@allbluecn/database 0.13.0 → 0.14.0

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.
@@ -11544,7 +11544,8 @@ export const ChatThreadScalarFieldEnum = {
11544
11544
  agentId: 'agentId',
11545
11545
  workspaceId: 'workspaceId',
11546
11546
  engine: 'engine',
11547
- localCwd: 'localCwd'
11547
+ localCwd: 'localCwd',
11548
+ localAgentId: 'localAgentId'
11548
11549
  } as const
11549
11550
 
11550
11551
  export type ChatThreadScalarFieldEnum = (typeof ChatThreadScalarFieldEnum)[keyof typeof ChatThreadScalarFieldEnum]
@@ -399,7 +399,8 @@ export const ChatThreadScalarFieldEnum = {
399
399
  agentId: 'agentId',
400
400
  workspaceId: 'workspaceId',
401
401
  engine: 'engine',
402
- localCwd: 'localCwd'
402
+ localCwd: 'localCwd',
403
+ localAgentId: 'localAgentId'
403
404
  } as const
404
405
 
405
406
  export type ChatThreadScalarFieldEnum = (typeof ChatThreadScalarFieldEnum)[keyof typeof ChatThreadScalarFieldEnum]
@@ -36,6 +36,7 @@ export type ChatThreadMinAggregateOutputType = {
36
36
  workspaceId: string | null
37
37
  engine: string | null
38
38
  localCwd: string | null
39
+ localAgentId: string | null
39
40
  }
40
41
 
