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>
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { Script } from '../../../protocol/protocol.js';
|
|
import { type LoggerFn } from '../../../utils/log.js';
|
|
import type { EventManager } from '../session/EventManager.js';
|
|
import type { Realm } from './Realm.js';
|
|
/**
|
|
* Used to send messages from realm to BiDi user.
|
|
*/
|
|
export declare class ChannelProxy {
|
|
#private;
|
|
constructor(channel: Script.ChannelProperties, logger?: LoggerFn);
|
|
/**
|
|
* Creates a channel proxy in the given realm, initialises listener and
|
|
* returns a handle to `sendMessage` delegate.
|
|
*/
|
|
init(realm: Realm, eventManager: EventManager): Promise<Script.Handle>;
|
|
/** Gets a ChannelProxy from window and returns its handle. */
|
|
startListenerFromWindow(realm: Realm, eventManager: EventManager): Promise<void>;
|
|
/**
|
|
* String to be evaluated to create a ProxyChannel and put it to window.
|
|
* Returns the delegate `sendMessage`. Used to provide an argument for preload
|
|
* script. Does the following:
|
|
* 1. Creates a ChannelProxy.
|
|
* 2. Puts the ChannelProxy to window['${this.#id}'] or resolves the promise
|
|
* by calling delegate stored in window['${this.#id}'].
|
|
* This is needed because `#getHandleFromWindow` can be called before or
|
|
* after this method.
|
|
* 3. Returns the delegate `sendMessage` of the created ChannelProxy.
|
|
*/
|
|
getEvalInWindowStr(): string;
|
|
}
|