@allbluecn/database 0.14.9 → 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/generated/browser.ts +53 -0
- package/generated/client.ts +53 -0
- package/generated/internal/class.ts +84 -4
- package/generated/internal/prismaNamespace.ts +752 -2
- package/generated/internal/prismaNamespaceBrowser.ts +151 -1
- package/generated/models/HarnessConnectorAccount.ts +20 -14
- package/generated/models/HarnessForgeBinding.ts +1524 -0
- package/generated/models/HarnessPluginMarketSource.ts +1501 -0
- package/generated/models/HarnessPluginVersionExemption.ts +1458 -0
- package/generated/models/HarnessTelemetrySettings.ts +1508 -0
- package/generated/models/HarnessTelemetryUpload.ts +1595 -0
- package/generated/models/HarnessWebhookDelivery.ts +1857 -0
- package/generated/models/HarnessWebhookRule.ts +1858 -0
- package/generated/models/HarnessWorktree.ts +1529 -0
- package/generated/models/User.ts +5648 -610
- package/generated/models.ts +8 -0
- package/migrations/20261128000000_harness_p4_forge_worktree/migration.sql +104 -0
- package/migrations/20261128000001_sync_overlay_harness_p4_forge/migration.sql +548 -0
- package/migrations/20261128000002_harness_p4_telemetry/migration.sql +48 -0
- package/migrations/20261128000003_harness_p5_webhook/migration.sql +82 -0
- package/migrations/20261128000004_harness_p5_webhook_secret_local/migration.sql +9 -0
- package/migrations/20261128000005_harness_p5_connector_meta_local/migration.sql +4 -0
- package/migrations/20261129000000_sync_overlay_harness_p5_webhook/migration.sql +581 -0
- package/migrations/20261129000100_sync_overlay_harness_p5_connector_meta/migration.sql +614 -0
- package/package.json +2 -2
- package/schema.prisma +221 -1
package/schema.prisma
CHANGED
|
@@ -121,6 +121,12 @@ model User {
|
|
|
121
121
|
plugins HarnessPlugin[]
|
|
122
122
|
harnessWorkspaces HarnessWorkspace[]
|
|
123
123
|
harnessSshHosts HarnessSshHost[]
|
|
124
|
+
harnessForgeBindings HarnessForgeBinding[]
|
|
125
|
+
harnessWorktrees HarnessWorktree[]
|
|
126
|
+
harnessPluginMarketSources HarnessPluginMarketSource[]
|
|
127
|
+
harnessPluginVersionExemptions HarnessPluginVersionExemption[]
|
|
128
|
+
harnessTelemetrySettings HarnessTelemetrySettings?
|
|
129
|
+
harnessTelemetryUploads HarnessTelemetryUpload[]
|
|
124
130
|
agentBindings BusinessAgentBinding[]
|
|
125
131
|
blobs Blob[]
|
|
126
132
|
bugsAssigned Bug[] @relation("bugAssignee")
|
|
@@ -3470,6 +3476,79 @@ model HarnessOutbox {
|
|
|
3470
3476
|
@@map("harness_outbox")
|
|
3471
3477
|
}
|
|
3472
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
|
+
|
|
3473
3552
|
model HarnessFeedback {
|
|
3474
3553
|
id String @id @default(cuid())
|
|
3475
3554
|
userId String
|
|
@@ -3538,7 +3617,11 @@ model HarnessConnectorAccount {
|
|
|
3538
3617
|
kind String // mcp | oauth
|
|
3539
3618
|
provider String
|
|
3540
3619
|
label String
|
|
3541
|
-
|
|
3620
|
+
/// 加密凭据(AES,encryptApiKey)。**可空**(P5 任务 5):跨端只同步账号元数据
|
|
3621
|
+
/// (kind/provider/label/metadata/expiresAt),凭据永不跨端——同步而来的行
|
|
3622
|
+
/// secretCipher 为 NULL,运行时经 CredentialStore 读到 null → 连接器自然缺席,
|
|
3623
|
+
/// 用户在该设备重新授权后恢复。
|
|
3624
|
+
secretCipher String? @db.Text
|
|
3542
3625
|
metadata Json?
|
|
3543
3626
|
expiresAt DateTime?
|
|
3544
3627
|
createdAt DateTime @default(now())
|
|
@@ -3589,3 +3672,140 @@ model HarnessSessionSearchToken {
|
|
|
3589
3672
|
@@index([token])
|
|
3590
3673
|
@@map("harness_session_search_tokens")
|
|
3591
3674
|
}
|
|
3675
|
+
|
|
3676
|
+
/// Forge 代码托管绑定(P4 任务 17):provider 账号级绑定(github|gitlab),桌面/云端
|
|
3677
|
+
/// 共享(母规格 §4.5 同步白名单成员,注册 sync-core self/userId scope)。凭据明文只进
|
|
3678
|
+
/// CredentialStore(credentialRef = "forge:<bindingId>" 约定引用),库里零明文。
|
|
3679
|
+
/// scopeType/scopeName 限定绑定可见域(user 账号或 org),repoWhitelist 为可选仓库白名单。
|
|
3680
|
+
model HarnessForgeBinding {
|
|
3681
|
+
id String @id @default(cuid())
|
|
3682
|
+
userId String
|
|
3683
|
+
provider String // github | gitlab
|
|
3684
|
+
accountLabel String // 展示用账号标识(登录名),不敏感
|
|
3685
|
+
scopeType String @default("user") // user | org
|
|
3686
|
+
scopeName String?
|
|
3687
|
+
repoWhitelist Json? // ["owner/repo", ...];null = 不限
|
|
3688
|
+
credentialRef String // CredentialStore 引用("forge:<id>"),明文不入库
|
|
3689
|
+
createdAt DateTime @default(now())
|
|
3690
|
+
updatedAt DateTime @updatedAt
|
|
3691
|
+
|
|
3692
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
3693
|
+
|
|
3694
|
+
@@unique([userId, provider, accountLabel])
|
|
3695
|
+
@@index([userId])
|
|
3696
|
+
@@map("harness_forge_bindings")
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
/// Harness worktree 生命周期(P4 任务 17,仅本地执行面):enter_worktree 创建并挂靠
|
|
3700
|
+
/// 线程(status=active),exit_worktree 三态(保留=不动 / 归档=标 archived 目录留存 /
|
|
3701
|
+
/// 删除=删目录删记录,必须用户授权)。设备本地状态,不注册 sync。
|
|
3702
|
+
model HarnessWorktree {
|
|
3703
|
+
id String @id @default(cuid())
|
|
3704
|
+
userId String
|
|
3705
|
+
threadId String
|
|
3706
|
+
path String // 相对 workspace root(".allblue-worktrees/<name>"),写入前过路径安全校验
|
|
3707
|
+
baseBranch String
|
|
3708
|
+
headBranch String
|
|
3709
|
+
status String @default("active") // active | merged | archived
|
|
3710
|
+
removedAt DateTime?
|
|
3711
|
+
createdAt DateTime @default(now())
|
|
3712
|
+
updatedAt DateTime @updatedAt
|
|
3713
|
+
|
|
3714
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
3715
|
+
|
|
3716
|
+
@@unique([userId, threadId, path])
|
|
3717
|
+
@@index([userId, status])
|
|
3718
|
+
@@index([threadId, status])
|
|
3719
|
+
@@map("harness_worktrees")
|
|
3720
|
+
}
|
|
3721
|
+
|
|
3722
|
+
/// 插件市场可信索引源(P4 任务 17 迁移落盘,任务 24 消费):用户自配索引 URL +
|
|
3723
|
+
/// 优先级;本地执行面状态,不注册 sync。
|
|
3724
|
+
model HarnessPluginMarketSource {
|
|
3725
|
+
id String @id @default(cuid())
|
|
3726
|
+
userId String
|
|
3727
|
+
name String
|
|
3728
|
+
url String
|
|
3729
|
+
enabled Boolean @default(true)
|
|
3730
|
+
priority Int @default(0)
|
|
3731
|
+
createdAt DateTime @default(now())
|
|
3732
|
+
updatedAt DateTime @updatedAt
|
|
3733
|
+
|
|
3734
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
3735
|
+
|
|
3736
|
+
@@unique([userId, name])
|
|
3737
|
+
@@index([userId, enabled])
|
|
3738
|
+
@@map("harness_plugin_market_sources")
|
|
3739
|
+
}
|
|
3740
|
+
|
|
3741
|
+
/// 插件版本豁免(P4 任务 17 迁移落盘,任务 24 消费):build 审批的版本范围豁免
|
|
3742
|
+
/// (可选过期);本地执行面状态,不注册 sync。
|
|
3743
|
+
model HarnessPluginVersionExemption {
|
|
3744
|
+
id String @id @default(cuid())
|
|
3745
|
+
userId String
|
|
3746
|
+
pluginName String
|
|
3747
|
+
versionRange String
|
|
3748
|
+
reason String @db.Text
|
|
3749
|
+
expiresAt DateTime?
|
|
3750
|
+
createdAt DateTime @default(now())
|
|
3751
|
+
updatedAt DateTime @updatedAt
|
|
3752
|
+
|
|
3753
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
3754
|
+
|
|
3755
|
+
@@unique([userId, pluginName, versionRange])
|
|
3756
|
+
@@index([userId, pluginName])
|
|
3757
|
+
@@map("harness_plugin_version_exemptions")
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
/// Harness telemetry 设置(P4 任务 25):每用户一行(opt-in 日志上传 + 计数偏好 +
|
|
3761
|
+
/// 排除谓词 + 保留期)。匿名计数面本身由部署级 env `HARNESS_TELEMETRY` 主闸
|
|
3762
|
+
/// (默认关闭)与本开关共同生效;上传端点为空 → Pro 托管(harnessTelemetryUpload
|
|
3763
|
+
/// 门控)或不可用。本地执行面状态,不注册 sync。
|
|
3764
|
+
model HarnessTelemetrySettings {
|
|
3765
|
+
id String @id @default(cuid())
|
|
3766
|
+
userId String @unique
|
|
3767
|
+
/// 匿名计数 opt-in(env 主闸开启时才真正采集)
|
|
3768
|
+
countersEnabled Boolean @default(false)
|
|
3769
|
+
/// 日志上传 opt-in
|
|
3770
|
+
uploadEnabled Boolean @default(false)
|
|
3771
|
+
/// 用户自配上传端点(空 → Pro 托管或不可用);写入与上传时双过 SSRF 守卫
|
|
3772
|
+
endpointUrl String?
|
|
3773
|
+
/// 保留期天数(滚动清理 HarnessTelemetryUpload 台账)
|
|
3774
|
+
retentionDays Int @default(14)
|
|
3775
|
+
/// 排除线程 id 清单(JSON string[];上传收集时排除)
|
|
3776
|
+
excludedThreadIds Json @default("[]")
|
|
3777
|
+
/// 排除工作区 id 清单(JSON string[];其下全部线程排除)
|
|
3778
|
+
excludedWorkspaceIds Json @default("[]")
|
|
3779
|
+
createdAt DateTime @default(now())
|
|
3780
|
+
updatedAt DateTime @updatedAt
|
|
3781
|
+
|
|
3782
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
3783
|
+
|
|
3784
|
+
@@map("harness_telemetry_settings")
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
/// Harness telemetry 上传台账(P4 任务 25):一次上传一行(载荷摘要 + 状态);
|
|
3788
|
+
/// 载荷本体按保留期随行滚动清理(retentionDays),保留期到期即删(含失败记录)。
|
|
3789
|
+
model HarnessTelemetryUpload {
|
|
3790
|
+
id String @id @default(cuid())
|
|
3791
|
+
userId String
|
|
3792
|
+
/// 上传目标端点(审计面;载荷已脱敏)
|
|
3793
|
+
endpointUrl String
|
|
3794
|
+
/// managed(Pro 托管)| custom(用户自配)
|
|
3795
|
+
endpointKind String
|
|
3796
|
+
/// success | failed
|
|
3797
|
+
status String
|
|
3798
|
+
/// 载荷字节数(脱敏后)
|
|
3799
|
+
payloadBytes Int
|
|
3800
|
+
/// 包含线程数 / 事件计数条数(匿名摘要,零内容)
|
|
3801
|
+
threadCount Int
|
|
3802
|
+
eventCount Int
|
|
3803
|
+
/// 失败原因(redactSecretsForLog 脱敏后)
|
|
3804
|
+
errorText String? @db.Text
|
|
3805
|
+
uploadedAt DateTime @default(now())
|
|
3806
|
+
|
|
3807
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
3808
|
+
|
|
3809
|
+
@@index([userId, uploadedAt])
|
|
3810
|
+
@@map("harness_telemetry_uploads")
|
|
3811
|
+
}
|