MCPcopy Create free account
hub / github.com/c4pt0r/pie / done_line

Function done_line

crates/coding-agent/src/debug.rs:139–164  ·  view source on GitHub ↗
(
    call_id: u64,
    reason: pie_ai::DoneReason,
    message: &AssistantMessage,
    started_at: Instant,
)

Source from the content-addressed store, hash-verified

137}
138
139fn done_line(
140 call_id: u64,
141 reason: pie_ai::DoneReason,
142 message: &AssistantMessage,
143 started_at: Instant,
144) -> String {
145 let usage = &message.usage;
146 let response_id = message
147 .response_id
148 .as_deref()
149 .map(ToString::to_string)
150 .unwrap_or_else(|| "-".into());
151 format!(
152 "[debug llm #{call_id} done] reason={reason:?} stop={:?} elapsed={} usage=input:{} output:{} cache_read:{} cache_write:{} total:{} cost:${:.6} response_id={} text:\n{}",
153 message.stop_reason,
154 elapsed_ms(started_at),
155 usage.input,
156 usage.output,
157 usage.cache_read,
158 usage.cache_write,
159 usage.total_tokens,
160 usage.cost.total,
161 response_id,
162 debug_preview(&assistant_log(message))
163 )
164}
165
166fn elapsed_ms(started_at: Instant) -> String {
167 format!("{}ms", started_at.elapsed().as_millis())

Callers 2

wrap_stream_fnFunction · 0.85

Calls

no outgoing calls