Add brain memory services and APIs

Introduce the backend pieces for brain memory ingestion, routing, and
system telemetry so the new knowledge workflows can project data into a
brain view. The supporting tests lock in the new behavior and keep the
expanded backend surface stable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 13:47:34 +08:00
parent e3691b01bb
commit d2447ee635
28 changed files with 2278 additions and 197 deletions

View File

@@ -0,0 +1,57 @@
from datetime import datetime
from pydantic import BaseModel
class BrainOverviewOut(BaseModel):
active_memory_count: int
important_tag_count: int
secondary_tag_count: int
recent_memory_titles: list[str]
class BrainMemoryOut(BaseModel):
id: str
memory_type: str
title: str
content: str
importance: int
confidence: float
status: str
created_at: datetime
model_config = {"from_attributes": True}
class BrainTagOut(BaseModel):
id: str
name: str
category: str
priority: str
score: float
model_config = {"from_attributes": True}
class BrainEventOut(BaseModel):
id: str
source_type: str
source_id: str
event_type: str
title: str | None
content_summary: str | None
status: str
created_at: datetime
model_config = {"from_attributes": True}
class BrainTagGroupsOut(BaseModel):
important: list[BrainTagOut]
secondary: list[BrainTagOut]
class BrainLearnRunOut(BaseModel):
events_considered: int
candidates_created: int
memories_promoted: int