Initial commit: Browser Pilot - Agentic Browser Control Extension

- Side Panel with Chat UI, Quick Actions, Dev Tools
- 22 browser automation tools (DOM, JS, screenshots, navigation)
- MCP server (zero-dep, Node 18+) for external AI clients
- Supports OpenRouter, Ollama, Anthropic, OpenAI, custom endpoints
- Chrome/Brave MV3 extension with content script console capture
This commit is contained in:
2026-07-28 11:04:37 +02:00
commit d708c8b58c
13 changed files with 2258 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
/**
* Browser Pilot Content Script
* Captures console logs and provides DOM utilities.
*/
(function() {
'use strict';
if (window.__bpInjected) return;
window.__bpInjected = true;
// Console capture
const orig = { log: console.log, warn: console.warn, error: console.error, info: console.info };
function hook(level) {
return function(...args) {
try {
chrome.runtime.sendMessage({
type: 'CONSOLE_LOG', level,
text: args.map(a => { try { return typeof a === 'object' ? JSON.stringify(a) : String(a); } catch { return String(a); } }).join(' ')
});
} catch {}
orig[level].apply(console, args);
};
}
console.log = hook('log');
console.warn = hook('warn');
console.error = hook('error');
console.info = hook('info');
window.addEventListener('error', e => {
try { chrome.runtime.sendMessage({ type: 'CONSOLE_LOG', level: 'error', text: `${e.message} @ ${e.filename}:${e.lineno}` }); } catch {}
});
window.addEventListener('unhandledrejection', e => {
try { chrome.runtime.sendMessage({ type: 'CONSOLE_LOG', level: 'error', text: 'Unhandled: ' + e.reason }); } catch {}
});
})();