defmodule SyntropyWeb.Api.RunJSON do @moduledoc false @spec run(map()) :: map() def run(run) do %{ id: run.id, status: run.status, kind: run.kind, node_id: run.node_id, coordinator_node_id: run.coordinator_node_id, prompt: run.prompt, strategy: run.strategy, resolved_mode: run.resolved_mode, selected_agent_ids: run.selected_agent_ids, selected_agents: run.selected_agents, contributing_agent_ids: run.contributing_agent_ids, contributing_agents: run.contributing_agents, thoughts: run.thoughts, thought_count: run.thought_count, agent_attempts: Map.get(run, :agent_attempts, []), execution_quality: Map.get(run, :execution_quality), provider_profile: Map.get(run, :provider_profile), llm_usage: Map.get(run, :llm_usage), synthesis: run.synthesis, structured_answer: Map.get(run, :structured_answer), output_quality: Map.get(run, :output_quality), selection_trace: run.selection_trace, recommendation_ids: run.recommendation_ids, snapshot_ids: run.snapshot_ids, source_review: run.source_review, citation_audit: run.citation_audit, inquiry_rounds: Map.get(run, :inquiry_rounds, []), tool_attempts: Map.get(run, :tool_attempts, []), expanded_evidence: Map.get(run, :expanded_evidence, []), inquiry_quality: Map.get(run, :inquiry_quality), receipts: Map.get(run, :receipts, []), code_review: Map.get(run, :code_review), error: run.error, started_at: run.started_at, updated_at: run.updated_at, completed_at: run.completed_at, failed_at: run.failed_at } end end