/**
 * Workspace-wide asset reference scan (assets-referenced-not-owned).
 *
 * Two features need the same walk: "which assets does this entry SOLELY
 * reference" (P2 delete prompt) and "how many entries reference each asset"
 * (P3 loose/unreferenced filter — the inverted index). This is the one
 * implementation of that walk; both are thin consumers.
 *
 * The walk is:
 *   - LIVE-RECONCILED (eng review D1): for an entry with an open editor doc the
 *     live Y.Doc body REPLACES the disk body (a reference just pasted blocks an
 *     offer / inflates a count; one just removed does the opposite). Disk
 *     FRONTMATTER is always scanned (it isn't editable live). Live-only docs
 *     (a fresh create still being typed, no disk file yet) are swept directly.
 *   - BUDGETED (fail-safe): a soft wall-clock cap. On overrun the walk stops and
 *     `partial` is true — the user-initiated, low-frequency scan must never
 *     stall the UI on a huge workspace, and callers must NEVER treat an
 *     unscanned asset as unreferenced (P2 offers nothing; P3 marks nothing loose).
 *   - ALL repos, even ones the caller can't read: a reference is a reference
 *     wherever it lives. Consumers reveal only an aggregate (a boolean / a
 *     count), never the referencing entry or its folder.
 */
import type { WorkspaceManager } from '../core/workspace-manager.js';
/** Soft wall-clock budget for the workspace reference scan. User-initiated and
 *  low-frequency, so a full walk is acceptable — but it must never stall the UI
 *  indefinitely on a huge workspace. Shared by every consumer so the fail-safe
 *  boundary is identical. */
export declare const DEFAULT_SCAN_BUDGET_MS = 4000;
export interface WorkspaceScanOptions {
    /** Override the scan budget (test hook / per-caller tuning). */
    budgetMs?: number;
    /** Entity key `${repo}/${entityType}/${entityId}` to skip — e.g. the entry
     *  being deleted, whose own references must not count as "elsewhere". */
    skipKey?: string;
    /** Optional early-exit, checked after each visited entry: returning true
     *  stops the walk WITHOUT marking it partial (the caller has all it needs,
     *  e.g. every target asset already proven shared). */
    stopWhen?: () => boolean;
}
export interface WorkspaceScanResult {
    /** True when the walk hit its budget before covering the workspace. Callers
     *  must fail safe: never treat an asset unseen by a partial scan as
     *  unreferenced. */
    partial: boolean;
}
/**
 * Walk every entry in every repo (live-reconciled, budgeted) and hand the
 * `visit` callback the set of immutable assetIds each entry references. The
 * callback owns what to do with them (intersect a target set, accumulate a
 * count, …). `visit` is never called for the `skipKey` entry.
 */
export declare function scanWorkspaceAssetReferences(wm: WorkspaceManager, visit: (assetIds: Set<string>, entry: {
    repo: string;
    entityType: string;
    entityId: string;
    key: string;
}) => void, opts?: WorkspaceScanOptions): Promise<WorkspaceScanResult>;
