/** * Phrase-path rendering helper for the prose pipeline (ADR-192 §6, the cutover). * * Bridges a handler's `(messageId, params, blockKey)` to the language provider's * `renderMessage` phrase pipeline, building the per-message `RenderContext` from * the per-turn factory and re-keying the realized blocks to the handler's * channel. The legacy `getMessage` string path remains in the handlers only as a * fallback for world-less construction (some unit tests); it is removed in W7 * once nothing constructs the pipeline without a world. * * Public interface: `phraseAvailable`, `renderViaPhrase`. * * Owner context: `@sharpee/engine` — internal prose pipeline. * * @see ADR-192 §6 */ import type { ITextBlock } from '@sharpee/text-blocks'; import type { HandlerContext } from './handlers/types'; /** * Whether the phrase path is wired for this turn: a render-context factory (the * pipeline had a world) and a provider that implements the phrase API. * * @param context the handler context * @returns true when `renderViaPhrase` can be used */ export declare function phraseAvailable(context: HandlerContext): boolean; /** * Render a message through the phrase pipeline and re-key its blocks. * * Precondition: {@link phraseAvailable} is true. * * @param context the handler context (carries the render-context factory) * @param messageId the message id to render * @param params the message params (entity NounPhrases, scalars, …). The reserved * key `__slots__` (a `{ [slotKey]: Phrase[] }` map) is not a placeholder binding: * its phrases are staged into this message's turn slot store before realization, * so an action that knows its target (e.g. examine staging detail clauses) can * fill a `{slot:key}` in its own template without holding a render context at * report time (ADR-195 S2). Plain phrase data — save/replay-safe. * @param blockKey the channel key to stamp on the realized blocks * @returns the realized blocks re-keyed to `blockKey`, or `null` when the message * id is not registered (the caller applies its inline-text fallback) */ export declare function renderViaPhrase(context: HandlerContext, messageId: string, params: Record, blockKey: string): ITextBlock[] | null; /** * Flatten realized blocks to a single plain string (newlines between blocks). * Used when a rendered message must be embedded into another message as a * `{verbatim:…}` scalar param. * * @param blocks realized text blocks * @returns the concatenated plain text */ export declare function flattenBlocks(blocks: ITextBlock[]): string; //# sourceMappingURL=phrase-render.d.ts.map