<?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;
while (($line = fgets($handle)) !== false) {
    $idx++;
    if (strpos($line, 'futureLocationTS') !== false) {
        $data = json_decode($line, true);
        if (!$data) continue;
        
        $content = $data['content'] ?? '';
        if (isset($data['tool_calls'])) {
            foreach ($data['tool_calls'] as $tc) {
                $argsStr = json_encode($tc['args'], JSON_PRETTY_PRINT);
                if (strpos($argsStr, 'futureLocationTS') !== false) {
                    $content .= "\n" . $argsStr;
                }
            }
        }
        
        if (strpos($content, '<select') !== false || strpos($content, 'class="card-grid"') !== false) {
            echo "=== Found TS HTML in Step $idx ===\n";
            $pos = strpos($content, 'futureLocationTS');
            if ($pos !== false) {
                $start = max(0, $pos - 1000);
                $length = 3000;
                echo substr($content, $start, $length) . "\n";
            } else {
                echo substr($content, 0, 3000) . "\n";
            }
            echo "==================================\n\n";
        }
    }
}
fclose($handle);
