fix(extension): 크로스 프로젝트 response watcher 우회 수정 + file_permission write 도구 3-button 매핑
- response watcher: pending 삭제 후 response data의 project_name으로 fallback 필터 - processResponseFile: sessionId를 pending에서 우선 사용 (activeSessionId 대신) - logToFile: [projectName] 접두사 추가 (공유 로그 구분) - file_permission 리스트에 replace_file_content, write_to_file, multi_replace_file_content 추가 - UserResponse에 project_name 필드 추가 + bot.py 4곳 전파 - known-issues: 2건 추가, devlog 012
This commit is contained in:
@@ -20,8 +20,10 @@ import * as crypto from 'crypto';
|
||||
// ─── File-based logging (AI can read directly) ───
|
||||
function logToFile(msg: string) {
|
||||
const ts = new Date().toISOString().replace('T', ' ').substring(0, 19);
|
||||
const line = `${ts} ${msg}`;
|
||||
console.log(`Gravity Bridge: ${msg}`);
|
||||
// Include projectName prefix so shared log can distinguish which extension instance logged
|
||||
const prefix = projectName ? `[${projectName}]` : '';
|
||||
const line = `${ts} ${prefix} ${msg}`;
|
||||
console.log(`Gravity Bridge: ${prefix} ${msg}`);
|
||||
try {
|
||||
if (!bridgePath) return;
|
||||
const logFile = path.join(bridgePath, 'extension.log');
|
||||
@@ -1708,7 +1710,7 @@ function setupMonitor() {
|
||||
conversation_id: activeSessionId,
|
||||
command,
|
||||
description: `Step #${actualIndex} (${(oStep.type || '').replace('CORTEX_STEP_TYPE_', '')})`,
|
||||
step_type: ['view_file', 'list_dir', 'find_by_name', 'read_file', 'grep_search'].includes(toolName) ? 'file_permission' : toolName,
|
||||
step_type: ['view_file', 'list_dir', 'find_by_name', 'read_file', 'grep_search', 'replace_file_content', 'write_to_file', 'multi_replace_file_content'].includes(toolName) ? 'file_permission' : toolName,
|
||||
step_index: actualIndex,
|
||||
source: 'step_probe_offset',
|
||||
});
|
||||
@@ -1763,7 +1765,7 @@ function setupMonitor() {
|
||||
conversation_id: activeSessionId,
|
||||
command,
|
||||
description,
|
||||
step_type: ['view_file', 'list_dir', 'find_by_name', 'read_file', 'grep_search'].includes(toolName) ? 'file_permission' : toolName,
|
||||
step_type: ['view_file', 'list_dir', 'find_by_name', 'read_file', 'grep_search', 'replace_file_content', 'write_to_file', 'multi_replace_file_content'].includes(toolName) ? 'file_permission' : toolName,
|
||||
step_index: si,
|
||||
source: 'step_probe',
|
||||
});
|
||||
@@ -2052,6 +2054,15 @@ function setupResponseWatcher() {
|
||||
return; // Not our project
|
||||
}
|
||||
} catch { }
|
||||
} else {
|
||||
// Pending file missing (deleted or auto_resolved) — check response data itself
|
||||
try {
|
||||
const respData = JSON.parse(fs.readFileSync(fp, 'utf-8'));
|
||||
if (respData.project_name && respData.project_name !== projectName) {
|
||||
logToFile(`[RESPONSE] skip (from resp data) ${rid} (project=${respData.project_name}, we=${projectName})`);
|
||||
return;
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
setTimeout(() => processResponseFile(fp), 300);
|
||||
}
|
||||
@@ -2160,13 +2171,17 @@ async function processResponseFile(filePath: string) {
|
||||
}
|
||||
} else if (isDomObserver) {
|
||||
// DOM observer path: ALSO try RPC strategies (renderer click is unreliable)
|
||||
logToFile(`[RESPONSE] dom_observer → tryApprovalStrategies(${approved}, ${activeSessionId.substring(0, 8)}, type=${pendingStepType}, step=${pendingStepIndex})`);
|
||||
const strategyResult = await tryApprovalStrategies(approved, activeSessionId, pendingStepType, pendingStepIndex);
|
||||
// Use sessionId from pending file if available, fallback to activeSessionId
|
||||
const targetSession = sessionId || activeSessionId;
|
||||
logToFile(`[RESPONSE] dom_observer → tryApprovalStrategies(${approved}, ${targetSession.substring(0, 8)}, type=${pendingStepType}, step=${pendingStepIndex})`);
|
||||
const strategyResult = await tryApprovalStrategies(approved, targetSession, pendingStepType, pendingStepIndex);
|
||||
logToFile(`[RESPONSE] dom strategy result: ${strategyResult}`);
|
||||
} else {
|
||||
// Step probe path: run ALL approval strategies
|
||||
logToFile(`[RESPONSE] step_probe → tryApprovalStrategies(${approved}, ${activeSessionId.substring(0, 8)}, type=${pendingStepType}, step=${pendingStepIndex})`);
|
||||
const strategyResult = await tryApprovalStrategies(approved, activeSessionId, pendingStepType, pendingStepIndex);
|
||||
// Use sessionId from pending file if available, fallback to activeSessionId
|
||||
const targetSession = sessionId || activeSessionId;
|
||||
logToFile(`[RESPONSE] step_probe → tryApprovalStrategies(${approved}, ${targetSession.substring(0, 8)}, type=${pendingStepType}, step=${pendingStepIndex})`);
|
||||
const strategyResult = await tryApprovalStrategies(approved, targetSession, pendingStepType, pendingStepIndex);
|
||||
logToFile(`[RESPONSE] strategy result: ${strategyResult}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user