@cotal-ai/manager 0.168.0 → 0.170.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/commands.js +1 -0
  2. package/dist/commands.js.map +1 -1
  3. package/dist/control-session.d.ts +5 -5
  4. package/dist/control-session.d.ts.map +1 -1
  5. package/dist/control-session.js +17 -65
  6. package/dist/control-session.js.map +1 -1
  7. package/dist/control-shutdown.d.ts +6 -7
  8. package/dist/control-shutdown.d.ts.map +1 -1
  9. package/dist/control-shutdown.js +9 -38
  10. package/dist/control-shutdown.js.map +1 -1
  11. package/dist/manager.d.ts +53 -603
  12. package/dist/manager.d.ts.map +1 -1
  13. package/dist/manager.js +329 -1950
  14. package/dist/manager.js.map +1 -1
  15. package/dist/names-capacity.d.ts +34 -2
  16. package/dist/names-capacity.d.ts.map +1 -1
  17. package/dist/names-capacity.js +53 -1
  18. package/dist/names-capacity.js.map +1 -1
  19. package/dist/run-hosting.d.ts +1 -0
  20. package/dist/run-hosting.d.ts.map +1 -1
  21. package/dist/run-hosting.js +26 -8
  22. package/dist/run-hosting.js.map +1 -1
  23. package/dist/seat-custody.d.ts +2 -0
  24. package/dist/seat-custody.d.ts.map +1 -1
  25. package/dist/seat-custody.js +10 -1
  26. package/dist/seat-custody.js.map +1 -1
  27. package/dist/seat-launch.d.ts +185 -0
  28. package/dist/seat-launch.d.ts.map +1 -0
  29. package/dist/seat-launch.js +522 -0
  30. package/dist/seat-launch.js.map +1 -0
  31. package/dist/seat-types.d.ts +362 -0
  32. package/dist/seat-types.d.ts.map +1 -0
  33. package/dist/seat-types.js +2 -0
  34. package/dist/seat-types.js.map +1 -0
  35. package/dist/serve-plane.d.ts +3 -0
  36. package/dist/serve-plane.d.ts.map +1 -1
  37. package/dist/serve-plane.js +18 -8
  38. package/dist/serve-plane.js.map +1 -1
  39. package/dist/service-child.js +2 -2
  40. package/dist/service-child.js.map +1 -1
  41. package/dist/session-recovery.d.ts +2 -4
  42. package/dist/session-recovery.d.ts.map +1 -1
  43. package/dist/session-recovery.js.map +1 -1
  44. package/dist/turn-relay.d.ts +397 -0
  45. package/dist/turn-relay.d.ts.map +1 -0
  46. package/dist/turn-relay.js +1068 -0
  47. package/dist/turn-relay.js.map +1 -0
  48. package/dist/user-provision.d.ts +152 -0
  49. package/dist/user-provision.d.ts.map +1 -0
  50. package/dist/user-provision.js +328 -0
  51. package/dist/user-provision.js.map +1 -0
  52. package/package.json +12 -12
package/dist/manager.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import { type DeprovisionResourceAccounting, type IssuedBinding } from "@cotal-ai/core";
2
2
  import { type SeatCap } from "@cotal-ai/workspace";
