@allbluecn/database 0.14.10 → 0.14.12
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 +17 -0
- package/generated/client.ts +17 -0
- package/generated/internal/class.ts +43 -6
- package/generated/internal/prismaNamespace.ts +274 -1
- package/generated/internal/prismaNamespaceBrowser.ts +64 -0
- package/generated/models/HarnessConnectorAccount.ts +20 -14
- package/generated/models/HarnessWebhookDelivery.ts +1857 -0
- package/generated/models/HarnessWebhookRule.ts +1858 -0
- package/generated/models/MemoryFact.ts +973 -0
- package/generated/models.ts +3 -0
- package/generated/prisma-query-compiler.postgresql.wasm +0 -0
- package/index.ts +9 -11
- 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_add_hnsw_vector_indexes/migration.sql +15 -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 +3 -8
- package/schema.prisma +94 -1
- package/cf-env-stub.ts +0 -4
- package/cf-env.ts +0 -25
- package/cloudflare-workers.d.ts +0 -6
package/schema.prisma
CHANGED
|
@@ -3212,6 +3212,22 @@ model DesignEmbedding {
|
|
|
3212
3212
|
@@map("design_embeddings")
|
|
3213
3213
|
}
|
|
3214
3214
|
|
|
3215
|
+
// 跨会话记忆事实表(pgvector 原生向量表,非 Prisma 模型语义)。
|
|
3216
|
+
// 与 KnowledgeEmbedding/DesignEmbedding 同族:必须占位对齐迁移 DDL,否则 migrate dev
|
|
3217
|
+
// diff 会推导 DROP TABLE(memory_facts 曾因此丢表=A02 复发,memfacts-001)。
|
|
3218
|
+
model MemoryFact {
|
|
3219
|
+
id String @id
|
|
3220
|
+
userId String
|
|
3221
|
+
threadId String
|
|
3222
|
+
content String
|
|
3223
|
+
embedding Unsupported("vector(1536)")
|
|
3224
|
+
createdAt DateTime @db.Timestamptz @default(now())
|
|
3225
|
+
|
|
3226
|
+
@@index([userId, createdAt(sort: Desc)], name: "memory_facts_userid_createdat_idx")
|
|
3227
|
+
@@index([threadId], name: "memory_facts_threadid_idx")
|
|
3228
|
+
@@map("memory_facts")
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3215
3231
|
// ── Harness 持久化(Phase 1,六 store 的 Prisma 载体;PG + PGlite 同方言)──────────
|
|
3216
3232
|
// 官方契约真源:@tanstack/ai-persistence@1.0.1 dist/esm/types.d.ts(LogStore 15 方法、
|
|
3217
3233
|
// SessionIndexStore CAS、MetadataStore getVersioned/setIf、BlobStore Range、ArtifactStore)。
|
|
@@ -3476,6 +3492,79 @@ model HarnessOutbox {
|
|
|
3476
3492
|
@@map("harness_outbox")
|
|
3477
3493
|
}
|
|
3478
3494
|
|
|
3495
|
+
/// 入站 webhook 规则(P5 任务 3,母规格 §6.2/§7)。跨会话定义,属同步白名单;
|
|
3496
|
+
/// 投递副作用经 HarnessOutbox(kind='webhook.delivery')由 Worker 驱动。
|
|
3497
|
+
model HarnessWebhookRule {
|
|
3498
|
+
id String @id @default(cuid())
|
|
3499
|
+
userId String
|
|
3500
|
+
/// 端点不透明令牌(URL 路径段,随机生成、唯一)。只作路由键,不是鉴权凭据
|
|
3501
|
+
token String @unique
|
|
3502
|
+
name String
|
|
3503
|
+
provider String @default("github") // github | generic
|
|
3504
|
+
/// 投递目标线程:Worker 在该线程发起一次 root Session
|
|
3505
|
+
threadId String
|
|
3506
|
+
workspaceId String?
|
|
3507
|
+
prompt String @db.Text
|
|
3508
|
+
/// HMAC-SHA256 密钥(AES 加密落库,encryptApiKey)。明文仅在设置页创建/轮换时
|
|
3509
|
+
/// 返回一次;绝不进 log / 搜索索引 / 工具结果(母规格 §8)。
|
|
3510
|
+
/// **可空**(P5 任务 5):跨端同步只带定义、不带密钥——同步而来的行 secretCipher
|
|
3511
|
+
/// 为 NULL,须在新设备重新录入密钥后该 rule 才能校验(此前一律 503 fail-closed)。
|
|
3512
|
+
secretCipher String?
|
|
3513
|
+
/// 密钥末 4 位,仅供用户识别是哪一把(非敏感)
|
|
3514
|
+
secretHint String
|
|
3515
|
+
/// 订阅事件类型(`push`/`pull_request`/...);null = 全部事件
|
|
3516
|
+
events Json?
|
|
3517
|
+
/// repo 白名单(`owner/repo` 精确匹配);与 ownerWhitelist 至少一个非空
|
|
3518
|
+
repoWhitelist Json?
|
|
3519
|
+
/// owner 白名单(精确匹配)
|
|
3520
|
+
ownerWhitelist Json?
|
|
3521
|
+
status String @default("active") // active | paused | deleted
|
|
3522
|
+
executionPlane String @default("local") // local | cloud
|
|
3523
|
+
lastDeliveryAt DateTime?
|
|
3524
|
+
lastError String? @db.Text
|
|
3525
|
+
revision Int @default(0)
|
|
3526
|
+
createdAt DateTime @default(now())
|
|
3527
|
+
updatedAt DateTime @updatedAt
|
|
3528
|
+
|
|
3529
|
+
deliveries HarnessWebhookDelivery[]
|
|
3530
|
+
|
|
3531
|
+
@@index([userId, status])
|
|
3532
|
+
@@index([threadId, status])
|
|
3533
|
+
@@map("harness_webhook_rules")
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
/// 入站 webhook 投递记录(执行面本地态,不跨端同步)。
|
|
3537
|
+
/// 存事件摘要而非整段 payload:验签用 raw body,落库只需可重建的触发上下文。
|
|
3538
|
+
model HarnessWebhookDelivery {
|
|
3539
|
+
id String @id @default(cuid())
|
|
3540
|
+
ruleId String
|
|
3541
|
+
userId String
|
|
3542
|
+
executionPlane String @default("local")
|
|
3543
|
+
/// 上游事件去重键:`github:<deliveryGuid>`,无 guid 时 `<event>:<timestamp>:<body 摘要>`
|
|
3544
|
+
eventKey String
|
|
3545
|
+
eventType String
|
|
3546
|
+
repo String?
|
|
3547
|
+
owner String?
|
|
3548
|
+
/// 有界事件摘要(event/action/title/url),非整段 payload
|
|
3549
|
+
summary Json
|
|
3550
|
+
state String @default("pending") // pending | claimed | delivered | skipped | failed
|
|
3551
|
+
leaseOwner String?
|
|
3552
|
+
leaseUntil DateTime?
|
|
3553
|
+
fencingToken Int @default(0)
|
|
3554
|
+
attempt Int @default(0)
|
|
3555
|
+
deliveredAt DateTime?
|
|
3556
|
+
lastError String? @db.Text
|
|
3557
|
+
createdAt DateTime @default(now())
|
|
3558
|
+
updatedAt DateTime @updatedAt
|
|
3559
|
+
|
|
3560
|
+
rule HarnessWebhookRule @relation(fields: [ruleId], references: [id], onDelete: Cascade)
|
|
3561
|
+
|
|
3562
|
+
@@unique([ruleId, eventKey])
|
|
3563
|
+
@@index([executionPlane, state, createdAt])
|
|
3564
|
+
@@index([userId, state])
|
|
3565
|
+
@@map("harness_webhook_deliveries")
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3479
3568
|
model HarnessFeedback {
|
|
3480
3569
|
id String @id @default(cuid())
|
|
3481
3570
|
userId String
|
|
@@ -3544,7 +3633,11 @@ model HarnessConnectorAccount {
|
|
|
3544
3633
|
kind String // mcp | oauth
|
|
3545
3634
|
provider String
|
|
3546
3635
|
label String
|
|
3547
|
-
|
|
3636
|
+
/// 加密凭据(AES,encryptApiKey)。**可空**(P5 任务 5):跨端只同步账号元数据
|
|
3637
|
+
/// (kind/provider/label/metadata/expiresAt),凭据永不跨端——同步而来的行
|
|
3638
|
+
/// secretCipher 为 NULL,运行时经 CredentialStore 读到 null → 连接器自然缺席,
|
|
3639
|
+
/// 用户在该设备重新授权后恢复。
|
|
3640
|
+
secretCipher String? @db.Text
|
|
3548
3641
|
metadata Json?
|
|
3549
3642
|
expiresAt DateTime?
|
|
3550
3643
|
createdAt DateTime @default(now())
|
package/cf-env-stub.ts
DELETED
package/cf-env.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Cloudflare Workers 运行时下,module-scope 读取绑定的官方途径
|
|
2
|
-
// (TanStack Start 官方部署口径:process.env 在 CF 的 module scope 为 undefined,
|
|
3
|
-
// env 按请求注入——见 .agents/skills/tanstack-react-start/deployment)。
|
|
4
|
-
// 必须用「module-scope 动态 import + try/catch」而非静态 import:静态导入会在
|
|
5
|
-
// 无 vite alias 的裸 Node ESM 运行时(tsx 直跑的 collab、seed 脚本等)抛
|
|
6
|
-
// ERR_UNSUPPORTED_ESM_URL_SCHEME 直接炸掉加载;动态版三种环境均正确——
|
|
7
|
-
// ① CF 构建(不 alias):workerd 内建模块,拿到真实 env;
|
|
8
|
-
// ② vite alias 构建(vercel/desktop/admin/Pro):解析到 cf-env-stub,返回空 env;
|
|
9
|
-
// ③ 裸 Node/tsx:import 抛 ERR_UNSUPPORTED_ESM_URL_SCHEME,catch 后降级空 env。
|
|
10
|
-
// 类型来自同包 cloudflare-workers.d.ts(轻量声明;勿用 @cloudflare/workers-types
|
|
11
|
-
// 全量 reference——会令下游 tsc 实例化爆炸 OOM)。
|
|
12
|
-
/// <reference path="./cloudflare-workers.d.ts" />
|
|
13
|
-
// ↑ 该 d.ts 纯环境声明、无人 import 且不在包 tsconfig include 内,须经此
|
|
14
|
-
// 显式拉进 program,否则本文件对 "cloudflare:workers" 的解析报 TS2307
|
|
15
|
-
// (静态与动态 import 同病,packages/database 包级 tsc 在 main 上本就红)。
|
|
16
|
-
|
|
17
|
-
let cloudflareEnv: Record<string, unknown> = {};
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
({ env: cloudflareEnv } = await import("cloudflare:workers"));
|
|
21
|
-
} catch {
|
|
22
|
-
// 非 CF 运行时:env 缺席,resolveDatabaseUrl 走 process.env 分支。
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { cloudflareEnv };
|
package/cloudflare-workers.d.ts
DELETED