25 lines
889 B
Markdown
25 lines
889 B
Markdown
|
|
# Task ID: 121
|
||
|
|
|
||
|
|
**Title:** Add AgentSession Prisma model
|
||
|
|
|
||
|
|
**Status:** pending
|
||
|
|
|
||
|
|
**Dependencies:** 118, 120
|
||
|
|
|
||
|
|
**Priority:** high
|
||
|
|
|
||
|
|
**Description:** Add AgentSession model with SessionState enum for ephemeral per-session pod tracking
|
||
|
|
|
||
|
|
**Details:**
|
||
|
|
|
||
|
|
In src/db/prisma/schema.prisma add:
|
||
|
|
1. enum SessionState { pending, provisioning, running, ended, failed }
|
||
|
|
2. model AgentSession with: id, agentId, projectId, taskId?, containerId?, state, image, expiresAt, lastError? (@db.Text), ownerId, createdAt, updatedAt, endedAt?
|
||
|
|
3. Relations: agent (Agent), project (Project), task (Task?), owner (User)
|
||
|
|
4. @@index([state]), @@index([taskId]), @@index([agentId])
|
||
|
|
5. Add sessions AgentSession[] to Agent, Project, Task, User models
|
||
|
|
|
||
|
|
**Test Strategy:**
|
||
|
|
|
||
|
|
Schema tests: create AgentSession with all relations, test cascade on Agent/Project delete, test SetNull on Task delete, verify state enum transitions.
|