File size: 772 Bytes
b8370f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | import Foundation
public typealias OpenClawChatToolActivityHandler = @MainActor @Sendable (
_ id: String,
_ name: String,
_ isActive: Bool,
_ sessionKey: String) -> Void
extension OpenClawChatViewModel {
public func endPendingToolActivities() {
self.pendingToolCallsById = [:]
}
func reportToolActivityChanges(
from previous: [String: OpenClawChatPendingToolCall],
to current: [String: OpenClawChatPendingToolCall])
{
for (id, call) in previous where current[id] == nil {
self.onToolActivity?(id, call.name, false, self.sessionKey)
}
for (id, call) in current where previous[id] == nil {
self.onToolActivity?(id, call.name, true, self.sessionKey)
}
}
}
|