@allbluecn/database 0.14.10 → 0.14.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/schema.prisma CHANGED
@@ -3476,6 +3476,79 @@ model HarnessOutbox {
3476
3476
  @@map("harness_outbox")
3477
3477
  }
3478
3478
 
3479
+ /// 入站 webhook 规则(P5 任务 3,母规格 §6.2/§7)。跨会话定义,属同步白名单;
3480
+ /// 投递副作用经 HarnessOutbox(kind='webhook.delivery')由 Worker 驱动。
3481
+ model HarnessWebhookRule {
3482
+ id String @id @default(cuid())
3483
+ userId String
3484
+ /// 端点不透明令牌(URL 路径段,随机生成、唯一)。只作路由键,不是鉴权凭据
3485
+ token String @unique
3486
+ name String
3487
+ provider String @default("github") // github | generic
3488
+ /// 投递目标线程:Worker 在该线程发起一次 root Session
3489
+ threadId String
3490
+ workspaceId String?
3491
+ prompt String @db.Text
3492
+ /// HMAC-SHA256 密钥(AES 加密落库,encryptApiKey)。明文仅在设置页创建/轮换时
3493
+ /// 返回一次;绝不进 log / 搜索索引 / 工具结果(母规格 §8)。
3494
+ /// **可空**(P5 任务 5):跨端同步只带定义、不带密钥——同步而来的行 secretCipher
3495
+ /// 为 NULL,须在新设备重新录入密钥后该 rule 才能校验(此前一律 503 fail-closed)。
3496
+ secretCipher String?
3497
+ /// 密钥末 4 位,仅供用户识别是哪一把(非敏感)
3498
+ secretHint String
3499
+ /// 订阅事件类型(`push`/`pull_request`/...);null = 全部事件
3500
+ events Json?
3501
+ /// repo 白名单(`owner/repo` 精确匹配);与 ownerWhitelist 至少一个非空
3502
+ repoWhitelist Json?
3503
+ /// owner 白名单(精确匹配)
3504
+ ownerWhitelist Json?
3505
+ status String @default("active") // active | paused | deleted
3506
+ executionPlane String @default("local") // local | cloud
3507
+ lastDeliveryAt DateTime?
3508
+ lastError String? @db.Text
3509
+ revision Int @default(0)
3510
+ createdAt DateTime @default(now())
3511
+ updatedAt DateTime @updatedAt
3512
+
3513
+ deliveries HarnessWebhookDelivery[]
3514
+
3515
+ @@index([userId, status])
3516
+ @@index([threadId, status])
3517
+ @@map("harness_webhook_rules")
3518
+ }
3519
+
3520
+ /// 入站 webhook 投递记录(执行面本地态,不跨端同步)。
3521
+ /// 存事件摘要而非整段 payload:验签用 raw body,落库只需可重建的触发上下文。
3522
+ model HarnessWebhookDelivery {
3523
+ id String @id @default(cuid())
3524
+ ruleId String
3525
+ userId String
3526
+ executionPlane String @default("local")
3527
+ /// 上游事件去重键:`github:<deliveryGuid>`,无 guid 时 `<event>:<timestamp>:<body 摘要>`
3528
+ eventKey String
3529
+ eventType String
3530
+ repo String?
3531
+ owner String?
3532
+ /// 有界事件摘要(event/action/title/url),非整段 payload
3533
+ summary Json
3534
+ state String @default("pending") // pending | claimed | delivered | skipped | failed
3535
+ leaseOwner String?
3536
+ leaseUntil DateTime?
3537
+ fencingToken Int @default(0)
3538
+ attempt Int @default(0)
3539
+ deliveredAt DateTime?
3540
+ lastError String? @db.Text
3541
+ createdAt DateTime @default(now())
3542
+ updatedAt DateTime @updatedAt
3543
+
3544
+ rule HarnessWebhookRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
3545
+
3546
+ @@unique([ruleId, eventKey])
3547
+ @@index([executionPlane, state, createdAt])
3548
+ @@index([userId, state])
3549
+ @@map("harness_webhook_deliveries")
3550
+ }
3551
+
3479
3552
  model HarnessFeedback {
3480
3553
  id String @id @default(cuid())
3481
3554
  userId String
@@ -3544,7 +3617,11 @@ model HarnessConnectorAccount {
3544
3617
  kind String // mcp | oauth
3545
3618
  provider String
3546
3619
  label String
3547
- secretCipher String @db.Text
3620
+ /// 加密凭据(AES,encryptApiKey)。**可空**(P5 任务 5):跨端只同步账号元数据
3621
+ /// (kind/provider/label/metadata/expiresAt),凭据永不跨端——同步而来的行
3622
+ /// secretCipher 为 NULL,运行时经 CredentialStore 读到 null → 连接器自然缺席,
3623
+ /// 用户在该设备重新授权后恢复。
3624
+ secretCipher String? @db.Text
3548
3625
  metadata Json?
3549
3626
  expiresAt DateTime?
3550
3627
  createdAt DateTime @default(now())