Sanity Library Reference Docs
    Preparing search index...

    Function parseStreamLine

    • Parses a single SSE line from the AI SDK v6 UI Message Stream protocol. Returns null if the line cannot be parsed or should be ignored.

      Format: data: <json>\n

      Supported types: text-start – Text block start (forwarded as-is) text-delta – Text chunk text-end – Text block end (forwarded as-is) tool-input-available – Tool call (client tools only, without providerExecuted) tool-output-available – Tool result (informational, skipped) finish – Finish event with reason error – Error event start – Stream start (skipped) [DONE] – Stream termination (skipped)

      Parameters

      • line: string

        A single line from the SSE byte stream.

      • textContentId: string

        Fallback ID for text parts that lack an explicit id.

      Returns ParsedStreamLine | null