import type { AgentToolResult } from "@lpb-work/pi-agent-core"; import type { ExtensionContext } from "@lpb-work/pi-coding-agent"; import type { SubagentParamsLike } from "../runs/foreground/subagent-executor.ts"; import { type Details, type SubagentState } from "../shared/types.ts"; export declare const SUBAGENT_RPC_PROTOCOL_VERSION = 1; export declare const SUBAGENT_RPC_REQUEST_EVENT = "subagents:rpc:v1:request"; export declare const SUBAGENT_RPC_READY_EVENT = "subagents:rpc:v1:ready"; export declare const SUBAGENT_RPC_REPLY_EVENT_PREFIX = "subagents:rpc:v1:reply:"; export declare const SUBAGENT_RPC_METHODS: readonly ["ping", "status", "spawn", "steer", "interrupt", "stop", "resume"]; export type SubagentRpcMethod = (typeof SUBAGENT_RPC_METHODS)[number]; export interface SubagentRpcRequestEnvelope { version: typeof SUBAGENT_RPC_PROTOCOL_VERSION; requestId: string; method: SubagentRpcMethod; params?: unknown; source?: { extension?: string; [key: string]: unknown; }; } export type SubagentRpcReplyEnvelope = { version: typeof SUBAGENT_RPC_PROTOCOL_VERSION; requestId: string; method?: SubagentRpcMethod; success: true; data: T; } | { version: typeof SUBAGENT_RPC_PROTOCOL_VERSION; requestId: string; method?: SubagentRpcMethod; success: false; error: { code: SubagentRpcErrorCode; message: string; }; }; type SubagentRpcErrorCode = "invalid_request" | "invalid_params" | "unsupported_version" | "unsupported_method" | "no_active_session" | "execution_failed" | "not_found" | "invalid_state"; interface EventBus { on(event: string, handler: (data: unknown) => void): (() => void) | undefined; emit(event: string, data: unknown): void; } export interface SubagentRpcFleetEntry { /** Opaque key for client-side reconciliation; never a run or async identifier. */ key: string; /** Resolved child agent/role name. */ agent: string; role?: string; model?: string; effort?: string; startedAt: number; tokens: { input: number; output: number; total: number; }; goal?: string; } export interface SubagentRpcFleetStatus { version: 1; entries: SubagentRpcFleetEntry[]; /** Total active children before the bounded entries window. */ totalActive: number; omitted: number; } interface RegisterSubagentRpcBridgeOptions { events: EventBus; getContext: () => ExtensionContext | null; execute: (id: string, params: SubagentParamsLike, signal: AbortSignal, onUpdate: ((result: AgentToolResult
) => void) | undefined, ctx: ExtensionContext) => Promise>; asyncDirRoot?: string; resultsDir?: string; kill?: (pid: number, signal?: NodeJS.Signals | 0) => boolean; now?: () => number; /** Native live state, projected into the optional public fleet-status capability. */ state?: SubagentState; } export declare function subagentRpcReplyEvent(requestId: string): string; export declare function registerSubagentRpcBridge(options: RegisterSubagentRpcBridgeOptions): { emitReady: (ctx?: ExtensionContext | null) => void; dispose: () => void; }; export {}; //# sourceMappingURL=rpc.d.ts.map