waterplane 0.1.24 → 0.1.26

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 (429) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/SECURITY.md +25 -5
  3. package/node_modules/@waterplane/shared/dist/agentseries/compare.d.ts +8 -0
  4. package/node_modules/@waterplane/shared/dist/agentseries/compare.js +103 -0
  5. package/node_modules/@waterplane/shared/dist/agentseries/compare.js.map +1 -0
  6. package/node_modules/@waterplane/shared/dist/agentseries/markers.d.ts +17 -0
  7. package/node_modules/@waterplane/shared/dist/agentseries/markers.js +125 -0
  8. package/node_modules/@waterplane/shared/dist/agentseries/markers.js.map +1 -0
  9. package/node_modules/@waterplane/shared/dist/agentseries/series.d.ts +16 -0
  10. package/node_modules/@waterplane/shared/dist/agentseries/series.js +93 -0
  11. package/node_modules/@waterplane/shared/dist/agentseries/series.js.map +1 -0
  12. package/node_modules/@waterplane/shared/dist/agentseries/stats.d.ts +8 -0
  13. package/node_modules/@waterplane/shared/dist/agentseries/stats.js +33 -0
  14. package/node_modules/@waterplane/shared/dist/agentseries/stats.js.map +1 -0
  15. package/node_modules/@waterplane/shared/dist/agentseries/types.d.ts +103 -0
  16. package/node_modules/@waterplane/shared/dist/agentseries/types.js +11 -0
  17. package/node_modules/@waterplane/shared/dist/agentseries/types.js.map +1 -0
  18. package/node_modules/@waterplane/shared/dist/agentseries.d.ts +10 -0
  19. package/node_modules/@waterplane/shared/dist/agentseries.js +11 -0
  20. package/node_modules/@waterplane/shared/dist/agentseries.js.map +1 -0
  21. package/node_modules/@waterplane/shared/dist/calday.d.ts +5 -0
  22. package/node_modules/@waterplane/shared/dist/calday.js +10 -0
  23. package/node_modules/@waterplane/shared/dist/calday.js.map +1 -1
  24. package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.d.ts +13 -1
  25. package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.js +22 -4
  26. package/node_modules/@waterplane/shared/dist/clihealth/healthfixture.js.map +1 -1
  27. package/node_modules/@waterplane/shared/dist/clihealth.d.ts +1 -1
  28. package/node_modules/@waterplane/shared/dist/clihealth.js +1 -1
  29. package/node_modules/@waterplane/shared/dist/clihealth.js.map +1 -1
  30. package/node_modules/@waterplane/shared/dist/dictate.d.ts +6 -0
  31. package/node_modules/@waterplane/shared/dist/dictate.js.map +1 -1
  32. package/node_modules/@waterplane/shared/dist/dictatemodels.d.ts +23 -0
  33. package/node_modules/@waterplane/shared/dist/dictatemodels.js +31 -0
  34. package/node_modules/@waterplane/shared/dist/dictatemodels.js.map +1 -0
  35. package/node_modules/@waterplane/shared/dist/healthindex/commits.d.ts +1 -1
  36. package/node_modules/@waterplane/shared/dist/healthindex/commits.js +2 -2
  37. package/node_modules/@waterplane/shared/dist/healthindex/commits.js.map +1 -1
  38. package/node_modules/@waterplane/shared/dist/healthindex/coverage.d.ts +128 -0
  39. package/node_modules/@waterplane/shared/dist/healthindex/coverage.js +343 -0
  40. package/node_modules/@waterplane/shared/dist/healthindex/coverage.js.map +1 -0
  41. package/node_modules/@waterplane/shared/dist/healthindex/readings.d.ts +9 -1
  42. package/node_modules/@waterplane/shared/dist/healthindex/readings.js +122 -4
  43. package/node_modules/@waterplane/shared/dist/healthindex/readings.js.map +1 -1
  44. package/node_modules/@waterplane/shared/dist/healthindex/repoindex.d.ts +5 -0
  45. package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js +2 -0
  46. package/node_modules/@waterplane/shared/dist/healthindex/repoindex.js.map +1 -1
  47. package/node_modules/@waterplane/shared/dist/healthindex/score.d.ts +3 -0
  48. package/node_modules/@waterplane/shared/dist/healthindex/score.js +52 -16
  49. package/node_modules/@waterplane/shared/dist/healthindex/score.js.map +1 -1
  50. package/node_modules/@waterplane/shared/dist/healthindex/types.d.ts +82 -6
  51. package/node_modules/@waterplane/shared/dist/healthindex/types.js +35 -2
  52. package/node_modules/@waterplane/shared/dist/healthindex/types.js.map +1 -1
  53. package/node_modules/@waterplane/shared/dist/healthindex/words.js +65 -6
  54. package/node_modules/@waterplane/shared/dist/healthindex/words.js.map +1 -1
  55. package/node_modules/@waterplane/shared/dist/healthindex.d.ts +21 -7
  56. package/node_modules/@waterplane/shared/dist/healthindex.js +20 -7
  57. package/node_modules/@waterplane/shared/dist/healthindex.js.map +1 -1
  58. package/node_modules/@waterplane/shared/dist/healthindexresponse.js +3 -2
  59. package/node_modules/@waterplane/shared/dist/healthindexresponse.js.map +1 -1
  60. package/node_modules/@waterplane/shared/dist/healthspend.d.ts +23 -0
  61. package/node_modules/@waterplane/shared/dist/healthspend.js +32 -1
  62. package/node_modules/@waterplane/shared/dist/healthspend.js.map +1 -1
  63. package/node_modules/@waterplane/shared/dist/hints.js +9 -0
  64. package/node_modules/@waterplane/shared/dist/hints.js.map +1 -1
  65. package/node_modules/@waterplane/shared/dist/index.d.ts +9 -0
  66. package/node_modules/@waterplane/shared/dist/index.js +9 -0
  67. package/node_modules/@waterplane/shared/dist/index.js.map +1 -1
  68. package/node_modules/@waterplane/shared/dist/installrow.js +10 -0
  69. package/node_modules/@waterplane/shared/dist/installrow.js.map +1 -1
  70. package/node_modules/@waterplane/shared/dist/intent/kind.d.ts +45 -1
  71. package/node_modules/@waterplane/shared/dist/intent/kind.js +60 -2
  72. package/node_modules/@waterplane/shared/dist/intent/kind.js.map +1 -1
  73. package/node_modules/@waterplane/shared/dist/intent.d.ts +1 -1
  74. package/node_modules/@waterplane/shared/dist/intent.js +1 -1
  75. package/node_modules/@waterplane/shared/dist/intent.js.map +1 -1
  76. package/node_modules/@waterplane/shared/dist/itempaths.d.ts +23 -0
  77. package/node_modules/@waterplane/shared/dist/itempaths.js +38 -0
  78. package/node_modules/@waterplane/shared/dist/itempaths.js.map +1 -1
  79. package/node_modules/@waterplane/shared/dist/pluginlaunch.d.ts +3 -2
  80. package/node_modules/@waterplane/shared/dist/pluginlaunch.js +1 -1
  81. package/node_modules/@waterplane/shared/dist/pluginlaunch.js.map +1 -1
  82. package/node_modules/@waterplane/shared/dist/pricelist.d.ts +57 -0
  83. package/node_modules/@waterplane/shared/dist/pricelist.js +128 -0
  84. package/node_modules/@waterplane/shared/dist/pricelist.js.map +1 -0
  85. package/node_modules/@waterplane/shared/dist/pricing.d.ts +86 -9
  86. package/node_modules/@waterplane/shared/dist/pricing.js +140 -20
  87. package/node_modules/@waterplane/shared/dist/pricing.js.map +1 -1
  88. package/node_modules/@waterplane/shared/dist/queue/queuelanestate.d.ts +14 -0
  89. package/node_modules/@waterplane/shared/dist/queue/queuelanestate.js +25 -0
  90. package/node_modules/@waterplane/shared/dist/queue/queuelanestate.js.map +1 -0
  91. package/node_modules/@waterplane/shared/dist/queue/queueplan.d.ts +4 -0
  92. package/node_modules/@waterplane/shared/dist/queue/queueplan.js +21 -0
  93. package/node_modules/@waterplane/shared/dist/queue/queueplan.js.map +1 -1
  94. package/node_modules/@waterplane/shared/dist/queue/queuewords.js +2 -1
  95. package/node_modules/@waterplane/shared/dist/queue/queuewords.js.map +1 -1
  96. package/node_modules/@waterplane/shared/dist/queue.d.ts +2 -0
  97. package/node_modules/@waterplane/shared/dist/queue.js +1 -0
  98. package/node_modules/@waterplane/shared/dist/queue.js.map +1 -1
  99. package/node_modules/@waterplane/shared/dist/repohealth.d.ts +178 -0
  100. package/node_modules/@waterplane/shared/dist/repohealth.js.map +1 -1
  101. package/node_modules/@waterplane/shared/dist/repohealthhabits.d.ts +15 -0
  102. package/node_modules/@waterplane/shared/dist/repohealthhabits.js +117 -0
  103. package/node_modules/@waterplane/shared/dist/repohealthhabits.js.map +1 -0
  104. package/node_modules/@waterplane/shared/dist/repohealthnative.d.ts +10 -0
  105. package/node_modules/@waterplane/shared/dist/repohealthnative.js +94 -0
  106. package/node_modules/@waterplane/shared/dist/repohealthnative.js.map +1 -0
  107. package/node_modules/@waterplane/shared/dist/repohealthread.js +23 -1
  108. package/node_modules/@waterplane/shared/dist/repohealthread.js.map +1 -1
  109. package/node_modules/@waterplane/shared/dist/skillstate.d.ts +51 -0
  110. package/node_modules/@waterplane/shared/dist/skillstate.js +176 -0
  111. package/node_modules/@waterplane/shared/dist/skillstate.js.map +1 -0
  112. package/node_modules/@waterplane/shared/dist/skillwords.d.ts +10 -0
  113. package/node_modules/@waterplane/shared/dist/skillwords.js +18 -0
  114. package/node_modules/@waterplane/shared/dist/skillwords.js.map +1 -0
  115. package/node_modules/@waterplane/shared/dist/wire/agentreadings.d.ts +248 -0
  116. package/node_modules/@waterplane/shared/dist/wire/agentreadings.js +36 -0
  117. package/node_modules/@waterplane/shared/dist/wire/agentreadings.js.map +1 -0
  118. package/node_modules/@waterplane/shared/dist/wire/backend.d.ts +2 -0
  119. package/node_modules/@waterplane/shared/dist/wire/costwindow.d.ts +4 -0
  120. package/node_modules/@waterplane/shared/dist/wire/dictatesetup.d.ts +42 -0
  121. package/node_modules/@waterplane/shared/dist/wire/dictatesetup.js +9 -0
  122. package/node_modules/@waterplane/shared/dist/wire/dictatesetup.js.map +1 -0
  123. package/node_modules/@waterplane/shared/dist/wire/messages/hostcore.d.ts +22 -1
  124. package/node_modules/@waterplane/shared/dist/wire/notify.d.ts +6 -1
  125. package/node_modules/@waterplane/shared/dist/wire/notify.js +6 -1
  126. package/node_modules/@waterplane/shared/dist/wire/notify.js.map +1 -1
  127. package/node_modules/@waterplane/shared/dist/wire/repo.d.ts +1 -1
  128. package/node_modules/@waterplane/shared/dist/wire/skills.d.ts +142 -0
  129. package/node_modules/@waterplane/shared/dist/wire/skills.js +6 -0
  130. package/node_modules/@waterplane/shared/dist/wire/skills.js.map +1 -0
  131. package/node_modules/@waterplane/shared/dist/wire/sysstat.d.ts +17 -0
  132. package/node_modules/@waterplane/shared/dist/wire/telemetry.d.ts +4 -0
  133. package/npm-shrinkwrap.json +2 -2
  134. package/package.json +1 -1
  135. package/packages/extensions/diskspace/waterplane-plugin.json +16 -0
  136. package/packages/extensions/links/waterplane-plugin.json +18 -0
  137. package/packages/host/dist/agentclass.d.ts +116 -0
  138. package/packages/host/dist/agentclass.js +339 -0
  139. package/packages/host/dist/agentclass.js.map +1 -0
  140. package/packages/host/dist/agentintents.d.ts +18 -0
  141. package/packages/host/dist/agentintents.js +40 -7
  142. package/packages/host/dist/agentintents.js.map +1 -1
  143. package/packages/host/dist/agentmarkers.d.ts +49 -0
  144. package/packages/host/dist/agentmarkers.js +255 -0
  145. package/packages/host/dist/agentmarkers.js.map +1 -0
  146. package/packages/host/dist/agentreadings.d.ts +68 -0
  147. package/packages/host/dist/agentreadings.js +336 -0
  148. package/packages/host/dist/agentreadings.js.map +1 -0
  149. package/packages/host/dist/agentscan.d.ts +8 -0
  150. package/packages/host/dist/agentscan.js +427 -0
  151. package/packages/host/dist/agentscan.js.map +1 -0
  152. package/packages/host/dist/archive.js +9 -3
  153. package/packages/host/dist/archive.js.map +1 -1
  154. package/packages/host/dist/artifacts.js +4 -7
  155. package/packages/host/dist/artifacts.js.map +1 -1
  156. package/packages/host/dist/askrules.js +12 -4
  157. package/packages/host/dist/askrules.js.map +1 -1
  158. package/packages/host/dist/auth.d.ts +1 -0
  159. package/packages/host/dist/auth.js +5 -3
  160. package/packages/host/dist/auth.js.map +1 -1
  161. package/packages/host/dist/autopull.js +4 -8
  162. package/packages/host/dist/autopull.js.map +1 -1
  163. package/packages/host/dist/backends/claude.js +1 -0
  164. package/packages/host/dist/backends/claude.js.map +1 -1
  165. package/packages/host/dist/backends/derive.js +3 -1
  166. package/packages/host/dist/backends/derive.js.map +1 -1
  167. package/packages/host/dist/binguard.js +19 -2
  168. package/packages/host/dist/binguard.js.map +1 -1
  169. package/packages/host/dist/capture.js +7 -10
  170. package/packages/host/dist/capture.js.map +1 -1
  171. package/packages/host/dist/clifixtures.d.ts +24 -4
  172. package/packages/host/dist/clifixtures.js +50 -10
  173. package/packages/host/dist/clifixtures.js.map +1 -1
  174. package/packages/host/dist/clihealth.d.ts +8 -2
  175. package/packages/host/dist/clihealth.js +11 -3
  176. package/packages/host/dist/clihealth.js.map +1 -1
  177. package/packages/host/dist/costwindow.js +4 -2
  178. package/packages/host/dist/costwindow.js.map +1 -1
  179. package/packages/host/dist/ctxlog/ctxagents.d.ts +2 -0
  180. package/packages/host/dist/ctxlog/ctxagents.js +5 -5
  181. package/packages/host/dist/ctxlog/ctxagents.js.map +1 -1
  182. package/packages/host/dist/ctxlog/ctxcursor.d.ts +2 -0
  183. package/packages/host/dist/ctxlog/ctxcursor.js +2 -2
  184. package/packages/host/dist/ctxlog/ctxcursor.js.map +1 -1
  185. package/packages/host/dist/ctxlog/ctxupdate.js +11 -6
  186. package/packages/host/dist/ctxlog/ctxupdate.js.map +1 -1
  187. package/packages/host/dist/deliver/deliverknobs.d.ts +0 -2
  188. package/packages/host/dist/deliver/deliverknobs.js +0 -2
  189. package/packages/host/dist/deliver/deliverknobs.js.map +1 -1
  190. package/packages/host/dist/deliver/deliverproof.d.ts +3 -2
  191. package/packages/host/dist/deliver/deliverproof.js +9 -8
  192. package/packages/host/dist/deliver/deliverproof.js.map +1 -1
  193. package/packages/host/dist/deliver/deliverreturn.d.ts +3 -2
  194. package/packages/host/dist/deliver/deliverreturn.js +13 -12
  195. package/packages/host/dist/deliver/deliverreturn.js.map +1 -1
  196. package/packages/host/dist/deliver/deliverrun.js +20 -18
  197. package/packages/host/dist/deliver/deliverrun.js.map +1 -1
  198. package/packages/host/dist/deliver/deliverscreen.d.ts +2 -1
  199. package/packages/host/dist/deliver/deliverscreen.js +9 -8
  200. package/packages/host/dist/deliver/deliverscreen.js.map +1 -1
  201. package/packages/host/dist/deliver/delivertypes.d.ts +4 -0
  202. package/packages/host/dist/deliver.js +2 -1
  203. package/packages/host/dist/deliver.js.map +1 -1
  204. package/packages/host/dist/dictate.d.ts +11 -0
  205. package/packages/host/dist/dictate.js +20 -10
  206. package/packages/host/dist/dictate.js.map +1 -1
  207. package/packages/host/dist/dictatesetup.d.ts +54 -0
  208. package/packages/host/dist/dictatesetup.js +261 -0
  209. package/packages/host/dist/dictatesetup.js.map +1 -0
  210. package/packages/host/dist/doctor.js +1 -1
  211. package/packages/host/dist/doctor.js.map +1 -1
  212. package/packages/host/dist/exposure.d.ts +10 -0
  213. package/packages/host/dist/exposure.js +25 -0
  214. package/packages/host/dist/exposure.js.map +1 -1
  215. package/packages/host/dist/exposurepush.js +2 -2
  216. package/packages/host/dist/exposurepush.js.map +1 -1
  217. package/packages/host/dist/extensions/diskspace/host/candidates.d.mts +180 -0
  218. package/packages/host/dist/extensions/diskspace/host/candidates.mjs +716 -0
  219. package/packages/host/dist/extensions/diskspace/host/candidates.mjs.map +1 -0
  220. package/packages/host/dist/extensions/diskspace/host/engine.d.mts +21 -0
  221. package/packages/host/dist/extensions/diskspace/host/engine.mjs +498 -0
  222. package/packages/host/dist/extensions/diskspace/host/engine.mjs.map +1 -0
  223. package/packages/host/dist/extensions/diskspace/host/index.d.mts +25 -0
  224. package/packages/host/dist/extensions/diskspace/host/index.mjs +135 -0
  225. package/packages/host/dist/extensions/diskspace/host/index.mjs.map +1 -0
  226. package/packages/host/dist/extensions/diskspace/host/large.d.mts +11 -0
  227. package/packages/host/dist/extensions/diskspace/host/large.mjs +56 -0
  228. package/packages/host/dist/extensions/diskspace/host/large.mjs.map +1 -0
  229. package/packages/host/dist/extensions/diskspace/host/run.d.mts +94 -0
  230. package/packages/host/dist/extensions/diskspace/host/run.mjs +200 -0
  231. package/packages/host/dist/extensions/diskspace/host/run.mjs.map +1 -0
  232. package/packages/host/dist/extensions/diskspace/shared/wire.d.mts +197 -0
  233. package/packages/host/dist/extensions/diskspace/shared/wire.mjs +23 -0
  234. package/packages/host/dist/extensions/diskspace/shared/wire.mjs.map +1 -0
  235. package/packages/host/dist/extensions/links/host/engine.d.mts +39 -0
  236. package/packages/host/dist/extensions/links/host/engine.mjs +285 -0
  237. package/packages/host/dist/extensions/links/host/engine.mjs.map +1 -0
  238. package/packages/host/dist/extensions/links/host/index.d.mts +10 -0
  239. package/packages/host/dist/extensions/links/host/index.mjs +72 -0
  240. package/packages/host/dist/extensions/links/host/index.mjs.map +1 -0
  241. package/packages/host/dist/extensions/links/host/parse.d.mts +61 -0
  242. package/packages/host/dist/extensions/links/host/parse.mjs +225 -0
  243. package/packages/host/dist/extensions/links/host/parse.mjs.map +1 -0
  244. package/packages/host/dist/extensions/links/host/run.d.mts +15 -0
  245. package/packages/host/dist/extensions/links/host/run.mjs +32 -0
  246. package/packages/host/dist/extensions/links/host/run.mjs.map +1 -0
  247. package/packages/host/dist/extensions/links/host/store.d.mts +11 -0
  248. package/packages/host/dist/extensions/links/host/store.mjs +76 -0
  249. package/packages/host/dist/extensions/links/host/store.mjs.map +1 -0
  250. package/packages/host/dist/extensions/links/shared/wire.d.mts +141 -0
  251. package/packages/host/dist/extensions/links/shared/wire.mjs +20 -0
  252. package/packages/host/dist/extensions/links/shared/wire.mjs.map +1 -0
  253. package/packages/host/dist/git.d.ts +5 -3
  254. package/packages/host/dist/git.js +16 -28
  255. package/packages/host/dist/git.js.map +1 -1
  256. package/packages/host/dist/halt.js +16 -3
  257. package/packages/host/dist/halt.js.map +1 -1
  258. package/packages/host/dist/jsonstore.d.ts +16 -4
  259. package/packages/host/dist/jsonstore.js +32 -8
  260. package/packages/host/dist/jsonstore.js.map +1 -1
  261. package/packages/host/dist/landedbase.d.ts +41 -0
  262. package/packages/host/dist/landedbase.js +59 -0
  263. package/packages/host/dist/landedbase.js.map +1 -0
  264. package/packages/host/dist/lantls.js +2 -2
  265. package/packages/host/dist/lantls.js.map +1 -1
  266. package/packages/host/dist/limitretry.js +2 -3
  267. package/packages/host/dist/limitretry.js.map +1 -1
  268. package/packages/host/dist/localledger.js +9 -12
  269. package/packages/host/dist/localledger.js.map +1 -1
  270. package/packages/host/dist/main.js +2 -0
  271. package/packages/host/dist/main.js.map +1 -1
  272. package/packages/host/dist/opendeliveries.d.ts +4 -0
  273. package/packages/host/dist/opendeliveries.js +27 -1
  274. package/packages/host/dist/opendeliveries.js.map +1 -1
  275. package/packages/host/dist/plugins/setupcontrib.js +3 -2
  276. package/packages/host/dist/plugins/setupcontrib.js.map +1 -1
  277. package/packages/host/dist/pricefetch.d.ts +80 -0
  278. package/packages/host/dist/pricefetch.js +289 -0
  279. package/packages/host/dist/pricefetch.js.map +1 -0
  280. package/packages/host/dist/pricegap.d.ts +11 -0
  281. package/packages/host/dist/pricegap.js +30 -0
  282. package/packages/host/dist/pricegap.js.map +1 -0
  283. package/packages/host/dist/repohealthscopes.js +16 -24
  284. package/packages/host/dist/repohealthscopes.js.map +1 -1
  285. package/packages/host/dist/repos.d.ts +4 -0
  286. package/packages/host/dist/repos.js +1 -1
  287. package/packages/host/dist/repos.js.map +1 -1
  288. package/packages/host/dist/reposkilltext.d.ts +2 -0
  289. package/packages/host/dist/reposkilltext.js +8 -2
  290. package/packages/host/dist/reposkilltext.js.map +1 -1
  291. package/packages/host/dist/routes/apiagentpoints.d.ts +5 -0
  292. package/packages/host/dist/routes/apiagentpoints.js +48 -0
  293. package/packages/host/dist/routes/apiagentpoints.js.map +1 -0
  294. package/packages/host/dist/routes/apidictate.d.ts +2 -0
  295. package/packages/host/dist/routes/apidictate.js +27 -0
  296. package/packages/host/dist/routes/apidictate.js.map +1 -0
  297. package/packages/host/dist/routes/apihost.js +3 -2
  298. package/packages/host/dist/routes/apihost.js.map +1 -1
  299. package/packages/host/dist/routes/apirepofiles.js +3 -1
  300. package/packages/host/dist/routes/apirepofiles.js.map +1 -1
  301. package/packages/host/dist/routes/apirepowork.js +14 -0
  302. package/packages/host/dist/routes/apirepowork.js.map +1 -1
  303. package/packages/host/dist/routes/apiroutes.js +4 -1
  304. package/packages/host/dist/routes/apiroutes.js.map +1 -1
  305. package/packages/host/dist/routes/apiskills.d.ts +3 -0
  306. package/packages/host/dist/routes/apiskills.js +81 -0
  307. package/packages/host/dist/routes/apiskills.js.map +1 -0
  308. package/packages/host/dist/routes/apistats.js +2 -2
  309. package/packages/host/dist/routes/apistats.js.map +1 -1
  310. package/packages/host/dist/routes/apisystem.js +3 -1
  311. package/packages/host/dist/routes/apisystem.js.map +1 -1
  312. package/packages/host/dist/routes/apitable.d.ts +2 -0
  313. package/packages/host/dist/routes/apitable.js.map +1 -1
  314. package/packages/host/dist/server/billingwire.js +5 -0
  315. package/packages/host/dist/server/billingwire.js.map +1 -1
  316. package/packages/host/dist/server/deliveries.d.ts +4 -1
  317. package/packages/host/dist/server/deliveries.js +38 -6
  318. package/packages/host/dist/server/deliveries.js.map +1 -1
  319. package/packages/host/dist/server/http.js +1 -1
  320. package/packages/host/dist/server/http.js.map +1 -1
  321. package/packages/host/dist/server/intentDeps.js +20 -6
  322. package/packages/host/dist/server/intentDeps.js.map +1 -1
  323. package/packages/host/dist/server/wsops.js +2 -1
  324. package/packages/host/dist/server/wsops.js.map +1 -1
  325. package/packages/host/dist/sessions/core.d.ts +1 -0
  326. package/packages/host/dist/sessions/ctxseries.js +7 -5
  327. package/packages/host/dist/sessions/ctxseries.js.map +1 -1
  328. package/packages/host/dist/sessions/drive.d.ts +6 -1
  329. package/packages/host/dist/sessions/drive.js +13 -10
  330. package/packages/host/dist/sessions/drive.js.map +1 -1
  331. package/packages/host/dist/sessions/record.js +16 -17
  332. package/packages/host/dist/sessions/record.js.map +1 -1
  333. package/packages/host/dist/sessions/sidechannel.js +1 -1
  334. package/packages/host/dist/sessions/sidechannel.js.map +1 -1
  335. package/packages/host/dist/sessions/tmux.js +6 -1
  336. package/packages/host/dist/sessions/tmux.js.map +1 -1
  337. package/packages/host/dist/sessions/turn.js +5 -0
  338. package/packages/host/dist/sessions/turn.js.map +1 -1
  339. package/packages/host/dist/sessions.d.ts +2 -1
  340. package/packages/host/dist/sessions.js +1 -1
  341. package/packages/host/dist/sessions.js.map +1 -1
  342. package/packages/host/dist/settle.d.ts +3 -2
  343. package/packages/host/dist/settle.js +13 -13
  344. package/packages/host/dist/settle.js.map +1 -1
  345. package/packages/host/dist/sidecar/sidecarname.d.ts +2 -0
  346. package/packages/host/dist/sidecar/sidecarname.js +5 -1
  347. package/packages/host/dist/sidecar/sidecarname.js.map +1 -1
  348. package/packages/host/dist/sidecar/sidecarroute.d.ts +1 -1
  349. package/packages/host/dist/sidecar/sidecarroute.js +5 -0
  350. package/packages/host/dist/sidecar/sidecarroute.js.map +1 -1
  351. package/packages/host/dist/sidecar.d.ts +1 -1
  352. package/packages/host/dist/sidecar.js +1 -1
  353. package/packages/host/dist/sidecar.js.map +1 -1
  354. package/packages/host/dist/skills/skillinventory.d.ts +23 -0
  355. package/packages/host/dist/skills/skillinventory.js +275 -0
  356. package/packages/host/dist/skills/skillinventory.js.map +1 -0
  357. package/packages/host/dist/skills/skilllayers.d.ts +28 -0
  358. package/packages/host/dist/skills/skilllayers.js +73 -0
  359. package/packages/host/dist/skills/skilllayers.js.map +1 -0
  360. package/packages/host/dist/skills/skillrecommend.d.ts +42 -0
  361. package/packages/host/dist/skills/skillrecommend.js +171 -0
  362. package/packages/host/dist/skills/skillrecommend.js.map +1 -0
  363. package/packages/host/dist/skills/skillrefs.d.ts +2 -0
  364. package/packages/host/dist/skills/skillrefs.js +50 -0
  365. package/packages/host/dist/skills/skillrefs.js.map +1 -0
  366. package/packages/host/dist/skills/skilluse.d.ts +57 -0
  367. package/packages/host/dist/skills/skilluse.js +242 -0
  368. package/packages/host/dist/skills/skilluse.js.map +1 -0
  369. package/packages/host/dist/skills/skillweight.d.ts +18 -0
  370. package/packages/host/dist/skills/skillweight.js +69 -0
  371. package/packages/host/dist/skills/skillweight.js.map +1 -0
  372. package/packages/host/dist/skills/skillwrite.d.ts +56 -0
  373. package/packages/host/dist/skills/skillwrite.js +183 -0
  374. package/packages/host/dist/skills/skillwrite.js.map +1 -0
  375. package/packages/host/dist/sysstat.d.ts +34 -1
  376. package/packages/host/dist/sysstat.js +82 -14
  377. package/packages/host/dist/sysstat.js.map +1 -1
  378. package/packages/host/dist/tokenscan.js +5 -2
  379. package/packages/host/dist/tokenscan.js.map +1 -1
  380. package/packages/host/dist/tokenstats.js +7 -4
  381. package/packages/host/dist/tokenstats.js.map +1 -1
  382. package/packages/host/dist/transcript/transcriptparse.js +2 -2
  383. package/packages/host/dist/transcript/transcriptparse.js.map +1 -1
  384. package/packages/host/dist/waitclock.d.ts +12 -0
  385. package/packages/host/dist/waitclock.js +23 -0
  386. package/packages/host/dist/waitclock.js.map +1 -0
  387. package/packages/host/dist/weekburn.js +7 -5
  388. package/packages/host/dist/weekburn.js.map +1 -1
  389. package/packages/host/dist/worktreeleftover.js +13 -15
  390. package/packages/host/dist/worktreeleftover.js.map +1 -1
  391. package/packages/web/dist/assets/demo-DHkwSmU5.js +26 -0
  392. package/packages/web/dist/assets/{icons-D8RlmSLR.js → icons-5lVTFNUU.js} +1 -1
  393. package/packages/web/dist/assets/index-Bh4cH6X8.js +170 -0
  394. package/packages/web/dist/assets/index-F7VHtsLI.css +1 -0
  395. package/packages/web/dist/assets/shared-BvQMg9ra.js +51 -0
  396. package/packages/web/dist/assets/sheets-Cwi72V02.js +257 -0
  397. package/packages/web/dist/assets/sheets-DjU2XiUd.css +1 -0
  398. package/packages/web/dist/build-id.txt +1 -1
  399. package/packages/web/dist/buildstamp.json +1 -1
  400. package/packages/web/dist/index.html +7 -7
  401. package/packages/web/dist/sw.js +2 -2
  402. package/release.json +11 -3
  403. package/tools/repohealth/constants.mjs +34 -1
  404. package/tools/repohealth/fixture.json +5374 -38
  405. package/tools/repohealth/git.mjs +77 -0
  406. package/tools/repohealth/lang/dart-analyze.mjs +181 -0
  407. package/tools/repohealth/lang/dart-lex.mjs +494 -0
  408. package/tools/repohealth/lang/dart-resolve.mjs +95 -0
  409. package/tools/repohealth/lang/python-ast.mjs +602 -0
  410. package/tools/repohealth/lang/python-resolve.mjs +228 -0
  411. package/tools/repohealth/metrics/habits.mjs +286 -0
  412. package/tools/repohealth/metrics/native.mjs +542 -0
  413. package/tools/repohealth/metrics/untested.mjs +20 -8
  414. package/tools/repohealth/metrics/workspace.mjs +256 -0
  415. package/tools/repohealth/own.mjs +67 -5
  416. package/tools/repohealth/packs/dart.mjs +153 -85
  417. package/tools/repohealth/packs/python.mjs +51 -14
  418. package/tools/repohealth/plot.mjs +143 -1
  419. package/tools/repohealth/reach.mjs +98 -0
  420. package/tools/repohealth/scope.mjs +14 -1
  421. package/tools/repohealth/series.mjs +5 -0
  422. package/tools/repohealth/types.mjs +4 -0
  423. package/tools/repohealth.mjs +39 -5
  424. package/packages/web/dist/assets/demo-ad3g3HDa.js +0 -26
  425. package/packages/web/dist/assets/index-Csb7jynu.js +0 -170
  426. package/packages/web/dist/assets/index-Cz9Haocy.css +0 -1
  427. package/packages/web/dist/assets/shared-DBaaGttP.js +0 -51
  428. package/packages/web/dist/assets/sheets-CqsP9w1V.js +0 -256
  429. package/packages/web/dist/assets/sheets-DoUhPGK0.css +0 -1
