Skip to content

Commit b3dffac

Browse files
authored
chore: sync extension files from sentience-chrome v2.2.0
1 parent 728a599 commit b3dffac

File tree

6 files changed

+582
-70
lines changed

6 files changed

+582
-70
lines changed

sentience/extension/background.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import init, { analyze_page_with_options, analyze_page, prune_for_api } from '..
66
// This runs in an isolated environment, completely immune to page CSP policies
77

88

9-
console.log('[Sentience Background] Initializing...');
109

1110
// Global WASM initialization state
1211
let wasmReady = false;
@@ -22,7 +21,6 @@ async function initWASM() {
2221

2322
wasmInitPromise = (async () => {
2423
try {
25-
console.log('[Sentience Background] Loading WASM module...');
2624

2725
// Define the js_click_element function that WASM expects
2826
// In Service Workers, use 'globalThis' instead of 'window'
@@ -36,8 +34,6 @@ async function initWASM() {
3634
await init();
3735

3836
wasmReady = true;
39-
console.log('[Sentience Background] ✓ WASM ready!');
40-
console.log(
4137
'[Sentience Background] Available functions: analyze_page, analyze_page_with_options, prune_for_api'
4238
);
4339
} catch (error) {
@@ -124,7 +120,6 @@ async function handleScreenshotCapture(_tabId, options = {}) {
124120
quality,
125121
});
126122

127-
console.log(
128123
`[Sentience Background] Screenshot captured: ${format}, size: ${dataUrl.length} bytes`
129124
);
130125
return dataUrl;
@@ -166,7 +161,6 @@ async function handleSnapshotProcessing(rawData, options = {}) {
166161
throw new Error('WASM module not initialized');
167162
}
168163

169-
console.log(
170164
`[Sentience Background] Processing ${rawData.length} elements with options:`,
171165
options
172166
);
@@ -213,7 +207,6 @@ async function handleSnapshotProcessing(rawData, options = {}) {
213207
}
214208

215209
const duration = performance.now() - startTime;
216-
console.log(
217210
`[Sentience Background] ✓ Processed: ${analyzedElements.length} analyzed, ${prunedRawData.length} pruned (${duration.toFixed(1)}ms)`
218211
);
219212

@@ -228,7 +221,6 @@ async function handleSnapshotProcessing(rawData, options = {}) {
228221
}
229222
}
230223

231-
console.log('[Sentience Background] Service worker ready');
232224

233225
// Global error handlers to prevent extension crashes
234226
self.addEventListener('error', (event) => {

sentience/extension/content.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
'use strict';
55

66
// content.js - ISOLATED WORLD (Bridge between Main World and Background)
7-
console.log('[Sentience Bridge] Loaded.');
87

98
// Detect if we're in a child frame (for iframe support)
109
const isChildFrame = window !== window.top;
1110
if (isChildFrame) {
12-
console.log('[Sentience Bridge] Running in child frame:', window.location.href);
1311
}
1412

1513
// 1. Pass Extension ID to Main World (So API knows where to find resources)
@@ -118,7 +116,6 @@
118116
}
119117

120118
if (response?.success) {
121-
console.log(`[Sentience Bridge] ✓ WASM processing complete in ${duration.toFixed(1)}ms`);
122119
window.postMessage(
123120
{
124121
type: 'SENTIENCE_SNAPSHOT_RESULT',
@@ -292,12 +289,10 @@
292289
shadow.appendChild(box);
293290
});
294291

295-
console.log(`[Sentience Bridge] Overlay shown for ${elements.length} elements`);
296292

297293
// Auto-remove after 5 seconds
298294
overlayTimeout = setTimeout(() => {
299295
removeOverlay();
300-
console.log('[Sentience Bridge] Overlay auto-cleared after 5 seconds');
301296
}, 5000);
302297
}
303298

@@ -306,7 +301,6 @@
306301
*/
307302
function handleClearOverlay() {
308303
removeOverlay();
309-
console.log('[Sentience Bridge] Overlay cleared manually');
310304
}
311305

312306
/**
@@ -324,6 +318,5 @@
324318
}
325319
}
326320

327-
// console.log('[Sentience Bridge] Ready - Extension ID:', chrome.runtime.id);
328321

329322
})();

0 commit comments

Comments
 (0)