fix(extension): UTF-8 encoding + noise filter enhancement (v0.5.39)

- http-bridge.ts: add req.setEncoding('utf8') to all POST handlers
  to fix Korean text corruption in pending/chat/dump payloads
- observer-script.ts: add inline pre-strip in cleanLines() for
  Material icon names concatenated by textContent without newlines
- observer-script.ts: apply cleanLines() to codeText extraction
- known-issues: document UTF-8 encoding and noise filter issues
This commit is contained in:
Variet Worker
2026-04-13 12:56:25 +09:00
parent 5a76e30993
commit 2a1ebf1020
7 changed files with 157 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ export function generateApprovalObserverScript(_port: number): string {
'arrow_forward|arrow_back|expand_more|expand_less|close|more_horiz|more_vert|' +
'content_copy|content_paste|check|check_circle|error|warning|info|' +
'keyboard_arrow_up|keyboard_arrow_down|keyboard_arrow_left|keyboard_arrow_right|' +
'Thought for \\\\d+|Show more|Show less|Copy|Copied!|Edit|Cancel|' +
'Thought for \\\\d+s?|Thought for a few seconds|Show more|Show less|Copy|Copied!|Edit|Cancel|' +
'Always run|Always allow|Running command|Running \\\\d+ commands?|' +
'Deny|Allow|Allow Once|Allow This Conversation|' +
'Run|Send|Stop|Review Changes|Accept all|Reject all|Accept|Reject' +
@@ -60,6 +60,10 @@ export function generateApprovalObserverScript(_port: number): string {
function cleanLines(text) {
if (!text) return '';
// Pre-strip: inline removal of icon names and UI noise that textContent concatenates without newlines
text = text.replace(/\\b(chevron_right|chevron_left|arrow_drop_down|arrow_drop_up|arrow_right|arrow_left|arrow_forward|arrow_back|expand_more|expand_less|more_horiz|more_vert|content_copy|content_paste|keyboard_arrow_up|keyboard_arrow_down|keyboard_arrow_left|keyboard_arrow_right|slow_motion_video|open_in_new)\\b/g, '\\n');
text = text.replace(/Thought for \\d+s?/gi, '');
text = text.replace(/Thought for a few seconds/gi, '');
var lines = text.split('\\n');
var clean = [];
for (var i = 0; i < lines.length; i++) {
@@ -130,7 +134,7 @@ export function generateApprovalObserverScript(_port: number): string {
var codeEl = stepEl.querySelector('pre, code');
var codeText = '';
if (codeEl) {
codeText = (codeEl.textContent || '').trim().substring(0, 400);
codeText = cleanLines((codeEl.textContent || '').trim().substring(0, 400));
}
// Try aria-label on button