@ruverd/julius 0.0.0-stage → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (704) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/CREDITS.md +25 -0
  3. package/LICENSE +21 -0
  4. package/PROVENANCE.md +9 -0
  5. package/README.md +229 -2
  6. package/dist/ai/crux.d.ts +60 -0
  7. package/dist/ai/crux.d.ts.map +1 -0
  8. package/dist/ai/crux.js +141 -0
  9. package/dist/ai/crux.js.map +1 -0
  10. package/dist/ai/failure.d.ts +60 -0
  11. package/dist/ai/failure.d.ts.map +1 -0
  12. package/dist/ai/failure.js +86 -0
  13. package/dist/ai/failure.js.map +1 -0
  14. package/dist/ai/llm/anthropic.d.ts +37 -0
  15. package/dist/ai/llm/anthropic.d.ts.map +1 -0
  16. package/dist/ai/llm/anthropic.js +144 -0
  17. package/dist/ai/llm/anthropic.js.map +1 -0
  18. package/dist/ai/llm/factory.d.ts +28 -0
  19. package/dist/ai/llm/factory.d.ts.map +1 -0
  20. package/dist/ai/llm/factory.js +36 -0
  21. package/dist/ai/llm/factory.js.map +1 -0
  22. package/dist/ai/llm/litellm.d.ts +34 -0
  23. package/dist/ai/llm/litellm.d.ts.map +1 -0
  24. package/dist/ai/llm/litellm.js +45 -0
  25. package/dist/ai/llm/litellm.js.map +1 -0
  26. package/dist/ai/llm/openai.d.ts +44 -0
  27. package/dist/ai/llm/openai.d.ts.map +1 -0
  28. package/dist/ai/llm/openai.js +239 -0
  29. package/dist/ai/llm/openai.js.map +1 -0
  30. package/dist/ai/llm/orcarouter.d.ts +34 -0
  31. package/dist/ai/llm/orcarouter.d.ts.map +1 -0
  32. package/dist/ai/llm/orcarouter.js +45 -0
  33. package/dist/ai/llm/orcarouter.js.map +1 -0
  34. package/dist/ai/llm/recover-tool.d.ts +19 -0
  35. package/dist/ai/llm/recover-tool.d.ts.map +1 -0
  36. package/dist/ai/llm/recover-tool.js +109 -0
  37. package/dist/ai/llm/recover-tool.js.map +1 -0
  38. package/dist/ai/llm/types.d.ts +122 -0
  39. package/dist/ai/llm/types.d.ts.map +1 -0
  40. package/dist/ai/llm/types.js +33 -0
  41. package/dist/ai/llm/types.js.map +1 -0
  42. package/dist/ai/providers.d.ts +59 -0
  43. package/dist/ai/providers.d.ts.map +1 -0
  44. package/dist/ai/providers.js +54 -0
  45. package/dist/ai/providers.js.map +1 -0
  46. package/dist/ai/summarize.d.ts +25 -0
  47. package/dist/ai/summarize.d.ts.map +1 -0
  48. package/dist/ai/summarize.js +34 -0
  49. package/dist/ai/summarize.js.map +1 -0
  50. package/dist/ai/synthesize.d.ts +40 -0
  51. package/dist/ai/synthesize.d.ts.map +1 -0
  52. package/dist/ai/synthesize.js +131 -0
  53. package/dist/ai/synthesize.js.map +1 -0
  54. package/dist/app/checkout.d.ts +46 -0
  55. package/dist/app/checkout.d.ts.map +1 -0
  56. package/dist/app/checkout.js +223 -0
  57. package/dist/app/checkout.js.map +1 -0
  58. package/dist/app/events.d.ts +44 -0
  59. package/dist/app/events.d.ts.map +1 -0
  60. package/dist/app/events.js +64 -0
  61. package/dist/app/events.js.map +1 -0
  62. package/dist/app/identity.d.ts +54 -0
  63. package/dist/app/identity.d.ts.map +1 -0
  64. package/dist/app/identity.js +96 -0
  65. package/dist/app/identity.js.map +1 -0
  66. package/dist/app/main.d.ts +2 -0
  67. package/dist/app/main.d.ts.map +1 -0
  68. package/dist/app/main.js +62 -0
  69. package/dist/app/main.js.map +1 -0
  70. package/dist/app/pages.d.ts +56 -0
  71. package/dist/app/pages.d.ts.map +1 -0
  72. package/dist/app/pages.js +193 -0
  73. package/dist/app/pages.js.map +1 -0
  74. package/dist/app/queue.d.ts +40 -0
  75. package/dist/app/queue.d.ts.map +1 -0
  76. package/dist/app/queue.js +68 -0
  77. package/dist/app/queue.js.map +1 -0
  78. package/dist/app/review-process.d.ts +66 -0
  79. package/dist/app/review-process.d.ts.map +1 -0
  80. package/dist/app/review-process.js +200 -0
  81. package/dist/app/review-process.js.map +1 -0
  82. package/dist/app/review-worker.d.ts +2 -0
  83. package/dist/app/review-worker.d.ts.map +1 -0
  84. package/dist/app/review-worker.js +108 -0
  85. package/dist/app/review-worker.js.map +1 -0
  86. package/dist/app/review.d.ts +23 -0
  87. package/dist/app/review.d.ts.map +1 -0
  88. package/dist/app/review.js +142 -0
  89. package/dist/app/review.js.map +1 -0
  90. package/dist/app/server.d.ts +49 -0
  91. package/dist/app/server.d.ts.map +1 -0
  92. package/dist/app/server.js +123 -0
  93. package/dist/app/server.js.map +1 -0
  94. package/dist/ask/ask.d.ts +195 -0
  95. package/dist/ask/ask.d.ts.map +1 -0
  96. package/dist/ask/ask.js +1252 -0
  97. package/dist/ask/ask.js.map +1 -0
  98. package/dist/ask/file-rank.d.ts +72 -0
  99. package/dist/ask/file-rank.d.ts.map +1 -0
  100. package/dist/ask/file-rank.js +160 -0
  101. package/dist/ask/file-rank.js.map +1 -0
  102. package/dist/ask/file-selection.d.ts +22 -0
  103. package/dist/ask/file-selection.d.ts.map +1 -0
  104. package/dist/ask/file-selection.js +66 -0
  105. package/dist/ask/file-selection.js.map +1 -0
  106. package/dist/ask/fuse.d.ts +195 -0
  107. package/dist/ask/fuse.d.ts.map +1 -0
  108. package/dist/ask/fuse.js +344 -0
  109. package/dist/ask/fuse.js.map +1 -0
  110. package/dist/ask/graphrank.d.ts +61 -0
  111. package/dist/ask/graphrank.d.ts.map +1 -0
  112. package/dist/ask/graphrank.js +130 -0
  113. package/dist/ask/graphrank.js.map +1 -0
  114. package/dist/ask/index-file.d.ts +44 -0
  115. package/dist/ask/index-file.d.ts.map +1 -0
  116. package/dist/ask/index-file.js +128 -0
  117. package/dist/ask/index-file.js.map +1 -0
  118. package/dist/bin/julius.d.ts +3 -0
  119. package/dist/bin/julius.d.ts.map +1 -0
  120. package/dist/bin/julius.js +4 -0
  121. package/dist/bin/julius.js.map +1 -0
  122. package/dist/blast/blast-cli.d.ts +35 -0
  123. package/dist/blast/blast-cli.d.ts.map +1 -0
  124. package/dist/blast/blast-cli.js +155 -0
  125. package/dist/blast/blast-cli.js.map +1 -0
  126. package/dist/blast/blast.d.ts +128 -0
  127. package/dist/blast/blast.d.ts.map +1 -0
  128. package/dist/blast/blast.js +383 -0
  129. package/dist/blast/blast.js.map +1 -0
  130. package/dist/blast/diff.d.ts +53 -0
  131. package/dist/blast/diff.d.ts.map +1 -0
  132. package/dist/blast/diff.js +193 -0
  133. package/dist/blast/diff.js.map +1 -0
  134. package/dist/blast/evidence.d.ts +51 -0
  135. package/dist/blast/evidence.d.ts.map +1 -0
  136. package/dist/blast/evidence.js +162 -0
  137. package/dist/blast/evidence.js.map +1 -0
  138. package/dist/blast/modules.d.ts +33 -0
  139. package/dist/blast/modules.d.ts.map +1 -0
  140. package/dist/blast/modules.js +83 -0
  141. package/dist/blast/modules.js.map +1 -0
  142. package/dist/blast/name.d.ts +74 -0
  143. package/dist/blast/name.d.ts.map +1 -0
  144. package/dist/blast/name.js +269 -0
  145. package/dist/blast/name.js.map +1 -0
  146. package/dist/blast/owners.d.ts +85 -0
  147. package/dist/blast/owners.d.ts.map +1 -0
  148. package/dist/blast/owners.js +272 -0
  149. package/dist/blast/owners.js.map +1 -0
  150. package/dist/blast/render.d.ts +46 -0
  151. package/dist/blast/render.d.ts.map +1 -0
  152. package/dist/blast/render.js +422 -0
  153. package/dist/blast/render.js.map +1 -0
  154. package/dist/blast/viz.d.ts +37 -0
  155. package/dist/blast/viz.d.ts.map +1 -0
  156. package/dist/blast/viz.js +180 -0
  157. package/dist/blast/viz.js.map +1 -0
  158. package/dist/brand.d.ts +13 -0
  159. package/dist/brand.d.ts.map +1 -0
  160. package/dist/brand.js +43 -0
  161. package/dist/brand.js.map +1 -0
  162. package/dist/check/learning-edits.d.ts +9 -0
  163. package/dist/check/learning-edits.d.ts.map +1 -0
  164. package/dist/check/learning-edits.js +62 -0
  165. package/dist/check/learning-edits.js.map +1 -0
  166. package/dist/check/local-check.d.ts +104 -0
  167. package/dist/check/local-check.d.ts.map +1 -0
  168. package/dist/check/local-check.js +830 -0
  169. package/dist/check/local-check.js.map +1 -0
  170. package/dist/check/types.d.ts +31 -0
  171. package/dist/check/types.d.ts.map +1 -0
  172. package/dist/check/types.js +2 -0
  173. package/dist/check/types.js.map +1 -0
  174. package/dist/claude/build-progress.d.ts +29 -0
  175. package/dist/claude/build-progress.d.ts.map +1 -0
  176. package/dist/claude/build-progress.js +76 -0
  177. package/dist/claude/build-progress.js.map +1 -0
  178. package/dist/claude/format.d.ts +131 -0
  179. package/dist/claude/format.d.ts.map +1 -0
  180. package/dist/claude/format.js +328 -0
  181. package/dist/claude/format.js.map +1 -0
  182. package/dist/claude/hook-layers.d.ts +8 -0
  183. package/dist/claude/hook-layers.d.ts.map +1 -0
  184. package/dist/claude/hook-layers.js +74 -0
  185. package/dist/claude/hook-layers.js.map +1 -0
  186. package/dist/claude/hooks.d.ts +101 -0
  187. package/dist/claude/hooks.d.ts.map +1 -0
  188. package/dist/claude/hooks.js +849 -0
  189. package/dist/claude/hooks.js.map +1 -0
  190. package/dist/claude/init.d.ts +70 -0
  191. package/dist/claude/init.d.ts.map +1 -0
  192. package/dist/claude/init.js +207 -0
  193. package/dist/claude/init.js.map +1 -0
  194. package/dist/claude/note-signals.d.ts +28 -0
  195. package/dist/claude/note-signals.d.ts.map +1 -0
  196. package/dist/claude/note-signals.js +325 -0
  197. package/dist/claude/note-signals.js.map +1 -0
  198. package/dist/claude/paths.d.ts +9 -0
  199. package/dist/claude/paths.d.ts.map +1 -0
  200. package/dist/claude/paths.js +22 -0
  201. package/dist/claude/paths.js.map +1 -0
  202. package/dist/claude/session-metrics.d.ts +73 -0
  203. package/dist/claude/session-metrics.d.ts.map +1 -0
  204. package/dist/claude/session-metrics.js +209 -0
  205. package/dist/claude/session-metrics.js.map +1 -0
  206. package/dist/claude/settings-merge.d.ts +66 -0
  207. package/dist/claude/settings-merge.d.ts.map +1 -0
  208. package/dist/claude/settings-merge.js +249 -0
  209. package/dist/claude/settings-merge.js.map +1 -0
  210. package/dist/claude/shim-template.d.ts +18 -0
  211. package/dist/claude/shim-template.d.ts.map +1 -0
  212. package/dist/claude/shim-template.js +226 -0
  213. package/dist/claude/shim-template.js.map +1 -0
  214. package/dist/claude/skill-template.d.ts +12 -0
  215. package/dist/claude/skill-template.d.ts.map +1 -0
  216. package/dist/claude/skill-template.js +294 -0
  217. package/dist/claude/skill-template.js.map +1 -0
  218. package/dist/claude/state.d.ts +73 -0
  219. package/dist/claude/state.d.ts.map +1 -0
  220. package/dist/claude/state.js +33 -0
  221. package/dist/claude/state.js.map +1 -0
  222. package/dist/claude/stats.d.ts +5 -0
  223. package/dist/claude/stats.d.ts.map +1 -0
  224. package/dist/claude/stats.js +24 -0
  225. package/dist/claude/stats.js.map +1 -0
  226. package/dist/claude/statusline.d.ts +14 -0
  227. package/dist/claude/statusline.d.ts.map +1 -0
  228. package/dist/claude/statusline.js +45 -0
  229. package/dist/claude/statusline.js.map +1 -0
  230. package/dist/claude/sync-run.d.ts +3 -0
  231. package/dist/claude/sync-run.d.ts.map +1 -0
  232. package/dist/claude/sync-run.js +46 -0
  233. package/dist/claude/sync-run.js.map +1 -0
  234. package/dist/claude/tally.d.ts +50 -0
  235. package/dist/claude/tally.d.ts.map +1 -0
  236. package/dist/claude/tally.js +211 -0
  237. package/dist/claude/tally.js.map +1 -0
  238. package/dist/cli-epilogue.d.ts +12 -0
  239. package/dist/cli-epilogue.d.ts.map +1 -0
  240. package/dist/cli-epilogue.js +55 -0
  241. package/dist/cli-epilogue.js.map +1 -0
  242. package/dist/cli-meta.d.ts +45 -0
  243. package/dist/cli-meta.d.ts.map +1 -0
  244. package/dist/cli-meta.js +145 -0
  245. package/dist/cli-meta.js.map +1 -0
  246. package/dist/cli-picker.d.ts +129 -0
  247. package/dist/cli-picker.d.ts.map +1 -0
  248. package/dist/cli-picker.js +432 -0
  249. package/dist/cli-picker.js.map +1 -0
  250. package/dist/cli.d.ts +3 -0
  251. package/dist/cli.d.ts.map +1 -0
  252. package/dist/cli.js +2213 -0
  253. package/dist/cli.js.map +1 -0
  254. package/dist/cloud/diff.d.ts +20 -0
  255. package/dist/cloud/diff.d.ts.map +1 -0
  256. package/dist/cloud/diff.js +59 -0
  257. package/dist/cloud/diff.js.map +1 -0
  258. package/dist/cloud/nudge.d.ts +66 -0
  259. package/dist/cloud/nudge.d.ts.map +1 -0
  260. package/dist/cloud/nudge.js +268 -0
  261. package/dist/cloud/nudge.js.map +1 -0
  262. package/dist/cloud/workspace-sync.d.ts +58 -0
  263. package/dist/cloud/workspace-sync.d.ts.map +1 -0
  264. package/dist/cloud/workspace-sync.js +268 -0
  265. package/dist/cloud/workspace-sync.js.map +1 -0
  266. package/dist/cloud/workspace.d.ts +159 -0
  267. package/dist/cloud/workspace.d.ts.map +1 -0
  268. package/dist/cloud/workspace.js +134 -0
  269. package/dist/cloud/workspace.js.map +1 -0
  270. package/dist/context/build.d.ts +52 -0
  271. package/dist/context/build.d.ts.map +1 -0
  272. package/dist/context/build.js +362 -0
  273. package/dist/context/build.js.map +1 -0
  274. package/dist/context/check.d.ts +42 -0
  275. package/dist/context/check.d.ts.map +1 -0
  276. package/dist/context/check.js +162 -0
  277. package/dist/context/check.js.map +1 -0
  278. package/dist/context/map-dir.d.ts +4 -0
  279. package/dist/context/map-dir.d.ts.map +1 -0
  280. package/dist/context/map-dir.js +6 -0
  281. package/dist/context/map-dir.js.map +1 -0
  282. package/dist/context/node-file.d.ts +109 -0
  283. package/dist/context/node-file.d.ts.map +1 -0
  284. package/dist/context/node-file.js +362 -0
  285. package/dist/context/node-file.js.map +1 -0
  286. package/dist/context/price.d.ts +49 -0
  287. package/dist/context/price.d.ts.map +1 -0
  288. package/dist/context/price.js +83 -0
  289. package/dist/context/price.js.map +1 -0
  290. package/dist/context/savings.d.ts +26 -0
  291. package/dist/context/savings.d.ts.map +1 -0
  292. package/dist/context/savings.js +59 -0
  293. package/dist/context/savings.js.map +1 -0
  294. package/dist/economy/cli.d.ts +3 -0
  295. package/dist/economy/cli.d.ts.map +1 -0
  296. package/dist/economy/cli.js +52 -0
  297. package/dist/economy/cli.js.map +1 -0
  298. package/dist/economy/delivery.d.ts +49 -0
  299. package/dist/economy/delivery.d.ts.map +1 -0
  300. package/dist/economy/delivery.js +176 -0
  301. package/dist/economy/delivery.js.map +1 -0
  302. package/dist/economy/index.d.ts +68 -0
  303. package/dist/economy/index.d.ts.map +1 -0
  304. package/dist/economy/index.js +524 -0
  305. package/dist/economy/index.js.map +1 -0
  306. package/dist/engine.d.ts +83 -0
  307. package/dist/engine.d.ts.map +1 -0
  308. package/dist/engine.js +122 -0
  309. package/dist/engine.js.map +1 -0
  310. package/dist/evaluation/index.d.ts +41 -0
  311. package/dist/evaluation/index.d.ts.map +1 -0
  312. package/dist/evaluation/index.js +61 -0
  313. package/dist/evaluation/index.js.map +1 -0
  314. package/dist/graph/bindings.d.ts +64 -0
  315. package/dist/graph/bindings.d.ts.map +1 -0
  316. package/dist/graph/bindings.js +713 -0
  317. package/dist/graph/bindings.js.map +1 -0
  318. package/dist/graph/build.d.ts +88 -0
  319. package/dist/graph/build.d.ts.map +1 -0
  320. package/dist/graph/build.js +375 -0
  321. package/dist/graph/build.js.map +1 -0
  322. package/dist/graph/cards.d.ts +46 -0
  323. package/dist/graph/cards.d.ts.map +1 -0
  324. package/dist/graph/cards.js +280 -0
  325. package/dist/graph/cards.js.map +1 -0
  326. package/dist/graph/check.d.ts +25 -0
  327. package/dist/graph/check.d.ts.map +1 -0
  328. package/dist/graph/check.js +192 -0
  329. package/dist/graph/check.js.map +1 -0
  330. package/dist/graph/container.d.ts +63 -0
  331. package/dist/graph/container.d.ts.map +1 -0
  332. package/dist/graph/container.js +190 -0
  333. package/dist/graph/container.js.map +1 -0
  334. package/dist/graph/enrich.d.ts +62 -0
  335. package/dist/graph/enrich.d.ts.map +1 -0
  336. package/dist/graph/enrich.js +253 -0
  337. package/dist/graph/enrich.js.map +1 -0
  338. package/dist/graph/extract-cache.d.ts +101 -0
  339. package/dist/graph/extract-cache.d.ts.map +1 -0
  340. package/dist/graph/extract-cache.js +199 -0
  341. package/dist/graph/extract-cache.js.map +1 -0
  342. package/dist/graph/extract.d.ts +85 -0
  343. package/dist/graph/extract.d.ts.map +1 -0
  344. package/dist/graph/extract.js +2376 -0
  345. package/dist/graph/extract.js.map +1 -0
  346. package/dist/graph/fingerprint.d.ts +76 -0
  347. package/dist/graph/fingerprint.d.ts.map +1 -0
  348. package/dist/graph/fingerprint.js +160 -0
  349. package/dist/graph/fingerprint.js.map +1 -0
  350. package/dist/graph/generic.d.ts +74 -0
  351. package/dist/graph/generic.d.ts.map +1 -0
  352. package/dist/graph/generic.js +580 -0
  353. package/dist/graph/generic.js.map +1 -0
  354. package/dist/graph/invariants.d.ts +33 -0
  355. package/dist/graph/invariants.d.ts.map +1 -0
  356. package/dist/graph/invariants.js +52 -0
  357. package/dist/graph/invariants.js.map +1 -0
  358. package/dist/graph/load.d.ts +29 -0
  359. package/dist/graph/load.d.ts.map +1 -0
  360. package/dist/graph/load.js +97 -0
  361. package/dist/graph/load.js.map +1 -0
  362. package/dist/graph/lsp/client.d.ts +43 -0
  363. package/dist/graph/lsp/client.d.ts.map +1 -0
  364. package/dist/graph/lsp/client.js +179 -0
  365. package/dist/graph/lsp/client.js.map +1 -0
  366. package/dist/graph/lsp/enrich.d.ts +11 -0
  367. package/dist/graph/lsp/enrich.d.ts.map +1 -0
  368. package/dist/graph/lsp/enrich.js +155 -0
  369. package/dist/graph/lsp/enrich.js.map +1 -0
  370. package/dist/graph/lsp/registry.d.ts +15 -0
  371. package/dist/graph/lsp/registry.d.ts.map +1 -0
  372. package/dist/graph/lsp/registry.js +46 -0
  373. package/dist/graph/lsp/registry.js.map +1 -0
  374. package/dist/graph/map.d.ts +107 -0
  375. package/dist/graph/map.d.ts.map +1 -0
  376. package/dist/graph/map.js +239 -0
  377. package/dist/graph/map.js.map +1 -0
  378. package/dist/graph/native.d.ts +38 -0
  379. package/dist/graph/native.d.ts.map +1 -0
  380. package/dist/graph/native.js +169 -0
  381. package/dist/graph/native.js.map +1 -0
  382. package/dist/graph/queries/c.scm +13 -0
  383. package/dist/graph/queries/c_sharp.scm +19 -0
  384. package/dist/graph/queries/clojure.scm +58 -0
  385. package/dist/graph/queries/cpp.scm +23 -0
  386. package/dist/graph/queries/dart.scm +42 -0
  387. package/dist/graph/queries/elixir.scm +54 -0
  388. package/dist/graph/queries/java.scm +20 -0
  389. package/dist/graph/queries/kotlin.scm +43 -0
  390. package/dist/graph/queries/lua.scm +36 -0
  391. package/dist/graph/queries/nix.scm +32 -0
  392. package/dist/graph/queries/php.scm +40 -0
  393. package/dist/graph/queries/ruby.scm +65 -0
  394. package/dist/graph/queries/rust.scm +41 -0
  395. package/dist/graph/queries/scala.scm +66 -0
  396. package/dist/graph/queries/solidity.scm +43 -0
  397. package/dist/graph/queries/swift.scm +51 -0
  398. package/dist/graph/refresh.d.ts +49 -0
  399. package/dist/graph/refresh.d.ts.map +1 -0
  400. package/dist/graph/refresh.js +255 -0
  401. package/dist/graph/refresh.js.map +1 -0
  402. package/dist/graph/relations.d.ts +14 -0
  403. package/dist/graph/relations.d.ts.map +1 -0
  404. package/dist/graph/relations.js +8 -0
  405. package/dist/graph/relations.js.map +1 -0
  406. package/dist/graph/resolve.d.ts +17 -0
  407. package/dist/graph/resolve.d.ts.map +1 -0
  408. package/dist/graph/resolve.js +654 -0
  409. package/dist/graph/resolve.js.map +1 -0
  410. package/dist/graph/root.d.ts +11 -0
  411. package/dist/graph/root.d.ts.map +1 -0
  412. package/dist/graph/root.js +40 -0
  413. package/dist/graph/root.js.map +1 -0
  414. package/dist/graph/scopes.d.ts +42 -0
  415. package/dist/graph/scopes.d.ts.map +1 -0
  416. package/dist/graph/scopes.js +342 -0
  417. package/dist/graph/scopes.js.map +1 -0
  418. package/dist/graph/seed.d.ts +38 -0
  419. package/dist/graph/seed.d.ts.map +1 -0
  420. package/dist/graph/seed.js +226 -0
  421. package/dist/graph/seed.js.map +1 -0
  422. package/dist/graph/source-files.d.ts +40 -0
  423. package/dist/graph/source-files.d.ts.map +1 -0
  424. package/dist/graph/source-files.js +85 -0
  425. package/dist/graph/source-files.js.map +1 -0
  426. package/dist/graph/traverse-cli.d.ts +55 -0
  427. package/dist/graph/traverse-cli.d.ts.map +1 -0
  428. package/dist/graph/traverse-cli.js +189 -0
  429. package/dist/graph/traverse-cli.js.map +1 -0
  430. package/dist/graph/traverse.d.ts +112 -0
  431. package/dist/graph/traverse.d.ts.map +1 -0
  432. package/dist/graph/traverse.js +192 -0
  433. package/dist/graph/traverse.js.map +1 -0
  434. package/dist/graph/types.d.ts +78 -0
  435. package/dist/graph/types.d.ts.map +1 -0
  436. package/dist/graph/types.js +14 -0
  437. package/dist/graph/types.js.map +1 -0
  438. package/dist/graph/workspace-cli.d.ts +48 -0
  439. package/dist/graph/workspace-cli.d.ts.map +1 -0
  440. package/dist/graph/workspace-cli.js +102 -0
  441. package/dist/graph/workspace-cli.js.map +1 -0
  442. package/dist/graph/workspace.d.ts +135 -0
  443. package/dist/graph/workspace.d.ts.map +1 -0
  444. package/dist/graph/workspace.js +598 -0
  445. package/dist/graph/workspace.js.map +1 -0
  446. package/dist/graph/write.d.ts +13 -0
  447. package/dist/graph/write.d.ts.map +1 -0
  448. package/dist/graph/write.js +86 -0
  449. package/dist/graph/write.js.map +1 -0
  450. package/dist/hosts/antigravity.d.ts +8 -0
  451. package/dist/hosts/antigravity.d.ts.map +1 -0
  452. package/dist/hosts/antigravity.js +42 -0
  453. package/dist/hosts/antigravity.js.map +1 -0
  454. package/dist/hosts/claude-global.d.ts +36 -0
  455. package/dist/hosts/claude-global.d.ts.map +1 -0
  456. package/dist/hosts/claude-global.js +153 -0
  457. package/dist/hosts/claude-global.js.map +1 -0
  458. package/dist/hosts/codex-hooks.d.ts +11 -0
  459. package/dist/hosts/codex-hooks.d.ts.map +1 -0
  460. package/dist/hosts/codex-hooks.js +80 -0
  461. package/dist/hosts/codex-hooks.js.map +1 -0
  462. package/dist/hosts/config-write.d.ts +36 -0
  463. package/dist/hosts/config-write.d.ts.map +1 -0
  464. package/dist/hosts/config-write.js +64 -0
  465. package/dist/hosts/config-write.js.map +1 -0
  466. package/dist/hosts/cursor-hooks.d.ts +21 -0
  467. package/dist/hosts/cursor-hooks.d.ts.map +1 -0
  468. package/dist/hosts/cursor-hooks.js +103 -0
  469. package/dist/hosts/cursor-hooks.js.map +1 -0
  470. package/dist/hosts/init.d.ts +26 -0
  471. package/dist/hosts/init.d.ts.map +1 -0
  472. package/dist/hosts/init.js +82 -0
  473. package/dist/hosts/init.js.map +1 -0
  474. package/dist/hosts/install.d.ts +12 -0
  475. package/dist/hosts/install.d.ts.map +1 -0
  476. package/dist/hosts/install.js +347 -0
  477. package/dist/hosts/install.js.map +1 -0
  478. package/dist/hosts/instructions.d.ts +7 -0
  479. package/dist/hosts/instructions.d.ts.map +1 -0
  480. package/dist/hosts/instructions.js +71 -0
  481. package/dist/hosts/instructions.js.map +1 -0
  482. package/dist/hosts/investigation-instructions.d.ts +2 -0
  483. package/dist/hosts/investigation-instructions.d.ts.map +1 -0
  484. package/dist/hosts/investigation-instructions.js +2 -0
  485. package/dist/hosts/investigation-instructions.js.map +1 -0
  486. package/dist/hosts/mcp-config.d.ts +59 -0
  487. package/dist/hosts/mcp-config.d.ts.map +1 -0
  488. package/dist/hosts/mcp-config.js +229 -0
  489. package/dist/hosts/mcp-config.js.map +1 -0
  490. package/dist/hosts/plan.d.ts +32 -0
  491. package/dist/hosts/plan.d.ts.map +1 -0
  492. package/dist/hosts/plan.js +77 -0
  493. package/dist/hosts/plan.js.map +1 -0
  494. package/dist/hosts/registry.d.ts +35 -0
  495. package/dist/hosts/registry.d.ts.map +1 -0
  496. package/dist/hosts/registry.js +157 -0
  497. package/dist/hosts/registry.js.map +1 -0
  498. package/dist/hosts/retract.d.ts +47 -0
  499. package/dist/hosts/retract.d.ts.map +1 -0
  500. package/dist/hosts/retract.js +541 -0
  501. package/dist/hosts/retract.js.map +1 -0
  502. package/dist/hosts/sections.d.ts +46 -0
  503. package/dist/hosts/sections.d.ts.map +1 -0
  504. package/dist/hosts/sections.js +126 -0
  505. package/dist/hosts/sections.js.map +1 -0
  506. package/dist/index.d.ts +43 -0
  507. package/dist/index.d.ts.map +1 -0
  508. package/dist/index.js +33 -0
  509. package/dist/index.js.map +1 -0
  510. package/dist/ingest/fs.d.ts +79 -0
  511. package/dist/ingest/fs.d.ts.map +1 -0
  512. package/dist/ingest/fs.js +307 -0
  513. package/dist/ingest/fs.js.map +1 -0
  514. package/dist/init-guard.d.ts +11 -0
  515. package/dist/init-guard.d.ts.map +1 -0
  516. package/dist/init-guard.js +21 -0
  517. package/dist/init-guard.js.map +1 -0
  518. package/dist/investigation/index.d.ts +57 -0
  519. package/dist/investigation/index.d.ts.map +1 -0
  520. package/dist/investigation/index.js +346 -0
  521. package/dist/investigation/index.js.map +1 -0
  522. package/dist/mcp/compact.d.ts +9 -0
  523. package/dist/mcp/compact.d.ts.map +1 -0
  524. package/dist/mcp/compact.js +133 -0
  525. package/dist/mcp/compact.js.map +1 -0
  526. package/dist/mcp/instructions.d.ts +5 -0
  527. package/dist/mcp/instructions.d.ts.map +1 -0
  528. package/dist/mcp/instructions.js +57 -0
  529. package/dist/mcp/instructions.js.map +1 -0
  530. package/dist/mcp/server.d.ts +7 -0
  531. package/dist/mcp/server.d.ts.map +1 -0
  532. package/dist/mcp/server.js +128 -0
  533. package/dist/mcp/server.js.map +1 -0
  534. package/dist/mcp/tool-names.d.ts +20 -0
  535. package/dist/mcp/tool-names.d.ts.map +1 -0
  536. package/dist/mcp/tool-names.js +36 -0
  537. package/dist/mcp/tool-names.js.map +1 -0
  538. package/dist/mcp/tools.d.ts +22 -0
  539. package/dist/mcp/tools.d.ts.map +1 -0
  540. package/dist/mcp/tools.js +300 -0
  541. package/dist/mcp/tools.js.map +1 -0
  542. package/dist/notes/ask-notes.d.ts +8 -0
  543. package/dist/notes/ask-notes.d.ts.map +1 -0
  544. package/dist/notes/ask-notes.js +19 -0
  545. package/dist/notes/ask-notes.js.map +1 -0
  546. package/dist/notes/branches.d.ts +102 -0
  547. package/dist/notes/branches.d.ts.map +1 -0
  548. package/dist/notes/branches.js +304 -0
  549. package/dist/notes/branches.js.map +1 -0
  550. package/dist/notes/cold-start.d.ts +177 -0
  551. package/dist/notes/cold-start.d.ts.map +1 -0
  552. package/dist/notes/cold-start.js +537 -0
  553. package/dist/notes/cold-start.js.map +1 -0
  554. package/dist/notes/edit-overlap.d.ts +62 -0
  555. package/dist/notes/edit-overlap.d.ts.map +1 -0
  556. package/dist/notes/edit-overlap.js +202 -0
  557. package/dist/notes/edit-overlap.js.map +1 -0
  558. package/dist/notes/git-facts.d.ts +21 -0
  559. package/dist/notes/git-facts.d.ts.map +1 -0
  560. package/dist/notes/git-facts.js +121 -0
  561. package/dist/notes/git-facts.js.map +1 -0
  562. package/dist/notes/home.d.ts +87 -0
  563. package/dist/notes/home.d.ts.map +1 -0
  564. package/dist/notes/home.js +430 -0
  565. package/dist/notes/home.js.map +1 -0
  566. package/dist/notes/learning-fields.d.ts +102 -0
  567. package/dist/notes/learning-fields.d.ts.map +1 -0
  568. package/dist/notes/learning-fields.js +217 -0
  569. package/dist/notes/learning-fields.js.map +1 -0
  570. package/dist/notes/note-gate.d.ts +42 -0
  571. package/dist/notes/note-gate.d.ts.map +1 -0
  572. package/dist/notes/note-gate.js +181 -0
  573. package/dist/notes/note-gate.js.map +1 -0
  574. package/dist/notes/notes.d.ts +214 -0
  575. package/dist/notes/notes.d.ts.map +1 -0
  576. package/dist/notes/notes.js +591 -0
  577. package/dist/notes/notes.js.map +1 -0
  578. package/dist/notes/pr-reviews.d.ts +108 -0
  579. package/dist/notes/pr-reviews.d.ts.map +1 -0
  580. package/dist/notes/pr-reviews.js +325 -0
  581. package/dist/notes/pr-reviews.js.map +1 -0
  582. package/dist/notes/repo-julius.d.ts +18 -0
  583. package/dist/notes/repo-julius.d.ts.map +1 -0
  584. package/dist/notes/repo-julius.js +111 -0
  585. package/dist/notes/repo-julius.js.map +1 -0
  586. package/dist/notes/session-cost.d.ts +35 -0
  587. package/dist/notes/session-cost.d.ts.map +1 -0
  588. package/dist/notes/session-cost.js +276 -0
  589. package/dist/notes/session-cost.js.map +1 -0
  590. package/dist/search/grep-cli.d.ts +37 -0
  591. package/dist/search/grep-cli.d.ts.map +1 -0
  592. package/dist/search/grep-cli.js +119 -0
  593. package/dist/search/grep-cli.js.map +1 -0
  594. package/dist/search/grep.d.ts +60 -0
  595. package/dist/search/grep.d.ts.map +1 -0
  596. package/dist/search/grep.js +176 -0
  597. package/dist/search/grep.js.map +1 -0
  598. package/dist/search/ignored-code.d.ts +9 -0
  599. package/dist/search/ignored-code.d.ts.map +1 -0
  600. package/dist/search/ignored-code.js +73 -0
  601. package/dist/search/ignored-code.js.map +1 -0
  602. package/dist/skills/skills.d.ts +118 -0
  603. package/dist/skills/skills.d.ts.map +1 -0
  604. package/dist/skills/skills.js +370 -0
  605. package/dist/skills/skills.js.map +1 -0
  606. package/dist/telemetry/contract.d.ts +103 -0
  607. package/dist/telemetry/contract.d.ts.map +1 -0
  608. package/dist/telemetry/contract.js +270 -0
  609. package/dist/telemetry/contract.js.map +1 -0
  610. package/dist/telemetry/flush.d.ts +21 -0
  611. package/dist/telemetry/flush.d.ts.map +1 -0
  612. package/dist/telemetry/flush.js +85 -0
  613. package/dist/telemetry/flush.js.map +1 -0
  614. package/dist/telemetry/gate.d.ts +30 -0
  615. package/dist/telemetry/gate.d.ts.map +1 -0
  616. package/dist/telemetry/gate.js +81 -0
  617. package/dist/telemetry/gate.js.map +1 -0
  618. package/dist/telemetry/identity.d.ts +40 -0
  619. package/dist/telemetry/identity.d.ts.map +1 -0
  620. package/dist/telemetry/identity.js +80 -0
  621. package/dist/telemetry/identity.js.map +1 -0
  622. package/dist/telemetry/index.d.ts +18 -0
  623. package/dist/telemetry/index.d.ts.map +1 -0
  624. package/dist/telemetry/index.js +16 -0
  625. package/dist/telemetry/index.js.map +1 -0
  626. package/dist/telemetry/key.d.ts +4 -0
  627. package/dist/telemetry/key.d.ts.map +1 -0
  628. package/dist/telemetry/key.js +4 -0
  629. package/dist/telemetry/key.js.map +1 -0
  630. package/dist/telemetry/notice.d.ts +19 -0
  631. package/dist/telemetry/notice.d.ts.map +1 -0
  632. package/dist/telemetry/notice.js +93 -0
  633. package/dist/telemetry/notice.js.map +1 -0
  634. package/dist/telemetry/queue.d.ts +35 -0
  635. package/dist/telemetry/queue.d.ts.map +1 -0
  636. package/dist/telemetry/queue.js +162 -0
  637. package/dist/telemetry/queue.js.map +1 -0
  638. package/dist/telemetry/send.d.ts +19 -0
  639. package/dist/telemetry/send.d.ts.map +1 -0
  640. package/dist/telemetry/send.js +84 -0
  641. package/dist/telemetry/send.js.map +1 -0
  642. package/dist/telemetry/sessions.d.ts +25 -0
  643. package/dist/telemetry/sessions.d.ts.map +1 -0
  644. package/dist/telemetry/sessions.js +104 -0
  645. package/dist/telemetry/sessions.js.map +1 -0
  646. package/dist/telemetry/track.d.ts +62 -0
  647. package/dist/telemetry/track.d.ts.map +1 -0
  648. package/dist/telemetry/track.js +142 -0
  649. package/dist/telemetry/track.js.map +1 -0
  650. package/dist/upkeep-run.d.ts +15 -0
  651. package/dist/upkeep-run.d.ts.map +1 -0
  652. package/dist/upkeep-run.js +71 -0
  653. package/dist/upkeep-run.js.map +1 -0
  654. package/dist/upkeep.d.ts +125 -0
  655. package/dist/upkeep.d.ts.map +1 -0
  656. package/dist/upkeep.js +255 -0
  657. package/dist/upkeep.js.map +1 -0
  658. package/dist/util/browser.d.ts +3 -0
  659. package/dist/util/browser.d.ts.map +1 -0
  660. package/dist/util/browser.js +14 -0
  661. package/dist/util/browser.js.map +1 -0
  662. package/dist/util/front-matter.d.ts +19 -0
  663. package/dist/util/front-matter.d.ts.map +1 -0
  664. package/dist/util/front-matter.js +21 -0
  665. package/dist/util/front-matter.js.map +1 -0
  666. package/dist/util/id.d.ts +7 -0
  667. package/dist/util/id.d.ts.map +1 -0
  668. package/dist/util/id.js +14 -0
  669. package/dist/util/id.js.map +1 -0
  670. package/dist/util/paths.d.ts +29 -0
  671. package/dist/util/paths.d.ts.map +1 -0
  672. package/dist/util/paths.js +71 -0
  673. package/dist/util/paths.js.map +1 -0
  674. package/dist/util/source.d.ts +4 -0
  675. package/dist/util/source.d.ts.map +1 -0
  676. package/dist/util/source.js +12 -0
  677. package/dist/util/source.js.map +1 -0
  678. package/dist/util/spinner.d.ts +15 -0
  679. package/dist/util/spinner.d.ts.map +1 -0
  680. package/dist/util/spinner.js +52 -0
  681. package/dist/util/spinner.js.map +1 -0
  682. package/dist/util/state.d.ts +100 -0
  683. package/dist/util/state.d.ts.map +1 -0
  684. package/dist/util/state.js +186 -0
  685. package/dist/util/state.js.map +1 -0
  686. package/dist/viewer/app.js +2 -0
  687. package/dist/viewer/index.html +49 -0
  688. package/dist/viewer/style.css +154 -0
  689. package/dist/viz/assemble.d.ts +83 -0
  690. package/dist/viz/assemble.d.ts.map +1 -0
  691. package/dist/viz/assemble.js +101 -0
  692. package/dist/viz/assemble.js.map +1 -0
  693. package/dist/viz/export.d.ts +39 -0
  694. package/dist/viz/export.d.ts.map +1 -0
  695. package/dist/viz/export.js +98 -0
  696. package/dist/viz/export.js.map +1 -0
  697. package/dist/viz/serve.d.ts +12 -0
  698. package/dist/viz/serve.d.ts.map +1 -0
  699. package/dist/viz/serve.js +129 -0
  700. package/dist/viz/serve.js.map +1 -0
  701. package/docs/assets/context-benchmark.svg +31 -0
  702. package/docs/assets/julius-hero.png +0 -0
  703. package/docs/upstream-changelog.md +785 -0
  704. package/package.json +138 -4
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Rolling a finished agent session up into one `session_summary` event.
3
+ *
4
+ * This is the event that justifies the whole exercise. Everything else here
5
+ * counts commands; this one answers the question the product actually rests on —
6
+ * when an agent had both julius and grep available, which did it reach for, and
7
+ * how many tokens did that save? The counters already exist: the Claude Code
8
+ * hooks have been writing `juliusReads`, `sourceReads` and `savedTokens` per
9
+ * session into `julius/.cache/session/` since well before telemetry did. Nothing
10
+ * new is measured here; a closed session is simply bucketed and queued.
11
+ *
12
+ * "Closed" is inferred from mtime by the idle sweep ({@link flushClosedSessions})
13
+ * because Claude Code has no reliable end-of-session hook — `Stop` fires per
14
+ * turn, and an editor that crashes fires nothing at all. A session untouched for
15
+ * two hours is over. Cursor DOES have `sessionEnd`, so it force-closes the exact
16
+ * conversation that just ended via {@link summarizeSession}, skipping the idle
17
+ * gate that would otherwise ignore the file the last tool use just wrote.
18
+ *
19
+ * Called from the session-start hook (the sweep) and the Cursor sessionEnd hook
20
+ * (the force-close) — both places guaranteed to run at the right moment. A hook
21
+ * must never touch the network (see the note atop upkeep.ts) and this doesn't:
22
+ * it only appends to the local queue.
23
+ */
24
+ import { statSync } from 'node:fs';
25
+ import { join } from 'node:path';
26
+ import { readSession, writeSession, sessionDir, listSessionIds } from '../claude/state.js';
27
+ import { countBucket, savedTokensBucket } from './contract.js';
28
+ import { track } from './track.js';
29
+ import { telemetryOn } from './gate.js';
30
+ /** Untouched for this long and the session is treated as over. */
31
+ export const SESSION_IDLE_MS = 2 * 60 * 60 * 1000;
32
+ /** Never roll up more than this in one hook run — a repo with a huge backlog of
33
+ * session files must not slow down a session start. The rest wait for the next. */
34
+ const MAX_PER_RUN = 20;
35
+ /**
36
+ * Roll one session up into a `session_summary`, ignoring the idle gate — for a
37
+ * host with a real end-of-session signal (Cursor's `sessionEnd`). Returns 1 if
38
+ * queued, 0 if already summarised or telemetry is off. Never throws.
39
+ *
40
+ * The event is attributed to the host stamped on the session file when there is
41
+ * one (a session used from Cursor stays Cursor even if Claude's idle sweep is
42
+ * what finally flushes it); `opts.host` is only the fallback for a file written
43
+ * before host-stamping, or by a path that didn't stamp.
44
+ */
45
+ export function summarizeSession(repo, id, opts = {}) {
46
+ try {
47
+ const { host = 'claude-code', home, env } = opts;
48
+ if (!telemetryOn(home, env))
49
+ return 0;
50
+ const s = readSession(repo, id);
51
+ if (s.summarized)
52
+ return 0;
53
+ // An empty session — opened, nothing asked — is still a fact worth having:
54
+ // it is the difference between "julius is installed" and "julius is used".
55
+ track('session_summary', {
56
+ julius_reads_bucket: countBucket(s.juliusReads ?? 0),
57
+ source_reads_bucket: countBucket(s.sourceReads ?? 0),
58
+ saved_tokens_bucket: savedTokensBucket(s.savedTokens ?? 0),
59
+ // Saved vs *said*: the gap between these two is value the user never
60
+ // heard about. Only turns whose reply was actually readable are in
61
+ // either count (claude/tally.ts), so a host that exposes no transcript
62
+ // reports 0/0 rather than a misleading 0-out-of-many.
63
+ julius_turns_bucket: countBucket(s.juliusTurns ?? 0),
64
+ reported_turns_bucket: countBucket(s.reportedTurns ?? 0),
65
+ }, { repo, host: s.host ?? host, home, env });
66
+ writeSession(repo, id, { ...s, summarized: true });
67
+ return 1;
68
+ }
69
+ catch {
70
+ return 0;
71
+ }
72
+ }
73
+ /**
74
+ * Queue a `session_summary` for every closed, not-yet-summarised session in this
75
+ * repo. "Closed" = untouched for {@link SESSION_IDLE_MS}. Returns how many were
76
+ * queued (for tests). Never throws.
77
+ */
78
+ export function flushClosedSessions(repo, now = Date.now(), home, env, host = 'claude-code') {
79
+ try {
80
+ if (!telemetryOn(home, env))
81
+ return 0;
82
+ const dir = sessionDir(repo);
83
+ let queued = 0;
84
+ for (const id of listSessionIds(repo).sort()) {
85
+ if (queued >= MAX_PER_RUN)
86
+ break;
87
+ let mtime;
88
+ try {
89
+ mtime = statSync(join(dir, `${id}.json`)).mtimeMs;
90
+ }
91
+ catch {
92
+ continue;
93
+ }
94
+ if (now - mtime < SESSION_IDLE_MS)
95
+ continue;
96
+ queued += summarizeSession(repo, id, { host, home, env });
97
+ }
98
+ return queued;
99
+ }
100
+ catch {
101
+ return 0; // a session start is never worth failing over a metric
102
+ }
103
+ }
104
+ //# sourceMappingURL=sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src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AAM,IAAI,gBAAgB,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC,CAAC,uDAAuD;IACnE,CAAC;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ import type { AgentHost } from './contract.js';
2
+ /** One queued event, exactly as it will be sent. */
3
+ export interface QueuedEvent {
4
+ event: string;
5
+ properties: Record<string, string>;
6
+ /** ISO timestamp, so a batch flushed a day late still lands on the right day. */
7
+ timestamp: string;
8
+ /** The install id, used as PostHog's `distinct_id` at send time. */
9
+ distinct_id: string;
10
+ }
11
+ export interface TrackContext {
12
+ /** Repo root, when the call site has one — supplies `repo_id`. */
13
+ repo?: string;
14
+ /** Which surface is calling. Defaults to the CLI. */
15
+ host?: AgentHost;
16
+ /** Test seam: a scratch `$HOME`. Production callers never pass this. */
17
+ home?: string;
18
+ /** Test seam: an environment to gate against. Production callers never pass
19
+ * this — a real run must be gated on the real `DO_NOT_TRACK` and `CI`. */
20
+ env?: NodeJS.ProcessEnv;
21
+ }
22
+ /**
23
+ * Which agent julius is running under, from the surface plus one env probe.
24
+ *
25
+ * Only the PRESENCE of `CLAUDECODE` is read, never its value — the distinction
26
+ * matters: a value could be anything a user's shell profile put there, presence
27
+ * is a boolean. Anything unrecognised is `cli`, which is the honest answer.
28
+ */
29
+ export declare function detectHost(explicit?: AgentHost, env?: NodeJS.ProcessEnv): AgentHost;
30
+ /**
31
+ * Record one event, if the contract allows it and the gates are open.
32
+ *
33
+ * Returns the event that was queued, or null — the return value exists for
34
+ * tests and for `julius telemetry debug`, not for control flow at call sites.
35
+ */
36
+ export declare function track(event: string, props?: Record<string, string | undefined>, ctx?: TrackContext): QueuedEvent | null;
37
+ /**
38
+ * The `first_run` event, fired the once. Separate from `track` because its
39
+ * trigger is a comparison against persisted state rather than anything a call
40
+ * site knows.
41
+ *
42
+ * Gated on `firstRunAt` and NOT on `installId().firstRun`, which is the whole
43
+ * reason this field exists: the npm postinstall hook mints the install id before
44
+ * any command runs, so "did this call mint the id" is false on the genuine first
45
+ * command and would have silenced this event permanently.
46
+ */
47
+ export declare function trackFirstRunIfNew(ctx?: TrackContext): void;
48
+ /**
49
+ * The `install` event, fired from the npm postinstall hook.
50
+ *
51
+ * Once per machine per version: an upgrade is a real install and worth counting,
52
+ * a second `npm install` of a version already recorded is not. Unique machines
53
+ * are then distinct install ids, exactly as for every other event.
54
+ *
55
+ * Nothing here is an exception to the gates — a fork with no key, CI,
56
+ * `DO_NOT_TRACK` and `julius telemetry disable` all still close it. It is only a
57
+ * call site that happens to run outside a command.
58
+ */
59
+ export declare function trackInstallIfNew(ctx?: TrackContext & {
60
+ global?: boolean;
61
+ }): void;
62
+ //# sourceMappingURL=track.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../../src/telemetry/track.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAO/C,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,iFAAiF;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;+EAC2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,SAAS,CAIhG;AAuBD;;;;;GAKG;AACH,wBAAgB,KAAK,CACnB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAM,EAC9C,GAAG,GAAE,YAAiB,GACrB,WAAW,GAAG,IAAI,CA0BpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,YAAiB,GAAG,IAAI,CAO/D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,YAAY,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,IAAI,CAQrF"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * `track()` — the only way an event is ever created, and the place the contract
3
+ * is enforced.
4
+ *
5
+ * Call sites pass a name and some properties; this drops anything the contract
6
+ * (contract.ts) does not list, stamps the common properties, and appends to the
7
+ * local queue. It never sends, never blocks, and never throws — a telemetry bug
8
+ * must be incapable of failing a build or a query.
9
+ *
10
+ * Two rules do the actual privacy work, and both are enforced here rather than
11
+ * asked of callers:
12
+ *
13
+ * • unknown event → dropped whole; unknown property key → dropped, the rest of
14
+ * the event survives. A careless `track('query', { path })` sends `query`
15
+ * without a path.
16
+ * • non-string values → dropped. Everything that crosses the wire is a bucket
17
+ * label or an enum member, so a raw count or a raw message cannot get out
18
+ * even under a key that happens to be allowed.
19
+ */
20
+ import { EVENTS } from './contract.js';
21
+ import { enqueue } from './queue.js';
22
+ import { telemetryOn } from './gate.js';
23
+ import { installId, patchState, readState, repoId } from './identity.js';
24
+ import { runningVersion } from '../upkeep.js';
25
+ import { brand } from '../brand.js';
26
+ /**
27
+ * Which agent julius is running under, from the surface plus one env probe.
28
+ *
29
+ * Only the PRESENCE of `CLAUDECODE` is read, never its value — the distinction
30
+ * matters: a value could be anything a user's shell profile put there, presence
31
+ * is a boolean. Anything unrecognised is `cli`, which is the honest answer.
32
+ */
33
+ export function detectHost(explicit, env = process.env) {
34
+ if (explicit)
35
+ return explicit;
36
+ if (env.CLAUDECODE !== undefined)
37
+ return 'claude-code';
38
+ return 'cli';
39
+ }
40
+ /** The properties every event carries. Kept in one place so no call site can
41
+ * disagree about them. */
42
+ function commonProps(ctx) {
43
+ const props = {
44
+ app_version: runningVersion(),
45
+ os: process.platform,
46
+ arch: process.arch,
47
+ node_major: String(process.versions.node.split('.')[0]),
48
+ ci: 'false', // an event only exists at all when the CI gate passed
49
+ agent_host: detectHost(ctx.host, ctx.env ?? process.env),
50
+ // `julius` or `julius`: which name started this process. The share of
51
+ // queries under `julius` is how the rename is measured, and both names
52
+ // share one install id, so nobody is counted twice.
53
+ cli_name: brand(ctx.env ?? process.env),
54
+ };
55
+ if (ctx.repo) {
56
+ try {
57
+ props.repo_id = repoId(ctx.repo);
58
+ }
59
+ catch { /* unwritable cache — omit */ }
60
+ }
61
+ return props;
62
+ }
63
+ /**
64
+ * Record one event, if the contract allows it and the gates are open.
65
+ *
66
+ * Returns the event that was queued, or null — the return value exists for
67
+ * tests and for `julius telemetry debug`, not for control flow at call sites.
68
+ */
69
+ export function track(event, props = {}, ctx = {}) {
70
+ try {
71
+ if (!telemetryOn(ctx.home, ctx.env))
72
+ return null;
73
+ // `Object.hasOwn`, not `EVENTS[event]`: a bare object literal inherits from
74
+ // Object.prototype, so `EVENTS['constructor']` is truthy and would sail past
75
+ // a plain existence check — only failing later, on a TypeError swallowed by
76
+ // the catch below. The allowlist must reject by design, not by exception.
77
+ if (!Object.hasOwn(EVENTS, event))
78
+ return null;
79
+ const allowed = EVENTS[event];
80
+ const properties = commonProps(ctx);
81
+ for (const [k, v] of Object.entries(props)) {
82
+ if (allowed.has(k) && typeof v === 'string')
83
+ properties[k] = v;
84
+ }
85
+ const queued = {
86
+ event,
87
+ properties,
88
+ timestamp: new Date().toISOString(),
89
+ distinct_id: installId(ctx.home).id,
90
+ };
91
+ enqueue(queued, ctx.home);
92
+ return queued;
93
+ }
94
+ catch {
95
+ return null; // telemetry never surfaces as a user-visible failure
96
+ }
97
+ }
98
+ /**
99
+ * The `first_run` event, fired the once. Separate from `track` because its
100
+ * trigger is a comparison against persisted state rather than anything a call
101
+ * site knows.
102
+ *
103
+ * Gated on `firstRunAt` and NOT on `installId().firstRun`, which is the whole
104
+ * reason this field exists: the npm postinstall hook mints the install id before
105
+ * any command runs, so "did this call mint the id" is false on the genuine first
106
+ * command and would have silenced this event permanently.
107
+ */
108
+ export function trackFirstRunIfNew(ctx = {}) {
109
+ try {
110
+ if (!telemetryOn(ctx.home, ctx.env))
111
+ return;
112
+ if (readState(ctx.home)?.firstRunAt)
113
+ return;
114
+ track('first_run', {}, ctx);
115
+ patchState({ firstRunAt: new Date().toISOString() }, ctx.home);
116
+ }
117
+ catch { /* never */ }
118
+ }
119
+ /**
120
+ * The `install` event, fired from the npm postinstall hook.
121
+ *
122
+ * Once per machine per version: an upgrade is a real install and worth counting,
123
+ * a second `npm install` of a version already recorded is not. Unique machines
124
+ * are then distinct install ids, exactly as for every other event.
125
+ *
126
+ * Nothing here is an exception to the gates — a fork with no key, CI,
127
+ * `DO_NOT_TRACK` and `julius telemetry disable` all still close it. It is only a
128
+ * call site that happens to run outside a command.
129
+ */
130
+ export function trackInstallIfNew(ctx = {}) {
131
+ try {
132
+ if (!telemetryOn(ctx.home, ctx.env))
133
+ return;
134
+ const version = runningVersion();
135
+ if (readState(ctx.home)?.installedVersion === version)
136
+ return;
137
+ track('install', { global: String(ctx.global ?? false) }, ctx);
138
+ patchState({ installedVersion: version }, ctx.home);
139
+ }
140
+ catch { /* never */ }
141
+ }
142
+ //# sourceMappingURL=track.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"track.js","sourceRoot":"","sources":["../../src/telemetry/track.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAA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D,IAAI,CAAC;QACH,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QAC5C,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU;YAAE,OAAO;QAC5C,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QAC5B,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAG,GAAwC,EAAE;IAC7E,IAAI,CAAC;QACH,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QAC5C,MAAM,OAAO,GAAG,cAAc,EAAE,CAAC;QACjC,IAAI,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,gBAAgB,KAAK,OAAO;YAAE,OAAO;QAC9D,KAAK,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAC/D,UAAU,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,15 @@
1
+ export interface UpkeepResult {
2
+ /** Lines worth showing the agent/user, already formatted. Usually empty. */
3
+ lines: string[];
4
+ }
5
+ /**
6
+ * @param repo the project dir
7
+ * @param current the running julius's version
8
+ * @param opts.background false in hook contexts: read the update cache, never
9
+ * spawn a fetch. Hooks run under a hard timeout and must stay off the network.
10
+ */
11
+ export declare function runUpkeep(repo: string, current: string, opts?: {
12
+ background?: boolean;
13
+ home?: string;
14
+ }): UpkeepResult;
15
+ //# sourceMappingURL=upkeep-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upkeep-run.d.ts","sourceRoot":"","sources":["../src/upkeep-run.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAuCD;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,YAAY,CAad"}
@@ -0,0 +1,71 @@
1
+ import { runInit, wiringName } from './claude/init.js';
2
+ import { runHostsInit } from './hosts/init.js';
3
+ import { juliusCliPath } from './claude/paths.js';
4
+ import { setBrand } from './brand.js';
5
+ import { ensureRepoHome } from './notes/home.js';
6
+ import { ensureRepoJulius } from './notes/repo-julius.js';
7
+ import { formatUpdateNudge, formatWiringRefresh, maybeRefreshInBackground, readUpdateCache, reconcileWiring, } from './upkeep.js';
8
+ /**
9
+ * Re-write the wiring for exactly the hosts a previous `init` chose here, with
10
+ * exactly the flags it was given.
11
+ *
12
+ * `build: false` matters: this runs at session start and at MCP boot, and a graph
13
+ * build there would stall the agent's first turn.
14
+ *
15
+ * The out-of-repo writes (`~/.codex/hooks.json`, `~/.codex/config.toml`) ARE
16
+ * included, because nothing else would ever refresh them: no skill, rule file, or
17
+ * MCP instruction tells an agent to run `julius init`, so leaving them out means a
18
+ * Codex user upgrades the binary and keeps the old hook config forever. They're
19
+ * safe to replay — `installCodexHooks` no-ops when `~/.codex` is absent, rewrites
20
+ * only its own entry (matched on `julius-hooks.cjs`), and reports `unchanged` when
21
+ * the bytes match. A user who declined them at init time is honoured via
22
+ * `opts.global`/`opts.hooks`, replayed from the stamp.
23
+ */
24
+ function rewriteWiring(repo, hosts, opts, toJulius = false) {
25
+ // Moving to julius: everything written from here speaks julius, the repo gets
26
+ // its .julius/, and the hosts are rewired under julius's names.
27
+ if (toJulius)
28
+ setBrand('julius');
29
+ // Under julius, each refresh also brings `.julius/` and its README up to date.
30
+ if (toJulius || wiringName(repo) === 'julius') {
31
+ const { place } = ensureRepoHome(repo);
32
+ if (place.git)
33
+ ensureRepoJulius(place.checkout);
34
+ }
35
+ // `opts.global` reaches the claude layer for the same reason `opts.statusline` does:
36
+ // its `~/.claude` writes (hosts/claude-global.ts) are out-of-repo, and a user who
37
+ // declined those at init time must keep declining them on every replay.
38
+ if (hosts.includes('claude'))
39
+ runInit(repo, { build: false, cliPath: juliusCliPath(), statusline: opts.statusline, global: opts.global, ...(toJulius ? { brand: 'julius' } : {}) });
40
+ // The other agents move with Claude Code: their julius-named files and
41
+ // fenced blocks are replaced by julius's (see hosts/init.ts).
42
+ const others = hosts.filter((h) => h !== 'claude');
43
+ if (others.length)
44
+ runHostsInit(repo, { agents: others, global: opts.global, mcp: opts.mcp, hooks: opts.hooks, ...(toJulius ? { brand: 'julius' } : {}) });
45
+ }
46
+ /**
47
+ * @param repo the project dir
48
+ * @param current the running julius's version
49
+ * @param opts.background false in hook contexts: read the update cache, never
50
+ * spawn a fetch. Hooks run under a hard timeout and must stay off the network.
51
+ */
52
+ export function runUpkeep(repo, current, opts = {}) {
53
+ const lines = [];
54
+ try {
55
+ const refreshed = reconcileWiring(repo, current, { rewrite: rewriteWiring });
56
+ const refreshLine = formatWiringRefresh(refreshed);
57
+ if (refreshLine)
58
+ lines.push(refreshLine);
59
+ }
60
+ catch { /* fail-soft: wiring refresh is never worth breaking a session for */ }
61
+ try {
62
+ if (opts.background !== false)
63
+ maybeRefreshInBackground(opts.home);
64
+ const nudge = formatUpdateNudge(current, readUpdateCache(opts.home)?.latest);
65
+ if (nudge)
66
+ lines.push(nudge);
67
+ }
68
+ catch { /* same */ }
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AI,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7E,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;IACtB,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * The version of the julius package this code was loaded from.
3
+ *
4
+ * Resolved from *this* module rather than the caller's: `readCurrentVersion`
5
+ * looks one level up from the module URL it's given, which lands on the package
6
+ * root for `dist/upkeep.js` but misses entirely for `dist/claude/hooks.js` and
7
+ * `dist/mcp/server.js`. Every caller asking here instead of passing its own
8
+ * `import.meta.url` is what keeps the hook and the MCP server from reading
9
+ * `0.0.0` and re-initing on every single session.
10
+ */
11
+ export declare function runningVersion(): string;
12
+ /** How long a registry answer is considered current. A day: julius ships far less
13
+ * often than that, and this is a nudge, not a security update. */
14
+ export declare const UPDATE_TTL_MS: number;
15
+ /** Numeric-dotted compare of the release part only (`1.2.3-beta.1` → `1.2.3`).
16
+ * Prerelease ordering doesn't matter here: the only question either caller asks
17
+ * is "is the thing on npm ahead of what's on disk", and a prerelease that
18
+ * compares equal simply produces no nudge. */
19
+ export declare function compareVersions(a: string, b: string): number;
20
+ export declare function isNewer(candidate: string | null | undefined, current: string): boolean;
21
+ export interface UpdateCache {
22
+ /** Latest version seen on npm, or null when the last fetch failed. */
23
+ latest: string | null;
24
+ /** Epoch ms of the last *attempt* — written by the parent before it spawns the
25
+ * fetch, so a repeatedly-failing fetch can't make every command spawn a child. */
26
+ checkedAt: number;
27
+ }
28
+ /** Machine-global, not per-repo: "what's the latest julius" is one fact, and a
29
+ * dev with twelve repos should cost the registry one request a day, not twelve. */
30
+ export declare function updateCachePath(home?: string): string;
31
+ export declare function readUpdateCache(home?: string): UpdateCache | null;
32
+ /**
33
+ * The `julius _update-check` command body: hit the registry, store the answer.
34
+ * Runs in a detached child so nothing user-facing ever waits on the network.
35
+ */
36
+ export declare function refreshUpdateCache(home?: string, now?: number): UpdateCache;
37
+ /** True when the cached answer is missing or older than the TTL. */
38
+ export declare function needsRefresh(cache: UpdateCache | null, now?: number): boolean;
39
+ /**
40
+ * Kick off a background registry check if the cache has gone stale. Touches
41
+ * `checkedAt` first so concurrent callers (and a child that dies) don't spawn a
42
+ * fetch per invocation. Never waits, never throws.
43
+ *
44
+ * Only called from long-lived or already-slow contexts (a CLI command, MCP
45
+ * boot) — never from a hook, which reads the cache and nothing else.
46
+ */
47
+ export declare function maybeRefreshInBackground(home?: string, now?: number, env?: NodeJS.ProcessEnv): boolean;
48
+ /** One line, or nothing. Nothing is the common case — don't spend context on
49
+ * "you're up to date". */
50
+ export declare function formatUpdateNudge(current: string, latest: string | null | undefined): string | null;
51
+ /**
52
+ * The subset of `julius init`'s flags a refresh has to replay.
53
+ *
54
+ * Without these, an auto-refresh would install things the user explicitly
55
+ * declined: someone who ran `julius init --no-global` (or `--no-hooks`, or
56
+ * `--no-statusline`) said "keep out of `~/.codex`" / "leave my statusline
57
+ * alone", and a later session silently writing there would be julius overriding a
58
+ * decision rather than maintaining one. Absent from an older stamp → all true,
59
+ * which is what plain `julius init` does.
60
+ */
61
+ export interface WiringOpts {
62
+ /** false → never write outside the repo (`--no-global`). */
63
+ global: boolean;
64
+ /** false → skip MCP server registration (`--no-mcp`). */
65
+ mcp: boolean;
66
+ /** false → skip hook installation (`--no-hooks`). */
67
+ hooks: boolean;
68
+ /** false → skip Claude Code statusLine (`--no-statusline` / JULIUS_NO_STATUSLINE). */
69
+ statusline: boolean;
70
+ }
71
+ export declare const DEFAULT_WIRING_OPTS: WiringOpts;
72
+ /** An older stamp has no `opts`; a plain `julius init` wired everything. */
73
+ export declare function wiringOpts(stamp: WiringStamp | null): WiringOpts;
74
+ export interface WiringStamp {
75
+ /** The julius version whose `init` wrote this repo's agent files. */
76
+ version: string;
77
+ /** Host ids that were wired, so a refresh re-writes exactly those and never
78
+ * silently adopts an agent the user declined in the picker. */
79
+ hosts: string[];
80
+ /** The init flags to replay — see {@link WiringOpts}. */
81
+ opts?: Partial<WiringOpts>;
82
+ at: string;
83
+ }
84
+ /** Under `julius/.cache/`, beside the other derived state: git-ignored, per-clone,
85
+ * and cheap to lose — a missing stamp just means one idempotent refresh. */
86
+ export declare function stampPath(repo: string): string;
87
+ export declare function readStamp(repo: string): WiringStamp | null;
88
+ export declare function writeStamp(repo: string, version: string, hosts: string[], opts?: Partial<WiringOpts>, at?: string): void;
89
+ /**
90
+ * Which agents this repo is *already* wired for, read off disk rather than
91
+ * re-detected. Detection answers "which editors does this machine have"; for a
92
+ * refresh we need "which files did a previous init actually write" — otherwise
93
+ * installing Windsurf once would silently add julius rules to every repo.
94
+ */
95
+ export declare function wiredHostIds(repo: string): string[];
96
+ export interface WiringRefresh {
97
+ from: string;
98
+ to: string;
99
+ hosts: string[];
100
+ /** True when the refresh included writes outside the repo (`~/.codex/`), so the
101
+ * caller can say so — a session changing machine-wide config should be visible. */
102
+ global: boolean;
103
+ /** True when it moved a repo wired as julius over to julius. */
104
+ switched?: boolean;
105
+ }
106
+ /**
107
+ * Re-run init's writes when the stamp and the running binary disagree.
108
+ *
109
+ * Deliberately narrow: it refreshes the hosts already wired, replays the flags
110
+ * that init was given, never builds the graph (this runs at session start — a
111
+ * rebuild there would stall the agent's first turn), and no-ops when the repo has
112
+ * no julius wiring at all.
113
+ *
114
+ * `toJulius` says whether this repo should move from julius's wiring to julius's
115
+ * (see upkeep-run.ts). When it should, the refresh runs whatever the stamp says:
116
+ * the person installed julius, which is the signal, whether or not julius's own
117
+ * version moved.
118
+ */
119
+ export declare function reconcileWiring(repo: string, current: string, deps: {
120
+ wired?: (repo: string) => string[];
121
+ rewrite: (repo: string, hosts: string[], opts: WiringOpts, toJulius: boolean) => void;
122
+ toJulius?: (repo: string) => boolean;
123
+ }): WiringRefresh | null;
124
+ export declare function formatWiringRefresh(r: WiringRefresh | null): string | null;
125
+ //# sourceMappingURL=upkeep.d.ts.map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