| 50 | return []MemoryRecall{{ |
| 51 | Filename: "memory-fabric", Content: content, RecallID: "memory-fabric", RecallIDs: ids, |
| 52 | }} |
| 53 | } |
| 54 | |
| 55 | func formatFabricSearchResult(result memory.SearchResult, referenceTime time.Time) (string, []string) { |
| 56 | var output strings.Builder |
| 57 | fmt.Fprintf(&output, "Reference time: %s\n", referenceTime.UTC().Format(time.RFC3339)) |
| 58 | fmt.Fprintf(&output, "Local memory route: %s.\n", strings.Join(result.Route, ", ")) |
| 59 | ids := make([]string, 0, len(result.Evidence)) |
| 60 | if len(result.Evidence) > 0 { |
| 61 | output.WriteString("\nEvidence:\n") |
| 62 | } |
| 63 | for index, evidence := range result.Evidence { |
| 64 | id := strings.TrimSpace(evidence.ResourceID) |
| 65 | if id == "" { |
| 66 | id = strings.TrimSpace(evidence.ID) |
| 67 | } |
| 68 | ids = append(ids, id) |
| 69 | ids = append(ids, evidence.SourceEventIDs...) |
| 70 | fmt.Fprintf(&output, "[%d] id=%s kind=%s", index+1, id, evidence.ResourceKind) |
| 71 | if !evidence.OccurredAt.IsZero() { |
| 72 | fmt.Fprintf(&output, " time=%s", evidence.OccurredAt.UTC().Format(time.RFC3339)) |
| 73 | } |
| 74 | if evidence.ContextID != "" { |
| 75 | fmt.Fprintf(&output, " context=%s", evidence.ContextID) |
| 76 | } |
| 77 | if evidence.Actor != "" { |
| 78 | fmt.Fprintf(&output, " actor=%s", evidence.Actor) |
| 79 | } |
| 80 | if evidence.Status != "" { |
| 81 | fmt.Fprintf(&output, " status=%s", evidence.Status) |
| 82 | } |
| 83 | if evidence.SlotID != "" { |
| 84 | fmt.Fprintf(&output, " slot=%s", evidence.SlotID) |