import type { Answer, AskContext, Stage } from "../types.ts"; /** * What `writeBack` may be told. * * The cache VERSION is deliberately absent. It lives on the request, set once by * `createPipeline`, because the reading stage and the three writers must all use * the same number: a version set on one of them alone is read at the new number * and written at the old one, which empties the cache for good instead of once. */ export type CacheStageOptions = { ttlSeconds?: number; }; /** * A verbatim repeat of a question already answered. * * Free and instant. This is the first stage for the obvious reason: whatever the * next stage would cost, it costs nothing here. * * FIRST TURN ONLY. A follow-up depends on the conversation before it, so the * same words mean different things to two readers. Caching "shorter" would serve * one reader's shortened answer to the next reader who typed the same word about * something else entirely. * * It takes no options. This stage once took a `version`, and that is why the * check below exists rather than nothing: a caller writing plain JavaScript * still passing one would have it ignored, fall back to version "1", and serve * the very answers the bump was meant to put out of reach. */ export declare function exactCacheStage(...legacy: never[]): Stage; /** * Write a completed answer back to the cache. * * This is not a stage. Call it after a run, with what the run produced. * * Two things are never written. A follow-up, for the reason above. And an * INCOMPLETE answer: text cut off mid-sentence is worth showing to the reader * who waited for it, and would be served to everybody who asks the same question * for as long as the entry lives. */ export declare function writeBack(ctx: AskContext, answer: Answer, options?: CacheStageOptions): Promise; //# sourceMappingURL=cache.d.ts.map