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
@@ -34,4 +34,3 @@ export interface TableOptions<T> {
34
34
  export declare function renderTable<T>(rows: T[], columns: TableColumn<T>[], opts?: TableOptions<T>): string[];
35
35
  /** Convenience: render + print + trailing newline. */
36
36
  export declare function printTable<T>(rows: T[], columns: TableColumn<T>[], opts?: TableOptions<T>): void;
37
- //# sourceMappingURL=table.d.ts.map
@@ -79,4 +79,3 @@ function padCell(value, width, align) {
79
79
  const pad = " ".repeat(padLen);
80
80
  return align === "right" ? `${pad}${value}` : `${value}${pad}`;
81
81
  }
82
- //# sourceMappingURL=table.js.map
@@ -11,4 +11,3 @@
11
11
  export declare function Title(title: string, sub?: string): string;
12
12
  /** Convenience: print title + trailing blank line to stdout. */
13
13
  export declare function printTitle(title: string, sub?: string): void;
14
- //# sourceMappingURL=title.d.ts.map
@@ -21,4 +21,3 @@ export function Title(title, sub) {
21
21
  export function printTitle(title, sub) {
22
22
  process.stdout.write(`${Title(title, sub)}\n\n`);
23
23
  }
24
- //# sourceMappingURL=title.js.map
@@ -63,4 +63,3 @@ export declare const glyph: {
63
63
  export declare const COLS: number;
64
64
  /** Effective render width: clamp to >= 80 unless explicitly narrower. */
65
65
  export declare function width(): number;
66
- //# sourceMappingURL=tokens.d.ts.map
@@ -84,4 +84,3 @@ export const COLS = (() => {
84
84
  export function width() {
85
85
  return Math.max(80, COLS);
86
86
  }
87
- //# sourceMappingURL=tokens.js.map
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Uses Node.js built-in readline/promises — no external dependencies.
9
9
  */
10
- import { Interface as ReadlineInterface } from "readline/promises";
10
+ import { type Interface as ReadlineInterface } from "readline/promises";
11
11
  export interface ModelTier {
12
12
  name: string;
13
13
  model: string;
@@ -16,7 +16,7 @@ export interface ModelTier {
16
16
  recommended: boolean;
17
17
  }
18
18
  /** Per-task routing override chosen during setup. */
19
- export interface TaskRouting {
19
+ interface TaskRouting {
20
20
  provider: string;
21
21
  model: string;
22
22
  }
@@ -39,15 +39,6 @@ export interface SetupResult {
39
39
  dreamEnabled?: boolean;
40
40
  }
41
41
  export declare const PROVIDER_TIERS: Record<string, ModelTier[]>;
42
- /**
43
- * Fetch models from OpenRouter, cache for 24 hours, fall back to hardcoded.
44
- * Returns updated PROVIDER_TIERS for cloud providers only.
45
- */
46
- export declare function fetchDynamicModels(): Promise<Record<string, ModelTier[]>>;
47
- /**
48
- * Get model tiers for a provider — tries dynamic first, falls back to hardcoded.
49
- */
50
- export declare function getModelTiers(provider: string): Promise<ModelTier[]>;
51
42
  /**
52
43
  * Returns the cheapest capable model for structuring tasks.
53
44
  * Structuring (keyword extraction, tagging) doesn't need a flagship model.
@@ -59,12 +50,6 @@ export declare function getStructuringModel(provider: string, chosenModel: strin
59
50
  * Replaces an existing key line if found, otherwise appends.
60
51
  */
61
52
  export declare function writeApiKey(provider: string, key: string): Promise<void>;
62
- /**
63
- * Write an API key to the macOS Keychain.
64
- * Uses the -U flag to update if the entry already exists.
65
- * Returns true on success, false on failure.
66
- */
67
- export declare function writeApiKeyToKeychain(envVar: string, key: string): boolean;
68
53
  /**
69
54
  * Detect which IDEs are available in the given project directory.
70
55
  * Returns an array like ["claude", "cursor", "codex"].
@@ -130,19 +115,6 @@ export interface ModelsSetupOpts {
130
115
  * provider, then writes the result to gnosys.json. Skips IDE and remote setup.
131
116
  */
132
117
  export declare function runModelsSetup(opts?: ModelsSetupOpts): Promise<void>;
133
- export interface ModelsCommandOpts {
134
- list?: boolean;
135
- refresh?: boolean;
136
- set?: string;
137
- directory?: string;
138
- }
139
- /**
140
- * Lightweight model-management command. Supports three operations:
141
- * --list: print available models for the current provider
142
- * --refresh: clear the OpenRouter cache and re-fetch
143
- * --set X: update the default model in gnosys.json (no prompts)
144
- */
145
- export declare function runModelsCommand(opts?: ModelsCommandOpts): Promise<void>;
146
118
  export interface DreamSetupOpts {
147
119
  directory?: string;
148
120
  /** v5.8.4: reuse the caller's readline (e.g. summary wizard) to avoid stdin races. */
@@ -179,4 +151,3 @@ export declare function runChatSetup(opts?: ChatSetupOpts): Promise<void>;
179
151
  */
180
152
  export declare function getApiKeyForProvider(provider: string): Promise<string>;
181
153
  export {};
182
- //# sourceMappingURL=setup.d.ts.map
package/dist/lib/setup.js CHANGED
@@ -93,7 +93,7 @@ const OPENROUTER_PREFIX_MAP = {
93
93
  * Fetch models from OpenRouter, cache for 24 hours, fall back to hardcoded.
94
94
  * Returns updated PROVIDER_TIERS for cloud providers only.
95
95
  */
96
- export async function fetchDynamicModels() {
96
+ async function fetchDynamicModels() {
97
97
  // Check cache first
98
98
  try {
99
99
  const stat = await fs.stat(CACHE_FILE);
@@ -266,7 +266,7 @@ export async function fetchDynamicModels() {
266
266
  /**
267
267
  * Get model tiers for a provider — tries dynamic first, falls back to hardcoded.
268
268
  */
269
- export async function getModelTiers(provider) {
269
+ async function getModelTiers(provider) {
270
270
  const dynamic = await fetchDynamicModels();
271
271
  if (dynamic[provider] && dynamic[provider].length > 0) {
272
272
  return dynamic[provider];
@@ -337,7 +337,8 @@ export async function writeApiKey(provider, key) {
337
337
  if (!envVar)
338
338
  return;
339
339
  const configDir = path.join(os.homedir(), ".config", "gnosys");
340
- await fs.mkdir(configDir, { recursive: true });
340
+ await fs.mkdir(configDir, { recursive: true, mode: 0o700 });
341
+ await fs.chmod(configDir, 0o700);
341
342
  const envPath = path.join(configDir, ".env");
342
343
  let lines = [];
343
344
  try {
@@ -364,13 +365,14 @@ export async function writeApiKey(provider, key) {
364
365
  lines.push(`${envVar}=${key}`);
365
366
  }
366
367
  await fs.writeFile(envPath, lines.join("\n") + "\n", "utf-8");
368
+ await fs.chmod(envPath, 0o600);
367
369
  }
368
370
  /**
369
371
  * Write an API key to the macOS Keychain.
370
372
  * Uses the -U flag to update if the entry already exists.
371
373
  * Returns true on success, false on failure.
372
374
  */
373
- export function writeApiKeyToKeychain(envVar, key) {
375
+ function writeApiKeyToKeychain(envVar, key) {
374
376
  if (process.platform !== "darwin")
375
377
  return false;
376
378
  try {
@@ -700,9 +702,9 @@ export async function setupIDE(ide, projectDir) {
700
702
  let existing = await fs.readFile(userCodexConfig, "utf-8");
701
703
  const before = existing;
702
704
  // Old shape (pre-v5.8.4): [gnosys] command/args
703
- existing = existing.replace(/\n?\[gnosys\][^\[]*?command\s*=\s*"gnosys"[^\[]*?args\s*=\s*\[[^\]]*\]\s*\n?/, "\n");
705
+ existing = existing.replace(/\n?\[gnosys\][^[]*?command\s*=\s*"gnosys"[^[]*?args\s*=\s*\[[^\]]*\]\s*\n?/, "\n");
704
706
  // v5.8.4 shape: [mcp.gnosys] type/command
705
- existing = existing.replace(/\n?\[mcp\.gnosys\][^\[]*?type\s*=\s*"local"[^\[]*?command\s*=\s*\[[^\]]*\]\s*\n?/, "\n");
707
+ existing = existing.replace(/\n?\[mcp\.gnosys\][^[]*?type\s*=\s*"local"[^[]*?command\s*=\s*\[[^\]]*\]\s*\n?/, "\n");
706
708
  if (existing !== before) {
707
709
  existing = existing.replace(/\n{3,}/g, "\n\n");
708
710
  await fs.writeFile(userCodexConfig, existing, "utf-8");
@@ -1112,6 +1114,7 @@ export async function runSetup(opts) {
1112
1114
  console.log();
1113
1115
  }
1114
1116
  if (shouldUpgrade) {
1117
+ // Intentional dynamic import — lazy-load projectIdentity to avoid a static cycle.
1115
1118
  const { createProjectIdentity } = await import("./projectIdentity.js");
1116
1119
  for (const project of projects) {
1117
1120
  // Check directory still exists on disk
@@ -1223,7 +1226,8 @@ export async function runSetup(opts) {
1223
1226
  if (baseUrl) {
1224
1227
  // Write GNOSYS_LLM_BASE_URL to env file
1225
1228
  const configDir = path.join(os.homedir(), ".config", "gnosys");
1226
- await fs.mkdir(configDir, { recursive: true });
1229
+ await fs.mkdir(configDir, { recursive: true, mode: 0o700 });
1230
+ await fs.chmod(configDir, 0o700);
1227
1231
  const envPath = path.join(configDir, ".env");
1228
1232
  let lines = [];
1229
1233
  try {
@@ -1248,6 +1252,7 @@ export async function runSetup(opts) {
1248
1252
  lines.push(`GNOSYS_LLM_BASE_URL=${baseUrl}`);
1249
1253
  }
1250
1254
  await fs.writeFile(envPath, lines.join("\n") + "\n", "utf-8");
1255
+ await fs.chmod(envPath, 0o600);
1251
1256
  }
1252
1257
  }
1253
1258
  else if (isSkip) {
@@ -2078,7 +2083,7 @@ export async function runModelsSetup(opts = {}) {
2078
2083
  * --refresh: clear the OpenRouter cache and re-fetch
2079
2084
  * --set X: update the default model in gnosys.json (no prompts)
2080
2085
  */
2081
- export async function runModelsCommand(opts = {}) {
2086
+ async function runModelsCommand(opts = {}) {
2082
2087
  const projectDir = opts.directory ? path.resolve(opts.directory) : process.cwd();
2083
2088
  const existingConfig = await loadExistingConfig(projectDir);
2084
2089
  const currentProvider = existingConfig?.llm.defaultProvider;
@@ -2484,4 +2489,3 @@ export async function getApiKeyForProvider(provider) {
2484
2489
  }
2485
2490
  return "";
2486
2491
  }
2487
- //# sourceMappingURL=setup.js.map
@@ -67,4 +67,3 @@ export declare function listDocuments(index: GnosysWebIndex, filter?: {
67
67
  tags?: string[];
68
68
  status?: string;
69
69
  }): DocumentManifest[];
70
- //# sourceMappingURL=staticSearch.d.ts.map
@@ -159,4 +159,3 @@ export function listDocuments(index, filter) {
159
159
  return true;
160
160
  });
161
161
  }
162
- //# sourceMappingURL=staticSearch.js.map
@@ -77,4 +77,3 @@ export declare class GnosysStore {
77
77
  */
78
78
  private autoCommit;
79
79
  }
80
- //# sourceMappingURL=store.d.ts.map
package/dist/lib/store.js CHANGED
@@ -211,4 +211,3 @@ export class GnosysStore {
211
211
  }
212
212
  }
213
213
  }
214
- //# sourceMappingURL=store.js.map
@@ -34,4 +34,3 @@ export declare function computeTfIdf(documents: Array<{
34
34
  term: string;
35
35
  score: number;
36
36
  }>>;
37
- //# sourceMappingURL=structuredIngest.d.ts.map
@@ -205,4 +205,3 @@ export function computeTfIdf(documents, topN = 20) {
205
205
  }
206
206
  return result;
207
207
  }
208
- //# sourceMappingURL=structuredIngest.js.map
@@ -21,4 +21,3 @@ export declare class GnosysTagRegistry {
21
21
  hasTag(tag: string): boolean;
22
22
  addTag(category: string, tag: string): Promise<boolean>;
23
23
  }
24
- //# sourceMappingURL=tags.d.ts.map
package/dist/lib/tags.js CHANGED
@@ -96,4 +96,3 @@ export class GnosysTagRegistry {
96
96
  return true;
97
97
  }
98
98
  }
99
- //# sourceMappingURL=tags.js.map
@@ -4,8 +4,8 @@
4
4
  * Group memories by time period to see knowledge evolution.
5
5
  * Compute summary statistics across the store.
6
6
  */
7
- import { Memory } from "./store.js";
8
- import { DbMemory } from "./db.js";
7
+ import type { Memory } from "./store.js";
8
+ import type { DbMemory } from "./db.js";
9
9
  export type TimePeriod = "day" | "week" | "month" | "year";
10
10
  export interface TimelineEntry {
11
11
  period: string;
@@ -38,4 +38,3 @@ export declare function groupDbByPeriod(memories: DbMemory[], period: TimePeriod
38
38
  * Compute summary statistics across all memories.
39
39
  */
40
40
  export declare function computeStats(memories: Memory[]): MemoryStats;
41
- //# sourceMappingURL=timeline.d.ts.map
@@ -99,9 +99,9 @@ function toPeriodKey(dateStr, period) {
99
99
  const parts = dateStr.split("-");
100
100
  if (parts.length < 3)
101
101
  return null;
102
- const year = parseInt(parts[0]);
103
- const month = parseInt(parts[1]);
104
- const day = parseInt(parts[2]);
102
+ const year = parseInt(parts[0], 10);
103
+ const month = parseInt(parts[1], 10);
104
+ const day = parseInt(parts[2], 10);
105
105
  switch (period) {
106
106
  case "day":
107
107
  return dateStr; // Already YYYY-MM-DD
@@ -127,4 +127,3 @@ function getISOWeek(d) {
127
127
  return (1 +
128
128
  Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + ((week1.getDay() + 6) % 7)) / 7));
129
129
  }
130
- //# sourceMappingURL=timeline.js.map
@@ -9,21 +9,7 @@
9
9
  *
10
10
  * No external dependencies beyond Node built-ins and the Gnosys DB.
11
11
  */
12
- import { GnosysDB } from "./db.js";
13
- export interface TraceNode {
14
- name: string;
15
- file: string;
16
- kind: "function" | "class" | "method" | "export";
17
- line: number;
18
- calls: string[];
19
- calledBy: string[];
20
- imports: string[];
21
- }
22
- export interface TraceGraph {
23
- nodes: Map<string, TraceNode>;
24
- files: string[];
25
- rootDir: string;
26
- }
12
+ import type { GnosysDB } from "./db.js";
27
13
  export interface TraceResult {
28
14
  memoriesCreated: number;
29
15
  relationshipsCreated: number;
@@ -39,4 +25,3 @@ export declare function traceCodebase(db: GnosysDB, rootDir: string, opts?: {
39
25
  projectId?: string;
40
26
  maxFiles?: number;
41
27
  }): TraceResult;
42
- //# sourceMappingURL=trace.d.ts.map
package/dist/lib/trace.js CHANGED
@@ -335,4 +335,3 @@ export function traceCodebase(db, rootDir, opts = {}) {
335
335
  memoryIds,
336
336
  };
337
337
  }
338
- //# sourceMappingURL=trace.js.map
@@ -35,4 +35,3 @@ export declare function readUpgradeMarker(): UpgradeMarker | null;
35
35
  * so the host respawns it against the upgraded global binary.
36
36
  */
37
37
  export declare function shouldRestartMcp(currentVersion: string): boolean;
38
- //# sourceMappingURL=upgrade.d.ts.map
@@ -58,4 +58,3 @@ export function shouldRestartMcp(currentVersion) {
58
58
  return false;
59
59
  return marker.version !== currentVersion;
60
60
  }
61
- //# sourceMappingURL=upgrade.js.map
@@ -27,4 +27,3 @@ export interface VideoTranscriptResult {
27
27
  * 5. Return the transcript result
28
28
  */
29
29
  export declare function transcribeVideo(filePath: string, options?: TranscriptionOptions): Promise<VideoTranscriptResult>;
30
- //# sourceMappingURL=videoExtract.d.ts.map
@@ -89,4 +89,3 @@ export async function transcribeVideo(filePath, options) {
89
89
  }
90
90
  }
91
91
  }
92
- //# sourceMappingURL=videoExtract.js.map
@@ -5,8 +5,7 @@
5
5
  * builds a TF-IDF weighted inverted index mapping tokens to documents,
6
6
  * and writes the result as a JSON file (gnosys-index.json).
7
7
  */
8
- import type { GnosysWebIndex, DocumentManifest, IndexEntry } from "./staticSearch.js";
9
- export type { GnosysWebIndex, DocumentManifest, IndexEntry };
8
+ import type { GnosysWebIndex } from "./staticSearch.js";
10
9
  export interface BuildIndexOptions {
11
10
  stopWords?: boolean;
12
11
  minTokenLength?: number;
@@ -25,4 +24,3 @@ export declare function buildIndex(knowledgeDir: string, options?: BuildIndexOpt
25
24
  * Write an index to a JSON file.
26
25
  */
27
26
  export declare function writeIndex(index: GnosysWebIndex, outputPath: string): Promise<void>;
28
- //# sourceMappingURL=webIndex.d.ts.map
@@ -205,4 +205,3 @@ export async function writeIndex(index, outputPath) {
205
205
  await fs.mkdir(dir, { recursive: true });
206
206
  writeFileSync(outputPath, JSON.stringify(index, null, 2), "utf-8");
207
207
  }
208
- //# sourceMappingURL=webIndex.js.map
@@ -32,6 +32,19 @@ export interface IngestResult {
32
32
  }>;
33
33
  duration: number;
34
34
  }
35
+ export interface SafeUrlOptions {
36
+ /** Allow loopback hosts (127.0.0.1, localhost, ::1). Defaults to false. */
37
+ allowLoopback?: boolean;
38
+ }
39
+ /**
40
+ * Validate a URL is safe to fetch (blocks SSRF to internal networks).
41
+ * Only allows http/https schemes and rejects private/loopback/metadata targets.
42
+ */
43
+ export declare function isSafeUrl(urlStr: string, options?: SafeUrlOptions): boolean;
44
+ /**
45
+ * Fetch a URL with manual redirect handling; re-validates each hop through isSafeUrl.
46
+ */
47
+ export declare function safeFetch(startUrl: string, init?: RequestInit, options?: SafeUrlOptions): Promise<Response>;
35
48
  /**
36
49
  * Ingest a website into a Gnosys knowledge directory.
37
50
  */
@@ -48,4 +61,3 @@ export declare function ingestDirectory(dir: string, config: WebIngestConfig, gn
48
61
  * Remove all knowledge files from the output directory.
49
62
  */
50
63
  export declare function removeKnowledge(knowledgePath: string): Promise<void>;
51
- //# sourceMappingURL=webIngest.d.ts.map
@@ -9,6 +9,7 @@ import fs from "fs/promises";
9
9
  import { existsSync, readFileSync, mkdirSync } from "fs";
10
10
  import path from "path";
11
11
  import { createHash } from "crypto";
12
+ import { isIP } from "node:net";
12
13
  import matter from "gray-matter";
13
14
  import TurndownService from "turndown";
14
15
  import { getLLMProvider } from "./llm.js";
@@ -28,36 +29,52 @@ function createTurndown() {
28
29
  const MAX_SITEMAP_DEPTH = 3;
29
30
  /** Maximum total URLs collected from sitemaps. */
30
31
  const MAX_SITEMAP_URLS = 10_000;
32
+ /** Maximum redirect hops when fetching remote URLs. */
33
+ const MAX_FETCH_REDIRECTS = 5;
31
34
  /**
32
35
  * Validate a URL is safe to fetch (blocks SSRF to internal networks).
33
- * Only allows http/https schemes and rejects private/loopback IPs.
36
+ * Only allows http/https schemes and rejects private/loopback/metadata targets.
34
37
  */
35
- function isSafeUrl(urlStr) {
38
+ export function isSafeUrl(urlStr, options) {
36
39
  try {
37
40
  const url = new URL(urlStr);
38
41
  // Only allow http/https
39
42
  if (url.protocol !== "http:" && url.protocol !== "https:")
40
43
  return false;
41
- const hostname = url.hostname;
42
- // Block loopback
43
- if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]") {
44
- return true; // Allow localhost for local dev — but block metadata endpoints below
45
- }
44
+ const allowLoopback = options?.allowLoopback ?? false;
45
+ const hostname = url.hostname.replace(/^\[|\]$/g, "");
46
46
  // Block cloud metadata endpoints
47
47
  if (hostname === "169.254.169.254" || hostname === "metadata.google.internal")
48
48
  return false;
49
- // Block private IPv4 ranges
50
- const ipv4Match = hostname.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
51
- if (ipv4Match) {
52
- const [, a, b] = ipv4Match.map(Number);
53
- if (a === 10)
54
- return false; // 10.0.0.0/8
55
- if (a === 172 && b >= 16 && b <= 31)
56
- return false; // 172.16.0.0/12
57
- if (a === 192 && b === 168)
58
- return false; // 192.168.0.0/16
59
- if (a === 169 && b === 254)
60
- return false; // 169.254.0.0/16 (link-local)
49
+ // Block hex-encoded IP hostnames (e.g. 0x7f000001)
50
+ if (/^0x[0-9a-f]+$/i.test(hostname))
51
+ return false;
52
+ // Block dotted hosts with hex octets (e.g. 0x7f.0.0.1)
53
+ if (hostname.includes(".") && hostname.split(".").some((part) => /^0x[0-9a-f]+$/i.test(part))) {
54
+ return false;
55
+ }
56
+ const ipKind = isIP(hostname);
57
+ if (ipKind === 4) {
58
+ return isSafeIpv4(hostname, allowLoopback);
59
+ }
60
+ if (ipKind === 6) {
61
+ return isSafeIpv6(hostname, allowLoopback);
62
+ }
63
+ // All-numeric hostname (decimal IP encoding, e.g. 2130706433 = 127.0.0.1)
64
+ if (/^\d+$/.test(hostname)) {
65
+ const asInt = Number(hostname);
66
+ if (!Number.isFinite(asInt) || asInt < 0 || asInt > 0xffffffff)
67
+ return false;
68
+ const octets = [
69
+ (asInt >>> 24) & 0xff,
70
+ (asInt >>> 16) & 0xff,
71
+ (asInt >>> 8) & 0xff,
72
+ asInt & 0xff,
73
+ ];
74
+ return isSafeIpv4(octets.join("."), allowLoopback);
75
+ }
76
+ if (!allowLoopback && (hostname === "localhost" || hostname.endsWith(".localhost"))) {
77
+ return false;
61
78
  }
62
79
  return true;
63
80
  }
@@ -65,6 +82,66 @@ function isSafeUrl(urlStr) {
65
82
  return false;
66
83
  }
67
84
  }
85
+ function isSafeIpv4(dotted, allowLoopback) {
86
+ const match = dotted.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);
87
+ if (!match)
88
+ return false;
89
+ const octets = match.slice(1).map(Number);
90
+ if (octets.some((n) => n > 255))
91
+ return false;
92
+ const [a, b] = octets;
93
+ if (a === 0 && octets.every((n) => n === 0))
94
+ return false; // 0.0.0.0
95
+ if (!allowLoopback && a === 127)
96
+ return false; // 127.0.0.0/8
97
+ if (a === 10)
98
+ return false; // 10.0.0.0/8
99
+ if (a === 172 && b >= 16 && b <= 31)
100
+ return false; // 172.16.0.0/12
101
+ if (a === 192 && b === 168)
102
+ return false; // 192.168.0.0/16
103
+ if (a === 169 && b === 254)
104
+ return false; // 169.254.0.0/16
105
+ return true;
106
+ }
107
+ function isSafeIpv6(addr, allowLoopback) {
108
+ const lower = addr.toLowerCase();
109
+ if (!allowLoopback && (lower === "::1" || lower === "0:0:0:0:0:0:0:1"))
110
+ return false;
111
+ // Unique local addresses fc00::/7
112
+ if (/^f[cd]/i.test(lower))
113
+ return false;
114
+ // Link-local fe80::/10
115
+ if (/^fe[89ab]/i.test(lower))
116
+ return false;
117
+ // IPv4-mapped IPv6 (::ffff:x.x.x.x)
118
+ const mapped = lower.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);
119
+ if (mapped) {
120
+ return isSafeIpv4(mapped[1], allowLoopback);
121
+ }
122
+ return true;
123
+ }
124
+ /**
125
+ * Fetch a URL with manual redirect handling; re-validates each hop through isSafeUrl.
126
+ */
127
+ export async function safeFetch(startUrl, init, options) {
128
+ let url = startUrl;
129
+ for (let hop = 0; hop <= MAX_FETCH_REDIRECTS; hop++) {
130
+ if (!isSafeUrl(url, options)) {
131
+ throw new Error(`Refusing to fetch unsafe URL: ${url}`);
132
+ }
133
+ const response = await fetch(url, { ...init, redirect: "manual" });
134
+ if (response.status >= 300 && response.status < 400) {
135
+ const location = response.headers.get("location");
136
+ if (!location)
137
+ return response;
138
+ url = new URL(location, url).toString();
139
+ continue;
140
+ }
141
+ return response;
142
+ }
143
+ throw new Error("Too many redirects");
144
+ }
68
145
  // ─── URL utilities ───────────────────────────────────────────────────────
69
146
  function matchesExclude(url, patterns) {
70
147
  const urlPath = new URL(url, "https://example.com").pathname;
@@ -122,7 +199,7 @@ async function fetchSitemapUrls(sitemapUrl, depth = 0) {
122
199
  if (!isSafeUrl(sitemapUrl)) {
123
200
  throw new Error(`Refusing to fetch unsafe URL: ${sitemapUrl}`);
124
201
  }
125
- const response = await fetch(sitemapUrl);
202
+ const response = await safeFetch(sitemapUrl);
126
203
  if (!response.ok) {
127
204
  throw new Error(`Failed to fetch sitemap: ${response.status} ${response.statusText}`);
128
205
  }
@@ -153,7 +230,7 @@ async function fetchPage(url) {
153
230
  if (!isSafeUrl(url)) {
154
231
  throw new Error(`Refusing to fetch unsafe URL: ${url}`);
155
232
  }
156
- const response = await fetch(url);
233
+ const response = await safeFetch(url);
157
234
  if (!response.ok) {
158
235
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
159
236
  }
@@ -507,7 +584,6 @@ async function applyTfIdfRelevance(outputDir) {
507
584
  docs.push({ id, content: parsed.content, path: filePath });
508
585
  }
509
586
  catch {
510
- continue;
511
587
  }
512
588
  }
513
589
  if (docs.length === 0)
@@ -526,8 +602,6 @@ async function applyTfIdfRelevance(outputDir) {
526
602
  await fs.writeFile(doc.path, updated, "utf-8");
527
603
  }
528
604
  catch {
529
- continue;
530
605
  }
531
606
  }
532
607
  }
533
- //# sourceMappingURL=webIngest.js.map
@@ -4,7 +4,7 @@
4
4
  * Scans memory content for [[wikilinks]] and builds a link graph.
5
5
  * Supports both [[title]] and [[path|display text]] formats.
6
6
  */
7
- import { Memory } from "./store.js";
7
+ import type { Memory } from "./store.js";
8
8
  /** A single link found in a memory. */
9
9
  export interface WikiLink {
10
10
  /** The raw target inside [[ ]] — could be a title or relative path */
@@ -17,7 +17,7 @@ export interface WikiLink {
17
17
  sourceTitle: string;
18
18
  }
19
19
  /** A node in the link graph with both outgoing and incoming links. */
20
- export interface LinkNode {
20
+ interface LinkNode {
21
21
  /** This memory's relative path */
22
22
  path: string;
23
23
  /** This memory's title */
@@ -60,4 +60,4 @@ export declare function getOutgoingLinks(memories: Memory[], sourcePath: string)
60
60
  * Format the link graph as a simple text summary.
61
61
  */
62
62
  export declare function formatGraphSummary(graph: LinkGraph): string;
63
- //# sourceMappingURL=wikilinks.d.ts.map
63
+ export {};
@@ -143,4 +143,3 @@ export function formatGraphSummary(graph) {
143
143
  }
144
144
  return lines.join("\n");
145
145
  }
146
- //# sourceMappingURL=wikilinks.js.map
@@ -9,4 +9,3 @@
9
9
  * the only way users actually see the message during `npm install -g`.
10
10
  */
11
11
  export {};
12
- //# sourceMappingURL=postinstall.d.ts.map
@@ -98,4 +98,3 @@ async function main() {
98
98
  }
99
99
  }
100
100
  main();
101
- //# sourceMappingURL=postinstall.js.map
@@ -79,4 +79,3 @@ export declare class SandboxClient {
79
79
  /** Check if the sandbox is running (non-throwing) */
80
80
  isRunning(): Promise<boolean>;
81
81
  }
82
- //# sourceMappingURL=client.d.ts.map
@@ -125,4 +125,3 @@ export class SandboxClient {
125
125
  }
126
126
  }
127
127
  }
128
- //# sourceMappingURL=client.js.map
@@ -11,4 +11,3 @@
11
11
  * Write the helper library file to the specified directory.
12
12
  */
13
13
  export declare function generateHelper(targetDir: string): Promise<string>;
14
- //# sourceMappingURL=helper-template.d.ts.map
@@ -288,4 +288,3 @@ export async function generateHelper(targetDir) {
288
288
  fs.writeFileSync(outputPath, source, "utf8");
289
289
  return outputPath;
290
290
  }
291
- //# sourceMappingURL=helper-template.js.map