<?php
$logPath = 'C:/Users/HP/.gemini/antigravity-ide/brain/d31b1fe2-ad06-4c7a-9ab1-c82bd4c8dd20/.system_generated/logs/transcript.jsonl';
if (!file_exists($logPath)) {
    die("Log not found\n");
}
$handle = fopen($logPath, "r");
$idx = 0;
$out = "";
while (($line = fgets($handle)) !== false) {
    $idx++;
    if ($idx == 494 || $idx == 495 || $idx == 496) {
        $out .= "=== Step $idx ===\n";
        $data = json_decode($line, true);
        if ($data) {
            $out .= "Type: " . ($data['type'] ?? '') . "\n";
            if (isset($data['tool_calls'])) {
                foreach ($data['tool_calls'] as $tc) {
                    $out .= "Tool: " . $tc['name'] . "\n";
                    $out .= "Args: " . json_encode($tc['args'], JSON_PRETTY_PRINT) . "\n";
                }
            }
        }
        $out .= "=================\n\n";
    }
}
fclose($handle);
file_put_contents("scratch/step_495_output.txt", $out);
echo "Saved to scratch/step_495_output.txt\n";
