@neuralis/brain-core 0.1.0 → 0.2.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 (401) hide show
  1. package/README.md +26 -35
  2. package/app/README.md +1 -1
  3. package/app/cards/DiffView.tsx +9 -7
  4. package/app/cards/README.md +1 -1
  5. package/app/cards/diffLine.tsx +2 -4
  6. package/app/filesystem/README.md +4 -4
  7. package/app/filesystem/api/README.md +3 -3
  8. package/app/filesystem/api/index.ts +137 -123
  9. package/app/filesystem/domain/types.ts +36 -5
  10. package/app/filesystem/hooks/README.md +5 -5
  11. package/app/filesystem/hooks/useDiscoverableSources.ts +4 -2
  12. package/app/filesystem/hooks/useFilesystemSSE.ts +31 -23
  13. package/app/filesystem/hooks/useGitChangesInventory.ts +4 -2
  14. package/app/filesystem/host/README.md +3 -2
  15. package/app/filesystem/host/installFilesystemHostComponents.tsx +22 -9
  16. package/app/filesystem/store/README.md +11 -7
  17. package/app/filesystem/store/filesystemStore.ts +454 -162
  18. package/app/filesystem/store/gitSlice.ts +6 -6
  19. package/app/filesystem/store/listSlice.ts +10 -6
  20. package/app/filesystem/store/searchSlice.ts +27 -4
  21. package/app/filesystem/ui/FileEditor.tsx +48 -35
  22. package/app/filesystem/ui/FileTree.tsx +10 -9
  23. package/app/filesystem/ui/FileTreeSearch.tsx +29 -2
  24. package/app/filesystem/ui/GitCommitChangesView.tsx +5 -3
  25. package/app/filesystem/ui/GitCommitGraph.tsx +6 -5
  26. package/app/filesystem/ui/GitControlPanel.tsx +14 -13
  27. package/app/filesystem/ui/GitDiffView.tsx +2 -1
  28. package/app/filesystem/ui/GitFileDiff.tsx +7 -6
  29. package/app/filesystem/ui/PendingChangesPanel.tsx +88 -28
  30. package/app/filesystem/ui/PendingReviewDialog.tsx +52 -24
  31. package/app/filesystem/ui/README.md +8 -7
  32. package/app/filesystem/ui/ReembedDialog.tsx +22 -9
  33. package/app/filesystem/ui/SourceDeleteConfirm.tsx +1 -1
  34. package/app/filesystem/ui/SourcesPanel.tsx +135 -42
  35. package/app/filesystem/ui/VectorHealthPanel.tsx +20 -4
  36. package/app/filesystem/ui/pendingChangesModel.ts +9 -5
  37. package/dist/app/chunks/{astro-LRAFGXNX.js → astro-B2J4AS2D.js} +1 -1
  38. package/dist/app/chunks/bash-KY6SAQTH.js +1 -0
  39. package/dist/app/chunks/c-OBOPYVZ7.js +1 -0
  40. package/dist/app/chunks/{chunk-5H7ZCOD3.js → chunk-2X3GNKJ3.js} +1 -1
  41. package/dist/app/chunks/{chunk-XIFGTNRM.js → chunk-JPJIVRFI.js} +1 -1
  42. package/dist/app/chunks/{chunk-RH3QY5LF.js → chunk-LEFIFWND.js} +1 -1
  43. package/dist/app/chunks/{chunk-G4RZ3UNX.js → chunk-N6RXX3PH.js} +1 -1
  44. package/dist/app/chunks/{chunk-QXXJ73P5.js → chunk-PZAW4HPB.js} +1 -1
  45. package/dist/app/chunks/{chunk-3QLE7Y4L.js → chunk-ZBYWWTO6.js} +1 -1
  46. package/dist/app/chunks/cpp-TVWVOTEQ.js +1 -0
  47. package/dist/app/chunks/css-MANZBYA4.js +1 -0
  48. package/dist/app/chunks/{elixir-M36XROA6.js → elixir-S725Z7EH.js} +1 -1
  49. package/dist/app/chunks/{elm-7BG6QAIK.js → elm-5WUUSTNB.js} +1 -1
  50. package/dist/app/chunks/graphql-UGOPR3WU.js +1 -0
  51. package/dist/app/chunks/html-F6FWTBSG.js +1 -0
  52. package/dist/app/chunks/java-ANIVV5H5.js +1 -0
  53. package/dist/app/chunks/javascript-IH374YWG.js +1 -0
  54. package/dist/app/chunks/json-WGGVVXSB.js +1 -0
  55. package/dist/app/chunks/jsx-OTXJQD32.js +1 -0
  56. package/dist/app/chunks/{latex-ZWK7SXB6.js → latex-QCZNITGN.js} +1 -1
  57. package/dist/app/chunks/lua-4CRZ64PU.js +1 -0
  58. package/dist/app/chunks/{nginx-2L6VRV3A.js → nginx-V4CYS7WR.js} +1 -1
  59. package/dist/app/chunks/{perl-PBUAXXK6.js → perl-BHTX7F5B.js} +1 -1
  60. package/dist/app/chunks/{php-QJX57PA6.js → php-AYGJ5WYZ.js} +1 -1
  61. package/dist/app/chunks/r-4YFCFA4B.js +1 -0
  62. package/dist/app/chunks/{ruby-RLOWMVPO.js → ruby-42NMJWAL.js} +1 -1
  63. package/dist/app/chunks/{scss-B5CAI3HR.js → scss-XD7VU2CU.js} +1 -1
  64. package/dist/app/chunks/sql-B55MH6JJ.js +1 -0
  65. package/dist/app/chunks/{svelte-GT3D4C44.js → svelte-WR3QPIJU.js} +1 -1
  66. package/dist/app/chunks/tsx-S73GAE2L.js +1 -0
  67. package/dist/app/chunks/typescript-NEWOAB5Z.js +1 -0
  68. package/dist/app/chunks/{vue-JOW62MHD.js → vue-CCDS4VZK.js} +1 -1
  69. package/dist/app/chunks/xml-UXKAGLDR.js +1 -0
  70. package/dist/app/chunks/yaml-UMWKDTK7.js +1 -0
  71. package/dist/app/host.js +46 -46
  72. package/dist/scripts/embeddingLockV3.d.ts +30 -0
  73. package/dist/scripts/embeddingLockV3.d.ts.map +1 -0
  74. package/dist/scripts/embeddingLockV3.js +100 -0
  75. package/dist/scripts/embeddingLockV3.js.map +1 -0
  76. package/dist/scripts/vectorProofV1.d.ts +90 -0
  77. package/dist/scripts/vectorProofV1.d.ts.map +1 -0
  78. package/dist/scripts/vectorProofV1.js +220 -0
  79. package/dist/scripts/vectorProofV1.js.map +1 -0
  80. package/dist/src/config/env.d.ts +21 -0
  81. package/dist/src/config/env.d.ts.map +1 -1
  82. package/dist/src/config/env.js +55 -0
  83. package/dist/src/config/env.js.map +1 -1
  84. package/dist/src/connectors/AppSourceConfigStore.d.ts +12 -2
  85. package/dist/src/connectors/AppSourceConfigStore.d.ts.map +1 -1
  86. package/dist/src/connectors/AppSourceConfigStore.js +48 -40
  87. package/dist/src/connectors/AppSourceConfigStore.js.map +1 -1
  88. package/dist/src/connectors/LocalDiskConnector.d.ts +11 -14
  89. package/dist/src/connectors/LocalDiskConnector.d.ts.map +1 -1
  90. package/dist/src/connectors/LocalDiskConnector.js +87 -107
  91. package/dist/src/connectors/LocalDiskConnector.js.map +1 -1
  92. package/dist/src/connectors/sourceConfigMutation.d.ts +11 -1
  93. package/dist/src/connectors/sourceConfigMutation.d.ts.map +1 -1
  94. package/dist/src/connectors/sourceConfigMutation.js +36 -3
  95. package/dist/src/connectors/sourceConfigMutation.js.map +1 -1
  96. package/dist/src/domain/chunker.js +8 -3
  97. package/dist/src/domain/chunker.js.map +1 -1
  98. package/dist/src/domain/healthTypes.d.ts +11 -0
  99. package/dist/src/domain/healthTypes.d.ts.map +1 -1
  100. package/dist/src/domain/mime.d.ts +1 -0
  101. package/dist/src/domain/mime.d.ts.map +1 -1
  102. package/dist/src/domain/mime.js +48 -0
  103. package/dist/src/domain/mime.js.map +1 -1
  104. package/dist/src/domain/pendingChange.d.ts +7 -0
  105. package/dist/src/domain/pendingChange.d.ts.map +1 -1
  106. package/dist/src/domain/pendingChange.js +11 -0
  107. package/dist/src/domain/pendingChange.js.map +1 -1
  108. package/dist/src/domain/sourceConfig.d.ts +7 -14
  109. package/dist/src/domain/sourceConfig.d.ts.map +1 -1
  110. package/dist/src/domain/sourceConfig.js +1 -13
  111. package/dist/src/domain/sourceConfig.js.map +1 -1
  112. package/dist/src/domain/sourcePackages.d.ts +11 -2
  113. package/dist/src/domain/sourcePackages.d.ts.map +1 -1
  114. package/dist/src/domain/syncTrigger.d.ts +2 -3
  115. package/dist/src/domain/syncTrigger.d.ts.map +1 -1
  116. package/dist/src/domain/syncTrigger.js +2 -3
  117. package/dist/src/domain/syncTrigger.js.map +1 -1
  118. package/dist/src/domain/syncTypes.d.ts +21 -4
  119. package/dist/src/domain/syncTypes.d.ts.map +1 -1
  120. package/dist/src/domain/syncTypes.js.map +1 -1
  121. package/dist/src/domain/text.d.ts +3 -0
  122. package/dist/src/domain/text.d.ts.map +1 -1
  123. package/dist/src/domain/text.js +5 -0
  124. package/dist/src/domain/text.js.map +1 -1
  125. package/dist/src/domain/types.d.ts +9 -0
  126. package/dist/src/domain/types.d.ts.map +1 -1
  127. package/dist/src/embeddings/clients/GeminiEmbedder.d.ts.map +1 -1
  128. package/dist/src/embeddings/clients/GeminiEmbedder.js +11 -5
  129. package/dist/src/embeddings/clients/GeminiEmbedder.js.map +1 -1
  130. package/dist/src/embeddings/clients/OllamaEmbedder.d.ts.map +1 -1
  131. package/dist/src/embeddings/clients/OllamaEmbedder.js +13 -6
  132. package/dist/src/embeddings/clients/OllamaEmbedder.js.map +1 -1
  133. package/dist/src/embeddings/clients/OpenAIEmbedder.d.ts.map +1 -1
  134. package/dist/src/embeddings/clients/OpenAIEmbedder.js +12 -9
  135. package/dist/src/embeddings/clients/OpenAIEmbedder.js.map +1 -1
  136. package/dist/src/embeddings/clients/QwenEmbedder.d.ts.map +1 -1
  137. package/dist/src/embeddings/clients/QwenEmbedder.js +12 -5
  138. package/dist/src/embeddings/clients/QwenEmbedder.js.map +1 -1
  139. package/dist/src/embeddings/clients/VoyageEmbedder.d.ts.map +1 -1
  140. package/dist/src/embeddings/clients/VoyageEmbedder.js +12 -5
  141. package/dist/src/embeddings/clients/VoyageEmbedder.js.map +1 -1
  142. package/dist/src/embeddings/factory.d.ts +2 -0
  143. package/dist/src/embeddings/factory.d.ts.map +1 -1
  144. package/dist/src/embeddings/factory.js +23 -3
  145. package/dist/src/embeddings/factory.js.map +1 -1
  146. package/dist/src/embeddings/lock.d.ts +22 -11
  147. package/dist/src/embeddings/lock.d.ts.map +1 -1
  148. package/dist/src/embeddings/lock.js +47 -29
  149. package/dist/src/embeddings/lock.js.map +1 -1
  150. package/dist/src/embeddings/retry.d.ts +5 -0
  151. package/dist/src/embeddings/retry.d.ts.map +1 -1
  152. package/dist/src/embeddings/retry.js +35 -0
  153. package/dist/src/embeddings/retry.js.map +1 -1
  154. package/dist/src/events/pending.d.ts +56 -0
  155. package/dist/src/events/pending.d.ts.map +1 -0
  156. package/dist/src/events/pending.js +108 -0
  157. package/dist/src/events/pending.js.map +1 -0
  158. package/dist/src/events/source.d.ts +60 -14
  159. package/dist/src/events/source.d.ts.map +1 -1
  160. package/dist/src/events/source.js +149 -31
  161. package/dist/src/events/source.js.map +1 -1
  162. package/dist/src/events/vector.d.ts +33 -0
  163. package/dist/src/events/vector.d.ts.map +1 -0
  164. package/dist/src/events/vector.js +57 -0
  165. package/dist/src/events/vector.js.map +1 -0
  166. package/dist/src/git/GitRunner.d.ts.map +1 -1
  167. package/dist/src/git/GitRunner.js +11 -8
  168. package/dist/src/git/GitRunner.js.map +1 -1
  169. package/dist/src/git/sourceGitControl.d.ts.map +1 -1
  170. package/dist/src/git/sourceGitControl.js +2 -1
  171. package/dist/src/git/sourceGitControl.js.map +1 -1
  172. package/dist/src/index.d.ts +5 -4
  173. package/dist/src/index.d.ts.map +1 -1
  174. package/dist/src/index.js +4 -3
  175. package/dist/src/index.js.map +1 -1
  176. package/dist/src/lifecycle.d.ts +20 -4
  177. package/dist/src/lifecycle.d.ts.map +1 -1
  178. package/dist/src/lifecycle.js +5 -1
  179. package/dist/src/lifecycle.js.map +1 -1
  180. package/dist/src/routes/health.js +6 -1
  181. package/dist/src/routes/health.js.map +1 -1
  182. package/dist/src/routes/pending.d.ts.map +1 -1
  183. package/dist/src/routes/pending.js +2 -1
  184. package/dist/src/routes/pending.js.map +1 -1
  185. package/dist/src/routes/sources.d.ts.map +1 -1
  186. package/dist/src/routes/sources.js +60 -11
  187. package/dist/src/routes/sources.js.map +1 -1
  188. package/dist/src/services/BridgeService.d.ts +2 -2
  189. package/dist/src/services/BridgeService.d.ts.map +1 -1
  190. package/dist/src/services/BridgeService.js +11 -2
  191. package/dist/src/services/BridgeService.js.map +1 -1
  192. package/dist/src/services/FilesystemService.d.ts +3 -1
  193. package/dist/src/services/FilesystemService.d.ts.map +1 -1
  194. package/dist/src/services/FilesystemService.js +3 -1
  195. package/dist/src/services/FilesystemService.js.map +1 -1
  196. package/dist/src/services/FilesystemUiService.js +1 -1
  197. package/dist/src/services/FilesystemUiService.js.map +1 -1
  198. package/dist/src/services/SyncScheduler.d.ts.map +1 -1
  199. package/dist/src/services/SyncScheduler.js +0 -14
  200. package/dist/src/services/SyncScheduler.js.map +1 -1
  201. package/dist/src/services/VectorHealthService.d.ts.map +1 -1
  202. package/dist/src/services/VectorHealthService.js +2 -46
  203. package/dist/src/services/VectorHealthService.js.map +1 -1
  204. package/dist/src/services/baselineRepair.d.ts +2 -2
  205. package/dist/src/services/baselineRepair.js +2 -2
  206. package/dist/src/services/declaredSources.d.ts +8 -1
  207. package/dist/src/services/declaredSources.d.ts.map +1 -1
  208. package/dist/src/services/declaredSources.js +19 -19
  209. package/dist/src/services/declaredSources.js.map +1 -1
  210. package/dist/src/store/dataFormats.d.ts +14 -3
  211. package/dist/src/store/dataFormats.d.ts.map +1 -1
  212. package/dist/src/store/dataFormats.js +15 -5
  213. package/dist/src/store/dataFormats.js.map +1 -1
  214. package/dist/src/sync/DeltaSyncRunner.d.ts.map +1 -1
  215. package/dist/src/sync/DeltaSyncRunner.js +78 -243
  216. package/dist/src/sync/DeltaSyncRunner.js.map +1 -1
  217. package/dist/src/sync/SyncJobQueue.d.ts +33 -4
  218. package/dist/src/sync/SyncJobQueue.d.ts.map +1 -1
  219. package/dist/src/sync/SyncJobQueue.js +179 -19
  220. package/dist/src/sync/SyncJobQueue.js.map +1 -1
  221. package/dist/src/sync/moveDetector.d.ts +2 -1
  222. package/dist/src/sync/moveDetector.d.ts.map +1 -1
  223. package/dist/src/sync/moveDetector.js +2 -1
  224. package/dist/src/sync/moveDetector.js.map +1 -1
  225. package/dist/src/tools/fs_search.d.ts.map +1 -1
  226. package/dist/src/tools/fs_search.js +8 -0
  227. package/dist/src/tools/fs_search.js.map +1 -1
  228. package/dist/src/tools/fs_write.js +3 -1
  229. package/dist/src/tools/fs_write.js.map +1 -1
  230. package/dist/src/usecases/chunkUpsert.d.ts +4 -0
  231. package/dist/src/usecases/chunkUpsert.d.ts.map +1 -1
  232. package/dist/src/usecases/chunkUpsert.js +103 -60
  233. package/dist/src/usecases/chunkUpsert.js.map +1 -1
  234. package/dist/src/usecases/embeddingBacklog.d.ts +31 -0
  235. package/dist/src/usecases/embeddingBacklog.d.ts.map +1 -0
  236. package/dist/src/usecases/embeddingBacklog.js +244 -0
  237. package/dist/src/usecases/embeddingBacklog.js.map +1 -0
  238. package/dist/src/usecases/listSourcePackages.js +17 -1
  239. package/dist/src/usecases/listSourcePackages.js.map +1 -1
  240. package/dist/src/usecases/mediaLane.d.ts +11 -4
  241. package/dist/src/usecases/mediaLane.d.ts.map +1 -1
  242. package/dist/src/usecases/mediaLane.js +67 -30
  243. package/dist/src/usecases/mediaLane.js.map +1 -1
  244. package/dist/src/usecases/pendingReview.d.ts.map +1 -1
  245. package/dist/src/usecases/pendingReview.js +24 -7
  246. package/dist/src/usecases/pendingReview.js.map +1 -1
  247. package/dist/src/usecases/purgeExcludedPoints.d.ts +2 -0
  248. package/dist/src/usecases/purgeExcludedPoints.d.ts.map +1 -1
  249. package/dist/src/usecases/purgeExcludedPoints.js +3 -2
  250. package/dist/src/usecases/purgeExcludedPoints.js.map +1 -1
  251. package/dist/src/usecases/readFiles.d.ts.map +1 -1
  252. package/dist/src/usecases/readFiles.js +33 -6
  253. package/dist/src/usecases/readFiles.js.map +1 -1
  254. package/dist/src/usecases/reconcileSourcePackageRoots.d.ts +31 -0
  255. package/dist/src/usecases/reconcileSourcePackageRoots.d.ts.map +1 -0
  256. package/dist/src/usecases/reconcileSourcePackageRoots.js +114 -0
  257. package/dist/src/usecases/reconcileSourcePackageRoots.js.map +1 -0
  258. package/dist/src/usecases/searchFiles.d.ts.map +1 -1
  259. package/dist/src/usecases/searchFiles.js +62 -64
  260. package/dist/src/usecases/searchFiles.js.map +1 -1
  261. package/dist/src/usecases/syncIndexedFile.d.ts +42 -0
  262. package/dist/src/usecases/syncIndexedFile.d.ts.map +1 -0
  263. package/dist/src/usecases/syncIndexedFile.js +242 -0
  264. package/dist/src/usecases/syncIndexedFile.js.map +1 -0
  265. package/dist/src/usecases/syncPointWrites.d.ts +5 -0
  266. package/dist/src/usecases/syncPointWrites.d.ts.map +1 -1
  267. package/dist/src/usecases/syncPointWrites.js +32 -5
  268. package/dist/src/usecases/syncPointWrites.js.map +1 -1
  269. package/dist/src/usecases/uploadBinary.d.ts.map +1 -1
  270. package/dist/src/usecases/uploadBinary.js +36 -49
  271. package/dist/src/usecases/uploadBinary.js.map +1 -1
  272. package/dist/src/usecases/vector/endpointGuard.js +2 -1
  273. package/dist/src/usecases/vector/endpointGuard.js.map +1 -1
  274. package/dist/src/usecases/vector/estimate.d.ts +7 -4
  275. package/dist/src/usecases/vector/estimate.d.ts.map +1 -1
  276. package/dist/src/usecases/vector/estimate.js +8 -5
  277. package/dist/src/usecases/vector/estimate.js.map +1 -1
  278. package/dist/src/usecases/vector/rebuildGeneration.d.ts +29 -5
  279. package/dist/src/usecases/vector/rebuildGeneration.d.ts.map +1 -1
  280. package/dist/src/usecases/vector/rebuildGeneration.js +224 -82
  281. package/dist/src/usecases/vector/rebuildGeneration.js.map +1 -1
  282. package/dist/src/usecases/vectorMaintenance.d.ts +46 -4
  283. package/dist/src/usecases/vectorMaintenance.d.ts.map +1 -1
  284. package/dist/src/usecases/vectorMaintenance.js +190 -11
  285. package/dist/src/usecases/vectorMaintenance.js.map +1 -1
  286. package/dist/src/usecases/write/commit.d.ts +6 -8
  287. package/dist/src/usecases/write/commit.d.ts.map +1 -1
  288. package/dist/src/usecases/write/commit.js +96 -112
  289. package/dist/src/usecases/write/commit.js.map +1 -1
  290. package/dist/src/usecases/write/content.js +1 -2
  291. package/dist/src/usecases/write/content.js.map +1 -1
  292. package/dist/src/usecases/write/ports.d.ts +1 -0
  293. package/dist/src/usecases/write/ports.d.ts.map +1 -1
  294. package/dist/src/vector/FilesystemVectorIndex.d.ts +34 -3
  295. package/dist/src/vector/FilesystemVectorIndex.d.ts.map +1 -1
  296. package/dist/src/vector/FilesystemVectorIndex.js +254 -20
  297. package/dist/src/vector/FilesystemVectorIndex.js.map +1 -1
  298. package/dist/src/vector/InMemoryVectorIndex.d.ts +9 -2
  299. package/dist/src/vector/InMemoryVectorIndex.d.ts.map +1 -1
  300. package/dist/src/vector/InMemoryVectorIndex.js +25 -6
  301. package/dist/src/vector/InMemoryVectorIndex.js.map +1 -1
  302. package/dist/src/vector/QdrantVectorIndex.d.ts +35 -9
  303. package/dist/src/vector/QdrantVectorIndex.d.ts.map +1 -1
  304. package/dist/src/vector/QdrantVectorIndex.js +209 -90
  305. package/dist/src/vector/QdrantVectorIndex.js.map +1 -1
  306. package/dist/src/vector/qdrantFilter.d.ts +3 -1
  307. package/dist/src/vector/qdrantFilter.d.ts.map +1 -1
  308. package/dist/src/vector/qdrantFilter.js +2 -0
  309. package/dist/src/vector/qdrantFilter.js.map +1 -1
  310. package/dist/src/vector/types.d.ts +81 -0
  311. package/dist/src/vector/types.d.ts.map +1 -1
  312. package/dist/src/vector/types.js +2 -0
  313. package/dist/src/vector/types.js.map +1 -1
  314. package/dist/src/wiring.d.ts +6 -0
  315. package/dist/src/wiring.d.ts.map +1 -1
  316. package/dist/src/wiring.js +62 -3
  317. package/dist/src/wiring.js.map +1 -1
  318. package/dist/tools/fs_search.json +2 -2
  319. package/docs/drive-overview.md +2 -2
  320. package/instructions/brain-model.md +1 -1
  321. package/package.json +1000 -11
  322. package/rules/brain-rules.md +1 -1
  323. package/skills/connect-business-data/SKILL.md +6 -4
  324. package/skills/create-package/SKILL.md +14 -12
  325. package/skills/create-package/references/config-and-credentials.md +3 -3
  326. package/skills/create-package/references/connectors-and-uri-policies.md +5 -3
  327. package/skills/create-package/references/manifest-and-discovery.md +5 -4
  328. package/skills/create-package/references/runtime-and-build.md +9 -9
  329. package/skills/create-package/references/skills-and-context.md +3 -3
  330. package/skills/create-package/references/surfaces-and-design.md +9 -6
  331. package/skills/create-package/references/team-and-workflows.md +2 -2
  332. package/skills/create-package/references/test-and-ship.md +15 -15
  333. package/skills/create-package/references/tools-and-schemas.md +1 -1
  334. package/skills/create-package/scripts/check-package.sh +50 -4
  335. package/skills/create-package/scripts/verify-loaded.sh +16 -16
  336. package/skills/manage-files/SKILL.md +2 -2
  337. package/skills/manage-sources/SKILL.md +16 -15
  338. package/skills/manage-sources/scripts/reembed.sh +9 -3
  339. package/skills/sync/SKILL.md +4 -4
  340. package/tools/fs_search.json +2 -2
  341. package/app/filesystem/hooks/useContainerWidth.ts +0 -39
  342. package/dist/app/chunks/bash-M45GHPBQ.js +0 -1
  343. package/dist/app/chunks/c-X3REOAWD.js +0 -1
  344. package/dist/app/chunks/cpp-VOWI743W.js +0 -1
  345. package/dist/app/chunks/css-2ZVPHE25.js +0 -1
  346. package/dist/app/chunks/graphql-7V2NP54C.js +0 -1
  347. package/dist/app/chunks/html-UF3LFLNA.js +0 -1
  348. package/dist/app/chunks/java-PNTAU4L3.js +0 -1
  349. package/dist/app/chunks/javascript-4JJTQGEL.js +0 -1
  350. package/dist/app/chunks/json-VLQ6D3JH.js +0 -1
  351. package/dist/app/chunks/jsx-KQKSLAAH.js +0 -1
  352. package/dist/app/chunks/lua-UFPYUJ2O.js +0 -1
  353. package/dist/app/chunks/r-QEZB45SR.js +0 -1
  354. package/dist/app/chunks/sql-DTZHNUZP.js +0 -1
  355. package/dist/app/chunks/tsx-WPR2WRZD.js +0 -1
  356. package/dist/app/chunks/typescript-LWO362OA.js +0 -1
  357. package/dist/app/chunks/xml-A5H72RTS.js +0 -1
  358. package/dist/app/chunks/yaml-MXHSIJCI.js +0 -1
  359. package/dist/src/services/purgePendingNodes.d.ts +0 -32
  360. package/dist/src/services/purgePendingNodes.d.ts.map +0 -1
  361. package/dist/src/services/purgePendingNodes.js +0 -61
  362. package/dist/src/services/purgePendingNodes.js.map +0 -1
  363. /package/dist/app/chunks/{chunk-737Y24HS.js → chunk-3JASFUPF.js} +0 -0
  364. /package/dist/app/chunks/{chunk-DKD2L57N.js → chunk-6EYLOQ4F.js} +0 -0
  365. /package/dist/app/chunks/{chunk-KYH5EHHY.js → chunk-7YRZ5LOQ.js} +0 -0
  366. /package/dist/app/chunks/{chunk-6TC3DVWV.js → chunk-C7LU4RID.js} +0 -0
  367. /package/dist/app/chunks/{chunk-TY33BMKR.js → chunk-CD52YDZP.js} +0 -0
  368. /package/dist/app/chunks/{chunk-OLEIKJ3X.js → chunk-DCJKTCJ5.js} +0 -0
  369. /package/dist/app/chunks/{chunk-QLBZ4JR2.js → chunk-EXIU2KBV.js} +0 -0
  370. /package/dist/app/chunks/{chunk-SFUNBBEA.js → chunk-FDP4LO4P.js} +0 -0
  371. /package/dist/app/chunks/{chunk-BGRVFATT.js → chunk-HNETUS7U.js} +0 -0
  372. /package/dist/app/chunks/{chunk-4QNMHAIR.js → chunk-LBFZJEDR.js} +0 -0
  373. /package/dist/app/chunks/{chunk-TRRUHDPN.js → chunk-ULRXL5VM.js} +0 -0
  374. /package/dist/app/chunks/{chunk-S6B4WWIF.js → chunk-XJK47SMJ.js} +0 -0
  375. /package/dist/app/chunks/{chunk-DZ5C5FKI.js → chunk-YYAAIAU2.js} +0 -0
  376. /package/dist/app/chunks/{clojure-OC6KPSJO.js → clojure-4QCN4GHG.js} +0 -0
  377. /package/dist/app/chunks/{core-KGE7TQJ3.js → core-ZHTX3P2Q.js} +0 -0
  378. /package/dist/app/chunks/{csharp-E7VIFITL.js → csharp-HQWR4N52.js} +0 -0
  379. /package/dist/app/chunks/{dark-plus-BOSCZXE4.js → dark-plus-GYPKKZES.js} +0 -0
  380. /package/dist/app/chunks/{dart-6Y3X27SZ.js → dart-FO4TTVO2.js} +0 -0
  381. /package/dist/app/chunks/{diff-TR2NPA64.js → diff-SHANV4YC.js} +0 -0
  382. /package/dist/app/chunks/{dist-T32U2VVR.js → dist-WSDF34DM.js} +0 -0
  383. /package/dist/app/chunks/{docker-N33HOW54.js → docker-VX55HTDS.js} +0 -0
  384. /package/dist/app/chunks/{go-6DGG5UTP.js → go-5UCPEC6S.js} +0 -0
  385. /package/dist/app/chunks/{haskell-KK36PMMM.js → haskell-25PJ3OSG.js} +0 -0
  386. /package/dist/app/chunks/{ini-VHVQ5TPB.js → ini-BJIVD5MK.js} +0 -0
  387. /package/dist/app/chunks/{kotlin-44WS3JHE.js → kotlin-MNR6XOEQ.js} +0 -0
  388. /package/dist/app/chunks/{less-5WZ3KLAK.js → less-KA5JURX6.js} +0 -0
  389. /package/dist/app/chunks/{light-plus-HGGBC43G.js → light-plus-QXH2UUWZ.js} +0 -0
  390. /package/dist/app/chunks/{make-X7RXMVW7.js → make-LPD5KOCO.js} +0 -0
  391. /package/dist/app/chunks/{markdown-46IKUAIB.js → markdown-LMWF6MQR.js} +0 -0
  392. /package/dist/app/chunks/{mdx-DGLHDAO7.js → mdx-WPMNN5BS.js} +0 -0
  393. /package/dist/app/chunks/{nix-Q6FYQZLX.js → nix-QGWLUUMZ.js} +0 -0
  394. /package/dist/app/chunks/{powershell-L4KJJ6DK.js → powershell-7GSBBEFF.js} +0 -0
  395. /package/dist/app/chunks/{prisma-IKS4LVH2.js → prisma-FPMPQISO.js} +0 -0
  396. /package/dist/app/chunks/{proto-AYCDOTJO.js → proto-7KDX5Z2U.js} +0 -0
  397. /package/dist/app/chunks/{python-KXMCSAFQ.js → python-CFG4FTQW.js} +0 -0
  398. /package/dist/app/chunks/{rust-J3BC3P6V.js → rust-X7A37WU3.js} +0 -0
  399. /package/dist/app/chunks/{scala-AYIIHBJK.js → scala-OYHJSUG2.js} +0 -0
  400. /package/dist/app/chunks/{swift-QPHHCQD3.js → swift-PE7VNYW5.js} +0 -0
  401. /package/dist/app/chunks/{toml-UV7JK7K7.js → toml-ETQRDILP.js} +0 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The embedding-lock OFFLINE upgrade to format v3 (`pnpm neuralis:upgrade`,
3
+ * app STOPPED). The runtime reads only v3 and refuses a v1/v2 lock naming the
4
+ * command; the conversion lives here and nowhere the runtime imports.
5
+ *
6
+ * - v1 (dimension-only, one collection) ⇒ dense generation 1 with the base
7
+ * recipe — every client's document request was the base one when v1 locks
8
+ * were written; a missing `apiModelId`/`createdAt` keeps the v1 reader's ''.
9
+ * - v2 ⇒ the same dense generation, recipe and collection.
10
+ * - a missing `provider` is taken from the registry row of `modelId`; an
11
+ * unknown model is refused rather than guessed.
12
+ * - a recorded v2 rebuild gains `phase: 'copying'` — v2 recorded a rebuild
13
+ * only once its shadow existed.
14
+ *
15
+ * `dryRun` writes nothing. `apply` is idempotent (a v3 lock is left as it is)
16
+ * and re-reads its own result through the runtime reader. The ledger
17
+ * begin/complete around `apply` is the operator command's.
18
+ */
19
+ import type { OfflineUpgradeContext, OfflineUpgradePlan } from '@neuralis/package-system/data';
20
+ declare const embeddingLockV3: {
21
+ id: string;
22
+ kinds: {
23
+ kind: "brain-core/embedding-lock";
24
+ to: 3;
25
+ }[];
26
+ dryRun(ctx: OfflineUpgradeContext): Promise<OfflineUpgradePlan>;
27
+ apply(ctx: OfflineUpgradeContext): Promise<void>;
28
+ };
29
+ export default embeddingLockV3;
30
+ //# sourceMappingURL=embeddingLockV3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddingLockV3.d.ts","sourceRoot":"","sources":["../../scripts/embeddingLockV3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAwB,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AA+CrH,QAAA,MAAM,eAAe;;;;;;gBAGD,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC;eAWpD,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAQxB,CAAC;eAElB,eAAe"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The embedding-lock OFFLINE upgrade to format v3 (`pnpm neuralis:upgrade`,
3
+ * app STOPPED). The runtime reads only v3 and refuses a v1/v2 lock naming the
4
+ * command; the conversion lives here and nowhere the runtime imports.
5
+ *
6
+ * - v1 (dimension-only, one collection) ⇒ dense generation 1 with the base
7
+ * recipe — every client's document request was the base one when v1 locks
8
+ * were written; a missing `apiModelId`/`createdAt` keeps the v1 reader's ''.
9
+ * - v2 ⇒ the same dense generation, recipe and collection.
10
+ * - a missing `provider` is taken from the registry row of `modelId`; an
11
+ * unknown model is refused rather than guessed.
12
+ * - a recorded v2 rebuild gains `phase: 'copying'` — v2 recorded a rebuild
13
+ * only once its shadow existed.
14
+ *
15
+ * `dryRun` writes nothing. `apply` is idempotent (a v3 lock is left as it is)
16
+ * and re-reads its own result through the runtime reader. The ledger
17
+ * begin/complete around `apply` is the operator command's.
18
+ */
19
+ import { readFile } from 'node:fs/promises';
20
+ import { join, relative } from 'node:path';
21
+ import { durableReplaceFile } from '@neuralis/package-system/data';
22
+ import { EMBEDDING_LOCK_FORMAT } from '../src/store/dataFormats.js';
23
+ import { EMBED_RECIPE_BASE, findEmbeddingModel } from '../src/embeddings/models.js';
24
+ import { readLock } from '../src/embeddings/lock.js';
25
+ function invalid(detail) {
26
+ return new Error(`EMBEDDING_LOCK_UPGRADE: ${detail}; the lock was not changed`);
27
+ }
28
+ async function convert(appRoot) {
29
+ const path = join(appRoot, 'config', 'embedding-lock.json');
30
+ let text;
31
+ try {
32
+ text = await readFile(path, 'utf8');
33
+ }
34
+ catch (error) {
35
+ if (error.code === 'ENOENT')
36
+ return { path, from: null };
37
+ throw error;
38
+ }
39
+ const raw = JSON.parse(text);
40
+ if (raw.version === EMBEDDING_LOCK_FORMAT.version)
41
+ return { path, from: 3 };
42
+ if (raw.version !== 1 && raw.version !== 2)
43
+ throw invalid(`unknown version ${String(raw.version)}`);
44
+ const version = raw.version;
45
+ if (typeof raw.modelId !== 'string' || !raw.modelId)
46
+ throw invalid('modelId missing');
47
+ if (typeof raw.dimension !== 'number' || !Number.isInteger(raw.dimension) || raw.dimension <= 0)
48
+ throw invalid('dimension invalid');
49
+ if (typeof raw.collection !== 'string' || !raw.collection)
50
+ throw invalid('collection missing');
51
+ const generation = version === 1 ? 1 : raw.generation;
52
+ if (typeof generation !== 'number' || !Number.isInteger(generation) || generation < 1)
53
+ throw invalid('generation invalid');
54
+ const embedRecipe = version === 1 ? EMBED_RECIPE_BASE : raw.embedRecipe;
55
+ if (typeof embedRecipe !== 'string' || !embedRecipe)
56
+ throw invalid('embedRecipe missing');
57
+ const provider = typeof raw.provider === 'string' ? raw.provider : findEmbeddingModel(raw.modelId)?.provider;
58
+ if (!provider)
59
+ throw invalid(`provider of ${raw.modelId} unknown`);
60
+ const rebuild = raw.rebuild;
61
+ if (rebuild !== undefined && (typeof rebuild !== 'object' || rebuild === null || Array.isArray(rebuild)))
62
+ throw invalid('rebuild invalid');
63
+ const lock = {
64
+ version: 3, mode: 'dense', collection: raw.collection,
65
+ createdAt: typeof raw.createdAt === 'string' ? raw.createdAt : '',
66
+ generation, modelId: raw.modelId, provider: provider,
67
+ apiModelId: typeof raw.apiModelId === 'string' ? raw.apiModelId : '',
68
+ embedRecipe, dimension: raw.dimension,
69
+ ...(typeof raw.backfilledAt === 'string' ? { backfilledAt: raw.backfilledAt } : {}),
70
+ // The job resolver validates rebuild state; the upgrade only adds the v3 phase.
71
+ ...(rebuild ? { rebuild: { ...rebuild, phase: 'copying' } } : {}),
72
+ };
73
+ return { path, from: version, lock };
74
+ }
75
+ const embeddingLockV3 = {
76
+ id: 'embedding-lock-v3',
77
+ kinds: [{ kind: EMBEDDING_LOCK_FORMAT.kind, to: EMBEDDING_LOCK_FORMAT.version }],
78
+ async dryRun(ctx) {
79
+ const conversion = await convert(ctx.appRoot);
80
+ if (!('lock' in conversion)) {
81
+ return { files: [], summary: [conversion.from === null ? 'no embedding lock — nothing to convert' : 'embedding lock already v3'] };
82
+ }
83
+ const { lock } = conversion;
84
+ return {
85
+ files: [relative(ctx.home, conversion.path)],
86
+ summary: [`embedding lock v${conversion.from} → v3 (dense generation ${lock.generation}, collection ${lock.collection})`],
87
+ };
88
+ },
89
+ async apply(ctx) {
90
+ const conversion = await convert(ctx.appRoot);
91
+ if (!('lock' in conversion))
92
+ return;
93
+ await durableReplaceFile(conversion.path, JSON.stringify(conversion.lock, null, 2), { mode: 0o600 });
94
+ // The runtime reader is the oracle: what was written must read back as v3.
95
+ await readLock(ctx.appRoot);
96
+ ctx.log(`embedding lock v${conversion.from} → v3`);
97
+ },
98
+ };
99
+ export default embeddingLockV3;
100
+ //# sourceMappingURL=embeddingLockV3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddingLockV3.js","sourceRoot":"","sources":["../../scripts/embeddingLockV3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAA4B,MAAM,6BAA6B,CAAC;AAC9G,OAAO,EAAE,QAAQ,EAAkD,MAAM,2BAA2B,CAAC;AAIrG,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,IAAI,KAAK,CAAC,2BAA2B,MAAM,4BAA4B,CAAC,CAAC;AAClF,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,OAAe;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;IAC5D,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QAAC,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAAC,CAAC;IAC5C,OAAO,KAAK,EAAE,CAAC;QACb,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACpF,MAAM,KAAK,CAAC;IACd,CAAC;IACD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AE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACrG,2EAA2E;QAC3E,MAAM,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC5B,GAAG,CAAC,GAAG,CAAC,mBAAmB,UAAU,CAAC,IAAI,OAAO,CAAC,CAAC;IACrD,CAAC;CAC6B,CAAC;AAEjC,eAAe,eAAe,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The vector-proof OFFLINE upgrade (`pnpm neuralis:upgrade`, app STOPPED,
3
+ * Qdrant UP). A point written before the embedding proof existed carries no
4
+ * `embedding_status`; the runtime reads only proven points, so the proof is
5
+ * written here, once, and nowhere the runtime imports.
6
+ *
7
+ * Per point without `embedding_status` (tombstones aside — they are never
8
+ * embedded again):
9
+ * - ADOPTED (`current`) when the active lock is dense, the point holds a
10
+ * stored vector stamped with the active marker (`embed_model`), and its own
11
+ * inline text answers the embedding input (`nodeEmbeddingInputHash`): the
12
+ * write path that predates the proof stored exactly the text it embedded
13
+ * beside the vector, so the proof is that text's hash under the active
14
+ * generation. No re-embed. EXCEPT a point whose write said its vector was
15
+ * not built (`version.sync.status: 'unindexed'`): that write kept the OLD
16
+ * vector under the NEW `content_hash`, and a later sync of the unchanged
17
+ * file could put the new text back beside it — so its text is no proof.
18
+ * - otherwise the embedding audit's own verdict (`runQueuedEmbedding`): a
19
+ * stored vector it cannot prove is `stale`, no vector is `missing`. The
20
+ * operator's embedding catch-up re-embeds those.
21
+ *
22
+ * Every write is a payload PATCH (`set_payload` — never an overwrite, never a
23
+ * vector write), so a stored vector is never dropped. `dryRun` counts and
24
+ * writes nothing; `apply` is idempotent — a second run finds no unproven point.
25
+ *
26
+ * Cost: every unproven point is written ONCE — an adopted one by its own
27
+ * operation (its hash is its own), the stale and the missing ones of a page by
28
+ * one operation each — so Qdrant re-indexes each point once whatever the
29
+ * batching. What the batching decides is the request count and the waits: a
30
+ * page's batch is sent unwaited, and only the LAST batch waits. An unwaited
31
+ * batch is acknowledged at Qdrant's write-ahead log and may still fail after
32
+ * the acknowledgement, so the closing exact count of unproven points is the
33
+ * proof: a run that leaves any fails, and the next run resumes them (+1 count
34
+ * per apply). The client holds at most one unsent batch per page, and every
35
+ * page costs at least three round-trips before it sends. The
36
+ * scroll offset is the next point id, so a page never reads a point an
37
+ * unwaited write still holds. Progress is logged every `PROGRESS_EVERY` points.
38
+ * The ledger begin/complete around `apply` is the operator command's. Module
39
+ * order matters only through `apply`: `embedding-lock-v3` < `vector-proof-v1`,
40
+ * so the lock this reads at apply is already v3.
41
+ */
42
+ import type { OfflineUpgradeModule } from '@neuralis/package-system/data';
43
+ /** The Qdrant calls this upgrade makes — the real client satisfies it, a test passes a fake. */
44
+ export type VectorProofClient = {
45
+ collectionExists(collection: string): Promise<{
46
+ exists: boolean;
47
+ }>;
48
+ count(collection: string, args: {
49
+ filter: unknown;
50
+ exact: boolean;
51
+ }): Promise<{
52
+ count: number;
53
+ }>;
54
+ scroll(collection: string, args: {
55
+ filter: unknown;
56
+ limit: number;
57
+ offset?: string | number;
58
+ with_payload: boolean | string[];
59
+ with_vector: boolean;
60
+ }): Promise<{
61
+ points: Array<{
62
+ id: string | number;
63
+ payload?: Record<string, unknown> | null;
64
+ }>;
65
+ next_page_offset?: string | number | null | Record<string, unknown>;
66
+ }>;
67
+ retrieve(collection: string, args: {
68
+ ids: Array<string | number>;
69
+ with_payload: string[];
70
+ with_vector: boolean;
71
+ }): Promise<Array<{
72
+ id: string | number;
73
+ payload?: Record<string, unknown> | null;
74
+ }>>;
75
+ batchUpdate(collection: string, args: {
76
+ wait: boolean;
77
+ operations: unknown[];
78
+ }): Promise<unknown>;
79
+ };
80
+ export type VectorProofDeps = {
81
+ /** Lazily built: an in-memory install never constructs a client. */
82
+ client(): VectorProofClient;
83
+ /** `BRAIN_INFRA_MODE` as the runtime reads it — `inmemory` persists no vector. */
84
+ infraMode(): 'inmemory' | 'local' | 'real';
85
+ now(): string;
86
+ };
87
+ export declare function createVectorProofUpgrade(deps: VectorProofDeps): OfflineUpgradeModule;
88
+ declare const vectorProofV1: OfflineUpgradeModule;
89
+ export default vectorProofV1;
90
+ //# sourceMappingURL=vectorProofV1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectorProofV1.d.ts","sourceRoot":"","sources":["../../scripts/vectorProofV1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAIH,OAAO,KAAK,EAAyB,oBAAoB,EAAsB,MAAM,+BAA+B,CAAC;AAWrH,gGAAgG;AAChG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACnE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjG,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;QAC/B,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,YAAY,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;QAAC,WAAW,EAAE,OAAO,CAAC;KAClH,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;SAAE,CAAC,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IACvK,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,GAAG,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC,CAAC;IACrM,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,UAAU,EAAE,OAAO,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACnG,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,MAAM,IAAI,iBAAiB,CAAC;IAC5B,kFAAkF;IAClF,SAAS,IAAI,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;IAC3C,GAAG,IAAI,MAAM,CAAC;CACf,CAAC;AAiCF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,eAAe,GAAG,oBAAoB,CAqHpF;AAED,QAAA,MAAM,aAAa,sBAIjB,CAAC;eAEY,aAAa"}
@@ -0,0 +1,220 @@
1
+ /**
2
+ * The vector-proof OFFLINE upgrade (`pnpm neuralis:upgrade`, app STOPPED,
3
+ * Qdrant UP). A point written before the embedding proof existed carries no
4
+ * `embedding_status`; the runtime reads only proven points, so the proof is
5
+ * written here, once, and nowhere the runtime imports.
6
+ *
7
+ * Per point without `embedding_status` (tombstones aside — they are never
8
+ * embedded again):
9
+ * - ADOPTED (`current`) when the active lock is dense, the point holds a
10
+ * stored vector stamped with the active marker (`embed_model`), and its own
11
+ * inline text answers the embedding input (`nodeEmbeddingInputHash`): the
12
+ * write path that predates the proof stored exactly the text it embedded
13
+ * beside the vector, so the proof is that text's hash under the active
14
+ * generation. No re-embed. EXCEPT a point whose write said its vector was
15
+ * not built (`version.sync.status: 'unindexed'`): that write kept the OLD
16
+ * vector under the NEW `content_hash`, and a later sync of the unchanged
17
+ * file could put the new text back beside it — so its text is no proof.
18
+ * - otherwise the embedding audit's own verdict (`runQueuedEmbedding`): a
19
+ * stored vector it cannot prove is `stale`, no vector is `missing`. The
20
+ * operator's embedding catch-up re-embeds those.
21
+ *
22
+ * Every write is a payload PATCH (`set_payload` — never an overwrite, never a
23
+ * vector write), so a stored vector is never dropped. `dryRun` counts and
24
+ * writes nothing; `apply` is idempotent — a second run finds no unproven point.
25
+ *
26
+ * Cost: every unproven point is written ONCE — an adopted one by its own
27
+ * operation (its hash is its own), the stale and the missing ones of a page by
28
+ * one operation each — so Qdrant re-indexes each point once whatever the
29
+ * batching. What the batching decides is the request count and the waits: a
30
+ * page's batch is sent unwaited, and only the LAST batch waits. An unwaited
31
+ * batch is acknowledged at Qdrant's write-ahead log and may still fail after
32
+ * the acknowledgement, so the closing exact count of unproven points is the
33
+ * proof: a run that leaves any fails, and the next run resumes them (+1 count
34
+ * per apply). The client holds at most one unsent batch per page, and every
35
+ * page costs at least three round-trips before it sends. The
36
+ * scroll offset is the next point id, so a page never reads a point an
37
+ * unwaited write still holds. Progress is logged every `PROGRESS_EVERY` points.
38
+ * The ledger begin/complete around `apply` is the operator command's. Module
39
+ * order matters only through `apply`: `embedding-lock-v3` < `vector-proof-v1`,
40
+ * so the lock this reads at apply is already v3.
41
+ */
42
+ import { readFile } from 'node:fs/promises';
43
+ import { join } from 'node:path';
44
+ import { VECTOR_PROOF_FORMAT } from '../src/store/dataFormats.js';
45
+ import { readLock } from '../src/embeddings/lock.js';
46
+ import { embedModelMarker } from '../src/embeddings/models.js';
47
+ import { nodeEmbeddingInputHash } from '../src/usecases/syncPointWrites.js';
48
+ import { getQdrantClient } from '../src/vector/qdrantClient.js';
49
+ import { baseCollection } from '../src/vector/QdrantVectorIndex.js';
50
+ import { inferInfraModeFromEnv } from '../src/wiring.js';
51
+ import { getBrainConfigNumber } from '../src/config/env.js';
52
+ /** A point with no `embedding_status` yet, ignoring tombstones. */
53
+ const UNPROVEN = {
54
+ must: [{ is_empty: { key: 'embedding_status' } }],
55
+ must_not: [{ key: 'status', match: { value: 'deleted' } }],
56
+ };
57
+ const SCAN_FIELDS = ['embed_model', 'modality', 'recovery_only', 'category'];
58
+ const INPUT_FIELDS = ['content', 'filename', 'category', 'modality', 'page', 'content_hash'];
59
+ /** The write path's own word that the stored vector was NOT built from the point's content. */
60
+ const UNINDEXED = { key: 'version.sync.status', match: { value: 'unindexed' } };
61
+ /** Inline text travels in batches this small (a parent stores up to ~200 k chars). */
62
+ const CONTENT_BATCH = 32;
63
+ /** One progress line per this many points marked, plus the closing tally. */
64
+ const PROGRESS_EVERY = 10_000;
65
+ /** The dry run's word on what the apply costs the vector database. */
66
+ const APPLY_COST = 'the apply marks every vector point once with its embedding proof (no re-embed); the vector database is busy for a few minutes on a large index';
67
+ /** The collection the runtime serves: the lock's (any lock version names one), else the base. */
68
+ async function servingCollection(appRoot) {
69
+ try {
70
+ const raw = JSON.parse(await readFile(join(appRoot, 'config', 'embedding-lock.json'), 'utf8'));
71
+ if (typeof raw.collection === 'string' && raw.collection)
72
+ return raw.collection;
73
+ }
74
+ catch (error) {
75
+ if (error.code !== 'ENOENT')
76
+ throw error;
77
+ }
78
+ return baseCollection();
79
+ }
80
+ function offsetOf(next) {
81
+ return typeof next === 'string' || typeof next === 'number' ? next : undefined;
82
+ }
83
+ export function createVectorProofUpgrade(deps) {
84
+ const plan = async (ctx) => {
85
+ if (deps.infraMode() === 'inmemory')
86
+ return null;
87
+ const collection = await servingCollection(ctx.appRoot);
88
+ const client = deps.client();
89
+ if (!(await client.collectionExists(collection)).exists)
90
+ return { collection, unproven: 0 };
91
+ return { collection, unproven: (await client.count(collection, { filter: UNPROVEN, exact: true })).count };
92
+ };
93
+ return {
94
+ id: 'vector-proof-v1',
95
+ kinds: [{ kind: VECTOR_PROOF_FORMAT.kind, to: VECTOR_PROOF_FORMAT.version }],
96
+ async dryRun(ctx) {
97
+ let found;
98
+ try {
99
+ found = await plan(ctx);
100
+ }
101
+ catch (error) {
102
+ return {
103
+ files: [],
104
+ summary: [],
105
+ blockers: {
106
+ lines: [`vector index · the Qdrant server did not answer (${error instanceof Error ? error.message : String(error)})`],
107
+ remedy: 'start Qdrant with the app still stopped (`docker compose up -d qdrant`, or the Qdrant binary), then run the command again',
108
+ },
109
+ };
110
+ }
111
+ if (!found)
112
+ return { files: [], summary: ['no persistent vector index (BRAIN_INFRA_MODE=inmemory) — nothing to prove'] };
113
+ return {
114
+ files: [],
115
+ summary: [found.unproven === 0
116
+ ? `vector index ${found.collection}: every point already carries its embedding proof`
117
+ : `vector index ${found.collection}: ${found.unproven} point(s) without an embedding proof — the ones whose stored vector and inline text match the active generation are adopted, the rest are marked for the embedding catch-up`,
118
+ ...(found.unproven === 0 ? [] : [APPLY_COST])],
119
+ };
120
+ },
121
+ async apply(ctx) {
122
+ if (deps.infraMode() === 'inmemory')
123
+ return;
124
+ const lock = await readLock(ctx.appRoot);
125
+ const collection = lock?.collection ?? baseCollection();
126
+ const client = deps.client();
127
+ if (!(await client.collectionExists(collection)).exists)
128
+ return;
129
+ const marker = lock?.mode === 'dense' ? embedModelMarker(lock.modelId, lock.dimension, lock.embedRecipe) : undefined;
130
+ const limit = Math.max(1, Math.floor(getBrainConfigNumber('vectorHealthBatchSize', undefined, 256)));
131
+ const total = (await client.count(collection, { filter: UNPROVEN, exact: true })).count;
132
+ const started = Date.now();
133
+ let adopted = 0;
134
+ let stale = 0;
135
+ let missing = 0;
136
+ let marked = 0;
137
+ let reported = 0;
138
+ let unsent = null;
139
+ const send = async (wait) => {
140
+ if (!unsent)
141
+ return;
142
+ await client.batchUpdate(collection, { wait, operations: unsent });
143
+ unsent = null;
144
+ };
145
+ let offset;
146
+ do {
147
+ const page = await client.scroll(collection, { filter: UNPROVEN, limit, ...(offset !== undefined ? { offset } : {}), with_payload: SCAN_FIELDS, with_vector: false });
148
+ const ids = page.points.map((point) => point.id);
149
+ if (ids.length === 0)
150
+ break;
151
+ const withVector = new Set((await client.scroll(collection, {
152
+ filter: { must: [{ has_id: ids }, { has_vector: '' }] }, limit: ids.length, with_payload: false, with_vector: false,
153
+ })).points.map((point) => String(point.id)));
154
+ // Adoption candidates: a vector stamped with the active marker, text (not media), searchable.
155
+ const markerMatched = marker === undefined ? [] : page.points.filter((point) => withVector.has(String(point.id))
156
+ && point.payload?.embed_model === marker && !point.payload?.modality && point.payload?.recovery_only !== true);
157
+ const unindexed = markerMatched.length === 0 ? new Set() : new Set((await client.scroll(collection, {
158
+ filter: { must: [{ has_id: markerMatched.map((point) => point.id) }, UNINDEXED] },
159
+ limit: markerMatched.length, with_payload: false, with_vector: false,
160
+ })).points.map((point) => String(point.id)));
161
+ const candidates = markerMatched.filter((point) => !unindexed.has(String(point.id)));
162
+ const proofs = new Map();
163
+ for (let i = 0; i < candidates.length; i += CONTENT_BATCH) {
164
+ const batch = candidates.slice(i, i + CONTENT_BATCH).map((point) => point.id);
165
+ for (const point of await client.retrieve(collection, { ids: batch, with_payload: INPUT_FIELDS, with_vector: false })) {
166
+ const payload = (point.payload ?? {});
167
+ if (typeof payload.content !== 'string')
168
+ continue;
169
+ const hash = nodeEmbeddingInputHash(payload);
170
+ if (hash)
171
+ proofs.set(String(point.id), hash);
172
+ }
173
+ }
174
+ const now = deps.now();
175
+ const operations = [];
176
+ const staleIds = [];
177
+ const missingIds = [];
178
+ for (const point of page.points) {
179
+ const hash = proofs.get(String(point.id));
180
+ if (hash && lock?.mode === 'dense') {
181
+ operations.push({ set_payload: { points: [point.id], payload: {
182
+ embedding_status: 'current', embedding_input_hash: hash, embedding_generation: lock.generation, embedding_updated_at: now,
183
+ } } });
184
+ }
185
+ else if (withVector.has(String(point.id)))
186
+ staleIds.push(point.id);
187
+ else
188
+ missingIds.push(point.id);
189
+ }
190
+ if (staleIds.length)
191
+ operations.push({ set_payload: { points: staleIds, payload: { embedding_status: 'stale' } } });
192
+ if (missingIds.length)
193
+ operations.push({ set_payload: { points: missingIds, payload: { embedding_status: 'missing' } } });
194
+ await send(false);
195
+ unsent = operations;
196
+ adopted += proofs.size;
197
+ stale += staleIds.length;
198
+ missing += missingIds.length;
199
+ marked += page.points.length;
200
+ if (marked - reported >= PROGRESS_EVERY) {
201
+ reported = marked;
202
+ ctx.log(`vector index ${collection}: ${marked} / ${total} points marked (${Math.round((Date.now() - started) / 1000)} s)`);
203
+ }
204
+ offset = offsetOf(page.next_page_offset);
205
+ } while (offset !== undefined);
206
+ await send(true);
207
+ const left = (await client.count(collection, { filter: UNPROVEN, exact: true })).count;
208
+ if (left > 0)
209
+ throw new Error(`vector index ${collection}: ${left} point(s) still carry no embedding proof — run the command again`);
210
+ ctx.log(`vector index ${collection}: ${adopted} adopted, ${stale} stale, ${missing} missing (${Math.round((Date.now() - started) / 1000)} s)`);
211
+ },
212
+ };
213
+ }
214
+ const vectorProofV1 = createVectorProofUpgrade({
215
+ client: () => getQdrantClient(),
216
+ infraMode: () => inferInfraModeFromEnv(),
217
+ now: () => new Date().toISOString(),
218
+ });
219
+ export default vectorProofV1;
220
+ //# sourceMappingURL=vectorProofV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectorProofV1.js","sourceRoot":"","sources":["../../scripts/vectorProofV1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAsB,MA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,CAAC,CAAC,CAAC,KAAK,CAAC;YACvF,IAAI,IAAI,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,UAAU,KAAK,IAAI,kEAAkE,CAAC,CAAC;YACrI,GAAG,CAAC,GAAG,CAAC,gBAAgB,UAAU,KAAK,OAAO,aAAa,KAAK,WAAW,OAAO,aAAa,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACjJ,CAAC;KAC6B,CAAC;AACnC,CAAC;AAED,MAAM,aAAa,GAAG,wBAAwB,CAAC;IAC7C,MAAM,EAAE,GAAG,EAAE,CAAC,eAAe,EAAkC;IAC/D,SAAS,EAAE,GAAG,EAAE,CAAC,qBAAqB,EAAE;IACxC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;CACpC,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
@@ -138,6 +138,17 @@ export declare function resolveTargetEmbeddingShape(): {
138
138
  info: EmbeddingModelInfo;
139
139
  dimension: number;
140
140
  };
