feat(service): P6.1 route tables (route_binding, route_decision, moderation_flag) + enums + events
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -121,6 +121,29 @@ enum IiosCallbackStatus {
|
||||
CANCELLED
|
||||
}
|
||||
|
||||
enum IiosRouteMode {
|
||||
MANUAL
|
||||
AUTOMATIC
|
||||
HYBRID
|
||||
SIMULATION_ONLY
|
||||
}
|
||||
|
||||
enum IiosOutputFormat {
|
||||
FORWARD
|
||||
THREADED
|
||||
DIGEST
|
||||
SUMMARY
|
||||
TRANSCRIPT
|
||||
}
|
||||
|
||||
enum IiosRouteDecisionState {
|
||||
ALLOW
|
||||
DENY
|
||||
REVIEW
|
||||
SUPPRESS
|
||||
SIMULATED
|
||||
}
|
||||
|
||||
// ─── Kernel tables ────────────────────────────────────────────────
|
||||
|
||||
/// Frozen six-vector scope. orgId + appId are REQUIRED (no global-by-null).
|
||||
@@ -577,3 +600,66 @@ model IiosRateLimitBucket {
|
||||
|
||||
@@id([channelType, bucketKey])
|
||||
}
|
||||
|
||||
// ─── P6: Routing (preview-first community forwarding) ──────────────
|
||||
|
||||
/// One origin→destination route rule. Preview-first: SIMULATION_ONLY + disabled
|
||||
/// + requiresReview by default. Restricted destinations are deny-by-default.
|
||||
model IiosRouteBinding {
|
||||
id String @id @default(cuid())
|
||||
scopeId String
|
||||
originChannelType String
|
||||
originRef String?
|
||||
destinationChannelType String
|
||||
destinationRef String?
|
||||
restrictionProfile String? // e.g. CHILD / SENIORS / ADULT / PUBLIC
|
||||
mode IiosRouteMode @default(SIMULATION_ONLY)
|
||||
outputFormat IiosOutputFormat @default(FORWARD)
|
||||
frequency String @default("IMMEDIATE")
|
||||
includeAttachments Boolean @default(false)
|
||||
requiresReview Boolean @default(true)
|
||||
rulepackVersion String @default("v1")
|
||||
enabled Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
decisions IiosRouteDecision[]
|
||||
|
||||
@@index([scopeId, originChannelType])
|
||||
}
|
||||
|
||||
/// Per-(interaction, binding) routing decision + rendered preview. No send during simulation.
|
||||
model IiosRouteDecision {
|
||||
id String @id @default(cuid())
|
||||
interactionId String
|
||||
routeBindingId String
|
||||
routeBinding IiosRouteBinding @relation(fields: [routeBindingId], references: [id], onDelete: Cascade)
|
||||
decisionState IiosRouteDecisionState
|
||||
reasonCodes String[]
|
||||
previewPayload Json
|
||||
outputFormat IiosOutputFormat
|
||||
rulepackVersion String
|
||||
simulationId String?
|
||||
decidedByActorId String?
|
||||
executed Boolean @default(false)
|
||||
executedCommandId String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([interactionId, routeBindingId])
|
||||
@@index([decisionState])
|
||||
}
|
||||
|
||||
/// A deterministic (RULE) or later AI-proposed flag on an interaction. AI can
|
||||
/// propose but never allow a route (P7).
|
||||
model IiosModerationFlag {
|
||||
id String @id @default(cuid())
|
||||
interactionId String
|
||||
flagType String
|
||||
severity String @default("LOW")
|
||||
proposedBy String @default("RULE")
|
||||
confidence Float?
|
||||
explanation String?
|
||||
createdAt DateTime @default(now())
|
||||
resolvedAt DateTime?
|
||||
|
||||
@@index([interactionId])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user