import { semanticDigest } from "@best-agent/foundation";
export function countToolErrorsSinceLastUser(messages) {
    let count = 0;
    for (const message of messages) {
        if (message.role === "user") {
            count = 0;
            continue;
        }
        if (message.role === "tool" && message.outcome === "error") {
            count += 1;
        }
    }
    return count;
}
export function semanticToolInputDigest(value) {
    return semanticDigest(value);
}
export function completedToolCallStableInputDigest(call) {
    return call.inputStableDigest ?? call.inputDigest;
}
//# sourceMappingURL=provider-tool-repeat-guard.js.map