gnosys 5.10.0 → 5.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (500) hide show
  1. package/README.md +66 -0
  2. package/dist/cli.d.ts +0 -1
  3. package/dist/cli.js +293 -139
  4. package/dist/index.d.ts +5 -1
  5. package/dist/index.js +429 -349
  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 +2 -2
  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 +0 -1
  68. package/dist/lib/db.d.ts +0 -1
  69. package/dist/lib/db.js +40 -8
  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 +1 -2
  87. package/dist/lib/federated.js +0 -1
  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 +2 -2
  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 +2 -3
  115. package/dist/lib/machineConfig.js +14 -3
  116. package/dist/lib/machineMigrate.d.ts +0 -1
  117. package/dist/lib/machineMigrate.js +0 -1
  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 +50 -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 +0 -7
  133. package/dist/lib/paths.js +1 -2
  134. package/dist/lib/pdfExtract.d.ts +0 -1
  135. package/dist/lib/pdfExtract.js +0 -1
  136. package/dist/lib/platform.d.ts +24 -0
  137. package/dist/lib/platform.js +114 -0
  138. package/dist/lib/portfolio.d.ts +1 -2
  139. package/dist/lib/portfolio.js +0 -1
  140. package/dist/lib/portfolioHtml.d.ts +1 -2
  141. package/dist/lib/portfolioHtml.js +0 -1
  142. package/dist/lib/preferences.d.ts +6 -2
  143. package/dist/lib/preferences.js +19 -1
  144. package/dist/lib/progress.d.ts +2 -2
  145. package/dist/lib/progress.js +0 -1
  146. package/dist/lib/projectIdentity.d.ts +1 -2
  147. package/dist/lib/projectIdentity.js +5 -5
  148. package/dist/lib/projectPaths.d.ts +2 -2
  149. package/dist/lib/projectPaths.js +0 -1
  150. package/dist/lib/projectScan.d.ts +2 -2
  151. package/dist/lib/projectScan.js +0 -1
  152. package/dist/lib/recall.d.ts +6 -6
  153. package/dist/lib/recall.js +0 -1
  154. package/dist/lib/remote.d.ts +7 -20
  155. package/dist/lib/remote.js +58 -3
  156. package/dist/lib/remoteWizard.d.ts +1 -2
  157. package/dist/lib/remoteWizard.js +124 -7
  158. package/dist/lib/resolver.d.ts +1 -2
  159. package/dist/lib/resolver.js +2 -3
  160. package/dist/lib/retry.d.ts +0 -1
  161. package/dist/lib/retry.js +1 -2
  162. package/dist/lib/rulesGen.d.ts +2 -8
  163. package/dist/lib/rulesGen.js +1 -2
  164. package/dist/lib/search.d.ts +1 -2
  165. package/dist/lib/search.js +1 -1
  166. package/dist/lib/searchTypes.d.ts +18 -0
  167. package/dist/lib/searchTypes.js +2 -0
  168. package/dist/lib/setup/coldStart.d.ts +0 -1
  169. package/dist/lib/setup/coldStart.js +0 -1
  170. package/dist/lib/setup/configSetRender.d.ts +0 -1
  171. package/dist/lib/setup/configSetRender.js +0 -1
  172. package/dist/lib/setup/dreamRender.d.ts +0 -1
  173. package/dist/lib/setup/dreamRender.js +0 -1
  174. package/dist/lib/setup/dreamState.d.ts +2 -2
  175. package/dist/lib/setup/dreamState.js +0 -1
  176. package/dist/lib/setup/modelsRender.d.ts +0 -1
  177. package/dist/lib/setup/modelsRender.js +0 -1
  178. package/dist/lib/setup/remoteRender.d.ts +0 -1
  179. package/dist/lib/setup/remoteRender.js +0 -1
  180. package/dist/lib/setup/routingRender.d.ts +0 -1
  181. package/dist/lib/setup/routingRender.js +0 -1
  182. package/dist/lib/setup/sections/ides.d.ts +1 -2
  183. package/dist/lib/setup/sections/ides.js +3 -2
  184. package/dist/lib/setup/sections/preferences.d.ts +1 -2
  185. package/dist/lib/setup/sections/preferences.js +3 -2
  186. package/dist/lib/setup/sections/routing.d.ts +1 -2
  187. package/dist/lib/setup/sections/routing.js +0 -1
  188. package/dist/lib/setup/storePath.d.ts +0 -1
  189. package/dist/lib/setup/storePath.js +0 -1
  190. package/dist/lib/setup/summary.d.ts +1 -2
  191. package/dist/lib/setup/summary.js +0 -1
  192. package/dist/lib/setup/syncProjectsRender.d.ts +0 -1
  193. package/dist/lib/setup/syncProjectsRender.js +0 -1
  194. package/dist/lib/setup/ui/diff.d.ts +0 -1
  195. package/dist/lib/setup/ui/diff.js +0 -1
  196. package/dist/lib/setup/ui/footer.d.ts +0 -1
  197. package/dist/lib/setup/ui/footer.js +0 -1
  198. package/dist/lib/setup/ui/header.d.ts +0 -1
  199. package/dist/lib/setup/ui/header.js +0 -1
  200. package/dist/lib/setup/ui/index.d.ts +0 -1
  201. package/dist/lib/setup/ui/index.js +0 -1
  202. package/dist/lib/setup/ui/menu.d.ts +0 -1
  203. package/dist/lib/setup/ui/menu.js +0 -1
  204. package/dist/lib/setup/ui/panel.d.ts +0 -1
  205. package/dist/lib/setup/ui/panel.js +0 -1
  206. package/dist/lib/setup/ui/prompt.d.ts +0 -1
  207. package/dist/lib/setup/ui/prompt.js +0 -1
  208. package/dist/lib/setup/ui/safePrompt.d.ts +0 -1
  209. package/dist/lib/setup/ui/safePrompt.js +0 -1
  210. package/dist/lib/setup/ui/spinner.d.ts +0 -1
  211. package/dist/lib/setup/ui/spinner.js +0 -1
  212. package/dist/lib/setup/ui/status.d.ts +0 -1
  213. package/dist/lib/setup/ui/status.js +0 -1
  214. package/dist/lib/setup/ui/table.d.ts +0 -1
  215. package/dist/lib/setup/ui/table.js +0 -1
  216. package/dist/lib/setup/ui/title.d.ts +0 -1
  217. package/dist/lib/setup/ui/title.js +0 -1
  218. package/dist/lib/setup/ui/tokens.d.ts +0 -1
  219. package/dist/lib/setup/ui/tokens.js +0 -1
  220. package/dist/lib/setup.d.ts +2 -31
  221. package/dist/lib/setup.js +56 -54
  222. package/dist/lib/staticSearch.d.ts +0 -1
  223. package/dist/lib/staticSearch.js +0 -1
  224. package/dist/lib/store.d.ts +0 -1
  225. package/dist/lib/store.js +0 -1
  226. package/dist/lib/structuredIngest.d.ts +0 -1
  227. package/dist/lib/structuredIngest.js +0 -1
  228. package/dist/lib/tags.d.ts +0 -1
  229. package/dist/lib/tags.js +0 -1
  230. package/dist/lib/timeline.d.ts +2 -3
  231. package/dist/lib/timeline.js +3 -4
  232. package/dist/lib/trace.d.ts +1 -16
  233. package/dist/lib/trace.js +0 -1
  234. package/dist/lib/upgrade.d.ts +4 -2
  235. package/dist/lib/upgrade.js +15 -3
  236. package/dist/lib/videoExtract.d.ts +0 -1
  237. package/dist/lib/videoExtract.js +2 -5
  238. package/dist/lib/webIndex.d.ts +1 -3
  239. package/dist/lib/webIndex.js +0 -1
  240. package/dist/lib/webIngest.d.ts +13 -1
  241. package/dist/lib/webIngest.js +98 -24
  242. package/dist/lib/wikilinks.d.ts +3 -3
  243. package/dist/lib/wikilinks.js +0 -1
  244. package/dist/postinstall.d.ts +0 -1
  245. package/dist/postinstall.js +0 -1
  246. package/dist/sandbox/client.d.ts +0 -1
  247. package/dist/sandbox/client.js +0 -1
  248. package/dist/sandbox/helper-template.d.ts +0 -1
  249. package/dist/sandbox/helper-template.js +0 -1
  250. package/dist/sandbox/manager.d.ts +0 -9
  251. package/dist/sandbox/manager.js +2 -3
  252. package/dist/sandbox/server.d.ts +2 -3
  253. package/dist/sandbox/server.js +7 -7
  254. package/docs/logo.svg +25 -0
  255. package/package.json +18 -6
  256. package/prompts/synthesize.md +2 -0
  257. package/dist/cli.d.ts.map +0 -1
  258. package/dist/cli.js.map +0 -1
  259. package/dist/index.d.ts.map +0 -1
  260. package/dist/index.js.map +0 -1
  261. package/dist/lib/archive.d.ts.map +0 -1
  262. package/dist/lib/archive.js.map +0 -1
  263. package/dist/lib/ask.d.ts.map +0 -1
  264. package/dist/lib/ask.js.map +0 -1
  265. package/dist/lib/attachments.d.ts.map +0 -1
  266. package/dist/lib/attachments.js.map +0 -1
  267. package/dist/lib/audioExtract.d.ts.map +0 -1
  268. package/dist/lib/audioExtract.js.map +0 -1
  269. package/dist/lib/audit.d.ts.map +0 -1
  270. package/dist/lib/audit.js.map +0 -1
  271. package/dist/lib/bootstrap.d.ts.map +0 -1
  272. package/dist/lib/bootstrap.js.map +0 -1
  273. package/dist/lib/chat/SlashPalette.d.ts.map +0 -1
  274. package/dist/lib/chat/SlashPalette.js.map +0 -1
  275. package/dist/lib/chat/boot-splash.d.ts.map +0 -1
  276. package/dist/lib/chat/boot-splash.js.map +0 -1
  277. package/dist/lib/chat/choose.d.ts.map +0 -1
  278. package/dist/lib/chat/choose.js.map +0 -1
  279. package/dist/lib/chat/commands.d.ts.map +0 -1
  280. package/dist/lib/chat/commands.js.map +0 -1
  281. package/dist/lib/chat/components/CitationText.d.ts.map +0 -1
  282. package/dist/lib/chat/components/CitationText.js.map +0 -1
  283. package/dist/lib/chat/components/MarkdownRenderer.d.ts.map +0 -1
  284. package/dist/lib/chat/components/MarkdownRenderer.js.map +0 -1
  285. package/dist/lib/chat/components/ToolCallCard.d.ts.map +0 -1
  286. package/dist/lib/chat/components/ToolCallCard.js.map +0 -1
  287. package/dist/lib/chat/focus.d.ts.map +0 -1
  288. package/dist/lib/chat/focus.js.map +0 -1
  289. package/dist/lib/chat/index.d.ts.map +0 -1
  290. package/dist/lib/chat/index.js.map +0 -1
  291. package/dist/lib/chat/intent.d.ts.map +0 -1
  292. package/dist/lib/chat/intent.js.map +0 -1
  293. package/dist/lib/chat/llmTurn.d.ts.map +0 -1
  294. package/dist/lib/chat/llmTurn.js.map +0 -1
  295. package/dist/lib/chat/recall.d.ts.map +0 -1
  296. package/dist/lib/chat/recall.js.map +0 -1
  297. package/dist/lib/chat/render.d.ts.map +0 -1
  298. package/dist/lib/chat/render.js.map +0 -1
  299. package/dist/lib/chat/session.d.ts.map +0 -1
  300. package/dist/lib/chat/session.js.map +0 -1
  301. package/dist/lib/chat/theme.d.ts.map +0 -1
  302. package/dist/lib/chat/theme.js.map +0 -1
  303. package/dist/lib/chat/toolFence.d.ts.map +0 -1
  304. package/dist/lib/chat/toolFence.js.map +0 -1
  305. package/dist/lib/chat/tools.d.ts.map +0 -1
  306. package/dist/lib/chat/tools.js.map +0 -1
  307. package/dist/lib/chat/types.d.ts.map +0 -1
  308. package/dist/lib/chat/types.js.map +0 -1
  309. package/dist/lib/chat/write.d.ts.map +0 -1
  310. package/dist/lib/chat/write.js.map +0 -1
  311. package/dist/lib/chunkSplitter.d.ts.map +0 -1
  312. package/dist/lib/chunkSplitter.js.map +0 -1
  313. package/dist/lib/cleanup.d.ts.map +0 -1
  314. package/dist/lib/cleanup.js.map +0 -1
  315. package/dist/lib/config.d.ts.map +0 -1
  316. package/dist/lib/config.js.map +0 -1
  317. package/dist/lib/dashboard.d.ts.map +0 -1
  318. package/dist/lib/dashboard.js.map +0 -1
  319. package/dist/lib/db.d.ts.map +0 -1
  320. package/dist/lib/db.js.map +0 -1
  321. package/dist/lib/dbSearch.d.ts.map +0 -1
  322. package/dist/lib/dbSearch.js.map +0 -1
  323. package/dist/lib/dbWrite.d.ts.map +0 -1
  324. package/dist/lib/dbWrite.js.map +0 -1
  325. package/dist/lib/desktopNotify.d.ts.map +0 -1
  326. package/dist/lib/desktopNotify.js.map +0 -1
  327. package/dist/lib/docxExtract.d.ts.map +0 -1
  328. package/dist/lib/docxExtract.js.map +0 -1
  329. package/dist/lib/dream.d.ts.map +0 -1
  330. package/dist/lib/dream.js.map +0 -1
  331. package/dist/lib/embeddings.d.ts.map +0 -1
  332. package/dist/lib/embeddings.js.map +0 -1
  333. package/dist/lib/export.d.ts.map +0 -1
  334. package/dist/lib/export.js.map +0 -1
  335. package/dist/lib/exportProject.d.ts.map +0 -1
  336. package/dist/lib/exportProject.js.map +0 -1
  337. package/dist/lib/federated.d.ts.map +0 -1
  338. package/dist/lib/federated.js.map +0 -1
  339. package/dist/lib/fileDetect.d.ts.map +0 -1
  340. package/dist/lib/fileDetect.js.map +0 -1
  341. package/dist/lib/graph.d.ts.map +0 -1
  342. package/dist/lib/graph.js.map +0 -1
  343. package/dist/lib/heartbeat.d.ts.map +0 -1
  344. package/dist/lib/heartbeat.js.map +0 -1
  345. package/dist/lib/history.d.ts +0 -39
  346. package/dist/lib/history.d.ts.map +0 -1
  347. package/dist/lib/history.js +0 -112
  348. package/dist/lib/history.js.map +0 -1
  349. package/dist/lib/hybridSearch.d.ts.map +0 -1
  350. package/dist/lib/hybridSearch.js.map +0 -1
  351. package/dist/lib/idFormat.d.ts.map +0 -1
  352. package/dist/lib/idFormat.js.map +0 -1
  353. package/dist/lib/imageExtract.d.ts.map +0 -1
  354. package/dist/lib/imageExtract.js.map +0 -1
  355. package/dist/lib/import.d.ts.map +0 -1
  356. package/dist/lib/import.js.map +0 -1
  357. package/dist/lib/importProject.d.ts.map +0 -1
  358. package/dist/lib/importProject.js.map +0 -1
  359. package/dist/lib/ingest.d.ts.map +0 -1
  360. package/dist/lib/ingest.js.map +0 -1
  361. package/dist/lib/lensing.d.ts.map +0 -1
  362. package/dist/lib/lensing.js.map +0 -1
  363. package/dist/lib/llm.d.ts.map +0 -1
  364. package/dist/lib/llm.js.map +0 -1
  365. package/dist/lib/lock.d.ts.map +0 -1
  366. package/dist/lib/lock.js.map +0 -1
  367. package/dist/lib/machineConfig.d.ts.map +0 -1
  368. package/dist/lib/machineConfig.js.map +0 -1
  369. package/dist/lib/machineMigrate.d.ts.map +0 -1
  370. package/dist/lib/machineMigrate.js.map +0 -1
  371. package/dist/lib/maintenance.d.ts.map +0 -1
  372. package/dist/lib/maintenance.js.map +0 -1
  373. package/dist/lib/migrate.d.ts.map +0 -1
  374. package/dist/lib/migrate.js.map +0 -1
  375. package/dist/lib/modelValidation.d.ts.map +0 -1
  376. package/dist/lib/modelValidation.js.map +0 -1
  377. package/dist/lib/multimodalIngest.d.ts.map +0 -1
  378. package/dist/lib/multimodalIngest.js.map +0 -1
  379. package/dist/lib/paths.d.ts.map +0 -1
  380. package/dist/lib/paths.js.map +0 -1
  381. package/dist/lib/pdfExtract.d.ts.map +0 -1
  382. package/dist/lib/pdfExtract.js.map +0 -1
  383. package/dist/lib/portfolio.d.ts.map +0 -1
  384. package/dist/lib/portfolio.js.map +0 -1
  385. package/dist/lib/portfolioHtml.d.ts.map +0 -1
  386. package/dist/lib/portfolioHtml.js.map +0 -1
  387. package/dist/lib/preferences.d.ts.map +0 -1
  388. package/dist/lib/preferences.js.map +0 -1
  389. package/dist/lib/progress.d.ts.map +0 -1
  390. package/dist/lib/progress.js.map +0 -1
  391. package/dist/lib/projectIdentity.d.ts.map +0 -1
  392. package/dist/lib/projectIdentity.js.map +0 -1
  393. package/dist/lib/projectPaths.d.ts.map +0 -1
  394. package/dist/lib/projectPaths.js.map +0 -1
  395. package/dist/lib/projectScan.d.ts.map +0 -1
  396. package/dist/lib/projectScan.js.map +0 -1
  397. package/dist/lib/recall.d.ts.map +0 -1
  398. package/dist/lib/recall.js.map +0 -1
  399. package/dist/lib/remote.d.ts.map +0 -1
  400. package/dist/lib/remote.js.map +0 -1
  401. package/dist/lib/remoteWizard.d.ts.map +0 -1
  402. package/dist/lib/remoteWizard.js.map +0 -1
  403. package/dist/lib/resolver.d.ts.map +0 -1
  404. package/dist/lib/resolver.js.map +0 -1
  405. package/dist/lib/retry.d.ts.map +0 -1
  406. package/dist/lib/retry.js.map +0 -1
  407. package/dist/lib/rulesGen.d.ts.map +0 -1
  408. package/dist/lib/rulesGen.js.map +0 -1
  409. package/dist/lib/search.d.ts.map +0 -1
  410. package/dist/lib/search.js.map +0 -1
  411. package/dist/lib/setup/coldStart.d.ts.map +0 -1
  412. package/dist/lib/setup/coldStart.js.map +0 -1
  413. package/dist/lib/setup/configSetRender.d.ts.map +0 -1
  414. package/dist/lib/setup/configSetRender.js.map +0 -1
  415. package/dist/lib/setup/dreamRender.d.ts.map +0 -1
  416. package/dist/lib/setup/dreamRender.js.map +0 -1
  417. package/dist/lib/setup/dreamState.d.ts.map +0 -1
  418. package/dist/lib/setup/dreamState.js.map +0 -1
  419. package/dist/lib/setup/modelsRender.d.ts.map +0 -1
  420. package/dist/lib/setup/modelsRender.js.map +0 -1
  421. package/dist/lib/setup/remoteRender.d.ts.map +0 -1
  422. package/dist/lib/setup/remoteRender.js.map +0 -1
  423. package/dist/lib/setup/routingRender.d.ts.map +0 -1
  424. package/dist/lib/setup/routingRender.js.map +0 -1
  425. package/dist/lib/setup/sections/ides.d.ts.map +0 -1
  426. package/dist/lib/setup/sections/ides.js.map +0 -1
  427. package/dist/lib/setup/sections/preferences.d.ts.map +0 -1
  428. package/dist/lib/setup/sections/preferences.js.map +0 -1
  429. package/dist/lib/setup/sections/routing.d.ts.map +0 -1
  430. package/dist/lib/setup/sections/routing.js.map +0 -1
  431. package/dist/lib/setup/storePath.d.ts.map +0 -1
  432. package/dist/lib/setup/storePath.js.map +0 -1
  433. package/dist/lib/setup/summary.d.ts.map +0 -1
  434. package/dist/lib/setup/summary.js.map +0 -1
  435. package/dist/lib/setup/syncProjectsRender.d.ts.map +0 -1
  436. package/dist/lib/setup/syncProjectsRender.js.map +0 -1
  437. package/dist/lib/setup/ui/diff.d.ts.map +0 -1
  438. package/dist/lib/setup/ui/diff.js.map +0 -1
  439. package/dist/lib/setup/ui/footer.d.ts.map +0 -1
  440. package/dist/lib/setup/ui/footer.js.map +0 -1
  441. package/dist/lib/setup/ui/header.d.ts.map +0 -1
  442. package/dist/lib/setup/ui/header.js.map +0 -1
  443. package/dist/lib/setup/ui/index.d.ts.map +0 -1
  444. package/dist/lib/setup/ui/index.js.map +0 -1
  445. package/dist/lib/setup/ui/menu.d.ts.map +0 -1
  446. package/dist/lib/setup/ui/menu.js.map +0 -1
  447. package/dist/lib/setup/ui/panel.d.ts.map +0 -1
  448. package/dist/lib/setup/ui/panel.js.map +0 -1
  449. package/dist/lib/setup/ui/prompt.d.ts.map +0 -1
  450. package/dist/lib/setup/ui/prompt.js.map +0 -1
  451. package/dist/lib/setup/ui/safePrompt.d.ts.map +0 -1
  452. package/dist/lib/setup/ui/safePrompt.js.map +0 -1
  453. package/dist/lib/setup/ui/spinner.d.ts.map +0 -1
  454. package/dist/lib/setup/ui/spinner.js.map +0 -1
  455. package/dist/lib/setup/ui/status.d.ts.map +0 -1
  456. package/dist/lib/setup/ui/status.js.map +0 -1
  457. package/dist/lib/setup/ui/table.d.ts.map +0 -1
  458. package/dist/lib/setup/ui/table.js.map +0 -1
  459. package/dist/lib/setup/ui/title.d.ts.map +0 -1
  460. package/dist/lib/setup/ui/title.js.map +0 -1
  461. package/dist/lib/setup/ui/tokens.d.ts.map +0 -1
  462. package/dist/lib/setup/ui/tokens.js.map +0 -1
  463. package/dist/lib/setup.d.ts.map +0 -1
  464. package/dist/lib/setup.js.map +0 -1
  465. package/dist/lib/staticSearch.d.ts.map +0 -1
  466. package/dist/lib/staticSearch.js.map +0 -1
  467. package/dist/lib/store.d.ts.map +0 -1
  468. package/dist/lib/store.js.map +0 -1
  469. package/dist/lib/structuredIngest.d.ts.map +0 -1
  470. package/dist/lib/structuredIngest.js.map +0 -1
  471. package/dist/lib/tags.d.ts.map +0 -1
  472. package/dist/lib/tags.js.map +0 -1
  473. package/dist/lib/timeline.d.ts.map +0 -1
  474. package/dist/lib/timeline.js.map +0 -1
  475. package/dist/lib/trace.d.ts.map +0 -1
  476. package/dist/lib/trace.js.map +0 -1
  477. package/dist/lib/upgrade.d.ts.map +0 -1
  478. package/dist/lib/upgrade.js.map +0 -1
  479. package/dist/lib/videoExtract.d.ts.map +0 -1
  480. package/dist/lib/videoExtract.js.map +0 -1
  481. package/dist/lib/webIndex.d.ts.map +0 -1
  482. package/dist/lib/webIndex.js.map +0 -1
  483. package/dist/lib/webIngest.d.ts.map +0 -1
  484. package/dist/lib/webIngest.js.map +0 -1
  485. package/dist/lib/wikilinks.d.ts.map +0 -1
  486. package/dist/lib/wikilinks.js.map +0 -1
  487. package/dist/postinstall.d.ts.map +0 -1
  488. package/dist/postinstall.js.map +0 -1
  489. package/dist/sandbox/client.d.ts.map +0 -1
  490. package/dist/sandbox/client.js.map +0 -1
  491. package/dist/sandbox/helper-template.d.ts.map +0 -1
  492. package/dist/sandbox/helper-template.js.map +0 -1
  493. package/dist/sandbox/index.d.ts +0 -10
  494. package/dist/sandbox/index.d.ts.map +0 -1
  495. package/dist/sandbox/index.js +0 -10
  496. package/dist/sandbox/index.js.map +0 -1
  497. package/dist/sandbox/manager.d.ts.map +0 -1
  498. package/dist/sandbox/manager.js.map +0 -1
  499. package/dist/sandbox/server.d.ts.map +0 -1
  500. package/dist/sandbox/server.js.map +0 -1
