const fs = require('fs');
const readline = require('readline');

async function search() {
    const logPath = 'C:\\Users\\BS\\.gemini\\antigravity\\brain\\393257b2-e812-421c-92f7-099f2362049e\\.system_generated\\logs\\transcript.jsonl';
    const rl = readline.createInterface({
        input: fs.createReadStream(logPath),
        crlfDelay: Infinity
    });
    
    let found = [];
    for await (const line of rl) {
        if (line.includes('function renderAbstracts') || line.includes('function saveAbstract')) {
            try {
                const parsed = JSON.parse(line);
                if (parsed.source === 'MODEL') {
                    found.push(parsed.content || JSON.stringify(parsed.tool_calls));
                }
            } catch(e) {}
        }
    }
    
    fs.writeFileSync('found_code.txt', found.join('\n\n=====\n\n'));
    console.log("Done");
}
search();
