MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / response_text

Function response_text

atomic-agent/src/turn/orchestrator/provenance.rs:1256–1276  ·  view source on GitHub ↗
(session: &AgentSession, event: &TurnEvent)

Source from the content-addressed store, hash-verified

1254}
1255
1256fn response_text(session: &AgentSession, event: &TurnEvent) -> Option<String> {
1257 let raw = event.raw_json.as_ref();
1258 let from_payload = |key: &str| -> Option<String> {
1259 raw.and_then(|value| value.get(key))
1260 .and_then(serde_json::Value::as_str)
1261 .map(str::trim)
1262 .filter(|text| !text.is_empty())
1263 .map(ToOwned::to_owned)
1264 };
1265 from_payload("last_assistant_message")
1266 .or_else(|| from_payload("prompt_response"))
1267 .or_else(|| from_payload("response"))
1268 .or_else(|| {
1269 let path = session.transcript_path.as_ref()?;
1270 let data = std::fs::read(path).ok()?;
1271 transcript::last_assistant_text(
1272 &data,
1273 transcript::format_for_agent(&session.agent_name),
1274 )
1275 })
1276}
1277
1278#[cfg(test)]
1279mod generic_context_tests {

Callers 1

Calls 7

last_assistant_textFunction · 0.85
format_for_agentFunction · 0.85
as_refMethod · 0.80
getMethod · 0.65
readFunction · 0.50
is_emptyMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected