feat(action): direct accept/reject buttons — no mirror tab needed, Extension /api/action endpoint

This commit is contained in:
2026-03-08 01:32:29 +09:00
parent 8568985e7a
commit 79c2b1b6d9
7 changed files with 83 additions and 23 deletions

View File

@@ -64,24 +64,11 @@ class BridgeClient {
}
/**
* 코드 편집 승인
* 승인/거절 액션 (통합)
* action: 'acceptStep' | 'rejectStep' | 'acceptCommand' | 'rejectCommand' | 'acceptTerminal' | 'rejectTerminal'
*/
async acceptStep() {
return this._post('/api/accept', {});
}
/**
* 코드 편집 거절
*/
async rejectStep() {
return this._post('/api/reject', {});
}
/**
* 터미널 명령 승인
*/
async acceptTerminal() {
return this._post('/api/accept-terminal', {});
async sendAction(action) {
return this._post('/api/action', { action });
}
/**

View File

@@ -330,7 +330,15 @@ app.get('/api/bridge/trajectory/:id', async (req, res) => {
}
});
// Bridge WS 이벤트 → 프론트엔드 포워딩
app.post('/api/bridge/action', async (req, res) => {
try {
const { action } = req.body;
const result = await bridge.sendAction(action);
res.json(result);
} catch (e) {
res.status(502).json({ error: e.message });
}
});
bridge.connectWs((msg) => {
broadcastToAll({ type: 'bridge_event', ...msg });
});