/**
 * Agent Worker Process
 *
 * Standalone Node.js child process that wraps AgentRunnerService for
 * isolated agent execution. Communicates with the parent process via
 * IPC messages (Node.js child_process.fork() protocol).
 *
 * This enables hot-reload of agent code without restarting the main
 * backend process, and crash isolation so a worker failure doesn't
 * bring down the server.
 *
 * @module services/agent/crewly-agent/agent-worker
 */
import type { CrewlyAgentConfig, AgentRunResult } from './types.js';
/**
 * Messages sent from the parent process to this worker.
 */
export type ParentMessage = {
    type: 'init';
    config: CrewlyAgentConfig;
} | {
    type: 'run';
    message: string;
    conversationId?: string;
    metadata?: Record<string, string>;
} | {
    type: 'abort';
} | {
    type: 'get-state';
} | {
    type: 'shutdown';
};
/**
 * Messages sent from this worker to the parent process.
 */
export type WorkerMessage = {
    type: 'ready';
} | {
    type: 'result';
    data: AgentRunResult;
} | {
    type: 'error';
    error: string;
    code?: string;
} | {
    type: 'log';
    level: 'debug' | 'info' | 'warn' | 'error';
    message: string;
} | {
    type: 'stream';
    event: 'text';
    data: {
        chunk: string;
    };
} | {
    type: 'stream';
    event: 'toolStart';
    data: {
        toolName: string;
        args: Record<string, unknown>;
    };
} | {
    type: 'stream';
    event: 'toolFinish';
    data: {
        toolName: string;
        args: Record<string, unknown>;
        result: unknown;
        durationMs: number;
    };
} | {
    type: 'stream';
    event: 'stepFinish';
    data: {
        stepIndex: number;
        hasToolCalls: boolean;
    };
} | {
    type: 'state';
    data: {
        historyLength: number;
        isProcessing: boolean;
        isInitialized: boolean;
    };
};
//# sourceMappingURL=agent-worker.d.ts.map