fix(step-probe): ensure fast AI responses and tool calls are captured by real-time block

This commit is contained in:
Variet Worker
2026-04-10 17:12:21 +09:00
parent 300338d5d3
commit 488b36f192
12 changed files with 352 additions and 32 deletions

View File

@@ -369,7 +369,7 @@ function setupMonitor() {
console.log(`Gravity Bridge: [POLL#${pollCount}] +${delta} steps (${currentCount}) "${currentTitle}"`);
// Real-time response capture: fetch latest steps on every delta>0
if (isRunning && currentCount > lastResponseCaptureStep && ctx.sdk) {
if (currentCount > lastResponseCaptureStep && ctx.sdk) {
try {
const rtOffset = Math.max(0, currentCount - 3);
const rtResp = await ctx.sdk.ls.rawRPC('GetCascadeTrajectorySteps', {
@@ -408,7 +408,40 @@ function setupMonitor() {
? text.substring(0, 3500) + '\n\n_(이하 생략)_'
: text;
ctx.writeChatSnapshot(`💬 **AI 응답**\n\n${truncated}`);
break;
}
}
if (s?.status === 'CORTEX_STEP_STATUS_WAITING') {
const toolCall = s?.metadata?.toolCall;
const toolName = toolCall?.name || (sType || '').replace('CORTEX_STEP_TYPE_', '').toLowerCase();
const { cmd: command, desc: description, isSafe: isSafeToAutoRun } = formatStepProbeCommand(toolName, actualIdx, sType || '', toolCall);
ctx.logToFile(`[STEP-PROBE] ★ WAITING (RT)! step=${actualIdx} type=${sType} cmd='${command}'`);
if (actualIdx !== ctx.lastPendingStepIndex) {
ctx.stallProbed = true;
if (actualIdx > ctx.lastPendingStepIndex) {
ctx.lastPendingStepIndex = actualIdx;
}
lastPendingTime = Date.now();
ctx.sawRunningAfterPending = false;
if (ctx.projectName !== 'default') {
const toolCat = ['view_file', 'list_dir', 'find_by_name', 'read_file', 'grep_search'].includes(toolName) ? 'file_permission'
: ['write_to_file', 'replace_file_content', 'multi_replace_file_content'].includes(toolName) ? 'code_edit'
: ['browser_subagent', 'open_browser_url'].includes(toolName) ? 'browser_subagent'
: toolName;
writePendingApproval({
conversation_id: ctx.activeSessionId,
command,
description,
step_type: toolCat,
step_index: actualIdx,
source: 'step_probe_rt',
safe_to_auto_run: isSafeToAutoRun,
});
}
}
}
}