feat(enrichment): Step Probe API 메모리 기반 명령어 보강 — Always run 표시 개선 (v0.5.90)
This commit is contained in:
@@ -520,6 +520,7 @@ async function activate(context) {
|
|||||||
get sessionStalled() { return (0, step_probe_1.getStepProbeContext)().sessionStalled; },
|
get sessionStalled() { return (0, step_probe_1.getStepProbeContext)().sessionStalled; },
|
||||||
get lastPendingStepIndex() { return (0, step_probe_1.getStepProbeContext)().lastPendingStepIndex; },
|
get lastPendingStepIndex() { return (0, step_probe_1.getStepProbeContext)().lastPendingStepIndex; },
|
||||||
writeChatSnapshot,
|
writeChatSnapshot,
|
||||||
|
getLastWaitingCommand: step_probe_1.getLastWaitingCommand,
|
||||||
};
|
};
|
||||||
const bridgePort = await (0, http_bridge_1.startHttpBridge)(httpBridgeCtx, sdk);
|
const bridgePort = await (0, http_bridge_1.startHttpBridge)(httpBridgeCtx, sdk);
|
||||||
let localPort = bridgePort;
|
let localPort = bridgePort;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
4
extension/package-lock.json
generated
4
extension/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "gravity-bridge",
|
"name": "gravity-bridge",
|
||||||
"version": "0.5.89",
|
"version": "0.5.90",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "gravity-bridge",
|
"name": "gravity-bridge",
|
||||||
"version": "0.5.89",
|
"version": "0.5.90",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^1.2.0",
|
"cheerio": "^1.2.0",
|
||||||
"ws": "^8.19.0"
|
"ws": "^8.19.0"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "gravity-bridge",
|
"name": "gravity-bridge",
|
||||||
"displayName": "Gravity Bridge",
|
"displayName": "Gravity Bridge",
|
||||||
"description": "Discord-based unified approval system for Antigravity AI interactions.",
|
"description": "Discord-based unified approval system for Antigravity AI interactions.",
|
||||||
"version": "0.5.89",
|
"version": "0.5.90",
|
||||||
"publisher": "variet",
|
"publisher": "variet",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.100.0"
|
"vscode": "^1.100.0"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import * as path from 'path';
|
|||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as cp from 'child_process';
|
import * as cp from 'child_process';
|
||||||
import { WSBridgeClient, WSResponseData, WSCommandData } from './ws-client';
|
import { WSBridgeClient, WSResponseData, WSCommandData } from './ws-client';
|
||||||
import { initStepProbe, BridgeContext, writePendingApproval, tryApprovalStrategies, writeRegistration, getApprovalContext, resetPendingState, resetPendingStateForReconnect, handleDiffReviewResponse, getActiveSessionId as getStepProbeSessionId, getStepProbeContext } from './step-probe';
|
import { initStepProbe, BridgeContext, writePendingApproval, tryApprovalStrategies, writeRegistration, getApprovalContext, resetPendingState, resetPendingStateForReconnect, handleDiffReviewResponse, getActiveSessionId as getStepProbeSessionId, getStepProbeContext, getLastWaitingCommand } from './step-probe';
|
||||||
import { startHttpBridge, getDeterministicPort, HttpBridgeContext } from './http-bridge';
|
import { startHttpBridge, getDeterministicPort, HttpBridgeContext } from './http-bridge';
|
||||||
import { setupApprovalObserver } from './html-patcher';
|
import { setupApprovalObserver } from './html-patcher';
|
||||||
import { watchCommandsDir, handleWSCommand, disposeCommandsWatcher, CommandHandlerContext } from './command-handler';
|
import { watchCommandsDir, handleWSCommand, disposeCommandsWatcher, CommandHandlerContext } from './command-handler';
|
||||||
@@ -521,6 +521,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||||||
get sessionStalled() { return getStepProbeContext().sessionStalled; },
|
get sessionStalled() { return getStepProbeContext().sessionStalled; },
|
||||||
get lastPendingStepIndex() { return getStepProbeContext().lastPendingStepIndex; },
|
get lastPendingStepIndex() { return getStepProbeContext().lastPendingStepIndex; },
|
||||||
writeChatSnapshot,
|
writeChatSnapshot,
|
||||||
|
getLastWaitingCommand,
|
||||||
};
|
};
|
||||||
const bridgePort = await startHttpBridge(httpBridgeCtx, sdk);
|
const bridgePort = await startHttpBridge(httpBridgeCtx, sdk);
|
||||||
let localPort = bridgePort;
|
let localPort = bridgePort;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export interface HttpBridgeContext {
|
|||||||
lastPendingStepIndex: number;
|
lastPendingStepIndex: number;
|
||||||
logToFile: (msg: string) => void;
|
logToFile: (msg: string) => void;
|
||||||
writeChatSnapshot?: (text: string) => void;
|
writeChatSnapshot?: (text: string) => void;
|
||||||
|
getLastWaitingCommand?: () => { cmd: string; desc: string; ts: number };
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Module-level state ───
|
// ─── Module-level state ───
|
||||||
@@ -334,6 +335,14 @@ function _handlePending(req: any, res: any, ctx: HttpBridgeContext) {
|
|||||||
}
|
}
|
||||||
} catch (e: any) { ctx.logToFile(`[HTTP] AUTO-APPROVE pending lookup error: ${e.message}`); }
|
} catch (e: any) { ctx.logToFile(`[HTTP] AUTO-APPROVE pending lookup error: ${e.message}`); }
|
||||||
}
|
}
|
||||||
|
// v29: Final-final fallback — Step Probe API memory
|
||||||
|
if (displayCmd === rawCmd && GENERIC_BTN_RE.test(displayCmd) && ctx.getLastWaitingCommand) {
|
||||||
|
const wc = ctx.getLastWaitingCommand();
|
||||||
|
if (wc.cmd && wc.cmd.length > 3 && !GENERIC_BTN_RE.test(wc.cmd) && (Date.now() - wc.ts) < 30_000) {
|
||||||
|
displayCmd = wc.desc && wc.desc.length > wc.cmd.length ? wc.desc.substring(0, 200) : wc.cmd.substring(0, 200);
|
||||||
|
ctx.logToFile(`[HTTP] AUTO-APPROVE enriched from step-probe memory: "${displayCmd.substring(0, 80)}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
const rid = data.request_id || Date.now().toString();
|
const rid = data.request_id || Date.now().toString();
|
||||||
ctx.logToFile(`[HTTP] AUTO-APPROVE "Always run" (btnIdx=${alwaysRunBtnIndex}): cmd="${displayCmd.substring(0, 80)}"`);
|
ctx.logToFile(`[HTTP] AUTO-APPROVE "Always run" (btnIdx=${alwaysRunBtnIndex}): cmd="${displayCmd.substring(0, 80)}"`);
|
||||||
// Write response file so observer's pollResponseGroup picks it up and clicks the button
|
// Write response file so observer's pollResponseGroup picks it up and clicks the button
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ let activeTrajectoryId = '';
|
|||||||
const recentPendingSteps = new Map<string, number>();
|
const recentPendingSteps = new Map<string, number>();
|
||||||
const PENDING_MEMORY_TTL_MS = 30_000;
|
const PENDING_MEMORY_TTL_MS = 30_000;
|
||||||
|
|
||||||
|
// v29: Last WAITING command from API — used by http-bridge for Always run enrichment
|
||||||
|
let lastWaitingCommand = { cmd: '', desc: '', ts: 0 };
|
||||||
|
|
||||||
// generateApprovalObserverScript → extracted to ./observer-script.ts
|
// generateApprovalObserverScript → extracted to ./observer-script.ts
|
||||||
const lastSnapshotText = new Map<string, string>();
|
const lastSnapshotText = new Map<string, string>();
|
||||||
|
|
||||||
@@ -79,6 +82,14 @@ export function getStepProbeContext(): { activeSessionId: string; sessionStalled
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* v29: Get last WAITING command from Step Probe API.
|
||||||
|
* Used by http-bridge as fallback when Observer's extractContext returns generic "Always run".
|
||||||
|
*/
|
||||||
|
export function getLastWaitingCommand(): { cmd: string; desc: string; ts: number } {
|
||||||
|
return { ...lastWaitingCommand };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset pending state after successful approval.
|
* Reset pending state after successful approval.
|
||||||
* Called after WS response triggers approval in extension.ts.
|
* Called after WS response triggers approval in extension.ts.
|
||||||
@@ -608,6 +619,8 @@ function setupMonitor() {
|
|||||||
const { cmd: command, desc: description, isSafe: isSafeToAutoRun } = formatStepProbeCommand(toolName, actualIdx, sType || '', toolCall);
|
const { cmd: command, desc: description, isSafe: isSafeToAutoRun } = formatStepProbeCommand(toolName, actualIdx, sType || '', toolCall);
|
||||||
|
|
||||||
ctx.logToFile(`[STEP-PROBE] ★ WAITING (RT)! step=${actualIdx} type=${sType} cmd='${command}'`);
|
ctx.logToFile(`[STEP-PROBE] ★ WAITING (RT)! step=${actualIdx} type=${sType} cmd='${command}'`);
|
||||||
|
// v29: Save for http-bridge enrichment
|
||||||
|
lastWaitingCommand = { cmd: command, desc: description, ts: Date.now() };
|
||||||
|
|
||||||
if (actualIdx !== ctx.lastPendingStepIndex) {
|
if (actualIdx !== ctx.lastPendingStepIndex) {
|
||||||
ctx.stallProbed = true;
|
ctx.stallProbed = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user