lmgrep 0.1.18 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/README.md +226 -63
  2. package/completions/_lmgrep +49 -40
  3. package/dist/application/Lmgrep.d.ts +107 -0
  4. package/dist/application/Lmgrep.js +99 -0
  5. package/dist/application/Lmgrep.js.map +1 -0
  6. package/dist/application/LmgrepFactory.d.ts +40 -0
  7. package/dist/application/LmgrepFactory.js +155 -0
  8. package/dist/application/LmgrepFactory.js.map +1 -0
  9. package/dist/application/indexing/BranchBootstrapper.d.ts +21 -0
  10. package/dist/application/indexing/BranchBootstrapper.js +52 -0
  11. package/dist/application/indexing/BranchBootstrapper.js.map +1 -0
  12. package/dist/application/indexing/BranchManifestSweeper.d.ts +17 -0
  13. package/dist/application/indexing/BranchManifestSweeper.js +35 -0
  14. package/dist/application/indexing/BranchManifestSweeper.js.map +1 -0
  15. package/dist/application/indexing/Duration.d.ts +9 -0
  16. package/dist/application/indexing/Duration.js +25 -0
  17. package/dist/application/indexing/Duration.js.map +1 -0
  18. package/dist/application/indexing/EmbeddingAbortError.d.ts +11 -0
  19. package/dist/application/indexing/EmbeddingAbortError.js +20 -0
  20. package/dist/application/indexing/EmbeddingAbortError.js.map +1 -0
  21. package/dist/application/indexing/EmbeddingPipeline.d.ts +59 -0
  22. package/dist/application/indexing/EmbeddingPipeline.js +140 -0
  23. package/dist/application/indexing/EmbeddingPipeline.js.map +1 -0
  24. package/dist/application/indexing/IndexBuilder.d.ts +112 -0
  25. package/dist/application/indexing/IndexBuilder.js +370 -0
  26. package/dist/application/indexing/IndexBuilder.js.map +1 -0
  27. package/dist/application/indexing/IndexingProgress.d.ts +34 -0
  28. package/dist/application/indexing/IndexingProgress.js +2 -0
  29. package/dist/application/indexing/IndexingProgress.js.map +1 -0
  30. package/dist/application/operations/Deadline.d.ts +13 -0
  31. package/dist/application/operations/Deadline.js +29 -0
  32. package/dist/application/operations/Deadline.js.map +1 -0
  33. package/dist/application/operations/HealthMonitor.d.ts +58 -0
  34. package/dist/application/operations/HealthMonitor.js +128 -0
  35. package/dist/application/operations/HealthMonitor.js.map +1 -0
  36. package/dist/application/operations/IndexAlternatives.d.ts +35 -0
  37. package/dist/application/operations/IndexAlternatives.js +61 -0
  38. package/dist/application/operations/IndexAlternatives.js.map +1 -0
  39. package/dist/application/operations/IndexInventory.d.ts +69 -0
  40. package/dist/application/operations/IndexInventory.js +99 -0
  41. package/dist/application/operations/IndexInventory.js.map +1 -0
  42. package/dist/application/operations/StatusService.d.ts +90 -0
  43. package/dist/application/operations/StatusService.js +171 -0
  44. package/dist/application/operations/StatusService.js.map +1 -0
  45. package/dist/application/operations/WatchService.d.ts +67 -0
  46. package/dist/application/operations/WatchService.js +145 -0
  47. package/dist/application/operations/WatchService.js.map +1 -0
  48. package/dist/application/operations/WorkingTreeDiff.d.ts +19 -0
  49. package/dist/application/operations/WorkingTreeDiff.js +36 -0
  50. package/dist/application/operations/WorkingTreeDiff.js.map +1 -0
  51. package/dist/application/research/ResearchAgent.d.ts +68 -0
  52. package/dist/application/research/ResearchAgent.js +201 -0
  53. package/dist/application/research/ResearchAgent.js.map +1 -0
  54. package/dist/application/research/ResearchPrompts.d.ts +16 -0
  55. package/dist/application/research/ResearchPrompts.js +34 -0
  56. package/dist/application/research/ResearchPrompts.js.map +1 -0
  57. package/dist/application/search/SearchCriteria.d.ts +37 -0
  58. package/dist/application/search/SearchCriteria.js +48 -0
  59. package/dist/application/search/SearchCriteria.js.map +1 -0
  60. package/dist/application/search/SearchService.d.ts +36 -0
  61. package/dist/application/search/SearchService.js +108 -0
  62. package/dist/application/search/SearchService.js.map +1 -0
  63. package/dist/application/search/SearchTargetResolver.d.ts +56 -0
  64. package/dist/application/search/SearchTargetResolver.js +104 -0
  65. package/dist/application/search/SearchTargetResolver.js.map +1 -0
  66. package/dist/cli.d.ts +1 -1
  67. package/dist/cli.js +4 -953
  68. package/dist/cli.js.map +1 -1
  69. package/dist/domain/config/ConfigSource.d.ts +16 -0
  70. package/dist/domain/config/ConfigSource.js +2 -0
  71. package/dist/domain/config/ConfigSource.js.map +1 -0
  72. package/dist/domain/config/LmgrepConfig.d.ts +53 -0
  73. package/dist/domain/config/LmgrepConfig.js +2 -0
  74. package/dist/domain/config/LmgrepConfig.js.map +1 -0
  75. package/dist/domain/corpus/Chunk.d.ts +49 -0
  76. package/dist/domain/corpus/Chunk.js +60 -0
  77. package/dist/domain/corpus/Chunk.js.map +1 -0
  78. package/dist/domain/corpus/CodeLocation.d.ts +18 -0
  79. package/dist/domain/corpus/CodeLocation.js +34 -0
  80. package/dist/domain/corpus/CodeLocation.js.map +1 -0
  81. package/dist/domain/corpus/ContentHash.d.ts +15 -0
  82. package/dist/domain/corpus/ContentHash.js +30 -0
  83. package/dist/domain/corpus/ContentHash.js.map +1 -0
  84. package/dist/domain/corpus/FileVersion.d.ts +31 -0
  85. package/dist/domain/corpus/FileVersion.js +47 -0
  86. package/dist/domain/corpus/FileVersion.js.map +1 -0
  87. package/dist/domain/corpus/SourceFile.d.ts +26 -0
  88. package/dist/domain/corpus/SourceFile.js +47 -0
  89. package/dist/domain/corpus/SourceFile.js.map +1 -0
  90. package/dist/domain/corpus/Vector.d.ts +37 -0
  91. package/dist/domain/corpus/Vector.js +96 -0
  92. package/dist/domain/corpus/Vector.js.map +1 -0
  93. package/dist/domain/ports/ChatModelPort.d.ts +57 -0
  94. package/dist/domain/ports/ChatModelPort.js +2 -0
  95. package/dist/domain/ports/ChatModelPort.js.map +1 -0
  96. package/dist/domain/ports/ChunkRepositoryPort.d.ts +42 -0
  97. package/dist/domain/ports/ChunkRepositoryPort.js +2 -0
  98. package/dist/domain/ports/ChunkRepositoryPort.js.map +1 -0
  99. package/dist/domain/ports/ChunkerPort.d.ts +5 -0
  100. package/dist/domain/ports/ChunkerPort.js +2 -0
  101. package/dist/domain/ports/ChunkerPort.js.map +1 -0
  102. package/dist/domain/ports/DatabaseSessionPort.d.ts +10 -0
  103. package/dist/domain/ports/DatabaseSessionPort.js +2 -0
  104. package/dist/domain/ports/DatabaseSessionPort.js.map +1 -0
  105. package/dist/domain/ports/EmbedderPort.d.ts +14 -0
  106. package/dist/domain/ports/EmbedderPort.js +2 -0
  107. package/dist/domain/ports/EmbedderPort.js.map +1 -0
  108. package/dist/domain/ports/FileManifestRepositoryPort.d.ts +32 -0
  109. package/dist/domain/ports/FileManifestRepositoryPort.js +2 -0
  110. package/dist/domain/ports/FileManifestRepositoryPort.js.map +1 -0
  111. package/dist/domain/ports/GitPort.d.ts +24 -0
  112. package/dist/domain/ports/GitPort.js +2 -0
  113. package/dist/domain/ports/GitPort.js.map +1 -0
  114. package/dist/domain/ports/IndexMaintenancePort.d.ts +58 -0
  115. package/dist/domain/ports/IndexMaintenancePort.js +2 -0
  116. package/dist/domain/ports/IndexMaintenancePort.js.map +1 -0
  117. package/dist/domain/ports/IndexMetadataPort.d.ts +23 -0
  118. package/dist/domain/ports/IndexMetadataPort.js +2 -0
  119. package/dist/domain/ports/IndexMetadataPort.js.map +1 -0
  120. package/dist/domain/ports/LockPort.d.ts +17 -0
  121. package/dist/domain/ports/LockPort.js +2 -0
  122. package/dist/domain/ports/LockPort.js.map +1 -0
  123. package/dist/domain/ports/LoggerPort.d.ts +5 -0
  124. package/dist/domain/ports/LoggerPort.js +2 -0
  125. package/dist/domain/ports/LoggerPort.js.map +1 -0
  126. package/dist/domain/ports/ProjectIndexesPort.d.ts +20 -0
  127. package/dist/domain/ports/ProjectIndexesPort.js +2 -0
  128. package/dist/domain/ports/ProjectIndexesPort.js.map +1 -0
  129. package/dist/domain/ports/ProjectRegistryPort.d.ts +42 -0
  130. package/dist/domain/ports/ProjectRegistryPort.js +2 -0
  131. package/dist/domain/ports/ProjectRegistryPort.js.map +1 -0
  132. package/dist/domain/ports/StateDirectoryPort.d.ts +29 -0
  133. package/dist/domain/ports/StateDirectoryPort.js +2 -0
  134. package/dist/domain/ports/StateDirectoryPort.js.map +1 -0
  135. package/dist/domain/ports/WorkspacePort.d.ts +38 -0
  136. package/dist/domain/ports/WorkspacePort.js +2 -0
  137. package/dist/domain/ports/WorkspacePort.js.map +1 -0
  138. package/dist/domain/project/Branch.d.ts +20 -0
  139. package/dist/domain/project/Branch.js +33 -0
  140. package/dist/domain/project/Branch.js.map +1 -0
  141. package/dist/domain/project/DatabaseLocation.d.ts +32 -0
  142. package/dist/domain/project/DatabaseLocation.js +35 -0
  143. package/dist/domain/project/DatabaseLocation.js.map +1 -0
  144. package/dist/domain/project/IndexMetadata.d.ts +17 -0
  145. package/dist/domain/project/IndexMetadata.js +2 -0
  146. package/dist/domain/project/IndexMetadata.js.map +1 -0
  147. package/dist/domain/project/ModelIdentity.d.ts +58 -0
  148. package/dist/domain/project/ModelIdentity.js +97 -0
  149. package/dist/domain/project/ModelIdentity.js.map +1 -0
  150. package/dist/domain/project/Project.d.ts +17 -0
  151. package/dist/domain/project/Project.js +21 -0
  152. package/dist/domain/project/Project.js.map +1 -0
  153. package/dist/domain/project/ProjectId.d.ts +28 -0
  154. package/dist/domain/project/ProjectId.js +58 -0
  155. package/dist/domain/project/ProjectId.js.map +1 -0
  156. package/dist/domain/project/ProjectLocator.d.ts +112 -0
  157. package/dist/domain/project/ProjectLocator.js +178 -0
  158. package/dist/domain/project/ProjectLocator.js.map +1 -0
  159. package/dist/domain/research/Citation.d.ts +27 -0
  160. package/dist/domain/research/Citation.js +43 -0
  161. package/dist/domain/research/Citation.js.map +1 -0
  162. package/dist/domain/research/EvidenceLedger.d.ts +47 -0
  163. package/dist/domain/research/EvidenceLedger.js +111 -0
  164. package/dist/domain/research/EvidenceLedger.js.map +1 -0
  165. package/dist/domain/research/ResearchTrace.d.ts +19 -0
  166. package/dist/domain/research/ResearchTrace.js +22 -0
  167. package/dist/domain/research/ResearchTrace.js.map +1 -0
  168. package/dist/domain/retrieval/Hit.d.ts +19 -0
  169. package/dist/domain/retrieval/Hit.js +28 -0
  170. package/dist/domain/retrieval/Hit.js.map +1 -0
  171. package/dist/domain/retrieval/HitList.d.ts +35 -0
  172. package/dist/domain/retrieval/HitList.js +81 -0
  173. package/dist/domain/retrieval/HitList.js.map +1 -0
  174. package/dist/domain/retrieval/MissingIndexError.d.ts +11 -0
  175. package/dist/domain/retrieval/MissingIndexError.js +15 -0
  176. package/dist/domain/retrieval/MissingIndexError.js.map +1 -0
  177. package/dist/index.d.ts +43 -45
  178. package/dist/index.js +30 -567
  179. package/dist/index.js.map +1 -1
  180. package/dist/infrastructure/ai/AiSdkChatModel.d.ts +31 -0
  181. package/dist/infrastructure/ai/AiSdkChatModel.js +137 -0
  182. package/dist/infrastructure/ai/AiSdkChatModel.js.map +1 -0
  183. package/dist/infrastructure/ai/AiSdkEmbedder.d.ts +28 -0
  184. package/dist/infrastructure/ai/AiSdkEmbedder.js +79 -0
  185. package/dist/infrastructure/ai/AiSdkEmbedder.js.map +1 -0
  186. package/dist/infrastructure/ai/EmbeddingPrefixes.d.ts +21 -0
  187. package/dist/infrastructure/ai/EmbeddingPrefixes.js +40 -0
  188. package/dist/infrastructure/ai/EmbeddingPrefixes.js.map +1 -0
  189. package/dist/infrastructure/ai/LmStudioProbe.d.ts +18 -0
  190. package/dist/infrastructure/ai/LmStudioProbe.js +49 -0
  191. package/dist/infrastructure/ai/LmStudioProbe.js.map +1 -0
  192. package/dist/infrastructure/ai/LocalModelReloader.d.ts +21 -0
  193. package/dist/infrastructure/ai/LocalModelReloader.js +61 -0
  194. package/dist/infrastructure/ai/LocalModelReloader.js.map +1 -0
  195. package/dist/infrastructure/ai/LocalRuntimeDetector.d.ts +36 -0
  196. package/dist/infrastructure/ai/LocalRuntimeDetector.js +61 -0
  197. package/dist/infrastructure/ai/LocalRuntimeDetector.js.map +1 -0
  198. package/dist/infrastructure/ai/ModelRuntime.d.ts +32 -0
  199. package/dist/infrastructure/ai/ModelRuntime.js +2 -0
  200. package/dist/infrastructure/ai/ModelRuntime.js.map +1 -0
  201. package/dist/infrastructure/ai/OllamaProbe.d.ts +21 -0
  202. package/dist/infrastructure/ai/OllamaProbe.js +69 -0
  203. package/dist/infrastructure/ai/OllamaProbe.js.map +1 -0
  204. package/dist/infrastructure/ai/ProviderFailure.d.ts +16 -0
  205. package/dist/infrastructure/ai/ProviderFailure.js +35 -0
  206. package/dist/infrastructure/ai/ProviderFailure.js.map +1 -0
  207. package/dist/infrastructure/ai/ProviderModuleLoader.d.ts +13 -0
  208. package/dist/infrastructure/ai/ProviderModuleLoader.js +49 -0
  209. package/dist/infrastructure/ai/ProviderModuleLoader.js.map +1 -0
  210. package/dist/infrastructure/ai/ProviderRegistry.d.ts +37 -0
  211. package/dist/infrastructure/ai/ProviderRegistry.js +55 -0
  212. package/dist/infrastructure/ai/ProviderRegistry.js.map +1 -0
  213. package/dist/infrastructure/fs/ConfigLoader.d.ts +59 -0
  214. package/dist/infrastructure/fs/ConfigLoader.js +194 -0
  215. package/dist/infrastructure/fs/ConfigLoader.js.map +1 -0
  216. package/dist/infrastructure/fs/DatabaseLocks.d.ts +52 -0
  217. package/dist/infrastructure/fs/DatabaseLocks.js +92 -0
  218. package/dist/infrastructure/fs/DatabaseLocks.js.map +1 -0
  219. package/dist/infrastructure/fs/DiskUsage.d.ts +6 -0
  220. package/dist/infrastructure/fs/DiskUsage.js +41 -0
  221. package/dist/infrastructure/fs/DiskUsage.js.map +1 -0
  222. package/dist/infrastructure/fs/IndexableFileRules.d.ts +33 -0
  223. package/dist/infrastructure/fs/IndexableFileRules.js +177 -0
  224. package/dist/infrastructure/fs/IndexableFileRules.js.map +1 -0
  225. package/dist/infrastructure/fs/Loggers.d.ts +14 -0
  226. package/dist/infrastructure/fs/Loggers.js +18 -0
  227. package/dist/infrastructure/fs/Loggers.js.map +1 -0
  228. package/dist/infrastructure/fs/PidFileLock.d.ts +40 -0
  229. package/dist/infrastructure/fs/PidFileLock.js +97 -0
  230. package/dist/infrastructure/fs/PidFileLock.js.map +1 -0
  231. package/dist/infrastructure/fs/ProjectIndexes.d.ts +8 -0
  232. package/dist/infrastructure/fs/ProjectIndexes.js +35 -0
  233. package/dist/infrastructure/fs/ProjectIndexes.js.map +1 -0
  234. package/dist/infrastructure/fs/ProjectMetadataStore.d.ts +42 -0
  235. package/dist/infrastructure/fs/ProjectMetadataStore.js +86 -0
  236. package/dist/infrastructure/fs/ProjectMetadataStore.js.map +1 -0
  237. package/dist/infrastructure/fs/ProjectRegistry.d.ts +25 -0
  238. package/dist/infrastructure/fs/ProjectRegistry.js +83 -0
  239. package/dist/infrastructure/fs/ProjectRegistry.js.map +1 -0
  240. package/dist/infrastructure/fs/StateDirectory.d.ts +28 -0
  241. package/dist/infrastructure/fs/StateDirectory.js +71 -0
  242. package/dist/infrastructure/fs/StateDirectory.js.map +1 -0
  243. package/dist/infrastructure/fs/Workspace.d.ts +25 -0
  244. package/dist/infrastructure/fs/Workspace.js +90 -0
  245. package/dist/infrastructure/fs/Workspace.js.map +1 -0
  246. package/dist/infrastructure/git/GitClient.d.ts +34 -0
  247. package/dist/infrastructure/git/GitClient.js +74 -0
  248. package/dist/infrastructure/git/GitClient.js.map +1 -0
  249. package/dist/infrastructure/lancedb/ChunkRepository.d.ts +38 -0
  250. package/dist/infrastructure/lancedb/ChunkRepository.js +166 -0
  251. package/dist/infrastructure/lancedb/ChunkRepository.js.map +1 -0
  252. package/dist/infrastructure/lancedb/DatabaseImporter.d.ts +22 -0
  253. package/dist/infrastructure/lancedb/DatabaseImporter.js +74 -0
  254. package/dist/infrastructure/lancedb/DatabaseImporter.js.map +1 -0
  255. package/dist/infrastructure/lancedb/FileManifestRepository.d.ts +34 -0
  256. package/dist/infrastructure/lancedb/FileManifestRepository.js +137 -0
  257. package/dist/infrastructure/lancedb/FileManifestRepository.js.map +1 -0
  258. package/dist/infrastructure/lancedb/IndexMaintenance.d.ts +53 -0
  259. package/dist/infrastructure/lancedb/IndexMaintenance.js +227 -0
  260. package/dist/infrastructure/lancedb/IndexMaintenance.js.map +1 -0
  261. package/dist/infrastructure/lancedb/LanceTables.d.ts +67 -0
  262. package/dist/infrastructure/lancedb/LanceTables.js +159 -0
  263. package/dist/infrastructure/lancedb/LanceTables.js.map +1 -0
  264. package/dist/{lib/native-tuning.js → infrastructure/lancedb/NativeTuning.js} +1 -1
  265. package/dist/infrastructure/lancedb/NativeTuning.js.map +1 -0
  266. package/dist/infrastructure/lancedb/RowReplication.d.ts +27 -0
  267. package/dist/infrastructure/lancedb/RowReplication.js +82 -0
  268. package/dist/infrastructure/lancedb/RowReplication.js.map +1 -0
  269. package/dist/infrastructure/lancedb/VectorIndexPolicy.d.ts +60 -0
  270. package/dist/infrastructure/lancedb/VectorIndexPolicy.js +72 -0
  271. package/dist/infrastructure/lancedb/VectorIndexPolicy.js.map +1 -0
  272. package/dist/infrastructure/p2p/IndexShare.d.ts +45 -0
  273. package/dist/infrastructure/p2p/IndexShare.js +160 -0
  274. package/dist/infrastructure/p2p/IndexShare.js.map +1 -0
  275. package/dist/infrastructure/p2p/PeerSwarm.d.ts +16 -0
  276. package/dist/infrastructure/p2p/PeerSwarm.js +41 -0
  277. package/dist/infrastructure/p2p/PeerSwarm.js.map +1 -0
  278. package/dist/infrastructure/p2p/SecureChannel.d.ts +60 -0
  279. package/dist/infrastructure/p2p/SecureChannel.js +71 -0
  280. package/dist/infrastructure/p2p/SecureChannel.js.map +1 -0
  281. package/dist/infrastructure/p2p/ShareCode.d.ts +25 -0
  282. package/dist/infrastructure/p2p/ShareCode.js +304 -0
  283. package/dist/infrastructure/p2p/ShareCode.js.map +1 -0
  284. package/dist/infrastructure/process/ProcessRegistry.d.ts +50 -0
  285. package/dist/infrastructure/process/ProcessRegistry.js +109 -0
  286. package/dist/infrastructure/process/ProcessRegistry.js.map +1 -0
  287. package/dist/infrastructure/treesitter/ChunkContextBuilder.d.ts +45 -0
  288. package/dist/infrastructure/treesitter/ChunkContextBuilder.js +159 -0
  289. package/dist/infrastructure/treesitter/ChunkContextBuilder.js.map +1 -0
  290. package/dist/infrastructure/treesitter/LanguageCatalog.d.ts +30 -0
  291. package/dist/{lib/chunker/languages.js → infrastructure/treesitter/LanguageCatalog.js} +34 -29
  292. package/dist/infrastructure/treesitter/LanguageCatalog.js.map +1 -0
  293. package/dist/infrastructure/treesitter/SlidingWindowChunker.d.ts +15 -0
  294. package/dist/infrastructure/treesitter/SlidingWindowChunker.js +42 -0
  295. package/dist/infrastructure/treesitter/SlidingWindowChunker.js.map +1 -0
  296. package/dist/infrastructure/treesitter/TreeSitterChunker.d.ts +42 -0
  297. package/dist/infrastructure/treesitter/TreeSitterChunker.js +163 -0
  298. package/dist/infrastructure/treesitter/TreeSitterChunker.js.map +1 -0
  299. package/dist/mcp.d.ts +1 -1
  300. package/dist/mcp.js +14 -72
  301. package/dist/mcp.js.map +1 -1
  302. package/dist/presentation/cli/Cli.d.ts +31 -0
  303. package/dist/presentation/cli/Cli.js +120 -0
  304. package/dist/presentation/cli/Cli.js.map +1 -0
  305. package/dist/presentation/cli/CliOptions.d.ts +18 -0
  306. package/dist/presentation/cli/CliOptions.js +25 -0
  307. package/dist/presentation/cli/CliOptions.js.map +1 -0
  308. package/dist/presentation/cli/CommandContext.d.ts +50 -0
  309. package/dist/presentation/cli/CommandContext.js +88 -0
  310. package/dist/presentation/cli/CommandContext.js.map +1 -0
  311. package/dist/presentation/cli/ConfigTemplate.d.ts +31 -0
  312. package/dist/presentation/cli/ConfigTemplate.js +83 -0
  313. package/dist/presentation/cli/ConfigTemplate.js.map +1 -0
  314. package/dist/presentation/cli/Renderer.d.ts +90 -0
  315. package/dist/presentation/cli/Renderer.js +290 -0
  316. package/dist/presentation/cli/Renderer.js.map +1 -0
  317. package/dist/presentation/cli/commands/AskCommand.d.ts +14 -0
  318. package/dist/presentation/cli/commands/AskCommand.js +48 -0
  319. package/dist/presentation/cli/commands/AskCommand.js.map +1 -0
  320. package/dist/presentation/cli/commands/CompletionsCommand.d.ts +18 -0
  321. package/dist/presentation/cli/commands/CompletionsCommand.js +96 -0
  322. package/dist/presentation/cli/commands/CompletionsCommand.js.map +1 -0
  323. package/dist/presentation/cli/commands/ConfigCommands.d.ts +55 -0
  324. package/dist/presentation/cli/commands/ConfigCommands.js +204 -0
  325. package/dist/presentation/cli/commands/ConfigCommands.js.map +1 -0
  326. package/dist/presentation/cli/commands/IndexCommand.d.ts +18 -0
  327. package/dist/presentation/cli/commands/IndexCommand.js +54 -0
  328. package/dist/presentation/cli/commands/IndexCommand.js.map +1 -0
  329. package/dist/presentation/cli/commands/ProjectsCommand.d.ts +48 -0
  330. package/dist/presentation/cli/commands/ProjectsCommand.js +240 -0
  331. package/dist/presentation/cli/commands/ProjectsCommand.js.map +1 -0
  332. package/dist/presentation/cli/commands/SearchCommand.d.ts +19 -0
  333. package/dist/presentation/cli/commands/SearchCommand.js +55 -0
  334. package/dist/presentation/cli/commands/SearchCommand.js.map +1 -0
  335. package/dist/presentation/cli/commands/ServerCommands.d.ts +13 -0
  336. package/dist/presentation/cli/commands/ServerCommands.js +40 -0
  337. package/dist/presentation/cli/commands/ServerCommands.js.map +1 -0
  338. package/dist/presentation/cli/commands/ShareCommands.d.ts +22 -0
  339. package/dist/presentation/cli/commands/ShareCommands.js +134 -0
  340. package/dist/presentation/cli/commands/ShareCommands.js.map +1 -0
  341. package/dist/presentation/cli/commands/StatusCommand.d.ts +15 -0
  342. package/dist/presentation/cli/commands/StatusCommand.js +53 -0
  343. package/dist/presentation/cli/commands/StatusCommand.js.map +1 -0
  344. package/dist/presentation/mcp/HitFormatter.d.ts +17 -0
  345. package/dist/presentation/mcp/HitFormatter.js +42 -0
  346. package/dist/presentation/mcp/HitFormatter.js.map +1 -0
  347. package/dist/presentation/mcp/IndexWatchController.d.ts +17 -0
  348. package/dist/presentation/mcp/IndexWatchController.js +31 -0
  349. package/dist/presentation/mcp/IndexWatchController.js.map +1 -0
  350. package/dist/presentation/mcp/LmgrepCore.d.ts +66 -0
  351. package/dist/presentation/mcp/LmgrepCore.js +178 -0
  352. package/dist/presentation/mcp/LmgrepCore.js.map +1 -0
  353. package/dist/presentation/mcp/McpServer.d.ts +18 -0
  354. package/dist/presentation/mcp/McpServer.js +63 -0
  355. package/dist/presentation/mcp/McpServer.js.map +1 -0
  356. package/dist/presentation/mcp/ToolDescriptions.d.ts +40 -0
  357. package/dist/presentation/mcp/ToolDescriptions.js +85 -0
  358. package/dist/presentation/mcp/ToolDescriptions.js.map +1 -0
  359. package/package.json +84 -89
  360. package/dist/lib/build.d.ts +0 -21
  361. package/dist/lib/build.js +0 -374
  362. package/dist/lib/build.js.map +0 -1
  363. package/dist/lib/chunker/context.d.ts +0 -21
  364. package/dist/lib/chunker/context.js +0 -131
  365. package/dist/lib/chunker/context.js.map +0 -1
  366. package/dist/lib/chunker/index.d.ts +0 -7
  367. package/dist/lib/chunker/index.js +0 -209
  368. package/dist/lib/chunker/index.js.map +0 -1
  369. package/dist/lib/chunker/languages.d.ts +0 -15
  370. package/dist/lib/chunker/languages.js.map +0 -1
  371. package/dist/lib/config.d.ts +0 -12
  372. package/dist/lib/config.js +0 -83
  373. package/dist/lib/config.js.map +0 -1
  374. package/dist/lib/embedder.d.ts +0 -65
  375. package/dist/lib/embedder.js +0 -236
  376. package/dist/lib/embedder.js.map +0 -1
  377. package/dist/lib/facet-session.d.ts +0 -44
  378. package/dist/lib/facet-session.js +0 -125
  379. package/dist/lib/facet-session.js.map +0 -1
  380. package/dist/lib/native-tuning.js.map +0 -1
  381. package/dist/lib/p2p.d.ts +0 -32
  382. package/dist/lib/p2p.js +0 -281
  383. package/dist/lib/p2p.js.map +0 -1
  384. package/dist/lib/providers.d.ts +0 -1
  385. package/dist/lib/providers.js +0 -41
  386. package/dist/lib/providers.js.map +0 -1
  387. package/dist/lib/repair.d.ts +0 -10
  388. package/dist/lib/repair.js +0 -57
  389. package/dist/lib/repair.js.map +0 -1
  390. package/dist/lib/scanner.d.ts +0 -34
  391. package/dist/lib/scanner.js +0 -242
  392. package/dist/lib/scanner.js.map +0 -1
  393. package/dist/lib/search-tool.d.ts +0 -55
  394. package/dist/lib/search-tool.js +0 -319
  395. package/dist/lib/search-tool.js.map +0 -1
  396. package/dist/lib/serve.d.ts +0 -11
  397. package/dist/lib/serve.js +0 -144
  398. package/dist/lib/serve.js.map +0 -1
  399. package/dist/lib/store.d.ts +0 -252
  400. package/dist/lib/store.js +0 -1216
  401. package/dist/lib/store.js.map +0 -1
  402. package/dist/lib/types.d.ts +0 -194
  403. package/dist/lib/types.js +0 -13
  404. package/dist/lib/types.js.map +0 -1
  405. package/dist/lib/vocab.d.ts +0 -20
  406. package/dist/lib/vocab.js +0 -275
  407. package/dist/lib/vocab.js.map +0 -1
  408. /package/dist/{lib/native-tuning.d.ts → infrastructure/lancedb/NativeTuning.d.ts} +0 -0
