/**
 * Register the Shortcut LLM provider with the model registry.
 *
 * Shortcut provider routes through our Python backend proxy which handles:
 * - JWT auth (via get_user)
 * - Model allowlisting
 * - Credit/usage tracking (via get_llm)
 * - Provider fallback (vertex)
 */
import { SHORTCUT_MODEL_ID, SHORTCUT_PROVIDER_ID } from '../../model-ids.js';
import { shortcutOAuth } from '../auth/shortcut-oauth.js';
import { createShortcutAuthRecovery } from './shortcut-auth-recovery.js';
import { createShortcutInvoke } from './shortcut-invoke.js';
import { createShortcutStream } from './shortcut-stream.js';
/** Register the Shortcut provider, wiring up models and streaming via the proxy. */
export function registerShortcutProvider(modelRegistry, proxyUrl, options) {
    const streaming = options?.streaming ?? true;
    const authStorage = options?.authStorageForRecovery ?? modelRegistry.authStorage;
    const recoverAuth = createShortcutAuthRecovery(authStorage);
    const getExtraHeaders = () => ({
        'X-Client-Platform': 'shortcutxl',
        ...options?.getExtraHeaders?.()
    });
    modelRegistry.registerProvider(SHORTCUT_PROVIDER_ID, {
        baseUrl: proxyUrl,
        api: 'shortcut-llm',
        streamSimple: streaming
            ? createShortcutStream(proxyUrl, getExtraHeaders, options?.onContentBlock, recoverAuth)
            : createShortcutInvoke(proxyUrl, getExtraHeaders, recoverAuth),
        oauth: shortcutOAuth,
        models: [
            {
                id: SHORTCUT_MODEL_ID.ClaudeOpus47,
                name: 'Claude Opus 4.7',
                reasoning: true,
                input: ['text', 'image'],
                cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
                contextWindow: 1_000_000,
                maxTokens: 128000
            },
            {
                id: SHORTCUT_MODEL_ID.ClaudeOpus48,
                name: 'Claude Opus 4.8',
                reasoning: true,
                input: ['text', 'image'],
                cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 },
                contextWindow: 1_000_000,
                maxTokens: 128000
            },
            {
                id: SHORTCUT_MODEL_ID.ClaudeSonnet46,
                name: 'Claude Sonnet 4.6',
                reasoning: true,
                input: ['text', 'image'],
                cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
                contextWindow: 200000,
                maxTokens: 64000
            },
            {
                id: SHORTCUT_MODEL_ID.Gpt55,
                name: 'GPT-5.5',
                reasoning: true,
                input: ['text', 'image'],
                cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 5 },
                contextWindow: 1_000_000,
                maxTokens: 128000
            }
        ]
    });
}
//# sourceMappingURL=register-shortcut-provider.js.map