3
- import type { PersonaEndpoint, ControlReply, EpCaller, EpErrorCode, InlinePersona, LaunchOpts, MeshLaunchAgent, RuntimeReference, SecretStore } from "@cotal-ai/core";
3
+ import type { PersonaEndpoint, ControlReply, EpCaller, RuntimeReference, SecretStore } from "@cotal-ai/core";
4
4
  import { type AgentHandle, 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";
6
8
  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";
9
+ import { type EpServeGrant, type Identity } from "@cotal-ai/core";
9
10
  import { type ManagerStopImpact } from "./manager-service-contract.js";
10
11
  /** Backstop for the detached-launch readiness race (#159 B1). `startAgent` waits on two REAL outcomes —
11
12
  * the assigned id joining the mesh (presence) = started, the child process exiting = failed — NOT a
@@ -93,6 +94,8 @@ export interface ManagerOptions {
93
94
  * as the published binary does. A library composition leaves this off and resolves only what its
94
95
  * composition root imported — a direct `new Manager()` never implicitly reads the machine manifest. */
95
96
  installedExtensions?: boolean;
97
+ /** The machine daemon's command for repairing host setup. Absent outside daemon hosting. */
98
+ machineSetupCommand?: string;
96
99
  /** The {@link SecretStore} for EVERY secret this manager touches — the daemon-cred renewal write side
97
100
  * (`remintDaemonCreds`) AND the per-agent standing-secret kinds (static creds / actor tokens /
98
101
  * sentinel creds). ONE store, so a hosted composition (KMS/Vault) can never end up with the manager
@@ -471,366 +474,6 @@ export interface ManagerResumeResult {
471
474
  }>;
472
475
  error?: string;
473
476
  }
474
- /** A spawn request, typed. The control-plane `start` op parses one of these out of an
475
- * untyped request; roster boot constructs them directly. Both funnel into {@link Manager.startAgent}. */
476
- export interface StartAgentOpts {
477
- /** The persona REF to spawn — a filename in `.cotal/agents` (the unique spawn key), discovered as
478
- * `.cotal/agents/<name>.md`. NOT the mesh identity: the spawned peer presents under the file's
479
- * own `name:` (auto-numbered on collision). The file must exist (no silent default-ACL fallback).
480
- * With {@link persona}, the helper's own name instead, numbered on collision the same way. */
481
- name: string;
482
- /** An inline persona in place of a catalog file. It takes no `config` or `identity`. Validated
483
- * where it is read, so a direct call meets the same refusals as the served door. */
484
- persona?: InlinePersona;
485
- /** The workflow run whose driver sends this spawn (SPEC 14.8). A manager that does not host the
486
- * run reads the run's admission and bounds the helper by it, as the hosting manager does. */
487
- runId?: string;
488
- /** Connector / agent type — resolved from the registry. Outranks the persona pin and every default (see `resolveAgentType`). */
489
- agent?: string;
490
- /** Detached caller's default connector, kept separate from an explicit flag so the persona file
491
- * can outrank it. Imperative control requests only; direct and manifest launches omit it. */
492
- defaultAgent?: string;
493
- role?: string;
494
- /** Explicit agent-file path that overrides the `name` ref for *which file to load* (identity still
495
- * comes from that file's `name:`). The file must exist. */
496
- config?: string;
497
- /** Presence-identity OVERRIDE (the `--name` flag with a positional/`--config` naming the file):
498
- * wins over the persona file's `name:`, exactly as in foreground `cotal spawn`. Imperative-only —
499
- * a manifest launch (`resolved`) is the identity authority and rejects it. */
500
- identity?: string;
501
- /** Model override (the `--model` flag). Takes precedence over the agent file's `model:`. */
502
- model?: string;
503
- /** Model variant override (the `--variant` flag). Takes precedence over the agent file's `variant:`. */
504
- variant?: string;
505
- /** Opaque connector launch options (the `--opt k=v` flags). Merged per key over the agent file's
506
- * `launchOptions:` (imperative wins); forwarded verbatim to the connector, which validates them. */
507
- launchOptions?: Record<string, unknown>;
508
- /** USER-MESH manifest launches only: the derived owner (`u_…`) from the launch spec (the
509
- * logged-in operator who applied it). Imperative spawns resolve the owner from the ctl
510
- * CALLER's principal instead — never from a payload field. */
511
- owner?: string;
512
- /** Opaque host-local session id to FORK into the mesh (the `--resume` flag), forwarded verbatim to
513
- * the connector. Only ever set from imperative control args (`opStart`), NEVER from `resolved` —
514
- * the manifest path stays resume-free by construction. Unsupported connectors throw at buildLaunch. */
515
- resume?: string;
516
- /** The one-time claim `transcript-receive` issued for carried bytes of {@link resume} (#1499), and
517
- * the agent the CLI found them with. Imperative control args only, like `resume`. */
518
- resumeClaim?: string;
519
- resumeAgent?: string;
520
- /** Publish the session's AG-UI event plane to its own principal-keyed event channel. Defaults to
521
- * on when the connector declares one; `false` (`--no-events`) is the explicit opt-out. */
522
- events?: boolean;
523
- eventPayloads?: boolean;
524
- /** #373: set by `opStart` when a non-owner, non-admin caller omitted `events` and the plane was served
525
- * disarmed. Carried into the reply data so the caller sees the downgrade — never silent. */
526
- eventsNotice?: string;
527
- /** Initial prompt auto-submitted at session start (the `--prompt` flag), forwarded verbatim to
528
- * the connector. Imperative launches only — a manifest launch carries its own `resolved.prompt`
529
- * and rejects this flag alongside it (one source, no merge). */
530
- prompt?: string;
531
- /** Access-policy overrides (the `--subscribe` / `--allow-subscribe` / `--allow-publish` flags):
532
- * win over the persona file exactly as in foreground `cotal spawn`, and are minted into the
533
- * creds AND forwarded to the connector from ONE source. Imperative-only — a manifest launch
534
- * (`resolved`) is the access authority and rejects these. */
535
- subscribe?: string[];
536
- allowSubscribe?: string[];
537
- allowPublish?: string[];
538
- /** Channels the seat joins on top of its resolved read set (the peer door's `join`). Each must
539
- * fall within the read ACL that resolves below, or the spawn is refused; nothing is widened.
540
- * Imperative-only, rejected with `resolved`. */
541
- join?: string[];
542
- /** The spawner's own read/post ACL. Consulted only when the persona file names no channel field
543
- * at all (`subscribe`, `allowSubscribe`, `allowPublish` all absent): the seat is then scoped to
544
- * its spawner, never wider. A persona that names any channel field is the authority and this is
545
- * ignored. The spawner's event channel is never inherited (the seat mints its own below).
546
- * Imperative-only, rejected with `resolved`. */
547
- callerAcl?: {
548
- allowSubscribe: string[];
549
- allowPublish: string[];
550
- };
551
- /** The request subject the served `spawn` door answered. A hosted enrollment forwards it, and the
552
- * issuing host makes the caller it saw publish that subject the helper's parent (SPEC 13.6).
553
- * Set by the served door only. */
554
- served?: string;
555
- /** Names of the operator's configured MCP servers this agent gets (absent → all declared for the
556
- * connector — the pre-merge manager behavior; `[]` → none). */
557
- shareTools?: readonly string[];
558
- /** Declarative in-place restart policy from a workflow `spawn`. When set, the manager restarts
559
- * the process under the same name, lifecycle uid, persona, worktree and permits until
560
- * `restarts` deaths fall inside `windowMs`. Absent: only a continuation-capable connector
561
- * (pi) arms the existing session-recovery constants. */
562
- supervise?: {
563
- restarts: number;
564
- windowMs: number;
565
- };
566
- /** A `once` spawn: the prompt is relayed as the seat's one turn instead of a kickoff, and the
567
- * seat is stopped when that turn ends. `deadlineMs` is resolved: `undefined` means no deadline. */
568
- once?: {
569
- deadlineMs: number | undefined;
570
- };
571
- /** A fully-resolved launch profile (from a mesh manifest via `supervise --launch`). When present,
572
- * `startAgent` takes identity/role/ACLs/capabilities/model from here — NOT from a persona file —
573
- * and `config` points at the materialized transient persona the connector reads. The persona file
574
- * is never the access authority in this path. */
575
- resolved?: MeshLaunchAgent;
576
- /** Per-agent working directory to root this agent at, overriding the manager's shared
577
- * workspaceRoot. Lets different agents run in different repos/folders. A relative path is
578
- * resolved against the manager's workspace root. Omitted → the agent uses workspaceRoot. */
579
- cwd?: string;
580
- /** Internal resolved-manifest provenance used by the preservation inventory. */
581
- launchRef?: {
582
- runId: string;
583
- requested: string;
584
- hash: string;
585
- };
586
- /** The §13.2 rail this spawn rode. Class-rail harness refusals name `--on`; instance-pinned
587
- * refusals stay local. Direct `startAgent` (roster / `--spawn`) is not a class request. */
588
- route?: "one" | "all" | "inst";
589
- /** The terminal runtime this one seat launches on. Absent uses this manager's own runtime, the
590
- * same choice `cotal up --runtime` made. A named runtime is resolved once and reused for every
591
- * later seat that names it. An unknown or unreachable one refuses the launch and starts nothing. */
592
- runtime?: string;
593
- /** Launch under an admitted delegated user intent (SPEC 13.16): the agent is `owner`'s, and
594
- * `parent` is its ledger parent and its recorded spawner. Set only by the composition root's
595
- * in-process call; the ctl spawn handler never maps a payload field into it. */
596
- delegatedIntent?: {
597
- intentId: string;
598
- owner: string;
599
- parent: string;
600
- };
601
- }
602
- interface ManagedLaunch {
603
- source: ManagerResumeAgent["launch"]["source"];
604
- /** The runtime kind this seat was launched on. Absent means the manager's own runtime. */
605
- runtime?: string;
606
- cwd: string;
607
- model?: string;
608
- variant?: string;
609
- prompt?: string;
610
- subscribe?: string[];
611
- allowSubscribe: string[];
612
- allowPublish?: string[];
613
- capabilities?: string[];
614
- /** The persona's endpoint commands, as minted. Renewal re-mints their rows. */
615
- endpoints?: PersonaEndpoint[];
616
- events: boolean;
617
- eventPayloads?: boolean;
618
- shareTools?: readonly string[];
619
- forkSource?: string;
620
- /** Read from {@link resumeRecordPath} once the seat has written it, then kept. */
621
- resumed?: ForkProvenance;
622
- /** A carried resume's claim (#1499): the digest the manager staged, which the seat's fork record
623
- * must name before {@link resumed} is set, the host it came from, and when it was staged. */
624
- carried?: {
625
- transcriptSha256: string;
626
- host: string;
627
- transferredAt: string;
628
- };
629
- /** The connector's {@link LaunchSpec.resumeRecordPath} for this seat's fork. */
630
- resumeRecordPath?: string;
631
- sessionId?: string;
632
- unresolvedLaunchOptionKeys?: string[];
633
- }
634
- export interface ManagedAgent {
635
- name: string;
636
- role?: string;
637
- agent: string;
638
- /** The seat-private Claude home a carried resume launched in (#1499), removed when the seat is freed. */
639
- seatHome?: string;
640
- /** Stable id the manager assigned this agent at spawn: the nkey public key (static auth), or
641
- * the owner+actor principal dot-form (user mode). */
642
- id: string;
643
- /** This incarnation's lifecycle UID (SPEC §13.1), minted once per spawn: the uid its
644
- * lifecycle-keyed broker footprint (`dm_…-<uid>`/`dlv_…-<uid>`/ACL row) carries and the ONLY
645
- * incarnation its teardown credential may name — a replayed teardown cannot reach a same-name
646
- * successor (its uid differs). */
647
- lifecycleUid: string;
648
- /** Private nkey seed, kept so a later step can mint matching creds for this id. Static auth
649
- * only — a user-mode agent has no static identity (its credential is its bearer). */
650
- seed?: string;
651
- /** The SPEC 13.15 issuance of a static agent's credential: the generation its rails carry and
652
- * the accepted-row token its endpoint discovers it by. A renewal keeps both (the ceiling is
653
- * unchanged by construction); absent on a user-mode or open agent. */
654
- issued?: IssuedBinding;
655
- /** Set for a USER-MODE agent: its derived owner. Marks the slot for user-mode teardown (ledger
656
- * revoke + token/sentinel/health file removal) and the auth-health read in {@link list}. */
657
- userOwner?: string;
658
- /** Launched under a delegated user intent (SPEC 13.16). Only {@link Manager.retireDelegatedAgent}
659
- * retires it: this holder's own prepare and requester bind to the holder's owner. */
660
- delegated?: true;
661
- /** The FS materialization paths of THIS incarnation's secret family, recorded at spawn (the
662
- * lifecycle-keyed derivation) or at adoption (the resume inventory's recorded paths — possibly a
663
- * previous generation's name-keyed layout). Teardown, preservation, and health reads consume
664
- * THESE, never a re-derivation by name alone, so a stale/replayed teardown can only ever address
665
- * this incarnation's own files — the manager-local half of the SPEC 13.1 name-disjoint
666
- * discipline (the broker half is the uid-pinned deprovisioner). Present per mode: static =
667
- * `creds`; user = `actorToken`/`sentinelCreds`/`health`; open = absent. Absent (never `{}`)
668
- * when nothing was recorded, so teardown's uid-keyed derivation fallback stays reachable. */
669
- secretPaths?: {
670
- creds?: string;
671
- actorToken?: string;
672
- sentinelCreds?: string;
673
- health?: string;
674
- };
675
- /** Authenticated id of the peer that requested this spawn (the control-plane `req.from.id`),
676
- * or the manager's own id for roster/pre-spawn. Non-forgeable — set by `handle()`. The spawner
677
- * ledger (P4b) keys own-children despawn + reap-on-parent-exit off this. */
678
- spawner: string;
679
- authorityParent?: string;
680
- startedAt: number;
681
- handle: AgentHandle;
682
- /** This agent's local control endpoint (path + first-frame auth token), when its connector runs
683
- * one. Kept in memory only (never persisted — token hygiene) so a graceful stop on a signal-less
684
- * runtime (ConPTY/Windows) can send a cooperative `{op:"shutdown"}` over it instead of a hard
685
- * kill that would deny the agent its clean mesh-leave. */
686
- control?: {
687
- path: string;
688
- token: string;
689
- };
690
- /** Set when `Runtime.spawnDelegated` started this seat outside the manager's filesystem. Its
691
- * handle's `stop()` is the fenced close by lifecycle key, which retirement runs only after the
692
- * host revoked the grant, never from the stop door. */
693
- handedOff?: true;
694
- launch: ManagedLaunch;
695
- /** The bounded launch wait elapsed without a join. Process liveness is separate, and an
696
- * exact-incarnation late join clears this diagnostic without stopping the seat. */
697
- joinIssue?: string;
698
- /** Set on a manifest `continuity: exact` seat once its first session was proven: the coordinates
699
- * its assignment is recorded under, kept current at every later proven rebind and at its stop. */
700
- continuity?: Omit<ContinuityAssignment, "version" | "sessionId">;
701
- /** In-memory process-recovery input. It is never persisted with secret values: preservation
702
- * reconstructs it from the validated inventory and current config. Continuation-capable
703
- * connectors (pi) receive it by default; any connector receives it when spawn carries
704
- * `supervise`. */
705
- restart?: {
706
- opts: LaunchOpts;
707
- sessionStatePath?: string;
708
- crashes: number[];
709
- recovering: boolean;
710
- armed: boolean;
711
- /** Present when spawn carried `supervise`; recoverManagedSession takes its budget from it.
712
- * Absent on the pi path without a policy, which keeps SESSION_RESTART_LIMIT / WINDOW_MS. */
713
- policy?: {
714
- restarts: number;
715
- windowMs: number;
716
- };
717
- };
718
- /** Set on a `once` seat: the goal of its one task, and why this manager stopped the seat, if it
719
- * did. The task is cancelled with that reason when the seat's exit is proved before it ended. */
720
- once?: {
721
- ref: GoalRef;
722
- stopReason?: string;
723
- retire?: string;
724
- };
725
- /** The connector's clause when this seat's startup ended `ready` on a connector whose idle wake
726
- * needs a confirmed startup: mesh traffic does not wake the seat. On the spawn reply and the ps row. */
727
- startupNotice?: string;
728
- /** Preservation and a not-yet-confirmed resume retain broker/auth state if the process exits. */
729
- suppressCleanup?: boolean;
730
- /** The TERMINALIZING latch: flipped SYNCHRONOUSLY before the first await on every
731
- * stop/despawn path (stopHandle + freeSlot are the chokepoints). Once set, this principal's
732
- * control ops refuse and no later renewal is admitted. A renewal already admitted drains before
733
- * the durable terminal begins, so its row and material are included in revocation and cleanup. */
734
- terminalizing?: boolean;
735
- /** Why this manager stopped the seat, set with {@link terminalizing} by the first stop. The exit
736
- * watcher frees the slot with it, so an exit the stop caused is not logged or ended as the
737
- * seat's own. */
738
- stopCause?: FreeSlotCause;
739
- /** Set while the manager has logged this seat off the mesh with its slot still held (#1208);
740
- * cleared when the seat is logged back on. */
741
- offMesh?: boolean;
742
- /** The one renewal admitted before terminalization. Retirement drains it before revocation and
743
- * cleanup; callers arriving after the latch never join it. */
744
- staticCredentialRenewal?: Promise<void>;
745
- }
746
- /** Runtime hooks the spawn-as-action serve path injects into {@link Manager.startAgent}.
747
- * Roster boot and the blocking callers pass none (unchanged behavior). */
748
- export interface SpawnHooks {
749
- /** Fires synchronously AFTER the incarnation identity (nkey + lifecycleUid) is minted but BEFORE
750
- * any provision/side-effect — the accept seam: it binds the goal and replies the acceptance. A
751
- * THROW here aborts the spawn before provisioning (the existing catch returns the failure and the
752
- * finally releases the reserve, so no footprint leaks) — this is the bind-conflict refusal path.
753
- * On the hosted enrollment arm it fires right after the host enrolls the agent, because the host
754
- * picks the uid; a throw there rolls that enrollment back. */
755
- onAccepted?: (allocated: {
756
- name: string;
757
- identity: Identity;
758
- lifecycleUid: string;
759
- agentTriple: {
760
- owner: string;
761
- actor: string;
762
- uid: string;
763
- };
764
- }) => Promise<void> | void;
765
- /** Fires once the child process has been launched (the "launched" progress edge). A THROW here
766
- * aborts the spawn with the seat already running and the handle held only in a local, so the
767
- * finally's orphan rollback reaps it by the reference the spawn reserved. */
768
- onLaunched?: () => void;
769
- /** Fires once the connector has supplied the exact bounded readiness window for this launch,
770
- * before the process starts. The action goal records that same value at acceptance. */
771
- onReadinessWindow?: (readinessTimeoutMs: number) => Promise<void> | void;
772
- /** Fires at the readiness verdict (presence join → succeeded / process exit → failed / window
773
- * elapsed → uncertain), carrying the succeeded reply data — the async serve body commits the goal
774
- * terminal + emits the final progress event here. Awaited, but the caller swallows its own errors
775
- * so a terminal-commit failure never disrupts the (already-replied) spawn. Resolves true only
776
- * when this call committed the terminal; a once task is served only after that. */
777
- onOutcome?: (outcome: {
778
- kind: "succeeded" | "failed" | "uncertain";
779
- data?: unknown;
780
- }) => Promise<boolean | void> | boolean | void;
781
- /** Fires when this spawn ends with its goal's terminal owned by ANOTHER path — today only a
782
- * despawn/stop that lands inside the readiness window, whose own handler commits `cancel`.
783
- * It commits nothing; it only claims the terminal so the post-accept fallback does not
784
- * manufacture a `failed` from the non-ok reply and race the real `cancel`. Without it, a
785
- * deliberate stop mid-launch reports the agent as having died on launch. */
786
- onTerminalDeferred?: () => void;
787
- /** Fires right before the first effect this spawn or launch takes: the name reserve, a re-driven
788
- * teardown, or a launch file written to disk. A refusal before it changed nothing, so the
789
- * action path answers it `not-executed` (SPEC 13.3); one after it keeps an unknown outcome. */
790
- onEffect?: () => void;
791
- /** Fires when a refusal after the first effect left nothing behind: the host refused the agent's
792
- * enrollment with `code`, and the spawn removed every secret it had staged. The action path
793
- * answers it `not-executed` with that code, as it answers a refusal before the first effect. */
794
- onUndone?: (code: EpErrorCode) => void;
795
- /** Fires right after `onAccepted` on a `once` spawn, before anything launches: accepts the seat's
796
- * one task as a turn addressed to the allocated incarnation and returns its goal. A throw fails
797
- * the spawn. */
798
- onOnce?: (task: {
799
- seat: {
800
- name: string;
801
- owner: string;
802
- actor: string;
803
- uid: string;
804
- };
805
- prompt: string;
806
- spawner: string;
807
- deadlineMs: number | undefined;
808
- readinessDeadlineMs: number;
809
- retire?: string;
810
- }) => Promise<{
811
- ref: GoalRef;
812
- deadlineAt?: number;
813
- }>;
814
- }
815
- /** The spawn-as-action acceptance floor: the ALLOCATED agent identity (name + the
816
- * addressing triple) plus the goal coordinates (goalId = the request id) and
817
- * the executor coordinate (the manager incarnation its terminal fences on). Carries NO secret
818
- * material; it names what was actually allocated, never a requested-but-unallocated name. */
819
- export interface SpawnAcceptance {
820
- name: string;
821
- owner: string;
822
- actor: string;
823
- uid: string;
824
- goalId: string;
825
- fingerprint: string;
826
- /** The connector-selected readiness budget persisted on this goal. A synchronous follower must
827
- * outlive it; otherwise it can time out while the manager is still legitimately waiting. */
828
- readinessDeadlineMs: number;
829
- executor: {
830
- lifecycleUid: string;
831
- epoch: number;
832
- };
833
- }
834
477
  /**
835
478
  * The agent supervisor: a long-lived mesh node that owns agent process lifecycle.
836
479
  * It serves control requests on the "manager" service and spawns/kills agents
@@ -860,6 +503,7 @@ export declare class Manager {
860
503
  /** See {@link ManagerOptions.installedExtensions}. */
861
504
  private readonly installedExtensions;
862
505
  private readonly expectedConnectorGeneration;
506
+ private readonly machineSetupCommand?;
863
507
  private readonly executionState;
864
508
  private readonly runtime;
865
509
  /** One backend per kind a seat has asked for, beside {@link runtime}. The manager's own runtime
@@ -962,59 +606,18 @@ export declare class Manager {
962
606
  /** The live spawn goal ref for each managed agent name, so a despawn MID-GOAL
963
607
  * drives the cancel path (transition -> cancel terminal). Cleared when the goal terminalizes. */
964
608
  private agentGoals;
965
- /**
966
- * The turn relay's same-incarnation idempotency map ({@link goalAcceptances}'s twin), by
967
- * {@link goalKey}: a same-goal retry serves the identical acceptance; cross-incarnation retries
968
- * rebuild from the goal-index entry (its acceptance floor + note).
969
- *
970
- * One entry per turn this incarnation accepted: the acceptance a duplicate submission is served
971
- * from, and — once the turn settles — the answer a RETRIED yield is served from.
972
- *
973
- * A yield's reply can be lost, and the retry used to find the pending turn already deleted and
974
- * hear `not-found`, which a seat reads as "drop it": failure reported for work that committed.
975
- * The settled answer lives here for a bounded window instead, and the sweep drops it after,
976
- * which is also what keeps this map from being one entry per turn for the process lifetime.
977
- *
978
- * `ref` is the goal coordinates the durable terminal is published under. A late yield that
979
- * arrives after pendingTurns is gone and before `settled` is remembered (or after a concurrent
980
- * sweep dropped the settled field) still has to name that terminal, never `not-found`. The
981
- * index entry is not that answer: it is cleared at commit, and the yield path never consults it.
982
- *
983
- * `leftoverSince` is when the pending latch dropped. An unsettled leftover ages off that stamp,
984
- * never off `acceptance.deadlineAt`: a turn that expired after a long outage would otherwise be
985
- * pruned on the first sweep tick, taking the GoalRef with it, and a late yield in the retry
986
- * window would hear `not-found` again.
987
- */
988
- private turnAcceptances;
609
+ private turnRelayInstance?;
610
+ private get turnRelay();
989
611
  private readonly participants;
990
- /** Every relayed turn awaiting its seat's yield, by {@link goalKey}. The seat's `turn-pending` pull
991
- * scans it; the deadline sweep drives expiry; a seat reap stamps its entries `seatDiedAt`, which
992
- * the deadline terminal carries as `agentDownAt` so the run reads that death as L4002.
993
- * Rebuilt at boot from goal-index entries carrying a turn note. */
994
- private pendingTurns;
995
- /** The deadline sweep behind {@link pendingTurns}: takes the hold's fire into an expired
996
- * settle and commits the deadline terminal. Unref'd; idle when no turn is pending. */
997
- private turnSweepTimer?;
998
- /** Once tasks whose ending is owed, by {@link goalKey}: the task can no longer run (its seat's
999
- * exit is proved, or it was never served), so it is cancelled if it has no terminal and its index
1000
- * entry is dropped. A settle that fails stays here and the turn sweep retries it. */
1001
- private readonly onceSettles;
1002
612
  /** Once tasks whose seat's exit is watched: that exit, not the spawn's outcome, settles the debt. */
1003
613
  private readonly onceWatched;
1004
- /** Once tasks a predecessor accepted, by seat uid, until this incarnation binds the seat or
1005
- * proves it gone. `readinessMs` bounds how long a seat no reconcile here can account for is
1006
- * waited for. */
1007
- private readonly onceInherited;
1008
- /** Inherited once seats this manager does not hold whose task has a terminal, by lifecycle uid.
1009
- * Every pull from one is answered `stop`, and its notice repeats until a pull has carried it. */
1010
- private readonly onceStops;
1011
- /** When the goal reconcile finished: the start of an inherited once task's wait for its seat. */
1012
- private goalReconcileDoneAt;
1013
614
  /** Process start, for the served `status` uptime. */
1014
615
  private readonly startedAtMs;
1015
- /** Connector harness paths resolved ONCE at boot. Missing binaries do not stop unrelated manager
1016
- * work, but they are named before the manager reports ready and remain visible in manager status. */
616
+ /** Connector harness inventory. Available paths stay pinned; unavailable rows are retried when
617
+ * launch, model lookup or status asks, without stopping unrelated Manager work. */
1017
618
  private connectorStatuses;
619
+ private connectorRequirements;
620
+ private claudeWakeRecheck?;
1018
621
  /** The boot inventory's warnings, printed once start completes, so a refused start prints none. */
1019
622
  private bootNotes;
1020
623
  /** The complete boot task. stop() joins it after fencing static reconciliation, so a registration
@@ -1064,6 +667,7 @@ export declare class Manager {
1064
667
  * does not re-acquire: a manager that is stopping never puts its own key back. It also closes the
1065
668
  * lifecycle fence ({@link beginLifecycle}), so no spawn can launch a seat the stop never sees. */
1066
669
  private leaseStopping;
670
+ private readonly shutdownReadiness;
1067
671
  /** The class-2 renewal owner's half-TTL schedule; armed only on auth meshes. */
1068
672
  private credRenewTimer?;
1069
673
  private resumeCredRenewal?;
@@ -1151,6 +755,10 @@ export declare class Manager {
1151
755
  deprovision?: DeprovisionResourceAccounting;
1152
756
  } | undefined);
