fix(observer): 'Running command' div에서 명령어 추출 — pre/code 대신 plain div 탐색 (v0.5.93)
This commit is contained in:
@@ -189,6 +189,26 @@ export function generateApprovalObserverScript(_port: number): string {
|
||||
_lastContextDebug = _debugTrail.join(' > ');
|
||||
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
|
||||
// AG Native's command display (pre.font-mono) is a SIBLING of footer, not ancestor
|
||||
if (node && node.parentElement) {
|
||||
|
||||
Reference in New Issue
Block a user