All checks were successful
ci/woodpecker/push/api Pipeline was successful
Co-authored-by: Jason Woltje <jason@diversecanvas.com> Co-committed-by: Jason Woltje <jason@diversecanvas.com>
1.6 KiB
1.6 KiB
MS22 Agent Memory Module
Objective
Add per-agent key/value store: AgentMemory model + NestJS module with CRUD endpoints.
Issues
- MS22-DB-002: Add AgentMemory schema model
- MS22-API-002: Add agent-memory NestJS module
Plan
- AgentMemory model → schema.prisma (after AgentSession, line 736)
- Add
agentMemories AgentMemory[]relation to Workspace model - Create apps/api/src/agent-memory/ with service, controller, DTOs, specs
- Register in app.module.ts
- Migrate:
prisma migrate dev --name ms22_agent_memory - lint + build
- Commit
Endpoints
- PUT /api/agents/:agentId/memory/:key (upsert)
- GET /api/agents/:agentId/memory (list all)
- GET /api/agents/:agentId/memory/:key (get one)
- DELETE /api/agents/:agentId/memory/:key (remove)
Auth
- @UseGuards(AuthGuard, WorkspaceGuard, PermissionGuard)
- @Workspace() decorator for workspaceId
- Permission.WORKSPACE_MEMBER for write ops
- Permission.WORKSPACE_ANY for read ops
Schema
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")
}
Progress
- Schema
- Module files
- app.module.ts
- Migration
- lint/build
- Commit