probe: getManagerTrace + getWorkbenchTrace + LS port discovery
This commit is contained in:
@@ -97,34 +97,78 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
vscode.commands.registerCommand('gravityBridge.reject', () => handleManualAction(false)),
|
vscode.commands.registerCommand('gravityBridge.reject', () => handleManualAction(false)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Probe getDiagnostics to discover AI response data structure
|
// === PROBE: Find where AI conversation text lives ===
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
console.log('Gravity Bridge: === PROBE START ===');
|
||||||
|
|
||||||
|
// Probe 1: getManagerTrace — may contain step-level data
|
||||||
try {
|
try {
|
||||||
const diag: any = await vscode.commands.executeCommand('antigravity.getDiagnostics');
|
const trace: any = await vscode.commands.executeCommand('antigravity.getManagerTrace');
|
||||||
if (typeof diag === 'string') {
|
console.log(`Gravity Bridge: [getManagerTrace] type=${typeof trace}`);
|
||||||
const parsed = JSON.parse(diag);
|
if (trace) {
|
||||||
console.log(`Gravity Bridge: getDiagnostics keys: ${Object.keys(parsed).join(', ')}`);
|
const str = typeof trace === 'string' ? trace : JSON.stringify(trace);
|
||||||
// Sample each key to understand structure
|
console.log(` length=${str.length}`);
|
||||||
for (const key of Object.keys(parsed)) {
|
console.log(` sample: ${str.substring(0, 500)}`);
|
||||||
const val = parsed[key];
|
// If object, show keys
|
||||||
if (Array.isArray(val)) {
|
const parsed = typeof trace === 'string' ? JSON.parse(trace) : trace;
|
||||||
console.log(` [${key}] Array(${val.length})`);
|
if (parsed && typeof parsed === 'object') {
|
||||||
if (val.length > 0) {
|
console.log(` keys: ${Object.keys(parsed).join(', ')}`);
|
||||||
const sample = val[val.length - 1]; // last item
|
|
||||||
console.log(` last: ${JSON.stringify(sample).substring(0, 300)}`);
|
|
||||||
}
|
}
|
||||||
} else if (typeof val === 'object') {
|
|
||||||
console.log(` [${key}] Object: ${JSON.stringify(val).substring(0, 200)}`);
|
|
||||||
} else {
|
|
||||||
console.log(` [${key}] ${typeof val}: ${String(val).substring(0, 100)}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log(`Gravity Bridge: getDiagnostics returned ${typeof diag}`);
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(`Gravity Bridge: getDiagnostics error: ${e}`);
|
console.log(`Gravity Bridge: [getManagerTrace] error: ${e}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Probe 2: getWorkbenchTrace — may contain conversation/step data
|
||||||
|
try {
|
||||||
|
const trace: any = await vscode.commands.executeCommand('antigravity.getWorkbenchTrace');
|
||||||
|
console.log(`Gravity Bridge: [getWorkbenchTrace] type=${typeof trace}`);
|
||||||
|
if (trace) {
|
||||||
|
const str = typeof trace === 'string' ? trace : JSON.stringify(trace);
|
||||||
|
console.log(` length=${str.length}`);
|
||||||
|
console.log(` sample: ${str.substring(0, 500)}`);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Gravity Bridge: [getWorkbenchTrace] error: ${e}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Probe 3: Find LS process for ConnectRPC port + CSRF token
|
||||||
|
try {
|
||||||
|
const { exec } = require('child_process');
|
||||||
|
exec(
|
||||||
|
'powershell -Command "Get-CimInstance Win32_Process | Where-Object {$_.CommandLine -like \'*language_server*\'} | Select-Object ProcessId, CommandLine | Format-List"',
|
||||||
|
{ maxBuffer: 1024 * 1024 },
|
||||||
|
(err: any, stdout: string) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Gravity Bridge: [LS discovery] error: ${err.message}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (stdout.trim()) {
|
||||||
|
console.log(`Gravity Bridge: [LS process found]`);
|
||||||
|
// Extract port and csrf_token from command line
|
||||||
|
const portMatch = stdout.match(/--(?:port|httpPort|httpsPort)[= ](\d+)/);
|
||||||
|
const csrfMatch = stdout.match(/--csrf_token[= ]([^\s"]+)/);
|
||||||
|
const extPortMatch = stdout.match(/--extension_server_port[= ](\d+)/);
|
||||||
|
console.log(` port: ${portMatch?.[1] || 'not found'}`);
|
||||||
|
console.log(` csrf: ${csrfMatch?.[1]?.substring(0, 12) || 'not found'}...`);
|
||||||
|
console.log(` ext_port: ${extPortMatch?.[1] || 'not found'}`);
|
||||||
|
// Show full command line for analysis
|
||||||
|
const lines = stdout.split('\n');
|
||||||
|
for (const line of lines) {
|
||||||
|
if (line.includes('CommandLine')) {
|
||||||
|
console.log(` cmdline: ${line.substring(0, 500)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`Gravity Bridge: [LS process] not found`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Gravity Bridge: [LS discovery] error: ${e}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Gravity Bridge: === PROBE END ===');
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
// Chat document change listener — captures AI text responses
|
// Chat document change listener — captures AI text responses
|
||||||
|
|||||||
Reference in New Issue
Block a user