@undefineds.co/xpod 0.3.75 → 0.4.0-rc.140

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 (362) hide show
  1. package/bin/xpod.js +43 -8
  2. package/config/bun.json +45 -48
  3. package/config/cloud.json +13 -90
  4. package/config/components-ignore.json +0 -1
  5. package/config/local.json +111 -63
  6. package/config/resolver.json +4 -2
  7. package/config/terminal.json +4 -1
  8. package/config/xpod.base.json +16 -8
  9. package/config/xpod.json +51 -54
  10. package/dist/acceptance/PublicCloudSemanticConformance.d.ts +4 -0
  11. package/dist/acceptance/PublicCloudSemanticConformance.js +214 -0
  12. package/dist/acceptance/QleverSearchConformance.d.ts +39 -0
  13. package/dist/acceptance/QleverSearchConformance.js +686 -0
  14. package/dist/acceptance/QleverSemanticConformance.d.ts +3 -0
  15. package/dist/acceptance/QleverSemanticConformance.js +178 -0
  16. package/dist/acceptance/RdfSemanticConformance.d.ts +114 -0
  17. package/dist/acceptance/RdfSemanticConformance.js +307 -0
  18. package/dist/acceptance/run-installed-qlever-conformance.d.ts +12 -0
  19. package/dist/acceptance/run-installed-qlever-conformance.js +87 -0
  20. package/dist/acceptance/run-installed-rdf-conformance.d.ts +12 -0
  21. package/dist/acceptance/run-installed-rdf-conformance.js +88 -0
  22. package/dist/ai/service/EmbeddingProviderError.d.ts +7 -0
  23. package/dist/ai/service/EmbeddingProviderError.js +42 -0
  24. package/dist/api/ai-gateway/connect/index.js +5 -2
  25. package/dist/api/auth/AuthContext.d.ts +5 -0
  26. package/dist/api/auth/AuthContext.js +10 -0
  27. package/dist/api/container/common.js +20 -1
  28. package/dist/api/container/rdf.d.ts +1 -0
  29. package/dist/api/container/rdf.js +43 -4
  30. package/dist/api/container/types.d.ts +4 -0
  31. package/dist/api/runs/InngestRunExecutionBackend.d.ts +2 -2
  32. package/dist/api/runs/PiAgentRuntimeDriver.d.ts +2 -0
  33. package/dist/api/runs/PiAgentRuntimeDriver.js +1 -0
  34. package/dist/api/runs/RdfRunContextRetriever.d.ts +8 -0
  35. package/dist/api/runs/RdfRunContextRetriever.js +23 -1
  36. package/dist/api/runtime.js +20 -6
  37. package/dist/api/service/RdfSearchIndexingService.d.ts +37 -3
  38. package/dist/api/service/RdfSearchIndexingService.js +130 -18
  39. package/dist/api/service/RdfSearchIndexingSolidFsSyncer.d.ts +8 -0
  40. package/dist/api/service/RdfSearchIndexingSolidFsSyncer.js +102 -15
  41. package/dist/api/service/RdfSearchReconciliationWorker.d.ts +76 -0
  42. package/dist/api/service/RdfSearchReconciliationWorker.js +294 -0
  43. package/dist/api/tasks/InngestTaskScheduler.d.ts +4 -4
  44. package/dist/components/components.jsonld +9 -12
  45. package/dist/components/context.jsonld +227 -348
  46. package/dist/document/MarkdownRetrievalPointProjector.d.ts +33 -0
  47. package/dist/document/MarkdownRetrievalPointProjector.js +196 -0
  48. package/dist/document/MarkdownRetrievalPointProjector.jsonld +135 -0
  49. package/dist/document/ReaderMaterialization.d.ts +34 -0
  50. package/dist/document/ReaderMaterialization.js +3 -0
  51. package/dist/document/ReaderMaterialization.jsonld +151 -0
  52. package/dist/document/ReaderMaterializationRepository.d.ts +27 -0
  53. package/dist/document/ReaderMaterializationRepository.js +400 -0
  54. package/dist/document/ReaderMaterializationRepository.jsonld +84 -0
  55. package/dist/document/index.d.ts +3 -1
  56. package/dist/document/index.js +3 -1
  57. package/dist/http/SubgraphSparqlHttpHandler.js +34 -54
  58. package/dist/http/search/SearchHttpHandler.js +14 -12
  59. package/dist/http/terminal/TerminalHttpHandler.d.ts +3 -0
  60. package/dist/http/terminal/TerminalHttpHandler.js +1 -0
  61. package/dist/http/terminal/TerminalHttpHandler.jsonld +11 -0
  62. package/dist/identity/drizzle/DrizzleIndexedStorage.js +19 -39
  63. package/dist/identity/drizzle/db.d.ts +1 -0
  64. package/dist/identity/drizzle/db.js +35 -0
  65. package/dist/index.d.ts +9 -17
  66. package/dist/index.js +14 -22
  67. package/dist/provision/ProvisionPodCreator.d.ts +1 -1
  68. package/dist/provision/ProvisionPodCreator.js +4 -3
  69. package/dist/search/RdfSearchIntentSink.d.ts +17 -0
  70. package/dist/search/RdfSearchIntentSink.js +46 -0
  71. package/dist/search/RdfSearchIntentSink.jsonld +47 -0
  72. package/dist/search/RdfSearchReconciliationRepository.d.ts +81 -0
  73. package/dist/search/RdfSearchReconciliationRepository.js +771 -0
  74. package/dist/solidfs/LocalRdfAuthorityRecoveryInitializer.d.ts +15 -0
  75. package/dist/solidfs/LocalRdfAuthorityRecoveryInitializer.js +48 -0
  76. package/dist/solidfs/LocalRdfAuthorityRecoveryInitializer.jsonld +99 -0
  77. package/dist/solidfs/RdfIndexSolidFsSyncer.js +22 -4
  78. package/dist/solidfs/SolidFsSyncJournal.d.ts +7 -1
  79. package/dist/solidfs/SolidFsSyncJournal.js +20 -5
  80. package/dist/solidfs/SolidFsSyncJournal.jsonld +43 -0
  81. package/dist/solidfs/index.d.ts +1 -0
  82. package/dist/solidfs/index.js +1 -0
  83. package/dist/storage/SparqlUpdateResourceStore.js +3 -3
  84. package/dist/storage/accessors/MixDataAccessor.d.ts +21 -29
  85. package/dist/storage/accessors/MixDataAccessor.js +182 -399
  86. package/dist/storage/accessors/MixDataAccessor.jsonld +109 -87
  87. package/dist/storage/accessors/SolidRdfDataAccessor.d.ts +12 -8
  88. package/dist/storage/accessors/SolidRdfDataAccessor.js +189 -59
  89. package/dist/storage/accessors/SolidRdfDataAccessor.jsonld +14 -29
  90. package/dist/storage/rdf/LocalQleverNativeSparqlClient.d.ts +55 -0
  91. package/dist/storage/rdf/LocalQleverNativeSparqlClient.js +519 -0
  92. package/dist/storage/rdf/LocalQleverNativeSparqlClient.jsonld +314 -0
  93. package/dist/storage/rdf/PostgresRdfEngine.d.ts +3 -1
  94. package/dist/storage/rdf/PostgresRdfEngine.js +111 -74
  95. package/dist/storage/rdf/PostgresRdfEngine.jsonld +12 -22
  96. package/dist/storage/rdf/PostgresRdfSchemaValidation.d.ts +8 -0
  97. package/dist/storage/rdf/PostgresRdfSchemaValidation.js +82 -0
  98. package/dist/storage/rdf/PostgresRdfTextIndex.d.ts +6 -3
  99. package/dist/storage/rdf/PostgresRdfTextIndex.js +158 -80
  100. package/dist/storage/rdf/PostgresRdfTextIndex.jsonld +16 -4
  101. package/dist/storage/rdf/PostgresRdfVectorIndex.d.ts +4 -5
  102. package/dist/storage/rdf/PostgresRdfVectorIndex.js +124 -120
  103. package/dist/storage/rdf/PostgresRdfVectorIndex.jsonld +14 -18
  104. package/dist/storage/rdf/QleverSparqlEngine.d.ts +35 -0
  105. package/dist/storage/rdf/QleverSparqlEngine.js +185 -0
  106. package/dist/storage/rdf/QleverSparqlEngine.jsonld +70 -0
  107. package/dist/storage/rdf/Rdf3xIndex.js +20 -16
  108. package/dist/storage/rdf/RdfAccessScope.d.ts +4 -0
  109. package/dist/storage/rdf/RdfAccessScope.js +74 -9
  110. package/dist/storage/rdf/RdfAccessScope.jsonld +16 -0
  111. package/dist/storage/rdf/RdfEngineRdfJsSource.d.ts +14 -0
  112. package/dist/storage/rdf/RdfEngineRdfJsSource.js +179 -0
  113. package/dist/storage/rdf/RdfQuadIndex.d.ts +13 -14
  114. package/dist/storage/rdf/RdfQuadIndex.js +286 -99
  115. package/dist/storage/rdf/RdfQuadIndex.jsonld +10 -22
  116. package/dist/storage/rdf/RdfQueryExecutor.js +10 -4
  117. package/dist/storage/rdf/RdfQuerySparqlEngine.d.ts +33 -0
  118. package/dist/storage/rdf/RdfQuerySparqlEngine.js +215 -0
  119. package/dist/storage/rdf/RdfQuerySparqlEngine.jsonld +78 -0
  120. package/dist/storage/rdf/RdfSparqlAdapter.d.ts +0 -4
  121. package/dist/storage/rdf/RdfSparqlAdapter.js +75 -173
  122. package/dist/storage/rdf/RdfSparqlBoundary.d.ts +37 -0
  123. package/dist/storage/rdf/RdfSparqlBoundary.js +247 -0
  124. package/dist/storage/rdf/RdfSparqlSerialization.d.ts +3 -0
  125. package/dist/storage/rdf/RdfSparqlSerialization.js +19 -0
  126. package/dist/storage/rdf/RdfSqliteConnection.d.ts +7 -0
  127. package/dist/storage/rdf/RdfSqliteConnection.js +23 -0
  128. package/dist/storage/rdf/RdfTermDictionary.d.ts +0 -8
  129. package/dist/storage/rdf/RdfTermDictionary.js +0 -136
  130. package/dist/storage/rdf/RdfTermDictionary.jsonld +0 -32
  131. package/dist/storage/rdf/RdfTermSemantics.d.ts +6 -0
  132. package/dist/storage/rdf/RdfTermSemantics.js +29 -0
  133. package/dist/storage/rdf/RdfTextIndex.d.ts +5 -6
  134. package/dist/storage/rdf/RdfTextIndex.js +187 -115
  135. package/dist/storage/rdf/RdfTextIndex.jsonld +10 -14
  136. package/dist/storage/rdf/RdfVectorIndex.d.ts +4 -4
  137. package/dist/storage/rdf/RdfVectorIndex.js +156 -233
  138. package/dist/storage/rdf/RdfVectorIndex.jsonld +10 -14
  139. package/dist/storage/rdf/SolidRdfEngine.d.ts +16 -21
  140. package/dist/storage/rdf/SolidRdfEngine.js +28 -308
  141. package/dist/storage/rdf/SolidRdfEngine.jsonld +26 -148
  142. package/dist/storage/rdf/XpodComunicaQueryEngine.d.ts +10 -0
  143. package/dist/storage/rdf/XpodComunicaQueryEngine.js +72 -0
  144. package/dist/storage/rdf/index.d.ts +7 -6
  145. package/dist/storage/rdf/index.js +17 -12
  146. package/dist/storage/rdf/models-benchmark.d.ts +5 -1
  147. package/dist/storage/rdf/models-benchmark.js +17 -19
  148. package/dist/storage/rdf/types.d.ts +68 -6
  149. package/dist/storage/rdf/types.jsonld +69 -0
  150. package/dist/storage/sparql/SubgraphQueryEngine.d.ts +13 -7
  151. package/dist/storage/sparql/SubgraphQueryEngine.js +6 -6
  152. package/dist/storage/vector/index.d.ts +0 -1
  153. package/dist/storage/vector/index.js +0 -1
  154. package/dist/terminal/AclPermissionService.d.ts +4 -5
  155. package/dist/terminal/AclPermissionService.js +55 -75
  156. package/dist/terminal/TerminalSessionManager.d.ts +3 -2
  157. package/dist/terminal/TerminalSessionManager.js +3 -3
  158. package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/ldp-executor.d.ts +1 -0
  159. package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/ldp-executor.d.ts.map +1 -1
  160. package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/ldp-executor.js +29 -26
  161. package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/ldp-executor.js.map +1 -1
  162. package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/sparql-strategy.d.ts.map +1 -1
  163. package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/sparql-strategy.js +9 -4
  164. package/node_modules/@undefineds.co/drizzle-solid/dist/core/execution/sparql-strategy.js.map +1 -1
  165. package/node_modules/@undefineds.co/drizzle-solid/dist/core/notifications/notifications-client.d.ts +1 -0
  166. package/node_modules/@undefineds.co/drizzle-solid/dist/core/notifications/notifications-client.d.ts.map +1 -1
  167. package/node_modules/@undefineds.co/drizzle-solid/dist/core/notifications/notifications-client.js +6 -3
  168. package/node_modules/@undefineds.co/drizzle-solid/dist/core/notifications/notifications-client.js.map +1 -1
  169. package/node_modules/@undefineds.co/drizzle-solid/dist/core/pod-database.js +3 -3
  170. package/node_modules/@undefineds.co/drizzle-solid/dist/core/pod-database.js.map +1 -1
  171. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-builders/select-query-builder.d.ts +6 -0
  172. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-builders/select-query-builder.d.ts.map +1 -1
  173. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-builders/select-query-builder.js +13 -3
  174. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-builders/select-query-builder.js.map +1 -1
  175. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-where-policy.d.ts +1 -0
  176. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-where-policy.d.ts.map +1 -1
  177. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-where-policy.js +31 -0
  178. package/node_modules/@undefineds.co/drizzle-solid/dist/core/query-where-policy.js.map +1 -1
  179. package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql/builder/expression-builder.d.ts.map +1 -1
  180. package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql/builder/expression-builder.js +5 -0
  181. package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql/builder/expression-builder.js.map +1 -1
  182. package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql-executor.d.ts +1 -0
  183. package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql-executor.d.ts.map +1 -1
  184. package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql-executor.js +45 -0
  185. package/node_modules/@undefineds.co/drizzle-solid/dist/core/sparql-executor.js.map +1 -1
  186. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/ldp-executor.d.ts +1 -0
  187. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/ldp-executor.d.ts.map +1 -1
  188. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/ldp-executor.js +29 -26
  189. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/ldp-executor.js.map +1 -1
  190. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/sparql-strategy.d.ts.map +1 -1
  191. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/sparql-strategy.js +9 -4
  192. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/execution/sparql-strategy.js.map +1 -1
  193. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/notifications/notifications-client.d.ts +1 -0
  194. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/notifications/notifications-client.d.ts.map +1 -1
  195. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/notifications/notifications-client.js +6 -3
  196. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/notifications/notifications-client.js.map +1 -1
  197. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/pod-database.js +3 -3
  198. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/pod-database.js.map +1 -1
  199. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-builders/select-query-builder.d.ts +6 -0
  200. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-builders/select-query-builder.d.ts.map +1 -1
  201. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-builders/select-query-builder.js +14 -4
  202. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-builders/select-query-builder.js.map +1 -1
  203. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-where-policy.d.ts +1 -0
  204. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-where-policy.d.ts.map +1 -1
  205. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-where-policy.js +30 -0
  206. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/query-where-policy.js.map +1 -1
  207. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql/builder/expression-builder.d.ts.map +1 -1
  208. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql/builder/expression-builder.js +5 -0
  209. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql/builder/expression-builder.js.map +1 -1
  210. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql-executor.d.ts +1 -0
  211. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql-executor.d.ts.map +1 -1
  212. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql-executor.js +45 -0
  213. package/node_modules/@undefineds.co/drizzle-solid/dist/esm/core/sparql-executor.js.map +1 -1
  214. package/node_modules/@undefineds.co/drizzle-solid/package.json +5 -4
  215. package/package.json +22 -8
  216. package/static/app/assets/{index-36TJKN-3.js → index-BikOyGPu.js} +34 -34
  217. package/static/app/assets/inrupt-smoke.js +2 -2
  218. package/static/app/assets/main.css +1 -1
  219. package/static/app/assets/main.js +11 -11
  220. package/static/auth-callback/assets/{AiConfigContext-BvBdu_A3.js → AiConfigContext-iQ74JmRZ.js} +1 -1
  221. package/static/auth-callback/assets/{AiConfigPage-BpDw4jco.js → AiConfigPage-BBDKE1gJ.js} +1 -1
  222. package/static/auth-callback/assets/{DocumentProcessingPanel-BmZ_jzRr.js → DocumentProcessingPanel-D9NntIEK.js} +1 -1
  223. package/static/auth-callback/assets/{IndexLifecyclePanel-BfQBjN4z.js → IndexLifecyclePanel-BG07yBdA.js} +1 -1
  224. package/static/auth-callback/assets/{IndexSubjectPanel-BlsnatPt.js → IndexSubjectPanel-B-bUnU3G.js} +1 -1
  225. package/static/auth-callback/assets/{ModelAssignmentsPanel-KA6Mdndz.js → ModelAssignmentsPanel-C7I-Nqy-.js} +1 -1
  226. package/static/auth-callback/assets/{ModelsPage-C7jymyIY.js → ModelsPage-C2hxyrmI.js} +1 -1
  227. package/static/auth-callback/assets/{NetworkPage-k2ShktNm.js → NetworkPage-IGIc2q1Y.js} +1 -1
  228. package/static/auth-callback/assets/{PaneListHeader-mLMe_dvU.js → PaneListHeader-CebuPl_g.js} +1 -1
  229. package/static/auth-callback/assets/{SearchIndexingPanel-CqV9um_t.js → SearchIndexingPanel-6HnZSg00.js} +1 -1
  230. package/static/auth-callback/assets/{StatusSubjectPanel-BgMBTbr2.js → StatusSubjectPanel-votxBkr5.js} +1 -1
  231. package/static/auth-callback/assets/{StatusWorkspace-zbSyhdG2.js → StatusWorkspace-Cksl61zX.js} +1 -1
  232. package/static/auth-callback/assets/{SystemSettingsPage-CtW79nW6.js → SystemSettingsPage-CKZFUaZT.js} +1 -1
  233. package/static/auth-callback/assets/{SystemSettingsSubjectPanel-ZOPKYUtZ.js → SystemSettingsSubjectPanel-pzfUcCf4.js} +1 -1
  234. package/static/auth-callback/assets/{activity-BQ-CQE3O.js → activity-DQL6kZHZ.js} +1 -1
  235. package/static/auth-callback/assets/auth-callback-B_s8Ye5Z.css +1 -0
  236. package/static/auth-callback/assets/{auth-callback-Htr_CB_g.js → auth-callback-BxQMd_Mc.js} +39 -39
  237. package/static/auth-callback/assets/{badge-D5SGTJeO.js → badge-DvW4LUHH.js} +1 -1
  238. package/static/auth-callback/assets/{download-DK183Ldo.js → download-Cx_uaCR1.js} +1 -1
  239. package/static/auth-callback/assets/{external-link-LDHy_4bn.js → external-link-D6L6ExH1.js} +1 -1
  240. package/static/auth-callback/assets/{index-BWrvgHqK.js → index-BAS_hxGu.js} +1 -1
  241. package/static/auth-callback/assets/{index-2WmlePQ9.js → index-BmBjpCoD.js} +1 -1
  242. package/static/auth-callback/assets/{index-browser-DUd4E4-x.js → index-browser-pdn4D3M4.js} +1 -1
  243. package/static/auth-callback/assets/{key-round-ibX79Kr-.js → key-round-BTBzOggq.js} +1 -1
  244. package/static/auth-callback/assets/{rotate-ccw-B2_VMaiX.js → rotate-ccw-eV7Cx8sB.js} +1 -1
  245. package/static/auth-callback/assets/{skeleton-F4nrpycc.js → skeleton-Bg4GYgBM.js} +1 -1
  246. package/static/auth-callback/assets/{waypoints-DImIq93f.js → waypoints-CJbydf0B.js} +1 -1
  247. package/static/auth-callback/assets/{workspace-layout-IVCSYU21.js → workspace-layout-C6Hh8Xf-.js} +1 -1
  248. package/static/auth-callback/auth-callback.html +2 -2
  249. package/static/dashboard/assets/{AiConfigContext-cjjfYTo9.js → AiConfigContext-BkJj28vK.js} +1 -1
  250. package/static/dashboard/assets/{AiConfigPage-CO0DSD_j.js → AiConfigPage-Cs9B4uyp.js} +1 -1
  251. package/static/dashboard/assets/{DocumentProcessingPanel-DMGnH8Oj.js → DocumentProcessingPanel-BBWmM7mS.js} +1 -1
  252. package/static/dashboard/assets/{IndexLifecyclePanel-DSkIOCL5.js → IndexLifecyclePanel-D5xGTT_i.js} +1 -1
  253. package/static/dashboard/assets/{IndexSubjectPanel-qWN_DbAp.js → IndexSubjectPanel-d-mjDthn.js} +1 -1
  254. package/static/dashboard/assets/{ModelAssignmentsPanel-DCf83uM3.js → ModelAssignmentsPanel-C-OLNbqf.js} +1 -1
  255. package/static/dashboard/assets/{ModelsPage-CMnvSrl5.js → ModelsPage-CBrLjuUn.js} +1 -1
  256. package/static/dashboard/assets/{NetworkPage-C8Gkwclb.js → NetworkPage-BlYk8L1z.js} +1 -1
  257. package/static/dashboard/assets/{PaneListHeader-BtU_8cDK.js → PaneListHeader-A5oZJQC0.js} +1 -1
  258. package/static/dashboard/assets/{SearchIndexingPanel-DEn12pNU.js → SearchIndexingPanel-Bs1j8ZP2.js} +1 -1
  259. package/static/dashboard/assets/{StatusSubjectPanel-B1_ILg2d.js → StatusSubjectPanel-Qao3orvi.js} +1 -1
  260. package/static/dashboard/assets/{StatusWorkspace-BG6nMNCo.js → StatusWorkspace-rDM0yDtk.js} +1 -1
  261. package/static/dashboard/assets/{SystemSettingsPage-BnWYIXaM.js → SystemSettingsPage-FPRPkKaR.js} +1 -1
  262. package/static/dashboard/assets/{SystemSettingsSubjectPanel-C_mYVPWb.js → SystemSettingsSubjectPanel-CjlJAxnX.js} +1 -1
  263. package/static/dashboard/assets/{activity-DYJ7PdRl.js → activity-CJ5K6hYC.js} +1 -1
  264. package/static/dashboard/assets/{badge-BIaZco1P.js → badge-L-NMOi1P.js} +1 -1
  265. package/static/dashboard/assets/dashboard-B_s8Ye5Z.css +1 -0
  266. package/static/dashboard/assets/{dashboard-Dl40_MEa.js → dashboard-DyjAyYxx.js} +34 -34
  267. package/static/dashboard/assets/{download-By16k9VK.js → download-Bi4u5K5B.js} +1 -1
  268. package/static/dashboard/assets/{external-link-B92xOG_d.js → external-link-jmhLDfvT.js} +1 -1
  269. package/static/dashboard/assets/{index-BajZpJ48.js → index-BoaGJBxf.js} +1 -1
  270. package/static/dashboard/assets/{index-wsVPom_x.js → index-C22TAEi4.js} +1 -1
  271. package/static/dashboard/assets/{key-round-Clo5FOwA.js → key-round-Dk1VmMrn.js} +1 -1
  272. package/static/dashboard/assets/{rotate-ccw-smWSfi1L.js → rotate-ccw-DIfLsSwi.js} +1 -1
  273. package/static/dashboard/assets/{skeleton-BrTaGeJw.js → skeleton-BGPJMHb-.js} +1 -1
  274. package/static/dashboard/assets/{waypoints-DGPQInE7.js → waypoints-CY53egpu.js} +1 -1
  275. package/static/dashboard/assets/{workspace-layout-CPU4XRmb.js → workspace-layout-CoHkcx70.js} +1 -1
  276. package/static/dashboard/dashboard.html +2 -2
  277. package/static/settings/assets/{AiConfigContext-CT29_OyW.js → AiConfigContext-BcEPlEJe.js} +1 -1
  278. package/static/settings/assets/{AiConfigPage-WIE95S28.js → AiConfigPage-D-t3ZUhg.js} +1 -1
  279. package/static/settings/assets/{DocumentProcessingPanel-KG8Sq999.js → DocumentProcessingPanel-m2SasiMO.js} +1 -1
  280. package/static/settings/assets/{IndexLifecyclePanel-iKvtHDXY.js → IndexLifecyclePanel-BNmAvx8V.js} +1 -1
  281. package/static/settings/assets/{IndexSubjectPanel-BQdSCkk4.js → IndexSubjectPanel-C5-L2AcW.js} +1 -1
  282. package/static/settings/assets/{ModelAssignmentsPanel-P8QcVB0F.js → ModelAssignmentsPanel-Cfpkf02Y.js} +1 -1
  283. package/static/settings/assets/{ModelsPage-UZkZGqor.js → ModelsPage-DZrACwVN.js} +1 -1
  284. package/static/settings/assets/{NetworkPage-Dcpcvg15.js → NetworkPage-BlrGGfqL.js} +1 -1
  285. package/static/settings/assets/{PaneListHeader--gHtZws5.js → PaneListHeader-C3TCs1RI.js} +1 -1
  286. package/static/settings/assets/{SearchIndexingPanel-DdgJSJYQ.js → SearchIndexingPanel-Cyp3CUzX.js} +1 -1
  287. package/static/settings/assets/{StatusSubjectPanel-UOxp_XVL.js → StatusSubjectPanel-gRkb8WEX.js} +1 -1
  288. package/static/settings/assets/{StatusWorkspace-CPNXuD12.js → StatusWorkspace-Dptx4Ec2.js} +1 -1
  289. package/static/settings/assets/{SystemSettingsPage-B6ySeVPw.js → SystemSettingsPage-BWgGUQbs.js} +1 -1
  290. package/static/settings/assets/{SystemSettingsSubjectPanel-I7zWmpiI.js → SystemSettingsSubjectPanel-VflUvpgC.js} +1 -1
  291. package/static/settings/assets/{activity-CFhmzahP.js → activity-D7iNhTkQ.js} +1 -1
  292. package/static/settings/assets/{badge-BBdUc5B-.js → badge-DO0r_RT4.js} +1 -1
  293. package/static/settings/assets/{download-WJE9-yxQ.js → download-CsJlNSbd.js} +1 -1
  294. package/static/settings/assets/{external-link-RKoYyCp_.js → external-link-BCR7SHme.js} +1 -1
  295. package/static/settings/assets/{index-Bq2o0Bif.js → index-Cgq16ekN.js} +1 -1
  296. package/static/settings/assets/{index-DvxneI5O.js → index-SrhQvcrU.js} +1 -1
  297. package/static/settings/assets/{index-browser-Qmo6EsFT.js → index-browser-THpcMCnz.js} +1 -1
  298. package/static/settings/assets/{key-round-r-D9sQUK.js → key-round-Dd3jk1BT.js} +1 -1
  299. package/static/settings/assets/{rotate-ccw-D3IIhbPH.js → rotate-ccw-tiL14i1d.js} +1 -1
  300. package/static/settings/assets/settings-B_s8Ye5Z.css +1 -0
  301. package/static/settings/assets/{settings-D8oDBXWg.js → settings-CVLDPejo.js} +34 -34
  302. package/static/settings/assets/{skeleton-DrL4RQuw.js → skeleton-DBxLuNgU.js} +1 -1
  303. package/static/settings/assets/{waypoints-C5sRhpJw.js → waypoints-DS3e3hv7.js} +1 -1
  304. package/static/settings/assets/{workspace-layout-B4ALmWsM.js → workspace-layout-mucrxyTK.js} +1 -1
  305. package/static/settings/settings.html +2 -2
  306. package/config/search.json +0 -66
  307. package/dist/document/HeadingChunker.jsonld +0 -41
  308. package/dist/security/secret-cell/DeploymentRootKeyProvider.jsonld +0 -124
  309. package/dist/security/secret-cell/SecretCellVault.jsonld +0 -207
  310. package/dist/storage/PostgresDerivedIndexJournal.d.ts +0 -47
  311. package/dist/storage/PostgresDerivedIndexJournal.js +0 -408
  312. package/dist/storage/PostgresDerivedIndexJournal.jsonld +0 -303
  313. package/dist/storage/RdfDerivedIndexingListener.d.ts +0 -32
  314. package/dist/storage/RdfDerivedIndexingListener.js +0 -135
  315. package/dist/storage/RdfDerivedIndexingListener.jsonld +0 -228
  316. package/dist/storage/accessors/QuadstoreSparqlDataAccessor.d.ts +0 -148
  317. package/dist/storage/accessors/QuadstoreSparqlDataAccessor.js +0 -436
  318. package/dist/storage/accessors/QuadstoreSparqlDataAccessor.jsonld +0 -172
  319. package/dist/storage/accessors/QuintStoreSparqlDataAccessor.d.ts +0 -102
  320. package/dist/storage/accessors/QuintStoreSparqlDataAccessor.js +0 -474
  321. package/dist/storage/accessors/QuintStoreSparqlDataAccessor.jsonld +0 -192
  322. package/dist/storage/rdf/RdfSparqlAdapter.jsonld +0 -486
  323. package/dist/storage/rdf/ShadowRdfQuintStore.d.ts +0 -59
  324. package/dist/storage/rdf/ShadowRdfQuintStore.js +0 -216
  325. package/dist/storage/rdf/ShadowRdfQuintStore.jsonld +0 -312
  326. package/dist/storage/rdf/SolidRdfSparqlEngine.d.ts +0 -107
  327. package/dist/storage/rdf/SolidRdfSparqlEngine.js +0 -1117
  328. package/dist/storage/rdf/SolidRdfSparqlEngine.jsonld +0 -312
  329. package/dist/storage/sparql/AlgebraUtils.d.ts +0 -48
  330. package/dist/storage/sparql/AlgebraUtils.js +0 -118
  331. package/dist/storage/sparql/CompatibilitySparqlEngine.d.ts +0 -37
  332. package/dist/storage/sparql/CompatibilitySparqlEngine.js +0 -96
  333. package/dist/storage/sparql/CompatibilitySparqlEngine.jsonld +0 -123
  334. package/dist/storage/sparql/CompatibilitySparqlEngineImpl.d.ts +0 -36
  335. package/dist/storage/sparql/CompatibilitySparqlEngineImpl.js +0 -124
  336. package/dist/storage/sparql/ComunicaOptimizedEngine.d.ts +0 -59
  337. package/dist/storage/sparql/ComunicaOptimizedEngine.js +0 -254
  338. package/dist/storage/sparql/ComunicaQuintEngine.d.ts +0 -143
  339. package/dist/storage/sparql/ComunicaQuintEngine.js +0 -781
  340. package/dist/storage/sparql/ExpressionEvaluator.d.ts +0 -54
  341. package/dist/storage/sparql/ExpressionEvaluator.js +0 -340
  342. package/dist/storage/sparql/FilterPushdownExtractor.d.ts +0 -74
  343. package/dist/storage/sparql/FilterPushdownExtractor.js +0 -421
  344. package/dist/storage/sparql/OptimizedQuadstoreEngine.d.ts +0 -65
  345. package/dist/storage/sparql/OptimizedQuadstoreEngine.js +0 -327
  346. package/dist/storage/sparql/OptimizedQuadstoreSource.d.ts +0 -46
  347. package/dist/storage/sparql/OptimizedQuadstoreSource.js +0 -118
  348. package/dist/storage/sparql/PatternBuilder.d.ts +0 -41
  349. package/dist/storage/sparql/PatternBuilder.js +0 -118
  350. package/dist/storage/sparql/QueryOptimizer.d.ts +0 -125
  351. package/dist/storage/sparql/QueryOptimizer.js +0 -375
  352. package/dist/storage/sparql/QuintEngine.d.ts +0 -92
  353. package/dist/storage/sparql/QuintEngine.js +0 -150
  354. package/dist/storage/sparql/QuintQuerySource.d.ts +0 -241
  355. package/dist/storage/sparql/QuintQuerySource.js +0 -1069
  356. package/dist/storage/sparql/SimpleSparqlExecutor.d.ts +0 -40
  357. package/dist/storage/sparql/SimpleSparqlExecutor.js +0 -131
  358. package/dist/storage/vector/VectorIndexingListener.d.ts +0 -114
  359. package/dist/storage/vector/VectorIndexingListener.js +0 -346
  360. package/static/auth-callback/assets/auth-callback-rWdEQY5f.css +0 -1
  361. package/static/dashboard/assets/dashboard-rWdEQY5f.css +0 -1
  362. package/static/settings/assets/settings-rWdEQY5f.css +0 -1
