"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.applyToolOutputRedaction = applyToolOutputRedaction;
const toolOutputRedaction_1 = require("./toolOutputRedaction");
function applyToolOutputRedaction(messages) {
    return messages.map((msg) => {
        if (msg.role !== "assistant")
            return msg;
        const newParts = msg.parts.map((part) => {
            if (part.type !== "dynamic-tool")
                return part;
            const toolPart = part;
            if (toolPart.state !== "output-available")
                return part;
            const redacted = {
                ...toolPart,
                output: (0, toolOutputRedaction_1.redactToolOutput)(toolPart.toolName, toolPart.output),
            };
            return redacted;
        });
        return {
            ...msg,
            parts: newParts,
        };
    });
}
//# sourceMappingURL=applyToolOutputRedaction.js.map