/**
 * Container Execution Protocol — standard contract for running automations
 * inside containers or as local binaries.
 *
 * Contract:
 *
 *   Input (via env vars):
 *     VAUBAN_EXECUTION_ID    — unique execution identifier (UUID)
 *     VAUBAN_AUTOMATION_NAME — automation name (kebab-case)
 *     VAUBAN_INPUT           — JSON-encoded input parameters
 *     VAUBAN_TIMEOUT         — timeout in seconds
 *     VAUBAN_MODE            — execution mode (default: "execute")
 *
 *   Output (via stdout, last non-empty line, JSON):
 *     { "status": "completed", "output": <any> }
 *     { "status": "failed", "error": { "code": "...", "message": "...", "details"?: <any> } }
 *
 *   Diagnostics (via stderr, optional, one JSON object per line):
 *     { "level": "info", "message": "...", "timestamp": "..." }
 *     { "progress": 0.5, "message": "..." }
 *
 * @public @since 1.2.0
 */
/**
 * Reserved environment variable names. All caller env merged on top must NOT
 * shadow these keys, or the automation's view of its own context becomes
 * undefined.
 *
 * @public
 */
export declare const PROTOCOL_ENV: {
    readonly EXECUTION_ID: "VAUBAN_EXECUTION_ID";
    readonly AUTOMATION_NAME: "VAUBAN_AUTOMATION_NAME";
    readonly INPUT: "VAUBAN_INPUT";
    readonly TIMEOUT: "VAUBAN_TIMEOUT";
    readonly MODE: "VAUBAN_MODE";
};
/**
 * Default protocol mode set when caller does not specify one.
 * @public
 */
export declare const DEFAULT_PROTOCOL_MODE = "execute";
/**
 * Final status reported by a container/binary on stdout.
 * @public
 */
export type ProtocolStatus = "completed" | "failed";
/**
 * Discriminated union of protocol outputs parsed from stdout.
 * @public
 */
export type ProtocolResult<T = unknown> = {
    readonly status: "completed";
    readonly output: T;
} | {
    readonly status: "failed";
    readonly error: {
        readonly code: string;
        readonly message: string;
        readonly details?: unknown;
    };
};
/**
 * Outcome of an execution attempt, combining protocol result with timing,
 * captured logs, and propagated metadata.
 *
 * @public
 */
export interface ExecutionResult<T = unknown> {
    readonly executionId: string;
    readonly automationName: string;
    readonly status: "completed" | "failed" | "timeout";
    readonly input: unknown;
    readonly output?: T;
    readonly error?: {
        code: string;
        message: string;
        details?: unknown;
    };
    readonly startedAt: Date;
    readonly completedAt: Date;
    readonly durationMs: number;
    readonly logs: ReadonlyArray<{
        readonly level: string;
        readonly message: string;
        readonly timestamp: string;
    }>;
}
/**
 * Thrown when stdout does not contain a parseable protocol result on its last
 * non-empty line.
 *
 * @public
 */
export declare class ProtocolParseError extends Error {
    readonly rawTail: string;
    constructor(reason: string, rawTail: string);
}
/**
 * Build the protocol's environment variables. Caller `extraEnv` is merged
 * AFTER protocol env, so it cannot accidentally override reserved keys.
 *
 * @public
 */
export declare function buildProtocolEnv(args: {
    executionId: string;
    automationName: string;
    input: unknown;
    timeoutSeconds: number;
    mode?: string;
    extraEnv?: Readonly<Record<string, string>>;
}): Record<string, string>;
/**
 * Parse the last non-empty line of stdout as a {@link ProtocolResult}.
 *
 * @throws {@link ProtocolParseError} when stdout is empty, has no JSON tail,
 *   or the JSON does not match the protocol shape.
 *
 * @public
 */
export declare function parseProtocolOutput<T = unknown>(stdout: string): ProtocolResult<T>;
/**
 * Parse stderr lines as JSON log entries when possible; fall back to plain
 * text wrapped at level "info". Used by {@link ContainerRuntime} to populate
 * `ExecutionResult.logs`.
 *
 * @public
 */
export declare function parseStderrLogs(stderr: string): Array<{
    level: string;
    message: string;
    timestamp: string;
}>;
//# sourceMappingURL=protocol.d.ts.map