@@ -0,0 +1,771 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RdfSearchReconciliationRepository = void 0;
4
+ const drizzle_orm_1 = require("drizzle-orm");
5
+ const db_1 = require("../identity/drizzle/db");
6
+ const PG_RDF_SEARCH_RECONCILIATION_SCHEMA_LOCK_KEY = 1_936_528_502;
7
+ /**
8
+ * Durable product queue for RDF FTS/VEC parity work.
9
+ *
10
+ * SolidFS writes may complete before the user's Pod has an embedding profile or
11
+ * provider quota. This repository keeps one desired embedding profile per
12
+ * source so skipped vector indexing remains recoverable after config, quota, or
13
+ * model changes.
14
+ */
15
+ class RdfSearchReconciliationRepository {
16
+ constructor(db) {
17
+ this.db = db;
18
+ this.ready = this.initialize();
19
+ }
20
+ async waitForConfig(input, now = new Date()) {
21
+ await this.ready;
22
+ await this.assertSourceIdentity(input);
23
+ const ts = timestampText(this.db, now);
24
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
25
+ INSERT INTO rdf_search_reconciliation (
26
+ source_key,
27
+ source_uri,
28
+ pod_root,
29
+ provider_id,
30
+ model,
31
+ model_version,
32
+ config_fingerprint,
33
+ source_hash,
34
+ source_version,
35
+ state,
36
+ reason,
37
+ attempt_count,
38
+ next_attempt_at,
39
+ lease_owner,
40
+ lease_expires_at,
41
+ failure_category,
42
+ updated_at
43
+ ) VALUES (
44
+ ${input.sourceKey},
45
+ ${input.sourceUri},
46
+ ${input.podRoot},
47
+ NULL,
48
+ NULL,
49
+ NULL,
50
+ NULL,
51
+ ${input.sourceHash ?? null},
52
+ ${input.sourceVersion ?? null},
53
+ 'waiting-config',
54
+ ${input.reason},
55
+ 0,
56
+ ${ts},
57
+ NULL,
58
+ NULL,
59
+ ${input.failureCategory ?? null},
60
+ ${ts}
61
+ )
62
+ ON CONFLICT (source_key) DO UPDATE SET
63
+ source_uri = excluded.source_uri,
64
+ state = 'waiting-config',
65
+ source_hash = excluded.source_hash,
66
+ source_version = excluded.source_version,
67
+ reason = excluded.reason,
68
+ lease_owner = NULL,
69
+ lease_expires_at = NULL,
70
+ failure_category = excluded.failure_category,
71
+ updated_at = excluded.updated_at
72
+ WHERE rdf_search_reconciliation.pod_root = excluded.pod_root
73
+ RETURNING
74
+ source_key,
75
+ source_uri,
76
+ pod_root,
77
+ provider_id,
78
+ model,
79
+ model_version,
80
+ config_fingerprint,
81
+ source_hash,
82
+ source_version,
83
+ state,
84
+ reason,
85
+ attempt_count,
86
+ next_attempt_at,
87
+ lease_owner,
88
+ lease_expires_at,
89
+ failure_category,
90
+ updated_at
91
+ `);
92
+ if (!result.rows[0]) {
93
+ throw new Error(`RDF search reconciliation pod root is immutable for source key ${input.sourceKey}`);
94
+ }
95
+ return mapRow(result.rows[0]);
96
+ }
97
+ async upsertDesired(input, now = new Date()) {
98
+ await this.ready;
99
+ const ts = timestampText(this.db, now);
100
+ const existing = await this.get(input.sourceKey);
101
+ assertSourceIdentity(existing, input);
102
+ const desiredChanged = hasDesiredChanged(existing, input);
103
+ const previousAttemptCount = existing?.attemptCount ?? 0;
104
+ const previousFailureCategory = existing?.failureCategory ?? null;
105
+ const attemptCount = desiredChanged ? 0 : previousAttemptCount;
106
+ const failureCategory = desiredChanged ? null : previousFailureCategory;
107
+ const nextState = !desiredChanged && existing?.state === 'applied'
108
+ ? 'applied'
109
+ : 'ready';
110
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
111
+ INSERT INTO rdf_search_reconciliation (
112
+ source_key,
113
+ source_uri,
114
+ pod_root,
115
+ provider_id,
116
+ model,
117
+ model_version,
118
+ config_fingerprint,
119
+ source_hash,
120
+ source_version,
121
+ state,
122
+ reason,
123
+ attempt_count,
124
+ next_attempt_at,
125
+ lease_owner,
126
+ lease_expires_at,
127
+ failure_category,
128
+ updated_at
129
+ ) VALUES (
130
+ ${input.sourceKey},
131
+ ${input.sourceUri},
132
+ ${input.podRoot},
133
+ ${input.providerId},
134
+ ${input.model},
135
+ ${input.modelVersion ?? null},
136
+ ${input.configFingerprint},
137
+ ${input.sourceHash ?? null},
138
+ ${input.sourceVersion ?? null},
139
+ ${nextState},
140
+ ${input.reason},
141
+ ${attemptCount},
142
+ ${ts},
143
+ NULL,
144
+ NULL,
145
+ ${failureCategory},
146
+ ${ts}
147
+ )
148
+ ON CONFLICT (source_key) DO UPDATE SET
149
+ source_uri = excluded.source_uri,
150
+ provider_id = excluded.provider_id,
151
+ model = excluded.model,
152
+ model_version = excluded.model_version,
153
+ config_fingerprint = excluded.config_fingerprint,
154
+ source_hash = excluded.source_hash,
155
+ source_version = excluded.source_version,
156
+ state = excluded.state,
157
+ reason = excluded.reason,
158
+ attempt_count = excluded.attempt_count,
159
+ next_attempt_at = excluded.next_attempt_at,
160
+ lease_owner = NULL,
161
+ lease_expires_at = NULL,
162
+ failure_category = excluded.failure_category,
163
+ updated_at = excluded.updated_at
164
+ WHERE rdf_search_reconciliation.pod_root = excluded.pod_root
165
+ RETURNING
166
+ source_key,
167
+ source_uri,
168
+ pod_root,
169
+ provider_id,
170
+ model,
171
+ model_version,
172
+ config_fingerprint,
173
+ source_hash,
174
+ source_version,
175
+ state,
176
+ reason,
177
+ attempt_count,
178
+ next_attempt_at,
179
+ lease_owner,
180
+ lease_expires_at,
181
+ failure_category,
182
+ updated_at
183
+ `);
184
+ if (!result.rows[0]) {
185
+ throw new Error(`RDF search reconciliation pod root is immutable for source key ${input.sourceKey}`);
186
+ }
187
+ return mapRow(result.rows[0]);
188
+ }
189
+ async upsertRetryable(input, now = new Date()) {
190
+ await this.ready;
191
+ const ts = timestampText(this.db, now);
192
+ const existing = await this.get(input.sourceKey);
193
+ assertSourceIdentity(existing, input);
194
+ const desiredChanged = hasDesiredChanged(existing, input);
195
+ const previousAttemptCount = existing?.attemptCount ?? 0;
196
+ const attemptCount = desiredChanged ? 1 : previousAttemptCount + 1;
197
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
198
+ INSERT INTO rdf_search_reconciliation (
199
+ source_key,
200
+ source_uri,
201
+ pod_root,
202
+ provider_id,
203
+ model,
204
+ model_version,
205
+ config_fingerprint,
206
+ source_hash,
207
+ source_version,
208
+ state,
209
+ reason,
210
+ attempt_count,
211
+ next_attempt_at,
212
+ lease_owner,
213
+ lease_expires_at,
214
+ failure_category,
215
+ updated_at
216
+ ) VALUES (
217
+ ${input.sourceKey},
218
+ ${input.sourceUri},
219
+ ${input.podRoot},
220
+ ${input.providerId},
221
+ ${input.model},
222
+ ${input.modelVersion ?? null},
223
+ ${input.configFingerprint},
224
+ ${input.sourceHash ?? null},
225
+ ${input.sourceVersion ?? null},
226
+ 'retryable',
227
+ ${input.reason},
228
+ ${attemptCount},
229
+ ${timestampText(this.db, input.nextAttemptAt)},
230
+ NULL,
231
+ NULL,
232
+ ${input.failureCategory},
233
+ ${ts}
234
+ )
235
+ ON CONFLICT (source_key) DO UPDATE SET
236
+ source_uri = excluded.source_uri,
237
+ provider_id = excluded.provider_id,
238
+ model = excluded.model,
239
+ model_version = excluded.model_version,
240
+ config_fingerprint = excluded.config_fingerprint,
241
+ source_hash = excluded.source_hash,
242
+ source_version = excluded.source_version,
243
+ state = 'retryable',
244
+ reason = excluded.reason,
245
+ attempt_count = excluded.attempt_count,
246
+ next_attempt_at = excluded.next_attempt_at,
247
+ lease_owner = NULL,
248
+ lease_expires_at = NULL,
249
+ failure_category = excluded.failure_category,
250
+ updated_at = excluded.updated_at
251
+ WHERE rdf_search_reconciliation.pod_root = excluded.pod_root
252
+ RETURNING
253
+ source_key,
254
+ source_uri,
255
+ pod_root,
256
+ provider_id,
257
+ model,
258
+ model_version,
259
+ config_fingerprint,
260
+ source_hash,
261
+ source_version,
262
+ state,
263
+ reason,
264
+ attempt_count,
265
+ next_attempt_at,
266
+ lease_owner,
267
+ lease_expires_at,
268
+ failure_category,
269
+ updated_at
270
+ `);
271
+ if (!result.rows[0]) {
272
+ throw new Error(`RDF search reconciliation pod root is immutable for source key ${input.sourceKey}`);
273
+ }
274
+ return mapRow(result.rows[0]);
275
+ }
276
+ async upsertApplied(input, now = new Date()) {
277
+ await this.ready;
278
+ await this.assertSourceIdentity(input);
279
+ const ts = timestampText(this.db, now);
280
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
281
+ INSERT INTO rdf_search_reconciliation (
282
+ source_key,
283
+ source_uri,
284
+ pod_root,
285
+ provider_id,
286
+ model,
287
+ model_version,
288
+ config_fingerprint,
289
+ source_hash,
290
+ source_version,
291
+ state,
292
+ reason,
293
+ attempt_count,
294
+ next_attempt_at,
295
+ lease_owner,
296
+ lease_expires_at,
297
+ failure_category,
298
+ updated_at
299
+ ) VALUES (
300
+ ${input.sourceKey},
301
+ ${input.sourceUri},
302
+ ${input.podRoot},
303
+ ${input.providerId},
304
+ ${input.model},
305
+ ${input.modelVersion ?? null},
306
+ ${input.configFingerprint},
307
+ ${input.sourceHash ?? null},
308
+ ${input.sourceVersion ?? null},
309
+ 'applied',
310
+ ${input.reason},
311
+ 0,
312
+ ${ts},
313
+ NULL,
314
+ NULL,
315
+ NULL,
316
+ ${ts}
317
+ )
318
+ ON CONFLICT (source_key) DO UPDATE SET
319
+ source_uri = excluded.source_uri,
320
+ provider_id = excluded.provider_id,
321
+ model = excluded.model,
322
+ model_version = excluded.model_version,
323
+ config_fingerprint = excluded.config_fingerprint,
324
+ source_hash = excluded.source_hash,
325
+ source_version = excluded.source_version,
326
+ state = 'applied',
327
+ reason = excluded.reason,
328
+ attempt_count = 0,
329
+ next_attempt_at = excluded.next_attempt_at,
330
+ lease_owner = NULL,
331
+ lease_expires_at = NULL,
332
+ failure_category = NULL,
333
+ updated_at = excluded.updated_at
334
+ WHERE rdf_search_reconciliation.pod_root = excluded.pod_root
335
+ RETURNING
336
+ source_key,
337
+ source_uri,
338
+ pod_root,
339
+ provider_id,
340
+ model,
341
+ model_version,
342
+ config_fingerprint,
343
+ source_hash,
344
+ source_version,
345
+ state,
346
+ reason,
347
+ attempt_count,
348
+ next_attempt_at,
349
+ lease_owner,
350
+ lease_expires_at,
351
+ failure_category,
352
+ updated_at
353
+ `);
354
+ if (!result.rows[0]) {
355
+ throw new Error(`RDF search reconciliation pod root is immutable for source key ${input.sourceKey}`);
356
+ }
357
+ return mapRow(result.rows[0]);
358
+ }
359
+ async upsertBlockedConfig(input, now = new Date()) {
360
+ await this.ready;
361
+ const existing = await this.get(input.sourceKey);
362
+ assertSourceIdentity(existing, input);
363
+ const attemptCount = hasDesiredChanged(existing, input)
364
+ ? 0
365
+ : existing?.attemptCount ?? 0;
366
+ const ts = timestampText(this.db, now);
367
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
368
+ INSERT INTO rdf_search_reconciliation (
369
+ source_key,
370
+ source_uri,
371
+ pod_root,
372
+ provider_id,
373
+ model,
374
+ model_version,
375
+ config_fingerprint,
376
+ source_hash,
377
+ source_version,
378
+ state,
379
+ reason,
380
+ attempt_count,
381
+ next_attempt_at,
382
+ lease_owner,
383
+ lease_expires_at,
384
+ failure_category,
385
+ updated_at
386
+ ) VALUES (
387
+ ${input.sourceKey},
388
+ ${input.sourceUri},
389
+ ${input.podRoot},
390
+ ${input.providerId},
391
+ ${input.model},
392
+ ${input.modelVersion ?? null},
393
+ ${input.configFingerprint},
394
+ ${input.sourceHash ?? null},
395
+ ${input.sourceVersion ?? null},
396
+ 'blocked-config',
397
+ ${input.reason},
398
+ ${attemptCount},
399
+ ${ts},
400
+ NULL,
401
+ NULL,
402
+ ${input.failureCategory},
403
+ ${ts}
404
+ )
405
+ ON CONFLICT (source_key) DO UPDATE SET
406
+ source_uri = excluded.source_uri,
407
+ provider_id = excluded.provider_id,
408
+ model = excluded.model,
409
+ model_version = excluded.model_version,
410
+ config_fingerprint = excluded.config_fingerprint,
411
+ source_hash = excluded.source_hash,
412
+ source_version = excluded.source_version,
413
+ state = 'blocked-config',
414
+ reason = excluded.reason,
415
+ attempt_count = excluded.attempt_count,
416
+ next_attempt_at = excluded.next_attempt_at,
417
+ lease_owner = NULL,
418
+ lease_expires_at = NULL,
419
+ failure_category = excluded.failure_category,
420
+ updated_at = excluded.updated_at
421
+ WHERE rdf_search_reconciliation.pod_root = excluded.pod_root
422
+ RETURNING
423
+ source_key,
424
+ source_uri,
425
+ pod_root,
426
+ provider_id,
427
+ model,
428
+ model_version,
429
+ config_fingerprint,
430
+ source_hash,
431
+ source_version,
432
+ state,
433
+ reason,
434
+ attempt_count,
435
+ next_attempt_at,
436
+ lease_owner,
437
+ lease_expires_at,
438
+ failure_category,
439
+ updated_at
440
+ `);
441
+ if (!result.rows[0]) {
442
+ throw new Error(`RDF search reconciliation pod root is immutable for source key ${input.sourceKey}`);
443
+ }
444
+ return mapRow(result.rows[0]);
445
+ }
446
+ async get(sourceKey) {
447
+ await this.ready;
448
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
449
+ SELECT
450
+ source_key,
451
+ source_uri,
452
+ pod_root,
453
+ provider_id,
454
+ model,
455
+ model_version,
456
+ config_fingerprint,
457
+ source_hash,
458
+ source_version,
459
+ state,
460
+ reason,
461
+ attempt_count,
462
+ next_attempt_at,
463
+ lease_owner,
464
+ lease_expires_at,
465
+ failure_category,
466
+ updated_at
467
+ FROM rdf_search_reconciliation
468
+ WHERE source_key = ${sourceKey}
469
+ LIMIT 1
470
+ `);
471
+ return result.rows[0] ? mapRow(result.rows[0]) : undefined;
472
+ }
473
+ async listRunnable(now = new Date(), limit) {
474
+ await this.ready;
475
+ const ts = timestampText(this.db, now);
476
+ const rowLimit = limit && limit > 0 ? limit : undefined;
477
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
478
+ SELECT
479
+ source_key,
480
+ source_uri,
481
+ pod_root,
482
+ provider_id,
483
+ model,
484
+ model_version,
485
+ config_fingerprint,
486
+ source_hash,
487
+ source_version,
488
+ state,
489
+ reason,
490
+ attempt_count,
491
+ next_attempt_at,
492
+ lease_owner,
493
+ lease_expires_at,
494
+ failure_category,
495
+ updated_at
496
+ FROM rdf_search_reconciliation
497
+ WHERE next_attempt_at <= ${ts}
498
+ AND (
499
+ state IN ('ready', 'retryable')
500
+ OR (
501
+ state = 'in-progress'
502
+ AND lease_owner IS NOT NULL
503
+ AND lease_expires_at IS NOT NULL
504
+ AND lease_expires_at <= ${ts}
505
+ )
506
+ )
507
+ ORDER BY next_attempt_at ASC, source_key ASC
508
+ ${rowLimit ? (0, drizzle_orm_1.sql) `LIMIT ${rowLimit}` : (0, drizzle_orm_1.sql) ``}
509
+ `);
510
+ return result.rows.map(mapRow);
511
+ }
512
+ async claimNext(workerId, now = new Date(), leaseDurationMs = 60_000) {
513
+ await this.ready;
514
+ const ts = timestampText(this.db, now);
515
+ const leaseExpiresAt = timestampText(this.db, new Date(now.getTime() + leaseDurationMs));
516
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
517
+ UPDATE rdf_search_reconciliation
518
+ SET state = 'in-progress',
519
+ lease_owner = ${workerId},
520
+ lease_expires_at = ${leaseExpiresAt},
521
+ updated_at = ${ts}
522
+ WHERE source_key = (
523
+ SELECT source_key
524
+ FROM rdf_search_reconciliation
525
+ WHERE next_attempt_at <= ${ts}
526
+ AND (
527
+ state IN ('ready', 'retryable')
528
+ OR (
529
+ state = 'in-progress'
530
+ AND lease_owner IS NOT NULL
531
+ AND lease_expires_at IS NOT NULL
532
+ AND lease_expires_at <= ${ts}
533
+ )
534
+ )
535
+ ORDER BY next_attempt_at ASC, source_key ASC
536
+ LIMIT 1
537
+ )
538
+ RETURNING
539
+ source_key,
540
+ source_uri,
541
+ pod_root,
542
+ provider_id,
543
+ model,
544
+ model_version,
545
+ config_fingerprint,
546
+ source_hash,
547
+ source_version,
548
+ state,
549
+ reason,
550
+ attempt_count,
551
+ next_attempt_at,
552
+ lease_owner,
553
+ lease_expires_at,
554
+ failure_category,
555
+ updated_at
556
+ `);
557
+ return result.rows[0] ? mapRow(result.rows[0]) : undefined;
558
+ }
559
+ async markRetryable(sourceKey, workerId, failureCategory, nextAttemptAt, now = new Date()) {
560
+ await this.ready;
561
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
562
+ UPDATE rdf_search_reconciliation
563
+ SET state = 'retryable',
564
+ attempt_count = attempt_count + 1,
565
+ next_attempt_at = ${timestampText(this.db, nextAttemptAt)},
566
+ lease_owner = NULL,
567
+ lease_expires_at = NULL,
568
+ failure_category = ${failureCategory},
569
+ updated_at = ${timestampText(this.db, now)}
570
+ WHERE source_key = ${sourceKey}
571
+ AND state = 'in-progress'
572
+ AND lease_owner = ${workerId}
573
+ AND lease_expires_at > ${timestampText(this.db, now)}
574
+ RETURNING
575
+ source_key,
576
+ source_uri,
577
+ pod_root,
578
+ provider_id,
579
+ model,
580
+ model_version,
581
+ config_fingerprint,
582
+ source_hash,
583
+ source_version,
584
+ state,
585
+ reason,
586
+ attempt_count,
587
+ next_attempt_at,
588
+ lease_owner,
589
+ lease_expires_at,
590
+ failure_category,
591
+ updated_at
592
+ `);
593
+ if (!result.rows[0]) {
594
+ throw new Error(`RDF search reconciliation ownership mismatch for source key ${sourceKey}`);
595
+ }
596
+ }
597
+ async markBlockedConfig(sourceKey, workerId, failureCategory, now = new Date()) {
598
+ await this.ready;
599
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
600
+ UPDATE rdf_search_reconciliation
601
+ SET state = 'blocked-config',
602
+ lease_owner = NULL,
603
+ lease_expires_at = NULL,
604
+ failure_category = ${failureCategory},
605
+ updated_at = ${timestampText(this.db, now)}
606
+ WHERE source_key = ${sourceKey}
607
+ AND state = 'in-progress'
608
+ AND lease_owner = ${workerId}
609
+ AND lease_expires_at > ${timestampText(this.db, now)}
610
+ RETURNING
611
+ source_key,
612
+ source_uri,
613
+ pod_root,
614
+ provider_id,
615
+ model,
616
+ model_version,
617
+ config_fingerprint,
618
+ source_hash,
619
+ source_version,
620
+ state,
621
+ reason,
622
+ attempt_count,
623
+ next_attempt_at,
624
+ lease_owner,
625
+ lease_expires_at,
626
+ failure_category,
627
+ updated_at
628
+ `);
629
+ if (!result.rows[0]) {
630
+ throw new Error(`RDF search reconciliation ownership mismatch for source key ${sourceKey}`);
631
+ }
632
+ }
633
+ async complete(sourceKey, workerId, now = new Date()) {
634
+ await this.ready;
635
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
636
+ UPDATE rdf_search_reconciliation
637
+ SET state = 'applied',
638
+ lease_owner = NULL,
639
+ lease_expires_at = NULL,
640
+ failure_category = NULL,
641
+ next_attempt_at = ${timestampText(this.db, now)},
642
+ updated_at = ${timestampText(this.db, now)}
643
+ WHERE source_key = ${sourceKey}
644
+ AND state = 'in-progress'
645
+ AND lease_owner = ${workerId}
646
+ AND lease_expires_at > ${timestampText(this.db, now)}
647
+ RETURNING
648
+ source_key,
649
+ source_uri,
650
+ pod_root,
651
+ provider_id,
652
+ model,
653
+ model_version,
654
+ config_fingerprint,
655
+ source_hash,
656
+ source_version,
657
+ state,
658
+ reason,
659
+ attempt_count,
660
+ next_attempt_at,
661
+ lease_owner,
662
+ lease_expires_at,
663
+ failure_category,
664
+ updated_at
665
+ `);
666
+ if (!result.rows[0]) {
667
+ throw new Error(`RDF search reconciliation ownership mismatch for source key ${sourceKey}`);
668
+ }
669
+ }
670
+ async deleteSource(sourceKey) {
671
+ await this.ready;
672
+ await (0, db_1.executeStatement)(this.db, (0, drizzle_orm_1.sql) `
673
+ DELETE FROM rdf_search_reconciliation
674
+ WHERE source_key = ${sourceKey}
675
+ `);
676
+ }
677
+ async listPodRoots() {
678
+ await this.ready;
679
+ const result = await (0, db_1.executeQuery)(this.db, (0, drizzle_orm_1.sql) `
680
+ SELECT DISTINCT pod_root
681
+ FROM rdf_search_reconciliation
682
+ ORDER BY pod_root ASC
683
+ `);
684
+ return result.rows.map((row) => row.pod_root);
685
+ }
686
+ async initialize() {
687
+ await (0, db_1.executePostgresLockedStatements)(this.db, PG_RDF_SEARCH_RECONCILIATION_SCHEMA_LOCK_KEY, [
688
+ `
689
+ CREATE TABLE IF NOT EXISTS rdf_search_reconciliation (
690
+ source_key TEXT PRIMARY KEY,
691
+ source_uri TEXT NOT NULL,
692
+ pod_root TEXT NOT NULL,
693
+ provider_id TEXT,
694
+ model TEXT,
695
+ model_version TEXT,
696
+ config_fingerprint TEXT,
697
+ source_hash TEXT,
698
+ source_version TEXT,
699
+ state TEXT NOT NULL,
700
+ reason TEXT NOT NULL,
701
+ attempt_count INTEGER NOT NULL DEFAULT 0,
702
+ next_attempt_at TEXT NOT NULL,
703
+ lease_owner TEXT,
704
+ lease_expires_at TEXT,
705
+ failure_category TEXT,
706
+ updated_at TEXT NOT NULL
707
+ )
708
+ `,
709
+ `
710
+ CREATE INDEX IF NOT EXISTS rdf_search_reconciliation_runnable_idx
711
+ ON rdf_search_reconciliation (state, next_attempt_at, lease_expires_at, source_key)
712
+ `,
713
+ ]);
714
+ }
715
+ async assertSourceIdentity(input) {
716
+ assertSourceIdentity(await this.get(input.sourceKey), input);
717
+ }
718
+ }
719
+ exports.RdfSearchReconciliationRepository = RdfSearchReconciliationRepository;
720
+ function mapRow(row) {
721
+ return {
722
+ sourceKey: row.source_key,
723
+ sourceUri: row.source_uri,
724
+ podRoot: row.pod_root,
725
+ providerId: row.provider_id ?? undefined,
726
+ model: row.model ?? undefined,
727
+ modelVersion: row.model_version ?? undefined,
728
+ configFingerprint: row.config_fingerprint ?? undefined,
729
+ sourceHash: row.source_hash ?? undefined,
730
+ sourceVersion: row.source_version ?? undefined,
731
+ state: row.state,
732
+ reason: row.reason,
733
+ attemptCount: Number(row.attempt_count),
734
+ nextAttemptAt: parseTimestamp(row.next_attempt_at),
735
+ leaseOwner: row.lease_owner ?? undefined,
736
+ leaseExpiresAt: row.lease_expires_at ? parseTimestamp(row.lease_expires_at) : undefined,
737
+ failureCategory: row.failure_category ?? undefined,
738
+ updatedAt: parseTimestamp(row.updated_at),
739
+ };
740
+ }
741
+ function hasDesiredChanged(existing, input) {
742
+ return !existing ||
743
+ existing.providerId !== input.providerId ||
744
+ existing.model !== input.model ||
745
+ (existing.modelVersion ?? undefined) !== (input.modelVersion ?? undefined) ||
746
+ existing.configFingerprint !== input.configFingerprint ||
747
+ (existing.sourceHash ?? undefined) !== (input.sourceHash ?? undefined) ||
748
+ (existing.sourceVersion ?? undefined) !== (input.sourceVersion ?? undefined);
749
+ }
750
+ function assertSourceIdentity(existing, input) {
751
+ if (!existing) {
752
+ return;
753
+ }
754
+ if (existing.podRoot !== input.podRoot) {
755
+ throw new Error(`RDF search reconciliation Pod root is immutable for source key ${input.sourceKey}`);
756
+ }
757
+ }
758
+ function timestampText(db, date) {
759
+ const value = (0, db_1.toDbTimestamp)(db, date);
760
+ if (value instanceof Date) {
761
+ return value.toISOString();
762
+ }
763
+ if (typeof value === 'number') {
764
+ return new Date(value * 1000).toISOString();
765
+ }
766
+ return date.toISOString();
767
+ }
768
+ function parseTimestamp(value) {
769
+ return (0, db_1.fromDbTimestamp)(value) ?? new Date(value);
770
+ }
771
+ //# sourceMappingURL=RdfSearchReconciliationRepository.js.map