/**
 * RelayAdapter — high-level interface over the broker SDK.
 *
 * Wraps AgentRelayClient with auto-start, safe result patterns,
 * and convenience methods. Usable by any integration: dashboard,
 * MCP, ACP bridge, CLI, or custom tooling.
 *
 * Usage:
 *   import { RelayAdapter } from '@agent-relay/sdk';
 *
 *   const relay = new RelayAdapter({ cwd: projectRoot });
 *   await relay.start();
 *
 *   await relay.spawn({ name: 'Worker1', cli: 'claude', task: 'Build auth' });
 *   const agents = await relay.listAgents();
 *   await relay.sendMessage({ to: 'Worker1', text: 'status?' });
 *   await relay.release('Worker1');
 *
 *   await relay.shutdown();
 */
import { AgentRelayClient } from './client.js';
import type { SendMessageInput } from './types.js';
import type { BrokerEvent, BrokerStats, BrokerStatus, CrashInsightsResponse } from './protocol.js';
export interface RelayAdapterOptions {
    /** Project root directory (required — the broker locks per project). */
    cwd: string;
    /** Path to the agent-relay binary. Falls back to bundled/PATH resolution. */
    binaryPath?: string;
    /** Default channels for spawned agents. */
    channels?: string[];
    /** Environment variables forwarded to the broker process. */
    env?: NodeJS.ProcessEnv;
}
export interface RelaySpawnRequest {
    name: string;
    cli: string;
    task?: string;
    team?: string;
    cwd?: string;
    model?: string;
    interactive?: boolean;
    shadowMode?: string;
    shadowOf?: string;
    shadowAgent?: string;
    shadowTriggers?: string;
    shadowSpeakOn?: string;
    spawnerName?: string;
    userId?: string;
    includeWorkflowConventions?: boolean;
}
export interface RelaySpawnResult {
    success: boolean;
    name: string;
    pid?: number;
    error?: string;
}
export interface RelayAgentInfo {
    name: string;
    cli?: string;
    pid?: number;
    channels: string[];
    parent?: string;
    runtime: string;
}
export interface RelayReleaseResult {
    success: boolean;
    name: string;
    error?: string;
}
export declare class RelayAdapter {
    private client;
    private started;
    private startPromise;
    private readonly spawnOpts;
    private readonly stderrListeners;
    private readonly pendingEventListeners;
    constructor(opts: RelayAdapterOptions);
    private ensureClient;
    /** Start the broker process. Idempotent — concurrent calls share one spawn. */
    start(): Promise<void>;
    private doStart;
    /** Shut down the broker and all spawned agents. */
    shutdown(): Promise<void>;
    /** Spawn an agent via the broker's PTY runtime. */
    spawn(req: RelaySpawnRequest): Promise<RelaySpawnResult>;
    /** Release (stop) a spawned agent. */
    release(name: string, reason?: string): Promise<RelayReleaseResult>;
    /** List all agents managed by this broker instance. */
    listAgents(): Promise<RelayAgentInfo[]>;
    /** Check if a specific agent is spawned. */
    hasAgent(name: string): Promise<boolean>;
    /** Get broker status (agent count, pending deliveries). */
    getStatus(): Promise<BrokerStatus>;
    /** Send a message to an agent or channel. */
    sendMessage(input: SendMessageInput): Promise<{
        event_id: string;
        targets: string[];
    }>;
    sendInput(name: string, data: string): Promise<void>;
    interruptAgent(name: string): Promise<boolean>;
    setModel(name: string, model: string, opts?: {
        timeoutMs?: number;
    }): Promise<{
        success: boolean;
        name: string;
        model: string;
    }>;
    getMetrics(agent?: string): Promise<{
        agents: Array<{
            name: string;
            pid: number;
            memory_bytes: number;
            uptime_secs: number;
        }>;
        broker?: BrokerStats;
    }>;
    getCrashInsights(): Promise<CrashInsightsResponse>;
    onEvent(listener: (event: BrokerEvent) => void): () => void;
    onStderr(listener: (line: string) => void): () => void;
    get raw(): AgentRelayClient;
}
//# sourceMappingURL=relay-adapter.d.ts.map