import type { Readable, Writable } from "node:stream"; import type { AgentSession, CommandDefinition, CommandDrivers, InstructionInjector } from "./contracts.js"; import type { ContributionRegistry } from "./contributions.js"; export type RpcCommandName = "prompt" | "steer" | "followUp" | "abort" | "state" | "messages" | "setModel" | "compact" | "switchSession" | "forkSession" | "cloneSession" | "checkout" | "command"; export interface RpcRequest { readonly id: string | number; readonly command: RpcCommandName; readonly params?: Record; } export interface RpcSessionFactory { createSession(id?: string): AgentSession | Promise; readonly commands?: readonly CommandDefinition[]; /** Host-opt-in driver capabilities forwarded to contributed commands on the * `command` execution context. Absent ⇒ context shape unchanged. */ readonly drivers?: CommandDrivers; /** Optional registry for resolving `instructionInjectors` names in `prompt`/`followUp` * params (Phase 30). Names resolve fail-closed. */ readonly instructionInjectors?: ContributionRegistry; } export interface RpcServerOptions extends RpcSessionFactory { readonly stdin: Readable; readonly stdout: Writable; } export declare function runRpcServer(options: RpcServerOptions): Promise; export declare function parseRpcRequest(value: unknown): RpcRequest;