@rulemetric/cli 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/dist/base-command.js +1 -1
  2. package/dist/{chunk-LMCICVE7.js → chunk-2UK4DZFW.js} +1 -1
  3. package/dist/{chunk-FK55FXKQ.js → chunk-35YVHBLL.js} +1 -1
  4. package/dist/{chunk-J7UZXRTH.js → chunk-3FNTV2TW.js} +1 -1
  5. package/dist/{chunk-U7BPWFOP.js → chunk-3IMRLHJJ.js} +1 -1
  6. package/dist/{chunk-TWPG3TEQ.js → chunk-42A4PUW7.js} +2 -2
  7. package/dist/{chunk-SV73ASP2.js → chunk-43VKTVM3.js} +1 -1
  8. package/dist/{chunk-MX34N7Y5.js → chunk-44TYRMIS.js} +1 -1
  9. package/dist/{chunk-HAYO6JYI.js → chunk-4FJYVYCU.js} +1 -1
  10. package/dist/{chunk-TTSDPDRH.js → chunk-5BT375C7.js} +1 -1
  11. package/dist/{chunk-N26UEHI3.js → chunk-5Z3H5JHK.js} +1 -1
  12. package/dist/{chunk-EWGE7YTQ.js → chunk-6ANODRDT.js} +1 -1
  13. package/dist/{chunk-ZZHIBOMT.js → chunk-76UKAFNM.js} +1 -1
  14. package/dist/{chunk-IOX4VJPR.js → chunk-7MTYUTUN.js} +1 -1
  15. package/dist/{chunk-JLBQKV4V.js → chunk-AGEZAKCC.js} +1 -1
  16. package/dist/{chunk-XAOLOR4Q.js → chunk-AIYFT4P6.js} +1 -1
  17. package/dist/{chunk-BVOXWAJO.js → chunk-B5X6HCBK.js} +1 -1
  18. package/dist/chunk-BAITMD76.js +1 -0
  19. package/dist/{chunk-AXJAGWZB.js → chunk-BFQVAU6N.js} +1 -1
  20. package/dist/{chunk-2WQUOC6S.js → chunk-BMT5WMEV.js} +1 -1
  21. package/dist/chunk-CT6GJQIR.js +1 -0
  22. package/dist/{chunk-FCTFHY3X.js → chunk-DHX4U6EC.js} +1 -1
  23. package/dist/chunk-DQYYHX6K.js +1 -0
  24. package/dist/{chunk-OO2ZRKZY.js → chunk-DVU5PHPM.js} +1 -1
  25. package/dist/{chunk-ZA6NXNPR.js → chunk-EMLLGASZ.js} +1 -1
  26. package/dist/{chunk-XFLKW6SJ.js → chunk-EUHRTEVJ.js} +1 -1
  27. package/dist/chunk-FBSZ6KCM.js +1 -0
  28. package/dist/{chunk-E5YE25QG.js → chunk-FKTT7A4H.js} +1 -1
  29. package/dist/{chunk-UQDOOQCM.js → chunk-FYZ6HHCV.js} +1 -1
  30. package/dist/{chunk-5XEGRU2R.js → chunk-GKVHFXUQ.js} +1 -1
  31. package/dist/chunk-GPBN4ROE.js +2 -0
  32. package/dist/chunk-H6FVXVGG.js +1 -0
  33. package/dist/{chunk-JKWB6UXA.js → chunk-HNYHZO2J.js} +1 -1
  34. package/dist/{chunk-FJX7WDPG.js → chunk-I6ZQOMZS.js} +1 -1
  35. package/dist/{chunk-AT2MMCOJ.js → chunk-IO46ICZY.js} +1 -1
  36. package/dist/chunk-IQEZ3T5A.js +1 -0
  37. package/dist/{chunk-DDYGA2DS.js → chunk-ISFPPDDB.js} +1 -1
  38. package/dist/chunk-JP6ULOEX.js +2 -0
  39. package/dist/{chunk-N7SZWKCU.js → chunk-JTYVBR5H.js} +1 -1
  40. package/dist/{chunk-GQGGFHX7.js → chunk-KOYHJFB3.js} +1 -1
  41. package/dist/chunk-LJRJ2RAC.js +4 -0
  42. package/dist/{chunk-JRWQJZYQ.js → chunk-MMLRWCBW.js} +1 -1
  43. package/dist/{chunk-N4RJ6CN7.js → chunk-MU7KKU3O.js} +1 -1
  44. package/dist/{chunk-HFSISGCJ.js → chunk-MXHAXY66.js} +1 -1
  45. package/dist/{chunk-GN46S7T4.js → chunk-N4YPDZJF.js} +1 -1
  46. package/dist/{chunk-JRAXWASH.js → chunk-NYNHX7OX.js} +1 -1
  47. package/dist/{chunk-E7RH43OS.js → chunk-OP4U3XBZ.js} +1 -1
  48. package/dist/{chunk-OMRH4JXS.js → chunk-OVS7ZDJ4.js} +1 -1
  49. package/dist/{chunk-YNLHJHUP.js → chunk-PIVEJTNF.js} +1 -1
  50. package/dist/{chunk-S5U76YUI.js → chunk-POEMCITL.js} +1 -1
  51. package/dist/{chunk-UFQ43KXE.js → chunk-Q36QSFSB.js} +1 -1
  52. package/dist/chunk-Q776YUBD.js +1 -0
  53. package/dist/chunk-QAMHZY2P.js +1 -0
  54. package/dist/{chunk-EXVXKJ7Y.js → chunk-QRIJ3AHP.js} +1 -1
  55. package/dist/{chunk-IC6VZHE6.js → chunk-RAQLVO2X.js} +1 -1
  56. package/dist/{chunk-V4PUYPTU.js → chunk-RG3R4EAB.js} +1 -1
  57. package/dist/{chunk-OLJF4K7L.js → chunk-RMRVUI7B.js} +1 -1
  58. package/dist/{chunk-O62OLKQL.js → chunk-RXZLBSDO.js} +1 -1
  59. package/dist/{chunk-RRM4HQG4.js → chunk-SCQK52SL.js} +1 -1
  60. package/dist/{chunk-YP2CBUXH.js → chunk-V55ROUNP.js} +1 -1
  61. package/dist/{chunk-YUIRDBQQ.js → chunk-VIFOLTZT.js} +1 -1
  62. package/dist/{chunk-XAXEZI6Z.js → chunk-VU24IH5S.js} +1 -1
  63. package/dist/{chunk-LDUJWJ6A.js → chunk-VXL5H3VZ.js} +1 -1
  64. package/dist/{chunk-NRYVMGJN.js → chunk-W23OYQXI.js} +1 -1
  65. package/dist/{chunk-S5CQSP35.js → chunk-WWQWHC4K.js} +1 -1
  66. package/dist/{chunk-VLWNSTYW.js → chunk-XGMOVQ5G.js} +1 -1
  67. package/dist/{chunk-NSPDDSRR.js → chunk-XJ25HFIT.js} +1 -1
  68. package/dist/{chunk-PPIZMPNI.js → chunk-XMA6SWOT.js} +1 -1
  69. package/dist/{chunk-H4LUPIHJ.js → chunk-XMTKP74H.js} +1 -1
  70. package/dist/chunk-XQYAVSUQ.js +1 -0
  71. package/dist/{chunk-ET7753IY.js → chunk-YK2IEHLB.js} +1 -1
  72. package/dist/{chunk-7ML2UCI7.js → chunk-ZK3ACE4T.js} +1 -1
  73. package/dist/commands/antigravity/backfill.js +1 -1
  74. package/dist/commands/auth/create-key.js +1 -1
  75. package/dist/commands/auth/login.js +1 -1
  76. package/dist/commands/auth/logout.js +1 -1
  77. package/dist/commands/auth/revoke-key.js +1 -1
  78. package/dist/commands/auth/signup.js +1 -1
  79. package/dist/commands/auth/status.js +1 -1
  80. package/dist/commands/capture/scope.js +1 -1
  81. package/dist/commands/catalog/index.js +1 -1
  82. package/dist/commands/catalog/recommend.js +1 -1
  83. package/dist/commands/crons/list.js +1 -1
  84. package/dist/commands/crons/run.js +1 -1
  85. package/dist/commands/dashboard.js +1 -1
  86. package/dist/commands/diagnostics.js +1 -1
  87. package/dist/commands/eval-targets/create.js +1 -1
  88. package/dist/commands/eval-targets/list.js +1 -1
  89. package/dist/commands/evals/agent.js +1 -1
  90. package/dist/commands/evals/auto-run.js +1 -1
  91. package/dist/commands/evals/benchmark.js +1 -1
  92. package/dist/commands/evals/compare.js +1 -1
  93. package/dist/commands/evals/create.js +1 -1
  94. package/dist/commands/evals/optimize-description.js +1 -1
  95. package/dist/commands/evals/optimize.js +1 -1
  96. package/dist/commands/evals/refine-cases.js +1 -1
  97. package/dist/commands/evals/run.js +1 -1
  98. package/dist/commands/evals/validate-judge.js +1 -1
  99. package/dist/commands/experiments/list.js +1 -1
  100. package/dist/commands/gateway/ensure.js +1 -1
  101. package/dist/commands/hooks/install.js +1 -1
  102. package/dist/commands/hooks/run.js +1 -1
  103. package/dist/commands/hooks/uninstall.js +1 -1
  104. package/dist/commands/instructions/create.js +1 -1
  105. package/dist/commands/instructions/dedupe.js +1 -1
  106. package/dist/commands/instructions/delete.js +1 -1
  107. package/dist/commands/instructions/fork.js +1 -1
  108. package/dist/commands/instructions/get.js +1 -1
  109. package/dist/commands/instructions/list.js +1 -1
  110. package/dist/commands/instructions/promote.js +1 -1
  111. package/dist/commands/instructions/pull.js +1 -1
  112. package/dist/commands/instructions/restore.js +1 -1
  113. package/dist/commands/instructions/retract.js +1 -1
  114. package/dist/commands/instructions/upstream.js +1 -1
  115. package/dist/commands/instructions/versions.js +1 -1
  116. package/dist/commands/launcher.js +1 -1
  117. package/dist/commands/local/down.js +1 -1
  118. package/dist/commands/local/up.js +1 -1
  119. package/dist/commands/org/current.js +1 -1
  120. package/dist/commands/org/list.js +1 -1
  121. package/dist/commands/org/switch.js +1 -1
  122. package/dist/commands/packs/add-instruction.js +1 -1
  123. package/dist/commands/packs/apply.js +1 -1
  124. package/dist/commands/packs/create.js +1 -1
  125. package/dist/commands/packs/fork.js +1 -1
  126. package/dist/commands/packs/get.js +1 -1
  127. package/dist/commands/packs/list.js +1 -1
  128. package/dist/commands/packs/remove-instruction.js +1 -1
  129. package/dist/commands/proxy/env.js +1 -1
  130. package/dist/commands/proxy/logs.js +1 -1
  131. package/dist/commands/proxy/restart.js +1 -1
  132. package/dist/commands/proxy/setup.js +1 -1
  133. package/dist/commands/proxy/start.js +1 -1
  134. package/dist/commands/proxy/status.js +1 -1
  135. package/dist/commands/proxy/stop.js +1 -1
  136. package/dist/commands/research/backfill.js +1 -1
  137. package/dist/commands/research/tail-transcript.js +1 -1
  138. package/dist/commands/service/install.js +1 -1
  139. package/dist/commands/service/status.js +1 -1
  140. package/dist/commands/service/uninstall.js +1 -1
  141. package/dist/commands/sessions/analyze.js +1 -1
  142. package/dist/commands/sessions/delete.js +1 -1
  143. package/dist/commands/sessions/end.js +1 -1
  144. package/dist/commands/sessions/import.js +1 -1
  145. package/dist/commands/sessions/list.js +1 -1
  146. package/dist/commands/sessions/start.js +1 -1
  147. package/dist/commands/setup.js +1 -1
  148. package/dist/commands/skills/export-approved.js +1 -1
  149. package/dist/commands/skills/install.js +1 -1
  150. package/dist/commands/skills/list.js +1 -1
  151. package/dist/commands/skills/publish.js +1 -1
  152. package/dist/commands/skills/search.js +1 -1
  153. package/dist/commands/skills/update.js +1 -1
  154. package/dist/commands/suggestions/accept.js +1 -1
  155. package/dist/commands/suggestions/auto.js +1 -1
  156. package/dist/commands/suggestions/dismiss.js +1 -1
  157. package/dist/commands/suggestions/list.js +1 -1
  158. package/dist/commands/suggestions/refresh.js +1 -1
  159. package/dist/commands/suggestions/undo.js +1 -1
  160. package/dist/dashboard/Dashboard.js +1 -1
  161. package/dist/dashboard/data.js +1 -1
  162. package/dist/dashboard/launcher/LauncherOverlay.js +1 -1
  163. package/dist/dashboard/launcher/api.js +1 -1
  164. package/dist/dashboard/launcher/useLaunchJobs.js +1 -1
  165. package/dist/dashboard/panels/measurement.js +1 -0
  166. package/dist/{dist-NHS7HY5Q.js → dist-GSHUC7UU.js} +1 -1
  167. package/dist/lib/active-org-refresh.js +1 -1
  168. package/dist/lib/agent-loop.js +1 -1
  169. package/dist/lib/antigravity-transcript.js +1 -1
  170. package/dist/lib/api-client.js +1 -1
  171. package/dist/lib/autorun-batch.js +1 -0
  172. package/dist/lib/ensure-api-key.js +1 -1
  173. package/dist/lib/ensure-fresh-token.js +1 -1
  174. package/dist/lib/eval-analyzer.js +1 -1
  175. package/dist/lib/eval-benchmark.js +1 -1
  176. package/dist/lib/eval-candidate-run.js +1 -1
  177. package/dist/lib/eval-case-generator.js +1 -1
  178. package/dist/lib/eval-conversation-handler.js +1 -1
  179. package/dist/lib/eval-executor.js +1 -1
  180. package/dist/lib/eval-grader.js +1 -1
  181. package/dist/lib/eval-meta-judge.js +1 -1
  182. package/dist/lib/eval-resume.js +1 -1
  183. package/dist/lib/eval-run-batch.js +1 -1
  184. package/dist/lib/eval-trigger-tester.js +1 -1
  185. package/dist/lib/evolution-enrolment.js +1 -1
  186. package/dist/lib/harbor-readiness.js +1 -1
  187. package/dist/lib/insights/generation/installed-asks.js +1 -1
  188. package/dist/lib/insights/nomination/nominate.js +1 -1
  189. package/dist/lib/instruction-proposer.js +1 -1
  190. package/dist/lib/instructions/acceptance/accept-events.js +1 -1
  191. package/dist/lib/instructions/acceptance/accept-hook.js +1 -1
  192. package/dist/lib/instructions/acceptance/hook-install.js +1 -1
  193. package/dist/lib/instructions/acceptance/reverse-applications.js +1 -1
  194. package/dist/lib/instructions/acceptance/suggestion-accept.js +1 -1
  195. package/dist/lib/jobs/handlers/cron-auto-accept-suggestions.js +1 -1
  196. package/dist/lib/jobs/handlers/cron-eval-autorun.js +1 -1
  197. package/dist/lib/jobs/handlers/cron-instruction-evolution.js +1 -1
  198. package/dist/lib/jobs/handlers/cron-instruction-training.js +1 -1
  199. package/dist/lib/jobs/handlers/cron-reconcile-attribution.js +1 -1
  200. package/dist/lib/jobs/handlers/cron-refine-cases.js +1 -1
  201. package/dist/lib/jobs/handlers/cron-refresh-pricing.js +1 -1
  202. package/dist/lib/jobs/handlers/cron-retire-unused-skills.js +1 -1
  203. package/dist/lib/jobs/handlers/cron-suggest-instructions.js +1 -1
  204. package/dist/lib/jobs/handlers/distill-memories.js +1 -1
  205. package/dist/lib/jobs/handlers/harbor-ab.js +1 -1
  206. package/dist/lib/jobs/handlers/process-changelog.js +1 -1
  207. package/dist/lib/jobs/handlers/process-conversation.js +1 -1
  208. package/dist/lib/jobs/handlers/process-eval.js +1 -1
  209. package/dist/lib/jobs/handlers/process-insights.js +1 -1
  210. package/dist/lib/jobs/handlers/process-judge-review.js +1 -1
  211. package/dist/lib/jobs/handlers/process-launch.js +1 -1
  212. package/dist/lib/jobs/handlers/process-memory-ab.js +1 -1
  213. package/dist/lib/jobs/handlers/process-run-cleanup.js +1 -1
  214. package/dist/lib/jobs/handlers/process-session-goal.js +1 -1
  215. package/dist/lib/jobs/shed-retry.js +1 -1
  216. package/dist/lib/judge-review-runner.js +1 -1
  217. package/dist/lib/llm-client.js +1 -1
  218. package/dist/lib/manual-tasks.js +1 -1
  219. package/dist/lib/measurement-llm.js +1 -1
  220. package/dist/lib/pi-exec.js +1 -1
  221. package/dist/lib/projects/workspace/worktree.js +1 -1
  222. package/dist/lib/refine-cases.js +1 -1
  223. package/dist/lib/research-client.js +1 -1
  224. package/dist/lib/retraction.js +1 -1
  225. package/dist/lib/reviewer-detect.js +1 -1
  226. package/dist/lib/setup-steps.js +1 -1
  227. package/dist/lib/telemetry.js +1 -1
  228. package/dist/lib/terminal-target-heartbeat.js +1 -1
  229. package/dist/lib/work-report.js +1 -1
  230. package/oclif.manifest.json +1 -1
  231. package/package.json +4 -4
  232. package/dist/chunk-74QIUVWY.js +0 -1
  233. package/dist/chunk-HRJDKAJ4.js +0 -1
  234. package/dist/chunk-INAZLRY5.js +0 -1
  235. package/dist/chunk-OUK2AWEI.js +0 -1
  236. package/dist/chunk-OYAOLJUH.js +0 -1
  237. package/dist/chunk-PUX6P5KC.js +0 -2
  238. package/dist/chunk-SBGXIPRN.js +0 -2
  239. package/dist/chunk-SPJ73X7A.js +0 -4
  240. package/dist/chunk-UJ7EPLKC.js +0 -1
  241. package/dist/chunk-WSWZPNLG.js +0 -1
  242. /package/dist/{chunk-SE3UKA3M.js → chunk-T75KAEJO.js} +0 -0
