/**
* adowire client — HTTP connection layer
*
* Handles POSTing component commit payloads to the server and returning
* the parsed JSON response.
*
* Supports two modes:
* 1. **Standard JSON** — single POST → JSON response (default).
* 2. **SSE streaming** — POST with `Accept: text/event-stream` so the
* server can push `$stream()` chunks in real-time (word-by-word AI
* output, progress updates, etc.). The final component response is
* delivered as the last SSE event.
*/
import type { WireRequestPayload, WireResponse, WireStream } from './types.js';
/**
* Callback invoked for every real-time stream chunk the server pushes
* over the SSE connection.
*/
export type StreamChunkCallback = (chunk: WireStream) => void;
export declare class Connection {
/** Resolve the adowire message endpoint at call-time. */
private static get endpoint();
/** Read the CSRF token from the `` tag. */
private static get csrfToken();
/** Build the common request headers. */
private static baseHeaders;
/**
* POST the given payload to the adowire message endpoint and return the
* parsed response.
*
* This is the non-streaming path — all effects (including any buffered
* `$stream` chunks) arrive together in one JSON body.
*/
static request(payload: WireRequestPayload): Promise;
/**
* POST the payload requesting an SSE (`text/event-stream`) response.
*
* The server will push zero or more `event: stream` frames (each carrying
* a single `WireStream` chunk) followed by exactly one `event: response`
* frame with the full `WireResponse` JSON.
*
* @param payload The standard adowire request payload.
* @param onStream Called **synchronously** for every stream chunk the
* server pushes. The callback should append/replace the
* content into the matching `[adowire:stream]` element.
* @returns The final `WireResponse` (snapshot + effects + HTML).
*/
static requestStreaming(payload: WireRequestPayload, onStream: StreamChunkCallback): Promise;
/**
* Read the SSE body from `response`, dispatch stream chunks via
* `onStream`, and resolve with the final `WireResponse`.
*/
private static parseSSE;
}