@aroman22/codegraph-vba-darwin-arm64 1.5.1 → 1.6.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 (335) hide show
  1. package/bin/codegraph +5 -0
  2. package/lib/dist/bin/codegraph.d.ts +1 -1
  3. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  4. package/lib/dist/bin/codegraph.js +307 -81
  5. package/lib/dist/bin/codegraph.js.map +1 -1
  6. package/lib/dist/bin/command-supervision.d.ts +38 -1
  7. package/lib/dist/bin/command-supervision.d.ts.map +1 -1
  8. package/lib/dist/bin/command-supervision.js +22 -3
  9. package/lib/dist/bin/command-supervision.js.map +1 -1
  10. package/lib/dist/db/index.d.ts +84 -5
  11. package/lib/dist/db/index.d.ts.map +1 -1
  12. package/lib/dist/db/index.js +209 -12
  13. package/lib/dist/db/index.js.map +1 -1
  14. package/lib/dist/db/migrations.d.ts +1 -1
  15. package/lib/dist/db/migrations.d.ts.map +1 -1
  16. package/lib/dist/db/migrations.js +80 -3
  17. package/lib/dist/db/migrations.js.map +1 -1
  18. package/lib/dist/db/queries.d.ts +127 -4
  19. package/lib/dist/db/queries.d.ts.map +1 -1
  20. package/lib/dist/db/queries.js +317 -7
  21. package/lib/dist/db/queries.js.map +1 -1
  22. package/lib/dist/db/schema.sql +43 -1
  23. package/lib/dist/db/wal-valve.d.ts +106 -0
  24. package/lib/dist/db/wal-valve.d.ts.map +1 -0
  25. package/lib/dist/db/wal-valve.js +208 -0
  26. package/lib/dist/db/wal-valve.js.map +1 -0
  27. package/lib/dist/directory.d.ts +9 -5
  28. package/lib/dist/directory.d.ts.map +1 -1
  29. package/lib/dist/directory.js +210 -19
  30. package/lib/dist/directory.js.map +1 -1
  31. package/lib/dist/extraction/cfml-extractor.d.ts +107 -0
  32. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -0
  33. package/lib/dist/extraction/cfml-extractor.js +494 -0
  34. package/lib/dist/extraction/cfml-extractor.js.map +1 -0
  35. package/lib/dist/extraction/grammars.d.ts +25 -1
  36. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  37. package/lib/dist/extraction/grammars.js +177 -23
  38. package/lib/dist/extraction/grammars.js.map +1 -1
  39. package/lib/dist/extraction/index.d.ts +47 -2
  40. package/lib/dist/extraction/index.d.ts.map +1 -1
  41. package/lib/dist/extraction/index.js +568 -51
  42. package/lib/dist/extraction/index.js.map +1 -1
  43. package/lib/dist/extraction/languages/arkts.d.ts +3 -0
  44. package/lib/dist/extraction/languages/arkts.d.ts.map +1 -0
  45. package/lib/dist/extraction/languages/arkts.js +127 -0
  46. package/lib/dist/extraction/languages/arkts.js.map +1 -0
  47. package/lib/dist/extraction/languages/c-cpp.d.ts +98 -0
  48. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  49. package/lib/dist/extraction/languages/c-cpp.js +563 -1
  50. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  51. package/lib/dist/extraction/languages/cfquery.d.ts +12 -0
  52. package/lib/dist/extraction/languages/cfquery.d.ts.map +1 -0
  53. package/lib/dist/extraction/languages/cfquery.js +28 -0
  54. package/lib/dist/extraction/languages/cfquery.js.map +1 -0
  55. package/lib/dist/extraction/languages/cfscript.d.ts +3 -0
  56. package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -0
  57. package/lib/dist/extraction/languages/cfscript.js +73 -0
  58. package/lib/dist/extraction/languages/cfscript.js.map +1 -0
  59. package/lib/dist/extraction/languages/cobol.d.ts +33 -0
  60. package/lib/dist/extraction/languages/cobol.d.ts.map +1 -0
  61. package/lib/dist/extraction/languages/cobol.js +499 -0
  62. package/lib/dist/extraction/languages/cobol.js.map +1 -0
  63. package/lib/dist/extraction/languages/erlang.d.ts +3 -0
  64. package/lib/dist/extraction/languages/erlang.d.ts.map +1 -0
  65. package/lib/dist/extraction/languages/erlang.js +350 -0
  66. package/lib/dist/extraction/languages/erlang.js.map +1 -0
  67. package/lib/dist/extraction/languages/index.d.ts.map +1 -1
  68. package/lib/dist/extraction/languages/index.js +18 -0
  69. package/lib/dist/extraction/languages/index.js.map +1 -1
  70. package/lib/dist/extraction/languages/nix.d.ts +3 -0
  71. package/lib/dist/extraction/languages/nix.d.ts.map +1 -0
  72. package/lib/dist/extraction/languages/nix.js +294 -0
  73. package/lib/dist/extraction/languages/nix.js.map +1 -0
  74. package/lib/dist/extraction/languages/solidity.d.ts +3 -0
  75. package/lib/dist/extraction/languages/solidity.d.ts.map +1 -0
  76. package/lib/dist/extraction/languages/solidity.js +293 -0
  77. package/lib/dist/extraction/languages/solidity.js.map +1 -0
  78. package/lib/dist/extraction/languages/terraform.d.ts +3 -0
  79. package/lib/dist/extraction/languages/terraform.d.ts.map +1 -0
  80. package/lib/dist/extraction/languages/terraform.js +641 -0
  81. package/lib/dist/extraction/languages/terraform.js.map +1 -0
  82. package/lib/dist/extraction/languages/vbnet.d.ts +11 -0
  83. package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -0
  84. package/lib/dist/extraction/languages/vbnet.js +141 -0
  85. package/lib/dist/extraction/languages/vbnet.js.map +1 -0
  86. package/lib/dist/extraction/mybatis-extractor.d.ts +30 -10
  87. package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
  88. package/lib/dist/extraction/mybatis-extractor.js +140 -38
  89. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  90. package/lib/dist/extraction/parse-pool.d.ts +28 -1
  91. package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
  92. package/lib/dist/extraction/parse-pool.js +76 -7
  93. package/lib/dist/extraction/parse-pool.js.map +1 -1
  94. package/lib/dist/extraction/parse-worker.js +11 -4
  95. package/lib/dist/extraction/parse-worker.js.map +1 -1
  96. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  97. package/lib/dist/extraction/tree-sitter-helpers.js +1 -0
  98. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  99. package/lib/dist/extraction/tree-sitter-types.d.ts +20 -1
  100. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  101. package/lib/dist/extraction/tree-sitter.d.ts +60 -1
  102. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  103. package/lib/dist/extraction/tree-sitter.js +905 -20
  104. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  105. package/lib/dist/extraction/vba/call-sweep.d.ts +3 -0
  106. package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -0
  107. package/lib/dist/extraction/vba/call-sweep.js +206 -0
  108. package/lib/dist/extraction/vba/call-sweep.js.map +1 -0
  109. package/lib/dist/extraction/vba/calls.d.ts +55 -0
  110. package/lib/dist/extraction/vba/calls.d.ts.map +1 -0
  111. package/lib/dist/extraction/vba/calls.js +439 -0
  112. package/lib/dist/extraction/vba/calls.js.map +1 -0
  113. package/lib/dist/extraction/vba/constants.d.ts +42 -0
  114. package/lib/dist/extraction/vba/constants.d.ts.map +1 -0
  115. package/lib/dist/extraction/vba/constants.js +112 -0
  116. package/lib/dist/extraction/vba/constants.js.map +1 -0
  117. package/lib/dist/extraction/vba/context.d.ts +175 -0
  118. package/lib/dist/extraction/vba/context.d.ts.map +1 -0
  119. package/lib/dist/extraction/vba/context.js +268 -0
  120. package/lib/dist/extraction/vba/context.js.map +1 -0
  121. package/lib/dist/extraction/vba/controls.d.ts +24 -0
  122. package/lib/dist/extraction/vba/controls.d.ts.map +1 -0
  123. package/lib/dist/extraction/vba/controls.js +89 -0
  124. package/lib/dist/extraction/vba/controls.js.map +1 -0
  125. package/lib/dist/extraction/vba/declarations.d.ts +3 -0
  126. package/lib/dist/extraction/vba/declarations.d.ts.map +1 -0
  127. package/lib/dist/extraction/vba/declarations.js +154 -0
  128. package/lib/dist/extraction/vba/declarations.js.map +1 -0
  129. package/lib/dist/extraction/vba/dims.d.ts +3 -0
  130. package/lib/dist/extraction/vba/dims.d.ts.map +1 -0
  131. package/lib/dist/extraction/vba/dims.js +186 -0
  132. package/lib/dist/extraction/vba/dims.js.map +1 -0
  133. package/lib/dist/extraction/vba/docmd.d.ts +16 -0
  134. package/lib/dist/extraction/vba/docmd.d.ts.map +1 -0
  135. package/lib/dist/extraction/vba/docmd.js +179 -0
  136. package/lib/dist/extraction/vba/docmd.js.map +1 -0
  137. package/lib/dist/extraction/vba/enums-consts.d.ts +15 -0
  138. package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -0
  139. package/lib/dist/extraction/vba/enums-consts.js +178 -0
  140. package/lib/dist/extraction/vba/enums-consts.js.map +1 -0
  141. package/lib/dist/extraction/vba/implements.d.ts +3 -0
  142. package/lib/dist/extraction/vba/implements.d.ts.map +1 -0
  143. package/lib/dist/extraction/vba/implements.js +52 -0
  144. package/lib/dist/extraction/vba/implements.js.map +1 -0
  145. package/lib/dist/extraction/vba/procedures.d.ts +3 -0
  146. package/lib/dist/extraction/vba/procedures.d.ts.map +1 -0
  147. package/lib/dist/extraction/vba/procedures.js +239 -0
  148. package/lib/dist/extraction/vba/procedures.js.map +1 -0
  149. package/lib/dist/extraction/vba/sql-wrapper.d.ts +17 -0
  150. package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -0
  151. package/lib/dist/extraction/vba/sql-wrapper.js +212 -0
  152. package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -0
  153. package/lib/dist/extraction/vba/tempvars.d.ts +10 -0
  154. package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -0
  155. package/lib/dist/extraction/vba/tempvars.js +138 -0
  156. package/lib/dist/extraction/vba/tempvars.js.map +1 -0
  157. package/lib/dist/extraction/vba/text-utils.d.ts +73 -0
  158. package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -0
  159. package/lib/dist/extraction/vba/text-utils.js +195 -0
  160. package/lib/dist/extraction/vba/text-utils.js.map +1 -0
  161. package/lib/dist/extraction/vba-extractor.d.ts +3 -951
  162. package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
  163. package/lib/dist/extraction/vba-extractor.js +46 -2934
  164. package/lib/dist/extraction/vba-extractor.js.map +1 -1
  165. package/lib/dist/extraction/vba-preprocess.d.ts +1 -1
  166. package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
  167. package/lib/dist/extraction/vba-preprocess.js +300 -88
  168. package/lib/dist/extraction/vba-preprocess.js.map +1 -1
  169. package/lib/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  170. package/lib/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  171. package/lib/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  172. package/lib/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  173. package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  174. package/lib/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  175. package/lib/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  176. package/lib/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  177. package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  178. package/lib/dist/graph/traversal.d.ts.map +1 -1
  179. package/lib/dist/graph/traversal.js +76 -17
  180. package/lib/dist/graph/traversal.js.map +1 -1
  181. package/lib/dist/index.d.ts +81 -1
  182. package/lib/dist/index.d.ts.map +1 -1
  183. package/lib/dist/index.js +467 -10
  184. package/lib/dist/index.js.map +1 -1
  185. package/lib/dist/installer/index.d.ts +42 -0
  186. package/lib/dist/installer/index.d.ts.map +1 -1
  187. package/lib/dist/installer/index.js +97 -2
  188. package/lib/dist/installer/index.js.map +1 -1
  189. package/lib/dist/mcp/daemon.d.ts +35 -3
  190. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  191. package/lib/dist/mcp/daemon.js +101 -9
  192. package/lib/dist/mcp/daemon.js.map +1 -1
  193. package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
  194. package/lib/dist/mcp/dynamic-boundaries.js +2 -1
  195. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  196. package/lib/dist/mcp/early-ppid.d.ts +26 -0
  197. package/lib/dist/mcp/early-ppid.d.ts.map +1 -0
  198. package/lib/dist/mcp/early-ppid.js +29 -0
  199. package/lib/dist/mcp/early-ppid.js.map +1 -0
  200. package/lib/dist/mcp/index.d.ts.map +1 -1
  201. package/lib/dist/mcp/index.js +29 -4
  202. package/lib/dist/mcp/index.js.map +1 -1
  203. package/lib/dist/mcp/liveness-watchdog.d.ts +18 -1
  204. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  205. package/lib/dist/mcp/liveness-watchdog.js +73 -13
  206. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  207. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  208. package/lib/dist/mcp/proxy.js +30 -4
  209. package/lib/dist/mcp/proxy.js.map +1 -1
  210. package/lib/dist/mcp/query-pool.d.ts +14 -0
  211. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  212. package/lib/dist/mcp/query-pool.js +18 -0
  213. package/lib/dist/mcp/query-pool.js.map +1 -1
  214. package/lib/dist/mcp/session.d.ts +14 -0
  215. package/lib/dist/mcp/session.d.ts.map +1 -1
  216. package/lib/dist/mcp/session.js +28 -1
  217. package/lib/dist/mcp/session.js.map +1 -1
  218. package/lib/dist/mcp/startup-handshake.d.ts +44 -0
  219. package/lib/dist/mcp/startup-handshake.d.ts.map +1 -0
  220. package/lib/dist/mcp/startup-handshake.js +73 -0
  221. package/lib/dist/mcp/startup-handshake.js.map +1 -0
  222. package/lib/dist/mcp/tools.d.ts +22 -0
  223. package/lib/dist/mcp/tools.d.ts.map +1 -1
  224. package/lib/dist/mcp/tools.js +289 -23
  225. package/lib/dist/mcp/tools.js.map +1 -1
  226. package/lib/dist/mcp/transport.d.ts.map +1 -1
  227. package/lib/dist/mcp/transport.js +18 -0
  228. package/lib/dist/mcp/transport.js.map +1 -1
  229. package/lib/dist/project-config.d.ts +44 -0
  230. package/lib/dist/project-config.d.ts.map +1 -1
  231. package/lib/dist/project-config.js +151 -2
  232. package/lib/dist/project-config.js.map +1 -1
  233. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
  234. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  235. package/lib/dist/resolution/c-fnptr-synthesizer.js +170 -146
  236. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  237. package/lib/dist/resolution/callback-synthesizer.d.ts +1 -1
  238. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  239. package/lib/dist/resolution/callback-synthesizer.js +1109 -97
  240. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  241. package/lib/dist/resolution/cooperative-yield.d.ts +32 -0
  242. package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -0
  243. package/lib/dist/resolution/cooperative-yield.js +42 -0
  244. package/lib/dist/resolution/cooperative-yield.js.map +1 -0
  245. package/lib/dist/resolution/frameworks/cics.d.ts +20 -0
  246. package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -0
  247. package/lib/dist/resolution/frameworks/cics.js +90 -0
  248. package/lib/dist/resolution/frameworks/cics.js.map +1 -0
  249. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  250. package/lib/dist/resolution/frameworks/index.js +6 -0
  251. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  252. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  253. package/lib/dist/resolution/frameworks/java.js +14 -6
  254. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  255. package/lib/dist/resolution/frameworks/terraform.d.ts +38 -0
  256. package/lib/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  257. package/lib/dist/resolution/frameworks/terraform.js +277 -0
  258. package/lib/dist/resolution/frameworks/terraform.js.map +1 -0
  259. package/lib/dist/resolution/goframe-synthesizer.d.ts +2 -1
  260. package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
  261. package/lib/dist/resolution/goframe-synthesizer.js +8 -3
  262. package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
  263. package/lib/dist/resolution/import-resolver.d.ts +7 -0
  264. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  265. package/lib/dist/resolution/import-resolver.js +129 -4
  266. package/lib/dist/resolution/import-resolver.js.map +1 -1
  267. package/lib/dist/resolution/index.d.ts +85 -2
  268. package/lib/dist/resolution/index.d.ts.map +1 -1
  269. package/lib/dist/resolution/index.js +535 -58
  270. package/lib/dist/resolution/index.js.map +1 -1
  271. package/lib/dist/resolution/name-matcher.d.ts +22 -3
  272. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  273. package/lib/dist/resolution/name-matcher.js +613 -39
  274. package/lib/dist/resolution/name-matcher.js.map +1 -1
  275. package/lib/dist/resolution/strip-comments.d.ts +1 -1
  276. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  277. package/lib/dist/resolution/strip-comments.js +49 -0
  278. package/lib/dist/resolution/strip-comments.js.map +1 -1
  279. package/lib/dist/resolution/types.d.ts +29 -0
  280. package/lib/dist/resolution/types.d.ts.map +1 -1
  281. package/lib/dist/resolution/workspace-packages.d.ts +10 -0
  282. package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
  283. package/lib/dist/resolution/workspace-packages.js +142 -4
  284. package/lib/dist/resolution/workspace-packages.js.map +1 -1
  285. package/lib/dist/search/identifier-segments.d.ts +60 -0
  286. package/lib/dist/search/identifier-segments.d.ts.map +1 -0
  287. package/lib/dist/search/identifier-segments.js +176 -0
  288. package/lib/dist/search/identifier-segments.js.map +1 -0
  289. package/lib/dist/sync/git-hooks.d.ts.map +1 -1
  290. package/lib/dist/sync/git-hooks.js +2 -0
  291. package/lib/dist/sync/git-hooks.js.map +1 -1
  292. package/lib/dist/sync/watcher.d.ts +10 -5
  293. package/lib/dist/sync/watcher.d.ts.map +1 -1
  294. package/lib/dist/sync/watcher.js +51 -14
  295. package/lib/dist/sync/watcher.js.map +1 -1
  296. package/lib/dist/sync/worktree.d.ts +9 -0
  297. package/lib/dist/sync/worktree.d.ts.map +1 -1
  298. package/lib/dist/sync/worktree.js +45 -0
  299. package/lib/dist/sync/worktree.js.map +1 -1
  300. package/lib/dist/types.d.ts +25 -2
  301. package/lib/dist/types.d.ts.map +1 -1
  302. package/lib/dist/types.js +10 -0
  303. package/lib/dist/types.js.map +1 -1
  304. package/lib/dist/upgrade/index.d.ts +32 -0
  305. package/lib/dist/upgrade/index.d.ts.map +1 -1
  306. package/lib/dist/upgrade/index.js +163 -14
  307. package/lib/dist/upgrade/index.js.map +1 -1
  308. package/lib/dist/upgrade/remove-binary.d.ts +87 -0
  309. package/lib/dist/upgrade/remove-binary.d.ts.map +1 -0
  310. package/lib/dist/upgrade/remove-binary.js +289 -0
  311. package/lib/dist/upgrade/remove-binary.js.map +1 -0
  312. package/lib/dist/upgrade/update-check.d.ts +92 -0
  313. package/lib/dist/upgrade/update-check.d.ts.map +1 -0
  314. package/lib/dist/upgrade/update-check.js +258 -0
  315. package/lib/dist/upgrade/update-check.js.map +1 -0
  316. package/lib/node_modules/.modules.yaml +1 -1
  317. package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
  318. package/lib/package.json +1 -1
  319. package/package.json +1 -1
  320. package/lib/dist/reasoning/config.d.ts +0 -45
  321. package/lib/dist/reasoning/config.d.ts.map +0 -1
  322. package/lib/dist/reasoning/config.js +0 -171
  323. package/lib/dist/reasoning/config.js.map +0 -1
  324. package/lib/dist/reasoning/credentials.d.ts +0 -5
  325. package/lib/dist/reasoning/credentials.d.ts.map +0 -1
  326. package/lib/dist/reasoning/credentials.js +0 -83
  327. package/lib/dist/reasoning/credentials.js.map +0 -1
  328. package/lib/dist/reasoning/login.d.ts +0 -21
  329. package/lib/dist/reasoning/login.d.ts.map +0 -1
  330. package/lib/dist/reasoning/login.js +0 -85
  331. package/lib/dist/reasoning/login.js.map +0 -1
  332. package/lib/dist/reasoning/reasoner.d.ts +0 -43
  333. package/lib/dist/reasoning/reasoner.d.ts.map +0 -1
  334. package/lib/dist/reasoning/reasoner.js +0 -308
  335. package/lib/dist/reasoning/reasoner.js.map +0 -1
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ /**
3
+ * Background update-availability check for long-lived servers (#1243).
4
+ *
5
+ * The recommended MCP config launches the LOCAL `codegraph` binary, so the
6
+ * server (and the prompt hook alongside it) silently stays on whatever version
7
+ * was last manually upgraded — users discover the drift only when something
8
+ * breaks. This module gives the running server *visibility* without changing
9
+ * behavior: a non-blocking check against the latest GitHub release, surfaced
10
+ * as a one-line notice (stderr log, MCP initialize instructions, and
11
+ * `codegraph_status`) telling the user to run `codegraph upgrade`.
12
+ *
13
+ * Invariants (mirrors the telemetry module's contract):
14
+ * - Never stdout — stdio is the MCP protocol channel.
15
+ * - Never blocking: the network refresh is fire-and-forget; every reader
16
+ * (`getUpdateNotice`) is a cheap synchronous cache read, so the #172
17
+ * respond-fast handshake contract holds.
18
+ * - Fail silent: offline / rate-limited / disk-full all degrade to "no
19
+ * notice", never an error, never a retry loop.
20
+ * - Off is off: `CODEGRAPH_NO_UPDATE_CHECK` (dedicated) or `DO_NOT_TRACK`
21
+ * (broad don't-phone-home convention — set by e.g. the Pro container's
22
+ * data plane) suppresses the network call AND the notice entirely.
23
+ *
24
+ * The check itself reuses `resolveLatestVersion` — the GitHub release-redirect
25
+ * trick with the API fallback — so version resolution can't drift from what
26
+ * `codegraph upgrade` installs. Results are cached in `~/.codegraph/` (the
27
+ * same global state dir telemetry and the daemon registry use) with a 24h TTL
28
+ * on success and a 1h backoff after failure, shared across every proxy /
29
+ * daemon process on the machine.
30
+ */
31
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
32
+ if (k2 === undefined) k2 = k;
33
+ var desc = Object.getOwnPropertyDescriptor(m, k);
34
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
35
+ desc = { enumerable: true, get: function() { return m[k]; } };
36
+ }
37
+ Object.defineProperty(o, k2, desc);
38
+ }) : (function(o, m, k, k2) {
39
+ if (k2 === undefined) k2 = k;
40
+ o[k2] = m[k];
41
+ }));
42
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
43
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
44
+ }) : function(o, v) {
45
+ o["default"] = v;
46
+ });
47
+ var __importStar = (this && this.__importStar) || (function () {
48
+ var ownKeys = function(o) {
49
+ ownKeys = Object.getOwnPropertyNames || function (o) {
50
+ var ar = [];
51
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
52
+ return ar;
53
+ };
54
+ return ownKeys(o);
55
+ };
56
+ return function (mod) {
57
+ if (mod && mod.__esModule) return mod;
58
+ var result = {};
59
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
60
+ __setModuleDefault(result, mod);
61
+ return result;
62
+ };
63
+ })();
64
+ Object.defineProperty(exports, "__esModule", { value: true });
65
+ exports.UPDATE_CHECK_FAILURE_BACKOFF_MS = exports.UPDATE_CHECK_TTL_MS = void 0;
66
+ exports.updateCheckDisabled = updateCheckDisabled;
67
+ exports.updateCheckCachePath = updateCheckCachePath;
68
+ exports.readUpdateCheckCache = readUpdateCheckCache;
69
+ exports.canonicalVersionTag = canonicalVersionTag;
70
+ exports.formatUpdateNotice = formatUpdateNotice;
71
+ exports.refreshUpdateCheck = refreshUpdateCheck;
72
+ exports.getUpdateNotice = getUpdateNotice;
73
+ exports.resetUpdateNoticeMemo = resetUpdateNoticeMemo;
74
+ exports.checkForUpdateInBackground = checkForUpdateInBackground;
75
+ const fs = __importStar(require("fs"));
76
+ const path = __importStar(require("path"));
77
+ const os = __importStar(require("os"));
78
+ const index_1 = require("./index");
79
+ const version_1 = require("../mcp/version");
80
+ /** Re-check the release feed after this long (successful checks). */
81
+ exports.UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1000;
82
+ /** Back off this long after a failed check (offline, rate-limited). */
83
+ exports.UPDATE_CHECK_FAILURE_BACKOFF_MS = 60 * 60 * 1000;
84
+ /** Short network budget — the refresh is background work, not a handshake. */
85
+ const UPDATE_CHECK_NETWORK_TIMEOUT_MS = 5000;
86
+ function resolveDeps(deps = {}) {
87
+ return {
88
+ dir: deps.dir ?? path.join(os.homedir(), '.codegraph'),
89
+ env: deps.env ?? process.env,
90
+ now: deps.now ?? Date.now,
91
+ resolveLatest: deps.resolveLatest ?? (() => (0, index_1.resolveLatestVersion)(undefined, UPDATE_CHECK_NETWORK_TIMEOUT_MS)),
92
+ currentVersion: deps.currentVersion ?? version_1.CodeGraphPackageVersion,
93
+ };
94
+ }
95
+ function envTruthy(raw) {
96
+ return raw !== undefined && raw !== '' && raw !== '0' && raw.toLowerCase() !== 'false';
97
+ }
98
+ /**
99
+ * True when the update check must not run at all — no network call, no
100
+ * notice. `DO_NOT_TRACK` uses the same truthiness the telemetry opt-out does.
101
+ */
102
+ function updateCheckDisabled(env = process.env) {
103
+ return envTruthy(env.CODEGRAPH_NO_UPDATE_CHECK) || envTruthy(env.DO_NOT_TRACK);
104
+ }
105
+ function updateCheckCachePath(dir) {
106
+ return path.join(dir, 'update-check.json');
107
+ }
108
+ function readUpdateCheckCache(dir) {
109
+ try {
110
+ const raw = fs.readFileSync(updateCheckCachePath(dir), 'utf8');
111
+ const parsed = JSON.parse(raw);
112
+ if (typeof parsed?.lastAttemptAt !== 'number')
113
+ return null;
114
+ return parsed;
115
+ }
116
+ catch {
117
+ return null; // missing / torn / unparseable — same as no cache
118
+ }
119
+ }
120
+ function writeUpdateCheckCache(dir, cache) {
121
+ try {
122
+ fs.mkdirSync(dir, { recursive: true });
123
+ fs.writeFileSync(updateCheckCachePath(dir), JSON.stringify(cache));
124
+ }
125
+ catch {
126
+ /* fail silent — a read-only home dir must not break the server */
127
+ }
128
+ }
129
+ /**
130
+ * Rebuild a canonical `vX.Y.Z[-pre]` tag from the PARSED semver fields, or
131
+ * null when the input isn't version-shaped. The notice ends up inside the MCP
132
+ * initialize instructions — agent-visible, system-prompt-adjacent text — and
133
+ * the `latest` value arrives from a network redirect via an on-disk cache, so
134
+ * only a reconstructed canonical string may ever be interpolated, never the
135
+ * raw value. (`parseSemver`'s regex is not end-anchored: a value like
136
+ * `1.2.3-x <arbitrary text>` parses "valid" while the raw string would carry
137
+ * the trailing text straight into every session's instructions.)
138
+ */
139
+ function canonicalVersionTag(v) {
140
+ const s = (0, index_1.parseSemver)(v);
141
+ if (!s)
142
+ return null;
143
+ return `v${s.major}.${s.minor}.${s.patch}${s.pre ? `-${s.pre}` : ''}`;
144
+ }
145
+ /** One user-facing sentence; every surface (stderr, instructions, status) shows this. */
146
+ function formatUpdateNotice(current, latest) {
147
+ return (`CodeGraph ${latest} is available (this server is running ` +
148
+ `${current}). Update with \`codegraph upgrade\`.`);
149
+ }
150
+ function noticeFrom(cache, d) {
151
+ if (!cache?.latest)
152
+ return null;
153
+ // A dev build whose package.json couldn't be read reports the sentinel
154
+ // version; any comparison against it would always claim an update.
155
+ if (d.currentVersion === '0.0.0-unknown')
156
+ return null;
157
+ // Canonicalize BOTH sides before comparing or rendering — a non-semver
158
+ // `latest` (garbage redirect, tampered cache) yields no notice at all
159
+ // rather than flowing into agent-visible text.
160
+ const latest = canonicalVersionTag(cache.latest);
161
+ const current = canonicalVersionTag(d.currentVersion);
162
+ if (!latest || !current)
163
+ return null;
164
+ return (0, index_1.isUpdateAvailable)(current, latest) ? formatUpdateNotice(current, latest) : null;
165
+ }
166
+ function cacheIsFresh(cache, nowMs) {
167
+ if (!cache)
168
+ return false;
169
+ if (cache.lastSuccessAt !== undefined && nowMs - cache.lastSuccessAt < exports.UPDATE_CHECK_TTL_MS) {
170
+ return true;
171
+ }
172
+ // No recent success: only the failure backoff holds the network call off.
173
+ return nowMs - cache.lastAttemptAt < exports.UPDATE_CHECK_FAILURE_BACKOFF_MS;
174
+ }
175
+ /**
176
+ * Ensure the on-disk cache is fresh (hitting the network only past the TTL /
177
+ * backoff) and return the current notice, or null. Never throws.
178
+ */
179
+ async function refreshUpdateCheck(deps = {}) {
180
+ const d = resolveDeps(deps);
181
+ if (updateCheckDisabled(d.env))
182
+ return null;
183
+ const cached = readUpdateCheckCache(d.dir);
184
+ const nowMs = d.now();
185
+ if (cacheIsFresh(cached, nowMs))
186
+ return noticeFrom(cached, d);
187
+ try {
188
+ const latest = canonicalVersionTag(await d.resolveLatest());
189
+ // A response that isn't version-shaped is a failure, not a result —
190
+ // fall through to the backoff path and keep the previous known-good tag.
191
+ if (!latest)
192
+ throw new Error('release feed returned a non-version tag');
193
+ const next = { lastAttemptAt: nowMs, lastSuccessAt: nowMs, latest };
194
+ writeUpdateCheckCache(d.dir, next);
195
+ return noticeFrom(next, d);
196
+ }
197
+ catch {
198
+ // Record the attempt (starts the backoff) but KEEP the previous latest —
199
+ // a transient outage must not hide an already-known update.
200
+ const next = {
201
+ lastAttemptAt: nowMs,
202
+ lastSuccessAt: cached?.lastSuccessAt,
203
+ latest: cached?.latest,
204
+ };
205
+ writeUpdateCheckCache(d.dir, next);
206
+ return noticeFrom(next, d);
207
+ }
208
+ }
209
+ // Per-process memo so the sync read path (MCP initialize, codegraph_status)
210
+ // touches the disk at most once a minute, not once per handshake.
211
+ const NOTICE_MEMO_TTL_MS = 60 * 1000;
212
+ let noticeMemo = null;
213
+ /**
214
+ * The current update notice from the on-disk cache — synchronous and cheap
215
+ * (memoized disk read), safe on the initialize respond-fast path. When the
216
+ * cache has gone stale (e.g. a daemon that has been up for weeks), kicks a
217
+ * background refresh so the NEXT reader sees a current answer; this call
218
+ * still returns immediately from the stale cache.
219
+ */
220
+ function getUpdateNotice(deps = {}) {
221
+ const d = resolveDeps(deps);
222
+ if (updateCheckDisabled(d.env))
223
+ return null;
224
+ const useMemo = deps.dir === undefined && deps.now === undefined;
225
+ const nowMs = d.now();
226
+ if (useMemo && noticeMemo && nowMs - noticeMemo.at < NOTICE_MEMO_TTL_MS) {
227
+ return noticeMemo.value;
228
+ }
229
+ const cached = readUpdateCheckCache(d.dir);
230
+ if (!cacheIsFresh(cached, nowMs)) {
231
+ void refreshUpdateCheck(deps).catch(() => { });
232
+ }
233
+ const value = noticeFrom(cached, d);
234
+ if (useMemo)
235
+ noticeMemo = { at: nowMs, value };
236
+ return value;
237
+ }
238
+ /** Test hook: clear the per-process memo. */
239
+ function resetUpdateNoticeMemo() {
240
+ noticeMemo = null;
241
+ }
242
+ /**
243
+ * Fire-and-forget entry point for server startup: refresh the cache in the
244
+ * background and, if an update is available, emit ONE stderr line (stderr is
245
+ * the MCP-safe channel; hosts surface it in their server logs). Never throws,
246
+ * never blocks, never writes stdout.
247
+ */
248
+ function checkForUpdateInBackground(deps = {}, log = (line) => process.stderr.write(line)) {
249
+ refreshUpdateCheck(deps)
250
+ .then((notice) => {
251
+ // The shared notice sentence starts with "CodeGraph …"; drop the word
252
+ // after the log tag so the line doesn't read "[CodeGraph] CodeGraph …".
253
+ if (notice)
254
+ log(`[CodeGraph] ${notice.replace(/^CodeGraph /, '')}\n`);
255
+ })
256
+ .catch(() => { });
257
+ }
258
+ //# sourceMappingURL=update-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-check.js","sourceRoot":"","sources":["../../src/upgrade/update-check.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DH,kDAEC;AAED,oDAEC;AAED,oDASC;AAqBD,kDAIC;AAGD,gDAKC;AA6BD,gDA2BC;AAcD,0CAiBC;AAGD,sDAEC;AAQD,gEAWC;AA3ND,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,mCAA+E;AAC/E,4CAAyD;AAEzD,qEAAqE;AACxD,QAAA,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACvD,uEAAuE;AAC1D,QAAA,+BAA+B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC9D,8EAA8E;AAC9E,MAAM,+BAA+B,GAAG,IAAI,CAAC;AA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IAC3C,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;QACjC,KAAK,kBAAkB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAqB,CAAC,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACpC,IAAI,OAAO;QAAE,UAAU,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC/C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,6CAA6C;AAC7C,SAAgB,qBAAqB;IACnC,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,0BAA0B,CACxC,OAAwB,EAAE,EAC1B,MAA8B,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IAElE,kBAAkB,CAAC,IAAI,CAAC;SACrB,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QACf,sEAAsE;QACtE,wEAAwE;QACxE,IAAI,MAAM;YAAE,GAAG,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACxE,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,EAAE,GAAqB,CAAC,CAAC,CAAC;AACxC,CAAC"}
@@ -34,7 +34,7 @@ layoutVersion: 5
34
34
  nodeLinker: hoisted
