libre-webui 0.21.3 → 0.22.1

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.
Files changed (945) hide show
  1. package/README.md +308 -328
  2. package/backend/dist/cli/migrateSqliteToPostgres.d.ts +2 -0
  3. package/backend/dist/cli/migrateSqliteToPostgres.d.ts.map +1 -0
  4. package/backend/dist/cli/migrateSqliteToPostgres.js +113 -0
  5. package/backend/dist/cli/migrateSqliteToPostgres.js.map +1 -0
  6. package/backend/dist/cli/recoveryBackup.d.ts +3 -0
  7. package/backend/dist/cli/recoveryBackup.d.ts.map +1 -0
  8. package/backend/dist/cli/recoveryBackup.js +251 -0
  9. package/backend/dist/cli/recoveryBackup.js.map +1 -0
  10. package/backend/dist/cli/recoveryInventory.d.ts +2 -0
  11. package/backend/dist/cli/recoveryInventory.d.ts.map +1 -0
  12. package/backend/dist/cli/recoveryInventory.js +109 -0
  13. package/backend/dist/cli/recoveryInventory.js.map +1 -0
  14. package/backend/dist/db.d.ts +27 -0
  15. package/backend/dist/db.d.ts.map +1 -1
  16. package/backend/dist/db.js +333 -16
  17. package/backend/dist/db.js.map +1 -1
  18. package/backend/dist/env.d.ts.map +1 -1
  19. package/backend/dist/env.js +12 -2
  20. package/backend/dist/env.js.map +1 -1
  21. package/backend/dist/index.d.ts.map +1 -1
  22. package/backend/dist/index.js +235 -47
  23. package/backend/dist/index.js.map +1 -1
  24. package/backend/dist/main.d.ts +2 -0
  25. package/backend/dist/main.d.ts.map +1 -0
  26. package/backend/dist/main.js +137 -0
  27. package/backend/dist/main.js.map +1 -0
  28. package/backend/dist/middleware/auth.d.ts.map +1 -1
  29. package/backend/dist/middleware/auth.js +7 -3
  30. package/backend/dist/middleware/auth.js.map +1 -1
  31. package/backend/dist/middleware/chatCancellationAdmission.d.ts +7 -0
  32. package/backend/dist/middleware/chatCancellationAdmission.d.ts.map +1 -0
  33. package/backend/dist/middleware/chatCancellationAdmission.js +17 -0
  34. package/backend/dist/middleware/chatCancellationAdmission.js.map +1 -0
  35. package/backend/dist/middleware/coordinatedRateLimit.d.ts +18 -0
  36. package/backend/dist/middleware/coordinatedRateLimit.d.ts.map +1 -0
  37. package/backend/dist/middleware/coordinatedRateLimit.js +52 -0
  38. package/backend/dist/middleware/coordinatedRateLimit.js.map +1 -0
  39. package/backend/dist/middleware/sharedRateLimit.d.ts +26 -0
  40. package/backend/dist/middleware/sharedRateLimit.d.ts.map +1 -0
  41. package/backend/dist/middleware/sharedRateLimit.js +99 -0
  42. package/backend/dist/middleware/sharedRateLimit.js.map +1 -0
  43. package/backend/dist/models/personaModel.d.ts +1 -26
  44. package/backend/dist/models/personaModel.d.ts.map +1 -1
  45. package/backend/dist/models/personaModel.js +54 -247
  46. package/backend/dist/models/personaModel.js.map +1 -1
  47. package/backend/dist/models/userModel.d.ts +23 -66
  48. package/backend/dist/models/userModel.d.ts.map +1 -1
  49. package/backend/dist/models/userModel.js +110 -187
  50. package/backend/dist/models/userModel.js.map +1 -1
  51. package/backend/dist/persistence/chatGenerationTypes.d.ts +24 -0
  52. package/backend/dist/persistence/chatGenerationTypes.d.ts.map +1 -0
  53. package/backend/dist/persistence/chatGenerationTypes.js +7 -0
  54. package/backend/dist/persistence/chatGenerationTypes.js.map +1 -0
  55. package/backend/dist/persistence/extensionTypes.d.ts +185 -0
  56. package/backend/dist/persistence/extensionTypes.d.ts.map +1 -0
  57. package/backend/dist/persistence/extensionTypes.js +13 -0
  58. package/backend/dist/persistence/extensionTypes.js.map +1 -0
  59. package/backend/dist/persistence/identityDeletionTypes.d.ts +16 -0
  60. package/backend/dist/persistence/identityDeletionTypes.d.ts.map +1 -0
  61. package/backend/dist/persistence/identityDeletionTypes.js +7 -0
  62. package/backend/dist/persistence/identityDeletionTypes.js.map +1 -0
  63. package/backend/dist/persistence/index.d.ts +48 -0
  64. package/backend/dist/persistence/index.d.ts.map +1 -0
  65. package/backend/dist/persistence/index.js +159 -0
  66. package/backend/dist/persistence/index.js.map +1 -0
  67. package/backend/dist/persistence/postgresConfig.d.ts +32 -0
  68. package/backend/dist/persistence/postgresConfig.d.ts.map +1 -0
  69. package/backend/dist/persistence/postgresConfig.js +91 -0
  70. package/backend/dist/persistence/postgresConfig.js.map +1 -0
  71. package/backend/dist/persistence/postgresCoreMigration.d.ts +8 -0
  72. package/backend/dist/persistence/postgresCoreMigration.d.ts.map +1 -0
  73. package/backend/dist/persistence/postgresCoreMigration.js +179 -0
  74. package/backend/dist/persistence/postgresCoreMigration.js.map +1 -0
  75. package/backend/dist/persistence/postgresDatabase.d.ts +40 -0
  76. package/backend/dist/persistence/postgresDatabase.d.ts.map +1 -0
  77. package/backend/dist/persistence/postgresDatabase.js +148 -0
  78. package/backend/dist/persistence/postgresDatabase.js.map +1 -0
  79. package/backend/dist/persistence/postgresExtensionMigration.d.ts +4 -0
  80. package/backend/dist/persistence/postgresExtensionMigration.d.ts.map +1 -0
  81. package/backend/dist/persistence/postgresExtensionMigration.js +143 -0
  82. package/backend/dist/persistence/postgresExtensionMigration.js.map +1 -0
  83. package/backend/dist/persistence/postgresExtensionRepositories.d.ts +6 -0
  84. package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -0
  85. package/backend/dist/persistence/postgresExtensionRepositories.js +550 -0
  86. package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -0
  87. package/backend/dist/persistence/postgresImportState.d.ts +9 -0
  88. package/backend/dist/persistence/postgresImportState.d.ts.map +1 -0
  89. package/backend/dist/persistence/postgresImportState.js +64 -0
  90. package/backend/dist/persistence/postgresImportState.js.map +1 -0
  91. package/backend/dist/persistence/postgresMigrationRegistry.d.ts +4 -0
  92. package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -0
  93. package/backend/dist/persistence/postgresMigrationRegistry.js +33 -0
  94. package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -0
  95. package/backend/dist/persistence/postgresMigrationTypes.d.ts +24 -0
  96. package/backend/dist/persistence/postgresMigrationTypes.d.ts.map +1 -0
  97. package/backend/dist/persistence/postgresMigrationTypes.js +7 -0
  98. package/backend/dist/persistence/postgresMigrationTypes.js.map +1 -0
  99. package/backend/dist/persistence/postgresMigrations.d.ts +15 -0
  100. package/backend/dist/persistence/postgresMigrations.d.ts.map +1 -0
  101. package/backend/dist/persistence/postgresMigrations.js +333 -0
  102. package/backend/dist/persistence/postgresMigrations.js.map +1 -0
  103. package/backend/dist/persistence/postgresPersistence.d.ts +17 -0
  104. package/backend/dist/persistence/postgresPersistence.d.ts.map +1 -0
  105. package/backend/dist/persistence/postgresPersistence.js +332 -0
  106. package/backend/dist/persistence/postgresPersistence.js.map +1 -0
  107. package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts +4 -0
  108. package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts.map +1 -0
  109. package/backend/dist/persistence/postgresPluginDefinitionMigration.js +40 -0
  110. package/backend/dist/persistence/postgresPluginDefinitionMigration.js.map +1 -0
  111. package/backend/dist/persistence/postgresResourceRepositories.d.ts +7 -0
  112. package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -0
  113. package/backend/dist/persistence/postgresResourceRepositories.js +776 -0
  114. package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -0
  115. package/backend/dist/persistence/postgresSchemaInspector.d.ts +14 -0
  116. package/backend/dist/persistence/postgresSchemaInspector.d.ts.map +1 -0
  117. package/backend/dist/persistence/postgresSchemaInspector.js +817 -0
  118. package/backend/dist/persistence/postgresSchemaInspector.js.map +1 -0
  119. package/backend/dist/persistence/resourceTypes.d.ts +207 -0
  120. package/backend/dist/persistence/resourceTypes.d.ts.map +1 -0
  121. package/backend/dist/persistence/resourceTypes.js +38 -0
  122. package/backend/dist/persistence/resourceTypes.js.map +1 -0
  123. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts +4 -0
  124. package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -0
  125. package/backend/dist/persistence/sqliteExtensionRepositories.js +494 -0
  126. package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -0
  127. package/backend/dist/persistence/sqliteMigrations.d.ts +93 -0
  128. package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -0
  129. package/backend/dist/persistence/sqliteMigrations.js +2232 -0
  130. package/backend/dist/persistence/sqliteMigrations.js.map +1 -0
  131. package/backend/dist/persistence/sqlitePersistence.d.ts +23 -0
  132. package/backend/dist/persistence/sqlitePersistence.d.ts.map +1 -0
  133. package/backend/dist/persistence/sqlitePersistence.js +596 -0
  134. package/backend/dist/persistence/sqlitePersistence.js.map +1 -0
  135. package/backend/dist/persistence/sqliteResourceRepositories.d.ts +4 -0
  136. package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -0
  137. package/backend/dist/persistence/sqliteResourceRepositories.js +663 -0
  138. package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -0
  139. package/backend/dist/persistence/sqliteSyncExecutor.d.ts +5 -0
  140. package/backend/dist/persistence/sqliteSyncExecutor.d.ts.map +1 -0
  141. package/backend/dist/persistence/sqliteSyncExecutor.js +19 -0
  142. package/backend/dist/persistence/sqliteSyncExecutor.js.map +1 -0
  143. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts +80 -0
  144. package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -0
  145. package/backend/dist/persistence/sqliteToPostgresMigration.js +1543 -0
  146. package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -0
  147. package/backend/dist/persistence/types.d.ts +131 -0
  148. package/backend/dist/persistence/types.d.ts.map +1 -0
  149. package/backend/dist/persistence/types.js +18 -0
  150. package/backend/dist/persistence/types.js.map +1 -0
  151. package/backend/dist/persistence/voiceProfileNameLookup.d.ts +9 -0
  152. package/backend/dist/persistence/voiceProfileNameLookup.d.ts.map +1 -0
  153. package/backend/dist/persistence/voiceProfileNameLookup.js +15 -0
  154. package/backend/dist/persistence/voiceProfileNameLookup.js.map +1 -0
  155. package/backend/dist/platform/coordination/index.d.ts +7 -0
  156. package/backend/dist/platform/coordination/index.d.ts.map +1 -0
  157. package/backend/dist/platform/coordination/index.js +24 -0
  158. package/backend/dist/platform/coordination/index.js.map +1 -0
  159. package/backend/dist/platform/coordination/localCoordinator.d.ts +49 -0
  160. package/backend/dist/platform/coordination/localCoordinator.d.ts.map +1 -0
  161. package/backend/dist/platform/coordination/localCoordinator.js +380 -0
  162. package/backend/dist/platform/coordination/localCoordinator.js.map +1 -0
  163. package/backend/dist/platform/coordination/redisCoordinator.d.ts +83 -0
  164. package/backend/dist/platform/coordination/redisCoordinator.d.ts.map +1 -0
  165. package/backend/dist/platform/coordination/redisCoordinator.js +726 -0
  166. package/backend/dist/platform/coordination/redisCoordinator.js.map +1 -0
  167. package/backend/dist/platform/coordination/service.d.ts +11 -0
  168. package/backend/dist/platform/coordination/service.d.ts.map +1 -0
  169. package/backend/dist/platform/coordination/service.js +55 -0
  170. package/backend/dist/platform/coordination/service.js.map +1 -0
  171. package/backend/dist/platform/coordination/sharedAdmission.d.ts +53 -0
  172. package/backend/dist/platform/coordination/sharedAdmission.d.ts.map +1 -0
  173. package/backend/dist/platform/coordination/sharedAdmission.js +194 -0
  174. package/backend/dist/platform/coordination/sharedAdmission.js.map +1 -0
  175. package/backend/dist/platform/coordination/types.d.ts +76 -0
  176. package/backend/dist/platform/coordination/types.d.ts.map +1 -0
  177. package/backend/dist/platform/coordination/types.js +32 -0
  178. package/backend/dist/platform/coordination/types.js.map +1 -0
  179. package/backend/dist/platform/events/durableEventGateway.d.ts +54 -0
  180. package/backend/dist/platform/events/durableEventGateway.d.ts.map +1 -0
  181. package/backend/dist/platform/events/durableEventGateway.js +262 -0
  182. package/backend/dist/platform/events/durableEventGateway.js.map +1 -0
  183. package/backend/dist/platform/events/index.d.ts +3 -0
  184. package/backend/dist/platform/events/index.d.ts.map +1 -0
  185. package/backend/dist/platform/events/index.js +8 -0
  186. package/backend/dist/platform/events/index.js.map +1 -0
  187. package/backend/dist/platform/events/service.d.ts +8 -0
  188. package/backend/dist/platform/events/service.d.ts.map +1 -0
  189. package/backend/dist/platform/events/service.js +25 -0
  190. package/backend/dist/platform/events/service.js.map +1 -0
  191. package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts +3 -0
  192. package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts.map +1 -0
  193. package/backend/dist/platform/jobs/chatGenerationEnqueuer.js +55 -0
  194. package/backend/dist/platform/jobs/chatGenerationEnqueuer.js.map +1 -0
  195. package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts +3 -0
  196. package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts.map +1 -0
  197. package/backend/dist/platform/jobs/documentIngestionEnqueuer.js +38 -0
  198. package/backend/dist/platform/jobs/documentIngestionEnqueuer.js.map +1 -0
  199. package/backend/dist/platform/jobs/domainJobContracts.d.ts +30 -0
  200. package/backend/dist/platform/jobs/domainJobContracts.d.ts.map +1 -0
  201. package/backend/dist/platform/jobs/domainJobContracts.js +53 -0
  202. package/backend/dist/platform/jobs/domainJobContracts.js.map +1 -0
  203. package/backend/dist/platform/jobs/domainJobHandlers.d.ts +11 -0
  204. package/backend/dist/platform/jobs/domainJobHandlers.d.ts.map +1 -0
  205. package/backend/dist/platform/jobs/domainJobHandlers.js +617 -0
  206. package/backend/dist/platform/jobs/domainJobHandlers.js.map +1 -0
  207. package/backend/dist/platform/jobs/durableEventIdentity.d.ts +8 -0
  208. package/backend/dist/platform/jobs/durableEventIdentity.d.ts.map +1 -0
  209. package/backend/dist/platform/jobs/durableEventIdentity.js +33 -0
  210. package/backend/dist/platform/jobs/durableEventIdentity.js.map +1 -0
  211. package/backend/dist/platform/jobs/durableJobRuntime.d.ts +57 -0
  212. package/backend/dist/platform/jobs/durableJobRuntime.d.ts.map +1 -0
  213. package/backend/dist/platform/jobs/durableJobRuntime.js +131 -0
  214. package/backend/dist/platform/jobs/durableJobRuntime.js.map +1 -0
  215. package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts +28 -0
  216. package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts.map +1 -0
  217. package/backend/dist/platform/jobs/durableJobRuntimeBackend.js +62 -0
  218. package/backend/dist/platform/jobs/durableJobRuntimeBackend.js.map +1 -0
  219. package/backend/dist/platform/jobs/durableJobService.d.ts +85 -0
  220. package/backend/dist/platform/jobs/durableJobService.d.ts.map +1 -0
  221. package/backend/dist/platform/jobs/durableJobService.js +726 -0
  222. package/backend/dist/platform/jobs/durableJobService.js.map +1 -0
  223. package/backend/dist/platform/jobs/durableJobTypes.d.ts +195 -0
  224. package/backend/dist/platform/jobs/durableJobTypes.d.ts.map +1 -0
  225. package/backend/dist/platform/jobs/durableJobTypes.js +72 -0
  226. package/backend/dist/platform/jobs/durableJobTypes.js.map +1 -0
  227. package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts +87 -0
  228. package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts.map +1 -0
  229. package/backend/dist/platform/jobs/embeddedDurableJobWorker.js +429 -0
  230. package/backend/dist/platform/jobs/embeddedDurableJobWorker.js.map +1 -0
  231. package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts +3 -0
  232. package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts.map +1 -0
  233. package/backend/dist/platform/jobs/identityDeletionEnqueuer.js +36 -0
  234. package/backend/dist/platform/jobs/identityDeletionEnqueuer.js.map +1 -0
  235. package/backend/dist/platform/jobs/index.d.ts +18 -0
  236. package/backend/dist/platform/jobs/index.d.ts.map +1 -0
  237. package/backend/dist/platform/jobs/index.js +34 -0
  238. package/backend/dist/platform/jobs/index.js.map +1 -0
  239. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts +4 -0
  240. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts.map +1 -0
  241. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js +25 -0
  242. package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js.map +1 -0
  243. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts +4 -0
  244. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts.map +1 -0
  245. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js +23 -0
  246. package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js.map +1 -0
  247. package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts +11 -0
  248. package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts.map +1 -0
  249. package/backend/dist/platform/jobs/postgresDurableJobMigration.js +106 -0
  250. package/backend/dist/platform/jobs/postgresDurableJobMigration.js.map +1 -0
  251. package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts +88 -0
  252. package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts.map +1 -0
  253. package/backend/dist/platform/jobs/postgresDurableJobRepository.js +1185 -0
  254. package/backend/dist/platform/jobs/postgresDurableJobRepository.js.map +1 -0
  255. package/backend/dist/platform/jobs/postgresDurableJobService.d.ts +86 -0
  256. package/backend/dist/platform/jobs/postgresDurableJobService.d.ts.map +1 -0
  257. package/backend/dist/platform/jobs/postgresDurableJobService.js +696 -0
  258. package/backend/dist/platform/jobs/postgresDurableJobService.js.map +1 -0
  259. package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts +53 -0
  260. package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts.map +1 -0
  261. package/backend/dist/platform/jobs/postgresDurableJobWorker.js +393 -0
  262. package/backend/dist/platform/jobs/postgresDurableJobWorker.js.map +1 -0
  263. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts +3 -0
  264. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts.map +1 -0
  265. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js +43 -0
  266. package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js.map +1 -0
  267. package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts +166 -0
  268. package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts.map +1 -0
  269. package/backend/dist/platform/jobs/sqliteDurableJobRepository.js +1008 -0
  270. package/backend/dist/platform/jobs/sqliteDurableJobRepository.js.map +1 -0
  271. package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts +4 -0
  272. package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts.map +1 -0
  273. package/backend/dist/platform/jobs/videoGenerationEnqueuer.js +46 -0
  274. package/backend/dist/platform/jobs/videoGenerationEnqueuer.js.map +1 -0
  275. package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts +3 -0
  276. package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts.map +1 -0
  277. package/backend/dist/platform/jobs/workExecutionEnqueuer.js +38 -0
  278. package/backend/dist/platform/jobs/workExecutionEnqueuer.js.map +1 -0
  279. package/backend/dist/platform/ollamaRuntimeConfig.d.ts +40 -0
  280. package/backend/dist/platform/ollamaRuntimeConfig.d.ts.map +1 -0
  281. package/backend/dist/platform/ollamaRuntimeConfig.js +72 -0
  282. package/backend/dist/platform/ollamaRuntimeConfig.js.map +1 -0
  283. package/backend/dist/platform/recovery/backupArchive.d.ts +120 -0
  284. package/backend/dist/platform/recovery/backupArchive.d.ts.map +1 -0
  285. package/backend/dist/platform/recovery/backupArchive.js +842 -0
  286. package/backend/dist/platform/recovery/backupArchive.js.map +1 -0
  287. package/backend/dist/platform/recovery/index.d.ts +3 -0
  288. package/backend/dist/platform/recovery/index.d.ts.map +1 -0
  289. package/backend/dist/platform/recovery/index.js +8 -0
  290. package/backend/dist/platform/recovery/index.js.map +1 -0
  291. package/backend/dist/platform/recovery/teamBackupArchive.d.ts +98 -0
  292. package/backend/dist/platform/recovery/teamBackupArchive.d.ts.map +1 -0
  293. package/backend/dist/platform/recovery/teamBackupArchive.js +1203 -0
  294. package/backend/dist/platform/recovery/teamBackupArchive.js.map +1 -0
  295. package/backend/dist/platform/runtimeConfig.d.ts +70 -0
  296. package/backend/dist/platform/runtimeConfig.d.ts.map +1 -0
  297. package/backend/dist/platform/runtimeConfig.js +205 -0
  298. package/backend/dist/platform/runtimeConfig.js.map +1 -0
  299. package/backend/dist/platform/storage/aesGcmKeyring.d.ts +26 -0
  300. package/backend/dist/platform/storage/aesGcmKeyring.d.ts.map +1 -0
  301. package/backend/dist/platform/storage/aesGcmKeyring.js +135 -0
  302. package/backend/dist/platform/storage/aesGcmKeyring.js.map +1 -0
  303. package/backend/dist/platform/storage/blobReferenceRepository.d.ts +36 -0
  304. package/backend/dist/platform/storage/blobReferenceRepository.d.ts.map +1 -0
  305. package/backend/dist/platform/storage/blobReferenceRepository.js +117 -0
  306. package/backend/dist/platform/storage/blobReferenceRepository.js.map +1 -0
  307. package/backend/dist/platform/storage/blobStore.d.ts +111 -0
  308. package/backend/dist/platform/storage/blobStore.d.ts.map +1 -0
  309. package/backend/dist/platform/storage/blobStore.js +46 -0
  310. package/backend/dist/platform/storage/blobStore.js.map +1 -0
  311. package/backend/dist/platform/storage/documentVectorIndex.d.ts +44 -0
  312. package/backend/dist/platform/storage/documentVectorIndex.d.ts.map +1 -0
  313. package/backend/dist/platform/storage/documentVectorIndex.js +110 -0
  314. package/backend/dist/platform/storage/documentVectorIndex.js.map +1 -0
  315. package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts +82 -0
  316. package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts.map +1 -0
  317. package/backend/dist/platform/storage/durableBlobQuotaPolicy.js +583 -0
  318. package/backend/dist/platform/storage/durableBlobQuotaPolicy.js.map +1 -0
  319. package/backend/dist/platform/storage/index.d.ts +19 -0
  320. package/backend/dist/platform/storage/index.d.ts.map +1 -0
  321. package/backend/dist/platform/storage/index.js +35 -0
  322. package/backend/dist/platform/storage/index.js.map +1 -0
  323. package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts +120 -0
  324. package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts.map +1 -0
  325. package/backend/dist/platform/storage/localEncryptedBlobStore.js +1205 -0
  326. package/backend/dist/platform/storage/localEncryptedBlobStore.js.map +1 -0
  327. package/backend/dist/platform/storage/personaMemoryIndexing.d.ts +12 -0
  328. package/backend/dist/platform/storage/personaMemoryIndexing.d.ts.map +1 -0
  329. package/backend/dist/platform/storage/personaMemoryIndexing.js +25 -0
  330. package/backend/dist/platform/storage/personaMemoryIndexing.js.map +1 -0
  331. package/backend/dist/platform/storage/pgVectorStore.d.ts +37 -0
  332. package/backend/dist/platform/storage/pgVectorStore.d.ts.map +1 -0
  333. package/backend/dist/platform/storage/pgVectorStore.js +493 -0
  334. package/backend/dist/platform/storage/pgVectorStore.js.map +1 -0
  335. package/backend/dist/platform/storage/platformDomainRepositories.d.ts +244 -0
  336. package/backend/dist/platform/storage/platformDomainRepositories.d.ts.map +1 -0
  337. package/backend/dist/platform/storage/platformDomainRepositories.js +7 -0
  338. package/backend/dist/platform/storage/platformDomainRepositories.js.map +1 -0
  339. package/backend/dist/platform/storage/platformStorageRuntime.d.ts +35 -0
  340. package/backend/dist/platform/storage/platformStorageRuntime.d.ts.map +1 -0
  341. package/backend/dist/platform/storage/platformStorageRuntime.js +299 -0
  342. package/backend/dist/platform/storage/platformStorageRuntime.js.map +1 -0
  343. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts +4 -0
  344. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts.map +1 -0
  345. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js +1017 -0
  346. package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js.map +1 -0
  347. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts +4 -0
  348. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts.map +1 -0
  349. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js +40 -0
  350. package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js.map +1 -0
  351. package/backend/dist/platform/storage/resourceContentCleanup.d.ts +29 -0
  352. package/backend/dist/platform/storage/resourceContentCleanup.d.ts.map +1 -0
  353. package/backend/dist/platform/storage/resourceContentCleanup.js +100 -0
  354. package/backend/dist/platform/storage/resourceContentCleanup.js.map +1 -0
  355. package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts +14 -0
  356. package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts.map +1 -0
  357. package/backend/dist/platform/storage/resourceDeletionLifecycle.js +31 -0
  358. package/backend/dist/platform/storage/resourceDeletionLifecycle.js.map +1 -0
  359. package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts +140 -0
  360. package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts.map +1 -0
  361. package/backend/dist/platform/storage/s3EncryptedBlobStore.js +1309 -0
  362. package/backend/dist/platform/storage/s3EncryptedBlobStore.js.map +1 -0
  363. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts +71 -0
  364. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts.map +1 -0
  365. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js +766 -0
  366. package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js.map +1 -0
  367. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts +4 -0
  368. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts.map +1 -0
  369. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js +1037 -0
  370. package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js.map +1 -0
  371. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts +25 -0
  372. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts.map +1 -0
  373. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js +1292 -0
  374. package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js.map +1 -0
  375. package/backend/dist/platform/storage/storageFactory.d.ts +83 -0
  376. package/backend/dist/platform/storage/storageFactory.d.ts.map +1 -0
  377. package/backend/dist/platform/storage/storageFactory.js +530 -0
  378. package/backend/dist/platform/storage/storageFactory.js.map +1 -0
  379. package/backend/dist/platform/storage/storageSchemaContracts.d.ts +22 -0
  380. package/backend/dist/platform/storage/storageSchemaContracts.d.ts.map +1 -0
  381. package/backend/dist/platform/storage/storageSchemaContracts.js +299 -0
  382. package/backend/dist/platform/storage/storageSchemaContracts.js.map +1 -0
  383. package/backend/dist/platform/storage/vectorStore.d.ts +117 -0
  384. package/backend/dist/platform/storage/vectorStore.d.ts.map +1 -0
  385. package/backend/dist/platform/storage/vectorStore.js +40 -0
  386. package/backend/dist/platform/storage/vectorStore.js.map +1 -0
  387. package/backend/dist/platform/workPersistence/index.d.ts +9 -0
  388. package/backend/dist/platform/workPersistence/index.d.ts.map +1 -0
  389. package/backend/dist/platform/workPersistence/index.js +14 -0
  390. package/backend/dist/platform/workPersistence/index.js.map +1 -0
  391. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts +9 -0
  392. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts.map +1 -0
  393. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js +47 -0
  394. package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js.map +1 -0
  395. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts +3 -0
  396. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts.map +1 -0
  397. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js +28 -0
  398. package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js.map +1 -0
  399. package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts +3 -0
  400. package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts.map +1 -0
  401. package/backend/dist/platform/workPersistence/postgresWorkMigration.js +101 -0
  402. package/backend/dist/platform/workPersistence/postgresWorkMigration.js.map +1 -0
  403. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts +79 -0
  404. package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -0
  405. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +521 -0
  406. package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -0
  407. package/backend/dist/platform/workPersistence/service.d.ts +6 -0
  408. package/backend/dist/platform/workPersistence/service.d.ts.map +1 -0
  409. package/backend/dist/platform/workPersistence/service.js +27 -0
  410. package/backend/dist/platform/workPersistence/service.js.map +1 -0
  411. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts +77 -0
  412. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -0
  413. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +463 -0
  414. package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -0
  415. package/backend/dist/platform/workPersistence/types.d.ts +159 -0
  416. package/backend/dist/platform/workPersistence/types.d.ts.map +1 -0
  417. package/backend/dist/platform/workPersistence/types.js +13 -0
  418. package/backend/dist/platform/workPersistence/types.js.map +1 -0
  419. package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts +13 -0
  420. package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts.map +1 -0
  421. package/backend/dist/platform/workPersistence/workExecutionTypes.js +7 -0
  422. package/backend/dist/platform/workPersistence/workExecutionTypes.js.map +1 -0
  423. package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts +8 -0
  424. package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts.map +1 -0
  425. package/backend/dist/platform/workPersistence/workMessageContentCodec.js +25 -0
  426. package/backend/dist/platform/workPersistence/workMessageContentCodec.js.map +1 -0
  427. package/backend/dist/platform/workPersistence/workTextSafety.d.ts +3 -0
  428. package/backend/dist/platform/workPersistence/workTextSafety.d.ts.map +1 -0
  429. package/backend/dist/platform/workPersistence/workTextSafety.js +8 -0
  430. package/backend/dist/platform/workPersistence/workTextSafety.js.map +1 -0
  431. package/backend/dist/routes/agentCli.js +1 -1
  432. package/backend/dist/routes/agentCli.js.map +1 -1
  433. package/backend/dist/routes/artifacts.d.ts.map +1 -1
  434. package/backend/dist/routes/artifacts.js +2 -1
  435. package/backend/dist/routes/artifacts.js.map +1 -1
  436. package/backend/dist/routes/auth.d.ts.map +1 -1
  437. package/backend/dist/routes/auth.js +64 -18
  438. package/backend/dist/routes/auth.js.map +1 -1
  439. package/backend/dist/routes/chat.d.ts.map +1 -1
  440. package/backend/dist/routes/chat.js +519 -85
  441. package/backend/dist/routes/chat.js.map +1 -1
  442. package/backend/dist/routes/documents.d.ts.map +1 -1
  443. package/backend/dist/routes/documents.js +134 -28
  444. package/backend/dist/routes/documents.js.map +1 -1
  445. package/backend/dist/routes/embeddings.d.ts.map +1 -1
  446. package/backend/dist/routes/embeddings.js +2 -1
  447. package/backend/dist/routes/embeddings.js.map +1 -1
  448. package/backend/dist/routes/health.d.ts +3 -0
  449. package/backend/dist/routes/health.d.ts.map +1 -0
  450. package/backend/dist/routes/health.js +52 -0
  451. package/backend/dist/routes/health.js.map +1 -0
  452. package/backend/dist/routes/huggingfaceHub.d.ts.map +1 -1
  453. package/backend/dist/routes/huggingfaceHub.js +2 -1
  454. package/backend/dist/routes/huggingfaceHub.js.map +1 -1
  455. package/backend/dist/routes/imageGen.d.ts.map +1 -1
  456. package/backend/dist/routes/imageGen.js +42 -10
  457. package/backend/dist/routes/imageGen.js.map +1 -1
  458. package/backend/dist/routes/jobs.d.ts +3 -0
  459. package/backend/dist/routes/jobs.d.ts.map +1 -0
  460. package/backend/dist/routes/jobs.js +126 -0
  461. package/backend/dist/routes/jobs.js.map +1 -0
  462. package/backend/dist/routes/libreClaw.d.ts.map +1 -1
  463. package/backend/dist/routes/libreClaw.js +10 -7
  464. package/backend/dist/routes/libreClaw.js.map +1 -1
  465. package/backend/dist/routes/media.d.ts.map +1 -1
  466. package/backend/dist/routes/media.js +523 -77
  467. package/backend/dist/routes/media.js.map +1 -1
  468. package/backend/dist/routes/notes.d.ts.map +1 -1
  469. package/backend/dist/routes/notes.js +21 -21
  470. package/backend/dist/routes/notes.js.map +1 -1
  471. package/backend/dist/routes/ollama.d.ts.map +1 -1
  472. package/backend/dist/routes/ollama.js +40 -12
  473. package/backend/dist/routes/ollama.js.map +1 -1
  474. package/backend/dist/routes/personas.d.ts.map +1 -1
  475. package/backend/dist/routes/personas.js +4 -2
  476. package/backend/dist/routes/personas.js.map +1 -1
  477. package/backend/dist/routes/plugins.d.ts.map +1 -1
  478. package/backend/dist/routes/plugins.js +79 -51
  479. package/backend/dist/routes/plugins.js.map +1 -1
  480. package/backend/dist/routes/preferences.d.ts.map +1 -1
  481. package/backend/dist/routes/preferences.js +290 -25
  482. package/backend/dist/routes/preferences.js.map +1 -1
  483. package/backend/dist/routes/search.d.ts.map +1 -1
  484. package/backend/dist/routes/search.js +23 -14
  485. package/backend/dist/routes/search.js.map +1 -1
  486. package/backend/dist/routes/stt.d.ts +9 -0
  487. package/backend/dist/routes/stt.d.ts.map +1 -0
  488. package/backend/dist/routes/stt.js +217 -0
  489. package/backend/dist/routes/stt.js.map +1 -0
  490. package/backend/dist/routes/systemDiagnostics.d.ts.map +1 -1
  491. package/backend/dist/routes/systemDiagnostics.js +2 -1
  492. package/backend/dist/routes/systemDiagnostics.js.map +1 -1
  493. package/backend/dist/routes/tts.d.ts.map +1 -1
  494. package/backend/dist/routes/tts.js +577 -28
  495. package/backend/dist/routes/tts.js.map +1 -1
  496. package/backend/dist/routes/users.d.ts.map +1 -1
  497. package/backend/dist/routes/users.js +16 -25
  498. package/backend/dist/routes/users.js.map +1 -1
  499. package/backend/dist/routes/work.d.ts.map +1 -1
  500. package/backend/dist/routes/work.js +167 -113
  501. package/backend/dist/routes/work.js.map +1 -1
  502. package/backend/dist/services/agentAccessService.d.ts +2 -2
  503. package/backend/dist/services/agentAccessService.d.ts.map +1 -1
  504. package/backend/dist/services/agentAccessService.js +5 -14
  505. package/backend/dist/services/agentAccessService.js.map +1 -1
  506. package/backend/dist/services/agentCliService.d.ts +3 -2
  507. package/backend/dist/services/agentCliService.d.ts.map +1 -1
  508. package/backend/dist/services/agentCliService.js +44 -16
  509. package/backend/dist/services/agentCliService.js.map +1 -1
  510. package/backend/dist/services/assistantCompletionService.d.ts +2 -1
  511. package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
  512. package/backend/dist/services/assistantCompletionService.js +7 -3
  513. package/backend/dist/services/assistantCompletionService.js.map +1 -1
  514. package/backend/dist/services/authService.d.ts +7 -2
  515. package/backend/dist/services/authService.d.ts.map +1 -1
  516. package/backend/dist/services/authService.js +23 -10
  517. package/backend/dist/services/authService.js.map +1 -1
  518. package/backend/dist/services/chatGenerationService.d.ts +5 -4
  519. package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
  520. package/backend/dist/services/chatGenerationService.js +23 -17
  521. package/backend/dist/services/chatGenerationService.js.map +1 -1
  522. package/backend/dist/services/chatRequestService.d.ts +4 -3
  523. package/backend/dist/services/chatRequestService.d.ts.map +1 -1
  524. package/backend/dist/services/chatRequestService.js +3 -3
  525. package/backend/dist/services/chatRequestService.js.map +1 -1
  526. package/backend/dist/services/chatService.d.ts +66 -16
  527. package/backend/dist/services/chatService.d.ts.map +1 -1
  528. package/backend/dist/services/chatService.js +402 -111
  529. package/backend/dist/services/chatService.js.map +1 -1
  530. package/backend/dist/services/codexOAuthService.d.ts +2 -2
  531. package/backend/dist/services/codexOAuthService.d.ts.map +1 -1
  532. package/backend/dist/services/codexOAuthService.js +63 -7
  533. package/backend/dist/services/codexOAuthService.js.map +1 -1
  534. package/backend/dist/services/dataArchiveService.d.ts +88 -0
  535. package/backend/dist/services/dataArchiveService.d.ts.map +1 -0
  536. package/backend/dist/services/dataArchiveService.js +1027 -0
  537. package/backend/dist/services/dataArchiveService.js.map +1 -0
  538. package/backend/dist/services/documentService.d.ts +67 -14
  539. package/backend/dist/services/documentService.d.ts.map +1 -1
  540. package/backend/dist/services/documentService.js +938 -193
  541. package/backend/dist/services/documentService.js.map +1 -1
  542. package/backend/dist/services/durableChatCompletion.d.ts +16 -0
  543. package/backend/dist/services/durableChatCompletion.d.ts.map +1 -0
  544. package/backend/dist/services/durableChatCompletion.js +34 -0
  545. package/backend/dist/services/durableChatCompletion.js.map +1 -0
  546. package/backend/dist/services/durableChatGenerationService.d.ts +19 -0
  547. package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -0
  548. package/backend/dist/services/durableChatGenerationService.js +341 -0
  549. package/backend/dist/services/durableChatGenerationService.js.map +1 -0
  550. package/backend/dist/services/embeddingService.d.ts +1 -1
  551. package/backend/dist/services/embeddingService.d.ts.map +1 -1
  552. package/backend/dist/services/embeddingService.js +16 -13
  553. package/backend/dist/services/embeddingService.js.map +1 -1
  554. package/backend/dist/services/encryptionService.d.ts +28 -1
  555. package/backend/dist/services/encryptionService.d.ts.map +1 -1
  556. package/backend/dist/services/encryptionService.js +131 -51
  557. package/backend/dist/services/encryptionService.js.map +1 -1
  558. package/backend/dist/services/followUpService.d.ts +1 -1
  559. package/backend/dist/services/followUpService.d.ts.map +1 -1
  560. package/backend/dist/services/followUpService.js +1 -1
  561. package/backend/dist/services/followUpService.js.map +1 -1
  562. package/backend/dist/services/galleryService.d.ts +38 -37
  563. package/backend/dist/services/galleryService.d.ts.map +1 -1
  564. package/backend/dist/services/galleryService.js +356 -251
  565. package/backend/dist/services/galleryService.js.map +1 -1
  566. package/backend/dist/services/healthService.d.ts +65 -0
  567. package/backend/dist/services/healthService.d.ts.map +1 -0
  568. package/backend/dist/services/healthService.js +379 -0
  569. package/backend/dist/services/healthService.js.map +1 -0
  570. package/backend/dist/services/legacyCiphertextIntegrity.d.ts +40 -0
  571. package/backend/dist/services/legacyCiphertextIntegrity.d.ts.map +1 -0
  572. package/backend/dist/services/legacyCiphertextIntegrity.js +406 -0
  573. package/backend/dist/services/legacyCiphertextIntegrity.js.map +1 -0
  574. package/backend/dist/services/mediaGenerationJobService.d.ts +27 -5
  575. package/backend/dist/services/mediaGenerationJobService.d.ts.map +1 -1
  576. package/backend/dist/services/mediaGenerationJobService.js +185 -55
  577. package/backend/dist/services/mediaGenerationJobService.js.map +1 -1
  578. package/backend/dist/services/memoryService.d.ts +7 -83
  579. package/backend/dist/services/memoryService.d.ts.map +1 -1
  580. package/backend/dist/services/memoryService.js +428 -573
  581. package/backend/dist/services/memoryService.js.map +1 -1
  582. package/backend/dist/services/memoryUtils.d.ts.map +1 -1
  583. package/backend/dist/services/memoryUtils.js +8 -1
  584. package/backend/dist/services/memoryUtils.js.map +1 -1
  585. package/backend/dist/services/modelAccessService.d.ts +3 -3
  586. package/backend/dist/services/modelAccessService.d.ts.map +1 -1
  587. package/backend/dist/services/modelAccessService.js +8 -16
  588. package/backend/dist/services/modelAccessService.js.map +1 -1
  589. package/backend/dist/services/mutationEngineService.d.ts +0 -7
  590. package/backend/dist/services/mutationEngineService.d.ts.map +1 -1
  591. package/backend/dist/services/mutationEngineService.js +7 -78
  592. package/backend/dist/services/mutationEngineService.js.map +1 -1
  593. package/backend/dist/services/ollamaService.d.ts +4 -4
  594. package/backend/dist/services/ollamaService.d.ts.map +1 -1
  595. package/backend/dist/services/ollamaService.js +62 -31
  596. package/backend/dist/services/ollamaService.js.map +1 -1
  597. package/backend/dist/services/personaService.d.ts.map +1 -1
  598. package/backend/dist/services/personaService.js +19 -54
  599. package/backend/dist/services/personaService.js.map +1 -1
  600. package/backend/dist/services/pluginActivationService.d.ts +6 -5
  601. package/backend/dist/services/pluginActivationService.d.ts.map +1 -1
  602. package/backend/dist/services/pluginActivationService.js +36 -76
  603. package/backend/dist/services/pluginActivationService.js.map +1 -1
  604. package/backend/dist/services/pluginAudioGenerationService.d.ts +11 -6
  605. package/backend/dist/services/pluginAudioGenerationService.d.ts.map +1 -1
  606. package/backend/dist/services/pluginAudioGenerationService.js +74 -16
  607. package/backend/dist/services/pluginAudioGenerationService.js.map +1 -1
  608. package/backend/dist/services/pluginCacheInvalidation.d.ts +38 -0
  609. package/backend/dist/services/pluginCacheInvalidation.d.ts.map +1 -0
  610. package/backend/dist/services/pluginCacheInvalidation.js +198 -0
  611. package/backend/dist/services/pluginCacheInvalidation.js.map +1 -0
  612. package/backend/dist/services/pluginCapabilityRegistryService.d.ts +3 -3
  613. package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
  614. package/backend/dist/services/pluginCapabilityRegistryService.js +11 -7
  615. package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
  616. package/backend/dist/services/pluginCredentialsService.d.ts +9 -8
  617. package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
  618. package/backend/dist/services/pluginCredentialsService.js +48 -89
  619. package/backend/dist/services/pluginCredentialsService.js.map +1 -1
  620. package/backend/dist/services/pluginEmbeddingService.d.ts +8 -7
  621. package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
  622. package/backend/dist/services/pluginEmbeddingService.js +13 -11
  623. package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
  624. package/backend/dist/services/pluginImageGenerationService.d.ts +10 -8
  625. package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
  626. package/backend/dist/services/pluginImageGenerationService.js +119 -14
  627. package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
  628. package/backend/dist/services/pluginSTTService.d.ts +47 -0
  629. package/backend/dist/services/pluginSTTService.d.ts.map +1 -0
  630. package/backend/dist/services/pluginSTTService.js +199 -0
  631. package/backend/dist/services/pluginSTTService.js.map +1 -0
  632. package/backend/dist/services/pluginService.d.ts +94 -40
  633. package/backend/dist/services/pluginService.d.ts.map +1 -1
  634. package/backend/dist/services/pluginService.js +833 -275
  635. package/backend/dist/services/pluginService.js.map +1 -1
  636. package/backend/dist/services/pluginTTSService.d.ts +26 -8
  637. package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
  638. package/backend/dist/services/pluginTTSService.js +277 -25
  639. package/backend/dist/services/pluginTTSService.js.map +1 -1
  640. package/backend/dist/services/pluginUsageService.d.ts +4 -4
  641. package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
  642. package/backend/dist/services/pluginUsageService.js +44 -93
  643. package/backend/dist/services/pluginUsageService.js.map +1 -1
  644. package/backend/dist/services/pluginVariablesService.d.ts +14 -7
  645. package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
  646. package/backend/dist/services/pluginVariablesService.js +116 -81
  647. package/backend/dist/services/pluginVariablesService.js.map +1 -1
  648. package/backend/dist/services/pluginVideoGenerationService.d.ts +19 -8
  649. package/backend/dist/services/pluginVideoGenerationService.d.ts.map +1 -1
  650. package/backend/dist/services/pluginVideoGenerationService.js +116 -20
  651. package/backend/dist/services/pluginVideoGenerationService.js.map +1 -1
  652. package/backend/dist/services/preferencesService.d.ts +31 -21
  653. package/backend/dist/services/preferencesService.d.ts.map +1 -1
  654. package/backend/dist/services/preferencesService.js +104 -102
  655. package/backend/dist/services/preferencesService.js.map +1 -1
  656. package/backend/dist/services/recoveryInventoryService.d.ts +244 -0
  657. package/backend/dist/services/recoveryInventoryService.d.ts.map +1 -0
  658. package/backend/dist/services/recoveryInventoryService.js +1436 -0
  659. package/backend/dist/services/recoveryInventoryService.js.map +1 -0
  660. package/backend/dist/services/simpleGitHubOAuth.js +3 -3
  661. package/backend/dist/services/simpleGitHubOAuth.js.map +1 -1
  662. package/backend/dist/services/simpleHuggingFaceOAuth.d.ts.map +1 -1
  663. package/backend/dist/services/simpleHuggingFaceOAuth.js +3 -3
  664. package/backend/dist/services/simpleHuggingFaceOAuth.js.map +1 -1
  665. package/backend/dist/services/systemDiagnosticsService.d.ts.map +1 -1
  666. package/backend/dist/services/systemDiagnosticsService.js +2 -2
  667. package/backend/dist/services/systemDiagnosticsService.js.map +1 -1
  668. package/backend/dist/services/systemSettingsService.d.ts +5 -0
  669. package/backend/dist/services/systemSettingsService.d.ts.map +1 -0
  670. package/backend/dist/services/systemSettingsService.js +24 -0
  671. package/backend/dist/services/systemSettingsService.js.map +1 -0
  672. package/backend/dist/services/titleGenerationService.d.ts +1 -1
  673. package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
  674. package/backend/dist/services/titleGenerationService.js +1 -1
  675. package/backend/dist/services/titleGenerationService.js.map +1 -1
  676. package/backend/dist/services/voiceProfileService.d.ts +44 -0
  677. package/backend/dist/services/voiceProfileService.d.ts.map +1 -0
  678. package/backend/dist/services/voiceProfileService.js +195 -0
  679. package/backend/dist/services/voiceProfileService.js.map +1 -0
  680. package/backend/dist/services/webSearchService.d.ts +7 -7
  681. package/backend/dist/services/webSearchService.d.ts.map +1 -1
  682. package/backend/dist/services/webSearchService.js +40 -35
  683. package/backend/dist/services/webSearchService.js.map +1 -1
  684. package/backend/dist/services/websocketTicketService.d.ts +39 -0
  685. package/backend/dist/services/websocketTicketService.d.ts.map +1 -0
  686. package/backend/dist/services/websocketTicketService.js +183 -0
  687. package/backend/dist/services/websocketTicketService.js.map +1 -0
  688. package/backend/dist/services/workAccessService.d.ts +3 -3
  689. package/backend/dist/services/workAccessService.d.ts.map +1 -1
  690. package/backend/dist/services/workAccessService.js +8 -16
  691. package/backend/dist/services/workAccessService.js.map +1 -1
  692. package/backend/dist/services/workAdminService.d.ts +3 -3
  693. package/backend/dist/services/workAdminService.d.ts.map +1 -1
  694. package/backend/dist/services/workAdminService.js +4 -4
  695. package/backend/dist/services/workAdminService.js.map +1 -1
  696. package/backend/dist/services/workAgentService.d.ts +25 -1
  697. package/backend/dist/services/workAgentService.d.ts.map +1 -1
  698. package/backend/dist/services/workAgentService.js +294 -126
  699. package/backend/dist/services/workAgentService.js.map +1 -1
  700. package/backend/dist/services/workEventService.d.ts +15 -2
  701. package/backend/dist/services/workEventService.d.ts.map +1 -1
  702. package/backend/dist/services/workEventService.js +201 -3
  703. package/backend/dist/services/workEventService.js.map +1 -1
  704. package/backend/dist/services/workKubernetesDriver.d.ts +8 -7
  705. package/backend/dist/services/workKubernetesDriver.d.ts.map +1 -1
  706. package/backend/dist/services/workKubernetesDriver.js +65 -21
  707. package/backend/dist/services/workKubernetesDriver.js.map +1 -1
  708. package/backend/dist/services/workModelProviderService.d.ts +2 -2
  709. package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
  710. package/backend/dist/services/workModelProviderService.js +38 -34
  711. package/backend/dist/services/workModelProviderService.js.map +1 -1
  712. package/backend/dist/services/workPolicyService.d.ts +7 -7
  713. package/backend/dist/services/workPolicyService.d.ts.map +1 -1
  714. package/backend/dist/services/workPolicyService.js +50 -51
  715. package/backend/dist/services/workPolicyService.js.map +1 -1
  716. package/backend/dist/services/workPreviewProxyService.d.ts +8 -8
  717. package/backend/dist/services/workPreviewProxyService.d.ts.map +1 -1
  718. package/backend/dist/services/workPreviewProxyService.js +47 -44
  719. package/backend/dist/services/workPreviewProxyService.js.map +1 -1
  720. package/backend/dist/services/workRuntimeDriver.d.ts +21 -18
  721. package/backend/dist/services/workRuntimeDriver.d.ts.map +1 -1
  722. package/backend/dist/services/workRuntimeDriver.js +69 -20
  723. package/backend/dist/services/workRuntimeDriver.js.map +1 -1
  724. package/backend/dist/services/workRuntimeService.d.ts +18 -13
  725. package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
  726. package/backend/dist/services/workRuntimeService.js +438 -194
  727. package/backend/dist/services/workRuntimeService.js.map +1 -1
  728. package/backend/dist/services/workRuntimeShared.d.ts +2 -0
  729. package/backend/dist/services/workRuntimeShared.d.ts.map +1 -1
  730. package/backend/dist/services/workRuntimeShared.js.map +1 -1
  731. package/backend/dist/services/workTaskService.d.ts +42 -36
  732. package/backend/dist/services/workTaskService.d.ts.map +1 -1
  733. package/backend/dist/services/workTaskService.js +445 -350
  734. package/backend/dist/services/workTaskService.js.map +1 -1
  735. package/backend/dist/services/workTerminalService.d.ts +1 -1
  736. package/backend/dist/services/workTerminalService.d.ts.map +1 -1
  737. package/backend/dist/services/workTerminalService.js +33 -6
  738. package/backend/dist/services/workTerminalService.js.map +1 -1
  739. package/backend/dist/storage.d.ts +72 -40
  740. package/backend/dist/storage.d.ts.map +1 -1
  741. package/backend/dist/storage.js +312 -660
  742. package/backend/dist/storage.js.map +1 -1
  743. package/backend/dist/types/index.d.ts +28 -0
  744. package/backend/dist/types/index.d.ts.map +1 -1
  745. package/backend/dist/types/index.js.map +1 -1
  746. package/backend/dist/types/work.d.ts +7 -2
  747. package/backend/dist/types/work.d.ts.map +1 -1
  748. package/backend/dist/utils/chatCancellation.d.ts +48 -0
  749. package/backend/dist/utils/chatCancellation.d.ts.map +1 -0
  750. package/backend/dist/utils/chatCancellation.js +152 -0
  751. package/backend/dist/utils/chatCancellation.js.map +1 -0
  752. package/backend/dist/utils/chatDocumentContext.d.ts +1 -1
  753. package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
  754. package/backend/dist/utils/chatDocumentContext.js +11 -5
  755. package/backend/dist/utils/chatDocumentContext.js.map +1 -1
  756. package/backend/dist/utils/chatStreamCoalescer.d.ts +15 -0
  757. package/backend/dist/utils/chatStreamCoalescer.d.ts.map +1 -0
  758. package/backend/dist/utils/chatStreamCoalescer.js +59 -0
  759. package/backend/dist/utils/chatStreamCoalescer.js.map +1 -0
  760. package/backend/dist/utils/dataDirectory.d.ts +49 -0
  761. package/backend/dist/utils/dataDirectory.d.ts.map +1 -0
  762. package/backend/dist/utils/dataDirectory.js +291 -0
  763. package/backend/dist/utils/dataDirectory.js.map +1 -0
  764. package/backend/dist/utils/generationUtils.d.ts.map +1 -1
  765. package/backend/dist/utils/generationUtils.js +18 -6
  766. package/backend/dist/utils/generationUtils.js.map +1 -1
  767. package/backend/dist/utils/jwt.d.ts.map +1 -1
  768. package/backend/dist/utils/jwt.js +2 -3
  769. package/backend/dist/utils/jwt.js.map +1 -1
  770. package/backend/dist/utils/ollamaModelDefaults.d.ts.map +1 -1
  771. package/backend/dist/utils/ollamaModelDefaults.js +2 -7
  772. package/backend/dist/utils/ollamaModelDefaults.js.map +1 -1
  773. package/backend/dist/utils/ollamaStreaming.d.ts +2 -1
  774. package/backend/dist/utils/ollamaStreaming.d.ts.map +1 -1
  775. package/backend/dist/utils/ollamaStreaming.js +49 -11
  776. package/backend/dist/utils/ollamaStreaming.js.map +1 -1
  777. package/backend/dist/utils/pluginConnectionVariables.d.ts.map +1 -1
  778. package/backend/dist/utils/pluginConnectionVariables.js +11 -3
  779. package/backend/dist/utils/pluginConnectionVariables.js.map +1 -1
  780. package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
  781. package/backend/dist/utils/pluginDefinitionTrust.js +4 -3
  782. package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
  783. package/backend/dist/utils/pluginStreaming.d.ts +2 -1
  784. package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
  785. package/backend/dist/utils/pluginStreaming.js +5 -1
  786. package/backend/dist/utils/pluginStreaming.js.map +1 -1
  787. package/backend/dist/utils/pluginUpload.d.ts +1 -0
  788. package/backend/dist/utils/pluginUpload.d.ts.map +1 -1
  789. package/backend/dist/utils/pluginUpload.js +14 -4
  790. package/backend/dist/utils/pluginUpload.js.map +1 -1
  791. package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
  792. package/backend/dist/utils/pluginValidation.js +29 -1
  793. package/backend/dist/utils/pluginValidation.js.map +1 -1
  794. package/backend/dist/utils/sttAudioUpload.d.ts +24 -0
  795. package/backend/dist/utils/sttAudioUpload.d.ts.map +1 -0
  796. package/backend/dist/utils/sttAudioUpload.js +500 -0
  797. package/backend/dist/utils/sttAudioUpload.js.map +1 -0
  798. package/backend/dist/utils/ttsVoiceCloneUpload.d.ts +34 -0
  799. package/backend/dist/utils/ttsVoiceCloneUpload.d.ts.map +1 -0
  800. package/backend/dist/utils/ttsVoiceCloneUpload.js +224 -0
  801. package/backend/dist/utils/ttsVoiceCloneUpload.js.map +1 -0
  802. package/backend/dist/utils/websocketMessages.d.ts +2 -1
  803. package/backend/dist/utils/websocketMessages.d.ts.map +1 -1
  804. package/backend/dist/utils/websocketMessages.js +16 -2
  805. package/backend/dist/utils/websocketMessages.js.map +1 -1
  806. package/backend/dist/websocketServer.d.ts +4 -1
  807. package/backend/dist/websocketServer.d.ts.map +1 -1
  808. package/backend/dist/websocketServer.js +290 -44
  809. package/backend/dist/websocketServer.js.map +1 -1
  810. package/backend/dist/workTerminalServer.d.ts +9 -0
  811. package/backend/dist/workTerminalServer.d.ts.map +1 -1
  812. package/backend/dist/workTerminalServer.js +221 -52
  813. package/backend/dist/workTerminalServer.js.map +1 -1
  814. package/backend/dist/worker.d.ts +2 -0
  815. package/backend/dist/worker.d.ts.map +1 -0
  816. package/backend/dist/worker.js +250 -0
  817. package/backend/dist/worker.js.map +1 -0
  818. package/backend/package.json +19 -9
  819. package/bin/cli.js +126 -99
  820. package/bin/runtime-paths.js +108 -0
  821. package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
  822. package/frontend/dist/artifact-runtime/framer-motion.js +5 -5
  823. package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
  824. package/frontend/dist/assets/index-Jtx9Amhz.js +16 -0
  825. package/frontend/dist/assets/index-kxtZQLV6.css +1 -0
  826. package/frontend/dist/assets/{markdown-math-ClQbWekD.css → markdown-math-ClTedVi7.css} +1 -1
  827. package/frontend/dist/index.html +18 -18
  828. package/frontend/dist/js/{ArtifactContainer-Dy2Q0iIL.js → ArtifactContainer-fZegtmva.js} +1 -1
  829. package/frontend/dist/js/{ArtifactDemoPage-K79dWshB.js → ArtifactDemoPage-BDBXYv9l.js} +1 -1
  830. package/frontend/dist/js/{ArtifactSandboxFrame-DhqLNUtY.js → ArtifactSandboxFrame-BN16NtKe.js} +3 -3
  831. package/frontend/dist/js/{ArtifactSlideOutPanel-Cl8JG7bz.js → ArtifactSlideOutPanel-x1fS85Ww.js} +1 -1
  832. package/frontend/dist/js/{Button-CTXHujOd.js → Button-BV44cTnj.js} +1 -1
  833. package/frontend/dist/js/ChatPage-C_pXh7WN.js +23 -0
  834. package/frontend/dist/js/{FirstTimeSetup-kHhRzGJ8.js → FirstTimeSetup-oRrlZnBm.js} +1 -1
  835. package/frontend/dist/js/GalleryPage-CV_vbE7X.js +1 -0
  836. package/frontend/dist/js/{HomePage-C1L8WAXL.js → HomePage-P-e7Huco.js} +1 -1
  837. package/frontend/dist/js/{LibreClawPage-Dyua8IUu.js → LibreClawPage-Cee06SUM.js} +1 -1
  838. package/frontend/dist/js/{ModelManagerModals-CuMRGUd-.js → ModelManagerModals-D7jIT3v1.js} +1 -1
  839. package/frontend/dist/js/{ModelSelector-CqHc-Ln4.js → ModelSelector-DXucbvrz.js} +1 -1
  840. package/frontend/dist/js/ModelsPage-C3_fZpMM.js +2 -0
  841. package/frontend/dist/js/NotesPage-rEIPWGIb.js +1 -0
  842. package/frontend/dist/js/{OptimizedSyntaxHighlighter-CWYUn9Oe.js → OptimizedSyntaxHighlighter-XwqZEoTf.js} +1 -1
  843. package/frontend/dist/js/{PersonasPage-D_6WBCH5.js → PersonasPage-BXtepFuD.js} +2 -2
  844. package/frontend/dist/js/PluginUsagePage-hhu8cxsu.js +1 -0
  845. package/frontend/dist/js/RichMessageContent-DkiEvdSg.js +3 -0
  846. package/frontend/dist/js/SettingsModal-BNxCtJ51.js +1 -0
  847. package/frontend/dist/js/{SettingsToggle-DLHlCDBl.js → SettingsToggle-WTa0rgvY.js} +1 -1
  848. package/frontend/dist/js/{SystemPage-BMWEet9e.js → SystemPage-BvvKFuoG.js} +1 -1
  849. package/frontend/dist/js/UserManagementPage-BccyR7si.js +1 -0
  850. package/frontend/dist/js/WorkPage-BgxrvY3I.js +6 -0
  851. package/frontend/dist/js/api-BvPDxsUQ.js +14 -0
  852. package/frontend/dist/js/appStore-DRSSjaHn.js +2 -0
  853. package/frontend/dist/js/ar-xTSvTq05.js +2 -0
  854. package/frontend/dist/js/authStore-BVykIRec.js +4 -0
  855. package/frontend/dist/js/{babel-CmENXdZw.js → babel-D24oDI9y.js} +1 -1
  856. package/frontend/dist/js/bn-iYAsohEA.js +2 -0
  857. package/frontend/dist/js/chatStore-UPp5TV_t.js +3 -0
  858. package/frontend/dist/js/{config-DkV1ka7I.js → config-BTlPm-cZ.js} +1 -1
  859. package/frontend/dist/js/cs-YBHN88Hb.js +2 -0
  860. package/frontend/dist/js/da-D7qlLy_k.js +2 -0
  861. package/frontend/dist/js/de-DV671k2c.js +2 -0
  862. package/frontend/dist/js/es-kyBgzNq-.js +2 -0
  863. package/frontend/dist/js/{estree-D5KP-qbw.js → estree-CfYahF_d.js} +1 -1
  864. package/frontend/dist/js/fr-Cw1vut7I.js +2 -0
  865. package/frontend/dist/js/hi-DWEFC024.js +2 -0
  866. package/frontend/dist/js/{html-Cm9c2akd.js → html-BJsDX1UZ.js} +1 -1
  867. package/frontend/dist/js/id-DlMHjjy0.js +2 -0
  868. package/frontend/dist/js/is-B9E_a7dG.js +2 -0
  869. package/frontend/dist/js/it-DawmVbLC.js +2 -0
  870. package/frontend/dist/js/ja-DmVvwY3W.js +2 -0
  871. package/frontend/dist/js/ko-DzOPpkVs.js +2 -0
  872. package/frontend/dist/js/{markdown-B2u7CnKN.js → markdown-GLyuUNig.js} +1 -1
  873. package/frontend/dist/js/markdown-core-BmPPZiuD.js +31 -0
  874. package/frontend/dist/js/{markdown-math-B7FlYsmr.js → markdown-math-mH7AZ_mb.js} +6 -6
  875. package/frontend/dist/js/{messageCodeStyles-DalG2j6U.js → messageCodeStyles-BHddEFP1.js} +1 -1
  876. package/frontend/dist/js/ms-DpsaOPht.js +2 -0
  877. package/frontend/dist/js/nl-B1d8W22n.js +2 -0
  878. package/frontend/dist/js/pl-nCncRVgt.js +2 -0
  879. package/frontend/dist/js/{postcss-B5WIGhAY.js → postcss-Bx9CTcIc.js} +1 -1
  880. package/frontend/dist/js/pt-DHw8fGuu.js +2 -0
  881. package/frontend/dist/js/{react-vendor-DPNXrO-8.js → react-vendor-C5yShNlM.js} +1 -1
  882. package/frontend/dist/js/{router-vendor-Ca9zqOqT.js → router-vendor-CbPDks39.js} +1 -1
  883. package/frontend/dist/js/ru-Derl_YP_.js +2 -0
  884. package/frontend/dist/js/{standalone-Dwm1daef.js → standalone-Dh56V0YW.js} +1 -1
  885. package/frontend/dist/js/sv-pJAfBVo0.js +2 -0
  886. package/frontend/dist/js/{syntax-highlight-Ca9bHsaz.js → syntax-highlight-3EEX6CGL.js} +3 -3
  887. package/frontend/dist/js/th-C_7fIGnk.js +2 -0
  888. package/frontend/dist/js/tr-CPqsJvaP.js +2 -0
  889. package/frontend/dist/js/{typescript-CwieSptM.js → typescript-DRy7A9w4.js} +1 -1
  890. package/frontend/dist/js/{ui-BnDZpjfc.js → ui-CuY4IifA.js} +2 -2
  891. package/frontend/dist/js/ui-vendor-D3Ahl1x5.js +177 -0
  892. package/frontend/dist/js/uk-3o8P_kFi.js +2 -0
  893. package/frontend/dist/js/{useTranslation-CXY69qNk.js → useTranslation-C3ei3mJq.js} +1 -1
  894. package/frontend/dist/js/{utils-BM0_0iFj.js → utils-CuC1beTY.js} +1 -1
  895. package/frontend/dist/js/{utils-vendor-1zob7nK9.js → utils-vendor-BBa8OxtB.js} +1 -1
  896. package/frontend/dist/js/vi-Dv6N7OVD.js +2 -0
  897. package/frontend/dist/js/{workApi-BOS7crs9.js → workApi-DHuYNHLf.js} +2 -2
  898. package/frontend/dist/js/{yaml-QD4znPfZ.js → yaml-DioTxVLA.js} +1 -1
  899. package/frontend/dist/js/zh-qg5iqtPi.js +2 -0
  900. package/package.json +16 -5
  901. package/plugins/huggingface.json +12 -3
  902. package/plugins/llama-cpp.json +18 -6
  903. package/plugins/longcat-audiodit.json +114 -0
  904. package/plugins/openai.json +18 -0
  905. package/frontend/dist/assets/index-BBpNbfKW.js +0 -16
  906. package/frontend/dist/assets/index-BLATyFmD.css +0 -1
  907. package/frontend/dist/js/ChatPage-BBayfMLS.js +0 -16
  908. package/frontend/dist/js/GalleryPage-By8VI39Q.js +0 -1
  909. package/frontend/dist/js/ModelsPage-ODeXhDDk.js +0 -2
  910. package/frontend/dist/js/NotesPage-CApzDjOq.js +0 -1
  911. package/frontend/dist/js/PluginUsagePage-kutS6SOd.js +0 -1
  912. package/frontend/dist/js/RichMessageContent-g6WT75Te.js +0 -3
  913. package/frontend/dist/js/SettingsModal-B7z51BCx.js +0 -1
  914. package/frontend/dist/js/UserManagementPage-D08lM51c.js +0 -1
  915. package/frontend/dist/js/WorkPage-DdVLefsK.js +0 -6
  916. package/frontend/dist/js/api-CLEmGcEh.js +0 -14
  917. package/frontend/dist/js/appStore-CGdhvp9P.js +0 -2
  918. package/frontend/dist/js/ar-BTmB2WVm.js +0 -2
  919. package/frontend/dist/js/authStore-Dh3beEOq.js +0 -4
  920. package/frontend/dist/js/bn-CQnH7YVT.js +0 -2
  921. package/frontend/dist/js/chatStore-CDeYWL_q.js +0 -3
  922. package/frontend/dist/js/cs-oTTZkQXr.js +0 -2
  923. package/frontend/dist/js/da-Br0gB6J6.js +0 -2
  924. package/frontend/dist/js/de-DE2iztTF.js +0 -2
  925. package/frontend/dist/js/es-DgthfVtl.js +0 -2
  926. package/frontend/dist/js/fr-BjxjFwPh.js +0 -2
  927. package/frontend/dist/js/hi-D1q7E-9N.js +0 -2
  928. package/frontend/dist/js/id-CDJZqLTF.js +0 -2
  929. package/frontend/dist/js/is-BU7Um_Tq.js +0 -2
  930. package/frontend/dist/js/it-CdAxr8P_.js +0 -2
  931. package/frontend/dist/js/ja-BLbQwz9u.js +0 -2
  932. package/frontend/dist/js/ko-CY5lpkAe.js +0 -2
  933. package/frontend/dist/js/markdown-core-DHnR5Hw8.js +0 -16
  934. package/frontend/dist/js/ms-tQ8AYXEQ.js +0 -2
  935. package/frontend/dist/js/nl-CRNi2oWT.js +0 -2
  936. package/frontend/dist/js/pl-CWtFRS_W.js +0 -2
  937. package/frontend/dist/js/pt-C7SPoLF8.js +0 -2
  938. package/frontend/dist/js/ru-Dz4AX8xc.js +0 -2
  939. package/frontend/dist/js/sv-ETy5-boa.js +0 -2
  940. package/frontend/dist/js/th-DpuMqvxU.js +0 -2
  941. package/frontend/dist/js/tr-C-1AYAqg.js +0 -2
  942. package/frontend/dist/js/ui-vendor-xUzKqAXI.js +0 -177
  943. package/frontend/dist/js/uk-CyS680gr.js +0 -2
  944. package/frontend/dist/js/vi-BG8HuiTz.js +0 -2
  945. package/frontend/dist/js/zh-NCs2mkHj.js +0 -2
