gnosys 5.9.5 → 5.11.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 (490) hide show
  1. package/README.md +91 -771
  2. package/dist/cli.d.ts +0 -1
  3. package/dist/cli.js +403 -141
  4. package/dist/index.d.ts +3 -1
  5. package/dist/index.js +427 -348
  6. package/dist/lib/archive.d.ts +3 -4
  7. package/dist/lib/archive.js +0 -1
  8. package/dist/lib/ask.d.ts +3 -4
  9. package/dist/lib/ask.js +0 -1
  10. package/dist/lib/atomicWrite.d.ts +7 -0
  11. package/dist/lib/atomicWrite.js +46 -0
  12. package/dist/lib/attachments.d.ts +0 -1
  13. package/dist/lib/attachments.js +0 -1
  14. package/dist/lib/audioExtract.d.ts +0 -1
  15. package/dist/lib/audioExtract.js +0 -1
  16. package/dist/lib/audit.d.ts +0 -1
  17. package/dist/lib/audit.js +0 -1
  18. package/dist/lib/bootstrap.d.ts +1 -2
  19. package/dist/lib/bootstrap.js +0 -1
  20. package/dist/lib/centralize.d.ts +20 -0
  21. package/dist/lib/centralize.js +34 -0
  22. package/dist/lib/chat/SlashPalette.d.ts +2 -3
  23. package/dist/lib/chat/SlashPalette.js +0 -1
  24. package/dist/lib/chat/boot-splash.d.ts +1 -2
  25. package/dist/lib/chat/boot-splash.js +0 -1
  26. package/dist/lib/chat/choose.d.ts +0 -1
  27. package/dist/lib/chat/choose.js +0 -2
  28. package/dist/lib/chat/commands.d.ts +1 -2
  29. package/dist/lib/chat/commands.js +0 -1
  30. package/dist/lib/chat/components/CitationText.d.ts +1 -2
  31. package/dist/lib/chat/components/CitationText.js +0 -1
  32. package/dist/lib/chat/components/MarkdownRenderer.d.ts +0 -1
  33. package/dist/lib/chat/components/MarkdownRenderer.js +0 -1
  34. package/dist/lib/chat/components/ToolCallCard.d.ts +1 -2
  35. package/dist/lib/chat/components/ToolCallCard.js +0 -1
  36. package/dist/lib/chat/focus.d.ts +3 -3
  37. package/dist/lib/chat/focus.js +0 -1
  38. package/dist/lib/chat/index.d.ts +3 -4
  39. package/dist/lib/chat/index.js +2 -2
  40. package/dist/lib/chat/intent.d.ts +1 -17
  41. package/dist/lib/chat/intent.js +2 -3
  42. package/dist/lib/chat/llmTurn.d.ts +5 -6
  43. package/dist/lib/chat/llmTurn.js +0 -1
  44. package/dist/lib/chat/recall.d.ts +2 -3
  45. package/dist/lib/chat/recall.js +1 -2
  46. package/dist/lib/chat/render.d.ts +2 -3
  47. package/dist/lib/chat/render.js +0 -1
  48. package/dist/lib/chat/session.d.ts +0 -1
  49. package/dist/lib/chat/session.js +0 -1
  50. package/dist/lib/chat/theme.d.ts +0 -1
  51. package/dist/lib/chat/theme.js +0 -1
  52. package/dist/lib/chat/toolFence.d.ts +2 -2
  53. package/dist/lib/chat/toolFence.js +0 -1
  54. package/dist/lib/chat/tools.d.ts +0 -1
  55. package/dist/lib/chat/tools.js +0 -1
  56. package/dist/lib/chat/types.d.ts +0 -1
  57. package/dist/lib/chat/types.js +0 -1
  58. package/dist/lib/chat/write.d.ts +5 -5
  59. package/dist/lib/chat/write.js +0 -1
  60. package/dist/lib/chunkSplitter.d.ts +0 -1
  61. package/dist/lib/chunkSplitter.js +0 -1
  62. package/dist/lib/cleanup.d.ts +0 -1
  63. package/dist/lib/cleanup.js +0 -1
  64. package/dist/lib/config.d.ts +0 -1
  65. package/dist/lib/config.js +3 -3
  66. package/dist/lib/dashboard.d.ts +3 -4
  67. package/dist/lib/dashboard.js +5 -2
  68. package/dist/lib/db.d.ts +24 -1
  69. package/dist/lib/db.js +162 -16
  70. package/dist/lib/dbSearch.d.ts +3 -4
  71. package/dist/lib/dbSearch.js +0 -1
  72. package/dist/lib/dbWrite.d.ts +2 -3
  73. package/dist/lib/dbWrite.js +0 -1
  74. package/dist/lib/desktopNotify.d.ts +0 -1
  75. package/dist/lib/desktopNotify.js +0 -1
  76. package/dist/lib/docxExtract.d.ts +0 -1
  77. package/dist/lib/docxExtract.js +22 -1
  78. package/dist/lib/dream.d.ts +2 -3
  79. package/dist/lib/dream.js +2 -2
  80. package/dist/lib/embeddings.d.ts +0 -3
  81. package/dist/lib/embeddings.js +7 -3
  82. package/dist/lib/export.d.ts +6 -2
  83. package/dist/lib/export.js +24 -2
  84. package/dist/lib/exportProject.d.ts +4 -3
  85. package/dist/lib/exportProject.js +3 -1
  86. package/dist/lib/federated.d.ts +3 -3
  87. package/dist/lib/federated.js +6 -4
  88. package/dist/lib/fileDetect.d.ts +0 -1
  89. package/dist/lib/fileDetect.js +0 -1
  90. package/dist/lib/graph.d.ts +4 -4
  91. package/dist/lib/graph.js +0 -1
  92. package/dist/lib/heartbeat.d.ts +0 -13
  93. package/dist/lib/heartbeat.js +1 -2
  94. package/dist/lib/hybridSearch.d.ts +5 -21
  95. package/dist/lib/hybridSearch.js +0 -1
  96. package/dist/lib/idFormat.d.ts +0 -2
  97. package/dist/lib/idFormat.js +1 -2
  98. package/dist/lib/imageExtract.d.ts +0 -1
  99. package/dist/lib/imageExtract.js +0 -1
  100. package/dist/lib/import.d.ts +6 -5
  101. package/dist/lib/import.js +3 -33
  102. package/dist/lib/importProject.d.ts +4 -4
  103. package/dist/lib/importProject.js +1 -2
  104. package/dist/lib/ingest.d.ts +3 -4
  105. package/dist/lib/ingest.js +0 -1
  106. package/dist/lib/lensing.d.ts +1 -2
  107. package/dist/lib/lensing.js +0 -1
  108. package/dist/lib/llm.d.ts +6 -45
  109. package/dist/lib/llm.js +27 -9
  110. package/dist/lib/lock.d.ts +0 -1
  111. package/dist/lib/lock.js +0 -1
  112. package/dist/lib/log.d.ts +4 -0
  113. package/dist/lib/log.js +85 -0
  114. package/dist/lib/machineConfig.d.ts +86 -0
  115. package/dist/lib/machineConfig.js +157 -0
  116. package/dist/lib/machineMigrate.d.ts +38 -0
  117. package/dist/lib/machineMigrate.js +102 -0
  118. package/dist/lib/maintenance.d.ts +4 -5
  119. package/dist/lib/maintenance.js +0 -1
  120. package/dist/lib/mcpClientConfig.d.ts +20 -0
  121. package/dist/lib/mcpClientConfig.js +62 -0
  122. package/dist/lib/mcpHttp.d.ts +52 -0
  123. package/dist/lib/mcpHttp.js +227 -0
  124. package/dist/lib/migrate.d.ts +1 -2
  125. package/dist/lib/migrate.js +1 -1
  126. package/dist/lib/modelValidation.d.ts +0 -1
  127. package/dist/lib/modelValidation.js +0 -1
  128. package/dist/lib/multimodalIngest.d.ts +1 -2
  129. package/dist/lib/multimodalIngest.js +0 -1
  130. package/dist/lib/packageManager.d.ts +5 -0
  131. package/dist/lib/packageManager.js +30 -0
  132. package/dist/lib/paths.d.ts +11 -7
  133. package/dist/lib/paths.js +14 -2
  134. package/dist/lib/pdfExtract.d.ts +0 -1
  135. package/dist/lib/pdfExtract.js +0 -1
  136. package/dist/lib/portfolio.d.ts +1 -2
  137. package/dist/lib/portfolio.js +10 -3
  138. package/dist/lib/portfolioHtml.d.ts +1 -2
  139. package/dist/lib/portfolioHtml.js +0 -1
  140. package/dist/lib/preferences.d.ts +6 -2
  141. package/dist/lib/preferences.js +19 -1
  142. package/dist/lib/progress.d.ts +2 -2
  143. package/dist/lib/progress.js +0 -1
  144. package/dist/lib/projectIdentity.d.ts +1 -2
  145. package/dist/lib/projectIdentity.js +5 -5
  146. package/dist/lib/projectPaths.d.ts +60 -0
  147. package/dist/lib/projectPaths.js +99 -0
  148. package/dist/lib/projectScan.d.ts +40 -0
  149. package/dist/lib/projectScan.js +96 -0
  150. package/dist/lib/recall.d.ts +6 -6
  151. package/dist/lib/recall.js +0 -1
  152. package/dist/lib/remote.d.ts +3 -20
  153. package/dist/lib/remote.js +44 -2
  154. package/dist/lib/remoteWizard.d.ts +2 -3
  155. package/dist/lib/remoteWizard.js +0 -1
  156. package/dist/lib/resolver.d.ts +1 -2
  157. package/dist/lib/resolver.js +2 -3
  158. package/dist/lib/retry.d.ts +0 -1
  159. package/dist/lib/retry.js +1 -2
  160. package/dist/lib/rulesGen.d.ts +2 -8
  161. package/dist/lib/rulesGen.js +1 -2
  162. package/dist/lib/search.d.ts +1 -2
  163. package/dist/lib/search.js +1 -1
  164. package/dist/lib/searchTypes.d.ts +18 -0
  165. package/dist/lib/searchTypes.js +2 -0
  166. package/dist/lib/setup/coldStart.d.ts +0 -1
  167. package/dist/lib/setup/coldStart.js +0 -1
  168. package/dist/lib/setup/configSetRender.d.ts +0 -1
  169. package/dist/lib/setup/configSetRender.js +0 -1
  170. package/dist/lib/setup/dreamRender.d.ts +0 -1
  171. package/dist/lib/setup/dreamRender.js +0 -1
  172. package/dist/lib/setup/dreamState.d.ts +2 -2
  173. package/dist/lib/setup/dreamState.js +0 -1
  174. package/dist/lib/setup/modelsRender.d.ts +0 -1
  175. package/dist/lib/setup/modelsRender.js +0 -1
  176. package/dist/lib/setup/remoteRender.d.ts +0 -1
  177. package/dist/lib/setup/remoteRender.js +0 -1
  178. package/dist/lib/setup/routingRender.d.ts +0 -1
  179. package/dist/lib/setup/routingRender.js +0 -1
  180. package/dist/lib/setup/sections/ides.d.ts +1 -2
  181. package/dist/lib/setup/sections/ides.js +3 -2
  182. package/dist/lib/setup/sections/preferences.d.ts +1 -2
  183. package/dist/lib/setup/sections/preferences.js +3 -2
  184. package/dist/lib/setup/sections/routing.d.ts +1 -2
  185. package/dist/lib/setup/sections/routing.js +0 -1
  186. package/dist/lib/setup/storePath.d.ts +0 -1
  187. package/dist/lib/setup/storePath.js +0 -1
  188. package/dist/lib/setup/summary.d.ts +1 -2
  189. package/dist/lib/setup/summary.js +0 -1
  190. package/dist/lib/setup/syncProjectsRender.d.ts +0 -1
  191. package/dist/lib/setup/syncProjectsRender.js +0 -1
  192. package/dist/lib/setup/ui/diff.d.ts +0 -1
  193. package/dist/lib/setup/ui/diff.js +0 -1
  194. package/dist/lib/setup/ui/footer.d.ts +0 -1
  195. package/dist/lib/setup/ui/footer.js +0 -1
  196. package/dist/lib/setup/ui/header.d.ts +0 -1
  197. package/dist/lib/setup/ui/header.js +0 -1
  198. package/dist/lib/setup/ui/index.d.ts +0 -1
  199. package/dist/lib/setup/ui/index.js +0 -1
  200. package/dist/lib/setup/ui/menu.d.ts +0 -1
  201. package/dist/lib/setup/ui/menu.js +0 -1
  202. package/dist/lib/setup/ui/panel.d.ts +0 -1
  203. package/dist/lib/setup/ui/panel.js +0 -1
  204. package/dist/lib/setup/ui/prompt.d.ts +0 -1
  205. package/dist/lib/setup/ui/prompt.js +0 -1
  206. package/dist/lib/setup/ui/safePrompt.d.ts +0 -1
  207. package/dist/lib/setup/ui/safePrompt.js +0 -1
  208. package/dist/lib/setup/ui/spinner.d.ts +0 -1
  209. package/dist/lib/setup/ui/spinner.js +0 -1
  210. package/dist/lib/setup/ui/status.d.ts +0 -1
  211. package/dist/lib/setup/ui/status.js +0 -1
  212. package/dist/lib/setup/ui/table.d.ts +0 -1
  213. package/dist/lib/setup/ui/table.js +0 -1
  214. package/dist/lib/setup/ui/title.d.ts +0 -1
  215. package/dist/lib/setup/ui/title.js +0 -1
  216. package/dist/lib/setup/ui/tokens.d.ts +0 -1
  217. package/dist/lib/setup/ui/tokens.js +0 -1
  218. package/dist/lib/setup.d.ts +2 -31
  219. package/dist/lib/setup.js +13 -9
  220. package/dist/lib/staticSearch.d.ts +0 -1
  221. package/dist/lib/staticSearch.js +0 -1
  222. package/dist/lib/store.d.ts +0 -1
  223. package/dist/lib/store.js +0 -1
  224. package/dist/lib/structuredIngest.d.ts +0 -1
  225. package/dist/lib/structuredIngest.js +0 -1
  226. package/dist/lib/tags.d.ts +0 -1
  227. package/dist/lib/tags.js +0 -1
  228. package/dist/lib/timeline.d.ts +2 -3
  229. package/dist/lib/timeline.js +3 -4
  230. package/dist/lib/trace.d.ts +1 -16
  231. package/dist/lib/trace.js +0 -1
  232. package/dist/lib/upgrade.d.ts +0 -1
  233. package/dist/lib/upgrade.js +0 -1
  234. package/dist/lib/videoExtract.d.ts +0 -1
  235. package/dist/lib/videoExtract.js +0 -1
  236. package/dist/lib/webIndex.d.ts +1 -3
  237. package/dist/lib/webIndex.js +0 -1
  238. package/dist/lib/webIngest.d.ts +13 -1
  239. package/dist/lib/webIngest.js +98 -24
  240. package/dist/lib/wikilinks.d.ts +3 -3
  241. package/dist/lib/wikilinks.js +0 -1
  242. package/dist/postinstall.d.ts +0 -1
  243. package/dist/postinstall.js +0 -1
  244. package/dist/sandbox/client.d.ts +0 -1
  245. package/dist/sandbox/client.js +0 -1
  246. package/dist/sandbox/helper-template.d.ts +0 -1
  247. package/dist/sandbox/helper-template.js +0 -1
  248. package/dist/sandbox/manager.d.ts +0 -9
  249. package/dist/sandbox/manager.js +2 -3
  250. package/dist/sandbox/server.d.ts +2 -3
  251. package/dist/sandbox/server.js +7 -7
  252. package/docs/logo.svg +25 -0
  253. package/package.json +18 -6
  254. package/prompts/synthesize.md +2 -0
  255. package/dist/cli.d.ts.map +0 -1
  256. package/dist/cli.js.map +0 -1
  257. package/dist/index.d.ts.map +0 -1
  258. package/dist/index.js.map +0 -1
  259. package/dist/lib/archive.d.ts.map +0 -1
  260. package/dist/lib/archive.js.map +0 -1
  261. package/dist/lib/ask.d.ts.map +0 -1
  262. package/dist/lib/ask.js.map +0 -1
  263. package/dist/lib/attachments.d.ts.map +0 -1
  264. package/dist/lib/attachments.js.map +0 -1
  265. package/dist/lib/audioExtract.d.ts.map +0 -1
  266. package/dist/lib/audioExtract.js.map +0 -1
  267. package/dist/lib/audit.d.ts.map +0 -1
  268. package/dist/lib/audit.js.map +0 -1
  269. package/dist/lib/bootstrap.d.ts.map +0 -1
  270. package/dist/lib/bootstrap.js.map +0 -1
  271. package/dist/lib/chat/SlashPalette.d.ts.map +0 -1
  272. package/dist/lib/chat/SlashPalette.js.map +0 -1
  273. package/dist/lib/chat/boot-splash.d.ts.map +0 -1
  274. package/dist/lib/chat/boot-splash.js.map +0 -1
  275. package/dist/lib/chat/choose.d.ts.map +0 -1
  276. package/dist/lib/chat/choose.js.map +0 -1
  277. package/dist/lib/chat/commands.d.ts.map +0 -1
  278. package/dist/lib/chat/commands.js.map +0 -1
  279. package/dist/lib/chat/components/CitationText.d.ts.map +0 -1
  280. package/dist/lib/chat/components/CitationText.js.map +0 -1
  281. package/dist/lib/chat/components/MarkdownRenderer.d.ts.map +0 -1
  282. package/dist/lib/chat/components/MarkdownRenderer.js.map +0 -1
  283. package/dist/lib/chat/components/ToolCallCard.d.ts.map +0 -1
  284. package/dist/lib/chat/components/ToolCallCard.js.map +0 -1
  285. package/dist/lib/chat/focus.d.ts.map +0 -1
  286. package/dist/lib/chat/focus.js.map +0 -1
  287. package/dist/lib/chat/index.d.ts.map +0 -1
  288. package/dist/lib/chat/index.js.map +0 -1
  289. package/dist/lib/chat/intent.d.ts.map +0 -1
  290. package/dist/lib/chat/intent.js.map +0 -1
  291. package/dist/lib/chat/llmTurn.d.ts.map +0 -1
  292. package/dist/lib/chat/llmTurn.js.map +0 -1
  293. package/dist/lib/chat/recall.d.ts.map +0 -1
  294. package/dist/lib/chat/recall.js.map +0 -1
  295. package/dist/lib/chat/render.d.ts.map +0 -1
  296. package/dist/lib/chat/render.js.map +0 -1
  297. package/dist/lib/chat/session.d.ts.map +0 -1
  298. package/dist/lib/chat/session.js.map +0 -1
  299. package/dist/lib/chat/theme.d.ts.map +0 -1
  300. package/dist/lib/chat/theme.js.map +0 -1
  301. package/dist/lib/chat/toolFence.d.ts.map +0 -1
  302. package/dist/lib/chat/toolFence.js.map +0 -1
  303. package/dist/lib/chat/tools.d.ts.map +0 -1
  304. package/dist/lib/chat/tools.js.map +0 -1
  305. package/dist/lib/chat/types.d.ts.map +0 -1
  306. package/dist/lib/chat/types.js.map +0 -1
  307. package/dist/lib/chat/write.d.ts.map +0 -1
  308. package/dist/lib/chat/write.js.map +0 -1
  309. package/dist/lib/chunkSplitter.d.ts.map +0 -1
  310. package/dist/lib/chunkSplitter.js.map +0 -1
  311. package/dist/lib/cleanup.d.ts.map +0 -1
  312. package/dist/lib/cleanup.js.map +0 -1
  313. package/dist/lib/config.d.ts.map +0 -1
  314. package/dist/lib/config.js.map +0 -1
  315. package/dist/lib/dashboard.d.ts.map +0 -1
  316. package/dist/lib/dashboard.js.map +0 -1
  317. package/dist/lib/db.d.ts.map +0 -1
  318. package/dist/lib/db.js.map +0 -1
  319. package/dist/lib/dbSearch.d.ts.map +0 -1
  320. package/dist/lib/dbSearch.js.map +0 -1
  321. package/dist/lib/dbWrite.d.ts.map +0 -1
  322. package/dist/lib/dbWrite.js.map +0 -1
  323. package/dist/lib/desktopNotify.d.ts.map +0 -1
  324. package/dist/lib/desktopNotify.js.map +0 -1
  325. package/dist/lib/docxExtract.d.ts.map +0 -1
  326. package/dist/lib/docxExtract.js.map +0 -1
  327. package/dist/lib/dream.d.ts.map +0 -1
  328. package/dist/lib/dream.js.map +0 -1
  329. package/dist/lib/embeddings.d.ts.map +0 -1
  330. package/dist/lib/embeddings.js.map +0 -1
  331. package/dist/lib/export.d.ts.map +0 -1
  332. package/dist/lib/export.js.map +0 -1
  333. package/dist/lib/exportProject.d.ts.map +0 -1
  334. package/dist/lib/exportProject.js.map +0 -1
  335. package/dist/lib/federated.d.ts.map +0 -1
  336. package/dist/lib/federated.js.map +0 -1
  337. package/dist/lib/fileDetect.d.ts.map +0 -1
  338. package/dist/lib/fileDetect.js.map +0 -1
  339. package/dist/lib/graph.d.ts.map +0 -1
  340. package/dist/lib/graph.js.map +0 -1
  341. package/dist/lib/heartbeat.d.ts.map +0 -1
  342. package/dist/lib/heartbeat.js.map +0 -1
  343. package/dist/lib/history.d.ts +0 -39
  344. package/dist/lib/history.d.ts.map +0 -1
  345. package/dist/lib/history.js +0 -112
  346. package/dist/lib/history.js.map +0 -1
  347. package/dist/lib/hybridSearch.d.ts.map +0 -1
  348. package/dist/lib/hybridSearch.js.map +0 -1
  349. package/dist/lib/idFormat.d.ts.map +0 -1
  350. package/dist/lib/idFormat.js.map +0 -1
  351. package/dist/lib/imageExtract.d.ts.map +0 -1
  352. package/dist/lib/imageExtract.js.map +0 -1
  353. package/dist/lib/import.d.ts.map +0 -1
  354. package/dist/lib/import.js.map +0 -1
  355. package/dist/lib/importProject.d.ts.map +0 -1
  356. package/dist/lib/importProject.js.map +0 -1
  357. package/dist/lib/ingest.d.ts.map +0 -1
  358. package/dist/lib/ingest.js.map +0 -1
  359. package/dist/lib/lensing.d.ts.map +0 -1
  360. package/dist/lib/lensing.js.map +0 -1
  361. package/dist/lib/llm.d.ts.map +0 -1
  362. package/dist/lib/llm.js.map +0 -1
  363. package/dist/lib/lock.d.ts.map +0 -1
  364. package/dist/lib/lock.js.map +0 -1
  365. package/dist/lib/maintenance.d.ts.map +0 -1
  366. package/dist/lib/maintenance.js.map +0 -1
  367. package/dist/lib/migrate.d.ts.map +0 -1
  368. package/dist/lib/migrate.js.map +0 -1
  369. package/dist/lib/modelValidation.d.ts.map +0 -1
  370. package/dist/lib/modelValidation.js.map +0 -1
  371. package/dist/lib/multimodalIngest.d.ts.map +0 -1
  372. package/dist/lib/multimodalIngest.js.map +0 -1
  373. package/dist/lib/paths.d.ts.map +0 -1
  374. package/dist/lib/paths.js.map +0 -1
  375. package/dist/lib/pdfExtract.d.ts.map +0 -1
  376. package/dist/lib/pdfExtract.js.map +0 -1
  377. package/dist/lib/portfolio.d.ts.map +0 -1
  378. package/dist/lib/portfolio.js.map +0 -1
  379. package/dist/lib/portfolioHtml.d.ts.map +0 -1
  380. package/dist/lib/portfolioHtml.js.map +0 -1
  381. package/dist/lib/preferences.d.ts.map +0 -1
  382. package/dist/lib/preferences.js.map +0 -1
  383. package/dist/lib/progress.d.ts.map +0 -1
  384. package/dist/lib/progress.js.map +0 -1
  385. package/dist/lib/projectIdentity.d.ts.map +0 -1
  386. package/dist/lib/projectIdentity.js.map +0 -1
  387. package/dist/lib/recall.d.ts.map +0 -1
  388. package/dist/lib/recall.js.map +0 -1
  389. package/dist/lib/remote.d.ts.map +0 -1
  390. package/dist/lib/remote.js.map +0 -1
  391. package/dist/lib/remoteWizard.d.ts.map +0 -1
  392. package/dist/lib/remoteWizard.js.map +0 -1
  393. package/dist/lib/resolver.d.ts.map +0 -1
  394. package/dist/lib/resolver.js.map +0 -1
  395. package/dist/lib/retry.d.ts.map +0 -1
  396. package/dist/lib/retry.js.map +0 -1
  397. package/dist/lib/rulesGen.d.ts.map +0 -1
  398. package/dist/lib/rulesGen.js.map +0 -1
  399. package/dist/lib/search.d.ts.map +0 -1
  400. package/dist/lib/search.js.map +0 -1
  401. package/dist/lib/setup/coldStart.d.ts.map +0 -1
  402. package/dist/lib/setup/coldStart.js.map +0 -1
  403. package/dist/lib/setup/configSetRender.d.ts.map +0 -1
  404. package/dist/lib/setup/configSetRender.js.map +0 -1
  405. package/dist/lib/setup/dreamRender.d.ts.map +0 -1
  406. package/dist/lib/setup/dreamRender.js.map +0 -1
  407. package/dist/lib/setup/dreamState.d.ts.map +0 -1
  408. package/dist/lib/setup/dreamState.js.map +0 -1
  409. package/dist/lib/setup/modelsRender.d.ts.map +0 -1
  410. package/dist/lib/setup/modelsRender.js.map +0 -1
  411. package/dist/lib/setup/remoteRender.d.ts.map +0 -1
  412. package/dist/lib/setup/remoteRender.js.map +0 -1
  413. package/dist/lib/setup/routingRender.d.ts.map +0 -1
  414. package/dist/lib/setup/routingRender.js.map +0 -1
  415. package/dist/lib/setup/sections/ides.d.ts.map +0 -1
  416. package/dist/lib/setup/sections/ides.js.map +0 -1
  417. package/dist/lib/setup/sections/preferences.d.ts.map +0 -1
  418. package/dist/lib/setup/sections/preferences.js.map +0 -1
  419. package/dist/lib/setup/sections/routing.d.ts.map +0 -1
  420. package/dist/lib/setup/sections/routing.js.map +0 -1
  421. package/dist/lib/setup/storePath.d.ts.map +0 -1
  422. package/dist/lib/setup/storePath.js.map +0 -1
  423. package/dist/lib/setup/summary.d.ts.map +0 -1
  424. package/dist/lib/setup/summary.js.map +0 -1
  425. package/dist/lib/setup/syncProjectsRender.d.ts.map +0 -1
  426. package/dist/lib/setup/syncProjectsRender.js.map +0 -1
  427. package/dist/lib/setup/ui/diff.d.ts.map +0 -1
  428. package/dist/lib/setup/ui/diff.js.map +0 -1
  429. package/dist/lib/setup/ui/footer.d.ts.map +0 -1
  430. package/dist/lib/setup/ui/footer.js.map +0 -1
  431. package/dist/lib/setup/ui/header.d.ts.map +0 -1
  432. package/dist/lib/setup/ui/header.js.map +0 -1
  433. package/dist/lib/setup/ui/index.d.ts.map +0 -1
  434. package/dist/lib/setup/ui/index.js.map +0 -1
  435. package/dist/lib/setup/ui/menu.d.ts.map +0 -1
  436. package/dist/lib/setup/ui/menu.js.map +0 -1
  437. package/dist/lib/setup/ui/panel.d.ts.map +0 -1
  438. package/dist/lib/setup/ui/panel.js.map +0 -1
  439. package/dist/lib/setup/ui/prompt.d.ts.map +0 -1
  440. package/dist/lib/setup/ui/prompt.js.map +0 -1
  441. package/dist/lib/setup/ui/safePrompt.d.ts.map +0 -1
  442. package/dist/lib/setup/ui/safePrompt.js.map +0 -1
  443. package/dist/lib/setup/ui/spinner.d.ts.map +0 -1
  444. package/dist/lib/setup/ui/spinner.js.map +0 -1
  445. package/dist/lib/setup/ui/status.d.ts.map +0 -1
  446. package/dist/lib/setup/ui/status.js.map +0 -1
  447. package/dist/lib/setup/ui/table.d.ts.map +0 -1
  448. package/dist/lib/setup/ui/table.js.map +0 -1
  449. package/dist/lib/setup/ui/title.d.ts.map +0 -1
  450. package/dist/lib/setup/ui/title.js.map +0 -1
  451. package/dist/lib/setup/ui/tokens.d.ts.map +0 -1
  452. package/dist/lib/setup/ui/tokens.js.map +0 -1
  453. package/dist/lib/setup.d.ts.map +0 -1
  454. package/dist/lib/setup.js.map +0 -1
  455. package/dist/lib/staticSearch.d.ts.map +0 -1
  456. package/dist/lib/staticSearch.js.map +0 -1
  457. package/dist/lib/store.d.ts.map +0 -1
  458. package/dist/lib/store.js.map +0 -1
  459. package/dist/lib/structuredIngest.d.ts.map +0 -1
  460. package/dist/lib/structuredIngest.js.map +0 -1
  461. package/dist/lib/tags.d.ts.map +0 -1
  462. package/dist/lib/tags.js.map +0 -1
  463. package/dist/lib/timeline.d.ts.map +0 -1
  464. package/dist/lib/timeline.js.map +0 -1
  465. package/dist/lib/trace.d.ts.map +0 -1
  466. package/dist/lib/trace.js.map +0 -1
  467. package/dist/lib/upgrade.d.ts.map +0 -1
  468. package/dist/lib/upgrade.js.map +0 -1
  469. package/dist/lib/videoExtract.d.ts.map +0 -1
  470. package/dist/lib/videoExtract.js.map +0 -1
  471. package/dist/lib/webIndex.d.ts.map +0 -1
  472. package/dist/lib/webIndex.js.map +0 -1
  473. package/dist/lib/webIngest.d.ts.map +0 -1
  474. package/dist/lib/webIngest.js.map +0 -1
  475. package/dist/lib/wikilinks.d.ts.map +0 -1
  476. package/dist/lib/wikilinks.js.map +0 -1
  477. package/dist/postinstall.d.ts.map +0 -1
  478. package/dist/postinstall.js.map +0 -1
  479. package/dist/sandbox/client.d.ts.map +0 -1
  480. package/dist/sandbox/client.js.map +0 -1
  481. package/dist/sandbox/helper-template.d.ts.map +0 -1
  482. package/dist/sandbox/helper-template.js.map +0 -1
  483. package/dist/sandbox/index.d.ts +0 -10
  484. package/dist/sandbox/index.d.ts.map +0 -1
  485. package/dist/sandbox/index.js +0 -10
  486. package/dist/sandbox/index.js.map +0 -1
  487. package/dist/sandbox/manager.d.ts.map +0 -1
  488. package/dist/sandbox/manager.js.map +0 -1
  489. package/dist/sandbox/server.d.ts.map +0 -1
  490. package/dist/sandbox/server.js.map +0 -1
