export interface ToolStreamEvent {
    toolCallId: string;
    name: string;
    phase: string;
    args?: unknown;
    result?: unknown;
    partialResult?: unknown;
}
export interface ChatDeltaEvent {
    runId: string;
    sessionKey: string;
    state: 'delta' | 'final' | 'aborted' | 'error';
    message?: unknown;
    errorMessage?: string;
}
export type SessionEventCallback = (type: 'chat' | 'tool' | 'connected' | 'disconnected' | 'error', data: unknown) => void;
declare class OpenClawSessionService {
    private ws;
    private pending;
    private gatewayUrl;
    private gatewayToken;
    private sessionKey;
    private connected;
    private connectNonce;
    private reconnectTimer;
    private backoffMs;
    private listeners;
    private closing;
    /** Configure and connect to the OpenClaw gateway WebSocket. */
    connect(opts: {
        gatewayUrl: string;
        token: string;
        sessionKey?: string;
    }): void;
    /** Disconnect from the gateway. */
    disconnect(): void;
    /** Subscribe to session events (chat deltas, tool calls, etc.). */
    subscribe(cb: SessionEventCallback): () => void;
    /** Send a chat message into the agent session. Returns the runId. */
    sendMessage(message: string, sessionKey?: string): Promise<{
        runId: string;
        status: string;
    }>;
    /** Abort the current run. */
    abort(sessionKey?: string, runId?: string): Promise<void>;
    /** Fetch chat history. */
    history(sessionKey?: string, limit?: number): Promise<{
        messages: unknown[];
    }>;
    get isConnected(): boolean;
    private doConnect;
    private scheduleReconnect;
    private handleMessage;
    private handleEvent;
    private sendConnect;
    private request;
    private flushPending;
    private emit;
}
export declare function extractTextFromMessage(message: unknown): string | null;
declare const openclawSessionService: OpenClawSessionService;
export default openclawSessionService;
//# sourceMappingURL=openclawSessionService.d.ts.map