import { ShortcutXLLlmOperations } from './model-stream.js';
export const ShortcutXLModelCallTransportKind = {
    AnthropicMessages: 'anthropic_messages',
    OpenAICompletions: 'openai_completions',
    OpenAIResponses: 'openai_responses',
    ShortcutProxy: 'shortcut_proxy'
};
/**
 * Request types emitted by private-gateway usage logging.
 *
 * Includes normal LLM operations plus non-chat helper-tool usage and fallback
 * values that the server-v1 observability route accepts.
 */
export const ShortcutXLUsageLogRequestTypes = [
    ...ShortcutXLLlmOperations,
    'sandbox_llm',
    'screenshot',
    'subagent',
    'unknown'
];
export const ShortcutXLModelCallCapability = {
    ImageInput: 'image_input',
    JsonToolCalls: 'json_tool_calls',
    NonStreamingInvoke: 'non_streaming_invoke',
    ReasoningDeltas: 'reasoning_deltas',
    TextStreaming: 'text_streaming',
    ToolStreaming: 'tool_streaming'
};
export const ShortcutXLProviderUsageStatus = {
    CancelledUsageUnknown: 'cancelled_usage_unknown',
    Unavailable: 'unavailable',
    UsageAvailable: 'usage_available'
};
export const ShortcutXLUsageReportStatus = {
    Recorded: 'recorded',
    ReportFailed: 'report_failed'
};
export const ShortcutXLModelRequestTraceMode = {
    Disabled: 'disabled',
    Full: 'full',
    MetadataOnly: 'metadata_only'
};
export const ShortcutXLModelCallErrorCategory = {
    Auth: 'auth',
    Cancelled: 'cancelled',
    CapabilityUnsupported: 'capability_unsupported',
    Configuration: 'configuration',
    InvalidResponse: 'invalid_response',
    ProviderRejected: 'provider_rejected',
    RateLimited: 'rate_limited',
    TransientNetwork: 'transient_network',
    Unknown: 'unknown'
};
export function createShortcutXLModelCallError(category, message, options = {}) {
    return {
        category,
        message,
        ...options
    };
}
export class ShortcutXLModelCallErrorEnvelope extends Error {
    error;
    constructor(error) {
        super(error.message);
        this.name = 'ShortcutXLModelCallErrorEnvelope';
        this.error = error;
    }
}
export function toShortcutXLModelCallError(error, fallbackCategory = ShortcutXLModelCallErrorCategory.Unknown) {
    if (error instanceof ShortcutXLModelCallErrorEnvelope) {
        return error.error;
    }
    return createShortcutXLModelCallError(fallbackCategory, error instanceof Error ? error.message : String(error));
}
export function splitShortcutXLModelStreamRequest(request) {
    return {
        context: {
            agentMode: request.agentMode,
            fileAttachmentIds: request.fileAttachmentIds,
            initialFileId: request.initialFileId,
            interactionMode: request.interactionMode,
            llmOperation: request.llmOperation,
            requestId: request.requestId,
            speed: request.speed,
            userMessageId: request.userMessageId
        },
        payload: {
            effortLevel: request.effortLevel,
            maxTokens: request.maxTokens,
            messages: request.messages,
            model: request.model,
            thinkingType: request.thinkingType,
            tools: request.tools
        }
    };
}
export function toShortcutXLModelStreamRequest(call) {
    return {
        agentMode: call.context.agentMode,
        effortLevel: call.payload.effortLevel,
        fileAttachmentIds: call.context.fileAttachmentIds,
        initialFileId: call.context.initialFileId,
        interactionMode: call.context.interactionMode,
        llmOperation: call.context.llmOperation,
        maxTokens: call.payload.maxTokens,
        messages: call.payload.messages,
        model: call.payload.model,
        requestId: call.context.requestId,
        speed: call.context.speed,
        thinkingType: call.payload.thinkingType,
        tools: call.payload.tools,
        userMessageId: call.context.userMessageId
    };
}
//# sourceMappingURL=model-call.js.map