/**
 * AgentRuntime — interface for runtime implementations.
 *
 * Each runtime wraps a specific Kimi/provider invocation mode.
 */
export function toTaskResult(result) {
    return {
        success: result.success,
        exitCode: result.exitCode,
        stdout: result.stdout,
        stderr: result.stderr,
        metadata: {
            ...result.metadata,
            ...(result.tokenUsage != null && { tokenUsage: result.tokenUsage }),
            ...(result.toolCalls != null && result.toolCalls.length > 0 && { toolCalls: result.toolCalls }),
        },
    };
}
