"use strict";
// =============================================================================
// Pure Agent - Transport Types
// Ported from Hermes agent/transports/types.py
// =============================================================================
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildToolCall = buildToolCall;
exports.emptyUsage = emptyUsage;
exports.mapFinishReason = mapFinishReason;
function buildToolCall(id, name, argumentsInput) {
    const argsStr = typeof argumentsInput === 'string'
        ? argumentsInput
        : JSON.stringify(argumentsInput || {});
    return {
        id,
        name,
        arguments: argsStr,
        type: 'function',
        function: { name, arguments: argsStr },
    };
}
function emptyUsage() {
    return { promptTokens: 0, completionTokens: 0, totalTokens: 0, cachedTokens: 0 };
}
// ---------------------------------------------------------------------------
// Finish reason mapping
// ---------------------------------------------------------------------------
function mapFinishReason(reason, mapping) {
    if (!reason)
        return 'stop';
    if (mapping && mapping[reason])
        return mapping[reason];
    // Default OpenAI reasons pass through
    if (['stop', 'tool_calls', 'length', 'content_filter'].includes(reason))
        return reason;
    return 'stop';
}
//# sourceMappingURL=types.js.map