1153
757
  private readonly staticLifecycle;
758
+ /** User-mode provisioning owns no manager state: each dependency reads through at its use. */
759
+ private readonly userProvision;
760
+ /** The launch pipeline's leaf steps. Every dependency reads through at its use. */
761
+ private readonly seatLaunch;
1154
762
  constructor(opts: ManagerOptions);
1155
763
  get runtimeKind(): string;
1156
764
  /** Whether this manager's runtime opens a terminal stream on the seats it spawns, so a caller
@@ -1488,7 +1096,7 @@ export declare class Manager {
1488
1096
  * readiness reads the same status; the maintenance fence refuses every other command in both
1489
1097
  * states. The read is counted in `lifecycleInFlight` like any admitted operation and released in
1490
1098
  * `finally`, so a drain waits at most for one status snapshot; the membership gate still
1491
- * applies. `preserving` and a stopping manager stay fenced. Status writes nothing. */
1099
+ * applies. `preserving` and a stopping manager stay fenced. */
1492
1100
  private serveObservation;
1493
1101
  /** The ep door's ADMIN flag for a caller. Static mesh: `true` — the
1494
1102
  * admin-grade rows (any-mode despawn/attach, the `manager.admin` family, `launch`) are minted
@@ -1587,10 +1195,7 @@ export declare class Manager {
1587
1195
  * host callback with the full endpoint caller tuple. Error string when denied, `undefined` when
1588
1196
  * allowed; remote host-state faults throw rather than being collapsed into a denial. */
