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

62
node_modules/proxy-agent/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
/// <reference types="node" />
import * as http from 'http';
import LRUCache from 'lru-cache';
import { Agent, AgentConnectOpts } from 'agent-base';
import type { PacProxyAgent, PacProxyAgentOptions } from 'pac-proxy-agent';
import type { HttpProxyAgent, HttpProxyAgentOptions } from 'http-proxy-agent';
import type { HttpsProxyAgent, HttpsProxyAgentOptions } from 'https-proxy-agent';
import type { SocksProxyAgent, SocksProxyAgentOptions } from 'socks-proxy-agent';
type ValidProtocol = (typeof HttpProxyAgent.protocols)[number] | (typeof HttpsProxyAgent.protocols)[number] | (typeof SocksProxyAgent.protocols)[number] | (typeof PacProxyAgent.protocols)[number];
type AgentConstructor = new (proxy: string, proxyAgentOptions?: ProxyAgentOptions) => Agent;
type GetProxyForUrlCallback = (url: string, req: http.ClientRequest) => string | Promise<string>;
/**
* Supported proxy types.
*/
export declare const proxies: {
[P in ValidProtocol]: [
() => Promise<AgentConstructor>,
() => Promise<AgentConstructor>
];
};
export type ProxyAgentOptions = HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & PacProxyAgentOptions<''> & {
/**
* Default `http.Agent` instance to use when no proxy is
* configured for a request. Defaults to a new `http.Agent()`
* instance with the proxy agent options passed in.
*/
httpAgent?: http.Agent;
/**
* Default `http.Agent` instance to use when no proxy is
* configured for a request. Defaults to a new `https.Agent()`
* instance with the proxy agent options passed in.
*/
httpsAgent?: http.Agent;
/**
* A callback for dynamic provision of proxy for url.
* Defaults to standard proxy environment variables,
* see https://www.npmjs.com/package/proxy-from-env for details
*/
getProxyForUrl?: GetProxyForUrlCallback;
};
/**
* Uses the appropriate `Agent` subclass based off of the "proxy"
* environment variables that are currently set.
*
* An LRU cache is used, to prevent unnecessary creation of proxy
* `http.Agent` instances.
*/
export declare class ProxyAgent extends Agent {
/**
* Cache for `Agent` instances.
*/
cache: LRUCache<string, Agent>;
connectOpts?: ProxyAgentOptions;
httpAgent: http.Agent;
httpsAgent: http.Agent;
getProxyForUrl: GetProxyForUrlCallback;
constructor(opts?: ProxyAgentOptions);
connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<http.Agent>;
destroy(): void;
}
export {};
//# sourceMappingURL=index.d.ts.map

1
node_modules/proxy-agent/dist/index.d.ts.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EACX,eAAe,EACf,sBAAsB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACX,eAAe,EACf,sBAAsB,EACtB,MAAM,mBAAmB,CAAC;AAI3B,KAAK,aAAa,GACf,CAAC,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GACzC,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAC1C,CAAC,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC,MAAM,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I;CAMf"}

