Cotal TypeScript packages
    Preparing search index...

    Interface Runtime

    A pluggable agent backend — pty (default) owns a real pseudo-terminal; extension runtimes can delegate to an external terminal or process surface.

    interface Runtime {
        kind: string;
        reportsStartupOutcome?: boolean;
        streamsTerminal: boolean;
        supportsRelease?: boolean;
        supportsWorkClosure?: boolean;
        adopt?(reference: RuntimeReference): AgentHandle;
        reapWork?(reference: RuntimeReference): Promise<void>;
        rebindDelegated?(
            request: DelegatedRebindRequest,
        ): Promise<DelegatedRebindResult>;
        reserve?(): RuntimeReference;
        spawn(
            name: string,
            spec: LaunchSpec,
            cwd: string,
            reference?: RuntimeReference,
        ): AgentHandle;
        spawnDelegated?(
            launch: DelegatedSeatLaunch,
            handoff: ManagedLifecycleHandoff,
        ): AgentHandle;
    }
    Index
    kind: string
    reportsStartupOutcome?: boolean

    True when every handle this runtime spawns reports AgentHandle.startupOutcome. A once spawn on a connector with Connector.onceNeedsConfirmed is refused without it.

    streamsTerminal: boolean

    Whether a handle this runtime creates can open a live AttachSession. A backend that owns the child's pseudo-terminal streams it; a backend that attaches to a process it does not own holds no stream for it, and its AgentHandle.attach throws its own guidance instead.

    REQUIRED, and a backend that streams nothing says so rather than leaving a caller to find out by catching the throw: the manager reports this to its callers, so a foreground cotal spawn on such a runtime launches the seat without attempting an attach that cannot open, and cotal attach refuses by name. Omitting it on a streaming backend would silence that terminal.

    supportsRelease?: boolean

    True only when every handle this runtime creates can release manager-local custody without stopping the underlying agent. Absent is false for PTY runtimes and irrelevant for runtimes that hold no process-owning PTY master.

    supportsWorkClosure?: boolean

    True only when every spawned handle supplies authoritative waitForWorkExit. A requested restart policy is refused before launch when absent or false. Built-in PTY does not provide descendant containment and must not declare this.

    • Reattach this runtime to a handle it created previously. This is a local runtime operation, not a mesh operation. OPTIONAL, and absent means REFUSE, never spawn a replacement: a runtime without durable custody omits it, and the caller must throw naming that runtime. A silent skip here would drop custody on the floor.

      Parameters

      Returns AgentHandle

    • Prove all local work for this durable launch reference ended before a successor manager restarts it. Requires the same ownership and closure guarantees as waitForWorkExit, including detached descendants. An absent record is unknown, never proof. Missing means restart across a manager crash is unsupported, even when ordinary seat-process reap is available.

      Parameters

      Returns Promise<void>

    • Mint the durable custody reference for a seat this runtime is ABOUT to spawn, before any process exists. The caller records it durably and then hands the SAME reference back to spawn, so the reference precedes the processes it addresses: a crash anywhere after the spawn leaves an orphan a successor can still address, never a live seat nobody can name. Minting the id inside spawn cannot give that ordering, because the processes are already running by the time it returns.

      OPTIONAL, and absent means this runtime has no durable custody to reserve; the caller spawns without a reference, as before. Such a runtime may still report a reference on the handle after the spawn and reap by it, which a successor can use once the handle exists. A runtime that implements this MUST spawn the seat under exactly the reference it returned, and report it back on the handle: a spawn that quietly mints its own id would leave the recorded reference addressing nothing, which is worse than recording none.

      Returns RuntimeReference

    • Spawn the agent. reference is a custody reference from reserve, and a runtime that offers reserve must honour it exactly; it is absent for a runtime without durable custody.

      Parameters

      Returns AgentHandle

    • Start one seat outside the manager's filesystem for an already-enrolled lifecycle. Optional; absent means the runtime cannot host a delegated seat and the manager uses spawn.

      The runtime creates one provider resource under managedRuntimeKey(handoff), writes the handoff and the persona into it as private files, and runs delegatedSeatCommand there. It calls the provider's create at most once per call and never retries a create whose answer was lost. The handle's status() is "exited" only after the provider observed the child exit, or after a fenced close by that key completed. A provider answer that no resource exists under the key is never exit evidence. A lost, timed-out or ambiguous acknowledgement leaves it "running".

      stop() is the fenced close by that key. It completes only when no create for that key can still materialize: the create was answered before the close, or the provider's close fences the key so a create that arrives later is refused. Until one of those holds, stop() keeps the close pending, status() stays "running", and waitForExit() does not settle. The handle carries no reference and no release.

      A provider that names its own resources may run the create as a durable operation keyed by that key and close through the identifier its authenticated create response returned, recorded where the host can read it without the manager. Only that response binds an identifier to the key; one derived from the key or found by name or listing is never closed or adopted.

      Parameters

      Returns AgentHandle