@@ -3,4 +3,3 @@
3
3
  * React/ink components can import without pulling fs/path dependencies.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=types.js.map
@@ -11,10 +11,10 @@
11
11
  * tags.from-chat: ["true"]
12
12
  * tags.source: ["remember" | "save-turn" | "auto" | "attach"]
13
13
  */
14
- import { GnosysDB } from "../db.js";
15
- import { GnosysConfig } from "../config.js";
16
- import { Turn } from "./types.js";
17
- export type PromoteSource = "remember" | "save-turn" | "auto" | "attach";
14
+ import type { GnosysDB } from "../db.js";
15
+ import type { GnosysConfig } from "../config.js";
16
+ import type { Turn } from "./types.js";
17
+ type PromoteSource = "remember" | "save-turn" | "auto" | "attach";
18
18
  export interface PromoteOptions {
19
19
  /** Free-form text to save. */
20
20
  content: string;
@@ -63,4 +63,4 @@ export interface AutoPromoteHint {
63
63
  * Returns null when nothing matches.
64
64
  */
65
65
  export declare function detectAutoPromote(userText: string): AutoPromoteHint | null;
66
- //# sourceMappingURL=write.d.ts.map
66
+ export {};
@@ -200,4 +200,3 @@ function fnv1a(text) {
200
200
  }
201
201
  return (hash >>> 0).toString(16).padStart(8, "0");
202
202
  }
203
- //# sourceMappingURL=write.js.map
@@ -43,4 +43,3 @@ export declare function splitSegments(segments: Array<{
43
43
  page?: string;
44
44
  timerange?: string;
45
45
  }>, options?: ChunkOptions): TextChunk[];
46
- //# sourceMappingURL=chunkSplitter.d.ts.map
@@ -230,4 +230,3 @@ export function splitSegments(segments, options) {
230
230
  }
231
231
  return allChunks;
232
232
  }
