Files
plan-tools/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.d.ts
Taylor Eernisse e7882b917b 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>
2026-02-07 16:16:41 -05:00

49 lines
2.1 KiB
TypeScript

import { QuickJSContext } from "./context";
import { QuickJSAsyncEmscriptenModule } from "./emscripten-types";
import { QuickJSAsyncFFI } from "./variants";
import { JSRuntimePointer } from "./types-ffi";
import { Lifetime } from "./lifetime";
import { QuickJSModuleCallbacks } from "./module";
import { QuickJSAsyncRuntime } from "./runtime-asyncify";
import { ContextEvalOptions, QuickJSHandle } from "./types";
import { VmCallResult } from "./vm-interface";
export type AsyncFunctionImplementation = (this: QuickJSHandle, ...args: QuickJSHandle[]) => Promise<QuickJSHandle | VmCallResult<QuickJSHandle> | void>;
/**
* Asyncified version of [[QuickJSContext]].
*
* *Asyncify* allows normally synchronous code to wait for asynchronous Promises
* or callbacks. The asyncified version of QuickJSContext can wait for async
* host functions as though they were synchronous.
*/
export declare class QuickJSAsyncContext extends QuickJSContext {
runtime: QuickJSAsyncRuntime;
/** @private */
protected module: QuickJSAsyncEmscriptenModule;
/** @private */
protected ffi: QuickJSAsyncFFI;
/** @private */
protected rt: Lifetime<JSRuntimePointer>;
/** @private */
protected callbacks: QuickJSModuleCallbacks;
/**
* Asyncified version of [[evalCode]].
*/
evalCodeAsync(code: string, filename?: string,
/** See [[EvalFlags]] for number semantics */
options?: number | ContextEvalOptions): Promise<VmCallResult<QuickJSHandle>>;
/**
* Similar to [[newFunction]].
* Convert an async host Javascript function into a synchronous QuickJS function value.
*
* Whenever QuickJS calls this function, the VM's stack will be unwound while
* waiting the async function to complete, and then restored when the returned
* promise resolves.
*
* Asyncified functions must never call other asyncified functions or
* `import`, even indirectly, because the stack cannot be unwound twice.
*
* See [Emscripten's docs on Asyncify](https://emscripten.org/docs/porting/asyncify.html).
*/
newAsyncifiedFunction(name: string, fn: AsyncFunctionImplementation): QuickJSHandle;
}