All files / src/sub-agents sub-agents.module.ts

100% Statements 19/19
100% Branches 0/0
100% Functions 0/0
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 416x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x                                               6x  
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { SubAgent } from './sub-agent.entity';
import { SubAgentRun } from './sub-agent-run.entity';
import { SubAgentsService } from './sub-agents.service';
import { SubAgentRunsService } from './sub-agent-runs.service';
import { SubAgentRunner } from './sub-agent-runner.service';
import { SubAgentsController } from './sub-agents.controller';
import { SubAgentRunsController } from './sub-agent-runs.controller';
import { LlmProviderModule } from '../llm-provider/llm-provider.module';
import { SessionsModule } from '../sessions/sessions.module';
import { ApplicationStateModule } from '../application-state/application-state.module';
import { ExecutionLogsModule } from '../execution-logs/execution-logs.module';
import { EventsModule } from '../events/events.module';
import { AIAction } from '../core-entities/ai-action.entity';
import { SessionInput } from '../core-entities/session-input.entity';
 
@Module({
  imports: [
    TypeOrmModule.forFeature([SubAgent, SubAgentRun, AIAction, SessionInput]),
    LlmProviderModule,
    // NOTE: SubAgentsModule does NOT import LlmOrchestrationModule, InteractiveChatModule,
    // or SystemPromptsModule. SubAgentRunner resolves the following services lazily
    // via ModuleRef to avoid circular dependency chains:
    //   - ACTION_HANDLER_REGISTRY (from LlmOrchestrationModule)
    //   - ToolSchemaService (from LlmOrchestrationModule)
    //   - HistoryCompressionService (from LlmOrchestrationModule)
    //   - SystemPromptsService (from SystemPromptsModule)
    // SubAgentRunsController resolves ChatService (from InteractiveChatModule) lazily.
    // This breaks the cycle: SubAgentsModule → SystemPromptsModule → LlmOrchestrationModule → SubAgentsModule.
    SessionsModule,
    ApplicationStateModule,
    ExecutionLogsModule,
    EventsModule,
  ],
  controllers: [SubAgentsController, SubAgentRunsController],
  providers: [SubAgentsService, SubAgentRunsService, SubAgentRunner],
  exports: [SubAgentsService, SubAgentRunsService, SubAgentRunner],
})
export class SubAgentsModule {}