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:
@@ -2,7 +2,7 @@
|
||||
"name": "gravity-bridge",
|
||||
"displayName": "Gravity Bridge",
|
||||
"description": "Discord-based unified approval system for Antigravity AI interactions.",
|
||||
"version": "0.5.38",
|
||||
"version": "0.5.39",
|
||||
"publisher": "variet",
|
||||
"engines": {
|
||||
"vscode": "^1.100.0"
|
||||
|
||||
@@ -128,6 +128,7 @@ export function startHttpBridge(ctx: HttpBridgeContext, sdk: any): Promise<numbe
|
||||
|
||||
if (req.method === 'POST' && url.pathname === '/dump-html') {
|
||||
let dumpBody = '';
|
||||
req.setEncoding('utf8');
|
||||
req.on('data', (c: string) => dumpBody += c);
|
||||
req.on('end', () => {
|
||||
try {
|
||||
@@ -145,6 +146,7 @@ export function startHttpBridge(ctx: HttpBridgeContext, sdk: any): Promise<numbe
|
||||
|
||||
if (req.method === 'POST' && url.pathname === '/test-rpc') {
|
||||
let rpcBody = '';
|
||||
req.setEncoding('utf8');
|
||||
req.on('data', (c: string) => rpcBody += c);
|
||||
req.on('end', async () => {
|
||||
try {
|
||||
@@ -248,6 +250,7 @@ export function startHttpBridge(ctx: HttpBridgeContext, sdk: any): Promise<numbe
|
||||
|
||||
function _handlePending(req: any, res: any, ctx: HttpBridgeContext) {
|
||||
let body = '';
|
||||
req.setEncoding('utf8');
|
||||
req.on('data', (c: string) => body += c);
|
||||
req.on('end', () => {
|
||||
try {
|
||||
@@ -398,6 +401,7 @@ function _handleDeepInspectTrigger(res: any) {
|
||||
|
||||
function _handleDeepInspectResult(req: any, res: any, ctx: HttpBridgeContext) {
|
||||
let body = '';
|
||||
req.setEncoding('utf8');
|
||||
req.on('data', (c: string) => body += c);
|
||||
req.on('end', () => {
|
||||
try {
|
||||
@@ -420,6 +424,7 @@ function _handleDeepInspectResult(req: any, res: any, ctx: HttpBridgeContext) {
|
||||
|
||||
function _handleChatSnapshot(req: any, res: any, ctx: HttpBridgeContext) {
|
||||
let body = '';
|
||||
req.setEncoding('utf8');
|
||||
req.on('data', (c: string) => body += c);
|
||||
req.on('end', () => {
|
||||
try {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user