Skip to main content

parse_opencode_output

Function parse_opencode_output 

Source
pub fn parse_opencode_output(
    stdout: &str,
) -> Result<(String, f64, u64), AppError>
Expand description

Parse the NDJSON output from opencode run --format json.

The output has 3 event types:

  • step_start: ignored
  • text: .part.text contains the LLM response text
  • step_finish: .part.tokens and .part.cost for accounting

Returns (response_text, cost, tokens).