probe: Trial D — streaming RPCs + JSON retry with live auth context
This commit is contained in:
@@ -435,70 +435,49 @@ function activate(context) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// ========== Trial B2: Chrome DevTools Protocol probe ==========
|
||||
// ========== Trial D: Streaming RPC + JSON retry ==========
|
||||
setTimeout(async () => {
|
||||
console.log('Gravity Bridge: [Trial B2] Probing Chrome DevTools Protocol access...');
|
||||
// Try getChromeDevtoolsMcpUrl - could give us DevTools WebSocket URL
|
||||
try {
|
||||
const cdpUrl = await vscode.commands.executeCommand('antigravity.getChromeDevtoolsMcpUrl');
|
||||
console.log(`Gravity Bridge: [Trial B2] getChromeDevtoolsMcpUrl: ${JSON.stringify(cdpUrl).substring(0, 500)}`);
|
||||
if (!lsPort || !lsCsrf) {
|
||||
console.log('Gravity Bridge: [Trial D] Skipped — no LS');
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Gravity Bridge: [Trial B2] getChromeDevtoolsMcpUrl error: ${e.message}`);
|
||||
}
|
||||
// Try getBrowserOnboardingPort
|
||||
try {
|
||||
const port = await vscode.commands.executeCommand('antigravity.getBrowserOnboardingPort');
|
||||
console.log(`Gravity Bridge: [Trial B2] getBrowserOnboardingPort: ${JSON.stringify(port)}`);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Gravity Bridge: [Trial B2] getBrowserOnboardingPort error: ${e.message}`);
|
||||
}
|
||||
// Try getWsTargets commands
|
||||
try {
|
||||
const wsTargets = await vscode.commands.executeCommand('antigravity.getWsTargets.open');
|
||||
console.log(`Gravity Bridge: [Trial B2] getWsTargets.open: ${JSON.stringify(wsTargets).substring(0, 500)}`);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Gravity Bridge: [Trial B2] getWsTargets.open error: ${e.message}`);
|
||||
}
|
||||
// Try getCascadePluginTemplate - might reveal plugin API
|
||||
try {
|
||||
const tmpl = await vscode.commands.executeCommand('antigravity.getCascadePluginTemplate');
|
||||
console.log(`Gravity Bridge: [Trial B2] getCascadePluginTemplate: ${JSON.stringify(tmpl).substring(0, 500)}`);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Gravity Bridge: [Trial B2] getCascadePluginTemplate error: ${e.message}`);
|
||||
}
|
||||
// Try workbench.action.chat.copyLink - might copy chat content
|
||||
try {
|
||||
const chatLink = await vscode.commands.executeCommand('workbench.action.chat.copyLink');
|
||||
console.log(`Gravity Bridge: [Trial B2] chat.copyLink: ${JSON.stringify(chatLink)}`);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Gravity Bridge: [Trial B2] chat.copyLink error: ${e.message}`);
|
||||
}
|
||||
// Try to find DevTools WebSocket URL from process args (Electron --remote-debugging-port)
|
||||
try {
|
||||
const exec = require('child_process');
|
||||
const cmd = 'wmic process where "name=\'Antigravity.exe\'" get CommandLine /format:list 2>nul';
|
||||
exec.exec(cmd, (err, stdout) => {
|
||||
if (stdout) {
|
||||
const portMatch = stdout.match(/--remote-debugging-port=(\d+)/);
|
||||
if (portMatch) {
|
||||
console.log(`Gravity Bridge: [Trial B2] ✅ Electron remote debugging port: ${portMatch[1]}`);
|
||||
console.log(`Gravity Bridge: [Trial B2] CDP URL: http://127.0.0.1:${portMatch[1]}/json`);
|
||||
}
|
||||
else {
|
||||
console.log(`Gravity Bridge: [Trial B2] No --remote-debugging-port in Antigravity args`);
|
||||
}
|
||||
}
|
||||
console.log(`Gravity Bridge: [Trial D] Probing streaming RPCs on port ${lsPort}...`);
|
||||
const http = require('http');
|
||||
function tryRPC(method, bodyStr) {
|
||||
return new Promise((resolve) => {
|
||||
const isJson = !!bodyStr;
|
||||
const body = isJson ? Buffer.from(bodyStr) : Buffer.from([0, 0, 0, 0, 0]);
|
||||
const req = http.request({ hostname: '127.0.0.1', port: lsPort, path: `/exa.language_server_pb.LanguageServerService/${method}`, method: 'POST', headers: { 'Content-Type': isJson ? 'application/json' : 'application/connect+proto', 'Connect-Protocol-Version': '1', 'x-codeium-csrf-token': lsCsrf }, timeout: 8000 }, (res) => {
|
||||
const chunks = [];
|
||||
res.on('data', (c) => chunks.push(c));
|
||||
res.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));
|
||||
});
|
||||
req.on('error', (e) => resolve(`err:${e.message}`));
|
||||
req.on('timeout', () => { req.destroy(); resolve('timeout'); });
|
||||
req.write(body);
|
||||
req.end();
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Gravity Bridge: [Trial B2] process scan error: ${e.message}`);
|
||||
for (const m of ['StreamCascadeReactiveUpdates', 'StreamCascadeSummariesReactiveUpdates', 'StreamAgentStateUpdates', 'GetBrowserOpenConversation']) {
|
||||
const r = await tryRPC(m);
|
||||
console.log(`Gravity Bridge: [Trial D] ${m}: ${r.substring(0, 400)}`);
|
||||
}
|
||||
}, 5000);
|
||||
try {
|
||||
const dRaw = await vscode.commands.executeCommand('antigravity.getDiagnostics');
|
||||
const d = typeof dRaw === 'string' ? JSON.parse(dRaw) : dRaw;
|
||||
const ts = d?.recentTrajectories || [];
|
||||
if (ts.length > 0) {
|
||||
const t = ts[ts.length - 1];
|
||||
const gid = t.googleAgentId || '';
|
||||
console.log(`Gravity Bridge: [Trial D] Latest: ${gid.substring(0, 8)} step=${t.lastStepIndex}`);
|
||||
const r = await tryRPC('GetCascadeTrajectorySteps', JSON.stringify({ trajectoryId: gid, startStepIndex: Math.max(0, t.lastStepIndex - 1) }));
|
||||
console.log(`Gravity Bridge: [Trial D] Steps(json): ${r.substring(0, 500)}`);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(`Gravity Bridge: [Trial D] err: ${e.message}`);
|
||||
}
|
||||
}, 15000);
|
||||
// Start LS bridge after a delay
|
||||
setTimeout(async () => {
|
||||
const found = await discoverLS();
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user