138
node_modules/proxy-agent/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,138 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProxyAgent = exports.proxies = void 0;
const http = __importStar(require("http"));
const https = __importStar(require("https"));
const url_1 = require("url");
const lru_cache_1 = __importDefault(require("lru-cache"));
const agent_base_1 = require("agent-base");
const debug_1 = __importDefault(require("debug"));
const proxy_from_env_1 = require("proxy-from-env");
const debug = (0, debug_1.default)('proxy-agent');
/**
* Shorthands for built-in supported types.
* Lazily loaded since some of these imports can be quite expensive
* (in particular, pac-proxy-agent).
*/
const wellKnownAgents = {
http: async () => (await Promise.resolve().then(() => __importStar(require('http-proxy-agent')))).HttpProxyAgent,
https: async () => (await Promise.resolve().then(() => __importStar(require('https-proxy-agent')))).HttpsProxyAgent,
socks: async () => (await Promise.resolve().then(() => __importStar(require('socks-proxy-agent')))).SocksProxyAgent,
pac: async () => (await Promise.resolve().then(() => __importStar(require('pac-proxy-agent')))).PacProxyAgent,
};
/**
* Supported proxy types.
*/
exports.proxies = {
http: [wellKnownAgents.http, wellKnownAgents.https],
https: [wellKnownAgents.http, wellKnownAgents.https],
socks: [wellKnownAgents.socks, wellKnownAgents.socks],
socks4: [wellKnownAgents.socks, wellKnownAgents.socks],
socks4a: [wellKnownAgents.socks, wellKnownAgents.socks],
socks5: [wellKnownAgents.socks, wellKnownAgents.socks],
socks5h: [wellKnownAgents.socks, wellKnownAgents.socks],
'pac+data': [wellKnownAgents.pac, wellKnownAgents.pac],
'pac+file': [wellKnownAgents.pac, wellKnownAgents.pac],
'pac+ftp': [wellKnownAgents.pac, wellKnownAgents.pac],
'pac+http': [wellKnownAgents.pac, wellKnownAgents.pac],
'pac+https': [wellKnownAgents.pac, wellKnownAgents.pac],
};
function isValidProtocol(v) {
return Object.keys(exports.proxies).includes(v);
}
/**
* Uses the appropriate `Agent` subclass based off of the "proxy"
* environment variables that are currently set.
*
* An LRU cache is used, to prevent unnecessary creation of proxy
* `http.Agent` instances.
*/
class ProxyAgent extends agent_base_1.Agent {
constructor(opts) {
super(opts);
/**
* Cache for `Agent` instances.
*/
this.cache = new lru_cache_1.default({
max: 20,
dispose: (agent) => agent.destroy(),
});
debug('Creating new ProxyAgent instance: %o', opts);
this.connectOpts = opts;
this.httpAgent = opts?.httpAgent || new http.Agent(opts);
this.httpsAgent =
opts?.httpsAgent || new https.Agent(opts);
this.getProxyForUrl = opts?.getProxyForUrl || proxy_from_env_1.getProxyForUrl;
}
async connect(req, opts) {
const { secureEndpoint } = opts;
const isWebSocket = req.getHeader('upgrade') === 'websocket';
const protocol = secureEndpoint
? isWebSocket
? 'wss:'
: 'https:'
: isWebSocket
? 'ws:'
: 'http:';
const host = req.getHeader('host');
const url = new url_1.URL(req.path, `${protocol}//${host}`).href;
const proxy = await this.getProxyForUrl(url, req);
if (!proxy) {
debug('Proxy not enabled for URL: %o', url);
return secureEndpoint ? this.httpsAgent : this.httpAgent;
}
debug('Request URL: %o', url);
debug('Proxy URL: %o', proxy);
// attempt to get a cached `http.Agent` instance first
const cacheKey = `${protocol}+${proxy}`;
let agent = this.cache.get(cacheKey);
if (!agent) {
const proxyUrl = new url_1.URL(proxy);
const proxyProto = proxyUrl.protocol.replace(':', '');
if (!isValidProtocol(proxyProto)) {
throw new Error(`Unsupported protocol for proxy URL: ${proxy}`);
}
const ctor = await exports.proxies[proxyProto][secureEndpoint || isWebSocket ? 1 : 0]();
agent = new ctor(proxy, this.connectOpts);
this.cache.set(cacheKey, agent);
}
else {
debug('Cache hit for proxy URL: %o', proxy);
}
return agent;
}
destroy() {
for (const agent of this.cache.values()) {
agent.destroy();
}
super.destroy();
}
}
exports.ProxyAgent = ProxyAgent;
//# sourceMappingURL=index.js.map

1
node_modules/proxy-agent/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAC/B,6BAA0B;AAC1B,0DAAiC;AACjC,2CAAqD;AACrD,kDAAgC;AAChC,mDAAqE;AAYrE,MAAM,KAAK,GAAG,IAAA,eAAW,EAAC,aAAa,CAAC,CAAC;AAkBzC;;;;GAIG;AACH,MAAM,eAAe,GAAG;IACvB,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,wDAAa,kBAAkB,GAAC,CAAC,CAAC,cAAc;IACnE,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,wDAAa,mBAAmB,GAAC,CAAC,CAAC,eAAe;IACtE,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,wDAAa,mBAAmB,GAAC,CAAC,CAAC,eAAe;IACtE,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,wDAAa,iBAAiB,GAAC,CAAC,CAAC,aAAa;CACvD,CAAC;AAEX;;GAEG;AACU,QAAA,OAAO,GAKhB;IACH,IAAI,EAAE,CAAC,eAAe,CAAC,IAA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