MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / ExportSnapshot

Method ExportSnapshot

agent/task_runtime.go:155–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153}
154
155func (rt *AgentTaskRuntime) ExportSnapshot() []map[string]any {
156 rt.mu.Lock()
157 defer rt.mu.Unlock()
158 records := make([]*AgentTaskRecord, 0, len(rt.records))
159 for _, record := range rt.records {
160 records = append(records, record)
161 }
162 sort.SliceStable(records, func(i, j int) bool {
163 if records[i].CreatedAt == records[j].CreatedAt {
164 return records[i].TaskID < records[j].TaskID
165 }
166 return records[i].CreatedAt < records[j].CreatedAt
167 })
168 out := make([]map[string]any, 0, len(records))
169 for _, record := range records {
170 out = append(out, record.ToMap())
171 }
172 return out
173}
174
175func (rt *AgentTaskRuntime) ImportSnapshot(snapshot []map[string]any) {
176 rt.mu.Lock()

Calls 1

ToMapMethod · 0.45