Add Brave CDP automation, replace Oracle browser mode

Connects to user's running Brave via Chrome DevTools Protocol
to automate ChatGPT interaction. Uses puppeteer-core to open a
tab, send the prompt, wait for response, and extract the result.

No cookies, no separate profiles, no copy/paste. Just connects
to the browser where the user is already logged in.

One-time setup: relaunch Brave with --remote-debugging-port=9222

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Taylor Eernisse
2026-02-07 16:16:41 -05:00
parent d776a266a8
commit e7882b917b
4163 changed files with 782828 additions and 148 deletions

View File

@@ -0,0 +1,27 @@
/**
* Copyright 2025 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { CdpClient } from '../../../cdp/CdpClient.js';
import { type WebExtension, type EmptyResult } from '../../../protocol/protocol.js';
/**
* Responsible for handling the `webModule` module.
*/
export declare class WebExtensionProcessor {
#private;
constructor(browserCdpClient: CdpClient);
install(params: WebExtension.InstallParameters): Promise<WebExtension.InstallResult>;
uninstall(params: WebExtension.UninstallParameters): Promise<EmptyResult>;
}

View File

@@ -0,0 +1,69 @@
"use strict";
/**
* Copyright 2025 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.WebExtensionProcessor = void 0;
const protocol_js_1 = require("../../../protocol/protocol.js");
/**
* Responsible for handling the `webModule` module.
*/
class WebExtensionProcessor {
#browserCdpClient;
constructor(browserCdpClient) {
this.#browserCdpClient = browserCdpClient;
}
async install(params) {
switch (params.extensionData.type) {
case 'archivePath':
case 'base64':
throw new protocol_js_1.UnsupportedOperationException('Archived and Base64 extensions are not supported');
case 'path':
break;
}
try {
const response = await this.#browserCdpClient.sendCommand('Extensions.loadUnpacked', {
path: params.extensionData.path,
});
return {
extension: response.id,
};
}
catch (err) {
if (err.message.startsWith('invalid web extension')) {
throw new protocol_js_1.InvalidWebExtensionException(err.message);
}
throw err;
}
}
async uninstall(params) {
try {
await this.#browserCdpClient.sendCommand('Extensions.uninstall', {
id: params.extension,
});
return {};
}
catch (err) {
if (err.message ===
'Uninstall failed. Reason: could not find extension.') {
throw new protocol_js_1.NoSuchWebExtensionException('no such web extension');
}
throw err;
}
}
}
exports.WebExtensionProcessor = WebExtensionProcessor;
//# sourceMappingURL=WebExtensionProcessor.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"WebExtensionProcessor.js","sourceRoot":"","sources":["../../../../../src/bidiMapper/modules/webExtension/WebExtensionProcessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAGH,+DAMuC;AAEvC;;GAEG;AACH,MAAa,qBAAqB;IACvB,iBAAiB,CAAY;IAEtC,YAAY,gBAA2B;QACrC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAsC;QAEtC,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;YAClC,KAAK,aAAa,CAAC;YACnB,KAAK,QAAQ;gBACX,MAAM,IAAI,2CAA6B,CACrC,kDAAkD,CACnD,CAAC;YACJ,KAAK,MAAM;gBACT,MAAM;QACV,CAAC;QACD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,W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