feat(action): direct accept/reject buttons — no mirror tab needed, Extension /api/action endpoint
This commit is contained in:
@@ -236,6 +236,35 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
}
|
||||
});
|
||||
|
||||
// --- 승인/거절 액션 (Gravity Web에서 직접 조작) ---
|
||||
|
||||
app.post('/api/action', async (req: any, res: any) => {
|
||||
try {
|
||||
const { action } = req.body;
|
||||
const commandMap: Record<string, string> = {
|
||||
acceptStep: 'antigravity.agent.acceptAgentStep',
|
||||
rejectStep: 'antigravity.agent.rejectAgentStep',
|
||||
acceptCommand: 'antigravity.command.accept',
|
||||
rejectCommand: 'antigravity.command.reject',
|
||||
acceptTerminal: 'antigravity.terminalCommand.accept',
|
||||
rejectTerminal: 'antigravity.terminalCommand.reject',
|
||||
};
|
||||
|
||||
const cmd = commandMap[action];
|
||||
if (!cmd) {
|
||||
res.status(400).json({ error: `Unknown action: ${action}` });
|
||||
return;
|
||||
}
|
||||
|
||||
await vscode.commands.executeCommand(cmd);
|
||||
output.appendLine(`[Action] ${action} → ${cmd} 실행`);
|
||||
res.json({ success: true, action });
|
||||
} catch (err: any) {
|
||||
output.appendLine(`[Action] 실패: ${err.message}`);
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
// --- 서버 시작 ---
|
||||
|
||||
server.listen(BRIDGE_PORT, () => {
|
||||
|
||||
Reference in New Issue
Block a user