41
42
  export type ChatThreadMaxAggregateOutputType = {
@@ -50,6 +51,7 @@ export type ChatThreadMaxAggregateOutputType = {
50
51
  workspaceId: string | null
51
52
  engine: string | null
52
53
  localCwd: string | null
54
+ localAgentId: string | null
53
55
  }
54
56
 
55
57
  export type ChatThreadCountAggregateOutputType = {
@@ -64,6 +66,7 @@ export type ChatThreadCountAggregateOutputType = {
64
66
  workspaceId: number
65
67
  engine: number
66
68
  localCwd: number
69
+ localAgentId: number
67
70
  _all: number
68
71
  }
69
72
 
@@ -80,6 +83,7 @@ export type ChatThreadMinAggregateInputType = {
80
83
  workspaceId?: true
81
84
  engine?: true
82
85
  localCwd?: true
86
+ localAgentId?: true
83
87
  }
84
88
 
85
89
  export type ChatThreadMaxAggregateInputType = {
@@ -94,6 +98,7 @@ export type ChatThreadMaxAggregateInputType = {
94
98
  workspaceId?: true
95
99
  engine?: true
96
100
  localCwd?: true
101
+ localAgentId?: true
97
102
  }
98
103
 
99
104
  export type ChatThreadCountAggregateInputType = {
@@ -108,6 +113,7 @@ export type ChatThreadCountAggregateInputType = {
108
113
  workspaceId?: true
109
114
  engine?: true
110
115
  localCwd?: true
116
+ localAgentId?: true
111
117
  _all?: true
112
118
  }
113
119
 
@@ -195,6 +201,7 @@ export type ChatThreadGroupByOutputType = {
195
201
  workspaceId: string | null
196
202
  engine: string
197
203
  localCwd: string | null
204
+ localAgentId: string | null
198
205
  _count: ChatThreadCountAggregateOutputType | null
199
206
  _min: ChatThreadMinAggregateOutputType | null
200
207
  _max: ChatThreadMaxAggregateOutputType | null
@@ -230,6 +237,7 @@ export type ChatThreadWhereInput = {
230
237
  workspaceId?: Prisma.StringNullableFilter<"ChatThread"> | string | null
231
238
  engine?: Prisma.StringFilter<"ChatThread"> | string
232
239
  localCwd?: Prisma.StringNullableFilter<"ChatThread"> | string | null
240
+ localAgentId?: Prisma.StringNullableFilter<"ChatThread"> | string | null
233
241
  user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
234
242
  messages?: Prisma.ChatMessageListRelationFilter
235
243
  runs?: Prisma.ChatRunListRelationFilter
@@ -251,6 +259,7 @@ export type ChatThreadOrderByWithRelationInput = {
251
259
  workspaceId?: Prisma.SortOrderInput | Prisma.SortOrder
252
260
  engine?: Prisma.SortOrder
253
261
  localCwd?: Prisma.SortOrderInput | Prisma.SortOrder
262
+ localAgentId?: Prisma.SortOrderInput | Prisma.SortOrder
254
263
  user?: Prisma.UserOrderByWithRelationInput
255
264
  messages?: Prisma.ChatMessageOrderByRelationAggregateInput
256
265
  runs?: Prisma.ChatRunOrderByRelationAggregateInput
@@ -275,6 +284,7 @@ export type ChatThreadWhereUniqueInput = Prisma.AtLeast<{
275
284
  workspaceId?: Prisma.StringNullableFilter<"ChatThread"> | string | null
276
285
  engine?: Prisma.StringFilter<"ChatThread"> | string
277
286
  localCwd?: Prisma.StringNullableFilter<"ChatThread"> | string | null
287
+ localAgentId?: Prisma.StringNullableFilter<"ChatThread"> | string | null
278
288
  user?: Prisma.XOR<Prisma.UserScalarRelationFilter, Prisma.UserWhereInput>
279
289
  messages?: Prisma.ChatMessageListRelationFilter
280
290
  runs?: Prisma.ChatRunListRelationFilter
@@ -296,6 +306,7 @@ export type ChatThreadOrderByWithAggregationInput = {
296
306
  workspaceId?: Prisma.SortOrderInput | Prisma.SortOrder
297
307
  engine?: Prisma.SortOrder
298
308
  localCwd?: Prisma.SortOrderInput | Prisma.SortOrder
309
+ localAgentId?: Prisma.SortOrderInput | Prisma.SortOrder
299
310
  _count?: Prisma.ChatThreadCountOrderByAggregateInput
300
311
  _max?: Prisma.ChatThreadMaxOrderByAggregateInput
301
312
  _min?: Prisma.ChatThreadMinOrderByAggregateInput
@@ -316,6 +327,7 @@ export type ChatThreadScalarWhereWithAggregatesInput = {
316
327
  workspaceId?: Prisma.StringNullableWithAggregatesFilter<"ChatThread"> | string | null
317
328
  engine?: Prisma.StringWithAggregatesFilter<"ChatThread"> | string
318
329
  localCwd?: Prisma.StringNullableWithAggregatesFilter<"ChatThread"> | string | null
330
+ localAgentId?: Prisma.StringNullableWithAggregatesFilter<"ChatThread"> | string | null
319
331
  }
320
332
 
321
333
  export type ChatThreadCreateInput = {
@@ -327,6 +339,7 @@ export type ChatThreadCreateInput = {
327
339
  updatedAt?: Date | string
328
340
  engine?: string
329
341
  localCwd?: string | null
342
+ localAgentId?: string | null
330
343
  user: Prisma.UserCreateNestedOneWithoutChatThreadsInput
331
344
  messages?: Prisma.ChatMessageCreateNestedManyWithoutThreadInput
332
345
  runs?: Prisma.ChatRunCreateNestedManyWithoutThreadInput
@@ -348,6 +361,7 @@ export type ChatThreadUncheckedCreateInput = {
348
361
  workspaceId?: string | null
349
362
  engine?: string
350
363
  localCwd?: string | null
364
+ localAgentId?: string | null
351
365
  messages?: Prisma.ChatMessageUncheckedCreateNestedManyWithoutThreadInput
352
366
  runs?: Prisma.ChatRunUncheckedCreateNestedManyWithoutThreadInput
353
367
  interrupts?: Prisma.ChatInterruptUncheckedCreateNestedManyWithoutThreadInput
@@ -363,6 +377,7 @@ export type ChatThreadUpdateInput = {
363
377
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
364
378
  engine?: Prisma.StringFieldUpdateOperationsInput | string
365
379
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
380
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
366
381
  user?: Prisma.UserUpdateOneRequiredWithoutChatThreadsNestedInput
367
382
  messages?: Prisma.ChatMessageUpdateManyWithoutThreadNestedInput
368
383
  runs?: Prisma.ChatRunUpdateManyWithoutThreadNestedInput
@@ -384,6 +399,7 @@ export type ChatThreadUncheckedUpdateInput = {
384
399
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
385
400
  engine?: Prisma.StringFieldUpdateOperationsInput | string
386
401
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
402
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
387
403
  messages?: Prisma.ChatMessageUncheckedUpdateManyWithoutThreadNestedInput
388
404
  runs?: Prisma.ChatRunUncheckedUpdateManyWithoutThreadNestedInput
389
405
  interrupts?: Prisma.ChatInterruptUncheckedUpdateManyWithoutThreadNestedInput
@@ -402,6 +418,7 @@ export type ChatThreadCreateManyInput = {
402
418
  workspaceId?: string | null
403
419
  engine?: string
404
420
  localCwd?: string | null
421
+ localAgentId?: string | null
405
422
  }
406
423
 
407
424
  export type ChatThreadUpdateManyMutationInput = {
@@ -413,6 +430,7 @@ export type ChatThreadUpdateManyMutationInput = {
413
430
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
414
431
  engine?: Prisma.StringFieldUpdateOperationsInput | string
415
432
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
433
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
416
434
  }
417
435
 
418
436
  export type ChatThreadUncheckedUpdateManyInput = {
@@ -427,6 +445,7 @@ export type ChatThreadUncheckedUpdateManyInput = {
427
445
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
428
446
  engine?: Prisma.StringFieldUpdateOperationsInput | string
429
447
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
448
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
430
449
  }
431
450
 
432
451
  export type ChatThreadListRelationFilter = {
@@ -451,6 +470,7 @@ export type ChatThreadCountOrderByAggregateInput = {
451
470
  workspaceId?: Prisma.SortOrder
452
471
  engine?: Prisma.SortOrder
453
472
  localCwd?: Prisma.SortOrder
473
+ localAgentId?: Prisma.SortOrder
454
474
  }
455
475
 
456
476
  export type ChatThreadMaxOrderByAggregateInput = {
@@ -465,6 +485,7 @@ export type ChatThreadMaxOrderByAggregateInput = {
465
485
  workspaceId?: Prisma.SortOrder
466
486
  engine?: Prisma.SortOrder
467
487
  localCwd?: Prisma.SortOrder
488
+ localAgentId?: Prisma.SortOrder
468
489
  }
469
490
 
470
491
  export type ChatThreadMinOrderByAggregateInput = {
@@ -479,6 +500,7 @@ export type ChatThreadMinOrderByAggregateInput = {
479
500
  workspaceId?: Prisma.SortOrder
480
501
  engine?: Prisma.SortOrder
481
502
  localCwd?: Prisma.SortOrder
503
+ localAgentId?: Prisma.SortOrder
482
504
  }
483
505
 
484
506
  export type ChatThreadScalarRelationFilter = {
@@ -677,6 +699,7 @@ export type ChatThreadCreateWithoutUserInput = {
677
699
  updatedAt?: Date | string
678
700
  engine?: string
679
701
  localCwd?: string | null
702
+ localAgentId?: string | null
680
703
  messages?: Prisma.ChatMessageCreateNestedManyWithoutThreadInput
681
704
  runs?: Prisma.ChatRunCreateNestedManyWithoutThreadInput
682
705
  interrupts?: Prisma.ChatInterruptCreateNestedManyWithoutThreadInput
@@ -696,6 +719,7 @@ export type ChatThreadUncheckedCreateWithoutUserInput = {
696
719
  workspaceId?: string | null
697
720
  engine?: string
698
721
  localCwd?: string | null
722
+ localAgentId?: string | null
699
723
  messages?: Prisma.ChatMessageUncheckedCreateNestedManyWithoutThreadInput
700
724
  runs?: Prisma.ChatRunUncheckedCreateNestedManyWithoutThreadInput
701
725
  interrupts?: Prisma.ChatInterruptUncheckedCreateNestedManyWithoutThreadInput
@@ -743,6 +767,7 @@ export type ChatThreadScalarWhereInput = {
743
767
  workspaceId?: Prisma.StringNullableFilter<"ChatThread"> | string | null
744
768
  engine?: Prisma.StringFilter<"ChatThread"> | string
745
769
  localCwd?: Prisma.StringNullableFilter<"ChatThread"> | string | null
770
+ localAgentId?: Prisma.StringNullableFilter<"ChatThread"> | string | null
746
771
  }
747
772
 
748
773
  export type ChatThreadCreateWithoutMessagesInput = {
@@ -754,6 +779,7 @@ export type ChatThreadCreateWithoutMessagesInput = {
754
779
  updatedAt?: Date | string
755
780
  engine?: string
756
781
  localCwd?: string | null
782
+ localAgentId?: string | null
757
783
  user: Prisma.UserCreateNestedOneWithoutChatThreadsInput
758
784
  runs?: Prisma.ChatRunCreateNestedManyWithoutThreadInput
759
785
  interrupts?: Prisma.ChatInterruptCreateNestedManyWithoutThreadInput
@@ -774,6 +800,7 @@ export type ChatThreadUncheckedCreateWithoutMessagesInput = {
774
800
  workspaceId?: string | null
775
801
  engine?: string
776
802
  localCwd?: string | null
803
+ localAgentId?: string | null
777
804
  runs?: Prisma.ChatRunUncheckedCreateNestedManyWithoutThreadInput
778
805
  interrupts?: Prisma.ChatInterruptUncheckedCreateNestedManyWithoutThreadInput
779
806
  generations?: Prisma.GenerationRunUncheckedCreateNestedManyWithoutThreadInput
@@ -804,6 +831,7 @@ export type ChatThreadUpdateWithoutMessagesInput = {
804
831
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
805
832
  engine?: Prisma.StringFieldUpdateOperationsInput | string
806
833
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
834
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
807
835
  user?: Prisma.UserUpdateOneRequiredWithoutChatThreadsNestedInput
808
836
  runs?: Prisma.ChatRunUpdateManyWithoutThreadNestedInput
809
837
  interrupts?: Prisma.ChatInterruptUpdateManyWithoutThreadNestedInput
@@ -824,6 +852,7 @@ export type ChatThreadUncheckedUpdateWithoutMessagesInput = {
824
852
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
825
853
  engine?: Prisma.StringFieldUpdateOperationsInput | string
826
854
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
855
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
827
856
  runs?: Prisma.ChatRunUncheckedUpdateManyWithoutThreadNestedInput
828
857
  interrupts?: Prisma.ChatInterruptUncheckedUpdateManyWithoutThreadNestedInput
829
858
  generations?: Prisma.GenerationRunUncheckedUpdateManyWithoutThreadNestedInput
@@ -838,6 +867,7 @@ export type ChatThreadCreateWithoutRunsInput = {
838
867
  updatedAt?: Date | string
839
868
  engine?: string
840
869
  localCwd?: string | null
870
+ localAgentId?: string | null
841
871
  user: Prisma.UserCreateNestedOneWithoutChatThreadsInput
842
872
  messages?: Prisma.ChatMessageCreateNestedManyWithoutThreadInput
843
873
  interrupts?: Prisma.ChatInterruptCreateNestedManyWithoutThreadInput
@@ -858,6 +888,7 @@ export type ChatThreadUncheckedCreateWithoutRunsInput = {
858
888
  workspaceId?: string | null
859
889
  engine?: string
860
890
  localCwd?: string | null
891
+ localAgentId?: string | null
861
892
  messages?: Prisma.ChatMessageUncheckedCreateNestedManyWithoutThreadInput
862
893
  interrupts?: Prisma.ChatInterruptUncheckedCreateNestedManyWithoutThreadInput
863
894
  generations?: Prisma.GenerationRunUncheckedCreateNestedManyWithoutThreadInput
@@ -888,6 +919,7 @@ export type ChatThreadUpdateWithoutRunsInput = {
888
919
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
889
920
  engine?: Prisma.StringFieldUpdateOperationsInput | string
890
921
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
922
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
891
923
  user?: Prisma.UserUpdateOneRequiredWithoutChatThreadsNestedInput
892
924
  messages?: Prisma.ChatMessageUpdateManyWithoutThreadNestedInput
893
925
  interrupts?: Prisma.ChatInterruptUpdateManyWithoutThreadNestedInput
@@ -908,6 +940,7 @@ export type ChatThreadUncheckedUpdateWithoutRunsInput = {
908
940
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
909
941
  engine?: Prisma.StringFieldUpdateOperationsInput | string
910
942
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
943
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
911
944
  messages?: Prisma.ChatMessageUncheckedUpdateManyWithoutThreadNestedInput
912
945
  interrupts?: Prisma.ChatInterruptUncheckedUpdateManyWithoutThreadNestedInput
913
946
  generations?: Prisma.GenerationRunUncheckedUpdateManyWithoutThreadNestedInput
@@ -922,6 +955,7 @@ export type ChatThreadCreateWithoutInterruptsInput = {
922
955
  updatedAt?: Date | string
923
956
  engine?: string
924
957
  localCwd?: string | null
958
+ localAgentId?: string | null
925
959
  user: Prisma.UserCreateNestedOneWithoutChatThreadsInput
926
960
  messages?: Prisma.ChatMessageCreateNestedManyWithoutThreadInput
927
961
  runs?: Prisma.ChatRunCreateNestedManyWithoutThreadInput
@@ -942,6 +976,7 @@ export type ChatThreadUncheckedCreateWithoutInterruptsInput = {
942
976
  workspaceId?: string | null
943
977
  engine?: string
944
978
  localCwd?: string | null
979
+ localAgentId?: string | null
945
980
  messages?: Prisma.ChatMessageUncheckedCreateNestedManyWithoutThreadInput
946
981
  runs?: Prisma.ChatRunUncheckedCreateNestedManyWithoutThreadInput
947
982
  generations?: Prisma.GenerationRunUncheckedCreateNestedManyWithoutThreadInput
@@ -972,6 +1007,7 @@ export type ChatThreadUpdateWithoutInterruptsInput = {
972
1007
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
973
1008
  engine?: Prisma.StringFieldUpdateOperationsInput | string
974
1009
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1010
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
975
1011
  user?: Prisma.UserUpdateOneRequiredWithoutChatThreadsNestedInput
976
1012
  messages?: Prisma.ChatMessageUpdateManyWithoutThreadNestedInput
977
1013
  runs?: Prisma.ChatRunUpdateManyWithoutThreadNestedInput
@@ -992,6 +1028,7 @@ export type ChatThreadUncheckedUpdateWithoutInterruptsInput = {
992
1028
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
993
1029
  engine?: Prisma.StringFieldUpdateOperationsInput | string
994
1030
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1031
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
995
1032
  messages?: Prisma.ChatMessageUncheckedUpdateManyWithoutThreadNestedInput
996
1033
  runs?: Prisma.ChatRunUncheckedUpdateManyWithoutThreadNestedInput
997
1034
  generations?: Prisma.GenerationRunUncheckedUpdateManyWithoutThreadNestedInput
@@ -1006,6 +1043,7 @@ export type ChatThreadCreateWithoutGenerationsInput = {
1006
1043
  updatedAt?: Date | string
1007
1044
  engine?: string
1008
1045
  localCwd?: string | null
1046
+ localAgentId?: string | null
1009
1047
  user: Prisma.UserCreateNestedOneWithoutChatThreadsInput
1010
1048
  messages?: Prisma.ChatMessageCreateNestedManyWithoutThreadInput
1011
1049
  runs?: Prisma.ChatRunCreateNestedManyWithoutThreadInput
@@ -1026,6 +1064,7 @@ export type ChatThreadUncheckedCreateWithoutGenerationsInput = {
1026
1064
  workspaceId?: string | null
1027
1065
  engine?: string
1028
1066
  localCwd?: string | null
1067
+ localAgentId?: string | null
1029
1068
  messages?: Prisma.ChatMessageUncheckedCreateNestedManyWithoutThreadInput
1030
1069
  runs?: Prisma.ChatRunUncheckedCreateNestedManyWithoutThreadInput
1031
1070
  interrupts?: Prisma.ChatInterruptUncheckedCreateNestedManyWithoutThreadInput
@@ -1056,6 +1095,7 @@ export type ChatThreadUpdateWithoutGenerationsInput = {
1056
1095
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
1057
1096
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1058
1097
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1098
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1059
1099
  user?: Prisma.UserUpdateOneRequiredWithoutChatThreadsNestedInput
1060
1100
  messages?: Prisma.ChatMessageUpdateManyWithoutThreadNestedInput
1061
1101
  runs?: Prisma.ChatRunUpdateManyWithoutThreadNestedInput
@@ -1076,6 +1116,7 @@ export type ChatThreadUncheckedUpdateWithoutGenerationsInput = {
1076
1116
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1077
1117
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1078
1118
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1119
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1079
1120
  messages?: Prisma.ChatMessageUncheckedUpdateManyWithoutThreadNestedInput
1080
1121
  runs?: Prisma.ChatRunUncheckedUpdateManyWithoutThreadNestedInput
1081
1122
  interrupts?: Prisma.ChatInterruptUncheckedUpdateManyWithoutThreadNestedInput
@@ -1090,6 +1131,7 @@ export type ChatThreadCreateWithoutAgentInput = {
1090
1131
  updatedAt?: Date | string
1091
1132
  engine?: string
1092
1133
  localCwd?: string | null
1134
+ localAgentId?: string | null
1093
1135
  user: Prisma.UserCreateNestedOneWithoutChatThreadsInput
1094
1136
  messages?: Prisma.ChatMessageCreateNestedManyWithoutThreadInput
1095
1137
  runs?: Prisma.ChatRunCreateNestedManyWithoutThreadInput
@@ -1109,6 +1151,7 @@ export type ChatThreadUncheckedCreateWithoutAgentInput = {
1109
1151
  workspaceId?: string | null
1110
1152
  engine?: string
1111
1153
  localCwd?: string | null
1154
+ localAgentId?: string | null
1112
1155
  messages?: Prisma.ChatMessageUncheckedCreateNestedManyWithoutThreadInput
1113
1156
  runs?: Prisma.ChatRunUncheckedCreateNestedManyWithoutThreadInput
1114
1157
  interrupts?: Prisma.ChatInterruptUncheckedCreateNestedManyWithoutThreadInput
@@ -1150,6 +1193,7 @@ export type ChatThreadCreateWithoutWorkspaceInput = {
1150
1193
  updatedAt?: Date | string
1151
1194
  engine?: string
1152
1195
  localCwd?: string | null
1196
+ localAgentId?: string | null
1153
1197
  user: Prisma.UserCreateNestedOneWithoutChatThreadsInput
1154
1198
  messages?: Prisma.ChatMessageCreateNestedManyWithoutThreadInput
1155
1199
  runs?: Prisma.ChatRunCreateNestedManyWithoutThreadInput
@@ -1169,6 +1213,7 @@ export type ChatThreadUncheckedCreateWithoutWorkspaceInput = {
1169
1213
  agentId?: string | null
1170
1214
  engine?: string
1171
1215
  localCwd?: string | null
1216
+ localAgentId?: string | null
1172
1217
  messages?: Prisma.ChatMessageUncheckedCreateNestedManyWithoutThreadInput
1173
1218
  runs?: Prisma.ChatRunUncheckedCreateNestedManyWithoutThreadInput
1174
1219
  interrupts?: Prisma.ChatInterruptUncheckedCreateNestedManyWithoutThreadInput
@@ -1212,6 +1257,7 @@ export type ChatThreadCreateManyUserInput = {
1212
1257
  workspaceId?: string | null
1213
1258
  engine?: string
1214
1259
  localCwd?: string | null
1260
+ localAgentId?: string | null
1215
1261
  }
1216
1262
 
1217
1263
  export type ChatThreadUpdateWithoutUserInput = {
@@ -1223,6 +1269,7 @@ export type ChatThreadUpdateWithoutUserInput = {
1223
1269
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
1224
1270
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1225
1271
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1272
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1226
1273
  messages?: Prisma.ChatMessageUpdateManyWithoutThreadNestedInput
1227
1274
  runs?: Prisma.ChatRunUpdateManyWithoutThreadNestedInput
1228
1275
  interrupts?: Prisma.ChatInterruptUpdateManyWithoutThreadNestedInput
@@ -1242,6 +1289,7 @@ export type ChatThreadUncheckedUpdateWithoutUserInput = {
1242
1289
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1243
1290
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1244
1291
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1292
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1245
1293
  messages?: Prisma.ChatMessageUncheckedUpdateManyWithoutThreadNestedInput
1246
1294
  runs?: Prisma.ChatRunUncheckedUpdateManyWithoutThreadNestedInput
1247
1295
  interrupts?: Prisma.ChatInterruptUncheckedUpdateManyWithoutThreadNestedInput
@@ -1259,6 +1307,7 @@ export type ChatThreadUncheckedUpdateManyWithoutUserInput = {
1259
1307
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1260
1308
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1261
1309
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1310
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1262
1311
  }
1263
1312
 
1264
1313
  export type ChatThreadCreateManyAgentInput = {
@@ -1272,6 +1321,7 @@ export type ChatThreadCreateManyAgentInput = {
1272
1321
  workspaceId?: string | null
1273
1322
  engine?: string
1274
1323
  localCwd?: string | null
1324
+ localAgentId?: string | null
1275
1325
  }
1276
1326
 
1277
1327
  export type ChatThreadUpdateWithoutAgentInput = {
@@ -1283,6 +1333,7 @@ export type ChatThreadUpdateWithoutAgentInput = {
1283
1333
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
1284
1334
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1285
1335
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1336
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1286
1337
  user?: Prisma.UserUpdateOneRequiredWithoutChatThreadsNestedInput
1287
1338
  messages?: Prisma.ChatMessageUpdateManyWithoutThreadNestedInput
1288
1339
  runs?: Prisma.ChatRunUpdateManyWithoutThreadNestedInput
@@ -1302,6 +1353,7 @@ export type ChatThreadUncheckedUpdateWithoutAgentInput = {
1302
1353
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1303
1354
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1304
1355
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1356
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1305
1357
  messages?: Prisma.ChatMessageUncheckedUpdateManyWithoutThreadNestedInput
1306
1358
  runs?: Prisma.ChatRunUncheckedUpdateManyWithoutThreadNestedInput
1307
1359
  interrupts?: Prisma.ChatInterruptUncheckedUpdateManyWithoutThreadNestedInput
@@ -1319,6 +1371,7 @@ export type ChatThreadUncheckedUpdateManyWithoutAgentInput = {
1319
1371
  workspaceId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1320
1372
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1321
1373
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1374
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1322
1375
  }
1323
1376
 
1324
1377
  export type ChatThreadCreateManyWorkspaceInput = {
@@ -1332,6 +1385,7 @@ export type ChatThreadCreateManyWorkspaceInput = {
1332
1385
  agentId?: string | null
1333
1386
  engine?: string
1334
1387
  localCwd?: string | null
1388
+ localAgentId?: string | null
1335
1389
  }
1336
1390
 
1337
1391
  export type ChatThreadUpdateWithoutWorkspaceInput = {
@@ -1343,6 +1397,7 @@ export type ChatThreadUpdateWithoutWorkspaceInput = {
1343
1397
  updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
1344
1398
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1345
1399
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1400
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1346
1401
  user?: Prisma.UserUpdateOneRequiredWithoutChatThreadsNestedInput
1347
1402
  messages?: Prisma.ChatMessageUpdateManyWithoutThreadNestedInput
1348
1403
  runs?: Prisma.ChatRunUpdateManyWithoutThreadNestedInput
@@ -1362,6 +1417,7 @@ export type ChatThreadUncheckedUpdateWithoutWorkspaceInput = {
1362
1417
  agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1363
1418
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1364
1419
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1420
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1365
1421
  messages?: Prisma.ChatMessageUncheckedUpdateManyWithoutThreadNestedInput
1366
1422
  runs?: Prisma.ChatRunUncheckedUpdateManyWithoutThreadNestedInput
1367
1423
  interrupts?: Prisma.ChatInterruptUncheckedUpdateManyWithoutThreadNestedInput
@@ -1379,6 +1435,7 @@ export type ChatThreadUncheckedUpdateManyWithoutWorkspaceInput = {
1379
1435
  agentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1380
1436
  engine?: Prisma.StringFieldUpdateOperationsInput | string
1381
1437
  localCwd?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1438
+ localAgentId?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
1382
1439
  }
1383
1440
 
1384
1441
 
@@ -1451,6 +1508,7 @@ export type ChatThreadSelect<ExtArgs extends runtime.Types.Extensions.InternalAr
1451
1508
  workspaceId?: boolean
1452
1509
  engine?: boolean
1453
1510
  localCwd?: boolean
1511
+ localAgentId?: boolean
1454
1512
  user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
1455
1513
  messages?: boolean | Prisma.ChatThread$messagesArgs<ExtArgs>
1456
1514
  runs?: boolean | Prisma.ChatThread$runsArgs<ExtArgs>
@@ -1473,6 +1531,7 @@ export type ChatThreadSelectCreateManyAndReturn<ExtArgs extends runtime.Types.Ex
1473
1531
  workspaceId?: boolean
1474
1532
  engine?: boolean
1475
1533
  localCwd?: boolean
1534
+ localAgentId?: boolean
1476
1535
  user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
1477
1536
  agent?: boolean | Prisma.ChatThread$agentArgs<ExtArgs>
1478
1537
  workspace?: boolean | Prisma.ChatThread$workspaceArgs<ExtArgs>
@@ -1490,6 +1549,7 @@ export type ChatThreadSelectUpdateManyAndReturn<ExtArgs extends runtime.Types.Ex
1490
1549
  workspaceId?: boolean
1491
1550
  engine?: boolean
1492
1551
  localCwd?: boolean
1552
+ localAgentId?: boolean
1493
1553
  user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
1494
1554
  agent?: boolean | Prisma.ChatThread$agentArgs<ExtArgs>
1495
1555
  workspace?: boolean | Prisma.ChatThread$workspaceArgs<ExtArgs>
@@ -1507,9 +1567,10 @@ export type ChatThreadSelectScalar = {
1507
1567
  workspaceId?: boolean
1508
1568
  engine?: boolean
1509
1569
  localCwd?: boolean
1570
+ localAgentId?: boolean
1510
1571
  }
1511
1572
 
1512
- export type ChatThreadOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "userId" | "title" | "isArchived" | "sandboxPolicy" | "createdAt" | "updatedAt" | "agentId" | "workspaceId" | "engine" | "localCwd", ExtArgs["result"]["chatThread"]>
1573
+ export type ChatThreadOmit<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetOmit<"id" | "userId" | "title" | "isArchived" | "sandboxPolicy" | "createdAt" | "updatedAt" | "agentId" | "workspaceId" | "engine" | "localCwd" | "localAgentId", ExtArgs["result"]["chatThread"]>
1513
1574
  export type ChatThreadInclude<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
1514
1575
  user?: boolean | Prisma.UserDefaultArgs<ExtArgs>
1515
1576
  messages?: boolean | Prisma.ChatThread$messagesArgs<ExtArgs>
@@ -1553,13 +1614,17 @@ export type $ChatThreadPayload<ExtArgs extends runtime.Types.Extensions.Internal
1553
1614
  agentId: string | null
1554
1615
  workspaceId: string | null
1555
1616
  /**
1556
- * 执行引擎:cloud(服务端模型)/ local(桌面 pi 本地 Agent,只读四件套)
1617
+ * 执行引擎:cloud(服务端模型)/ local(桌面本地 Agent)
1557
1618
  */
1558
1619
  engine: string
1559
1620
  /**
1560
1621
  * 本地 Agent 的授权工作目录(engine=local 时必填;仅桌面壳)
1561
1622
  */
1562
1623
  localCwd: string | null
1624
+ /**
1625
+ * 本地 agent 选择(engine=local 时):'pi'(内置引擎,null 视同)/ 'acp:<catalogId>'
1626
+ */
1627
+ localAgentId: string | null
1563
1628
  }, ExtArgs["result"]["chatThread"]>
1564
1629
  composites: {}
1565
1630
  }
@@ -2001,6 +2066,7 @@ export interface ChatThreadFieldRefs {
2001
2066
  readonly workspaceId: Prisma.FieldRef<"ChatThread", 'String'>
2002
2067
  readonly engine: Prisma.FieldRef<"ChatThread", 'String'>
2003
2068
  readonly localCwd: Prisma.FieldRef<"ChatThread", 'String'>
2069
+ readonly localAgentId: Prisma.FieldRef<"ChatThread", 'String'>
2004
2070
  }
2005
2071
 
2006
2072
 
@@ -0,0 +1,4 @@
1
+ -- 多本地 agent(桌面):线程级本地 agent 选择
2
+ -- 'pi'(内置引擎,NULL 视同)/ 'acp:<catalogId>'(本机 ACP 客户端);
3
+ -- 存量线程 NULL = pi,行为不变。
4
+ ALTER TABLE "chat_threads" ADD COLUMN "localAgentId" TEXT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allbluecn/database",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -26,6 +26,7 @@
26
26
  ".": "./index.ts",
27
27
  "./get-prisma": "./get-prisma.ts",
28
28
  "./pglite-init": "./pglite-init.ts",
29
+ "./pglite-seed": "./pglite-seed.ts",
29
30
  "./cf-env": "./cf-env.ts",
30
31
  "./cf-env-stub": "./cf-env-stub.ts",
31
32
  "./lib/share-utils": "./src/lib/share-utils.ts",
@@ -48,6 +49,7 @@
48
49
  "prisma.config.ts",
49
50
  "migrations",
50
51
  "pglite-init.ts",
52
+ "pglite-seed.ts",
51
53
  "index.ts",
52
54
  "get-prisma.ts",
53
55
  "cf-env.ts",
package/pglite-init.ts CHANGED
@@ -15,6 +15,7 @@ import { PGlite } from "@electric-sql/pglite";
15
15
  import { vector } from "@electric-sql/pglite-pgvector";
16
16
  import { PrismaPGlite } from "pglite-prisma-adapter";
17
17
  import { PrismaClient } from "./generated/client.ts";
18
+ import { seedAiProvidersPglite, type PgliteSeedPrisma } from "./pglite-seed.ts";
18
19
 
19
20
  const LEDGER_DDL = `
20
21
  CREATE TABLE IF NOT EXISTS _pglite_migrations (
@@ -74,6 +75,19 @@ export async function createPglite(options: PgliteInitOptions): Promise<PgliteHa
74
75
  adapter: new PrismaPGlite(db),
75
76
  log: ["error"],
76
77
  }) as unknown as PrismaClient;
78
+
79
+ // 桌面没有 `prisma db seed` 步骤:迁移后 create-only 补种 AI 服务商目录
80
+ // (幂等,已有行跳过)。失败不阻断启动(降级为空目录,设置页可见症状),
81
+ // 但必须大声报错——静默空目录正是本 seed 要修的缺陷。
82
+ try {
83
+ const created = await seedAiProvidersPglite(prisma as unknown as PgliteSeedPrisma);
84
+ if (created > 0) {
85
+ console.log(`[pglite-init] AI 服务商目录 seed:新增 ${created} 条`);
86
+ }
87
+ } catch (error) {
88
+ console.error("[pglite-init] AI 服务商目录 seed 失败(降级为空目录):", error);
89
+ }
90
+
77
91
  const handle = { db, prisma };
78
92
  // 宿主协调:Electron backend entry 预热实例后,nitro 内 database/index.ts
79
93
  // 经此共享同一 PGlite(单实例约束——同目录双实例会损坏 cluster)
package/pglite-seed.ts ADDED
@@ -0,0 +1,63 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+
5
+ // 桌面端(Electron + PGlite)目录 seed:AiProvider 预置服务商。
6
+ // 云端/web 走 `prisma db seed`(seed/seed-ai-providers.ts,同一份 SEED_AI_PROVIDERS
7
+ // 数据源);桌面 PGlite 初始化只有迁移步骤、没有 seed 钩子,目录表为空会导致
8
+ // 设置页「使用自己的 Key」无预置服务商、agent BYOK 元数据解析全跳过。
9
+ //
10
+ // 语义与 seed/seed-ai-providers.ts 默认模式逐项对齐(create-only):
11
+ // - 不存在 → 插入(enabled: true,sortOrder = 目录顺序)
12
+ // - 已存在 → 跳过(保留对元数据的修改)
13
+ // 映射字段若两边任一改动,必须同步另一边。
14
+ import { SEED_AI_PROVIDERS } from "@allbluecn/kernel";
15
+
16
+ /** prisma 最小写入面(结构类型:调用方传真实 PrismaClient 或测试桩均可) */
17
+ export interface PgliteSeedPrisma {
18
+ aiProvider: {
19
+ findUnique(args: { where: { providerId: string } }): Promise<unknown | null>;
20
+ create(args: { data: Record<string, unknown> }): Promise<unknown>;
21
+ };
22
+ }
23
+
24
+ /**
25
+ * create-only 补种 AI 服务商目录,返回本次新增条数。单条失败 warn 后继续
26
+ * (一条坏数据不拖垮其余目录);调用方决定整体失败时是否阻断启动。
27
+ */
28
+ export async function seedAiProvidersPglite(prisma: PgliteSeedPrisma): Promise<number> {
29
+ let created = 0;
30
+ for (let i = 0; i < SEED_AI_PROVIDERS.length; i++) {
31
+ const p = SEED_AI_PROVIDERS[i]!;
32
+ const data: Record<string, unknown> = {
33
+ providerId: p.providerId,
34
+ displayName: p.displayName,
35
+ brandName: p.brandName,
36
+ description: p.description,
37
+ category: p.category,
38
+ adapterKind: p.adapterKind,
39
+ defaultBaseUrl: p.defaultBaseUrl ?? null,
40
+ keyUrl: p.keyUrl ?? null,
41
+ docsUrl: p.docsUrl ?? null,
42
+ keyPlaceholder: p.keyPlaceholder ?? null,
43
+ iconSlug: p.iconSlug ?? null,
44
+ brandColor: p.brandColor,
45
+ badge: p.badge ?? null,
46
+ isLocal: p.isLocal ?? false,
47
+ models: p.models,
48
+ sortOrder: i,
49
+ enabled: true,
50
+ };
51
+ try {
52
+ const existing = await prisma.aiProvider.findUnique({
53
+ where: { providerId: p.providerId },
54
+ });
55
+ if (existing) continue;
56
+ await prisma.aiProvider.create({ data });
57
+ created++;
58
+ } catch (error) {
59
+ console.warn(`[pglite-seed] AiProvider ${p.providerId} 补种失败,跳过:`, error);
60
+ }
61
+ }
62
+ return created;
63
+ }
package/schema.prisma CHANGED
@@ -363,10 +363,12 @@ model ChatThread {
363
363
  agent UserAgent? @relation(fields: [agentId], references: [id], onDelete: SetNull)
364
364
  workspaceId String?
365
365
  workspace HarnessWorkspace? @relation(fields: [workspaceId], references: [id], onDelete: SetNull)
366
- /// 执行引擎:cloud(服务端模型)/ local(桌面 pi 本地 Agent,只读四件套)
366
+ /// 执行引擎:cloud(服务端模型)/ local(桌面本地 Agent)
367
367
  engine String @default("cloud")
368
368
  /// 本地 Agent 的授权工作目录(engine=local 时必填;仅桌面壳)
369
369
  localCwd String?
370
+ /// 本地 agent 选择(engine=local 时):'pi'(内置引擎,null 视同)/ 'acp:<catalogId>'
371
+ localAgentId String?
370
372
 
371
373
  @@index([userId, updatedAt])
372
374
  @@map("chat_threads")