fix(observer): 'Running command' div에서 명령어 추출 — pre/code 대신 plain div 탐색 (v0.5.93)

This commit is contained in:
Variet Worker
2026-04-19 14:40:05 +09:00
parent 70c83b4226
commit 64800d3c20
3 changed files with 23 additions and 3 deletions

View File

@@ -1,12 +1,12 @@
{ {
"name": "gravity-bridge", "name": "gravity-bridge",
"version": "0.5.92", "version": "0.5.93",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "gravity-bridge", "name": "gravity-bridge",
"version": "0.5.92", "version": "0.5.93",
"dependencies": { "dependencies": {
"cheerio": "^1.2.0", "cheerio": "^1.2.0",
"ws": "^8.19.0" "ws": "^8.19.0"

View File

@@ -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.92", "version": "0.5.93",
"publisher": "variet", "publisher": "variet",
"engines": { "engines": {
"vscode": "^1.100.0" "vscode": "^1.100.0"

View File

@@ -189,6 +189,26 @@ export function generateApprovalObserverScript(_port: number): string {
_lastContextDebug = _debugTrail.join(' > '); _lastContextDebug = _debugTrail.join(' > ');
return parts.join(' \u2014 '); return parts.join(' \u2014 ');
} }
// v30: Command text is in plain divs near "Running command" header, not pre/code
var rcDivs = node.querySelectorAll('div');
for (var rci = 0; rci < rcDivs.length; rci++) {
var rcTxt = (rcDivs[rci].textContent || '').trim();
if (rcTxt === 'Running command' && rcDivs[rci].parentElement) {
var rcP = rcDivs[rci].parentElement;
for (var rcsi = 0; rcsi < rcP.children.length; rcsi++) {
if (rcP.children[rcsi] === rcDivs[rci]) continue;
var sibT = (rcP.children[rcsi].textContent || '').trim();
var pM = sibT.match(/[\\u003e\\u00bb\\u276f]\\s+(.+)/);
if (pM && pM[1].trim().length > 3) {
var cmdV = pM[1].trim().substring(0, 300);
if (/^(Always|Run|Allow|Cancel|Deny)/i.test(cmdV)) continue;
log('CONTEXT-OK d='+depth+' src=running-cmd trail='+_debugTrail.join(' '));
_lastContextDebug = _debugTrail.join(' ');
return 'Running command: ' + cmdV;
}
}
}
}
// v23: Also search sibling elements at each level // v23: Also search sibling elements at each level
// AG Native's command display (pre.font-mono) is a SIBLING of footer, not ancestor // AG Native's command display (pre.font-mono) is a SIBLING of footer, not ancestor
if (node && node.parentElement) { if (node && node.parentElement) {