CoAgent8 - Source API
    Preparing search index...

    Unified Stream Reducer Standardizes response assembly, terminal answer replacement, tool tracking, and strict memory bounds across provider adapters. Line framing belongs to createLineDecoder in execution/stream.

    Index
    maxMessageBytes: number
    maxMessages: number
    maxTools: number
    maxTotalBytes: number
    • Formats the consolidated output for terminal reporting.

      Returns string

      The backend's own text, or an empty string when it produced none: a placeholder here would read as an answer beside a failure the adapter reports.

    • Records tool state transition with bound protection. Returns true if transition was newly recorded.

      Parameters

      • id: string
      • name: string
      • status: "error" | "active" | "done"

      Returns boolean

    • Drops messages that are not part of the answer, such as commentary a backend marks as interim once its final answer arrives; their bytes return to the budget, and their truncation no longer marks the answer as truncated (CUR-005).

      Parameters

      • ids: Iterable<string>

      Returns void

    • Terminal answer replacement: supersedes intermediate draft messages with the authoritative completed response.

      Parameters

      • finalText: string

      Returns void

    • Appends or updates an assistant response message fragment. Under budget pressure, always replaces draft with latest bounded text and markers.

      Parameters

      • id: string
      • text: string
      • options: { delta?: boolean } = {}

      Returns void