agentrinse 0.8.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (583) hide show
  1. package/README.md +87 -8
  2. package/dist/adapters/artifacts/adapter.d.ts +1 -1
  3. package/dist/adapters/artifacts/adapter.d.ts.map +1 -1
  4. package/dist/adapters/artifacts/adapter.js +74 -95
  5. package/dist/adapters/artifacts/adapter.js.map +1 -1
  6. package/dist/adapters/claude-retention.d.ts +0 -1
  7. package/dist/adapters/claude-retention.d.ts.map +1 -1
  8. package/dist/adapters/claude-retention.js +1 -1
  9. package/dist/adapters/claude-retention.js.map +1 -1
  10. package/dist/adapters/codex-database.d.ts +0 -1
  11. package/dist/adapters/codex-database.d.ts.map +1 -1
  12. package/dist/adapters/codex-database.js +1 -1
  13. package/dist/adapters/codex-database.js.map +1 -1
  14. package/dist/adapters/cursor-maintenance.d.ts +2 -1
  15. package/dist/adapters/cursor-maintenance.d.ts.map +1 -1
  16. package/dist/adapters/cursor-maintenance.js +1 -1
  17. package/dist/adapters/cursor-maintenance.js.map +1 -1
  18. package/dist/adapters/docker/adapter.d.ts +0 -1
  19. package/dist/adapters/docker/adapter.d.ts.map +1 -1
  20. package/dist/adapters/docker/adapter.js +8 -73
  21. package/dist/adapters/docker/adapter.js.map +1 -1
  22. package/dist/adapters/docker/owner.d.ts +2 -5
  23. package/dist/adapters/docker/owner.d.ts.map +1 -1
  24. package/dist/adapters/docker/owner.js +5 -5
  25. package/dist/adapters/docker/owner.js.map +1 -1
  26. package/dist/adapters/git/adapter.d.ts +9 -7
  27. package/dist/adapters/git/adapter.d.ts.map +1 -1
  28. package/dist/adapters/git/adapter.js +118 -220
  29. package/dist/adapters/git/adapter.js.map +1 -1
  30. package/dist/adapters/git/inventory-command.d.ts +5 -0
  31. package/dist/adapters/git/inventory-command.d.ts.map +1 -0
  32. package/dist/adapters/git/inventory-command.js +31 -0
  33. package/dist/adapters/git/inventory-command.js.map +1 -0
  34. package/dist/adapters/git/refs.d.ts +3 -1
  35. package/dist/adapters/git/refs.d.ts.map +1 -1
  36. package/dist/adapters/git/refs.js +10 -4
  37. package/dist/adapters/git/refs.js.map +1 -1
  38. package/dist/adapters/git/worktree-admin-size.d.ts +3 -0
  39. package/dist/adapters/git/worktree-admin-size.d.ts.map +1 -0
  40. package/dist/adapters/git/worktree-admin-size.js +72 -0
  41. package/dist/adapters/git/worktree-admin-size.js.map +1 -0
  42. package/dist/adapters/grok-maintenance.d.ts +1 -0
  43. package/dist/adapters/grok-maintenance.d.ts.map +1 -1
  44. package/dist/adapters/grok-maintenance.js +24 -0
  45. package/dist/adapters/grok-maintenance.js.map +1 -1
  46. package/dist/adapters/openclaw-database.d.ts +27 -0
  47. package/dist/adapters/openclaw-database.d.ts.map +1 -0
  48. package/dist/adapters/openclaw-database.js +148 -0
  49. package/dist/adapters/openclaw-database.js.map +1 -0
  50. package/dist/adapters/openclaw-ownership.d.ts +29 -0
  51. package/dist/adapters/openclaw-ownership.d.ts.map +1 -0
  52. package/dist/adapters/openclaw-ownership.js +155 -0
  53. package/dist/adapters/openclaw-ownership.js.map +1 -0
  54. package/dist/adapters/openclaw.d.ts +12 -0
  55. package/dist/adapters/openclaw.d.ts.map +1 -0
  56. package/dist/adapters/openclaw.js +306 -0
  57. package/dist/adapters/openclaw.js.map +1 -0
  58. package/dist/adapters/provider-adapter.d.ts +4 -2
  59. package/dist/adapters/provider-adapter.d.ts.map +1 -1
  60. package/dist/adapters/provider-adapter.js +91 -424
  61. package/dist/adapters/provider-adapter.js.map +1 -1
  62. package/dist/adapters/provider-file-classification.d.ts +6 -0
  63. package/dist/adapters/provider-file-classification.d.ts.map +1 -0
  64. package/dist/adapters/provider-file-classification.js +64 -0
  65. package/dist/adapters/provider-file-classification.js.map +1 -0
  66. package/dist/adapters/provider-file-discovery.d.ts +17 -0
  67. package/dist/adapters/provider-file-discovery.d.ts.map +1 -0
  68. package/dist/adapters/provider-file-discovery.js +143 -0
  69. package/dist/adapters/provider-file-discovery.js.map +1 -0
  70. package/dist/adapters/provider-reachability.d.ts.map +1 -1
  71. package/dist/adapters/provider-reachability.js +35 -2
  72. package/dist/adapters/provider-reachability.js.map +1 -1
  73. package/dist/adapters/provider-root.d.ts.map +1 -1
  74. package/dist/adapters/provider-root.js +27 -23
  75. package/dist/adapters/provider-root.js.map +1 -1
  76. package/dist/adapters/provider-specs.d.ts +4 -14
  77. package/dist/adapters/provider-specs.d.ts.map +1 -1
  78. package/dist/adapters/provider-specs.js +20 -204
  79. package/dist/adapters/provider-specs.js.map +1 -1
  80. package/dist/adapters/registry.d.ts +1 -0
  81. package/dist/adapters/registry.d.ts.map +1 -1
  82. package/dist/adapters/registry.js +12 -6
  83. package/dist/adapters/registry.js.map +1 -1
  84. package/dist/adapters/report-only-finding.d.ts +8 -0
  85. package/dist/adapters/report-only-finding.d.ts.map +1 -0
  86. package/dist/adapters/report-only-finding.js +22 -0
  87. package/dist/adapters/report-only-finding.js.map +1 -0
  88. package/dist/adapters/runtime/adapter.d.ts +2 -0
  89. package/dist/adapters/runtime/adapter.d.ts.map +1 -1
  90. package/dist/adapters/runtime/adapter.js +37 -40
  91. package/dist/adapters/runtime/adapter.js.map +1 -1
  92. package/dist/commands/adapters.d.ts.map +1 -1
  93. package/dist/commands/adapters.js +3 -1
  94. package/dist/commands/adapters.js.map +1 -1
  95. package/dist/commands/apply.d.ts.map +1 -1
  96. package/dist/commands/apply.js +2 -1
  97. package/dist/commands/apply.js.map +1 -1
  98. package/dist/commands/audit.d.ts +3 -0
  99. package/dist/commands/audit.d.ts.map +1 -1
  100. package/dist/commands/audit.js +48 -11
  101. package/dist/commands/audit.js.map +1 -1
  102. package/dist/commands/clean.d.ts +8 -1
  103. package/dist/commands/clean.d.ts.map +1 -1
  104. package/dist/commands/clean.js +86 -34
  105. package/dist/commands/clean.js.map +1 -1
  106. package/dist/commands/completion.d.ts +2 -1
  107. package/dist/commands/completion.d.ts.map +1 -1
  108. package/dist/commands/completion.js +8 -3
  109. package/dist/commands/completion.js.map +1 -1
  110. package/dist/commands/doctor.d.ts.map +1 -1
  111. package/dist/commands/doctor.js +28 -6
  112. package/dist/commands/doctor.js.map +1 -1
  113. package/dist/commands/git-inventory.d.ts +154 -0
  114. package/dist/commands/git-inventory.d.ts.map +1 -0
  115. package/dist/commands/git-inventory.js +350 -0
  116. package/dist/commands/git-inventory.js.map +1 -0
  117. package/dist/commands/history.d.ts +0 -1
  118. package/dist/commands/history.d.ts.map +1 -1
  119. package/dist/commands/history.js +1 -1
  120. package/dist/commands/history.js.map +1 -1
  121. package/dist/commands/purge.d.ts.map +1 -1
  122. package/dist/commands/purge.js +2 -1
  123. package/dist/commands/purge.js.map +1 -1
  124. package/dist/commands/show.d.ts +0 -1
  125. package/dist/commands/show.d.ts.map +1 -1
  126. package/dist/commands/show.js +3 -2
  127. package/dist/commands/show.js.map +1 -1
  128. package/dist/commands/storage-output.d.ts +5 -0
  129. package/dist/commands/storage-output.d.ts.map +1 -0
  130. package/dist/commands/storage-output.js +91 -0
  131. package/dist/commands/storage-output.js.map +1 -0
  132. package/dist/commands/storage-rules.d.ts +178 -0
  133. package/dist/commands/storage-rules.d.ts.map +1 -0
  134. package/dist/commands/storage-rules.js +35 -0
  135. package/dist/commands/storage-rules.js.map +1 -0
  136. package/dist/commands/storage-selection.d.ts +24 -0
  137. package/dist/commands/storage-selection.d.ts.map +1 -0
  138. package/dist/commands/storage-selection.js +52 -0
  139. package/dist/commands/storage-selection.js.map +1 -0
  140. package/dist/commands/storage.d.ts +107 -0
  141. package/dist/commands/storage.d.ts.map +1 -0
  142. package/dist/commands/storage.js +205 -0
  143. package/dist/commands/storage.js.map +1 -0
  144. package/dist/commands/undo.d.ts +1 -1
  145. package/dist/commands/undo.d.ts.map +1 -1
  146. package/dist/commands/undo.js +1 -1
  147. package/dist/commands/undo.js.map +1 -1
  148. package/dist/commands/worktree-grades.d.ts +13 -0
  149. package/dist/commands/worktree-grades.d.ts.map +1 -0
  150. package/dist/commands/worktree-grades.js +304 -0
  151. package/dist/commands/worktree-grades.js.map +1 -0
  152. package/dist/commands/worktree-lifecycle.d.ts +41 -0
  153. package/dist/commands/worktree-lifecycle.d.ts.map +1 -0
  154. package/dist/commands/worktree-lifecycle.js +97 -0
  155. package/dist/commands/worktree-lifecycle.js.map +1 -0
  156. package/dist/commands/worktrees.d.ts +86 -0
  157. package/dist/commands/worktrees.d.ts.map +1 -0
  158. package/dist/commands/worktrees.js +450 -0
  159. package/dist/commands/worktrees.js.map +1 -0
  160. package/dist/config/defaults.d.ts +4 -0
  161. package/dist/config/defaults.d.ts.map +1 -1
  162. package/dist/config/defaults.js +10 -4
  163. package/dist/config/defaults.js.map +1 -1
  164. package/dist/config/schema.d.ts +15 -4
  165. package/dist/config/schema.d.ts.map +1 -1
  166. package/dist/config/schema.js +24 -16
  167. package/dist/config/schema.js.map +1 -1
  168. package/dist/contracts/action.d.ts +64 -0
  169. package/dist/contracts/action.d.ts.map +1 -1
  170. package/dist/contracts/action.js +5 -12
  171. package/dist/contracts/action.js.map +1 -1
  172. package/dist/contracts/adapter.d.ts +6 -1
  173. package/dist/contracts/adapter.d.ts.map +1 -1
  174. package/dist/contracts/diagnostic.d.ts +2 -1
  175. package/dist/contracts/diagnostic.d.ts.map +1 -1
  176. package/dist/contracts/diagnostic.js +1 -1
  177. package/dist/contracts/diagnostic.js.map +1 -1
  178. package/dist/contracts/finding.d.ts +31 -2
  179. package/dist/contracts/finding.d.ts.map +1 -1
  180. package/dist/contracts/finding.js +2 -8
  181. package/dist/contracts/finding.js.map +1 -1
  182. package/dist/contracts/plan.d.ts +28 -0
  183. package/dist/contracts/plan.d.ts.map +1 -1
  184. package/dist/contracts/provider-file-quarantine.d.ts +8 -0
  185. package/dist/contracts/provider-file-quarantine.d.ts.map +1 -1
  186. package/dist/contracts/report.d.ts +30 -1
  187. package/dist/contracts/report.d.ts.map +1 -1
  188. package/dist/contracts/report.js +1 -7
  189. package/dist/contracts/report.js.map +1 -1
  190. package/dist/contracts/run.d.ts +3 -2
  191. package/dist/contracts/run.d.ts.map +1 -1
  192. package/dist/contracts/run.js +2 -2
  193. package/dist/contracts/run.js.map +1 -1
  194. package/dist/core/apply.d.ts +2 -0
  195. package/dist/core/apply.d.ts.map +1 -1
  196. package/dist/core/apply.js +55 -2
  197. package/dist/core/apply.js.map +1 -1
  198. package/dist/core/artifact-executor.d.ts +4 -4
  199. package/dist/core/artifact-executor.d.ts.map +1 -1
  200. package/dist/core/artifact-executor.js +67 -13
  201. package/dist/core/artifact-executor.js.map +1 -1
  202. package/dist/core/artifact-git-state.d.ts +13 -0
  203. package/dist/core/artifact-git-state.d.ts.map +1 -0
  204. package/dist/core/artifact-git-state.js +65 -0
  205. package/dist/core/artifact-git-state.js.map +1 -0
  206. package/dist/core/artifact-measurement.d.ts +5 -0
  207. package/dist/core/artifact-measurement.d.ts.map +1 -0
  208. package/dist/core/artifact-measurement.js +28 -0
  209. package/dist/core/artifact-measurement.js.map +1 -0
  210. package/dist/core/artifact-protection.d.ts +5 -0
  211. package/dist/core/artifact-protection.d.ts.map +1 -0
  212. package/dist/core/artifact-protection.js +54 -0
  213. package/dist/core/artifact-protection.js.map +1 -0
  214. package/dist/core/artifact-revalidation.d.ts.map +1 -1
  215. package/dist/core/artifact-revalidation.js +26 -5
  216. package/dist/core/artifact-revalidation.js.map +1 -1
  217. package/dist/core/audit.d.ts +33 -0
  218. package/dist/core/audit.d.ts.map +1 -1
  219. package/dist/core/audit.js +294 -4
  220. package/dist/core/audit.js.map +1 -1
  221. package/dist/core/bounded-command.d.ts +1 -0
  222. package/dist/core/bounded-command.d.ts.map +1 -1
  223. package/dist/core/bounded-command.js +10 -1
  224. package/dist/core/bounded-command.js.map +1 -1
  225. package/dist/core/database-revalidation.d.ts +0 -1
  226. package/dist/core/database-revalidation.d.ts.map +1 -1
  227. package/dist/core/database-revalidation.js +1 -1
  228. package/dist/core/database-revalidation.js.map +1 -1
  229. package/dist/core/directory-change-proof.d.ts +12 -0
  230. package/dist/core/directory-change-proof.d.ts.map +1 -0
  231. package/dist/core/directory-change-proof.js +55 -0
  232. package/dist/core/directory-change-proof.js.map +1 -0
  233. package/dist/core/git-operation-state.d.ts +0 -1
  234. package/dist/core/git-operation-state.d.ts.map +1 -1
  235. package/dist/core/git-operation-state.js +1 -1
  236. package/dist/core/git-operation-state.js.map +1 -1
  237. package/dist/core/measure.d.ts +20 -1
  238. package/dist/core/measure.d.ts.map +1 -1
  239. package/dist/core/measure.js +57 -9
  240. package/dist/core/measure.js.map +1 -1
  241. package/dist/core/no-clobber-rename.d.ts +1 -0
  242. package/dist/core/no-clobber-rename.d.ts.map +1 -1
  243. package/dist/core/no-clobber-rename.js +12 -5
  244. package/dist/core/no-clobber-rename.js.map +1 -1
  245. package/dist/core/pinned-file.d.ts +2 -1
  246. package/dist/core/pinned-file.d.ts.map +1 -1
  247. package/dist/core/pinned-file.js +1 -1
  248. package/dist/core/pinned-file.js.map +1 -1
  249. package/dist/core/plan.d.ts.map +1 -1
  250. package/dist/core/plan.js +15 -6
  251. package/dist/core/plan.js.map +1 -1
  252. package/dist/core/process-ownership.d.ts +3 -0
  253. package/dist/core/process-ownership.d.ts.map +1 -1
  254. package/dist/core/process-ownership.js +42 -19
  255. package/dist/core/process-ownership.js.map +1 -1
  256. package/dist/core/project-file.d.ts +6 -0
  257. package/dist/core/project-file.d.ts.map +1 -0
  258. package/dist/core/project-file.js +46 -0
  259. package/dist/core/project-file.js.map +1 -0
  260. package/dist/core/provider-file-identity.d.ts +1 -1
  261. package/dist/core/provider-file-identity.d.ts.map +1 -1
  262. package/dist/core/provider-file-identity.js +9 -1
  263. package/dist/core/provider-file-identity.js.map +1 -1
  264. package/dist/core/provider-file-policy.d.ts +3 -31
  265. package/dist/core/provider-file-policy.d.ts.map +1 -1
  266. package/dist/core/provider-file-policy.js +31 -95
  267. package/dist/core/provider-file-policy.js.map +1 -1
  268. package/dist/core/provider-file-revalidation.d.ts.map +1 -1
  269. package/dist/core/provider-file-revalidation.js +5 -1
  270. package/dist/core/provider-file-revalidation.js.map +1 -1
  271. package/dist/core/provider-processes.d.ts.map +1 -1
  272. package/dist/core/provider-processes.js +7 -0
  273. package/dist/core/provider-processes.js.map +1 -1
  274. package/dist/core/reachability.d.ts +1 -0
  275. package/dist/core/reachability.d.ts.map +1 -1
  276. package/dist/core/reachability.js +17 -10
  277. package/dist/core/reachability.js.map +1 -1
  278. package/dist/core/redaction.d.ts.map +1 -1
  279. package/dist/core/redaction.js +1 -0
  280. package/dist/core/redaction.js.map +1 -1
  281. package/dist/core/safety.js +2 -2
  282. package/dist/core/safety.js.map +1 -1
  283. package/dist/core/storage-area.d.ts +20 -0
  284. package/dist/core/storage-area.d.ts.map +1 -0
  285. package/dist/core/storage-area.js +67 -0
  286. package/dist/core/storage-area.js.map +1 -0
  287. package/dist/core/storage-measurement.d.ts +12 -0
  288. package/dist/core/storage-measurement.d.ts.map +1 -0
  289. package/dist/core/storage-measurement.js +87 -0
  290. package/dist/core/storage-measurement.js.map +1 -0
  291. package/dist/core/storage-mounts.d.ts +14 -0
  292. package/dist/core/storage-mounts.d.ts.map +1 -0
  293. package/dist/core/storage-mounts.js +172 -0
  294. package/dist/core/storage-mounts.js.map +1 -0
  295. package/dist/core/storage-observation.d.ts +45 -0
  296. package/dist/core/storage-observation.d.ts.map +1 -0
  297. package/dist/core/storage-observation.js +136 -0
  298. package/dist/core/storage-observation.js.map +1 -0
  299. package/dist/core/worktree-purge.d.ts +7 -0
  300. package/dist/core/worktree-purge.d.ts.map +1 -0
  301. package/dist/core/worktree-purge.js +281 -0
  302. package/dist/core/worktree-purge.js.map +1 -0
  303. package/dist/core/worktree-recovery-validation.d.ts +9 -0
  304. package/dist/core/worktree-recovery-validation.d.ts.map +1 -0
  305. package/dist/core/worktree-recovery-validation.js +215 -0
  306. package/dist/core/worktree-recovery-validation.js.map +1 -0
  307. package/dist/core/worktree-recovery.d.ts +17 -5
  308. package/dist/core/worktree-recovery.d.ts.map +1 -1
  309. package/dist/core/worktree-recovery.js +16 -843
  310. package/dist/core/worktree-recovery.js.map +1 -1
  311. package/dist/core/worktree-undo.d.ts +4 -0
  312. package/dist/core/worktree-undo.d.ts.map +1 -0
  313. package/dist/core/worktree-undo.js +328 -0
  314. package/dist/core/worktree-undo.js.map +1 -0
  315. package/dist/main.d.ts.map +1 -1
  316. package/dist/main.js +104 -8
  317. package/dist/main.js.map +1 -1
  318. package/dist/output.d.ts +5 -0
  319. package/dist/output.d.ts.map +1 -1
  320. package/dist/output.js +11 -0
  321. package/dist/output.js.map +1 -1
  322. package/dist/rules/build/cache-tag.d.ts +3 -0
  323. package/dist/rules/build/cache-tag.d.ts.map +1 -0
  324. package/dist/rules/build/cache-tag.js +19 -0
  325. package/dist/rules/build/cache-tag.js.map +1 -0
  326. package/dist/rules/build/inspection.d.ts +14 -0
  327. package/dist/rules/build/inspection.d.ts.map +1 -0
  328. package/dist/rules/build/inspection.js +99 -0
  329. package/dist/rules/build/inspection.js.map +1 -0
  330. package/dist/rules/build/project-cache.d.ts +302 -0
  331. package/dist/rules/build/project-cache.d.ts.map +1 -0
  332. package/dist/rules/build/project-cache.js +115 -0
  333. package/dist/rules/build/project-cache.js.map +1 -0
  334. package/dist/rules/builtin.generated.d.ts +77 -0
  335. package/dist/rules/builtin.generated.d.ts.map +1 -0
  336. package/dist/rules/builtin.generated.js +35 -0
  337. package/dist/rules/builtin.generated.js.map +1 -0
  338. package/dist/rules/claude/changelog-cache.json +24 -0
  339. package/dist/rules/claude/debug-log.json +28 -0
  340. package/dist/rules/claude/inventory.d.ts +3 -0
  341. package/dist/rules/claude/inventory.d.ts.map +1 -0
  342. package/dist/rules/claude/inventory.js +37 -0
  343. package/dist/rules/claude/inventory.js.map +1 -0
  344. package/dist/rules/claude/native-maintenance.d.ts +5 -0
  345. package/dist/rules/claude/native-maintenance.d.ts.map +1 -0
  346. package/dist/rules/claude/native-maintenance.js +24 -0
  347. package/dist/rules/claude/native-maintenance.js.map +1 -0
  348. package/dist/rules/claude/project-registration.d.ts +10 -0
  349. package/dist/rules/claude/project-registration.d.ts.map +1 -0
  350. package/dist/rules/claude/project-registration.js +28 -0
  351. package/dist/rules/claude/project-registration.js.map +1 -0
  352. package/dist/rules/codex/database-vacuum.d.ts +5 -0
  353. package/dist/rules/codex/database-vacuum.d.ts.map +1 -0
  354. package/dist/rules/codex/database-vacuum.js +115 -0
  355. package/dist/rules/codex/database-vacuum.js.map +1 -0
  356. package/dist/rules/codex/inventory.d.ts +3 -0
  357. package/dist/rules/codex/inventory.d.ts.map +1 -0
  358. package/dist/rules/codex/inventory.js +46 -0
  359. package/dist/rules/codex/inventory.js.map +1 -0
  360. package/dist/rules/codex/storage-databases.d.ts +2 -0
  361. package/dist/rules/codex/storage-databases.d.ts.map +1 -0
  362. package/dist/rules/codex/storage-databases.js +5 -0
  363. package/dist/rules/codex/storage-databases.js.map +1 -0
  364. package/dist/rules/copilot/inventory.d.ts +3 -0
  365. package/dist/rules/copilot/inventory.d.ts.map +1 -0
  366. package/dist/rules/copilot/inventory.js +22 -0
  367. package/dist/rules/copilot/inventory.js.map +1 -0
  368. package/dist/rules/copilot/native-maintenance.d.ts +5 -0
  369. package/dist/rules/copilot/native-maintenance.d.ts.map +1 -0
  370. package/dist/rules/copilot/native-maintenance.js +21 -0
  371. package/dist/rules/copilot/native-maintenance.js.map +1 -0
  372. package/dist/rules/cursor/inventory.d.ts +3 -0
  373. package/dist/rules/cursor/inventory.d.ts.map +1 -0
  374. package/dist/rules/cursor/inventory.js +34 -0
  375. package/dist/rules/cursor/inventory.js.map +1 -0
  376. package/dist/rules/cursor/native-maintenance.d.ts +5 -0
  377. package/dist/rules/cursor/native-maintenance.d.ts.map +1 -0
  378. package/dist/rules/cursor/native-maintenance.js +18 -0
  379. package/dist/rules/cursor/native-maintenance.js.map +1 -0
  380. package/dist/rules/docker/build-cache.d.ts +5 -0
  381. package/dist/rules/docker/build-cache.d.ts.map +1 -0
  382. package/dist/rules/docker/build-cache.js +43 -0
  383. package/dist/rules/docker/build-cache.js.map +1 -0
  384. package/dist/rules/file-rule.d.ts +190 -0
  385. package/dist/rules/file-rule.d.ts.map +1 -0
  386. package/dist/rules/file-rule.js +71 -0
  387. package/dist/rules/file-rule.js.map +1 -0
  388. package/dist/rules/git/inventory-bytes.d.ts +95 -0
  389. package/dist/rules/git/inventory-bytes.d.ts.map +1 -0
  390. package/dist/rules/git/inventory-bytes.js +134 -0
  391. package/dist/rules/git/inventory-bytes.js.map +1 -0
  392. package/dist/rules/git/inventory-lifecycle.d.ts +60 -0
  393. package/dist/rules/git/inventory-lifecycle.d.ts.map +1 -0
  394. package/dist/rules/git/inventory-lifecycle.js +171 -0
  395. package/dist/rules/git/inventory-lifecycle.js.map +1 -0
  396. package/dist/rules/git/inventory-loose.d.ts +15 -0
  397. package/dist/rules/git/inventory-loose.d.ts.map +1 -0
  398. package/dist/rules/git/inventory-loose.js +103 -0
  399. package/dist/rules/git/inventory-loose.js.map +1 -0
  400. package/dist/rules/git/inventory-owner.d.ts +55 -0
  401. package/dist/rules/git/inventory-owner.d.ts.map +1 -0
  402. package/dist/rules/git/inventory-owner.js +96 -0
  403. package/dist/rules/git/inventory-owner.js.map +1 -0
  404. package/dist/rules/git/inventory-packs.d.ts +31 -0
  405. package/dist/rules/git/inventory-packs.d.ts.map +1 -0
  406. package/dist/rules/git/inventory-packs.js +162 -0
  407. package/dist/rules/git/inventory-packs.js.map +1 -0
  408. package/dist/rules/git/inventory-path.d.ts +3 -0
  409. package/dist/rules/git/inventory-path.d.ts.map +1 -0
  410. package/dist/rules/git/inventory-path.js +30 -0
  411. package/dist/rules/git/inventory-path.js.map +1 -0
  412. package/dist/rules/git/inventory-registrations.d.ts +31 -0
  413. package/dist/rules/git/inventory-registrations.d.ts.map +1 -0
  414. package/dist/rules/git/inventory-registrations.js +313 -0
  415. package/dist/rules/git/inventory-registrations.js.map +1 -0
  416. package/dist/rules/git/pack-storage.d.ts +23 -0
  417. package/dist/rules/git/pack-storage.d.ts.map +1 -0
  418. package/dist/rules/git/pack-storage.js +112 -0
  419. package/dist/rules/git/pack-storage.js.map +1 -0
  420. package/dist/rules/git/project-worktree-roots.d.ts +6 -0
  421. package/dist/rules/git/project-worktree-roots.d.ts.map +1 -0
  422. package/dist/rules/git/project-worktree-roots.js +35 -0
  423. package/dist/rules/git/project-worktree-roots.js.map +1 -0
  424. package/dist/rules/git/registration.d.ts +31 -0
  425. package/dist/rules/git/registration.d.ts.map +1 -0
  426. package/dist/rules/git/registration.js +53 -0
  427. package/dist/rules/git/registration.js.map +1 -0
  428. package/dist/rules/git/selected-binding.d.ts +14 -0
  429. package/dist/rules/git/selected-binding.d.ts.map +1 -0
  430. package/dist/rules/git/selected-binding.js +65 -0
  431. package/dist/rules/git/selected-binding.js.map +1 -0
  432. package/dist/rules/git/temporary-pack-header.d.ts +12 -0
  433. package/dist/rules/git/temporary-pack-header.d.ts.map +1 -0
  434. package/dist/rules/git/temporary-pack-header.js +62 -0
  435. package/dist/rules/git/temporary-pack-header.js.map +1 -0
  436. package/dist/rules/git/worktree.d.ts +5 -0
  437. package/dist/rules/git/worktree.d.ts.map +1 -0
  438. package/dist/rules/git/worktree.js +83 -0
  439. package/dist/rules/git/worktree.js.map +1 -0
  440. package/dist/rules/grok/inventory.d.ts +3 -0
  441. package/dist/rules/grok/inventory.d.ts.map +1 -0
  442. package/dist/rules/grok/inventory.js +42 -0
  443. package/dist/rules/grok/inventory.js.map +1 -0
  444. package/dist/rules/grok/native-maintenance.d.ts +5 -0
  445. package/dist/rules/grok/native-maintenance.d.ts.map +1 -0
  446. package/dist/rules/grok/native-maintenance.js +21 -0
  447. package/dist/rules/grok/native-maintenance.js.map +1 -0
  448. package/dist/rules/jiti/project-cache.d.ts +9 -0
  449. package/dist/rules/jiti/project-cache.d.ts.map +1 -0
  450. package/dist/rules/jiti/project-cache.js +9 -0
  451. package/dist/rules/jiti/project-cache.js.map +1 -0
  452. package/dist/rules/openclaw/crabbox-identity.d.ts +20 -0
  453. package/dist/rules/openclaw/crabbox-identity.d.ts.map +1 -0
  454. package/dist/rules/openclaw/crabbox-identity.js +84 -0
  455. package/dist/rules/openclaw/crabbox-identity.js.map +1 -0
  456. package/dist/rules/openclaw/crabbox-storage.d.ts +28 -0
  457. package/dist/rules/openclaw/crabbox-storage.d.ts.map +1 -0
  458. package/dist/rules/openclaw/crabbox-storage.js +201 -0
  459. package/dist/rules/openclaw/crabbox-storage.js.map +1 -0
  460. package/dist/rules/openclaw/inventory.d.ts +3 -0
  461. package/dist/rules/openclaw/inventory.d.ts.map +1 -0
  462. package/dist/rules/openclaw/inventory.js +35 -0
  463. package/dist/rules/openclaw/inventory.js.map +1 -0
  464. package/dist/rules/openclaw/profile.d.ts +2 -0
  465. package/dist/rules/openclaw/profile.d.ts.map +1 -0
  466. package/dist/rules/openclaw/profile.js +5 -0
  467. package/dist/rules/openclaw/profile.js.map +1 -0
  468. package/dist/rules/openclaw/shell-snapshot.json +24 -0
  469. package/dist/rules/openclaw/storage.d.ts +27 -0
  470. package/dist/rules/openclaw/storage.d.ts.map +1 -0
  471. package/dist/rules/openclaw/storage.js +125 -0
  472. package/dist/rules/openclaw/storage.js.map +1 -0
  473. package/dist/rules/opencode/inventory.d.ts +3 -0
  474. package/dist/rules/opencode/inventory.d.ts.map +1 -0
  475. package/dist/rules/opencode/inventory.js +26 -0
  476. package/dist/rules/opencode/inventory.js.map +1 -0
  477. package/dist/rules/opencode/native-maintenance.d.ts +5 -0
  478. package/dist/rules/opencode/native-maintenance.d.ts.map +1 -0
  479. package/dist/rules/opencode/native-maintenance.js +23 -0
  480. package/dist/rules/opencode/native-maintenance.js.map +1 -0
  481. package/dist/rules/provider.d.ts +20 -0
  482. package/dist/rules/provider.d.ts.map +1 -0
  483. package/dist/rules/provider.js +5 -0
  484. package/dist/rules/provider.js.map +1 -0
  485. package/dist/rules/runtime/tools.d.ts +30 -0
  486. package/dist/rules/runtime/tools.d.ts.map +1 -0
  487. package/dist/rules/runtime/tools.js +10 -0
  488. package/dist/rules/runtime/tools.js.map +1 -0
  489. package/dist/rules/schema.d.ts +130 -0
  490. package/dist/rules/schema.d.ts.map +1 -0
  491. package/dist/rules/schema.js +78 -0
  492. package/dist/rules/schema.js.map +1 -0
  493. package/dist/rules/storage/agent-and-system-storage.d.ts +3 -0
  494. package/dist/rules/storage/agent-and-system-storage.d.ts.map +1 -0
  495. package/dist/rules/storage/agent-and-system-storage.js +81 -0
  496. package/dist/rules/storage/agent-and-system-storage.js.map +1 -0
  497. package/dist/rules/storage/agents-locations.d.ts +2 -0
  498. package/dist/rules/storage/agents-locations.d.ts.map +1 -0
  499. package/dist/rules/storage/agents-locations.js +33 -0
  500. package/dist/rules/storage/agents-locations.js.map +1 -0
  501. package/dist/rules/storage/apple-system-locations.d.ts +2 -0
  502. package/dist/rules/storage/apple-system-locations.d.ts.map +1 -0
  503. package/dist/rules/storage/apple-system-locations.js +17 -0
  504. package/dist/rules/storage/apple-system-locations.js.map +1 -0
  505. package/dist/rules/storage/build-and-browser-caches.d.ts +3 -0
  506. package/dist/rules/storage/build-and-browser-caches.d.ts.map +1 -0
  507. package/dist/rules/storage/build-and-browser-caches.js +89 -0
  508. package/dist/rules/storage/build-and-browser-caches.js.map +1 -0
  509. package/dist/rules/storage/catalog.d.ts +16 -0
  510. package/dist/rules/storage/catalog.d.ts.map +1 -0
  511. package/dist/rules/storage/catalog.js +27 -0
  512. package/dist/rules/storage/catalog.js.map +1 -0
  513. package/dist/rules/storage/desktop-locations.d.ts +2 -0
  514. package/dist/rules/storage/desktop-locations.d.ts.map +1 -0
  515. package/dist/rules/storage/desktop-locations.js +59 -0
  516. package/dist/rules/storage/desktop-locations.js.map +1 -0
  517. package/dist/rules/storage/location.d.ts +15 -0
  518. package/dist/rules/storage/location.d.ts.map +1 -0
  519. package/dist/rules/storage/location.js +18 -0
  520. package/dist/rules/storage/location.js.map +1 -0
  521. package/dist/rules/storage/mobile-locations.d.ts +2 -0
  522. package/dist/rules/storage/mobile-locations.d.ts.map +1 -0
  523. package/dist/rules/storage/mobile-locations.js +43 -0
  524. package/dist/rules/storage/mobile-locations.js.map +1 -0
  525. package/dist/rules/storage/native-volume.d.ts +26 -0
  526. package/dist/rules/storage/native-volume.d.ts.map +1 -0
  527. package/dist/rules/storage/native-volume.js +111 -0
  528. package/dist/rules/storage/native-volume.js.map +1 -0
  529. package/dist/rules/storage/owner-evidence.d.ts +98 -0
  530. package/dist/rules/storage/owner-evidence.d.ts.map +1 -0
  531. package/dist/rules/storage/owner-evidence.js +120 -0
  532. package/dist/rules/storage/owner-evidence.js.map +1 -0
  533. package/dist/rules/storage/package-stores.d.ts +3 -0
  534. package/dist/rules/storage/package-stores.d.ts.map +1 -0
  535. package/dist/rules/storage/package-stores.js +84 -0
  536. package/dist/rules/storage/package-stores.js.map +1 -0
  537. package/dist/rules/storage/packages-locations.d.ts +2 -0
  538. package/dist/rules/storage/packages-locations.d.ts.map +1 -0
  539. package/dist/rules/storage/packages-locations.js +99 -0
  540. package/dist/rules/storage/packages-locations.js.map +1 -0
  541. package/dist/rules/storage/supplied-locations.d.ts +68 -0
  542. package/dist/rules/storage/supplied-locations.d.ts.map +1 -0
  543. package/dist/rules/storage/supplied-locations.js +86 -0
  544. package/dist/rules/storage/supplied-locations.js.map +1 -0
  545. package/dist/rules/storage/toolchains-locations.d.ts +2 -0
  546. package/dist/rules/storage/toolchains-locations.d.ts.map +1 -0
  547. package/dist/rules/storage/toolchains-locations.js +80 -0
  548. package/dist/rules/storage/toolchains-locations.js.map +1 -0
  549. package/dist/rules/vite/project-cache.d.ts +16 -0
  550. package/dist/rules/vite/project-cache.d.ts.map +1 -0
  551. package/dist/rules/vite/project-cache.js +19 -0
  552. package/dist/rules/vite/project-cache.js.map +1 -0
  553. package/dist/rules/zed/inventory.d.ts +3 -0
  554. package/dist/rules/zed/inventory.d.ts.map +1 -0
  555. package/dist/rules/zed/inventory.js +22 -0
  556. package/dist/rules/zed/inventory.js.map +1 -0
  557. package/dist/rules/zed/rotated-log.json +27 -0
  558. package/dist/version.d.ts +1 -1
  559. package/dist/version.js +1 -1
  560. package/package.json +16 -11
  561. package/schemas/audit.schema.json +138 -5
  562. package/schemas/cleanup-rule.schema.json +256 -0
  563. package/schemas/command-envelope.schema.json +2 -2
  564. package/schemas/command-event.schema.json +1 -1
  565. package/schemas/database-backup.schema.json +4 -4
  566. package/schemas/doctor.schema.json +1 -1
  567. package/schemas/plan.schema.json +136 -3
  568. package/schemas/provider-file-quarantine.schema.json +1534 -549
  569. package/schemas/quarantine.schema.json +5 -4
  570. package/schemas/run.schema.json +10 -10
  571. package/skills/agentrinse/SKILL.md +31 -0
  572. package/dist/adapters/claude-cache.d.ts +0 -3
  573. package/dist/adapters/claude-cache.d.ts.map +0 -1
  574. package/dist/adapters/claude-cache.js +0 -67
  575. package/dist/adapters/claude-cache.js.map +0 -1
  576. package/dist/adapters/claude-debug.d.ts +0 -3
  577. package/dist/adapters/claude-debug.d.ts.map +0 -1
  578. package/dist/adapters/claude-debug.js +0 -100
  579. package/dist/adapters/claude-debug.js.map +0 -1
  580. package/dist/adapters/zed-logs.d.ts +0 -8
  581. package/dist/adapters/zed-logs.d.ts.map +0 -1
  582. package/dist/adapters/zed-logs.js +0 -103
  583. package/dist/adapters/zed-logs.js.map +0 -1
