import type { UnderstandingSourceGrant, UnderstandingSourceItem, UnderstandingSourceRun } from './types.js'; export type RefreshProgress = { status: UnderstandingSourceRun['status']; phase: 'queued' | 'waiting_desktop' | 'reading' | 'analyzing' | 'completed'; added?: number; updated?: number; itemsSeen?: number; error?: string; }; export type RefreshSourceRun = UnderstandingSourceRun & { adapterId: string; displayName: string; }; export type RefreshBatch = { id: string; status: 'running' | 'completed' | 'partial' | 'failed'; sources: RefreshSourceRun[]; createdAt: number; }; export interface UnderstandingRefreshDeps { enabled(): boolean; start(grant: UnderstandingSourceGrant, runId: string): Promise>; progress(run: UnderstandingSourceRun): RefreshProgress | undefined; analyzeDesktop(grant: UnderstandingSourceGrant, items: UnderstandingSourceItem[], signal: AbortSignal): Promise<{ added?: number; updated?: number; }>; emit?(type: string, payload: unknown): void; } /** Coordinates existing source executors; the source run remains the authority for progress. */ export declare class UnderstandingRefreshService { private readonly deps; private readonly owner; private readonly starting; private readonly analyzing; constructor(deps: UnderstandingRefreshDeps); start(sourceIds?: string[]): RefreshBatch; sources(): RefreshSourceRun[]; latest(): RefreshBatch | null; get(id: string): RefreshBatch | null; private update; private reconcile; private dispatch; submitDesktop(runId: string, input: { items: UnderstandingSourceItem[]; error?: string; }): void; }