export function getLoadedCostLimitExceeded(agentData) {
    if (!agentData.costLimit) {
        return null;
    }
    const costLimitMessage = (agentData.messages || []).find((msg) => msg.role === "assistant" &&
        typeof msg.content === "string" &&
        msg.content.includes("Cost limit") &&
        msg.content.includes("Current cost:"));
    if (costLimitMessage?.content) {
        const match = costLimitMessage.content.match(/Current cost: \$([0-9.]+)/);
        const totalCost = match && match[1] ? parseFloat(match[1]) : agentData.totalCost || 0;
        return {
            totalCost,
            costLimit: agentData.costLimit,
            initialCostLimit: agentData.costLimit,
        };
    }
    if (agentData.totalCost && agentData.totalCost > agentData.costLimit) {
        return {
            totalCost: agentData.totalCost,
            costLimit: agentData.costLimit,
            initialCostLimit: agentData.costLimit,
        };
    }
    return null;
}
//# sourceMappingURL=agentSessionCostLimit.js.map