import { DEFAULT_MODEL_OPTION, parseLineSeparatedModels } from './shared.js';
export const cursorAgentDef = {
    id: 'cursor-agent',
    name: 'Cursor Agent',
    bin: 'cursor-agent',
    versionArgs: ['--version'],
    // `cursor-agent models` prints account-bound model ids per line. When
    // the user isn't authed it prints "No models available for this
    // account." — that's not a model list, so we detect it and fall back.
    listModels: {
        args: ['models'],
        timeoutMs: 5000,
        parse: (stdout) => {
            const trimmed = String(stdout || '').trim();
            if (!trimmed || /no models available/i.test(trimmed))
                return null;
            return parseLineSeparatedModels(trimmed);
        },
    },
    fallbackModels: [
        DEFAULT_MODEL_OPTION,
        { id: 'auto', label: 'auto' },
        { id: 'sonnet-4', label: 'sonnet-4' },
        { id: 'sonnet-4-thinking', label: 'sonnet-4-thinking' },
        { id: 'gpt-5', label: 'gpt-5' },
    ],
    // Cursor Agent does not use `-` as a "read prompt from stdin" sentinel.
    // Passing it makes the CLI treat the dash as the literal user prompt,
    // which then surfaces as "your message only contains '-'". Keep stdin
    // piped for prompt delivery, but do not append a fake prompt arg.
    buildArgs: (_prompt, _imagePaths, _extra, options = {}, runtimeContext = {}) => {
        const args = [];
        args.push('--print', '--output-format', 'stream-json', '--stream-partial-output', '--force', '--trust');
        if (runtimeContext.cwd) {
            args.push('--workspace', runtimeContext.cwd);
        }
        if (options.model && options.model !== 'default') {
            args.push('--model', options.model);
        }
        return args;
    },
    promptViaStdin: true,
    streamFormat: 'json-event-stream',
    eventParser: 'cursor-agent',
};
//# sourceMappingURL=cursor-agent.js.map