/** * Session-scoped observation of Harness projection snapshots. * * The registry remains the state authority: change notifications only coalesce * a later redraw, and every consumer reads its value from `snapshot(session)`. * @module dshline/projections/observer */ import type { Session } from '@deepseek-ai/dsh-session'; import type { ProjectionSnapshot, SessionProjectionMap, SessionProjectionRegistry } from '@deepseek-ai/dsh-session-projection'; /** One registered client-visible projection unit, by name. */ export type ProjectionKey = Extract; /** Inputs the shared session-projection observer needs from the runner. */ export interface SessionProjectionObserverSpec { /** Optional Harness registry; custom profiles may omit the entire seam. */ readonly registry: SessionProjectionRegistry | undefined; /** Exact session instance whose views this observer serves. */ readonly session: Session; /** Request a live-region redraw after the registry's synchronous drive settles. */ readonly invalidate: () => void; } /** * Observe one exact session's optional Harness projection registry. * * The registry calls listeners once for every changing unit while it drives one * event. Deferring one invalidation to a microtask prevents a view render from * synchronously re-entering that drive and makes several unit changes one redraw. */ export declare class SessionProjectionObserver { private readonly spec; private alive; private pending; private readonly unsubscribe; /** * @param spec - optional registry, exact session identity, and redraw request. */ constructor(spec: SessionProjectionObserverSpec); /** Whether this profile mounted the generic projection infrastructure. */ get available(): boolean; /** * Read the registry's authoritative current cut for this exact session. * * `keys` narrows which client-visible VIEWS are produced and validated, which * is the whole cost of an unkeyed read on a line redrawn by every spinner beat: * every unit a profile has registered is folded, viewed, and passed through its * own `viewSchema` on the way out, whether or not this caller reads a field of * it. Naming the units a consumer actually reads therefore buys nothing in * authority — the cut is the registry's, state materialization still covers * every unit, and the same `asOfSeq` position — while leaving the units nobody * reads unviewed. * @param keys - the units this consumer reads, or every unit when omitted. * @returns the snapshot, or undefined when the optional registry is absent. */ snapshot(keys?: readonly ProjectionKey[]): ProjectionSnapshot | undefined; /** Stop observing and suppress an already-queued redraw. */ dispose(): void; } //# sourceMappingURL=observer.d.ts.map