<?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;
$steps = [];
while (($line = fgets($handle)) !== false) {
    $idx++;
    $data = json_decode($line, true);
    if ($data) {
        $steps[] = [
            'index' => $idx,
            'type' => $data['type'] ?? '',
            'source' => $data['source'] ?? '',
            'tool_calls' => isset($data['tool_calls']) ? array_map(function($t) { return $t['name']; }, $data['tool_calls']) : []
        ];
    }
}
fclose($handle);
echo "Total steps: " . count($steps) . "\n";
$start = max(0, count($steps) - 30);
for ($i = $start; $i < count($steps); $i++) {
    echo "Step " . $steps[$i]['index'] . ": " . $steps[$i]['source'] . " | " . $steps[$i]['type'] . " | Tools: " . implode(", ", $steps[$i]['tool_calls']) . "\n";
}
