feat(gateway): Docker Gateway 봇 + HTTP API 구현 #task-311

- gateway.py: Collector↔Gateway HTTP API (pending, response, chat, register, commands)
- Dockerfile + docker-compose.yml: BOT_MODE=gateway, port 8585
- main.py: gateway 모드 (watcher 비활성, GatewayAPI 시작)
- config.py: gateway 모드 BRAIN_PATH 검증 스킵
- requirements.txt: aiohttp 추가
- docs/usage-guide.md: Docker 배포 섹션 추가
- Extension VSIX v0.3.9 빌드 (auto-approve 포함)
This commit is contained in:
Variet Worker
2026-03-11 19:38:26 +09:00
parent c1303999cf
commit 6dbbb57fa7
10 changed files with 326 additions and 27 deletions

View File

@@ -77,6 +77,7 @@ let bridgePath;
let projectName;
let workspaceUri = ''; // filesystem path of the workspace folder (for session filtering)
let isActive = false;
let autoApproveEnabled = false; // toggled via !auto from Discord
let deterministicPort = 0; // derived from projectName, consistent across restarts
let watcher = null;
let commandsWatcher = null;
@@ -184,10 +185,19 @@ function processCommandFile(filePath) {
vscode.commands.executeCommand('antigravity.agent.rejectAgentStep')
.then(() => console.log('Gravity Bridge: ✅ stop sent'), () => { });
}
else if (text.startsWith('!auto ')) {
else if (text.startsWith('!auto')) {
// Auto-approve mode toggle
const mode = text.includes('on') ? 'true' : 'false';
console.log(`Gravity Bridge: auto-approve${mode}`);
if (text === '!auto on') {
autoApproveEnabled = true;
}
else if (text === '!auto off') {
autoApproveEnabled = false;
}
else {
// Toggle if no explicit on/off
autoApproveEnabled = !autoApproveEnabled;
}
logToFile(`[AUTO] auto-approve toggled → ${autoApproveEnabled}`);
}
else if (text) {
// Send message to Antigravity — use VS Code command (most reliable)
@@ -1897,14 +1907,21 @@ function setupMonitor() {
lastPendingStepIndex = actualIndex;
lastPendingTime = Date.now();
sawRunningAfterPending = false;
writePendingApproval({
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', 'replace_file_content', 'write_to_file', 'multi_replace_file_content'].includes(toolName) ? 'file_permission' : toolName,
step_index: actualIndex,
source: 'step_probe_offset',
});
// Auto-approve: skip Discord, approve directly
if (autoApproveEnabled) {
logToFile(`[AUTO] auto-approving step=${actualIndex} cmd='${command.substring(0, 60)}'`);
tryApprovalStrategies(true, activeSessionId, ['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, actualIndex);
}
else {
writePendingApproval({
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', 'replace_file_content', 'write_to_file', 'multi_replace_file_content'].includes(toolName) ? 'file_permission' : toolName,
step_index: actualIndex,
source: 'step_probe_offset',
});
}
}
break;
}
@@ -1953,14 +1970,21 @@ function setupMonitor() {
lastPendingStepIndex = si;
lastPendingTime = Date.now();
sawRunningAfterPending = false;
writePendingApproval({
conversation_id: activeSessionId,
command,
description,
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',
});
// Auto-approve: skip Discord, approve directly
if (autoApproveEnabled) {
logToFile(`[AUTO] auto-approving step=${si} cmd='${command.substring(0, 60)}'`);
tryApprovalStrategies(true, activeSessionId, ['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, si);
}
else {
writePendingApproval({
conversation_id: activeSessionId,
command,
description,
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',
});
}
}
break;
}

File diff suppressed because one or more lines are too long