@allbluecn/database 0.14.8 → 0.14.9

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.
@@ -168,6 +168,7 @@ export type * from './models/HarnessScheduleOccurrence.ts'
168
168
  export type * from './models/HarnessOutbox.ts'
169
169
  export type * from './models/HarnessFeedback.ts'
170
170
  export type * from './models/HarnessMcpServer.ts'
171
+ export type * from './models/HarnessSshHost.ts'
171
172
  export type * from './models/HarnessConnectorAccount.ts'
172
173
  export type * from './models/HarnessSessionSearchDocument.ts'
173
174
  export type * from './models/HarnessSessionSearchToken.ts'
@@ -0,0 +1,32 @@
1
+ -- AlterTable
2
+ ALTER TABLE "chat_threads" ADD COLUMN "sshHostId" TEXT;
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "harness_ssh_hosts" (
6
+ "id" TEXT NOT NULL,
7
+ "userId" TEXT NOT NULL,
8
+ "name" TEXT NOT NULL,
9
+ "host" TEXT NOT NULL,
10
+ "port" INTEGER NOT NULL DEFAULT 22,
11
+ "username" TEXT NOT NULL,
12
+ "authMethod" TEXT NOT NULL,
13
+ "credentialId" TEXT NOT NULL,
14
+ "pinnedFingerprint" TEXT NOT NULL,
15
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
16
+ "updatedAt" TIMESTAMP(3) NOT NULL,
17
+
18
+ CONSTRAINT "harness_ssh_hosts_pkey" PRIMARY KEY ("id")
19
+ );
20
+
21
+ -- CreateIndex
22
+ CREATE INDEX "harness_ssh_hosts_userId_idx" ON "harness_ssh_hosts"("userId");
23
+
24
+ -- CreateIndex
25
+ CREATE UNIQUE INDEX "harness_ssh_hosts_userId_name_key" ON "harness_ssh_hosts"("userId", "name");
26
+
27
+ -- AddForeignKey
28
+ ALTER TABLE "chat_threads" ADD CONSTRAINT "chat_threads_sshHostId_fkey" FOREIGN KEY ("sshHostId") REFERENCES "harness_ssh_hosts"("id") ON DELETE SET NULL ON UPDATE CASCADE;
29
+
30
+ -- AddForeignKey
31
+ ALTER TABLE "harness_ssh_hosts" ADD CONSTRAINT "harness_ssh_hosts_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
32
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allbluecn/database",
3
- "version": "0.14.8",
3
+ "version": "0.14.9",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
package/schema.prisma CHANGED
@@ -120,6 +120,7 @@ model User {
120
120
  createdQuickDocs WorkspaceQuickDoc[]
121
121
  plugins HarnessPlugin[]
122
122
  harnessWorkspaces HarnessWorkspace[]
123
+ harnessSshHosts HarnessSshHost[]
123
124
  agentBindings BusinessAgentBinding[]
124
125
  blobs Blob[]
125
126
  bugsAssigned Bug[] @relation("bugAssignee")
@@ -363,6 +364,9 @@ model ChatThread {
363
364
  agent UserAgent? @relation(fields: [agentId], references: [id], onDelete: SetNull)
364
365
  workspaceId String?
365
366
  workspace HarnessWorkspace? @relation(fields: [workspaceId], references: [id], onDelete: SetNull)
367
+ /// SSH 执行目标(任务 16,仅桌面):非空时工作区后端走远端 SSH 主机
368
+ sshHostId String?
369
+ sshHost HarnessSshHost? @relation(fields: [sshHostId], references: [id], onDelete: SetNull)
366
370
  /// 执行引擎:cloud(服务端模型)/ local(桌面本地 Agent)
367
371
  engine String @default("cloud")
368
372
  /// 本地 Agent 的授权工作目录(engine=local 时必填;仅桌面壳)
@@ -3504,6 +3508,30 @@ model HarnessMcpServer {
3504
3508
  @@map("harness_mcp_servers")
3505
3509
  }
3506
3510
 
3511
+ /// SSH 执行目标主机档案(任务 16,仅桌面):设备本地信任锚,不注册 sync。
3512
+ /// 凭据明文只进 HarnessConnectorAccount(credentialId 引用,以主机记录 id 为 label),
3513
+ /// 库里只存指纹固定值 pinnedFingerprint(TOFU 首次信任后逐次比对)。
3514
+ model HarnessSshHost {
3515
+ id String @id @default(cuid())
3516
+ userId String
3517
+ name String
3518
+ host String
3519
+ port Int @default(22)
3520
+ username String
3521
+ authMethod String // "password" | "key"
3522
+ credentialId String // CredentialStore 引用;明文不入库
3523
+ pinnedFingerprint String // "SHA256:<base64>"
3524
+ createdAt DateTime @default(now())
3525
+ updatedAt DateTime @updatedAt
3526
+
3527
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3528
+ threads ChatThread[]
3529
+
3530
+ @@unique([userId, name])
3531
+ @@index([userId])
3532
+ @@map("harness_ssh_hosts")
3533
+ }
3534
+
3507
3535
  model HarnessConnectorAccount {
3508
3536
  id String @id @default(cuid())
3509
3537
  userId String