Add opt-in GRDB memory with frozen conversation snapshots, background learning, session search, and a user-only Destroy action on both platforms. Persist and synchronize complete skill packages with the new AgentKit management tools. Pin signed AgentKit 0.12.3 and GRDB 7.11.1. Add the V18 package migration, regression coverage, bilingual UI snapshots, and architecture records. Validation: AgentKit and iOS suites, focused macOS skills/memory/architecture/localization tests, Swift formatting, and Chinese localization checks passed. Full macOS runs exposed intermittent existing waveform-rendering and metrics-timing failures.
48 lines
2.2 KiB
Swift
48 lines
2.2 KiB
Swift
import AgentKit
|
|
import Foundation
|
|
|
|
/// Only successful history changes schedule indexing; disabled memory performs no additional I/O.
|
|
@MainActor public final class MemoryIndexedAgentRepository: AgentRunPersisting {
|
|
private let base: any AgentRunPersisting
|
|
private let memory: MemoryModel
|
|
public init(base: any AgentRunPersisting, memory: MemoryModel) {
|
|
self.base = base
|
|
self.memory = memory
|
|
memory.attachHistory(base)
|
|
}
|
|
public func save(_ snapshot: AgentRunSnapshot) async throws {
|
|
try await base.save(snapshot)
|
|
if snapshot.state.isTerminal { memory.historyChanged() }
|
|
}
|
|
public func record(_ event: AgentEvent, runID: UUID) async throws { try await base.record(event, runID: runID) }
|
|
public func persistCompaction(_ record: AgentCompactionRecord, conversationID: UUID) async throws {
|
|
try await base.persistCompaction(record, conversationID: conversationID)
|
|
}
|
|
public func loadConversations() async throws -> [StoredAgentConversation] { try await base.loadConversations() }
|
|
public func deleteConversation(_ id: UUID) async throws {
|
|
try await base.deleteConversation(id)
|
|
memory.historyChanged()
|
|
}
|
|
public func setTitle(_ title: String, conversationID: UUID) async throws {
|
|
try await base.setTitle(title, conversationID: conversationID)
|
|
memory.historyChanged()
|
|
}
|
|
public func setConversationMetadata(_ metadata: StoredAgentConversationMetadata, conversationID: UUID) async throws
|
|
{
|
|
try await base.setConversationMetadata(metadata, conversationID: conversationID)
|
|
}
|
|
public func reorderConversations(_ updates: [StoredAgentConversationOrder]) async throws {
|
|
try await base.reorderConversations(updates)
|
|
}
|
|
public func truncateConversation(_ id: UUID, fromUserMessageID: UUID, replacingWith: AgentTranscriptMessage)
|
|
async throws
|
|
{
|
|
try await base.truncateConversation(id, fromUserMessageID: fromUserMessageID, replacingWith: replacingWith)
|
|
memory.historyChanged()
|
|
}
|
|
public func createConversation(_ conversation: StoredAgentConversation) async throws {
|
|
try await base.createConversation(conversation)
|
|
memory.historyChanged()
|
|
}
|
|
}
|