Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions sentience/extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import init, { analyze_page_with_options, analyze_page, prune_for_api } from '..
// This runs in an isolated environment, completely immune to page CSP policies


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

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

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

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

wasmReady = true;
console.log('[Sentience Background] ✓ WASM ready!');
console.log(
'[Sentience Background] Available functions: analyze_page, analyze_page_with_options, prune_for_api'
);
} catch (error) {
Expand Down Expand Up @@ -124,7 +120,6 @@ async function handleScreenshotCapture(_tabId, options = {}) {
quality,
});

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

console.log(
`[Sentience Background] Processing ${rawData.length} elements with options:`,
options
);
Expand Down Expand Up @@ -213,7 +207,6 @@ async function handleSnapshotProcessing(rawData, options = {}) {
}

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

Expand All @@ -228,7 +221,6 @@ async function handleSnapshotProcessing(rawData, options = {}) {
}
}

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

// Global error handlers to prevent extension crashes
self.addEventListener('error', (event) => {
Expand Down
7 changes: 0 additions & 7 deletions sentience/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
'use strict';

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

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

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

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

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

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

Expand All @@ -306,7 +301,6 @@
*/
function handleClearOverlay() {
removeOverlay();
console.log('[Sentience Bridge] Overlay cleared manually');
}

/**
Expand All @@ -324,6 +318,5 @@
}
}

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

})();
Loading
Loading