import { type NodeRow } from '../canvas/index.js'; import type { PiInvocation } from './launch.js'; /** View-side launch hints the broker host needs beyond the PiInvocation. The * broker uses `cwd` + `resuming`; `name` is carried for the node's display. */ export interface LaunchPlacement { cwd: string; name: string; resuming: boolean; } /** A handle to a node's running engine container. The broker host supervises via * the broker pid recorded as pi_pid; no tmux placement coords exist (the engine * is never in a pane). */ export interface HostHandle { /** Supervised pid (signal-0 target). Null means the host failed to spawn an * engine at all. Spawn/revive record this pid immediately; the broker * re-records the same pid during extension bind. */ pid: number | null; /** Real child-exit signal from the launch handle. Resolves when the detached * broker exits, so readiness waits can fail fast without pid probes. */ exited: Promise<{ code: number | null; signal: NodeJS.Signals | null; }>; } export interface Host { /** Bring a node's ENGINE into existence from its launch recipe; return a * supervisable handle. */ launch(nodeId: string, inv: PiInvocation, opts: LaunchPlacement): HostHandle; /** Is this node's engine alive? PURE / non-mutating. `string | NodeRow` so * both call sites — the revive guard (passes the id) and the daemon (passes a * row) — share one selector. For the broker this IS isPidAlive(pi_pid). */ isAlive(node: string | NodeRow): boolean; /** Tear the engine down (close/cancel teardown). */ teardown(nodeId: string): void; /** Deliver an OS signal to the engine container — present so the daemon never * reaches around the abstraction. */ signal(nodeId: string, sig: NodeJS.Signals): void; } /** Validate the broker launch recipe before we detach a child process. This is * the fast-fail seam for known module/path errors: a bad engine resolve or a * missing plain session path throws here, before spawn(). */ export declare function preflightBrokerLaunch(nodeId: string, inv: PiInvocation, cwd: string): void; export declare const headlessBrokerHost: Host;