fix(ext): WS response → tryApprovalStrategies 직접 호출 (파일 경유 제거)
This commit is contained in:
@@ -1059,20 +1059,18 @@ async function activate(context) {
|
||||
if (hubUrl) {
|
||||
wsBridge = new ws_client_1.WSBridgeClient(hubUrl, regCode, projectName, pcName, {
|
||||
onResponse: (data) => {
|
||||
logToFile(`[WS-RESPONSE] ${data.request_id?.substring(0, 12)} approved=${data.approved}`);
|
||||
// Route to processResponseFile logic — write temp response file for compatibility
|
||||
try {
|
||||
const responseDir = path.join(bridgePath, 'response');
|
||||
if (!fs.existsSync(responseDir)) {
|
||||
fs.mkdirSync(responseDir, { recursive: true });
|
||||
}
|
||||
const responseFile = path.join(responseDir, `${data.request_id}.json`);
|
||||
fs.writeFileSync(responseFile, JSON.stringify(data, null, 2), 'utf-8');
|
||||
logToFile(`[WS-RESPONSE] Written response file for processing`);
|
||||
}
|
||||
catch (e) {
|
||||
logToFile(`[WS-RESPONSE] Write error: ${e.message}`);
|
||||
}
|
||||
logToFile(`[WS-RESPONSE] ${data.request_id?.substring(0, 12)} approved=${data.approved} step_type=${data.step_type || '(none)'}`);
|
||||
// Direct approval — WS path has no pending file, so call tryApprovalStrategies directly
|
||||
const approved = data.approved ?? true;
|
||||
const stepType = data.step_type || '';
|
||||
const approvalCtx = (0, step_probe_1.getApprovalContext)();
|
||||
logToFile(`[WS-RESPONSE] Triggering approval: approved=${approved} session=${approvalCtx.sessionId.substring(0, 8)} stepType=${stepType} stepIndex=${approvalCtx.stepIndex}`);
|
||||
(0, step_probe_1.tryApprovalStrategies)(approved, approvalCtx.sessionId, stepType, approvalCtx.stepIndex)
|
||||
.then(result => {
|
||||
logToFile(`[WS-RESPONSE] Approval result: ${result}`);
|
||||
(0, step_probe_1.resetPendingState)();
|
||||
})
|
||||
.catch(err => logToFile(`[WS-RESPONSE] Approval error: ${err.message}`));
|
||||
},
|
||||
onCommand: (data) => {
|
||||
logToFile(`[WS-CMD] ${data.text?.substring(0, 50)}`);
|
||||
|
||||
Reference in New Issue
Block a user