@@ -0,0 +1,1037 @@
1
+ /*
2
+ * Libre WebUI
3
+ * Copyright (C) 2025 Kroonen AI, Inc.
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ */
6
+ import { createSQLiteSyncExecutor } from '../../persistence/sqliteSyncExecutor.js';
7
+ import { embeddingBufferToArray } from '../../services/memoryUtils.js';
8
+ import { resourceDeletionToken } from './resourceDeletionLifecycle.js';
9
+ import { MAX_VECTOR_RESOURCE_INDEX_ENTRIES } from './vectorStore.js';
10
+ const resourceTable = (resourceType) => {
11
+ switch (resourceType) {
12
+ case 'document':
13
+ return 'documents';
14
+ case 'generated-media':
15
+ return 'generated_images';
16
+ case 'persona':
17
+ return 'personas';
18
+ }
19
+ };
20
+ const assertResourceIdentifierAvailable = (database, resourceType, resourceId) => {
21
+ const reserved = database
22
+ .prepare(`SELECT 1 FROM platform_resource_deletion_tombstones
23
+ WHERE resource_type = ? AND resource_id = ?`)
24
+ .get(resourceType, resourceId);
25
+ if (reserved) {
26
+ throw new Error('Resource identifier is permanently reserved by deletion');
27
+ }
28
+ };
29
+ const recordResourceDeletion = (database, input) => {
30
+ assertResourceIdentifierAvailable(database, input.resourceType, input.resourceId);
31
+ const deletionIncarnation = 1;
32
+ const deletionToken = resourceDeletionToken({
33
+ ...input,
34
+ deletionIncarnation,
35
+ });
36
+ database
37
+ .prepare(`INSERT INTO platform_resource_deletion_tombstones
38
+ (resource_type, resource_id, owner_user_id, deletion_incarnation,
39
+ deletion_token, deleted_at, completed_at)
40
+ VALUES (?, ?, ?, ?, ?, ?, NULL)`)
41
+ .run(input.resourceType, input.resourceId, input.ownerUserId, deletionIncarnation, deletionToken, Date.now());
42
+ return { ...input, deletionIncarnation, deletionToken };
43
+ };
44
+ const decryptLegacyCompatible = (cipher, value) => cipher.isEncrypted(value) ? cipher.decryptAuthenticated(value) : value;
45
+ const decryptLegacyJson = (cipher, value) => {
46
+ if (!value)
47
+ return undefined;
48
+ try {
49
+ return JSON.parse(decryptLegacyCompatible(cipher, value));
50
+ }
51
+ catch {
52
+ return undefined;
53
+ }
54
+ };
55
+ /**
56
+ * Keep platform repository composition free of the legacy storage mapper
57
+ * singleton. The application injects the selected content cipher explicitly;
58
+ * importing storage primitives must never initialize encryption or a database.
59
+ */
60
+ const mapDocumentRow = (cipher, row) => ({
61
+ id: row.id,
62
+ filename: row.filename,
63
+ ...(row.title ? { title: decryptLegacyCompatible(cipher, row.title) } : {}),
64
+ ...(row.content
65
+ ? { content: decryptLegacyCompatible(cipher, row.content) }
66
+ : {}),
67
+ ...(row.file_type ? { fileType: row.file_type } : {}),
68
+ ...(row.size === undefined ? {} : { size: row.size }),
69
+ ...(row.session_id ? { sessionId: row.session_id } : {}),
70
+ ...(row.collection_id ? { collectionId: row.collection_id } : {}),
71
+ uploadedAt: row.uploaded_at,
72
+ ...(row.created_at === undefined ? {} : { createdAt: row.created_at }),
73
+ ...(row.metadata
74
+ ? {
75
+ metadata: decryptLegacyJson(cipher, row.metadata),
76
+ }
77
+ : {}),
78
+ });
79
+ const mapDocumentChunkRow = (cipher, row) => ({
80
+ id: row.id,
81
+ documentId: row.document_id,
82
+ content: decryptLegacyCompatible(cipher, row.content),
83
+ ...(row.embedding
84
+ ? { embedding: decryptLegacyJson(cipher, row.embedding) }
85
+ : {}),
86
+ chunkIndex: row.chunk_index,
87
+ startChar: row.start_char,
88
+ endChar: row.end_char,
89
+ });
90
+ const referenceFromRow = (row) => ({
91
+ blobId: row.blob_id,
92
+ ownerUserId: row.owner_user_id,
93
+ resourceType: row.resource_type,
94
+ resourceId: row.resource_id,
95
+ purpose: row.purpose,
96
+ createdAt: row.created_at,
97
+ });
98
+ class SQLiteDocumentRepository {
99
+ constructor(database, cipher) {
100
+ this.database = database;
101
+ this.cipher = cipher;
102
+ }
103
+ async listByOwner(userId) {
104
+ const rows = this.database
105
+ .prepare('SELECT * FROM documents WHERE user_id = ? ORDER BY uploaded_at DESC')
106
+ .all(userId);
107
+ return rows.map(row => mapDocumentRow(this.cipher, row));
108
+ }
109
+ async findByOwner(documentId, userId) {
110
+ const row = this.database
111
+ .prepare('SELECT * FROM documents WHERE id = ? AND user_id = ?')
112
+ .get(documentId, userId);
113
+ return row ? mapDocumentRow(this.cipher, row) : undefined;
114
+ }
115
+ async upsert(document, userId) {
116
+ const save = this.database.transaction(() => {
117
+ assertResourceIdentifierAvailable(this.database, 'document', document.id);
118
+ this.upsertSync(document, userId);
119
+ });
120
+ save.immediate();
121
+ }
122
+ upsertSync(document, userId) {
123
+ const now = Date.now();
124
+ this.database
125
+ .prepare(`INSERT INTO documents
126
+ (id, user_id, filename, title, content, file_type, size, session_id,
127
+ collection_id, metadata, uploaded_at, created_at, updated_at)
128
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
129
+ ON CONFLICT(id) DO UPDATE SET
130
+ filename = excluded.filename, title = excluded.title,
131
+ content = excluded.content, file_type = excluded.file_type,
132
+ size = excluded.size, session_id = excluded.session_id,
133
+ collection_id = excluded.collection_id, metadata = excluded.metadata,
134
+ uploaded_at = excluded.uploaded_at, updated_at = excluded.updated_at
135
+ WHERE documents.user_id = excluded.user_id`)
136
+ .run(document.id, userId, document.filename, document.title ? this.cipher.encrypt(document.title) : null, document.content ? this.cipher.encrypt(document.content) : null, document.fileType || null, document.size ?? null, document.sessionId || null, document.collectionId || null, document.metadata
137
+ ? this.cipher.encrypt(JSON.stringify(document.metadata))
138
+ : null, document.uploadedAt, document.createdAt || now, now);
139
+ }
140
+ async upsertWithBlobAndEnqueue(document, userId, reference, enqueuer) {
141
+ if (reference.ownerUserId !== userId ||
142
+ reference.resourceType !== 'document' ||
143
+ reference.resourceId !== document.id ||
144
+ reference.purpose !== 'document.source') {
145
+ throw new Error('Document ingestion blob reference is inconsistent');
146
+ }
147
+ const publish = this.database.transaction(() => {
148
+ assertResourceIdentifierAvailable(this.database, 'document', document.id);
149
+ this.upsertSync(document, userId);
150
+ this.database
151
+ .prepare(`INSERT INTO platform_blob_references
152
+ (blob_id, owner_user_id, resource_type, resource_id, purpose, created_at)
153
+ VALUES (?, ?, ?, ?, ?, ?)`)
154
+ .run(reference.blobId, reference.ownerUserId, reference.resourceType, reference.resourceId, reference.purpose, reference.createdAt);
155
+ enqueuer.enqueueSQLite(createSQLiteSyncExecutor(this.database), {
156
+ documentId: document.id,
157
+ ownerUserId: userId,
158
+ });
159
+ });
160
+ publish.immediate();
161
+ }
162
+ async completeIngestion(document, userId, chunks) {
163
+ const complete = this.database.transaction(() => {
164
+ const updated = this.database
165
+ .prepare(`UPDATE documents SET filename = ?, title = ?, content = ?,
166
+ file_type = ?, size = ?, session_id = ?, collection_id = ?,
167
+ metadata = ?, uploaded_at = ?, updated_at = ?
168
+ WHERE id = ? AND user_id = ?`)
169
+ .run(document.filename, document.title ? this.cipher.encrypt(document.title) : null, document.content ? this.cipher.encrypt(document.content) : null, document.fileType || null, document.size ?? null, document.sessionId || null, document.collectionId || null, document.metadata
170
+ ? this.cipher.encrypt(JSON.stringify(document.metadata))
171
+ : null, document.uploadedAt, Date.now(), document.id, userId);
172
+ if (updated.changes !== 1)
173
+ return false;
174
+ this.replaceChunksSync(document.id, chunks);
175
+ return true;
176
+ });
177
+ return complete.immediate();
178
+ }
179
+ async publishEmbeddingIndex(documentId, userId, expectedSource, embeddingIndex, chunks) {
180
+ if (!embeddingIndex ||
181
+ typeof embeddingIndex !== 'object' ||
182
+ Array.isArray(embeddingIndex)) {
183
+ throw new Error('Document embedding index metadata is invalid');
184
+ }
185
+ const publish = this.database.transaction(() => {
186
+ const row = this.database
187
+ .prepare(`SELECT content, file_type, metadata FROM documents
188
+ WHERE id = ? AND user_id = ?`)
189
+ .get(documentId, userId);
190
+ if (!row)
191
+ return false;
192
+ const currentContent = row.content
193
+ ? decryptLegacyCompatible(this.cipher, row.content)
194
+ : null;
195
+ if (currentContent !== expectedSource.content ||
196
+ row.file_type !== expectedSource.fileType) {
197
+ return false;
198
+ }
199
+ const currentMetadata = decryptLegacyJson(this.cipher, row.metadata) ??
200
+ {};
201
+ const metadata = this.cipher.encrypt(JSON.stringify({
202
+ ...currentMetadata,
203
+ embeddingIndex,
204
+ }));
205
+ const updated = this.database
206
+ .prepare(`UPDATE documents SET metadata = ?, updated_at = ?
207
+ WHERE id = ? AND user_id = ?`)
208
+ .run(metadata, Date.now(), documentId, userId);
209
+ if (updated.changes !== 1)
210
+ return false;
211
+ this.replaceChunksSync(documentId, chunks);
212
+ return true;
213
+ });
214
+ return publish.immediate();
215
+ }
216
+ async deleteByOwner(documentId, userId) {
217
+ return (this.database
218
+ .prepare('DELETE FROM documents WHERE id = ? AND user_id = ?')
219
+ .run(documentId, userId).changes > 0);
220
+ }
221
+ async deleteAndEnqueue(documentId, userId, enqueuer) {
222
+ const remove = this.database.transaction(() => {
223
+ const existing = this.database
224
+ .prepare('SELECT 1 FROM documents WHERE id = ? AND user_id = ?')
225
+ .get(documentId, userId);
226
+ if (!existing)
227
+ return false;
228
+ const deletion = recordResourceDeletion(this.database, {
229
+ resourceType: 'document',
230
+ resourceId: documentId,
231
+ ownerUserId: userId,
232
+ });
233
+ const deleted = this.database
234
+ .prepare('DELETE FROM documents WHERE id = ? AND user_id = ?')
235
+ .run(documentId, userId);
236
+ if (deleted.changes !== 1) {
237
+ throw new Error('Document disappeared while deletion was serialized');
238
+ }
239
+ enqueuer.enqueueSQLite(createSQLiteSyncExecutor(this.database), deletion);
240
+ return true;
241
+ });
242
+ return remove.immediate();
243
+ }
244
+ async setCollection(documentId, collectionId, userId) {
245
+ return (this.database
246
+ .prepare('UPDATE documents SET collection_id = ? WHERE id = ? AND user_id = ?')
247
+ .run(collectionId, documentId, userId).changes > 0);
248
+ }
249
+ async inspectLegacyChunkEmbeddings(documentId, userId) {
250
+ const rows = this.database
251
+ .prepare(`SELECT c.embedding
252
+ FROM document_chunks c
253
+ JOIN documents d ON d.id = c.document_id
254
+ WHERE c.document_id = ? AND d.user_id = ?
255
+ AND c.embedding IS NOT NULL
256
+ ORDER BY c.chunk_index, c.id`)
257
+ .iterate(documentId, userId);
258
+ let present = false;
259
+ let rowCount = 0;
260
+ let ciphertextBytes = 0;
261
+ for (const row of rows) {
262
+ present = true;
263
+ rowCount += 1;
264
+ const rowBytes = typeof row.embedding === 'string'
265
+ ? Buffer.byteLength(row.embedding, 'utf8')
266
+ : 0;
267
+ ciphertextBytes += rowBytes;
268
+ if (rowCount > MAX_VECTOR_RESOURCE_INDEX_ENTRIES ||
269
+ ciphertextBytes > 64 * 1024 * 1024 ||
270
+ typeof row.embedding !== 'string' ||
271
+ rowBytes > 4 * 1024 * 1024 ||
272
+ !this.cipher.isEncrypted(row.embedding)) {
273
+ return { present: true, authenticated: false };
274
+ }
275
+ try {
276
+ const plaintext = this.cipher.decryptAuthenticated(row.embedding);
277
+ if (Buffer.byteLength(plaintext, 'utf8') > 2 * 1024 * 1024) {
278
+ return { present: true, authenticated: false };
279
+ }
280
+ const embedding = JSON.parse(plaintext);
281
+ if (!Array.isArray(embedding) ||
282
+ embedding.length < 1 ||
283
+ embedding.length > 16000 ||
284
+ !embedding.every(component => typeof component === 'number' && Number.isFinite(component))) {
285
+ return { present: true, authenticated: false };
286
+ }
287
+ }
288
+ catch {
289
+ return { present: true, authenticated: false };
290
+ }
291
+ }
292
+ return { present, authenticated: present };
293
+ }
294
+ async listChunks(documentId) {
295
+ const rows = this.database
296
+ .prepare('SELECT * FROM document_chunks WHERE document_id = ? ORDER BY chunk_index ASC')
297
+ .all(documentId);
298
+ return rows.map(row => mapDocumentChunkRow(this.cipher, row));
299
+ }
300
+ async replaceChunks(documentId, chunks) {
301
+ const replace = this.database.transaction(() => this.replaceChunksSync(documentId, chunks));
302
+ replace();
303
+ }
304
+ replaceChunksSync(documentId, chunks) {
305
+ this.database
306
+ .prepare('DELETE FROM document_chunks WHERE document_id = ?')
307
+ .run(documentId);
308
+ const insert = this.database.prepare(`INSERT INTO document_chunks
309
+ (id, document_id, chunk_index, content, start_char, end_char,
310
+ embedding, created_at)
311
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`);
312
+ const now = Date.now();
313
+ for (const chunk of chunks) {
314
+ insert.run(chunk.id, documentId, chunk.chunkIndex, this.cipher.encrypt(chunk.content), chunk.startChar ?? null, chunk.endChar ?? null, chunk.embedding
315
+ ? this.cipher.encrypt(JSON.stringify(chunk.embedding))
316
+ : null, now);
317
+ }
318
+ }
319
+ async deleteChunks(documentId) {
320
+ return (this.database
321
+ .prepare('DELETE FROM document_chunks WHERE document_id = ?')
322
+ .run(documentId).changes > 0);
323
+ }
324
+ }
325
+ class SQLiteGalleryMetadataRepository {
326
+ constructor(database, cipher) {
327
+ this.database = database;
328
+ this.cipher = cipher;
329
+ }
330
+ map(row) {
331
+ const metadata = decryptLegacyJson(this.cipher, row.metadata);
332
+ return {
333
+ id: row.id,
334
+ userId: row.user_id,
335
+ kind: row.kind,
336
+ prompt: decryptLegacyCompatible(this.cipher, row.prompt),
337
+ model: row.model,
338
+ ...(row.plugin_id ? { pluginId: row.plugin_id } : {}),
339
+ mimeType: row.mime_type,
340
+ ...(row.size ? { size: row.size } : {}),
341
+ ...(row.quality ? { quality: row.quality } : {}),
342
+ ...(metadata ? { metadata } : {}),
343
+ createdAt: row.created_at,
344
+ ...(row.image_data
345
+ ? {
346
+ legacyMediaData: decryptLegacyCompatible(this.cipher, row.image_data),
347
+ }
348
+ : {}),
349
+ };
350
+ }
351
+ async insert(record, reference) {
352
+ const insert = this.database.transaction(() => {
353
+ assertResourceIdentifierAvailable(this.database, 'generated-media', record.id);
354
+ this.database
355
+ .prepare(`INSERT INTO generated_images
356
+ (id, user_id, kind, prompt, model, plugin_id, image_data,
357
+ mime_type, size, quality, metadata, created_at)
358
+ VALUES (?, ?, ?, ?, ?, ?, '', ?, ?, ?, ?, ?)`)
359
+ .run(record.id, record.userId, record.kind, this.cipher.encrypt(record.prompt), record.model, record.pluginId || null, record.mimeType, record.size || null, record.quality || null, record.metadata
360
+ ? this.cipher.encrypt(JSON.stringify(record.metadata))
361
+ : null, record.createdAt);
362
+ this.database
363
+ .prepare(`INSERT INTO platform_blob_references
364
+ (blob_id, owner_user_id, resource_type, resource_id, purpose, created_at)
365
+ VALUES (?, ?, ?, ?, ?, ?)`)
366
+ .run(reference.blobId, reference.ownerUserId, reference.resourceType, reference.resourceId, reference.purpose, reference.createdAt);
367
+ });
368
+ insert();
369
+ }
370
+ async findByOwner(mediaId, userId) {
371
+ const row = this.database
372
+ .prepare('SELECT * FROM generated_images WHERE id = ? AND user_id = ?')
373
+ .get(mediaId, userId);
374
+ return row ? this.map(row) : undefined;
375
+ }
376
+ async listByOwner(userId, options) {
377
+ const predicate = options.kind ? 'user_id = ? AND kind = ?' : 'user_id = ?';
378
+ const values = options.kind ? [userId, options.kind] : [userId];
379
+ const count = this.database
380
+ .prepare(`SELECT COUNT(*) AS count FROM generated_images WHERE ${predicate}`)
381
+ .get(...values);
382
+ const rows = this.database
383
+ .prepare(`SELECT * FROM generated_images WHERE ${predicate}
384
+ ORDER BY created_at DESC, id ASC LIMIT ? OFFSET ?`)
385
+ .all(...values, options.limit, options.offset);
386
+ return { records: rows.map(row => this.map(row)), total: count.count };
387
+ }
388
+ async adoptLegacyBlob(reference) {
389
+ const adopt = this.database.transaction(() => {
390
+ assertResourceIdentifierAvailable(this.database, 'generated-media', reference.resourceId);
391
+ const current = this.database
392
+ .prepare(`SELECT image_data FROM generated_images
393
+ WHERE id = ? AND user_id = ?`)
394
+ .get(reference.resourceId, reference.ownerUserId);
395
+ if (!current) {
396
+ throw new Error('Generated media was deleted during legacy adoption');
397
+ }
398
+ this.database
399
+ .prepare(`INSERT INTO platform_blob_references
400
+ (blob_id, owner_user_id, resource_type, resource_id, purpose, created_at)
401
+ VALUES (?, ?, ?, ?, ?, ?)
402
+ ON CONFLICT(resource_type, resource_id, purpose) DO NOTHING`)
403
+ .run(reference.blobId, reference.ownerUserId, reference.resourceType, reference.resourceId, reference.purpose, reference.createdAt);
404
+ this.database
405
+ .prepare(`UPDATE generated_images SET image_data = ''
406
+ WHERE id = ? AND user_id = ? AND image_data <> ''`)
407
+ .run(reference.resourceId, reference.ownerUserId);
408
+ });
409
+ adopt();
410
+ }
411
+ async deleteByOwner(mediaId, userId) {
412
+ const remove = this.database.transaction(() => {
413
+ const reference = this.database
414
+ .prepare(`SELECT blob_id, owner_user_id, resource_type, resource_id, purpose,
415
+ created_at
416
+ FROM platform_blob_references
417
+ WHERE resource_type = 'generated-media' AND resource_id = ?
418
+ AND purpose = 'gallery.media' AND owner_user_id = ?`)
419
+ .get(mediaId, userId);
420
+ const deleted = this.database
421
+ .prepare('DELETE FROM generated_images WHERE id = ? AND user_id = ?')
422
+ .run(mediaId, userId);
423
+ if (deleted.changes === 0)
424
+ return undefined;
425
+ this.database
426
+ .prepare(`DELETE FROM platform_blob_references
427
+ WHERE resource_type = 'generated-media' AND resource_id = ?
428
+ AND purpose = 'gallery.media' AND owner_user_id = ?`)
429
+ .run(mediaId, userId);
430
+ return reference ? referenceFromRow(reference) : undefined;
431
+ });
432
+ return remove();
433
+ }
434
+ async deleteAndEnqueue(mediaId, userId, enqueuer) {
435
+ const remove = this.database.transaction(() => {
436
+ const existing = this.database
437
+ .prepare('SELECT 1 FROM generated_images WHERE id = ? AND user_id = ?')
438
+ .get(mediaId, userId);
439
+ if (!existing)
440
+ return false;
441
+ const deletion = recordResourceDeletion(this.database, {
442
+ resourceType: 'generated-media',
443
+ resourceId: mediaId,
444
+ ownerUserId: userId,
445
+ });
446
+ this.database
447
+ .prepare(`UPDATE media_generation_jobs
448
+ SET status = 'failed', error = ?, updated_at = ?
449
+ WHERE id = ? AND user_id = ?
450
+ AND status IN ('pending', 'in_progress')`)
451
+ .run(this.cipher.encrypt('Generated media was deleted'), Date.now(), mediaId, userId);
452
+ const deleted = this.database
453
+ .prepare('DELETE FROM generated_images WHERE id = ? AND user_id = ?')
454
+ .run(mediaId, userId);
455
+ if (deleted.changes !== 1) {
456
+ throw new Error('Generated media disappeared during deletion');
457
+ }
458
+ enqueuer.enqueueSQLite(createSQLiteSyncExecutor(this.database), deletion);
459
+ return true;
460
+ });
461
+ return remove.immediate();
462
+ }
463
+ }
464
+ class SQLiteMediaGenerationJobRepository {
465
+ constructor(database, cipher) {
466
+ this.database = database;
467
+ this.cipher = cipher;
468
+ }
469
+ map(row) {
470
+ return {
471
+ id: row.id,
472
+ userId: row.user_id,
473
+ providerJobId: row.provider_job_id,
474
+ pluginId: row.plugin_id,
475
+ model: row.model,
476
+ prompt: decryptLegacyCompatible(this.cipher, row.prompt),
477
+ status: row.status,
478
+ options: decryptLegacyJson(this.cipher, row.options_json) || {},
479
+ ...(row.gallery_id ? { galleryId: row.gallery_id } : {}),
480
+ ...(row.error
481
+ ? { error: decryptLegacyCompatible(this.cipher, row.error) }
482
+ : {}),
483
+ createdAt: row.created_at,
484
+ updatedAt: row.updated_at,
485
+ };
486
+ }
487
+ insert(record) {
488
+ this.database
489
+ .prepare(`INSERT INTO media_generation_jobs
490
+ (id, user_id, provider_job_id, plugin_id, model, prompt, status,
491
+ options_json, gallery_id, error, created_at, updated_at)
492
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
493
+ .run(record.id, record.userId, record.providerJobId, record.pluginId, record.model, this.cipher.encrypt(record.prompt), record.status, this.cipher.encrypt(JSON.stringify(record.options)), record.galleryId || null, record.error ? this.cipher.encrypt(record.error) : null, record.createdAt, record.updatedAt);
494
+ }
495
+ async create(record) {
496
+ this.insert(record);
497
+ }
498
+ async createPreparedAndEnqueue(record, enqueuer) {
499
+ this.database
500
+ .transaction(() => {
501
+ this.insert(record);
502
+ enqueuer.enqueueSQLite(createSQLiteSyncExecutor(this.database), {
503
+ mediaJobId: record.id,
504
+ ownerUserId: record.userId,
505
+ });
506
+ })
507
+ .immediate();
508
+ }
509
+ async acceptProviderAndEnqueueResume(id, userId, providerJobId, updatedAt, preparedProviderJobId, enqueuer) {
510
+ return this.database
511
+ .transaction(() => {
512
+ const current = this.database
513
+ .prepare('SELECT provider_job_id FROM media_generation_jobs WHERE id = ? AND user_id = ?')
514
+ .get(id, userId);
515
+ if (!current)
516
+ return false;
517
+ if (current.provider_job_id !== preparedProviderJobId &&
518
+ current.provider_job_id !== providerJobId) {
519
+ throw new Error('Media provider reconciliation returned a new job ID');
520
+ }
521
+ this.database
522
+ .prepare(`UPDATE media_generation_jobs
523
+ SET provider_job_id = ?, status = 'pending', updated_at = ?
524
+ WHERE id = ? AND user_id = ?`)
525
+ .run(providerJobId, updatedAt, id, userId);
526
+ enqueuer.enqueueSQLite(createSQLiteSyncExecutor(this.database), {
527
+ mediaJobId: id,
528
+ ownerUserId: userId,
529
+ });
530
+ return true;
531
+ })
532
+ .immediate();
533
+ }
534
+ async findByOwner(id, userId) {
535
+ const row = this.database
536
+ .prepare('SELECT * FROM media_generation_jobs WHERE id = ? AND user_id = ?')
537
+ .get(id, userId);
538
+ return row ? this.map(row) : undefined;
539
+ }
540
+ async listByOwner(userId, options) {
541
+ const rows = this.database
542
+ .prepare(`SELECT * FROM media_generation_jobs WHERE user_id = ?
543
+ ${options.activeOnly ? "AND status IN ('pending', 'in_progress')" : ''}
544
+ ORDER BY updated_at DESC, id ASC LIMIT ?`)
545
+ .all(userId, options.limit);
546
+ return rows.map(row => this.map(row));
547
+ }
548
+ async deleteByOwner(id, userId) {
549
+ return (this.database
550
+ .prepare('DELETE FROM media_generation_jobs WHERE id = ? AND user_id = ?')
551
+ .run(id, userId).changes > 0);
552
+ }
553
+ async updateStatus(id, userId, status, fields, updatedAt) {
554
+ return (this.database
555
+ .prepare(`UPDATE media_generation_jobs
556
+ SET status = ?, gallery_id = COALESCE(?, gallery_id),
557
+ error = COALESCE(?, error), updated_at = ?
558
+ WHERE id = ? AND user_id = ?`)
559
+ .run(status, fields.galleryId || null, fields.error ? this.cipher.encrypt(fields.error) : null, updatedAt, id, userId).changes > 0);
560
+ }
561
+ async completeIfUnclaimed(id, userId, galleryId, updatedAt) {
562
+ return (this.database
563
+ .prepare(`UPDATE media_generation_jobs
564
+ SET status = 'completed', gallery_id = ?, error = NULL, updated_at = ?
565
+ WHERE id = ? AND user_id = ? AND gallery_id IS NULL`)
566
+ .run(galleryId, updatedAt, id, userId).changes > 0);
567
+ }
568
+ async deleteTerminalBefore(cutoff) {
569
+ return this.database
570
+ .prepare(`DELETE FROM media_generation_jobs
571
+ WHERE status IN ('completed', 'failed') AND updated_at < ?`)
572
+ .run(cutoff).changes;
573
+ }
574
+ }
575
+ class SQLitePersonaMemoryRepository {
576
+ constructor(database, cipher) {
577
+ this.database = database;
578
+ this.cipher = cipher;
579
+ }
580
+ map(row) {
581
+ let consolidatedFrom;
582
+ try {
583
+ const parsed = row.consolidated_from
584
+ ? JSON.parse(decryptLegacyCompatible(this.cipher, row.consolidated_from))
585
+ : undefined;
586
+ if (Array.isArray(parsed) &&
587
+ parsed.every(value => typeof value === 'string')) {
588
+ consolidatedFrom = parsed;
589
+ }
590
+ }
591
+ catch {
592
+ consolidatedFrom = undefined;
593
+ }
594
+ return {
595
+ id: row.id,
596
+ userId: row.user_id,
597
+ personaId: row.persona_id,
598
+ content: decryptLegacyCompatible(this.cipher, row.content),
599
+ timestamp: row.timestamp,
600
+ ...(row.context
601
+ ? { context: decryptLegacyCompatible(this.cipher, row.context) }
602
+ : {}),
603
+ importanceScore: row.importance_score,
604
+ memoryType: row.memory_type || 'general',
605
+ accessCount: row.access_count || 0,
606
+ ...(row.last_accessed ? { lastAccessed: row.last_accessed } : {}),
607
+ decayFactor: row.decay_factor ?? 1,
608
+ ...(consolidatedFrom ? { consolidatedFrom } : {}),
609
+ ...(row.embedding
610
+ ? { legacyEmbedding: embeddingBufferToArray(row.embedding) }
611
+ : {}),
612
+ };
613
+ }
614
+ async insert(record) {
615
+ this.database
616
+ .prepare(`INSERT INTO persona_memories
617
+ (id, user_id, persona_id, content, embedding, timestamp, context,
618
+ importance_score, memory_type, access_count, last_accessed,
619
+ decay_factor, consolidated_from)
620
+ VALUES (?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?)`)
621
+ .run(record.id, record.userId, record.personaId, this.cipher.encrypt(record.content), record.timestamp, record.context ? this.cipher.encrypt(record.context) : null, record.importanceScore, record.memoryType, record.accessCount, record.lastAccessed || null, record.decayFactor, record.consolidatedFrom
622
+ ? this.cipher.encrypt(JSON.stringify(record.consolidatedFrom))
623
+ : null);
624
+ }
625
+ async findByOwner(memoryId, userId, personaId) {
626
+ const row = this.database
627
+ .prepare(`SELECT * FROM persona_memories
628
+ WHERE id = ? AND user_id = ? AND persona_id = ?`)
629
+ .get(memoryId, userId, personaId);
630
+ return row ? this.map(row) : undefined;
631
+ }
632
+ async listByOwner(userId, personaId, options = {}) {
633
+ const parameters = [userId, personaId];
634
+ let predicate = 'user_id = ? AND persona_id = ?';
635
+ if (options.types?.length) {
636
+ predicate += ` AND memory_type IN (${options.types.map(() => '?').join(',')})`;
637
+ parameters.push(...options.types);
638
+ }
639
+ if (options.minimumImportance !== undefined) {
640
+ predicate += ' AND importance_score >= ?';
641
+ parameters.push(options.minimumImportance);
642
+ }
643
+ const limit = Math.min(Math.max(options.limit ?? 100, 1), 10000);
644
+ const offset = Math.max(options.offset ?? 0, 0);
645
+ const rows = this.database
646
+ .prepare(`SELECT * FROM persona_memories WHERE ${predicate}
647
+ ORDER BY timestamp DESC, id ASC LIMIT ? OFFSET ?`)
648
+ .all(...parameters, limit, offset);
649
+ return rows.map(row => this.map(row));
650
+ }
651
+ async countByOwner(userId, personaId) {
652
+ const row = this.database
653
+ .prepare('SELECT COUNT(*) AS count FROM persona_memories WHERE user_id = ? AND persona_id = ?')
654
+ .get(userId, personaId);
655
+ return row.count;
656
+ }
657
+ async reinforce(memoryId, userId, personaId, accessedAt) {
658
+ return (this.database
659
+ .prepare(`UPDATE persona_memories
660
+ SET access_count = COALESCE(access_count, 0) + 1,
661
+ last_accessed = ?,
662
+ importance_score = MIN(1.0, COALESCE(importance_score, 0.5) + 0.05)
663
+ WHERE id = ? AND user_id = ? AND persona_id = ?`)
664
+ .run(accessedAt, memoryId, userId, personaId).changes > 0);
665
+ }
666
+ async markAccessed(ids, userId, personaId, accessedAt) {
667
+ if (ids.length === 0)
668
+ return 0;
669
+ return this.database
670
+ .prepare(`UPDATE persona_memories
671
+ SET access_count = COALESCE(access_count, 0) + 1, last_accessed = ?
672
+ WHERE user_id = ? AND persona_id = ?
673
+ AND id IN (${ids.map(() => '?').join(',')})`)
674
+ .run(accessedAt, userId, personaId, ...ids).changes;
675
+ }
676
+ async updateImportance(memoryId, userId, personaId, importanceScore, decayFactor) {
677
+ return (this.database
678
+ .prepare(`UPDATE persona_memories
679
+ SET importance_score = ?, decay_factor = COALESCE(?, decay_factor)
680
+ WHERE id = ? AND user_id = ? AND persona_id = ?`)
681
+ .run(importanceScore, decayFactor ?? null, memoryId, userId, personaId)
682
+ .changes > 0);
683
+ }
684
+ async deleteIds(ids, userId, personaId) {
685
+ if (ids.length === 0)
686
+ return 0;
687
+ return this.database
688
+ .prepare(`DELETE FROM persona_memories WHERE user_id = ? AND persona_id = ?
689
+ AND id IN (${ids.map(() => '?').join(',')})`)
690
+ .run(userId, personaId, ...ids).changes;
691
+ }
692
+ async deleteAllByOwner(userId, personaId) {
693
+ return this.database
694
+ .prepare('DELETE FROM persona_memories WHERE user_id = ? AND persona_id = ?')
695
+ .run(userId, personaId).changes;
696
+ }
697
+ async findOldLowImportanceIds(userId, personaId, cutoff, maximumImportance) {
698
+ const rows = this.database
699
+ .prepare(`SELECT id FROM persona_memories
700
+ WHERE user_id = ? AND persona_id = ? AND timestamp < ?
701
+ AND importance_score < ?
702
+ ORDER BY timestamp, id`)
703
+ .all(userId, personaId, cutoff, maximumImportance);
704
+ return rows.map(row => row.id);
705
+ }
706
+ async deleteOldLowImportance(userId, personaId, cutoff, maximumImportance) {
707
+ const remove = this.database.transaction(() => {
708
+ const rows = this.database
709
+ .prepare(`SELECT id FROM persona_memories
710
+ WHERE user_id = ? AND persona_id = ? AND timestamp < ?
711
+ AND importance_score < ?`)
712
+ .all(userId, personaId, cutoff, maximumImportance);
713
+ if (rows.length) {
714
+ this.database
715
+ .prepare(`DELETE FROM persona_memories WHERE user_id = ? AND persona_id = ?
716
+ AND id IN (${rows.map(() => '?').join(',')})`)
717
+ .run(userId, personaId, ...rows.map(row => row.id));
718
+ }
719
+ return rows.map(row => row.id);
720
+ });
721
+ return remove();
722
+ }
723
+ async statistics(userId, personaId) {
724
+ const types = this.database
725
+ .prepare(`SELECT COALESCE(memory_type, 'general') AS memory_type, COUNT(*) AS count
726
+ FROM persona_memories WHERE user_id = ? AND persona_id = ?
727
+ GROUP BY COALESCE(memory_type, 'general')`)
728
+ .all(userId, personaId);
729
+ const aggregate = this.database
730
+ .prepare(`SELECT COUNT(*) AS total_count, AVG(importance_score) AS avg_importance,
731
+ MIN(timestamp) AS oldest_memory, MAX(timestamp) AS newest_memory,
732
+ SUM(COALESCE(access_count, 0)) AS total_accesses
733
+ FROM persona_memories WHERE user_id = ? AND persona_id = ?`)
734
+ .get(userId, personaId);
735
+ return {
736
+ totalCount: aggregate.total_count,
737
+ byType: Object.fromEntries(types.map(row => [row.memory_type, row.count])),
738
+ averageImportance: aggregate.avg_importance ?? 0.5,
739
+ oldestMemory: aggregate.oldest_memory,
740
+ newestMemory: aggregate.newest_memory,
741
+ totalAccesses: aggregate.total_accesses ?? 0,
742
+ };
743
+ }
744
+ }
745
+ class SQLitePersonaRepository {
746
+ constructor(database, cipher) {
747
+ this.database = database;
748
+ this.cipher = cipher;
749
+ }
750
+ map(row) {
751
+ const parse = (value) => value
752
+ ? JSON.parse(decryptLegacyCompatible(this.cipher, value))
753
+ : undefined;
754
+ return {
755
+ id: row.id,
756
+ user_id: row.user_id,
757
+ name: decryptLegacyCompatible(this.cipher, row.name),
758
+ ...(row.description
759
+ ? { description: decryptLegacyCompatible(this.cipher, row.description) }
760
+ : {}),
761
+ model: row.model,
762
+ parameters: parse(row.parameters) || {},
763
+ ...(row.avatar
764
+ ? { avatar: decryptLegacyCompatible(this.cipher, row.avatar) }
765
+ : {}),
766
+ ...(row.background
767
+ ? { background: decryptLegacyCompatible(this.cipher, row.background) }
768
+ : {}),
769
+ ...(row.embedding_model ? { embedding_model: row.embedding_model } : {}),
770
+ ...(row.memory_settings
771
+ ? {
772
+ memory_settings: parse(row.memory_settings),
773
+ }
774
+ : {}),
775
+ ...(row.mutation_settings
776
+ ? {
777
+ mutation_settings: parse(row.mutation_settings),
778
+ }
779
+ : {}),
780
+ created_at: row.created_at,
781
+ updated_at: row.updated_at,
782
+ };
783
+ }
784
+ async listByOwner(userId) {
785
+ const rows = this.database
786
+ .prepare('SELECT * FROM personas WHERE user_id = ? ORDER BY updated_at DESC, id ASC')
787
+ .all(userId);
788
+ return rows.map(row => this.map(row));
789
+ }
790
+ async findByOwner(id, userId) {
791
+ const row = this.database
792
+ .prepare('SELECT * FROM personas WHERE id = ? AND user_id = ?')
793
+ .get(id, userId);
794
+ return row ? this.map(row) : undefined;
795
+ }
796
+ values(persona) {
797
+ return [
798
+ persona.id,
799
+ persona.user_id,
800
+ this.cipher.encrypt(persona.name),
801
+ persona.description ? this.cipher.encrypt(persona.description) : null,
802
+ persona.model,
803
+ this.cipher.encrypt(JSON.stringify(persona.parameters)),
804
+ persona.avatar ? this.cipher.encrypt(persona.avatar) : null,
805
+ persona.background ? this.cipher.encrypt(persona.background) : null,
806
+ persona.embedding_model || null,
807
+ persona.memory_settings
808
+ ? this.cipher.encrypt(JSON.stringify(persona.memory_settings))
809
+ : null,
810
+ persona.mutation_settings
811
+ ? this.cipher.encrypt(JSON.stringify(persona.mutation_settings))
812
+ : null,
813
+ persona.created_at,
814
+ persona.updated_at,
815
+ ];
816
+ }
817
+ async insert(persona) {
818
+ const insert = this.database.transaction(() => {
819
+ assertResourceIdentifierAvailable(this.database, 'persona', persona.id);
820
+ this.database
821
+ .prepare(`INSERT INTO personas
822
+ (id, user_id, name, description, model, parameters, avatar,
823
+ background, embedding_model, memory_settings, mutation_settings,
824
+ created_at, updated_at)
825
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
826
+ .run(...this.values(persona));
827
+ });
828
+ insert.immediate();
829
+ }
830
+ async replace(persona) {
831
+ const result = this.database
832
+ .prepare(`UPDATE personas SET name = ?, description = ?, model = ?,
833
+ parameters = ?, avatar = ?, background = ?, embedding_model = ?,
834
+ memory_settings = ?, mutation_settings = ?, updated_at = ?
835
+ WHERE id = ? AND user_id = ?`)
836
+ .run(this.cipher.encrypt(persona.name), persona.description ? this.cipher.encrypt(persona.description) : null, persona.model, this.cipher.encrypt(JSON.stringify(persona.parameters)), persona.avatar ? this.cipher.encrypt(persona.avatar) : null, persona.background ? this.cipher.encrypt(persona.background) : null, persona.embedding_model || null, persona.memory_settings
837
+ ? this.cipher.encrypt(JSON.stringify(persona.memory_settings))
838
+ : null, persona.mutation_settings
839
+ ? this.cipher.encrypt(JSON.stringify(persona.mutation_settings))
840
+ : null, persona.updated_at, persona.id, persona.user_id);
841
+ return result.changes === 1;
842
+ }
843
+ async patchByOwner(id, userId, patch) {
844
+ const update = this.database.transaction(() => {
845
+ const assignments = [];
846
+ const values = [];
847
+ const assign = (column, value) => {
848
+ assignments.push(`${column} = ?`);
849
+ values.push(value);
850
+ };
851
+ if (patch.name !== undefined) {
852
+ assign('name', this.cipher.encrypt(patch.name));
853
+ }
854
+ if (patch.description !== undefined) {
855
+ assign('description', patch.description === null
856
+ ? null
857
+ : this.cipher.encrypt(patch.description));
858
+ }
859
+ if (patch.model !== undefined)
860
+ assign('model', patch.model);
861
+ if (patch.parameters !== undefined) {
862
+ assign('parameters', this.cipher.encrypt(JSON.stringify(patch.parameters)));
863
+ }
864
+ if (patch.avatar !== undefined) {
865
+ assign('avatar', patch.avatar === null ? null : this.cipher.encrypt(patch.avatar));
866
+ }
867
+ if (patch.background !== undefined) {
868
+ assign('background', patch.background === null
869
+ ? null
870
+ : this.cipher.encrypt(patch.background));
871
+ }
872
+ if (patch.embedding_model !== undefined) {
873
+ assign('embedding_model', patch.embedding_model);
874
+ }
875
+ if (patch.memory_settings !== undefined) {
876
+ assign('memory_settings', patch.memory_settings === null
877
+ ? null
878
+ : this.cipher.encrypt(JSON.stringify(patch.memory_settings)));
879
+ }
880
+ if (patch.mutation_settings !== undefined) {
881
+ assign('mutation_settings', patch.mutation_settings === null
882
+ ? null
883
+ : this.cipher.encrypt(JSON.stringify(patch.mutation_settings)));
884
+ }
885
+ assign('updated_at', patch.updated_at);
886
+ const result = this.database
887
+ .prepare(`UPDATE personas SET ${assignments.join(', ')}
888
+ WHERE id = ? AND user_id = ?`)
889
+ .run(...values, id, userId);
890
+ if (result.changes !== 1)
891
+ return undefined;
892
+ const row = this.database
893
+ .prepare('SELECT * FROM personas WHERE id = ? AND user_id = ?')
894
+ .get(id, userId);
895
+ return this.map(row);
896
+ });
897
+ return update.immediate();
898
+ }
899
+ async deleteByOwner(id, userId) {
900
+ return (this.database
901
+ .prepare('DELETE FROM personas WHERE id = ? AND user_id = ?')
902
+ .run(id, userId).changes === 1);
903
+ }
904
+ async deleteAndEnqueue(id, userId, enqueuer) {
905
+ const remove = this.database.transaction(() => {
906
+ const existing = this.database
907
+ .prepare('SELECT 1 FROM personas WHERE id = ? AND user_id = ?')
908
+ .get(id, userId);
909
+ if (!existing)
910
+ return false;
911
+ const deletion = recordResourceDeletion(this.database, {
912
+ resourceType: 'persona',
913
+ resourceId: id,
914
+ ownerUserId: userId,
915
+ });
916
+ const deleted = this.database
917
+ .prepare('DELETE FROM personas WHERE id = ? AND user_id = ?')
918
+ .run(id, userId);
919
+ if (deleted.changes !== 1) {
920
+ throw new Error('Persona disappeared during deletion');
921
+ }
922
+ enqueuer.enqueueSQLite(createSQLiteSyncExecutor(this.database), deletion);
923
+ return true;
924
+ });
925
+ return remove.immediate();
926
+ }
927
+ async countByOwner(userId) {
928
+ const row = this.database
929
+ .prepare('SELECT COUNT(*) AS count FROM personas WHERE user_id = ?')
930
+ .get(userId);
931
+ return row.count;
932
+ }
933
+ }
934
+ class SQLitePersonaStateRepository {
935
+ constructor(database, cipher) {
936
+ this.database = database;
937
+ this.cipher = cipher;
938
+ }
939
+ async findByOwner(personaId, userId) {
940
+ const row = this.database
941
+ .prepare('SELECT * FROM persona_states WHERE persona_id = ? AND user_id = ?')
942
+ .get(personaId, userId);
943
+ if (!row)
944
+ return undefined;
945
+ return {
946
+ persona_id: row.persona_id,
947
+ user_id: row.user_id,
948
+ runtime_state: JSON.parse(decryptLegacyCompatible(this.cipher, row.runtime_state)),
949
+ mutation_log: JSON.parse(decryptLegacyCompatible(this.cipher, row.mutation_log)),
950
+ last_updated: row.last_updated,
951
+ version: row.version,
952
+ };
953
+ }
954
+ async upsert(state) {
955
+ this.database
956
+ .prepare(`INSERT INTO persona_states
957
+ (persona_id, user_id, runtime_state, mutation_log, last_updated, version)
958
+ VALUES (?, ?, ?, ?, ?, ?)
959
+ ON CONFLICT(persona_id) DO UPDATE SET
960
+ runtime_state = excluded.runtime_state,
961
+ mutation_log = excluded.mutation_log,
962
+ last_updated = excluded.last_updated,
963
+ version = excluded.version
964
+ WHERE persona_states.user_id = excluded.user_id`)
965
+ .run(state.persona_id, state.user_id, this.cipher.encrypt(JSON.stringify(state.runtime_state)), this.cipher.encrypt(JSON.stringify(state.mutation_log)), state.last_updated, state.version);
966
+ }
967
+ async deleteByOwner(personaId, userId) {
968
+ return (this.database
969
+ .prepare('DELETE FROM persona_states WHERE persona_id = ? AND user_id = ?')
970
+ .run(personaId, userId).changes === 1);
971
+ }
972
+ }
973
+ class SQLiteResourceDeletionLifecycleRepository {
974
+ constructor(database) {
975
+ this.database = database;
976
+ }
977
+ cleanupAuthorizedSync(input) {
978
+ const table = resourceTable(input.resourceType);
979
+ const row = this.database
980
+ .prepare(`SELECT 1
981
+ FROM platform_resource_deletion_tombstones tombstone
982
+ WHERE tombstone.resource_type = ?
983
+ AND tombstone.resource_id = ?
984
+ AND tombstone.owner_user_id = ?
985
+ AND tombstone.deletion_incarnation = ?
986
+ AND tombstone.deletion_token = ?
987
+ AND NOT EXISTS (
988
+ SELECT 1 FROM ${table} resource
989
+ WHERE resource.id = tombstone.resource_id
990
+ AND resource.user_id = tombstone.owner_user_id
991
+ )`)
992
+ .get(input.resourceType, input.resourceId, input.ownerUserId, input.deletionIncarnation, input.deletionToken);
993
+ return Boolean(row);
994
+ }
995
+ async withAuthorizedCleanup(input, operation) {
996
+ // better-sqlite3 transactions cannot span an async external operation.
997
+ // Safety instead comes from the permanent tombstone: every same-ID
998
+ // creator, archive restore, and legacy adoption rejects it before write.
999
+ if (!this.cleanupAuthorizedSync(input))
1000
+ return { authorized: false };
1001
+ return { authorized: true, value: await operation() };
1002
+ }
1003
+ async isReserved(resourceType, resourceId) {
1004
+ return Boolean(this.database
1005
+ .prepare(`SELECT 1 FROM platform_resource_deletion_tombstones
1006
+ WHERE resource_type = ? AND resource_id = ?`)
1007
+ .get(resourceType, resourceId));
1008
+ }
1009
+ async isCleanupAuthorized(input) {
1010
+ return this.cleanupAuthorizedSync(input);
1011
+ }
1012
+ async markCleanupCompleted(input) {
1013
+ const table = resourceTable(input.resourceType);
1014
+ const result = this.database
1015
+ .prepare(`UPDATE platform_resource_deletion_tombstones
1016
+ SET completed_at = COALESCE(completed_at, ?)
1017
+ WHERE resource_type = ? AND resource_id = ? AND owner_user_id = ?
1018
+ AND deletion_incarnation = ? AND deletion_token = ?
1019
+ AND NOT EXISTS (
1020
+ SELECT 1 FROM ${table} resource
1021
+ WHERE resource.id = platform_resource_deletion_tombstones.resource_id
1022
+ AND resource.user_id = platform_resource_deletion_tombstones.owner_user_id
1023
+ )`)
1024
+ .run(Date.now(), input.resourceType, input.resourceId, input.ownerUserId, input.deletionIncarnation, input.deletionToken);
1025
+ return result.changes === 1;
1026
+ }
1027
+ }
1028
+ export const createSQLitePlatformDomainRepositories = (database, cipher) => ({
1029
+ documents: new SQLiteDocumentRepository(database, cipher),
1030
+ gallery: new SQLiteGalleryMetadataRepository(database, cipher),
1031
+ mediaJobs: new SQLiteMediaGenerationJobRepository(database, cipher),
1032
+ memories: new SQLitePersonaMemoryRepository(database, cipher),
1033
+ personas: new SQLitePersonaRepository(database, cipher),
1034
+ personaStates: new SQLitePersonaStateRepository(database, cipher),
1035
+ resourceDeletions: new SQLiteResourceDeletionLifecycleRepository(database),
1036
+ });
1037
+ //# sourceMappingURL=sqlitePlatformDomainRepositories.js.map