The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(api): reuse _COMPACTION_INTERNAL_FIELDS from compaction_display
kshitijk4poorb2c4f1f37616
diff --git a/gateway/platforms/api_server.py b/gateway/platforms/api_server.pyindex 143aae20c76..53e9ad7a70c 100644--- a/gateway/platforms/api_server.py+++ b/gateway/platforms/api_server.py@@ -441,20 +441,15 @@ def _project_client_message(message: Dict[str, Any]) -> Dict[str, Any]:summary delimiter. Tool calls are dropped from both shapes because acarrier's inherited calls are historical context, not live client output."""- from agent.compaction_display import project_compaction_message_for_display+ from agent.compaction_display import (+ _COMPACTION_INTERNAL_FIELDS,+ project_compaction_message_for_display,+ )projected = project_compaction_message_for_display(message)if projected is None:projected = message.copy()- for internal_key in (- "tool_calls",- "finish_reason",- "reasoning",- "reasoning_content",- "reasoning_details",- "codex_reasoning_items",- "codex_message_items",- ):+ for internal_key in _COMPACTION_INTERNAL_FIELDS:projected.pop(internal_key, None)projected["content"] = ""projected["display_kind"] = "hidden"