chore(bridge): update known-issues and prep for DOM Observer MD restoration (#634)

This commit is contained in:
Variet Worker
2026-04-17 06:25:22 +09:00
parent b2f17a086b
commit 13e569f426
4 changed files with 48 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
"name": "gravity-bridge",
"displayName": "Gravity Bridge",
"description": "Discord-based unified approval system for Antigravity AI interactions.",
"version": "0.5.53",
"version": "0.5.54",
"publisher": "variet",
"engines": {
"vscode": "^1.100.0"

View File

@@ -49,8 +49,8 @@ export function generateApprovalObserverScript(_port: number): string {
var NOISE_CODE_RE = /^(declare\\s+(class|function|interface|type|enum|const|var|let)\\s|(import|export|from)\\s|\\s*[{}()\\[\\];]\\s*$|\\.ts:\\d+:|extension.*src.*sdk)/i;
function isNoiseLine(line) {
if (!line || line.trim().length < 2) return true;
var trimmed = line.trim();
if (trimmed.length < 2 && !/^[-*+>]$|^[0-9]$/.test(trimmed)) return true;
if (NOISE_RE.test(trimmed)) return true;
if (NOISE_CODE_RE.test(trimmed)) return true;
// Single-word Material icon names (all lowercase, no spaces)
@@ -66,10 +66,23 @@ export function generateApprovalObserverScript(_port: number): string {
text = text.replace(/Thought for a few seconds/gi, '');
var lines = text.split('\\n');
var clean = [];
var lastWasEmpty = false;
for (var i = 0; i < lines.length; i++) {
if (!isNoiseLine(lines[i])) clean.push(lines[i].trim());
var line = lines[i];
if (line.trim().length === 0) {
if (!lastWasEmpty && clean.length > 0) {
clean.push('');
lastWasEmpty = true;
}
continue;
}
if (!isNoiseLine(line)) {
clean.push(line.replace(/\\s+$/, ''));
lastWasEmpty = false;
}
}
return clean.join('\\n').trim();
while (clean.length > 0 && clean[clean.length - 1] === '') clean.pop();
return clean.join('\\n');
}
function cleanButtonText(btn) {
@@ -506,12 +519,29 @@ export function generateApprovalObserverScript(_port: number): string {
// Try to get text from markdown rendering area first
// AG Native uses .leading-relaxed.select-text, Cascade uses .markdown-body/.prose
var mdEl = clone.querySelector('.markdown-body, .prose, [class*="markdown"], [class*="rendered"]');
// v18 FIX: Temporarily attach to DOM to force layout computation for .innerText
// Without this, .innerText on unattached node behaves exactly like .textContent (loses block newlines)
var container = document.createElement('div');
container.style.position = 'absolute';
container.style.left = '-9999px';
container.style.top = '-9999px';
container.style.opacity = '0';
container.style.width = '800px';
container.appendChild(clone);
document.body.appendChild(container);
var targetEl = mdEl || clone;
var rawText = '';
if (mdEl && mdEl.innerText && mdEl.innerText.trim().length > 10) {
rawText = mdEl.innerText.trim();
} else {
// Fallback: get all text but filter aggressively
rawText = (clone.innerText || clone.textContent || '').trim();
try {
if (targetEl.innerText && targetEl.innerText.trim().length > 10) {
rawText = targetEl.innerText.trim();
} else {
// Fallback: get all text but filter aggressively
rawText = (targetEl.innerText || targetEl.textContent || '').trim();
}
} finally {
if (container.parentNode) container.parentNode.removeChild(container);
}
// Apply line-by-line noise filter