feat(brain): surface deleted_at in memory outputs
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
f6e1e64a0c
commit
2b40d0a3b0
6 changed files with 18 additions and 0 deletions
|
|
@ -547,6 +547,9 @@ func (s *PrepSubsystem) cmdBrainList(options core.Options) core.Result {
|
|||
if memory.SupersedesCount > 0 {
|
||||
core.Print(nil, " supersedes: %d", memory.SupersedesCount)
|
||||
}
|
||||
if memory.DeletedAt != "" {
|
||||
core.Print(nil, " deleted_at: %s", memory.DeletedAt)
|
||||
}
|
||||
if memory.Content != "" {
|
||||
core.Print(nil, " %s", memory.Content)
|
||||
}
|
||||
|
|
@ -698,6 +701,7 @@ type brainRecallMemory struct {
|
|||
Project string `json:"project"`
|
||||
AgentID string `json:"agent_id"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
DeletedAt string `json:"deleted_at,omitempty"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
|
|
@ -1134,6 +1138,7 @@ type brainListOutputEntry struct {
|
|||
AgentID string `json:"agent_id"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
SupersedesCount int `json:"supersedes_count,omitempty"`
|
||||
DeletedAt string `json:"deleted_at,omitempty"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
|
||||
|
|
@ -1178,6 +1183,7 @@ func brainListOutputFromPayload(payload map[string]any) brainListOutput {
|
|||
case int:
|
||||
entry.SupersedesCount = supersedesCount
|
||||
}
|
||||
entry.DeletedAt = brainListStringValue(entryMap["deleted_at"])
|
||||
if tags, ok := entryMap["tags"].([]any); ok {
|
||||
for _, tag := range tags {
|
||||
entry.Tags = append(entry.Tags, brainListStringValue(tag))
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ func TestCommands_CmdBrainList_Good(t *testing.T) {
|
|||
"agent_id": "virgil",
|
||||
"confidence": 0.9,
|
||||
"supersedes_count": 3,
|
||||
"deleted_at": "2026-03-31T12:30:00Z",
|
||||
"tags": []any{"architecture", "convention"},
|
||||
},
|
||||
},
|
||||
|
|
@ -272,6 +273,7 @@ func TestCommands_CmdBrainList_Good(t *testing.T) {
|
|||
assert.Contains(t, output, "count: 1")
|
||||
assert.Contains(t, output, "mem-1 architecture")
|
||||
assert.Contains(t, output, "supersedes: 3")
|
||||
assert.Contains(t, output, "deleted_at: 2026-03-31T12:30:00Z")
|
||||
assert.Contains(t, output, "Use named actions.")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -258,6 +258,7 @@ func memoriesFromPayload(payload map[string]any) []Memory {
|
|||
CreatedAt: stringField(memoryMap, "created_at"),
|
||||
UpdatedAt: stringField(memoryMap, "updated_at"),
|
||||
ExpiresAt: stringField(memoryMap, "expires_at"),
|
||||
DeletedAt: stringField(memoryMap, "deleted_at"),
|
||||
}
|
||||
if id, ok := memoryMap["id"].(string); ok {
|
||||
memory.ID = id
|
||||
|
|
|
|||
|
|
@ -429,6 +429,7 @@ func TestDirect_List_Good_WithMemories(t *testing.T) {
|
|||
"agent_id": "codex",
|
||||
"confidence": 0.73,
|
||||
"supersedes_count": 2,
|
||||
"deleted_at": "2026-03-31T12:30:00Z",
|
||||
"tags": []any{"queue", "review"},
|
||||
"updated_at": "2026-03-30T10:00:00Z",
|
||||
"created_at": "2026-03-30T09:00:00Z",
|
||||
|
|
@ -469,6 +470,7 @@ func TestDirect_List_Good_WithMemories(t *testing.T) {
|
|||
assert.Equal(t, "manual", out.Memories[0].Source)
|
||||
assert.Equal(t, "2026-03-30T10:00:00Z", out.Memories[0].UpdatedAt)
|
||||
assert.Equal(t, "2026-04-01T00:00:00Z", out.Memories[0].ExpiresAt)
|
||||
assert.Equal(t, "2026-03-31T12:30:00Z", out.Memories[0].DeletedAt)
|
||||
assert.Contains(t, out.Memories[0].Tags, "queue")
|
||||
assert.Contains(t, out.Memories[0].Tags, "source:manual")
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ type Memory struct {
|
|||
SupersedesID string `json:"supersedes_id,omitempty"`
|
||||
SupersedesCount int `json:"supersedes_count,omitempty"`
|
||||
ExpiresAt string `json:"expires_at,omitempty"`
|
||||
DeletedAt string `json:"deleted_at,omitempty"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,3 +23,9 @@ func TestTools_RecallInput_Good(t *testing.T) {
|
|||
input := RecallInput{Query: "error handling", TopK: 10}
|
||||
assert.Equal(t, 10, input.TopK)
|
||||
}
|
||||
|
||||
func TestTools_Memory_Good(t *testing.T) {
|
||||
memory := Memory{DeletedAt: "2026-04-01T00:00:00Z"}
|
||||
|
||||
assert.Equal(t, "2026-04-01T00:00:00Z", memory.DeletedAt)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue