@cotal-ai/manager 0.171.3 → 0.171.5

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 (107) hide show
  1. package/dist/boot.d.ts +162 -0
  2. package/dist/boot.d.ts.map +1 -0
  3. package/dist/boot.js +627 -0
  4. package/dist/boot.js.map +1 -0
  5. package/dist/broker-transport.d.ts +132 -0
  6. package/dist/broker-transport.d.ts.map +1 -0
  7. package/dist/broker-transport.js +282 -0
  8. package/dist/broker-transport.js.map +1 -0
  9. package/dist/command-dispatch.d.ts +3 -0
  10. package/dist/command-dispatch.d.ts.map +1 -1
  11. package/dist/command-dispatch.js +67 -0
  12. package/dist/command-dispatch.js.map +1 -1
  13. package/dist/connector-inventory.d.ts +40 -0
  14. package/dist/connector-inventory.d.ts.map +1 -0
  15. package/dist/connector-inventory.js +90 -0
  16. package/dist/connector-inventory.js.map +1 -0
  17. package/dist/credential-renewal.d.ts +5 -1
  18. package/dist/credential-renewal.d.ts.map +1 -1
  19. package/dist/credential-renewal.js +65 -3
  20. package/dist/credential-renewal.js.map +1 -1
  21. package/dist/goal-writer.d.ts +3 -0
  22. package/dist/goal-writer.d.ts.map +1 -1
  23. package/dist/goal-writer.js +30 -0
  24. package/dist/goal-writer.js.map +1 -1
  25. package/dist/harness-resolution.d.ts +74 -0
  26. package/dist/harness-resolution.d.ts.map +1 -0
  27. package/dist/harness-resolution.js +125 -0
  28. package/dist/harness-resolution.js.map +1 -0
  29. package/dist/lease-keeper.d.ts +4 -0
  30. package/dist/lease-keeper.d.ts.map +1 -1
  31. package/dist/lease-keeper.js +10 -0
  32. package/dist/lease-keeper.js.map +1 -1
  33. package/dist/managed-static-lifecycle.d.ts +3 -0
  34. package/dist/managed-static-lifecycle.d.ts.map +1 -1
  35. package/dist/managed-static-lifecycle.js +42 -0
  36. package/dist/managed-static-lifecycle.js.map +1 -1
  37. package/dist/manager.d.ts +613 -553
  38. package/dist/manager.d.ts.map +1 -1
  39. package/dist/manager.js +192 -3621
  40. package/dist/manager.js.map +1 -1
  41. package/dist/names-capacity.d.ts +4 -0
  42. package/dist/names-capacity.d.ts.map +1 -1
  43. package/dist/names-capacity.js +29 -0
  44. package/dist/names-capacity.js.map +1 -1
  45. package/dist/persona-catalog.d.ts +3 -0
  46. package/dist/persona-catalog.d.ts.map +1 -1
  47. package/dist/persona-catalog.js +19 -0
  48. package/dist/persona-catalog.js.map +1 -1
  49. package/dist/preservation.d.ts +160 -0
  50. package/dist/preservation.d.ts.map +1 -0
  51. package/dist/preservation.js +631 -0
  52. package/dist/preservation.js.map +1 -0
  53. package/dist/preserved-resume.d.ts +220 -0
  54. package/dist/preserved-resume.d.ts.map +1 -0
  55. package/dist/preserved-resume.js +1222 -0
  56. package/dist/preserved-resume.js.map +1 -0
  57. package/dist/readiness-wait.d.ts +67 -0
  58. package/dist/readiness-wait.d.ts.map +1 -0
  59. package/dist/readiness-wait.js +255 -0
  60. package/dist/readiness-wait.js.map +1 -0
  61. package/dist/retirement.d.ts +4 -0
  62. package/dist/retirement.d.ts.map +1 -1
  63. package/dist/retirement.js +29 -0
  64. package/dist/retirement.js.map +1 -1
  65. package/dist/seat-custody.d.ts +4 -0
  66. package/dist/seat-custody.d.ts.map +1 -1
  67. package/dist/seat-custody.js +25 -0
  68. package/dist/seat-custody.js.map +1 -1
  69. package/dist/seat-launch.d.ts +3 -0
  70. package/dist/seat-launch.d.ts.map +1 -1
  71. package/dist/seat-launch.js +69 -0
  72. package/dist/seat-launch.js.map +1 -1
  73. package/dist/seat-stop.d.ts +3 -0
  74. package/dist/seat-stop.d.ts.map +1 -1
  75. package/dist/seat-stop.js +40 -0
  76. package/dist/seat-stop.js.map +1 -1
  77. package/dist/seat-types.d.ts +6 -6
  78. package/dist/seat-types.d.ts.map +1 -1
  79. package/dist/serve-plane.d.ts +4 -0
  80. package/dist/serve-plane.d.ts.map +1 -1
  81. package/dist/serve-plane.js +76 -0
  82. package/dist/serve-plane.js.map +1 -1
  83. package/dist/session-recovery.d.ts +4 -0
  84. package/dist/session-recovery.d.ts.map +1 -1
  85. package/dist/session-recovery.js +31 -0
  86. package/dist/session-recovery.js.map +1 -1
  87. package/dist/spawn-goal.d.ts +3 -0
  88. package/dist/spawn-goal.d.ts.map +1 -1
  89. package/dist/spawn-goal.js +23 -0
  90. package/dist/spawn-goal.js.map +1 -1
  91. package/dist/start-doors.d.ts +54 -0
  92. package/dist/start-doors.d.ts.map +1 -0
  93. package/dist/start-doors.js +201 -0
  94. package/dist/start-doors.js.map +1 -0
  95. package/dist/status-and-models.d.ts +158 -0
  96. package/dist/status-and-models.d.ts.map +1 -0
  97. package/dist/status-and-models.js +330 -0
  98. package/dist/status-and-models.js.map +1 -0
  99. package/dist/terminal-input.d.ts +3 -0
  100. package/dist/terminal-input.d.ts.map +1 -1
  101. package/dist/terminal-input.js +12 -0
  102. package/dist/terminal-input.js.map +1 -1
  103. package/dist/user-provision.d.ts +4 -0
  104. package/dist/user-provision.d.ts.map +1 -1
  105. package/dist/user-provision.js +17 -0
  106. package/dist/user-provision.js.map +1 -1
  107. package/package.json +12 -12
package/dist/manager.d.ts CHANGED
@@ -1,17 +1,49 @@
1
- import { type DeprovisionResourceAccounting, type IssuedBinding } from "@cotal-ai/core";
2
- import { type SeatCap } from "@cotal-ai/workspace";
3
- import type { PersonaEndpoint, Connector, ControlReply, EpCaller, RuntimeReference, SecretStore } from "@cotal-ai/core";
1
+ import { UserProvision, type ProvisionUserAgentOpts, type ProvisionedUserAgent, type UserAgentRefusal } from "./user-provision.js";
2
+ import { TurnRelay, type OnceRetire, type TurnAcceptance } from "./turn-relay.js";
3
+ import { CotalEndpoint, type DeprovisionResourceAccounting, type IssuedBinding, type IssuedStore } from "@cotal-ai/core";
4
+ import { retainConnectorSeat } from "@cotal-ai/workspace";
5
+ import { type ManagerInstanceIdentity, type SeatCap } from "@cotal-ai/workspace";
6
+ import type { ActionContext, EpCapability, PersonaEndpoint, RunAdmission, Connector, ControlReply, DelegatedGrant, EpCaller, LaunchSpec, ManagerLeaseInfo, Presence, RuntimeReference, SecretStore, SecretStoreIdentity, SpaceAuth, StartupOutcome } from "@cotal-ai/core";
4
7
  import { type AgentHandle, type Runtime, type RuntimeMode } from "./runtime/index.js";
5
- import type { SpawnHooks, StartAgentOpts } from "./seat-types.js";
8
+ import { Retirement, type TeardownTarget } from "./retirement.js";
9
+ import type { ManagedAgent, SpawnAcceptance, SpawnHooks, StartAgentOpts } from "./seat-types.js";
6
10
  export type { ManagedAgent, SpawnAcceptance, SpawnHooks, StartAgentOpts } from "./seat-types.js";
11
+ import { NamesCapacity, type Occupancy } from "./names-capacity.js";
12
+ import { AttachEndpoint } from "./attach-endpoint.js";
13
+ import { ManagedStaticLifecycle } from "./managed-static-lifecycle.js";
7
14
  export { STATIC_RECONCILE_RETRY_DELAYS_MS } from "./managed-static-lifecycle.js";
8
15
  export { credRenewIntervalMs } from "./credential-renewal.js";
9
16
  export { ManagerInstanceLeaseHeld } from "./lease-keeper.js";
17
+ import { SessionRecovery } from "./session-recovery.js";
18
+ import { SeatCustody } from "./seat-custody.js";
19
+ import { GoalWriter } from "./goal-writer.js";
20
+ import { SeatStop } from "./seat-stop.js";
10
21
  import { CommandDispatch } from "./command-dispatch.js";
22
+ import { SpawnGoal } from "./spawn-goal.js";
23
+ import { PersonaCatalog } from "./persona-catalog.js";
24
+ import { TerminalInput } from "./terminal-input.js";
25
+ import { StatusAndModels } from "./status-and-models.js";
26
+ import { ReadinessWait } from "./readiness-wait.js";
27
+ import { BrokerTransport } from "./broker-transport.js";
28
+ import { StartDoors } from "./start-doors.js";
29
+ import { HarnessResolution } from "./harness-resolution.js";
30
+ import { ConnectorInventory } from "./connector-inventory.js";
31
+ import { Preservation } from "./preservation.js";
32
+ import { PreservedResume } from "./preserved-resume.js";
11
33
  export { PASTE_END, PASTE_START, RUNTIME_NO_TERMINAL_DETAIL } from "./terminal-input.js";
12
34
  import { CredentialRenewal } from "./credential-renewal.js";
13
- import { type EpServeGrant, type Identity } from "@cotal-ai/core";
14
- import { type ManagerStopImpact } from "./manager-service-contract.js";
35
+ import { SeatLaunch, type SpawnRun, type StaticSpawnBound } from "./seat-launch.js";
36
+ import { ManagerBoot } from "./boot.js";
37
+ import { RunHosting } from "./run-hosting.js";
38
+ import { type CleanupFailure } from "@cotal-ai/core";
39
+ import { type SeatRecord } from "./resume.js";
40
+ import { TranscriptReceiver } from "./transcript-receive.js";
41
+ import { type LifecycleStateTransport, type StaticManagedSlotRow } from "@cotal-ai/core";
42
+ import { ManagerSessionPlane } from "./session/index.js";
43
+ import { type EpIssuanceGate, type GoalIndexEntry, EpEnvelopeError, type EpServeContext, type EpServeGrant, type EpServeHandle, type GoalRef, type Identity } from "@cotal-ai/core";
44
+ import { type ManagerConnectorStatus, type ManagerStaticReconciliationStatus, type ManagerStopImpact } from "./manager-service-contract.js";
45
+ import type { NatsConnection } from "@nats-io/transport-node";
46
+ import type { KV } from "@nats-io/kv";
15
47
  /** Backstop for the detached-launch readiness race (#159 B1). `startAgent` waits on two REAL outcomes —
16
48
  * the assigned id joining the mesh (presence) = started, the child process exiting = failed — NOT a
17
49
  * liveness-inferring timer. This is only the last-resort bound for "neither happened in time": the launch
@@ -449,6 +481,15 @@ export interface ManagerResumeResult {
449
481
  }>;
450
482
  error?: string;
451
483
  }
484
+ /** One native personal lifecycle that may receive workflow turns through this manager. */
485
+ interface PersonalTurnParticipant {
486
+ name: string;
487
+ owner: string;
488
+ actor: string;
489
+ uid: string;
490
+ generation?: string;
491
+ expiresAt: number;
492
+ }
452
493
  /**
453
494
  * The agent supervisor: a long-lived mesh node that owns agent process lifecycle.
454
495
  * It serves control requests on the "manager" service and spawns/kills agents
@@ -456,29 +497,29 @@ export interface ManagerResumeResult {
456
497
  * mesh traffic — terminal I/O streams over its own attach endpoint instead.
457
498
  */
