@cotal-ai/manager 0.169.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.
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, ControlEndpoint, 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
@@ -473,363 +474,6 @@ export interface ManagerResumeResult {
473
474
  }>;
474
475
  error?: string;
475
476
  }
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
477
  /**
834
478
  * The agent supervisor: a long-lived mesh node that owns agent process lifecycle.
835
479
  * It serves control requests on the "manager" service and spawns/kills agents
@@ -969,10 +613,11 @@ export declare class Manager {
969
613
  private readonly onceWatched;
970
614
  /** Process start, for the served `status` uptime. */
971
615
  private readonly startedAtMs;
972
- /** Connector harness inventory. Available paths stay pinned; missing binaries are retried when
616
+ /** Connector harness inventory. Available paths stay pinned; unavailable rows are retried when
973
617
  * launch, model lookup or status asks, without stopping unrelated Manager work. */
974
618
  private connectorStatuses;
975
619
  private connectorRequirements;
620
+ private claudeWakeRecheck?;
976
621
  /** The boot inventory's warnings, printed once start completes, so a refused start prints none. */
977
622
  private bootNotes;
978
623
  /** The complete boot task. stop() joins it after fencing static reconciliation, so a registration
@@ -1112,6 +757,8 @@ export declare class Manager {
1112
757
  private readonly staticLifecycle;
1113
758
  /** User-mode provisioning owns no manager state: each dependency reads through at its use. */
1114
759
  private readonly userProvision;
760
+ /** The launch pipeline's leaf steps. Every dependency reads through at its use. */
761
+ private readonly seatLaunch;
1115
762
  constructor(opts: ManagerOptions);
1116
763
  get runtimeKind(): string;
1117
764
  /** Whether this manager's runtime opens a terminal stream on the seats it spawns, so a caller
@@ -1449,7 +1096,7 @@ export declare class Manager {
1449
1096
  * readiness reads the same status; the maintenance fence refuses every other command in both
1450
1097
  * states. The read is counted in `lifecycleInFlight` like any admitted operation and released in
1451
1098
  * `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. */
1099
+ * applies. `preserving` and a stopping manager stay fenced. */
1453
1100
  private serveObservation;
1454
1101
  /** The ep door's ADMIN flag for a caller. Static mesh: `true` — the
1455
1102
  * admin-grade rows (any-mode despawn/attach, the `manager.admin` family, `launch`) are minted
@@ -1548,10 +1195,7 @@ export declare class Manager {
1548
1195
  * host callback with the full endpoint caller tuple. Error string when denied, `undefined` when
1549
1196
  * allowed; remote host-state faults throw rather than being collapsed into a denial. */
