const vscode = require('vscode'); const fs = require('fs'); const path = require('path'); let autoAcceptInterval = null; let enabled = true; let statusBarItem; // All known Antigravity accept/run commands that dismiss permission dialogs. // These are fired in parallel every tick to catch any pending approval request. const ACCEPT_COMMANDS = [ // Terminal command approvals (covers "Run command?" dialogs for git, npm, etc.) 'antigravity.terminalCommand.accept', 'antigravity.terminalCommand.run', // General command approvals 'antigravity.command.accept', // Diff-hunk approvals (auto-accept code changes) 'antigravity.prioritized.agentAcceptFocusedHunk', ]; function activate(context) { // Dump all available commands for debugging / future reference vscode.commands.getCommands(true).then(cmds => { try { fs.writeFileSync( path.join(process.env.USERPROFILE, '.gemini', 'antigravity', 'commands_dump.json'), JSON.stringify(cmds, null, 2) ); } catch (e) { } }); // Register toggle command let disposable = vscode.commands.registerCommand('unlimited.toggle', function () { enabled = !enabled; updateStatusBar(); if (enabled) { vscode.window.showInformationMessage('Auto-Skip: ON'); } else { vscode.window.showInformationMessage('Auto-Skip: OFF'); } }); context.subscriptions.push(disposable); try { // Create Right Item (High Priority) // Alignment Right, Priority 10000 ensures it is the first/left-most item in the Right block statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 10000); statusBarItem.command = 'unlimited.toggle'; context.subscriptions.push(statusBarItem); updateStatusBar(); statusBarItem.show(); } catch (e) { // Silent failure in production to avoid harassing user } // Start the loop startLoop(); } function updateStatusBar() { if (!statusBarItem) return; if (enabled) { statusBarItem.text = "Auto-Skip: ON"; statusBarItem.tooltip = "Unlimited Auto-Skip is Executing (Click to Pause)"; statusBarItem.backgroundColor = undefined; } else { statusBarItem.text = "Auto-Skip: OFF"; statusBarItem.tooltip = "Unlimited Auto-Skip is Paused (Click to Resume)"; statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground'); } } function startLoop() { autoAcceptInterval = setInterval(async () => { if (!enabled) return; // Fire all accept commands in parallel for speed await Promise.allSettled( ACCEPT_COMMANDS.map(cmd => vscode.commands.executeCommand(cmd)) ); }, 300); } function deactivate() { if (autoAcceptInterval) { clearInterval(autoAcceptInterval); } } module.exports = { activate, deactivate }