@startuml
interface InferenceProvider
interface ProviderRegistry
interface InferenceRouter
interface RoutingStrategy
interface InferenceCancellationToken
interface Tokenizer
interface InferenceReducer
interface Projection

class DefaultInferenceRouter
class DefaultInferenceReducer
class InferenceProjector
class InferenceRepository

class InferenceRequest
class InferenceResponse
class InferenceState
class InferenceRecord
class GenerationConfig
class ToolCallRequest
class ToolDefinition
class ModelCapability
class CapabilityScore
class ProviderHealth
class FinishReason
class ResponseFormat

enum InferenceStatus

InferenceRouter <|.. DefaultInferenceRouter
RoutingStrategy <|-- (DefaultInferenceRouter uses)
InferenceProvider <|-- (DefaultInferenceRouter uses)
ProviderRegistry <|-- (DefaultInferenceRouter uses)
InferenceReducer <|.. DefaultInferenceReducer
Projection <|.. InferenceProjector
InferenceProjector --> InferenceReducer
InferenceRepository --> InferenceProjector

DefaultInferenceRouter --> RoutingStrategy
DefaultInferenceRouter --> ProviderRegistry
InferenceRequest --> GenerationConfig
InferenceRequest --> "contextPack" ContextPack
InferenceRequest --> "tools" ToolDefinition
InferenceResponse --> "toolCalls" ToolCallRequest
InferenceResponse --> FinishReason
InferenceProvider --> Tokenizer
InferenceRecord --> InferenceStatus

package "core:events" <<External>> {
  [InferenceStartedEvent]
  [InferenceCompletedEvent]
  [InferenceFailedEvent]
  [InferenceTimeoutEvent]
}
package "core:context" <<External>> {
  [ContextPack]
}
package "core:artifacts" <<External>> {
  [JsonSchema]
}
package "core:sessions" <<External>> {
  [Projection]
  [EventReplayer]
}

DefaultInferenceReducer ..> "core:events"
InferenceRepository ..> "core:events"
InferenceRepository ..> "core:sessions"
InferenceRequest ..> "core:context"
ResponseFormat.Json ..> "core:artifacts"

@enduml
