@cotal-ai/manager 0.169.0 → 0.171.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/manager.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { type DeprovisionResourceAccounting, type IssuedBinding } from "@cotal-ai/core";
2
2
  import { type SeatCap } from "@cotal-ai/workspace";
3
- import type { PersonaEndpoint, ControlEndpoint, ControlReply, EpCaller, EpErrorCode, InlinePersona, LaunchOpts, MeshLaunchAgent, RuntimeReference, SecretStore } from "@cotal-ai/core";
4
- import { type AgentHandle, type RuntimeMode } from "./runtime/index.js";
3
+ import type { PersonaEndpoint, Connector, ControlReply, EpCaller, RuntimeReference, SecretStore } from "@cotal-ai/core";
4
+ import { type AgentHandle, type Runtime, type RuntimeMode } from "./runtime/index.js";
5
+ import type { SpawnHooks, StartAgentOpts } from "./seat-types.js";
6
+ export type { ManagedAgent, SpawnAcceptance, SpawnHooks, StartAgentOpts } from "./seat-types.js";
5
7
  export { STATIC_RECONCILE_RETRY_DELAYS_MS } from "./managed-static-lifecycle.js";
8
+ export { credRenewIntervalMs } from "./credential-renewal.js";
6
9
  export { ManagerInstanceLeaseHeld } from "./lease-keeper.js";
7
- import { type ContinuityAssignment } from "./launch.js";
8
- import { type EpServeGrant, type GoalRef, type Identity } from "@cotal-ai/core";
10
+ import { CredentialRenewal } from "./credential-renewal.js";
11
+ import { type EpServeGrant, type Identity } from "@cotal-ai/core";
9
12
  import { type ManagerStopImpact } from "./manager-service-contract.js";
10
13
  /** Backstop for the detached-launch readiness race (#159 B1). `startAgent` waits on two REAL outcomes —
11
14
  * the assigned id joining the mesh (presence) = started, the child process exiting = failed — NOT a
@@ -27,24 +30,6 @@ export declare const PASTE_END = "\u001B[201~";
27
30
  * stream. The message carries that runtime's own guidance, which is operator copy and changes; this
28
31
  * marker is the contract a caller keys on so it can act without reading the wording. */
29
32
  export declare const RUNTIME_NO_TERMINAL_DETAIL = "ai.cotal.manager.runtime-no-terminal";