@@ -0,0 +1,716 @@
1
+ /**
2
+ * What may be deleted, and what is only shown — computed HERE, from fixed rules over the host's own
3
+ * roots, never from anything the phone sent. Every function resolves one CATEGORY freshly, so a
4
+ * delete can re-derive exactly its own category (`engine.mts`) instead of trusting a list it handed
5
+ * out earlier.
6
+ *
7
+ * Categories and their anchors (the folder a candidate must REALLY be inside — `safeToRemove`):
8
+ * cache a fixed list of regenerable caches under $HOME, each exactly its own path
9
+ * build build output under the code root: `build`/`.next`/`.turbo`/`.vite` next to a
10
+ * package.json / build.gradle* / settings.gradle*, and ignored by git
11
+ * tmp claude session scratchpads under /tmp/claude-<uid> (/private/tmp on a Mac), untouched for a day (anchored at /tmp, so the
12
+ * claude-<uid> folder must itself be real)
13
+ * wcache wsl only: a fixed list of regenerable caches under the Windows home, each exactly its
14
+ * own path (one `*` segment allowed: a Firefox profile folder, each still checked)
15
+ * wtemp wsl only: entries directly under the Windows %TEMP% untouched for a week (anchored at the Windows home)
16
+ * hf ~/.cache/huggingface/hub/models--*
17
+ * ollama a tag `ollama list` names (deleted by `ollama rm`, never by path)
18
+ * Show-only entries get ids too (`show:`/`nm:`), so the phone can key its rows — and no
19
+ * `remove` accepts them (`CANDIDATE_ID_RE`).
20
+ */
21
+ import { createHash } from "node:crypto";
22
+ import { lstat, readdir, realpath } from "node:fs/promises";
23
+ import { basename, dirname, isAbsolute, join, relative, sep } from "node:path";
24
+ import { run, pool, tick } from "./run.mjs";
25
+ export function idOf(category, key) {
26
+ return `${category}:${createHash("sha256").update(`${category}\0${key}`).digest("hex").slice(0, 16)}`;
27
+ }
28
+ export function tilde(p, home) {
29
+ return p === home ? "~" : p.startsWith(home + sep) ? `~${p.slice(home.length)}` : p;
30
+ }
31
+ export const profileOf = (r) => r.profile ?? "mac";
32
+ /** The Windows home, only on wsl. */
33
+ export const winHomeOf = (r) => (profileOf(r) === "wsl" ? r.winHome ?? null : null);
34
+ /** `/mnt/c/Users/me/x` as Windows writes it (`C:/Users/me/x`); any other path as it is. */
35
+ export function driveForm(p) {
36
+ const m = /^\/mnt\/([a-z])(\/.*)?$/.exec(p);
37
+ return m ? `${m[1].toUpperCase()}:${m[2] ?? "/"}` : p;
38
+ }
39
+ /** On wsl a group says which disk it is on; elsewhere there is one disk and it says nothing. */
40
+ /** The disk a PATH is on under wsl: a path under /mnt/<letter>/ is that Windows drive, anything else is inside WSL. */
41
+ export const sideOfPath = (p) => (/^\/mnt\/[a-z](\/|$)/.test(p) ? "windows" : "wsl");
42
+ export function sided(r, group, side) {
43
+ if (profileOf(r) !== "wsl")
44
+ return { group };
45
+ return { group: `${group} ${side === "windows" ? "on Windows" : "in WSL"}`, side };
46
+ }
47
+ /** The Mac's list (`profile: "mac"`). */
48
+ export const FIXED_CACHES = [
49
+ { rel: ".gradle/caches", group: "Gradle", regen: "Gradle downloads dependencies again on the next build (a slow first build)." },
50
+ { rel: ".gradle/wrapper/dists", group: "Gradle", regen: "Each project's gradlew downloads its Gradle version again on the next build." },
51
+ { rel: ".gradle/daemon", group: "Gradle", regen: "Daemon logs and registry; recreated by the next build." },
52
+ { rel: ".npm/_cacache", group: "npm", regen: "npm downloads packages again on the next install." },
53
+ { rel: "Library/Caches/ms-playwright", group: "browser engines", regen: "`npx playwright install chromium` puts them back — this host's thumbnails and web capture need it." },
54
+ { rel: ".cache/puppeteer", group: "browser engines", regen: "Puppeteer downloads its browser again on the next install." },
55
+ { rel: "Library/Caches/pip", group: "Python", regen: "pip downloads wheels again on the next install." },
56
+ { rel: "Library/Caches/node-gyp", group: "npm", regen: "Node headers are downloaded again on the next native build." },
57
+ { rel: "Library/Caches/Homebrew", group: "Homebrew", regen: "Old downloads; brew fetches what it needs again (`brew cleanup` does the same)." },
58
+ { rel: "Library/Caches/electron", group: "npm", regen: "Electron binaries are downloaded again on the next install." },
59
+ { rel: "Library/Caches/claude-cli-nodejs", group: "Claude Code", regen: "Claude Code's own cache (logs); recreated as it runs." },
60
+ { rel: "Library/Caches/BraveSoftware", group: "browser caches", regen: "The browser refills it as you browse; best done with Brave closed." },
61
+ { rel: "Library/Caches/com.brave.Browser", group: "browser caches", regen: "The browser refills it as you browse; best done with Brave closed." },
62
+ { rel: "Library/Caches/Google", group: "browser caches", regen: "Chrome refills it as you browse; best done with Chrome closed." },
63
+ { rel: "Library/Caches/Firefox", group: "browser caches", regen: "Firefox refills it as you browse; best done with Firefox closed." },
64
+ ];
65
+ async function isRealDir(p) {
66
+ try {
67
+ const s = await lstat(p);
68
+ return s.isDirectory();
69
+ }
70
+ catch {
71
+ return false;
72
+ }
73
+ }
74
+ async function exists(p) {
75
+ try {
76
+ await lstat(p);
77
+ return true;
78
+ }
79
+ catch {
80
+ return false;
81
+ }
82
+ }
83
+ /** Linux's list, and the Linux side of wsl (XDG cache folders under ~/.cache). */
84
+ export const LINUX_CACHES = [
85
+ { rel: ".gradle/caches", group: "Gradle", regen: "Gradle downloads dependencies again on the next build (a slow first build)." },
86
+ { rel: ".gradle/wrapper/dists", group: "Gradle", regen: "Each project's gradlew downloads its Gradle version again on the next build." },
87
+ { rel: ".gradle/daemon", group: "Gradle", regen: "Daemon logs and registry; recreated by the next build." },
88
+ { rel: ".npm/_cacache", group: "npm", regen: "npm downloads packages again on the next install." },
89
+ { rel: ".cache/ms-playwright", group: "browser engines", regen: "`npx playwright install chromium` puts them back — this host's thumbnails and web capture need it." },
90
+ { rel: ".cache/puppeteer", group: "browser engines", regen: "Puppeteer downloads its browser again on the next install." },
91
+ { rel: ".cache/pip", group: "Python", regen: "pip downloads wheels again on the next install." },
92
+ { rel: ".cache/node-gyp", group: "npm", regen: "Node headers are downloaded again on the next native build." },
93
+ { rel: ".cache/electron", group: "npm", regen: "Electron binaries are downloaded again on the next install." },
94
+ { rel: ".cache/google-chrome", group: "browser caches", regen: "Chrome refills it as you browse; best done with Chrome closed." },
95
+ { rel: ".cache/chromium", group: "browser caches", regen: "Chromium refills it as you browse; best done with Chromium closed." },
96
+ { rel: ".cache/BraveSoftware", group: "browser caches", regen: "The browser refills it as you browse; best done with Brave closed." },
97
+ { rel: ".cache/mozilla", group: "browser caches", regen: "Firefox refills it as you browse; best done with Firefox closed." },
98
+ ];
99
+ const BROWSER_WIN = (name) => {
100
+ const dir = name === "Chrome" ? "Google/Chrome" : name === "Brave" ? "BraveSoftware/Brave-Browser" : "Microsoft/Edge";
101
+ const regen = `${name} refills it as you browse; best done with ${name} closed (a file it still holds makes the delete fail).`;
102
+ return [
103
+ { rel: `AppData/Local/${dir}/User Data/Default/Cache`, group: "browser caches", regen },
104
+ { rel: `AppData/Local/${dir}/User Data/Default/Code Cache`, group: "browser caches", regen },
105
+ ];
106
+ };
107
+ /** wsl's Windows side, relative to the Windows home. A `*` segment is one real folder per row. */
108
+ export const WIN_CACHES = [
109
+ { rel: "AppData/Local/npm-cache", group: "npm", regen: "npm on Windows downloads packages again on the next install." },
110
+ { rel: "AppData/Local/pip/cache", group: "Python", regen: "pip on Windows downloads wheels again on the next install." },
111
+ { rel: "AppData/Local/ms-playwright", group: "browser engines", regen: "`npx playwright install` on Windows puts them back." },
112
+ { rel: ".gradle/caches", group: "Gradle", regen: "Gradle on Windows downloads dependencies again on the next build (a slow first build)." },
113
+ { rel: ".gradle/wrapper/dists", group: "Gradle", regen: "Each project's gradlew downloads its Gradle version again on the next Windows build." },
114
+ { rel: ".gradle/daemon", group: "Gradle", regen: "Daemon logs and registry; recreated by the next Windows build." },
115
+ ...BROWSER_WIN("Chrome"), ...BROWSER_WIN("Brave"), ...BROWSER_WIN("Edge"),
116
+ { rel: "AppData/Local/Mozilla/Firefox/Profiles/*/cache2", group: "browser caches", regen: "Firefox refills it as you browse; best done with Firefox closed (a file it still holds makes the delete fail)." },
117
+ ];
118
+ /** The home-side list for this desktop's profile. */
119
+ export const cachesFor = (r) => (profileOf(r) === "mac" ? FIXED_CACHES : LINUX_CACHES);
120
+ /** Whether `rel` (already split, no empty/`.`/`..` segment) is `pattern`, a `*` matching any one segment. */
121
+ export function relMatches(pattern, rel) {
122
+ const p = pattern.split("/");
123
+ return p.length === rel.length && p.every((seg, i) => seg === "*" || seg === rel[i]);
124
+ }
125
+ /** A pattern's real paths under `base`: a `*` segment lists that folder's sub-folders (never a symlink). */
126
+ async function expand(base, pattern) {
127
+ let paths = [base];
128
+ for (const seg of pattern.split("/")) {
129
+ if (seg !== "*") {
130
+ paths = paths.map((p) => join(p, seg));
131
+ continue;
132
+ }
133
+ const next = [];
134
+ for (const p of paths) {
135
+ let ents;
136
+ try {
137
+ ents = await readdir(p, { withFileTypes: true });
138
+ }
139
+ catch {
140
+ continue;
141
+ }
142
+ for (const e of ents)
143
+ if (e.isDirectory())
144
+ next.push(join(p, e.name));
145
+ }
146
+ paths = next.sort();
147
+ }
148
+ const out = [];
149
+ for (const p of paths)
150
+ if (await exists(p))
151
+ out.push(p);
152
+ return out;
153
+ }
154
+ /** Every fixed cache that exists (a symlink too — `safeToRemove` is what refuses it, with words). */
155
+ export async function resolveCaches(r) {
156
+ const out = [];
157
+ for (const c of cachesFor(r)) {
158
+ const path = join(r.home, c.rel);
159
+ if (!(await exists(path)))
160
+ continue;
161
+ out.push({ id: idOf("cache", path), category: "cache", kind: "temp", ...sided(r, c.group, "wsl"), label: tilde(path, r.home), path, regen: c.regen });
162
+ }
163
+ return out;
164
+ }
165
+ /** wsl: every Windows-side fixed cache that exists; none without a Windows home. */
166
+ export async function resolveWinCaches(r) {
167
+ const win = winHomeOf(r);
168
+ if (!win)
169
+ return [];
170
+ const out = [];
171
+ for (const c of WIN_CACHES) {
172
+ for (const path of await expand(win, c.rel)) {
173
+ out.push({ id: idOf("wcache", path), category: "wcache", kind: "temp", ...sided(r, c.group, "windows"), label: driveForm(path), path, regen: c.regen });
174
+ }
175
+ }
176
+ return out;
177
+ }
178
+ // ── build + node_modules: one walk of the code root ────────────────────────
179
+ export const BUILD_NAMES = new Set(["build", ".next", ".turbo", ".vite"]);
180
+ const MANIFESTS = ["package.json", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"];
181
+ const NEVER_DESCEND = new Set([".git", "node_modules", ".gradle", ".Trash"]);
182
+ /**
183
+ * Walk the code root: build output folders (not descended into) and node_modules folders (never
184
+ * descended into). Bounded by depth and by a folder budget, yielding as it goes — this runs in the
185
+ * process pumping every PTY. Symlinks are never followed.
186
+ */
187
+ export async function walkRoot(r) {
188
+ const build = [];
189
+ const nodeModules = [];
190
+ let opened = 0;
191
+ let stopped = false;
192
+ const queue = [{ dir: r.root, depth: 0 }];
193
+ while (queue.length) {
194
+ const { dir, depth } = queue.shift();
195
+ if (opened >= r.walkBudget) {
196
+ stopped = true;
197
+ break;
198
+ }
199
+ opened++;
200
+ if (opened % 200 === 0)
201
+ await tick();
202
+ let ents;
203
+ try {
204
+ ents = await readdir(dir, { withFileTypes: true });
205
+ }
206
+ catch {
207
+ continue;
208
+ }
209
+ const hasManifest = manifestIn(ents.map((e) => e.name));
210
+ for (const e of ents) {
211
+ if (!e.isDirectory())
212
+ continue; // a symlink is not a directory entry here: never followed
213
+ const p = join(dir, e.name);
214
+ if (e.name === "node_modules") {
215
+ nodeModules.push(p);
216
+ continue;
217
+ }
218
+ if (BUILD_NAMES.has(e.name) && hasManifest) {
219
+ build.push(p);
220
+ continue;
221
+ }
222
+ if (NEVER_DESCEND.has(e.name))
223
+ continue;
224
+ if (depth + 1 < r.walkDepth)
225
+ queue.push({ dir: p, depth: depth + 1 });
226
+ }
227
+ }
228
+ const ignored = await pool(build, r.concurrency, (p) => gitIgnored(r, p));
229
+ const kept = build.filter((_, i) => ignored[i]);
230
+ return { build: kept, nodeModules, stopped, outsideGit: build.length - kept.length };
231
+ }
232
+ const manifestIn = (names) => MANIFESTS.some((m) => names.includes(m));
233
+ /** Build output is ignored by git; a `build/` git tracks (an electron-builder resources folder) is source. */
234
+ async function gitIgnored(r, p) {
235
+ const res = await run(r.gitBin, ["-C", dirname(p), "check-ignore", "-q", "--", basename(p)], { timeoutMs: 15_000 });
236
+ return res.code === 0;
237
+ }
238
+ /**
239
+ * ONE path checked the way `walkRoot` would have found it, without walking the code root — the
240
+ * fresh recompute a build-output delete runs (on a Windows-drive code root a walk takes many
241
+ * minutes). The path must be under the code root within the walk's depth, reached only through
242
+ * folders the walk descends into (no `node_modules`, `.git`, `.gradle`, `.Trash`, and no build
243
+ * output folder above it), named like build output, a real folder (not a link) next to a manifest,
244
+ * and ignored by git. Null candidate with the sentence why otherwise.
245
+ */
246
+ export async function recheckBuild(r, path) {
247
+ const no = (why) => ({ c: null, why: `${path}: ${why}` });
248
+ if (!isAbsolute(path))
249
+ return no("not an absolute path");
250
+ if (path.split(sep).some((seg) => seg === ".." || seg === "."))
251
+ return no("not a plain path");
252
+ const relText = relative(r.root, path);
253
+ if (!relText || relText.startsWith("..") || isAbsolute(relText))
254
+ return no(`outside ${r.root}`);
255
+ const rel = relText.split(sep);
256
+ if (rel.some((s) => s === ".." || s === "." || s === ""))
257
+ return no(`not a plain path under ${r.root}`);
258
+ if (rel.length > r.walkDepth)
259
+ return no("deeper than the code-root walk looks");
260
+ if (!BUILD_NAMES.has(rel.at(-1)))
261
+ return no("not named like build output");
262
+ for (let i = 0; i < rel.length - 1; i++) {
263
+ const seg = rel[i];
264
+ if (seg === "node_modules" || NEVER_DESCEND.has(seg))
265
+ return no(`inside ${seg}, which the walk never opens`);
266
+ if (BUILD_NAMES.has(seg)) {
267
+ let names = [];
268
+ try {
269
+ names = await readdir(join(r.root, ...rel.slice(0, i)));
270
+ }
271
+ catch { /* unreadable: not a manifest */ }
272
+ if (manifestIn(names))
273
+ return no("inside another build output folder");
274
+ }
275
+ }
276
+ let st;
277
+ try {
278
+ st = await lstat(path);
279
+ }
280
+ catch {
281
+ return no("no longer there");
282
+ }
283
+ if (st.isSymbolicLink() || !st.isDirectory())
284
+ return no("not a real folder");
285
+ let names = [];
286
+ try {
287
+ names = await readdir(dirname(path));
288
+ }
289
+ catch { /* unreadable: no manifest */ }
290
+ if (!manifestIn(names))
291
+ return no("no package.json, build.gradle or settings.gradle beside it");
292
+ if (!(await gitIgnored(r, path)))
293
+ return no("not ignored by git");
294
+ return { c: buildCandidates(r, { build: [path], nodeModules: [], stopped: false, outsideGit: 0 })[0] };
295
+ }
296
+ /** `p` is `base` or inside it, lexically. */
297
+ const within = (base, p) => { const t = relative(base, p); return !t.startsWith("..") && !isAbsolute(t); };
298
+ /** wsl: a path whose bytes are on the Windows drive — under a /mnt drive, or under the Windows home. */
299
+ export function onWindowsDrive(r, p) {
300
+ if (profileOf(r) !== "wsl")
301
+ return false;
302
+ const win = winHomeOf(r);
303
+ return sideOfPath(p) === "windows" || (win != null && within(win, p));
304
+ }
305
+ /**
306
+ * The code-root walk runs only on a tap: on wsl with the code root on the Windows drive, where
307
+ * reading folders through WSL's drvfs is slow enough that one walk of a real code root took 29 min.
308
+ */
309
+ export const codeOnTap = (r) => onWindowsDrive(r, r.root);
310
+ export const BUILD_REGEN = "The next build writes it again.";
311
+ export function buildCandidates(r, w) {
312
+ return w.build.map((path) => ({ id: idOf("build", path), category: "build", kind: "temp", ...sided(r, "build output", sideOfPath(path)), label: sideOfPath(path) === "windows" ? driveForm(path) : tilde(path, r.home), path, regen: BUILD_REGEN }));
313
+ }
314
+ export function nodeModulesEntries(r, w) {
315
+ return w.nodeModules.map((path) => ({
316
+ id: idOf("nm", path), category: "nm", kind: "show", ...sided(r, "node_modules", sideOfPath(path)), label: sideOfPath(path) === "windows" ? driveForm(path) : tilde(path, r.home), path,
317
+ regen: "`npm ci` in that folder puts it back; delete it by hand only in a checkout you are not using.",
318
+ }));
319
+ }
320
+ // ── tmp: claude scratchpads untouched for a day ────────────────────────────
321
+ /** The newest mtime anywhere under `dir`, or null when the folder has more than `budget` entries (then it is not "old"). */
322
+ export async function newestMtime(dir, budget = 5000) {
323
+ let newest = 0, seen = 0;
324
+ const stack = [dir];
325
+ while (stack.length) {
326
+ const d = stack.pop();
327
+ let st;
328
+ try {
329
+ st = await lstat(d);
330
+ }
331
+ catch {
332
+ continue;
333
+ }
334
+ newest = Math.max(newest, st.mtimeMs);
335
+ if (!st.isDirectory())
336
+ continue;
337
+ let ents;
338
+ try {
339
+ ents = await readdir(d, { withFileTypes: true });
340
+ }
341
+ catch {
342
+ return null;
343
+ }
344
+ for (const e of ents) {
345
+ if (++seen > budget)
346
+ return null;
347
+ const p = join(d, e.name);
348
+ if (e.isDirectory())
349
+ stack.push(p);
350
+ else {
351
+ try {
352
+ newest = Math.max(newest, (await lstat(p)).mtimeMs);
353
+ }
354
+ catch { /* gone */ }
355
+ }
356
+ }
357
+ }
358
+ return newest;
359
+ }
360
+ /** The session folders (`<tmpRoot>/<project>/<session>`) where nothing changed for `tmpMinAgeMs`. */
361
+ export async function oldScratchpads(r) {
362
+ const out = [];
363
+ let projects;
364
+ try {
365
+ projects = await readdir(r.tmpRoot, { withFileTypes: true });
366
+ }
367
+ catch {
368
+ return out;
369
+ }
370
+ const cutoff = r.now() - r.tmpMinAgeMs;
371
+ for (const p of projects) {
372
+ if (!p.isDirectory())
373
+ continue;
374
+ let sessions;
375
+ try {
376
+ sessions = await readdir(join(r.tmpRoot, p.name), { withFileTypes: true });
377
+ }
378
+ catch {
379
+ continue;
380
+ }
381
+ for (const s of sessions) {
382
+ if (!s.isDirectory())
383
+ continue;
384
+ const dir = join(r.tmpRoot, p.name, s.name);
385
+ const newest = await newestMtime(dir);
386
+ if (newest != null && newest < cutoff)
387
+ out.push(dir);
388
+ }
389
+ await tick();
390
+ }
391
+ return out.sort();
392
+ }
393
+ export const TMP_KEY = "claude-scratchpads";
394
+ export async function resolveTmp(r) {
395
+ const members = await oldScratchpads(r);
396
+ if (!members.length)
397
+ return [];
398
+ return [{
399
+ id: idOf("tmp", TMP_KEY), category: "tmp", kind: "temp", ...sided(r, "scratchpads", "wsl"), label: `${tilde(r.tmpRoot, r.home)} — sessions idle over a day`,
400
+ members, regen: "Scratch folders of Claude Code sessions where nothing changed for a day; a live session would have touched its own.",
401
+ note: `${members.length} session folder${members.length === 1 ? "" : "s"}`,
402
+ }];
403
+ }
404
+ // ── wtemp: the Windows %TEMP%, entries untouched for a week (wsl only) ─────
405
+ export const winTempDir = (win) => join(win, "AppData", "Local", "Temp");
406
+ /** How many %TEMP% entries one scan looks at; past it the row says so. */
407
+ export const WIN_TEMP_MAX = 3000;
408
+ export const WIN_TEMP_KEY = "windows-temp";
409
+ /** Entries directly under %TEMP% (files and folders, never a symlink) where nothing changed for a week. */
410
+ export async function oldWinTemp(r) {
411
+ const win = winHomeOf(r);
412
+ if (!win)
413
+ return { members: [], capped: false };
414
+ const dir = winTempDir(win);
415
+ let ents;
416
+ try {
417
+ ents = await readdir(dir, { withFileTypes: true });
418
+ }
419
+ catch {
420
+ return { members: [], capped: false };
421
+ }
422
+ const cutoff = r.now() - r.winTempMinAgeMs;
423
+ const capped = ents.length > WIN_TEMP_MAX;
424
+ const out = [];
425
+ let i = 0;
426
+ for (const e of ents.slice(0, WIN_TEMP_MAX)) {
427
+ if (++i % 100 === 0)
428
+ await tick();
429
+ if (e.isSymbolicLink() || !(e.isDirectory() || e.isFile()))
430
+ continue;
431
+ const p = join(dir, e.name);
432
+ const newest = await newestMtime(p);
433
+ if (newest != null && newest < cutoff)
434
+ out.push(p);
435
+ }
436
+ return { members: out.sort(), capped };
437
+ }
438
+ export async function resolveWinTemp(r) {
439
+ const win = winHomeOf(r);
440
+ if (!win)
441
+ return [];
442
+ const { members, capped } = await oldWinTemp(r);
443
+ if (!members.length)
444
+ return [];
445
+ return [{
446
+ id: idOf("wtemp", WIN_TEMP_KEY), category: "wtemp", kind: "temp", ...sided(r, "temporary files", "windows"),
447
+ label: `${driveForm(winTempDir(win))} — untouched for a week`, members,
448
+ regen: "Leftover temporary files of Windows programs where nothing changed for a week. One a running program still holds is skipped, not forced.",
449
+ note: `${members.length} item${members.length === 1 ? "" : "s"}${capped ? ` (only the first ${WIN_TEMP_MAX} in the folder were looked at)` : ""}`,
450
+ }];
451
+ }
452
+ // ── hf: Hugging Face hub models ────────────────────────────────────────────
453
+ export const hfHub = (r) => join(r.home, ".cache", "huggingface", "hub");
454
+ export async function resolveHf(r) {
455
+ const hub = hfHub(r);
456
+ let ents;
457
+ try {
458
+ ents = await readdir(hub, { withFileTypes: true });
459
+ }
460
+ catch {
461
+ return [];
462
+ }
463
+ const out = [];
464
+ for (const e of ents) {
465
+ if (!e.name.startsWith("models--"))
466
+ continue;
467
+ const path = join(hub, e.name);
468
+ let mtime = null;
469
+ try {
470
+ mtime = (await lstat(path)).mtimeMs;
471
+ }
472
+ catch {
473
+ continue;
474
+ }
475
+ const label = e.name.slice("models--".length).replace(/--/g, "/");
476
+ out.push({ id: idOf("hf", path), category: "hf", kind: "model", ...sided(r, "Hugging Face", "wsl"), label, path, mtime, regen: "Downloaded again the next time something loads this model." });
477
+ }
478
+ return out.sort((a, b) => a.label.localeCompare(b.label));
479
+ }
480
+ // ── ollama ─────────────────────────────────────────────────────────────────
481
+ const UNITS = { B: 1, KB: 1e3, MB: 1e6, GB: 1e9, TB: 1e12 };
482
+ /** "18 GB" → KiB, ollama's decimal units; null when it does not parse. */
483
+ export function ollamaSizeKb(text) {
484
+ const m = /^([\d.]+)\s*([KMGT]?B)$/i.exec(text.trim());
485
+ if (!m)
486
+ return null;
487
+ const n = Number(m[1]), u = UNITS[m[2].toUpperCase()];
488
+ return Number.isFinite(n) && u ? Math.round((n * u) / 1024) : null;
489
+ }
490
+ /** `ollama list`'s table, columns split on runs of 2+ spaces. A row that does not have them is dropped. */
491
+ export function parseOllamaList(out) {
492
+ const rows = [];
493
+ for (const line of out.split("\n")) {
494
+ if (!line.trim() || /^NAME\s/.test(line))
495
+ continue;
496
+ const cols = line.trim().split(/\s{2,}/);
497
+ if (cols.length < 3)
498
+ continue;
499
+ const [name, id, size, modified = ""] = cols;
500
+ if (!/^[0-9a-f]{6,}$/i.test(id))
501
+ continue;
502
+ rows.push({ name, id, size, modified });
503
+ }
504
+ return rows;
505
+ }
506
+ /** An ollama tag safe to hand to `ollama rm` as one argv element. */
507
+ export const OLLAMA_NAME_RE = /^[A-Za-z0-9][\w.\-:/]{0,199}$/;
508
+ export async function resolveOllama(r) {
509
+ if (!r.ollamaBin)
510
+ return { list: [], note: null };
511
+ const res = await run(r.ollamaBin, ["list"], { timeoutMs: 20_000 });
512
+ if (res.code !== 0) {
513
+ const why = res.timedOut ? "it did not answer within 20 s" : (res.stderr.trim().split("\n").at(-1) || res.error || `exit ${res.code}`);
514
+ return { list: [], note: `ollama models are not listed: \`ollama list\` failed — ${why}` };
515
+ }
516
+ const rows = parseOllamaList(res.stdout).filter((x) => OLLAMA_NAME_RE.test(x.name));
517
+ const byId = new Map();
518
+ for (const x of rows)
519
+ byId.set(x.id, [...(byId.get(x.id) ?? []), x.name]);
520
+ const list = rows.map((x) => {
521
+ const twins = (byId.get(x.id) ?? []).filter((n) => n !== x.name);
522
+ const shared = twins.length
523
+ ? `Same ID as ${twins.join(", ")}: one copy on disk — deleting this tag frees nothing until ${twins.length === 1 ? "that one goes" : "those go"} too.`
524
+ : "";
525
+ return {
526
+ id: idOf("ollama", x.name), category: "ollama", kind: "model", ...sided(r, "Ollama", "wsl"), label: x.name, ollamaName: x.name, ollamaId: x.id,
527
+ sizeText: x.size, regen: `\`ollama pull ${x.name}\` downloads it again.`,
528
+ note: [x.modified ? `modified ${x.modified}` : "", shared].filter(Boolean).join(" · "),
529
+ };
530
+ });
531
+ return { list, note: null };
532
+ }
533
+ // ── show-only ──────────────────────────────────────────────────────────────
534
+ /** wsl: the distros' virtual disks (`ext4.vhdx`), found in the two places WSL keeps them, bounded. */
535
+ export async function wslDisks(win) {
536
+ const out = [];
537
+ const look = async (parent, tail) => {
538
+ let ents;
539
+ try {
540
+ ents = await readdir(parent, { withFileTypes: true });
541
+ }
542
+ catch {
543
+ return;
544
+ }
545
+ for (const e of ents.slice(0, 600)) {
546
+ if (!e.isDirectory())
547
+ continue;
548
+ const p = join(parent, e.name, ...tail);
549
+ try {
550
+ if ((await lstat(p)).isFile())
551
+ out.push(p);
552
+ }
553
+ catch { /* not this one */ }
554
+ }
555
+ };
556
+ await look(join(win, "AppData/Local/Packages"), ["LocalState", "ext4.vhdx"]);
557
+ await look(join(win, "AppData/Local/wsl"), ["ext4.vhdx"]);
558
+ return out.sort();
559
+ }
560
+ /** The compact instruction for a WSL virtual disk, naming this distro when it is known. */
561
+ export function compactHow(distro) {
562
+ const d = distro && /^[\w.\-]{1,64}$/.test(distro) ? distro : "<distro>";
563
+ return `This file only grows: space freed inside WSL comes back to Windows only after it is compacted. Simplest, once: \`wsl --manage ${d} --set-sparse true\` in Windows PowerShell, and it shrinks by itself from then on. Or by hand: \`wsl --shutdown\`, then \`Optimize-VHD -Path <this file> -Mode Full\` (Hyper-V), or diskpart's \`compact vdisk\`.`;
564
+ }
565
+ export async function showOnly(r) {
566
+ const out = [];
567
+ const prof = profileOf(r);
568
+ const add = async (path, group, regen, label, side = "wsl") => {
569
+ if (!(await isRealDir(path)))
570
+ return;
571
+ out.push({ id: idOf("show", path), category: "show", kind: "show", ...sided(r, group, side), label: label ?? (side === "windows" ? driveForm(path) : tilde(path, r.home)), path, regen });
572
+ };
573
+ const images = join(r.androidSdk, "system-images");
574
+ try {
575
+ const ents = (await readdir(images, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name).sort();
576
+ for (const n of ents) {
577
+ const api = /^android-(.+)$/.exec(n)?.[1];
578
+ await add(join(images, n), "Android system images", "Remove unused ones in Android Studio's SDK Manager (or `sdkmanager --uninstall`); an emulator using it stops booting.", api ? `API ${api} — ${tilde(join(images, n), r.home)}` : undefined);
579
+ }
580
+ }
581
+ catch { /* no SDK */ }
582
+ if (prof === "mac")
583
+ await add(join(r.home, "Library/Developer/CoreSimulator"), "Xcode", "`xcrun simctl delete unavailable` drops simulators of runtimes that are gone.");
584
+ await add(join(r.home, ".claude/projects"), "Claude Code", "Every conversation's log — what resume, the token statistics and the archive read. Not regenerable.");
585
+ await add(join(r.home, "Downloads"), "your files", prof === "mac" ? "Your own downloads: look through them in Finder." : "Your own downloads: look through them in a file manager.");
586
+ await add(join(r.home, ".ollama"), "Ollama", "All ollama models together — delete single tags in the models list above.");
587
+ if (prof === "mac") {
588
+ await add(join(r.home, "Library/Containers/com.docker.docker/Data"), "Docker", "`docker system prune` (and `docker volume prune`) frees images and volumes nobody uses.");
589
+ await add(join(r.home, ".orbstack"), "Docker", "OrbStack's data: prune images and volumes from inside it.");
590
+ // Not ~/Library/Group Containers/*.dev.orbstack: macOS guards other apps' group containers, and
591
+ // measuring one hung du for the full 120 s here (a permission prompt on the desktop, likely).
592
+ }
593
+ else {
594
+ // Rootless Docker's data; an unreadable one (a root-owned install) is simply not listed.
595
+ const docker = join(r.home, ".local/share/docker");
596
+ if (await readable(docker))
597
+ await add(docker, "Docker", "`docker system prune` (and `docker volume prune`) frees images and volumes nobody uses.");
598
+ }
599
+ const win = winHomeOf(r);
600
+ if (win) {
601
+ for (const vhdx of await wslDisks(win)) {
602
+ out.push({ id: idOf("show", vhdx), category: "show", kind: "show", ...sided(r, "WSL's virtual disk", "windows"), label: driveForm(vhdx), path: vhdx, regen: compactHow(r.wslDistro) });
603
+ }
604
+ await add(join(win, "AppData/Local/Docker/wsl"), "Docker", "Docker Desktop's disks: `docker system prune` frees images and volumes nobody uses; the disk file itself shrinks only when Docker Desktop compacts it (Troubleshoot › Clean / Purge data).", undefined, "windows");
605
+ await add(join(win, "Downloads"), "your files", "Your own Windows downloads: look through them in Explorer.", undefined, "windows");
606
+ }
607
+ return out;
608
+ }
609
+ async function readable(p) {
610
+ try {
611
+ await readdir(p);
612
+ return true;
613
+ }
614
+ catch {
615
+ return false;
616
+ }
617
+ }
618
+ /** The folders the large-file find skips because a list above already covers them. */
619
+ export function coveredPaths(r) {
620
+ if (profileOf(r) !== "mac") {
621
+ const win = winHomeOf(r);
622
+ return [
623
+ ...LINUX_CACHES.map((c) => join(r.home, c.rel)),
624
+ hfHub(r), join(r.home, ".ollama"), join(r.androidSdk, "system-images"), join(r.home, ".local/share/docker"), join(r.home, ".local/share/Trash"),
625
+ // -xdev already keeps the find off /mnt (another filesystem); pruned by name as well.
626
+ ...(profileOf(r) === "wsl" ? ["/mnt", ...(win ? [win] : [])] : []),
627
+ ];
628
+ }
629
+ return [
630
+ ...FIXED_CACHES.map((c) => join(r.home, c.rel)),
631
+ hfHub(r), join(r.home, ".ollama"), join(r.androidSdk, "system-images"), join(r.home, "Library/Developer/CoreSimulator"),
632
+ join(r.home, "Library/Containers/com.docker.docker"), join(r.home, ".orbstack"),
633
+ join(r.home, "Library/Mobile Documents"), join(r.home, ".Trash"),
634
+ // Other apps' data: macOS may stop the find on a permission prompt nobody at the phone can answer.
635
+ join(r.home, "Library/Containers"), join(r.home, "Library/Group Containers"),
636
+ ];
637
+ }
638
+ // ── the containment check every delete passes, at scan time and again at delete time ──
639
+ /** Which anchor a deletable category is held inside, and the shape its relative path must have. */
640
+ function anchorOf(c, r, path) {
641
+ const win = winHomeOf(r);
642
+ switch (c.category) {
643
+ case "cache": return { base: r.home, shapeOk: (rel) => cachesFor(r).some((f) => relMatches(f.rel, rel)) };
644
+ case "wcache": return win ? { base: win, shapeOk: (rel) => WIN_CACHES.some((f) => relMatches(f.rel, rel)) } : null;
645
+ // A %TEMP% entry may be a file: the one category where a non-folder is deleted.
646
+ // Anchored at the Windows home like wcache, so a link at AppData, Local or Temp refuses too.
647
+ case "wtemp": return win ? { base: win, shapeOk: (rel) => rel.length === 4 && rel.slice(0, 3).join("/") === "AppData/Local/Temp", fileOk: true } : null;
648
+ case "hf": return { base: r.home, shapeOk: (rel) => rel.length === 4 && rel.slice(0, 3).join("/") === ".cache/huggingface/hub" && rel[3].startsWith("models--") };
649
+ case "build": return { base: r.root, shapeOk: (rel) => rel.length >= 2 && BUILD_NAMES.has(rel.at(-1)) };
650
+ // Anchored at the folder holding tmpRoot, so tmpRoot itself must be a real folder (in a shared /tmp another user can plant a link there).
651
+ case "tmp": return { base: dirname(r.tmpRoot), shapeOk: (rel) => rel.length === 3 && rel[0] === basename(r.tmpRoot) };
652
+ default:
653
+ void path;
654
+ return null;
655
+ }
656
+ }
657
+ /**
658
+ * Null when `path` may be removed as a `c.category` candidate, else the sentence why not. The path
659
+ * must be absolute and lexically inside its anchor with the category's shape, must not be a symlink,
660
+ * and its REALPATH must be exactly the anchor's realpath joined with the same relative path — so a
661
+ * symlink anywhere between the anchor and the leaf (or a swapped-in one since the scan) refuses.
662
+ */
663
+ export async function safeToRemove(c, r, path) {
664
+ const a = anchorOf(c, r, path);
665
+ if (!a)
666
+ return `${c.label}: this kind of entry has no delete path`;
667
+ if (!isAbsolute(path))
668
+ return `${c.label}: not an absolute path`;
669
+ const relText = relative(a.base, path);
670
+ if (!relText || relText.startsWith("..") || isAbsolute(relText))
671
+ return `${c.label}: outside ${a.base}`;
672
+ const rel = relText.split(sep);
673
+ if (rel.some((s) => s === ".." || s === "." || s === ""))
674
+ return `${c.label}: not a plain path under ${a.base}`;
675
+ if (!a.shapeOk(rel))
676
+ return `${c.label}: not a ${c.category} path this extension deletes`;
677
+ let st;
678
+ try {
679
+ st = await lstat(path);
680
+ }
681
+ catch {
682
+ return `${c.label}: no longer there`;
683
+ }
684
+ if (st.isSymbolicLink())
685
+ return `${c.label}: is a symlink — refusing to follow it`;
686
+ if (!st.isDirectory() && !(a.fileOk && st.isFile()))
687
+ return `${c.label}: not a folder`;
688
+ let real, base;
689
+ try {
690
+ real = await realpath(path);
691
+ base = await realpath(a.base);
692
+ }
693
+ catch {
694
+ return `${c.label}: its real location could not be read`;
695
+ }
696
+ if (real !== join(base, ...rel))
697
+ return `${c.label}: resolves to ${real}, outside where it should be — refusing`;
698
+ if (c.category === "tmp") {
699
+ // A real folder planted by another user is as bad as a link: they could swap a session folder for a link while we delete.
700
+ // So the scratchpad root must be ours and closed to anyone else (a group that is only our own, as on a private-group distro, is fine).
701
+ let rs;
702
+ try {
703
+ rs = await lstat(r.tmpRoot);
704
+ }
705
+ catch {
706
+ return `${c.label}: no longer there`;
707
+ }
708
+ const uid = process.getuid?.(), gid = process.getgid?.();
709
+ if (uid !== undefined && rs.uid !== uid)
710
+ return `${c.label}: ${r.tmpRoot} belongs to another user — refusing`;
711
+ if (rs.mode & 0o002 || (rs.mode & 0o020 && gid !== undefined && rs.gid !== gid))
712
+ return `${c.label}: ${r.tmpRoot} is writable by other users — refusing`;
713
+ }
714
+ return null;
715
+ }
716
+ //# sourceMappingURL=candidates.mjs.map