/** * Client half of the snapshot digest: ask the Host to describe the record the * card is showing, and report what came back. * * The request carries the contributions the card already displays rather than a * session identity, so the Host needs no session lookup and answers the same * record identically wherever it appears. Every outcome is a state the card can * draw: no channel, in flight, ready, or unavailable. * * @module dsh-context-snapshot-bar/client/summary */ import type { SnapshotSummaryRequest, SnapshotSummaryResponse } from '../shared/types.ts'; /** The slice of the Client Connection service this card uses. */ export type SummaryCaller = (channel: string, endpoint: string, payload: unknown, signal?: AbortSignal) => Promise; /** Why the Host could not answer a digest request. */ export type SummaryUnavailableReason = Extract['reason']; /** What the card knows about the digest for the record it is showing. */ export type SummaryState = { readonly status: 'idle'; } | { readonly status: 'loading'; } | { readonly status: 'ready'; readonly text: string; readonly model: string; } | { readonly status: 'unavailable'; readonly reason: SummaryUnavailableReason; readonly detail?: string; }; /** * Follow one snapshot record's digest. * * The caller arrives through a getter because the Client's connection service * activates asynchronously: the card mounts before it is there, so the hook * re-checks for a bounded time. Both the getter and the request are read through * refs and the effect depends only on the record's identity, because a caller * that rebuilt either value on every render would otherwise re-run the effect * forever. A Client without a digest channel leaves the digest `idle`, and the * card then omits the section rather than showing it empty. * * @param getCaller - reads the current Connection caller, if any. * @param request - the record to describe, or null when the card shows none. * @returns the digest state for the current request. */ export declare function useSnapshotSummary(getCaller: (() => SummaryCaller | undefined) | undefined, request: SnapshotSummaryRequest | null): SummaryState; //# sourceMappingURL=summary.d.ts.map