"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApplicationStateService = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const core_entities_1 = require("../core-entities");
const global_config_service_1 = require("../global-config/global-config.service");
const ACTIVE_SESSION_KEY = 'activeSessionId';
const WEBSOCKET_ENABLED_KEY = 'websocketEnabled';
const AUTO_CONTEXT_FETCH_ENABLED_KEY = 'autoContextFetchEnabled';
const EXECUTION_STRATEGY_KEY = 'executionStrategy';
const THEME_KEY = 'theme';
const CONTEXT_TOKEN_LIMIT_KEY = 'contextTokenLimit';
const YOLO_MODE_ENABLED_KEY = 'yoloModeEnabled';
const YOLO_MODE_MESSAGE_KEY = 'yoloModeMessage';
const OPENROUTER_API_KEY = 'openrouterApiKey';
const ZAI_API_KEY = 'zaiApiKey';
const ALIBABA_API_KEY = 'alibabaApiKey';
const OLLAMA_API_KEY = 'ollamaApiKey';
const RECENT_MODELS_KEY = 'recentModels';
const OPENAI_API_KEY = 'openaiApiKey';
const OPENAI_BASE_URL = 'openaiBaseUrl';
const STREAMING_ENABLED_KEY = 'streamingEnabled';
const TOOLS_ENABLED_KEY = 'toolsEnabled';
const SYNTAX_VALIDATION_ENABLED_KEY = 'syntaxValidationEnabled';
const FOLLOWUP_TOKEN_LIMIT_KEY = 'followupTokenLimit';
const HISTORY_COMPRESSION_ENABLED_KEY = 'historyCompressionEnabled';
const LLM_RETRY_ENABLED_KEY = 'llmRetryEnabled';
const LLM_RETRY_MAX_ATTEMPTS_KEY = 'llmRetryMaxAttempts';
const NOTIFICATIONS_ENABLED_KEY = 'notificationsEnabled';
const DEFAULT_INSTANCE = 'default';
let ApplicationStateService = class ApplicationStateService {
    constructor(applicationStateRepository, systemPromptsRepository, globalConfigService) {
        this.applicationStateRepository = applicationStateRepository;
        this.systemPromptsRepository = systemPromptsRepository;
        this.globalConfigService = globalConfigService;
        this.effectiveSettingsCache = null;
        this.effectiveSettingsCacheTime = null;
        this.EFFECTIVE_SETTINGS_TTL = 5 * 1000;
        this.instance = process.env.REPOBURG_INSTANCE_NAME || DEFAULT_INSTANCE;
    }
    async setState(key, value) {
        await this.applicationStateRepository.save({
            instance: this.instance,
            key: key,
            value: value,
        });
        this.effectiveSettingsCache = null;
        this.effectiveSettingsCacheTime = null;
    }
    async getState(key) {
        const state = await this.applicationStateRepository.findOneBy({
            instance: this.instance,
            key: key,
        });
        return state?.value || null;
    }
    async deleteState(key) {
        await this.applicationStateRepository.delete({
            instance: this.instance,
            key: key,
        });
        this.effectiveSettingsCache = null;
        this.effectiveSettingsCacheTime = null;
    }
    getEffectiveBoolean(projectValue, globalValue, defaultValue) {
        if (projectValue !== null) {
            return { value: projectValue === 'true', source: 'project' };
        }
        if (globalValue !== undefined) {
            return { value: globalValue, source: 'global' };
        }
        return { value: defaultValue, source: 'default' };
    }
    getEffectiveString(projectValue, globalValue, defaultValue) {
        if (projectValue !== null) {
            return { value: projectValue, source: 'project' };
        }
        if (globalValue !== undefined) {
            return { value: globalValue, source: 'global' };
        }
        return { value: defaultValue, source: 'default' };
    }
    getEffectiveNumber(projectValue, globalValue, defaultValue) {
        if (projectValue !== null) {
            return { value: parseInt(projectValue, 10), source: 'project' };
        }
        if (globalValue !== undefined) {
            return { value: globalValue, source: 'global' };
        }
        return { value: defaultValue, source: 'default' };
    }
    getEffectiveNullableString(projectValue, globalValue) {
        if (projectValue !== null) {
            return { value: projectValue, source: 'project' };
        }
        if (globalValue !== undefined) {
            return { value: globalValue, source: 'global' };
        }
        return { value: null, source: 'default' };
    }
    async getEffectiveSettings() {
        const now = Date.now();
        if (this.effectiveSettingsCache &&
            this.effectiveSettingsCacheTime &&
            now - this.effectiveSettingsCacheTime < this.EFFECTIVE_SETTINGS_TTL) {
            return this.effectiveSettingsCache;
        }
        const globalConfig = this.globalConfigService.getConfig();
        const projectStates = await this.applicationStateRepository.find({
            where: { instance: this.instance },
        });
        const projectMap = new Map(projectStates.map((s) => [s.key, s.value]));
        const settings = {
            executionStrategy: this.getEffectiveString(projectMap.get(EXECUTION_STRATEGY_KEY) || null, globalConfig.executionStrategy, 'apply_revert'),
            websocketEnabled: this.getEffectiveBoolean(projectMap.get(WEBSOCKET_ENABLED_KEY) || null, globalConfig.websocketEnabled, true),
            autoContextFetchEnabled: this.getEffectiveBoolean(projectMap.get(AUTO_CONTEXT_FETCH_ENABLED_KEY) || null, globalConfig.autoContextFetchEnabled, true),
            yoloModeEnabled: this.getEffectiveBoolean(projectMap.get(YOLO_MODE_ENABLED_KEY) || null, globalConfig.yoloModeEnabled, false),
            yoloModeMessage: this.getEffectiveString(projectMap.get(YOLO_MODE_MESSAGE_KEY) || null, globalConfig.yoloModeMessage, 'continue or final'),
            streamingEnabled: this.getEffectiveBoolean(projectMap.get(STREAMING_ENABLED_KEY) || null, globalConfig.streamingEnabled, false),
            toolsEnabled: this.getEffectiveBoolean(projectMap.get(TOOLS_ENABLED_KEY) || null, globalConfig.toolsEnabled, true),
            syntaxValidationEnabled: this.getEffectiveBoolean(projectMap.get(SYNTAX_VALIDATION_ENABLED_KEY) || null, globalConfig.syntaxValidationEnabled, true),
            historyCompressionEnabled: this.getEffectiveBoolean(projectMap.get(HISTORY_COMPRESSION_ENABLED_KEY) || null, globalConfig.historyCompressionEnabled, true),
            llmRetryEnabled: this.getEffectiveBoolean(projectMap.get(LLM_RETRY_ENABLED_KEY) || null, globalConfig.llmRetryEnabled, true),
            llmRetryMaxAttempts: this.getEffectiveNumber(projectMap.get(LLM_RETRY_MAX_ATTEMPTS_KEY) || null, globalConfig.llmRetryMaxAttempts, 3),
            notificationsEnabled: this.getEffectiveBoolean(projectMap.get(NOTIFICATIONS_ENABLED_KEY) || null, globalConfig.notificationsEnabled, false),
            contextTokenLimit: this.getEffectiveNumber(projectMap.get(CONTEXT_TOKEN_LIMIT_KEY) || null, globalConfig.contextTokenLimit, 500000),
            followupTokenLimit: this.getEffectiveNumber(projectMap.get(FOLLOWUP_TOKEN_LIMIT_KEY) || null, globalConfig.followupTokenLimit, 32000),
            openrouterApiKey: this.getEffectiveNullableString(projectMap.get(OPENROUTER_API_KEY) || null, globalConfig.openrouterApiKey),
            zaiApiKey: this.getEffectiveNullableString(projectMap.get(ZAI_API_KEY) || null, globalConfig.zaiApiKey),
            alibabaApiKey: this.getEffectiveNullableString(projectMap.get(ALIBABA_API_KEY) || null, globalConfig.alibabaApiKey),
            ollamaApiKey: this.getEffectiveNullableString(projectMap.get(OLLAMA_API_KEY) || null, globalConfig.ollamaApiKey),
            openaiApiKey: this.getEffectiveNullableString(projectMap.get(OPENAI_API_KEY) || null, globalConfig.openaiApiKey),
            openaiBaseUrl: this.getEffectiveNullableString(projectMap.get(OPENAI_BASE_URL) || null, globalConfig.openaiBaseUrl),
        };
        this.effectiveSettingsCache = settings;
        this.effectiveSettingsCacheTime = now;
        return settings;
    }
    async getProjectOverrides() {
        const states = await this.applicationStateRepository.find({
            where: { instance: this.instance },
        });
        const overrides = {};
        for (const state of states) {
            if (state.key !== ACTIVE_SESSION_KEY &&
                state.key !== RECENT_MODELS_KEY &&
                state.key !== THEME_KEY) {
                overrides[state.key] = state.value;
            }
        }
        return overrides;
    }
    async clearOverride(key) {
        await this.deleteState(key);
    }
    async setActiveSessionId(sessionId) {
        await this.setState(ACTIVE_SESSION_KEY, sessionId);
    }
    async getActiveSessionId() {
        return this.getState(ACTIVE_SESSION_KEY);
    }
    async setWebsocketEnabled(enabled) {
        await this.setState(WEBSOCKET_ENABLED_KEY, String(enabled));
    }
    async getWebsocketEnabled() {
        const projectValue = await this.getState(WEBSOCKET_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('websocketEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true).value;
    }
    async getWebsocketEnabledWithSource() {
        const projectValue = await this.getState(WEBSOCKET_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('websocketEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true);
    }
    async setAutoContextFetchEnabled(enabled) {
        await this.setState(AUTO_CONTEXT_FETCH_ENABLED_KEY, String(enabled));
    }
    async getAutoContextFetchEnabled() {
        const projectValue = await this.getState(AUTO_CONTEXT_FETCH_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('autoContextFetchEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true).value;
    }
    async getAutoContextFetchEnabledWithSource() {
        const projectValue = await this.getState(AUTO_CONTEXT_FETCH_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('autoContextFetchEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true);
    }
    async setExecutionStrategy(strategy) {
        await this.setState(EXECUTION_STRATEGY_KEY, strategy);
    }
    async getExecutionStrategy() {
        const projectValue = await this.getState(EXECUTION_STRATEGY_KEY);
        const globalValue = this.globalConfigService.get('executionStrategy');
        return this.getEffectiveString(projectValue, globalValue, 'apply_revert')
            .value;
    }
    async getExecutionStrategyWithSource() {
        const projectValue = await this.getState(EXECUTION_STRATEGY_KEY);
        const globalValue = this.globalConfigService.get('executionStrategy');
        return this.getEffectiveString(projectValue, globalValue, 'apply_revert');
    }
    async setTheme(theme) {
        await this.setState(THEME_KEY, theme);
    }
    async getTheme() {
        const theme = await this.getState(THEME_KEY);
        return theme || 'system';
    }
    async setContextTokenLimit(limit) {
        await this.setState(CONTEXT_TOKEN_LIMIT_KEY, String(limit));
    }
    async getContextTokenLimit() {
        const projectValue = await this.getState(CONTEXT_TOKEN_LIMIT_KEY);
        const globalValue = this.globalConfigService.get('contextTokenLimit');
        return this.getEffectiveNumber(projectValue, globalValue, 500000).value;
    }
    async getContextTokenLimitWithSource() {
        const projectValue = await this.getState(CONTEXT_TOKEN_LIMIT_KEY);
        const globalValue = this.globalConfigService.get('contextTokenLimit');
        return this.getEffectiveNumber(projectValue, globalValue, 500000);
    }
    async setYoloModeEnabled(enabled) {
        await this.setState(YOLO_MODE_ENABLED_KEY, String(enabled));
    }
    async getYoloModeEnabled() {
        const projectValue = await this.getState(YOLO_MODE_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('yoloModeEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, false).value;
    }
    async getYoloModeEnabledWithSource() {
        const projectValue = await this.getState(YOLO_MODE_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('yoloModeEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, false);
    }
    async setOpenrouterApiKey(apiKey) {
        await this.setState(OPENROUTER_API_KEY, apiKey);
    }
    async getOpenrouterApiKey() {
        const projectValue = await this.getState(OPENROUTER_API_KEY);
        const globalValue = this.globalConfigService.get('openrouterApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue).value;
    }
    async getOpenrouterApiKeyWithSource() {
        const projectValue = await this.getState(OPENROUTER_API_KEY);
        const globalValue = this.globalConfigService.get('openrouterApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue);
    }
    async setZaiApiKey(apiKey) {
        await this.setState(ZAI_API_KEY, apiKey);
    }
    async getZaiApiKey() {
        const projectValue = await this.getState(ZAI_API_KEY);
        const globalValue = this.globalConfigService.get('zaiApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue).value;
    }
    async getZaiApiKeyWithSource() {
        const projectValue = await this.getState(ZAI_API_KEY);
        const globalValue = this.globalConfigService.get('zaiApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue);
    }
    async setAlibabaApiKey(apiKey) {
        await this.setState(ALIBABA_API_KEY, apiKey);
    }
    async getAlibabaApiKey() {
        const projectValue = await this.getState(ALIBABA_API_KEY);
        const globalValue = this.globalConfigService.get('alibabaApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue).value;
    }
    async getAlibabaApiKeyWithSource() {
        const projectValue = await this.getState(ALIBABA_API_KEY);
        const globalValue = this.globalConfigService.get('alibabaApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue);
    }
    async setOllamaApiKey(apiKey) {
        await this.setState(OLLAMA_API_KEY, apiKey);
    }
    async getOllamaApiKey() {
        const projectValue = await this.getState(OLLAMA_API_KEY);
        const globalValue = this.globalConfigService.get('ollamaApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue).value;
    }
    async getOllamaApiKeyWithSource() {
        const projectValue = await this.getState(OLLAMA_API_KEY);
        const globalValue = this.globalConfigService.get('ollamaApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue);
    }
    async trackUsedModel(modelId) {
        const recent = await this.getRecentModels();
        const filtered = recent.filter((m) => m !== modelId);
        const updated = [modelId, ...filtered].slice(0, 5);
        await this.setState(RECENT_MODELS_KEY, JSON.stringify(updated));
    }
    async getRecentModels() {
        const value = await this.getState(RECENT_MODELS_KEY);
        if (!value)
            return ['ollama/glm-5.1:cloud', 'zai/glm-5'];
        try {
            return JSON.parse(value);
        }
        catch {
            return ['ollama/glm-5.1:cloud', 'zai/glm-5'];
        }
    }
    async setStreamingEnabled(enabled) {
        await this.setState(STREAMING_ENABLED_KEY, String(enabled));
    }
    async getStreamingEnabled() {
        const projectValue = await this.getState(STREAMING_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('streamingEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, false).value;
    }
    async getStreamingEnabledWithSource() {
        const projectValue = await this.getState(STREAMING_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('streamingEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, false);
    }
    async setToolsEnabled(enabled) {
        await this.setState(TOOLS_ENABLED_KEY, String(enabled));
    }
    async getToolsEnabled() {
        const projectValue = await this.getState(TOOLS_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('toolsEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true).value;
    }
    async getToolsEnabledWithSource() {
        const projectValue = await this.getState(TOOLS_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('toolsEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true);
    }
    async setSyntaxValidationEnabled(enabled) {
        await this.setState(SYNTAX_VALIDATION_ENABLED_KEY, String(enabled));
    }
    async getSyntaxValidationEnabled() {
        const projectValue = await this.getState(SYNTAX_VALIDATION_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('syntaxValidationEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true).value;
    }
    async getSyntaxValidationEnabledWithSource() {
        const projectValue = await this.getState(SYNTAX_VALIDATION_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('syntaxValidationEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true);
    }
    async setYoloModeMessage(message) {
        await this.setState(YOLO_MODE_MESSAGE_KEY, message);
    }
    async getYoloModeMessage() {
        const projectValue = await this.getState(YOLO_MODE_MESSAGE_KEY);
        const globalValue = this.globalConfigService.get('yoloModeMessage');
        return this.getEffectiveString(projectValue, globalValue, 'continue or final').value;
    }
    async getYoloModeMessageWithSource() {
        const projectValue = await this.getState(YOLO_MODE_MESSAGE_KEY);
        const globalValue = this.globalConfigService.get('yoloModeMessage');
        return this.getEffectiveString(projectValue, globalValue, 'continue or final');
    }
    async setFollowupTokenLimit(limit) {
        await this.setState(FOLLOWUP_TOKEN_LIMIT_KEY, String(limit));
    }
    async getFollowupTokenLimit() {
        const projectValue = await this.getState(FOLLOWUP_TOKEN_LIMIT_KEY);
        const globalValue = this.globalConfigService.get('followupTokenLimit');
        return this.getEffectiveNumber(projectValue, globalValue, 32000).value;
    }
    async getFollowupTokenLimitWithSource() {
        const projectValue = await this.getState(FOLLOWUP_TOKEN_LIMIT_KEY);
        const globalValue = this.globalConfigService.get('followupTokenLimit');
        return this.getEffectiveNumber(projectValue, globalValue, 32000);
    }
    async getEffectiveFollowupTokenLimit(systemPromptId) {
        if (systemPromptId) {
            const systemPrompt = await this.systemPromptsRepository.findOneBy({
                id: systemPromptId,
            });
            if (systemPrompt && systemPrompt.followup_token_limit !== null) {
                return systemPrompt.followup_token_limit;
            }
        }
        return this.getFollowupTokenLimit();
    }
    async setHistoryCompressionEnabled(enabled) {
        await this.setState(HISTORY_COMPRESSION_ENABLED_KEY, String(enabled));
    }
    async getHistoryCompressionEnabled() {
        const projectValue = await this.getState(HISTORY_COMPRESSION_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('historyCompressionEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true).value;
    }
    async getHistoryCompressionEnabledWithSource() {
        const projectValue = await this.getState(HISTORY_COMPRESSION_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('historyCompressionEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true);
    }
    async setLlmRetryEnabled(enabled) {
        await this.setState(LLM_RETRY_ENABLED_KEY, String(enabled));
    }
    async getLlmRetryEnabled() {
        const projectValue = await this.getState(LLM_RETRY_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('llmRetryEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true).value;
    }
    async getLlmRetryEnabledWithSource() {
        const projectValue = await this.getState(LLM_RETRY_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('llmRetryEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, true);
    }
    async setLlmRetryMaxAttempts(attempts) {
        await this.setState(LLM_RETRY_MAX_ATTEMPTS_KEY, String(attempts));
    }
    async getLlmRetryMaxAttempts() {
        const projectValue = await this.getState(LLM_RETRY_MAX_ATTEMPTS_KEY);
        const globalValue = this.globalConfigService.get('llmRetryMaxAttempts');
        const result = this.getEffectiveNumber(projectValue, globalValue, 3).value;
        return Math.min(Math.max(result, 1), 10);
    }
    async getLlmRetryMaxAttemptsWithSource() {
        const projectValue = await this.getState(LLM_RETRY_MAX_ATTEMPTS_KEY);
        const globalValue = this.globalConfigService.get('llmRetryMaxAttempts');
        const result = this.getEffectiveNumber(projectValue, globalValue, 3);
        return {
            value: Math.min(Math.max(result.value, 1), 10),
            source: result.source,
        };
    }
    async setOpenaiApiKey(apiKey) {
        await this.setState(OPENAI_API_KEY, apiKey);
    }
    async getOpenaiApiKey() {
        const projectValue = await this.getState(OPENAI_API_KEY);
        const globalValue = this.globalConfigService.get('openaiApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue).value;
    }
    async getOpenaiApiKeyWithSource() {
        const projectValue = await this.getState(OPENAI_API_KEY);
        const globalValue = this.globalConfigService.get('openaiApiKey');
        return this.getEffectiveNullableString(projectValue, globalValue);
    }
    async setOpenaiBaseUrl(baseUrl) {
        await this.setState(OPENAI_BASE_URL, baseUrl);
    }
    async setNotificationsEnabled(enabled) {
        await this.setState(NOTIFICATIONS_ENABLED_KEY, String(enabled));
    }
    async getNotificationsEnabled() {
        const projectValue = await this.getState(NOTIFICATIONS_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('notificationsEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, false).value;
    }
    async getNotificationsEnabledWithSource() {
        const projectValue = await this.getState(NOTIFICATIONS_ENABLED_KEY);
        const globalValue = this.globalConfigService.get('notificationsEnabled');
        return this.getEffectiveBoolean(projectValue, globalValue, false);
    }
    async getOpenaiBaseUrl() {
        const projectValue = await this.getState(OPENAI_BASE_URL);
        const globalValue = this.globalConfigService.get('openaiBaseUrl');
        return this.getEffectiveNullableString(projectValue, globalValue).value;
    }
    async getOpenaiBaseUrlWithSource() {
        const projectValue = await this.getState(OPENAI_BASE_URL);
        const globalValue = this.globalConfigService.get('openaiBaseUrl');
        return this.getEffectiveNullableString(projectValue, globalValue);
    }
};
exports.ApplicationStateService = ApplicationStateService;
exports.ApplicationStateService = ApplicationStateService = __decorate([
    (0, common_1.Injectable)(),
    __param(0, (0, typeorm_1.InjectRepository)(core_entities_1.ApplicationState)),
    __param(1, (0, typeorm_1.InjectRepository)(core_entities_1.SystemPrompt)),
    __metadata("design:paramtypes", [typeorm_2.Repository,
        typeorm_2.Repository,
        global_config_service_1.GlobalConfigService])
], ApplicationStateService);
//# sourceMappingURL=application-state.service.js.map