@@ -1 +1 @@
1
- import{d as E}from"./chunk-OUK2AWEI.js";import{b as F,c as x}from"./chunk-KGURGIZ2.js";import{f as R}from"./chunk-ZZHIBOMT.js";import{a}from"./chunk-ZLLER3HP.js";var _="with_candidate",w="with_prior_version";function S(e){return JSON.stringify([e.outputs.engine??null,e.outputs.model??null,e.outputs.methodology??null,e.outputs.deliveryRegime??null,e.grading.judge_engine??null,e.grading.judge_model??null])}a(S,"observedExecutionKey");function I(e){let r=e.filter(n=>n.status==="completed"),i=new Set(r.map(n=>JSON.stringify([n.outputs.engine??null,n.outputs.model??null,n.outputs.methodology??null,n.outputs.deliveryRegime??null]))),t=new Set(r.filter(n=>n.grading.judge_model!=null).map(n=>JSON.stringify([n.grading.judge_engine??"claude",n.grading.judge_model])));return i.size===1&&t.size<=1?JSON.stringify([[...i][0],[...t][0]??null]):null}a(I,"measurementBatchKey");function A(e){let r=e.filter(t=>t.configuration===_),i=[];for(let t of r){let n=e.find(s=>s.configuration===w&&s.evalId===t.evalId&&s.runNumber===t.runNumber);if(!n||S(n)!==S(t))continue;let l=h(t),m=h(n);l==null||m==null||i.push({withScore:l,withoutScore:m})}return i}a(A,"pairCandidateRuns");function h(e){return e.status!=="completed"?null:e.grading?.summary?.pass_rate??null}a(h,"evidenceOf");function $(e){let r=[],i=0;for(let t of e){if(t.status==="failed"){r.push(t.failure??{kind:"unknown",class:"infrastructure"});continue}h(t)==null&&(i+=1)}return{infrastructureFailed:r.length,ungradeable:i,summary:F(r)}}a($,"accountForFailures");function Q(e){let{pairs:r,minPairs:i,accounting:t}=e;return r>=i?{kind:"proceed"}:t.infrastructureFailed<=0?{kind:"proceed"}:{kind:"infrastructure-incomplete",reason:`${r}/${i} pair(s) \u2014 ${t.infrastructureFailed} run(s) never executed (${t.summary.describe()}). Retry when the environment recovers; this is not a statement about the target.`}}a(Q,"attributeShortfall");function k(e,r,i,t){let n=[];for(let l of e)n.push({eval_:l,configuration:_,targetContent:r,runNumber:t}),n.push({eval_:l,configuration:w,targetContent:i,runNumber:t});return n}a(k,"buildCandidateQueue");async function j(e){let{cases:r,candidateContent:i,priorVersionContent:t,concurrency:n,runNumber:l,opts:m,onLog:s=a(()=>{},"onLog")}=e,g=k(r,i,t,l),o=[],y=Math.max(1,n),p=null;for(let u=0;u<g.length;u+=y){let d=g.slice(u,u+y);o.push(...await Promise.all(d.map(c=>E(c,m,s))));let C=o.find(c=>c.failure&&x(c.failure.kind));if(C?.failure){p=C.failure.kind;let c=g.length-o.length;s(` \u26D4 aborting batch \u2014 ${p}: the account is out of quota. Skipped ${c} remaining run(s) that would certainly have failed.`);break}}for(let u of o)try{await R("/api/eval-runs",u)}catch(d){s(` \u26A0 failed to post a run result: ${d instanceof Error?d.message:String(d)}`)}let b=A(o),f=$(o),v=r.length-b.length;if(v>0){let u=f.infrastructureFailed?` \u2014 ${f.infrastructureFailed} run(s) never executed (${f.summary.describe()})`:"";s(` \u26A0 ${v}/${r.length} case(s) produced no usable pair (failed or ungradeable arm)${u}`)}return{completed:o.filter(u=>u.status==="completed").length,failed:o.filter(u=>u.status==="failed").length,results:o,pairs:b,accounting:f,abortedForQuota:p}}a(j,"runCandidateBatchAndPost");export{_ as a,w as b,S as c,I as d,A as e,$ as f,Q as g,k as h,j as i};
1
+ import{d as E}from"./chunk-H6FVXVGG.js";import{b as F,c as x}from"./chunk-KGURGIZ2.js";import{f as R}from"./chunk-76UKAFNM.js";import{a}from"./chunk-ZLLER3HP.js";var _="with_candidate",w="with_prior_version";function S(e){return JSON.stringify([e.outputs.engine??null,e.outputs.model??null,e.outputs.methodology??null,e.outputs.deliveryRegime??null,e.grading.judge_engine??null,e.grading.judge_model??null])}a(S,"observedExecutionKey");function I(e){let r=e.filter(n=>n.status==="completed"),i=new Set(r.map(n=>JSON.stringify([n.outputs.engine??null,n.outputs.model??null,n.outputs.methodology??null,n.outputs.deliveryRegime??null]))),t=new Set(r.filter(n=>n.grading.judge_model!=null).map(n=>JSON.stringify([n.grading.judge_engine??"claude",n.grading.judge_model])));return i.size===1&&t.size<=1?JSON.stringify([[...i][0],[...t][0]??null]):null}a(I,"measurementBatchKey");function A(e){let r=e.filter(t=>t.configuration===_),i=[];for(let t of r){let n=e.find(s=>s.configuration===w&&s.evalId===t.evalId&&s.runNumber===t.runNumber);if(!n||S(n)!==S(t))continue;let l=h(t),m=h(n);l==null||m==null||i.push({withScore:l,withoutScore:m})}return i}a(A,"pairCandidateRuns");function h(e){return e.status!=="completed"?null:e.grading?.summary?.pass_rate??null}a(h,"evidenceOf");function $(e){let r=[],i=0;for(let t of e){if(t.status==="failed"){r.push(t.failure??{kind:"unknown",class:"infrastructure"});continue}h(t)==null&&(i+=1)}return{infrastructureFailed:r.length,ungradeable:i,summary:F(r)}}a($,"accountForFailures");function Q(e){let{pairs:r,minPairs:i,accounting:t}=e;return r>=i?{kind:"proceed"}:t.infrastructureFailed<=0?{kind:"proceed"}:{kind:"infrastructure-incomplete",reason:`${r}/${i} pair(s) \u2014 ${t.infrastructureFailed} run(s) never executed (${t.summary.describe()}). Retry when the environment recovers; this is not a statement about the target.`}}a(Q,"attributeShortfall");function k(e,r,i,t){let n=[];for(let l of e)n.push({eval_:l,configuration:_,targetContent:r,runNumber:t}),n.push({eval_:l,configuration:w,targetContent:i,runNumber:t});return n}a(k,"buildCandidateQueue");async function j(e){let{cases:r,candidateContent:i,priorVersionContent:t,concurrency:n,runNumber:l,opts:m,onLog:s=a(()=>{},"onLog")}=e,g=k(r,i,t,l),o=[],y=Math.max(1,n),p=null;for(let u=0;u<g.length;u+=y){let d=g.slice(u,u+y);o.push(...await Promise.all(d.map(c=>E(c,m,s))));let C=o.find(c=>c.failure&&x(c.failure.kind));if(C?.failure){p=C.failure.kind;let c=g.length-o.length;s(` \u26D4 aborting batch \u2014 ${p}: the account is out of quota. Skipped ${c} remaining run(s) that would certainly have failed.`);break}}for(let u of o)try{await R("/api/eval-runs",u)}catch(d){s(` \u26A0 failed to post a run result: ${d instanceof Error?d.message:String(d)}`)}let b=A(o),f=$(o),v=r.length-b.length;if(v>0){let u=f.infrastructureFailed?` \u2014 ${f.infrastructureFailed} run(s) never executed (${f.summary.describe()})`:"";s(` \u26A0 ${v}/${r.length} case(s) produced no usable pair (failed or ungradeable arm)${u}`)}return{completed:o.filter(u=>u.status==="completed").length,failed:o.filter(u=>u.status==="failed").length,results:o,pairs:b,accounting:f,abortedForQuota:p}}a(j,"runCandidateBatchAndPost");export{_ as a,w as b,S as c,I as d,A as e,$ as f,Q as g,k as h,j as i};
@@ -1,4 +1,4 @@
1
- import{h as o}from"./chunk-FJX7WDPG.js";import{g as f}from"./chunk-GN46S7T4.js";import{b as y,e as m,h as d}from"./chunk-ZZHIBOMT.js";import{a as S}from"./chunk-ZLLER3HP.js";var _=1800*1e3,G=300*1e3,R=10,T=`Given these messages from an AI coding session, write a 1-2 sentence summary of what the user is trying to accomplish. Focus on the goal, not the steps. No preamble.
1
+ import{h as o}from"./chunk-I6ZQOMZS.js";import{g as f}from"./chunk-N4YPDZJF.js";import{b as y,e as m,h as d}from"./chunk-76UKAFNM.js";import{a as S}from"./chunk-ZLLER3HP.js";var _=1800*1e3,G=300*1e3,R=10,T=`Given these messages from an AI coding session, write a 1-2 sentence summary of what the user is trying to accomplish. Focus on the goal, not the steps. No preamble.
2
2
 
3
3
  Return strict JSON in the form: {"goalSummary": "..."}`;async function N(n,e={}){let w=e.llm??f,i=e.now??Date.now,v=e.getSession??(async s=>{try{return await o(()=>m(`/api/sessions/${s}`),{label:"session detail",idempotent:!0})}catch(t){if(t instanceof y&&t.statusCode===404)return null;throw t}}),l=e.getEvents??((s,t)=>o(()=>m(`/api/sessions/${s}/events?limit=${t.limit}&sort=${t.sort}`),{label:"session events",idempotent:!0})),P=e.saveGoal??(async(s,t)=>{await o(()=>d(`/api/sessions/${s}/enrich`,{analysis:t}),{label:"session enrich"})}),r=await v(n.sessionId);if(!r)return{skipped:"not_found"};let[A]=await l(n.sessionId,{limit:1,sort:"desc"}),h=new Date(A?.timestamp??r.startedAt).getTime();if(i()-h>_)return{skipped:"stale"};let c=r.analysis??{},g=c.goalSummaryAt?new Date(c.goalSummaryAt).getTime():0;if(g&&i()-g<G)return{skipped:"recent"};let u=(await l(n.sessionId,{limit:R*2,sort:"asc"})).filter(s=>s.content&&(s.eventType==="user_message"||s.eventType==="assistant_response")).map(s=>`${s.eventType==="user_message"?"USER":"ASSISTANT"}: ${s.content}`).join(`
4
4
 
@@ -1 +1 @@
1
- import{c as l}from"./chunk-ZZHIBOMT.js";import{c as a,l as u}from"./chunk-PZNWH4VQ.js";import{a as o}from"./chunk-ZLLER3HP.js";var c=120*1e3,t=null;async function k(){if(process.env.RULEMETRIC_API_KEY)return!0;let e=a(u());if(!e.isRefreshable(c))return!0;let r=e.loadToken();return r?.refreshToken?t||(t=f(e,r).finally(()=>{t=null}),t):!0}o(k,"ensureFreshToken");async function f(e,r){let s;try{s=await fetch(`${l()}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:r.refreshToken})})}catch{return!0}if(s.status===401)return e.clearToken(),!1;if(!s.ok)return!0;let n=await s.json().catch(()=>null);if(!n?.accessToken||!n.refreshToken)return!0;let i={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt??r.expiresAt,email:n.email??r.email};return e.saveToken(i),e.saveEnvFile(i.accessToken),!0}o(f,"doRefresh");export{k as a};
1
+ import{c as l}from"./chunk-76UKAFNM.js";import{c as a,l as u}from"./chunk-PZNWH4VQ.js";import{a as o}from"./chunk-ZLLER3HP.js";var c=120*1e3,t=null;async function k(){if(process.env.RULEMETRIC_API_KEY)return!0;let e=a(u());if(!e.isRefreshable(c))return!0;let r=e.loadToken();return r?.refreshToken?t||(t=f(e,r).finally(()=>{t=null}),t):!0}o(k,"ensureFreshToken");async function f(e,r){let s;try{s=await fetch(`${l()}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:r.refreshToken})})}catch{return!0}if(s.status===401)return e.clearToken(),!1;if(!s.ok)return!0;let n=await s.json().catch(()=>null);if(!n?.accessToken||!n.refreshToken)return!0;let i={accessToken:n.accessToken,refreshToken:n.refreshToken,expiresAt:n.expiresAt??r.expiresAt,email:n.email??r.email};return e.saveToken(i),e.saveEnvFile(i.accessToken),!0}o(f,"doRefresh");export{k as a};
@@ -1 +1 @@
1
- import{c as g}from"./chunk-N7SZWKCU.js";import{e as h,f}from"./chunk-ZZHIBOMT.js";import{q as u,r as m}from"./chunk-TWPG3TEQ.js";import{a as c}from"./chunk-ZLLER3HP.js";import*as i from"node:fs";import*as d from"node:path";var v=new Set(u);async function w(r){let{applications:l}=await h(`/api/recommendation-applications?instructionId=${encodeURIComponent(r.instructionId)}&projectPath=${encodeURIComponent(r.projectPath)}&limit=200`),t=l.filter(e=>v.has(e.status)&&e.inverse),s=[];for(let e of m(t.map(n=>({...n,appliedAt:n.appliedAt})))){let n=e.inverse;if(n.kind==="delete-paths"){let p=y(r.dir,n.paths);s.push({applicationId:e.id,target:e.targetPath,reversed:p.removed,drifted:!1,reason:p.reason}),(p.removed||p.alreadyGone)&&await f(`/api/recommendation-applications/${encodeURIComponent(e.id)}/transition`,{status:"reverted"});continue}if(n.kind!=="remove-hook-entry"){s.push({applicationId:e.id,target:e.targetPath,reversed:!1,drifted:!1,reason:`no reverser for inverse kind '${n.kind}' \u2014 recorded, not reversed`});continue}let o=g({dir:r.dir,inverse:n});s.push({applicationId:e.id,target:e.targetPath,reversed:o.removed,drifted:o.drifted,reason:o.reason}),(o.removed||o.code==="not-present")&&await f(`/api/recommendation-applications/${encodeURIComponent(e.id)}/transition`,{status:"reverted"})}return s}c(w,"reverseApplications");function y(r,l){let t=d.resolve(r),s=!1,e=0;for(let n of l){let o=d.resolve(t,n);if(o===t||!o.startsWith(t+d.sep))return{removed:!1,alreadyGone:!1,reason:`refused: ${n} does not resolve to a path inside the project`};if(!i.existsSync(o)&&!I(o)){e+=1;continue}try{i.rmSync(o,{recursive:!0,force:!0}),s=!0;let a=d.dirname(o);a.startsWith(t+d.sep)&&i.readdirSync(a).length===0&&i.rmdirSync(a)}catch(a){return{removed:!1,alreadyGone:!1,reason:`could not remove ${n}: ${a instanceof Error?a.message:String(a)}`}}}return!s&&e===l.length?{removed:!1,alreadyGone:!0,reason:"already removed"}:{removed:s,alreadyGone:!1}}c(y,"deletePaths");function I(r){try{return i.lstatSync(r).isSymbolicLink()}catch{return!1}}c(I,"isSymlink");function b(r){let l=r.name??r.instructionId,t=[],s=r.reversals.filter(e=>e.reversed);if(r.stripped.length>0)t.push(`Removed ${l} from ${r.stripped.join(", ")}.`);else if(s.length>0)for(let e of s)t.push(`Removed ${l} from ${e.target}.`),e.drifted&&t.push(" (that file had changed since it was installed; only the recorded entry was removed)");else{let e=r.searched.length>0?` (searched ${r.searched.join(", ")})`:"";t.push(`No rulemetric-managed block for ${r.instructionId} was found in this directory${e}.`)}for(let e of r.reversals.filter(n=>!n.reversed))t.push(`Still installed in ${e.target}: ${e.reason??"the recorded inverse did not apply"}`);return r.dismissalError?(t.push(`Could not record the dismissal: ${r.dismissalError}`),t.push(r.stripped.length>0||s.length>0?' What was removed above stays removed \u2014 only the "stop proposing this" record failed.':" Nothing was removed, and the dismissal was not recorded either."),t.push(" This proposal may be suggested again. Re-run this command to retry."),t):(t.push("It will not be proposed again for 30 days."),t.push("Turn auto-adoption off entirely: rulemetric suggestions auto --off"),t)}c(b,"describeUndo");export{w as a,y as b,b as c};
1
+ import{c as g}from"./chunk-JTYVBR5H.js";import{e as h,f}from"./chunk-76UKAFNM.js";import{q as u,r as m}from"./chunk-42A4PUW7.js";import{a as c}from"./chunk-ZLLER3HP.js";import*as i from"node:fs";import*as d from"node:path";var v=new Set(u);async function w(r){let{applications:l}=await h(`/api/recommendation-applications?instructionId=${encodeURIComponent(r.instructionId)}&projectPath=${encodeURIComponent(r.projectPath)}&limit=200`),t=l.filter(e=>v.has(e.status)&&e.inverse),s=[];for(let e of m(t.map(n=>({...n,appliedAt:n.appliedAt})))){let n=e.inverse;if(n.kind==="delete-paths"){let p=y(r.dir,n.paths);s.push({applicationId:e.id,target:e.targetPath,reversed:p.removed,drifted:!1,reason:p.reason}),(p.removed||p.alreadyGone)&&await f(`/api/recommendation-applications/${encodeURIComponent(e.id)}/transition`,{status:"reverted"});continue}if(n.kind!=="remove-hook-entry"){s.push({applicationId:e.id,target:e.targetPath,reversed:!1,drifted:!1,reason:`no reverser for inverse kind '${n.kind}' \u2014 recorded, not reversed`});continue}let o=g({dir:r.dir,inverse:n});s.push({applicationId:e.id,target:e.targetPath,reversed:o.removed,drifted:o.drifted,reason:o.reason}),(o.removed||o.code==="not-present")&&await f(`/api/recommendation-applications/${encodeURIComponent(e.id)}/transition`,{status:"reverted"})}return s}c(w,"reverseApplications");function y(r,l){let t=d.resolve(r),s=!1,e=0;for(let n of l){let o=d.resolve(t,n);if(o===t||!o.startsWith(t+d.sep))return{removed:!1,alreadyGone:!1,reason:`refused: ${n} does not resolve to a path inside the project`};if(!i.existsSync(o)&&!I(o)){e+=1;continue}try{i.rmSync(o,{recursive:!0,force:!0}),s=!0;let a=d.dirname(o);a.startsWith(t+d.sep)&&i.readdirSync(a).length===0&&i.rmdirSync(a)}catch(a){return{removed:!1,alreadyGone:!1,reason:`could not remove ${n}: ${a instanceof Error?a.message:String(a)}`}}}return!s&&e===l.length?{removed:!1,alreadyGone:!0,reason:"already removed"}:{removed:s,alreadyGone:!1}}c(y,"deletePaths");function I(r){try{return i.lstatSync(r).isSymbolicLink()}catch{return!1}}c(I,"isSymlink");function b(r){let l=r.name??r.instructionId,t=[],s=r.reversals.filter(e=>e.reversed);if(r.stripped.length>0)t.push(`Removed ${l} from ${r.stripped.join(", ")}.`);else if(s.length>0)for(let e of s)t.push(`Removed ${l} from ${e.target}.`),e.drifted&&t.push(" (that file had changed since it was installed; only the recorded entry was removed)");else{let e=r.searched.length>0?` (searched ${r.searched.join(", ")})`:"";t.push(`No rulemetric-managed block for ${r.instructionId} was found in this directory${e}.`)}for(let e of r.reversals.filter(n=>!n.reversed))t.push(`Still installed in ${e.target}: ${e.reason??"the recorded inverse did not apply"}`);return r.dismissalError?(t.push(`Could not record the dismissal: ${r.dismissalError}`),t.push(r.stripped.length>0||s.length>0?' What was removed above stays removed \u2014 only the "stop proposing this" record failed.':" Nothing was removed, and the dismissal was not recorded either."),t.push(" This proposal may be suggested again. Re-run this command to retry."),t):(t.push("It will not be proposed again for 30 days."),t.push("Turn auto-adoption off entirely: rulemetric suggestions auto --off"),t)}c(b,"describeUndo");export{w as a,y as b,b as c};
@@ -1 +1 @@
1
- import{b as l}from"./chunk-DDYGA2DS.js";import{a as p}from"./chunk-5RBLIVBF.js";import{h}from"./chunk-ZZHIBOMT.js";import{a as c}from"./chunk-ZLLER3HP.js";async function g(t){if(!t.worktree?.create)return t;let{branch:e,baseRef:s}=t.worktree,n=await l({repoRoot:t.projectPath,branch:e,baseRef:s});return{...t,projectPath:n.path,gitBranch:n.branch}}c(g,"resolveWorktreeForLaunch");async function L(t,e){let{mirrorId:s,tool:n}=t,{config:r}=t,a=c(o=>e.logger.info(o),"log");if(e.job.attempts>1)throw new p(`process_launch is not safe to retry (attempt ${e.job.attempts}). Re-launch manually.`);r=await g(r),r.worktree?.create&&a(`Worktree resolved: ${r.projectPath} (branch ${r.gitBranch})`),a(`Launching ${n}...`);let{getLauncher:f}=await import("./dist-NHS7HY5Q.js"),i=await f(n).launch(r);a(`Launch completed: sessionId=${i.sessionId}`);let u={...i,worktreePath:r.worktree?.create?r.projectPath:void 0,runId:r.runId};return await h(`/api/launch-jobs/${s}/state`,{result:u}).catch(o=>{a(`result persist failed: ${o instanceof Error?o.message:String(o)}`)}),u}c(L,"processLaunch");export{g as a,L as b};
1
+ import{b as l}from"./chunk-ISFPPDDB.js";import{a as p}from"./chunk-5RBLIVBF.js";import{h}from"./chunk-76UKAFNM.js";import{a as c}from"./chunk-ZLLER3HP.js";async function g(t){if(!t.worktree?.create)return t;let{branch:e,baseRef:s}=t.worktree,n=await l({repoRoot:t.projectPath,branch:e,baseRef:s});return{...t,projectPath:n.path,gitBranch:n.branch}}c(g,"resolveWorktreeForLaunch");async function L(t,e){let{mirrorId:s,tool:n}=t,{config:r}=t,a=c(o=>e.logger.info(o),"log");if(e.job.attempts>1)throw new p(`process_launch is not safe to retry (attempt ${e.job.attempts}). Re-launch manually.`);r=await g(r),r.worktree?.create&&a(`Worktree resolved: ${r.projectPath} (branch ${r.gitBranch})`),a(`Launching ${n}...`);let{getLauncher:f}=await import("./dist-GSHUC7UU.js"),i=await f(n).launch(r);a(`Launch completed: sessionId=${i.sessionId}`);let u={...i,worktreePath:r.worktree?.create?r.projectPath:void 0,runId:r.runId};return await h(`/api/launch-jobs/${s}/state`,{result:u}).catch(o=>{a(`result persist failed: ${o instanceof Error?o.message:String(o)}`)}),u}c(L,"processLaunch");export{g as a,L as b};
@@ -1 +1 @@
1
- import{b as c,f as m}from"./chunk-ZZHIBOMT.js";import{a as s}from"./chunk-ZLLER3HP.js";var R=new Set([408,429,502,503,504]),_=12e4,T=2e4,b=1e3,l=15e3;function p(t,e){try{t(JSON.stringify({ts:new Date().toISOString(),...e}))}catch{t(`[agent-loop] log_error event=${e.event}`)}}s(p,"structuredLog");function f(t,e){return e.aborted?Promise.resolve(!1):t<=0?Promise.resolve(!0):new Promise(r=>{let a=setTimeout(()=>{e.removeEventListener("abort",o),r(!0)},t),o=s(()=>{clearTimeout(a),e.removeEventListener("abort",o),r(!1)},"onAbort");e.addEventListener("abort",o,{once:!0})})}s(f,"abortableSleep");function g(t){return t instanceof c?R.has(t.statusCode):!0}s(g,"isRetryableReportError");async function S(t,e,r){let a=Date.now()+r.budgetMs,o=b;for(let i=1;;i++)try{return await m(t,e),{ok:!0,attempts:i}}catch(n){let u=a-Date.now();if(!g(n)||u<=0||r.signal.aborted)return{ok:!1,attempts:i,error:n};if(p(r.log,{event:`${r.event}_retry`,jobId:r.jobId,attempt:i,status:n instanceof c?n.statusCode:void 0,error:n instanceof Error?n.message:String(n),retryInMs:Math.min(o,u)}),!await f(Math.min(o,u),r.signal))return{ok:!1,attempts:i,error:n};o=Math.min(o*2,l)}}s(S,"postReportWithRetry");export{R as a,_ as b,T as c,b as d,l as e,p as f,f as g,g as h,S as i};
1
+ import{b as c,f as m}from"./chunk-76UKAFNM.js";import{a as s}from"./chunk-ZLLER3HP.js";var R=new Set([408,429,502,503,504]),_=12e4,T=2e4,b=1e3,l=15e3;function p(t,e){try{t(JSON.stringify({ts:new Date().toISOString(),...e}))}catch{t(`[agent-loop] log_error event=${e.event}`)}}s(p,"structuredLog");function f(t,e){return e.aborted?Promise.resolve(!1):t<=0?Promise.resolve(!0):new Promise(r=>{let a=setTimeout(()=>{e.removeEventListener("abort",o),r(!0)},t),o=s(()=>{clearTimeout(a),e.removeEventListener("abort",o),r(!1)},"onAbort");e.addEventListener("abort",o,{once:!0})})}s(f,"abortableSleep");function g(t){return t instanceof c?R.has(t.statusCode):!0}s(g,"isRetryableReportError");async function S(t,e,r){let a=Date.now()+r.budgetMs,o=b;for(let i=1;;i++)try{return await m(t,e),{ok:!0,attempts:i}}catch(n){let u=a-Date.now();if(!g(n)||u<=0||r.signal.aborted)return{ok:!1,attempts:i,error:n};if(p(r.log,{event:`${r.event}_retry`,jobId:r.jobId,attempt:i,status:n instanceof c?n.statusCode:void 0,error:n instanceof Error?n.message:String(n),retryInMs:Math.min(o,u)}),!await f(Math.min(o,u),r.signal))return{ok:!1,attempts:i,error:n};o=Math.min(o*2,l)}}s(S,"postReportWithRetry");export{R as a,_ as b,T as c,b as d,l as e,p as f,f as g,g as h,S as i};
@@ -1,4 +1,4 @@
1
- import{b as E,d as R}from"./chunk-ZZHIBOMT.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as C}from"node:crypto";import{existsSync as A,mkdirSync as I,readFileSync as p,renameSync as L,rmdirSync as M,writeFileSync as m}from"node:fs";import{homedir as U,tmpdir as x}from"node:os";import{join as c}from"node:path";var $=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function v(t){return $.test(t)?t:`antigravity-${C("sha256").update(t).digest("hex").slice(0,16)}`}o(v,"hookSessionKey");var _=100,F=new Set(["RUN_COMMAND","VIEW_FILE","LIST_DIRECTORY","CODE_ACTION","GREP_SEARCH","SEARCH_WEB"]),H=new Set(["CONVERSATION_HISTORY","KNOWLEDGE_ARTIFACTS","CHECKPOINT"]);function T(){return process.env.RULEMETRIC_CONFIG_DIR??c(U(),".config","rulemetric")}o(T,"configDir");function O(){return c(T(),"antigravity-state")}o(O,"stateDir");function P(t){return c(O(),`${t}.json`)}o(P,"stateFile");function k(){let t=c(T(),"env");if(A(t))try{let n=p(t,"utf-8");for(let r of n.split(/\r?\n/)){let e=r.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);if(!e)continue;let i=e[1];if(process.env[i]!==void 0)continue;let s=e[2];(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),process.env[i]=s}}catch{}}o(k,"loadEnvFile");function b(t){try{let n=p(P(t),"utf-8"),r=JSON.parse(n);if(r&&typeof r=="object"&&"lastStepIdx"in r){let e=r.lastStepIdx;if(typeof e=="number"&&Number.isFinite(e))return{lastStepIdx:e}}}catch{}return null}o(b,"loadState");function g(t,n){I(O(),{recursive:!0});let r=P(t),e=`${r}.tmp`;m(e,JSON.stringify(n),{mode:384});try{L(e,r)}catch{m(r,JSON.stringify(n),{mode:384})}}o(g,"saveState");function N(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=c(r,v(t));try{return p(e,"utf-8").trim()||null}catch{return null}}o(N,"resolveRwSessionId");function W(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=v(t),i=c(r,`${e}.seq`),s=c(r,`${e}.seqlock`),l=Date.now()+5e3;for(;Date.now()<l;)try{I(s);break}catch{}let a=1;try{a=parseInt(p(i,"utf-8").trim(),10)+1,(!Number.isFinite(a)||a<1)&&(a=1)}catch{a=1}try{m(i,String(a))}catch{}try{M(s)}catch{}return a}o(W,"nextSequence");function Y(t,n){let r;try{r=p(t,"utf-8")}catch{return[]}let e=[];for(let i of r.split(/\r?\n/))if(i.trim())try{let s=JSON.parse(i);typeof s.step_index=="number"&&s.step_index>n&&e.push(s)}catch{}return e.sort((i,s)=>i.step_index-s.step_index),e}o(Y,"readNewRecords");function G(t){let n;try{n=p(t,"utf-8")}catch{return-1}let r=-1;for(let e of n.split(/\r?\n/))if(e.trim())try{let i=JSON.parse(e);typeof i.step_index=="number"&&i.step_index>r&&(r=i.step_index)}catch{}return r}o(G,"findMaxStepIndex");function J(t){let n=t.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/);return n?n[1].trim():t.trim()}o(J,"extractUserPrompt");function j(t,n){let r=t.created_at??new Date().toISOString(),e={antigravityStepIndex:t.step_index,antigravitySource:t.source,antigravityType:t.type};if(H.has(t.type)||F.has(t.type))return null;if(t.source==="USER_EXPLICIT"&&t.type==="USER_INPUT")return{sequence:n,eventType:"user_message",content:J(t.content??""),timestamp:r,metadata:e};if(t.source==="MODEL"&&t.type==="PLANNER_RESPONSE"){let i=[];return t.thinking&&t.thinking.trim()&&i.push(`[thinking]
1
+ import{b as E,d as R}from"./chunk-76UKAFNM.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as C}from"node:crypto";import{existsSync as A,mkdirSync as I,readFileSync as p,renameSync as L,rmdirSync as M,writeFileSync as m}from"node:fs";import{homedir as U,tmpdir as x}from"node:os";import{join as c}from"node:path";var $=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function v(t){return $.test(t)?t:`antigravity-${C("sha256").update(t).digest("hex").slice(0,16)}`}o(v,"hookSessionKey");var _=100,F=new Set(["RUN_COMMAND","VIEW_FILE","LIST_DIRECTORY","CODE_ACTION","GREP_SEARCH","SEARCH_WEB"]),H=new Set(["CONVERSATION_HISTORY","KNOWLEDGE_ARTIFACTS","CHECKPOINT"]);function T(){return process.env.RULEMETRIC_CONFIG_DIR??c(U(),".config","rulemetric")}o(T,"configDir");function O(){return c(T(),"antigravity-state")}o(O,"stateDir");function P(t){return c(O(),`${t}.json`)}o(P,"stateFile");function k(){let t=c(T(),"env");if(A(t))try{let n=p(t,"utf-8");for(let r of n.split(/\r?\n/)){let e=r.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);if(!e)continue;let i=e[1];if(process.env[i]!==void 0)continue;let s=e[2];(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),process.env[i]=s}}catch{}}o(k,"loadEnvFile");function b(t){try{let n=p(P(t),"utf-8"),r=JSON.parse(n);if(r&&typeof r=="object"&&"lastStepIdx"in r){let e=r.lastStepIdx;if(typeof e=="number"&&Number.isFinite(e))return{lastStepIdx:e}}}catch{}return null}o(b,"loadState");function g(t,n){I(O(),{recursive:!0});let r=P(t),e=`${r}.tmp`;m(e,JSON.stringify(n),{mode:384});try{L(e,r)}catch{m(r,JSON.stringify(n),{mode:384})}}o(g,"saveState");function N(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=c(r,v(t));try{return p(e,"utf-8").trim()||null}catch{return null}}o(N,"resolveRwSessionId");function W(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=v(t),i=c(r,`${e}.seq`),s=c(r,`${e}.seqlock`),l=Date.now()+5e3;for(;Date.now()<l;)try{I(s);break}catch{}let a=1;try{a=parseInt(p(i,"utf-8").trim(),10)+1,(!Number.isFinite(a)||a<1)&&(a=1)}catch{a=1}try{m(i,String(a))}catch{}try{M(s)}catch{}return a}o(W,"nextSequence");function Y(t,n){let r;try{r=p(t,"utf-8")}catch{return[]}let e=[];for(let i of r.split(/\r?\n/))if(i.trim())try{let s=JSON.parse(i);typeof s.step_index=="number"&&s.step_index>n&&e.push(s)}catch{}return e.sort((i,s)=>i.step_index-s.step_index),e}o(Y,"readNewRecords");function G(t){let n;try{n=p(t,"utf-8")}catch{return-1}let r=-1;for(let e of n.split(/\r?\n/))if(e.trim())try{let i=JSON.parse(e);typeof i.step_index=="number"&&i.step_index>r&&(r=i.step_index)}catch{}return r}o(G,"findMaxStepIndex");function J(t){let n=t.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/);return n?n[1].trim():t.trim()}o(J,"extractUserPrompt");function j(t,n){let r=t.created_at??new Date().toISOString(),e={antigravityStepIndex:t.step_index,antigravitySource:t.source,antigravityType:t.type};if(H.has(t.type)||F.has(t.type))return null;if(t.source==="USER_EXPLICIT"&&t.type==="USER_INPUT")return{sequence:n,eventType:"user_message",content:J(t.content??""),timestamp:r,metadata:e};if(t.source==="MODEL"&&t.type==="PLANNER_RESPONSE"){let i=[];return t.thinking&&t.thinking.trim()&&i.push(`[thinking]
2
2
  ${t.thinking.trim()}`),t.content&&t.content.trim()&&i.push(t.content.trim()),t.tool_calls&&t.tool_calls.length>0&&(e.antigravityToolCalls=t.tool_calls.map(s=>s.name).filter(Boolean)),{sequence:n,eventType:"assistant_response",content:i.join(`
