"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createAgenticaHistory = createAgenticaHistory;
function createAgenticaHistory(props) {
    if (props.history.type === "userMessage")
        return Object.assign(Object.assign({}, props.history), { toJSON: () => props.history });
    else if (props.history.type === "assistantMessage")
        return Object.assign(Object.assign({}, props.history), { toJSON: () => props.history });
    const operation = props.operations.find((op) => op.function.name === props.history.type);
    if (operation === undefined)
        return null;
    const partial = {
        id: props.history.id,
        created_at: props.history.created_at,
        type: "execute",
        arguments: {
            instruction: props.history.instruction,
        },
        value: {
            success: props.history.type === "analyze" || props.history.type === "interface"
                ? true
                : props.history.compiled.type === "success",
        },
        success: true,
    };
    return Object.assign(Object.assign({}, partial), { protocol: operation.protocol, operation: operation, toJSON: () => (Object.assign(Object.assign({}, partial), { protocol: operation.protocol, operation: operation.toJSON() })) });
}
//# sourceMappingURL=createAgenticaHistory.js.map