diff --git a/src/telegram_codex_bot/transcript_parser.py b/src/telegram_codex_bot/transcript_parser.py index 4d0e1aa..84ce889 100644 --- a/src/telegram_codex_bot/transcript_parser.py +++ b/src/telegram_codex_bot/transcript_parser.py @@ -76,7 +76,7 @@ class TranscriptParser: # Magic string constants _NO_CONTENT_PLACEHOLDER = "(no content)" _INTERRUPTED_TEXT = "[Request interrupted by user for tool use]" - _INTERNAL_TOOL_NAMES = {"update_plan"} + _INTERNAL_TOOL_NAMES = {"update_plan", "view_image", "viewimage"} _MAX_SUMMARY_LENGTH = 200 _AUTH_ERROR_HINT_MARKERS = ( "could not be refreshed", diff --git a/tests/telegram_codex_bot/test_transcript_parser.py b/tests/telegram_codex_bot/test_transcript_parser.py index 833a2ec..64e62a2 100644 --- a/tests/telegram_codex_bot/test_transcript_parser.py +++ b/tests/telegram_codex_bot/test_transcript_parser.py @@ -207,6 +207,48 @@ def test_private_connector_tool_calls_are_hidden_but_thinking_stays( assert "checking repos" in result[0].text assert pending == {} + def test_view_image_tool_calls_are_hidden_from_messages(self): + use_item = { + "type": "response_item", + "timestamp": "2026-06-08T09:40:05Z", + "payload": { + "type": "function_call", + "call_id": "call_view_image", + "name": "view_image", + "arguments": json.dumps( + { + "path": "/tmp/ibkr-gateway-screen.png", + "detail": "high", + } + ), + }, + } + result_item = { + "type": "response_item", + "timestamp": "2026-06-08T09:40:06Z", + "payload": { + "type": "function_call_output", + "call_id": "call_view_image", + "output": json.dumps( + [ + { + "type": "input_image", + "image_url": "data:image/png;base64,abc123", + } + ] + ), + }, + } + + entries = [ + TranscriptParser.parse_line(json.dumps(use_item)), + TranscriptParser.parse_line(json.dumps(result_item)), + ] + result, pending = TranscriptParser.parse_entries([e for e in entries if e]) + + assert result == [] + assert pending == {} + def test_response_item_function_call_output_is_normalized_as_tool_result(self): item = { "type": "response_item",