import { type SubjectFields } from './hash.js'; /** `adopts`: the local id of a subject a deploy settled with no vendor id, which this observation is (refresh's * adoption, architecture "Refresh"): the observation lands as that subject's alias, and the local one stands. */ export type ObservedResource = { type: string; id: string; fields: SubjectFields; deleted?: boolean; adopts?: string; }; export type ObserveReport = { observed: number; appended: number; unchanged: number; removed: number; }; export type Observation = { service: string; root?: string; } & ({ resource: ObservedResource; } | { resources: ObservedResource[]; complete?: Completed[]; }); /** Run `fn` with every `observeResource` inside it COLLECTED instead of folded; the caller folds the * batch (`observeResources`) once `fn` returns. The kernel's refresh does this around an adapter. */ export declare function collectObservations(fn: () => Promise): Promise<{ value: T; observations: Observation[]; }>; /** A type a batch listed in full: all of it, or (a type under a parent) the subjects whose `field` names one of the * parents listed `within`. */ export type Completed = string | { type: string; field: string; within: string[]; } | { type: string; ids: string[]; }; /** Fold a collected batch: one `observeResources` per service, `complete` applied to each. */ export declare function foldObservations(observations: Observation[], opts?: { root?: string; at?: string; complete?: Completed[]; batch?: string; }): ObserveReport; /** One observed resource: collected when a refresh scope is open, else folded onto the root's log now. */ export declare function observeResource(service: string, resource: ObservedResource, opts?: { root?: string; at?: string; }): ObserveReport; /** The fold: diff each resource against upstream state, append what changed to the root's log. `complete` * names the types this batch listed in full (or in full under the parents it names) — a subject of such a type the * batch does not hold is tombstoned. Entry ids are content-addressed, so the same observation folds once. */ export declare function observeResources(service: string, resources: ObservedResource[], opts?: { root?: string; at?: string; complete?: Completed[]; batch?: string; }): ObserveReport;