@startuml
interface Tool
interface FileAffectingTool
interface ToolExecutor
interface ToolRegistry
interface ToolReducer
interface Projection

class DefaultToolReducer
class ToolProjector
class DefaultToolRepository

class ToolState
class ToolInvocationRecord
class ValidationResult
enum ToolInvocationStatus
enum ToolCapability

Tool <|-- FileAffectingTool
ToolReducer <|.. DefaultToolReducer
Projection <|.. ToolProjector
ToolProjector --> ToolReducer
DefaultToolRepository --> ToolProjector
DefaultToolRepository ..> ToolState
ToolState --> "invocations" ToolInvocationRecord
ToolInvocationRecord --> ToolInvocationStatus

package "core:events" <<External>> {
  [ToolInvocationRequestedEvent]
  [ToolExecutionStartedEvent]
  [ToolExecutionCompletedEvent]
  [ToolExecutionFailedEvent]
  [ToolExecutionRejectedEvent]
  [ToolRequest]
  [ToolReceipt]
}
package "core:approvals" <<External>> {
  [Tier]
}
package "core:sessions" <<External>> {
  [Projection]
  [EventReplayer]
}

DefaultToolReducer ..> "core:events"
DefaultToolRepository ..> "core:events"
DefaultToolRepository ..> "core:sessions"
Tool ..> "core:events"
Tool ..> "core:approvals"

@enduml
