mirror of
https://github.com/clawdbot/clawdbot.git
synced 2026-02-01 03:47:45 +01:00
23 lines
497 B
Swift
23 lines
497 B
Swift
import Foundation
|
|
import Observation
|
|
|
|
@MainActor
|
|
@Observable
|
|
final class AgentEventStore {
|
|
static let shared = AgentEventStore()
|
|
|
|
private(set) var events: [ControlAgentEvent] = []
|
|
private let maxEvents = 400
|
|
|
|
func append(_ event: ControlAgentEvent) {
|
|
self.events.append(event)
|
|
if self.events.count > self.maxEvents {
|
|
self.events.removeFirst(self.events.count - self.maxEvents)
|
|
}
|
|
}
|
|
|
|
func clear() {
|
|
self.events.removeAll()
|
|
}
|
|
}
|