35
35
  packageManager: pnpm@10.16.1
36
36
  pendingBuilds: []
37
- prunedAt: Sat, 04 Jul 2026 15:36:16 GMT
37
+ prunedAt: Sat, 11 Jul 2026 14:30:46 GMT
38
38
  publicHoistPattern: []
39
39
  registries:
40
40
  '@jsr': https://npm.jsr.io/
@@ -1,5 +1,5 @@
1
1
  {
2
- "lastValidatedTimestamp": 1783179376942,
2
+ "lastValidatedTimestamp": 1783780246823,
3
3
  "projects": {},
4
4
  "pnpmfiles": [],
5
5
  "settings": {
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aroman22/codegraph-vba",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "Supercharge AI coding agents with semantic code intelligence — surgical context, fewer tool calls, faster answers. 100% local.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aroman22/codegraph-vba-darwin-arm64",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "CodeGraph self-contained bundle for darwin-arm64",
5
5
  "os": [
6
6
  "darwin"
@@ -1,45 +0,0 @@
1
- /** Managed tier ("CodeGraph AI") — the metered gateway used when logged in. */
2
- export declare const MANAGED_DEFAULT_URL = "https://ai.getcodegraph.com/v1";
3
- /** The gateway's public model id (it translates this to the upstream provider id). */
4
- export declare const MANAGED_DEFAULT_MODEL = "openai/gpt-oss-120b";
5
- export interface OffloadConfig {
6
- /** Managed tier: route through CodeGraph AI (metered) with the logged-in org token. */
7
- managed?: boolean;
8
- /** OpenAI-compatible base URL ending in `/v1` (e.g. https://api.cerebras.ai/v1). */
9
- url?: string;
10
- /** Model id to request (default `gpt-oss-120b` BYO, `openai/gpt-oss-120b` managed). */
11
- model?: string;
12
- /** Name of the env var holding the provider API key (never persisted). BYO only. */
13
- keyEnv?: string;
14
- /** reasoning_effort: low | medium | high (default `low`). */
15
- effort?: string;
16
- /** Output style: plain | report (default `plain`). */
17
- style?: string;
18
- }
19
- export interface ResolvedOffload {
20
- /** True when the offload is usable (endpoint present; for managed, a token too). */
21
- enabled: boolean;
22
- /** Managed tier (CodeGraph AI, metered) vs BYO endpoint. */
23
- managed: boolean;
24
- url?: string;
25
- model: string;
26
- /** Resolved API key / org token (from env, the configured `keyEnv`, or login), if any. */
27
- apiKey?: string;
28
- /** Where the key/token came from (for `status` display) — never the secret itself. */
29
- keySource?: string;
30
- effort: string;
31
- style: string;
32
- timeoutMs: number;
33
- maxTokens: number;
34
- strip: boolean;
35
- debug: boolean;
36
- /** Where the endpoint came from — drives `codegraph offload status`. */
37
- origin: 'env' | 'config' | 'none';
38
- }
39
- /** The persisted offload block (empty object if none). */
40
- export declare function readOffloadConfig(): OffloadConfig;
41
- /** Persist (or, with `null`, clear) the offload block, leaving other config keys intact. */
42
- export declare function writeOffloadConfig(offload: OffloadConfig | null): void;
43
- /** Merge the persisted config with `CODEGRAPH_OFFLOAD_*` env overrides (env wins). */
44
- export declare function resolveOffload(env?: NodeJS.ProcessEnv): ResolvedOffload;
45
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/reasoning/config.ts"],"names":[],"mappings":"AAqBA,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,mCAAmC,CAAC;AACpE,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,uFAAuF;IACvF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,wEAAwE;IACxE,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;CACnC;AAsBD,0DAA0D;AAC1D,wBAAgB,iBAAiB,IAAI,aAAa,CAIjD;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAKtE;AAOD,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,eAAe,CAwDpF"}
@@ -1,171 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.MANAGED_DEFAULT_MODEL = exports.MANAGED_DEFAULT_URL = void 0;
37
- exports.readOffloadConfig = readOffloadConfig;
38
- exports.writeOffloadConfig = writeOffloadConfig;
39
- exports.resolveOffload = resolveOffload;
40
- /**
41
- * Reasoning-offload configuration: the persistent, machine-level settings the
42
- * `codegraph offload` CLI writes, merged with `CODEGRAPH_OFFLOAD_*` env overrides.
43
- *
44
- * Stored in `~/.codegraph/config.json` under the `offload` key — the same global
45
- * home CodeGraph already uses for the daemon registry — because the reasoning
46
- * endpoint is a per-machine choice (the model you bring), not per-project state.
47
- * Every codegraph MCP server on the machine picks it up, so a user configures it
48
- * once. Env vars override the file (CI / ephemeral / advanced use).
49
- *
50
- * For a BYO endpoint, the API key is NEVER written to disk: the CLI stores the
51
- * NAME of an env var (`keyEnv`) and reads the key from it at call time. The
52
- * MANAGED tier ("CodeGraph AI") instead authenticates with a revocable, org-scoped
53
- * token from `codegraph offload login`, stored separately in `credentials.json`
54
- * (see ./credentials) — so `config.json` itself never carries a secret either way.
55
- */
56
- const fs = __importStar(require("fs"));
57
- const path = __importStar(require("path"));
58
- const os = __importStar(require("os"));
59
- const credentials_1 = require("./credentials");
60
- /** Managed tier ("CodeGraph AI") — the metered gateway used when logged in. */
61
- exports.MANAGED_DEFAULT_URL = 'https://ai.getcodegraph.com/v1';
62
- /** The gateway's public model id (it translates this to the upstream provider id). */
63
- exports.MANAGED_DEFAULT_MODEL = 'openai/gpt-oss-120b';
64
- function configDir() {
65
- return path.join(os.homedir(), '.codegraph');
66
- }
67
- function configPath() {
68
- return path.join(configDir(), 'config.json');
69
- }
70
- function readUserConfig() {
71
- try {
72
- return JSON.parse(fs.readFileSync(configPath(), 'utf8'));
73
- }
74
- catch {
75
- return {};
76
- }
77
- }
78
- function writeUserConfig(cfg) {
79
- fs.mkdirSync(configDir(), { recursive: true });
80
- fs.writeFileSync(configPath(), JSON.stringify(cfg, null, 2) + '\n');
81
- }
82
- /** The persisted offload block (empty object if none). */
83
- function readOffloadConfig() {
84
- const cfg = readUserConfig();
85
- const o = cfg.offload;
86
- return o && typeof o === 'object' ? o : {};
87
- }
88
- /** Persist (or, with `null`, clear) the offload block, leaving other config keys intact. */
89
- function writeOffloadConfig(offload) {
90
- const cfg = readUserConfig();
91
- if (offload === null)
92
- delete cfg.offload;
93
- else
94
- cfg.offload = offload;
95
- writeUserConfig(cfg);
96
- }
97
- const trimmed = (v) => {
98
- const t = v?.trim();
99
- return t ? t : undefined;
100
- };
101
- /** Merge the persisted config with `CODEGRAPH_OFFLOAD_*` env overrides (env wins). */
102
- function resolveOffload(env = process.env) {
103
- // Hard kill-switch: disable the offload for this process/session without touching
104
- // the persisted config or the stored login — e.g. one A/B arm, or a user who wants
105
- // codegraph_explore to return raw source for a session. Env-only by design.
106
- if (env.CODEGRAPH_OFFLOAD_DISABLE === '1') {
107
- return {
108
- enabled: false, managed: false, url: undefined, model: exports.MANAGED_DEFAULT_MODEL,
109
- apiKey: undefined, keySource: undefined, effort: 'low', style: 'plain',
110
- timeoutMs: 20000, maxTokens: 12000, strip: false,
111
- debug: env.CODEGRAPH_OFFLOAD_DEBUG === '1', origin: 'none',
112
- };
113
- }
114
- const c = readOffloadConfig();
115
- const managed = !!c.managed;
116
- const envUrl = trimmed(env.CODEGRAPH_OFFLOAD_URL);
117
- const envKey = trimmed(env.CODEGRAPH_OFFLOAD_KEY);
118
- let url;
119
- let apiKey;
120
- let keySource;
121
- let model;
122
- if (managed) {
123
- // Managed tier: default to the CodeGraph AI gateway + its public model id; the
124
- // bearer is the org token from `codegraph offload login` (or an env override).
125
- url = envUrl ?? trimmed(c.url) ?? exports.MANAGED_DEFAULT_URL;
126
- model = trimmed(env.CODEGRAPH_OFFLOAD_MODEL) ?? trimmed(c.model) ?? exports.MANAGED_DEFAULT_MODEL;
127
- if (envKey) {
128
- apiKey = envKey;
129
- keySource = 'CODEGRAPH_OFFLOAD_KEY';
130
- }
131
- else {
132
- const t = (0, credentials_1.readOffloadToken)();
133
- if (t) {
134
- apiKey = t;
135
- keySource = 'codegraph login';
136
- }
137
- }
138
- }
139
- else {
140
- // BYO: endpoint + (optional) provider key resolved from env or the named env var.
141
- url = envUrl ?? trimmed(c.url);
142
- model = trimmed(env.CODEGRAPH_OFFLOAD_MODEL) ?? trimmed(c.model) ?? 'gpt-oss-120b';
143
- if (envKey) {
144
- apiKey = envKey;
145
- keySource = 'CODEGRAPH_OFFLOAD_KEY';
146
- }
147
- else if (c.keyEnv && trimmed(env[c.keyEnv])) {
148
- apiKey = trimmed(env[c.keyEnv]);
149
- keySource = c.keyEnv;
150
- }
151
- }
152
- const origin = envUrl ? 'env' : (managed || trimmed(c.url)) ? 'config' : 'none';
153
- return {
154
- // Managed needs both an endpoint AND a token (no token → effectively logged out);
155
- // BYO needs only an endpoint (some endpoints require no auth).
156
- enabled: managed ? (!!url && !!apiKey) : !!url,
157
- managed,
158
- url,
159
- model,
160
- apiKey,
161
- keySource,
162
- effort: trimmed(env.CODEGRAPH_OFFLOAD_EFFORT) ?? trimmed(c.effort) ?? 'low',
163
- style: trimmed(env.CODEGRAPH_OFFLOAD_STYLE) ?? trimmed(c.style) ?? 'plain',
164
- timeoutMs: Number(env.CODEGRAPH_OFFLOAD_TIMEOUT_MS) || 20000,
165
- maxTokens: Number(env.CODEGRAPH_OFFLOAD_MAXTOKENS) || 12000,
166
- strip: env.CODEGRAPH_OFFLOAD_STRIP === '1',
167
- debug: env.CODEGRAPH_OFFLOAD_DEBUG === '1',
168
- origin,
169
- };
170
- }
171
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/reasoning/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,8CAIC;AAGD,gDAKC;AAQD,wCAwDC;AA/JD;;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AAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAE3G,OAAO;QACL,kFAAkF;QAClF,+DAA+D;QAC/D,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAC9C,OAAO;QACP,GAAG;QACH,KAAK;QACL,MAAM;QACN,SAAS;QACT,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK;QAC3E,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,OAAO;QAC1E,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,IAAI,KAAK;QAC5D,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,IAAI,KAAK;QAC3D,KAAK,EAAE,GAAG,CAAC,uBAAuB,KAAK,GAAG;QAC1C,KAAK,EAAE,GAAG,CAAC,uBAAuB,KAAK,GAAG;QAC1C,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -1,5 +0,0 @@
1
- /** The stored managed-offload org token, if the machine is logged in. */
2
- export declare function readOffloadToken(): string | undefined;
3
- /** Persist (or, with `null`, clear) the managed-offload org token at `0600`. */
4
- export declare function writeOffloadToken(token: string | null): void;
5
- //# sourceMappingURL=credentials.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/reasoning/credentials.ts"],"names":[],"mappings":"AA0BA,yEAAyE;AACzE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAGrD;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAS5D"}
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.readOffloadToken = readOffloadToken;
37
- exports.writeOffloadToken = writeOffloadToken;
38
- /**
39
- * Managed-offload credentials: the CodeGraph org token that authenticates the
40
- * managed reasoning tier against `codegraph-ai` (the metered gateway).
41
- *
42
- * Unlike a BYO provider key (which is never persisted — the config stores only the
43
- * NAME of an env var), the org token IS a revocable, org-scoped auth token issued
44
- * to this machine — like the token `gh auth` or `npm login` stores. So it lives in
45
- * its own file, `~/.codegraph/credentials.json`, written `0600`, kept out of the
46
- * shareable `config.json`.
47
- */
48
- const fs = __importStar(require("fs"));
49
- const path = __importStar(require("path"));
50
- const os = __importStar(require("os"));
51
- function credentialsPath() {
52
- return path.join(os.homedir(), '.codegraph', 'credentials.json');
53
- }
54
- function read() {
55
- try {
56
- return JSON.parse(fs.readFileSync(credentialsPath(), 'utf8'));
57
- }
58
- catch {
59
- return {};
60
- }
61
- }
62
- /** The stored managed-offload org token, if the machine is logged in. */
63
- function readOffloadToken() {
64
- const t = read().offloadToken;
65
- return typeof t === 'string' && t.trim() ? t.trim() : undefined;
66
- }
67
- /** Persist (or, with `null`, clear) the managed-offload org token at `0600`. */
68
- function writeOffloadToken(token) {
69
- const p = credentialsPath();
70
- fs.mkdirSync(path.dirname(p), { recursive: true });
71
- const creds = read();
72
- if (token === null)
73
- delete creds.offloadToken;
74
- else
75
- creds.offloadToken = token;
76
- // Write restrictively: create at 0600, and tighten an existing file too.
77
- fs.writeFileSync(p, JSON.stringify(creds, null, 2) + '\n', { mode: 0o600 });
78
- try {
79
- fs.chmodSync(p, 0o600);
80
- }
81
- catch { /* best-effort on platforms without POSIX modes */ }
82
- }
83
- //# sourceMappingURL=credentials.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/reasoning/credentials.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,4CAGC;AAGD,8CASC;AA1CD;;;;;;;;;GASG;AACH,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,SAAS,eAAe;IACtB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,IAAI;IACX,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,EAAE,MAAM,CAAC,CAA4B,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,SAAgB,gBAAgB;IAC9B,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,YAAY,CAAC;IAC9B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAED,gFAAgF;AAChF,SAAgB,iBAAiB,CAAC,KAAoB;IACpD,MAAM,CAAC,GAAG,eAAe,EAAE,CAAC;IAC5B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;IACrB,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC,YAAY,CAAC;;QACzC,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC;IAChC,yEAAyE;IACzE,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,IAAI,CAAC;QAAC,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,kDAAkD,CAAC,CAAC;AAC9F,CAAC"}
@@ -1,21 +0,0 @@
1
- /** Dashboard base for the device-login endpoints; override for testing via CODEGRAPH_LOGIN_URL. */
2
- export declare function loginBaseUrl(): string;
3
- /** The dashboard's response to a device-authorization start request. */
4
- export interface DeviceStart {
5
- device_code: string;
6
- user_code: string;
7
- verification_uri: string;
8
- /** Same URL with the code prefilled, for one-click open. */
9
- verification_uri_complete?: string;
10
- /** Seconds the CLI should wait between polls. */
11
- interval?: number;
12
- /** Seconds until the request expires. */
13
- expires_in?: number;
14
- }
15
- /** Begin a device-authorization request. */
16
- export declare function startDeviceLogin(): Promise<DeviceStart>;
17
- /** Poll until the user approves in the browser; resolves with the org token. */
18
- export declare function pollForToken(deviceCode: string, intervalSec: number, expiresInSec: number): Promise<string>;
19
- /** Best-effort: open a URL in the default browser. Never throws — the URL is also printed. */
20
- export declare function openBrowser(url: string): Promise<void>;
21
- //# sourceMappingURL=login.d.ts.map