@@ -1,23 +1,20 @@
1
+ import { collectProviderFiles } from "./provider-file-discovery.js";
1
2
  import { lstat } from "node:fs/promises";
2
3
  import { join, resolve } from "node:path";
3
- import { databaseIdentitySchema, providerFileQuarantineActionSchema, providerFileIdentitySchema, } from "../contracts/action.js";
4
+ import { reportOnlyFinding } from "./report-only-finding.js";
4
5
  import { sha256 } from "../core/digest.js";
5
6
  import { measurePath } from "../core/measure.js";
6
- import { PROVIDER_FILE_POLICIES } from "../core/provider-file-policy.js";
7
- import { codexDatabaseContractMatches, inspectCodexDatabase, inspectCodexProcesses, inspectDatabaseOpenHandles, } from "./codex-database.js";
8
- import { collectClaudeChangelogCache } from "./claude-cache.js";
9
- import { collectClaudeDebugLogs } from "./claude-debug.js";
10
- import { claudeNativeRetentionFactsSchema, inspectClaudeNativeRetention, usesClaudeNativeRetention, } from "./claude-retention.js";
11
- import { copilotNativeMaintenanceFactsSchema, copilotNativeMaintenanceFor, } from "./copilot-maintenance.js";
12
- import { cursorNativeMaintenanceFactsSchema, cursorNativeMaintenanceFor, inspectCursorDatabaseCompanions, inspectCursorDatabaseParents, } from "./cursor-maintenance.js";
13
- import { grokOwnerContractFactsSchema, inspectGrokOwnerContract, } from "./grok-maintenance.js";
14
- import { opencodeNativeMaintenanceFactsSchema, opencodeNativeMaintenanceFor, } from "./opencode-maintenance.js";
7
+ import { classifyProviderFile } from "./provider-file-classification.js";
8
+ import { inspectCodexDatabase, inspectCodexProcesses, inspectDatabaseOpenHandles, } from "./codex-database.js";
9
+ import { inspectClaudeNativeRetention, usesClaudeNativeRetention } from "./claude-retention.js";
10
+ import { copilotNativeMaintenanceFor } from "./copilot-maintenance.js";
11
+ import { cursorNativeMaintenanceFor, inspectCursorDatabaseCompanions, inspectCursorDatabaseParents, } from "./cursor-maintenance.js";
12
+ import { inspectGrokOwnerContract } from "./grok-maintenance.js";
13
+ import { opencodeNativeMaintenanceFor } from "./opencode-maintenance.js";
15
14
  import { collectProviderReachability } from "./provider-reachability.js";
