/** * NATS chunk → normalized `ChatStreamEvent` decoder. * * THE live NATS reading path — the ONLY chunk parser in the codebase. Every * consumer (this lib's `useNatsChatAdapter`, the hub, the product app) feeds * raw chunks through `decodeNatsChunk` into `createChatStreamReducer`. The * legacy `components/chat/utils/chunk-parser.ts` (`parseChunkToAction`) that * this module superseded was DELETED — do not reintroduce a second decoder. * * Chunks map onto the transport-agnostic event union, with the JetStream * `streamSeq` lifted into the `seq` envelope (the reducer's idempotency gate * keys off it). * * Behavior is pinned by `__tests__/nats-decoder-golden.test.ts`. * * Server-safe: no React, no browser APIs. */ import type { AskOptionData } from '../components/chat/types/message.types'; import type { ChatStreamEvent } from './events'; /** Coerce the wire's ask `options[]` into the card's row shape. Rows without a * usable `label` are dropped: the label is what gets SENT when the row is * picked, so a blank one would post an empty reply. */ export declare function normalizeAskOptions(raw: unknown): AskOptionData[]; /** * Parse one raw NATS chunk into a normalized event. Returns `null` for * unknown/malformed chunks — an unrecognized `type`, a missing required * field, or a non-object payload are all tolerated as no-ops rather than * throwing, so a backend that adds a chunk type can't break the stream. */ export declare function decodeNatsChunk(chunk: unknown): ChatStreamEvent | null; //# sourceMappingURL=nats-decoder.d.ts.map