/** Pure protocol + request lifecycle for lazy folder-tree providers. */ export type TreeVersion = string | number; export type TreeListingStatus = "unknown" | "partial" | "complete"; export interface TreeProviderEntry { name: string; kind: "file" | "directory"; size?: number; path?: string; } export interface TreeListOptions { cursor?: string; limit?: number; /** Every request is abortable; providers must observe this signal. */ signal: AbortSignal; } export interface TreeListPage { entries: readonly TreeProviderEntry[]; cursor?: string; complete: boolean; /** Opaque, path-local snapshot token. No global ordering is required. */ version: TreeVersion; } export interface TreeStat { kind: "file" | "directory"; size?: number; version?: TreeVersion; } export interface TreeWatchEvent { path: string; version?: TreeVersion; } export interface TreeProvider { list(path: string, options: TreeListOptions): Promise; stat?(path: string, options: { signal: AbortSignal; }): Promise; read?(path: string, options: { signal: AbortSignal; }): Promise; /** Invalidation ping only. Consumers re-list; watch payloads are not mutations. */ watch?(path: string, onInvalidate: (event: TreeWatchEvent) => void): () => void; } export interface TreeListingSnapshot { path: string; status: TreeListingStatus; /** complete + [] means known-empty; unknown + [] means not listed. */ entries: readonly TreeProviderEntry[]; cursor?: string; version?: TreeVersion; generation: number; loading: boolean; error?: unknown; /** True after pagination snapshot drift; the next load restarts at page one. */ restartRequired: boolean; } export interface TreeLoadOptions { signal: AbortSignal; limit?: number; } /** * Per-path listing state machine. It owns request deduplication, generation * guards, aborts, cursor merging, and watch invalidation. Retry timing and * backoff remain host-adapter policy. */ export declare class TreeListingStore { readonly provider: TreeProvider; private readonly onChange; private readonly states; constructor(provider: TreeProvider, onChange?: (snapshot: TreeListingSnapshot) => void); snapshot(path: string): TreeListingSnapshot; /** Load exactly one page. Concurrent calls for a path share one promise. */ load(path: string, options: TreeLoadOptions): Promise; /** Abort and forget a path's listing. Stale completions cannot repopulate it. */ invalidate(path: string, version?: TreeVersion): TreeListingSnapshot; abort(path: string): void; /** Attach provider invalidations. The callback resets state; it never mutates entries. */ watch(path: string): () => void; dispose(): void; private state; private resetListing; private emit; } //# sourceMappingURL=treeprovider.d.ts.map