import type { NapiNode } from '@vibecook/truffle'; /** A device-owned slice of data. */ export interface Slice { deviceId: string; data: T; version: number; updatedAt: number; } /** Events emitted by the synced store. */ export type StoreEvent = { type: 'local_changed'; data: T; } | { type: 'peer_updated'; deviceId: string; data: T; version: number; } | { type: 'peer_removed'; deviceId: string; }; export interface UseSyncedStoreResult { /** This device's current data, or null if not yet set. */ localData: T | null; /** All device slices (local + remote), keyed by device ID. */ allSlices: Map>; /** List of device IDs with data in this store. */ deviceIds: string[]; /** Current local version number. */ version: number; /** Update this device's data (broadcasts automatically). */ set: (data: T) => Promise; } /** * React hook for a Truffle synced store. * * Provides reactive access to the native RFC 016 synced-store implementation, * including current snapshots, peer removal, and automatic peer synchronization. * * @example * ```tsx * const { localData, allSlices, set } = useSyncedStore(node, 'app-state'); * * // Update local state (broadcasts to all peers) * set({ activeProject: 'truffle', status: 'coding' }); * * // Read all peers' state * for (const [deviceId, slice] of allSlices) { * console.log(`${deviceId}: ${slice.data.activeProject}`); * } * ``` */ export declare function useSyncedStore(node: NapiNode | null, storeId: string): UseSyncedStoreResult; //# sourceMappingURL=use-synced-store.d.ts.map