import type { AssistantMessage } from "@sheason/pi-ai";
import type { AgentToolResult } from "@sheason/pi-coding-agent";
import type { HubAgentViewModel, HubViewDocumentState, HubWelcomePayload, RegisteredPeer, SessionCrdtSyncFormat } from "../../hub/index.js";
import { type ImagePayload, PeerImageCache } from "./peer-image-cache.js";
export interface PeerLiveToolExecution {
    toolCallId: string;
    toolName: string;
    args?: Record<string, unknown>;
    partialResult?: AgentToolResult<unknown>;
    result?: AgentToolResult<unknown>;
    isError?: boolean;
}
export interface PeerLiveSnapshot {
    streamingMessageId?: string;
    streamingMessageIndex?: number;
    streamingMessage?: AssistantMessage;
    toolExecutions: PeerLiveToolExecution[];
    statusMessage?: string;
}
export interface PeerAppSnapshot {
    welcome?: HubWelcomePayload;
    view?: HubViewDocumentState;
    selectedAgent?: HubAgentViewModel;
    live: PeerLiveSnapshot;
    peers: RegisteredPeer[];
}
export declare class PeerAppState {
    private welcome;
    private readonly crdt;
    private view;
    private selectedAgent;
    private crdtLive;
    private localSelectedAgent;
    private localLive;
    private readonly imageCache;
    private peers;
    private readonly listeners;
    private scheduledEmit;
    subscribe(listener: (snapshot: PeerAppSnapshot) => void): () => void;
    applyWelcome(welcome: HubWelcomePayload): void;
    resetCrdtSyncState(): void;
    /** For socket layer: collect `imageId`s referenced in payload but not cached yet. */
    collectMissingImageIds(value: unknown): string[];
    getImageCache(): PeerImageCache;
    applyImagePayload(payload: ImagePayload): void;
    applyCrdtSyncMessage(message: Uint8Array, format?: SessionCrdtSyncFormat): {
        missingImageIds: string[];
    };
    getSnapshot(): PeerAppSnapshot;
    applyLocalAgentProjection(agent: HubAgentViewModel, live: PeerLiveSnapshot): void;
    isReady(): boolean;
    private emit;
    private scheduleEmit;
    private cancelScheduledEmit;
}
//# sourceMappingURL=peer-app-state.d.ts.map