import { semanticDigest } from "@best-agent/foundation";
export function computeRequestDigest(input) {
    return semanticDigest({
        messages: input.messages.map((message) => ({
            role: message.role,
            content: message.content,
            toolName: "toolName" in message ? message.toolName : undefined,
            toolCallId: "toolCallId" in message ? message.toolCallId : undefined,
            toolCalls: "toolCalls" in message ? message.toolCalls : undefined,
            outcome: "outcome" in message ? message.outcome : undefined,
        })),
        systemPrompt: input.systemPrompt ?? "",
        tools: input.tools?.map((tool) => ({
            name: tool.name,
            inputSchema: tool.inputSchema,
        })) ?? [],
        phaseResultPhaseName: input.phaseResultPhaseName,
    }).slice(0, 16);
}
export function createStableCorrectionTraceId(input) {
    return semanticDigest({
        code: input.code,
        operation: input.operation,
        requestDigest: input.requestDigest,
        type: "provider-correction-trace",
    }).slice(0, 16);
}
//# sourceMappingURL=provider-request-digest.js.map