/**
 * Cross-Memory Socket Bridge (Phase 6)
 *
 * Bidirectional TCP bridge between editors (Cursor, VSCode, etc.) and the
 * Fivo Cell daemon. Editors send events (file_focus, cursor_move, AI prompt,
 * AI response, terminal commands, etc.) and the bridge stores them in the
 * shared event DB. Other tools can read the timeline via the existing
 * `replay` engine.
 *
 * Protocol: newline-delimited JSON.
 *   client → server:  { type: "event", project, event: {...} }
 *   client → server:  { type: "ping" }
 *   server → client:  { type: "ack", id }
 *   server → client:  { type: "pong" }
 *   server → client:  { type: "event", event: {...} }   // broadcast
 *   server → client:  { type: "error", message }
 */
export interface BridgeEventMessage {
    type: 'event';
    project: string;
    event: {
        eventType: string;
        filePath?: string;
        line?: number;
        column?: number;
        command?: string;
        exitCode?: number;
        durationMs?: number;
        success?: boolean;
        toolName?: string;
        taskType?: string;
        branch?: string;
        message?: string;
        commitHash?: string;
        errorMessage?: string;
        errorStack?: string;
        testFile?: string;
        testName?: string;
        sessionId?: number;
        metadata?: Record<string, unknown>;
    };
}
export interface BridgePingMessage {
    type: 'ping';
}
export type BridgeClientMessage = BridgeEventMessage | BridgePingMessage | {
    type: string;
    [k: string]: unknown;
};
export interface BridgeAckMessage {
    type: 'ack';
    id: number;
}
export interface BridgePongMessage {
    type: 'pong';
    uptimeSeconds: number;
}
export interface BridgeErrorMessage {
    type: 'error';
    message: string;
}
export interface BridgeBroadcastEvent {
    type: 'event';
    project: string;
    event: unknown;
}
export interface BridgeEditorState {
    editorName: string;
    editorVersion?: string;
    filePath: string;
    line: number;
    column: number;
    unsavedBuffer?: string;
    unsavedLength?: number;
    isDirty: boolean;
    project: string;
    language?: string;
    selectionLength?: number;
    timestamp: string;
}
export interface BridgeEditorStateMessage {
    type: 'editor_state';
    state: BridgeEditorState;
}
export interface BridgeEditorStateQueryMessage {
    type: 'editor_state_query';
    project?: string;
}
export interface BridgeEditorStateResponseMessage {
    type: 'editor_state_response';
    states: BridgeEditorState[];
}
export interface BridgeEditorStateClearedMessage {
    type: 'editor_state_cleared';
    clientId: number;
}
export type BridgeServerMessage = BridgeAckMessage | BridgePongMessage | BridgeErrorMessage | BridgeBroadcastEvent | BridgeEditorStateResponseMessage | BridgeEditorStateClearedMessage;
export interface BridgeClientInfo {
    id: number;
    remoteAddress: string;
    remotePort: number;
    project: string;
    connectedAt: string;
    eventsReceived: number;
}
export interface BridgeServerInfo {
    running: boolean;
    port: number;
    host: string;
    startedAt: string | null;
    clientCount: number;
    totalEventsReceived: number;
    clients: BridgeClientInfo[];
    editorStates: BridgeEditorState[];
}
export declare function getDefaultPort(): number;
export declare function setDefaultPort(p: number): void;
/**
 * Discover the port of a running bridge by reading the pid file.
 * Returns null if no pid file exists, or the recorded port if it does.
 * Callers can use this as a default when --port is not specified.
 */
export declare function discoverBridgePort(): number | null;
export declare function getEditorStates(project?: string): BridgeEditorState[];
export declare function getEditorState(project: string): BridgeEditorState | null;
export declare function clearAllEditorStates(): void;
export declare function startBridge(port?: number, host?: string): Promise<BridgeServerInfo>;
export declare function stopBridge(): boolean;
export declare function isBridgeRunning(): boolean;
export declare function getBridgeInfo(): BridgeServerInfo;
export declare function isPortInUse(port: number, host?: string): Promise<boolean>;
export declare function killStaleBridge(): boolean;
export interface BridgeQueryResult {
    connected: boolean;
    states: BridgeEditorState[];
    error?: string;
}
export declare function queryBridgeEditorStates(project?: string, port?: number, host?: string, timeoutMs?: number): Promise<BridgeQueryResult>;
//# sourceMappingURL=socket-bridge.d.ts.map