fix(extension): restore AI Response Content capture by patching DOM extraction, CSP connect-src, and TS regex literal serialization
This commit is contained in:
@@ -244,6 +244,45 @@ function setupMonitor() {
|
||||
if (pollCount <= 3) ctx.logToFile(`[POLL] GetDiagnostics fallback failed: ${e.message}`);
|
||||
}
|
||||
|
||||
try {
|
||||
// Fallback 2: The backend API hard-limits to 10 trajectories, often dropping the newest active session.
|
||||
// We physically scan the .gemini/antigravity/brain/ directory to guarantee we track the latest ones.
|
||||
const brainDir = path.resolve(ctx.bridgePath, '..', 'brain');
|
||||
if (fs.existsSync(brainDir)) {
|
||||
const brainDirs = fs.readdirSync(brainDir, { withFileTypes: true })
|
||||
.filter(dirent => dirent.isDirectory() && dirent.name.length === 36)
|
||||
.map(dirent => {
|
||||
const stats = fs.statSync(path.join(brainDir, dirent.name));
|
||||
return { name: dirent.name, time: stats.mtimeMs };
|
||||
})
|
||||
.sort((a, b) => b.time - a.time);
|
||||
|
||||
for (let i = 0; i < Math.min(3, brainDirs.length); i++) {
|
||||
const sid = brainDirs[i].name;
|
||||
if (!allTraj.trajectorySummaries[sid]) {
|
||||
try {
|
||||
const stResp = await ctx.sdk.ls.rawRPC('GetCascadeTrajectorySteps', { cascadeId: sid, stepOffset: 0 });
|
||||
if (stResp?.steps) {
|
||||
const len = stResp.steps.length;
|
||||
const ls = len > 0 ? stResp.steps[len - 1] : null;
|
||||
allTraj.trajectorySummaries[sid] = {
|
||||
status: ls?.status || 'CASCADE_RUN_STATUS_RUNNING', // Assume running if we have to force it
|
||||
stepCount: len,
|
||||
lastModifiedTime: new Date(brainDirs[i].time).toISOString(),
|
||||
summary: 'Discovered via brain/ scan',
|
||||
trajectoryMetadata: { workspaces: [{ workspaceFolderAbsoluteUri: ctx.workspaceUri.replace(/\\/g, '/') }] }
|
||||
};
|
||||
}
|
||||
} catch (e: any) {
|
||||
if (pollCount <= 30) ctx.logToFile(`[POLL] Fallback 2 error for sid=${sid}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: any) {
|
||||
if (pollCount <= 3) ctx.logToFile(`[POLL] brainDir scan fallback failed: ${e.message}`);
|
||||
}
|
||||
|
||||
if (!allTraj?.trajectorySummaries || Object.keys(allTraj.trajectorySummaries).length === 0) {
|
||||
if (pollCount <= 3) ctx.logToFile('[POLL] no trajectorySummaries found from any source');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user