Cotal TypeScript packages
    Preparing search index...

    Class Manager

    The agent supervisor: a long-lived mesh node that owns agent process lifecycle. It serves control requests on the "manager" service and spawns/kills agents through a pluggable Runtime (pty by default). It does NOT proxy agent mesh traffic — terminal I/O streams over its own attach endpoint instead.

    Index
    abortPreservation absentByLeaseRow acceptOnceTurn adoptRuntimeHandle adoptSeat adoptTurnGoal armSessionRecovery assertGoalWriterEpochCurrent attachAuthorized authorizeNamed authorizeRunAmend authorizeRunAnswer awaitHandleExit awaitLifecycleDrain awaitReadiness awaitStartupOutcome beginLifecycle bindOnceSeat boundedReconnect canReadPersona capabilityRefusal claimDaemonRenewalOwnership classSpawnEnabled commitOnceCancel commitPreservation confirmRetirement deprovision deprovisionBroker despawnAuthorized dial dialRemoteStanding dialServeConnection driveStaticRetirement dropInlineSnapshot dropSeatRecord emitGoalProgress endOnceBeforeServe epAdminReach eventsRefusal executionRecordPath executionRefusal failSeatTurns fenceRetiringAcl fileDigest findManagedByTarget forkProvenance freeSlot healFrozenRegistrationGate hostedAgents hostedSeatCount hostLaunchFields inlineSnapshotChange inputAuthorized inventoryReferenceError isProcessBoundSeat launchOwner lifecycleMembershipInventory lifecycleMembershipRefusal list loadSeatRuntime localPreservation localServiceObservation loggedSpawnRefusal logSeatMeshTransitions logSeatReaped maintenanceError managedPrincipal managerServiceDefs managerStatusData mintAndStageGoalWriter mintAndStageSessionLedger nameError noticeSeatTurns occupancy omitClassCommands onAgentExit onceRefusal opCommitResume opDefinePersona openOnceDelivery openStaticChatSession opFinalizeResume opLaunch opModels opPreservationCtl opPurge opRemovePersona opResumePreserved opStart opStopSelf pendingWork place preparePreservation preserveState probeStaticCredential provisionUserAgent psOwnerFilter readerRemedy readManagedSession readManagedSessionState readStaticReconcileSlot reapChildrenOf reapOrphanSeat reconcileGoalIndex reconcileStaticLifecycles recordContinuity recordContinuityAtStop recordSlotCustody recordSlotRuntime recoverManagedSession refreshSeatRecord registerManagerService releasedSeatPending releaseLifecycle renewDaemonCreds renewManagedStaticCred renewRemoteBeforeRedial renewRemoteExecutor renewRemoteStandingBundle reserveCustody resolveConnector resolveServeTarget restartSupervisedSeat resumeEntry resumeEntryOf resumePreserved resumePreservedAgent retainedSessionId retireConnection retireDelegatedAgent retireStaticChatSession runAnswerer runHost runPreparation runtimeFor seatRecordFor serveBound serveGated serveObservation serveSpawnGoal serveTurnCancel serveTurnGoal serveTurnParticipation serveTurnUnconfirmed serveTurnYield serviceIdentityObservation settleOnceTurn shredUserSecrets spawnCustodied spawnPersona spawnRun start startAgent startByName staticReconciliationStatus staticSpawnBound stop stopAndTrack stopHandle stopWindowsSeat tail trackDeprovision turnPendingFor turnTarget validateRetainedAuthority waitForPresence watchConnectorHolder watchExit watchOnceExit withEndpointServeExecutor withIssuer withLifecycleExecutor withOpenServeConnection withProvisioner withRetirementSlot
    admittedLocalIdentity?: ManagerInstanceIdentity

    The local instance identity admitExecutionState already resolved. The ordinary start adopts it instead of reading the same record again.

    agentGoals: Map<string, GoalRef> = ...

    The live spawn goal ref for each managed agent name, so a despawn MID-GOAL drives the cancel path (transition -> cancel terminal). Cleared when the goal terminalizes.

    agents: Map<string, ManagedAgent> = ...
    attach: AttachEndpoint
    config: ManagerConfig = ...

    The Manager's identity, operator settings and timing (see ManagerConfig). Declared ahead of the parts so each part built below receives this object; the constructor fills the rest in.

    credRenewTimer?: Timeout

    The class-2 renewal owner's half-TTL schedule; armed only on auth meshes.

    daemonRenewalLeaseTimer?: Timeout
    delegatedLaunched: Set<string> = ...

    Lifecycle UIDs already handed to Runtime.spawnDelegated: a lifecycle is handed off at most once, so a lost create acknowledgement can never become a second create.

    installedExtensions: boolean
    leaseStopping: boolean = false

    Set at the top of stop(). renewLease returns at once once this is set, and its gone arm does not re-acquire: a manager that is stopping never puts its own key back. It also closes the lifecycle fence (beginLifecycle), so no spawn can launch a seat the stop never sees.

    lifecycleInFlight: number = 0
    maintenanceState: ManagerMaintenanceState = "active"
    managerServeIdentity: Identity

    The persisted serve nkey identity: reusing the SAME principal across restart keeps provisionEndpointGateOpen idempotent (no core barrier change) and gives verified eviction a stable target (the predecessor's connections under this principal). Set in start().

    namesCapacity: NamesCapacity = ...
    onceWatched: Set<string> = ...

    Once tasks whose seat's exit is watched: that exit, not the spawn's outcome, settles the debt.

    participants: Map<string, PersonalTurnParticipant> = ...
    preservationAttemptId?: string
    preservationGeneration: number = 0
    preservationInventory?: ManagerResumeInventory
    resumeCredRenewal?: () => void
    resumeDurableCommitToken?: string
    resumeRequired: boolean = false
    retirement: Retirement = ...
    runHosting?: RunHosting

    The workflow-run host (SPEC 14.3): the drives this incarnation holds, each on its own per-run credential and connection. Absent under a remote authority, which mints no driver credentials, so the run-* family refuses there rather than connecting on a weaker identity.

    seatCustody: SeatCustody = ...
    sessionRecovery: SessionRecovery = ...
    staticLifecycle: ManagedStaticLifecycle = ...
    staticLifecycleEvict?: (principal: string) => Promise<EvictionResult>

    Internal test seam. Production leaves this undefined and uses the scoped delivery-admin evictor.

    transcripts?: TranscriptReceiver

    This instance's side of a carried resume transcript (#1499); absent where it has no transfer reader.

    transportDown: WeakSet<NatsConnection> = ...

    #1577: dedicated connections (serve, goal-writer, session-ledger) whose transport is down while the client reconnects them, tracked by BrokerTransport.trackTransport. Such a connection is open (isClosed() is false under unbounded reconnects) yet the broker holds none of its rails, so the liveness responder must not grade the serve connection bound, and a stop closes rather than drains it (retireConnection). Keyed by the connection, so a re-dial that swaps in a fresh one starts from its own state.

    unverifiedStops: {
        authoritative?: boolean;
        error?: string;
        handle: AgentHandle;
        id: string;
        name: string;
    }[] = []
    userProvision: UserProvision = ...

    User-mode provisioning owns no manager state: each dependency reads through at its use.

    DELIVERY_SHARD: 0

    The delivery shard whose lease names the process that reloads the standing credentials. Delivery is single-shard today and the endpoint's own responder reads row 0; naming it here keeps the manager's binding check and that reply arguing about the same row.

    • get managerInstanceId(): string

      The persisted LOGICAL instance id (SPEC 13.6 item 7): STABLE across restart, so a restart re-registers the SAME id with an ADVANCED epoch through the §13.1 gate (the successor fences the predecessor's epoch — the (i) fence bites on a real restart). It is the registration instanceId, the served-status id, the goal spec's executor.instanceId, the epe route, and the resolveExecutorEpoch key — DISTINCT from ManagerConfig.managerLifecycleUid (per-process: the presence node uid + the managerInstance audit coordinate every static activation records). Set in start(); undefined before.

      Returns string

    • set managerInstanceId(value: string): void

      Parameters

      • value: string

      Returns void

    • get meshMode(): "user" | "open" | "static"

      The out-of-band route for the mesh the refusal is running on, as ONE paste-ready command.

      A REMEDY A REFUSAL PRINTS IS AUTHORITY THE REFUSAL LENDS, AND BOTH HALVES OF THIS ONE WERE WIDER THAN THE SENTENCE AROUND THEM. The static half named --profile observer, and mint reads --allow-subscribe only for the agent profile while the observer arm of permissionsFor hardcodes chat.>: an operator narrowing a reader to one event plane was handed a reader of every channel in the space. The user half named a bare cotal actor grant, and an omitted flag there is not "leave it alone" but the WIDE default (> read, > post, spawn,run,role:default scope), so the same sentence handed out a full-mesh reader-writer with spawn and workflow scope. The static half was found by RUNNING the printed command and decoding what it produced; the user half was found by READING it against runActor's defaults. Neither is the only way in, and a remedy string is not proved by either one alone.

      So the command is spelled out in full and only ONE is printed: the one for the mesh this manager is actually running, because a sentence carrying both routes is a sentence an operator picks the wrong half of. smoke:events-grant section 9 runs the static half and grades the credential; smoke:user-spawn:live section E runs the user half and grades the row.

      It takes NO mode argument, on purpose. It used to, and the resume door passed the resumed DOCUMENT's (entry.identity.mode === "user") rather than the manager's: those agree on an honest inventory and disagree on the shape section 8 exercises, a user-mode record under a static manager, where it handed a static operator cotal actor grant for a mesh with no actor ledger to write it to. The operator reading the refusal is on the manager's mesh, never on the record's. A boolean parameter is how that happened, so the mode is read from this and a third door cannot pass the wrong one.

      The selector below reads the three-valued mesh mode (open | static | user), not a boolean derived from it (#567). this.userMode is false for BOTH static and open, so a boolean selector collapses those two and an open mesh was handed the static route (cotal mint --provision), which mint refuses outright on an open mesh. A boolean also has no third state to invert, so a mutation grid over return this.userMode ? … : … proves the one arm it has is load-bearing but is structurally blind to a missing arm: there is no mutant that turns "two arms" into "three arms". Switching on meshMode gives a fourth mesh mode nowhere to fall silently, since switch has no default arm to catch it.

      Returns "user" | "open" | "static"

    • get spareSeats(): "stop" | "release"

      What a default process stop does with this manager's seats. release drops manager-local custody and leaves every seat running. stop means this runtime keeps its PTYs inside the manager process, so those seats close with it: the stop stops and deprovisions them, and still releases every seat that can outlive it.

      Returns "stop" | "release"

    • get staticReconcileLastSweepResources(): | {
          deprovision?: DeprovisionResourceAccounting;
          slots: {
              deferred: number;
              examined: number;
              failed: number;
              preservedAdopted: number;
              preservedForeign: number;
              retired: number;
              terminalized: number;
          };
      }
      | undefined

      Returns
          | {
              deprovision?: DeprovisionResourceAccounting;
              slots: {
                  deferred: number;
                  examined: number;
                  failed: number;
                  preservedAdopted: number;
                  preservedForeign: number;
                  retired: number;
                  terminalized: number;
              };
          }
          | undefined

    • set staticReconcileLastSweepResources(
          value:
              | {
                  deprovision?: DeprovisionResourceAccounting;
                  slots: {
                      deferred: number;
                      examined: number;
                      failed: number;
                      preservedAdopted: number;
                      preservedForeign: number;
                      retired: number;
                      terminalized: number;
                  };
              }
              | undefined,
      ): void

      Parameters

      • value:
            | {
                deprovision?: DeprovisionResourceAccounting;
                slots: {
                    deferred: number;
                    examined: number;
                    failed: number;
                    preservedAdopted: number;
                    preservedForeign: number;
                    retired: number;
                    terminalized: number;
                };
            }
            | undefined

      Returns void

    • get streamsTerminal(): boolean

      Whether this manager's runtime opens a terminal stream on the seats it spawns, so a caller knows before it asks whether attach can open one here. A control instance with no execution spawns no seat, so it streams no terminal either.

      Returns boolean

    • CredentialRenewal.absentByLeaseRow.

      Parameters

      • ...args: [unanswered: boolean]

      Returns Promise<"absent">

    • Accept a once spawn's task, inline in the spawn's accept seam: nothing has launched yet, so a refusal here fails the spawn and leaves no seat. Mirrors serveTurnGoal's accept, with the goal ref and the seat given rather than read off a request. A task with no deadline mints no hold; its goal still records the spawn's readiness budget, which a successor needs to settle it.

      Parameters

      • o: {
            acceptedAt: number;
            command: string;
            deadlineMs: number | undefined;
            executor: { epoch: number; lifecycleUid: string };
            fingerprint: string;
            prompt: string;
            readinessDeadlineMs: number;
            retire?: string;
            seat: { actor: string; name: string; owner: string; uid: string };
            spawner: string;
            spawnRef: GoalRef;
        }

      Returns Promise<{ deadlineAt?: number; ref: GoalRef }>

    • Adopt one inherited TURN goal at boot (the reconcile sweep's turn branch): a non-terminal entry carrying a parseable note rebuilds its pending relay — never an uncertain settle, because the deadline hold IS this goal's bounded ending and it survived the restart. No liveness verdict is made here (the agents map is empty during reconcile, so absence means "not yet re-registered", never "dead"); a garbled note or a floor that does not name the seat's owner is logged and left, the dead-pointer honesty rule.

      Parameters

      • entry: {
            allocated?: {
                actor: string;
                name: string;
                owner?: string;
                readinessDeadlineMs?: number;
                uid: string;
            };
            iid: string;
            note?: string;
            ref: GoalRef;
        }

      Returns Promise<void>

    • GoalWriter.assertGoalWriterEpochCurrent.

      Parameters

      • ...args: [epoch: number]

      Returns Promise<void>

    • TerminalInput.attachAuthorized.

      Parameters

      • ...args: [a: ManagedAgent, caller: { actor: string; owner: string; uid: string }]

      Returns Promise<ControlReply>

    • Collapsed despawn/attach authorization (P4b). The caller already reached the command's ep row (cred-gated: owner-mode rows via the spawn capability, any-mode rows only in admin instruments). With admin=true (any-mode) any named target is allowed (operator). Otherwise a named target is allowed if it's the caller's OWN child (spawner == caller) — and, on a user mesh, if it runs under the CALLER'S OWNER (owner-domain) or the caller's ledger row holds admin, read fresh. Local managers run the pure authorizeNamedControl policy against their provider-backed ledger. Remote managers preserve own-child and owner-domain decisions locally, then send only the residual cross-owner admin question through the registered host callback with the full endpoint caller tuple. Error string when denied, undefined when allowed; remote host-state faults throw rather than being collapsed into a denial.

      Parameters

      • target: ManagedAgent
      • caller: string
      • admin: boolean
      • OptionalepCaller: EpCaller

      Returns Promise<string | undefined>

    • A baseline seat may answer only the pause whose relay is pending on that exact incarnation. Explicit run holders and unmanaged operator instruments keep the run capability's existing answer reach. The relay payload is manager-held state written by the runtime, never request input, and its token is checked against the open checkpoint before any answer is filed.

      Parameters

      • ctx: EpServeContext
      • args: { runId: string; stepKey: string }
      • open: { token: string }

      Returns void

    • ReadinessWait.awaitReadiness.

      Parameters

      • ...args: [
            a: ManagedAgent,
            readinessTimeoutMs: number,
            opts: { joinedAfter?: number; operator?: string; reapOnExit?: boolean },
        ]

      Returns Promise<
          | { ok: true; operator?: string }
          | {
              deliberate?: boolean;
              detail: string;
              ok: false;
              running?: boolean;
              uncertain?: boolean;
          },
      >

    • Admit one lifecycle/control operation while active. The synchronous increment is the fence: preserveState and stop close it before their first await, so work is either counted or rejected.

      Parameters

      • resumeOperation: boolean = false

      Returns (() => void) | undefined

    • Make an adopted seat a once seat again: its exit settles its task, and the task is served to it. A task that ended before the restart owes the stop the predecessor may not have made.

      Parameters

      • a: ManagedAgent

      Returns Promise<void>

    • CredentialRenewal.boundedReconnect.

      Parameters

      • ...args: [label: string, attempt: () => Promise<boolean>, expired: boolean]

      Returns Promise<boolean>

    • PersonaCatalog.canReadPersona.

      Parameters

      • ...args: [owner: string, caller: string, admin: boolean]

      Returns boolean

    • HarnessResolution.capabilityRefusal.

      Parameters

      • ...args: [
            connector: Connector,
            launch: {
                askPermissions?: boolean;
                events: boolean;
                exact: boolean;
                firstCommand?: CommandInput;
                modes?: LaunchModes;
                prompt?: string;
                reasoningEvents?: boolean;
                variant?: string;
            },
        ]

      Returns string | undefined

    • CredentialRenewal.claimDaemonRenewalOwnership.

      Parameters

      • ...args: [waitMs: number]

      Returns Promise<void>

    • BrokerTransport.dial.

      Parameters

      • ...args: [opts: NodeConnectionOptions]

      Returns Promise<NatsConnection>

    • BrokerTransport.dialRemoteStanding.

      Parameters

      • ...args: [opts: NodeConnectionOptions, deadline: number]

      Returns Promise<NatsConnection>

    • Parameters

      • state: { creds?: string; grant: EpServeGrant; identity: Identity; nc: NatsConnection }
      • readCreds: () => string = ...
      • Optionaldeadline: number

      Returns Promise<{ handle: EpServeHandle; nc: NatsConnection }>

    • SeatStop.dropInlineSnapshot.

      Parameters

      • ...args: [name: string, lifecycleUid: string]

      Returns boolean

    • End a once seat before its task is served: let go of the spawn goal, record why it stopped if stopReason is given and none is recorded yet, then stop the seat. Synchronous, in that order.

      Parameters

      • a: ManagedAgent
      • reason: string
      • OptionalstopReason: string

      Returns void

    • The reap hook: a pending turn addressed to the reaped INCARNATION is MARKED dead, never settled early — no honest terminal exists for it (a completion must prove the executor's live currency, and the hold is only expirable once due), so the entry rides to its deadline and the deny then records both facts. The addressee's own client observes the death from presence long before that, which is the run's L4002.

      Parameters

      • name: string
      • uid: string

      Returns void

    • SeatStop.fenceRetiringAcl.

      Parameters

      • ...args: [a: { id: string; lifecycleUid: string }]

      Returns Promise<string | undefined>

    • SeatStop.findManagedByTarget.

      Parameters

      • ...args: [t: { actor: string; lifecycleUid: string; owner: string }]

      Returns ManagedAgent | undefined

    • Parameters

      • a: ManagedAgent
      • floor: boolean
      • cause: FreeSlotCause
      • acceptedBeforeFence: boolean = false

      Returns void

    • ManagerBoot.healFrozenRegistrationGate.

      Parameters

      • ...args: [authKv: KV, instanceId: string, auth: SpaceAuth, recordsKv: KV]

      Returns Promise<void>

    • StatusAndModels.hostedAgents.

      Parameters

      • ...args: []

      Returns {
          application: string;
          cwd: string;
          id: string;
          lifecycleUid: string;
          model?: string;
          name: string;
          startedAt: string;
          state: "running" | "exited";
      }[]

    • HarnessResolution.hostLaunchFields.

      Parameters

      • ...args: [
            cotalConfig: CotalConfig,
            agent: string,
            shareTools: readonly string[],
            harness: { binaries?: Readonly<Record<string, string>> },
        ]

      Returns ReturnType<HarnessResolution["hostLaunchFields"]>

    • Why an inline seat's snapshot no longer matches its launch, or undefined when it does or the seat is not inline. The recorded path and the relaunch's path must both be this lifecycle's snapshot path, as the resume cut requires, and the file there must still be a private regular file with the recorded digest.

      Parameters

      • a: ManagedAgent

      Returns string | undefined

    • TerminalInput.inputAuthorized.

      Parameters

      • ...args: [a: ManagedAgent, args: Record<string, unknown>]

      Returns Promise<{ bytes: number; name: string }>

    • The owner a launch belongs to: NamesCapacity.launchOwner.

      Parameters

      • opts: Pick<StartAgentOpts, "owner">
      • Optionalspawner: string

      Returns string

    • SeatStop.lifecycleMembershipInventory.

      Parameters

      • ...args: [a: { id: string; lifecycleUid: string }]

      Returns Promise<{ channels: string[]; complete: boolean; reason?: string }>

    • SeatStop.lifecycleMembershipRefusal.

      Parameters

      • ...args: [caller: string]

      Returns string | undefined

    • StatusAndModels.list.

      Parameters

      • ...args: [ownerFilter?: string]

      Returns {
          activeAt?: number;
          agent: string;
          authHealth?: "auth-renewal-failed" | "auth-unknown" | "auth-stale";
          authReason?: string;
          condition?: {
              code: PresenceConditionCode;
              message?: string;
              since?: number;
              source?: string;
          };
          cwd: string;
          host: string;
          id: string;
          instanceId: string;
          joinHealth?: { reason: string; state: "degraded" };
          lifecycleUid: string;
          mesh: string;
          meshView: "current" | "unpopulated" | "stale";
          mode: string;
          model: string | undefined;
          name: string;
          offlineSince?: number;
          pid: number | undefined;
          presenceIdentityVerified: boolean;
          presenceObservedAt?: number;
          provider?: string;
          resume?: ForkProvenance | { source: string };
          role: string | undefined;
          space: string;
          spawner: string;
          startupNotice?: string;
          status: "running" | "exited";
          uptimeMs: number;
          variant: string | undefined;
      }[]

    • Import the installed extension that provides a seat's runtime before runtimeFor resolves it, as resolveConnector does for a connector. On the published binary the manager process imports only its own runtime, so a seat that names another installed runtime found nothing in the registry and was refused as unknown. The manifest is consulted first, so a live cotal ext remove refuses the next launch even while an earlier import keeps the provider registered; seats already on that runtime keep their cached backend. A library composition resolves only what its root imported. The refusal names an official runtime's package.

      Parameters

      • kind: string | undefined

      Returns Promise<void>

    • The attempt and inventory digest this embedding holds while maintenance is not active, for its own native child only. Absent when active or before an inventory exists.

      Returns { attemptId: string; inventorySha256: string } | undefined

    • SeatStop.logSeatReaped.

      Parameters

      • ...args: [a: ManagedAgent, cause: FreeSlotCause]

      Returns void

    • Tell a seat that its turn-pending answer changed (SPEC 14.3 turn notice), over the serve connection that holds this instance's reply rows. The notice carries no turn and the seat pulls on it, so a lost notice delays that seat until its next pull, and nothing else.

      Parameters

      • seat: { actor: string; name: string; owner: string; uid: string }

      Returns void

    • SeatLaunch.onceRefusal.

      Parameters

      • connector: Connector
      • runtime: Runtime
      • launch: Pick<
            StartAgentOpts,
            "once"
            | "supervise"
            | "launchOptions"
            | "prompt"
            | "autoName",
        >
      • spawner: string | undefined
      • hooks: SpawnHooks | undefined

      Returns string | undefined

    • PersonaCatalog.opDefinePersona.

      Parameters

      • ...args: [
            args: Record<string, unknown>,
            caller: string,
            admin: boolean,
            authenticated?: EpCaller,
        ]

      Returns Promise<ControlReply>

    • Parameters

      • raw: unknown

      Returns Promise<
          {
              actor: string;
              alias: string;
              expiresAt: number;
              lifecycleUid: string;
              sealed: string;
              sealer: string;
          },
      >

    • StartDoors.opLaunch.

      Parameters

      • ...args: [
            args: Record<string, unknown>,
            caller: string,
            admin: boolean,
            hooks?: SpawnHooks,
            route: "one" | "all" | "inst",
        ]

      Returns Promise<ControlReply>

    • StartDoors.opStart.

      Parameters

      • ...args: [
            args: Record<string, unknown>,
            caller: string,
            admin: boolean,
            hooks?: SpawnHooks,
            route: "one" | "all" | "inst",
            authenticatedCaller?: EpCaller,
            served?: string,
        ]

      Returns Promise<ControlReply>

    • The work a stop would cut short, as status reports it in stopImpact. cotal manager stop refuses while any is pending, and the idle clock does not run.

      Returns {
          deprovisioningInFlight: number;
          lifecycleInFlight: number;
          reservedLaunches: number;
          retirementsPending: number;
          staticReconciliationInFlight: number;
      }

    • Put a launched seat in the agent table, then mark its reserved name placed.

      Parameters

      • name: string
      • a: ManagedAgent

      Returns void

    • Parameters

      • name: string
      • opts: ProvisionUserAgentOpts

      Returns Promise<ProvisionedUserAgent | UserAgentRefusal>

    • Parameters

      • a: ManagedAgent

      Returns
          | { sessionId: string; status: "running"
          | "quit" }
          | { connector: string; cwd: string; prompt: string; status: "prompt" }

    • True when a default stop wrote a runtime reference for this exact lifecycle and it is still there. That file is what a later manager adopts, so a slot free must not remove it before the retirement that confirms the lifecycle is gone.

      Parameters

      • a: { lifecycleUid: string; name: string }

      Returns boolean

    • CredentialRenewal.renewRemoteBeforeRedial.

      Parameters

      • ...args: [label: string, read: () => string | undefined]

      Returns Promise<void>

    • CredentialRenewal.renewRemoteExecutor.

      Parameters

      • ...args: [force: boolean]

      Returns Promise<void>

    • CredentialRenewal.renewRemoteStandingBundle.

      Parameters

      • ...args: [force: boolean]

      Returns Promise<void>

    • Parameters

      • t: { actor: string; owner: string }

      Returns { lifecycleUid: string; mappingRevision: number } | undefined

    • PreservedResume.resumePreservedAgent.

      Parameters

      • ...args: [
            entry: ManagerResumeAgent,
            preflightOnly: boolean,
            batchReserved: boolean,
            prepared?: Map<string, PreparedResume>,
            supervised?: SupervisedRestart,
        ]

      Returns Promise<ControlReply>

    • BrokerTransport.retireConnection.

      Parameters

      • ...args: [nc: NatsConnection, flush?: () => Promise<unknown>]

      Returns Promise<void>

    • Parameters

      • raw: unknown

      Returns Promise<{ outcome: "failed" | "retired" | "alreadyRetired"; reason?: string }>

    • The answerer a run-answer records (SPEC 14.5): the caller as this manager knows them. A managed seat is named by its persona name; any other authenticated caller (an operator instrument, a logged-in user) by its principal. Never the request body's word.

      Parameters

      Returns string

    • The run host, or one of three refusals. A remote-authority manager holds no space signer, so it cannot mint the per-run driver credential SPEC 14.6 requires without all four closed host callbacks. A local user-auth mesh is unimplemented: a hosted run's seats are spawned, turned and despawned by a caller derived from the run id under the static owner, which the user-mode spawn door refuses (no u_ owner), so a program would fail at its first seat; no path to --local is offered there since a user bearer holds no run rows either. An ordinary manager whose host is not standing yet is still booting (the serve surface comes up before the host): unavailable, retry. The three are told apart, since the first sentence steers a caller to --local and the others must not.

      Returns RunHosting

    • The backend one seat launches, restarts, and is reaped through. An omitted or blank choice is this manager's own runtime. A named one is created once, cached by its resolved kind, and reused for every later seat of that kind. The manager's own runtime is never replaced. An unknown or unreachable runtime throws, and pooled control refuses a custodial one by the same rule the constructor applied to the manager's own.

      Parameters

      • kind: string | undefined

      Returns Runtime

    • Run one v0.4 service-command handler through the SHARED admission chokepoint (admitControl) on the broker-authenticated caller principal, mapping the two fences onto the §13.3 catalog: maintenance/resume → unavailable, membership → permission-denied. The serve boundary publishes the structured error reply.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

    • status only: serveGated, except that a fully preserved manager, and an active one launched for a resume that has not committed it yet, still answer it. A preserved-exit stop's caller-attributed preview needs the preserved manager's stop impact, and a resumed service's readiness reads the same status; the maintenance fence refuses every other command in both states. The read is counted in lifecycleInFlight like any admitted operation and released in finally, so a drain waits at most for one status snapshot; the membership gate still applies. preserving and a stopping manager stay fenced.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

    • The caller withdraws a turn it submitted (the reserved cancel, SPEC 13.6 item 4), so the seat is not shown it again and a late yield is answered from the cancelled terminal. Only a relay this incarnation holds is moved to cancelling, because only its holder can commit the terminal; an ended goal is refused with its cached outcome, which keeps a repeated cancel idempotent. The pending entry is the latch the yield and the deadline sweep race on, taken before the first await so a concurrent cancel finds nothing to take. A failed cancel puts it back so the relay still ends at its deadline, unless something ended the relay while it was held: a yield that read the entry first, or this commit with only its reply lost. An entry whose outcome cannot be read back stays out and converges through the goal index at the next boot, as a failed deadline commit does.

      Parameters

      Returns Promise<{ goalId: string; state: string }>

    • Accept one turn goal against a live managed seat. Mirrors serveSpawnGoal's accept path (idempotent retry map, index-CAS-before-bind, create-only bindGoal) but runs it INLINE: there is no launch to hand off, so the accept either completes durably or unwinds its own bound goal with a failed terminal before refusing.

      Parameters

      • ctx: EpServeContext
      • target:
            | { agent: ManagedAgent; kind: "managed"; name: string }
            | { kind: "personal"; name: string; participant: PersonalTurnParticipant }

      Returns Promise<TurnAcceptance>

    • Authorize and renew one personal native participant. Local user-auth authority reads the exact managed foreground row fresh; a signerless manager asks its registered host. The lease is held only in memory and is therefore renewed after reconnect or manager restart.

      Parameters

      Returns Promise<
          {
              actor: string;
              expiresAt: number;
              lifecycleUid: string;
              managerInstanceId: string;
              name: string;
              owner: string;
          },
      >

    • A once seat's report that its task's handoff to its harness was not confirmed. The seat sealed the task before it reported, so nothing hands it over again; the task fails delivery-unconfirmed and the seat is stopped. The commit proves the seat's live currency, as a yield's does: a seat already gone commits nothing here, and its exit cancels the task. Only the addressed seat may report, only for its once task; a repeat after the terminal is answered with it.

      Parameters

      • c: { actor: string; owner: string; uid: string }
      • raw: Record<string, unknown>

      Returns Promise<{ goalId: string; state: string }>

    • The seat's yield: claim the hold (one-use; expiry fails closed), then commit the goal succeeded carrying the TurnResult. A yield AFTER the deadline drives the deadline terminal instead and refuses — the expiry outcome stands, never a late success over it.

      Parameters

      • c: { actor: string; owner: string; uid: string }
      • raw: Record<string, unknown>

      Returns Promise<{ goalId: string; state: string }>

    • End a once task that can no longer run: once its connector, when it has a retire hook, proves the seat's launched processes gone, cancel the task with reason if it has no terminal yet, then drop its index entry. One flight per task; a failure keeps it in onceSettles and the turn sweep retries it.

      Parameters

      • ref: GoalRef
      • reason: string
      • Optionalretire: OnceRetire

      Returns Promise<void>

    • Shred a user agent's secret family from the store and from disk. Every removal is attempted, and each failure joins unshredded, so one fault cannot leave the rest of the family behind.

      Parameters

      • unshredded: CleanupFailure[]
      • family: { actorToken?: string; health?: string; sentinelCreds?: string }

      Returns Promise<void>

    • SeatLaunch.spawnPersona.

      Parameters

      • ...args: [
            opts: Pick<
                StartAgentOpts,
                | "agent"
                | "name"
                | "persona"
                | "identity"
                | "config"
                | "defaultAgent"
                | "resolved",
            >,
            spawner: string,
            authenticatedCaller: EpCaller,
        ]

      Returns Promise<
          | {
              agent: string;
              configPath: string;
              def: AgentDef
              | undefined;
              inline?: undefined;
              ref: string;
          }
          | {
              agent: string;
              configPath?: undefined;
              def: AgentDef;
              inline: { save: boolean };
              ref: string;
          }
          | { code?: "bad-request"; error: string },
      >

    • Spawn and supervise one agent. The single spawn path: both the control-plane start op and declarative roster boot call this. Mints scoped creds in auth mode, resolves the agent file, launches via the connector + runtime, and records the handle. spawner is the authenticated id of the peer that requested the spawn (req.from.id), defaulting to the manager's own id for roster/pre-spawn — recorded for the spawner ledger (own-children despawn + reap-on-parent-exit).

      Parameters

      • opts: StartAgentOpts
      • Optionalspawner: string
      • Optionalhooks: SpawnHooks
      • OptionalauthenticatedCaller: EpCaller

      Returns Promise<ControlReply>

    • Spawn a teammate by persona ref (name loads .cotal/agents/<name>.md; the peer presents under that file's own name:), as if a peer asked via the control plane. Used to pre-spawn the demo's experts at startup so the manager owns them.

      Parameters

      • name: string

      Returns Promise<ControlReply>

    • Stop a seat this spawn just placed and track its exit: the stop first, so the terminalizing latch is set before anything awaits, then the exit tracking. Both are synchronous.

      Parameters

      • a: ManagedAgent
      • cause: FreeSlotCause

      Returns void

    • SeatStop.stopHandle.

      Parameters

      • ...args: [a: ManagedAgent, graceful: boolean, cause: FreeSlotCause]

      Returns string | undefined

    • SeatStop.stopWindowsSeat.

      Parameters

      • ...args: [a: ManagedAgent, graceful: boolean, floor: boolean, cause: FreeSlotStopCause]

      Returns Promise<void>

    • The seat's pull: every pending turn addressed to the CALLER's incarnation, oldest first. The uid is part of the address — a successor seat never receives a predecessor's turn.

      Parameters

      • c: { actor: string; owner: string; uid: string }

      Returns {
          notices: true;
          stop?: true;
          turns: {
              acceptedAt: number;
              deadlineAt?: number;
              goalId: string;
              once?: true;
              payload: string;
          }[];
      }

    • A managed seat or a finite authorized personal participant. Only the first carries custody.

      Parameters

      Returns
          | { agent: ManagedAgent; kind: "managed"; name: string }
          | { kind: "personal"; name: string; participant: PersonalTurnParticipant }

    • Resolve once name shows up on the mesh roster (presence registered), or after timeoutMs. Lets the pre-spawn loop stagger heavy agent cold-starts so they don't all boot at once. Best-effort, keyed on the manager-owned (auto-numbered, unique) spawn name — NOT identity resolution: a same-named unmanaged peer already present could satisfy this early. That's acceptable for cold-start staggering; it never routes anything.

      Parameters

      • name: string
      • timeoutMs: number = 30_000

      Returns Promise<boolean>

    • The once task's exit hook, on the handle the seat was launched with: whichever path ends the seat, its proved exit cancels a task that has no terminal yet and discharges the seat's debt. An exit that cannot be proved leaves both.

      Parameters

      • a: ManagedAgent

      Returns void

    • BrokerTransport.withEndpointServeExecutor.

      Type Parameters

      • T

      Parameters

      • fn: (kvs: { authKv: KV; nc: NatsConnection; recordsKv: KV }) => Promise<T>

      Returns Promise<T>

    • BrokerTransport.withLifecycleExecutor.

      Type Parameters

      • T

      Parameters

      • pin: { actor: string; alias: string; lifecycleUid: string; owner: string }
      • fn: (t: LifecycleStateTransport) => Promise<T>

      Returns Promise<T>

    • BrokerTransport.withOpenServeConnection.

      Type Parameters

      • T

      Parameters

      • fn: (kvs: { authKv: KV; nc: NatsConnection; recordsKv: KV }) => Promise<T>

      Returns Promise<T>

    • Run one retirement in a RETIREMENT_CONCURRENCY slot, oldest first: a seat's deprovision, a chat session's terminal and a static reconcile's terminal all take one. No retirement awaits another, so the bounded pool cannot deadlock.

      Type Parameters

      • T

      Parameters

      • run: () => Promise<T>

      Returns Promise<T>