1550
1197
  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`. */
1198
+ /** The wire principal of a managed agent: {@link managedPrincipal}. */
1555
1199
  private managedPrincipal;
1556
1200
  private resumeLivenessErrors;
1557
1201
  /** Self-despawn (P2b): stop the managed agent whose id == the authenticated caller. The
@@ -1587,13 +1231,10 @@ export declare class Manager {
1587
1231
  * wait proves exit: nobody asked for those children to be gone, so they stay managed until the
1588
1232
  * runtime says otherwise, and a runtime that cannot prove exit records an unverified stop. */
1589
1233
  private trackStoppedHandle;
1590
- private servedSpawnRequest;
1591
1234
  private provisionUserAgent;
1592
1235
  /** Shred a user agent's secret family from the store and from disk. Every removal is attempted,
1593
1236
  * and each failure joins `unshredded`, so one fault cannot leave the rest of the family behind. */
1594
1237
  private shredUserSecrets;
1595
- private delegatedMeshRecord;
1596
- private composeManagedHandoff;
1597
1238
  /**
1598
1239
  * WHY A SEAT LEFT — one line, at the one place every free path passes through.
1599
1240
  *
@@ -1655,8 +1296,6 @@ export declare class Manager {
1655
1296
  private readManagedSessionState;
1656
1297
  private retainedSessionId;
1657
1298
  private forkProvenance;
1658
- private refuseCarriedFork;
1659
- private refuseLateCarriedFork;
1660
1299
  private readManagedSession;
1661
1300
  private recordContinuity;
1662
1301
  private recordContinuityAtStop;
@@ -1674,8 +1313,6 @@ export declare class Manager {
1674
1313
  * path. */
1675
1314
  private onAgentExit;
1676
1315
  private nameError;
1677
- private nameInUse;
1678
- private uniqueName;
1679
1316
  /** Spawn a teammate by persona ref (`name` loads `.cotal/agents/<name>.md`; the peer presents
1680
1317
  * under that file's own `name:`), as if a peer asked via the control plane. Used to pre-spawn the
1681
1318
  * demo's experts at startup so the manager owns them. */
@@ -1696,14 +1333,10 @@ export declare class Manager {
1696
1333
  * here, and a deadline past the scheduler's last instant is refused here, which the schema does
1697
1334
  * not express. */
1698
1335
  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. */
1336
+ /** {@link SeatLaunch.checkSpawnCwd}. */
1702
1337
  private checkSpawnCwd;
1703
- /** Refuse host directory reads before lookup when seats cannot use this host. */
1704
- private assertHostDirectoryExecution;
1705
1338
  private listSpawnDirectory;
1706
- /** Resolve a placed spawn directory without creating or substituting a workspace. */
1339
+ /** {@link SeatLaunch.resolveSpawnCwd}. */
1707
1340
  private resolveSpawnCwd;
1708
1341
  /** Resolve a connector by agent type. Library composition (installedExtensions off) → a registry
1709
1342
  * hit, exactly as before (the composition root imported what it wants). The published binary gates
@@ -1714,30 +1347,26 @@ export declare class Manager {
1714
1347
  * including providers already present in the registry.
1715
1348
  * Fail-loud with an install hint; no fallback. */
1716
1349
  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. */
1350
+ /** {@link SeatLaunch.connectorNames}. */
1719
1351
  private connectorNames;
1720
1352
  /** Resolve every installed/registered connector's declared harness binaries before the manager
1721
1353
  * reports ready. A missing harness degrades only that connector, never unrelated lifecycle work:
1722
1354
  * boot continues, names it once start completes and records it on both manager status surfaces. */
1723
1355
  private inspectConnectorsAtBoot;
1724
- /** Retry missing applications on the Manager's PATH without changing resolved available rows. */
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. */
1725
1360
  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. */
1361
+ /** {@link SeatLaunch.classSpawnEnabled}. */
1729
1362
  private classSpawnEnabled;
1730
1363
  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. */
1364
+ /** {@link SeatLaunch.harnessUnavailableError}. */
1736
1365
  private harnessUnavailableError;
1737
1366
  /** The harness binaries a managed launch runs, as boot resolved them, or the refusal naming what is
1738
1367
  * missing. Spawn, resume and the model catalog all take it, so a seat launches from the same files
1739
1368
  * 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.
1369
+ * is there. Callers recheck unavailable rows first; available rows retain their resolved files.
1741
1370
  * A connector registered after boot has no inventory row and is checked on PATH now. */
1742
1371
  private launchHarness;
1743
1372
  /** The launch fields the host supplies rather than the seat. Spawn and resume both take them from
@@ -1748,10 +1377,9 @@ export declare class Manager {
1748
1377
  /** The refusal for a launch choice the connector cannot honour. Spawn and resume both ask before
1749
1378
  * a seat's launch is built, so a rule changed here holds on both paths. */
1750
1379
  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. */
1380
+ /** {@link SeatLaunch.onceRefusal}. */
1753
1381
  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. */
1382
+ /** {@link SeatLaunch.spawnerName}. */
1755
1383
  private spawnerName;
1756
1384
  /** The refusal for an event-plane choice the registration policy or the connector cannot meet.
1757
1385
  * Spawn and resume both ask before a seat's launch is built, so a seat retained without the
@@ -1788,42 +1416,15 @@ export declare class Manager {
1788
1416
  * defaulting to the manager's own id for roster/pre-spawn — recorded for the spawner
1789
1417
  * ledger (own-children despawn + reap-on-parent-exit). */
1790
1418
  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). */
1419
+ /** {@link SeatLaunch.spawnPersona}. */
1794
1420
  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. */
1421
+ /** {@link SeatLaunch.spawnRun}. */
1805
1422
  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
- */
1423
+ /** {@link SeatLaunch.staticSpawnBound}. */
1818
1424
  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. */
1425
+ /** {@link SeatLaunch.spawnBoundRefusal}. */
1824
1426
  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. */
1427
+ /** {@link SeatLaunch.managedStaticInstanceReads}. */
1827
1428
  private managedStaticInstanceReads;
1828
1429
  private startAgentActive;
1829
1430
  /** Preflight the whole inventory before launching its first process, then adopt each exact retained
@@ -1902,33 +1503,11 @@ export declare class Manager {
1902
1503
  private occupancy;
1903
1504
  private occupancyText;
1904
1505
  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
- */
1506
+ /** The owner a launch belongs to: {@link NamesCapacity.launchOwner}. */
1913
1507
  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
- */
1508
+ /** Live seats this manager holds for one owner: {@link NamesCapacity.ownerSeats}. */
1924
1509
  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
- */
1510
+ /** The per-owner ceiling at accept: {@link NamesCapacity.seatCapRefusal}. */
1932
1511
  private seatCapRefusal;
1933
1512
  private opStop;
1934
1513
  /** The ONE named-terminal core both doors share: the ctl named `stop`
@@ -2183,9 +1762,7 @@ export declare class Manager {
2183
1762
  * no hold; its goal still records the spawn's readiness budget, which a successor needs to settle
2184
1763
  * it. */
2185
1764
  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. */
1765
+ /** How a once seat's startup watch ended: {@link awaitStartupOutcome}. */
2189
1766
  private awaitStartupOutcome;
2190
1767
  /** Serve a once task from now on: its spawn's succeeded terminal is written. */
2191
1768
  private openOnceDelivery;
@@ -2197,6 +1774,14 @@ export declare class Manager {
2197
1774
  /** A once seat's helpers end with its task. A natural exit reaps them in {@link onAgentExit}; a
2198
1775
  * stop frees the slot first, so this stop reaps them itself. */
2199
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;
2200
1785
  /** The once task's exit hook, on the handle the seat was launched with: whichever path ends the
2201
1786
  * seat, its proved exit cancels a task that has no terminal yet and discharges the seat's debt. An
2202
1787
  * exit that cannot be proved leaves both. */
@@ -2225,9 +1810,8 @@ export declare class Manager {
2225
1810
  private recordSlotCustody;
2226
1811
  private reserveCustody;
2227
1812
  private spawnCustodied;
2228
- /** Keep launch provenance independent of status and runtime wire contracts. */
1813
+ /** Keep launch provenance independent of status and runtime wire contracts: {@link watchConnectorHolder}. */
2229
1814
  private watchConnectorHolder;
2230
- private recordSeat;
2231
1815
  private refreshSeatRecord;
2232
1816
  private dropSeatRecord;
2233
1817
  /** True when a default stop wrote a runtime reference for this exact lifecycle and it is still