"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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppModule = void 0;
const common_1 = require("@nestjs/common");
const app_controller_1 = require("./app.controller");
const app_service_1 = require("./app.service");
const typeorm_1 = require("@nestjs/typeorm");
const core_entities_1 = require("./core-entities");
const sub_agent_entity_1 = require("./sub-agents/sub-agent.entity");
const core_entities_2 = require("./core-entities");
const projects_module_1 = require("./projects/projects.module");
const sessions_module_1 = require("./sessions/sessions.module");
const session_inputs_module_1 = require("./session-inputs/session-inputs.module");
const ai_actions_module_1 = require("./ai-actions/ai-actions.module");
const execution_logs_module_1 = require("./execution-logs/execution-logs.module");
const context_templates_module_1 = require("./context-templates/context-templates.module");
const context_generation_module_1 = require("./context-generation/context-generation.module");
const system_prompts_module_1 = require("./system-prompts/system-prompts.module");
const seeding_module_1 = require("./seeding/seeding.module");
const workspace_module_1 = require("./workspace/workspace.module");
const custom_snippets_module_1 = require("./custom-snippets/custom-snippets.module");
const path = require("path");
const fs = require("fs");
const session_transfer_module_1 = require("./session-transfer/session-transfer.module");
const session_followup_module_1 = require("./session-followup/session-followup.module");
const application_state_module_1 = require("./application-state/application-state.module");
const llm_responses_module_1 = require("./llm-responses/llm-responses.module");
const events_module_1 = require("./events/events.module");
const context_snippets_module_1 = require("./context-snippets/context-snippets.module");
const chat_module_1 = require("./interactive-chat/chat.module");
const mcp_module_1 = require("./mcp/mcp.module");
const visual_editor_module_1 = require("./visual-editor/visual-editor.module");
const custom_variables_module_1 = require("./custom-variables/custom-variables.module");
const tool_hooks_module_1 = require("./tool-hooks/tool-hooks.module");
const message_bus_module_1 = require("./message-bus/message-bus.module");
const session_input_subscriber_1 = require("./session-inputs/session-input.subscriber");
const llm_call_logs_module_1 = require("./llm-call-logs/llm-call-logs.module");
const global_config_module_1 = require("./global-config/global-config.module");
const agents_module_1 = require("./agents/agents.module");
let dbPath = ':memory:';
if (process.env.NODE_ENV === 'production') {
    const projectPath = process.env.REPOBURG_PROJECT_PATH || process.cwd();
    const dbDir = path.join(projectPath, '.repoburg');
    if (!fs.existsSync(dbDir)) {
        fs.mkdirSync(dbDir, { recursive: true });
    }
    dbPath = path.join(dbDir, 'data.sqlite');
    console.log(`Using production database at: ${dbPath}`);
}
let AppModule = class AppModule {
};
exports.AppModule = AppModule;
exports.AppModule = AppModule = __decorate([
    (0, common_1.Module)({
        imports: [
            typeorm_1.TypeOrmModule.forRoot({
                type: 'sqlite',
                database: dbPath,
                entities: [
                    core_entities_1.Project,
                    core_entities_1.Session,
                    core_entities_1.ContextTemplate,
                    core_entities_1.SessionInput,
                    core_entities_1.AIAction,
                    core_entities_1.ExecutionLog,
                    core_entities_1.SystemPrompt,
                    core_entities_1.CustomSnippet,
                    core_entities_1.ApplicationState,
                    core_entities_1.ContextSnippet,
                    core_entities_1.McpConfig,
                    core_entities_1.McpTool,
                    core_entities_1.CustomVariable,
                    core_entities_1.ToolHook,
                    core_entities_1.LlmCallLog,
                    sub_agent_entity_1.SubAgent,
                    core_entities_2.Agent,
                ],
                subscribers: [session_input_subscriber_1.SessionInputSubscriber],
                synchronize: true,
                autoLoadEntities: true,
            }),
            projects_module_1.ProjectsModule,
            sessions_module_1.SessionsModule,
            session_inputs_module_1.SessionInputsModule,
            ai_actions_module_1.AIActionsModule,
            execution_logs_module_1.ExecutionLogsModule,
            context_templates_module_1.ContextTemplatesModule,
            context_generation_module_1.ContextGenerationModule,
            system_prompts_module_1.SystemPromptsModule,
            seeding_module_1.SeedingModule,
            workspace_module_1.WorkspaceModule,
            custom_snippets_module_1.CustomSnippetsModule,
            session_transfer_module_1.SessionTransferModule,
            session_followup_module_1.SessionFollowupModule,
            global_config_module_1.GlobalConfigModule,
            application_state_module_1.ApplicationStateModule,
            llm_responses_module_1.LlmResponsesModule,
            events_module_1.EventsModule,
            context_snippets_module_1.ContextSnippetsModule,
            chat_module_1.InteractiveChatModule,
            mcp_module_1.McpModule,
            visual_editor_module_1.VisualEditorModule,
            custom_variables_module_1.CustomVariablesModule,
            tool_hooks_module_1.ToolHooksModule,
            message_bus_module_1.MessageBusModule,
            llm_call_logs_module_1.LlmCallLogsModule,
            agents_module_1.AgentsModule,
        ],
        controllers: [app_controller_1.AppController],
        providers: [app_service_1.AppService],
        exports: [app_service_1.AppService],
    })
], AppModule);
//# sourceMappingURL=app.module.js.map