# Interface ICompositeRouter

Composite router interface for dependency injection.

interface ICompositeRouter {
route(
task: CliTask,
): Promise<Result<CompositeRoutingDecision, CompositeRoutingError>>;
executeTask(
task: CliTask,
): Promise<Result<CliResponse, CliError | CompositeRoutingError>>;
recordOutcome(
cliName: "claude" | "gemini" | "codex" | "opencode",
task: CliTask,
reward: number,
): void;
recordPreference(
query: string,
strongPreferred: boolean,
quality?: { strong?: number; weak?: number },
): void;
recordDifficultyOutcome(
task: CliTask,
success: boolean,
qualityScore?: number,
): void;
getStats(): CompositeRouterStats;
hasMinimumPreferenceData(): boolean;
getZeroRouter(): IZeroRouter | undefined;
getLatencyTracker(): ILatencyTracker | undefined;
getRoutingMemory(): IRoutingMemory | undefined;
getMetricsCollector(): IRoutingMetricsCollector | undefined;
getOrchestrationObserver(): IOrchestrationObserver | undefined;
getCapacityDashboard(): Promise<
Map<"claude" | "gemini" | "codex" | "opencode", CapacityStatus>,
>;
}

#### Implemented by

- CompositeRouter

- Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:114

##### Index

### Methods

route
executeTask
recordOutcome
recordPreference
recordDifficultyOutcome
getStats
hasMinimumPreferenceData
getZeroRouter
getLatencyTracker
getRoutingMemory
getMetricsCollector
getOrchestrationObserver
getCapacityDashboard

## Methods

### route

- route(
  task: CliTask,
  ): Promise<Result<CompositeRoutingDecision, CompositeRoutingError>>

  #### Parameters

  - task: CliTask

  #### Returns Promise<Result<CompositeRoutingDecision, CompositeRoutingError>>

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:115

### executeTask

- executeTask(
  task: CliTask,
  ): Promise<Result<CliResponse, CliError | CompositeRoutingError>>

  #### Parameters

  - task: CliTask

  #### Returns Promise<Result<CliResponse, CliError | CompositeRoutingError>>

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:116

### recordOutcome

- recordOutcome(
  cliName: "claude" | "gemini" | "codex" | "opencode",
  task: CliTask,
  reward: number,
  ): void

  #### Parameters

  - cliName: "claude" | "gemini" | "codex" | "opencode"
  - task: CliTask
  - reward: number

  #### Returns void

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:117

### recordPreference

- recordPreference(
  query: string,
  strongPreferred: boolean,
  quality?: { strong?: number; weak?: number },
  ): void

  #### Parameters

  - query: string
  - strongPreferred: boolean
  - `Optional` quality: { strong?: number; weak?: number }

  #### Returns void

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:118

### recordDifficultyOutcome

- recordDifficultyOutcome(
  task: CliTask,
  success: boolean,
  qualityScore?: number,
  ): void

  #### Parameters

  - task: CliTask
  - success: boolean
  - `Optional` qualityScore: number

  #### Returns void

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:123

### getStats

- getStats(): CompositeRouterStats

  #### Returns CompositeRouterStats

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:124

### hasMinimumPreferenceData

- hasMinimumPreferenceData(): boolean

  #### Returns boolean

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:125

### getZeroRouter

- getZeroRouter(): IZeroRouter | undefined

  #### Returns IZeroRouter | undefined

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:126

### getLatencyTracker

- getLatencyTracker(): ILatencyTracker | undefined

  #### Returns ILatencyTracker | undefined

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:127

### getRoutingMemory

- getRoutingMemory(): IRoutingMemory | undefined

  #### Returns IRoutingMemory | undefined

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:128

### getMetricsCollector

- getMetricsCollector(): IRoutingMetricsCollector | undefined

  Get the metrics collector (if configured) (Issue #559)

  #### Returns IRoutingMetricsCollector | undefined

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:130

### getOrchestrationObserver

- getOrchestrationObserver(): IOrchestrationObserver | undefined

  Get the orchestration observer (if configured) (Issue #587)

  #### Returns IOrchestrationObserver | undefined

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:132

### getCapacityDashboard

- getCapacityDashboard(): Promise<
  Map<"claude" | "gemini" | "codex" | "opencode", CapacityStatus>,
  >

  Get capacity status for all registered CLIs (Issue #807)

  #### Returns Promise<Map<"claude" | "gemini" | "codex" | "opencode", CapacityStatus>>

  - Defined in packages/nexus-agents/src/cli-adapters/composite-router.ts:134