233
- //# sourceMappingURL=chunkSplitter.js.map
@@ -49,4 +49,3 @@ export interface CleanupResult {
49
49
  * writes when `yes === true`, otherwise just returns the diff (dry run).
50
50
  */
51
51
  export declare function cleanupRegistry(opts: CleanupOptions): Promise<CleanupResult>;
52
- //# sourceMappingURL=cleanup.d.ts.map
@@ -165,4 +165,3 @@ export async function cleanupRegistry(opts) {
165
165
  }
166
166
  return { removed: toRemove, kept: categorized.alive.length, wrote: true };
167
167
  }
168
- //# sourceMappingURL=cleanup.js.map
@@ -382,4 +382,3 @@ export declare function generateConfigTemplate(): string;
382
382
  */
383
383
  export declare const ALL_PROVIDERS: LLMProviderName[];
384
384
  export {};
385
- //# sourceMappingURL=config.d.ts.map
@@ -7,6 +7,7 @@ import fs from "fs/promises";
7
7
  import path from "path";
8
8
  import { execSync } from "child_process";
9
9
  import { getGnosysHome } from "./paths.js";
10
+ import { atomicWriteFile } from "./atomicWrite.js";
10
11
  // ─── LLM Provider Schemas ───────────────────────────────────────────────
11
12
  const LLMProviderEnum = z.enum(["anthropic", "ollama", "groq", "openai", "lmstudio", "xai", "mistral", "custom"]);
