probe: Trial E2 — Electron webContents + undocumented VS Code commands

This commit is contained in:
2026-03-07 23:38:25 +09:00
parent 87094e00b0
commit 8c0736fe2b
4 changed files with 114 additions and 1 deletions

Binary file not shown.

View File

@@ -436,6 +436,67 @@ function activate(context) {
} }
return null; return null;
} }
// ========== Trial E2: Electron webContents probe ==========
setTimeout(() => {
console.log('Gravity Bridge: [Trial E2] Probing Electron webContents...');
try {
// Try to access Electron APIs from extension host
const electron = require('electron');
console.log(`Gravity Bridge: [Trial E2] electron keys: ${Object.keys(electron).join(', ')}`);
// Try remote (deprecated but might work)
if (electron.remote) {
const wcs = electron.remote.webContents.getAllWebContents();
console.log(`Gravity Bridge: [Trial E2] Found ${wcs.length} webContents via remote`);
wcs.forEach((wc, i) => {
console.log(` [${i}] id=${wc.id} url=${wc.getURL().substring(0, 80)} title=${wc.getTitle().substring(0, 40)}`);
});
}
}
catch (e) {
console.log(`Gravity Bridge: [Trial E2] electron: ${e.message}`);
}
try {
// Try @electron/remote
const remote = require('@electron/remote');
const wcs = remote.webContents.getAllWebContents();
console.log(`Gravity Bridge: [Trial E2] @electron/remote: ${wcs.length} webContents`);
}
catch (e) {
console.log(`Gravity Bridge: [Trial E2] @electron/remote: ${e.message}`);
}
try {
// Try process.mainModule to access main process
const mainModule = process.mainModule;
console.log(`Gravity Bridge: [Trial E2] mainModule: ${mainModule?.filename?.substring(0, 80)}`);
}
catch (e) {
console.log(`Gravity Bridge: [Trial E2] mainModule: ${e.message}`);
}
// Try to find webview frames via VS Code internals
try {
const vscodeInternal = global._VSCODE_NODE_MODULES;
if (vscodeInternal) {
console.log(`Gravity Bridge: [Trial E2] _VSCODE_NODE_MODULES keys: ${Object.keys(vscodeInternal).join(', ')}`);
}
}
catch (e) {
console.log(`Gravity Bridge: [Trial E2] vscode internals: ${e.message}`);
}
// Try to list all vscode webview panels through undocumented APIs
try {
const allCmds = ['workbench.action.webview.openDeveloperTools', 'workbench.experimental.chat.dump'];
allCmds.forEach(async (cmd) => {
try {
const result = await vscode.commands.executeCommand(cmd);
console.log(`Gravity Bridge: [Trial E2] ${cmd}: ${JSON.stringify(result).substring(0, 300)}`);
}
catch (e) {
console.log(`Gravity Bridge: [Trial E2] ${cmd}: ${e.message}`);
}
});
}
catch (e) { }
}, 8000);
// ========== Stream subscription for active cascades ========== // ========== Stream subscription for active cascades ==========
function subscribeToStream(cascadeId) { function subscribeToStream(cascadeId) {
if (!lsPort || !lsCsrf) { if (!lsPort || !lsCsrf) {

File diff suppressed because one or more lines are too long

View File

@@ -429,6 +429,58 @@ export function activate(context: vscode.ExtensionContext) {
// ========== Trial E2: Electron webContents probe ==========
setTimeout(() => {
console.log('Gravity Bridge: [Trial E2] Probing Electron webContents...');
try {
// Try to access Electron APIs from extension host
const electron = require('electron');
console.log(`Gravity Bridge: [Trial E2] electron keys: ${Object.keys(electron).join(', ')}`);
// Try remote (deprecated but might work)
if (electron.remote) {
const wcs = electron.remote.webContents.getAllWebContents();
console.log(`Gravity Bridge: [Trial E2] Found ${wcs.length} webContents via remote`);
wcs.forEach((wc: any, i: number) => {
console.log(` [${i}] id=${wc.id} url=${wc.getURL().substring(0, 80)} title=${wc.getTitle().substring(0, 40)}`);
});
}
} catch (e: any) { console.log(`Gravity Bridge: [Trial E2] electron: ${e.message}`); }
try {
// Try @electron/remote
const remote = require('@electron/remote');
const wcs = remote.webContents.getAllWebContents();
console.log(`Gravity Bridge: [Trial E2] @electron/remote: ${wcs.length} webContents`);
} catch (e: any) { console.log(`Gravity Bridge: [Trial E2] @electron/remote: ${e.message}`); }
try {
// Try process.mainModule to access main process
const mainModule = process.mainModule;
console.log(`Gravity Bridge: [Trial E2] mainModule: ${mainModule?.filename?.substring(0, 80)}`);
} catch (e: any) { console.log(`Gravity Bridge: [Trial E2] mainModule: ${e.message}`); }
// Try to find webview frames via VS Code internals
try {
const vscodeInternal = (global as any)._VSCODE_NODE_MODULES;
if (vscodeInternal) {
console.log(`Gravity Bridge: [Trial E2] _VSCODE_NODE_MODULES keys: ${Object.keys(vscodeInternal).join(', ')}`);
}
} catch (e: any) { console.log(`Gravity Bridge: [Trial E2] vscode internals: ${e.message}`); }
// Try to list all vscode webview panels through undocumented APIs
try {
const allCmds = ['workbench.action.webview.openDeveloperTools', 'workbench.experimental.chat.dump'];
allCmds.forEach(async (cmd) => {
try {
const result = await vscode.commands.executeCommand(cmd);
console.log(`Gravity Bridge: [Trial E2] ${cmd}: ${JSON.stringify(result).substring(0, 300)}`);
} catch (e: any) { console.log(`Gravity Bridge: [Trial E2] ${cmd}: ${e.message}`); }
});
} catch (e: any) { }
}, 8000);
// ========== Stream subscription for active cascades ========== // ========== Stream subscription for active cascades ==========
function subscribeToStream(cascadeId: string): void { function subscribeToStream(cascadeId: string): void {
if (!lsPort || !lsCsrf) { return; } if (!lsPort || !lsCsrf) { return; }