forked from EduCraft/curriculum-project-hub
fix: bind agent sessions to role
This commit is contained in:
@@ -190,14 +190,15 @@ model ProjectGroupBinding {
|
||||
|
||||
// --- AgentRun, session, lock (ADR-0002, 0017) -----------------------------
|
||||
|
||||
/// ADR-0017: session is provider/model-bound. `provider` + `model` capture
|
||||
/// the binding; provider-specific runtime cursors live in `metadata`
|
||||
/// (e.g. metadata.claudeSessionId). Same provider+model ⇒ reuse across runs
|
||||
/// (ADR-0002); a switch ⇒ new Hub session.
|
||||
/// ADR-0017: session is provider/role/model-bound. `provider` + `roleId` +
|
||||
/// `model` capture the binding; provider-specific runtime cursors live in
|
||||
/// `metadata` (e.g. metadata.claudeSessionId). Same provider+role+model ⇒
|
||||
/// reuse across runs (ADR-0002); a switch ⇒ new Hub session.
|
||||
model AgentSession {
|
||||
id String @id @default(cuid())
|
||||
projectId String
|
||||
provider String
|
||||
roleId String
|
||||
model String
|
||||
title String?
|
||||
metadata Json
|
||||
@@ -210,7 +211,8 @@ model AgentSession {
|
||||
messages AgentMessage[] @relation("sessionMessages")
|
||||
|
||||
@@index([projectId, archivedAt])
|
||||
@@index([provider, model])
|
||||
@@index([provider, roleId, model])
|
||||
@@index([projectId, provider, roleId, model, archivedAt])
|
||||
@@index([updatedAt])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user