3
3
 
4
4
  `)||null,timestamp:r,metadata:e}}return t.source==="MODEL"&&t.type==="GENERIC"?{sequence:n,eventType:"tool_result",content:t.content??null,timestamp:r,metadata:e}:t.source==="SYSTEM"&&(t.type==="SYSTEM_MESSAGE"||t.type==="ERROR_MESSAGE")?null:{sequence:n,eventType:`antigravity_${t.type.toLowerCase()}`,content:t.content??null,timestamp:r,metadata:e}}o(j,"classifyRecord");function q(t){try{let n=JSON.parse(t);return n&&typeof n=="object"?n:null}catch{return null}}o(q,"parseHookPayload");async function K(t,n,r,e,i={}){let s=i.errorSink??(u=>process.stderr.write(u)),l=0,a=0,d=0,S=0,f=e;for(let u of t){l++,i.onProgress?.({attempted:l,total:t.length,record:u});let w=W(r),y=j(u,w);if(!y)S++;else try{await R(`/api/sessions/${n}/events`,{method:"POST",body:y}),a++}catch(h){d++;let D=h instanceof E?h.statusCode:"unknown";s(`[antigravity-tailer] failed step=${u.step_index} type=${u.type} status=${D}
@@ -1,4 +1,4 @@
1
- import{h as E}from"./chunk-GN46S7T4.js";import{a as r}from"./chunk-ZLLER3HP.js";var g="<<<FILE-CONTENT-BEGIN>>>",m="<<<FILE-CONTENT-END>>>",b="<RATIONALE>",R="</RATIONALE>",u="<PROPOSED_INSTRUCTION>",p="</PROPOSED_INSTRUCTION>",d=.5,f=3;function y(e){let t=e.immutableSections.length>0?e.immutableSections.map(s=>` - ${s}`).join(`
1
+ import{h as E}from"./chunk-N4YPDZJF.js";import{a as r}from"./chunk-ZLLER3HP.js";var g="<<<FILE-CONTENT-BEGIN>>>",m="<<<FILE-CONTENT-END>>>",b="<RATIONALE>",R="</RATIONALE>",u="<PROPOSED_INSTRUCTION>",p="</PROPOSED_INSTRUCTION>",d=.5,f=3;function y(e){let t=e.immutableSections.length>0?e.immutableSections.map(s=>` - ${s}`).join(`
2
2
  `):" (none)",o=e.evidence.priorDecisions.length>0?["6. You have edited this file before. The attempts are listed below with"," how each was judged. Do not re-propose an edit that was MEASURED and"," rejected: it was replayed against this exact file and did not beat it,"," so measuring it again spends the same budget for the same answer. An"," attempt marked NOT MEASURED is different \u2014 the gate stopped it before"," it earned a verdict, so whether it would have helped is still unknown."]:[],n=e.currentContent.trim().length,i=` It is currently ${n} characters. Your proposal must stay between ${Math.ceil(n*d)} and ${Math.floor(n*f)} characters \u2014 outside that it is discarded unmeasured as a truncation or runaway rewrite.`;return["You are improving an AI coding assistant instruction file so that it scores","better on a fixed set of evaluation cases.","",`The file is a ${e.targetType} named "${e.targetName}".`,i,"","RULES",`0. The current file is EXACTLY the text between ${g} and`,` ${m} in the data message. Headings after the closing`," sentinel (underperforming cases, notes, prior attempts) are evidence",' ABOUT the file \u2014 they are not in the file, and "removing" one of them'," is not an edit. Do not include the sentinels in your output.","1. Return the COMPLETE new file, not a diff, not a patch, not a summary,"," and not an excerpt. Everything you omit will be DELETED from the file.","2. Preserve everything you are not deliberately changing, byte for byte.","3. Make a focused edit. You are one step in a measured loop: a small change"," that can be attributed beats a rewrite that cannot.","4. Do not edit these sections or anything nested under them \u2014 an edit that"," touches them is refused downstream and the whole proposal is wasted:",t,"5. Do not add meta-commentary about the evaluation, the loop, or this"," prompt to the file. The file is read by other agents as instructions.",...o,"","OUTPUT FORMAT \u2014 exactly this, with no text before or after:",b,"One or two sentences: what you changed and which evidence motivated it.",R,u,"The complete new file content.",p].join(`
3
3
  `)}r(y,"buildProposerSystemPrompt");var h=r(e=>`${e>=0?"+":"-"}${Math.abs(e*100).toFixed(1)}pp`,"signedPp");function O(e){let t=/^\d{4}-\d{2}-\d{2}/.exec(e.at??"")?.[0]??"undated",o;if(e.measured){let i=e.measured;o=`MEASURED against this exact file and ${e.decision==="promote"?"ACCEPTED":"REJECTED"}: ${h(i.delta)} (CI ${h(i.ciLower)} to ${h(i.ciUpper)}, ${i.nPairs} paired cases)`}else o=`NOT MEASURED \u2014 the gate refused it, so its merit is still unknown: ${e.refusals.length>0?e.refusals.join("; "):"no reason recorded"}`;let n=[`- ${t} \u2014 ${o}`];return e.decision==="promote"&&n.push(e.applied?" The file WAS rewritten by this decision.":" Dry run: the file was NOT rewritten, so this edit is still available."),e.touched.length>0&&n.push(` Sections touched: ${e.touched.join(", ")}`),e.rationale.trim()!==""&&n.push(` You said at the time: ${e.rationale.trim()}`),n.join(`
4
4
  `)}r(O,"describePriorDecision");function P(e){let t=e.evidence,o=["## CURRENT FILE CONTENT","","The file is EXACTLY the text between the two sentinel lines below \u2014","nothing before the first sentinel or after the second is part of it.","Everything after the closing sentinel is evidence ABOUT the file.","",g,e.currentContent,m,""];if(t.weakest.length>0){o.push("## CASES WHERE THIS FILE CURRENTLY UNDERPERFORMS","");for(let n of t.weakest)o.push(`- ${n.name}: passes ${(n.withPassRate*100).toFixed(0)}% with the file vs ${(n.withoutPassRate*100).toFixed(0)}% without it`);o.push("")}return t.nonDiscriminating.length>0&&o.push("## CASES THAT CARRY NO SIGNAL EITHER WAY","","These score the same with and without the file. Changing the file to chase","them is unlikely to move anything.","",...t.nonDiscriminating.map(n=>`- ${n}`),""),t.priorDecisions.length>0&&o.push("## WHAT YOU ALREADY PROPOSED FOR THIS FILE, AND HOW IT WAS JUDGED","","Newest first. Every attempt listed here was made against the file above,","byte for byte. Attempts against a different version of the file are not","shown, because a verdict earned by different text says nothing about this","one.","",...t.priorDecisions.map(O),""),t.notes.length>0&&o.push("## NOTES","",...t.notes.map(n=>`- ${n}`),""),o.join(`
@@ -1,3 +1,3 @@
1
- import{e as p}from"./chunk-LJRE3LZ2.js";import{C as f}from"./chunk-TWPG3TEQ.js";import{a as r}from"./chunk-ZLLER3HP.js";var g=80,h=/\b(must|never|always|do not|don'?t|avoid|prefer|require[sd]?|before|after|only|instead of|use|run|add|keep|stop|refuse|check|verify|ask|write|read)\b/i,m=200,k=r(()=>({asks:[],omitted:0}),"empty");function A(s){return s.replace(/\s+/g," ").trim().toLowerCase()}r(A,"key");function I(s){let t=[];for(let o of s.split(`
1
+ import{e as p}from"./chunk-LJRE3LZ2.js";import{C as f}from"./chunk-42A4PUW7.js";import{a as r}from"./chunk-ZLLER3HP.js";var g=80,h=/\b(must|never|always|do not|don'?t|avoid|prefer|require[sd]?|before|after|only|instead of|use|run|add|keep|stop|refuse|check|verify|ask|write|read)\b/i,m=200,k=r(()=>({asks:[],omitted:0}),"empty");function A(s){return s.replace(/\s+/g," ").trim().toLowerCase()}r(A,"key");function I(s){let t=[];for(let o of s.split(`
2
2
  `)){let e=o.trim(),n=t.length>0?t[t.length-1]:"",i=e===""||/^(?:[-*+]|\d+[.)]|#|```|>|\||!)/.test(e);if(n!==""&&!/[.!?:;]$/.test(n)&&!/^(?:#|```)/.test(n)&&!i){t[t.length-1]=`${n} ${e}`;continue}t.push(e)}return t.join(`
3
3
  `)}r(I,"unwrap");function y(s,t=p){if(!s)return k();try{let o=new Set,e=[],n=[];for(let l of t(s))for(let d of f(I(l.content))){let c=A(d);if(c===""||o.has(c))continue;o.add(c);let a=d.replace(/\s+/g," ").trim(),u=a.length>m?`${a.slice(0,m)}\u2026`:a;(h.test(u)?e:n).push(u)}let i=[...e,...n];return{asks:i.slice(0,g),omitted:Math.max(0,i.length-g)}}catch{return k()}}r(y,"readInstalledAsks");export{g as a,m as b,y as c};
@@ -1 +1 @@
1
- import{a as i}from"./chunk-JRWQJZYQ.js";import{h as s}from"./chunk-ZZHIBOMT.js";import{a as n}from"./chunk-ZLLER3HP.js";async function l(a,c){let{mirrorId:g,evalTargetId:p,config:r}=a,e=n(o=>c.logger.info(o),"log");await i(r,p,e);let t={type:"conversation",conversationId:r.conversationId};return await s(`/api/eval-jobs/${g}/state`,{result:t}).catch(o=>{e(`result persist failed: ${o instanceof Error?o.message:String(o)}`)}),t}n(l,"processConversation");export{l as a};
1
+ import{a as i}from"./chunk-MMLRWCBW.js";import{h as s}from"./chunk-76UKAFNM.js";import{a as n}from"./chunk-ZLLER3HP.js";async function l(a,c){let{mirrorId:g,evalTargetId:p,config:r}=a,e=n(o=>c.logger.info(o),"log");await i(r,p,e);let t={type:"conversation",conversationId:r.conversationId};return await s(`/api/eval-jobs/${g}/state`,{result:t}).catch(o=>{e(`result persist failed: ${o instanceof Error?o.message:String(o)}`)}),t}n(l,"processConversation");export{l as a};
@@ -1 +1 @@
1
- import{a as j}from"./chunk-N26UEHI3.js";import{a as E}from"./chunk-NBTC5FNV.js";import{a as J}from"./chunk-TU2AR6XO.js";import{d as T}from"./chunk-NJ5UED3H.js";import{b as I,c as P,d as v}from"./chunk-MX34N7Y5.js";import{a as b}from"./chunk-ZLLER3HP.js";import{useEffect as R,useState as i}from"react";import{Box as l,Text as s,useInput as Z}from"ink";import{jsx as t,jsxs as a}from"react/jsx-runtime";function K({onClose:A,activeOrg:F,defaultProjectPath:y,width:_}){let{jobs:u,error:L,loading:$,refetch:S}=j(20),[M,C]=i([]),[d,m]=i("list"),[f,w]=i(0),[h,g]=i(null),[x,B]=i(null),[p,c]=i(null);R(()=>{v().then(C).catch(o=>{let r=o instanceof Error?o.message:String(o);c(`couldn't load launchers: ${r}`),C([{tool:"claude_code",capabilities:{headless:!0,interactive:!0,remoteSpawn:!0}}])})},[]),R(()=>{if(!p)return;let o=setTimeout(()=>c(null),5e3);return()=>clearTimeout(o)},[p]),Z((o,r)=>{if(h){if(o==="y"||o==="Y"){let e=h.id;g(null),P(e).then(()=>{S(),c(`cancelled ${e.slice(0,8)}`)}).catch(n=>c(`cancel failed: ${n instanceof Error?n.message:String(n)}`))}else(o==="n"||o==="N"||r.escape)&&g(null);return}if(r.escape){if(d!=="none"){m("none");return}A();return}if(r.tab){m(e=>e==="list"?"form":e==="form"?"none":"list");return}if(o!=="q"&&d==="list"){if(r.upArrow)w(e=>Math.max(0,e-1));else if(r.downArrow)w(e=>Math.min(u.length-1,e+1));else if(o==="c"){let e=u[f];e&&(e.status==="running"||e.status==="queued"||e.status==="pending")&&g(e)}else if(o==="r"){let e=u[f],n=e?.result?.externalSessionId;e&&e.tool==="claude_code"&&n?(B({tool:"claude_code",projectPath:e.config.projectPath,resumeSessionId:n}),m("form")):c("resume needs a Claude Code session with a session id")}else if(o==="o"){let n=u[f]?.result?.externalSessionId;if(n){let O=process.env.RULEMETRIC_WEB_URL??"http://localhost:5174";import("node:child_process").then(({spawn:U})=>{U("open",[`${O}/sessions/${n}`],{detached:!0,stdio:"ignore"}).unref()})}}}});async function N(o){await I(o),B(null),m("list"),c("launched"),S()}return b(N,"handleSubmit"),a(l,{flexDirection:"column",borderStyle:"round",borderColor:T,width:_,paddingX:1,children:[a(l,{children:[t(s,{bold:!0,color:T,children:"Launcher"}),t(s,{dimColor:!0,children:" active org: "}),t(s,{children:F??"(none)"}),$&&t(s,{dimColor:!0,children:" loading\u2026"}),L&&a(s,{color:"#F55B5B",children:[" \u26A0 ",L]})]}),t(l,{marginTop:1,children:t(E,{jobs:u,selectedIndex:f,focused:d==="list"})}),t(l,{marginTop:1,children:t(J,{launchers:M,defaultProjectPath:x?.projectPath??y,defaultTool:x?.tool,defaultResumeSessionId:x?.resumeSessionId,focused:d==="form",onSubmit:N})}),h&&t(l,{marginTop:1,children:a(s,{color:"#FFD700",children:["Cancel job ",h.id.slice(0,8),"? (y/n)"]})}),p&&t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\xB7 ",p]})}),t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\u2191\u2193 select tab focus c cancel r resume o open esc ",d==="none"?"close":"back"]})})]})}b(K,"LauncherOverlay");export{K as a};
1
+ import{a as j}from"./chunk-5Z3H5JHK.js";import{a as E}from"./chunk-NBTC5FNV.js";import{a as J}from"./chunk-TU2AR6XO.js";import{d as T}from"./chunk-NJ5UED3H.js";import{b as I,c as P,d as v}from"./chunk-44TYRMIS.js";import{a as b}from"./chunk-ZLLER3HP.js";import{useEffect as R,useState as i}from"react";import{Box as l,Text as s,useInput as Z}from"ink";import{jsx as t,jsxs as a}from"react/jsx-runtime";function K({onClose:A,activeOrg:F,defaultProjectPath:y,width:_}){let{jobs:u,error:L,loading:$,refetch:S}=j(20),[M,C]=i([]),[d,m]=i("list"),[f,w]=i(0),[h,g]=i(null),[x,B]=i(null),[p,c]=i(null);R(()=>{v().then(C).catch(o=>{let r=o instanceof Error?o.message:String(o);c(`couldn't load launchers: ${r}`),C([{tool:"claude_code",capabilities:{headless:!0,interactive:!0,remoteSpawn:!0}}])})},[]),R(()=>{if(!p)return;let o=setTimeout(()=>c(null),5e3);return()=>clearTimeout(o)},[p]),Z((o,r)=>{if(h){if(o==="y"||o==="Y"){let e=h.id;g(null),P(e).then(()=>{S(),c(`cancelled ${e.slice(0,8)}`)}).catch(n=>c(`cancel failed: ${n instanceof Error?n.message:String(n)}`))}else(o==="n"||o==="N"||r.escape)&&g(null);return}if(r.escape){if(d!=="none"){m("none");return}A();return}if(r.tab){m(e=>e==="list"?"form":e==="form"?"none":"list");return}if(o!=="q"&&d==="list"){if(r.upArrow)w(e=>Math.max(0,e-1));else if(r.downArrow)w(e=>Math.min(u.length-1,e+1));else if(o==="c"){let e=u[f];e&&(e.status==="running"||e.status==="queued"||e.status==="pending")&&g(e)}else if(o==="r"){let e=u[f],n=e?.result?.externalSessionId;e&&e.tool==="claude_code"&&n?(B({tool:"claude_code",projectPath:e.config.projectPath,resumeSessionId:n}),m("form")):c("resume needs a Claude Code session with a session id")}else if(o==="o"){let n=u[f]?.result?.externalSessionId;if(n){let O=process.env.RULEMETRIC_WEB_URL??"http://localhost:5174";import("node:child_process").then(({spawn:U})=>{U("open",[`${O}/sessions/${n}`],{detached:!0,stdio:"ignore"}).unref()})}}}});async function N(o){await I(o),B(null),m("list"),c("launched"),S()}return b(N,"handleSubmit"),a(l,{flexDirection:"column",borderStyle:"round",borderColor:T,width:_,paddingX:1,children:[a(l,{children:[t(s,{bold:!0,color:T,children:"Launcher"}),t(s,{dimColor:!0,children:" active org: "}),t(s,{children:F??"(none)"}),$&&t(s,{dimColor:!0,children:" loading\u2026"}),L&&a(s,{color:"#F55B5B",children:[" \u26A0 ",L]})]}),t(l,{marginTop:1,children:t(E,{jobs:u,selectedIndex:f,focused:d==="list"})}),t(l,{marginTop:1,children:t(J,{launchers:M,defaultProjectPath:x?.projectPath??y,defaultTool:x?.tool,defaultResumeSessionId:x?.resumeSessionId,focused:d==="form",onSubmit:N})}),h&&t(l,{marginTop:1,children:a(s,{color:"#FFD700",children:["Cancel job ",h.id.slice(0,8),"? (y/n)"]})}),p&&t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\xB7 ",p]})}),t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\u2191\u2193 select tab focus c cancel r resume o open esc ",d==="none"?"close":"back"]})})]})}b(K,"LauncherOverlay");export{K as a};
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-ZLLER3HP.js";import{z as e}from"zod";var l=e.enum(["claude","codex","pi"]),d=e.string().trim().min(1).max(200).nullable(),c=o((n,r)=>{n.engine==="codex"&&!n.model&&r.addIssue({code:"custom",path:["model"],message:"Codex requires a model pin"}),n.engine==="pi"&&!/^[^\s/:]+\/[^\s/]+$/.test(n.model??"")&&r.addIssue({code:"custom",path:["model"],message:"Pi requires a provider/model pin (for example openai-codex/gpt-5.4-mini)"}),n.engine===null&&n.model!==null&&r.addIssue({code:"custom",path:["model"],message:"Choose an engine before a model"})},"requirePin"),u=e.object({engine:l.nullable(),model:d}).strict().superRefine(c),p=e.object({preference:u,workers:e.array(e.object({lastSeen:e.string(),protocol:e.number().nullable(),engines:e.array(e.string())})).optional(),graderBlockers:e.array(e.object({targetId:e.string(),name:e.string(),engine:e.string(),model:e.string()})).optional()}),g=e.object({cadence:e.string(),summary:e.string(),readiness:e.object({ready:e.boolean(),reported:e.boolean(),missing:e.array(e.string())}),sweeps:e.array(e.object({task:e.string(),last:e.object({status:e.string(),decision:e.string().nullable(),reason:e.string().nullable()}).nullable()}))});function b(n){let{preference:r,workers:t,graderBlockers:a}=n,s=[{id:"actor",label:"Measurement actor",detail:r.engine?`${r.engine} \xB7 ${r.model??"CLI default"}`:"Unset \u2014 existing worker defaults"},{id:"workers",label:"Worker reports",detail:t===void 0?"Unavailable":t.length===0?"No recent worker report \u2014 start or upgrade your worker":t.map(i=>`${i.engines.join(", ")||"no engines"} (protocol ${i.protocol??"unknown"})`).join("; ")},{id:"readiness",label:"Trial readiness",detail:"Check each eval target for nightly readiness, schedule and latest batch. Engine detection does not guarantee credits."},{id:"grader",label:"Independent graders",detail:a===void 0?"Readiness unavailable":a.length?`${a.length} target(s) lack a compatible actor/grader worker`:"No reported grader blockers; pins are configured per target"}];return r.engine==="pi"&&s.push({id:"limit",label:"Pi",detail:"Uses the selected provider/model. Harbor is unsupported."}),r.engine==="codex"&&s.push({id:"limit",label:"Codex",detail:"Reports tokens, not measured dollars. Harbor dollar-cost-only tasks are unsupported."}),s}o(b,"measurementRows");function h(n){return[{id:"harbor",label:"Harbor schedule",detail:n.summary},{id:"harbor-worker",label:"Harbor worker",detail:n.readiness.reported?n.readiness.ready?"Dependencies reported ready; local worker and Docker must remain available":`Not ready: ${n.readiness.missing.join(", ")}`:"No recent readiness report"},...n.sweeps.map(r=>({id:`harbor-${r.task}`,label:r.task,detail:r.last?`${r.last.decision??r.last.status} \u2014 ${r.last.reason??"No result detail"}`:"Not run yet"}))]}o(h,"harborRows");var f=e.object({version:e.literal(1),engine:l,model:d,source:e.enum(["account","explicit"])}).strict().superRefine(c),k="claude-haiku-4-5";export{u as a,p as b,g as c,b as d,h as e,f,k as g};
@@ -1 +1 @@
1
- import{f as u}from"./chunk-ZZHIBOMT.js";import{a as m}from"./chunk-ZLLER3HP.js";async function p(n,a,s){if(a)try{let t=Array.isArray(n.recommendation_candidates)?n.recommendation_candidates.filter(e=>typeof e.title=="string"&&typeof e.artifact=="string"&&typeof e.canonicalBody=="string"&&e.canonicalBody.trim().length>=12).map(e=>({title:String(e.title).trim(),artifact:String(e.artifact),canonicalBody:String(e.canonicalBody).trim(),rationale:String(e.rationale??""),evidence:Array.isArray(e.evidence)?e.evidence:[],outcomeMetric:String(e.outcomeMetric??"session_outcome"),renderings:Array.isArray(e.renderings)?e.renderings:[]})):[],i=n.suggestions,l=Array.isArray(i?.claude_md_additions)?i.claude_md_additions.filter(e=>typeof e?.addition=="string"&&e.addition.trim().length>=12).map(e=>({addition:String(e.addition).trim(),why:String(e.why??"")})):[],d=Array.isArray(n.recommended_skills)?n.recommended_skills.filter(e=>typeof e?.skillId=="string"&&e.skillId.length>0).map(e=>({skillId:String(e.skillId),reason:String(e.reason??"")})):[],g=Array.isArray(i?.features_to_try)?i.features_to_try.filter(e=>typeof e?.feature=="string"&&e.feature.trim().length>=2).map(e=>({feature:String(e.feature).trim(),one_liner:String(e.one_liner??""),why_for_you:String(e.why_for_you??""),example_code:String(e.example_code??"")})):[],c=[...Array.isArray(i?.usage_patterns)?i.usage_patterns.map(e=>({title:String(e.title??"").trim(),lead:String(e.suggestion??""),detail:String(e.detail??""),copyable_prompt:String(e.copyable_prompt??""),origin:"usage_pattern"})):[],...Array.isArray(n.on_the_horizon?.opportunities)?n.on_the_horizon.opportunities.map(e=>({title:String(e.title??"").trim(),lead:String(e.whats_possible??""),detail:String(e.how_to_try??""),copyable_prompt:String(e.copyable_prompt??""),origin:"opportunity"})):[]].filter(e=>e.title.length>=2);if(t.length===0&&l.length===0&&d.length===0&&g.length===0&&c.length===0)return;let r=await u("/api/insights/recommendations/nominate",{projectPath:a,candidates:t.slice(0,40),additions:l.slice(0,20),skills:d.slice(0,20),features:g.slice(0,20),advice:c.slice(0,40)}),o=r.additionsRejected??[];s(` ${r.nominated} recommendation(s) nominated into the suggestion feed (${r.additionsCreated} new instruction(s)`+((r.featuresCreated??0)>0?`, ${r.featuresCreated} feature proposal(s)`:"")+((r.adviceCreated??0)>0?`, ${r.adviceCreated} pattern/opportunity`:"")+(r.skillsUnresolved>0?`, ${r.skillsUnresolved} skill slug(s) unresolved`:"")+(o.length>0?`, ${o.length} rejected as unfilled templates`:"")+")");for(let e of o)s(` rejected "${e.name}" \u2014 unfilled placeholder(s): ${e.placeholders.join(", ")}`);for(let e of r.itemsFailed??[])s(` failed "${e.name}" \u2014 ${e.error}`)}catch(t){s(` nomination skipped (whole batch): ${t instanceof Error?t.message:String(t)}`)}}m(p,"nominateRecommendations");export{p as a};
1
+ import{f as u}from"./chunk-76UKAFNM.js";import{a as m}from"./chunk-ZLLER3HP.js";async function p(n,a,s){if(a)try{let t=Array.isArray(n.recommendation_candidates)?n.recommendation_candidates.filter(e=>typeof e.title=="string"&&typeof e.artifact=="string"&&typeof e.canonicalBody=="string"&&e.canonicalBody.trim().length>=12).map(e=>({title:String(e.title).trim(),artifact:String(e.artifact),canonicalBody:String(e.canonicalBody).trim(),rationale:String(e.rationale??""),evidence:Array.isArray(e.evidence)?e.evidence:[],outcomeMetric:String(e.outcomeMetric??"session_outcome"),renderings:Array.isArray(e.renderings)?e.renderings:[]})):[],i=n.suggestions,l=Array.isArray(i?.claude_md_additions)?i.claude_md_additions.filter(e=>typeof e?.addition=="string"&&e.addition.trim().length>=12).map(e=>({addition:String(e.addition).trim(),why:String(e.why??"")})):[],d=Array.isArray(n.recommended_skills)?n.recommended_skills.filter(e=>typeof e?.skillId=="string"&&e.skillId.length>0).map(e=>({skillId:String(e.skillId),reason:String(e.reason??"")})):[],g=Array.isArray(i?.features_to_try)?i.features_to_try.filter(e=>typeof e?.feature=="string"&&e.feature.trim().length>=2).map(e=>({feature:String(e.feature).trim(),one_liner:String(e.one_liner??""),why_for_you:String(e.why_for_you??""),example_code:String(e.example_code??"")})):[],c=[...Array.isArray(i?.usage_patterns)?i.usage_patterns.map(e=>({title:String(e.title??"").trim(),lead:String(e.suggestion??""),detail:String(e.detail??""),copyable_prompt:String(e.copyable_prompt??""),origin:"usage_pattern"})):[],...Array.isArray(n.on_the_horizon?.opportunities)?n.on_the_horizon.opportunities.map(e=>({title:String(e.title??"").trim(),lead:String(e.whats_possible??""),detail:String(e.how_to_try??""),copyable_prompt:String(e.copyable_prompt??""),origin:"opportunity"})):[]].filter(e=>e.title.length>=2);if(t.length===0&&l.length===0&&d.length===0&&g.length===0&&c.length===0)return;let r=await u("/api/insights/recommendations/nominate",{projectPath:a,candidates:t.slice(0,40),additions:l.slice(0,20),skills:d.slice(0,20),features:g.slice(0,20),advice:c.slice(0,40)}),o=r.additionsRejected??[];s(` ${r.nominated} recommendation(s) nominated into the suggestion feed (${r.additionsCreated} new instruction(s)`+((r.featuresCreated??0)>0?`, ${r.featuresCreated} feature proposal(s)`:"")+((r.adviceCreated??0)>0?`, ${r.adviceCreated} pattern/opportunity`:"")+(r.skillsUnresolved>0?`, ${r.skillsUnresolved} skill slug(s) unresolved`:"")+(o.length>0?`, ${o.length} rejected as unfilled templates`:"")+")");for(let e of o)s(` rejected "${e.name}" \u2014 unfilled placeholder(s): ${e.placeholders.join(", ")}`);for(let e of r.itemsFailed??[])s(` failed "${e.name}" \u2014 ${e.error}`)}catch(t){s(` nomination skipped (whole batch): ${t instanceof Error?t.message:String(t)}`)}}m(p,"nominateRecommendations");export{p as a};
@@ -1 +1 @@
1
- import{b as s,c as a}from"./chunk-5MXZJWQS.js";import{f as c}from"./chunk-UJ7EPLKC.js";import{a as u}from"./chunk-74QIUVWY.js";import{a as m}from"./chunk-ZLLER3HP.js";import{mkdtempSync as p,rmSync as d}from"node:fs";import{join as f}from"node:path";import{tmpdir as l}from"node:os";async function g(n,o,i){let r=u.parse(n),e=p(f(l(),"rulemetric-measurement-generation-"));try{let t=await c({engine:r.engine,model:r.model??void 0,systemPrompt:o,prompt:i,workDir:e,timeout:12e4});if(t.error||t.exitCode!==0||!t.output.trim())throw new Error(`Selected ${r.engine} generator failed: ${t.error??`exit ${t.exitCode}, empty output`}`);return t.output}finally{d(e,{recursive:!0,force:!0})}}m(g,"runMeasurementText");async function S(n,o,i){let r=await g(n,o,i),e=s(a(r)??r);if(!e.ok||!e.value||Array.isArray(e.value)||typeof e.value!="object")throw new Error(`Selected ${n.engine} generator returned invalid JSON`);return e.value}m(S,"runMeasurementJson");export{g as a,S as b};
1
+ import{b as s,c as a}from"./chunk-5MXZJWQS.js";import{f as c}from"./chunk-FBSZ6KCM.js";import{f as u}from"./chunk-XQYAVSUQ.js";import{a as m}from"./chunk-ZLLER3HP.js";import{mkdtempSync as p,rmSync as d}from"node:fs";import{join as f}from"node:path";import{tmpdir as l}from"node:os";async function g(n,o,i){let r=u.parse(n),e=p(f(l(),"rulemetric-measurement-generation-"));try{let t=await c({engine:r.engine,model:r.model??void 0,systemPrompt:o,prompt:i,workDir:e,timeout:12e4});if(t.error||t.exitCode!==0||!t.output.trim())throw new Error(`Selected ${r.engine} generator failed: ${t.error??`exit ${t.exitCode}, empty output`}`);return t.output}finally{d(e,{recursive:!0,force:!0})}}m(g,"runMeasurementText");async function S(n,o,i){let r=await g(n,o,i),e=s(a(r)??r);if(!e.ok||!e.value||Array.isArray(e.value)||typeof e.value!="object")throw new Error(`Selected ${n.engine} generator returned invalid JSON`);return e.value}m(S,"runMeasurementJson");export{g as a,S as b};
@@ -1,2 +1,2 @@
1
- import{a as v,b as u,e as y,g as d}from"../../chunk-S5CQSP35.js";import{a as h}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as p}from"../../chunk-ZLLER3HP.js";import{Args as k,Flags as o}from"@oclif/core";import{existsSync as T}from"node:fs";import{homedir as P}from"node:os";import{join as I}from"node:path";var A=I(P(),".gemini","antigravity-ide","brain"),g=class x extends h{static{p(this,"AntigravityBackfill")}static description="Backfill historical events from an Antigravity conversation transcript into a RuleMetric session. Useful for seeding a conversation that existed before hooks were installed \u2014 the live hook intentionally only captures forward.";static examples=["<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --session 158db9aa-68ee-43fc-961b-f3a180578694","<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --dry-run"];static args={conversationId:k.string({description:"Antigravity conversationId (UUID) \u2014 the directory name under ~/.gemini/antigravity-ide/brain/",required:!0})};static flags={session:o.string({char:"s",description:"RuleMetric session UUID to POST events into. If omitted, resolved from the hook tmp file ($TMPDIR/rulemetric/<conversationId>) \u2014 fails if neither is present."}),transcript:o.string({description:"Path to the transcript.jsonl file. Defaults to ~/.gemini/antigravity-ide/brain/<conversationId>/.system_generated/logs/transcript.jsonl"}),"after-step":o.integer({description:"Only emit records with step_index > this value. Default: read from existing state file, else -1 (everything)."}),limit:o.integer({description:"Cap on the number of records to process this run."}),"dry-run":o.boolean({default:!1,description:"Classify records without POSTing. Reports counts only."}),"save-state":o.boolean({default:!0,allowNo:!0,description:"After backfill, persist the highest step_index so the live hook resumes from there."})};async run(){let{args:b,flags:e}=await this.parse(x),t=b.conversationId;d.loadEnvFile(),process.env.RULEMETRIC_API_URL||this.error("RULEMETRIC_API_URL is not set. Configure it via env or ~/.config/rulemetric/env.");let l=e.transcript??I(A,t,".system_generated","logs","transcript.jsonl");T(l)||this.error(`Transcript not found: ${l}`);let m=e.session??d.resolveRwSessionId(t);m||this.error(`No RuleMetric session resolved. Pass --session <uuid>, or run the Antigravity hook at least once so $TMPDIR/rulemetric/${t} is populated.`);let n=e["after-step"];n===void 0&&(n=d.load(t)?.lastStepIdx??-1);let i=v(l,n);e.limit!==void 0&&i.length>e.limit&&(i=i.slice(0,e.limit));let R=u(l);if(this.log(`Conversation ${t}: transcript max step = ${R}, after-step = ${n}, records to process = ${i.length}`),i.length===0){this.log("Nothing to backfill.");return}if(e["dry-run"]){let r=0,a=0,c={};for(let S of i){let f=(await import("../../lib/antigravity-transcript.js")).classifyRecord(S,0);f?(r++,c[f.eventType]=(c[f.eventType]??0)+1):a++}this.log(`Dry run: would emit ${r}, skip ${a}. By eventType: ${JSON.stringify(c)}`);return}let w=Date.now(),s=await y(i,m,t,n,{onProgress:p(({attempted:r,total:a})=>{(r%100===0||r===a)&&process.stderr.write(` \u2026${r}/${a}
1
+ import{a as v,b as u,e as y,g as d}from"../../chunk-WWQWHC4K.js";import{a as h}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as p}from"../../chunk-ZLLER3HP.js";import{Args as k,Flags as o}from"@oclif/core";import{existsSync as T}from"node:fs";import{homedir as P}from"node:os";import{join as I}from"node:path";var A=I(P(),".gemini","antigravity-ide","brain"),g=class x extends h{static{p(this,"AntigravityBackfill")}static description="Backfill historical events from an Antigravity conversation transcript into a RuleMetric session. Useful for seeding a conversation that existed before hooks were installed \u2014 the live hook intentionally only captures forward.";static examples=["<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --session 158db9aa-68ee-43fc-961b-f3a180578694","<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --dry-run"];static args={conversationId:k.string({description:"Antigravity conversationId (UUID) \u2014 the directory name under ~/.gemini/antigravity-ide/brain/",required:!0})};static flags={session:o.string({char:"s",description:"RuleMetric session UUID to POST events into. If omitted, resolved from the hook tmp file ($TMPDIR/rulemetric/<conversationId>) \u2014 fails if neither is present."}),transcript:o.string({description:"Path to the transcript.jsonl file. Defaults to ~/.gemini/antigravity-ide/brain/<conversationId>/.system_generated/logs/transcript.jsonl"}),"after-step":o.integer({description:"Only emit records with step_index > this value. Default: read from existing state file, else -1 (everything)."}),limit:o.integer({description:"Cap on the number of records to process this run."}),"dry-run":o.boolean({default:!1,description:"Classify records without POSTing. Reports counts only."}),"save-state":o.boolean({default:!0,allowNo:!0,description:"After backfill, persist the highest step_index so the live hook resumes from there."})};async run(){let{args:b,flags:e}=await this.parse(x),t=b.conversationId;d.loadEnvFile(),process.env.RULEMETRIC_API_URL||this.error("RULEMETRIC_API_URL is not set. Configure it via env or ~/.config/rulemetric/env.");let l=e.transcript??I(A,t,".system_generated","logs","transcript.jsonl");T(l)||this.error(`Transcript not found: ${l}`);let m=e.session??d.resolveRwSessionId(t);m||this.error(`No RuleMetric session resolved. Pass --session <uuid>, or run the Antigravity hook at least once so $TMPDIR/rulemetric/${t} is populated.`);let n=e["after-step"];n===void 0&&(n=d.load(t)?.lastStepIdx??-1);let i=v(l,n);e.limit!==void 0&&i.length>e.limit&&(i=i.slice(0,e.limit));let R=u(l);if(this.log(`Conversation ${t}: transcript max step = ${R}, after-step = ${n}, records to process = ${i.length}`),i.length===0){this.log("Nothing to backfill.");return}if(e["dry-run"]){let r=0,a=0,c={};for(let S of i){let f=(await import("../../lib/antigravity-transcript.js")).classifyRecord(S,0);f?(r++,c[f.eventType]=(c[f.eventType]??0)+1):a++}this.log(`Dry run: would emit ${r}, skip ${a}. By eventType: ${JSON.stringify(c)}`);return}let w=Date.now(),s=await y(i,m,t,n,{onProgress:p(({attempted:r,total:a})=>{(r%100===0||r===a)&&process.stderr.write(` \u2026${r}/${a}
2
2
  `)},"onProgress")}),$=((Date.now()-w)/1e3).toFixed(1);this.log(`Backfill complete in ${$}s. attempted=${s.attempted} emitted=${s.emitted} skipped=${s.skipped} failed=${s.failed} highestStepIdx=${s.highestStepIdx}`),e["save-state"]?(d.save(t,{lastStepIdx:s.highestStepIdx}),this.log(`State saved \u2192 live hook will resume from step_index > ${s.highestStepIdx}.`)):this.log("State NOT saved (--no-save-state). Live hook will re-emit any new records from after-step.")}};export{g as default};
@@ -1 +1 @@
1
- import{a as n}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{f as r}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import{i as o,l as s}from"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import*as c from"node:path";import{Flags as l}from"@oclif/core";var t=class g extends n{static{a(this,"AuthCreateKey")}static description="Create a long-lived API key for CLI and proxy authentication";static examples=['<%= config.bin %> auth create-key --name "laptop"','<%= config.bin %> auth create-key --name "ci token" --no-save'];static flags={name:l.string({char:"n",description:"Name for this key",required:!0}),save:l.boolean({char:"s",description:"Save key to ~/.config/rulemetric/env for hooks/proxy",default:!0,allowNo:!0})};async run(){let{flags:i}=await this.parse(g),e=await r("/api/auth/api-keys",{name:i.name});this.log(""),this.log("API key created successfully:"),this.log(""),this.log(` Name: ${e.name}`),this.log(` Key: ${e.key}`),this.log(` Prefix: ${e.keyPrefix}`),this.log(""),this.warn("Save this key now \u2014 it will not be shown again."),i.save&&(o(e.key,process.env.RULEMETRIC_API_URL),this.log(""),this.log(`Key saved to ${c.join(s(),"env")} (RULEMETRIC_API_KEY)`),this.log("Hooks and proxy will use this key automatically."))}};export{t as default};
1
+ import{a as n}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{f as r}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import{i as o,l as s}from"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import*as c from"node:path";import{Flags as l}from"@oclif/core";var t=class g extends n{static{a(this,"AuthCreateKey")}static description="Create a long-lived API key for CLI and proxy authentication";static examples=['<%= config.bin %> auth create-key --name "laptop"','<%= config.bin %> auth create-key --name "ci token" --no-save'];static flags={name:l.string({char:"n",description:"Name for this key",required:!0}),save:l.boolean({char:"s",description:"Save key to ~/.config/rulemetric/env for hooks/proxy",default:!0,allowNo:!0})};async run(){let{flags:i}=await this.parse(g),e=await r("/api/auth/api-keys",{name:i.name});this.log(""),this.log("API key created successfully:"),this.log(""),this.log(` Name: ${e.name}`),this.log(` Key: ${e.key}`),this.log(` Prefix: ${e.keyPrefix}`),this.log(""),this.warn("Save this key now \u2014 it will not be shown again."),i.save&&(o(e.key,process.env.RULEMETRIC_API_URL),this.log(""),this.log(`Key saved to ${c.join(s(),"env")} (RULEMETRIC_API_KEY)`),this.log("Hooks and proxy will use this key automatically."))}};export{t as default};
@@ -1,4 +1,4 @@
1
- import{a as f}from"../../chunk-V4PUYPTU.js";import{a as w}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import{c}from"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import{b as n}from"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{b as r,d as a}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import{b as m,d,h as u,i as g}from"../../chunk-PZNWH4VQ.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{Flags as p}from"@oclif/core";var h=class y extends w{static{l(this,"AuthLogin")}static description="Log in to RuleMetric";static examples=["<%= config.bin %> auth login","<%= config.bin %> auth login -e user@example.com"];static flags={email:p.string({char:"e",description:"Email address"}),password:p.string({char:"p",description:"Password (for non-interactive use)"}),"api-key":p.string({description:"Authenticate with an API key from https://rulemetric.com/connect (required for Google/GitHub sign-ins, which have no password)",exclusive:["password"]})};async run(){let{flags:s}=await this.parse(y);if(s["api-key"]){await this.loginWithApiKey(s["api-key"]);return}let e=s.email,t=s.password;if(!e||!t){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p, or set RULEMETRIC_API_KEY (create a key at https://rulemetric.com/connect).");let{input:o,password:k}=await import("@inquirer/prompts");this.log("Signed up with Google or GitHub? You have no password \u2014 press Ctrl-C and run:"),this.log(" rulemetric auth login --api-key <key> (create one at https://rulemetric.com/connect)"),this.log(""),e||(e=await o({message:"Email:"})),t||(t=await k({message:"Password:"}))}let i;try{i=await a("/auth/login",{method:"POST",body:{email:e,password:t},timeoutMs:2e4})}catch(o){throw o instanceof r&&o.statusCode===401&&this.error(`Invalid email or password.
1
+ import{a as f}from"../../chunk-RG3R4EAB.js";import{a as w}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import{c}from"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import{b as n}from"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{b as r,d as a}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import{b as m,d,h as u,i as g}from"../../chunk-PZNWH4VQ.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{Flags as p}from"@oclif/core";var h=class y extends w{static{l(this,"AuthLogin")}static description="Log in to RuleMetric";static examples=["<%= config.bin %> auth login","<%= config.bin %> auth login -e user@example.com"];static flags={email:p.string({char:"e",description:"Email address"}),password:p.string({char:"p",description:"Password (for non-interactive use)"}),"api-key":p.string({description:"Authenticate with an API key from https://rulemetric.com/connect (required for Google/GitHub sign-ins, which have no password)",exclusive:["password"]})};async run(){let{flags:s}=await this.parse(y);if(s["api-key"]){await this.loginWithApiKey(s["api-key"]);return}let e=s.email,t=s.password;if(!e||!t){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p, or set RULEMETRIC_API_KEY (create a key at https://rulemetric.com/connect).");let{input:o,password:k}=await import("@inquirer/prompts");this.log("Signed up with Google or GitHub? You have no password \u2014 press Ctrl-C and run:"),this.log(" rulemetric auth login --api-key <key> (create one at https://rulemetric.com/connect)"),this.log(""),e||(e=await o({message:"Email:"})),t||(t=await k({message:"Password:"}))}let i;try{i=await a("/auth/login",{method:"POST",body:{email:e,password:t},timeoutMs:2e4})}catch(o){throw o instanceof r&&o.statusCode===401&&this.error(`Invalid email or password.
2
2
 
3
3
  If you signed up with Google or GitHub, you have no password \u2014 that is why this cannot work. Create an API key at https://rulemetric.com/connect, then run:
4
4
  rulemetric auth login --api-key <key>`),o}let v=i.expiresAt??new Date(Date.now()+3600*1e3).toISOString();d({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:v,email:i.email}),u(i.accessToken,process.env.RULEMETRIC_API_URL),await n(),await f(this.log.bind(this),this.warn.bind(this),this.config.version),c("auth_login",{},this.config.version),this.log(`Logged in as ${i.email}`)}async loginWithApiKey(s){let e=s.trim();e||this.error("Empty --api-key. Create one at https://rulemetric.com/connect"),process.env.RULEMETRIC_API_KEY=e;try{await a("/api/setup/status",{timeoutMs:2e4})}catch(t){throw delete process.env.RULEMETRIC_API_KEY,t instanceof r&&(t.statusCode===401||t.statusCode===403)&&this.error("That API key was rejected. Check you copied it whole (it is shown only once at creation) or mint a new one at https://rulemetric.com/connect"),t}g(e,process.env.RULEMETRIC_API_URL),m(),await n(),c("auth_login",{method:"api_key"},this.config.version),this.log(`Authenticated with API key ${e.slice(0,11)}...`),this.log("Verify any time with: rulemetric auth status")}};export{h as default};
@@ -1 +1 @@
1
- import{a as s}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import{f as i,j as r}from"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";var e=class t extends s{static{o(this,"AuthLogout")}static description="Log out of RuleMetric";static examples=["<%= config.bin %> auth logout"];async run(){await this.parse(t),i(),r(),this.log("Logged out successfully.")}};export{e as default};
1
+ import{a as s}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import{f as i,j as r}from"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";var e=class t extends s{static{o(this,"AuthLogout")}static description="Log out of RuleMetric";static examples=["<%= config.bin %> auth logout"];async run(){await this.parse(t),i(),r(),this.log("Logged out successfully.")}};export{e as default};
@@ -1,4 +1,4 @@
1
- import{a as k}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{e as n,i as c}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Args as y}from"@oclif/core";var a=class m extends k{static{s(this,"AuthRevokeKey")}static description="Revoke an API key (run with no argument to list active keys)";static examples=["<%= config.bin %> auth revoke-key","<%= config.bin %> auth revoke-key rm_abc12345",'<%= config.bin %> auth revoke-key "my-laptop (auto)"'];static args={id:y.string({description:"API key ID, prefix (rm_xxxxxxxx), or name"})};async run(){let{args:o}=await this.parse(m),r=(await n("/api/auth/api-keys")).filter(e=>!e.revokedAt);if(!o.id){if(r.length===0){this.log("No active API keys.");return}this.log(`Active API keys \u2014 pass an id, prefix, or name to revoke one:
1
+ import{a as k}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{e as n,i as c}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Args as y}from"@oclif/core";var a=class m extends k{static{s(this,"AuthRevokeKey")}static description="Revoke an API key (run with no argument to list active keys)";static examples=["<%= config.bin %> auth revoke-key","<%= config.bin %> auth revoke-key rm_abc12345",'<%= config.bin %> auth revoke-key "my-laptop (auto)"'];static args={id:y.string({description:"API key ID, prefix (rm_xxxxxxxx), or name"})};async run(){let{args:o}=await this.parse(m),r=(await n("/api/auth/api-keys")).filter(e=>!e.revokedAt);if(!o.id){if(r.length===0){this.log("No active API keys.");return}this.log(`Active API keys \u2014 pass an id, prefix, or name to revoke one:
2
2
  `);for(let e of r)this.log(` ${e.id} ${e.keyPrefix}... ${e.name}`);return}let i=o.id,t=r.filter(e=>e.id===i||e.name===i||i.startsWith("rm_")&&i.startsWith(e.keyPrefix));t.length===0&&this.error(`No active API key matches "${i}". Run \`rulemetric auth revoke-key\` with no argument to list keys.`),t.length>1&&this.error(`"${i}" matches ${t.length} keys \u2014 use the exact key ID:
3
3
  `+t.map(e=>` ${e.id} ${e.keyPrefix}... ${e.name}`).join(`
4
4
  `)),await c(`/api/auth/api-keys/${t[0].id}`),this.log(`API key ${t[0].keyPrefix}... ("${t[0].name}") revoked.`)}};export{a as default};
@@ -1 +1 @@
1
- import{a as g}from"../../chunk-V4PUYPTU.js";import{a as h}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import{c as d}from"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import{b as l}from"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{b as m,d as p}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import{d as n,h as c}from"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as u}from"@oclif/core";var t=class f extends h{static{o(this,"AuthSignup")}static description="Create a RuleMetric account from the CLI";static examples=["<%= config.bin %> auth signup","<%= config.bin %> auth signup -e user@example.com"];static flags={email:u.string({char:"e",description:"Email address"}),password:u.string({char:"p",description:"Password (min 8 chars; for non-interactive use)"})};async run(){let{flags:a}=await this.parse(f),i=a.email,r=a.password;if(!i||!r){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p.");let{input:s,password:v}=await import("@inquirer/prompts");i||(i=await s({message:"Email:"})),r||(r=await v({message:"Password (min 8 chars):"}))}let e;try{e=await p("/auth/signup",{method:"POST",body:{email:i,password:r},timeoutMs:2e4})}catch(s){throw s instanceof m&&s.statusCode===409&&this.error(`An account with ${i} already exists. Run: rulemetric auth login -e ${i}`),s}if(e.confirmationRequired||!e.accessToken||!e.refreshToken){this.log(`Account created for ${e.email}.`),this.log("Check your email and click the confirmation link, then run:"),this.log(` rulemetric auth login -e ${e.email}`);return}let w=e.expiresAt??new Date(Date.now()+3600*1e3).toISOString();n({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:w,email:e.email}),c(e.accessToken,process.env.RULEMETRIC_API_URL),await l(),await g(this.log.bind(this),this.warn.bind(this),this.config.version),d("auth_signup",{},this.config.version),this.log(`Signed up and logged in as ${e.email}`)}};export{t as default};
1
+ import{a as g}from"../../chunk-RG3R4EAB.js";import{a as h}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import{c as d}from"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import{b as l}from"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{b as m,d as p}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import{d as n,h as c}from"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as u}from"@oclif/core";var t=class f extends h{static{o(this,"AuthSignup")}static description="Create a RuleMetric account from the CLI";static examples=["<%= config.bin %> auth signup","<%= config.bin %> auth signup -e user@example.com"];static flags={email:u.string({char:"e",description:"Email address"}),password:u.string({char:"p",description:"Password (min 8 chars; for non-interactive use)"})};async run(){let{flags:a}=await this.parse(f),i=a.email,r=a.password;if(!i||!r){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p.");let{input:s,password:v}=await import("@inquirer/prompts");i||(i=await s({message:"Email:"})),r||(r=await v({message:"Password (min 8 chars):"}))}let e;try{e=await p("/auth/signup",{method:"POST",body:{email:i,password:r},timeoutMs:2e4})}catch(s){throw s instanceof m&&s.statusCode===409&&this.error(`An account with ${i} already exists. Run: rulemetric auth login -e ${i}`),s}if(e.confirmationRequired||!e.accessToken||!e.refreshToken){this.log(`Account created for ${e.email}.`),this.log("Check your email and click the confirmation link, then run:"),this.log(` rulemetric auth login -e ${e.email}`);return}let w=e.expiresAt??new Date(Date.now()+3600*1e3).toISOString();n({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:w,email:e.email}),c(e.accessToken,process.env.RULEMETRIC_API_URL),await l(),await g(this.log.bind(this),this.warn.bind(this),this.config.version),d("auth_signup",{},this.config.version),this.log(`Signed up and logged in as ${e.email}`)}};export{t as default};
@@ -1 +1 @@
1
- import{a as c}from"../../chunk-W2MV25SB.js";import{a as g}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import{a,e as l,l as t}from"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import*as u from"node:path";var o=class h extends g{static{r(this,"AuthStatus")}static description="Show current authentication status";static examples=["<%= config.bin %> auth status"];async run(){await this.parse(h);let e=l(),i=process.env.RULEMETRIC_API_KEY,s=a().apiKey;if(i||s){let m=i||s,p=i?"RULEMETRIC_API_KEY env var":u.join(t(),"env");this.log(`Authenticated via API key ${m.slice(0,11)}... (${p})`),e&&this.log(`Logged in as: ${e.email}`),this.log(`Config: ${t()}`);return}if(!e){this.log("Not logged in. Run `rulemetric auth login` to authenticate.");return}let n=new Date(e.expiresAt).getTime();if(Number.isNaN(n)||Date.now()>=n){this.log("Session expired. Run `rulemetric auth login` to re-authenticate.");return}this.log(`Logged in as: ${e.email}`),this.log(`Session expires: ${c(e.expiresAt)}`),this.log(`Config: ${t()}`)}};export{o as default};
1
+ import{a as c}from"../../chunk-W2MV25SB.js";import{a as g}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import{a,e as l,l as t}from"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import*as u from"node:path";var o=class h extends g{static{r(this,"AuthStatus")}static description="Show current authentication status";static examples=["<%= config.bin %> auth status"];async run(){await this.parse(h);let e=l(),i=process.env.RULEMETRIC_API_KEY,s=a().apiKey;if(i||s){let m=i||s,p=i?"RULEMETRIC_API_KEY env var":u.join(t(),"env");this.log(`Authenticated via API key ${m.slice(0,11)}... (${p})`),e&&this.log(`Logged in as: ${e.email}`),this.log(`Config: ${t()}`);return}if(!e){this.log("Not logged in. Run `rulemetric auth login` to authenticate.");return}let n=new Date(e.expiresAt).getTime();if(Number.isNaN(n)||Date.now()>=n){this.log("Session expired. Run `rulemetric auth login` to re-authenticate.");return}this.log(`Logged in as: ${e.email}`),this.log(`Session expires: ${c(e.expiresAt)}`),this.log(`Config: ${t()}`)}};export{o as default};
@@ -1,2 +1,2 @@
1
- import{a as f,b as k,c as S,d as x,e as R,f as n,g as y}from"../../chunk-VALRPZXH.js";import{b as C,c as w,g as v,h as b}from"../../chunk-QI3FJKGK.js";import{a as u}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import{l as m}from"../../chunk-PZNWH4VQ.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{existsSync as O}from"node:fs";import{Flags as c}from"@oclif/core";var g=class E extends u{static{h(this,"CaptureScope")}static description="Show or set which projects RuleMetric captures \u2014 the Codex sweep and hook-driven sessions each have their own scope";static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --add ~/work/client-a --add ~/work/client-b","<%= config.bin %> <%= command.id %> --tool hooks --add ~/work/client-a","<%= config.bin %> <%= command.id %> --tool hooks --off","<%= config.bin %> <%= command.id %> --remove ~/work/client-a","<%= config.bin %> <%= command.id %> --off","<%= config.bin %> <%= command.id %> --all"];static flags={tool:c.string({description:'Which capture path to edit: "codex" (the worker transcript sweep, the default) or "hooks" (Claude Code / Cursor / Copilot / Antigravity hook sessions).',options:["codex","hooks"],default:"codex"}),add:c.string({description:"Capture sessions under this path (repeatable). Implies an allowlist.",multiple:!0}),remove:c.string({description:"Stop capturing under this path (repeatable).",multiple:!0}),off:c.boolean({description:"Turn this capture path off entirely.",exclusive:["all"]}),all:c.boolean({description:"Capture every project (the default).",exclusive:["off"]}),clear:c.boolean({description:"Remove this scope, restoring the default."})};async run(){let{flags:o}=await this.parse(E),s=m(),d=f(s);if(!((o.add?.length??0)>0||(o.remove?.length??0)>0||o.off||o.all||o.clear)){await this.show(s,d);return}for(let t of[...o.add??[],...o.remove??[]])R(t)||this.error(`Not an absolute path: ${t}
1
+ import{a as f,b as k,c as S,d as x,e as R,f as n,g as y}from"../../chunk-VALRPZXH.js";import{b as C,c as w,g as v,h as b}from"../../chunk-QI3FJKGK.js";import{a as u}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import{l as m}from"../../chunk-PZNWH4VQ.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{existsSync as O}from"node:fs";import{Flags as c}from"@oclif/core";var g=class E extends u{static{h(this,"CaptureScope")}static description="Show or set which projects RuleMetric captures \u2014 the Codex sweep and hook-driven sessions each have their own scope";static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --add ~/work/client-a --add ~/work/client-b","<%= config.bin %> <%= command.id %> --tool hooks --add ~/work/client-a","<%= config.bin %> <%= command.id %> --tool hooks --off","<%= config.bin %> <%= command.id %> --remove ~/work/client-a","<%= config.bin %> <%= command.id %> --off","<%= config.bin %> <%= command.id %> --all"];static flags={tool:c.string({description:'Which capture path to edit: "codex" (the worker transcript sweep, the default) or "hooks" (Claude Code / Cursor / Copilot / Antigravity hook sessions).',options:["codex","hooks"],default:"codex"}),add:c.string({description:"Capture sessions under this path (repeatable). Implies an allowlist.",multiple:!0}),remove:c.string({description:"Stop capturing under this path (repeatable).",multiple:!0}),off:c.boolean({description:"Turn this capture path off entirely.",exclusive:["all"]}),all:c.boolean({description:"Capture every project (the default).",exclusive:["off"]}),clear:c.boolean({description:"Remove this scope, restoring the default."})};async run(){let{flags:o}=await this.parse(E),s=m(),d=f(s);if(!((o.add?.length??0)>0||(o.remove?.length??0)>0||o.off||o.all||o.clear)){await this.show(s,d);return}for(let t of[...o.add??[],...o.remove??[]])R(t)||this.error(`Not an absolute path: ${t}
2
2
  Use an absolute path or ~/\u2026 \u2014 relative paths cannot be matched against a session's cwd.`);for(let t of o.add??[]){let a=x(t);O(a)||this.warn(`${a} does not exist yet \u2014 added anyway, but nothing will match until it does.`)}let e;try{e=k(s)}catch(t){o.clear||this.error(t instanceof Error?t.message:String(t));let a=y(s);this.warn(`${f(s)} was not valid JSON \u2014 saved it to ${a} and starting fresh.`),e={}}let i=o.tool??"codex",r=void 0,l=!1;if(o.clear&&({config:e}=n(e,{op:"clear"},r,i)),o.off&&({config:e}=n(e,{op:"mode",mode:"off"},r,i)),o.all&&({config:e}=n(e,{op:"mode",mode:"all"},r,i)),o.remove?.length){let t=n(e,{op:"remove",roots:o.remove},r,i);e=t.config,l=t.emptiedToOff}o.add?.length&&({config:e}=n(e,{op:"add",roots:o.add},r,i)),S(s,e),l&&(this.log(`Removed the last root \u2014 ${i==="hooks"?"hook":"Codex"} capture is now OFF rather than silently capturing everything.`),this.log("Use --all to go back to capturing every project.")),await this.show(s,d),this.log(""),this.log(i==="hooks"?"Takes effect on the next hook fire. No restart needed.":"Takes effect on the next sweep (within ~30s). No restart needed.")}async show(o,s){let d=await C({configDir:o}),p=await w({configDir:o}),e=h((i,r,l,t)=>{if(this.log(`${i}: ${l}`),r.roots.length)for(let a of r.roots)this.log(` \u2022 ${a}`);r.error&&(this.log(" This scope is FAILING CLOSED \u2014 nothing is being captured on this path."),this.log(` Fix the file, or run \`rulemetric capture scope ${i==="Hook capture"?"--tool hooks ":""}--clear\` to start over.`)),r.source==="env"&&this.log(` Set by environment variable, which outranks the config file (${t}).`)},"print");e("Codex capture",d,v(d),"RULEMETRIC_CODEX_CAPTURE / RULEMETRIC_CODEX_ROOTS"),e("Hook capture",p,b(p),"RULEMETRIC_HOOKS_CAPTURE / RULEMETRIC_HOOKS_ROOTS"),this.log(`Config: ${s}`)}};export{g as default};
@@ -1,2 +1,2 @@
1
- import{a as g,b as d,c as p}from"../../chunk-W2MV25SB.js";import{a as c}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import{Flags as i}from"@oclif/core";var o=class m extends c{static{a(this,"Catalog")}static description="Browse the org instruction catalog";static flags={badge:i.string({description:"Filter by badge",options:["recommended","required"]}),scope:i.string({description:"Filter by scope",options:["org","team"]}),search:i.string({description:"Search by name or description"})};async run(){let{flags:e}=await this.parse(m);this.requireAuth();let s=new URLSearchParams;e.badge&&s.set("badge",e.badge),e.scope&&s.set("scope",e.scope),e.search&&s.set("search",e.search);let r=await n(`/api/catalog?${s.toString()}`);if(r.length===0){this.log("No instructions found in catalog.");return}for(let t of r){let l=t.badge?` [${t.badge}]`:"",f=t.tags?.length?` (${t.tags.join(", ")})`:"";this.log(` ${d(t.name,40)} \u2014 ${p(t.scope)}${l} v${t.version}${f} ${g(t.updatedAt)}`)}this.log(`
1
+ import{a as g,b as d,c as p}from"../../chunk-W2MV25SB.js";import{a as c}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import{Flags as i}from"@oclif/core";var o=class m extends c{static{a(this,"Catalog")}static description="Browse the org instruction catalog";static flags={badge:i.string({description:"Filter by badge",options:["recommended","required"]}),scope:i.string({description:"Filter by scope",options:["org","team"]}),search:i.string({description:"Search by name or description"})};async run(){let{flags:e}=await this.parse(m);this.requireAuth();let s=new URLSearchParams;e.badge&&s.set("badge",e.badge),e.scope&&s.set("scope",e.scope),e.search&&s.set("search",e.search);let r=await n(`/api/catalog?${s.toString()}`);if(r.length===0){this.log("No instructions found in catalog.");return}for(let t of r){let l=t.badge?` [${t.badge}]`:"",f=t.tags?.length?` (${t.tags.join(", ")})`:"";this.log(` ${d(t.name,40)} \u2014 ${p(t.scope)}${l} v${t.version}${f} ${g(t.updatedAt)}`)}this.log(`
2
2
  ${r.length} instruction(s) found.`)}};export{o as default};
@@ -1,3 +1,3 @@
1
- import{a as i}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{f as n}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as c}from"@oclif/core";var o=class s extends i{static{t(this,"CatalogRecommend")}static description="Get AI-powered instruction recommendations for a project";static args={projectId:c.string({description:"ID of the project",required:!0})};async run(){let{args:a}=await this.parse(s);this.requireAuth(),this.log(`Analyzing project and generating recommendations...
1
+ import{a as i}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{f as n}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as c}from"@oclif/core";var o=class s extends i{static{t(this,"CatalogRecommend")}static description="Get AI-powered instruction recommendations for a project";static args={projectId:c.string({description:"ID of the project",required:!0})};async run(){let{args:a}=await this.parse(s);this.requireAuth(),this.log(`Analyzing project and generating recommendations...
2
2
  `);let r=await n(`/api/projects/${a.projectId}/recommendations`,{});if(r.error&&this.warn(`Note: ${r.error}`),r.recommendations.length===0){this.log("No recommendations found.");return}for(let e of r.recommendations)this.log(` ${(e.score*100).toFixed(0)}% \u2014 ${e.instructionId}`),this.log(` ${e.reason}
3
3
  `)}};export{o as default};
@@ -1 +1 @@
1
- import{a as o}from"../../chunk-4VN5PG2S.js";import{a as n}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{printTable as t}from"@oclif/table";var a=class s extends n{static{i(this,"CronsList")}static description="List manually-runnable maintenance tasks";static examples=["<%= config.bin %> crons list"];async run(){await this.parse(s),t({data:o.map(e=>({Name:e.name,"Scheduled by":e.scheduledBy,Description:e.description})),columns:["Name","Scheduled by","Description"]}),this.log(""),this.log("Scheduled crons run in Supabase pg_cron \u2014 audit them with:"),this.log(` psql "$DATABASE_URL" -c 'select jobname, schedule, active from cron.job;'`),this.log("Run any task above on demand with: rulemetric crons run <name>")}};export{a as default};
1
+ import{a as o}from"../../chunk-4VN5PG2S.js";import{a as n}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{printTable as t}from"@oclif/table";var a=class s extends n{static{i(this,"CronsList")}static description="List manually-runnable maintenance tasks";static examples=["<%= config.bin %> crons list"];async run(){await this.parse(s),t({data:o.map(e=>({Name:e.name,"Scheduled by":e.scheduledBy,Description:e.description})),columns:["Name","Scheduled by","Description"]}),this.log(""),this.log("Scheduled crons run in Supabase pg_cron \u2014 audit them with:"),this.log(` psql "$DATABASE_URL" -c 'select jobname, schedule, active from cron.job;'`),this.log("Run any task above on demand with: rulemetric crons run <name>")}};export{a as default};
@@ -1,2 +1,2 @@
1
- import{a as $}from"../../chunk-4VN5PG2S.js";import{a as k}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{e as b}from"../../chunk-ZZHIBOMT.js";import{A as f,B as g,z as h}from"../../chunk-TWPG3TEQ.js";import{a as p}from"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as d}from"../../chunk-ZLLER3HP.js";import{Args as _,Flags as y}from"@oclif/core";var l=class w extends k{static{d(this,"CronsRun")}static description="Run a maintenance task synchronously, right now";static examples=["<%= config.bin %> crons run cron_check_changelog","<%= config.bin %> crons run cron_suggest_instructions --quiet"];static args={name:_.string({description:"Task name (run `rulemetric crons list` to see all)",required:!0})};static flags={"dry-run":y.boolean({description:"For Harbor, print the saved engine/model and supported tasks without running them"}),quiet:y.boolean({char:"q",description:"Suppress per-line log output; print summary only"})};async run(){let{args:s,flags:a}=await this.parse(w);this.requireAuth();let o=$.find(e=>e.name===s.name);o||this.error(`Unknown task: ${s.name}
1
+ import{a as $}from"../../chunk-4VN5PG2S.js";import{a as k}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{e as b}from"../../chunk-76UKAFNM.js";import{A as f,B as g,z as h}from"../../chunk-42A4PUW7.js";import{f as p}from"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as d}from"../../chunk-ZLLER3HP.js";import{Args as _,Flags as y}from"@oclif/core";var l=class w extends k{static{d(this,"CronsRun")}static description="Run a maintenance task synchronously, right now";static examples=["<%= config.bin %> crons run cron_check_changelog","<%= config.bin %> crons run cron_suggest_instructions --quiet"];static args={name:_.string({description:"Task name (run `rulemetric crons list` to see all)",required:!0})};static flags={"dry-run":y.boolean({description:"For Harbor, print the saved engine/model and supported tasks without running them"}),quiet:y.boolean({char:"q",description:"Suppress per-line log output; print summary only"})};async run(){let{args:s,flags:a}=await this.parse(w);this.requireAuth();let o=$.find(e=>e.name===s.name);o||this.error(`Unknown task: ${s.name}
2
2
  Run \`rulemetric crons list\` to see available tasks.`);let t=null;if(s.name==="harbor_ab"){let e=await b("/api/settings/measurement");t=e.execution.harbor?p.parse(e.execution.harbor):null;for(let r of h("proven")){let m=f(r,t);if(m){this.log(`Unsupported: ${m}`);continue}let i=g(r,"manual",t);this.log(`${r.task}: ${t?.engine??"claude"} / ${i.model}, ${i.class}, ${i.nTrials} trials per arm`)}if(a["dry-run"])return}else a["dry-run"]&&this.error("--dry-run is currently supported only for harbor_ab");let u;try{({runManualTask:u}=await import("../../lib/manual-tasks.js"))}catch(e){let r=e?.code;throw(r==="ERR_MODULE_NOT_FOUND"||r==="MODULE_NOT_FOUND")&&this.error("`crons run` needs the worker runtime, which isn't available in this install.\nReinstall the CLI and verify that its runtime dependencies are present. A database credential is not required for end-user maintenance tasks."),e}this.log(`\u25B6 Running ${o.name} \u2026`);let v=Date.now(),n=await u(s.name,{measurement:t});if(!a.quiet)for(let e of n.logs){let r=e.level==="error"||e.level==="warn"?`[${e.level}]`:"";this.log(` ${r} ${e.message}`)}let c=((n.durationMs??Date.now()-v)/1e3).toFixed(1);n.ok?this.log(`\u2713 ${o.name} completed in ${c}s (${n.logs.length} log line${n.logs.length===1?"":"s"})`):this.error(`\u2717 ${o.name} failed after ${c}s: ${n.error}`)}};export{l as default};
@@ -1 +1 @@
1
- import{a as o}from"../chunk-N4RJ6CN7.js";import"../chunk-IZTIYR5Q.js";import"../chunk-E5YE25QG.js";import"../chunk-YUIRDBQQ.js";import"../chunk-HAYO6JYI.js";import"../chunk-3AV3GTMP.js";import"../chunk-ZZHIBOMT.js";import"../chunk-TWPG3TEQ.js";import"../chunk-74QIUVWY.js";import"../chunk-PZNWH4VQ.js";import{a as i}from"../chunk-ZLLER3HP.js";import{Flags as r}from"@oclif/core";var a=class s extends o{static{i(this,"Dashboard")}static description="Interactive TUI dashboard showing session analytics, outcomes, friction, and insights";static examples=["<%= config.bin %> dashboard","<%= config.bin %> dashboard --period 30days","<%= config.bin %> dashboard --launcher"];static flags={period:r.string({char:"p",default:"week",options:["today","week","30days","month","all"],description:"Initial time period"}),launcher:r.boolean({char:"l",default:!1,description:"Open the launcher overlay immediately"})};async run(){let{flags:e}=await this.parse(s),{renderDashboard:t}=await import("../dashboard/Dashboard.js");await t(e.period,{openLauncher:e.launcher})}};export{a as default};
1
+ import{a as o}from"../chunk-MU7KKU3O.js";import"../chunk-IZTIYR5Q.js";import"../chunk-FKTT7A4H.js";import"../chunk-VIFOLTZT.js";import"../chunk-4FJYVYCU.js";import"../chunk-3AV3GTMP.js";import"../chunk-76UKAFNM.js";import"../chunk-42A4PUW7.js";import"../chunk-XQYAVSUQ.js";import"../chunk-PZNWH4VQ.js";import{a as i}from"../chunk-ZLLER3HP.js";import{Flags as r}from"@oclif/core";var a=class s extends o{static{i(this,"Dashboard")}static description="Interactive TUI dashboard showing session analytics, outcomes, friction, and insights";static examples=["<%= config.bin %> dashboard","<%= config.bin %> dashboard --period 30days","<%= config.bin %> dashboard --launcher"];static flags={period:r.string({char:"p",default:"week",options:["today","week","30days","month","all"],description:"Initial time period"}),launcher:r.boolean({char:"l",default:!1,description:"Open the launcher overlay immediately"})};async run(){let{flags:e}=await this.parse(s),{renderDashboard:t}=await import("../dashboard/Dashboard.js");await t(e.period,{openLauncher:e.launcher})}};export{a as default};
@@ -1 +1 @@
1
- import{c as q,d as K}from"../chunk-TYFEWLYZ.js";import{b as L,c as W}from"../chunk-V5U3E4BZ.js";import{a as J}from"../chunk-2TJ7Q2OU.js";import{e as O,f as _,g as M}from"../chunk-QWCEZEDO.js";import"../chunk-KKDHD4XA.js";import"../chunk-SZ62CP55.js";import{d as oe,e as ne}from"../chunk-S5U76YUI.js";import"../chunk-M7QSC64D.js";import"../chunk-VLWNSTYW.js";import"../chunk-G7V4ZZZ3.js";import"../chunk-SV73ASP2.js";import{i as z,j as Q,k as Z,m as ee,n as te}from"../chunk-LB24UKHZ.js";import"../chunk-RRM4HQG4.js";import"../chunk-7ML2UCI7.js";import"../chunk-GN46S7T4.js";import"../chunk-PPAHIVG5.js";import"../chunk-5MXZJWQS.js";import"../chunk-CT7FWSIU.js";import"../chunk-AHLVY52I.js";import"../chunk-N7ODX6PO.js";import{a as V}from"../chunk-OZQNSELV.js";import"../chunk-HFGO5762.js";import"../chunk-VS5ROGDP.js";import"../chunk-OUK2AWEI.js";import"../chunk-SWSOEYC7.js";import"../chunk-U2NT5OSQ.js";import"../chunk-KGURGIZ2.js";import"../chunk-GYNZ3OZF.js";import"../chunk-UPFH72PF.js";import"../chunk-OO2ZRKZY.js";import"../chunk-CDY7TQFZ.js";import"../chunk-VBXL7XO7.js";import"../chunk-UJ7EPLKC.js";import"../chunk-PUX6P5KC.js";import"../chunk-SG4UDDHB.js";import{d as F}from"../chunk-SBGXIPRN.js";import"../chunk-6XTLP2G7.js";import"../chunk-PJ3WHQ67.js";import{a as X,b as D,c as Y,g as j,h as G}from"../chunk-QI3FJKGK.js";import{a as B}from"../chunk-N4RJ6CN7.js";import"../chunk-IZTIYR5Q.js";import"../chunk-E5YE25QG.js";import"../chunk-YUIRDBQQ.js";import"../chunk-HAYO6JYI.js";import"../chunk-3AV3GTMP.js";import{a as U,e as y}from"../chunk-ZZHIBOMT.js";import"../chunk-TWPG3TEQ.js";import"../chunk-74QIUVWY.js";import{a as N,g as v,l as x}from"../chunk-PZNWH4VQ.js";import{a as S}from"../chunk-ZLLER3HP.js";import{spawnSync as le}from"node:child_process";import{existsSync as ce,readFileSync as ue}from"node:fs";import{join as se}from"node:path";var I=class h extends B{static{S(this,"Diagnostics")}static description='Diagnose capture / proxy / connectivity problems (e.g. a client-side "502 Bad Gateway")';static examples=["<%= config.bin %> diagnostics"];baseUrl(){return process.env.RULEMETRIC_API_URL??N().apiUrl??U}async checkDirect(){let r=process.env.HTTPS_PROXY,i=process.env.HTTP_PROXY;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let s=new AbortController,l=setTimeout(()=>s.abort(),8e3);try{return(await globalThis.fetch(`${this.baseUrl()}/health`,{signal:s.signal})).ok}catch{return!1}finally{clearTimeout(l),r!==void 0&&(process.env.HTTPS_PROXY=r),i!==void 0&&(process.env.HTTP_PROXY=i)}}configuredProxy(){if(process.env.HTTPS_PROXY)return process.env.HTTPS_PROXY;for(let r of["settings.local.json","settings.json"]){let i=se(process.cwd(),".claude",r);if(ce(i))try{let s=JSON.parse(ue(i,"utf8"));if(s.env?.HTTPS_PROXY)return s.env.HTTPS_PROXY}catch{}}return null}checkThroughProxy(r){let i=le("curl",["-sS","-x",r,"--max-time","8","-o","/dev/null","-w","%{http_code}",`${this.baseUrl()}/health`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return i.error||typeof i.stdout!="string"?null:i.stdout.trim()==="200"}async run(){await this.parse(h);let r=process.version,i=this.configuredProxy(),s=i!=null,[l,m,d]=await Promise.all([this.checkDirect(),M(O),M(_)]),p=s&&i?this.checkThroughProxy(i):null,t=S((e,c,T)=>{let u=c===null?"\u2013":c?"[OK]":"[!!]";this.log(` ${u} ${e.padEnd(22)} ${T}`)},"line");this.log("RuleMetric diagnostics"),this.log(""),t("Node",!L(r),`${r}${L(r)?" (< 20.11 \u2014 breaks the bundled proxy)":""}`),t("API (direct)",l,`${this.baseUrl()}/health ${l?"reachable":"UNREACHABLE"}`),t("Authenticated",v(),v()?"yes":"no \u2014 run `rulemetric auth login`"),t("Proxy configured",s?!0:null,s?i:"no HTTPS_PROXY set"),s&&(t("Gateway :"+O,m,m?"listening":"NOT listening"),t("mitmproxy :"+_,d,d?"listening":"not listening (gateway should route direct)"),t("API (via proxy)",p,p===null?"inconclusive (curl unavailable)":p?"reachable":"FAILED \u2014 502/blocked through your proxy"));let a=F();t("claude CLI",a.claudeBin!=null,a.claudeBin??"not found \u2014 LLM features (grading, distill) will no-op"),t("codex CLI",a.codexBin!=null?!0:null,a.codexBin?`${a.codexBin}${a.codexConfiguredModel?` (model ${a.codexConfiguredModel})`:""}`:"not found \u2014 optional; enables the cross-vendor reviewer (evals validate-judge)");let o=null;if(v()&&l)try{o=await y("/api/workers/health")}catch{o=null}if(o){let e=o.worker;t("Worker",!!e.active,e.present?e.active?`online (last heartbeat ${e.ageSeconds??"?"}s ago${e.clientVersion?`, v${e.clientVersion}`:""})`:`NOT RUNNING \u2014 last heartbeat ${A(e.ageSeconds)} ago`:"never connected \u2014 no worker has ever reported in");let c=o.worker.engines;if(c!=null){let u=[c.claude&&"claude",c.codex&&"codex"].filter(Boolean);t("LLM engine",u.length>0,u.length>0?`${u.join(" + ")} available to the worker`:"NONE \u2014 the worker found no `claude` and no `codex`. LLM jobs will complete with empty output rather than failing.")}let T=o.pending.reduce((u,E)=>u+E.count,0);if(T>0){let u=o.verdict.stuck.reduce(($,k)=>$+k.count,0),E=o.verdict.unclaimable.reduce(($,k)=>$+k.count,0),R=(o.verdict.engineBlocked??[]).reduce(($,k)=>$+k.count,0);t("Job queue",u===0&&R===0,`${T} pending`+(u>0?` \u2014 ${u} waiting on this worker`:"")+(R>0?` \u2014 ${R} need a local LLM engine`:"")+(E>0?` \u2014 ${E} need a worker with DATABASE_URL`:""))}else t("Job queue",!0,"empty")}else v()&&l&&t("Worker",null,"could not read /workers/health (older API?)");let n=o?.worker.machine;if(n){let e=n.suspends+n.stalls,c=n.lastPause;t("Worker pauses",e===0?!0:null,e===0?`none since ${n.since} \u2014 no sleep or stall seen by the worker`:`${n.suspends} suspend${n.suspends===1?"":"s"}`+(n.stalls>0?` + ${n.stalls} event-loop stall${n.stalls===1?"":"s"}`:"")+` since ${n.since}, ${A(Math.round(n.pausedMs/1e3))} paused total`+(c?`; last: ${c.kind} of ${A(Math.round(c.wallGapMs/1e3))} ending ${c.detectedAt}`:"")+" \u2014 jobs in flight during a suspend lose their lease and are redone on wake")}let f=await q();if(f){t("Machine sleep (pmset)",f.sleeps===0?!0:null,K(f));for(let e of f.recent.slice(-3)){let c=e.seconds!=null?` (${A(e.seconds)})`:"";this.log(` \u21B3 ${e.at.toISOString()} ${e.kind}${c}: ${e.reason.slice(0,80)}`)}}let C=V(process.cwd()),g=await D({configDir:x()}),re=await Y({configDir:x()}),w=` \u2014 ${G(re)}`,b=J(process.cwd()),H=[b.user&&`user hooks (${b.user})`,b.workspace&&`workspace hooks (${b.workspace})`].filter(Boolean),ie={claude_code:`session hooks (+ proxy for instruction linking)${w}`,codex:`worker transcript sync of ~/.codex/sessions \u2014 ${j(g)}`,cursor:`user hooks (~/.cursor/hooks.json)${w}`,copilot_agent:`workspace hooks${w}`,antigravity:H.length>0?`${H.join(" + ")}${w}`:"NOT CAPTURED \u2014 no rulemetric block in ~/.gemini/config/hooks.json or .agents/hooks.json; run `rulemetric hooks install` (user hooks are on by default)"};this.log(""),this.log(" Capture coverage (agents found on this machine):");for(let e of C)this.log(` \u2022 ${e.padEnd(15)} ${ie[e]??"captured"}`);if(C.includes("codex"))if(g.error)this.log(` ! ${g.error}`);else if(g.mode==="allowlist")for(let e of g.roots)this.log(` \u21B3 ${e}`);else g.mode==="all"&&this.log(` \u21B3 scope it with ${se(x(),X)} ({"codex":{"roots":["/path/to/repo"]}}) or RULEMETRIC_CODEX_CAPTURE=off`);o&&!o.worker.active&&C.includes("codex")&&g.mode!=="off"&&this.log(" ! Codex capture runs INSIDE the worker \u2014 it is stopped while the worker is down."),v()&&l&&await this.reportEvolutionSpend();let P=W({nodeVersion:r,directApiOk:l,httpsProxySet:s,gatewayAlive:m,mitmproxyAlive:d,proxyPathOk:p});this.log("");let ae=P.severity==="ok"?"[OK]":P.severity==="warn"?"[!!]":"[XX]";this.log(`${ae} ${P.headline}`);for(let e of P.hints)this.log(` \u2022 ${e}`);if(o&&o.verdict.severity!=="ok"){let e=o.verdict.severity==="warn"?"[!!]":"[XX]";this.log(""),this.log(`${e} ${o.verdict.headline}`);for(let c of o.verdict.hints)this.log(` \u2022 ${c}`)}}async reportEvolutionSpend(){let r;try{r=await y("/api/eval-targets?type=instruction&limit=200")}catch{return}let i=r.filter(s=>{let l=s.metadata??{};return l.autoEvolveEnabled===!0||l.autoEvolveEnabled==="true"});if(i.length!==0){this.log(""),this.log(" Nightly instruction evolution (cron_instruction_evolution, 07:30 UTC):");for(let s of i){let l=s.metadata??{},m=Q(l),d=z(l);if(m){this.log(` \u2022 ${s.name} \u2014 PAUSED (metadata.autoEvolvePaused). Opt-in preserved.`),this.log(" \u21B3 resume: set autoEvolvePaused=false");continue}let p=null;try{p=(await y(`/api/eval-targets/${s.id}/evals`)).filter(a=>!a.retiredAt).length}catch{}if(this.log(` \u2022 ${s.name}`),p!=null){let t=ne(p,d.minPairs,oe(d,p));if(!t.feasible)this.log(` \u21B3 cannot reach a verdict \u2014 ${t.reason}`);else{let a=Z({liveCases:p,passes:t.passes});this.log(` \u21B3 each night: ${te(a)}`)}}this.log(` \u21B3 pairs budget ${d.minPairs}`+(d.configured?" (metadata.autoEvolvePairs)":" (default)")+` \xB7 writes ${l.autoEvolveApply===!0||l.autoEvolveApply==="true"?"ENABLED":"off (dry run)"}`),d.note&&this.log(` ! ${d.note}`);try{let t=await y(`/api/eval-targets/${s.id}/promotions?limit=1`),a=t.promotions[0];if(a){let n=a.gates?.cost,f=n?.modelCalls?`${n.modelCalls} model calls, ${n.usablePairs??"?"} usable pair(s)`+(n.mde!=null?`, resolved +/-${ee(n.mde)}`:"")+(n.wallMs?`, ${(n.wallMs/6e4).toFixed(0)} min`:""):"cost not recorded (decision predates cost tracking)";this.log(` \u21B3 last run ${new Date(a.createdAt).toISOString().slice(0,10)}: ${a.decision}${a.applied?" (APPLIED)":""} \u2014 ${f}`)}let o=t.counts??{};this.log(` \u21B3 lifetime: ${o.promote??0} promote / ${o.revert??0} revert / ${o.refuse??0} refuse`)}catch{}}this.log(" \u21B3 pause the spend: metadata.autoEvolvePaused=true (keeps the opt-in)")}}};function A(h){if(h===null)return"never";if(h<90)return`${Math.round(h)}s`;let r=Math.round(h/60);return r<90?`${r}m`:`${Math.round(r/60)}h`}S(A,"formatAge");export{I as default};
1
+ import{c as q,d as K}from"../chunk-TYFEWLYZ.js";import{b as L,c as W}from"../chunk-V5U3E4BZ.js";import{a as J}from"../chunk-2TJ7Q2OU.js";import{e as O,f as _,g as M}from"../chunk-QWCEZEDO.js";import"../chunk-KKDHD4XA.js";import"../chunk-SZ62CP55.js";import{d as oe,e as ne}from"../chunk-POEMCITL.js";import"../chunk-M7QSC64D.js";import"../chunk-XGMOVQ5G.js";import{i as z,j as Q,k as Z,m as ee,n as te}from"../chunk-LB24UKHZ.js";import"../chunk-G7V4ZZZ3.js";import"../chunk-43VKTVM3.js";import"../chunk-AHLVY52I.js";import"../chunk-SCQK52SL.js";import"../chunk-ZK3ACE4T.js";import"../chunk-N4YPDZJF.js";import"../chunk-PPAHIVG5.js";import"../chunk-5MXZJWQS.js";import"../chunk-CT7FWSIU.js";import"../chunk-N7ODX6PO.js";import{a as V}from"../chunk-OZQNSELV.js";import"../chunk-HFGO5762.js";import"../chunk-VS5ROGDP.js";import"../chunk-H6FVXVGG.js";import"../chunk-SWSOEYC7.js";import"../chunk-U2NT5OSQ.js";import"../chunk-KGURGIZ2.js";import"../chunk-GYNZ3OZF.js";import"../chunk-UPFH72PF.js";import"../chunk-DVU5PHPM.js";import"../chunk-CDY7TQFZ.js";import"../chunk-VBXL7XO7.js";import"../chunk-FBSZ6KCM.js";import"../chunk-JP6ULOEX.js";import"../chunk-SG4UDDHB.js";import{d as F}from"../chunk-GPBN4ROE.js";import"../chunk-6XTLP2G7.js";import"../chunk-PJ3WHQ67.js";import{a as X,b as D,c as Y,g as j,h as G}from"../chunk-QI3FJKGK.js";import{a as B}from"../chunk-MU7KKU3O.js";import"../chunk-IZTIYR5Q.js";import"../chunk-FKTT7A4H.js";import"../chunk-VIFOLTZT.js";import"../chunk-4FJYVYCU.js";import"../chunk-3AV3GTMP.js";import{a as U,e as y}from"../chunk-76UKAFNM.js";import"../chunk-42A4PUW7.js";import"../chunk-XQYAVSUQ.js";import{a as N,g as v,l as x}from"../chunk-PZNWH4VQ.js";import{a as S}from"../chunk-ZLLER3HP.js";import{spawnSync as le}from"node:child_process";import{existsSync as ce,readFileSync as ue}from"node:fs";import{join as se}from"node:path";var I=class h extends B{static{S(this,"Diagnostics")}static description='Diagnose capture / proxy / connectivity problems (e.g. a client-side "502 Bad Gateway")';static examples=["<%= config.bin %> diagnostics"];baseUrl(){return process.env.RULEMETRIC_API_URL??N().apiUrl??U}async checkDirect(){let r=process.env.HTTPS_PROXY,i=process.env.HTTP_PROXY;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let s=new AbortController,l=setTimeout(()=>s.abort(),8e3);try{return(await globalThis.fetch(`${this.baseUrl()}/health`,{signal:s.signal})).ok}catch{return!1}finally{clearTimeout(l),r!==void 0&&(process.env.HTTPS_PROXY=r),i!==void 0&&(process.env.HTTP_PROXY=i)}}configuredProxy(){if(process.env.HTTPS_PROXY)return process.env.HTTPS_PROXY;for(let r of["settings.local.json","settings.json"]){let i=se(process.cwd(),".claude",r);if(ce(i))try{let s=JSON.parse(ue(i,"utf8"));if(s.env?.HTTPS_PROXY)return s.env.HTTPS_PROXY}catch{}}return null}checkThroughProxy(r){let i=le("curl",["-sS","-x",r,"--max-time","8","-o","/dev/null","-w","%{http_code}",`${this.baseUrl()}/health`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return i.error||typeof i.stdout!="string"?null:i.stdout.trim()==="200"}async run(){await this.parse(h);let r=process.version,i=this.configuredProxy(),s=i!=null,[l,m,d]=await Promise.all([this.checkDirect(),M(O),M(_)]),p=s&&i?this.checkThroughProxy(i):null,t=S((e,c,T)=>{let u=c===null?"\u2013":c?"[OK]":"[!!]";this.log(` ${u} ${e.padEnd(22)} ${T}`)},"line");this.log("RuleMetric diagnostics"),this.log(""),t("Node",!L(r),`${r}${L(r)?" (< 20.11 \u2014 breaks the bundled proxy)":""}`),t("API (direct)",l,`${this.baseUrl()}/health ${l?"reachable":"UNREACHABLE"}`),t("Authenticated",v(),v()?"yes":"no \u2014 run `rulemetric auth login`"),t("Proxy configured",s?!0:null,s?i:"no HTTPS_PROXY set"),s&&(t("Gateway :"+O,m,m?"listening":"NOT listening"),t("mitmproxy :"+_,d,d?"listening":"not listening (gateway should route direct)"),t("API (via proxy)",p,p===null?"inconclusive (curl unavailable)":p?"reachable":"FAILED \u2014 502/blocked through your proxy"));let a=F();t("claude CLI",a.claudeBin!=null,a.claudeBin??"not found \u2014 LLM features (grading, distill) will no-op"),t("codex CLI",a.codexBin!=null?!0:null,a.codexBin?`${a.codexBin}${a.codexConfiguredModel?` (model ${a.codexConfiguredModel})`:""}`:"not found \u2014 optional; enables the cross-vendor reviewer (evals validate-judge)");let o=null;if(v()&&l)try{o=await y("/api/workers/health")}catch{o=null}if(o){let e=o.worker;t("Worker",!!e.active,e.present?e.active?`online (last heartbeat ${e.ageSeconds??"?"}s ago${e.clientVersion?`, v${e.clientVersion}`:""})`:`NOT RUNNING \u2014 last heartbeat ${A(e.ageSeconds)} ago`:"never connected \u2014 no worker has ever reported in");let c=o.worker.engines;if(c!=null){let u=[c.claude&&"claude",c.codex&&"codex"].filter(Boolean);t("LLM engine",u.length>0,u.length>0?`${u.join(" + ")} available to the worker`:"NONE \u2014 the worker found no `claude` and no `codex`. LLM jobs will complete with empty output rather than failing.")}let T=o.pending.reduce((u,E)=>u+E.count,0);if(T>0){let u=o.verdict.stuck.reduce(($,k)=>$+k.count,0),E=o.verdict.unclaimable.reduce(($,k)=>$+k.count,0),R=(o.verdict.engineBlocked??[]).reduce(($,k)=>$+k.count,0);t("Job queue",u===0&&R===0,`${T} pending`+(u>0?` \u2014 ${u} waiting on this worker`:"")+(R>0?` \u2014 ${R} need a local LLM engine`:"")+(E>0?` \u2014 ${E} need a worker with DATABASE_URL`:""))}else t("Job queue",!0,"empty")}else v()&&l&&t("Worker",null,"could not read /workers/health (older API?)");let n=o?.worker.machine;if(n){let e=n.suspends+n.stalls,c=n.lastPause;t("Worker pauses",e===0?!0:null,e===0?`none since ${n.since} \u2014 no sleep or stall seen by the worker`:`${n.suspends} suspend${n.suspends===1?"":"s"}`+(n.stalls>0?` + ${n.stalls} event-loop stall${n.stalls===1?"":"s"}`:"")+` since ${n.since}, ${A(Math.round(n.pausedMs/1e3))} paused total`+(c?`; last: ${c.kind} of ${A(Math.round(c.wallGapMs/1e3))} ending ${c.detectedAt}`:"")+" \u2014 jobs in flight during a suspend lose their lease and are redone on wake")}let f=await q();if(f){t("Machine sleep (pmset)",f.sleeps===0?!0:null,K(f));for(let e of f.recent.slice(-3)){let c=e.seconds!=null?` (${A(e.seconds)})`:"";this.log(` \u21B3 ${e.at.toISOString()} ${e.kind}${c}: ${e.reason.slice(0,80)}`)}}let C=V(process.cwd()),g=await D({configDir:x()}),re=await Y({configDir:x()}),w=` \u2014 ${G(re)}`,b=J(process.cwd()),H=[b.user&&`user hooks (${b.user})`,b.workspace&&`workspace hooks (${b.workspace})`].filter(Boolean),ie={claude_code:`session hooks (+ proxy for instruction linking)${w}`,codex:`worker transcript sync of ~/.codex/sessions \u2014 ${j(g)}`,cursor:`user hooks (~/.cursor/hooks.json)${w}`,copilot_agent:`workspace hooks${w}`,antigravity:H.length>0?`${H.join(" + ")}${w}`:"NOT CAPTURED \u2014 no rulemetric block in ~/.gemini/config/hooks.json or .agents/hooks.json; run `rulemetric hooks install` (user hooks are on by default)"};this.log(""),this.log(" Capture coverage (agents found on this machine):");for(let e of C)this.log(` \u2022 ${e.padEnd(15)} ${ie[e]??"captured"}`);if(C.includes("codex"))if(g.error)this.log(` ! ${g.error}`);else if(g.mode==="allowlist")for(let e of g.roots)this.log(` \u21B3 ${e}`);else g.mode==="all"&&this.log(` \u21B3 scope it with ${se(x(),X)} ({"codex":{"roots":["/path/to/repo"]}}) or RULEMETRIC_CODEX_CAPTURE=off`);o&&!o.worker.active&&C.includes("codex")&&g.mode!=="off"&&this.log(" ! Codex capture runs INSIDE the worker \u2014 it is stopped while the worker is down."),v()&&l&&await this.reportEvolutionSpend();let P=W({nodeVersion:r,directApiOk:l,httpsProxySet:s,gatewayAlive:m,mitmproxyAlive:d,proxyPathOk:p});this.log("");let ae=P.severity==="ok"?"[OK]":P.severity==="warn"?"[!!]":"[XX]";this.log(`${ae} ${P.headline}`);for(let e of P.hints)this.log(` \u2022 ${e}`);if(o&&o.verdict.severity!=="ok"){let e=o.verdict.severity==="warn"?"[!!]":"[XX]";this.log(""),this.log(`${e} ${o.verdict.headline}`);for(let c of o.verdict.hints)this.log(` \u2022 ${c}`)}}async reportEvolutionSpend(){let r;try{r=await y("/api/eval-targets?type=instruction&limit=200")}catch{return}let i=r.filter(s=>{let l=s.metadata??{};return l.autoEvolveEnabled===!0||l.autoEvolveEnabled==="true"});if(i.length!==0){this.log(""),this.log(" Nightly instruction evolution (cron_instruction_evolution, 07:30 UTC):");for(let s of i){let l=s.metadata??{},m=Q(l),d=z(l);if(m){this.log(` \u2022 ${s.name} \u2014 PAUSED (metadata.autoEvolvePaused). Opt-in preserved.`),this.log(" \u21B3 resume: set autoEvolvePaused=false");continue}let p=null;try{p=(await y(`/api/eval-targets/${s.id}/evals`)).filter(a=>!a.retiredAt).length}catch{}if(this.log(` \u2022 ${s.name}`),p!=null){let t=ne(p,d.minPairs,oe(d,p));if(!t.feasible)this.log(` \u21B3 cannot reach a verdict \u2014 ${t.reason}`);else{let a=Z({liveCases:p,passes:t.passes});this.log(` \u21B3 each night: ${te(a)}`)}}this.log(` \u21B3 pairs budget ${d.minPairs}`+(d.configured?" (metadata.autoEvolvePairs)":" (default)")+` \xB7 writes ${l.autoEvolveApply===!0||l.autoEvolveApply==="true"?"ENABLED":"off (dry run)"}`),d.note&&this.log(` ! ${d.note}`);try{let t=await y(`/api/eval-targets/${s.id}/promotions?limit=1`),a=t.promotions[0];if(a){let n=a.gates?.cost,f=n?.modelCalls?`${n.modelCalls} model calls, ${n.usablePairs??"?"} usable pair(s)`+(n.mde!=null?`, resolved +/-${ee(n.mde)}`:"")+(n.wallMs?`, ${(n.wallMs/6e4).toFixed(0)} min`:""):"cost not recorded (decision predates cost tracking)";this.log(` \u21B3 last run ${new Date(a.createdAt).toISOString().slice(0,10)}: ${a.decision}${a.applied?" (APPLIED)":""} \u2014 ${f}`)}let o=t.counts??{};this.log(` \u21B3 lifetime: ${o.promote??0} promote / ${o.revert??0} revert / ${o.refuse??0} refuse`)}catch{}}this.log(" \u21B3 pause the spend: metadata.autoEvolvePaused=true (keeps the opt-in)")}}};function A(h){if(h===null)return"never";if(h<90)return`${Math.round(h)}s`;let r=Math.round(h/60);return r<90?`${r}m`:`${Math.round(r/60)}h`}S(A,"formatAge");export{I as default};
@@ -1 +1 @@
1
- import{a}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{f as s}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as e}from"@oclif/core";import{readFileSync as p}from"node:fs";var n=class c extends a{static{o(this,"EvalTargetCreate")}static description="Create an eval target (instruction, skill, prompt, or plan to test)";static examples=["<%= config.bin %> eval-targets create --name my-rules --type instruction --file ./CLAUDE.md",'<%= config.bin %> eval-targets create --name my-prompt --type prompt --content "Always use TypeScript"'];static flags={name:e.string({char:"n",description:"Name for the eval target",required:!0}),type:e.string({char:"t",description:"Target type",options:["instruction","skill","prompt","plan"],required:!0}),file:e.string({char:"f",description:"Path to content file"}),content:e.string({char:"c",description:"Content string (alternative to --file)"}),description:e.string({char:"d",description:"Description of the target",default:""})};async run(){let{flags:t}=await this.parse(c);this.requireAuth();let i;t.file?i=p(t.file,"utf-8"):t.content?i=t.content:this.error("Provide either --file or --content");let r=await s("/api/eval-targets",{name:t.name,type:t.type,content:i,description:t.description});this.log(`Created eval target: ${r.name} (${r.id}) v${r.version}`)}};export{n as default};
1
+ import{a}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{f as s}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as e}from"@oclif/core";import{readFileSync as p}from"node:fs";var n=class c extends a{static{o(this,"EvalTargetCreate")}static description="Create an eval target (instruction, skill, prompt, or plan to test)";static examples=["<%= config.bin %> eval-targets create --name my-rules --type instruction --file ./CLAUDE.md",'<%= config.bin %> eval-targets create --name my-prompt --type prompt --content "Always use TypeScript"'];static flags={name:e.string({char:"n",description:"Name for the eval target",required:!0}),type:e.string({char:"t",description:"Target type",options:["instruction","skill","prompt","plan"],required:!0}),file:e.string({char:"f",description:"Path to content file"}),content:e.string({char:"c",description:"Content string (alternative to --file)"}),description:e.string({char:"d",description:"Description of the target",default:""})};async run(){let{flags:t}=await this.parse(c);this.requireAuth();let i;t.file?i=p(t.file,"utf-8"):t.content?i=t.content:this.error("Provide either --file or --content");let r=await s("/api/eval-targets",{name:t.name,type:t.type,content:i,description:t.description});this.log(`Created eval target: ${r.name} (${r.id}) v${r.version}`)}};export{n as default};
@@ -1 +1 @@
1
- import{a as p,b as e}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Flags as m}from"@oclif/core";import{printTable as d}from"@oclif/table";var r=class l extends o{static{s(this,"EvalTargetList")}static description="List eval targets";static examples=["<%= config.bin %> eval-targets list","<%= config.bin %> eval-targets list --type instruction"];static flags={type:m.string({char:"t",description:"Filter by type",options:["instruction","skill","prompt","plan"]})};async run(){let{flags:i}=await this.parse(l);this.requireAuth();let c=i.type?`?type=${i.type}`:"",a=await n(`/api/eval-targets${c}`);if(a.length===0){this.log("No eval targets found. Create one with `rulemetric eval-targets create`.");return}d({data:a.map(t=>({Name:e(t.name,30),Type:t.type,Version:`v${t.version}`,Description:e(t.description,40),Updated:p(t.updatedAt)})),columns:["Name","Type","Version","Description","Updated"]})}};export{r as default};
1
+ import{a as p,b as e}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Flags as m}from"@oclif/core";import{printTable as d}from"@oclif/table";var r=class l extends o{static{s(this,"EvalTargetList")}static description="List eval targets";static examples=["<%= config.bin %> eval-targets list","<%= config.bin %> eval-targets list --type instruction"];static flags={type:m.string({char:"t",description:"Filter by type",options:["instruction","skill","prompt","plan"]})};async run(){let{flags:i}=await this.parse(l);this.requireAuth();let c=i.type?`?type=${i.type}`:"",a=await n(`/api/eval-targets${c}`);if(a.length===0){this.log("No eval targets found. Create one with `rulemetric eval-targets create`.");return}d({data:a.map(t=>({Name:e(t.name,30),Type:t.type,Version:`v${t.version}`,Description:e(t.description,40),Updated:p(t.updatedAt)})),columns:["Name","Type","Version","Description","Updated"]})}};export{r as default};
@@ -1,3 +1,3 @@
1
- import{a as G,b as V,c as j,d as q}from"../../chunk-J4W6GNCF.js";import{b as M}from"../../chunk-GH4EZK2O.js";import{c as g}from"../../chunk-HRJDKAJ4.js";import{e as D}from"../../chunk-OYAOLJUH.js";import"../../chunk-NRYVMGJN.js";import"../../chunk-ZA6NXNPR.js";import"../../chunk-IEQDLURA.js";import"../../chunk-KINIFUZQ.js";import"../../chunk-FCTFHY3X.js";import"../../chunk-JRAXWASH.js";import"../../chunk-LDUJWJ6A.js";import"../../chunk-WSWZPNLG.js";import"../../chunk-OLJF4K7L.js";import"../../chunk-DDYGA2DS.js";import"../../chunk-ZYGBABMZ.js";import"../../chunk-YP2CBUXH.js";import"../../chunk-U7BPWFOP.js";import"../../chunk-3ZHVP3KE.js";import"../../chunk-XFLKW6SJ.js";import"../../chunk-HOQPVOMF.js";import"../../chunk-5XEGRU2R.js";import"../../chunk-SPJ73X7A.js";import"../../chunk-E7GQJML3.js";import"../../chunk-PPIZMPNI.js";import"../../chunk-IC6VZHE6.js";import"../../chunk-5RBLIVBF.js";import"../../chunk-EXVXKJ7Y.js";import"../../chunk-INAZLRY5.js";import"../../chunk-OMRH4JXS.js";import"../../chunk-JLBQKV4V.js";import"../../chunk-FJX7WDPG.js";import"../../chunk-EWGE7YTQ.js";import"../../chunk-XAOLOR4Q.js";import"../../chunk-PZS55PW2.js";import"../../chunk-NSPDDSRR.js";import"../../chunk-SJKS3PYX.js";import"../../chunk-ET7753IY.js";import"../../chunk-YNLHJHUP.js";import"../../chunk-3UKZJAFS.js";import"../../chunk-IOX4VJPR.js";import"../../chunk-JRWQJZYQ.js";import"../../chunk-GIRPEMTW.js";import"../../chunk-SIGZEQ3K.js";import"../../chunk-LMCICVE7.js";import"../../chunk-J7UZXRTH.js";import"../../chunk-N7SZWKCU.js";import"../../chunk-BVOXWAJO.js";import"../../chunk-SE3UKA3M.js";import"../../chunk-O62OLKQL.js";import"../../chunk-LJRE3LZ2.js";import"../../chunk-HFSISGCJ.js";import"../../chunk-UQDOOQCM.js";import"../../chunk-E7RH43OS.js";import"../../chunk-JKWB6UXA.js";import"../../chunk-6UEFCMR2.js";import"../../chunk-MODXEGCU.js";import"../../chunk-MHVHGKDK.js";import"../../chunk-RBSEE2Z6.js";import"../../chunk-GQGGFHX7.js";import"../../chunk-S5U76YUI.js";import"../../chunk-M7QSC64D.js";import"../../chunk-VLWNSTYW.js";import"../../chunk-G7V4ZZZ3.js";import"../../chunk-SV73ASP2.js";import"../../chunk-LB24UKHZ.js";import"../../chunk-RRM4HQG4.js";import"../../chunk-7ML2UCI7.js";import"../../chunk-GN46S7T4.js";import"../../chunk-PPAHIVG5.js";import"../../chunk-5MXZJWQS.js";import"../../chunk-CT7FWSIU.js";import"../../chunk-AHLVY52I.js";import"../../chunk-N7ODX6PO.js";import"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import"../../chunk-OUK2AWEI.js";import"../../chunk-SWSOEYC7.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-GYNZ3OZF.js";import"../../chunk-UPFH72PF.js";import"../../chunk-OO2ZRKZY.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-VBXL7XO7.js";import"../../chunk-UJ7EPLKC.js";import"../../chunk-PUX6P5KC.js";import"../../chunk-SG4UDDHB.js";import"../../chunk-SBGXIPRN.js";import"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import{b as A,d as C,g as S,i as E,j as L,k as $}from"../../chunk-QI3FJKGK.js";import{a as O}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{f as m}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import{e as I,l as p}from"../../chunk-PZNWH4VQ.js";import{a as e}from"../../chunk-ZLLER3HP.js";import{trace as de,context as me}from"@opentelemetry/api";import{NodeSDK as W}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as Y}from"@opentelemetry/exporter-trace-otlp-http";import{BatchSpanProcessor as J,ConsoleSpanExporter as z,SimpleSpanProcessor as Q}from"@opentelemetry/sdk-trace-node";import{Resource as Z}from"@opentelemetry/resources";import{ATTR_SERVICE_NAME as ee,ATTR_SERVICE_VERSION as te}from"@opentelemetry/semantic-conventions";function F(r){if(!r)return{};let n={};for(let o of r.split(",")){let s=o.indexOf("=");if(s===-1)continue;let i=o.slice(0,s).trim(),c=o.slice(s+1).trim();i&&(n[i]=c)}return n}e(F,"parseOtlpHeaders");var u=null;function T(){return process.env.TELEMETRY_ENABLED!=="false"}e(T,"isTelemetryEnabled");function x(r){if(!T()||u!==null)return"off";let n=new Z({[ee]:r.serviceName,[te]:r.serviceVersion??"0.1.0"}),o=process.env.OTEL_EXPORTER_OTLP_ENDPOINT,s,i;if(o){let c=F(process.env.OTEL_EXPORTER_OTLP_HEADERS),l=new Y({url:`${o}/v1/traces`,headers:c});i=new J(l),s="otlp"}else if(process.env.OTEL_SPAN_EXPORT==="none")i=void 0,s="silent";else{let c=new z;i=new Q(c),s="console"}return u=new W({resource:n,spanProcessors:i?[i]:[]}),u.start(),s}e(x,"initTelemetry");async function h(){u&&(await u.shutdown(),u=null)}e(h,"shutdownTelemetry");import{SpanKind as Pe,SpanStatusCode as Re}from"@opentelemetry/api";import{trace as Ie,context as Oe}from"@opentelemetry/api";import*as f from"@sentry/node";var v=!1;function w(r){if(v)return!1;let n=process.env.SENTRY_DSN;return n?(f.init({dsn:n,serverName:r.serviceName,environment:process.env.NODE_ENV??"development",tracesSampleRate:0}),v=!0,!0):!1}e(w,"initSentry");async function y(r){v&&await f.flush(r)}e(y,"flushSentry");import{existsSync as ne,mkdirSync as oe,readFileSync as k,unlinkSync as X,writeFileSync as U}from"node:fs";import{dirname as se,join as R}from"node:path";import{execFileSync as ie}from"node:child_process";var a=R(p(),"evals-agent.lock");function ce(r){try{return process.kill(r,0),!0}catch(n){return n.code==="EPERM"}}e(ce,"pidAlive");function ae(r){if(!ce(r))return!1;try{let n=ie("ps",["-p",String(r),"-o","command="],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return/run\.js\s+evals\s+agent|evals\s+agent/.test(n)}catch{return!0}}e(ae,"isLiveAgent");function le(){try{oe(se(a),{recursive:!0})}catch{}for(let r=0;r<2;r++)try{return U(a,String(process.pid),{flag:"wx"}),{ok:!0}}catch(n){if(n.code!=="EEXIST")throw n;let o=0;try{o=Number(k(a,"utf-8").trim())}catch{}if(o&&o!==process.pid&&ae(o))return{ok:!1,holder:o};try{X(a)}catch{}}try{U(a,String(process.pid))}catch{}return{ok:!0}}e(le,"acquireAgentLock");function P(){try{ne(a)&&Number(k(a,"utf-8").trim())===process.pid&&X(a)}catch{}}e(P,"releaseAgentLock");var N=class r extends O{static{e(this,"EvalAgentCommand")}static description="The worker daemon: long-polls /api/work/next, claims jobs, and runs them locally. Installed as a launchd service by `rulemetric service install`.";static examples=["<%= config.bin %> evals agent"];async run(){await this.parse(r),this.requireAuth();let n=le();if(!n.ok){this.log(`Another rulemetric evals agent is already running (pid ${n.holder}). Refusing to start a second instance.`);return}process.env.PG_APPLICATION_NAME||="rulemetric-agent",w({serviceName:"rulemetric-agent"})&&this.log("[sentry] error capture enabled");let s=x({serviceName:"rulemetric-agent"});s==="otlp"?this.log(`[otel] traces exporting to ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}`):s==="console"?this.log("[otel] cron spans printing to stdout (set OTEL_EXPORTER_OTLP_ENDPOINT to ship to a backend)"):this.log("[otel] disabled (TELEMETRY_ENABLED=false)"),!I()&&!process.env.RULEMETRIC_API_KEY&&this.error("No auth token found. Run `rulemetric auth login` first."),this.log("Starting thin agent (Phase 4b parallel-run)..."),this.log(`Long-polling /api/work/next. Press Ctrl+C to stop.
1
+ import{a as G,b as V,c as j,d as q}from"../../chunk-J4W6GNCF.js";import{b as M}from"../../chunk-GH4EZK2O.js";import{c as g}from"../../chunk-Q776YUBD.js";import{e as D}from"../../chunk-BAITMD76.js";import"../../chunk-W23OYQXI.js";import"../../chunk-EMLLGASZ.js";import"../../chunk-IEQDLURA.js";import"../../chunk-KINIFUZQ.js";import"../../chunk-V55ROUNP.js";import"../../chunk-XMA6SWOT.js";import"../../chunk-RAQLVO2X.js";import"../../chunk-DHX4U6EC.js";import"../../chunk-NYNHX7OX.js";import"../../chunk-VXL5H3VZ.js";import"../../chunk-QAMHZY2P.js";import"../../chunk-RMRVUI7B.js";import"../../chunk-ISFPPDDB.js";import"../../chunk-ZYGBABMZ.js";import"../../chunk-5RBLIVBF.js";import"../../chunk-AIYFT4P6.js";import"../../chunk-PZS55PW2.js";import"../../chunk-3IMRLHJJ.js";import"../../chunk-3ZHVP3KE.js";import"../../chunk-EUHRTEVJ.js";import"../../chunk-HOQPVOMF.js";import"../../chunk-GKVHFXUQ.js";import"../../chunk-LJRJ2RAC.js";import"../../chunk-E7GQJML3.js";import"../../chunk-QRIJ3AHP.js";import"../../chunk-CT6GJQIR.js";import"../../chunk-OVS7ZDJ4.js";import"../../chunk-AGEZAKCC.js";import"../../chunk-I6ZQOMZS.js";import"../../chunk-6ANODRDT.js";import"../../chunk-3UKZJAFS.js";import"../../chunk-XJ25HFIT.js";import"../../chunk-SJKS3PYX.js";import"../../chunk-YK2IEHLB.js";import"../../chunk-PIVEJTNF.js";import"../../chunk-7MTYUTUN.js";import"../../chunk-MMLRWCBW.js";import"../../chunk-GIRPEMTW.js";import"../../chunk-SIGZEQ3K.js";import"../../chunk-DQYYHX6K.js";import"../../chunk-2UK4DZFW.js";import"../../chunk-3FNTV2TW.js";import"../../chunk-JTYVBR5H.js";import"../../chunk-B5X6HCBK.js";import"../../chunk-T75KAEJO.js";import"../../chunk-RXZLBSDO.js";import"../../chunk-LJRE3LZ2.js";import"../../chunk-MXHAXY66.js";import"../../chunk-FYZ6HHCV.js";import"../../chunk-OP4U3XBZ.js";import"../../chunk-HNYHZO2J.js";import"../../chunk-6UEFCMR2.js";import"../../chunk-MODXEGCU.js";import"../../chunk-MHVHGKDK.js";import"../../chunk-RBSEE2Z6.js";import"../../chunk-KOYHJFB3.js";import"../../chunk-POEMCITL.js";import"../../chunk-M7QSC64D.js";import"../../chunk-XGMOVQ5G.js";import"../../chunk-LB24UKHZ.js";import"../../chunk-G7V4ZZZ3.js";import"../../chunk-43VKTVM3.js";import"../../chunk-AHLVY52I.js";import"../../chunk-SCQK52SL.js";import"../../chunk-ZK3ACE4T.js";import"../../chunk-N4YPDZJF.js";import"../../chunk-PPAHIVG5.js";import"../../chunk-5MXZJWQS.js";import"../../chunk-CT7FWSIU.js";import"../../chunk-N7ODX6PO.js";import"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import"../../chunk-H6FVXVGG.js";import"../../chunk-SWSOEYC7.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-GYNZ3OZF.js";import"../../chunk-UPFH72PF.js";import"../../chunk-DVU5PHPM.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-VBXL7XO7.js";import"../../chunk-FBSZ6KCM.js";import"../../chunk-JP6ULOEX.js";import"../../chunk-SG4UDDHB.js";import"../../chunk-GPBN4ROE.js";import"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import{b as A,d as C,g as S,i as E,j as L,k as $}from"../../chunk-QI3FJKGK.js";import{a as O}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{f as m}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import{e as I,l as p}from"../../chunk-PZNWH4VQ.js";import{a as e}from"../../chunk-ZLLER3HP.js";import{trace as de,context as me}from"@opentelemetry/api";import{NodeSDK as W}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as Y}from"@opentelemetry/exporter-trace-otlp-http";import{BatchSpanProcessor as J,ConsoleSpanExporter as z,SimpleSpanProcessor as Q}from"@opentelemetry/sdk-trace-node";import{Resource as Z}from"@opentelemetry/resources";import{ATTR_SERVICE_NAME as ee,ATTR_SERVICE_VERSION as te}from"@opentelemetry/semantic-conventions";function F(r){if(!r)return{};let n={};for(let o of r.split(",")){let s=o.indexOf("=");if(s===-1)continue;let i=o.slice(0,s).trim(),c=o.slice(s+1).trim();i&&(n[i]=c)}return n}e(F,"parseOtlpHeaders");var u=null;function T(){return process.env.TELEMETRY_ENABLED!=="false"}e(T,"isTelemetryEnabled");function x(r){if(!T()||u!==null)return"off";let n=new Z({[ee]:r.serviceName,[te]:r.serviceVersion??"0.1.0"}),o=process.env.OTEL_EXPORTER_OTLP_ENDPOINT,s,i;if(o){let c=F(process.env.OTEL_EXPORTER_OTLP_HEADERS),l=new Y({url:`${o}/v1/traces`,headers:c});i=new J(l),s="otlp"}else if(process.env.OTEL_SPAN_EXPORT==="none")i=void 0,s="silent";else{let c=new z;i=new Q(c),s="console"}return u=new W({resource:n,spanProcessors:i?[i]:[]}),u.start(),s}e(x,"initTelemetry");async function h(){u&&(await u.shutdown(),u=null)}e(h,"shutdownTelemetry");import{SpanKind as Pe,SpanStatusCode as Re}from"@opentelemetry/api";import{trace as Ie,context as Oe}from"@opentelemetry/api";import*as f from"@sentry/node";var v=!1;function w(r){if(v)return!1;let n=process.env.SENTRY_DSN;return n?(f.init({dsn:n,serverName:r.serviceName,environment:process.env.NODE_ENV??"development",tracesSampleRate:0}),v=!0,!0):!1}e(w,"initSentry");async function y(r){v&&await f.flush(r)}e(y,"flushSentry");import{existsSync as ne,mkdirSync as oe,readFileSync as k,unlinkSync as X,writeFileSync as U}from"node:fs";import{dirname as se,join as R}from"node:path";import{execFileSync as ie}from"node:child_process";var a=R(p(),"evals-agent.lock");function ce(r){try{return process.kill(r,0),!0}catch(n){return n.code==="EPERM"}}e(ce,"pidAlive");function ae(r){if(!ce(r))return!1;try{let n=ie("ps",["-p",String(r),"-o","command="],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return/run\.js\s+evals\s+agent|evals\s+agent/.test(n)}catch{return!0}}e(ae,"isLiveAgent");function le(){try{oe(se(a),{recursive:!0})}catch{}for(let r=0;r<2;r++)try{return U(a,String(process.pid),{flag:"wx"}),{ok:!0}}catch(n){if(n.code!=="EEXIST")throw n;let o=0;try{o=Number(k(a,"utf-8").trim())}catch{}if(o&&o!==process.pid&&ae(o))return{ok:!1,holder:o};try{X(a)}catch{}}try{U(a,String(process.pid))}catch{}return{ok:!0}}e(le,"acquireAgentLock");function P(){try{ne(a)&&Number(k(a,"utf-8").trim())===process.pid&&X(a)}catch{}}e(P,"releaseAgentLock");var N=class r extends O{static{e(this,"EvalAgentCommand")}static description="The worker daemon: long-polls /api/work/next, claims jobs, and runs them locally. Installed as a launchd service by `rulemetric service install`.";static examples=["<%= config.bin %> evals agent"];async run(){await this.parse(r),this.requireAuth();let n=le();if(!n.ok){this.log(`Another rulemetric evals agent is already running (pid ${n.holder}). Refusing to start a second instance.`);return}process.env.PG_APPLICATION_NAME||="rulemetric-agent",w({serviceName:"rulemetric-agent"})&&this.log("[sentry] error capture enabled");let s=x({serviceName:"rulemetric-agent"});s==="otlp"?this.log(`[otel] traces exporting to ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}`):s==="console"?this.log("[otel] cron spans printing to stdout (set OTEL_EXPORTER_OTLP_ENDPOINT to ship to a backend)"):this.log("[otel] disabled (TELEMETRY_ENABLED=false)"),!I()&&!process.env.RULEMETRIC_API_KEY&&this.error("No auth token found. Run `rulemetric auth login` first."),this.log("Starting thin agent (Phase 4b parallel-run)..."),this.log(`Long-polling /api/work/next. Press Ctrl+C to stop.
2
2
  `);let c=new AbortController,l=await A({configDir:p()});if(this.log(`[transcript-sync] Codex capture: ${S(l)}`),l.error)this.log(`[transcript-sync] WARNING: ${l.error}`);else if(l.mode==="allowlist")for(let t of l.roots)this.log(`[transcript-sync] \u2022 ${t}`);let d=await C({configDir:p()});if(this.log(`[transcript-sync] Pi capture: ${E(d)}`),d.error)this.log(`[transcript-sync] WARNING: ${d.error}`);else if(d.mode==="allowlist")for(let t of d.roots)this.log(`[transcript-sync] \u2022 ${t}`);let B=new M({postSnapshot:e((t,K)=>m(`/api/sessions/${t}/context-snapshots`,K),"postSnapshot"),linkInstructions:e(t=>m("/api/sessions/link-instructions",{sessionId:t}),"linkInstructions"),log:e(t=>this.log(`[transcript-sync] ${t}`),"log")}),H=new G({providers:[V(void 0,void 0,L({configDir:p(),onChange:e(t=>this.log(`[transcript-sync] Codex capture changed: ${S(t)}`),"onChange")})),j(void 0,void 0,$({configDir:p(),onChange:e(t=>this.log(`[transcript-sync] Pi capture changed: ${E(t)}`),"onChange")}))],statePath:R(p(),"transcript-sync-state.json"),importTranscript:e(t=>m("/api/sessions/import",t),"importTranscript"),emitInstructions:e(t=>B.emit(t),"emitInstructions"),log:e(t=>this.log(`[transcript-sync] ${t}`),"log")});q(H,{signal:c.signal,log:e(t=>this.log(`[transcript-sync] ${t}`),"log")});let _=e(async t=>{this.log(`
3
3
  [${t}] shutting down agent...`),c.abort(),await Promise.allSettled([y(2e3),h(),g()]),P(),process.exit(0)},"shutdown");process.on("SIGINT",()=>{_("SIGINT")}),process.on("SIGTERM",()=>{_("SIGTERM")});let b=!1;try{await D({signal:c.signal,log:e(t=>this.log(t),"log"),version:this.config.version,readInstalledVersion:e(()=>{try{return JSON.parse(k(R(this.config.root,"package.json"),"utf-8")).version??null}catch{return null}},"readInstalledVersion"),onVersionDrift:e(()=>{b=!0},"onVersionDrift")}),b&&(this.log("[upgrade] Installed CLI version changed \u2014 restarting worker onto the new code."),await Promise.allSettled([y(2e3),h(),g()]),P(),process.exit(1))}finally{P(),await g()}}};export{N as default};
@@ -1,4 +1,4 @@
1
- import{a as k}from"../../chunk-RBSEE2Z6.js";import{e as $}from"../../chunk-OUK2AWEI.js";import"../../chunk-SWSOEYC7.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-GYNZ3OZF.js";import"../../chunk-UPFH72PF.js";import"../../chunk-OO2ZRKZY.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-UJ7EPLKC.js";import"../../chunk-PUX6P5KC.js";import"../../chunk-SG4UDDHB.js";import"../../chunk-SBGXIPRN.js";import"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import{a as w}from"../../chunk-N4RJ6CN7.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-E5YE25QG.js";import"../../chunk-YUIRDBQQ.js";import"../../chunk-HAYO6JYI.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-ZZHIBOMT.js";import"../../chunk-TWPG3TEQ.js";import"../../chunk-74QIUVWY.js";import"../../chunk-PZNWH4VQ.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{Args as A,Flags as r}from"@oclif/core";var m=class y extends w{static{h(this,"EvalAutoRun")}static description="Run evals in a loop until the effect verdict is statistically powered (\xA76f auto-run-to-power)";static examples=["<%= config.bin %> evals auto-run <target-id> # preview (cost + plan)","<%= config.bin %> evals auto-run <target-id> --yes # run until powered / budget","<%= config.bin %> evals auto-run <target-id> --yes --max-runs 120 --batch-parallel 4"];static args={targetId:A.string({description:"Eval target ID",required:!0})};static flags={yes:r.boolean({char:"y",description:"Actually run. Without this, only previews the plan + cost."}),"max-runs":r.integer({description:"Hard ceiling on completed runs",default:200}),"batch-parallel":r.integer({description:"Concurrent executions within a batch",default:3}),timeout:r.integer({description:"Timeout per eval in ms",default:12e4}),model:r.string({description:"Model for eval execution"}),"grader-model":r.string({description:"Model for grading"}),"skip-baseline":r.boolean({description:"Skip without_target runs (no delta \u2014 not recommended)",default:!1})};async run(){let{args:C,flags:e}=await this.parse(y);this.requireAuth();let i=C.targetId,c=20,a=await n(`/api/eval-targets/${i}`),l=await n(`/api/eval-targets/${i}/evals`);l.length===0&&this.error(`No active cases on "${a.name}". Generate some (\`evals create\` / the web Generate button) or run \`evals refine-cases\` first.`);let b=l.length*(e["skip-baseline"]?1:2),f=Math.ceil(e["max-runs"]/b);if(this.log(`Auto-run "${a.name}" v${a.version} toward a powered \xB1${c}pp verdict.`),this.log(`Plan: up to ${e["max-runs"]} runs (${l.length} active case(s) \xD7 ${e["skip-baseline"]?1:2}/batch = ${b}/batch, \u2264${f} batches). Each run is a synthetic \`claude -p\` execution + grade.`),this.log('Note: this is a controlled synthetic A/B. For a DEPLOYED instruction with real usage, the Insights observational verdict is cheaper and uses real sessions \u2014 auto-run is for pre-deploy, catalog skills, or targets with no real "without" cohort.'),!e.yes){this.log(`
1
+ import{a as k}from"../../chunk-RBSEE2Z6.js";import{e as $}from"../../chunk-H6FVXVGG.js";import"../../chunk-SWSOEYC7.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-GYNZ3OZF.js";import"../../chunk-UPFH72PF.js";import"../../chunk-DVU5PHPM.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-FBSZ6KCM.js";import"../../chunk-JP6ULOEX.js";import"../../chunk-SG4UDDHB.js";import"../../chunk-GPBN4ROE.js";import"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import{a as w}from"../../chunk-MU7KKU3O.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-FKTT7A4H.js";import"../../chunk-VIFOLTZT.js";import"../../chunk-4FJYVYCU.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-76UKAFNM.js";import"../../chunk-42A4PUW7.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{Args as A,Flags as r}from"@oclif/core";var m=class y extends w{static{h(this,"EvalAutoRun")}static description="Run evals in a loop until the effect verdict is statistically powered (\xA76f auto-run-to-power)";static examples=["<%= config.bin %> evals auto-run <target-id> # preview (cost + plan)","<%= config.bin %> evals auto-run <target-id> --yes # run until powered / budget","<%= config.bin %> evals auto-run <target-id> --yes --max-runs 120 --batch-parallel 4"];static args={targetId:A.string({description:"Eval target ID",required:!0})};static flags={yes:r.boolean({char:"y",description:"Actually run. Without this, only previews the plan + cost."}),"max-runs":r.integer({description:"Hard ceiling on completed runs",default:200}),"batch-parallel":r.integer({description:"Concurrent executions within a batch",default:3}),timeout:r.integer({description:"Timeout per eval in ms",default:12e4}),model:r.string({description:"Model for eval execution"}),"grader-model":r.string({description:"Model for grading"}),"skip-baseline":r.boolean({description:"Skip without_target runs (no delta \u2014 not recommended)",default:!1})};async run(){let{args:C,flags:e}=await this.parse(y);this.requireAuth();let i=C.targetId,c=20,a=await n(`/api/eval-targets/${i}`),l=await n(`/api/eval-targets/${i}/evals`);l.length===0&&this.error(`No active cases on "${a.name}". Generate some (\`evals create\` / the web Generate button) or run \`evals refine-cases\` first.`);let b=l.length*(e["skip-baseline"]?1:2),f=Math.ceil(e["max-runs"]/b);if(this.log(`Auto-run "${a.name}" v${a.version} toward a powered \xB1${c}pp verdict.`),this.log(`Plan: up to ${e["max-runs"]} runs (${l.length} active case(s) \xD7 ${e["skip-baseline"]?1:2}/batch = ${b}/batch, \u2264${f} batches). Each run is a synthetic \`claude -p\` execution + grade.`),this.log('Note: this is a controlled synthetic A/B. For a DEPLOYED instruction with real usage, the Insights observational verdict is cheaper and uses real sessions \u2014 auto-run is for pre-deploy, catalog skills, or targets with no real "without" cohort.'),!e.yes){this.log(`
2
2
  Preview only. Re-run with --yes to start.`);return}let t={runsCompleted:0,maxRuns:e["max-runs"],batchesRun:0,maxBatches:f},x={targetId:i,targetVersion:a.version,iteration:1,timeout:e.timeout,model:e.model,graderModel:e["grader-model"],skipGrading:!1,targetType:a.type,targetName:a.name};for(;;){let s;try{s=await n(`/api/eval-targets/${i}/judge-calibration`)}catch(o){this.log(`
3
3
  \u25A0 stopping \u2014 could not read the power check: ${o instanceof Error?o.message:String(o)}`);break}let E={powered:s.powerCheck?.powered??!1,mde:s.powerCheck?.mde==null?1/0:s.powerCheck.mde},B=s.caseDiscrimination??{total:0,discriminating:0,nonDiscriminating:0,unpaired:0},p=k(E,B,t,{targetEffectPp:c});if(this.log(`
4
4
  ${p.action==="stop"?"\u25A0":"\u25B8"} ${p.reason}`),p.action==="stop")break;let v=await n(`/api/eval-targets/${i}/evals`);if(v.length===0){this.log("\u25A0 no active cases left \u2014 stopping.");break}let{completed:g,failed:D}=await $({cases:v,targetContent:a.content,concurrency:e["batch-parallel"],runNumber:t.batchesRun+1,opts:x,skipBaseline:e["skip-baseline"],onLog:h(o=>this.log(o),"onLog")});if(t.runsCompleted+=g,t.batchesRun+=1,this.log(`Batch ${t.batchesRun}: ${g} completed, ${D} failed \u2014 ${t.runsCompleted}/${t.maxRuns} runs, ${t.batchesRun}/${t.maxBatches} batches.`),g===0){this.log("\u25A0 batch produced 0 completed runs \u2014 the executor appears broken (check the model / `claude -p`). Aborting.");break}}let d=await n(`/api/eval-targets/${i}/judge-calibration`),u=d.powerCheck?.mde,R=u==null||!Number.isFinite(u)?"unknown":`\xB1${Math.round(u*100)}pp`;this.log(`