import http from "node:http";
import type { IncomingMessage } from "node:http";
import type { RunnerSelfSeat } from "../core/runner/contracts.js";
import type { ImageInput, TaskSpec } from "../core/types.js";
/** Inbound request body. Tool *code* can never come over the wire — the server injects tools via resolveSpec. */
export interface TaskRequestBody {
    objective: string;
    sessionId?: string;
    images?: ImageInput[];
    [key: string]: unknown;
}
export interface TaskServerOptions {
    runner: RunnerSelfSeat;
    /**
     * Map an inbound request body to a full TaskSpec. This is where the SERVER decides the model,
     * tools, MCP servers, system prompt, and limits for the request. The body only supplies content
     * (objective / sessionId / images), never executable tools.
     */
    resolveSpec: (body: TaskRequestBody, req: IncomingMessage) => TaskSpec | Promise<TaskSpec>;
    /** Optional authorization gate. Return false to reject with 401. */
    authorize?: (req: IncomingMessage) => boolean | Promise<boolean>;
    /** CORS allow-origin (e.g. "*"). Omit to disable CORS headers. */
    corsOrigin?: string;
    /** Max request body bytes. Default 5 MiB. */
    maxBodyBytes?: number;
}
/**
 * Create an HTTP server exposing the runner over two endpoints:
 *   POST /task          → run to completion, returns TaskResult JSON
 *   POST /task/stream   → Server-Sent Events of TaskEvent (text_delta / text_end / reasoning_delta / tool_* / done)
 *
 * The request body provides { objective, sessionId?, images? }; `resolveSpec` supplies the rest
 * (model, tools, mcp, systemPrompt, limits) server-side.
 */
export declare function createTaskServer(opts: TaskServerOptions): http.Server;