30
- /** Pick a `setInterval` period for {@link Manager.renewDaemonCreds} that guarantees at least one
31
- * tick lands inside every renewal owner's `[renewAt, exp)` window.
32
- *
33
- * `inspectCredHealth` marks a credential `near-expiry` at 75% of its iat-to-exp lifetime and
34
- * `expired` at 100%, so the window width is TTL/4. Ticks TTL/4 apart therefore land at least once
35
- * inside every window; ticks TTL/2 apart (the old schedule) can miss it entirely for any TTL. That
36
- * is the cause of Cotal #457, reproduced at both TTL=86400 and TTL=20 (the compressed-ratio probe).
37
- *
38
- * Deriving from the caller's TTL keeps the schedule correct for any credential class: the 24h
39
- * `STANDING_RENEWABLE_TTL_SEC` and the 30-day `ROTATION_RENEWED_TTL_SEC` both get a tick inside
40
- * their own renewal window without a hardcoded number. Post-boot responsiveness is already
41
- * covered by the caller invoking `renewDaemonCreds` once synchronously before starting the timer,
42
- * so no separate floor is needed. The pass is idempotent, since `renewDaemonCreds` no-ops each
43
- * credential when its state is `healthy`, so a tick that lands before the window costs one health
44
- * check per owner. A managed seat's credential is judged as of the next tick instead, because the
45
- * seat re-reads its file only once a minute and nothing pushes the renewal to it: a tick that
46
- * lands in the window's last minute can come too late for the seat to adopt it. */
47
- export declare function credRenewIntervalMs(ttlSeconds: number): number;
48
33
  export interface ManagerOptions {
49
34
  space: string;
50
35
  /** Assert the embedding generation matches this Manager. Installed first-party connectors
@@ -473,363 +458,6 @@ export interface ManagerResumeResult {
473
458
  }>;
474
459
  error?: string;
475
460
  }
476
- /** A spawn request, typed. The control-plane `start` op parses one of these out of an
477
- * untyped request; roster boot constructs them directly. Both funnel into {@link Manager.startAgent}. */
478
- export interface StartAgentOpts {
479
- /** The persona REF to spawn — a filename in `.cotal/agents` (the unique spawn key), discovered as
480
- * `.cotal/agents/<name>.md`. NOT the mesh identity: the spawned peer presents under the file's
481
- * own `name:` (auto-numbered on collision). The file must exist (no silent default-ACL fallback).
482
- * With {@link persona}, the helper's own name instead, numbered on collision the same way. */
483
- name: string;
484
- /** An inline persona in place of a catalog file. It takes no `config` or `identity`. Validated
485
- * where it is read, so a direct call meets the same refusals as the served door. */
486
- persona?: InlinePersona;
487
- /** The workflow run whose driver sends this spawn (SPEC 14.8). A manager that does not host the
488
- * run reads the run's admission and bounds the helper by it, as the hosting manager does. */
489
- runId?: string;
490
- /** Connector / agent type — resolved from the registry. Outranks the persona pin and every default (see `resolveAgentType`). */
491
- agent?: string;
492
- /** Detached caller's default connector, kept separate from an explicit flag so the persona file
493
- * can outrank it. Imperative control requests only; direct and manifest launches omit it. */
494
- defaultAgent?: string;
495
- role?: string;
496
- /** Explicit agent-file path that overrides the `name` ref for *which file to load* (identity still
497
- * comes from that file's `name:`). The file must exist. */
498
- config?: string;
499
- /** Presence-identity OVERRIDE (the `--name` flag with a positional/`--config` naming the file):
500
- * wins over the persona file's `name:`, exactly as in foreground `cotal spawn`. Imperative-only —
501
- * a manifest launch (`resolved`) is the identity authority and rejects it. */
502
- identity?: string;
503
- /** Model override (the `--model` flag). Takes precedence over the agent file's `model:`. */
504
- model?: string;
505
- /** Model variant override (the `--variant` flag). Takes precedence over the agent file's `variant:`. */
506
- variant?: string;
507
- /** Opaque connector launch options (the `--opt k=v` flags). Merged per key over the agent file's
508
- * `launchOptions:` (imperative wins); forwarded verbatim to the connector, which validates them. */
509
- launchOptions?: Record<string, unknown>;
510
- /** USER-MESH manifest launches only: the derived owner (`u_…`) from the launch spec (the
511
- * logged-in operator who applied it). Imperative spawns resolve the owner from the ctl
512
- * CALLER's principal instead — never from a payload field. */
513
- owner?: string;
514
- /** Opaque host-local session id to FORK into the mesh (the `--resume` flag), forwarded verbatim to
515
- * the connector. Only ever set from imperative control args (`opStart`), NEVER from `resolved` —
516
- * the manifest path stays resume-free by construction. Unsupported connectors throw at buildLaunch. */
517
- resume?: string;
518
- /** The one-time claim `transcript-receive` issued for carried bytes of {@link resume} (#1499), and
519
- * the agent the CLI found them with. Imperative control args only, like `resume`. */
520
- resumeClaim?: string;
521
- resumeAgent?: string;
522
- /** Publish the session's AG-UI event plane to its own principal-keyed event channel. Defaults to
523
- * on when the connector declares one; `false` (`--no-events`) is the explicit opt-out. */
524
- events?: boolean;
525
- eventPayloads?: boolean;
526
- /** #373: set by `opStart` when a non-owner, non-admin caller omitted `events` and the plane was served
527
- * disarmed. Carried into the reply data so the caller sees the downgrade — never silent. */
528
- eventsNotice?: string;
529
- /** Initial prompt auto-submitted at session start (the `--prompt` flag), forwarded verbatim to
530
- * the connector. Imperative launches only — a manifest launch carries its own `resolved.prompt`
531
- * and rejects this flag alongside it (one source, no merge). */
532
- prompt?: string;
533
- /** Access-policy overrides (the `--subscribe` / `--allow-subscribe` / `--allow-publish` flags):
534
- * win over the persona file exactly as in foreground `cotal spawn`, and are minted into the
535
- * creds AND forwarded to the connector from ONE source. Imperative-only — a manifest launch
536
- * (`resolved`) is the access authority and rejects these. */
537
- subscribe?: string[];
538
- allowSubscribe?: string[];
539
- allowPublish?: string[];
540
- /** Channels the seat joins on top of its resolved read set (the peer door's `join`). Each must
541
- * fall within the read ACL that resolves below, or the spawn is refused; nothing is widened.
542
- * Imperative-only, rejected with `resolved`. */
543
- join?: string[];
544
- /** The spawner's own read/post ACL. Consulted only when the persona file names no channel field
545
- * at all (`subscribe`, `allowSubscribe`, `allowPublish` all absent): the seat is then scoped to
546
- * its spawner, never wider. A persona that names any channel field is the authority and this is
547
- * ignored. The spawner's event channel is never inherited (the seat mints its own below).
548
- * Imperative-only, rejected with `resolved`. */
549
- callerAcl?: {
550
- allowSubscribe: string[];
551
- allowPublish: string[];
552
- };
553
- /** The request subject the served `spawn` door answered. A hosted enrollment forwards it, and the
554
- * issuing host makes the caller it saw publish that subject the helper's parent (SPEC 13.6).
555
- * Set by the served door only. */
556
- served?: string;
557
- /** Names of the operator's configured MCP servers this agent gets (absent → all declared for the
558
- * connector — the pre-merge manager behavior; `[]` → none). */
559
- shareTools?: readonly string[];
560
- /** Declarative in-place restart policy from a workflow `spawn`. When set, the manager restarts
561
- * the process under the same name, lifecycle uid, persona, worktree and permits until
562
- * `restarts` deaths fall inside `windowMs`. Absent: only a continuation-capable connector
563
- * (pi) arms the existing session-recovery constants. */
564
- supervise?: {
565
- restarts: number;
566
- windowMs: number;
567
- };
568
- /** A `once` spawn: the prompt is relayed as the seat's one turn instead of a kickoff, and the
569
- * seat is stopped when that turn ends. `deadlineMs` is resolved: `undefined` means no deadline. */
570
- once?: {
571
- deadlineMs: number | undefined;
572
- };
573
- /** A fully-resolved launch profile (from a mesh manifest via `supervise --launch`). When present,
574
- * `startAgent` takes identity/role/ACLs/capabilities/model from here — NOT from a persona file —
575
- * and `config` points at the materialized transient persona the connector reads. The persona file
576
- * is never the access authority in this path. */
577
- resolved?: MeshLaunchAgent;
578
- /** Per-agent working directory to root this agent at, overriding the manager's shared
579
- * workspaceRoot. Lets different agents run in different repos/folders. A relative path is
580
- * resolved against the manager's workspace root. Omitted → the agent uses workspaceRoot. */
581
- cwd?: string;
582
- /** Internal resolved-manifest provenance used by the preservation inventory. */
583
- launchRef?: {
584
- runId: string;
585
- requested: string;
586
- hash: string;
587
- };
588
- /** The §13.2 rail this spawn rode. Class-rail harness refusals name `--on`; instance-pinned
589
- * refusals stay local. Direct `startAgent` (roster / `--spawn`) is not a class request. */
590
- route?: "one" | "all" | "inst";
591
- /** The terminal runtime this one seat launches on. Absent uses this manager's own runtime, the
592
- * same choice `cotal up --runtime` made. A named runtime is resolved once and reused for every
593
- * later seat that names it. An unknown or unreachable one refuses the launch and starts nothing. */
594
- runtime?: string;
595
- /** Launch under an admitted delegated user intent (SPEC 13.16): the agent is `owner`'s, and
596
- * `parent` is its ledger parent and its recorded spawner. Set only by the composition root's
597
- * in-process call; the ctl spawn handler never maps a payload field into it. */
598
- delegatedIntent?: {
599
- intentId: string;
600
- owner: string;
601
- parent: string;
602
- };
603
- }
604
- interface ManagedLaunch {
605
- source: ManagerResumeAgent["launch"]["source"];
606
- /** The runtime kind this seat was launched on. Absent means the manager's own runtime. */
607
- runtime?: string;
608
- cwd: string;
609
- model?: string;
610
- variant?: string;
611
- prompt?: string;
612
- subscribe?: string[];
613
- allowSubscribe: string[];
614
- allowPublish?: string[];
615
- capabilities?: string[];
616
- /** The persona's endpoint commands, as minted. Renewal re-mints their rows. */
617
- endpoints?: PersonaEndpoint[];
618
- events: boolean;
619
- eventPayloads?: boolean;
620
- shareTools?: readonly string[];
621
- forkSource?: string;
622
- /** Read from {@link resumeRecordPath} once the seat has written it, then kept. */
623
- resumed?: ForkProvenance;
624
- /** A carried resume's claim (#1499): the digest the manager staged, which the seat's fork record
625
- * must name before {@link resumed} is set, the host it came from, and when it was staged. */
626
- carried?: {
627
- transcriptSha256: string;
628
- host: string;
629
- transferredAt: string;
630
- };
631
- /** The connector's {@link LaunchSpec.resumeRecordPath} for this seat's fork. */
632
- resumeRecordPath?: string;
633
- sessionId?: string;
634
- unresolvedLaunchOptionKeys?: string[];
635
- }
636
- export interface ManagedAgent {
637
- name: string;
638
- role?: string;
639
- agent: string;
640
- /** The seat-private Claude home a carried resume launched in (#1499), removed when the seat is freed. */
641
- seatHome?: string;
642
- /** Stable id the manager assigned this agent at spawn: the nkey public key (static auth), or
643
- * the owner+actor principal dot-form (user mode). */
644
- id: string;
645
- /** This incarnation's lifecycle UID (SPEC §13.1), minted once per spawn: the uid its
646
- * lifecycle-keyed broker footprint (`dm_…-<uid>`/`dlv_…-<uid>`/ACL row) carries and the ONLY
647
- * incarnation its teardown credential may name — a replayed teardown cannot reach a same-name
648
- * successor (its uid differs). */
649
- lifecycleUid: string;
650
- /** Private nkey seed, kept so a later step can mint matching creds for this id. Static auth
651
- * only — a user-mode agent has no static identity (its credential is its bearer). */
652
- seed?: string;
653
- /** The SPEC 13.15 issuance of a static agent's credential: the generation its rails carry and
654
- * the accepted-row token its endpoint discovers it by. A renewal keeps both (the ceiling is
655
- * unchanged by construction); absent on a user-mode or open agent. */
656
- issued?: IssuedBinding;
657
- /** Set for a USER-MODE agent: its derived owner. Marks the slot for user-mode teardown (ledger
658
- * revoke + token/sentinel/health file removal) and the auth-health read in {@link list}. */
659
- userOwner?: string;
660
- /** Launched under a delegated user intent (SPEC 13.16). Only {@link Manager.retireDelegatedAgent}
661
- * retires it: this holder's own prepare and requester bind to the holder's owner. */
662
- delegated?: true;
663
- /** The FS materialization paths of THIS incarnation's secret family, recorded at spawn (the
664
- * lifecycle-keyed derivation) or at adoption (the resume inventory's recorded paths — possibly a
665
- * previous generation's name-keyed layout). Teardown, preservation, and health reads consume
666
- * THESE, never a re-derivation by name alone, so a stale/replayed teardown can only ever address
667
- * this incarnation's own files — the manager-local half of the SPEC 13.1 name-disjoint
668
- * discipline (the broker half is the uid-pinned deprovisioner). Present per mode: static =
669
- * `creds`; user = `actorToken`/`sentinelCreds`/`health`; open = absent. Absent (never `{}`)
670
- * when nothing was recorded, so teardown's uid-keyed derivation fallback stays reachable. */
671
- secretPaths?: {
672
- creds?: string;
673
- actorToken?: string;
674
- sentinelCreds?: string;
675
- health?: string;
676
- };
677
- /** Authenticated id of the peer that requested this spawn (the control-plane `req.from.id`),
678
- * or the manager's own id for roster/pre-spawn. Non-forgeable — set by `handle()`. The spawner
679
- * ledger (P4b) keys own-children despawn + reap-on-parent-exit off this. */
680
- spawner: string;
681
- authorityParent?: string;
682
- startedAt: number;
683
- handle: AgentHandle;
684
- /** This agent's local control endpoint (path + first-frame auth token), when its connector runs
685
- * one. Kept in memory only (never persisted — token hygiene) so a graceful stop on a signal-less
686
- * runtime (ConPTY/Windows) can send a cooperative `{op:"shutdown"}` over it instead of a hard
687
- * kill that would deny the agent its clean mesh-leave. */
688
- control?: ControlEndpoint;
689
- /** Set when `Runtime.spawnDelegated` started this seat outside the manager's filesystem. Its
690
- * handle's `stop()` is the fenced close by lifecycle key, which retirement runs only after the
691
- * host revoked the grant, never from the stop door. */
692
- handedOff?: true;
693
- launch: ManagedLaunch;
694
- /** The bounded launch wait elapsed without a join. Process liveness is separate, and an
695
- * exact-incarnation late join clears this diagnostic without stopping the seat. */
696
- joinIssue?: string;
697
- /** Set on a manifest `continuity: exact` seat once its first session was proven: the coordinates
698
- * its assignment is recorded under, kept current at every later proven rebind and at its stop. */
699
- continuity?: Omit<ContinuityAssignment, "version" | "sessionId">;
700
- /** In-memory process-recovery input. It is never persisted with secret values: preservation
701
- * reconstructs it from the validated inventory and current config. Continuation-capable
702
- * connectors (pi) receive it by default; any connector receives it when spawn carries
703
- * `supervise`. */
704
- restart?: {
705
- opts: LaunchOpts;
706
- sessionStatePath?: string;
707
- crashes: number[];
708
- recovering: boolean;
709
- armed: boolean;
710
- /** Present when spawn carried `supervise`; recoverManagedSession takes its budget from it.
711
- * Absent on the pi path without a policy, which keeps SESSION_RESTART_LIMIT / WINDOW_MS. */
712
- policy?: {
713
- restarts: number;
714
- windowMs: number;
715
- };
716
- };
717
- /** Set on a `once` seat: the goal of its one task, and why this manager stopped the seat, if it
718
- * did. The task is cancelled with that reason when the seat's exit is proved before it ended. */
719
- once?: {
720
- ref: GoalRef;
721
- stopReason?: string;
722
- retire?: string;
723
- };
724
- /** The connector's clause when this seat's startup ended `ready` on a connector whose idle wake
725
- * needs a confirmed startup: mesh traffic does not wake the seat. On the spawn reply and the ps row. */
726
- startupNotice?: string;
727
- /** Preservation and a not-yet-confirmed resume retain broker/auth state if the process exits. */
728
- suppressCleanup?: boolean;
729
- /** The TERMINALIZING latch: flipped SYNCHRONOUSLY before the first await on every
730
- * stop/despawn path (stopHandle + freeSlot are the chokepoints). Once set, this principal's
731
- * control ops refuse and no later renewal is admitted. A renewal already admitted drains before
732
- * the durable terminal begins, so its row and material are included in revocation and cleanup. */
733
- terminalizing?: boolean;
734
- /** Why this manager stopped the seat, set with {@link terminalizing} by the first stop. The exit
735
- * watcher frees the slot with it, so an exit the stop caused is not logged or ended as the
736
- * seat's own. */
737
- stopCause?: FreeSlotCause;
738
- /** Set while the manager has logged this seat off the mesh with its slot still held (#1208);
739
- * cleared when the seat is logged back on. */
740
- offMesh?: boolean;
741
- /** The one renewal admitted before terminalization. Retirement drains it before revocation and
742
- * cleanup; callers arriving after the latch never join it. */
743
- staticCredentialRenewal?: Promise<void>;
744
- }
745
- /** Runtime hooks the spawn-as-action serve path injects into {@link Manager.startAgent}.
746
- * Roster boot and the blocking callers pass none (unchanged behavior). */
747
- export interface SpawnHooks {
748
- /** Fires synchronously AFTER the incarnation identity (nkey + lifecycleUid) is minted but BEFORE
749
- * any provision/side-effect — the accept seam: it binds the goal and replies the acceptance. A
750
- * THROW here aborts the spawn before provisioning (the existing catch returns the failure and the
751
- * finally releases the reserve, so no footprint leaks) — this is the bind-conflict refusal path.
752
- * On the hosted enrollment arm it fires right after the host enrolls the agent, because the host
753
- * picks the uid; a throw there rolls that enrollment back. */
754
- onAccepted?: (allocated: {
755
- name: string;
756
- identity: Identity;
757
- lifecycleUid: string;
758
- agentTriple: {
759
- owner: string;
760
- actor: string;
761
- uid: string;
762
- };
763
- }) => Promise<void> | void;
764
- /** Fires once the child process has been launched (the "launched" progress edge). A THROW here
765
- * aborts the spawn with the seat already running and the handle held only in a local, so the
766
- * finally's orphan rollback reaps it by the reference the spawn reserved. */
767
- onLaunched?: () => void;
768
- /** Fires once the connector has supplied the exact bounded readiness window for this launch,
769
- * before the process starts. The action goal records that same value at acceptance. */
770
- onReadinessWindow?: (readinessTimeoutMs: number) => Promise<void> | void;
771
- /** Fires at the readiness verdict (presence join → succeeded / process exit → failed / window
772
- * elapsed → uncertain), carrying the succeeded reply data — the async serve body commits the goal
773
- * terminal + emits the final progress event here. Awaited, but the caller swallows its own errors
774
- * so a terminal-commit failure never disrupts the (already-replied) spawn. Resolves true only
775
- * when this call committed the terminal; a once task is served only after that. */
776
- onOutcome?: (outcome: {
777
- kind: "succeeded" | "failed" | "uncertain";
778
- data?: unknown;
779
- }) => Promise<boolean | void> | boolean | void;
780
- /** Fires when this spawn ends with its goal's terminal owned by ANOTHER path — today only a
781
- * despawn/stop that lands inside the readiness window, whose own handler commits `cancel`.
782
- * It commits nothing; it only claims the terminal so the post-accept fallback does not
783
- * manufacture a `failed` from the non-ok reply and race the real `cancel`. Without it, a
784
- * deliberate stop mid-launch reports the agent as having died on launch. */
785
- onTerminalDeferred?: () => void;
786
- /** Fires right before the first effect this spawn or launch takes: the name reserve, a re-driven
787
- * teardown, or a launch file written to disk. A refusal before it changed nothing, so the
788
- * action path answers it `not-executed` (SPEC 13.3); one after it keeps an unknown outcome. */
789
- onEffect?: () => void;
790
- /** Fires when a refusal after the first effect left nothing behind: the host refused the agent's
791
- * enrollment with `code`, and the spawn removed every secret it had staged. The action path
792
- * answers it `not-executed` with that code, as it answers a refusal before the first effect. */
793
- onUndone?: (code: EpErrorCode) => void;
794
- /** Fires right after `onAccepted` on a `once` spawn, before anything launches: accepts the seat's
795
- * one task as a turn addressed to the allocated incarnation and returns its goal. A throw fails
796
- * the spawn. */
797
- onOnce?: (task: {
798
- seat: {
799
- name: string;
800
- owner: string;
801
- actor: string;
802
- uid: string;
803
- };
804
- prompt: string;
805
- spawner: string;
806
- deadlineMs: number | undefined;
807
- readinessDeadlineMs: number;
808
- retire?: string;
809
- }) => Promise<{
810
- ref: GoalRef;
811
- deadlineAt?: number;
812
- }>;
813
- }
814
- /** The spawn-as-action acceptance floor: the ALLOCATED agent identity (name + the
815
- * addressing triple) plus the goal coordinates (goalId = the request id) and
816
- * the executor coordinate (the manager incarnation its terminal fences on). Carries NO secret
817
- * material; it names what was actually allocated, never a requested-but-unallocated name. */
818
- export interface SpawnAcceptance {
819
- name: string;
820
- owner: string;
821
- actor: string;
822
- uid: string;
823
- goalId: string;
824
- fingerprint: string;
825
- /** The connector-selected readiness budget persisted on this goal. A synchronous follower must
826
- * outlive it; otherwise it can time out while the manager is still legitimately waiting. */
827
- readinessDeadlineMs: number;
828
- executor: {
829
- lifecycleUid: string;
830
- epoch: number;
831
- };
832
- }
833
461
  /**
834
462
  * The agent supervisor: a long-lived mesh node that owns agent process lifecycle.
835
463
  * It serves control requests on the "manager" service and spawns/kills agents
@@ -969,10 +597,11 @@ export declare class Manager {
969
597
  private readonly onceWatched;
970
598
  /** Process start, for the served `status` uptime. */
971
599
  private readonly startedAtMs;
972
- /** Connector harness inventory. Available paths stay pinned; missing binaries are retried when
600
+ /** Connector harness inventory. Available paths stay pinned; unavailable rows are retried when
973
601
  * launch, model lookup or status asks, without stopping unrelated Manager work. */
974
602
  private connectorStatuses;
975
603
  private connectorRequirements;
604
+ private claudeWakeRecheck?;
976
605
  /** The boot inventory's warnings, printed once start completes, so a refused start prints none. */
977
606
  private bootNotes;
978
607
  /** The complete boot task. stop() joins it after fencing static reconciliation, so a registration
@@ -1112,6 +741,12 @@ export declare class Manager {
1112
741
  private readonly staticLifecycle;
1113
742
  /** User-mode provisioning owns no manager state: each dependency reads through at its use. */
1114
743
  private readonly userProvision;
744
+ /** The goal-writer connection and the goal index it reconciles. Every dependency reads through at its use. */
745
+ private readonly goalWriterComponent;
746
+ /** Renewal of the manager's standing credentials. Every dependency reads through at its use. */
747
+ private readonly credentialRenewal;
748
+ /** The launch pipeline's leaf steps. Every dependency reads through at its use. */
749
+ private readonly seatLaunch;
1115
750
  constructor(opts: ManagerOptions);
1116
751
  get runtimeKind(): string;
1117
752
  /** Whether this manager's runtime opens a terminal stream on the seats it spawns, so a caller
@@ -1212,121 +847,30 @@ export declare class Manager {
1212
847
  /** The delivery shard whose lease names the process that reloads the standing credentials.
1213
848
  * Delivery is single-shard today and the endpoint's own responder reads row 0; naming it here
1214
849
  * keeps the manager's binding check and that reply arguing about the same row. */
1215
- private static readonly DELIVERY_SHARD;
1216
- /** Proof that this manager remints into the store the delivery daemon reloads from.
1217
- * Fingerprint-only `reloadCreds` is safe only after this. Two named, different stores
1218
- * refuse the pass. A daemon that is not bound yet is not a named store: start and
1219
- * remint still proceed (tests, delayed delivery), writing this manager's store. The
1220
- * challenge runs again before every remint, so a later daemon on a foreign store is
1221
- * refused then rather than certified by an earlier absence. A request timeout is not
1222
- * absence: a hung rail would skip the proof, so it fails closed.
1223
- *
1224
- * ABSENCE IS READ OFF THE LEASE ROW, never off the rail's no-responder shape alone (#1694).
1225
- * The rail is queue-grouped, so "no responder answered" is itself something the rail reports,
1226
- * and a responder that answers in a shape the client turns into that error makes the pass read
1227
- * "absent" while a holder is live on the row — certifying every later remint with no proof at
1228
- * all. So a no-responder outcome is decided by the row: a row that names a holder makes the
1229
- * pass refuse (undetermined — a live daemon went unanswered, which must not read as "no
1230
- * daemon"), and only a row that is absent or holderless settles "absent", the state start()
1231
- * treats as not-yet-bound. An unreadable row (a failed read, or a key that exists but does not
1232
- * parse) is a genuine unknown and refuses fail-closed, like a hung rail. */
1233
- private daemonStoreRelation;
1234
- /** Settle a no-responder challenge outcome from the lease row, never from the rail's own
1235
- * reporting shape (#1694). The three cases:
1236
- *
1237
- * 1. The row READS but names a holder: a live daemon holds the shard and the rail went
1238
- * unanswered. That is undetermined, not "no daemon" — treating it as absent would let this
1239
- * manager remint with no proof while a reloading daemon runs, which is exactly what the
1240
- * challenge exists to prevent. Refuse.
1241
- * 2. The row is unreadable — a read that fails (a denied or erroring bucket) OR a key that
1242
- * exists but does not parse as a lease record (`readDeliveryLeaseEntry` throws for both):
1243
- * undetermined, and it refuses the same fail-closed way a hung rail does. Never a silent
1244
- * "absent" over a row the manager could not read.
1245
- * 3. The row is absent or holderless (no key, a DEL/PURGE tombstone, or a row that names no
1246
- * holder): today's "absent", the state start() treats as a daemon that is not bound yet.
1247
- *
1248
- * `deliveryLeaseHolder` swallows its read failures into `undefined`, which would fold case 2
1249
- * into case 3 — so this reads the entry directly and lets the read's own failure refuse. */
1250
- private absentByLeaseRow;
1251
- /** Keep this manager's renewal lease alive between credential passes (#1634). The manager bucket
1252
- * expires keys at MANAGER_LEASE_TTL_MS, far below the credential pass's cadence, so the lease
1253
- * needs its own heartbeat like the per-instance liveness lease. A non-owner calls this too: the
1254
- * CAS is how a survivor picks up a dead owner's expired lease with no operator step. Never
1255
- * throws; a failed heartbeat leaves ownership to the next pass rather than ending the process. */
850
+ static readonly DELIVERY_SHARD = 0;
851
+ /** {@link CredentialRenewal.absentByLeaseRow}. */
852
+ absentByLeaseRow(...args: Parameters<CredentialRenewal["absentByLeaseRow"]>): ReturnType<CredentialRenewal["absentByLeaseRow"]>;
853
+ /** {@link CredentialRenewal.keepDaemonRenewalLease}. */
1256
854
  private keepDaemonRenewalLease;
1257
- /** Decide whether THIS manager owns the daemon's credential renewal (#1634). Both conditions are
1258
- * required, because each answers a question the other cannot:
1259
- *
1260
- * 1. The daemon must reload from this manager's store (#1447). Reminting into a store the daemon
1261
- * never reads writes bytes nobody adopts, and fingerprint-only `reloadCreds` would then name a
1262
- * generation the daemon cannot see.
1263
- * 2. This manager must hold the per-space renewal lease. Store identity CANNOT pick one owner on
1264
- * its own: `sameSecretStoreIdentity` is pure equality with no holder and no tiebreak, so every
1265
- * manager sharing one store passes it, and two owners reminting on independent timers have no
1266
- * ordering between them - one's write lands between the other's re-sign and its adoption
1267
- * request, which is the #773 refusal the challenge exists to prevent.
1268
- *
1269
- * A manager failing either test serves the space normally and skips only the daemon remint. */
855
+ /** {@link CredentialRenewal.claimDaemonRenewalOwnership}. */
1270
856
  private claimDaemonRenewalOwnership;
1271
- /** #2073: arm the `endpoint-serve` credential's own renewal from its `[renewAt, exp)` window
1272
- * instead of `credRenewTimer`'s boot-phased TTL/4 tick, which can miss that window depending on
1273
- * when the timer happened to start relative to the credential's `iat`. Called after the initial
1274
- * mint (`registerManagerService`) and after every successful re-mint in the serve branch below,
1275
- * so the schedule always tracks the CURRENT credential. `credsRenewalDelayMs` is the same 75%
1276
- * convention the endpoint's delivery renewal and the membership feed use (`@cotal-ai/core`); no
1277
- * second copy of that arithmetic lives here. */
857
+ /** {@link CredentialRenewal.scheduleServeRenewal}. */
1278
858
  private scheduleServeRenewal;
1279
859
  private credentialPushRetry?;
1280
860
  private readonly credentialPushes;
1281
861
  private supervisorCredentialPush?;
1282
862
  private readonly pendingCredentialPushes;
1283
863
  private supervisorCredentialPushPending;
1284
- private scheduleCredentialPushRetry;
1285
- /** Retain a busy transport and retry its adopted credential without replaying requests. */
1286
- private pushRenewedCreds;
1287
- private pushRenewedCredsOnce;
1288
- private pushSupervisorCreds;
1289
- private pushSupervisorCredsOnce;
1290
- /** #2073: the shared bounded-retry shape for a closed standing connection: wait out each of
1291
- * {@link STATIC_RECONCILE_RETRY_DELAYS_MS}, trying `attempt` after each. Waiting does not repair
1292
- * two closes, so they skip the first delay. One that closes while an all-duty renewal is in flight,
1293
- * as one the broker expires just before adoption, tries when that renewal adopts. One whose
1294
- * credential has `expired` tries at once, because its attempt renews the credential. A stop landing
1295
- * while this loop waits is not a fault this loop reports (the caller re-checks `leaseStopping`). */
864
+ /** {@link CredentialRenewal.boundedReconnect}. */
1296
865
  private boundedReconnect;
1297
- /** One class-2 renewal pass: re-sign `.cotal/delivery.creds` + `.cotal/membership-rw.creds`
1298
- * for their existing nkeys, then request the delivery daemon's EXPLICIT `reloadCreds` adoption on the
1299
- * delivery-admin rail and persist the audit record (`.cotal/renewal.<spaceKey>.json`) that `cotal doctor auth`
1300
- * renders — so "file re-signed" and "daemon adopted" are distinguishable states. A missing daemon
1301
- * (no responder) is recorded honestly: each daemon's own 75% renewal timer remains the adoption backstop.
1302
- * Never throws — renewal failure must be LOUD (log + record), not fatal to the supervisor. */
866
+ /** {@link CredentialRenewal.renewDaemonCreds}. */
1303
867
  private renewDaemonCreds;
1304
- /** Renew the remote registration executor through the typed host protocol. A healthy credential
1305
- * is retained; near-expiry and expired credentials are replaced for the same nkey. */
868
+ /** {@link CredentialRenewal.renewRemoteExecutor}. */
1306
869
  private renewRemoteExecutor;
1307
- /** An active signerless manager renews its standing duties together. The issuer stages the closed
1308
- * credential family first; broker preflight proves every JWT and existing caller-held nkey
1309
- * before any mutable holder changes. A failed candidate leaves all current creds intact. */
870
+ /** {@link CredentialRenewal.renewRemoteStandingBundle}. */
1310
871
  private renewRemoteStandingBundle;
1311
- /** A signerless manager's closed standing connection re-dials through the all-duty family only.
1312
- * A healthy holder re-dials as is. An unhealthy one waits for the closed renewal and adoption,
1313
- * and a refusal fails this attempt with last-good and debt kept. Nothing is minted locally. */
872
+ /** {@link CredentialRenewal.renewRemoteBeforeRedial}. */
1314
873
  private renewRemoteBeforeRedial;
1315
- private renewRemoteStandingBundleOnce;
1316
- /** Warn, on every renewal pass, when a $SYS credential is at or past its renewal point.
1317
- *
1318
- * The manager is the renewal owner for every credential it CAN re-sign, and these two are the ones
1319
- * it cannot: they are `rotation-renewed`, so no resident process re-mints them and they simply die
1320
- * on their 30-day horizon. Before this, a mesh that never ran `doctor auth` got no signal at all,
1321
- * it discovered the expiry as an "Authorization Violation" in the delivery log and a refused
1322
- * membership adoption, weeks after the warning would have been actionable (#338). The pass runs
1323
- * every half-TTL of the 24h class, so this repeats about twice a day for the ~7 days between the
1324
- * renewal point and expiry: loud enough to be seen, bounded enough not to be noise.
1325
- *
1326
- * Diagnostic only, and deliberately non-fatal: renewal is an operator action (`cotal down` then
1327
- * `cotal up --rotate-sys`, which needs a broker restart), so the manager must report it, never
1328
- * attempt it. An absent file is the unprovisioned space, reported by the daemon that needs it. */
1329
- private warnOnSystemCredExpiry;
1330
874
  /** Admit one lifecycle/control operation while active. The synchronous increment is the fence:
1331
875
  * preserveState and stop close it before their first await, so work is either counted or rejected. */
1332
876
  private beginLifecycle;
@@ -1449,7 +993,7 @@ export declare class Manager {
1449
993
  * readiness reads the same status; the maintenance fence refuses every other command in both
1450
994
  * states. The read is counted in `lifecycleInFlight` like any admitted operation and released in
1451
995
  * `finally`, so a drain waits at most for one status snapshot; the membership gate still
1452
- * applies. `preserving` and a stopping manager stay fenced. Status writes nothing. */
996
+ * applies. `preserving` and a stopping manager stay fenced. */
1453
997
  private serveObservation;
1454
998
  /** The ep door's ADMIN flag for a caller. Static mesh: `true` — the
1455
999
  * admin-grade rows (any-mode despawn/attach, the `manager.admin` family, `launch`) are minted
@@ -1548,10 +1092,7 @@ export declare class Manager {
1548
1092
  * host callback with the full endpoint caller tuple. Error string when denied, `undefined` when
1549
1093
  * allowed; remote host-state faults throw rather than being collapsed into a denial. */
1550
1094
  private authorizeNamed;
1551
- /** The wire PRINCIPAL dot-form a managed agent's presence/control identity carries: user-mode
1552
- * entries already store it in `id`; static mints store the raw nkey there (the durable/teardown
1553
- * key), so the wire form derives under DEV_OWNER. Every comparison against an AUTHENTICATED wire
1554
- * id (presence card.id, control from.id) must go through this, never raw `a.id`. */
1095
+ /** The wire principal of a managed agent: {@link managedPrincipal}. */
1555
1096
  private managedPrincipal;
1556
1097
  private resumeLivenessErrors;
1557
1098
  /** Self-despawn (P2b): stop the managed agent whose id == the authenticated caller. The
@@ -1587,13 +1128,10 @@ export declare class Manager {
1587
1128
  * wait proves exit: nobody asked for those children to be gone, so they stay managed until the
1588
1129
  * runtime says otherwise, and a runtime that cannot prove exit records an unverified stop. */
1589
1130
  private trackStoppedHandle;
1590
- private servedSpawnRequest;
1591
1131
  private provisionUserAgent;
1592
1132
  /** Shred a user agent's secret family from the store and from disk. Every removal is attempted,
1593
1133
  * and each failure joins `unshredded`, so one fault cannot leave the rest of the family behind. */
1594
1134
  private shredUserSecrets;
1595
- private delegatedMeshRecord;
1596
- private composeManagedHandoff;
1597
1135
  /**
1598
1136
  * WHY A SEAT LEFT — one line, at the one place every free path passes through.
1599
1137
  *
@@ -1655,8 +1193,6 @@ export declare class Manager {
1655
1193
  private readManagedSessionState;
1656
1194
  private retainedSessionId;
1657
1195
  private forkProvenance;
1658
- private refuseCarriedFork;
1659
- private refuseLateCarriedFork;
1660
1196
  private readManagedSession;
1661
1197
  private recordContinuity;
1662
1198
  private recordContinuityAtStop;
@@ -1674,8 +1210,6 @@ export declare class Manager {
1674
1210
  * path. */
1675
1211
  private onAgentExit;
1676
1212
  private nameError;
1677
- private nameInUse;
1678
- private uniqueName;
1679
1213
  /** Spawn a teammate by persona ref (`name` loads `.cotal/agents/<name>.md`; the peer presents
1680
1214
  * under that file's own `name:`), as if a peer asked via the control plane. Used to pre-spawn the
1681
1215
  * demo's experts at startup so the manager owns them. */
@@ -1696,14 +1230,8 @@ export declare class Manager {
1696
1230
  * here, and a deadline past the scheduler's last instant is refused here, which the schema does
1697
1231
  * not express. */
1698
1232
  private opStart;
1699
- /** The realpath + directory checks a placed spawn directory must pass on this manager's host,
1700
- * shared by the served `resolve-cwd` command and the `spawn` admission check (#385 item 2): one
1701
- * function, so the two doors never drift. Creates nothing and never substitutes the workspace root. */
1702
- private checkSpawnCwd;
1703
- /** Refuse host directory reads before lookup when seats cannot use this host. */
1704
- private assertHostDirectoryExecution;
1705
1233
  private listSpawnDirectory;
1706
- /** Resolve a placed spawn directory without creating or substituting a workspace. */
1234
+ /** {@link SeatLaunch.resolveSpawnCwd}. */
1707
1235
  private resolveSpawnCwd;
1708
1236
  /** Resolve a connector by agent type. Library composition (installedExtensions off) → a registry
1709
1237
  * hit, exactly as before (the composition root imported what it wants). The published binary gates
@@ -1714,30 +1242,24 @@ export declare class Manager {
1714
1242
  * including providers already present in the registry.
1715
1243
  * Fail-loud with an install hint; no fallback. */
1716
1244
  private resolveConnector;
1717
- /** Connector names the manager can spawn WITHOUT importing: the manifest on the published binary,
1718
- * else whatever a composition root registered. Drives the `models` catalog enumeration. */
1245
+ /** {@link SeatLaunch.connectorNames}. */
1719
1246
  private connectorNames;
1720
1247
  /** Resolve every installed/registered connector's declared harness binaries before the manager
1721
1248
  * reports ready. A missing harness degrades only that connector, never unrelated lifecycle work:
1722
1249
  * boot continues, names it once start completes and records it on both manager status surfaces. */
1723
1250
  private inspectConnectorsAtBoot;
1724
- /** Retry missing applications on the Manager's PATH without changing resolved available rows. */
1251
+ /** Install and verify the hosted Claude wake channel, or report the cause and remedy. */
1252
+ private prepareClaudeWake;
1253
+ /** Retry unavailable applications without changing resolved available rows. Claude launches
1254
+ * join the status or launch that started wake setup, before any name or capacity is reserved. */
1725
1255
  private refreshUnavailableConnectors;
1726
- /** True when at least one declared connector is available. Empty inventory (or a failed
1727
- * inventory load) skips the class `one` subscribe for spawn/launch so this member cannot
1728
- * consume an unpinned request a sibling could serve. */
1256
+ /** {@link SeatLaunch.classSpawnEnabled}. */
1729
1257
  private classSpawnEnabled;
1730
1258
  private omitClassCommands;
1731
- /** Named harness-unavailable refusal. On the class rail a partial inventory must not look
1732
- * like the space cannot launch: name `--on` so the caller can pin a sibling. The standing
1733
- * serve credential cannot enumerate sibling `svc.*.status` inventories, so the residual
1734
- * is the flag, not a list of capable instance ids. Instance-pinned calls keep the local
1735
- * reason only. */
1736
- private harnessUnavailableError;
1737
1259
  /** The harness binaries a managed launch runs, as boot resolved them, or the refusal naming what is
1738
1260
  * missing. Spawn, resume and the model catalog all take it, so a seat launches from the same files
1739
1261
  * whichever path starts it and the catalog never disagrees with a launch about whether the harness
1740
- * is there. Unavailable rows are checked again on PATH; available rows retain their resolved files.
1262
+ * is there. Callers recheck unavailable rows first; available rows retain their resolved files.
1741
1263
  * A connector registered after boot has no inventory row and is checked on PATH now. */
1742
1264
  private launchHarness;
1743
1265
  /** The launch fields the host supplies rather than the seat. Spawn and resume both take them from
@@ -1748,11 +1270,8 @@ export declare class Manager {
1748
1270
  /** The refusal for a launch choice the connector cannot honour. Spawn and resume both ask before
1749
1271
  * a seat's launch is built, so a rule changed here holds on both paths. */
1750
1272
  private capabilityRefusal;
1751
- /** The refusal for a `once` spawn this manager cannot run as one task: every check is made before
1752
- * anything is allocated, so a refused spawn leaves nothing behind. */
1753
- private onceRefusal;
1754
- /** How a once task names who sent it: the spawner's roster name, or its principal when that name is missing or only whitespace. */
1755
- private spawnerName;
1273
+ /** {@link SeatLaunch.onceRefusal}. */
1274
+ onceRefusal(connector: Connector, runtime: Runtime, launch: Pick<StartAgentOpts, "once" | "supervise" | "launchOptions" | "prompt">, spawner: string | undefined, hooks: SpawnHooks | undefined): string | undefined;
1756
1275
  /** The refusal for an event-plane choice the registration policy or the connector cannot meet.
1757
1276
  * Spawn and resume both ask before a seat's launch is built, so a seat retained without the
1758
1277
  * plane cannot come back on a space that now requires it. An absent choice arms supported planes. */
@@ -1788,44 +1307,16 @@ export declare class Manager {
1788
1307
  * defaulting to the manager's own id for roster/pre-spawn — recorded for the spawner
1789
1308
  * ledger (own-children despawn + reap-on-parent-exit). */
1790
1309
  startAgent(opts: StartAgentOpts, spawner?: string, hooks?: SpawnHooks, authenticatedCaller?: EpCaller): Promise<ControlReply>;
1791
- /** The persona file a spawn loads and the harness it resolves, shared by `spawn` and the served
1792
- * `resolve-agent` read: a detached resume locates the session it carries with the connector this
1793
- * names, so the two doors must not drift (#2899). */
1310
+ /** {@link SeatLaunch.spawnPersona}. */
1794
1311
  private spawnPersona;
1795
- /** Whether a persona path resolves into the inline snapshot directory, the directory itself
1796
- * included. A directory that does not exist holds nothing. */
1797
- private insideInlineDir;
1798
- /** The run a spawn acts for (SPEC 14.8). The run this manager drives under `caller` answers from
1799
- * memory. On a static mesh, a spawn from a run hosted elsewhere names its run, whether the program
1800
- * placed it here or the class queue delivered it, and its caller must be that run's driver, whose
1801
- * triple derives from the run id; the run's admission and revocation marker are then read
1802
- * leader-served, so the helper is bounded as the hosting manager bounds it. Elsewhere the run id
1803
- * is not read: a user-auth run's issuing host bounds the helper, and an open mesh bounds none.
1804
- * `undefined` for a spawn that acts for no run. */
1312
+ /** {@link SeatLaunch.spawnRun}. */
1805
1313
  private spawnRun;
1806
- /**
1807
- * Resolve what bounds a spawn's grant on a STATIC mesh: the caller's issued evidence, read the way
1808
- * keyed runs read it. A user-auth mesh bounds the mint on its ledger instead, and an open mesh
1809
- * mints no grant, so both return `exempt`. So does a call with no authenticated caller, which is
1810
- * the manager's own composition root (roster boot, a manifest `launch`, which a static mesh mints
1811
- * only into operator instruments). A workflow run's spawn, whether this manager hosts the run or
1812
- * its spawn reached this manager from another host ({@link spawnRun}), is bounded by the run's admission (SPEC 14.8):
1813
- * the ceiling it recorded, at the starter's coordinate, unless the starter was exempt then. That
1814
- * ceiling is the starter's evidence as resolved at admission, or for a local run the channels the
1815
- * operator named. Any other caller with no issued generation, or whose evidence does not resolve,
1816
- * hands on no grant. The evidence's own standing decides the rest.
1817
- */
1314
+ /** {@link SeatLaunch.staticSpawnBound}. */
1818
1315
  private staticSpawnBound;
1819
- /** The refusal for a grant its static spawner does not hold, or `undefined` when it holds all of
1820
- * it. Each part is named, so the caller can drop exactly what overreached. `armsEvents` is whether
1821
- * the helper's own event plane will be minted: that row is keyed on a principal allocated later,
1822
- * so it is measured as the spawner's own, the rule the ledger applies. `door` names the command
1823
- * being bounded: a persona definition is bounded against its definer as a spawn is. */
1316
+ /** {@link SeatLaunch.spawnBoundRefusal}. */
1824
1317
  private spawnBoundRefusal;
1825
- /** Ordinary static control seats can read their holding instance. A run's recorded ceiling is
1826
- * authoritative, so its helpers receive no additional instance reads. */
1318
+ /** {@link SeatLaunch.managedStaticInstanceReads}. */
1827
1319
  private managedStaticInstanceReads;
1828
- private startAgentActive;
1829
1320
  /** Preflight the whole inventory before launching its first process, then adopt each exact retained
1830
1321
  * principal without provisioning. A later runtime launch failure is reported per-agent, but malformed
1831
1322
  * or missing inventory material can never produce a partially resumed set. */
@@ -1902,33 +1393,11 @@ export declare class Manager {
1902
1393
  private occupancy;
1903
1394
  private occupancyText;
1904
1395
  private capacityRefusal;
1905
- /**
1906
- * The owner a launch belongs to, read ONCE so the per-owner ceiling, the agent's addressing
1907
- * triple and the user-mode provisioner cannot charge three different owners for one seat. A
1908
- * static or open mesh has one owner by construction; a user-auth mesh takes the spec's owner,
1909
- * else the owner of the principal that asked, which is what {@link provisionUserAgent} resolves
1910
- * from the same two values (it refuses outright where this falls back, so the two never disagree
1911
- * on an admitted launch).
1912
- */
1396
+ /** The owner a launch belongs to: {@link NamesCapacity.launchOwner}. */
1913
1397
  private launchOwner;
1914
- /** The owner of a seat this manager supervises, by the same rule {@link launchOwner} admitted it
1915
- * under: a user-mode seat records its derived owner, and every other seat is the mesh's one owner. */
1916
- private seatOwner;
1917
- /**
1918
- * Live seats this manager holds for one owner: the seats it supervises, plus the launches it has
1919
- * reserved for that owner and not yet placed. It deliberately does NOT count cooling stamps — a
1920
- * cooling slot is a seat that already freed, and the recycle floor it holds is a global
1921
- * fork-bomb bound (P4c), not one tenant's occupancy. Mirrors {@link occupancy}'s reserved rule,
1922
- * so a reservation stops being counted twice the moment its seat reaches `agents`.
1923
- */
1398
+ /** Live seats this manager holds for one owner: {@link NamesCapacity.ownerSeats}. */
1924
1399
  private ownerSeats;
1925
- /**
1926
- * The per-owner ceiling, consulted at accept: `undefined` admits the launch, and a refusal
1927
- * carries the owner's count and the cap so a caller can render a remedy and a script can decide
1928
- * without re-reading prose. Distinct from {@link capacityRefusal}, which bounds the HOST: that
1929
- * one frees when anyone stops a seat or a cooling slot expires, this one frees only when THIS
1930
- * owner stops one of its own, or the operator raises the cap, so they cannot share a sentence.
1931
- */
1400
+ /** The per-owner ceiling at accept: {@link NamesCapacity.seatCapRefusal}. */
1932
1401
  private seatCapRefusal;
1933
1402
  private opStop;
1934
1403
  /** The ONE named-terminal core both doors share: the ctl named `stop`
@@ -2011,94 +1480,20 @@ export declare class Manager {
2011
1480
  private healFrozenRegistrationGate;
2012
1481
  private dialServeConnection;
2013
1482
  private registerManagerService;
2014
- /** Mint the standing `goal-writer` credential and STAGE it into this
2015
- * instance's §13.1 revocation family (`epcred.<e>.<iid>`), over the passed executor's `authKv`
2016
- * (the scoped `endpoint-serve-executor`, which holds the epcred write grant). The GRANT profile
2017
- * stays goal-writer-only (Q2, disjoint from the serve credential); only the FAMILY membership
2018
- * is shared, so the registration barrier's existing enumerate+revoke+evict catches the
2019
- * goal-writer on takeover/retire with NO barrier code change. Used both at registration (the run
2020
- * block's `authKv`) and at renewal (a fresh executor's), re-minting the SAME stable nkey with a
2021
- * fresh bounded exp: `mintCreds` stamps a random `issuance:` tag on `goal-writer` (`userTags`),
2022
- * so each issuance signs distinct bytes and stages a distinct ledger row (per-JWT `credentialId`
2023
- * digest) even within one second. */
1483
+ /** {@link GoalWriter.mintAndStageGoalWriter}. */
2024
1484
  private mintAndStageGoalWriter;
2025
- /** #2073: dial the goal-writer's ONE standing connection and rebuild everything derived from it
2026
- * (the fence-resolving action context, the issuance-gate reader) — shared by the initial start
2027
- * and the closed-connection recovery ({@link onGoalWriterConnectionClosed}), so a redial never
2028
- * leaves the context bound to a dead socket. */
2029
- private dialGoalWriter;
2030
- /** #2073: the goal-writer rail's closed-connection fault, the same bounded shape the serve rail
2031
- * uses ({@link onServeConnectionClosed}) through the same {@link boundedReconnect} helper:
2032
- * re-dial with the current credential (a transport blip needs nothing new), re-mint through the
2033
- * existing goal-writer renewal branch when the credential itself has expired, then re-attach.
2034
- * Unlike the serve rail this never exits the process on exhaustion (brief step 4: only the serve
2035
- * rail is the control plane the report lost) — it logs and leaves the credential to the next
2036
- * scheduled renewal pass. */
2037
- private onGoalWriterConnectionClosed;
2038
- /** Spawn-as-action: stand up the standing self-mediated goal-writer connection +
2039
- * ActionContext. Mode-dual, mirroring {@link registerManagerService}: an AUTH mesh uses the
2040
- * scoped `goal-writer` credential already minted + family-STAGED inside registration's run block
2041
- * ({@link mintAndStageGoalWriter} — DISJOINT grant from the serve cred, SHARED §13.1 revocation
2042
- * family); an OPEN mesh uses a bare connection (no credential system to mint from - the broker
2043
- * enforces nothing). The connection presents the CURRENT credential on every (re)connect (a
2044
- * renewal is adopted without reconnecting the whole endpoint); the ActionContext bonds its
2045
- * KV + JS + JSM to this one connection and space (SPEC 13.4), so a composition mixup cannot splice
2046
- * goal state across brokers. */
1485
+ /** {@link GoalWriter.startGoalWriter}. */
2047
1486
  private startGoalWriter;
2048
- /** Retire the goal-writer connection (best-effort, both exit paths). */
1487
+ /** {@link GoalWriter.stopGoalWriter}. */
2049
1488
  private stopGoalWriter;
2050
1489
  private mintAndStageSessionLedger;
2051
1490
  private startSessionPlane;
2052
1491
  private stopSessionPlane;
2053
- /** The boot reconcile: a fresh incarnation (a manager restart takes a NEW
2054
- * instanceId, so the in-memory acceptance map starts empty) inherits the endpoint's accepted-but-
2055
- * unterminal goals from any predecessor. The local signer enumerates with an ephemeral PROVISIONER.
2056
- * A remote manager calls the authenticated host-owned scan, which keeps the sealed consumer and its
2057
- * lifecycle authority on the host; the instance executor, goal-writer, and supervisor hold NO records
2058
- * consumer grant. Settle each orphan so an accepted goal is NEVER dropped across a restart. Open mesh:
2059
- * a bare connection (the broker enforces nothing). Runs ONCE at start, BEFORE spawn-as-action begins
2060
- * accepting (the `goalReconcileDone` gate), so it never races a live goal's acceptance. Never
2061
- * fatal — a reconcile failure is logged and the gate opens either way. */
1492
+ /** {@link GoalWriter.reconcileGoalIndex}. */
2062
1493
  private reconcileGoalIndex;
2063
- /** Settle ONE inherited goal by evidence: no goal record (a crash between the index write and the
2064
- * goal-record create) leaves the pointer untouched (never settle a goal that was never accepted,
2065
- * and clearing it would race a live goal mid-creation); a TERMINAL goal clears the index
2066
- * (converged — the predecessor committed but died before clearing); a NON-TERMINAL goal settles
2067
- * `uncertain` (the accepting incarnation is gone, so the success signal will never reach us — the
2068
- * bounded readiness outcome the plan maps the window to). Within the readiness window it arms a
2069
- * bounded, unref'd timer to settle at the deadline (an early uncertain would steal a still-possible
2070
- * success the substrate guards against). */
2071
- private reconcileOneGoal;
2072
- /** Publish a goal PROGRESS event on the caller-scoped epe subtree, over the SERVE
2073
- * connection (which holds the `epe.<e>.<iid>.<epoch>.>` egress grant; the goal-writer deliberately
2074
- * does not). The terminal rides a final event `phase:"terminal"` (the caller follows epe to
2075
- * the terminal; the durable result fact + inspect/ps are the reconcile authority). A dropped event
2076
- * is non-fatal (the terminal is authoritative in the journal). */
1494
+ /** {@link GoalWriter.emitGoalProgress}. */
2077
1495
  private emitGoalProgress;
2078
- /** The own-gate currency belt: before the goal-writer commits a terminal fact, the manager reads
2079
- * its OWN issuance gate epoch and REFUSES the commit if superseded. This NARROWS the window; it
2080
- * is not the fence. Layer 1 below is closed by the sibling-mint fence; layers 2 and 3 are not
2081
- * closed by any planned slice and must not be described as temporary.
2082
- *
2083
- * THE RESIDUAL, STACKED:
2084
- * 1. SIBLING-MINT INJECTION. A §13.1 barrier's revoke/evict loop closes only over the family
2085
- * SNAPSHOT IT ENUMERATED, so a sibling mint that observes the gate and stages a ledger row
2086
- * WITHOUT the observe/open/commit fence can be staged and released AFTER that enumerate and
2087
- * never be revoked. This layer is closed exactly where BOTH sibling mint sites
2088
- * ({@link mintAndStageGoalWriter}, {@link mintAndStageSessionLedger}) route their stage
2089
- * through `commitSiblingIssuance` (the revision-pinned CAS that makes a losing mint release
2090
- * nothing), and open exactly where they do not — state the mechanism, never the branch.
2091
- * 2. THE BARRIER WINDOW. A gate FREEZE neither kills this connection nor advances the epoch,
2092
- * and this belt compares `processEpoch` alone, so it still PASSES from barrier start until
2093
- * the reopen. A ledger revoke marks a row; it does not re-check a live JWT mid-publish. The
2094
- * durable kill is the CLUSTER-VERIFIED EVICTION, so a deposed manager can INITIATE new
2095
- * terminal publishes from barrier start until eviction is verified — not merely finish bytes
2096
- * already on the wire. Successor EXISTENCE and corpse DEATH are different phases, so the
2097
- * barrier's ordering licenses no conclusion about when the corpse stops being able to write.
2098
- * 3. OPEN MESH. No credential family exists, so the revoke/evict loop is vacuous and this belt
2099
- * is COOPERATIVE only: a non-conformant process simply does not run it.
2100
- * The named follow-up that would close 2 and 3 is the gate-linearized commit (routing the
2101
- * terminal through the issuance gate's own CAS), deliberately deferred as substrate territory. */
1496
+ /** {@link GoalWriter.assertGoalWriterEpochCurrent}. */
2102
1497
  private assertGoalWriterEpochCurrent;
2103
1498
  /** A spawn's refusal reaches only its caller's terminal, so the manager also writes one line for it
2104
1499
  * to its own log, naming the request ID the caller printed, the persona and the reason. */
@@ -2183,9 +1578,7 @@ export declare class Manager {
2183
1578
  * no hold; its goal still records the spawn's readiness budget, which a successor needs to settle
2184
1579
  * it. */
2185
1580
  private acceptOnceTurn;
2186
- /** How a once seat's startup watch ended, waited for until {@link STARTUP_OUTCOME_MS} after its
2187
- * launch or the readiness window, whichever is longer. A watch that has not ended by then, or a
2188
- * seat being stopped, answers what the handle reports at that moment. */
1581
+ /** How a once seat's startup watch ended: {@link awaitStartupOutcome}. */
2189
1582
  private awaitStartupOutcome;
2190
1583
  /** Serve a once task from now on: its spawn's succeeded terminal is written. */
2191
1584
  private openOnceDelivery;
@@ -2197,6 +1590,14 @@ export declare class Manager {
2197
1590
  /** A once seat's helpers end with its task. A natural exit reaps them in {@link onAgentExit}; a
2198
1591
  * stop frees the slot first, so this stop reaps them itself. */
2199
1592
  private stopOnceSeat;
1593
+ /** Stop a seat this spawn just placed and track its exit: the stop first, so the terminalizing
1594
+ * latch is set before anything awaits, then the exit tracking. Both are synchronous. */
1595
+ private stopAndTrack;
1596
+ /** End a once seat before its task is served: let go of the spawn goal, record why it stopped if
1597
+ * `stopReason` is given and none is recorded yet, then stop the seat. Synchronous, in that order. */
1598
+ private endOnceBeforeServe;
1599
+ /** Put a launched seat in the agent table, then mark its reserved name placed. */
1600
+ private place;
2200
1601
  /** The once task's exit hook, on the handle the seat was launched with: whichever path ends the
2201
1602
  * seat, its proved exit cancels a task that has no terminal yet and discharges the seat's debt. An
2202
1603
  * exit that cannot be proved leaves both. */
@@ -2225,9 +1626,8 @@ export declare class Manager {
2225
1626
  private recordSlotCustody;
2226
1627
  private reserveCustody;
2227
1628
  private spawnCustodied;
2228
- /** Keep launch provenance independent of status and runtime wire contracts. */
1629
+ /** Keep launch provenance independent of status and runtime wire contracts: {@link watchConnectorHolder}. */
2229
1630
  private watchConnectorHolder;
2230
- private recordSeat;
2231
1631
  private refreshSeatRecord;
2232
1632
  private dropSeatRecord;
2233
1633
  /** True when a default stop wrote a runtime reference for this exact lifecycle and it is still