fix(observer): v31 — content_copy 아이콘 필터 + 후보 길이순 정렬 + trailing icon strip (v0.5.96)
This commit is contained in:
4
extension/package-lock.json
generated
4
extension/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "gravity-bridge",
|
||||
"version": "0.5.95",
|
||||
"version": "0.5.96",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gravity-bridge",
|
||||
"version": "0.5.95",
|
||||
"version": "0.5.96",
|
||||
"dependencies": {
|
||||
"cheerio": "^1.2.0",
|
||||
"ws": "^8.19.0"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "gravity-bridge",
|
||||
"displayName": "Gravity Bridge",
|
||||
"description": "Discord-based unified approval system for Antigravity AI interactions.",
|
||||
"version": "0.5.95",
|
||||
"version": "0.5.96",
|
||||
"publisher": "variet",
|
||||
"engines": {
|
||||
"vscode": "^1.100.0"
|
||||
|
||||
@@ -205,31 +205,37 @@ export function generateApprovalObserverScript(_port: number): string {
|
||||
var rcEl = rcDivs[rci];
|
||||
var rcChildCount = rcEl.children ? rcEl.children.length : 0;
|
||||
var rcTxt = (rcEl.textContent || '').trim();
|
||||
// Match leaf div with exact or near-exact "Running command" text
|
||||
if ((rcTxt === 'Running command' || (rcChildCount === 0 && rcTxt.indexOf('Running command') !== -1 && rcTxt.length < 30)) && rcEl.parentElement) {
|
||||
var rcP = rcEl.parentElement;
|
||||
log('CONTEXT-v30 found RC header at d'+depth+' siblings='+rcP.children.length);
|
||||
var rcCands = [];
|
||||
for (var rcsi = 0; rcsi < rcP.children.length; rcsi++) {
|
||||
if (rcP.children[rcsi] === rcEl) continue;
|
||||
var sibT = (rcP.children[rcsi].textContent || '').trim();
|
||||
if (sibT.length < 5) continue;
|
||||
// Skip button-bar text
|
||||
if (/^(content_copy|content_paste|play_arrow|check_circle|chevron_|keyboard_arrow|more_horiz|more_vert|expand_|alternate_email|arrow_drop)/.test(sibT)) continue;
|
||||
if (/^(Always|Run|Allow|Cancel|Deny|keyboard_arrow)/i.test(sibT)) continue;
|
||||
if (sibT.indexOf('Always run') !== -1 && sibT.indexOf('Cancel') !== -1) continue;
|
||||
// Try prompt marker extraction
|
||||
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 cmdV='+cmdV.substring(0,60));
|
||||
_lastContextDebug = _debugTrail.join(' ');
|
||||
return 'Running command: ' + cmdV;
|
||||
rcCands.push(sibT);
|
||||
}
|
||||
// Fallback: use raw sibling text if it looks like a terminal line
|
||||
if (sibT.length > 10 && /[\\u276f\\u003e]/.test(sibT)) {
|
||||
log('CONTEXT-OK d='+depth+' src=running-cmd-raw sibT='+sibT.substring(0,60));
|
||||
rcCands.sort(function(a,b){ return b.length - a.length; });
|
||||
log('CONTEXT-v30 RC d='+depth+' cands='+rcCands.length+(rcCands.length>0?' best="'+rcCands[0].substring(0,60)+'"':''));
|
||||
for (var rcci = 0; rcci < rcCands.length; rcci++) {
|
||||
var candT = rcCands[rcci];
|
||||
var pM = candT.match(/[\\u003e\\u00bb\\u276f]\\s+(.+)/);
|
||||
if (pM && pM[1].trim().length > 3) {
|
||||
var cmdV = pM[1].trim();
|
||||
cmdV = cmdV.replace(/\\s*(content_copy|content_paste|play_arrow|check_circle|keyboard_arrow[_a-z]*)\\s*$/, '').trim();
|
||||
if (cmdV.length < 3) continue;
|
||||
if (/^(Always|Run|Allow|Cancel|Deny)/i.test(cmdV)) continue;
|
||||
log('CONTEXT-OK d='+depth+' src=running-cmd cmdV='+cmdV.substring(0,80));
|
||||
_lastContextDebug = _debugTrail.join(' ');
|
||||
return sibT.substring(0, 300);
|
||||
return 'Running command: ' + cmdV.substring(0, 300);
|
||||
}
|
||||
if (candT.length > 10 && /[\\u276f\\u003e]/.test(candT)) {
|
||||
var rawC = candT.replace(/\\s*(content_copy|content_paste|play_arrow)\\s*$/, '').trim();
|
||||
log('CONTEXT-OK d='+depth+' src=running-cmd-raw rawC='+rawC.substring(0,80));
|
||||
_lastContextDebug = _debugTrail.join(' ');
|
||||
return rawC.substring(0, 300);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user