import { applyChatProcessedRequestWithNative, buildChatNodeResultMetadataWithNative } from '../../../router/virtual-router/engine-selection/native-chat-process-node-result-semantics.js';
export function buildProcessedRequest(request) {
    const timestamp = Date.now();
    return applyChatProcessedRequestWithNative(request, timestamp);
}
export function buildSuccessResult(startTime, processedRequest) {
    const endTime = Date.now();
    const metadata = buildChatNodeResultMetadataWithNative(startTime, endTime, processedRequest.messages.length, processedRequest.tools?.length ?? 0, true);
    return {
        success: true,
        metadata: metadata
    };
}
export function buildErrorResult(startTime, error) {
    const endTime = Date.now();
    const metadata = buildChatNodeResultMetadataWithNative(startTime, endTime, 0, 0, false);
    return {
        success: false,
        metadata: metadata,
        error: {
            message: error instanceof Error ? error.message : String(error)
        }
    };
}
