/**
 * Worker-port protocol — the structured-clone-safe message channel between
 * the worker-side runtime controller and the main-thread client adapter.
 * Owns request/response correlation and the abort-side detachment rule for
 * results that arrive after the requesting tool has been cancelled.
 */
import { type AgentEvent } from '../../contracts/agent-api.js';
import type { HostToolExecutor, ToolRegistry } from '../../contracts/host-tool-api.js';
import { type WorkerMessage } from '../../contracts/wire.js';
import type { EmbeddedAgentDispatch } from './dispatch.js';
type WorkerMessageEvent = {
    data: unknown;
};
type WorkerMessageListener = (event: WorkerMessageEvent) => void;
/** Minimal `MessagePort`-shaped surface; both `Worker` and `MessagePort` satisfy it. */
export interface WorkerPort {
    postMessage(message: WorkerMessage): void;
    addEventListener(type: 'message', listener: WorkerMessageListener): void;
    removeEventListener(type: 'message', listener: WorkerMessageListener): void;
    start?(): void;
}
/** Lifecycle handle for any port attachment. */
export interface WorkerPortBinding {
    dispose(): void;
}
/** Binding plus the `HostToolExecutor` that forwards requests over the port. */
export interface WorkerPortHostToolExecutorBinding extends WorkerPortBinding {
    hostToolExecutor: HostToolExecutor;
}
/** Wiring options for `createWorkerPortHostToolExecutorWithOptions`. */
export interface WorkerPortHostToolExecutorOptions {
    onProtocolError?: (event: AgentEvent) => void;
    registry: ToolRegistry;
}
/** Convenience constructor without protocol-error reporting. */
export declare function createWorkerPortHostToolExecutor(port: WorkerPort, registry: ToolRegistry): WorkerPortHostToolExecutorBinding;
/** Build a `HostToolExecutor` that ferries requests over `port` and resolves on response. */
export declare function createWorkerPortHostToolExecutorWithOptions(port: WorkerPort, options: WorkerPortHostToolExecutorOptions): WorkerPortHostToolExecutorBinding;
/** Pump runtime events out and `AgentCommand`s in across the worker port. */
export declare function attachEmbeddedAgentDispatchToWorkerPort(port: WorkerPort, controller: EmbeddedAgentDispatch, registry: ToolRegistry): WorkerPortBinding;
export {};
//# sourceMappingURL=worker-port.d.ts.map