|
Entropic 2.11.1
Local-first agentic inference engine
|
Operator-visible final-text extraction for the external bridge. More...
#include <nlohmann/json.hpp>#include <string>

Go to the source code of this file.
Functions | |
| std::string | facade_text::extract_final_text (const char *result_json) |
| Extract the answer text from a serialized conversation. | |
| std::string | facade_text::no_response_reason (const char *result_json) |
| Explain why no answer text could be extracted (gh#130). | |
| std::string | facade_text::final_text_or_reason (const char *result_json) |
| Final answer text, or a diagnostic when there is none. | |
Operator-visible final-text extraction for the external bridge.
Private facade header. Extracted from external_bridge.cpp in v2.10.2 so the selection rule is directly unit-testable — gh#130 was a one-line scanning bug in a static helper with no test reachable to it.
Definition in file final_text.h.
|
inline |
Extract the answer text from a serialized conversation.
Scans backwards for the most recent assistant message that actually has content, skipping empty ones.
entropic.complete — e.g. anti-spiral rejects the lead's tool call and the next generation comes back finish=stop, 0 tool calls, 0 chars — leaves a trailing empty assistant message. Returning that empty content and stopping made the bridge answer "(no response)" while the real answer sat one or two messages earlier.The worst case was a completed sub-tier delegation: fold_delegation_summary (gh#119, v2.9.17) already folds a child's summary into the lead's empty assistant turn precisely so this function can find it — but a later terminal empty assistant turn shadowed it, and the operator lost an answer the engine had correctly produced.
role: "user" (tool_executor.cpp), and serialize_messages emits only {role, content} — so at this layer a delegation summary is indistinguishable from the operator's own prompt. Falling back to the last user message would echo the operator's question back as the answer, which is worse than admitting there is none. Delegation summaries reach us via the assistant-turn fold above, not by sniffing user messages.| result_json | Serialized conversation JSON array. |
Definition at line 55 of file final_text.h.
|
inline |
Final answer text, or a diagnostic when there is none.
| result_json | Serialized conversation JSON array. |
Definition at line 122 of file final_text.h.
|
inline |
Explain why no answer text could be extracted (gh#130).
The bare "(no response)" the bridge used to return could not distinguish an engine failure from a model that simply stalled, which the consumer reported as its own diagnostic dead end. The returned strings keep "(no response" as their leading substring so prefix/substring matching on the old sentinel still fires; exact-equality matching does not.
Deliberately reports only what the conversation itself proves. Iteration counts and the specific precondition that fired (anti-spiral, budget) are not present in this JSON, so they are not invented here.
| result_json | Serialized conversation JSON array. |
Definition at line 93 of file final_text.h.