/**
 * CollabManager — orchestrates the full collaboration lifecycle.
 *
 * Pure app-layer class with no shell/TUI dependencies. Manages:
 * - CollabClient connection and room lifecycle
 * - CollabSync (CRDT workbook sync)
 * - CollabAwareness (peer sheet info broadcasting)
 * - Display name resolution
 *
 * Used by the interactive shell (/collab command), RPC mode, and tests.
 */
import type { SheetEnginePool } from '../new-sheet/sheet-engine.js';
import { CollabAwareness } from './awareness.js';
import { CollabClient, type JoinResult } from './collab-client.js';
import { CollabSync } from './collab-sync.js';
import type { PeerInfo } from './types.js';
export interface CollabStatus {
    connected: boolean;
    roomId: string | null;
    peerId: string | null;
    peers: PeerInfo[];
}
/** Abstraction for display name resolution — tests inject a simple string. */
export interface DisplayNameProvider {
    getOrCreate(): {
        name: string;
        isNew: boolean;
    };
    set(name: string): void;
    get(): string | undefined;
}
/** Persists display name to `<agentDir>/collab.json`. */
export declare class FileDisplayNameProvider implements DisplayNameProvider {
    private agentDir;
    constructor(agentDir: string);
    getOrCreate(): {
        name: string;
        isNew: boolean;
    };
    set(name: string): void;
    get(): string | undefined;
    private configPath;
    private load;
    private save;
}
/** Simple in-memory provider for tests. */
export declare class StaticDisplayNameProvider implements DisplayNameProvider {
    private name;
    constructor(name: string);
    getOrCreate(): {
        name: string;
        isNew: boolean;
    };
    set(name: string): void;
    get(): string | undefined;
}
export declare class CollabManager {
    private serverUrl;
    private pool;
    private displayNameProvider;
    private _client;
    private _sync;
    private _awareness;
    constructor(serverUrl: string, pool: SheetEnginePool, displayNameProvider: DisplayNameProvider);
    /** The underlying CollabClient (for event wiring by modes). */
    get client(): CollabClient;
    get sync(): CollabSync | null;
    get awareness(): CollabAwareness | null;
    /** Create a new room and auto-join it. Returns the join result. */
    createRoom(displayName?: string): Promise<JoinResult>;
    /** Join an existing room by ID. Returns the join result. */
    joinRoom(roomId: string, displayName?: string): Promise<JoinResult>;
    /** Leave the current room and clean up sync/awareness. */
    leave(): void;
    /** Current collab status. */
    getStatus(): CollabStatus;
    /** Whether we're currently in a room. */
    get inRoom(): boolean;
    getDisplayName(): {
        name: string;
        isNew: boolean;
    };
    setDisplayName(name: string): void;
    currentDisplayName(): string | undefined;
    destroy(): void;
    private attachSync;
    private detachSync;
    private attachAwareness;
    private detachAwareness;
}
//# sourceMappingURL=collab-manager.d.ts.map