11#include <nlohmann/json.hpp>
25 if (j.contains(
"parent_conversation_id") &&
26 !j[
"parent_conversation_id"].is_null()) {
27 return j[
"parent_conversation_id"].get<std::string>();
40 const nlohmann::json& result,
AuditEntry& entry) {
43 entry.
elapsed_ms = result.at(
"elapsed_ms").get<
double>();
57 j[
"params"] = nlohmann::json::parse(
62 j[
"directives"] = nlohmann::json::parse(
67 ? nlohmann::json(
nullptr)
82 entry.
caller_id = j.at(
"caller_id").get<std::string>();
83 entry.
tool_name = j.at(
"tool_name").get<std::string>();
88 entry.
iteration = j.at(
"iteration").get<
int>();
91 }
catch (
const nlohmann::json::exception& e) {
92 logger->warn(
"Failed to parse audit entry: {}", e.what());
AuditEntry struct and JSON serialization for JSONL audit log.
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Activate model on GPU (WARM → ACTIVE).
bool audit_entry_from_json(const nlohmann::json &j, AuditEntry &entry)
Deserialize AuditEntry fields from a JSON object.
static void parse_result_fields(const nlohmann::json &result, AuditEntry &entry)
Parse the result sub-object from JSON into AuditEntry fields.
static std::string extract_parent_id(const nlohmann::json &j)
Extract optional parent_conversation_id from JSON.
nlohmann::json audit_entry_to_json(const AuditEntry &entry)
Serialize AuditEntry fields to a JSON object.
A single audit log entry for one MCP tool call.
int delegation_depth
Current delegation depth (0 = lead)
std::string result_content
Tool result text (full, never truncated)
double elapsed_ms
Tool execution duration in milliseconds.
std::string parent_conversation_id
Parent conversation ID (empty for lead)
int iteration
Engine loop iteration number.
std::string params_json
Tool parameters as JSON string (never truncated)
std::string tool_name
Fully-qualified tool name (e.g., "filesystem.write_file")
std::string result_status
"success", "error", or "timeout"
std::string caller_id
Identity/tier name (e.g., "eng", "qa", "lead")
std::string directives_json
Directives array as JSON string ("[]" if none)