141
+ /** Embedding intent is a live config read; disabled means zero model/key resolution. */
142
+ export declare function embeddingEnabled(): boolean;
143
+ export declare class EmbeddingDisabledError extends Error {
144
+ readonly code: 'embedding_disabled';
145
+ constructor();
146
+ }
147
+ export declare class EmbeddingMetadataOnlyError extends Error {
148
+ readonly code: 'embedding_metadata_only';
149
+ constructor();
150
+ }
151
+ export declare function requireEmbeddingEnabled(): void;
141
152
  /** The generation identity a model + dimension writes (what a lock records). */
142
153
  export declare function generationFor(info: EmbeddingModelInfo, dimension: number): EmbeddingGeneration;
143
154
  /**
@@ -166,4 +177,14 @@ export declare function resolveActiveEmbeddingShape(): Promise<{
166
177
  */
167
178
  export declare function resolveActiveEmbeddingConfig(): Promise<ResolvedEmbeddingConfig>;
168
179
  export declare function clearNeuralisEnvCache(): void;
180
+ export type EmbeddingUnavailableReason = 'network' | 'timeout' | 'credentials' | 'rate_limit' | 'quota' | 'provider' | 'model_missing';
181
+ /** Provider availability is separate from malformed input/output and local authorization. */
182
+ export declare class EmbeddingUnavailableError extends Error {
183
+ readonly reason: EmbeddingUnavailableReason;
184
+ readonly status?: number | undefined;
185
+ readonly code: 'embedding_unavailable';
186
+ constructor(reason: EmbeddingUnavailableReason, status?: number | undefined);
187
+ }
188
+ export declare function embeddingHttpUnavailable(status: number): EmbeddingUnavailableError | undefined;
189
+ export declare function embeddingTransportUnavailable(error: unknown): EmbeddingUnavailableError | undefined;
169
190
  //# sourceMappingURL=env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/config/env.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,sBAAsB,EAC5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,MAAM,MAAM,mBAAmB,GAAG;IAChC,iEAAiE;IACjE,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9B,mFAAmF;IACnF,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC5D,CAAC;AAIF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAG1E;AAED,wBAAgB,sBAAsB,IAAI,mBAAmB,GAAG,IAAI,CAEnE;AAED,8EAA8E;AAC9E,wBAAgB,yBAAyB,IAAI,MAAM,CAKlD;AAMD,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAI/C;AAED,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,uBAAuB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AC7C,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,uBAAuB,CAAC,CA6ClC;AAED;;;;GAIG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAQ5G;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAGrF;AAED,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,eAAe,CAAC;AAEvI,6FAA6F;AAC7F,qBAAa,yBAA0B,SAAQ,KAAK;IAEtC,QAAQ,CAAC,MAAM,EAAE,0BAA0B;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;IADjF,QAAQ,CAAC,IAAI,EAAG,uBAAuB,CAAU;IACjD,YAAqB,MAAM,EAAE,0BAA0B,EAAW,MAAM,CAAC,EAAE,MAAM,YAAA,EAGhF;CACF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS,CAO9F;AAED,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,GAAG,SAAS,CAQnG"}
