fix(ext): resolve ui freeze and saftoautorun burst send memory leak (v0.5.15)

This commit is contained in:
Variet Worker
2026-04-08 05:17:17 +09:00
parent 8a49320232
commit bf7db72afb
5 changed files with 41 additions and 13 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "gravity-bridge",
"version": "0.5.4",
"version": "0.5.15",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gravity-bridge",
"version": "0.5.4",
"version": "0.5.15",
"dependencies": {
"ws": "^8.19.0"
},

View File

@@ -2,7 +2,7 @@
"name": "gravity-bridge",
"displayName": "Gravity Bridge",
"description": "Antigravity ↔ Discord 브리지 연동 확장",
"version": "0.5.14",
"version": "0.5.15",
"publisher": "variet",
"engines": {
"vscode": "^1.100.0"
@@ -85,4 +85,4 @@
"dependencies": {
"ws": "^8.19.0"
}
}
}

View File

@@ -70,15 +70,17 @@ function detectProjectName(): string {
if (folders && folders.length > 0) {
const cwd = folders[0].uri.fsPath;
try {
const remoteUrl = cp.execSync('git remote get-url origin', {
cwd, encoding: 'utf-8', timeout: 2000, windowsHide: true, stdio: ['ignore', 'pipe', 'ignore']
}).toString().trim();
const match = remoteUrl.match(/\/([^\/]+?)(?:\.git)?$/);
if (match && match[1]) {
return match[1].toLowerCase().replace(/[\s\-]+/g, '_');
const gitConfig = path.join(cwd, '.git', 'config');
if (fs.existsSync(gitConfig)) {
const cfg = fs.readFileSync(gitConfig, 'utf-8');
const match = cfg.match(/url\s*=\s*(.*?)\n/);
if (match && match[1]) {
const repo = match[1].trim().match(/\/([^\/]+?)(?:\.git)?$/);
if (repo && repo[1]) return repo[1].toLowerCase().replace(/[\s]+/g, '_');
}
}
} catch { }
return path.basename(cwd).toLowerCase().replace(/[\s\-]+/g, '_');
return path.basename(cwd).toLowerCase().replace(/[\s]+/g, '_');
}
return 'default';
}
@@ -219,7 +221,7 @@ export async function fixLSConnection(): Promise<boolean> {
// Generate the workspace hint the same way SDK does, but we'll match case-insensitively
const folder = folders[0].uri.fsPath;
const parts = folder.replace(/\\/g, '/').split('/');
const hint = parts.slice(-2).join('_').replace(/[-.\s]/g, '_').toLowerCase();
const hint = parts.slice(-2).join('_').replace(/[^a-z0-9]/gi, '').toLowerCase();
if (!hint) { logToFile('[LS-FIX] skipped: empty hint'); return false; }
@@ -255,7 +257,7 @@ export async function fixLSConnection(): Promise<boolean> {
// Match workspace_id arg against our hint
const wsMatch = line.match(/--workspace_id[= ](\S+)/i);
if (wsMatch) {
const wsid = wsMatch[1].toLowerCase();
const wsid = wsMatch[1].replace(/[^a-z0-9]/gi, '').toLowerCase();
if (wsid.includes(hint)) {
matchedLine = line;
break;

View File

@@ -41,6 +41,7 @@ const PENDING_MEMORY_TTL_MS = 60_000;
// generateApprovalObserverScript → extracted to ./observer-script.ts
const lastSnapshotText = new Map<string, string>();
const autoRunSteps = new Set<number>();
/**
* Get current approval context for WS response routing.
@@ -333,6 +334,19 @@ function setupMonitor() {
ctx.logToFile(`[DIFF-TRACK] + ${bn} (step ${actualIdx})`);
}
}
const safeToAutoRun = tcArgs.SafeToAutoRun === true || tcArgs.safeToAutoRun === true;
if (safeToAutoRun && !autoRunSteps.has(actualIdx)) {
if (autoRunSteps.size > 1000) {
const oldest = autoRunSteps.values().next().value;
if (oldest !== undefined) autoRunSteps.delete(oldest);
}
autoRunSteps.add(actualIdx);
const cmdText = tcArgs.CommandLine || tcArgs.command || tcArgs.Command || JSON.stringify(tcArgs);
const truncatedCmd = cmdText.length > 500 ? cmdText.substring(0, 500) + '...' : cmdText;
ctx.logToFile(`[AUTO-RUN] step=${actualIdx} captured`);
ctx.writeChatSnapshot(`🤖 **[Background Execution]**\n\n\`\`\`bash\n${truncatedCmd}\n\`\`\``);
}
} catch { }
}
if (sType.includes('PLANNER_RESPONSE') && s?.status?.includes('DONE')) {