@startuml
package "core:kernel" {
  abstract class SessionOrchestrator {
    # emit()
    # executeStage()
    # runInference()
    # resolveTransition()
    + abstract run()
    + abstract cancel()
  }

  class DefaultSessionOrchestrator {
    + run()
    + cancel()
    + submitApprovalDecision()
  }

  class ReplayOrchestrator {
    + run()
    + cancel()
    # runInference()
    # mapValidationOutcome()
  }

  interface ApprovalGateway {
    + submitApprovalDecision()
  }

  interface RetryCoordinator
  class DefaultRetryCoordinator

  data class OrchestratorRepositories
  data class OrchestratorEngines

  data class OrchestrationConfig
  sealed interface WorkflowResult
  sealed interface ReplayStrategy
  sealed interface StageOutcome
  interface OrchestrationReducer
  class DefaultOrchestrationReducer
  class OrchestrationProjector
  class OrchestrationRepository

  class ReplayInferenceProvider
  class ReplayArtifactMissingException

  DefaultSessionOrchestrator --|> SessionOrchestrator
  DefaultSessionOrchestrator ..|> ApprovalGateway
  ReplayOrchestrator --|> SessionOrchestrator

  SessionOrchestrator *-- OrchestratorRepositories
  SessionOrchestrator *-- OrchestratorEngines
  SessionOrchestrator --> RetryCoordinator

  DefaultRetryCoordinator ..|> RetryCoordinator
  DefaultRetryCoordinator --> EventStore

  ReplayOrchestrator --> ReplayInferenceProvider

  OrchestrationProjector --> OrchestrationReducer
  OrchestrationRepository --> EventReplayer
}

package "external modules" as EXT {
  package ":core:events" as EV {
    interface EventStore
    interface EventReplayer
    interface Projection
  }

  package ":core:sessions" as SES {
    class DefaultSessionRepository
    data class Session
  }

  package ":core:transitions" as TR {
    interface TransitionResolver
    data class WorkflowGraph
    data class StageExecutionResult
  }

  package ":core:inference" as INF {
    interface InferenceRouter
    interface InferenceRepository
    data class InferenceResponse
  }

  package ":core:context" as CTX {
    interface ContextPackBuilder
  }

  package ":core:validation" as VAL {
    interface ValidationPipeline
  }

  package ":core:approvals" as APR {
    class DefaultApprovalRepository
  }

  package ":core:risk" as RSK {
    interface RiskAssessor
  }

  package ":core:tools" as TOL {
    interface ToolExecutor
    interface ToolRegistry
  }

  package ":core:artifacts-store" as AST {
    interface ArtifactStore
  }
}

SessionOrchestrator --> EV
SessionOrchestrator --> SES
SessionOrchestrator --> TR
SessionOrchestrator --> INF
SessionOrchestrator --> CTX
SessionOrchestrator --> VAL
SessionOrchestrator --> APR
SessionOrchestrator --> RSK
SessionOrchestrator --> TOL
SessionOrchestrator --> AST

ReplayOrchestrator --> EXT

note top of DefaultSessionOrchestrator : Live execution with\nreal inference, validation,\nrisk assessment, approvals
note top of ReplayOrchestrator : Deterministic replay from\nevent log only

@enduml