12
13
  const AnthropicConfigSchema = z.object({
@@ -534,7 +535,7 @@ export async function loadConfig(storePath) {
534
535
  export async function writeConfig(storePath, config) {
535
536
  const configPath = path.join(storePath, "gnosys.json");
536
537
  const merged = GnosysConfigSchema.parse(config);
537
- await fs.writeFile(configPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
538
+ await atomicWriteFile(configPath, JSON.stringify(merged, null, 2) + "\n");
538
539
  }
539
540
  /**
540
541
  * Update specific fields in gnosys.json without overwriting the whole file.
@@ -554,7 +555,7 @@ export async function updateConfig(storePath, updates) {
554
555
  // Validate for shape/type errors. The validated object has defaults
555
556
  // applied; we deliberately throw it away and persist `merged` instead.
556
557
  const validated = GnosysConfigSchema.parse(merged);
557
- await fs.writeFile(configPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
558
+ await atomicWriteFile(configPath, JSON.stringify(merged, null, 2) + "\n");
558
559
  return validated;
559
560
  }
560
561
  /**
@@ -617,4 +618,3 @@ export function generateConfigTemplate() {
617
618
  * All supported provider names.
618
619
  */
619
620
  export const ALL_PROVIDERS = ["anthropic", "ollama", "groq", "openai", "lmstudio", "xai", "mistral", "custom"];
620
- //# sourceMappingURL=config.js.map
@@ -2,9 +2,9 @@
2
2
  * Gnosys Dashboard — Aggregated system status in a pretty terminal display.
3
3
  * Combines memory stats, maintenance health, graph stats, and LLM routing.
4
4
  */
5
- import { GnosysResolver } from "./resolver.js";
6
- import { GnosysConfig, LLMProviderName } from "./config.js";
7
- import { GnosysDB } from "./db.js";
5
+ import type { GnosysResolver } from "./resolver.js";
6
+ import { type GnosysConfig, type LLMProviderName } from "./config.js";
7
+ import type { GnosysDB } from "./db.js";
8
8
  export interface DashboardData {
9
9
  stores: Array<{
10
10
  label: string;
@@ -92,4 +92,3 @@ export declare function formatDashboard(data: DashboardData): string;
92
92
  * Format dashboard data as structured JSON for MCP tool consumption.
93
93
  */
94
94
  export declare function formatDashboardJSON(data: DashboardData): string;
95
- //# sourceMappingURL=dashboard.d.ts.map
@@ -5,6 +5,8 @@
5
5
  import { resolveTaskModel, ALL_PROVIDERS, } from "./config.js";
6
6
  import { isProviderAvailable } from "./llm.js";
7
7
  import { GnosysEmbeddings } from "./embeddings.js";
8
+ import { readMachineConfig } from "./machineConfig.js";
9
+ import { effectiveProjectPath } from "./projectPaths.js";
8
10
  import fs from "fs/promises";
9
11
  import path from "path";
10
12
  /**
@@ -53,9 +55,11 @@ export async function collectDashboardData(resolver, config, version, gnosysDb)
53
55
  let totalMemories = 0;
54
56
  if (gnosysDb?.isAvailable() && gnosysDb?.isMigrated()) {
55
57
  const projects = gnosysDb.getAllProjects();
58
+ const machine = readMachineConfig();
56
59
  for (const p of projects) {
57
60
  const count = gnosysDb.getMemoriesByProject(p.id).length;
58
- storeData.push({ label: p.name, path: p.working_directory, memoryCount: count });
61
+ const path = effectiveProjectPath(gnosysDb, p, machine) ?? "(not on this machine)";
62
+ storeData.push({ label: p.name, path, memoryCount: count });
59
63
  totalMemories += count;
60
64
  }
61
65
  // Also count user/global-scoped memories that have no project_id
@@ -417,4 +421,3 @@ export function formatDashboard(data) {
417
421
  export function formatDashboardJSON(data) {
418
422
  return JSON.stringify(data, null, 2);
419
423
  }
420
- //# sourceMappingURL=dashboard.js.map
package/dist/lib/db.d.ts CHANGED
@@ -40,12 +40,26 @@ export interface DbProject {
40
40
  id: string;
41
41
  name: string;
42
42
  working_directory: string;
43
+ root_id?: string | null;
44
+ rel_path?: string | null;
43
45
  user: string;
44
46
  agent_rules_target: string | null;
45
47
  obsidian_vault: string | null;
46
48
  created: string;
47
49
  modified: string;
48
50
  }
51
+ /**
52
+ * v5.11: Per-machine project location override. One row per (project, machine)
53
+ * for projects that live OUTSIDE any named root (so root_id/rel_path can't
54
+ * resolve them). The composite primary key means each machine owns its own
55
+ * row — machines never clobber each other's path.
56
+ */
57
+ export interface DbProjectLocation {
58
+ project_id: string;
59
+ machine_id: string;
60
+ abs_path: string;
61
+ modified: string;
62
+ }
49
63
  export type MemoryScope = "project" | "user" | "global";
50
64
  export interface DbRelationship {
51
65
  source_id: string;
@@ -223,6 +237,13 @@ export declare class GnosysDB {
223
237
  */
224
238
  getMemoriesByScope(scope: MemoryScope): DbMemory[];
225
239
  insertProject(project: DbProject): void;
240
+ /** This machine's stored absolute path for a project, or null if none. */
241
+ getProjectLocation(projectId: string, machineId: string): DbProjectLocation | null;
242
+ /** All machines' stored locations for a project. */
243
+ getProjectLocations(projectId: string): DbProjectLocation[];
244
+ /** Record/replace this machine's path for a project (composite PK). */
245
+ setProjectLocation(loc: DbProjectLocation): void;
246
+ deleteProjectLocation(projectId: string, machineId: string): void;
226
247
  getProject(id: string): DbProject | null;
227
248
  getProjectByDirectory(dir: string): DbProject | null;
228
249
  getAllProjects(): DbProject[];
@@ -291,6 +312,9 @@ export declare class GnosysDB {
291
312
  transaction<T>(fn: () => T): T;
292
313
  getMeta(key: string): string | null;
293
314
  setMeta(key: string, value: string): void;
315
+ /** Remove a meta key. Used by v5.11 migrate to move machine-local values
316
+ * (machine_id, remote_path) out of the synced DB into machine.json. */
317
+ deleteMeta(key: string): void;
294
318
  /**
295
319
  * Get the machine ID designated to run dream cycles. Stored in gnosys_meta
296
320
  * under `dream_machine_id`. Returns null if no machine is designated (dream
@@ -355,4 +379,3 @@ export declare class GnosysDB {
355
379
  getSchemaVersion(): number;
356
380
  }
357
381
  export { fnv1a };
358
- //# sourceMappingURL=db.d.ts.map
package/dist/lib/db.js CHANGED
@@ -20,9 +20,11 @@ import path from "path";
20
20
  import fs from "fs";
21
21
  import { enableWAL } from "./lock.js";
22
22
  import { getGnosysHome as getGnosysHomeImpl, getCentralDbPath as getCentralDbPathImpl } from "./paths.js";
23
+ import { readMachineConfig } from "./machineConfig.js";
24
+ import { logError } from "./log.js";
23
25
  import { ulid } from "ulidx";
24
26
  // ─── Schema ─────────────────────────────────────────────────────────────
25
- const SCHEMA_VERSION = 3;
27
+ const SCHEMA_VERSION = 4;
26
28
  const SCHEMA_SQL = `
27
29
  CREATE TABLE IF NOT EXISTS memories (
28
30
  id TEXT PRIMARY KEY,
@@ -61,6 +63,8 @@ CREATE INDEX IF NOT EXISTS idx_memories_last_reinforced ON memories(last_reinfor
61
63
  CREATE INDEX IF NOT EXISTS idx_memories_content_hash ON memories(content_hash);
62
64
  CREATE INDEX IF NOT EXISTS idx_memories_project_id ON memories(project_id);
63
65
  CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope);
66
+ CREATE INDEX IF NOT EXISTS idx_memories_modified ON memories(modified);
67
+ CREATE INDEX IF NOT EXISTS idx_memories_created ON memories(created);
64
68
 
65
69
  CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
66
70
  id,
@@ -112,10 +116,15 @@ CREATE INDEX IF NOT EXISTS idx_audit_timestamp ON audit_log(timestamp);
112
116
  CREATE INDEX IF NOT EXISTS idx_audit_operation ON audit_log(operation);
113
117
  CREATE INDEX IF NOT EXISTS idx_audit_trace ON audit_log(trace_id);
114
118
 
119
+ -- v5.11: working_directory is a machine-local display cache (not UNIQUE, not
120
+ -- identity). Portable identity is id (UUID); portable location is root_id +
121
+ -- rel_path resolved against this machine's roots (see machineConfig.ts).
115
122
  CREATE TABLE IF NOT EXISTS projects (
116
123
  id TEXT PRIMARY KEY,
117
124
  name TEXT NOT NULL,
118
- working_directory TEXT NOT NULL UNIQUE,
125
+ working_directory TEXT NOT NULL DEFAULT '',
126
+ root_id TEXT,
127
+ rel_path TEXT,
119
128
  user TEXT NOT NULL,
120
129
  agent_rules_target TEXT,
121
130
  obsidian_vault TEXT,
@@ -123,6 +132,15 @@ CREATE TABLE IF NOT EXISTS projects (
123
132
  modified TEXT NOT NULL
124
133
  );
125
134
 
135
+ -- v5.11: per-machine path override for projects outside any named root.
136
+ CREATE TABLE IF NOT EXISTS project_locations (
137
+ project_id TEXT NOT NULL,
138
+ machine_id TEXT NOT NULL,
139
+ abs_path TEXT NOT NULL,
140
+ modified TEXT NOT NULL,
141
+ PRIMARY KEY (project_id, machine_id)
142
+ );
143
+
126
144
  CREATE TABLE IF NOT EXISTS gnosys_meta (
127
145
  key TEXT PRIMARY KEY,
128
146
  value TEXT NOT NULL,
@@ -183,8 +201,8 @@ const MEMORY_COLUMNS = new Set([
183
201
  "project_id", "scope",
184
202
  ]);
185
203
  const PROJECT_COLUMNS = new Set([
186
- "name", "working_directory", "user", "agent_rules_target",
187
- "obsidian_vault", "created", "modified",
204
+ "name", "working_directory", "root_id", "rel_path", "user",
205
+ "agent_rules_target", "obsidian_vault", "created", "modified",
188
206
  ]);
189
207
  // ─── FNV-1a hash (same as embeddings.ts) ────────────────────────────────
190
208
  function fnv1a(str) {
@@ -241,9 +259,16 @@ export class GnosysDB {
241
259
  }
242
260
  const localDb = GnosysDB.openLocal();
243
261
  // Check if remote is configured. If not, we're done — return local.
262
+ // v5.11: the remote connection is machine-local (machine.json), since the
263
+ // NAS mount path / Tailscale URL differs per machine. Prefer it; fall back
264
+ // to the legacy synced gnosys_meta value when machine.json has none.
244
265
  let remotePath = null;
245
266
  try {
246
- if (localDb.isAvailable()) {
267
+ const mc = readMachineConfig();
268
+ if (mc?.remote?.enabled && mc.remote.path) {
269
+ remotePath = mc.remote.path;
270
+ }
271
+ else if (localDb.isAvailable()) {
247
272
  remotePath = localDb.getMeta("remote_path");
248
273
  }
249
274
  }
@@ -269,7 +294,10 @@ export class GnosysDB {
269
294
  // Quiet fallback notice on stderr — visible to humans, doesn't pollute
270
295
  // stdout that scripts/agents are piping. Only emitted when remote is
271
296
  // CONFIGURED but unreachable (the user expected it to work).
272
- process.stderr.write(`gnosys: remote unreachable (${remotePath}), using local cache\n`);
297
+ logError(new Error(`remote unreachable (${remotePath}), using local cache`), {
298
+ module: "db",
299
+ op: "open",
300
+ });
273
301
  return localDb;
274
302
  }
275
303
  // Remote is reachable — open it and return. Close local first since we
@@ -288,7 +316,13 @@ export class GnosysDB {
288
316
  */
289
317
  static openLocal() {
290
318
  const dir = GnosysDB.getGnosysHome();
291
- fs.mkdirSync(dir, { recursive: true });
319
+ fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
320
+ try {
321
+ fs.chmodSync(dir, 0o700);
322
+ }
323
+ catch {
324
+ // best-effort (Windows / network FS)
325
+ }
292
326
  return new GnosysDB(dir);
293
327
  }
294
328
  constructor(storePath, opts) {
@@ -300,9 +334,22 @@ export class GnosysDB {
300
334
  const retryDelay = opts?.retryDelayMs ?? 500;
301
335
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
302
336
  try {
303
- fs.mkdirSync(storePath, { recursive: true });
337
+ fs.mkdirSync(storePath, { recursive: true, mode: 0o700 });
304
338
  this.db = new Database(this.dbFilePath);
305
339
  enableWAL(this.db);
340
+ try {
341
+ fs.chmodSync(storePath, 0o700);
342
+ fs.chmodSync(this.dbFilePath, 0o600);
343
+ for (const ext of ["-wal", "-shm"]) {
344
+ const sidecar = this.dbFilePath + ext;
345
+ if (fs.existsSync(sidecar)) {
346
+ fs.chmodSync(sidecar, 0o600);
347
+ }
348
+ }
349
+ }
350
+ catch {
351
+ // best-effort (Windows / network FS)
352
+ }
306
353
  this.db.pragma("foreign_keys = ON");
307
354
  // Longer busy timeout for network shares (10s)
308
355
  this.db.pragma("busy_timeout = 10000");
@@ -453,6 +500,13 @@ export class GnosysDB {
453
500
  return new GnosysDB(dir);
454
501
  }
455
502
  applySchema() {
503
+ const currentVersion = this.db.pragma("user_version", { simple: true });
504
+ // Legacy DBs (user_version >= 1) must migrate before the full current
505
+ // schema is applied — SCHEMA_SQL creates indexes on columns (project_id,
506
+ // scope, …) that do not exist on v1/v2 databases yet.
507
+ if (currentVersion > 0 && currentVersion < SCHEMA_VERSION) {
508
+ this.migrateSchema(currentVersion);
509
+ }
456
510
  // Apply main schema
457
511
  this.db.exec(SCHEMA_SQL);
458
512
  // Apply triggers (separate because of FTS5 delete syntax)
@@ -462,10 +516,11 @@ export class GnosysDB {
462
516
  catch {
463
517
  // Triggers may already exist — that's fine
464
518
  }
465
- // Schema migration: v1 v2 (add project_id, scope, projects table)
466
- const currentVersion = this.db.pragma("user_version", { simple: true });
467
- if (currentVersion < SCHEMA_VERSION) {
468
- this.migrateSchema(currentVersion);
519
+ // Fresh DBs (user_version 0) get the full schema first, then migrate
520
+ // to stamp user_version and apply any incremental steps idempotently.
521
+ const versionAfterSchema = this.db.pragma("user_version", { simple: true });
522
+ if (versionAfterSchema < SCHEMA_VERSION) {
523
+ this.migrateSchema(versionAfterSchema);
469
524
  }
470
525
  }
471
526
  /**
@@ -535,6 +590,57 @@ export class GnosysDB {
535
590
  // Column already exists — fine
536
591
  }
537
592
  }
593
+ if (fromVersion < 4) {
594
+ // v3 → v4 (v5.11): machine-portable project paths.
595
+ // Add root_id/rel_path and drop the UNIQUE constraint on
596
+ // working_directory (which forced a single path per project across all
597
+ // machines). SQLite can't drop a constraint in place, so rebuild the
598
+ // table — but only if the new shape isn't already present (a fresh DB
599
+ // gets it straight from SCHEMA_SQL above).
600
+ const cols = this.db.pragma("table_info(projects)");
601
+ const hasRelPath = cols.some((c) => c.name === "rel_path");
602
+ if (!hasRelPath) {
603
+ const rebuild = this.db.transaction(() => {
604
+ this.db.exec(`
605
+ CREATE TABLE projects_new (
606
+ id TEXT PRIMARY KEY,
607
+ name TEXT NOT NULL,
608
+ working_directory TEXT NOT NULL DEFAULT '',
609
+ root_id TEXT,
610
+ rel_path TEXT,
611
+ user TEXT NOT NULL,
612
+ agent_rules_target TEXT,
613
+ obsidian_vault TEXT,
614
+ created TEXT NOT NULL,
615
+ modified TEXT NOT NULL
616
+ )
617
+ `);
618
+ this.db.exec(`
619
+ INSERT INTO projects_new
620
+ (id, name, working_directory, user, agent_rules_target, obsidian_vault, created, modified)
621
+ SELECT id, name, working_directory, user, agent_rules_target, obsidian_vault, created, modified
622
+ FROM projects
623
+ `);
624
+ this.db.exec("DROP TABLE projects");
625
+ this.db.exec("ALTER TABLE projects_new RENAME TO projects");
626
+ });
627
+ rebuild();
628
+ }
629
+ try {
630
+ this.db.exec(`
631
+ CREATE TABLE IF NOT EXISTS project_locations (
632
+ project_id TEXT NOT NULL,
633
+ machine_id TEXT NOT NULL,
634
+ abs_path TEXT NOT NULL,
635
+ modified TEXT NOT NULL,
636
+ PRIMARY KEY (project_id, machine_id)
637
+ )
638
+ `);
639
+ }
640
+ catch {
641
+ // Table may already exist
642
+ }
643
+ }
538
644
  this.db.pragma(`user_version = ${SCHEMA_VERSION}`);
539
645
  }
540
646
  isAvailable() {
@@ -725,9 +831,38 @@ export class GnosysDB {
725
831
  return this.withRecovery(() => {
726
832
  this.db.prepare(`
727
833
  INSERT OR REPLACE INTO projects
728
- (id, name, working_directory, user, agent_rules_target, obsidian_vault, created, modified)
729
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)
730
- `).run(project.id, project.name, project.working_directory, project.user, project.agent_rules_target || null, project.obsidian_vault || null, project.created, project.modified);
834
+ (id, name, working_directory, root_id, rel_path, user, agent_rules_target, obsidian_vault, created, modified)
835
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
836
+ `).run(project.id, project.name, project.working_directory, project.root_id ?? null, project.rel_path ?? null, project.user, project.agent_rules_target || null, project.obsidian_vault || null, project.created, project.modified);
837
+ });
838
+ }
839
+ // ─── Per-machine project locations (v5.11) ─────────────────────────
840
+ /** This machine's stored absolute path for a project, or null if none. */
841
+ getProjectLocation(projectId, machineId) {
842
+ return this.withRecovery(() => this.db
843
+ .prepare("SELECT * FROM project_locations WHERE project_id = ? AND machine_id = ?")
844
+ .get(projectId, machineId) || null);
845
+ }
846
+ /** All machines' stored locations for a project. */
847
+ getProjectLocations(projectId) {
848
+ return this.withRecovery(() => this.db
849
+ .prepare("SELECT * FROM project_locations WHERE project_id = ?")
850
+ .all(projectId));
851
+ }
852
+ /** Record/replace this machine's path for a project (composite PK). */
853
+ setProjectLocation(loc) {
854
+ return this.withRecovery(() => {
855
+ this.db.prepare(`
856
+ INSERT OR REPLACE INTO project_locations (project_id, machine_id, abs_path, modified)
857
+ VALUES (?, ?, ?, ?)
858
+ `).run(loc.project_id, loc.machine_id, loc.abs_path, loc.modified);
859
+ });
860
+ }
861
+ deleteProjectLocation(projectId, machineId) {
862
+ return this.withRecovery(() => {
863
+ this.db
864
+ .prepare("DELETE FROM project_locations WHERE project_id = ? AND machine_id = ?")
865
+ .run(projectId, machineId);
731
866
  });
732
867
  }
733
868
  getProject(id) {
@@ -963,6 +1098,18 @@ export class GnosysDB {
963
1098
  }
964
1099
  }
965
1100
  }
1101
+ /** Remove a meta key. Used by v5.11 migrate to move machine-local values
1102
+ * (machine_id, remote_path) out of the synced DB into machine.json. */
1103
+ deleteMeta(key) {
1104
+ if (!this.available)
1105
+ return;
1106
+ try {
1107
+ this.db.prepare("DELETE FROM gnosys_meta WHERE key = ?").run(key);
1108
+ }
1109
+ catch {
1110
+ // table may not exist — nothing to delete
1111
+ }
1112
+ }
966
1113
  // ─── Dream state (v5.4.2) ───────────────────────────────────────────
967
1114
  /**
968
1115
  * Get the machine ID designated to run dream cycles. Stored in gnosys_meta
@@ -1105,4 +1252,3 @@ export class GnosysDB {
1105
1252
  }
1106
1253
  // ─── Migration Helper ─────────────────────────────────────────────────
1107
1254
  export { fnv1a };
1108
- //# sourceMappingURL=db.js.map
@@ -9,9 +9,9 @@
9
9
  * Implements the same result types so consumers (recall, hybridSearch, ask)
10
10
  * work without modification.
11
11
  */
12
- import { GnosysDB, DbMemory } from "./db.js";
13
- import { SearchResult, DiscoverResult } from "./search.js";
14
- import { HybridSearchResult, SearchMode } from "./hybridSearch.js";
12
+ import type { GnosysDB, DbMemory } from "./db.js";
13
+ import type { SearchResult, DiscoverResult } from "./search.js";
14
+ import type { HybridSearchResult, SearchMode } from "./searchTypes.js";
15
15
  export declare class GnosysDbSearch {
16
16
  private db;
17
17
  constructor(db: GnosysDB);
@@ -62,4 +62,3 @@ export declare class GnosysDbSearch {
62
62
  */
63
63
  embeddingCount(): number;
64
64
  }
65
- //# sourceMappingURL=dbSearch.d.ts.map
@@ -235,4 +235,3 @@ export class GnosysDbSearch {
235
235
  return this.db.getEmbeddingCount();
236
236
  }
237
237
  }
238
- //# sourceMappingURL=dbSearch.js.map
@@ -13,8 +13,8 @@
13
13
  * Once the Obsidian Export Bridge (Phase 7e) is complete, .md writes
14
14
  * become optional — controlled by config.
15
15
  */
16
- import { GnosysDB } from "./db.js";
17
- import { MemoryFrontmatter } from "./store.js";
16
+ import type { GnosysDB } from "./db.js";
17
+ import { type MemoryFrontmatter } from "./store.js";
18
18
  /**
19
19
  * Sync a memory write to gnosys.db after it's been written to .md.
20
20
  * Call this after GnosysStore.writeMemory() or updateMemory().
@@ -53,4 +53,3 @@ export declare function syncConfidenceToDb(db: GnosysDB, memoryId: string, newCo
53
53
  * This supplements (and eventually replaces) the JSONL audit log.
54
54
  */
55
55
  export declare function auditToDb(db: GnosysDB, operation: string, memoryId?: string, details?: Record<string, unknown>, durationMs?: number, traceId?: string): void;
56
- //# sourceMappingURL=dbWrite.d.ts.map
@@ -187,4 +187,3 @@ export function auditToDb(db, operation, memoryId, details, durationMs, traceId)
187
187
  trace_id: traceId || null,
188
188
  });
189
189
  }
190
- //# sourceMappingURL=dbWrite.js.map
@@ -28,4 +28,3 @@ export interface NotifyOptions {
28
28
  * fell back to stderr.
29
29
  */
30
30
  export declare function notifyDesktop(message: string, opts?: NotifyOptions): Promise<boolean>;
31
- //# sourceMappingURL=desktopNotify.d.ts.map
@@ -77,4 +77,3 @@ function stderrFallback(title, message) {
77
77
  function escapeAppleScript(s) {
78
78
  return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
79
79
  }
80
- //# sourceMappingURL=desktopNotify.js.map
@@ -24,4 +24,3 @@ export interface DocxChunk {
24
24
  * a single chunk.
25
25
  */
26
26
  export declare function extractDocxText(filePath: string): Promise<DocxChunk[]>;
27
- //# sourceMappingURL=docxExtract.d.ts.map
@@ -6,6 +6,8 @@
6
6
  * Both libraries are loaded via dynamic import so they stay optional.
7
7
  */
8
8
  import * as fs from "fs/promises";
9
+ /** Reject DOCX archives whose entries decompress beyond this total (zip-bomb guard). */
10
+ const MAX_DECOMPRESSED_BYTES = 200 * 1024 * 1024;
9
11
  // ─── Public API ─────────────────────────────────────────────────────────
10
12
  /**
11
13
  * Extract text from a DOCX file as markdown, split into section chunks.
@@ -25,6 +27,7 @@ export async function extractDocxText(filePath) {
25
27
  const TurndownService = (await import("turndown")).default;
26
28
  // Read the file and convert to HTML
27
29
  const buffer = await fs.readFile(filePath);
30
+ await assertDocxDecompressedSizeWithinLimit(buffer);
28
31
  const result = await mammoth.convertToHtml({ buffer });
29
32
  const html = result.value;
30
33
  if (!html || !html.trim()) {
@@ -77,4 +80,22 @@ export async function extractDocxText(filePath) {
77
80
  }
78
81
  return chunks;
79
82
  }
80
- //# sourceMappingURL=docxExtract.js.map
83
+ /**
84
+ * Inspect ZIP central-directory metadata before decompression.
85
+ * Rejects archives whose total uncompressed payload exceeds the cap.
86
+ */
87
+ async function assertDocxDecompressedSizeWithinLimit(buffer) {
88
+ const JSZip = (await import("jszip")).default;
89
+ const zip = await JSZip.loadAsync(buffer);
90
+ let total = 0;
91
+ zip.forEach((_relativePath, entry) => {
92
+ if (entry.dir)
93
+ return;
94
+ const data = entry._data;
95
+ const size = data?.uncompressedSize ?? 0;
96
+ total += size;
97
+ });
98
+ if (total > MAX_DECOMPRESSED_BYTES) {
99
+ throw new Error(`DOCX decompresses to ~${Math.floor(total / 1048576)}MB, exceeds the ${MAX_DECOMPRESSED_BYTES / 1048576}MB limit (possible zip bomb).`);
100
+ }
101
+ }
@@ -17,8 +17,8 @@
17
17
  * - Off by default — must be explicitly enabled
18
18
  * - Uses cheap/local LLM (configurable, defaults to Ollama)
19
19
  */
20
- import { GnosysDB } from "./db.js";
21
- import { GnosysConfig, LLMProviderName } from "./config.js";
20
+ import type { GnosysDB } from "./db.js";
21
+ import type { GnosysConfig, LLMProviderName } from "./config.js";
22
22
  export interface DreamConfig {
23
23
  /** Enable dream mode (default: false) */
24
24
  enabled: boolean;
@@ -179,4 +179,3 @@ export declare class DreamScheduler {
179
179
  * Format a dream report as human-readable text.
180
180
  */
181
181
  export declare function formatDreamReport(report: DreamReport): string;
182
- //# sourceMappingURL=dream.d.ts.map
package/dist/lib/dream.js CHANGED
@@ -21,6 +21,7 @@ import os from "os";
21
21
  import { getLLMProvider } from "./llm.js";
22
22
  import { notifyDesktop } from "./desktopNotify.js";
23
23
  import { syncConfidenceToDb, auditToDb } from "./dbWrite.js";
24
+ import { logError } from "./log.js";
24
25
  /** Layer 4 alert threshold: fire desktop notification at this many consecutive provider failures. */
25
26
  const DREAM_FAILURE_NOTIFY_THRESHOLD = 3;
26
27
  export const DEFAULT_DREAM_CONFIG = {
@@ -739,7 +740,7 @@ export class DreamScheduler {
739
740
  console.error(`[dream] Complete: ${report.decayUpdated} decay, ${report.summariesGenerated} summaries, ${report.reviewSuggestions.length} reviews, ${report.relationshipsDiscovered} relations (${(report.durationMs / 1000).toFixed(1)}s)`);
740
741
  }
741
742
  catch (err) {
742
- console.error(`[dream] Error: ${err instanceof Error ? err.message : String(err)}`);
743
+ logError(err, { module: "dream", op: "scheduler" });
743
744
  }
744
745
  finally {
745
746
  this.running = false;
@@ -794,4 +795,3 @@ export function formatDreamReport(report) {
794
795
  }
795
796
  return lines.join("\n");
796
797
  }
797
- //# sourceMappingURL=dream.js.map
@@ -4,7 +4,6 @@
4
4
  * Model (~80 MB) is downloaded only on first use and cached.
5
5
  * Embeddings are stored in SQLite as regeneratable sidecar data.
6
6
  */
7
- declare const EMBEDDING_DIM = 384;
8
7
  export declare class GnosysEmbeddings {
9
8
  private pipeline;
10
9
  private db;
@@ -80,5 +79,3 @@ export declare class GnosysEmbeddings {
80
79
  };
81
80
  close(): void;
82
81
  }
83
- export { EMBEDDING_DIM };
84
- //# sourceMappingURL=embeddings.d.ts.map