import { PoolJson, PoolBallWithBuoyancy } from './types';
export declare function readPool(poolDir: string): PoolJson | null;
export declare function writePool(poolDir: string, pool: PoolJson): void;
export declare function readBallContent(poolDir: string, ballId: string): string | null;
export declare function writeBallContent(poolDir: string, ballId: string, content: string): void;
export declare function enrichBallsWithBuoyancy(pool: PoolJson): PoolBallWithBuoyancy[];
export declare function generateSnapshot(pool: PoolJson): string;
/**
 * Estimate token count from text content (rough: ~4 chars per token for mixed CJK/EN).
 */
export declare function estimateTokens(text: string): number;
export interface SurfaceBall {
    id: string;
    type: string;
    summary: string;
    buoyancy: number;
    diameter: number;
    links: string[];
}
/**
 * Build surface.md — the set of top-buoyancy balls whose total token diameter
 * fits within the wedge top width (surface_width). Writes surface.md to poolDir.
 * MUST be called within withPoolLock when pool.json may be concurrently modified.
 */
export declare function buildSurface(poolDir: string): {
    surfaceBalls: SurfaceBall[];
    totalTokens: number;
};
/**
 * Compute and cache the diameter (token estimate) for a ball.
 */
export declare function computeDiameter(poolDir: string, ballId: string): number;
/**
 * Tick the pool: increment t with session-based dedup.
 * Returns { t, deduplicated } or null if pool not found.
 * MUST be called within withPoolLock to prevent concurrent read-modify-write races.
 */
export declare function tickPool(poolDir: string, session?: string): {
    t: number;
    deduplicated: boolean;
} | null;
/**
 * Migrate from v1 (state.json + index.json + frontmatter balls) to v2 (pool.json + pure content balls).
 * Idempotent: if pool.json already exists with version >= 2, returns empty changes.
 */
export declare function migrateV1toV2(poolDir: string): {
    changes: string[];
};
/**
 * Check if pool directory uses v1 format (has state.json but no pool.json).
 */
export declare function needsUpgrade(poolDir: string): boolean;
/**
 * Check if pool is initialized (either v1 or v2 format).
 */
export declare function isInitialized(poolDir: string): boolean;
//# sourceMappingURL=pool-manager.d.ts.map