@allbluecn/database 0.14.8 → 0.14.10

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
@@ -120,6 +120,13 @@ model User {
120
120
  createdQuickDocs WorkspaceQuickDoc[]
121
121
  plugins HarnessPlugin[]
122
122
  harnessWorkspaces HarnessWorkspace[]
123
+ harnessSshHosts HarnessSshHost[]
124
+ harnessForgeBindings HarnessForgeBinding[]
125
+ harnessWorktrees HarnessWorktree[]
126
+ harnessPluginMarketSources HarnessPluginMarketSource[]
127
+ harnessPluginVersionExemptions HarnessPluginVersionExemption[]
128
+ harnessTelemetrySettings HarnessTelemetrySettings?
129
+ harnessTelemetryUploads HarnessTelemetryUpload[]
123
130
  agentBindings BusinessAgentBinding[]
124
131
  blobs Blob[]
125
132
  bugsAssigned Bug[] @relation("bugAssignee")
@@ -363,6 +370,9 @@ model ChatThread {
363
370
  agent UserAgent? @relation(fields: [agentId], references: [id], onDelete: SetNull)
364
371
  workspaceId String?
365
372
  workspace HarnessWorkspace? @relation(fields: [workspaceId], references: [id], onDelete: SetNull)
373
+ /// SSH 执行目标(任务 16,仅桌面):非空时工作区后端走远端 SSH 主机
374
+ sshHostId String?
375
+ sshHost HarnessSshHost? @relation(fields: [sshHostId], references: [id], onDelete: SetNull)
366
376
  /// 执行引擎:cloud(服务端模型)/ local(桌面本地 Agent)
367
377
  engine String @default("cloud")
368
378
  /// 本地 Agent 的授权工作目录(engine=local 时必填;仅桌面壳)
@@ -3504,6 +3514,30 @@ model HarnessMcpServer {
3504
3514
  @@map("harness_mcp_servers")
3505
3515
  }
3506
3516
 
3517
+ /// SSH 执行目标主机档案(任务 16,仅桌面):设备本地信任锚,不注册 sync。
3518
+ /// 凭据明文只进 HarnessConnectorAccount(credentialId 引用,以主机记录 id 为 label),
3519
+ /// 库里只存指纹固定值 pinnedFingerprint(TOFU 首次信任后逐次比对)。
3520
+ model HarnessSshHost {
3521
+ id String @id @default(cuid())
3522
+ userId String
3523
+ name String
3524
+ host String
3525
+ port Int @default(22)
3526
+ username String
3527
+ authMethod String // "password" | "key"
3528
+ credentialId String // CredentialStore 引用;明文不入库
3529
+ pinnedFingerprint String // "SHA256:<base64>"
3530
+ createdAt DateTime @default(now())
3531
+ updatedAt DateTime @updatedAt
3532
+
3533
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3534
+ threads ChatThread[]
3535
+
3536
+ @@unique([userId, name])
3537
+ @@index([userId])
3538
+ @@map("harness_ssh_hosts")
3539
+ }
3540
+
3507
3541
  model HarnessConnectorAccount {
3508
3542
  id String @id @default(cuid())
3509
3543
  userId String
@@ -3561,3 +3595,140 @@ model HarnessSessionSearchToken {
3561
3595
  @@index([token])
3562
3596
  @@map("harness_session_search_tokens")
3563
3597
  }
3598
+
3599
+ /// Forge 代码托管绑定(P4 任务 17):provider 账号级绑定(github|gitlab),桌面/云端
3600
+ /// 共享(母规格 §4.5 同步白名单成员,注册 sync-core self/userId scope)。凭据明文只进
3601
+ /// CredentialStore(credentialRef = "forge:<bindingId>" 约定引用),库里零明文。
3602
+ /// scopeType/scopeName 限定绑定可见域(user 账号或 org),repoWhitelist 为可选仓库白名单。
3603
+ model HarnessForgeBinding {
3604
+ id String @id @default(cuid())
3605
+ userId String
3606
+ provider String // github | gitlab
3607
+ accountLabel String // 展示用账号标识(登录名),不敏感
3608
+ scopeType String @default("user") // user | org
3609
+ scopeName String?
3610
+ repoWhitelist Json? // ["owner/repo", ...];null = 不限
3611
+ credentialRef String // CredentialStore 引用("forge:<id>"),明文不入库
3612
+ createdAt DateTime @default(now())
3613
+ updatedAt DateTime @updatedAt
3614
+
3615
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3616
+
3617
+ @@unique([userId, provider, accountLabel])
3618
+ @@index([userId])
3619
+ @@map("harness_forge_bindings")
3620
+ }
3621
+
3622
+ /// Harness worktree 生命周期(P4 任务 17,仅本地执行面):enter_worktree 创建并挂靠
3623
+ /// 线程(status=active),exit_worktree 三态(保留=不动 / 归档=标 archived 目录留存 /
3624
+ /// 删除=删目录删记录,必须用户授权)。设备本地状态,不注册 sync。
3625
+ model HarnessWorktree {
3626
+ id String @id @default(cuid())
3627
+ userId String
3628
+ threadId String
3629
+ path String // 相对 workspace root(".allblue-worktrees/<name>"),写入前过路径安全校验
3630
+ baseBranch String
3631
+ headBranch String
3632
+ status String @default("active") // active | merged | archived
3633
+ removedAt DateTime?
3634
+ createdAt DateTime @default(now())
3635
+ updatedAt DateTime @updatedAt
3636
+
3637
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3638
+
3639
+ @@unique([userId, threadId, path])
3640
+ @@index([userId, status])
3641
+ @@index([threadId, status])
3642
+ @@map("harness_worktrees")
3643
+ }
3644
+
3645
+ /// 插件市场可信索引源(P4 任务 17 迁移落盘,任务 24 消费):用户自配索引 URL +
3646
+ /// 优先级;本地执行面状态,不注册 sync。
3647
+ model HarnessPluginMarketSource {
3648
+ id String @id @default(cuid())
3649
+ userId String
3650
+ name String
3651
+ url String
3652
+ enabled Boolean @default(true)
3653
+ priority Int @default(0)
3654
+ createdAt DateTime @default(now())
3655
+ updatedAt DateTime @updatedAt
3656
+
3657
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3658
+
3659
+ @@unique([userId, name])
3660
+ @@index([userId, enabled])
3661
+ @@map("harness_plugin_market_sources")
3662
+ }
3663
+
3664
+ /// 插件版本豁免(P4 任务 17 迁移落盘,任务 24 消费):build 审批的版本范围豁免
3665
+ /// (可选过期);本地执行面状态,不注册 sync。
3666
+ model HarnessPluginVersionExemption {
3667
+ id String @id @default(cuid())
3668
+ userId String
3669
+ pluginName String
3670
+ versionRange String
3671
+ reason String @db.Text
3672
+ expiresAt DateTime?
3673
+ createdAt DateTime @default(now())
3674
+ updatedAt DateTime @updatedAt
3675
+
3676
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3677
+
3678
+ @@unique([userId, pluginName, versionRange])
3679
+ @@index([userId, pluginName])
3680
+ @@map("harness_plugin_version_exemptions")
3681
+ }
3682
+
3683
+ /// Harness telemetry 设置(P4 任务 25):每用户一行(opt-in 日志上传 + 计数偏好 +
3684
+ /// 排除谓词 + 保留期)。匿名计数面本身由部署级 env `HARNESS_TELEMETRY` 主闸
3685
+ /// (默认关闭)与本开关共同生效;上传端点为空 → Pro 托管(harnessTelemetryUpload
3686
+ /// 门控)或不可用。本地执行面状态,不注册 sync。
3687
+ model HarnessTelemetrySettings {
3688
+ id String @id @default(cuid())
3689
+ userId String @unique
3690
+ /// 匿名计数 opt-in(env 主闸开启时才真正采集)
3691
+ countersEnabled Boolean @default(false)
3692
+ /// 日志上传 opt-in
3693
+ uploadEnabled Boolean @default(false)
3694
+ /// 用户自配上传端点(空 → Pro 托管或不可用);写入与上传时双过 SSRF 守卫
3695
+ endpointUrl String?
3696
+ /// 保留期天数(滚动清理 HarnessTelemetryUpload 台账)
3697
+ retentionDays Int @default(14)
3698
+ /// 排除线程 id 清单(JSON string[];上传收集时排除)
3699
+ excludedThreadIds Json @default("[]")
3700
+ /// 排除工作区 id 清单(JSON string[];其下全部线程排除)
3701
+ excludedWorkspaceIds Json @default("[]")
3702
+ createdAt DateTime @default(now())
3703
+ updatedAt DateTime @updatedAt
3704
+
3705
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3706
+
3707
+ @@map("harness_telemetry_settings")
3708
+ }
3709
+
3710
+ /// Harness telemetry 上传台账(P4 任务 25):一次上传一行(载荷摘要 + 状态);
3711
+ /// 载荷本体按保留期随行滚动清理(retentionDays),保留期到期即删(含失败记录)。
3712
+ model HarnessTelemetryUpload {
3713
+ id String @id @default(cuid())
3714
+ userId String
3715
+ /// 上传目标端点(审计面;载荷已脱敏)
3716
+ endpointUrl String
3717
+ /// managed(Pro 托管)| custom(用户自配)
3718
+ endpointKind String
3719
+ /// success | failed
3720
+ status String
3721
+ /// 载荷字节数(脱敏后)
3722
+ payloadBytes Int
3723
+ /// 包含线程数 / 事件计数条数(匿名摘要,零内容)
3724
+ threadCount Int
3725
+ eventCount Int
3726
+ /// 失败原因(redactSecretsForLog 脱敏后)
3727
+ errorText String? @db.Text
3728
+ uploadedAt DateTime @default(now())
3729
+
3730
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3731
+
3732
+ @@index([userId, uploadedAt])
3733
+ @@map("harness_telemetry_uploads")
3734
+ }