1589
1197
  private authorizeNamed;
1590
- /** The wire PRINCIPAL dot-form a managed agent's presence/control identity carries: user-mode
1591
- * entries already store it in `id`; static mints store the raw nkey there (the durable/teardown
1592
- * key), so the wire form derives under DEV_OWNER. Every comparison against an AUTHENTICATED wire
1593
- * id (presence card.id, control from.id) must go through this, never raw `a.id`. */
1198
+ /** The wire principal of a managed agent: {@link managedPrincipal}. */
1594
1199
  private managedPrincipal;
1595
1200
  private resumeLivenessErrors;
1596
1201
  /** Self-despawn (P2b): stop the managed agent whose id == the authenticated caller. The
@@ -1626,46 +1231,10 @@ export declare class Manager {
1626
1231
  * wait proves exit: nobody asked for those children to be gone, so they stay managed until the
1627
1232
  * runtime says otherwise, and a runtime that cannot prove exit records an unverified stop. */
1628
1233
  private trackStoppedHandle;
1629
- /** The served spawn a hosted enrollment forwards. A run's spawn also names its run, so the host
1630
- * bounds the helper by what the run's starter held when the run was admitted (SPEC 14.8). */
1631
- private servedSpawnRequest;
1632
- /** USER-MODE spawn provisioning (the gate-1 counterpart to the static mint block): resolve the
1633
- * OWNER (ctl caller's principal, or the manifest's stamped owner — never a payload field),
1634
- * pre-create the principal-keyed durables + ACL row on the ephemeral provisioner, author the
1635
- * ledger grant (the upsert ROTATES the per-agent secret on every start — a non-running agent
1636
- * never holds a standing mint secret), materialize the 0600 secret/sentinel files, and
1637
- * PREFLIGHT the bearer chain once — the spawned agent must never be the first to discover a
1638
- * dead auth plane. Every failure is returned as the refusal sentence, with the grant + files
1639
- * rolled back. */
1640
1234
  private provisionUserAgent;
