import type { TaskRunner } from "../../contracts/orchestration.js";
import type { InitializeParams, PromptResult, SteerResult, SetPlanModeResult, CancelResult, ReplayResult, WireHookSubscription, WireEvent, WireRequest, ApprovalRequest, ToolCallRequest, QuestionRequest, HookRequest, ContentPart, ServerInfo, SlashCommandInfo, ServerCapabilities, ExternalToolsResult, HooksInfo } from "./wire-protocol-types.js";
export type { JsonRpcRequest, JsonRpcResponse, } from "./wire-protocol-types.js";
/** Backward-compatible generic wire event (deprecated — use WireEvent instead) */
export type LegacyWireEvent = {
    type: "status";
    contextUsage: number;
    maxContextTokens: number;
    tokenUsage: number;
    planMode: boolean;
} | {
    type: "message";
    role: "assistant" | "user";
    content: string;
} | {
    type: "tool_use";
    name: string;
    input: unknown;
} | {
    type: "tool_result";
    name: string;
    output: unknown;
} | {
    type: "error";
    message: string;
} | {
    type: "request";
    method: string;
    params: unknown;
    respond: (result: unknown) => void;
    reject: (error: {
        code: number;
        message: string;
    }) => void;
};
/** Kimi wire client options */
export interface KimiWireClientOptions {
    agentFile?: string;
    configFile?: string;
    mcpConfigFile?: string;
    cwd?: string;
    env?: NodeJS.ProcessEnv;
    /** Hook subscriptions to declare during initialize */
    hooks?: WireHookSubscription[];
    /** Resume previous session */
    continue?: boolean;
    /** Specific session ID */
    session?: string;
    /** Model to use */
    model?: string;
    /** YOLO mode (skip approvals) */
    yolo?: boolean;
}
/** Handler for a specific request type from the agent */
export type ApprovalRequestHandler = (request: ApprovalRequest, respond: (response: {
    request_id: string;
    response: "approve" | "approve_for_session" | "reject";
    feedback?: string;
}) => void, reject: (error: {
    code: number;
    message: string;
}) => void) => void;
export type ToolCallRequestHandler = (request: ToolCallRequest, respond: (result: {
    tool_call_id: string;
    return_value: {
        is_error: boolean;
        output: string | ContentPart[];
        message: string;
        display: unknown[];
    };
}) => void, reject: (error: {
    code: number;
    message: string;
}) => void) => void;
export type QuestionRequestHandler = (request: QuestionRequest, respond: (response: {
    request_id: string;
    answers: Record<string, string>;
}) => void, reject: (error: {
    code: number;
    message: string;
}) => void) => void;
export type HookRequestHandler = (request: HookRequest, respond: (response: {
    request_id: string;
    action: "allow" | "block";
    reason: string;
}) => void, reject: (error: {
    code: number;
    message: string;
}) => void) => void;
export declare class KimiWireClient {
    private options;
    private proc?;
    private rl?;
    private pending;
    private eventHandlers;
    private legacyEventHandlers;
    private approvalHandlers;
    private toolCallHandlers;
    private questionHandlers;
    private hookHandlers;
    private genericRequestHandlers;
    private static readonly MAX_PENDING_RPCS;
    private _initializeResult?;
    constructor(options?: KimiWireClientOptions);
    get serverInfo(): ServerInfo | undefined;
    get slashCommands(): SlashCommandInfo[] | undefined;
    get serverCapabilities(): ServerCapabilities | undefined;
    get registeredTools(): ExternalToolsResult | undefined;
    get hooksInfo(): HooksInfo | undefined;
    /** Register a strongly-typed event handler */
    onEvent(handler: (event: WireEvent) => void): () => void;
    /** @deprecated Use onEvent with WireEvent instead */
    onLegacyEvent(handler: (event: LegacyWireEvent) => void): () => void;
    private emitEvent;
    private emitLegacyEvent;
    onApprovalRequest(handler: ApprovalRequestHandler): () => void;
    onToolCallRequest(handler: ToolCallRequestHandler): () => void;
    onQuestionRequest(handler: QuestionRequestHandler): () => void;
    onHookRequest(handler: HookRequestHandler): () => void;
    /** Generic fallback request handler for unhandled request types */
    onRequest(handler: (request: WireRequest, respond: (result: unknown) => void, reject: (error: {
        code: number;
        message: string;
    }) => void) => void): () => void;
    start(): Promise<void>;
    private call;
    private handleServerMessage;
    private dispatchEvent;
    private dispatchRequest;
    prompt(userInput: string | ContentPart[]): Promise<PromptResult>;
    steer(userInput: string | ContentPart[]): Promise<SteerResult>;
    cancel(): Promise<CancelResult>;
    replay(): Promise<ReplayResult>;
    setPlanMode(enabled: boolean): Promise<SetPlanModeResult>;
    stop(): Promise<void>;
}
/** @deprecated Use PromptResult instead */
export type KimiPromptResult = PromptResult;
/** @deprecated Use InitializeParams instead */
export type KimiInitializeParams = InitializeParams;
export * from "./wire-protocol-types.js";
export declare function createKimiTaskRunner(client: KimiWireClient): TaskRunner;
