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

Function response_text

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

Source from the content-addressed store, hash-verified

919}
920
921fn response_text(session: &AgentSession, event: &TurnEvent) -> Option<String> {
922 let raw = event.raw_json.as_ref();
923 let from_payload = |key: &str| -> Option<String> {
924 raw.and_then(|value| value.get(key))
925 .and_then(serde_json::Value::as_str)
926 .map(str::trim)
927 .filter(|text| !text.is_empty())
928 .map(ToOwned::to_owned)
929 };
930 from_payload("last_assistant_message")
931 .or_else(|| from_payload("prompt_response"))
932 .or_else(|| from_payload("response"))
933 .or_else(|| {
934 let path = session.transcript_path.as_ref()?;
935 let data = std::fs::read(path).ok()?;
936 transcript::last_assistant_text(
937 &data,
938 transcript::format_for_agent(&session.agent_name),
939 )
940 })
941}
942
943/// Extract the generic end-of-turn todo snapshot supplied by current agent
944/// hooks. Preserve an upstream stable `id` when present. Agents that omit IDs

Callers 1

Calls 5

last_assistant_textFunction · 0.85
format_for_agentFunction · 0.85
as_refMethod · 0.80
getMethod · 0.65
is_emptyMethod · 0.45

Tested by

no test coverage detected