1641
- /**
1642
- * HOSTED user-mode spawn provisioning (#1972): the participant arm of host-owned enrollment.
1643
- *
1644
- * A registered participant holds no ledger writer, no JetStream provisioner, and no signing seed,
1645
- * so every step the local arm above performs itself is the HOST's here. What stays local is the
1646
- * one thing that must: the standing `actorToken`. This method generates it, writes it at 0600
1647
- * BEFORE the request, and sends only its SHA-256 digest — so the plaintext never crosses the
1648
- * network and a host compromise cannot replay an agent's exchange secret.
1649
- *
1650
- * The HOST picks the lifecycle UID. It alone can see the retirement tombstones that make a UID
1651
- * permanently unusable (a retired uid is refused forever by the retirement frontier), so a
1652
- * participant-chosen uid could aim a fresh grant at a dead incarnation. The uid the host returns
1653
- * is the one the spawn records and the one the child's durables are keyed by.
1654
- *
1655
- * The bearer argv selects `--exchange-url`: the local `--dir` arm reads a state directory this
1656
- * machine does not have, and a signerless participant must never appear to hold one.
1657
- */
1658
- private enrollUserAgent;
1659
1235
  /** Shred a user agent's secret family from the store and from disk. Every removal is attempted,
1660
1236
  * and each failure joins `unshredded`, so one fault cannot leave the rest of the family behind. */
1661
1237
  private shredUserSecrets;
1662
- /** This manager's registry record for its space, which pins the broker and IdP a delegated seat's
1663
- * handoff carries. It must pin the exchange the host enrolls against, or the child would register
1664
- * a mesh whose bearers come from somewhere else. */
1665
- private delegatedMeshRecord;
1666
- /** The one handoff a delegated seat receives, built from values this manager holds: the
1667
- * enrollment result, the token it generated, and its own registry record. No path crosses. */
1668
- private composeManagedHandoff;
1669
1238
  /**
1670
1239
  * WHY A SEAT LEFT — one line, at the one place every free path passes through.
1671
1240
  *
@@ -1727,8 +1296,6 @@ export declare class Manager {
1727
1296
  private readManagedSessionState;
1728
1297
  private retainedSessionId;
1729
1298
  private forkProvenance;
1730
- private refuseCarriedFork;
1731
- private refuseLateCarriedFork;
1732
1299
  private readManagedSession;
1733
1300
  private recordContinuity;
1734
1301
  private recordContinuityAtStop;
@@ -1746,8 +1313,6 @@ export declare class Manager {
1746
1313
  * path. */
1747
1314
  private onAgentExit;
1748
1315
  private nameError;
1749
- private nameInUse;
1750
- private uniqueName;
1751
1316
  /** Spawn a teammate by persona ref (`name` loads `.cotal/agents/<name>.md`; the peer presents
1752
1317
  * under that file's own `name:`), as if a peer asked via the control plane. Used to pre-spawn the
1753
1318
  * demo's experts at startup so the manager owns them. */
@@ -1768,14 +1333,10 @@ export declare class Manager {
1768
1333
  * here, and a deadline past the scheduler's last instant is refused here, which the schema does
1769
1334
  * not express. */
1770
1335
  private opStart;
1771
- /** The realpath + directory checks a placed spawn directory must pass on this manager's host,
1772
- * shared by the served `resolve-cwd` command and the `spawn` admission check (#385 item 2): one
1773
- * function, so the two doors never drift. Creates nothing and never substitutes the workspace root. */
1336
+ /** {@link SeatLaunch.checkSpawnCwd}. */
1774
1337
  private checkSpawnCwd;
1775
- /** Refuse host directory reads before lookup when seats cannot use this host. */
1776
- private assertHostDirectoryExecution;
1777
1338
  private listSpawnDirectory;
1778
- /** Resolve a placed spawn directory without creating or substituting a workspace. */
1339
+ /** {@link SeatLaunch.resolveSpawnCwd}. */
1779
1340
  private resolveSpawnCwd;
1780
1341
  /** Resolve a connector by agent type. Library composition (installedExtensions off) → a registry
1781
1342
  * hit, exactly as before (the composition root imported what it wants). The published binary gates
@@ -1786,28 +1347,27 @@ export declare class Manager {
1786
1347
  * including providers already present in the registry.
1787
1348
  * Fail-loud with an install hint; no fallback. */
1788
1349
  private resolveConnector;
1789
- /** Connector names the manager can spawn WITHOUT importing: the manifest on the published binary,
1790
- * else whatever a composition root registered. Drives the `models` catalog enumeration. */
1350
+ /** {@link SeatLaunch.connectorNames}. */
1791
1351
  private connectorNames;
1792
1352
  /** Resolve every installed/registered connector's declared harness binaries before the manager
1793
1353
  * reports ready. A missing harness degrades only that connector, never unrelated lifecycle work:
1794
1354
  * boot continues, names it once start completes and records it on both manager status surfaces. */
1795
1355
  private inspectConnectorsAtBoot;
1796
- /** True when at least one declared connector is available. Empty inventory (or a failed
1797
- * inventory load) skips the class `one` subscribe for spawn/launch so this member cannot
1798
- * consume an unpinned request a sibling could serve. */
1356
+ /** Install and verify the hosted Claude wake channel, or report the cause and remedy. */
1357
+ private prepareClaudeWake;
1358
+ /** Retry unavailable applications without changing resolved available rows. Claude launches
1359
+ * join the status or launch that started wake setup, before any name or capacity is reserved. */
1360
+ private refreshUnavailableConnectors;
1361
+ /** {@link SeatLaunch.classSpawnEnabled}. */
1799
1362
  private classSpawnEnabled;
1800
1363
  private omitClassCommands;
1801
- /** Named harness-unavailable refusal. On the class rail a partial inventory must not look
1802
- * like the space cannot launch: name `--on` so the caller can pin a sibling. The standing
1803
- * serve credential cannot enumerate sibling `svc.*.status` inventories, so the residual
1804
- * is the flag, not a list of capable instance ids. Instance-pinned calls keep the local
1805
- * reason only. */
1364
+ /** {@link SeatLaunch.harnessUnavailableError}. */
1806
1365
  private harnessUnavailableError;
1807
1366
  /** The harness binaries a managed launch runs, as boot resolved them, or the refusal naming what is
1808
1367
  * missing. Spawn, resume and the model catalog all take it, so a seat launches from the same files
1809
1368
  * whichever path starts it and the catalog never disagrees with a launch about whether the harness
1810
- * is there. A connector registered after boot has no inventory row and is checked on PATH now. */
1369
+ * is there. Callers recheck unavailable rows first; available rows retain their resolved files.
1370
+ * A connector registered after boot has no inventory row and is checked on PATH now. */
1811
1371
  private launchHarness;
1812
1372
  /** The launch fields the host supplies rather than the seat. Spawn and resume both take them from
1813
1373
  * here, so a resumed seat launches under the same host policy, `eventsRequired` included, as the
@@ -1817,14 +1377,13 @@ export declare class Manager {
1817
1377
  /** The refusal for a launch choice the connector cannot honour. Spawn and resume both ask before
1818
1378
  * a seat's launch is built, so a rule changed here holds on both paths. */
1819
1379
  private capabilityRefusal;
1820
- /** The refusal for a `once` spawn this manager cannot run as one task: every check is made before
1821
- * anything is allocated, so a refused spawn leaves nothing behind. */
1380
+ /** {@link SeatLaunch.onceRefusal}. */
1822
1381
  private onceRefusal;
1823
- /** How a once task names who sent it: the spawner's roster name, or its principal when that name is missing or only whitespace. */
1382
+ /** {@link SeatLaunch.spawnerName}. */
1824
1383
  private spawnerName;
1825
1384
  /** The refusal for an event-plane choice the registration policy or the connector cannot meet.
1826
1385
  * Spawn and resume both ask before a seat's launch is built, so a seat retained without the
1827
- * plane cannot come back on a space that now requires it. An absent choice arms the plane. */
1386
+ * plane cannot come back on a space that now requires it. An absent choice arms supported planes. */
1828
1387
  private eventsRefusal;
1829
1388
  /** Return connector-provided model catalogs for selector UIs. Optional by connector: a host with no
1830
1389
  * local model-list API reports `supported:false` rather than blocking the manager. A connector that
@@ -1857,42 +1416,15 @@ export declare class Manager {
1857
1416
  * defaulting to the manager's own id for roster/pre-spawn — recorded for the spawner
1858
1417
  * ledger (own-children despawn + reap-on-parent-exit). */
1859
1418
  startAgent(opts: StartAgentOpts, spawner?: string, hooks?: SpawnHooks, authenticatedCaller?: EpCaller): Promise<ControlReply>;
1860
- /** The persona file a spawn loads and the harness it resolves, shared by `spawn` and the served
1861
- * `resolve-agent` read: a detached resume locates the session it carries with the connector this
1862
- * names, so the two doors must not drift (#2899). */
1419
+ /** {@link SeatLaunch.spawnPersona}. */
1863
1420
  private spawnPersona;
1864
- /** Whether a persona path resolves into the inline snapshot directory, the directory itself
1865
- * included. A directory that does not exist holds nothing. */
1866
- private insideInlineDir;
1867
- /** The run a spawn acts for (SPEC 14.8). The run this manager drives under `caller` answers from
1868
- * memory. On a static mesh, a spawn from a run hosted elsewhere names its run, whether the program
1869
- * placed it here or the class queue delivered it, and its caller must be that run's driver, whose
1870
- * triple derives from the run id; the run's admission and revocation marker are then read
1871
- * leader-served, so the helper is bounded as the hosting manager bounds it. Elsewhere the run id
1872
- * is not read: a user-auth run's issuing host bounds the helper, and an open mesh bounds none.
1873
- * `undefined` for a spawn that acts for no run. */
1421
+ /** {@link SeatLaunch.spawnRun}. */
1874
1422
  private spawnRun;
1875
- /**
1876
- * Resolve what bounds a spawn's grant on a STATIC mesh: the caller's issued evidence, read the way
1877
- * keyed runs read it. A user-auth mesh bounds the mint on its ledger instead, and an open mesh
1878
- * mints no grant, so both return `exempt`. So does a call with no authenticated caller, which is
1879
- * the manager's own composition root (roster boot, a manifest `launch`, which a static mesh mints
1880
- * only into operator instruments). A workflow run's spawn, whether this manager hosts the run or
1881
- * its spawn reached this manager from another host ({@link spawnRun}), is bounded by the run's admission (SPEC 14.8):
1882
- * the ceiling it recorded, at the starter's coordinate, unless the starter was exempt then. That
1883
- * ceiling is the starter's evidence as resolved at admission, or for a local run the channels the
1884
- * operator named. Any other caller with no issued generation, or whose evidence does not resolve,
1885
- * hands on no grant. The evidence's own standing decides the rest.
1886
- */
1423
+ /** {@link SeatLaunch.staticSpawnBound}. */
1887
1424
  private staticSpawnBound;
1888
- /** The refusal for a grant its static spawner does not hold, or `undefined` when it holds all of
1889
- * it. Each part is named, so the caller can drop exactly what overreached. `armsEvents` is whether
1890
- * the helper's own event plane will be minted: that row is keyed on a principal allocated later,
1891
- * so it is measured as the spawner's own, the rule the ledger applies. `door` names the command
1892
- * being bounded: a persona definition is bounded against its definer as a spawn is. */
1425
+ /** {@link SeatLaunch.spawnBoundRefusal}. */
1893
1426
  private spawnBoundRefusal;
1894
- /** Ordinary static control seats can read their holding instance. A run's recorded ceiling is
1895
- * authoritative, so its helpers receive no additional instance reads. */
1427
+ /** {@link SeatLaunch.managedStaticInstanceReads}. */
1896
1428
  private managedStaticInstanceReads;
1897
1429
  private startAgentActive;
1898
1430
  /** Preflight the whole inventory before launching its first process, then adopt each exact retained
@@ -1971,33 +1503,11 @@ export declare class Manager {
1971
1503
  private occupancy;
1972
1504
  private occupancyText;
1973
1505
  private capacityRefusal;
1974
- /**
1975
- * The owner a launch belongs to, read ONCE so the per-owner ceiling, the agent's addressing
1976
- * triple and the user-mode provisioner cannot charge three different owners for one seat. A
1977
- * static or open mesh has one owner by construction; a user-auth mesh takes the spec's owner,
1978
- * else the owner of the principal that asked, which is what {@link provisionUserAgent} resolves
1979
- * from the same two values (it refuses outright where this falls back, so the two never disagree
1980
- * on an admitted launch).
1981
- */
1506
+ /** The owner a launch belongs to: {@link NamesCapacity.launchOwner}. */
1982
1507
  private launchOwner;
1983
- /** The owner of a seat this manager supervises, by the same rule {@link launchOwner} admitted it
1984
- * under: a user-mode seat records its derived owner, and every other seat is the mesh's one owner. */
1985
- private seatOwner;
1986
- /**
1987
- * Live seats this manager holds for one owner: the seats it supervises, plus the launches it has
1988
- * reserved for that owner and not yet placed. It deliberately does NOT count cooling stamps — a
1989
- * cooling slot is a seat that already freed, and the recycle floor it holds is a global
1990
- * fork-bomb bound (P4c), not one tenant's occupancy. Mirrors {@link occupancy}'s reserved rule,
1991
- * so a reservation stops being counted twice the moment its seat reaches `agents`.
1992
- */
1508
+ /** Live seats this manager holds for one owner: {@link NamesCapacity.ownerSeats}. */
1993
1509
  private ownerSeats;
1994
- /**
1995
- * The per-owner ceiling, consulted at accept: `undefined` admits the launch, and a refusal
1996
- * carries the owner's count and the cap so a caller can render a remedy and a script can decide
1997
- * without re-reading prose. Distinct from {@link capacityRefusal}, which bounds the HOST: that
1998
- * one frees when anyone stops a seat or a cooling slot expires, this one frees only when THIS
1999
- * owner stops one of its own, or the operator raises the cap, so they cannot share a sentence.
2000
- */
1510
+ /** The per-owner ceiling at accept: {@link NamesCapacity.seatCapRefusal}. */
2001
1511
  private seatCapRefusal;
2002
1512
  private opStop;
2003
1513
  /** The ONE named-terminal core both doors share: the ctl named `stop`
@@ -2211,27 +1721,10 @@ export declare class Manager {
2211
1721
  * connection that holds this instance's reply rows. The notice carries no turn and the seat
2212
1722
  * pulls on it, so a lost notice delays that seat until its next pull, and nothing else. */
2213
1723
  private noticeSeatTurns;
2214
- /** A seat names a turn by goal id alone when it yields, so one incarnation holding two callers'
2215
- * turns under one id could not say which of the two it answered. */
2216
- private assertSeatTurnFree;
2217
- /** The relay key of the turn addressed to seat incarnation `c` under `goalId`, pending or kept
2218
- * for a retried yield. The accept path never hands one incarnation two turns under one goal
2219
- * id, so at most one matches. */
2220
- private seatTurnKey;
2221
1724
  /** The seat's yield: claim the hold (one-use; expiry fails closed), then commit the goal
2222
1725
  * `succeeded` carrying the TurnResult. A yield AFTER the deadline drives the deadline terminal
2223
1726
  * instead and refuses — the expiry outcome stands, never a late success over it. */
2224
1727
  private serveTurnYield;
2225
- /** A seat's answer for a turn no longer pending. A REPLY THAT WAS LOST IS NOT AN ANSWER THAT
2226
- * FAILED: the commit deleted the pending turn, so a retry found nothing and heard `not-found`,
2227
- * which a seat reads as "drop it", reporting failure for work the run already has. The answer
2228
- * the first reply carried is served again instead, to the addressee it was addressed to and
2229
- * nobody else. */
2230
- private settledTurnAnswer;
2231
- /** Claim a pending turn's deadline hold before the seat's answer commits: one use, and a hold
2232
- * that already expired drives the deadline terminal instead and refuses the answer. A once task
2233
- * with no deadline has no hold. */
2234
- private claimTurnHold;
2235
1728
  /** A once seat's report that its task's handoff to its harness was not confirmed. The seat sealed
2236
1729
  * the task before it reported, so nothing hands it over again; the task fails
2237
1730
  * `delivery-unconfirmed` and the seat is stopped. The commit proves the seat's live currency, as
@@ -2250,39 +1743,12 @@ export declare class Manager {
2250
1743
  * whose outcome cannot be read back stays out and converges through the goal index at the
2251
1744
  * next boot, as a failed deadline commit does. */
2252
1745
  private serveTurnCancel;
2253
- /** Commit the deadline terminal for one pending turn whose hold settled EXPIRED: the deny's
2254
- * predicate is that recorded settle, verified by core against the spec's goal binding. The map
2255
- * delete is the idempotency latch (yield-loss and sweep race here); a commit failure after it
2256
- * converges through the goal index at the next boot, the same narrow leg spawn leaves open. */
2257
- private commitTurnDeadline;
2258
1746
  /** The reap hook: a pending turn addressed to the reaped INCARNATION is MARKED dead, never
2259
1747
  * settled early — no honest terminal exists for it (a completion must prove the executor's
2260
1748
  * live currency, and the hold is only expirable once due), so the entry rides to its deadline
2261
1749
  * and the deny then records both facts. The addressee's own client observes the death from
2262
1750
  * presence long before that, which is the run's L4002. */
2263
1751
  private failSeatTurns;
2264
- /** Settle one DUE hold as its owner: the manager minted it, so once the deadline has passed it
2265
- * expires the pause itself ({@link expireCheckpoint}, the guard-hold precedent) rather than
2266
- * waiting on the broker's fire — which it holds no grant to read, and which a hold minted under
2267
- * a predecessor's epoch would carry on a subject this incarnation never subscribes. Idempotent
2268
- * by the plane: a yield that claimed the hold first is observed as `resumed` and left to its
2269
- * own commit, and an already-expired hold returns its recorded settle. */
2270
- private expireTurnHold;
2271
- private ensureTurnSweep;
2272
- /** The answer a retried yield is served, held for {@link TURN_ANSWER_RETENTION_MS}. Only for a
2273
- * turn this incarnation accepted: an entry it has no acceptance for is one it cannot vouch for. */
2274
- private rememberSettledTurn;
2275
- /** Stamp when the pending latch dropped, so an unsettled leftover ages off that instant rather
2276
- * than the original deadline. Idempotent: the first drop is the one the retry window starts at. */
2277
- private markTurnLatchDropped;
2278
- /** Stop the sweep only when it has nothing left to do. It drives elapsed turns to their deadline
2279
- * terminals AND drops settled answers once their retry window has passed, so a stop while the
2280
- * second is still owed would leave one entry per turn for the process lifetime. */
2281
- private maybeStopTurnSweep;
2282
- private stopTurnSweep;
2283
- /** Drive every elapsed pending turn to its deadline terminal. Only entries at/past their own
2284
- * `deadlineAt` are read at all; a `resumed` settle is a yield mid-commit and is left alone. */
2285
- private sweepTurnDeadlines;
2286
1752
  /** Adopt one inherited TURN goal at boot (the reconcile sweep's turn branch): a non-terminal
2287
1753
  * entry carrying a parseable note rebuilds its pending relay — never an `uncertain` settle,
2288
1754
  * because the deadline hold IS this goal's bounded ending and it survived the restart. No
@@ -2296,9 +1762,7 @@ export declare class Manager {
2296
1762
  * no hold; its goal still records the spawn's readiness budget, which a successor needs to settle
2297
1763
  * it. */
2298
1764
  private acceptOnceTurn;
2299
- /** How a once seat's startup watch ended, waited for until {@link STARTUP_OUTCOME_MS} after its
2300
- * launch or the readiness window, whichever is longer. A watch that has not ended by then, or a
2301
- * seat being stopped, answers what the handle reports at that moment. */
1765
+ /** How a once seat's startup watch ended: {@link awaitStartupOutcome}. */
2302
1766
  private awaitStartupOutcome;
2303
1767
  /** Serve a once task from now on: its spawn's succeeded terminal is written. */
2304
1768
  private openOnceDelivery;
@@ -2310,6 +1774,14 @@ export declare class Manager {
2310
1774
  /** A once seat's helpers end with its task. A natural exit reaps them in {@link onAgentExit}; a
2311
1775
  * stop frees the slot first, so this stop reaps them itself. */
2312
1776
  private stopOnceSeat;
1777
+ /** Stop a seat this spawn just placed and track its exit: the stop first, so the terminalizing
1778
+ * latch is set before anything awaits, then the exit tracking. Both are synchronous. */
1779
+ private stopAndTrack;
1780
+ /** End a once seat before its task is served: let go of the spawn goal, record why it stopped if
1781
+ * `stopReason` is given and none is recorded yet, then stop the seat. Synchronous, in that order. */
1782
+ private endOnceBeforeServe;
1783
+ /** Put a launched seat in the agent table, then mark its reserved name placed. */
1784
+ private place;
2313
1785
  /** The once task's exit hook, on the handle the seat was launched with: whichever path ends the
2314
1786
  * seat, its proved exit cancels a task that has no terminal yet and discharges the seat's debt. An
2315
1787
  * exit that cannot be proved leaves both. */
@@ -2319,35 +1791,14 @@ export declare class Manager {
2319
1791
  * then drop its index entry. One flight per task; a failure keeps it in {@link onceSettles} and
2320
1792
  * the turn sweep retries it. */
2321
1793
  private settleOnceTurn;
2322
- private runOnceSettle;
2323
1794
  /** Cancel a once task with `reason` unless it already has a terminal. */
2324
1795
  private commitOnceCancel;
2325
1796
  /** Ask the seat's connector to prove its launched processes gone, within {@link ONCE_RETIRE_MS}.
2326
1797
  * Throws without that proof. */
2327
1798
  private retireOnceSeat;
2328
- /** Record a once task a predecessor accepted, and bind its seat if this incarnation already
2329
- * adopted it. The static adoption and the goal reconcile run in either order, so each side
2330
- * binds what the other has already found. */
2331
- private inheritOnce;
2332
- /** An inherited once task whose seat this manager cannot hold: it adopts no seats (an open or
2333
- * user-mode mesh) and the seat is not bound here. */
2334
- private onceSeatUnheld;
2335
- /** Whether a once task was served: its spawn's succeeded terminal is written. */
2336
- private onceServed;
2337
1799
  /** Make an adopted seat a once seat again: its exit settles its task, and the task is served to
2338
1800
  * it. A task that ended before the restart owes the stop the predecessor may not have made. */
2339
1801
  private bindOnceSeat;
2340
- /** Inherited once tasks whose seat is not bound here. On a static mesh the boot reconcile adopts
2341
- * every seat it can and reaps the rest by their custody reference, so once it has finished with
2342
- * a seat's slot, an unbound seat is proved gone. A manager that adopts no seats cannot reach the
2343
- * old seat or prove its exit: it does not serve the task to it, a task with a deadline ends at
2344
- * that deadline, and one without is settled `uncertain` after one readiness window. Its debt is
2345
- * never cleared here, since nothing proves that seat gone. */
2346
- private settleInheritedOnce;
2347
- /** An inherited task's seat this manager cannot reach: its terminal stands, and its index entry,
2348
- * the seat's debt, stays recorded, because nothing here can prove that seat gone. The seat is
2349
- * told to end itself on its next pull, and its notice repeats until a pull carries that. */
2350
- private keepUnprovedOnceDebt;
2351
1802
  /** Settle race: a despawn MID-GOAL drives the goal's cancel terminal - transition to
2352
1803
  * `cancelling`, then commit the `cancel` cause on the goal-writer connection. First-terminal-fact
2353
1804
  * wins: if the readiness outcome already committed (succeeded/failed/uncertain) the transition or
@@ -2359,9 +1810,8 @@ export declare class Manager {
2359
1810
  private recordSlotCustody;
2360
1811
  private reserveCustody;
2361
1812
  private spawnCustodied;
2362
- /** Keep launch provenance independent of status and runtime wire contracts. */
1813
+ /** Keep launch provenance independent of status and runtime wire contracts: {@link watchConnectorHolder}. */
2363
1814
  private watchConnectorHolder;
2364
- private recordSeat;
2365
1815
  private refreshSeatRecord;
2366
1816
  private dropSeatRecord;
2367
1817
  /** True when a default stop wrote a runtime reference for this exact lifecycle and it is still