feat(api): add agent memory module (MS22-DB-002, MS22-API-002)
- Add AgentMemory model to schema.prisma with workspaceId/agentId/key/value and @@unique([workspaceId, agentId, key]) constraint - Add Workspace.agentMemories relation - Add migration 20260228000000_ms22_agent_memory - Add AgentMemoryModule with service, controller, DTOs, and unit tests - Endpoints: PUT/GET/GET/:key/DELETE on /api/agents/:agentId/memory/:key - Register AgentMemoryModule in app.module.ts - 10 unit tests passing (service + controller) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -299,6 +299,7 @@ model Workspace {
|
||||
agentSessions AgentSession[]
|
||||
agentTasks AgentTask[]
|
||||
findings Finding[]
|
||||
agentMemories AgentMemory[]
|
||||
userLayouts UserLayout[]
|
||||
knowledgeEntries KnowledgeEntry[]
|
||||
knowledgeTags KnowledgeTag[]
|
||||
@@ -764,6 +765,23 @@ model AgentSession {
|
||||
@@map("agent_sessions")
|
||||
}
|
||||
|
||||
model AgentMemory {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
workspaceId String @map("workspace_id") @db.Uuid
|
||||
agentId String @map("agent_id")
|
||||
key String
|
||||
value Json
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz
|
||||
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([workspaceId, agentId, key])
|
||||
@@index([workspaceId])
|
||||
@@index([agentId])
|
||||
@@map("agent_memories")
|
||||
}
|
||||
|
||||
model WidgetDefinition {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user