import type { CDPClient } from './cdp.js';
import { type RefNode } from './refs.js';
/**
 * File upload strategies for `agents browser upload`.
 *
 * Every uploader on the web is one of three patterns:
 *
 *   A. Direct file input — the page exposes (or hides) `<input type=file>`.
 *      `DOM.setFileInputFiles` plants the paths directly. The cleanest
 *      path; works whenever the input is in the DOM, even when CSS-hidden
 *      or visually offscreen.
 *
 *   B. Drag-drop target — the page listens for `drop` events on a region
 *      (Canva, Notion, Linear, GitHub PRs). We dispatch synthetic
 *      `dragenter`/`dragover`/`drop` events with a `DataTransfer` whose
 *      `files` list carries a `File` built from disk bytes. The dispatch
 *      uses real elementFromPoint coordinates so React/DOM listeners fire.
 *
 *   C. Native chooser interception — the user clicks a button that calls
 *      `input.click()` and the only file input is dynamically created in
 *      response. `Page.setInterceptFileChooserDialog` flips the chooser
 *      from a blocking OS dialog into a CDP event; we click the trigger,
 *      wait for `Page.fileChooserOpened`, then satisfy it with
 *      `Page.handleFileChooser({ action: 'accept', files })`. Lifecycle:
 *      enable interception -> click -> wait -> accept -> disable.
 */
export interface UploadOptions {
    files: string[];
}
export declare function getUploadStagingDir(): string;
export declare function stageUploadFile(source: string): string;
/** Pattern A — direct file input via `DOM.setFileInputFiles`. */
export declare function uploadToFileInput(cdp: CDPClient, sessionId: string, backendNodeId: number, files: string[]): Promise<void>;
/** Pattern B — synthetic drag-drop onto a target node. */
export declare function uploadToDropTarget(cdp: CDPClient, sessionId: string, backendNodeId: number, files: string[]): Promise<void>;
/**
 * Pattern C — click a trigger, intercept the OS file chooser, feed files.
 *
 * `Page.setInterceptFileChooserDialog` must be enabled before the click; the
 * chooser only fires once, so we register a single-shot handler ahead of time.
 * Auto-attached child sessions matter here: the chooser event arrives on the
 * session whose page hosts the input, which is the same session we used for
 * the click — so we filter event params by sessionId.
 */
export declare function uploadViaFileChooser(cdp: CDPClient, sessionId: string, triggerRef: {
    node: RefNode;
    nodeMap: Map<number, RefNode>;
}, files: string[], timeoutMs?: number): Promise<void>;
export declare function mimeFromExt(filePath: string): string;
/**
 * Inspect a ref's DOM node to decide which pattern fits when the caller
 * didn't specify. Returns 'input' if the node is `<input type=file>`,
 * otherwise 'drop'. Chooser interception (Pattern C) is never auto-selected
 * because it requires clicking the ref, which mutates page state — opt-in only.
 */
export declare function detectUploadPattern(cdp: CDPClient, sessionId: string, backendNodeId: number): Promise<'input' | 'drop'>;
