fix(observer): 500ms 딜레이드 컨텍스트 추출 + 버튼 셀렉터 확장 (v0.5.83)
- Always run 감지 시 desc가 generic이면 500ms 딜레이 후 재추출 - 버튼 셀렉터에 role=button, monaco-button, vscode-button 추가 - ACCEPT-SCAN 디버그 로그 (30초 간격)
This commit is contained in:
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.81",
|
"version": "0.5.83",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "gravity-bridge",
|
"name": "gravity-bridge",
|
||||||
"version": "0.5.81",
|
"version": "0.5.83",
|
||||||
"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.81",
|
"version": "0.5.83",
|
||||||
"publisher": "variet",
|
"publisher": "variet",
|
||||||
"engines": {
|
"engines": {
|
||||||
"vscode": "^1.100.0"
|
"vscode": "^1.100.0"
|
||||||
|
|||||||
2
extension/scratch/diff_test.py
Normal file
2
extension/scratch/diff_test.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# diff_review detection test v2
|
||||||
|
test_value = "hello"
|
||||||
@@ -1015,9 +1015,21 @@ export function generateApprovalObserverScript(_port: number): string {
|
|||||||
if(!_ready)return;
|
if(!_ready)return;
|
||||||
scanChatBodies();
|
scanChatBodies();
|
||||||
var now=Date.now();
|
var now=Date.now();
|
||||||
var allBtns=document.querySelectorAll('button');
|
var allBtns=document.querySelectorAll('button, [role="button"], a.monaco-button, .monaco-text-button, vscode-button');
|
||||||
if(!allBtns.length)return;
|
if(!allBtns.length)return;
|
||||||
|
|
||||||
|
// v25: One-shot debug — find Accept/Reject elements in ANY tag (run once per 30s)
|
||||||
|
if (!scan._lastAcceptScan || now - scan._lastAcceptScan > 30000) {
|
||||||
|
scan._lastAcceptScan = now;
|
||||||
|
var allEls = document.querySelectorAll('button, a, div, span, [role="button"]');
|
||||||
|
for (var ai = 0; ai < allEls.length; ai++) {
|
||||||
|
var aTxt = (allEls[ai].textContent || '').trim();
|
||||||
|
if (aTxt.length > 2 && aTxt.length < 30 && /Accept|Reject all/i.test(aTxt)) {
|
||||||
|
log('ACCEPT-SCAN tag=' + allEls[ai].tagName + ' cls=' + (allEls[ai].className || '').substring(0,80) + ' txt=' + aTxt.substring(0,40) + ' oP=' + !!allEls[ai].offsetParent + ' dis=' + allEls[ai].disabled + ' hid=' + allEls[ai].hidden);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(var j=0;j<allBtns.length;j++){
|
for(var j=0;j<allBtns.length;j++){
|
||||||
var b=allBtns[j];
|
var b=allBtns[j];
|
||||||
// v24: Visibility check moved after txt extraction (see isDiffReviewBtn below)
|
// v24: Visibility check moved after txt extraction (see isDiffReviewBtn below)
|
||||||
@@ -1069,7 +1081,44 @@ export function generateApprovalObserverScript(_port: number): string {
|
|||||||
_sent[groupKey]={rid:rid,ts:now};
|
_sent[groupKey]={rid:rid,ts:now};
|
||||||
for(var mk=0;mk<bidList.length;mk++)_sent[bidList[mk]]={rid:rid,ts:now};
|
for(var mk=0;mk<bidList.length;mk++)_sent[bidList[mk]]={rid:rid,ts:now};
|
||||||
|
|
||||||
log('DETECTED '+matchedType+': '+txt+' ['+desc.substring(0,80)+'] step='+stepIdx);
|
// v26: Deferred context — if desc is generic ("Always run", button text only),
|
||||||
|
// delay 500ms and re-extract to allow DOM rendering to complete
|
||||||
|
var isGenericDesc = /^(Always\\s+run|Run|Allow|Accept|Retry)$/i.test(desc.trim()) || desc === txt;
|
||||||
|
if (isGenericDesc && matchedType === 'command') {
|
||||||
|
log('DEFERRED-CONTEXT: desc="' + desc.substring(0,30) + '" — waiting 500ms for DOM render');
|
||||||
|
(function(b2, rid2, btnRefs2, bidList2, groupKey2, txt2, type2, buttonsArr2) {
|
||||||
|
setTimeout(function() {
|
||||||
|
var retryDesc = extractContext(b2);
|
||||||
|
var finalDesc = /^(Always\\s+run|Run|Allow|Accept|Retry)$/i.test(retryDesc.trim()) ? desc : retryDesc;
|
||||||
|
log('DEFERRED-RESULT: "' + finalDesc.substring(0,80) + '"');
|
||||||
|
var payload = {
|
||||||
|
request_id: rid2,
|
||||||
|
command: txt2,
|
||||||
|
description: finalDesc,
|
||||||
|
step_type: type2,
|
||||||
|
buttons: buttonsArr2,
|
||||||
|
_debug_trail: _lastContextDebug || ''
|
||||||
|
};
|
||||||
|
fetch(BASE+'/pending',{
|
||||||
|
method:'POST',
|
||||||
|
headers:{'Content-Type':'application/json'},
|
||||||
|
body:JSON.stringify(payload)
|
||||||
|
}).then(function(r){return r.json();}).then(function(d){
|
||||||
|
if (!d.ok || d.filtered) {
|
||||||
|
delete _sent[groupKey2];
|
||||||
|
for(var di=0;di<bidList2.length;di++)delete _sent[bidList2[di]];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pollResponseGroup(d.request_id,btnRefs2,bidList2,groupKey2);
|
||||||
|
}).catch(function(e){
|
||||||
|
delete _sent[groupKey2];
|
||||||
|
for(var di=0;di<bidList2.length;di++)delete _sent[bidList2[di]];
|
||||||
|
});
|
||||||
|
}, 500);
|
||||||
|
})(b, rid, btnRefs, bidList, groupKey, txt, matchedType, buttonsArr);
|
||||||
|
} else {
|
||||||
|
// Original immediate send path
|
||||||
|
log('DETECTED '+matchedType+': '+txt+' ['+desc.substring(0,80)+'] step='+stepIdx);
|
||||||
|
|
||||||
(function(rid2,btnRefs2,bidList2,groupKey2,txt2,desc2,type2,buttonsArr2){
|
(function(rid2,btnRefs2,bidList2,groupKey2,txt2,desc2,type2,buttonsArr2){
|
||||||
var payload={
|
var payload={
|
||||||
@@ -1096,6 +1145,7 @@ export function generateApprovalObserverScript(_port: number): string {
|
|||||||
for(var di=0;di<bidList2.length;di++)delete _sent[bidList2[di]];
|
for(var di=0;di<bidList2.length;di++)delete _sent[bidList2[di]];
|
||||||
});
|
});
|
||||||
})(rid,btnRefs,bidList,groupKey,txt,desc,matchedType,buttonsArr);
|
})(rid,btnRefs,bidList,groupKey,txt,desc,matchedType,buttonsArr);
|
||||||
|
} // end else (immediate send)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user