458
499
  export declare class Manager {
459
- private readonly space;
460
- private readonly servers;
500
+ protected readonly space: string;
501
+ protected readonly servers: string | undefined;
461
502
  /** The broker ws listener port (loopback) `cotal up` allocated, for the console session
462
503
  * client's wsUrl. Undefined ⇒ no console session client (POST /session 503s). */
463
- private readonly wsPort?;
464
- private readonly name;
465
- private readonly workspaceRoot;
466
- private readonly eventsRequired;
467
- private readonly eventPayloadsWithheld;
504
+ protected readonly wsPort?: number;
505
+ protected readonly name: string;
506
+ protected readonly workspaceRoot: string;
507
+ protected readonly eventsRequired: boolean;
508
+ protected readonly eventPayloadsWithheld: boolean;
468
509
  /** The operator-set global live-session ceiling (see {@link ManagerOptions.maxSessions}). */
469
- private readonly maxSessions?;
510
+ protected readonly maxSessions?: number;
470
511
  /** The operator-set per-owner seat ceiling (see {@link ManagerOptions.seatCap}). */
471
- private readonly seatCap;
512
+ protected readonly seatCap: SeatCap;
472
513
  /** The ONE secret store for every kind this manager touches (daemon-cred remint + agent kinds).
473
514
  * See {@link ManagerOptions.secretStore}. */
474
- private readonly secrets;
515
+ protected readonly secrets: SecretStore;
475
516
  /** Named identity of {@link secrets}: the same coordinate the delivery daemon must reload from.
476
517
  * Set at construction for an injected store; the workspace store is named on first challenge. */
477
- private secretStoreIdentity?;
518
+ protected secretStoreIdentity?: SecretStoreIdentity;
478
519
  /** See {@link ManagerOptions.installedExtensions}. */
479
- private readonly installedExtensions;
480
- private readonly expectedConnectorGeneration;
481
- private readonly machineSetupCommand?;
520
+ protected readonly installedExtensions: boolean;
521
+ protected readonly expectedConnectorGeneration: string;
522
+ protected readonly machineSetupCommand?: string;
482
523
  private readonly executionState;
483
524
  private readonly runtime;
484
525
  /** One backend per kind a seat has asked for, beside {@link runtime}. The manager's own runtime
@@ -488,45 +529,51 @@ export declare class Manager {
488
529
  * already refused for the manager's own. */
489
530
  private readonly pooled;
490
531
  /** Internal test seam. Production leaves this undefined and uses the scoped delivery-admin evictor. */
491
- private staticLifecycleEvict?;
492
- private readonly preserveStopTimeoutMs;
493
- private readonly endpointServeExecutorExpiresInSeconds?;
494
- private readonly agents;
532
+ protected staticLifecycleEvict?: (principal: string) => Promise<import("@cotal-ai/core").EvictionResult>;
533
+ protected readonly preserveStopTimeoutMs: number;
534
+ protected readonly endpointServeExecutorExpiresInSeconds?: number;
535
+ protected readonly agents: Map<string, ManagedAgent>;
495
536
  /** Lifecycle UIDs already handed to `Runtime.spawnDelegated`: a lifecycle is handed off at most
496
537
  * once, so a lost create acknowledgement can never become a second create. */
497
- private readonly delegatedLaunched;
538
+ protected readonly delegatedLaunched: Set<string>;
498
539
  /** This manager process's own incarnation uid (SPEC 13.1; minted once per supervisor process,
499
540
  * never reused across restarts) — the endpoint's presence key AND the `managerInstance` audit
500
541
  * coordinate every static activation records. */
501
- private readonly managerLifecycleUid;
542
+ protected readonly managerLifecycleUid: string;
502
543
  /** The persisted LOGICAL instance id (SPEC 13.6 item 7): STABLE across restart, so a
503
544
  * restart re-registers the SAME id with an ADVANCED epoch through the §13.1 gate (the successor
504
545
  * fences the predecessor's epoch — the (i) fence bites on a real restart). It is the registration
505
546
  * instanceId, the served-status id, the goal spec's executor.instanceId, the epe route, and the
506
547
  * resolveExecutorEpoch key — DISTINCT from {@link managerLifecycleUid} (per-process: the presence
507
548
  * node uid + the managerInstance audit coordinate every static activation records). Set in start(). */
508
- private managerInstanceId;
549
+ protected managerInstanceId: string;
509
550
  /** The persisted serve nkey identity: reusing the SAME principal across restart keeps
510
551
  * {@link provisionEndpointGateOpen} idempotent (no core barrier change) and gives verified
511
552
  * eviction a stable target (the predecessor's connections under this principal). Set in start(). */
512
- private managerServeIdentity;
553
+ protected managerServeIdentity: Identity;
513
554
  /** The local instance identity {@link admitExecutionState} already resolved. The ordinary start
514
555
  * adopts it instead of reading the same record again. */
515
- private admittedLocalIdentity?;
516
- private readonly onServiceIdentity?;
556
+ protected admittedLocalIdentity?: ManagerInstanceIdentity;
557
+ protected readonly onServiceIdentity?: ManagerOptions["onServiceIdentity"];
517
558
  /** The manager's v0.4 service-endpoint serve state — the serve handle +
518
559
  * its dedicated connection, the STABLE serve identity (renewals re-mint the same nkey), the
519
560
  * branded serve grant, and the CURRENT credential (the connection's authenticator reads it on
520
561
  * every (re)connect, so a renewal is adopted without re-registration). Absent on open meshes,
521
562
  * in user mode, and before registration completes. */
522
- private serviceServe?;
563
+ protected serviceServe?: {
564
+ handle: EpServeHandle;
565
+ nc: NatsConnection;
566
+ identity: Identity;
567
+ grant: EpServeGrant;
568
+ creds?: string;
569
+ };
523
570
  /** #1577: dedicated connections (serve, goal-writer, session-ledger) whose transport is down while
524
571
  * the client reconnects them, tracked by {@link trackTransport}. Such a connection is open
525
572
  * (`isClosed()` is false under unbounded reconnects) yet the broker holds none of its rails, so
526
573
  * the liveness responder must not grade the serve connection `bound`, and a stop closes rather
527
574
  * than drains it ({@link retireConnection}). Keyed by the connection, so a re-dial that swaps in a
528
575
  * fresh one starts from its own state. */
529
- private readonly transportDown;
576
+ protected readonly transportDown: WeakSet<NatsConnection>;
530
577
  /** The spawn-as-action SELF-MEDIATED goal-writer connection + ActionContext — a
531
578
  * standing connection DISJOINT from the serve credential, scoped to exactly this endpoint's
532
579
  * goal bind/terminal facts + goal-record writes ({@link goalWriterGrants}). Auth mode mints the
@@ -534,177 +581,186 @@ export declare class Manager {
534
581
  * `gate` (auth mode) is the own-issuance-gate READER for the own-gate currency belt — the
535
582
  * manager reads its OWN `epgate.<e>.<iid>` epoch over this connection before a terminal commit
536
583
  * and skips a superseded commit (the fast-fail belt paired with the (b) barrier-revoke fence). */
537
- private goalWriter?;
584
+ protected goalWriter?: {
585
+ nc: NatsConnection;
586
+ ctx: ActionContext;
587
+ creds?: string;
588
+ identity: Identity;
589
+ gate?: EpIssuanceGate;
590
+ };
538
591
  /** The workflow-run host (SPEC 14.3): the drives this incarnation holds, each on its own
539
592
  * per-run credential and connection. Absent under a remote authority, which mints no driver
540
593
  * credentials, so the `run-*` family refuses there rather than connecting on a weaker identity. */
541
- private runHosting?;
594
+ protected runHosting?: RunHosting;
542
595
  /** The STABLE goal-writer identity (auth mode) — minted once at
543
596
  * registration alongside the serve identity; a renewal re-mints the SAME nkey with a fresh
544
597
  * bounded exp and re-stages its distinct credId into the §13.1 revocation family. The current
545
598
  * goal-writer credential is minted INSIDE {@link registerManagerService}'s run block (fence
546
599
  * live) and stashed here for {@link startGoalWriter} to build the standing connection from. */
547
- private goalWriterIdentity?;
548
- private goalWriterCreds?;
600
+ protected goalWriterIdentity?: Identity;
601
+ protected goalWriterCreds?: string;
549
602
  /** The manager's ONE §13.6 session plane — offer mint + one-use redeem + PTY-bridge
550
603
  * standup for `attach`. The face's establisher and the CLI attach handler both call THIS one
551
604
  * plane; the manager never constructs a second. Undefined until {@link startSessionPlane}. */
552
- private sessionPlane?;
605
+ protected sessionPlane?: ManagerSessionPlane;
553
606
  /** The standing session-LEDGER connection + its mutable creds holder (the authenticator
554
607
  * presents the refreshed cred on the next reconnect after a half-TTL renewal — the goal-writer
555
608
  * precedent). Auth mode only; an open mesh runs the plane over a bare connection. */
556
- private sessionLedgerConn?;
609
+ protected sessionLedgerConn?: {
610
+ nc: NatsConnection;
611
+ creds?: string;
612
+ };
557
613
  /** Renews the session signing key long before its window closes. A key that expires unattended
558
614
  * takes the whole session plane down until the manager is restarted, which kills live sessions. */
559
- private sessionKeyRenewTimer?;
615
+ protected sessionKeyRenewTimer?: ReturnType<typeof setInterval>;
560
616
  /** The STABLE session-LEDGER identity (auth mode) — minted once at registration
561
617
  * alongside the serve + goal-writer identities; a renewal re-mints the SAME nkey with a fresh
562
618
  * bounded exp and re-stages its distinct credId into the §13.1 revocation family. The current
563
619
  * credential is minted INSIDE {@link registerManagerService}'s run block and stashed here. */
564
- private sessionLedgerIdentity?;
565
- private sessionLedgerCreds?;
620
+ protected sessionLedgerIdentity?: Identity;
621
+ protected sessionLedgerCreds?: string;
566
622
  /** The acceptance replied for each goal this incarnation accepted, by {@link goalKey}, so an
567
623
  * idempotent same-goalId retry serves the IDENTICAL acceptance (same allocated name/triple)
568
624
  * without a second spawn. An entry lives while its goal is in flight and for
569
625
  * {@link goalAcceptanceRetentionMs} after its terminal commits; a later retry, or one at another
570
626
  * incarnation, is answered from the goal index while the goal runs and from its committed
571
627
  * result fact once it has ended. */
572
- private goalAcceptances;
628
+ protected goalAcceptances: Map<string, SpawnAcceptance>;
573
629
  /** How long a terminal goal's acceptance stays in {@link goalAcceptances}: the retry window its
574
630
  * turn twin keeps a settled answer for. An instance field so a test can shorten it. */
575
- private goalAcceptanceRetentionMs;
631
+ protected goalAcceptanceRetentionMs: number;
576
632
  /** The boot reconcile of the durable goal index runs ONCE at start (a
577
633
  * fresh incarnation inherits the endpoint's accepted-but-unterminal goals from any predecessor).
578
634
  * Spawn-as-action REFUSES to accept until it completes, so the sweep never races a live goal's
579
635
  * acceptance (settling one mid-flight would steal its real terminal). */
580
- private goalReconcileDone;
636
+ protected goalReconcileDone: boolean;
581
637
  /** The live spawn goal ref for each managed agent name, so a despawn MID-GOAL
582
638
  * drives the cancel path (transition -> cancel terminal). Cleared when the goal terminalizes. */
583
- private agentGoals;
639
+ protected agentGoals: Map<string, GoalRef>;
584
640
  private turnRelayInstance?;
585
- private get turnRelay();
586
- private readonly participants;
641
+ protected get turnRelay(): TurnRelay;
642
+ protected readonly participants: Map<string, PersonalTurnParticipant>;
587
643
  /** Once tasks whose seat's exit is watched: that exit, not the spawn's outcome, settles the debt. */
588
- private readonly onceWatched;
644
+ protected readonly onceWatched: Set<string>;
589
645
  /** Process start, for the served `status` uptime. */
590
- private readonly startedAtMs;
646
+ protected readonly startedAtMs: number;
591
647
  /** Connector harness inventory. Available paths stay pinned; unavailable rows are retried when
592
648
  * launch, model lookup or status asks, without stopping unrelated Manager work. */
593
- private connectorStatuses;
594
- private connectorRequirements;
649
+ protected connectorStatuses: ManagerConnectorStatus[];
650
+ protected connectorRequirements: Map<string, {
651
+ requires: readonly string[];
652
+ needsClaudeWake: boolean;
653
+ }>;
595
654
  private claudeWakeRecheck?;
596
655
  /** The boot inventory's warnings, printed once start completes, so a refused start prints none. */
597
- private bootNotes;
656
+ protected bootNotes: string[];
598
657
  /** The complete boot task. stop() joins it after fencing static reconciliation, so a registration
599
658
  * already past an earlier shutdown check cannot finish after stop() returns. */
600
659
  private startTask?;
601
660
  /** This instance's side of a carried resume transcript (#1499); absent where it has no transfer reader. */
602
- private transcripts?;
661
+ protected transcripts?: TranscriptReceiver;
603
662
  /** The one stop this manager runs, with the agent policy it was asked for. A stop takes seats out
604
663
  * of `agents` before they have exited, so a second teardown would find none and report success
605
664
  * while the first still waits on a live seat. */
606
665
  private stopTask?;
607
666
  /** Held as an instance field so broker-owning smokes can compress the schedule without changing
608
667
  * production semantics. It is never a fence expiry: the durable non-retired row stays authoritative. */
609
- private staticReconcileRetryDelaysMs;
668
+ protected staticReconcileRetryDelaysMs: readonly number[];
610
669
  /** Retirements holding one of the {@link RETIREMENT_CONCURRENCY} slots. */
611
670
  private retirementsRunning;
612
671
  /** Retirements waiting for a slot, oldest first. */
613
672
  private readonly retirementQueue;
614
- private readonly attach;
615
- private ep;
673
+ protected readonly attach: AttachEndpoint;
674
+ protected ep: CotalEndpoint;
616
675
  /** Space trust material when the mesh runs in auth mode (`.cotal/auth` present);
617
676
  * the manager mints per-agent creds from it at spawn. Undefined when the mesh is open. */
618
- private auth?;
677
+ protected auth?: SpaceAuth;
619
678
  /** Readiness-race backstop (#159 B1) — the {@link READINESS_TIMEOUT_MS} constant, held as an instance
620
679
  * field so a test can shorten it (the join/exit signals are event-driven; only the backstop is timed).
621
680
  * Production leaves it at the constant. */
622
- private readinessTimeoutMs;
681
+ protected readinessTimeoutMs: number;
623
682
  /** True on a USER-AUTH space (the on-disk marker; cross-checked against the registry at start).
624
683
  * Gates the whole spawn path: user mode grants ledger actors + bearer plumbing, never static mints. */
625
- private userMode;
626
- private readonly namesCapacity;
684
+ protected userMode: boolean;
685
+ protected readonly namesCapacity: NamesCapacity;
627
686
  private readonly servePlane;
628
- private resolveServeTarget;
629
- private readonly retirement;
687
+ protected resolveServeTarget(t: {
688
+ owner: string;
689
+ actor: string;
690
+ }): {
691
+ lifecycleUid: string;
692
+ mappingRevision: number;
693
+ } | undefined;
694
+ protected readonly retirement: Retirement;
630
695
  private readonly lease;
631
- private get leaseInfo();
632
- private set leaseInfo(value);
633
- private get leaseRevision();
634
- private set leaseRevision(value);
635
- private get leaseTimer();
636
- private set leaseTimer(value);
696
+ protected get leaseInfo(): Omit<ManagerLeaseInfo, "since"> | undefined;
697
+ protected set leaseInfo(info: Omit<ManagerLeaseInfo, "since"> | undefined);
698
+ protected get leaseRevision(): number | undefined;
699
+ protected set leaseRevision(revision: number | undefined);
700
+ protected get leaseTimer(): ReturnType<typeof setInterval> | undefined;
701
+ protected set leaseTimer(timer: ReturnType<typeof setInterval> | undefined);
637
702
  private get leaseRenewTask();
638
- private acquireInstanceLease;
639
- private renewLease;
703
+ protected acquireInstanceLease(info: Omit<ManagerLeaseInfo, "since">): Promise<number>;
704
+ protected renewLease(): Promise<void>;
640
705
  private releaseOwnManagerLease;
641
706
  /** Set at the top of `stop()`. `renewLease` returns at once once this is set, and its `gone` arm
642
707
  * does not re-acquire: a manager that is stopping never puts its own key back. It also closes the
643
708
  * lifecycle fence ({@link beginLifecycle}), so no spawn can launch a seat the stop never sees. */
644
- private leaseStopping;
645
- private readonly shutdownReadiness;
709
+ protected leaseStopping: boolean;
710
+ protected readonly shutdownReadiness: AbortController;
646
711
  /** The class-2 renewal owner's half-TTL schedule; armed only on auth meshes. */
647
- private credRenewTimer?;
648
- private resumeCredRenewal?;
712
+ protected credRenewTimer?: ReturnType<typeof setInterval>;
713
+ protected resumeCredRenewal?: () => void;
649
714
  /** #2073: the `endpoint-serve` credential's OWN renewal, armed from its `[renewAt, exp)` window
650
715
  * (`credsRenewalDelayMs`) rather than left to `credRenewTimer`'s boot-phased TTL/4 tick, which can
651
716
  * miss the window by ordering. Re-armed at registration and after every successful re-mint;
652
717
  * cleared in `stop()` beside `credRenewTimer`. */
653
- private endpointServeRenewalTimer?;
718
+ protected endpointServeRenewalTimer?: ReturnType<typeof setTimeout>;
654
719
  /** #1634: does THIS manager own the delivery daemon's credential renewal? True only while the
655
720
  * daemon reloads from this manager's store AND this manager holds the per-space renewal lease.
656
721
  * Starts false: a manager that has not proved both must not remint. */
657
- private daemonRenewalOwner;
722
+ protected daemonRenewalOwner: boolean;
658
723
  /** #2561: may the lease heartbeat contend at all? Set by every claim, false while the daemon names
659
724
  * another store or the challenge refused. Without it the heartbeat re-takes the lease the claim
660
725
  * just released and holds it against every manager and `doctor auth --fix` that can remint. */
661
- private daemonRenewalEligible;
662
- private daemonRenewalLeaseTimer?;
663
- private maintenanceState;
664
- private lifecycleInFlight;
726
+ protected daemonRenewalEligible: boolean;
727
+ protected daemonRenewalLeaseTimer?: ReturnType<typeof setInterval>;
728
+ protected maintenanceState: ManagerMaintenanceState;
729
+ protected lifecycleInFlight: number;
665
730
  private lifecycleDrainWaiters;
666
- private preservationTask?;
667
- private preparationTask?;
668
- private preservationGeneration;
669
- private preservationAttemptId?;
670
- private preservationStarted;
671
- private preservationFailures;
672
- private unverifiedStops;
673
- private preservationInventory?;
674
- private resumeAttemptId?;
675
- private resumeInventoryDigest?;
676
- private resumeInventory?;
677
- private resumeTask?;
678
- private resumeResult?;
679
- private resumeRequired;
680
- private resumeAwaitingCommit;
681
- private resumeCommitted;
682
- private resumeCommitTask?;
683
- private resumeFinalized;
684
- private resumeDurableCommitToken?;
685
- private readonly resumedAgentNames;
686
- private readonly remoteAuthority?;
687
- private remoteExecutorCreds?;
688
- private remoteSupervisorCreds?;
689
- private remoteBundleRenewal?;
690
- private remoteBundleAdoption?;
691
- private finishRemoteBundleAdoption?;
731
+ protected preservationGeneration: number;
732
+ protected preservationAttemptId?: string;
733
+ protected unverifiedStops: Array<{
734
+ name: string;
735
+ id: string;
736
+ handle: AgentHandle;
737
+ authoritative?: boolean;
738
+ error?: string;
739
+ }>;
740
+ protected preservationInventory?: ManagerResumeInventory;
741
+ protected resumeAttemptId?: string;
742
+ protected resumeRequired: boolean;
743
+ protected resumeDurableCommitToken?: string;
744
+ protected readonly remoteAuthority?: NonNullable<ManagerOptions["remoteAuthority"]>;
745
+ protected remoteExecutorCreds?: string;
746
+ protected remoteSupervisorCreds?: string;
747
+ protected remoteBundleRenewal?: Promise<void>;
748
+ protected remoteBundleAdoption?: Promise<void>;
749
+ protected finishRemoteBundleAdoption?: () => void;
692
750
  /** A refused or failed standing candidate is cleanup debt, never a silent loss: the last-good
693
751
  * family stays live and this records what the host may have signed but the manager never adopted. */
694
- private remoteRenewalDebt?;
695
- /** Every broker dial this manager makes, through ONE transport decision.
696
- *
697
- * `this.servers` is whatever the mesh record held (`cotal supervise` reads it from there), so it
698
- * can be a `ws://`/`wss://` broker published through an HTTPS edge. The raw node transport
699
- * refuses such a URL instead of dialing it, so the scheme picks the dialer here rather than at
700
- * thirteen call sites. `dialerFor` also owns the websocket transport's options, which is why
701
- * callers below still pass their own auth options unchanged. */
702
- private dial;
703
- /** Initial NATS timeout is per dial, not per server list. Keep the aggregate deadline too, and
704
- * close a late result rather than letting an abandoned preflight or recovery install a transport. */
705
- private dialRemoteStanding;
706
- private readonly seatCustody;
707
- private readonly sessionRecovery;
752
+ protected remoteRenewalDebt?: {
753
+ at: number;
754
+ processEpoch: number;
755
+ reason: string;
756
+ unadoptedSubjects: string[];
757
+ };
758
+ /** {@link BrokerTransport.dial}. */
759
+ protected dial(...args: Parameters<BrokerTransport["dial"]>): ReturnType<BrokerTransport["dial"]>;
760
+ /** {@link BrokerTransport.dialRemoteStanding}. */
761
+ protected dialRemoteStanding(...args: Parameters<BrokerTransport["dialRemoteStanding"]>): ReturnType<BrokerTransport["dialRemoteStanding"]>;
762
+ protected readonly seatCustody: SeatCustody;
763
+ protected readonly sessionRecovery: SessionRecovery;
708
764
  get staticReconcileLastSweepResources(): {
709
765
  slots: {
710
766
  examined: number;
@@ -729,9 +785,9 @@ export declare class Manager {
729
785
  };
730
786
  deprovision?: DeprovisionResourceAccounting;
731
787
  } | undefined);
732
- private readonly staticLifecycle;
788
+ protected readonly staticLifecycle: ManagedStaticLifecycle;
733
789
  /** User-mode provisioning owns no manager state: each dependency reads through at its use. */
734
- private readonly userProvision;
790
+ protected readonly userProvision: UserProvision;
735
791
  /** Seat stop, exit, recursive reap and named despawn. Every dependency reads through at its use. */
736
792
  private readonly seatStopComponent;
737
793
  /** The typed command table and its admission. Every dependency reads through at its use. */
@@ -742,12 +798,30 @@ export declare class Manager {
742
798
  private readonly personaCatalogComponent;
743
799
  /** Seat terminal input and attach sessions. Every dependency reads through at its use. */
744
800
  private readonly terminalInputComponent;
801
+ /** Status, seat list and model catalog reads. Every dependency reads through at its use. */
802
+ private readonly statusAndModelsComponent;
803
+ /** The launch readiness race and exit watch. Every dependency reads through at its use. */
804
+ private readonly readinessWaitComponent;
805
+ /** Broker dials and scoped executor connections. Every dependency reads through at its use. */
806
+ private readonly brokerTransportComponent;
807
+ /** The start and launch control doors. Every dependency reads through at its use. */
808
+ private readonly startDoorsComponent;
809
+ /** Connector and harness resolution for a launch. Every dependency reads through at its use. */
810
+ private readonly harnessResolutionComponent;
811
+ /** The boot connector inventory. Every dependency reads through at its use. */
812
+ private readonly connectorInventoryComponent;
813
+ /** Manager preservation and released-seat adoption. Every dependency reads through at its use. */
814
+ private readonly preservationComponent;
815
+ /** Preserved-manager resume and its control doors. Every dependency reads through at its use. */
816
+ private readonly preservedResumeComponent;
745
817
  /** The goal-writer connection and the goal index it reconciles. Every dependency reads through at its use. */
746
818
  private readonly goalWriterComponent;
747
819
  /** Renewal of the manager's standing credentials. Every dependency reads through at its use. */
748
820
  private readonly credentialRenewal;
749
821
  /** The launch pipeline's leaf steps. Every dependency reads through at its use. */
750
822
  private readonly seatLaunch;
823
+ /** Manager boot: execution admission, connect, registration and lease. Every dependency reads through at its use. */
824
+ private readonly bootComponent;
751
825
  constructor(opts: ManagerOptions);
752
826
  get runtimeKind(): string;
753
827
  /** Whether this manager's runtime opens a terminal stream on the seats it spawns, so a caller
@@ -755,9 +829,9 @@ export declare class Manager {
755
829
  * spawns no seat, so it streams no terminal either. */
756
830
  get streamsTerminal(): boolean;
757
831
  get execution(): "runtime" | "none";
758
- private executionRefusal;
832
+ protected executionRefusal(): string;
759
833
  /** A defensive last barrier, not a substitute Runtime. Entry admission runs before effects. */
760
- private get requiredRuntime();
834
+ protected get requiredRuntime(): Runtime;
761
835
  /** Import the installed extension that provides a seat's runtime before {@link runtimeFor}
762
836
  * resolves it, as {@link resolveConnector} does for a connector. On the published binary the
763
837
  * manager process imports only its own runtime, so a seat that names another installed runtime
@@ -765,13 +839,13 @@ export declare class Manager {
765
839
  * live `cotal ext remove` refuses the next launch even while an earlier import keeps the provider
766
840
  * registered; seats already on that runtime keep their cached backend. A library composition
767
841
  * resolves only what its root imported. The refusal names an official runtime's package. */
768
- private loadSeatRuntime;
842
+ protected loadSeatRuntime(kind: string | undefined): Promise<void>;
769
843
  /** The backend one seat launches, restarts, and is reaped through. An omitted or blank choice is
770
844
  * this manager's own runtime. A named one is created once, cached by its resolved kind, and reused
771
845
  * for every later seat of that kind. The manager's own runtime is never replaced. An unknown or
772
846
  * unreachable runtime throws, and pooled control refuses a custodial one by the same rule the
773
847
  * constructor applied to the manager's own. */
774
- private runtimeFor;
848
+ protected runtimeFor(kind: string | undefined): Runtime;
775
849
  /** What a default process stop does with this manager's seats. `release` drops manager-local
776
850
  * custody and leaves every seat running. `stop` means this runtime keeps its PTYs inside the
777
851
  * manager process, so those seats close with it: the stop stops and deprovisions them, and still
@@ -789,7 +863,7 @@ export declare class Manager {
789
863
  attemptId: string;
790
864
  inventorySha256: string;
791
865
  } | undefined;
792
- private serviceIdentityObservation;
866
+ protected serviceIdentityObservation(): ManagerServiceIdentity;
793
867
  /** The console page URL (manager-hosted, loopback). */
794
868
  get consoleUrl(): string;
795
869
  /**
@@ -828,22 +902,13 @@ export declare class Manager {
828
902
  * "two arms" into "three arms". Switching on `meshMode` gives a fourth mesh mode nowhere to fall
829
903
  * silently, since `switch` has no default arm to catch it.
830
904
  */
831
- private get meshMode();
832
- /** The CHAT stream frontier at a preservation cut (issue #545), read through whichever local
833
- * authority this mesh mode holds: open mode's own endpoint already has `$JS.API.STREAM.INFO`
834
- * on the CHAT stream. Local and remote supervisor credentials also hold this metadata grant
835
- * for transcript startup checks, but this preservation path retains its existing local-authority
836
- * boundary. Static/user modes borrow the ephemeral `provisioner` profile the manager already
837
- * mints per spawn. A remote-authority manager (`this.auth`
838
- * undefined in static/user mode) has no local space authority to mint that provisioner with, so
839
- * it prints one line and returns no floor — the inventory then carries none and resumed seats
840
- * behave exactly as before this fix, not a silent partial degrade. */
841
- private chatFrontierForPreservation;
842
- private readerRemedy;
905
+ protected get meshMode(): "open" | "static" | "user";
906
+ protected readerRemedy(owner: string, channel: string): string;
843
907
  start(): Promise<void>;
844
- private executionRecordPath;
908
+ protected executionRecordPath(instanceId: string): string;
909
+ /** {@link ManagerBoot.claimExecutionRecord}. */
845
910
  private claimExecutionRecord;
846
- private admitExecutionState;
911
+ /** {@link ManagerBoot.runStart}. */
847
912
  private runStart;
848
913
  /** The delivery shard whose lease names the process that reloads the standing credentials.
849
914
  * Delivery is single-shard today and the endpoint's own responder reads row 0; naming it here
@@ -852,81 +917,62 @@ export declare class Manager {
852
917
  /** {@link CredentialRenewal.absentByLeaseRow}. */
853
918
  absentByLeaseRow(...args: Parameters<CredentialRenewal["absentByLeaseRow"]>): ReturnType<CredentialRenewal["absentByLeaseRow"]>;
854
919
  /** {@link CredentialRenewal.keepDaemonRenewalLease}. */
855
- private keepDaemonRenewalLease;
920
+ protected keepDaemonRenewalLease(...args: Parameters<CredentialRenewal["keepDaemonRenewalLease"]>): ReturnType<CredentialRenewal["keepDaemonRenewalLease"]>;
856
921
  /** {@link CredentialRenewal.claimDaemonRenewalOwnership}. */
857
- private claimDaemonRenewalOwnership;
922
+ protected claimDaemonRenewalOwnership(...args: Parameters<CredentialRenewal["claimDaemonRenewalOwnership"]>): ReturnType<CredentialRenewal["claimDaemonRenewalOwnership"]>;
858
923
  /** {@link CredentialRenewal.scheduleServeRenewal}. */
859
- private scheduleServeRenewal;
860
- private credentialPushRetry?;
861
- private readonly credentialPushes;
862
- private supervisorCredentialPush?;
863
- private readonly pendingCredentialPushes;
864
- private supervisorCredentialPushPending;
924
+ protected scheduleServeRenewal(...args: Parameters<CredentialRenewal["scheduleServeRenewal"]>): ReturnType<CredentialRenewal["scheduleServeRenewal"]>;
925
+ protected credentialPushRetry?: ReturnType<typeof setTimeout>;
926
+ protected readonly credentialPushes: Map<NatsConnection, Promise<void>>;
927
+ protected supervisorCredentialPush?: Promise<void>;
928
+ protected readonly pendingCredentialPushes: Set<NatsConnection>;
929
+ protected supervisorCredentialPushPending: boolean;
865
930
  /** {@link CredentialRenewal.boundedReconnect}. */
866
- private boundedReconnect;
931
+ protected boundedReconnect(...args: Parameters<CredentialRenewal["boundedReconnect"]>): ReturnType<CredentialRenewal["boundedReconnect"]>;
867
932
  /** {@link CredentialRenewal.renewDaemonCreds}. */
868
- private renewDaemonCreds;
933
+ protected renewDaemonCreds(...args: Parameters<CredentialRenewal["renewDaemonCreds"]>): ReturnType<CredentialRenewal["renewDaemonCreds"]>;
869
934
  /** {@link CredentialRenewal.renewRemoteExecutor}. */
870
- private renewRemoteExecutor;
935
+ protected renewRemoteExecutor(...args: Parameters<CredentialRenewal["renewRemoteExecutor"]>): ReturnType<CredentialRenewal["renewRemoteExecutor"]>;
871
936
  /** {@link CredentialRenewal.renewRemoteStandingBundle}. */
872
- private renewRemoteStandingBundle;
937
+ protected renewRemoteStandingBundle(...args: Parameters<CredentialRenewal["renewRemoteStandingBundle"]>): ReturnType<CredentialRenewal["renewRemoteStandingBundle"]>;
873
938
  /** {@link CredentialRenewal.renewRemoteBeforeRedial}. */
874
- private renewRemoteBeforeRedial;
939
+ protected renewRemoteBeforeRedial(...args: Parameters<CredentialRenewal["renewRemoteBeforeRedial"]>): ReturnType<CredentialRenewal["renewRemoteBeforeRedial"]>;
875
940
  /** Admit one lifecycle/control operation while active. The synchronous increment is the fence:
876
941
  * preserveState and stop close it before their first await, so work is either counted or rejected. */
877
- private beginLifecycle;
878
- private releaseLifecycle;
879
- private trackDeprovision;
880
- private awaitLifecycleDrain;
881
- private maintenanceError;
882
- /** Fence and build the inventory without stopping a child. The coordinator must durably persist
883
- * this exact plan before calling commitPreservation with the same attempt id. */
884
- preparePreservation(attemptId: string): Promise<ManagerPreservationPlan>;
885
- private assertPreservationGeneration;
886
- private runPreparation;
887
- /** Stop children only after the coordinator has persisted the prepared inventory. Same-attempt
888
- * retries are idempotent; a different attempt is refused. */
889
- commitPreservation(attemptId: string): Promise<ManagerPreserveResult>;
890
- /** Recover an abandoned prepare before any child stop. Once commit begins, preservation is
891
- * irreversible and remains fenced until the coordinator records failure/recourse. */
892
- abortPreservation(attemptId: string): void;
893
- /** In-process convenience that preserves the crash barrier by awaiting durable persistence between
894
- * prepare and commit. Wire callers use the explicit two-phase admin operations. */
895
- preserveState(opts: ManagerPreserveOptions): Promise<ManagerPreserveResult>;
896
- private runPreservation;
897
- private awaitHandleExit;
898
- private inventoryReferenceError;
899
- private fileDigest;
900
- private fileDigestOrEmpty;
901
- private resumeEntry;
902
- /** The resume entry of one live seat, with no side effect: a preservation cut and a supervised
903
- * seat's record both build it. The entry is its own copy, so a caller's write to the plan it was
904
- * handed cannot change the launch the manager keeps supervising (#3241). */
905
- private resumeEntryOf;
906
- /** Tear down every managed agent's footprint on an explicit destructive {@link stop}, or only the
907
- * in-process seats a default stop cannot detach. A manager exit is
908
- * a mass agent-exit, and without this its agents' footprints (creds files + `dm_`/`dlv_` durables + ACL
909
- * rows) would orphan exactly as the per-agent exit path prevents. Stop each child gracefully, so its
910
- * own shutdown runs before the runtime escalates, and AWAIT its deprovision — bounded per agent (`withTimeout`) and
911
- * best-effort (`allSettled` + a loud log), so one slow/failed teardown can neither hang nor abort exit.
912
- * The creds file is dropped even if the broker teardown fails (see {@link deprovision}). Deliberately
913
- * touches NEITHER the lease NOR the endpoints — the caller owns those. */
942
+ protected beginLifecycle(resumeOperation?: boolean): (() => void) | undefined;
943
+ protected releaseLifecycle(): void;
944
+ protected trackDeprovision(a: TeardownTarget, context?: string): void;
945
+ protected awaitLifecycleDrain(): Promise<void>;
946
+ protected maintenanceError(): string;
947
+ /** {@link Preservation.preparePreservation}. */
948
+ preparePreservation(...args: Parameters<Preservation["preparePreservation"]>): ReturnType<Preservation["preparePreservation"]>;
949
+ /** {@link Preservation.runPreparation}. */
950
+ runPreparation(...args: Parameters<Preservation["runPreparation"]>): ReturnType<Preservation["runPreparation"]>;
951
+ /** {@link Preservation.commitPreservation}. */
952
+ commitPreservation(...args: Parameters<Preservation["commitPreservation"]>): ReturnType<Preservation["commitPreservation"]>;
953
+ /** {@link Preservation.abortPreservation}. */
954
+ abortPreservation(...args: Parameters<Preservation["abortPreservation"]>): ReturnType<Preservation["abortPreservation"]>;
955
+ /** {@link Preservation.preserveState}. */
956
+ preserveState(...args: Parameters<Preservation["preserveState"]>): ReturnType<Preservation["preserveState"]>;
957
+ /** {@link Preservation.awaitHandleExit}. */
958
+ protected awaitHandleExit(...args: Parameters<Preservation["awaitHandleExit"]>): ReturnType<Preservation["awaitHandleExit"]>;
959
+ /** {@link Preservation.inventoryReferenceError}. */
960
+ protected inventoryReferenceError(...args: Parameters<Preservation["inventoryReferenceError"]>): ReturnType<Preservation["inventoryReferenceError"]>;
961
+ protected fileDigest(path: string): string;
962
+ /** {@link Preservation.fileDigestOrEmpty}. */
963
+ protected fileDigestOrEmpty(...args: Parameters<Preservation["fileDigestOrEmpty"]>): ReturnType<Preservation["fileDigestOrEmpty"]>;
964
+ /** {@link PreservedResume.resumeEntry}. */
965
+ protected resumeEntry(...args: Parameters<PreservedResume["resumeEntry"]>): ReturnType<PreservedResume["resumeEntry"]>;
966
+ /** {@link PreservedResume.resumeEntryOf}. */
967
+ protected resumeEntryOf(...args: Parameters<PreservedResume["resumeEntryOf"]>): ReturnType<PreservedResume["resumeEntryOf"]>;
968
+ /** {@link Preservation.teardownManagedAgents}. */
914
969
  private teardownManagedAgents;
915
- private isProcessBoundSeat;
916
- /** Drop local custody of every seat that can outlive this process, and leave it running. A seat
917
- * with a runtime reference is recorded first, so the next manager on this workspace adopts it, or
918
- * retires it once its runtime proves it gone. The stopping manager keeps no watch on a released
919
- * seat: its endpoint is closing, and a retirement it drove afterwards would run over a dead
920
- * connection and race the next manager's. `stop` is every seat left for the caller to stop and
921
- * retire now: an in-process seat, a seat the runtime already reports gone, and a seat whose record
922
- * could not be written, because a released seat nobody can find again is the leak this stop must
923
- * not create. */
970
+ /** {@link Preservation.isProcessBoundSeat}. */
971
+ protected isProcessBoundSeat(...args: Parameters<Preservation["isProcessBoundSeat"]>): ReturnType<Preservation["isProcessBoundSeat"]>;
972
+ /** {@link Preservation.releaseManagedAgents}. */
924
973
  private releaseManagedAgents;
925
- /** Take back user-mode seats a previous manager released while they were still running. A seat
926
- * the runtime adopts is watched, and retired when that watch proves it gone. A seat the runtime
927
- * has already reaped is retired now. Anything the runtime cannot prove is left recorded. */
928
- private adoptReleasedSeats;
929
- private adoptReleasedSeat;
974
+ /** {@link Preservation.adoptReleasedSeats}. */
975
+ protected adoptReleasedSeats(...args: Parameters<Preservation["adoptReleasedSeats"]>): ReturnType<Preservation["adoptReleasedSeats"]>;
930
976
  private stopRetainedAgentsOnExit;
931
977
  /** Every call joins the first stop and settles with it. A call that asks for a different
932
978
  * `withAgents` is refused, since the running stop has already applied its own policy. */
@@ -955,32 +1001,27 @@ export declare class Manager {
955
1001
  * and drop its dedicated connection, or only close the connection while its transport is down.
956
1002
  * Best-effort so a graceful stop completes its remaining teardown even when the broker is gone. */
957
1003
  private stopServiceServe;
958
- /** Retire a dedicated connection on stop: drain it while its transport is up, close it while the
959
- * client is reconnecting it. A drain on a reconnecting connection does not fail, it waits for the
960
- * reconnect, so the stop would last as long as the outage; a broker this connection cannot reach
961
- * has nothing left to flush. `flush` (the serve loop's own drain) runs only while the transport is
962
- * up. Best-effort, so a graceful stop completes its remaining teardown even when the broker is gone. */
963
- private retireConnection;
964
- /** A failed candidate must not extend preparation by draining subscriptions on a stalled socket.
965
- * Close only that candidate first. Native stop still owns any already-dispatched handlers, whose
966
- * outcomes remain unknown to callers and must not be replayed; they do not hold family adoption. */
967
- private discardServeCandidate;
968
- /** Track a dedicated connection's transport into {@link transportDown} from the first moment:
969
- * nats.js reports `disconnect` when the socket drops and `reconnect` only after it has re-sent the
970
- * connection's subscriptions. If the status stream itself fails, the transport can no longer be
971
- * observed, so it counts as down. */
972
- private trackTransport;
973
- private opFinalizeResume;
974
- private opCommitResume;
975
- private opResumePreserved;
976
- private opPreservationCtl;
1004
+ /** {@link BrokerTransport.retireConnection}. */
1005
+ protected retireConnection(...args: Parameters<BrokerTransport["retireConnection"]>): ReturnType<BrokerTransport["retireConnection"]>;
1006
+ /** {@link BrokerTransport.discardServeCandidate}. */
1007
+ protected discardServeCandidate(...args: Parameters<BrokerTransport["discardServeCandidate"]>): ReturnType<BrokerTransport["discardServeCandidate"]>;
1008
+ /** {@link BrokerTransport.trackTransport}. */
1009
+ protected trackTransport(...args: Parameters<BrokerTransport["trackTransport"]>): ReturnType<BrokerTransport["trackTransport"]>;
1010
+ /** {@link PreservedResume.opFinalizeResume}. */
1011
+ protected opFinalizeResume(...args: Parameters<PreservedResume["opFinalizeResume"]>): ReturnType<PreservedResume["opFinalizeResume"]>;
1012
+ /** {@link PreservedResume.opCommitResume}. */
1013
+ protected opCommitResume(...args: Parameters<PreservedResume["opCommitResume"]>): ReturnType<PreservedResume["opCommitResume"]>;
1014
+ /** {@link PreservedResume.opResumePreserved}. */
1015
+ protected opResumePreserved(...args: Parameters<PreservedResume["opResumePreserved"]>): ReturnType<PreservedResume["opResumePreserved"]>;
1016
+ /** {@link PreservedResume.opPreservationCtl}. */
1017
+ protected opPreservationCtl(...args: Parameters<PreservedResume["opPreservationCtl"]>): ReturnType<PreservedResume["opPreservationCtl"]>;
977
1018
  /** {@link CommandDispatch.admitControl}. */
978
1019
  private admitControl;
979
1020
  /** Run one v0.4 service-command handler through the SHARED admission chokepoint
980
1021
  * ({@link admitControl}) on the broker-authenticated caller principal, mapping the two fences
981
1022
  * onto the §13.3 catalog: maintenance/resume → `unavailable`, membership →
982
1023
  * `permission-denied`. The serve boundary publishes the structured error reply. */
983
- private serveGated;
1024
+ protected serveGated<T>(ctx: EpServeContext, fn: () => T | Promise<T>): Promise<T>;
984
1025
  /** `status` only: {@link serveGated}, except that a fully preserved manager, and an active one
985
1026
  * launched for a resume that has not committed it yet, still answer it. A preserved-exit stop's
986
1027
  * caller-attributed preview needs the preserved manager's stop impact, and a resumed service's
@@ -988,9 +1029,9 @@ export declare class Manager {
988
1029
  * states. The read is counted in `lifecycleInFlight` like any admitted operation and released in
989
1030
  * `finally`, so a drain waits at most for one status snapshot; the membership gate still
990
1031
  * applies. `preserving` and a stopping manager stay fenced. */
991
- private serveObservation;
1032
+ protected serveObservation<T>(ctx: EpServeContext, fn: () => T | Promise<T>): Promise<T>;
992
1033
  /** {@link CommandDispatch.epAdminReach}. */
993
- private epAdminReach;
1034
+ protected epAdminReach(...args: Parameters<CommandDispatch["epAdminReach"]>): ReturnType<CommandDispatch["epAdminReach"]>;
994
1035
  /** The run host, or one of three refusals. A remote-authority manager holds no space signer, so
995
1036
  * it cannot mint the per-run driver credential SPEC 14.6 requires without all four closed
996
1037
  * host callbacks. A local user-auth mesh is `unimplemented`: a hosted run's seats
@@ -1000,16 +1041,21 @@ export declare class Manager {
1000
1041
  * either. An ordinary manager whose host is not standing yet is still booting (the serve
1001
1042
  * surface comes up before the host): `unavailable`, retry. The three are told apart, since
1002
1043
  * the first sentence steers a caller to `--local` and the others must not. */
1003
- private runHost;
1044
+ protected runHost(): RunHosting;
1004
1045
  /** The answerer a `run-answer` records (SPEC 14.5): the caller as this manager knows them. A
1005
1046
  * managed seat is named by its persona name; any other authenticated caller (an operator
1006
1047
  * instrument, a logged-in user) by its principal. Never the request body's word. */
1007
- private runAnswerer;
1048
+ protected runAnswerer(ctx: EpServeContext): string;
1008
1049
  /** A baseline seat may answer only the pause whose relay is pending on that exact incarnation.
1009
1050
  * Explicit `run` holders and unmanaged operator instruments keep the run capability's existing
1010
1051
  * answer reach. The relay payload is manager-held state written by the runtime, never request
1011
1052
  * input, and its token is checked against the open checkpoint before any answer is filed. */
1012
- private authorizeRunAnswer;
1053
+ protected authorizeRunAnswer(ctx: EpServeContext, args: {
1054
+ runId: string;
1055
+ stepKey: string;
1056
+ }, open: {
1057
+ token: string;
1058
+ }): void;
1013
1059
  /** Find one exact live presence row. Presence is not authority, but a participation lease with no
1014
1060
  * live addressee would authorize a durable turn nobody can receive. Duplicate exact rows are
1015
1061
  * refused rather than selected by order. */
@@ -1017,19 +1063,35 @@ export declare class Manager {
1017
1063
  /** Authorize and renew one personal native participant. Local user-auth authority reads the exact
1018
1064
  * managed foreground row fresh; a signerless manager asks its registered host. The lease is held
1019
1065
  * only in memory and is therefore renewed after reconnect or manager restart. */
1020
- private serveTurnParticipation;
1066
+ protected serveTurnParticipation(caller: EpCaller): Promise<{
1067
+ owner: string;
1068
+ actor: string;
1069
+ lifecycleUid: string;
1070
+ name: string;
1071
+ managerInstanceId: string;
1072
+ expiresAt: number;
1073
+ }>;
1021
1074
  private currentParticipant;
1022
1075
  /** A managed seat or a finite authorized personal participant. Only the first carries custody. */
1023
- private turnTarget;
1076
+ protected turnTarget(ctx: EpServeContext): {
1077
+ kind: "managed";
1078
+ agent: ManagedAgent;
1079
+ name: string;
1080
+ } | {
1081
+ kind: "personal";
1082
+ participant: PersonalTurnParticipant;
1083
+ name: string;
1084
+ };
1024
1085
  /** Resolve whether an exact turn executor lifecycle is current. */
1025
1086
  private turnExecutorEpoch;
1026
1087
  /** A baseline seat may amend only an answer recorded under its own name: it changes its own
1027
1088
  * position, never another answerer's. Explicit `run` holders and unmanaged operator instruments
1028
1089
  * keep the reach they have to answer, as {@link authorizeRunAnswer} does. */
1029
- private authorizeRunAmend;
1090
+ protected authorizeRunAmend(ctx: EpServeContext, accepted: {
1091
+ by: string;
1092
+ }): void;
1030
1093
  /** {@link CommandDispatch.managerServiceDefs}. */
1031
- private managerServiceDefs;
1032
- private commitResumeActivation;
1094
+ protected managerServiceDefs(...args: Parameters<CommandDispatch["managerServiceDefs"]>): ReturnType<CommandDispatch["managerServiceDefs"]>;
1033
1095
  /** Collapsed despawn/attach authorization (P4b). The caller already reached the command's ep
1034
1096
  * row (cred-gated: owner-mode rows via the spawn capability, any-mode rows only in admin
1035
1097
  * instruments). With admin=true (any-mode) any named target is allowed (operator). Otherwise
@@ -1040,62 +1102,87 @@ export declare class Manager {
1040
1102
  * decisions locally, then send only the residual cross-owner admin question through the registered
1041
1103
  * host callback with the full endpoint caller tuple. Error string when denied, `undefined` when
1042
1104
  * allowed; remote host-state faults throw rather than being collapsed into a denial. */
1043
- private authorizeNamed;
1105
+ protected authorizeNamed(target: ManagedAgent, caller: string, admin: boolean, epCaller?: EpCaller): Promise<string | undefined>;
1044
1106
  /** The wire principal of a managed agent: {@link managedPrincipal}. */
1045
- private managedPrincipal;
1046
- private resumeLivenessErrors;
1107
+ protected managedPrincipal(a: {
1108
+ id: string;
1109
+ userOwner?: string;
1110
+ }): string;
1047
1111
  /** {@link CommandDispatch.opStopSelf}. */
1048
1112
  opStopSelf(...args: Parameters<CommandDispatch["opStopSelf"]>): ReturnType<CommandDispatch["opStopSelf"]>;
1049
1113
  /** {@link SeatStop.stopHandle}. */
1050
- private stopHandle;
1114
+ protected stopHandle(...args: Parameters<SeatStop["stopHandle"]>): ReturnType<SeatStop["stopHandle"]>;
1051
1115
  /** {@link SeatStop.stopWindowsSeat}. */
1052
- private stopWindowsSeat;
1116
+ protected stopWindowsSeat(...args: Parameters<SeatStop["stopWindowsSeat"]>): ReturnType<SeatStop["stopWindowsSeat"]>;
1053
1117
  /** {@link SeatStop.trackStoppedHandle}. */
1054
- private trackStoppedHandle;
1055
- private provisionUserAgent;
1118
+ protected trackStoppedHandle(...args: Parameters<SeatStop["trackStoppedHandle"]>): ReturnType<SeatStop["trackStoppedHandle"]>;
1119
+ protected provisionUserAgent(name: string, opts: ProvisionUserAgentOpts): Promise<ProvisionedUserAgent | UserAgentRefusal>;
1056
1120
  /** Shred a user agent's secret family from the store and from disk. Every removal is attempted,
1057
1121
  * and each failure joins `unshredded`, so one fault cannot leave the rest of the family behind. */
1058
- private shredUserSecrets;
1122
+ protected shredUserSecrets(unshredded: CleanupFailure[], family: {
1123
+ actorToken?: string;
1124
+ sentinelCreds?: string;
1125
+ health?: string;
1126
+ }): Promise<void>;
1059
1127
  /** {@link SeatStop.logSeatReaped}. */
1060
- private logSeatReaped;
1128
+ protected logSeatReaped(...args: Parameters<SeatStop["logSeatReaped"]>): ReturnType<SeatStop["logSeatReaped"]>;
1061
1129
  /** {@link SeatStop.logSeatMeshTransitions}. */
1062
- private logSeatMeshTransitions;
1130
+ protected logSeatMeshTransitions(...args: Parameters<SeatStop["logSeatMeshTransitions"]>): ReturnType<SeatStop["logSeatMeshTransitions"]>;
1063
1131
  /** {@link SeatStop.isOwnPresence}. */
1064
- private isOwnPresence;
1065
- private freeSlot;
1132
+ protected isOwnPresence(a: ManagedAgent, p: Presence | undefined): p is Presence;
1133
+ protected freeSlot(a: ManagedAgent, floor: boolean, cause: FreeSlotCause, acceptedBeforeFence?: boolean): void;
1066
1134
  /** {@link SeatStop.dropInlineSnapshot}. */
1067
- private dropInlineSnapshot;
1135
+ protected dropInlineSnapshot(...args: Parameters<SeatStop["dropInlineSnapshot"]>): ReturnType<SeatStop["dropInlineSnapshot"]>;
1068
1136
  /** {@link SeatStop.teardownTarget}. */
1069
- private teardownTarget;
1070
- private deprovision;
1137
+ protected teardownTarget(...args: Parameters<SeatStop["teardownTarget"]>): ReturnType<SeatStop["teardownTarget"]>;
1138
+ protected deprovision(a: TeardownTarget): Promise<void>;
1071
1139
  /** Run one retirement in a {@link RETIREMENT_CONCURRENCY} slot, oldest first: a seat's deprovision, a
1072
1140
  * chat session's terminal and a static reconcile's terminal all take one. No retirement awaits
1073
1141
  * another, so the bounded pool cannot deadlock. */
1074
- private withRetirementSlot;
1075
- private confirmRetirement;
1076
- private deprovisionBroker;
1142
+ protected withRetirementSlot<T>(run: () => Promise<T>): Promise<T>;
1143
+ protected confirmRetirement(a: {
1144
+ id: string;
1145
+ name: string;
1146
+ lifecycleUid: string;
1147
+ }): void;
1148
+ protected deprovisionBroker(a: {
1149
+ id: string;
1150
+ name: string;
1151
+ lifecycleUid: string;
1152
+ launch?: {
1153
+ allowSubscribe: readonly string[];
1154
+ };
1155
+ }): Promise<DeprovisionResourceAccounting>;
1077
1156
  /** {@link SeatStop.fenceRetiringAcl}. */
1078
- private fenceRetiringAcl;
1157
+ protected fenceRetiringAcl(...args: Parameters<SeatStop["fenceRetiringAcl"]>): ReturnType<SeatStop["fenceRetiringAcl"]>;
1079
1158
  /** {@link SeatStop.lifecycleMembershipInventory}. */
1080
- private lifecycleMembershipInventory;
1159
+ protected lifecycleMembershipInventory(...args: Parameters<SeatStop["lifecycleMembershipInventory"]>): ReturnType<SeatStop["lifecycleMembershipInventory"]>;
1081
1160
  /** {@link SeatStop.reapChildrenOf}. */
1082
- private reapChildrenOf;
1083
- private readManagedSessionState;
1084
- private retainedSessionId;
1085
- private forkProvenance;
1086
- private readManagedSession;
1087
- private recordContinuity;
1088
- private recordContinuityAtStop;
1089
- private armSessionRecovery;
1161
+ protected reapChildrenOf(...args: Parameters<SeatStop["reapChildrenOf"]>): ReturnType<SeatStop["reapChildrenOf"]>;
1162
+ protected readManagedSessionState(a: ManagedAgent): {
1163
+ sessionId: string;
1164
+ status: "running" | "quit";
1165
+ } | {
1166
+ connector: string;
1167
+ status: "prompt";
1168
+ prompt: string;
1169
+ cwd: string;
1170
+ };
1171
+ protected retainedSessionId(entry: ManagerResumeAgent, connector: Connector): string | undefined;
1172
+ protected forkProvenance(a: ManagedAgent): ForkProvenance | undefined;
1173
+ protected readManagedSession(a: ManagedAgent): string;
1174
+ protected recordContinuity(a: ManagedAgent, sessionId: string): void;
1175
+ protected recordContinuityAtStop(a: ManagedAgent, boundary: string): void;
1176
+ protected armSessionRecovery(a: ManagedAgent): Promise<void>;
1090
1177
  /** Why an inline seat's snapshot no longer matches its launch, or `undefined` when it does or the
1091
1178
  * seat is not inline. The recorded path and the relaunch's path must both be this lifecycle's
1092
1179
  * snapshot path, as the resume cut requires, and the file there must still be a private regular
1093
1180
  * file with the recorded digest. */
1094
- private inlineSnapshotChange;
1095
- private recoverManagedSession;
1181
+ protected inlineSnapshotChange(a: ManagedAgent): string | undefined;
1182
+ protected recoverManagedSession(a: ManagedAgent): void;
1096
1183
  /** {@link SeatStop.onAgentExit}. */
1097
- private onAgentExit;
1098
- private nameError;
1184
+ protected onAgentExit(...args: Parameters<SeatStop["onAgentExit"]>): ReturnType<SeatStop["onAgentExit"]>;
1185
+ protected nameError(name: string): string | undefined;
1099
1186
  /** Spawn a teammate by persona ref (`name` loads `.cotal/agents/<name>.md`; the peer presents
1100
1187
  * under that file's own `name:`), as if a peer asked via the control plane. Used to pre-spawn the
1101
1188
  * demo's experts at startup so the manager owns them. */
@@ -1106,86 +1193,44 @@ export declare class Manager {
1106
1193
  * resolution: a same-named *unmanaged* peer already present could satisfy this early. That's
1107
1194
  * acceptable for cold-start staggering; it never routes anything. */
1108
1195
  waitForPresence(name: string, timeoutMs?: number): Promise<boolean>;
1109
- /** Parse a served `spawn` request into {@link StartAgentOpts}. The compiled spawn input contract
1110
- * is the shape check: it already refused a non-mapping `launchOptions`, a `supervise` that is not
1111
- * the closed `{ restarts, windowMs }` pair, and a list on `subscribe`, `allowSubscribe`,
1112
- * `allowPublish`, `shareTools`, `join` or `callerAcl` that is not an array of strings. This reads
1113
- * those fields as admitted, the way it reads the string fields. The connector still validates the
1114
- * launch-option keys, and `startAgent` still refuses a supervise budget the seat record would not
1115
- * take. `once` is shape-checked by that same contract. Its omitted `deadlineMs` takes the default
1116
- * here, and a deadline past the scheduler's last instant is refused here, which the schema does
1117
- * not express. */
1118
- private opStart;
1119
- private listSpawnDirectory;
1196
+ /** {@link StartDoors.opStart}. */
1197
+ protected opStart(...args: Parameters<StartDoors["opStart"]>): ReturnType<StartDoors["opStart"]>;
1198
+ protected listSpawnDirectory(args: Record<string, unknown>): ReturnType<SeatLaunch["listSpawnDirectory"]>;
1120
1199
  /** {@link SeatLaunch.resolveSpawnCwd}. */
1121
- private resolveSpawnCwd;
1122
- /** Resolve a connector by agent type. Library composition (installedExtensions off) → a registry
1123
- * hit, exactly as before (the composition root imported what it wants). The published binary gates
1124
- * on MANIFEST membership FIRST — so a live `cotal ext remove` is honored even though the registry
1125
- * still holds a connector imported earlier this session — then returns the registry hit or lazily
1126
- * imports the providing package (transactional + single-flight, via the workspace primitive).
1127
- * The captured Manager generation is checked for first-party providers under that lock,
1128
- * including providers already present in the registry.
1129
- * Fail-loud with an install hint; no fallback. */
1130
- private resolveConnector;
1200
+ protected resolveSpawnCwd(value: unknown): {
1201
+ cwd: string;
1202
+ host: string;
1203
+ };
1204
+ /** {@link HarnessResolution.resolveConnector}. */
1205
+ protected resolveConnector(...args: Parameters<HarnessResolution["resolveConnector"]>): ReturnType<HarnessResolution["resolveConnector"]>;
1131
1206
  /** {@link SeatLaunch.connectorNames}. */
1132
- private connectorNames;
1133
- /** Resolve every installed/registered connector's declared harness binaries before the manager
1134
- * reports ready. A missing harness degrades only that connector, never unrelated lifecycle work:
1135
- * boot continues, names it once start completes and records it on both manager status surfaces. */
1136
- private inspectConnectorsAtBoot;
1207
+ protected connectorNames(): string[];
1208
+ /** {@link ConnectorInventory.inspectConnectorsAtBoot}. */
1209
+ protected inspectConnectorsAtBoot(...args: Parameters<ConnectorInventory["inspectConnectorsAtBoot"]>): ReturnType<ConnectorInventory["inspectConnectorsAtBoot"]>;
1137
1210
  /** Install and verify the hosted Claude wake channel, or report the cause and remedy. */
1138
- private prepareClaudeWake;
1211
+ protected prepareClaudeWake(): Promise<string | undefined>;
1139
1212
  /** Retry unavailable applications without changing resolved available rows. Claude launches
1140
1213
  * join the status or launch that started wake setup, before any name or capacity is reserved. */
1141
- private refreshUnavailableConnectors;
1214
+ protected refreshUnavailableConnectors(name?: string, setupClaude?: boolean): Promise<void> | undefined;
1142
1215
  /** {@link SeatLaunch.classSpawnEnabled}. */
1143
- private classSpawnEnabled;
1144
- private omitClassCommands;
1145
- /** The harness binaries a managed launch runs, as boot resolved them, or the refusal naming what is
1146
- * missing. Spawn, resume and the model catalog all take it, so a seat launches from the same files
1147
- * whichever path starts it and the catalog never disagrees with a launch about whether the harness
1148
- * is there. Callers recheck unavailable rows first; available rows retain their resolved files.
1149
- * A connector registered after boot has no inventory row and is checked on PATH now. */
1150
- private launchHarness;
1151
- /** The launch fields the host supplies rather than the seat. Spawn and resume both take them from
1152
- * here, so a resumed seat launches under the same host policy, `eventsRequired` included, as the
1153
- * same seat spawned fresh. The caller passes the cotal config it judged the launch by, so the
1154
- * servers and env allowlist come from the contents its checks read. */
1155
- private hostLaunchFields;
1156
- /** The refusal for a launch choice the connector cannot honour. Spawn and resume both ask before
1157
- * a seat's launch is built, so a rule changed here holds on both paths. */
1158
- private capabilityRefusal;
1216
+ protected classSpawnEnabled(): boolean;
1217
+ protected omitClassCommands(): readonly string[] | undefined;
1218
+ /** {@link HarnessResolution.launchHarness}. */
1219
+ protected launchHarness(...args: Parameters<HarnessResolution["launchHarness"]>): ReturnType<HarnessResolution["launchHarness"]>;
1220
+ /** {@link HarnessResolution.hostLaunchFields}. */
1221
+ protected hostLaunchFields(...args: Parameters<HarnessResolution["hostLaunchFields"]>): ReturnType<HarnessResolution["hostLaunchFields"]>;
1222
+ /** {@link HarnessResolution.capabilityRefusal}. */
1223
+ protected capabilityRefusal(...args: Parameters<HarnessResolution["capabilityRefusal"]>): ReturnType<HarnessResolution["capabilityRefusal"]>;
1159
1224
  /** {@link SeatLaunch.onceRefusal}. */
1160
1225
  onceRefusal(connector: Connector, runtime: Runtime, launch: Pick<StartAgentOpts, "once" | "supervise" | "launchOptions" | "prompt">, spawner: string | undefined, hooks: SpawnHooks | undefined): string | undefined;
1161
- /** The refusal for an event-plane choice the registration policy or the connector cannot meet.
1162
- * Spawn and resume both ask before a seat's launch is built, so a seat retained without the
1163
- * plane cannot come back on a space that now requires it. An absent choice arms supported planes. */
1164
- private eventsRefusal;
1165
- /** Return connector-provided model catalogs for selector UIs. Optional by connector: a host with no
1166
- * local model-list API reports `supported:false` rather than blocking the manager. A connector that
1167
- * fails to import shows an `error:` row (from manifest enumeration) and never blocks the others. */
1168
- private opModels;
1169
- /** The owner-domain bound on `ps`/`status` metadata: on a USER mesh, a privileged-tier caller
1170
- * sees only agents under its OWN subject-pinned owner. Two ways to see ALL owners: the admin
1171
- * TIER (operator), or a fresh ledger `admin` SCOPE on the caller's row — the SAME authority that
1172
- * lets `stop`/`attach` reach cross-owner agents ({@link authorizeNamedControl}). Without this the
1173
- * two surfaces disagree: an admin operator could cross-owner stop an agent it could not list.
1174
- * Read fresh so a revoked admin loses visibility on its next call; a read failure and an
1175
- * unparseable caller both fall closed (own-owner / matches-nothing). Static meshes are unbounded. */
1176
- private psOwnerFilter;
1177
- /** Boot one resolved agent from a mesh-manifest launch spec, for `cotal spawn -f` onto a RUNNING
1178
- * manager. The request carries `{ runId, name }` — plus, for a deploy from another checkout or
1179
- * host, the resolved `spec` itself inline (validated as untrusted input and persisted under THIS
1180
- * manager's `.cotal/run/` first) — NEVER a path: the manager derives + validates
1181
- * `.cotal/run/<runId>.json` itself ({@link launchSpecForRun} — token-safe id, no-follow,
1182
- * `loadLaunchSpec`'s untrusted-input + `validateLaunchPolicy` contract), materializes the named
1183
- * agent's transient persona, and spawns via the same `startAgent({ resolved })` path as
1184
- * `supervise --launch`. The reply is enriched for the ownership ledger: the SPAWNED
1185
- * (collision-numbered) name + nkey id creds are filed under, plus the manifest `requested` name,
1186
- * `runId`, and resolved `hash`. USER mesh: a privileged-tier launch is owner-equality-authorized
1187
- * (spec owner === caller owner) before any side effect; the admin tier keeps operator behavior. */
1188
- private opLaunch;
1226
+ /** {@link HarnessResolution.eventsRefusal}. */
1227
+ protected eventsRefusal(...args: Parameters<HarnessResolution["eventsRefusal"]>): ReturnType<HarnessResolution["eventsRefusal"]>;
1228
+ /** {@link StatusAndModels.opModels}. */
1229
+ protected opModels(...args: Parameters<StatusAndModels["opModels"]>): ReturnType<StatusAndModels["opModels"]>;
1230
+ /** {@link StatusAndModels.psOwnerFilter}. */
1231
+ protected psOwnerFilter(...args: Parameters<StatusAndModels["psOwnerFilter"]>): ReturnType<StatusAndModels["psOwnerFilter"]>;
1232
+ /** {@link StartDoors.opLaunch}. */
1233
+ protected opLaunch(...args: Parameters<StartDoors["opLaunch"]>): ReturnType<StartDoors["opLaunch"]>;
1189
1234
  /** Spawn and supervise one agent. The single spawn path: both the control-plane
1190
1235
  * `start` op and declarative roster boot call this. Mints scoped creds in auth mode,
1191
1236
  * resolves the agent file, launches via the connector + runtime, and records the handle.
@@ -1194,206 +1239,177 @@ export declare class Manager {
1194
1239
  * ledger (own-children despawn + reap-on-parent-exit). */
1195
1240
  startAgent(opts: StartAgentOpts, spawner?: string, hooks?: SpawnHooks, authenticatedCaller?: EpCaller): Promise<ControlReply>;
1196
1241
  /** {@link SeatLaunch.spawnPersona}. */
1197
- private spawnPersona;
1242
+ protected spawnPersona(...args: Parameters<SeatLaunch["spawnPersona"]>): ReturnType<SeatLaunch["spawnPersona"]>;
1198
1243
  /** {@link SeatLaunch.spawnRun}. */
1199
- private spawnRun;
1244
+ protected spawnRun(caller: EpCaller | undefined, runId: string | undefined): Promise<SpawnRun | undefined>;
1200
1245
  /** {@link SeatLaunch.staticSpawnBound}. */
1201
- private staticSpawnBound;
1246
+ protected staticSpawnBound(caller: EpCaller | undefined, run: Extract<SpawnRun, {
1247
+ admission: RunAdmission;
1248
+ }> | undefined): Promise<StaticSpawnBound>;
1202
1249
  /** {@link SeatLaunch.spawnBoundRefusal}. */
1203
- private spawnBoundRefusal;
1250
+ protected spawnBoundRefusal(bound: StaticSpawnBound, grant: DelegatedGrant, armsEvents: boolean, door?: "spawn" | "define-persona"): string | undefined;
1204
1251
  /** {@link SeatLaunch.managedStaticInstanceReads}. */
1205
- private managedStaticInstanceReads;
1206
- /** Preflight the whole inventory before launching its first process, then adopt each exact retained
1207
- * principal without provisioning. A later runtime launch failure is reported per-agent, but malformed
1208
- * or missing inventory material can never produce a partially resumed set. */
1209
- resumePreserved(inventory: ManagerResumeInventory): Promise<ManagerResumeResult>;
1210
- /** Re-read every retained identity input and its current authority without provisioning. This runs
1211
- * during whole-inventory preflight, immediately before each individual spawn, and at commit. */
1212
- private validateRetainedAuthority;
1213
- /** The seat reference behind a live retained principal, when that seat is provably one a lost
1214
- * manager of this logical instance launched for this exact incarnation. The resume binds the
1215
- * launched handle's reference to the incarnation's active slot before it waits for readiness, and
1216
- * the coordinator journals `resume-active` only after that wait, so a coordinator crash between the
1217
- * two leaves `resume-intent` behind a live seat. Undefined for everything else, which stays refused:
1218
- * another incarnation's presence, a slot another instance owns, a runtime that cannot reap the
1219
- * reference, and user or open meshes, which keep no slot. */
1220
- private orphanedResumeSeat;
1221
- /** Reap a seat {@link orphanedResumeSeat} found, then wait for its principal to leave presence so
1222
- * the relaunch's readiness cannot match the dead seat's row. Returns the refusal when the reap
1223
- * proves nothing or the principal stays live, which means another process holds it. */
1224
- private reapOrphanedResumeSeat;
1225
- /** Validate/relaunch one retained inventory entry. Called through resumePreserved so all records
1226
- * pass the same preflight before the first child is exposed, and through restartSupervisedSeat
1227
- * with the one record a crashed manager left (`supervised`). */
1228
- private resumePreservedAgent;
1229
- private launchPreparedResume;
1230
- /** Arm a resumed seat's restart once it is ready, whether it joined inside the readiness window or
1231
- * after it (#4144). A supervised restart arms the way its spawn did: a connector with no session
1232
- * continuation is armed at readiness, one with it once its session is proved. Returns why the
1233
- * session could not be rebound, and the caller stops the seat. */
1234
- private armResumedSeat;
1235
- /** A resumed seat whose readiness was uncertain gets what a ready one gets once it joins: its
1236
- * restart is armed and its record rewritten. Without this, a supervised seat restarted after a
1237
- * manager crash that joined late was retired on its next exit instead of restarted. */
1238
- private armLateResume;
1239
- /** A resumed seat keeps its retained credentials, so freeing it runs no deprovision and nothing
1240
- * would reap it: it is freed only once its exit is proved, and otherwise stays managed until it
1241
- * exits or the manager stops it. */
1242
- private stopFailedResume;
1243
- private probeStaticCredential;
1244
- /** An uncertain resume remains non-destructive until exact-principal AND exact-incarnation presence
1245
- * arrives later, and then `adopted` runs. Same predicate as the readiness fence: a principal-only
1246
- * match would let a wrong/absent-uid presence under the reused alias clear cleanup suppression on
1247
- * another incarnation. A supervised restart keeps its principal and uid, so it also carries the
1248
- * fence's `joinedAfter` bound: the row the dead seat left must not stand in for the new process.
1249
- * A heartbeat on that row moves only its time and emits no presence event, so the bound is polled. */
1250
- private watchResumeAdoption;
1251
- /** #159 B1: wait for a detached launch to reach a REAL outcome before replying — never a liveness-
1252
- * inferring timer. Races three:
1253
- * • the assigned id joins presence (live) → **started** — the honest signal (the manager owns mesh
1254
- * lifecycle, not app health, so `ok:true` means "it joined the mesh", not "fully healthy");
1255
- * • the child process exits → **failed** — surface its last output and reap the slot;
1256
- * • neither within {@link readinessTimeoutMs} → **uncertain** — a non-success diagnostic that does NOT
1257
- * deprovision (it may still be booting; the caller keeps {@link watchExit} wired so a later death is
1258
- * still reaped).
1259
- * Presence is keyed on the EXACT freshly-minted id, never the name — a fresh id has no prior record, so
1260
- * any live presence for it is from THIS launch (stale/same-name records can't false-start it). The
1261
- * `"presence"` event is only a wake; the roster is re-read as the source of truth (subscribe-then-check
1262
- * catches a join/exit that landed before we subscribed). A runtime whose `attach()` throws (an external
1263
- * surface) streams no output or exit, so its exit leg polls the runtime's exit proof ({@link pollProvedExit}),
1264
- * reads it once more when the window closes, and its failure carries no last output; one that cannot prove an
1265
- * exit either races presence-vs-backstop only.
1266
- * A launch that waits for the operator at `opts.operator`, a screen its connector names, is ready once a
1267
- * process this runtime owns has run for {@link OPERATOR_READINESS_MS} without exiting. An uncertain verdict
1268
- * says whether a process this runtime owns is still running. */
1269
- private awaitReadiness;
1270
- /** Last non-empty line of the session's rendered backlog as a single trimmed snippet (≤160 chars)
1271
- * — a readable one-line cause for an early-exit diagnostic. The backlog repaints cells a TUI
1272
- * skipped with cursor moves, so it is rendered and the line is read off the terminal; stripping
1273
- * its escapes would glue the words those moves separate. */
1274
- private tail;
1275
- /** Subscribe to a managed agent's process-exit so a self-driven exit frees its slot and reaps
1276
- * its children (P4b/P4c). The watch is bound to the current handle: a restart swaps in a new one
1277
- * and watches it, so a late exit proved for the old handle must not retire the row. */
1278
- private watchExit;
1279
- private occupancy;
1280
- private occupancyText;
1281
- private capacityRefusal;
1252
+ protected managedStaticInstanceReads(capabilities: readonly string[] | undefined): EpCapability[];
1253
+ /** {@link PreservedResume.resumePreserved}. */
1254
+ resumePreserved(...args: Parameters<PreservedResume["resumePreserved"]>): ReturnType<PreservedResume["resumePreserved"]>;
1255
+ /** {@link PreservedResume.validateRetainedAuthority}. */
1256
+ protected validateRetainedAuthority(...args: Parameters<PreservedResume["validateRetainedAuthority"]>): ReturnType<PreservedResume["validateRetainedAuthority"]>;
1257
+ /** {@link PreservedResume.resumePreservedAgent}. */
1258
+ protected resumePreservedAgent(...args: Parameters<PreservedResume["resumePreservedAgent"]>): ReturnType<PreservedResume["resumePreservedAgent"]>;
1259
+ protected probeStaticCredential(creds: string): Promise<import("@cotal-ai/core").ProbeResult>;
1260
+ /** {@link ReadinessWait.awaitReadiness}. */
1261
+ protected awaitReadiness(...args: Parameters<ReadinessWait["awaitReadiness"]>): ReturnType<ReadinessWait["awaitReadiness"]>;
1262
+ /** {@link ReadinessWait.tail}. */
1263
+ protected tail(...args: Parameters<ReadinessWait["tail"]>): ReturnType<ReadinessWait["tail"]>;
1264
+ /** {@link ReadinessWait.watchExit}. */
1265
+ protected watchExit(...args: Parameters<ReadinessWait["watchExit"]>): ReturnType<ReadinessWait["watchExit"]>;
1266
+ protected occupancy(): Occupancy;
1267
+ protected occupancyText(o: Occupancy): string;
1268
+ protected capacityRefusal(o: Occupancy): string;
1282
1269
  /** The owner a launch belongs to: {@link NamesCapacity.launchOwner}. */
1283
- private launchOwner;
1270
+ protected launchOwner(opts: Pick<StartAgentOpts, "owner">, spawner?: string): string;
1284
1271
  /** Live seats this manager holds for one owner: {@link NamesCapacity.ownerSeats}. */
1285
1272
  private ownerSeats;
1286
1273
  /** The per-owner ceiling at accept: {@link NamesCapacity.seatCapRefusal}. */
1287
- private seatCapRefusal;
1274
+ protected seatCapRefusal(owner: string): EpEnvelopeError | undefined;
1288
1275
  /** {@link SeatStop.opStop}. */
1289
1276
  private opStop;
1290
1277
  /** {@link SeatStop.despawnAuthorized}. */
1291
- private despawnAuthorized;
1278
+ protected despawnAuthorized(...args: Parameters<SeatStop["despawnAuthorized"]>): ReturnType<SeatStop["despawnAuthorized"]>;
1292
1279
  /** {@link SeatStop.retireDelegatedAgent}. */
1293
1280
  retireDelegatedAgent(name: string, intentId: string): Promise<ControlReply>;
1294
1281
  /** {@link SeatStop.findManagedByTarget}. */
1295
- private findManagedByTarget;
1296
- /** Run one static §13.1 lifecycle OPERATION over an ephemeral, key-pinned `lifecycle-executor`
1297
- * connection: the credential's grants name exactly ONE incarnation's head/uid/gate/
1298
- * cred-family/slot keys, so the write authority exists only for this operation's window and
1299
- * can move nothing else. The transport is the direct-KV binding the shared core saga drives. */
1300
- private withLifecycleExecutor;
1301
- /** Run one SPEC 13.15 issuance operation over an ephemeral `issuer` connection: the evidence
1302
- * stage/release of one mint, or the retirement walk of one lifecycle's issuances. The store
1303
- * handle and the accepted-row KV live only for this window; the standing supervisor holds no
1304
- * grant on either bucket. */
1305
- private withIssuer;
1306
- /** The issuance seam of ONE static credential mint (SPEC 13.15): the evidence is bound to the
1307
- * incarnation's own `cred.<uid>` ledger family, so the family's revocation (the static
1308
- * terminal) retires every issuance that named it. The finalizer is the §13.1 ledger append
1309
- * (slot credentialId + `cred.<uid>.<credId>` row); release runs it, then activates. */
1310
- private issuanceSeam;
1311
- /** Run one §13.1 endpoint-instance maintenance operation over an ephemeral,
1312
- * key-pinned `endpoint-serve-executor` connection: the credential's grants name exactly the
1313
- * manager instance's `epgate`/`epcred` keys plus its registration's two records keys, so the
1314
- * gate CAS, mint fence, spec/governance writes, and clean deregistration ride a one-shot scoped
1315
- * authority. The remote boot goal-index sweep instead uses the authenticated host-owned scan.
1316
- * This is NEVER the manager's standing seed/supervisor connection. */
1317
- private withEndpointServeExecutor;
1318
- /** The open-mesh counterpart of {@link withEndpointServeExecutor}: an OPEN mesh has no
1319
- * credential system, so there is no scoped executor to mint - the same §13.1 gate/records
1320
- * writes ride a bare one-shot connection (the broker enforces nothing on an open mesh; the
1321
- * ceremony still produces the real gate, epoch, and registration the serve rails run on). */
1322
- private withOpenServeConnection;
1323
- /** Parent-local inventory read. It does not enter maintenance or change admission. */
1324
- hostedSeatCount(): number;
1325
- /** Public local-seat facts for the owning machine daemon. No mesh or secret reads. */
1326
- hostedAgents(): {
1327
- name: string;
1328
- application: string;
1329
- model?: string;
1330
- cwd: string;
1331
- startedAt: string;
1332
- state: "running" | "exited";
1333
- }[];
1334
- /** The served manager-level health summary. Given an owner, `agentCount` counts only that owner's
1335
- * seats, as `ps` lists them ({@link psOwnerFilter}), so a person reading a shared Manager does not
1336
- * learn how many seats other owners hold on it. */
1337
- private managerStatusData;
1338
- private staticReconciliationStatus;
1339
- /** Complete a crashed predecessor's FROZEN registration gate before this incarnation starts a
1340
- * new one (#783 item 3 / #871). The CLI `cotal reconcile-gate` already does this; a successor
1341
- * that cannot register is exactly the state that command exists to repair, so boot must run
1342
- * the SAME composition rather than waiting for an operator.
1343
- *
1344
- * Admit only `gone` AND `sweepComplete=true` (the probe mapping already folds an incomplete
1345
- * `gone` into `unestablishable`). Live / unknown / unestablishable / wrong-op-kind stay loud
1346
- * refusals. No TTL: request-ingress has no process-epoch fence, so a clock would either let a
1347
- * superseded serve credential keep consuming ingress or just rename the freeze. An open gate
1348
- * is a no-op (the successor's own freeze comes next). A committed spec under that freeze is
1349
- * finished at the committed registrationRevision; only a definite no-commit abort-reopens. */
1350
- private healFrozenRegistrationGate;
1351
- private dialServeConnection;
1352
- private registerManagerService;
1282
+ protected findManagedByTarget(...args: Parameters<SeatStop["findManagedByTarget"]>): ReturnType<SeatStop["findManagedByTarget"]>;
1283
+ /** {@link BrokerTransport.withLifecycleExecutor}. */
1284
+ protected withLifecycleExecutor<T>(pin: {
1285
+ owner: string;
1286
+ actor: string;
1287
+ lifecycleUid: string;
1288
+ alias: string;
1289
+ }, fn: (t: LifecycleStateTransport) => Promise<T>): Promise<T>;
1290
+ /** {@link BrokerTransport.withIssuer}. */
1291
+ protected withIssuer<T>(fn: (i: {
1292
+ store: IssuedStore;
1293
+ accepted: KV;
1294
+ }) => Promise<T>): Promise<T>;
1295
+ /** {@link BrokerTransport.issuanceSeam}. */
1296
+ protected issuanceSeam(...args: Parameters<BrokerTransport["issuanceSeam"]>): ReturnType<BrokerTransport["issuanceSeam"]>;
1297
+ /** {@link BrokerTransport.withEndpointServeExecutor}. */
1298
+ protected withEndpointServeExecutor<T>(fn: (kvs: {
1299
+ recordsKv: KV;
1300
+ authKv: KV;
1301
+ nc: NatsConnection;
1302
+ }) => Promise<T>): Promise<T>;
1303
+ /** {@link BrokerTransport.withOpenServeConnection}. */
1304
+ protected withOpenServeConnection<T>(fn: (kvs: {
1305
+ recordsKv: KV;
1306
+ authKv: KV;
1307
+ nc: NatsConnection;
1308
+ }) => Promise<T>): Promise<T>;
1309
+ /** {@link StatusAndModels.hostedSeatCount}. */
1310
+ hostedSeatCount(...args: Parameters<StatusAndModels["hostedSeatCount"]>): ReturnType<StatusAndModels["hostedSeatCount"]>;
1311
+ /** {@link StatusAndModels.hostedAgents}. */
1312
+ hostedAgents(...args: Parameters<StatusAndModels["hostedAgents"]>): ReturnType<StatusAndModels["hostedAgents"]>;
1313
+ /** {@link StatusAndModels.managerStatusData}. */
1314
+ protected managerStatusData(...args: Parameters<StatusAndModels["managerStatusData"]>): ReturnType<StatusAndModels["managerStatusData"]>;
1315
+ protected staticReconciliationStatus(): ManagerStaticReconciliationStatus;
1316
+ /** {@link ManagerBoot.healFrozenRegistrationGate}. */
1317
+ protected healFrozenRegistrationGate(...args: Parameters<ManagerBoot["healFrozenRegistrationGate"]>): ReturnType<ManagerBoot["healFrozenRegistrationGate"]>;
1318
+ protected dialServeConnection(state: {
1319
+ nc: NatsConnection;
1320
+ identity: Identity;
1321
+ grant: EpServeGrant;
1322
+ creds?: string;
1323
+ }, readCreds?: () => string, deadline?: number): Promise<{
1324
+ nc: NatsConnection;
1325
+ handle: EpServeHandle;
1326
+ }>;
1327
+ protected registerManagerService(): Promise<void>;
1353
1328
  /** {@link GoalWriter.mintAndStageGoalWriter}. */
1354
- private mintAndStageGoalWriter;
1329
+ protected mintAndStageGoalWriter(...args: Parameters<GoalWriter["mintAndStageGoalWriter"]>): ReturnType<GoalWriter["mintAndStageGoalWriter"]>;
1355
1330
  /** {@link GoalWriter.startGoalWriter}. */
1356
- private startGoalWriter;
1331
+ protected startGoalWriter(...args: Parameters<GoalWriter["startGoalWriter"]>): ReturnType<GoalWriter["startGoalWriter"]>;
1357
1332
  /** {@link GoalWriter.stopGoalWriter}. */
1358
1333
  private stopGoalWriter;
1359
- private mintAndStageSessionLedger;
1360
- private startSessionPlane;
1334
+ protected mintAndStageSessionLedger(authKv: KV): Promise<string>;
1335
+ protected startSessionPlane(): Promise<void>;
1361
1336
  private stopSessionPlane;
1362
1337
  /** {@link GoalWriter.reconcileGoalIndex}. */
1363
- private reconcileGoalIndex;
1338
+ protected reconcileGoalIndex(...args: Parameters<GoalWriter["reconcileGoalIndex"]>): ReturnType<GoalWriter["reconcileGoalIndex"]>;
1364
1339
  /** {@link GoalWriter.emitGoalProgress}. */
1365
- private emitGoalProgress;
1340
+ protected emitGoalProgress(...args: Parameters<GoalWriter["emitGoalProgress"]>): ReturnType<GoalWriter["emitGoalProgress"]>;
1366
1341
  /** {@link GoalWriter.assertGoalWriterEpochCurrent}. */
1367
- private assertGoalWriterEpochCurrent;
1342
+ protected assertGoalWriterEpochCurrent(...args: Parameters<GoalWriter["assertGoalWriterEpochCurrent"]>): ReturnType<GoalWriter["assertGoalWriterEpochCurrent"]>;
1368
1343
  /** {@link SpawnGoal.loggedSpawnRefusal}. */
1369
- private loggedSpawnRefusal;
1344
+ protected loggedSpawnRefusal<T>(ctx: EpServeContext, serve: () => Promise<T>): Promise<T>;
1370
1345
  /** {@link SpawnGoal.serveSpawnGoal}. */
1371
- private serveSpawnGoal;
1346
+ protected serveSpawnGoal(...args: Parameters<SpawnGoal["serveSpawnGoal"]>): ReturnType<SpawnGoal["serveSpawnGoal"]>;
1372
1347
  /** {@link SpawnGoal.expireGoalAcceptance}. */
1373
- private expireGoalAcceptance;
1348
+ protected expireGoalAcceptance(...args: Parameters<SpawnGoal["expireGoalAcceptance"]>): ReturnType<SpawnGoal["expireGoalAcceptance"]>;
1374
1349
  /** Accept one `turn` goal against a live managed seat. Mirrors {@link serveSpawnGoal}'s accept
1375
1350
  * path (idempotent retry map, index-CAS-before-bind, create-only bindGoal) but runs it INLINE:
1376
1351
  * there is no launch to hand off, so the accept either completes durably or unwinds its own
1377
1352
  * bound goal with a `failed` terminal before refusing. */
1378
- private serveTurnGoal;
1353
+ protected serveTurnGoal(ctx: EpServeContext, target: {
1354
+ kind: "managed";
1355
+ agent: ManagedAgent;
1356
+ name: string;
1357
+ } | {
1358
+ kind: "personal";
1359
+ participant: PersonalTurnParticipant;
1360
+ name: string;
1361
+ }): Promise<TurnAcceptance>;
1379
1362
  /** The seat's pull: every pending turn addressed to the CALLER's incarnation, oldest first.
1380
1363
  * The uid is part of the address — a successor seat never receives a predecessor's turn. */
1381
- private turnPendingFor;
1364
+ protected turnPendingFor(c: {
1365
+ owner: string;
1366
+ actor: string;
1367
+ uid: string;
1368
+ }): {
1369
+ turns: {
1370
+ goalId: string;
1371
+ payload: string;
1372
+ acceptedAt: number;
1373
+ deadlineAt?: number;
1374
+ once?: true;
1375
+ }[];
1376
+ notices: true;
1377
+ stop?: true;
1378
+ };
1382
1379
  /** Tell a seat that its `turn-pending` answer changed (SPEC 14.3 turn notice), over the serve
1383
1380
  * connection that holds this instance's reply rows. The notice carries no turn and the seat
1384
1381
  * pulls on it, so a lost notice delays that seat until its next pull, and nothing else. */
1385
- private noticeSeatTurns;
1382
+ protected noticeSeatTurns(seat: {
1383
+ name: string;
1384
+ owner: string;
1385
+ actor: string;
1386
+ uid: string;
1387
+ }): void;
1386
1388
  /** The seat's yield: claim the hold (one-use; expiry fails closed), then commit the goal
1387
1389
  * `succeeded` carrying the TurnResult. A yield AFTER the deadline drives the deadline terminal
1388
1390
  * instead and refuses — the expiry outcome stands, never a late success over it. */
1389
- private serveTurnYield;
1391
+ protected serveTurnYield(c: {
1392
+ owner: string;
1393
+ actor: string;
1394
+ uid: string;
1395
+ }, raw: Record<string, unknown>): Promise<{
1396
+ goalId: string;
1397
+ state: string;
1398
+ }>;
1390
1399
  /** A once seat's report that its task's handoff to its harness was not confirmed. The seat sealed
1391
1400
  * the task before it reported, so nothing hands it over again; the task fails
1392
1401
  * `delivery-unconfirmed` and the seat is stopped. The commit proves the seat's live currency, as
1393
1402
  * a yield's does: a seat already gone commits nothing here, and its exit cancels the task. Only
1394
1403
  * the addressed seat may report, only for its once task; a repeat after the terminal is answered
1395
1404
  * with it. */
1396
- private serveTurnUnconfirmed;
1405
+ protected serveTurnUnconfirmed(c: {
1406
+ owner: string;
1407
+ actor: string;
1408
+ uid: string;
1409
+ }, raw: Record<string, unknown>): Promise<{
1410
+ goalId: string;
1411
+ state: string;
1412
+ }>;
1397
1413
  /** The caller withdraws a turn it submitted (the reserved `cancel`, SPEC 13.6 item 4), so the
1398
1414
  * seat is not shown it again and a late yield is answered from the cancelled terminal. Only a
1399
1415
  * relay this incarnation holds is moved to `cancelling`, because only its holder can commit the
@@ -1404,30 +1420,61 @@ export declare class Manager {
1404
1420
  * held: a yield that read the entry first, or this commit with only its reply lost. An entry
1405
1421
  * whose outcome cannot be read back stays out and converges through the goal index at the
1406
1422
  * next boot, as a failed deadline commit does. */
1407
- private serveTurnCancel;
1423
+ protected serveTurnCancel(ctx: EpServeContext): Promise<{
1424
+ goalId: string;
1425
+ state: string;
1426
+ }>;
1408
1427
  /** The reap hook: a pending turn addressed to the reaped INCARNATION is MARKED dead, never
1409
1428
  * settled early — no honest terminal exists for it (a completion must prove the executor's
1410
1429
  * live currency, and the hold is only expirable once due), so the entry rides to its deadline
1411
1430
  * and the deny then records both facts. The addressee's own client observes the death from
1412
1431
  * presence long before that, which is the run's L4002. */
1413
- private failSeatTurns;
1432
+ protected failSeatTurns(name: string, uid: string): void;
1414
1433
  /** Adopt one inherited TURN goal at boot (the reconcile sweep's turn branch): a non-terminal
1415
1434
  * entry carrying a parseable note rebuilds its pending relay — never an `uncertain` settle,
1416
1435
  * because the deadline hold IS this goal's bounded ending and it survived the restart. No
1417
1436
  * liveness verdict is made here (the agents map is empty during reconcile, so absence means
1418
1437
  * "not yet re-registered", never "dead"); a garbled note or a floor that does not name the
1419
1438
  * seat's owner is logged and left, the dead-pointer honesty rule. */
1420
- private adoptTurnGoal;
1439
+ protected adoptTurnGoal(entry: {
1440
+ ref: GoalRef;
1441
+ iid: string;
1442
+ allocated?: GoalIndexEntry["allocated"];
1443
+ note?: string;
1444
+ }): Promise<void>;
1421
1445
  /** Accept a once spawn's task, inline in the spawn's accept seam: nothing has launched yet, so a
1422
1446
  * refusal here fails the spawn and leaves no seat. Mirrors {@link serveTurnGoal}'s accept, with
1423
1447
  * the goal ref and the seat given rather than read off a request. A task with no deadline mints
1424
1448
  * no hold; its goal still records the spawn's readiness budget, which a successor needs to settle
1425
1449
  * it. */
1426
- private acceptOnceTurn;
1450
+ protected acceptOnceTurn(o: {
1451
+ spawnRef: GoalRef;
1452
+ fingerprint: string;
1453
+ command: string;
1454
+ executor: {
1455
+ lifecycleUid: string;
1456
+ epoch: number;
1457
+ };
1458
+ acceptedAt: number;
1459
+ seat: {
1460
+ name: string;
1461
+ owner: string;
1462
+ actor: string;
1463
+ uid: string;
1464
+ };
1465
+ prompt: string;
1466
+ spawner: string;
1467
+ deadlineMs: number | undefined;
1468
+ readinessDeadlineMs: number;
1469
+ retire?: string;
1470
+ }): Promise<{
1471
+ ref: GoalRef;
1472
+ deadlineAt?: number;
1473
+ }>;
1427
1474
  /** How a once seat's startup watch ended: {@link awaitStartupOutcome}. */
1428
- private awaitStartupOutcome;
1475
+ protected awaitStartupOutcome(a: ManagedAgent, launchedAt: number, readinessTimeoutMs: number): Promise<StartupOutcome>;
1429
1476
  /** Serve a once task from now on: its spawn's succeeded terminal is written. */
1430
- private openOnceDelivery;
1477
+ protected openOnceDelivery(ref: GoalRef): void;
1431
1478
  /** Stop the seat of a once task that just ended, found by its incarnation and never by its name.
1432
1479
  * After the readiness verdict the spawn goal's outcome belongs to that verdict, so the stop lets
1433
1480
  * go of the spawn goal first and never cancels it. Before the verdict it is a deliberate stop,
@@ -1438,93 +1485,106 @@ export declare class Manager {
1438
1485
  private stopOnceSeat;
1439
1486
  /** Stop a seat this spawn just placed and track its exit: the stop first, so the terminalizing
1440
1487
  * latch is set before anything awaits, then the exit tracking. Both are synchronous. */
1441
- private stopAndTrack;
1488
+ protected stopAndTrack(a: ManagedAgent, cause: FreeSlotCause): void;
1442
1489
  /** End a once seat before its task is served: let go of the spawn goal, record why it stopped if
1443
1490
  * `stopReason` is given and none is recorded yet, then stop the seat. Synchronous, in that order. */
1444
- private endOnceBeforeServe;
1491
+ protected endOnceBeforeServe(a: ManagedAgent, reason: string, stopReason?: string): void;
1445
1492
  /** Put a launched seat in the agent table, then mark its reserved name placed. */
1446
- private place;
1493
+ protected place(name: string, a: ManagedAgent): void;
1447
1494
  /** The once task's exit hook, on the handle the seat was launched with: whichever path ends the
1448
1495
  * seat, its proved exit cancels a task that has no terminal yet and discharges the seat's debt. An
1449
1496
  * exit that cannot be proved leaves both. */
1450
- private watchOnceExit;
1497
+ protected watchOnceExit(a: ManagedAgent): void;
1451
1498
  /** End a once task that can no longer run: once its connector, when it has a `retire` hook, proves
1452
1499
  * the seat's launched processes gone, cancel the task with `reason` if it has no terminal yet,
1453
1500
  * then drop its index entry. One flight per task; a failure keeps it in {@link onceSettles} and
1454
1501
  * the turn sweep retries it. */
1455
- private settleOnceTurn;
1502
+ protected settleOnceTurn(ref: GoalRef, reason: string, retire?: OnceRetire): Promise<void>;
1456
1503
  /** Cancel a once task with `reason` unless it already has a terminal. */
1457
- private commitOnceCancel;
1504
+ protected commitOnceCancel(ref: GoalRef, reason: string): Promise<void>;
1458
1505
  /** Ask the seat's connector to prove its launched processes gone, within {@link ONCE_RETIRE_MS}.
1459
1506
  * Throws without that proof. */
1460
1507
  private retireOnceSeat;
1461
1508
  /** Make an adopted seat a once seat again: its exit settles its task, and the task is served to
1462
1509
  * it. A task that ended before the restart owes the stop the predecessor may not have made. */
1463
- private bindOnceSeat;
1510
+ protected bindOnceSeat(a: ManagedAgent): Promise<void>;
1464
1511
  /** {@link SeatStop.cancelAgentGoal}. */
1465
1512
  private cancelAgentGoal;
1466
- private recordSlotRuntime;
1467
- private recordSlotCustody;
1468
- private reserveCustody;
1469
- private spawnCustodied;
1513
+ protected recordSlotRuntime(a: ManagedAgent): Promise<void>;
1514
+ protected recordSlotCustody(a: {
1515
+ name: string;
1516
+ id: string;
1517
+ lifecycleUid: string;
1518
+ }, runtime: RuntimeReference): Promise<void>;
1519
+ protected reserveCustody(runtime: Runtime): RuntimeReference | undefined;
1520
+ protected spawnCustodied(runtime: Runtime, name: string, spec: LaunchSpec, cwd: string, reserved: RuntimeReference | undefined): Promise<AgentHandle>;
1470
1521
  /** Keep launch provenance independent of status and runtime wire contracts: {@link watchConnectorHolder}. */
1471
- private watchConnectorHolder;
1472
- private refreshSeatRecord;
1473
- private dropSeatRecord;
1522
+ protected watchConnectorHolder(handle: AgentHandle, holder: ReturnType<typeof retainConnectorSeat>): void;
1523
+ protected refreshSeatRecord(a: ManagedAgent): void;
1524
+ protected dropSeatRecord(a: {
1525
+ name: string;
1526
+ lifecycleUid: string;
1527
+ }): void;
1474
1528
  /** True when a default stop wrote a runtime reference for this exact lifecycle and it is still
1475
1529
  * there. That file is what a later manager adopts, so a slot free must not remove it before the
1476
1530
  * retirement that confirms the lifecycle is gone. */
1477
- private releasedSeatPending;
1478
- private seatRecordFor;
1479
- private adoptSeat;
1480
- private restartSupervisedSeat;
1481
- private reapOrphanSeat;
1482
- private driveStaticRetirement;
1483
- private openStaticChatSession;
1484
- private retireStaticChatSession;
1531
+ protected releasedSeatPending(a: {
1532
+ name: string;
1533
+ lifecycleUid: string;
1534
+ }): boolean;
1535
+ protected seatRecordFor(row: StaticManagedSlotRow): SeatRecord | undefined;
1536
+ protected adoptSeat(row: StaticManagedSlotRow, record: SeatRecord): Promise<string | undefined>;
1537
+ protected restartSupervisedSeat(row: StaticManagedSlotRow, record: SeatRecord): Promise<string | undefined>;
1538
+ protected reapOrphanSeat(a: {
1539
+ name: string;
1540
+ runtime?: RuntimeReference;
1541
+ }): Promise<void>;
1542
+ protected driveStaticRetirement(a: TeardownTarget, surfaceFailure?: boolean, onDeprovision?: (accounting: DeprovisionResourceAccounting) => void): Promise<void>;
1543
+ protected openStaticChatSession(raw: unknown): Promise<{
1544
+ alias: string;
1545
+ actor: string;
1546
+ lifecycleUid: string;
1547
+ expiresAt: number;
1548
+ sealer: string;
1549
+ sealed: string;
1550
+ }>;
1551
+ protected retireStaticChatSession(raw: unknown): Promise<{
1552
+ outcome: "retired" | "alreadyRetired" | "failed";
1553
+ reason?: string;
1554
+ }>;
1485
1555
  private retireChatSessionsOnStop;
1486
1556
  private reportChatSessionsLeftAtStop;
1487
- private renewManagedStaticCred;
1488
- private readStaticReconcileSlot;
1557
+ protected renewManagedStaticCred(a: ManagedAgent): Promise<void>;
1558
+ protected readStaticReconcileSlot(alias: string): Promise<StaticManagedSlotRow | undefined>;
1489
1559
  private awaitStaticReconcileDrain;
1490
- private reconcileStaticLifecycles;
1560
+ protected reconcileStaticLifecycles(postAdoption?: boolean): Promise<void>;
1491
1561
  /** {@link SeatStop.lifecycleMembershipRefusal}. */
1492
- private lifecycleMembershipRefusal;
1493
- /** Open a short-lived PROVISIONER connection, run the onboarding ops on it, and drain it (closure (ii),
1494
- * residual 2). The DM/DLV consumer-create surface — the irreducible onboarding power — lives only for
1495
- * this window, never as a standing grant on the long-lived supervisor. A provision-only endpoint
1496
- * (no presence/consume/channel-watch) connected with memory-only `provisioner` creds; it sets its own
1497
- * `inboxPrefix` so JS-API replies land on the `_INBOX_<id>.>` the provisioner cred subscribes. */
1498
- private withProvisioner;
1499
- /** A connection holding this instance's transfer reader grants (docs/design/resume-transfer.md
1500
- * section 6) for this one receive or sweep: minted from the space's signing seed, or issued by the
1501
- * host to a remote manager. An open mesh enforces no grants, so a bare one-shot connection is that
1502
- * reader there. */
1503
- private withTransferReader;
1562
+ protected lifecycleMembershipRefusal(...args: Parameters<SeatStop["lifecycleMembershipRefusal"]>): ReturnType<SeatStop["lifecycleMembershipRefusal"]>;
1563
+ /** {@link BrokerTransport.withProvisioner}. */
1564
+ protected withProvisioner<T>(fn: (prov: CotalEndpoint) => Promise<T>): Promise<T>;
1565
+ /** {@link BrokerTransport.withTransferReader}. */
1566
+ protected withTransferReader<T>(fn: (nc: NatsConnection) => Promise<T>): Promise<T>;
1504
1567
  /** {@link SeatStop.opPurge}. */
1505
- private opPurge;
1568
+ protected opPurge(...args: Parameters<SeatStop["opPurge"]>): ReturnType<SeatStop["opPurge"]>;
1506
1569
  /** {@link PersonaCatalog.opDefinePersona}. */
1507
- private opDefinePersona;
1570
+ protected opDefinePersona(...args: Parameters<PersonaCatalog["opDefinePersona"]>): ReturnType<PersonaCatalog["opDefinePersona"]>;
1508
1571
  /** {@link PersonaCatalog.opRemovePersona}. */
1509
- private opRemovePersona;
1572
+ protected opRemovePersona(...args: Parameters<PersonaCatalog["opRemovePersona"]>): ReturnType<PersonaCatalog["opRemovePersona"]>;
1510
1573
  /** {@link PersonaCatalog.personaOwner}. */
1511
- private personaOwner;
1574
+ protected personaOwner(...args: Parameters<PersonaCatalog["personaOwner"]>): ReturnType<PersonaCatalog["personaOwner"]>;
1512
1575
  /** {@link PersonaCatalog.canReadPersona}. */
1513
- private canReadPersona;
1576
+ protected canReadPersona(...args: Parameters<PersonaCatalog["canReadPersona"]>): ReturnType<PersonaCatalog["canReadPersona"]>;
1514
1577
  /** {@link PersonaCatalog.opListPersonas}. */
1515
- private opListPersonas;
1578
+ protected opListPersonas(...args: Parameters<PersonaCatalog["opListPersonas"]>): ReturnType<PersonaCatalog["opListPersonas"]>;
1516
1579
  /** {@link PersonaCatalog.opShowPersona}. */
1517
- private opShowPersona;
1580
+ protected opShowPersona(...args: Parameters<PersonaCatalog["opShowPersona"]>): ReturnType<PersonaCatalog["opShowPersona"]>;
1518
1581
  /** {@link TerminalInput.inputAuthorized}. */
1519
- private inputAuthorized;
1582
+ protected inputAuthorized(...args: Parameters<TerminalInput["inputAuthorized"]>): ReturnType<TerminalInput["inputAuthorized"]>;
1520
1583
  /** {@link TerminalInput.attachAuthorized}. */
1521
- private attachAuthorized;
1584
+ protected attachAuthorized(...args: Parameters<TerminalInput["attachAuthorized"]>): ReturnType<TerminalInput["attachAuthorized"]>;
1522
1585
  /** {@link TerminalInput.establishConsoleSession}. */
1523
1586
  private establishConsoleSession;
1524
- /** Managed agents cross-referenced with live presence (the manager sees the roster).
1525
- *
1526
- * `ownerFilter`: restrict to agents whose spawn-time stored `userOwner` equals it (the ps/status
1527
- * owner-domain bound); undefined = unbounded. {@link NO_OWNER_MATCHES} matches nothing. */
1528
- private list;
1587
+ /** {@link StatusAndModels.list}. */
1588
+ protected list(...args: Parameters<StatusAndModels["list"]>): ReturnType<StatusAndModels["list"]>;
1529
1589
  }
1530
1590
  //# sourceMappingURL=manager.d.ts.map