import { FALLBACK_MOCK_MODEL } from '../constants/provider/index.js';
export class MockLLMProvider {
    id = 'mock';
    name = 'Mock LLM Provider';
    model;
    responseText;
    responseDelayMs;
    constructor(config) {
        this.model = config.model ?? FALLBACK_MOCK_MODEL;
        this.responseText = config.responseText ?? 'Mock provider response';
        this.responseDelayMs = config.responseDelayMs ?? 0;
    }
    buildUsage() {
        return {
            promptTokens: 0,
            completionTokens: 0,
            totalTokens: 0,
            cachedTokens: 0,
            cacheWriteTokens: 0,
        };
    }
    async delay() {
        if (this.responseDelayMs <= 0)
            return;
        await new Promise((resolve) => setTimeout(resolve, this.responseDelayMs));
    }
    normalizeResponse(params, message) {
        return {
            id: `mock-${Date.now()}-${Math.floor(Math.random() * 1_000_000)}`,
            model: params.model ?? this.model,
            message: {
                role: 'assistant',
                content: message,
            },
            finishReason: 'stop',
            usage: this.buildUsage(),
        };
    }
    async *chatStream(params) {
        await this.delay();
        const response = this.normalizeResponse(params, this.responseText);
        const content = response.message.content ?? '';
        const chunkSize = 8;
        for (let i = 0; i < content.length; i += chunkSize) {
            yield {
                id: response.id,
                delta: {
                    content: content.slice(i, i + chunkSize),
                },
            };
        }
        yield {
            id: response.id,
            delta: {},
            finishReason: 'stop',
            usage: response.usage,
        };
    }
    async listModels() {
        return [
            {
                id: this.model,
                name: 'Mock Model',
                contextWindow: 32_000,
                maxOutputTokens: 8_000,
                inputPrice: 0,
                outputPrice: 0,
                supportsToolUse: false,
                supportsStreaming: true,
            },
        ];
    }
    async healthCheck() {
        await this.delay();
        return true;
    }
}
//# sourceMappingURL=mock.js.map