feat(brain): expose OpenBrain schema fields

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-02 03:30:59 +00:00
parent cd134217f8
commit cf7b26d450
2 changed files with 19 additions and 2 deletions

View file

@ -94,6 +94,8 @@ func (p *BrainProvider) Describe() []api.RouteDescription {
"tags": map[string]any{"type": "array", "items": map[string]any{"type": "string"}},
"project": map[string]any{"type": "string"},
"confidence": map[string]any{"type": "number"},
"supersedes": map[string]any{"type": "string"},
"expires_in": map[string]any{"type": "integer"},
},
"required": []string{"content", "type"},
},
@ -120,8 +122,10 @@ func (p *BrainProvider) Describe() []api.RouteDescription {
"filter": map[string]any{
"type": "object",
"properties": map[string]any{
"project": map[string]any{"type": "string"},
"type": map[string]any{"type": "string"},
"project": map[string]any{"type": "string"},
"type": map[string]any{"type": "string"},
"agent_id": map[string]any{"type": "string"},
"min_confidence": map[string]any{"type": "number"},
},
},
},

View file

@ -285,6 +285,19 @@ func TestProvider_Describe_Ugly_ReturnSliceIsDetached(t *testing.T) {
assert.Equal(t, "/remember", NewProvider(nil, nil).Describe()[0].Path)
}
func TestProvider_Describe_Good_BrainFields(t *testing.T) {
descriptions := NewProvider(nil, nil).Describe()
rememberProps := descriptions[0].RequestBody["properties"].(map[string]any)
assert.Contains(t, rememberProps, "supersedes")
assert.Contains(t, rememberProps, "expires_in")
recallProps := descriptions[1].RequestBody["properties"].(map[string]any)
filterProps := recallProps["filter"].(map[string]any)["properties"].(map[string]any)
assert.Contains(t, filterProps, "agent_id")
assert.Contains(t, filterProps, "min_confidence")
}
func TestProvider_Status_Good(t *testing.T) {
bridge, _, cleanup := connectedBridge(t)
defer cleanup()