Skip to main content

Module codec

Module codec 

Source
Expand description

Stream-json line encode / decode.

Re-exportsยง

use serde_json::Value; ๐Ÿ”’
use serde_json::json; ๐Ÿ”’
use crate::Error; ๐Ÿ”’
use crate::control::ControlRequest; ๐Ÿ”’
use forge_primitives::Message; ๐Ÿ”’

Enumsยง

DecodedLine
A single stream-json line from the subprocess - either a regular message or a control request.

Functionsยง

decode_dispatch
Decode one stream-json line, dispatching on the type field.
decode_line
Parse one stream-json line into a Message.
encode_user_prompt
Encode a user prompt as one line of stream-json input.
encode_user_prompt_with_content
Encode a user-turn line with structured content blocks (text + image) as the message body. Use this when the prompt includes images or other non-text blocks; for plain text use encode_user_prompt which emits the simpler bare-string form.