@@ -249,6 +249,22 @@ export function resolveTargetEmbeddingShape() {
249
249
  }
250
250
  return { info, dimension };
251
251
  }
252
+ /** Embedding intent is a live config read; disabled means zero model/key resolution. */
253
+ export function embeddingEnabled() {
254
+ return getBrainConfigBoolean('embeddingEnabled', undefined, true);
255
+ }
256
+ export class EmbeddingDisabledError extends Error {
257
+ code = 'embedding_disabled';
258
+ constructor() { super('EMBEDDING_DISABLED'); this.name = 'EmbeddingDisabledError'; }
259
+ }
260
+ export class EmbeddingMetadataOnlyError extends Error {
261
+ code = 'embedding_metadata_only';
262
+ constructor() { super('EMBEDDING_METADATA_ONLY: activate a dense generation explicitly'); this.name = 'EmbeddingMetadataOnlyError'; }
263
+ }
264
+ export function requireEmbeddingEnabled() {
265
+ if (!embeddingEnabled())
266
+ throw new EmbeddingDisabledError();
267
+ }
252
268
  /** The generation identity a model + dimension writes (what a lock records). */
253
269
  export function generationFor(info, dimension) {
254
270
  return {
@@ -270,6 +286,7 @@ export function generationFor(info, dimension) {
270
286
  * REGRESSION (owner decision 2026-08-03); the `embeddingPlatformScope` guard pins it.
271
287
  */
272
288
  export async function resolveEmbeddingConfigFor(info, dimension) {
289
+ requireEmbeddingEnabled();
273
290
  const provider = brainConfigProvider;
274
291
  let apiKey;
275
292
  if (info.credentialId) {
@@ -317,9 +334,12 @@ export async function resolveEmbeddingConfigFor(info, dimension) {
317
334
  * when the locked model is gone.
318
335
  */
319
336
  export async function resolveActiveEmbeddingShape() {
337
+ requireEmbeddingEnabled();
320
338
  const lock = await getActiveLock(resolveNeuralisHome().appRoot);
321
339
  if (!lock)
322
340
  return resolveTargetEmbeddingShape();
341
+ if (lock.mode === 'metadata')
342
+ throw new EmbeddingMetadataOnlyError();
323
343
  const info = resolveEmbeddingModel(lock.modelId);
324
344
  if (!info)
325
345
  throw new ActiveEmbeddingModelUnresolvableError(lock.modelId);
@@ -336,4 +356,39 @@ export async function resolveActiveEmbeddingConfig() {
336
356
  export function clearNeuralisEnvCache() {
337
357
  cachedEnv = null;
338
358
  }
359
+ /** Provider availability is separate from malformed input/output and local authorization. */
360
+ export class EmbeddingUnavailableError extends Error {
361
+ reason;
362
+ status;
363
+ code = 'embedding_unavailable';
364
+ constructor(reason, status) {
365
+ super(`EMBEDDING_UNAVAILABLE:${reason}${status === undefined ? '' : `:${status}`}`);
366
+ this.reason = reason;
367
+ this.status = status;
368
+ this.name = 'EmbeddingUnavailableError';
369
+ }
370
+ }
371
+ export function embeddingHttpUnavailable(status) {
372
+ if (status === 401 || status === 403)
373
+ return new EmbeddingUnavailableError('credentials', status);
374
+ // 402 Payment Required: the account is out of credit (Gemini "prepayment depleted"); only a top-up drains it.
375
+ if (status === 402)
376
+ return new EmbeddingUnavailableError('quota', status);
377
+ if (status === 429)
378
+ return new EmbeddingUnavailableError('rate_limit', status);
379
+ if (status >= 500 && status < 600)
380
+ return new EmbeddingUnavailableError('provider', status);
381
+ return undefined;
382
+ }
383
+ export function embeddingTransportUnavailable(error) {
384
+ if (error instanceof Error && error.name === 'TimeoutError')
385
+ return new EmbeddingUnavailableError('timeout');
386
+ if (error instanceof TypeError) {
387
+ const cause = error.cause;
388
+ const code = cause && typeof cause === 'object' && 'code' in cause ? cause.code : undefined;
389
+ if (error.message === 'fetch failed' || typeof code === 'string' && ['UND_ERR_SOCKET', 'ECONNRESET', 'ECONNREFUSED', 'ETIMEDOUT', 'ENOTFOUND', 'EAI_AGAIN'].includes(code))
390
+ return new EmbeddingUnavailableError('network');
391
+ }
392
+ return undefined;
393
+ }
339
394
  //# sourceMappingURL=env.js.map