@@ -28,7 +28,8 @@ import os from "os";
28
28
  import path from "path";
29
29
  import { randomUUID } from "crypto";
30
30
  import { getMachineConfigPath } from "./paths.js";
31
- export const MACHINE_CONFIG_VERSION = 1;
31
+ import { atomicWriteFileSync } from "./atomicWrite.js";
32
+ const MACHINE_CONFIG_VERSION = 1;
32
33
  /** A fresh machine config for the current host. */
33
34
  export function defaultMachineConfig() {
34
35
  return {
@@ -77,7 +78,7 @@ export function readMachineConfig() {
77
78
  export function writeMachineConfig(cfg) {
78
79
  const p = getMachineConfigPath();
79
80
  fs.mkdirSync(path.dirname(p), { recursive: true });
80
- fs.writeFileSync(p, JSON.stringify(cfg, null, 2) + "\n", "utf-8");
81
+ atomicWriteFileSync(p, JSON.stringify(cfg, null, 2) + "\n");
81
82
  }
82
83
  /**
83
84
  * Load machine.json, creating it on first run. If the persisted config's
@@ -88,8 +89,19 @@ export function writeMachineConfig(cfg) {
88
89
  * genuine foreign file gets corrected when the user re-runs `projects scan`).
89
90
  */
90
91
  export function ensureMachineConfig() {
92
+ const override = process.env.GNOSYS_MACHINE_ID?.trim();
91
93
  const existing = readMachineConfig();
92
94
  const host = os.hostname();
95
+ if (override) {
96
+ const base = existing ?? defaultMachineConfig();
97
+ const cfg = {
98
+ ...base,
99
+ machineId: override,
100
+ hostname: host,
101
+ };
102
+ writeMachineConfig(cfg);
103
+ return { config: cfg, created: !existing, regenerated: false };
104
+ }
93
105
  if (!existing) {
94
106
  const fresh = defaultMachineConfig();
95
107
  writeMachineConfig(fresh);
@@ -143,4 +155,3 @@ export function relPathUnderRoot(cfg, absPath) {
143
155
  }
144
156
  return best ? { rootId: best.rootId, relPath: best.relPath } : null;
145
157
  }
146
- //# sourceMappingURL=machineConfig.js.map
@@ -36,4 +36,3 @@ export declare function migrateMachine(localDb: GnosysDB, opts?: {
36
36
  * outlier projects live elsewhere.
37
37
  */
38
38
  export declare function deriveCommonRoot(): string | null;
39
- //# sourceMappingURL=machineMigrate.d.ts.map
@@ -100,4 +100,3 @@ export function deriveCommonRoot() {
100
100
  }
101
101
  return best;
102
102
  }
103
- //# sourceMappingURL=machineMigrate.js.map
@@ -9,10 +9,10 @@
9
9
  *
10
10
  * All operations produce safe Git commits with rollback on failure.
11
11
  */
12
- import { GnosysStore, Memory } from "./store.js";
13
- import { GnosysConfig } from "./config.js";
14
- import { GnosysResolver } from "./resolver.js";
15
- import { GnosysDB } from "./db.js";
12
+ import type { GnosysStore, Memory } from "./store.js";
13
+ import { type GnosysConfig } from "./config.js";
14
+ import type { GnosysResolver } from "./resolver.js";
15
+ import type { GnosysDB } from "./db.js";
16
16
  export interface MaintenanceOptions {
17
17
  /** Show what would change without modifying anything */
18
18
  dryRun?: boolean;
@@ -123,4 +123,3 @@ export declare class GnosysMaintenanceEngine {
123
123
  * Format a maintenance report as a human-readable string.
124
124
  */
125
125
  export declare function formatMaintenanceReport(report: MaintenanceReport): string;
126
- //# sourceMappingURL=maintenance.d.ts.map
@@ -546,4 +546,3 @@ export function formatMaintenanceReport(report) {
546
546
  }
547
547
  return lines.join("\n");
548
548
  }
549
- //# sourceMappingURL=maintenance.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Point an IDE at a REMOTE gnosys server (v5.12 Phase B).
3
+ *
4
+ * In the central-server topology, a client machine doesn't spawn a local
5
+ * `gnosys serve` — its IDE connects to the host's URL. This writes the URL-based
6
+ * MCP entry into the IDE config (instead of the `{ command, args }` stdio form
7
+ * the local setup writes).
8
+ */
9
+ export interface RemoteOpts {
10
+ url: string;
11
+ token?: string;
12
+ }
13
+ /** The MCP server entry for a remote (HTTP/URL) gnosys server. */
14
+ export declare function remoteMcpEntry(opts: RemoteOpts): Record<string, unknown>;
15
+ /** Merge a `gnosys` entry into a JSON file's `mcpServers` map (create if absent). */
16
+ export declare function mergeJsonMcpServer(file: string, entry: Record<string, unknown>): Promise<void>;
17
+ /** Write the remote entry into a project's `.cursor/mcp.json`. Returns the path. */
18
+ export declare function writeCursorRemote(projectDir: string, opts: RemoteOpts): Promise<string>;
19
+ export type RemoteIde = "cursor" | "claude-desktop";
20
+ export declare function writeRemoteClientConfig(ide: RemoteIde, projectDir: string, opts: RemoteOpts): Promise<string>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Point an IDE at a REMOTE gnosys server (v5.12 Phase B).
3
+ *
4
+ * In the central-server topology, a client machine doesn't spawn a local
5
+ * `gnosys serve` — its IDE connects to the host's URL. This writes the URL-based
6
+ * MCP entry into the IDE config (instead of the `{ command, args }` stdio form
7
+ * the local setup writes).
8
+ */
9
+ import fs from "fs/promises";
10
+ import path from "path";
11
+ import { getClaudeDesktopConfigPath } from "./platform.js";
12
+ /** The MCP server entry for a remote (HTTP/URL) gnosys server. */
13
+ export function remoteMcpEntry(opts) {
14
+ return {
15
+ url: opts.url,
16
+ ...(opts.token ? { headers: { Authorization: `Bearer ${opts.token}` } } : {}),
17
+ };
18
+ }
19
+ /** Merge a `gnosys` entry into a JSON file's `mcpServers` map (create if absent). */
20
+ export async function mergeJsonMcpServer(file, entry) {
21
+ let config = {};
22
+ try {
23
+ config = JSON.parse(await fs.readFile(file, "utf-8"));
24
+ }
25
+ catch {
26
+ // missing or invalid — start fresh
27
+ }
28
+ const servers = (config.mcpServers ?? {});
29
+ servers.gnosys = entry;
30
+ config.mcpServers = servers;
31
+ await fs.mkdir(path.dirname(file), { recursive: true });
32
+ await fs.writeFile(file, JSON.stringify(config, null, 2) + "\n", "utf-8");
33
+ }
34
+ /** Write the remote entry into a project's `.cursor/mcp.json`. Returns the path. */
35
+ export async function writeCursorRemote(projectDir, opts) {
36
+ const file = path.join(projectDir, ".cursor", "mcp.json");
37
+ await mergeJsonMcpServer(file, remoteMcpEntry(opts));
38
+ return file;
39
+ }
40
+ /** Write the remote entry into the Claude Desktop config. Returns the path. */
41
+ async function writeClaudeDesktopRemote(opts) {
42
+ const file = getClaudeDesktopConfigPath();
43
+ await mergeJsonMcpServer(file, remoteMcpEntry(opts));
44
+ return file;
45
+ }
46
+ export async function writeRemoteClientConfig(ide, projectDir, opts) {
47
+ return ide === "claude-desktop"
48
+ ? writeClaudeDesktopRemote(opts)
49
+ : writeCursorRemote(projectDir, opts);
50
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Streamable HTTP transport for the Gnosys MCP server (v5.12 Phase A).
3
+ *
4
+ * Lets clients connect to a long-running gnosys server over HTTP instead of
5
+ * spawning a local stdio process — the basis for the "central server" topology
6
+ * (one host owns the brain; other machines point their IDE at the URL).
7
+ *
8
+ * Stateful sessions: each `initialize` mints a session id and gets its OWN
9
+ * McpServer (built by `makeServer`), so concurrent clients don't share MCP
10
+ * protocol state. The servers all reference the same module-global brain/search,
11
+ * so there's no per-session data — only a fresh capability registration.
12
+ *
13
+ * Uses Node's built-in http (no express). The SDK's StreamableHTTPServerTransport
14
+ * accepts a pre-parsed body, so we read+parse POST bodies ourselves.
15
+ */
16
+ import http from "node:http";
17
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
18
+ export interface McpHttpOptions {
19
+ host: string;
20
+ port: number;
21
+ /** MCP endpoint path. Default "/mcp". */
22
+ path?: string;
23
+ /** Build a fully-registered McpServer for a new session. */
24
+ makeServer: () => Promise<McpServer> | McpServer;
25
+ /** Phase C: require `Authorization: Bearer <token>` when set. */
26
+ authToken?: string;
27
+ log?: (msg: string) => void;
28
+ /** Reap sessions idle longer than this (ms). Default 30 min. */
29
+ sessionIdleMs?: number;
30
+ /** Sweep cadence (ms). Default 60s. */
31
+ sweepIntervalMs?: number;
32
+ /** Browser origins explicitly allowed to call the endpoint. Default: none. */
33
+ allowedOrigins?: string[];
34
+ /** Max request body bytes. Default 4 MiB. */
35
+ maxBodyBytes?: number;
36
+ /** Max ms to fully receive a request body. Default 30s. */
37
+ bodyTimeoutMs?: number;
38
+ }
39
+ export interface McpHttpHandle {
40
+ server: http.Server;
41
+ /** Active session count (for tests/observability). */
42
+ sessionCount: () => number;
43
+ /** Close+remove sessions idle beyond sessionIdleMs. Returns count reaped. */
44
+ reapIdleSessions: (now?: number) => number;
45
+ close: () => Promise<void>;
46
+ }
47
+ /** True when the bind host is loopback-only (token optional). */
48
+ export declare function isLoopbackHost(host: string): boolean;
49
+ /**
50
+ * Start the MCP Streamable HTTP server. Resolves once it is listening.
51
+ */
52
+ export declare function startMcpHttpServer(opts: McpHttpOptions): Promise<McpHttpHandle>;
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Streamable HTTP transport for the Gnosys MCP server (v5.12 Phase A).
3
+ *
4
+ * Lets clients connect to a long-running gnosys server over HTTP instead of
5
+ * spawning a local stdio process — the basis for the "central server" topology
6
+ * (one host owns the brain; other machines point their IDE at the URL).
7
+ *
8
+ * Stateful sessions: each `initialize` mints a session id and gets its OWN
9
+ * McpServer (built by `makeServer`), so concurrent clients don't share MCP
10
+ * protocol state. The servers all reference the same module-global brain/search,
11
+ * so there's no per-session data — only a fresh capability registration.
12
+ *
13
+ * Uses Node's built-in http (no express). The SDK's StreamableHTTPServerTransport
14
+ * accepts a pre-parsed body, so we read+parse POST bodies ourselves.
15
+ */
16
+ import http from "node:http";
17
+ import { randomUUID } from "node:crypto";
18
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
19
+ import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
20
+ /** True when the bind host is loopback-only (token optional). */
21
+ export function isLoopbackHost(host) {
22
+ const h = (host || "").trim().toLowerCase();
23
+ if (h === "localhost" || h === "::1" || h === "[::1]")
24
+ return true;
25
+ if (/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h))
26
+ return true;
27
+ return false;
28
+ }
29
+ class HttpBodyError extends Error {
30
+ statusCode;
31
+ constructor(statusCode, message) {
32
+ super(message);
33
+ this.statusCode = statusCode;
34
+ }
35
+ }
36
+ function readBody(req, maxBytes, timeoutMs) {
37
+ return new Promise((resolve, reject) => {
38
+ const chunks = [];
39
+ let total = 0;
40
+ let settled = false;
41
+ const done = (fn) => {
42
+ if (settled)
43
+ return;
44
+ settled = true;
45
+ clearTimeout(timer);
46
+ fn();
47
+ };
48
+ const timer = setTimeout(() => done(() => {
49
+ reject(new HttpBodyError(408, "Request body timeout"));
50
+ }), timeoutMs);
51
+ if (typeof timer.unref === "function")
52
+ timer.unref();
53
+ req.on("data", (c) => {
54
+ total += c.length;
55
+ if (total > maxBytes) {
56
+ done(() => {
57
+ reject(new HttpBodyError(413, "Payload too large"));
58
+ });
59
+ return;
60
+ }
61
+ chunks.push(c);
62
+ });
63
+ req.on("end", () => done(() => {
64
+ const raw = Buffer.concat(chunks).toString("utf-8");
65
+ if (!raw)
66
+ return resolve(undefined);
67
+ try {
68
+ resolve(JSON.parse(raw));
69
+ }
70
+ catch (e) {
71
+ reject(e);
72
+ }
73
+ }));
74
+ req.on("error", (e) => done(() => reject(e)));
75
+ });
76
+ }
77
+ function jsonRpcError(res, status, code, message) {
78
+ res.writeHead(status, { "content-type": "application/json" });
79
+ res.end(JSON.stringify({ jsonrpc: "2.0", error: { code, message }, id: null }));
80
+ }
81
+ /**
82
+ * Start the MCP Streamable HTTP server. Resolves once it is listening.
83
+ */
84
+ export function startMcpHttpServer(opts) {
85
+ if (!isLoopbackHost(opts.host) && !opts.authToken) {
86
+ return Promise.reject(new Error(`Refusing to start: HTTP transport is binding to a non-loopback address ` +
87
+ `(${opts.host}) without an auth token. Anyone who can reach this address ` +
88
+ `would get unauthenticated access to your memory. Set --token <token> ` +
89
+ `(or GNOSYS_SERVE_TOKEN), or bind to 127.0.0.1.`));
90
+ }
91
+ const mcpPath = opts.path ?? "/mcp";
92
+ const log = opts.log ?? (() => { });
93
+ const transports = new Map();
94
+ const lastSeen = new Map();
95
+ const idleMs = opts.sessionIdleMs ?? 30 * 60 * 1000;
96
+ const sweepMs = opts.sweepIntervalMs ?? 60 * 1000;
97
+ const maxBodyBytes = opts.maxBodyBytes ?? 4 * 1024 * 1024;
98
+ const bodyTimeoutMs = opts.bodyTimeoutMs ?? 30_000;
99
+ const touch = (sid) => lastSeen.set(sid, Date.now());
100
+ function reapIdle(now = Date.now()) {
101
+ let reaped = 0;
102
+ for (const [sid, t] of transports) {
103
+ if (now - (lastSeen.get(sid) ?? now) > idleMs) {
104
+ void t.close();
105
+ lastSeen.delete(sid);
106
+ reaped++;
107
+ }
108
+ }
109
+ return reaped;
110
+ }
111
+ const httpServer = http.createServer((req, res) => {
112
+ void handle(req, res).catch((e) => {
113
+ log(`request error: ${e instanceof Error ? e.message : String(e)}`);
114
+ if (!res.headersSent)
115
+ jsonRpcError(res, 500, -32603, "Internal error");
116
+ });
117
+ });
118
+ httpServer.headersTimeout = 15_000;
119
+ httpServer.requestTimeout = 60_000;
120
+ async function handle(req, res) {
121
+ const url = new URL(req.url ?? "/", `http://${req.headers.host ?? "localhost"}`);
122
+ // Liveness probe — unauthenticated, no MCP involvement.
123
+ if (url.pathname === "/health") {
124
+ res.writeHead(200, { "content-type": "application/json" });
125
+ res.end(JSON.stringify({ status: "ok", sessions: transports.size }));
126
+ return;
127
+ }
128
+ if (url.pathname !== mcpPath) {
129
+ res.writeHead(404, { "content-type": "text/plain" });
130
+ res.end("Not found");
131
+ return;
132
+ }
133
+ // CORS default-deny: browsers send Origin on cross-origin calls; IDE/CLI clients do not.
134
+ const origin = req.headers["origin"];
135
+ if (origin && !(opts.allowedOrigins ?? []).includes(origin)) {
136
+ jsonRpcError(res, 403, -32001, "Origin not allowed");
137
+ return;
138
+ }
139
+ // Phase C: bearer auth (only enforced when a token is configured).
140
+ if (opts.authToken) {
141
+ if (req.headers["authorization"] !== `Bearer ${opts.authToken}`) {
142
+ jsonRpcError(res, 401, -32001, "Unauthorized");
143
+ return;
144
+ }
145
+ }
146
+ const sessionId = req.headers["mcp-session-id"];
147
+ if (req.method === "POST") {
148
+ let body;
149
+ try {
150
+ body = await readBody(req, maxBodyBytes, bodyTimeoutMs);
151
+ }
152
+ catch (e) {
153
+ if (e instanceof HttpBodyError) {
154
+ jsonRpcError(res, e.statusCode, -32000, e.message);
155
+ req.destroy();
156
+ return;
157
+ }
158
+ jsonRpcError(res, 400, -32700, "Parse error");
159
+ req.destroy();
160
+ return;
161
+ }
162
+ let transport = sessionId ? transports.get(sessionId) : undefined;
163
+ if (!transport) {
164
+ if (!isInitializeRequest(body)) {
165
+ jsonRpcError(res, 400, -32000, "No valid session; send an initialize request first");
166
+ return;
167
+ }
168
+ // New session: fresh server + transport.
169
+ const server = await opts.makeServer();
170
+ transport = new StreamableHTTPServerTransport({
171
+ sessionIdGenerator: () => randomUUID(),
172
+ onsessioninitialized: (sid) => {
173
+ transports.set(sid, transport);
174
+ touch(sid);
175
+ log(`session initialized: ${sid} (${transports.size} active)`);
176
+ },
177
+ });
178
+ transport.onclose = () => {
179
+ const sid = transport.sessionId;
180
+ if (sid)
181
+ lastSeen.delete(sid);
182
+ if (sid && transports.delete(sid))
183
+ log(`session closed: ${sid} (${transports.size} active)`);
184
+ };
185
+ await server.connect(transport);
186
+ }
187
+ else if (sessionId) {
188
+ touch(sessionId);
189
+ }
190
+ await transport.handleRequest(req, res, body);
191
+ return;
192
+ }
193
+ if (req.method === "GET" || req.method === "DELETE") {
194
+ const transport = sessionId ? transports.get(sessionId) : undefined;
195
+ if (!transport) {
196
+ jsonRpcError(res, 400, -32000, "Missing or unknown session id");
197
+ return;
198
+ }
199
+ if (sessionId)
200
+ touch(sessionId);
201
+ await transport.handleRequest(req, res);
202
+ return;
203
+ }
204
+ res.writeHead(405, { "content-type": "text/plain" });
205
+ res.end("Method not allowed");
206
+ }
207
+ return new Promise((resolve) => {
208
+ httpServer.listen(opts.port, opts.host, () => {
209
+ log(`listening on http://${opts.host}:${opts.port}${mcpPath}`);
210
+ const sweep = setInterval(() => reapIdle(), sweepMs);
211
+ sweep.unref();
212
+ resolve({
213
+ server: httpServer,
214
+ sessionCount: () => transports.size,
215
+ reapIdleSessions: (now) => reapIdle(now),
216
+ close: () => new Promise((r) => {
217
+ clearInterval(sweep);
218
+ for (const t of transports.values())
219
+ void t.close();
220
+ transports.clear();
221
+ lastSeen.clear();
222
+ httpServer.close(() => r());
223
+ }),
224
+ });
225
+ });
226
+ });
227
+ }
@@ -5,7 +5,7 @@
5
5
  * Safe: original .md files and old DBs are untouched.
6
6
  * Reversible: delete gnosys.db to revert.
7
7
  */
8
- import { MigrationStats } from "./db.js";
8
+ import { type MigrationStats } from "./db.js";
9
9
  /**
10
10
  * Migrate all data from v1.x format into gnosys.db.
11
11
  */
@@ -16,4 +16,3 @@ export declare function migrate(storePath: string, options?: {
16
16
  * Format migration results for CLI output.
17
17
  */
18
18
  export declare function formatMigrationReport(stats: MigrationStats): string;
19
- //# sourceMappingURL=migrate.d.ts.map
@@ -169,6 +169,7 @@ export async function migrate(storePath, options) {
169
169
  const embPath = path.join(storePath, ".config", "embeddings.db");
170
170
  if (Database) {
171
171
  const embDb = new Database(embPath, { readonly: true });
172
+ embDb.pragma("busy_timeout = 5000");
172
173
  const rows = embDb.prepare("SELECT file_path, embedding FROM embeddings").all();
173
174
  let embCount = 0;
174
175
  for (const row of rows) {
@@ -257,4 +258,3 @@ export function formatMigrationReport(stats) {
257
258
  ];
258
259
  return lines.join("\n");
259
260
  }
260
- //# sourceMappingURL=migrate.js.map
@@ -19,4 +19,3 @@ export declare function validateModel(provider: string, model: string, apiKey: s
19
19
  customBaseUrl?: string;
20
20
  timeoutMs?: number;
21
21
  }): Promise<ValidationResult>;
22
- //# sourceMappingURL=modelValidation.d.ts.map
@@ -154,4 +154,3 @@ export async function validateModel(provider, model, apiKey, opts) {
154
154
  return { ok: false, error: msg };
155
155
  }
156
156
  }
157
- //# sourceMappingURL=modelValidation.js.map
@@ -5,7 +5,7 @@
5
5
  * Supports PDF and DOCX in Phase 2. Image, audio, and video ingestion
6
6
  * will be added in Phase 3/4.
7
7
  */
8
- import { FileType } from "./fileDetect.js";
8
+ import { type FileType } from "./fileDetect.js";
9
9
  import { type AttachmentRecord } from "./attachments.js";
10
10
  export interface MultimodalIngestOptions {
11
11
  /** Absolute path to the file to ingest */
@@ -65,4 +65,3 @@ export interface MultimodalIngestResult {
65
65
  * 7. Link each memory back to the attachment
66
66
  */
67
67
  export declare function ingestFile(options: MultimodalIngestOptions): Promise<MultimodalIngestResult>;
68
- //# sourceMappingURL=multimodalIngest.d.ts.map
@@ -488,4 +488,3 @@ async function ingestImage(filePath, storePath, config, attachment, opts) {
488
488
  fileType: "image",
489
489
  };
490
490
  }
491
- //# sourceMappingURL=multimodalIngest.js.map
@@ -0,0 +1,5 @@
1
+ export type PkgManager = "npm" | "pnpm" | "yarn" | "npx";
2
+ /** Detect how the running global gnosys was installed, from its path + env. */
3
+ export declare function detectPackageManager(execPath?: string, env?: NodeJS.ProcessEnv): PkgManager;
4
+ /** The upgrade command for a manager, or null when there's nothing to install (npx). */
5
+ export declare function upgradeCommand(pm: PkgManager): string | null;
@@ -0,0 +1,30 @@
1
+ /** Detect how the running global gnosys was installed, from its path + env. */
2
+ export function detectPackageManager(execPath = process.argv[1] || "", env = process.env) {
3
+ const p = execPath.replace(/\\/g, "/").toLowerCase();
4
+ if (p.includes("/_npx/") || p.includes("/.npm/_npx/"))
5
+ return "npx";
6
+ if (p.includes("/pnpm/") || (env.PNPM_HOME && p.startsWith(env.PNPM_HOME.replace(/\\/g, "/").toLowerCase()))) {
7
+ return "pnpm";
8
+ }
9
+ if (p.includes("/.yarn/") || p.includes("/yarn/global/") || p.includes("/.config/yarn/"))
10
+ return "yarn";
11
+ const ua = (env.npm_config_user_agent || "").toLowerCase();
12
+ if (ua.startsWith("pnpm"))
13
+ return "pnpm";
14
+ if (ua.startsWith("yarn"))
15
+ return "yarn";
16
+ return "npm";
17
+ }
18
+ /** The upgrade command for a manager, or null when there's nothing to install (npx). */
19
+ export function upgradeCommand(pm) {
20
+ switch (pm) {
21
+ case "pnpm":
22
+ return "pnpm add -g gnosys@latest";
23
+ case "yarn":
24
+ return "yarn global add gnosys@latest";
25
+ case "npx":
26
+ return null;
27
+ default:
28
+ return "npm install -g gnosys@latest";
29
+ }
30
+ }
@@ -27,12 +27,6 @@ export declare function getGnosysHome(): string;
27
27
  export declare function getCentralDbPath(): string;
28
28
  /** Path to the sandbox runtime directory (socket + helper template live here). */
29
29
  export declare function getSandboxDir(): string;
30
- /**
31
- * Path to the user-level config directory: `~/.config/gnosys/`. Holds
32
- * the project registry, .env, and other per-user CLI metadata that
33
- * lives OUTSIDE the central data store at `~/.gnosys/`.
34
- */
35
- export declare function getConfigDir(): string;
36
30
  /** Path to the project registry file (~/.config/gnosys/projects.json). */
37
31
  export declare function getProjectRegistryPath(): string;
38
32
  /**
@@ -46,4 +40,3 @@ export declare function getProjectRegistryPath(): string;
46
40
  * machine-local counterpart. See machineConfig.ts.
47
41
  */
48
42
  export declare function getMachineConfigPath(): string;
49
- //# sourceMappingURL=paths.d.ts.map
package/dist/lib/paths.js CHANGED
@@ -42,7 +42,7 @@ export function getSandboxDir() {
42
42
  * the project registry, .env, and other per-user CLI metadata that
43
43
  * lives OUTSIDE the central data store at `~/.gnosys/`.
44
44
  */
45
- export function getConfigDir() {
45
+ function getConfigDir() {
46
46
  if (process.env.GNOSYS_CONFIG_DIR)
47
47
  return process.env.GNOSYS_CONFIG_DIR;
48
48
  const home = process.env.HOME || process.env.USERPROFILE || "/tmp";
@@ -65,4 +65,3 @@ export function getProjectRegistryPath() {
65
65
  export function getMachineConfigPath() {
66
66
  return path.join(getConfigDir(), "machine.json");
67
67
  }
68
- //# sourceMappingURL=paths.js.map
@@ -26,4 +26,3 @@ export interface PdfChunk {
26
26
  * where the content appears.
27
27
  */
28
28
  export declare function extractPdfText(filePath: string): Promise<PdfChunk[]>;
29
- //# sourceMappingURL=pdfExtract.d.ts.map
@@ -160,4 +160,3 @@ function findPageForOffset(pageBlocks, combinedText, offset) {
160
160
  }
161
161
  return pageBlocks[pageBlocks.length - 1]?.pageNum || 1;
162
162
  }
163
- //# sourceMappingURL=pdfExtract.js.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Cross-platform paths and user-facing hints (macOS, Linux, Windows).
3
+ */
4
+ export type OsFamily = "macos" | "linux" | "windows";
5
+ /** Current OS family for CLI messages and help text. */
6
+ export declare function getOsFamily(): OsFamily;
7
+ /** Primary secure credential store name on this machine. */
8
+ export declare function getSecureStorageLabel(): string;
9
+ /** Short phrase for error messages (setup may still be required on Windows). */
10
+ export declare function getSecureStorageSetupHint(): string;
11
+ /** Order of API key resolution for user-facing help on the current OS. */
12
+ export declare function getApiKeyResolutionOrderText(): string;
13
+ /** Claude Desktop MCP config file path for the current platform. */
14
+ export declare function getClaudeDesktopConfigPath(): string;
15
+ /** Display path with ~ for home (for logs and help). */
16
+ export declare function displayClaudeDesktopConfigPath(): string;
17
+ /** Shell profile file(s) suggested for env vars on this OS. */
18
+ export declare function getShellProfileHint(): string;
19
+ /** Lines shown when user skips API key setup in gnosys setup. */
20
+ export declare function getApiKeySkipHints(envVarName: string, provider: string): string[];
21
+ /** ffmpeg install instructions (all platforms, for errors). */
22
+ export declare function formatFfmpegInstallHint(): string;
23
+ /** Ingest / LLM missing-key helper bullet for gnosys setup. */
24
+ export declare function getSetupStorageBullet(): string;