15
+ import { collectOpenClaw } from "./openclaw.js";
16
+ import { OPENCLAW_OWNER_UNKNOWN } from "./openclaw-ownership.js";
16
17
  import { resolveProviderRoot } from "./provider-root.js";
17
- import { collectZedRotatedLog } from "./zed-logs.js";
18
- const DATABASE_RECLAIM_THRESHOLD_BYTES = 512 * 1024 * 1024;
19
- const DATABASE_RECLAIM_RATIO = 0.25;
20
- const DATABASE_BACKUP_TTL_MINUTES = 7 * 24 * 60;
21
18
  function isMissing(error) {
22
19
  return (error instanceof Error && "code" in error && error.code === "ENOENT");
23
20
  }
@@ -33,6 +30,15 @@ export class ProviderAuditAdapter {
33
30
  root(context) {
34
31
  return resolveProviderRoot(this.spec, context.home, this.options);
35
32
  }
33
+ markDiscoveryIncomplete() {
34
+ if (this.id === "codex" || this.id === "claude" || this.id === "openclaw") {
35
+ this.options.reachability?.addGlobal({
36
+ code: "unknown-provider-state",
37
+ source: this.id,
38
+ detail: "Provider workspace ownership discovery did not complete.",
39
+ });
40
+ }
41
+ }
36
42
  async probe(context) {
37
43
  let root;
38
44
  try {
@@ -121,8 +127,15 @@ export class ProviderAuditAdapter {
121
127
  };
122
128
  }
123
129
  }
124
- async collect(context, probe) {
130
+ async collect(context, probe, observer) {
125
131
  if (probe.status !== "available" || probe.root === undefined) {
132
+ if (this.id === "openclaw" && probe.status === "degraded") {
133
+ this.options.reachability?.addGlobal({
134
+ code: OPENCLAW_OWNER_UNKNOWN,
135
+ source: this.id,
136
+ detail: "OpenClaw ownership could not be inspected.",
137
+ });
138
+ }
126
139
  if (probe.status === "degraded" &&
127
140
  this.options.reachability !== undefined &&
128
141
  (this.spec.id === "codex" || this.spec.id === "claude")) {
@@ -132,34 +145,64 @@ export class ProviderAuditAdapter {
132
145
  detail: `${this.spec.displayName} ownership metadata could not be inspected.`,
133
146
  });
134
147
  }
135
- if (this.spec.id === "zed" &&
136
- probe.status === "absent" &&
148
+ if (probe.status === "absent" &&
149
+ this.options.quickInventory !== true &&
137
150
  this.options.inventoryResources !== false) {
138
- return collectZedRotatedLog(context, {
139
- ...(this.options.root === undefined ? {} : { root: this.options.root }),
140
- ...(this.options.platform === undefined ? {} : { platform: this.options.platform }),
141
- ...(this.options.environment === undefined
142
- ? {}
143
- : { environment: this.options.environment }),
144
- });
151
+ const collection = await collectProviderFiles(this.spec.id, context, this.options);
152
+ for (const resource of collection.resources) {
153
+ observer?.reportResource(resource);
154
+ }
155
+ for (const diagnostic of collection.diagnostics) {
156
+ observer?.reportDiagnostic(diagnostic);
157
+ }
158
+ return collection;
145
159
  }
146
160
  return { resources: [], diagnostics: [] };
147
161
  }
148
162
  const resources = [];
149
163
  const diagnostics = [];
164
+ const addResources = (...reportedResources) => {
165
+ resources.push(...reportedResources);
166
+ for (const resource of reportedResources) {
167
+ observer?.reportResource(resource);
168
+ }
169
+ };
170
+ const addDiagnostics = (...reportedDiagnostics) => {
171
+ diagnostics.push(...reportedDiagnostics);
172
+ for (const diagnostic of reportedDiagnostics) {
173
+ observer?.reportDiagnostic(diagnostic);
174
+ }
175
+ };
176
+ if (this.id === "openclaw" && this.options.quickInventory !== true) {
177
+ try {
178
+ await collectOpenClaw(context, probe.root, this.options, {
179
+ reportResource: addResources,
180
+ reportDiagnostic: addDiagnostics,
181
+ });
182
+ }
183
+ catch (error) {
184
+ this.options.reachability?.addGlobal({
185
+ code: OPENCLAW_OWNER_UNKNOWN,
186
+ source: this.id,
187
+ detail: "OpenClaw inventory did not complete.",
188
+ });
189
+ throw error;
190
+ }
191
+ return { resources, diagnostics };
192
+ }
150
193
  if (this.options.reachability !== undefined) {
151
- diagnostics.push(...(await collectProviderReachability(this.spec.id, context, probe.root, this.options.reachability)));
194
+ addDiagnostics(...(await collectProviderReachability(this.spec.id, context, probe.root, this.options.reachability)));
152
195
  }
153
196
  if (this.options.inventoryResources === false) {
154
197
  return { resources: [], diagnostics };
155
198
  }
156
- const claudeRetention = this.spec.id === "claude"
199
+ const claudeRetention = this.options.quickInventory !== true && this.spec.id === "claude"
157
200
  ? await inspectClaudeNativeRetention(probe.root, this.options.platform ?? process.platform)
158
201
  : undefined;
159
202
  if (claudeRetention !== undefined) {
160
- diagnostics.push(...claudeRetention.diagnostics);
203
+ addDiagnostics(...claudeRetention.diagnostics);
161
204
  }
162
- const grokOwnerContract = this.spec.id === "grok"
205
+ const grokOwnerContract = this.options.quickInventory !== true && this.spec.id === "grok"
163
206
  ? await inspectGrokOwnerContract(probe.root, this.options.environment ?? process.env, this.options.platform ?? process.platform, this.options.runGrokVersion)
164
207
  : undefined;
165
208
  const candidates = grokOwnerContract !== undefined && grokOwnerContract.installedVersionStatus !== "exact"
@@ -174,13 +217,15 @@ export class ProviderAuditAdapter {
174
217
  for (const candidate of candidates) {
175
218
  context.signal?.throwIfAborted();
176
219
  const path = candidate.relativePath === "." ? probe.root : join(probe.root, candidate.relativePath);
177
- const copilotNativeMaintenance = this.spec.id === "copilot"
220
+ const copilotNativeMaintenance = this.options.quickInventory !== true && this.spec.id === "copilot"
178
221
  ? copilotNativeMaintenanceFor(candidate.relativePath)
179
222
  : undefined;
180
- const opencodeNativeMaintenance = this.spec.id === "opencode"
223
+ const opencodeNativeMaintenance = this.options.quickInventory !== true && this.spec.id === "opencode"
181
224
  ? opencodeNativeMaintenanceFor(candidate.relativePath)
182
225
  : undefined;
183
- const cursorNativeMaintenance = this.spec.id === "cursor" ? cursorNativeMaintenanceFor(candidate.relativePath) : undefined;
226
+ const cursorNativeMaintenance = this.options.quickInventory !== true && this.spec.id === "cursor"
227
+ ? cursorNativeMaintenanceFor(candidate.relativePath)
228
+ : undefined;
184
229
  const canonicalKey = `${this.id}:${candidate.kind}:${resolve(path)}`;
185
230
  const resourceId = `${this.id}:${candidate.kind}:${sha256(canonicalKey)}`;
186
231
  if (cursorNativeMaintenance !== undefined) {
@@ -189,7 +234,7 @@ export class ProviderAuditAdapter {
189
234
  continue;
190
235
  }
191
236
  if (parentInspection.status === "blocked") {
192
- diagnostics.push({
237
+ addDiagnostics({
193
238
  severity: "warning",
194
239
  code: parentInspection.code === "symlink"
195
240
  ? "RESOURCE_PARENT_SYMLINK_SKIPPED"
@@ -203,7 +248,7 @@ export class ProviderAuditAdapter {
203
248
  try {
204
249
  const stats = await lstat(path);
205
250
  if (stats.isSymbolicLink()) {
206
- diagnostics.push({
251
+ addDiagnostics({
207
252
  severity: "warning",
208
253
  code: "RESOURCE_SYMLINK_SKIPPED",
209
254
  message: "A provider resource symlink was not followed.",
@@ -232,7 +277,7 @@ export class ProviderAuditAdapter {
232
277
  const cursorDatabaseCompanions = cursorNativeMaintenance === undefined
233
278
  ? undefined
234
279
  : await inspectCursorDatabaseCompanions(path, this.options.measureBytes);
235
- resources.push({
280
+ addResources({
236
281
  resource: {
237
282
  id: resourceId,
238
283
  adapter: this.id,
@@ -292,7 +337,7 @@ export class ProviderAuditAdapter {
292
337
  if (cursorNativeMaintenance !== undefined) {
293
338
  const cursorDatabaseCompanions = await inspectCursorDatabaseCompanions(path, this.options.measureBytes);
294
339
  if (cursorDatabaseCompanions.some((companion) => companion.status !== "missing")) {
295
- resources.push({
340
+ addResources({
296
341
  resource: {
297
342
  id: resourceId,
298
343
  adapter: this.id,
@@ -314,7 +359,7 @@ export class ProviderAuditAdapter {
314
359
  }
315
360
  continue;
316
361
  }
317
- diagnostics.push({
362
+ addDiagnostics({
318
363
  severity: "warning",
319
364
  code: "RESOURCE_INSPECTION_FAILED",
320
365
  message: error instanceof Error ? error.message : String(error),
@@ -322,402 +367,24 @@ export class ProviderAuditAdapter {
322
367
  });
323
368
  }
324
369
  }
325
- if (this.spec.id === "claude") {
326
- const debugLogs = await collectClaudeDebugLogs(context, probe.root, this.options.maxEntries);
327
- const changelogCache = await collectClaudeChangelogCache(context, probe.root);
328
- resources.push(...debugLogs.resources);
329
- resources.push(...changelogCache.resources);
330
- diagnostics.push(...debugLogs.diagnostics);
331
- diagnostics.push(...changelogCache.diagnostics);
332
- }
333
- if (this.spec.id === "zed") {
334
- const rotatedLog = await collectZedRotatedLog(context, {
335
- ...(this.options.root === undefined ? {} : { root: this.options.root }),
336
- ...(this.options.platform === undefined ? {} : { platform: this.options.platform }),
337
- ...(this.options.environment === undefined
338
- ? {}
339
- : { environment: this.options.environment }),
340
- });
341
- resources.push(...rotatedLog.resources);
342
- diagnostics.push(...rotatedLog.diagnostics);
370
+ if (this.options.quickInventory !== true) {
371
+ const files = await collectProviderFiles(this.spec.id, context, this.options, probe.root);
372
+ addResources(...files.resources);
373
+ addDiagnostics(...files.diagnostics);
343
374
  }
344
375
  return { resources, diagnostics };
345
376
  }
346
377
  async classify(context, resource) {
347
- const observedAt = context.now.toISOString();
348
- const providerFileIdentity = providerFileIdentitySchema.safeParse(resource.facts.providerFileIdentity);
349
- const claudeNativeRetention = claudeNativeRetentionFactsSchema.safeParse(resource.facts.nativeRetention);
350
- const copilotNativeMaintenance = copilotNativeMaintenanceFactsSchema.safeParse(resource.facts.nativeMaintenance);
351
- const opencodeNativeMaintenance = opencodeNativeMaintenanceFactsSchema.safeParse(resource.facts.nativeMaintenance);
352
- const cursorNativeMaintenance = cursorNativeMaintenanceFactsSchema.safeParse(resource.facts.nativeMaintenance);
353
- const grokOwnerContract = grokOwnerContractFactsSchema.safeParse(resource.facts.ownerContract);
354
- const providerFilePolicy = typeof resource.facts.policyId === "string"
355
- ? PROVIDER_FILE_POLICIES.find((policy) => policy.id === resource.facts.policyId &&
356
- providerFileIdentity.success &&
357
- policy.matchesRelativePath(providerFileIdentity.data.relativePath))
358
- : undefined;
359
- if (providerFileIdentity.success &&
360
- providerFileIdentity.data.provider === this.spec.id &&
361
- providerFilePolicy?.provider === this.spec.id) {
362
- const identity = providerFileIdentity.data;
363
- const oldEnough = context.now.getTime() - identity.mtimeMs >= providerFilePolicy.minAgeMinutes * 60_000;
364
- const candidateActions = oldEnough
365
- ? [
366
- providerFileQuarantineActionSchema.parse({
367
- actionId: `provider.file-quarantine:${sha256(`${providerFilePolicy.id}:${identity.fingerprint}`)}`,
368
- type: "provider.file-quarantine",
369
- adapter: providerFilePolicy.provider,
370
- resourceId: resource.resource.id,
371
- policyId: providerFilePolicy.id,
372
- risk: "recoverable",
373
- description: providerFilePolicy.description,
374
- expectedReclaimBytes: 0,
375
- pendingQuarantineBytes: identity.measuredBytes,
376
- quarantineTtlMinutes: providerFilePolicy.quarantineTtlMinutes,
377
- target: identity,
378
- }),
379
- ]
380
- : [];
381
- return {
382
- schemaVersion: 1,
383
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
384
- auditId: context.auditId,
385
- observedAt,
386
- resource: resource.resource,
387
- state: oldEnough ? "eligible" : "protected",
388
- confidence: "certain",
389
- roots: [
390
- {
391
- code: providerFilePolicy.rootCode,
392
- source: this.id,
393
- observedAt,
394
- detail: providerFilePolicy.rootDetail,
395
- },
396
- ...(oldEnough
397
- ? []
398
- : [
399
- {
400
- code: "provider-file-too-recent",
401
- source: this.id,
402
- observedAt,
403
- detail: providerFilePolicy.tooRecentDetail,
404
- },
405
- ]),
406
- ],
407
- facts: resource.facts,
408
- candidateActions,
409
- measuredBytes: identity.measuredBytes,
410
- estimatedReclaimBytes: 0,
411
- warnings: [],
412
- };
413
- }
414
- const databaseIdentity = databaseIdentitySchema.safeParse(resource.facts.databaseIdentity);
415
- if (this.spec.id === "codex" && databaseIdentity.success) {
416
- const estimatedReclaimBytes = typeof resource.facts.estimatedReclaimBytes === "number"
417
- ? resource.facts.estimatedReclaimBytes
418
- : 0;
419
- const freePageRatio = typeof resource.facts.freePageRatio === "number" ? resource.facts.freePageRatio : 0;
420
- const openHandles = resource.facts.openHandles;
421
- const ownerProcesses = resource.facts.ownerProcesses;
422
- const supported = codexDatabaseContractMatches(databaseIdentity.data);
423
- const worthwhile = estimatedReclaimBytes >= DATABASE_RECLAIM_THRESHOLD_BYTES &&
424
- freePageRatio >= DATABASE_RECLAIM_RATIO;
425
- const allowed = resource.facts.offlineVacuumAllowed === true;
426
- const walSafe = databaseIdentity.data.wal?.measuredBytes === undefined ||
427
- databaseIdentity.data.wal.measuredBytes === 0;
428
- const ownerIdle = ownerProcesses?.status === "idle";
429
- const handlesIdle = openHandles?.status === "idle";
430
- const eligible = supported && worthwhile && allowed && walSafe && ownerIdle && handlesIdle;
431
- const roots = [];
432
- if (!supported) {
433
- roots.push({
434
- code: "unsupported-database-contract",
435
- source: this.id,
436
- observedAt,
437
- detail: "The Codex database filename, migration version, or required tables changed.",
438
- });
439
- }
440
- if (!worthwhile) {
441
- roots.push({
442
- code: "database-compaction-not-needed",
443
- source: this.id,
444
- observedAt,
445
- detail: "Free pages are below the 512 MiB and 25 percent compaction thresholds.",
446
- });
447
- }
448
- if (!allowed) {
449
- roots.push({
450
- code: "offline-vacuum-not-authorized",
451
- source: this.id,
452
- observedAt,
453
- detail: "Re-run the audit with --allow-offline-vacuum to propose this action.",
454
- });
455
- }
456
- if (!walSafe) {
457
- roots.push({
458
- code: "database-wal-not-empty",
459
- source: this.id,
460
- observedAt,
461
- detail: "The WAL contains data and must be checkpointed by Codex before compaction.",
462
- });
463
- }
464
- if (!ownerIdle) {
465
- roots.push({
466
- code: ownerProcesses?.status === "busy"
467
- ? "provider-process-active"
468
- : "provider-process-state-unknown",
469
- source: this.id,
470
- observedAt,
471
- detail: ownerProcesses?.status === "busy"
472
- ? "A Codex CLI, desktop, or app-server process is active."
473
- : (ownerProcesses?.reason ?? "Codex process state could not be proven."),
474
- });
475
- }
476
- if (!handlesIdle) {
477
- roots.push({
478
- code: openHandles?.status === "busy"
479
- ? "database-open-descriptor"
480
- : "database-descriptor-state-unknown",
481
- source: this.id,
482
- observedAt,
483
- detail: openHandles?.status === "busy"
484
- ? "A process has the database or a SQLite companion open."
485
- : (openHandles?.reason ?? "Open database descriptors could not be inspected."),
486
- });
487
- }
488
- const candidateActions = eligible
489
- ? [
490
- {
491
- actionId: `database.vacuum:${sha256(JSON.stringify(databaseIdentity.data))}`,
492
- type: "database.vacuum",
493
- adapter: "codex",
494
- resourceId: resource.resource.id,
495
- risk: "experimental",
496
- description: `Compact Codex ${databaseIdentity.data.database} database offline with a retained rollback copy`,
497
- expectedReclaimBytes: estimatedReclaimBytes,
498
- backupTtlMinutes: DATABASE_BACKUP_TTL_MINUTES,
499
- target: databaseIdentity.data,
500
- },
501
- ]
502
- : [];
503
- return {
504
- schemaVersion: 1,
505
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
506
- auditId: context.auditId,
507
- observedAt,
508
- resource: resource.resource,
509
- state: eligible ? "eligible" : "protected",
510
- confidence: supported ? "certain" : "unknown",
511
- roots,
512
- facts: resource.facts,
513
- candidateActions,
514
- measuredBytes: databaseIdentity.data.measuredBytes,
515
- estimatedReclaimBytes,
516
- warnings: [],
517
- };
518
- }
519
- if (this.spec.id === "claude" && claudeNativeRetention.success) {
520
- const uncertain = !["missing", "valid"].includes(claudeNativeRetention.data.userSettingsStatus);
521
- const configuredDays = claudeNativeRetention.data.userConfiguredDays;
522
- return {
523
- schemaVersion: 1,
524
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
525
- auditId: context.auditId,
526
- observedAt,
527
- resource: resource.resource,
528
- state: "protected",
529
- confidence: uncertain ? "unknown" : "high",
530
- roots: [
531
- {
532
- code: uncertain
533
- ? "claude-native-retention-uncertain"
534
- : "claude-native-retention-expected",
535
- source: this.id,
536
- observedAt,
537
- detail: uncertain
538
- ? "Claude user settings could not be validated; Claude may pause native cleanup unless managed settings provide cleanupPeriodDays."
539
- : configuredDays === undefined
540
- ? "Claude documents a 30-day startup retention sweep; higher-precedence settings were not resolved."
541
- : `Claude user settings declare a ${configuredDays}-day startup retention sweep; higher-precedence settings were not resolved.`,
542
- },
543
- {
544
- code: "provider-owned-report-only",
545
- source: this.id,
546
- observedAt,
547
- detail: "Claude owns this retention sweep; AgentRinse does not mutate the resource.",
548
- },
549
- ],
550
- facts: resource.facts,
551
- candidateActions: [],
552
- ...(resource.measuredBytes === undefined ? {} : { measuredBytes: resource.measuredBytes }),
553
- warnings: [],
554
- };
555
- }
556
- if (this.spec.id === "copilot" && copilotNativeMaintenance.success) {
557
- const detail = copilotNativeMaintenance.data.kind === "session-prune"
558
- ? "Current Copilot CLI documents local-only session pruning with dry-run support; AgentRinse did not probe the installed CLI version."
559
- : "Copilot CLI 1.0.52 introduced startup pruning for direct process logs older than seven days or beyond the newest 50; AgentRinse did not probe the installed CLI version.";
560
- return {
561
- schemaVersion: 1,
562
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
563
- auditId: context.auditId,
564
- observedAt,
565
- resource: resource.resource,
566
- state: "protected",
567
- confidence: "unknown",
568
- roots: [
569
- {
570
- code: "copilot-native-maintenance-version-unverified",
571
- source: this.id,
572
- observedAt,
573
- detail,
574
- },
575
- {
576
- code: "provider-owned-report-only",
577
- source: this.id,
578
- observedAt,
579
- detail: "Copilot owns this maintenance path; AgentRinse does not mutate the resource.",
580
- },
581
- ],
582
- facts: resource.facts,
583
- candidateActions: [],
584
- ...(resource.measuredBytes === undefined ? {} : { measuredBytes: resource.measuredBytes }),
585
- warnings: [],
586
- };
587
- }
588
- if (this.spec.id === "opencode" && opencodeNativeMaintenance.success) {
589
- const detail = opencodeNativeMaintenance.data.kind === "snapshot-gc"
590
- ? "OpenCode 1.18.9 schedules snapshot Git garbage collection after one minute and hourly, pruning objects older than seven days; AgentRinse did not probe the installed version."
591
- : "OpenCode 1.18.9 appends server logs to opencode.log without a server-log retention sweep; the desktop application's separate seven-day log cleanup does not cover this directory.";
592
- return {
593
- schemaVersion: 1,
594
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
595
- auditId: context.auditId,
596
- observedAt,
597
- resource: resource.resource,
598
- state: "protected",
599
- confidence: "unknown",
600
- roots: [
601
- {
602
- code: opencodeNativeMaintenance.data.kind === "snapshot-gc"
603
- ? "opencode-native-snapshot-gc-version-unverified"
604
- : "opencode-server-log-retention-version-unverified",
605
- source: this.id,
606
- observedAt,
607
- detail,
608
- },
609
- {
610
- code: "provider-owned-report-only",
611
- source: this.id,
612
- observedAt,
613
- detail: "OpenCode owns this maintenance path; AgentRinse does not mutate the resource.",
614
- },
615
- ],
616
- facts: resource.facts,
617
- candidateActions: [],
618
- ...(resource.measuredBytes === undefined ? {} : { measuredBytes: resource.measuredBytes }),
619
- warnings: [],
620
- };
621
- }
622
- if (this.spec.id === "cursor" && cursorNativeMaintenance.success) {
623
- return {
624
- schemaVersion: 1,
625
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
626
- auditId: context.auditId,
627
- observedAt,
628
- resource: resource.resource,
629
- state: "protected",
630
- confidence: "unknown",
631
- roots: [
632
- {
633
- code: "cursor-native-database-maintenance-version-unverified",
634
- source: this.id,
635
- observedAt,
636
- detail: "Current Cursor guidance exposes command-palette operations for orphaned agent KV cleanup or user-selected chat deletion, both followed by VACUUM; AgentRinse did not prove the installed Cursor version.",
637
- },
638
- {
639
- code: "provider-owned-report-only",
640
- source: this.id,
641
- observedAt,
642
- detail: "Cursor owns its database schema and maintenance commands; AgentRinse does not open or mutate the database.",
643
- },
644
- ],
645
- facts: resource.facts,
646
- candidateActions: [],
647
- ...(resource.measuredBytes === undefined ? {} : { measuredBytes: resource.measuredBytes }),
648
- warnings: [],
649
- };
650
- }
651
- if (this.spec.id === "grok" && grokOwnerContract.success) {
652
- const versionStatus = grokOwnerContract.data.installedVersionStatus;
653
- const executableStatus = grokOwnerContract.data.ownerExecutableStatus;
654
- const exact = versionStatus === "exact";
655
- const detail = exact
656
- ? "The installed Grok version and build revision match the inspected source snapshot. Grok runs its memory GC during session initialization, but exposes no tagged, user-invokable cleanup contract that AgentRinse can bind and revalidate."
657
- : versionStatus === "version-mismatch"
658
- ? `Installed Grok ${grokOwnerContract.data.installedVersion} does not match inspected source version ${grokOwnerContract.data.sourceVersion}; only the owner root was inventoried.`
659
- : versionStatus === "revision-mismatch"
660
- ? `Installed Grok build revision ${grokOwnerContract.data.installedRevision} does not match the inspected source revisions; only the owner root was inventoried.`
661
- : versionStatus === "unparseable"
662
- ? "The installed Grok version output did not match the documented format; only the owner root was inventoried."
663
- : executableStatus === "unsafe"
664
- ? "The canonical Grok executable escapes or does not resolve to a file inside the audited owner root; only the owner root was inventoried."
665
- : executableStatus === "unexecutable"
666
- ? "The canonical Grok executable is not executable; only the owner root was inventoried."
667
- : executableStatus === "unreadable"
668
- ? "The canonical Grok executable could not be inspected; only the owner root was inventoried."
669
- : executableStatus === "missing"
670
- ? "The audited owner root has no canonical Grok executable; only the owner root was inventoried."
671
- : "The bound Grok executable version could not be inspected; only the owner root was inventoried.";
672
- return {
673
- schemaVersion: 1,
674
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
675
- auditId: context.auditId,
676
- observedAt,
677
- resource: resource.resource,
678
- state: "protected",
679
- confidence: exact ? "high" : "unknown",
680
- roots: [
681
- {
682
- code: "grok-cleanup-owner-contract-unavailable",
683
- source: this.id,
684
- observedAt,
685
- detail,
686
- },
687
- {
688
- code: "provider-owned-report-only",
689
- source: this.id,
690
- observedAt,
691
- detail: "Grok owns sessions, memory, logs, worktrees, plugins, credentials, configuration, and runtime assets; AgentRinse does not mutate them.",
692
- },
693
- ],
694
- facts: resource.facts,
695
- candidateActions: [],
696
- ...(resource.measuredBytes === undefined ? {} : { measuredBytes: resource.measuredBytes }),
697
- warnings: [],
698
- };
699
- }
700
- return {
701
- schemaVersion: 1,
702
- findingId: `${resource.resource.id}:${sha256(context.auditId)}`,
703
- auditId: context.auditId,
704
- observedAt,
705
- resource: resource.resource,
706
- state: "protected",
707
- confidence: "certain",
708
- roots: [
378
+ const quarantinableFile = classifyProviderFile(this.spec.id, context, resource);
379
+ if (quarantinableFile)
380
+ return quarantinableFile;
381
+ return (this.spec.classify?.(context, resource) ??
382
+ reportOnlyFinding(context, resource, this.spec.id, "certain", [
709
383
  {
710
384
  code: "provider-owned-report-only",
711
- source: this.id,
712
- observedAt,
713
385
  detail: "This adapter inventories provider state but does not clean it.",
714
386
  },
715
- ],
716
- facts: resource.facts,
717
- candidateActions: [],
718
- ...(resource.measuredBytes === undefined ? {} : { measuredBytes: resource.measuredBytes }),
719
- warnings: [],
720
- };
387
+ ]));
721
388
  }
722
389
  }
723
390
  //# sourceMappingURL=provider-adapter.js.map