import type { AcpTransport } from "./transport.ts"; /** A handler for an inbound agent→client request; its resolved value is the result. */ export type AcpRequestHandler = (params: unknown) => unknown | Promise; /** A handler for an inbound agent→client notification (no response). */ export type AcpNotificationHandler = (params: unknown) => void; /** A JSON-RPC error returned by, or raised toward, the peer. */ export declare class AcpRpcError extends Error { readonly code: number; readonly data: unknown; constructor(code: number, message: string, data?: unknown); } export declare class AcpConnection { #private; constructor(transport: AcpTransport); /** Send a request and resolve with its `result` (or reject with its `error`). */ request(method: string, params?: unknown): Promise; /** Send a fire-and-forget notification (no id, no response). */ notify(method: string, params?: unknown): void; /** Register the handler for an inbound notification `method` (last wins). */ onNotification(method: string, handler: AcpNotificationHandler): void; /** Register the handler for an inbound request `method` (last wins). */ onRequest(method: string, handler: AcpRequestHandler): void; /** Close the connection, rejecting every in-flight request. */ close(): void; }