@@ -0,0 +1,32 @@
1
+ /** What a discovered model is good for. */
2
+ export type ModelKind = "embedding" | "chat" | "unknown";
3
+ export interface CatalogedModel {
4
+ id: string;
5
+ kind: ModelKind;
6
+ /**
7
+ * Currently loaded in the runtime.
8
+ *
9
+ * The strongest statement of intent available without asking: a model the
10
+ * user has deliberately loaded is the one they mean. Undefined when the
11
+ * runtime does not report load state.
12
+ */
13
+ loaded?: boolean;
14
+ }
15
+ /** A local inference server that was found listening. */
16
+ export interface DetectedRuntime {
17
+ /** Human name, for what `init` prints. */
18
+ label: string;
19
+ /** Provider segment of the `provider:model` string. */
20
+ providerId: string;
21
+ baseURL: string;
22
+ /**
23
+ * AI SDK package to load. Undefined means the default
24
+ * `@ai-sdk/<providerId>` is correct.
25
+ */
26
+ providerPackage?: string;
27
+ models: CatalogedModel[];
28
+ }
29
+ /** Detects one kind of local inference server. */
30
+ export interface RuntimeProbe {
31
+ detect(): Promise<DetectedRuntime | undefined>;
32
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ModelRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelRuntime.js","sourceRoot":"","sources":["../../../src/infrastructure/ai/ModelRuntime.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import type { DetectedRuntime, RuntimeProbe } from "./ModelRuntime.js";
2
+ /**
3
+ * Detects a local Ollama server.
4
+ *
5
+ * Ollama's tag listing does not say what a model is for, so kind is inferred
6
+ * from the name. That is a guess, and marked as one — `unknown` models are
7
+ * offered only when nothing better is found.
8
+ */
9
+ export declare class OllamaProbe implements RuntimeProbe {
10
+ private static readonly TAGS_URL;
11
+ /** Models currently resident in memory. */
12
+ private static readonly RUNNING_URL;
13
+ static readonly BASE_URL = "http://localhost:11434/v1";
14
+ private static readonly TIMEOUT_MS;
15
+ /** Name fragments that reliably indicate an embedding model. */
16
+ private static readonly EMBEDDING_HINTS;
17
+ detect(): Promise<DetectedRuntime | undefined>;
18
+ /** Best-effort; an older Ollama without this endpoint just reports none. */
19
+ private loadedModelNames;
20
+ private static looksLikeEmbedding;
21
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Detects a local Ollama server.
3
+ *
4
+ * Ollama's tag listing does not say what a model is for, so kind is inferred
5
+ * from the name. That is a guess, and marked as one — `unknown` models are
6
+ * offered only when nothing better is found.
7
+ */
8
+ export class OllamaProbe {
9
+ static TAGS_URL = "http://localhost:11434/api/tags";
10
+ /** Models currently resident in memory. */
11
+ static RUNNING_URL = "http://localhost:11434/api/ps";
12
+ static BASE_URL = "http://localhost:11434/v1";
13
+ static TIMEOUT_MS = 3000;
14
+ /** Name fragments that reliably indicate an embedding model. */
15
+ static EMBEDDING_HINTS = [
16
+ "embed",
17
+ "nomic",
18
+ "bge",
19
+ "minilm",
20
+ "gte-",
21
+ "e5-",
22
+ ];
23
+ async detect() {
24
+ let payload;
25
+ try {
26
+ const res = await fetch(OllamaProbe.TAGS_URL, {
27
+ signal: AbortSignal.timeout(OllamaProbe.TIMEOUT_MS),
28
+ });
29
+ if (!res.ok)
30
+ return undefined;
31
+ payload = (await res.json());
32
+ }
33
+ catch {
34
+ return undefined;
35
+ }
36
+ const loaded = await this.loadedModelNames();
37
+ const models = (payload.models ?? []).map((m) => ({
38
+ id: m.name,
39
+ kind: OllamaProbe.looksLikeEmbedding(m.name) ? "embedding" : "unknown",
40
+ loaded: loaded.has(m.name),
41
+ }));
42
+ return {
43
+ label: "Ollama",
44
+ providerId: "ollama",
45
+ baseURL: OllamaProbe.BASE_URL,
46
+ models,
47
+ };
48
+ }
49
+ /** Best-effort; an older Ollama without this endpoint just reports none. */
50
+ async loadedModelNames() {
51
+ try {
52
+ const res = await fetch(OllamaProbe.RUNNING_URL, {
53
+ signal: AbortSignal.timeout(OllamaProbe.TIMEOUT_MS),
54
+ });
55
+ if (!res.ok)
56
+ return new Set();
57
+ const payload = (await res.json());
58
+ return new Set((payload.models ?? []).map((m) => m.name));
59
+ }
60
+ catch {
61
+ return new Set();
62
+ }
63
+ }
64
+ static looksLikeEmbedding(name) {
65
+ const lower = name.toLowerCase();
66
+ return OllamaProbe.EMBEDDING_HINTS.some((hint) => lower.includes(hint));
67
+ }
68
+ }
69
+ //# sourceMappingURL=OllamaProbe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OllamaProbe.js","sourceRoot":"","sources":["../../../src/infrastructure/ai/OllamaProbe.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACf,MAAM,CAAU,QAAQ,GAAG,iCAAiC,CAAC;IACrE,2CAA2C;IACnC,MAAM,CAAU,WAAW,GAAG,+BAA+B,CAAC;IACtE,MAAM,CAAU,QAAQ,GAAG,2BAA2B,CAAC;IAC/C,MAAM,CAAU,UAAU,GAAG,IAAI,CAAC;IAE1C,gEAAgE;IACxD,MAAM,CAAU,eAAe,GAAG;QACzC,OAAO;QACP,OAAO;QACP,KAAK;QACL,QAAQ;QACR,MAAM;QACN,KAAK;KACL,CAAC;IAEF,KAAK,CAAC,MAAM;QACX,IAAI,OAA6C,CAAC;QAClD,IAAI,CAAC;YACJ,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE;gBAC7C,MAAM,EAAE,WAAW,CAAC,OA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C,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,IAAI,GAAG,EAAE,CAAC;QAClB,CAAC;IACF,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAAC,IAAY;QAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,OAAO,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACzE,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Classifies provider errors that the research loop must handle differently
3
+ * from a genuine failure.
4
+ *
5
+ * A timeout and a context overflow both mean "the loop cannot continue, but
6
+ * what it gathered is still good" — they fall through to synthesis rather than
7
+ * degrading the whole run.
8
+ */
9
+ export declare class ProviderFailure {
10
+ private static readonly OVERFLOW_PATTERN;
11
+ static isAbort(error: unknown): boolean;
12
+ /** A provider 400 whose body mentions the context window being exceeded. */
13
+ static isContextOverflow(error: unknown): boolean;
14
+ /** Opt-in diagnostics; provider errors carry detail worth seeing. */
15
+ static debug(where: string, error: unknown): void;
16
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Classifies provider errors that the research loop must handle differently
3
+ * from a genuine failure.
4
+ *
5
+ * A timeout and a context overflow both mean "the loop cannot continue, but
6
+ * what it gathered is still good" — they fall through to synthesis rather than
7
+ * degrading the whole run.
8
+ */
9
+ export class ProviderFailure {
10
+ static OVERFLOW_PATTERN = /context (size|length|window)|exceed|too (long|large)|max.*token/i;
11
+ static isAbort(error) {
12
+ return (error instanceof Error &&
13
+ (error.name === "AbortError" || error.name === "TimeoutError"));
14
+ }
15
+ /** A provider 400 whose body mentions the context window being exceeded. */
16
+ static isContextOverflow(error) {
17
+ const e = error;
18
+ if (e?.statusCode !== 400)
19
+ return false;
20
+ return ProviderFailure.OVERFLOW_PATTERN.test(`${e.responseBody ?? ""} ${e.message ?? ""}`);
21
+ }
22
+ /** Opt-in diagnostics; provider errors carry detail worth seeing. */
23
+ static debug(where, error) {
24
+ if (!process.env.LMGREP_DEBUG)
25
+ return;
26
+ const e = error;
27
+ console.error(`[lmgrep debug] ${where} error:`, {
28
+ name: e?.name,
29
+ message: e?.message,
30
+ statusCode: e?.statusCode,
31
+ responseBody: e?.responseBody,
32
+ });
33
+ }
34
+ }
35
+ //# sourceMappingURL=ProviderFailure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderFailure.js","sourceRoot":"","sources":["../../../src/infrastructure/ai/ProviderFailure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IACnB,MAAM,CAAU,gBAAgB,GACvC,kEAAkE,CAAC;IAEpE,MAAM,CAAC,OAAO,CAAC,KAAc;QAC5B,OAAO,CACN,KAAK,YAAY,KAAK;YACtB,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,CAC9D,CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,MAAM,CAAC,iBAAiB,CAAC,KAAc;QACtC,MAAM,CAAC,GAAG,KAIT,CAAC;QACF,IAAI,CAAC,EAAE,UAAU,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QACxC,OAAO,eAAe,CAAC,gBAAgB,CAAC,IAAI,CAC3C,GAAG,CAAC,CAAC,YAAY,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,IAAI,EAAE,EAAE,CAC5C,CAAC;IACH,CAAC;IAED,qEAAqE;IACrE,MAAM,CAAC,KAAK,CAAC,KAAa,EAAE,KAAc;QACzC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY;YAAE,OAAO;QACtC,MAAM,CAAC,GAAG,KAAgC,CAAC;QAC3C,OAAO,CAAC,KAAK,CAAC,kBAAkB,KAAK,SAAS,EAAE;YAC/C,IAAI,EAAE,CAAC,EAAE,IAAI;YACb,OAAO,EAAE,CAAC,EAAE,OAAO;YACnB,UAAU,EAAE,CAAC,EAAE,UAAU;YACzB,YAAY,EAAE,CAAC,EAAE,YAAY;SAC7B,CAAC,CAAC;IACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Imports an AI SDK provider package.
3
+ *
4
+ * Providers are peer dependencies the user installs, so resolution has to
5
+ * reach beyond this package's own `node_modules`: an `npm i -g @ai-sdk/openai`
6
+ * is a normal setup and would otherwise fail to resolve.
7
+ */
8
+ export declare class ProviderModuleLoader {
9
+ private readonly cache;
10
+ load(packageName: string): Promise<Record<string, unknown>>;
11
+ private resolve;
12
+ private globalModulePaths;
13
+ }
@@ -0,0 +1,49 @@
1
+ import { execSync } from "node:child_process";
2
+ import { createRequire } from "node:module";
3
+ import { join } from "node:path";
4
+ /**
5
+ * Imports an AI SDK provider package.
6
+ *
7
+ * Providers are peer dependencies the user installs, so resolution has to
8
+ * reach beyond this package's own `node_modules`: an `npm i -g @ai-sdk/openai`
9
+ * is a normal setup and would otherwise fail to resolve.
10
+ */
11
+ export class ProviderModuleLoader {
12
+ cache = new Map();
13
+ async load(packageName) {
14
+ const cached = this.cache.get(packageName);
15
+ if (cached)
16
+ return cached;
17
+ const loaded = await this.resolve(packageName);
18
+ this.cache.set(packageName, loaded);
19
+ return loaded;
20
+ }
21
+ async resolve(packageName) {
22
+ // Local resolution first — the common case.
23
+ try {
24
+ return await import(packageName);
25
+ }
26
+ catch { }
27
+ for (const globalPath of this.globalModulePaths()) {
28
+ try {
29
+ const req = createRequire(join(globalPath, ".placeholder"));
30
+ return await import(req.resolve(packageName));
31
+ }
32
+ catch { }
33
+ }
34
+ throw new Error(`Provider "${packageName}" is not installed. Run:\n\n npm install -g ${packageName}\n`);
35
+ }
36
+ globalModulePaths() {
37
+ const paths = [];
38
+ for (const command of ["pnpm root -g", "npm root -g"]) {
39
+ try {
40
+ const out = execSync(command, { stdio: "pipe" }).toString().trim();
41
+ if (out)
42
+ paths.push(out);
43
+ }
44
+ catch { }
45
+ }
46
+ return paths;
47
+ }
48
+ }
49
+ //# sourceMappingURL=ProviderModuleLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderModuleLoader.js","sourceRoot":"","sources":["../../../src/infrastructure/ai/ProviderModuleLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IACf,KAAK,GAAG,IAAI,GAAG,EAAmC,CAAC;IAEpE,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;QAE1B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,KAAK,CAAC,OAAO,CAAC,WAAmB;QACxC,4CAA4C;QAC5C,IAAI,CAAC;YACJ,OAAO,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QAEV,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;YACnD,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;gBAC5D,OAAO,MAAM,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;YAC/C,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACX,CAAC;QAED,MAAM,IAAI,KAAK,CACd,aAAa,WAAW,gDAAgD,WAAW,IAAI,CACvF,CAAC;IACH,CAAC;IAEO,iBAAiB;QACxB,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,MAAM,OAAO,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC;gBACJ,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;gBACnE,IAAI,GAAG;oBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACX,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD"}
@@ -0,0 +1,37 @@
1
+ import { ProviderModuleLoader } from "./ProviderModuleLoader.js";
2
+ /** A `provider:model` string split into its parts. */
3
+ export declare class ModelReference {
4
+ readonly provider: string;
5
+ readonly model: string;
6
+ readonly full: string;
7
+ private constructor();
8
+ static parse(value: string, label: string): ModelReference;
9
+ }
10
+ export interface ProviderRequest {
11
+ reference: ModelReference;
12
+ /** Package to import; defaults to `@ai-sdk/<provider>`. */
13
+ packageName?: string;
14
+ baseURL?: string;
15
+ /**
16
+ * Whether a configured `baseURL` should force use of the `create*` factory
17
+ * even when the module exports a ready-made default instance.
18
+ *
19
+ * It matters because a bare default export (e.g. `openai`) ignores baseURL
20
+ * and would silently talk to the cloud. The chat path sets this; the
21
+ * embedding path historically does not, and the two are kept distinct here
22
+ * rather than quietly unified.
23
+ */
24
+ preferFactoryWhenBaseUrlSet: boolean;
25
+ }
26
+ /**
27
+ * Turns a `provider:model` string plus config into a live AI SDK provider.
28
+ *
29
+ * Both the embedding and chat paths need the same import-and-instantiate
30
+ * dance, so it lives here once; the one place they genuinely differ is
31
+ * expressed as {@link ProviderRequest.preferFactoryWhenBaseUrlSet}.
32
+ */
33
+ export declare class ProviderRegistry {
34
+ private readonly loader;
35
+ constructor(loader?: ProviderModuleLoader);
36
+ instantiate(request: ProviderRequest): Promise<unknown>;
37
+ }
@@ -0,0 +1,55 @@
1
+ import { ProviderModuleLoader } from "./ProviderModuleLoader.js";
2
+ /** A `provider:model` string split into its parts. */
3
+ export class ModelReference {
4
+ provider;
5
+ model;
6
+ full;
7
+ constructor(provider, model, full) {
8
+ this.provider = provider;
9
+ this.model = model;
10
+ this.full = full;
11
+ }
12
+ static parse(value, label) {
13
+ const colon = value.indexOf(":");
14
+ if (colon === -1) {
15
+ throw new Error(`${label} must be in "provider:model" format. Got: "${value}"`);
16
+ }
17
+ return new ModelReference(value.slice(0, colon), value.slice(colon + 1), value);
18
+ }
19
+ }
20
+ /**
21
+ * Turns a `provider:model` string plus config into a live AI SDK provider.
22
+ *
23
+ * Both the embedding and chat paths need the same import-and-instantiate
24
+ * dance, so it lives here once; the one place they genuinely differ is
25
+ * expressed as {@link ProviderRequest.preferFactoryWhenBaseUrlSet}.
26
+ */
27
+ export class ProviderRegistry {
28
+ loader;
29
+ constructor(loader = new ProviderModuleLoader()) {
30
+ this.loader = loader;
31
+ }
32
+ async instantiate(request) {
33
+ const providerName = request.reference.provider;
34
+ const packageName = request.packageName ?? `@ai-sdk/${providerName}`;
35
+ const module = await this.loader.load(packageName);
36
+ let instance = module[providerName];
37
+ const forceFactory = request.preferFactoryWhenBaseUrlSet && Boolean(request.baseURL);
38
+ if (!instance || forceFactory) {
39
+ const factoryKey = Object.keys(module).find((k) => k.startsWith("create"));
40
+ if (factoryKey) {
41
+ const factory = module[factoryKey];
42
+ instance = factory({
43
+ name: providerName,
44
+ ...(request.baseURL ? { baseURL: request.baseURL } : {}),
45
+ });
46
+ }
47
+ }
48
+ if (!instance) {
49
+ throw new Error(`Package "${packageName}" has no usable provider export. ` +
50
+ `Available: ${Object.keys(module).join(", ")}`);
51
+ }
52
+ return instance;
53
+ }
54
+ }
55
+ //# sourceMappingURL=ProviderRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderRegistry.js","sourceRoot":"","sources":["../../../src/infrastructure/ai/ProviderRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,sDAAsD;AACtD,MAAM,OAAO,cAAc;IAEhB;IACA;IACA;IAHV,YACU,QAAgB,EAChB,KAAa,EACb,IAAY;QAFZ,aAAQ,GAAR,QAAQ,CAAQ;QAChB,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAQ;IACnB,CAAC;IAEJ,MAAM,CAAC,KAAK,CAAC,KAAa,EAAE,KAAa;QACxC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACd,GAAG,KAAK,8CAA8C,KAAK,GAAG,CAC9D,CAAC;QACH,CAAC;QACD,OAAO,IAAI,cAAc,CACxB,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EACrB,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EACtB,KAAK,CACL,CAAC;IACH,CAAC;CACD;AAmBD;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAEV;IADlB,YACkB,SAA+B,IAAI,oBAAoB,EAAE;QAAzD,WAAM,GAAN,MAAM,CAAmD;IACxE,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,OAAwB;QACzC,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC;QAChD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,WAAW,YAAY,EAAE,CAAC;QACrE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEnD,IAAI,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QAEpC,MAAM,YAAY,GACjB,OAAO,CAAC,2BAA2B,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,QAAQ,IAAI,YAAY,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACjD,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CACtB,CAAC;YACF,IAAI,UAAU,EAAE,CAAC;gBAChB,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAErB,CAAC;gBACb,QAAQ,GAAG,OAAO,CAAC;oBAClB,IAAI,EAAE,YAAY;oBAClB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACxD,CAAC,CAAC;YACJ,CAAC;QACF,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACd,YAAY,WAAW,mCAAmC;gBACzD,cAAc,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC/C,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;CACD"}
@@ -0,0 +1,59 @@
1
+ import type { ConfigSource } from "../../domain/config/ConfigSource.js";
2
+ import type { LmgrepConfig } from "../../domain/config/LmgrepConfig.js";
3
+ /**
4
+ * Loads configuration from two kinds of file, split by what the settings
5
+ * actually describe.
6
+ *
7
+ * **Machine settings** — which model to embed with, which to answer with,
8
+ * where those servers listen — describe *this computer's* inference setup.
9
+ * They live in one global file. They used to be settable per project too,
10
+ * which was the single most confusing thing about lmgrep: the model determines
11
+ * what a stored vector *means*, so a project file could silently point an
12
+ * index at incompatible embeddings, and `status` would report an effective
13
+ * model without saying which of three files produced it.
14
+ *
15
+ * **Project settings** — what to ignore, which extensions to index — describe
16
+ * *this repository*, are worth committing, and mean the same thing on every
17
+ * machine that checks it out.
18
+ *
19
+ * Machine keys found in a project file are reported and ignored rather than
20
+ * applied. Wanting a different model for one project is a real thing to want;
21
+ * it is now spelled as a different database (`--database`), because the model
22
+ * is a property of an index rather than of a directory.
23
+ */
24
+ export declare class ConfigLoader {
25
+ /** Settings that describe this machine's inference setup. */
26
+ private static readonly MACHINE_SCHEMA;
27
+ /** Settings that describe a repository. */
28
+ private static readonly PROJECT_SCHEMA;
29
+ private static readonly FILE_NAME;
30
+ private static readonly PROJECT_FILE_NAMES;
31
+ private static readonly DEFAULTS;
32
+ /** Populated by {@link load}: what was read, and what was ignored. */
33
+ readonly sources: ConfigSource[];
34
+ readonly warnings: string[];
35
+ load(cwd: string): LmgrepConfig;
36
+ /**
37
+ * The XDG-compliant global config directory.
38
+ * Linux: $XDG_CONFIG_HOME/lmgrep or ~/.config/lmgrep
39
+ * macOS: ~/Library/Application Support/lmgrep
40
+ */
41
+ configDirectory(): string;
42
+ globalConfigPath(): string;
43
+ /** Path of the project file in `cwd`, whether or not it exists. */
44
+ projectConfigPath(cwd: string): string;
45
+ /**
46
+ * Parse a single machine config file, ignoring the layering.
47
+ *
48
+ * `init` rewrites one specific file, so it needs that file's own contents —
49
+ * merging layers here would copy one file's settings into another.
50
+ */
51
+ readFile(path: string): Partial<LmgrepConfig> | undefined;
52
+ private readMachineFile;
53
+ private readProjectFile;
54
+ private parseYaml;
55
+ private pick;
56
+ private static machineKeys;
57
+ private static projectKeys;
58
+ private validate;
59
+ }
@@ -0,0 +1,194 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { homedir, platform } from "node:os";
3
+ import { join } from "node:path";
4
+ import { parse } from "yaml";
5
+ import { z } from "zod";
6
+ /**
7
+ * Loads configuration from two kinds of file, split by what the settings
8
+ * actually describe.
9
+ *
10
+ * **Machine settings** — which model to embed with, which to answer with,
11
+ * where those servers listen — describe *this computer's* inference setup.
12
+ * They live in one global file. They used to be settable per project too,
13
+ * which was the single most confusing thing about lmgrep: the model determines
14
+ * what a stored vector *means*, so a project file could silently point an
15
+ * index at incompatible embeddings, and `status` would report an effective
16
+ * model without saying which of three files produced it.
17
+ *
18
+ * **Project settings** — what to ignore, which extensions to index — describe
19
+ * *this repository*, are worth committing, and mean the same thing on every
20
+ * machine that checks it out.
21
+ *
22
+ * Machine keys found in a project file are reported and ignored rather than
23
+ * applied. Wanting a different model for one project is a real thing to want;
24
+ * it is now spelled as a different database (`--database`), because the model
25
+ * is a property of an index rather than of a directory.
26
+ */
27
+ export class ConfigLoader {
28
+ /** Settings that describe this machine's inference setup. */
29
+ static MACHINE_SCHEMA = z.object({
30
+ model: z
31
+ .string()
32
+ .regex(/^.+:.+$/, 'Model must be in "provider:model" format (e.g. "ollama:nomic-embed-text")'),
33
+ provider: z.string().optional(),
34
+ baseURL: z.string().url().optional(),
35
+ local: z.boolean().optional(),
36
+ batchSize: z.number().int().positive().default(100),
37
+ dimensions: z.number().int().positive().optional(),
38
+ queryPrefix: z.string().optional(),
39
+ documentPrefix: z.string().optional(),
40
+ maxTokens: z.number().int().positive().optional(),
41
+ chatModel: z
42
+ .string()
43
+ .regex(/^.+:.+$/, 'chatModel must be in "provider:model" format (e.g. "lmstudio:qwen/qwen3.5-9b")')
44
+ .optional(),
45
+ chatProvider: z.string().optional(),
46
+ chatBaseURL: z.string().url().optional(),
47
+ chatMaxSteps: z.number().int().positive().optional(),
48
+ chatTimeoutMs: z.number().int().positive().optional(),
49
+ });
50
+ /** Settings that describe a repository. */
51
+ static PROJECT_SCHEMA = z.object({
52
+ ignore: z.array(z.string()).optional(),
53
+ extensions: z
54
+ .object({
55
+ include: z.array(z.string()).optional(),
56
+ exclude: z.array(z.string()).optional(),
57
+ })
58
+ .optional(),
59
+ });
60
+ static FILE_NAME = "config.yml";
61
+ static PROJECT_FILE_NAMES = [".lmgrep.yml", ".lmgrep.yaml"];
62
+ static DEFAULTS = { batchSize: 100 };
63
+ /** Populated by {@link load}: what was read, and what was ignored. */
64
+ sources = [];
65
+ warnings = [];
66
+ load(cwd) {
67
+ const layers = [];
68
+ // Home-level files are machine settings wherever they sit; the bare
69
+ // ~/.lmgrep.yml predates the XDG path and is still honoured so an
70
+ // upgrade does not silently unconfigure anyone.
71
+ const legacy = this.readMachineFile(join(homedir(), ".lmgrep.yml"), "deprecated");
72
+ if (legacy)
73
+ layers.push(legacy);
74
+ const global = this.readMachineFile(this.globalConfigPath());
75
+ if (global)
76
+ layers.push(global);
77
+ const project = this.readProjectFile(cwd);
78
+ if (project)
79
+ layers.push(project);
80
+ if (layers.length === 0) {
81
+ throw new Error("No configuration found. Run `lmgrep init` to set up your embedding model.");
82
+ }
83
+ return this.validate(Object.assign({ ...ConfigLoader.DEFAULTS }, ...layers));
84
+ }
85
+ /**
86
+ * The XDG-compliant global config directory.
87
+ * Linux: $XDG_CONFIG_HOME/lmgrep or ~/.config/lmgrep
88
+ * macOS: ~/Library/Application Support/lmgrep
89
+ */
90
+ configDirectory() {
91
+ if (platform() === "darwin") {
92
+ return join(homedir(), "Library", "Application Support", "lmgrep");
93
+ }
94
+ const xdg = process.env.XDG_CONFIG_HOME;
95
+ return join(xdg || join(homedir(), ".config"), "lmgrep");
96
+ }
97
+ globalConfigPath() {
98
+ return join(this.configDirectory(), ConfigLoader.FILE_NAME);
99
+ }
100
+ /** Path of the project file in `cwd`, whether or not it exists. */
101
+ projectConfigPath(cwd) {
102
+ for (const name of ConfigLoader.PROJECT_FILE_NAMES) {
103
+ if (existsSync(join(cwd, name)))
104
+ return join(cwd, name);
105
+ }
106
+ return join(cwd, ConfigLoader.PROJECT_FILE_NAMES[0]);
107
+ }
108
+ /**
109
+ * Parse a single machine config file, ignoring the layering.
110
+ *
111
+ * `init` rewrites one specific file, so it needs that file's own contents —
112
+ * merging layers here would copy one file's settings into another.
113
+ */
114
+ readFile(path) {
115
+ const raw = this.parseYaml(path);
116
+ if (!raw)
117
+ return undefined;
118
+ return ConfigLoader.MACHINE_SCHEMA.partial().parse(this.pick(raw, ConfigLoader.machineKeys()));
119
+ }
120
+ readMachineFile(path, deprecated) {
121
+ const raw = this.parseYaml(path);
122
+ if (!raw)
123
+ return undefined;
124
+ const projectKeys = ConfigLoader.projectKeys().filter((k) => k in raw);
125
+ if (projectKeys.length > 0) {
126
+ this.warnings.push(`${path}: ${projectKeys.join(", ")} ${projectKeys.length === 1 ? "is a project setting" : "are project settings"} — ` +
127
+ "move to .lmgrep.yml in the repository it applies to.");
128
+ }
129
+ const parsed = ConfigLoader.MACHINE_SCHEMA.partial().parse(this.pick(raw, ConfigLoader.machineKeys()));
130
+ // Deprecation is not warned about here: `lmgrep status` marks the
131
+ // location in its provenance listing, which is where someone is
132
+ // actually looking at their configuration. Printing it before every
133
+ // search would be noise on the one path that must stay quiet.
134
+ this.sources.push({
135
+ path,
136
+ scope: "machine",
137
+ keys: Object.keys(parsed),
138
+ ...(deprecated ? { deprecated: true } : {}),
139
+ });
140
+ return parsed;
141
+ }
142
+ readProjectFile(cwd) {
143
+ for (const name of ConfigLoader.PROJECT_FILE_NAMES) {
144
+ const path = join(cwd, name);
145
+ const raw = this.parseYaml(path);
146
+ if (!raw)
147
+ continue;
148
+ const machineKeys = ConfigLoader.machineKeys().filter((k) => k in raw);
149
+ if (machineKeys.length > 0) {
150
+ // Named individually because the consequence differs per key:
151
+ // a stray `model` here silently decided what an index meant.
152
+ this.warnings.push(`${path}: ignoring ${machineKeys.join(", ")} — these describe your machine, ` +
153
+ `not this repository. Set them in ${this.globalConfigPath()}. ` +
154
+ "For a project-specific model, index it under `--in <name>` instead.");
155
+ }
156
+ const parsed = ConfigLoader.PROJECT_SCHEMA.parse(this.pick(raw, ConfigLoader.projectKeys()));
157
+ this.sources.push({
158
+ path,
159
+ scope: "project",
160
+ keys: Object.keys(parsed),
161
+ });
162
+ return parsed;
163
+ }
164
+ return undefined;
165
+ }
166
+ parseYaml(path) {
167
+ if (!existsSync(path))
168
+ return undefined;
169
+ const parsed = parse(readFileSync(path, "utf-8"));
170
+ if (parsed == null || typeof parsed !== "object")
171
+ return undefined;
172
+ return parsed;
173
+ }
174
+ pick(raw, keys) {
175
+ const out = {};
176
+ for (const key of keys)
177
+ if (key in raw)
178
+ out[key] = raw[key];
179
+ return out;
180
+ }
181
+ static machineKeys() {
182
+ return Object.keys(ConfigLoader.MACHINE_SCHEMA.shape);
183
+ }
184
+ static projectKeys() {
185
+ return Object.keys(ConfigLoader.PROJECT_SCHEMA.shape);
186
+ }
187
+ validate(config) {
188
+ if (!config.model) {
189
+ throw new Error(`No model configured. Run \`lmgrep init\` to detect your setup, or set \`model\` in ${this.globalConfigPath()}.`);
190
+ }
191
+ return config;
192
+ }
193
+ }
194
+ //# sourceMappingURL=ConfigLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigLoader.js","sourceRoot":"","sources":["../../../src/infrastructure/fs/ConfigLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,YAAY;IACxB,6DAA6D;IACrD,MAAM,CAAU,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;QACjD,KAAK,EAAE,CAAC;aACN,MAAM,EAAE;aACR,KAAK,CACL,SAAS,EACT,2EAA2E,CAC3E;QACF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE,C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