@rulemetric/cli 0.14.1 → 0.14.2
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.
- package/dist/base-command.js +1 -1
- package/dist/{chunk-POEMCITL.js → chunk-3NWJ7CZ2.js} +1 -1
- package/dist/{chunk-RMRVUI7B.js → chunk-5PMTNNA6.js} +1 -1
- package/dist/{chunk-EMLLGASZ.js → chunk-5TM7AOH2.js} +1 -1
- package/dist/{chunk-QAMHZY2P.js → chunk-5VNEHPGC.js} +1 -1
- package/dist/{chunk-HNYHZO2J.js → chunk-6AAAHV2B.js} +1 -1
- package/dist/{chunk-3FNTV2TW.js → chunk-6T6YFPBW.js} +1 -1
- package/dist/{chunk-XGMOVQ5G.js → chunk-6TGFU6RU.js} +1 -1
- package/dist/chunk-77FH6UZP.js +111 -0
- package/dist/{chunk-N4YPDZJF.js → chunk-7BCZDVIU.js} +1 -1
- package/dist/{chunk-WWQWHC4K.js → chunk-BDQTVYYF.js} +1 -1
- package/dist/chunk-CQD2R3BA.js +3 -0
- package/dist/{chunk-I6ZQOMZS.js → chunk-CVPAKEEZ.js} +1 -1
- package/dist/{chunk-QRIJ3AHP.js → chunk-CYCH2EQC.js} +1 -1
- package/dist/{chunk-AGEZAKCC.js → chunk-CZBO3A6B.js} +1 -1
- package/dist/{chunk-JTYVBR5H.js → chunk-DANMUHNW.js} +1 -1
- package/dist/{chunk-4FJYVYCU.js → chunk-DX6IPDED.js} +1 -1
- package/dist/{chunk-OP4U3XBZ.js → chunk-DXNUCWUX.js} +1 -1
- package/dist/{chunk-BMT5WMEV.js → chunk-EBWV4SUS.js} +1 -1
- package/dist/{chunk-NYNHX7OX.js → chunk-F5PJN2EY.js} +1 -1
- package/dist/{chunk-MMLRWCBW.js → chunk-FS3TAQAE.js} +1 -1
- package/dist/{chunk-RXZLBSDO.js → chunk-FXQS7AEZ.js} +1 -1
- package/dist/{chunk-LJRJ2RAC.js → chunk-FZMO7XSN.js} +3 -3
- package/dist/{chunk-XMTKP74H.js → chunk-GDLQNY4V.js} +1 -1
- package/dist/{chunk-76UKAFNM.js → chunk-GIXHG5FK.js} +1 -1
- package/dist/{chunk-XJ25HFIT.js → chunk-GLBWNB2N.js} +1 -1
- package/dist/{chunk-IO46ICZY.js → chunk-H2FMAJUJ.js} +1 -1
- package/dist/{chunk-BAITMD76.js → chunk-H33XYL7O.js} +1 -1
- package/dist/{chunk-6ANODRDT.js → chunk-H4QPAEEA.js} +1 -1
- package/dist/{chunk-V55ROUNP.js → chunk-HM63AB2C.js} +1 -1
- package/dist/{chunk-B5X6HCBK.js → chunk-ISYU5BMU.js} +1 -1
- package/dist/{chunk-AIYFT4P6.js → chunk-J6RQ5AH2.js} +1 -1
- package/dist/{chunk-YK2IEHLB.js → chunk-KE5K3F7J.js} +1 -1
- package/dist/{chunk-VIFOLTZT.js → chunk-KEVDLLHT.js} +1 -1
- package/dist/{chunk-OVS7ZDJ4.js → chunk-L562Y4RN.js} +1 -1
- package/dist/chunk-MOJY6S5J.js +1 -0
- package/dist/{chunk-IQEZ3T5A.js → chunk-MYGVN6X4.js} +1 -1
- package/dist/{chunk-44TYRMIS.js → chunk-NWV66NMA.js} +1 -1
- package/dist/{chunk-43VKTVM3.js → chunk-O4K4M5G6.js} +1 -1
- package/dist/{chunk-5Z3H5JHK.js → chunk-PJ4RIUI3.js} +1 -1
- package/dist/{chunk-XMA6SWOT.js → chunk-PXYK4MBX.js} +1 -1
- package/dist/{chunk-EUHRTEVJ.js → chunk-QENSCK77.js} +1 -1
- package/dist/{chunk-5BT375C7.js → chunk-QNSIBPWG.js} +1 -1
- package/dist/{chunk-3IMRLHJJ.js → chunk-QPAOX7P2.js} +1 -1
- package/dist/{chunk-RG3R4EAB.js → chunk-QPVUGTDP.js} +1 -1
- package/dist/{chunk-2UK4DZFW.js → chunk-RE7RAZQ5.js} +1 -1
- package/dist/{chunk-MXHAXY66.js → chunk-RR7V5CK5.js} +1 -1
- package/dist/{chunk-SCQK52SL.js → chunk-RSVNQ2XI.js} +1 -1
- package/dist/{chunk-35YVHBLL.js → chunk-RYCVPQYK.js} +1 -1
- package/dist/{chunk-VU24IH5S.js → chunk-SFZPFNC6.js} +1 -1
- package/dist/{chunk-H6FVXVGG.js → chunk-T47SFA5X.js} +1 -1
- package/dist/{chunk-BFQVAU6N.js → chunk-UVCVJKEN.js} +1 -1
- package/dist/{chunk-GKVHFXUQ.js → chunk-VCUW2NAP.js} +1 -1
- package/dist/{chunk-CT6GJQIR.js → chunk-VXNICAVG.js} +1 -1
- package/dist/{chunk-FYZ6HHCV.js → chunk-WIKCYUZC.js} +1 -1
- package/dist/{chunk-FKTT7A4H.js → chunk-WL5ZWQAS.js} +1 -1
- package/dist/{chunk-MU7KKU3O.js → chunk-WUCACPGC.js} +1 -1
- package/dist/{chunk-42A4PUW7.js → chunk-X6CF5KTW.js} +4 -4
- package/dist/{chunk-VXL5H3VZ.js → chunk-XIOYV5A7.js} +1 -1
- package/dist/{chunk-W23OYQXI.js → chunk-XXPWPKTD.js} +1 -1
- package/dist/chunk-XZW5ZHFC.js +15 -0
- package/dist/{chunk-RAQLVO2X.js → chunk-ZTQUGAZG.js} +1 -1
- package/dist/commands/antigravity/backfill.js +1 -1
- package/dist/commands/auth/create-key.js +1 -1
- package/dist/commands/auth/login.js +1 -1
- package/dist/commands/auth/logout.js +1 -1
- package/dist/commands/auth/revoke-key.js +1 -1
- package/dist/commands/auth/signup.js +1 -1
- package/dist/commands/auth/status.js +1 -1
- package/dist/commands/capture/scope.js +1 -1
- package/dist/commands/catalog/index.js +1 -1
- package/dist/commands/catalog/recommend.js +1 -1
- package/dist/commands/crons/list.js +1 -1
- package/dist/commands/crons/run.js +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/diagnostics.js +1 -1
- package/dist/commands/eval-targets/create.js +1 -1
- package/dist/commands/eval-targets/list.js +1 -1
- package/dist/commands/evals/agent.js +1 -1
- package/dist/commands/evals/auto-run.js +1 -1
- package/dist/commands/evals/benchmark.js +1 -1
- package/dist/commands/evals/compare.js +1 -1
- package/dist/commands/evals/create.js +1 -1
- package/dist/commands/evals/optimize-description.js +1 -1
- package/dist/commands/evals/optimize.js +1 -1
- package/dist/commands/evals/refine-cases.js +1 -1
- package/dist/commands/evals/run.js +1 -1
- package/dist/commands/evals/validate-judge.js +1 -1
- package/dist/commands/experiments/list.js +1 -1
- package/dist/commands/gateway/ensure.js +1 -1
- package/dist/commands/hooks/install.js +1 -1
- package/dist/commands/hooks/run.js +1 -1
- package/dist/commands/hooks/uninstall.js +1 -1
- package/dist/commands/instructions/create.js +1 -1
- package/dist/commands/instructions/dedupe.js +1 -1
- package/dist/commands/instructions/delete.js +1 -1
- package/dist/commands/instructions/fork.js +1 -1
- package/dist/commands/instructions/get.js +1 -1
- package/dist/commands/instructions/list.js +1 -1
- package/dist/commands/instructions/promote.js +1 -1
- package/dist/commands/instructions/pull.js +1 -1
- package/dist/commands/instructions/restore.js +1 -1
- package/dist/commands/instructions/retract.js +1 -1
- package/dist/commands/instructions/upstream.js +1 -1
- package/dist/commands/instructions/versions.js +1 -1
- package/dist/commands/launcher.js +1 -1
- package/dist/commands/local/down.js +1 -1
- package/dist/commands/local/up.js +1 -1
- package/dist/commands/org/current.js +1 -1
- package/dist/commands/org/list.js +1 -1
- package/dist/commands/org/switch.js +1 -1
- package/dist/commands/packs/add-instruction.js +1 -1
- package/dist/commands/packs/apply.js +1 -1
- package/dist/commands/packs/create.js +1 -1
- package/dist/commands/packs/fork.js +1 -1
- package/dist/commands/packs/get.js +1 -1
- package/dist/commands/packs/list.js +1 -1
- package/dist/commands/packs/remove-instruction.js +1 -1
- package/dist/commands/proxy/env.js +1 -1
- package/dist/commands/proxy/logs.js +1 -1
- package/dist/commands/proxy/restart.js +1 -1
- package/dist/commands/proxy/setup.js +1 -1
- package/dist/commands/proxy/start.js +1 -1
- package/dist/commands/proxy/status.js +1 -1
- package/dist/commands/proxy/stop.js +1 -1
- package/dist/commands/research/backfill.js +1 -1
- package/dist/commands/research/tail-transcript.js +1 -1
- package/dist/commands/service/install.js +1 -1
- package/dist/commands/service/status.js +1 -1
- package/dist/commands/service/uninstall.js +1 -1
- package/dist/commands/sessions/analyze.js +1 -1
- package/dist/commands/sessions/delete.js +1 -1
- package/dist/commands/sessions/end.js +1 -1
- package/dist/commands/sessions/import.js +1 -1
- package/dist/commands/sessions/list.js +1 -1
- package/dist/commands/sessions/start.js +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/skills/export-approved.js +1 -1
- package/dist/commands/skills/install.js +1 -1
- package/dist/commands/skills/list.js +1 -1
- package/dist/commands/skills/publish.js +1 -1
- package/dist/commands/skills/search.js +1 -1
- package/dist/commands/skills/update.js +1 -1
- package/dist/commands/suggestions/accept.js +1 -1
- package/dist/commands/suggestions/auto.js +1 -1
- package/dist/commands/suggestions/dismiss.js +1 -1
- package/dist/commands/suggestions/list.js +1 -1
- package/dist/commands/suggestions/refresh.js +1 -1
- package/dist/commands/suggestions/undo.js +1 -1
- package/dist/dashboard/Dashboard.js +1 -1
- package/dist/dashboard/data.js +1 -1
- package/dist/dashboard/launcher/LauncherOverlay.js +1 -1
- package/dist/dashboard/launcher/api.js +1 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +1 -1
- package/dist/dashboard/panels/measurement.js +1 -1
- package/dist/lib/active-org-refresh.js +1 -1
- package/dist/lib/agent-loop.js +1 -1
- package/dist/lib/antigravity-transcript.js +1 -1
- package/dist/lib/api-client.js +1 -1
- package/dist/lib/ensure-api-key.js +1 -1
- package/dist/lib/ensure-fresh-token.js +1 -1
- package/dist/lib/eval-benchmark.js +1 -1
- package/dist/lib/eval-candidate-run.js +1 -1
- package/dist/lib/eval-case-generator.js +1 -1
- package/dist/lib/eval-conversation-handler.js +1 -1
- package/dist/lib/eval-resume.js +1 -1
- package/dist/lib/eval-run-batch.js +1 -1
- package/dist/lib/evolution-enrolment.js +1 -1
- package/dist/lib/insights/generation/installed-asks.js +1 -1
- package/dist/lib/insights/generation/project-evidence.js +1 -0
- package/dist/lib/insights/generation/prompts.js +1 -1
- package/dist/lib/insights/nomination/nominate.js +1 -1
- package/dist/lib/instruction-proposer.js +1 -1
- package/dist/lib/instructions/acceptance/accept-events.js +1 -1
- package/dist/lib/instructions/acceptance/accept-hook.js +1 -1
- package/dist/lib/instructions/acceptance/hook-install.js +1 -1
- package/dist/lib/instructions/acceptance/reverse-applications.js +1 -1
- package/dist/lib/instructions/acceptance/suggestion-accept.js +1 -1
- package/dist/lib/jobs/handlers/cron-auto-accept-suggestions.js +1 -1
- package/dist/lib/jobs/handlers/cron-eval-autorun.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-evolution.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-training.js +1 -1
- package/dist/lib/jobs/handlers/cron-reconcile-attribution.js +1 -1
- package/dist/lib/jobs/handlers/cron-refine-cases.js +1 -1
- package/dist/lib/jobs/handlers/cron-refresh-pricing.js +1 -1
- package/dist/lib/jobs/handlers/cron-retire-unused-skills.js +1 -1
- package/dist/lib/jobs/handlers/cron-suggest-instructions.js +1 -1
- package/dist/lib/jobs/handlers/distill-memories.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab-verdict.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab.js +1 -1
- package/dist/lib/jobs/handlers/process-changelog.js +1 -1
- package/dist/lib/jobs/handlers/process-conversation.js +1 -1
- package/dist/lib/jobs/handlers/process-eval.js +1 -1
- package/dist/lib/jobs/handlers/process-insights.js +1 -1
- package/dist/lib/jobs/handlers/process-judge-review.js +1 -1
- package/dist/lib/jobs/handlers/process-launch.js +1 -1
- package/dist/lib/jobs/handlers/process-memory-ab.js +1 -1
- package/dist/lib/jobs/handlers/process-run-cleanup.js +1 -1
- package/dist/lib/jobs/handlers/process-session-goal.js +1 -1
- package/dist/lib/jobs/shed-retry.js +1 -1
- package/dist/lib/judge-review-runner.js +1 -1
- package/dist/lib/llm-client.js +1 -1
- package/dist/lib/manual-tasks.js +1 -1
- package/dist/lib/refine-cases.js +1 -1
- package/dist/lib/research-client.js +1 -1
- package/dist/lib/retraction.js +1 -1
- package/dist/lib/setup-steps.js +1 -1
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/terminal-target-heartbeat.js +1 -1
- package/dist/lib/work-report.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-DHX4U6EC.js +0 -13
- package/dist/chunk-E7GQJML3.js +0 -1
- package/dist/chunk-SJKS3PYX.js +0 -109
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as p}from"./chunk-LJRE3LZ2.js";import{C as f}from"./chunk-
|
|
1
|
+
import{e as p}from"./chunk-LJRE3LZ2.js";import{C as f}from"./chunk-X6CF5KTW.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{b as $}from"./chunk-VBXL7XO7.js";import{e as w,f as k}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-VBXL7XO7.js";import{e as w,f as k}from"./chunk-GIXHG5FK.js";import{a as u}from"./chunk-ZLLER3HP.js";function h(e){if(e.length===0)return{mean:0,stddev:0,min:0,max:0};let n=e.reduce((s,a)=>s+a,0)/e.length,o=e.reduce((s,a)=>s+(a-n)**2,0)/e.length;return{mean:Math.round(n*1e3)/1e3,stddev:Math.round(Math.sqrt(o)*1e3)/1e3,min:Math.min(...e),max:Math.max(...e)}}u(h,"computeStats");var x="with_target",E="without_target";function _(e){let n=e.grading.summary?.pass_rate;return typeof n=="number"&&n>=1}u(_,"fullPass");function b(e){return e.grading.summary?.pass_rate!=null}u(b,"hasGrading");function R(e){let n=e.timing.total_tokens;return typeof n=="number"&&n>0?n:void 0}u(R,"tokensOf");function v(e){let n=e.timing.duration_ms;return typeof n=="number"&&!isNaN(n)?n/1e3:void 0}u(v,"secondsOf");function y(e,n){let o={};for(let s of e)(o[n(s)]??=[]).push(s);return o}u(y,"groupBy");function C(e,n){let o=y(e.filter(b),i=>i.evalId),s=y(n.filter(b),i=>i.evalId),a=u((i,l)=>i.runNumber-l.runNumber,"byRun"),t=[];for(let i of Object.keys(o)){let l=o[i].sort(a),d=(s[i]??[]).sort(a);for(let r=0;r<Math.min(l.length,d.length);r++){let c={withScore:_(l[r])?1:0,withoutScore:_(d[r])?1:0},f=R(l[r]),g=R(d[r]);f!=null&&g!=null&&(c.withCost=f,c.withoutCost=g);let p=v(l[r]),m=v(d[r]);p!=null&&m!=null&&(c.withLatency=p,c.withoutLatency=m),t.push(c)}}return t}u(C,"pairRunsByEval");function T(e){let n=e.filter(r=>r.status==="completed");if(n.length===0)return{runSummary:{},verdict:null,notes:["No completed runs found"],totalRuns:0};let o=y(n,r=>r.configuration),s={},a=[];for(let[r,c]of Object.entries(o)){let f=c.filter(b).map(m=>m.grading.summary.pass_rate),g=c.map(v).filter(m=>m!=null),p=c.map(R).filter(m=>m!=null);s[r]={},f.length>0&&(s[r].pass_rate=h(f)),g.length>0&&(s[r].time_seconds=h(g)),p.length>0&&(s[r].tokens=h(p))}let t=null,i=o[x]??[],l=o[E]??[],d=C(i,l);if(d.length>0){if(t=$(d),!t.sufficient)a.push(t.insufficientReason??"Insufficient data for a significance verdict.");else if(t.significant){let r=t.delta>=0?"improves":"reduces",c=t.pValue!=null?`, McNemar p=${t.pValue.toFixed(4)}`:"";a.push(`Target ${r} the pass rate by ${Math.abs(t.delta*100).toFixed(0)}% (95% CI ${(t.ci.lower*100).toFixed(0)}\u2013${(t.ci.upper*100).toFixed(0)}%, n=${t.nWith}${c}).`)}else a.push(`No significant effect on pass rate (95% CI ${(t.ci.lower*100).toFixed(0)}\u2013${(t.ci.upper*100).toFixed(0)}%, n=${t.nWith}).`);t.costDelta!=null&&Math.round(t.costDelta)!==0&&a.push(`Token cost delta: ${t.costDelta>=0?"+":""}${Math.round(t.costDelta)} tokens/task.`),t.latencyDelta!=null&&Math.abs(t.latencyDelta)>1&&a.push(`Target ${t.latencyDelta>0?"adds":"saves"} ${Math.abs(t.latencyDelta).toFixed(1)}s/task.`)}for(let r of Object.values(s))if(r.pass_rate&&r.pass_rate.stddev>.2){a.push(`High pass-rate variance (stddev=${r.pass_rate.stddev.toFixed(2)}) \u2014 results may be unreliable.`);break}return{runSummary:s,verdict:t,notes:a,totalRuns:n.length}}u(T,"summarizeRuns");async function S(e,n){let o=n?`&iteration=${n}`:"",s=100,a=[];for(let t=0;t<1e5;t+=s){let i=await w(`/api/eval-targets/${e}/runs?limit=${s}&offset=${t}&activeCasesOnly=1${o}`);if(a.push(...i),i.length<s)break}return T(a)}u(S,"aggregateBenchmark");async function B(e,n,o){return k(`/api/eval-targets/${e}/benchmarks`,{iteration:n,runSummary:o.runSummary,notes:o.notes})}u(B,"postBenchmark");export{T as a,S as b,B as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as R,c as L,f as s,g as I,i as h}from"./chunk-
|
|
1
|
+
import{b as R,c as L,f as s,g as I,i as h}from"./chunk-XXPWPKTD.js";import{c as ne}from"./chunk-5TM7AOH2.js";import{b as re}from"./chunk-IEQDLURA.js";import{d as te,e as oe,f as se}from"./chunk-KINIFUZQ.js";import{a as O}from"./chunk-ZYGBABMZ.js";import{a as U}from"./chunk-HM63AB2C.js";import{a as F}from"./chunk-PXYK4MBX.js";import{a as W}from"./chunk-ZTQUGAZG.js";import{a as $}from"./chunk-XZW5ZHFC.js";import{a as q}from"./chunk-F5PJN2EY.js";import{b as J}from"./chunk-XIOYV5A7.js";import{a as K}from"./chunk-5VNEHPGC.js";import{a as Y}from"./chunk-5PMTNNA6.js";import{b as V}from"./chunk-5RBLIVBF.js";import{a as j}from"./chunk-H4QPAEEA.js";import{a as Q}from"./chunk-J6RQ5AH2.js";import{a as D}from"./chunk-PZS55PW2.js";import{a as ee}from"./chunk-QPAOX7P2.js";import{e as P}from"./chunk-QENSCK77.js";import{b as G}from"./chunk-VCUW2NAP.js";import{c as N}from"./chunk-FZMO7XSN.js";import{a as z}from"./chunk-CYCH2EQC.js";import{a as X}from"./chunk-VXNICAVG.js";import{a as Z}from"./chunk-L562Y4RN.js";import{a as x}from"./chunk-CZBO3A6B.js";import{b as C}from"./chunk-PIVEJTNF.js";import{k as B}from"./chunk-3NWJ7CZ2.js";import{d as S}from"./chunk-GPBN4ROE.js";import{b as M,e as T,f as E}from"./chunk-GIXHG5FK.js";import{a as l}from"./chunk-ZLLER3HP.js";var H=null,w=null,ce={process_eval:W,process_insights:$,process_launch:J,process_send_message:O,process_conversation:F,process_session_goal:U,distill_memories:G,memory_ab:K,process_run_cleanup:Y,cron_refine_cases:j,cron_retire_unused_skills:ee,cron_reconcile_attribution:x,cron_suggest_instructions:P,cron_refresh_skills:D,cron_refresh_pricing:Q,cron_eval_autorun:X,cron_auto_accept_suggestions:z,cron_instruction_training:Z,cron_instruction_evolution:B,process_judge_review:q,harbor_ab:N},ae=Object.keys(ce),me=new Set([]);function pe(e=process.env){return e.DATABASE_URL?ae:ae.filter(t=>!me.has(t))}l(pe,"availableCapabilities");var ge=3e4,_e=3e4,fe=3e4,ie=500,le=1e4,ve=`thin-agent-${process.pid}`,A=null;function ke(e,t,r,p){let d;try{let i=S();d={claude:i.claudeBin!=null,codex:i.codexBin!=null,pi:i.piBin!=null,codexModel:i.codexConfiguredModel}}catch{}let m;try{m=C()}catch{}let g=l(i=>E("/api/workers/heartbeat",{workerType:"cli-worker",clientName:ve,clientVersion:p,workerVersion:"0.1.0",currentJobId:null,inFlightCount:0,lastError:null,status:i,metadata:{capabilities:e,mode:"thin-agent",measurementProtocol:1,memorySnapshots:1,boundedAutorun:1,llmEngines:d,harborReady:m,machine:H?.summary()}}).then(c=>{let u=c?.advisory;u&&u.message!==A?(A=u.message,s(r,{event:"worker_advisory",code:u.code,message:u.message})):u||(A=null)}).catch(c=>{s(r,{event:"presence_heartbeat_error",error:c instanceof Error?c.message:String(c)})}),"send");g("alive");let f=setInterval(()=>g("alive"),fe),a=null,n=l(()=>a||(clearInterval(f),a=Promise.race([g("shutting_down"),new Promise(i=>setTimeout(i,2e3).unref())]),a),"sayGoodbye");return t.addEventListener("abort",()=>{n()},{once:!0}),{shutdown:n}}l(ke,"startPresenceHeartbeat");async function be(e,t,r=S()){let p=[...r.claudeBin?["claude"]:[],...r.codexBin?["codex"]:[],...r.piBin?["pi"]:[]],d=`capabilities=${encodeURIComponent(e.join(","))}&waitMs=${t}&measurementProtocol=1&memorySnapshots=1&boundedAutorun=1&measurementEngines=${encodeURIComponent(p.join(","))}`,m=await T(`/api/work/next?${d}`);return m==null||typeof m=="string"?null:m}l(be,"pollForWork");function he(e,t){return{logger:{info:l(r=>t(r),"info"),warn:l(r=>t(r),"warn"),error:l(r=>t(r),"error")},job:{attempts:e}}}l(he,"makeHelpers");async function we(e,t,r,p){let d=ce[e.kind],m=Date.now();if(s(r,{event:"claim",jobId:e.id,kind:e.kind,attempts:e.attempts}),!d){let n=`unknown kind: ${e.kind}`;s(r,{event:"fail",jobId:e.id,kind:e.kind,terminal:!0,error:n}),await E(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:n,terminal:!0}).catch(()=>{});return}let g=l(()=>{s(r,{event:"heartbeat",jobId:e.id}),h(`/api/work/${e.id}/heartbeat`,{leaseToken:e.leaseToken},{budgetMs:Math.min(L,Math.max(0,t-1e3)),signal:p,log:r,event:"heartbeat",jobId:e.id}).then(n=>{n.ok||s(r,{event:"heartbeat_error",jobId:e.id,attempts:n.attempts,error:n.error instanceof Error?n.error.message:String(n.error)})})},"beat"),f=setInterval(g,t);w={jobId:e.id,beat:g};let a;try{let n=he(e.attempts,r);a={kind:"complete",result:await d(e.payload,n)??{}}}catch(n){let i=H?.pausesSince(m)??[],c=se(i),u=n instanceof Error?n.message:String(n),v=V(n),o=!v&&oe(i);a={kind:"fail",message:c?`${c}; ${u}`:u,pausedDuringJob:!!c,terminal:v,hostSuspended:o}}try{if(a.kind==="complete"){s(r,{event:"complete",jobId:e.id,kind:e.kind,durationMs:Date.now()-m});let n=await h(`/api/work/${e.id}/complete`,{leaseToken:e.leaseToken,result:a.result},{budgetMs:R,signal:p,log:r,event:"complete_post",jobId:e.id});n.ok||s(r,{event:"complete_post_error",jobId:e.id,kind:e.kind,attempts:n.attempts,error:n.error instanceof Error?n.error.message:String(n.error)})}else{s(r,{event:"fail",jobId:e.id,kind:e.kind,durationMs:Date.now()-m,terminal:a.terminal,error:a.message,...a.pausedDuringJob?{pausedDuringJob:!0}:{},...a.hostSuspended?{hostSuspended:!0}:{}});let n=await h(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:a.message,terminal:a.terminal,hostSuspended:a.hostSuspended},{budgetMs:R,signal:p,log:r,event:"fail_post",jobId:e.id});n.ok||s(r,{event:"fail_post_error",jobId:e.id,attempts:n.attempts,error:n.error instanceof Error?n.error.message:String(n.error)})}}finally{clearInterval(f),w=null}}l(we,"runOne");var de=new Set(["process_eval","process_conversation","process_insights","process_session_goal","distill_memories","memory_ab","cron_suggest_instructions","cron_eval_autorun","cron_instruction_evolution","process_judge_review","harbor_ab"]);async function Ze(e){let t=e.log??(()=>{}),r=e.pollWaitMs??ge,p=e.heartbeatIntervalMs??_e,d=e.capabilities??pe();s(t,{event:"agent_start",capabilities:d,pollWaitMs:r,heartbeatIntervalMs:p});try{let o=re();o.removed.length>0&&s(t,{event:"eval_worktrees_swept",removed:o.removed.length})}catch(o){s(t,{event:"eval_worktree_sweep_failed",error:o instanceof Error?o.message:String(o)})}H=te({signal:e.signal,onPause:l(o=>{s(t,{event:"machine_pause",...o,jobId:w?.jobId??null}),w?.beat()},"onPause")});let m=ke(d,e.signal,t,e.version);ne({signal:e.signal,log:t}).catch(o=>{s(t,{event:"tt_heartbeat_fatal",error:o instanceof Error?o.message:String(o)})});let g=5*6e4,f=0,a=l(()=>{if(!e.readInstalledVersion||!e.version)return!1;let o=Date.now();if(o-f<g)return!1;f=o;let b=e.readInstalledVersion();return!!(b&&b!==e.version)},"versionDrifted"),n=new AbortController,i=n.signal;e.signal.aborted?n.abort():e.signal.addEventListener("abort",()=>n.abort(),{once:!0});let c=l(async(o,b)=>{let _=ie;for(;!i.aborted;){if(a()){s(t,{event:"agent_version_drift",bootVersion:e.version,installedVersion:e.readInstalledVersion?.()??null}),n.abort(),e.onVersionDrift?.();break}let y=null;try{y=await be([...b],r)}catch(k){let ue=k instanceof M?k.statusCode:void 0;if(s(t,{event:"poll_error",lane:o,status:ue,error:k instanceof Error?k.message:String(k)}),!await I(_,i))break;_=Math.min(_*2,le);continue}if(!y){if(s(t,{event:"poll_204",lane:o}),!await I(_,i))break;_=Math.min(_*2,le);continue}_=ie,await we(y,p,t,i)}},"runLane"),u=d.filter(o=>de.has(o)),v=d.filter(o=>!de.has(o));u.length>0&&v.length>0?(s(t,{event:"agent_lanes",heavy:u.length,fast:v.length}),await Promise.all([c("heavy",u),c("fast",v)])):await c("single",d),await m.shutdown(),s(t,{event:"agent_stop"})}l(Ze,"runAgentLoop");export{ce as a,ae as b,pe as c,be as d,Ze as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,c as d}from"./chunk-
|
|
1
|
+
import{b as u,c as d}from"./chunk-RR7V5CK5.js";import{b as g}from"./chunk-DXNUCWUX.js";import{e as m,f as p,h as l}from"./chunk-GIXHG5FK.js";import{a as s}from"./chunk-ZLLER3HP.js";async function x(f,R){let r=s(e=>R?.logger?.info?.(e)??console.log(e),"log"),{evalTargetId:n}=f,i=`[cron_refine_cases] ${n}`,t=await m(`/api/eval-targets/${n}`);if(!(t.metadata?.autoRefineCases===!0))return r(`${i} not opted in (metadata.autoRefineCases)`),{skipped:"not-opted-in",reason:`"${t.name}" has not opted into automatic case refinement. Set metadata.autoRefineCases=true to let the loop cull cases that carry no treatment signal, or run \`rulemetric evals refine-cases ${n}\` by hand.`,targetName:t.name};let C=await m(`/api/eval-targets/${n}/judge-calibration`),a=u(C.caseDiscrimination);if(a.refused)return r(`${i} ${a.refused}: ${a.summary}`),{skipped:a.refused,reason:a.summary,targetName:t.name};r(`${i} ${a.summary}`);let o=await d(a,{generate:s(e=>g({content:t.content,name:t.name,feedback:e}),"generate"),createCase:s(e=>p(`/api/eval-targets/${n}/evals`,{name:e.name,prompt:e.prompt,expectations:e.expectations}),"createCase"),retireCase:s(async(e,y)=>{await l(`/api/eval-targets/${n}/evals/${e}`,{retire:!0,retiredReason:y})},"retireCase"),log:r});r(`${i} ${o.summary}`);let{skipped:c,...$}=o;return{...$,targetName:t.name,...c?{skipped:c,reason:o.summary}:{}}}s(x,"cronRefineCases");export{x as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as o}from"./chunk-
|
|
1
|
+
import{h as o}from"./chunk-CVPAKEEZ.js";import{g as f}from"./chunk-7BCZDVIU.js";import{b as y,e as m,h as d}from"./chunk-GIXHG5FK.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{f as r}from"./chunk-
|
|
1
|
+
import{f as r}from"./chunk-GIXHG5FK.js";import{a as i}from"./chunk-ZLLER3HP.js";async function p(e,t,n,o){await r(`/api/instruction-suggestions/${encodeURIComponent(e)}/events`,{eventType:"accepted",projectPath:t,instructionId:n,actor:o})}i(p,"logAccepted");async function a(e,t,n,o,s="redundant"){await r(`/api/instruction-suggestions/${encodeURIComponent(e)}/events`,{eventType:s,projectPath:t,instructionId:n,actor:o})}i(a,"logRefused");export{p as a,a as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as b,g as y}from"./chunk-
|
|
1
|
+
import{e as b,g as y}from"./chunk-7BCZDVIU.js";import{e as M,f as w}from"./chunk-GIXHG5FK.js";import{a as u}from"./chunk-ZLLER3HP.js";var $={anthropic:["https://platform.claude.com/docs/en/about-claude/pricing.md"],openai:["https://platform.openai.com/docs/pricing"]},R=.7,v=16e3,x=["You extract LLM API pricing from a provider pricing page.","You will be given the page text in <data> tags and, in this system prompt,","a list of model ids to find. For EACH requested model id, return its","published USD price per 1,000,000 tokens.","","Rules:","- Only report a model if you can find its rate ON THE PAGE. If it is not on"," the page, set found=false and omit the numbers \u2014 never guess from memory.","- inputPerM and outputPerM are the standard (non-batch, non-priority) rates.","- cacheReadPerM: the cached/discounted-input rate if published, else omit.","- For Anthropic models ONLY, if cache-write rates are not explicitly listed,"," compute them as cacheWrite5mPerM = inputPerM * 1.25 and"," cacheWrite1hPerM = inputPerM * 2.0. For all other providers, omit them.","- confidence is 0..1: how sure you are the numbers are correct for THIS id.","- contextWindow in tokens if stated, else omit.","","Respond with ONLY a JSON object of the form:",'{"rates":[{"modelId":"...","found":true,"confidence":0.9,"inputPerM":5,"outputPerM":25,"cacheReadPerM":0.5,"contextWindow":1000000}]}'].join(`
|
|
2
2
|
`);async function C(f){try{let n=await fetch(f,{headers:{accept:"text/plain, text/markdown, text/html"}});if(!n.ok)return null;let i=await n.text();return i.length>v?i.slice(0,v):i}catch{return null}}u(C,"fetchPage");var L=u(async(f,n)=>{let i=await M("/api/pricing/coverage"),I=[...i.unpriced,...i.stale],m=new Map;for(let r of I)m.set(`${r.provider}::${r.modelId}`,r);let a=[...m.values()];if(a.length===0)return n.logger.info("[cron-refresh-pricing] coverage clean \u2014 nothing unpriced or stale"),{status:"clean",checked:i.unpriced.length+i.stale.length};if(b()==="none")return n.logger.warn(`[cron-refresh-pricing] ${a.length} model(s) need pricing but no LLM backend (install the claude CLI or set ANTHROPIC_API_KEY) \u2014 skipping`),{status:"no-llm",pending:a.length};let d=new Map;for(let r of a){let o=d.get(r.provider)??[];o.push(r.modelId),d.set(r.provider,o)}let t={written:0,unchanged:0,flagged:0,rejected:0,skipped:0},c=[];for(let[r,o]of d){let h=$[r];if(!h){n.logger.warn(`[cron-refresh-pricing] no pricing source configured for provider '${r}' (${o.length} model(s)) \u2014 skipping`),t.skipped+=o.length;continue}let p="",l="";for(let e of h){let s=await C(e);s&&(p+=`
|
|
3
3
|
|
|
4
4
|
=== ${e} ===
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as u}from"./chunk-
|
|
1
|
+
import{f as u}from"./chunk-GIXHG5FK.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{c as l}from"./chunk-
|
|
1
|
+
import{c as l}from"./chunk-GIXHG5FK.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{e as c,f as d}from"./chunk-
|
|
1
|
+
import{e as c,f as d}from"./chunk-GIXHG5FK.js";import{a as m}from"./chunk-ZLLER3HP.js";async function f(g,p){let r=m(e=>p?.logger?.info?.(e)??console.log(e),"log"),{projectPath:s}=g,i=`[cron_instruction_training] ${s}`;if(!s)return{skipped:"no-project-path"};let n=await d("/api/instruction-experiments/settle",{projectPath:s}),o=n.settled.map(e=>e.outcome),a=o.filter(e=>e==="graduated").length;for(let e of n.settled)r(`${i}: experiment ${e.experimentId} \u2192 ${e.outcome}`);n.examined>0&&r(`${i}: examined ${n.examined} running experiment(s) \u2014 ${n.settled.length} settled (${a} graduated), ${n.stillRunning} still gathering`);let t=await c(`/api/instruction-suggestions/trialable?projectPath=${encodeURIComponent(s)}`);for(let e of t.refused)r(`${i}: not trialling "${e.name}" \u2014 ${e.reason}`);if(t.candidates.length===0)return r(`${i}: no new trial started (${t.running}/${t.limits.maxConcurrent} running, ${t.slots} slot(s) free)`),{examined:n.examined,settled:n.settled.length,graduated:a,nominated:0,running:t.running,outcomes:o};let u=0;for(let e of t.candidates)try{await d("/api/instruction-experiments",{instructionId:e.instructionId,projectPath:s,source:"trial"}),u+=1,r(`${i}: now measuring "${e.name}" (score ${e.score.toFixed(2)})`)}catch(l){r(`${i}: could not measure "${e.name}" \u2014 ${l instanceof Error?l.message:String(l)}`)}return{examined:n.examined,settled:n.settled.length,graduated:a,nominated:u,running:t.running+u,outcomes:o}}m(f,"cronInstructionTraining");export{f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l}from"./chunk-ZLLER3HP.js";var x=25;function w(e,r,n=1.959964){let s=1+n*n/r,c=(e+n*n/(2*r))/s,d=n*Math.sqrt(e*(1-e)/r+n*n/(4*r*r))/s;return[c-d,c+d]}l(w,"wilson");function g(e,r,n,s){let[c,d]=w(e,r),[u,t]=w(n,s);return[u-d,t-c]}l(g,"newcombe");var p=l(e=>`${e>=0?"+":""}${e.toFixed(3)}`,"fmt"),f=l(e=>`${e.passes}/${e.n}`,"counts");function _(e){let r=e.provenance;if(!r)return{decisionSemanticsVersion:2,decision:"incomparable",reason:"harness provenance was not checked; no instruction-effect claim is supported",reward:{delta:null,ci:null}};if(!r.comparable)return{decisionSemanticsVersion:2,decision:"incomparable",reason:`the two arms were not the same harness, so this is not an A/B of the rule: ${r.reasons.join("; ")}. Nothing here is evidence about the instruction \u2014 re-run both arms on one harness before reading anything into the numbers.`,reward:{delta:null,ci:null}};let n={...v(e),decisionSemanticsVersion:2};return r?.pooled_across.length?{...n,reason:`${n.reason} [pooled across ${r.pooled_across.join(", ")} by explicit --allow-cross]`}:n}l(_,"judgeSweep");function v(e){let r=e.minN??25,{baseline:n,with:s}=e;if(n.passes==null||s.passes==null||n.n===0||s.n===0)return{decision:"unmeasured",reason:`no reward recorded for the ${[n.passes==null||n.n===0?"baseline":null,s.passes==null||s.n===0?"with-arm":null].filter(Boolean).join(" and ")} arm \u2014 nothing to decide on; check the job dir for a harness error before reading this as a result`,reward:{delta:null,ci:null}};let c=n.passes/n.n,d=s.passes/s.n,u=d-c,t=g(c,n.n,d,s.n),$=t[0]>0||t[1]<0,m=n.n<r||s.n<r,o=`baseline ${f(n)} \u2192 with ${f(s)}, delta ${p(u)}, 95% CI [${p(t[0])}, ${p(t[1])}]`,i={delta:u,ci:t},b=m?` (n=${n.n}/${s.n}, below the ${r}/arm floor)`:"";if(e.taskClass==="unvalidated")return{decision:m?"undecided":"measured",reason:`calibration on an unvalidated engine/model${b}: ${o}. No regression or graduation claim against another model's catalogue.`,reward:i};if(m)return{decision:"undecided",reason:`calibration below the decision floor${b}: ${o}`,reward:i};if(t[1]<0)return{decision:"reward_harm",reason:`lower reward in this comparison: ${o}. This is not a between-period regression test.`,reward:i};if(e.taskClass==="proven"&&e.axis==="reward")return t[0]>0?{decision:"holds",reason:`calibration effect reproduced on this fixture: ${o}. This does not establish representative project improvement.`,reward:i}:{decision:"replication_alert",reason:`prior calibration effect did not reproduce: ${o}. Investigate the rule, model and harness; a valid between-period comparison is required to establish regression. The interval does not establish equivalence.`,reward:i};let a=e.cost;if(e.axis==="cost"&&!a)return{decision:"unmeasured",reason:`no per-trial cost measured \u2014 cost is UNKNOWN, not $0 (${o})`,reward:i};if(a&&a.decision!=="undecided"){let h=`cost ${a.delta_pct==null?"n/a":`${a.delta_pct>=0?"+":""}${a.delta_pct.toFixed(1)}%`}/trial, 95% CI [${a.ci_usd[0].toFixed(4)}, ${a.ci_usd[1].toFixed(4)}] USD`;return{decision:"cost_signal",reason:`${a.decision} in this comparison: ${h}; reward ${o}. ${a.reward.regressed?"The with-arm solved LESS in the observed sample. ":""}Reliability noninferiority is unestablished: no margin was declared. No performance-adoption claim.`,reward:i}}return e.taskClass==="proven"&&e.axis==="cost"?{decision:"replication_alert",reason:`prior cost saving did not reproduce; cost interval includes zero; reward ${o}. No between-period regression or reward-equivalence claim.`,reward:i}:$?{decision:"now_discriminates",reason:`exploratory calibration finding: ${o}. Validate on frozen tasks before making an improvement claim.`,reward:i}:{decision:"inconclusive",reason:`interval includes zero: ${o}. Neither equivalence nor absence of useful effect is established.`,reward:i}}l(v,"judgeMeasured");export{x as a,w as b,g as c,_ as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as w}from"./chunk-NJ5UED3H.js";import{c as $,d as p}from"./chunk-
|
|
1
|
+
import{d as w}from"./chunk-NJ5UED3H.js";import{c as $,d as p}from"./chunk-GIXHG5FK.js";import{a as H,b as k,c as U,d as L,e as O}from"./chunk-XQYAVSUQ.js";import{a as g}from"./chunk-ZLLER3HP.js";import{useCallback as D,useEffect as G,useRef as y,useState as u}from"react";import{Box as q,Text as r,useInput as N}from"ink";import W from"ink-select-input";import X from"ink-text-input";import{spawn as z}from"node:child_process";import{Fragment as T,jsx as s,jsxs as i}from"react/jsx-runtime";function se({width:_,onClose:S}){let[M,j]=u([]),[c,m]=u("status"),[b,A]=u(null),[R,C]=u(""),[E,o]=u(""),[d,P]=u(!1),h=y(!1),v=y(!1),f=y(!0),l=D(async()=>{if(h.current){v.current=!0;return}h.current=!0;try{let t=await Promise.allSettled([p("/api/settings/measurement",{timeoutMs:5e3}).then(e=>L(k.parse(e))),p("/api/settings/harbor",{timeoutMs:5e3}).then(e=>O(U.parse(e)))]);f.current&&j(t.flatMap((e,n)=>e.status==="fulfilled"?e.value:[{id:`error-${n}`,label:n===0?"Measurement unavailable":"Harbor unavailable",detail:e.reason instanceof Error?e.reason.message:String(e.reason)}]))}finally{h.current=!1,v.current&&f.current&&(v.current=!1,l())}},[]);G(()=>{f.current=!0,l();let t=setInterval(()=>void l(),3e4);return()=>{f.current=!1,clearInterval(t)}},[l]);async function I(t,e){let n=H.safeParse({engine:t,model:e.trim()||null});if(!n.success){o(n.error.issues.map(a=>a.message).join("; "));return}P(!0);try{await p("/api/settings/measurement",{method:"PATCH",body:n.data,timeoutMs:5e3}),o("Saved for future opted-in jobs. Schedules and file permissions are unchanged."),m("status"),await l()}catch(a){o(a instanceof Error?a.message:String(a))}finally{P(!1)}}g(I,"save");function x(t){try{let e=new URL(t,process.env.RULEMETRIC_WEB_URL??$()).toString(),n=process.platform==="darwin"?"open":process.platform==="win32"?"rundll32":"xdg-open",a=process.platform==="win32"?["url.dll,FileProtocolHandler",e]:[e],B=z(n,a,{stdio:"ignore"});B.on("error",()=>o(`Open in your browser: ${e}`)),B.on("exit",F=>{F&&o(`Open in your browser: ${e}`)}),o(`Opening ${e}`)}catch(e){o(e instanceof Error?e.message:String(e))}}return g(x,"openPage"),N((t,e)=>{if(!d){if(e.escape){c==="status"?S():(m("status"),o(""));return}c==="status"&&((t==="q"||t==="m")&&S(),t==="r"&&l(),t==="c"&&(o(""),m("engine")),t==="e"&&x("/eval-targets"),t==="t"&&x("/memories"),t==="h"&&x("/settings"))}}),i(q,{width:_,flexDirection:"column",borderStyle:"round",borderColor:w,paddingX:1,children:[s(r,{bold:!0,color:w,children:"Measurement \xB7 account settings"}),c==="status"&&i(T,{children:[M.length===0?s(r,{children:"Loading measurement status\u2026"}):M.map(t=>i(r,{children:[i(r,{bold:!0,children:[t.label,": "]}),t.detail]},t.id)),s(r,{dimColor:!0,children:"Trials compare with/without an instruction or memory within a fixed harness/model. Inspect exclusions and uncertainty before claiming a gain."}),s(r,{children:"c engine/model \xB7 e nightly trials & eval evidence \xB7 t memory trials"}),s(r,{children:"h Harbor/settings \xB7 r refresh \xB7 Esc back (e/t/h open dashboard)"})]}),c==="engine"&&i(T,{children:[s(r,{children:"Choose actor for future opted-in jobs. This does not enable schedules or file rewrites."}),s(W,{items:[{label:"Claude Code",value:"claude"},{label:"Codex",value:"codex"},{label:"Pi",value:"pi"},{label:"Unset \u2014 existing worker defaults",value:"unset"}],onSelect:t=>{if(!d){if(t.value==="unset"){I(null,"");return}A(t.value),C(""),m("model")}}})]}),c==="model"&&i(T,{children:[s(r,{children:b==="pi"?"Required provider/model (Harbor unsupported)":b==="codex"?"Required supported Codex model":"Claude model (blank uses defaults)"}),i(q,{children:[s(r,{children:"Model: "}),s(X,{value:R,onChange:C,focus:!d,onSubmit:()=>{d||I(b,R)}})]}),s(r,{dimColor:!0,children:"Enter saves \xB7 Esc cancels"})]}),d&&s(r,{children:"Saving\u2026"}),E&&s(r,{children:E})]})}g(se,"MeasurementPanel");export{se as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-GIXHG5FK.js";import{a as e}from"./chunk-ZLLER3HP.js";function i(){return process.env.RULEMETRIC_API_URL??a}e(i,"apiUrl");function u(){let n=process.env.RULEMETRIC_API_KEY??process.env.RULEMETRIC_ACCESS_TOKEN;if(!n)throw new Error("not signed in \u2014 run `rulemetric auth login`");return n}e(u,"authToken");async function t(n,o){let r=await fetch(`${i()}${n}`,{...o,headers:{Authorization:`Bearer ${u()}`,"Content-Type":"application/json",...o?.headers??{}},signal:AbortSignal.timeout(1e4)});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return await r.json()}e(t,"request");function c({limit:n}){return t(`/api/launch-jobs?limit=${n}`)}e(c,"fetchLaunchJobs");function h(n){return t("/api/launch-jobs",{method:"POST",body:JSON.stringify(n)})}e(h,"createLaunchJob");function l(n){return t(`/api/launch-jobs/${n}/cancel`,{method:"POST"})}e(l,"cancelLaunchJob");function p(){return t("/api/launchers")}e(p,"listLaunchers");export{c as a,h as b,l as c,p as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as h,e as g}from"./chunk-
|
|
1
|
+
import{d as h,e as g}from"./chunk-RSVNQ2XI.js";import{e as p,g as f}from"./chunk-GIXHG5FK.js";import{a as o}from"./chunk-ZLLER3HP.js";var u="openCandidate";function K(n,s,a){let t=(n??{})[u];if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return e.executionKey!==a||typeof e.content!="string"||!e.content||typeof e.hash!="string"||!e.hash||typeof e.priorHash!="string"||e.priorHash!==s?null:{...a?{executionKey:a}:{},...typeof e.observedKey=="string"?{observedKey:e.observedKey}:{},content:e.content,hash:e.hash,priorHash:e.priorHash,plannedPairs:typeof e.plannedPairs=="number"?e.plannedPairs:0,updatedAt:typeof e.updatedAt=="string"?e.updatedAt:""}}o(K,"resolveOpenCandidate");function C(n){let{plannedPairs:s,carriedPairs:a,liveCases:t}=n;if(t<=0)return 0;let e=s-a;return e<=0?0:Math.ceil(e/t)}o(C,"owedPasses");var d=100;async function x(n){let{evalTargetId:s,candidateContentHash:a}=n,t=[];for(let e=0;;e+=d){let i=await p(`/api/eval-targets/${s}/runs?candidateContentHash=${encodeURIComponent(a)}&limit=${d}&offset=${e}`);if(!Array.isArray(i)||i.length===0||(t.push(...i.filter(r=>{if(r.outputs?.executionKey!==n.executionKey)return!1;if(!n.executionKey)return!0;if(!n.observedKey)return!1;let l=h([r]);if(!l)return!1;let[y,c]=JSON.parse(l),[b,m]=JSON.parse(n.observedKey);return y===b&&(c===null||c===m)})),i.length<d))break}return g(t)}o(x,"fetchCarriedPairs");async function A(n){let{evalTargetId:s,meta:a,blob:t,log:e,tag:i}=n;try{let r={...a};t?r[u]=t:delete r[u],await f(`/api/eval-targets/${s}`,{metadata:r}),e(t?`${i}: banked candidate ${t.hash.slice(0,8)} \u2014 the next run resumes instead of restarting`:`${i}: cleared the banked candidate (this cycle reached a decision)`)}catch(r){e(`${i}: could not update the candidate bank (${r instanceof Error?r.message:String(r)})`)}}o(A,"bankOpenCandidate");function O(n){return{...n.executionKey?{executionKey:n.executionKey}:{},...n.observedKey?{observedKey:n.observedKey}:{},content:n.content,hash:n.hash,priorHash:n.priorHash,plannedPairs:n.plannedPairs,updatedAt:n.now.toISOString()}}o(O,"buildOpenCandidate");export{u as a,K as b,C as c,x as d,A as e,O as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-NWV66NMA.js";import{a as f}from"./chunk-ZLLER3HP.js";import{useEffect as J,useState as u,useCallback as m,useRef as s}from"react";var y=5e3;function T(a=20){let[d,b]=u([]),[g,l]=u(null),[h,p]=u(!0),r=s(!1),e=s(null),c=s(0),t=m(async()=>{let o=++c.current;try{let n=await i({limit:a});if(r.current||o!==c.current)return;b(n),l(null)}catch(n){if(r.current||o!==c.current)return;l(n instanceof Error?n.message:String(n))}finally{if(r.current||o!==c.current)return;p(!1),e.current=setTimeout(()=>{t()},y)}},[a]),L=m(()=>{e.current&&clearTimeout(e.current),t()},[t]);return J(()=>(r.current=!1,t(),()=>{r.current=!0,e.current&&clearTimeout(e.current)}),[t]),{jobs:d,error:g,loading:h,refetch:L}}f(T,"useLaunchJobs");export{T as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-FS3TAQAE.js";import{h as s}from"./chunk-GIXHG5FK.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{c as X}from"./chunk-HOQPVOMF.js";import{b as D}from"./chunk-GIRPEMTW.js";import{a as x}from"./chunk-MODXEGCU.js";import{e as J,g as B}from"./chunk-
|
|
1
|
+
import{c as X}from"./chunk-HOQPVOMF.js";import{b as D}from"./chunk-GIRPEMTW.js";import{a as x}from"./chunk-MODXEGCU.js";import{e as J,g as B}from"./chunk-7BCZDVIU.js";import{e as w,f as R}from"./chunk-GIXHG5FK.js";import{c as H,d as U}from"./chunk-X6CF5KTW.js";import{a as u}from"./chunk-ZLLER3HP.js";import{readFileSync as q,realpathSync as V}from"node:fs";import y from"node:path";import A from"node:os";function Q(s){let n=y.resolve(s);if(n===y.resolve(A.homedir()))return!1;let a=y.parse(n).root;if(n===a)return!1;try{let o=V(A.tmpdir());if(V(n)===o)return!1}catch{}return!0}u(Q,"isScorableProjectPath");var Z=5,ee=Number(process.env.RULEMETRIC_MAX_SUGGESTION_PROJECTS??10),te=48,ne=.5,O=400,oe=3,re=.6,se=1;function ae(s){let n=s.bloated??[],a=new Set([...s.harmful.map(o=>o.id),...s.candidates.map(o=>o.id)]);return n.filter(o=>!a.has(o.id)).slice(0,se).map(o=>({instructionId:o.id,estimatedTokens:o.estimatedTokens,topProjectId:o.topProjectId??null,score:.55,reason:`Costs ~${o.estimatedTokens} tokens every session and measures neutral across ${o.exposures} exposed session(s) \u2014 enough data to detect an effect, and none found. Consider shortening "${o.name}" rather than removing it.`+(o.containsSafetyLanguage?" CAUTION: it contains guardrail language (destructive-command or credential rules) \u2014 preserve those lines when shortening.":"")}))}u(ae,"buildTrimProposals");async function ie(s,n,a){let o=[],i=0;for(let d of s)try{await a("/api/instruction-experiments",{instructionId:d.instructionId,projectPath:n,source:"groom"}),i++}catch(g){let m=g instanceof Error?g.message:String(g);o.push({...d,reason:`${d.reason} (not measurable by withholding: ${m})`})}return{nominated:i,unmeasurable:o}}u(ie,"nominateRemovals");function ce(s){let n=[];for(let o of s.harmful){let i=o.verdict.delta;n.push({instructionId:o.id,score:Math.min(.95,.75+Math.abs(i)),topProjectId:o.topProjectId??null,reason:`Measured harmful: sessions using "${o.name}" scored ${(i*100).toFixed(1)}pp worse across ${o.exposures} exposed session(s). Observational \u2014 review before archiving.`})}let a=new Set(s.harmful.map(o=>o.id));for(let o of s.candidates)a.has(o.id)||n.push({instructionId:o.id,score:re,topProjectId:o.topProjectId??null,reason:`Unused: "${o.name}" is ${o.reason} (${o.totalExposures} lifetime exposure(s)) but still costs context budget every session.`});return n.slice(0,oe)}u(ce,"buildRemovalProposals");function le(){let s=y.join(A.homedir(),".config","rulemetric","skills-registry.json");try{let n=q(s,"utf-8"),a=JSON.parse(n),o=new Date(a.generatedAt).getTime();return Number.isNaN(o)?"unknown":Date.now()-o>te*60*60*1e3?"stale":"fresh"}catch{return"unknown"}}u(le,"observeSkillsRegistry");var Re=u(async(s,n)=>{let a=J(),o=a!=="none";o?n.logger.info(`Scoring backend: ${a}`):n.logger.warn("No LLM backend available (claude CLI missing and ANTHROPIC_API_KEY unset); skipping relevance scoring. Removal/trim proposals still run \u2014 they need no LLM.");let i;try{i=(await w("/api/sessions/project-paths?limit="+ee)).projectPaths}catch(e){n.logger.warn(`Failed to fetch project paths: ${e instanceof Error?e.message:String(e)}`);return}if(i.length===0){n.logger.info("No recent project paths; nothing to score");return}let d=new Map;try{let e=await w("/api/projects?limit=200");for(let t of e.projects??[])t.primaryCheckoutPath&&d.set(x(t.primaryCheckoutPath),t.id)}catch(e){n.logger.warn(`Failed to fetch projects for id resolution: ${e instanceof Error?e.message:String(e)}`)}let g=new Map;try{let e=await w(`/api/catalog?limit=200&proposable=1&contentPreview=${O}`);for(let t of e)g.set(t.id,{id:t.id,name:t.name,description:t.description??"",tags:t.tags??[],contentPreview:(t.contentPreview??"").slice(0,O)})}catch(e){n.logger.warn(`Failed to fetch catalog: ${e instanceof Error?e.message:String(e)}`)}try{let e=await w("/api/instructions?limit=100");for(let t of e.instructions??[])g.has(t.id)||g.set(t.id,{id:t.id,name:t.name,description:t.description??"",tags:t.tags??[],contentPreview:(t.content??"").slice(0,O)})}catch(e){n.logger.warn(`Failed to fetch personal instructions: ${e instanceof Error?e.message:String(e)}`)}let m=[],p=[];try{let e=await w("/api/insights/groom-candidates");if(!e.captureHealthy)n.logger.info(`Grooming paused: ${e.reason??"capture unhealthy"}`);else{m=ce(e),p=ae(e);let t=e.safetyGuarded+e.harmfulSafetyGuarded;n.logger.info(`Removal proposals: ${m.length} (${e.harmful.length} measured-harmful, ${e.candidates.length} never-used, ${t} withheld by the safety allowlist); trim proposals: ${p.length} (${(e.bloated??[]).length} measured-neutral and expensive, ${e.trimSafetyFlagged??0} flagged as containing guardrail language)`)}}catch(e){n.logger.warn(`Failed to fetch groom candidates: ${e instanceof Error?e.message:String(e)}`)}let b=[...g.values()];if(b.length===0&&m.length===0&&p.length===0){n.logger.info("No candidate instructions and nothing to retire; nothing to score");return}n.logger.info(`Scoring ${b.length} candidates across ${i.length} project(s)`);let M=0,l=null,I=new Set;for(let e of i)try{let t=x(e);if(!Q(t)){n.logger.info(`Skipping ${t}: not a project directory (home/root)`);continue}let f=D(t),k=o&&f.length>0;f.length===0&&n.logger.info(`${t}: insufficient language signals; removal/trim only`);let v=X(t),z={name:y.basename(t),description:v.description,languages:f,topics:v.topics,dependencies:v.dependencies},E=k?U(b):[];k&&n.logger.info(`Scoring ${b.length} candidates for ${t} in ${E.length} batch(es)`);let C=[],$=0;for(let r of E)try{let c=await B(H(z,r),"",4096);if(!c){$++;continue}let T=c.recommendations??[];for(let P of T)typeof P.instructionId=="string"&&typeof P.score=="number"&&typeof P.reason=="string"&&C.push({instructionId:P.instructionId,score:P.score,reason:P.reason})}catch(c){$++,n.logger.warn(`Batch failed for ${t}: ${c instanceof Error?c.message:String(c)}`)}$>0&&n.logger.warn(`${$}/${E.length} batch(es) failed for ${t} (backend ${a}); suggestions are partial`),k&&C.length===0&&n.logger.warn(`No usable LLM output for ${t} (backend ${a})`);let K=C.filter(r=>r.score>=ne).sort((r,c)=>c.score-r.score).slice(0,Z),_=d.get(t),W=l===null||l===t;l===null&&(l=t);let N=u(r=>r.topProjectId?r.topProjectId===_:W,"placeHere"),F=m.filter(N),{nominated:L,unmeasurable:G}=await ie(F,t,R);L>0&&n.logger.info(`${t}: ${L} removal candidate(s) nominated for randomised withholding instead of the feed`);let h=[...K.map(r=>({instructionId:r.instructionId,score:r.score,reason:r.reason,kind:"add"})),...G.map(({topProjectId:r,...c})=>({...c,kind:"remove"})),...p.filter(N).map(({estimatedTokens:r,topProjectId:c,...T})=>({...T,kind:"trim"}))];if(h.length===0){n.logger.info(`Nothing to suggest for ${t}`);continue}await R("/api/instruction-suggestions/batch-upsert",{projectPath:t,..._?{projectId:_}:{},suggestions:h}),n.logger.info(`${t}: ${h.filter(r=>r.kind==="add").length} add + ${h.filter(r=>r.kind==="remove").length} remove + ${h.filter(r=>r.kind==="trim").length} trim`);for(let r of h)r.kind!=="add"&&I.add(r.instructionId);let Y=new Set(G.map(r=>r.instructionId));for(let r of F)Y.has(r.instructionId)||I.add(r.instructionId);M++}catch(t){n.logger.warn(`Failed to score ${e}: ${t instanceof Error?t.message:String(t)}`)}let j=[...m.filter(e=>!I.has(e.instructionId)),...p.filter(e=>!I.has(e.instructionId)).map(({estimatedTokens:e,...t})=>t)];if(j.length>0&&l)try{let e=new Set(p.map(t=>t.instructionId));await R("/api/instruction-suggestions/batch-upsert",{projectPath:l,...d.get(l)?{projectId:d.get(l)}:{},suggestions:j.map(({topProjectId:t,...f})=>({...f,kind:e.has(f.instructionId)?"trim":"remove"}))}),n.logger.info(`Orphan sweep: ${j.length} proposal(s) whose project was not scored this run placed on ${l}`)}catch(e){n.logger.warn(`Orphan sweep failed: ${e instanceof Error?e.message:String(e)}`)}let S=le();if(S==="unknown")n.logger.warn("Skills registry unreadable or has no usable generatedAt; leaving suggestion staleness unchanged");else try{await R("/api/instruction-suggestions/mark-stale",{stale:S==="stale"}),S==="stale"?n.logger.warn("Skills registry is stale (>48h); marked catalog-skill suggestions stale"):n.logger.info("Skills registry is fresh; cleared staleness on catalog-skill suggestions")}catch{}n.logger.info(`Done: scored ${M}/${i.length} projects`)},"cronSuggestInstructions");export{Q as a,ae as b,ie as c,ce as d,Re as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as d}from"./chunk-QWCEZEDO.js";import{a as R,g as v,h as T,j as I,m as C}from"./chunk-OZQNSELV.js";import{d as g}from"./chunk-GPBN4ROE.js";import{e as _}from"./chunk-
|
|
1
|
+
import{e as d}from"./chunk-QWCEZEDO.js";import{a as R,g as v,h as T,j as I,m as C}from"./chunk-OZQNSELV.js";import{d as g}from"./chunk-GPBN4ROE.js";import{e as _}from"./chunk-GIXHG5FK.js";import{g as m,l as k}from"./chunk-PZNWH4VQ.js";import{a as i}from"./chunk-ZLLER3HP.js";import{execSync as j}from"node:child_process";import{existsSync as p,readFileSync as y}from"node:fs";import{homedir as f}from"node:os";import{join as a}from"node:path";var P=["install","auth","hooks","worker"],O=["judge"],M=[...P,...O];function $(){return{projectPath:process.cwd(),configDir:k()}}i($,"defaultContext");var A=a(f(),".mitmproxy","mitmproxy-ca-cert.pem");function S(e){if(!e)return"";if(e.length<=8)return"*".repeat(e.length);let t=e.slice(0,4),n=e.slice(-4);return`${t}${"*".repeat(Math.max(4,e.length-8))}${n}`}i(S,"maskToken");function te(e,t){let n=e===null?[]:e.replace(/\n$/,"").split(`
|
|
2
2
|
`),o=t===null?[]:t.replace(/\n$/,"").split(`
|
|
3
3
|
`),s=[],u=Math.max(n.length,o.length);for(let c=0;c<u;c++){let l=n[c],r=o[c];l===r?s.push(` ${l}`):(l!==void 0&&s.push(`-${l}`),r!==void 0&&s.push(`+${r}`))}return s.join(`
|
|
4
4
|
`)}i(te,"renderDiff");function x(e,t){let n=a(e,"env");if(!p(n))return null;try{let s=y(n,"utf-8").match(new RegExp(`^${t}=(.+)$`,"m"));return s?s[1]:null}catch{return null}}i(x,"readEnvValue");async function b(){if(!m())return!1;try{return(await Promise.race([_("/api/setup/status"),new Promise((t,n)=>setTimeout(()=>n(new Error("setup/status timeout")),2500))]))?.workerActive===!0}catch{return!1}}i(b,"workerActive");function E(e,t){let n=a(e,".claude",t),o={},s=null;if(p(n))try{s=y(n,"utf-8").replace(/\n$/,""),o=JSON.parse(s)}catch{o={}}return{settings:o,before:s}}i(E,"readProjectSettings");function D(e){let{settings:t,before:n}=E(e,"settings.local.json");return v(t),{before:n,after:JSON.stringify(t,null,2)}}i(D,"projectHooksSettings");function N(e){let{settings:t,before:n}=E(e,"settings.local.json"),o={...t.env??{}};return o.HTTPS_PROXY=`http://localhost:${d}`,o.NO_PROXY=I,o.NODE_EXTRA_CA_CERTS=A,{before:n,after:JSON.stringify({...t,env:o},null,2)}}i(N,"projectProxyEnvSettings");function U(e){let{settings:t,before:n}=E(e,"settings.json");if(n===null)return null;let{removed:o}=C(t,d);return o?{before:n,after:JSON.stringify(t,null,2)}:null}i(U,"projectSharedSettingsMigration");var Y=a(f(),"Library","LaunchAgents","com.rulemetric.worker.plist"),G=a(f(),".config","systemd","user","rulemetric-worker.service");function h(e){j(e,{stdio:"inherit"})}i(h,"runCommand");var L=[{id:"install",title:"Install the CLI",command:"npm install -g @rulemetric/cli",async detect(){return m()||await b()},async plan(){return{id:"install",title:"Install the CLI",command:"npm install -g @rulemetric/cli",artifacts:[{path:"npm install -g @rulemetric/cli",kind:"command",before:null,after:"rulemetric --version # verifies the binary is on PATH"}]}},async apply(){h("npm install -g @rulemetric/cli")}},{id:"auth",title:"Authenticate",command:"rulemetric auth login",async detect(){return m()},async plan(e){let t=a(e.configDir,"env"),n=null;if(p(t))try{n=X(y(t,"utf-8"))}catch{n="(unreadable)"}let o=x(e.configDir,"RULEMETRIC_ACCESS_TOKEN"),u=[`RULEMETRIC_ACCESS_TOKEN=${S(o||"<token-from-login>")}`],c=x(e.configDir,"RULEMETRIC_API_KEY");c&&u.push(`RULEMETRIC_API_KEY=${S(c)}`);let l=process.env.RULEMETRIC_API_URL;l&&u.push(`RULEMETRIC_API_URL=${l}`);let r=u.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g}from"./chunk-3ZHVP3KE.js";import{d as k,e as h}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-3ZHVP3KE.js";import{d as k,e as h}from"./chunk-FXQS7AEZ.js";import{e as m,i as f}from"./chunk-GIXHG5FK.js";import{a as c}from"./chunk-ZLLER3HP.js";import{existsSync as b}from"node:fs";async function w($,y){let r=c(t=>y?.logger?.info?.(t)??console.log(t),"log"),{projectPath:s}=$,n=`[cron_retire_unused_skills] ${s}`;if(!s||!b(s))return{skipped:"project-missing",reason:`${s} does not exist on this machine \u2014 refusing to delete files for a project that is not here.`};let o=await m("/api/insights/groom-candidates"),e=g({captureHealthy:o.skillCaptureHealthy===!0,captureReason:o.skillCaptureHealthy===void 0?"API did not report skill capture health (older deployment)":o.skillCaptureReason,candidates:o.unusedSkills??[]});if(e.refused)return r(`${n} ${e.refused}: ${e.summary}`),{skipped:e.refused,reason:e.summary,held:e.held.length};r(`${n} ${e.summary}`);let a=[],d=[],l=0;for(let t of e.retire){let u=k({kind:"skill_file",target:t.name,cwd:s});if(!u.ok){l+=1,r(`${n} could not plan removal of ${t.name}: ${u.refusal??"unresolved"}`);continue}let R=new Date().toISOString().replace(/[:.]/g,"-"),i=h(u,R);if(!i.applied){l+=1,r(`${n} failed to remove ${t.name}: ${i.error??"unknown error"}`);continue}a.push(t.name),i.backupPath&&d.push(i.backupPath),r(`${n} retired ${t.name} (backup: ${i.backupPath??"none"})`);try{await f(`/api/instructions/${t.instructionId}`)}catch(p){r(`${n} removed ${t.name} but could not archive its instruction row: ${p instanceof Error?p.message:String(p)}`)}}return{retired:a.length,failed:l,held:e.held.length,names:a,backups:d,reason:e.summary}}c(w,"cronRetireUnusedSkills");export{w as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
1
|
+
import{c as u}from"./chunk-WL5ZWQAS.js";import{b as c,e as y,f as m}from"./chunk-GIXHG5FK.js";import{a as n,b as t,i as s,k as p}from"./chunk-PZNWH4VQ.js";import{a}from"./chunk-ZLLER3HP.js";import{hostname as l}from"node:os";async function R(f,r,h){t();let o=process.env.RULEMETRIC_API_KEY,d=n().apiKey;if(o||d)try{await y("/api/profile");return}catch(e){if(!(e instanceof c)||e.statusCode!==401)return;if(o){r('Your exported RULEMETRIC_API_KEY was rejected (revoked?). Unset it or replace it with a fresh key (`rulemetric auth create-key --name "my-laptop"`).');return}p(),t(),r("Stored API key was rejected (revoked?) \u2014 replacing it with a fresh one.")}let i=`${l()} (auto)`;try{let e=await m("/api/auth/api-keys",{name:i});s(e.key,process.env.RULEMETRIC_API_URL),t(),f(`Created API key "${i}" for hooks + proxy auth (saved to your config).`),u("key_created",{},h)}catch(e){let k=e instanceof Error?e.message:String(e);r(`Could not auto-create an API key (${k}). Hooks/proxy will work via your session token for ABOUT AN HOUR \u2014 the token expires, and capture then stops until a key exists. Run \`rulemetric auth create-key --name "my-laptop"\` (or \`rulemetric auth login\` again) to fix this permanently.`)}}a(R,"ensureDeviceApiKey");export{R as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as U,b as F}from"./chunk-
|
|
1
|
+
import{a as U,b as F}from"./chunk-6T6YFPBW.js";import{a as h,b as I}from"./chunk-ISYU5BMU.js";import{a as w,b as k,e as R}from"./chunk-LJRE3LZ2.js";import{d as $}from"./chunk-GYNZ3OZF.js";import{g as C,i as D,j as P}from"./chunk-UPFH72PF.js";import{e as v,f as x,i as j}from"./chunk-GIXHG5FK.js";import{D as S,F as b,G as T,o as A}from"./chunk-X6CF5KTW.js";import{a as l}from"./chunk-ZLLER3HP.js";import*as u from"node:fs";import*as m from"node:path";var O=new Set(["mcp","subagent","feature"]);function ie(e,t,n){return L(m.join(e,"CLAUDE.md"),t,n)}l(ie,"appendToCLAUDEmd");function L(e,t,n){let i=w(t),s=k(t),a=u.existsSync(e)?u.readFileSync(e,"utf8"):"";if(a.includes(i))return!1;let p=`${a.length>0&&!a.endsWith(`
|
|
2
2
|
`)?`
|
|
3
3
|
|
|
4
4
|
`:a.length>0?`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-WIKCYUZC.js";import{a as g}from"./chunk-ZLLER3HP.js";var p=5;function b(t){let r=g((e,f)=>({retire:[],survivingCases:0,replacementsRequired:!1,refused:e,summary:f}),"none");if(!t||t.cases.length===0&&t.unpairedCases.length===0)return r("no-discrimination-data","No case-discrimination data yet \u2014 the target needs runs in BOTH cohorts before any case can be judged dead.");let c=[...t.cases.filter(e=>!e.discriminating).map(e=>({evalId:e.evalId,name:e.name,feedback:{name:e.name,withPassRate:e.withPassRate,withoutPassRate:e.withoutPassRate,reason:e.note}})),...t.unpairedCases.map(e=>({evalId:e.evalId,name:e.name,feedback:{name:e.name,withPassRate:e.withPassRate??0,withoutPassRate:e.withoutPassRate,reason:"runs in only one cohort (no with-vs-without comparison possible)"}}))];if(c.length===0)return r("all-discriminating","Every case discriminates \u2014 nothing to retire.");let s=new Map(t.cases.map(e=>[e.evalId,e.separation])),o=[...c].sort((e,f)=>(s.get(e.evalId)??-1)-(s.get(f.evalId)??-1)).slice(0,p),u=c.length-o.length,d=t.total+t.unpaired,l=d-o.length,i=l<m,n=`${o.length} of ${d} live case(s) carry no treatment signal`+(u>0?` (${u} more over the ${p}-per-run cap)`:"")+(i?`; retiring them leaves ${l}, below the ${m}-case evolution floor, so replacements must be generated first`:"");return{retire:o,survivingCases:l,replacementsRequired:i,refused:null,summary:n}}g(b,"planCaseRefinement");async function v(t,r){let h=r.log??(()=>{}),c=g((n,e)=>({retired:0,generated:0,skipped:n,summary:e,retiredNames:[],generatedNames:[]}),"empty");if(t.refused)return c(t.refused,t.summary);let s=await r.generate(t.retire.map(n=>n.feedback)),a=[];for(let n of s??[]){let e=await r.createCase(n);a.push(e.name),h(` + ${e.name} (${e.id})`)}let o=t.survivingCases+t.retire.length+a.length,u=Math.max(0,o-m),d=t.retire.slice(0,Math.min(t.retire.length,u)),l=t.retire.length-d.length;if(d.length===0)return{retired:0,generated:a.length,skipped:s===null?"no-llm-backend":"no-replacements-generated",summary:`${t.summary}. `+(s===null?"No local LLM backend available, so nothing was retired":`The generator produced ${a.length} usable replacement(s), not enough to retire anything`)+` \u2014 dropping below the ${m}-case floor would silently disenrol the target from the nightly loop.`,retiredNames:[],generatedNames:a};let i=[];for(let n of d)await r.retireCase(n.evalId,n.feedback.reason),i.push(n.name),h(` retired ${n.name}`);return{retired:i.length,generated:a.length,skipped:null,summary:`Retired ${i.length} non-discriminating case(s), added ${a.length} replacement(s)`+(l>0?`; held ${l} back to stay at the ${m}-case floor (they remain condemned and will be retired once replacements exist)`:"")+". The replacements have no runs yet \u2014 the next autorun batch builds their depth.",retiredNames:i,generatedNames:a}}g(v,"executeCaseRefinement");export{p as a,b,v as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as E}from"./chunk-
|
|
1
|
+
import{d as E}from"./chunk-T47SFA5X.js";import{b as F,c as x}from"./chunk-KGURGIZ2.js";import{f as R}from"./chunk-GIXHG5FK.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,2 +1,2 @@
|
|
|
1
|
-
import{c as E,n as m}from"./chunk-T75KAEJO.js";import{a as d}from"./chunk-
|
|
1
|
+
import{c as E,n as m}from"./chunk-T75KAEJO.js";import{a as d}from"./chunk-GIXHG5FK.js";import{a as c}from"./chunk-ZLLER3HP.js";import*as p from"node:fs";import*as u from"node:path";import*as _ from"node:os";function T(){if(process.env.RULEMETRIC_API_KEY||process.env.RULEMETRIC_ACCESS_TOKEN)return;let s=u.join(_.homedir(),".config","rulemetric","env");C(s)||C(u.join(process.cwd(),".env.local"))}c(T,"ensureEnv");function C(s){try{let t=p.readFileSync(s,"utf-8");for(let n of t.split(`
|
|
2
2
|
`)){let e=n.trim();if(!e||e.startsWith("#"))continue;let o=e.indexOf("=");if(o<0)continue;let r=e.slice(0,o).trim(),i=e.slice(o+1).trim();process.env[r]||(process.env[r]=i)}return!!(process.env.RULEMETRIC_API_KEY||process.env.RULEMETRIC_ACCESS_TOKEN)}catch{return!1}}c(C,"loadEnvFile");T();async function I(s){let t={totalSessions:0,totalCalls:0,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,totalCacheWriteTokens:0,totalCostUSD:0,providers:{}},n=await m(s);t.providers={};for(let a of n)t.providers[a.provider]=(t.providers[a.provider]||0)+1;let e=new E,o=n.filter(a=>a.provider==="claude");for(let a of o)try{let h=p.readdirSync(a.path).filter(f=>f.endsWith(".jsonl"));t.totalSessions+=h.length;for(let f of h){let v=p.readFileSync(u.join(a.path,f),"utf-8"),R=e.parse(v);for(let l of R.events)l.tokenUsage&&(t.totalCalls++,t.totalInputTokens+=l.tokenUsage.input,t.totalOutputTokens+=l.tokenUsage.output,t.totalCacheReadTokens+=l.tokenUsage.cacheRead??0,t.totalCacheWriteTokens+=l.tokenUsage.cacheWrite??0)}}catch{}let r=15,i=75;return t.totalCostUSD=Math.round((t.totalInputTokens/1e6*r+t.totalOutputTokens/1e6*i+t.totalCacheReadTokens/1e6*(r*.1)+t.totalCacheWriteTokens/1e6*(r*1.25))*100)/100,t}c(I,"loadLocalStats");async function U(s){let t=process.env.RULEMETRIC_API_URL??d,n=process.env.RULEMETRIC_API_KEY,e=process.env.RULEMETRIC_ACCESS_TOKEN,o=n??e;if(!o)return null;let r=new URLSearchParams;s&&r.set("projectPath",s);try{let i=await fetch(`${t}/api/insights/compute?${r}`,{headers:{Authorization:`Bearer ${o}`},signal:AbortSignal.timeout(5e3)});return i.ok?await i.json():null}catch{return null}}c(U,"loadApiInsights");async function g(s){let t=process.env.RULEMETRIC_API_URL??d,n=process.env.RULEMETRIC_API_KEY??process.env.RULEMETRIC_ACCESS_TOKEN;if(!n)return null;let e=new URLSearchParams;s&&e.set("projectPath",s);try{let o=await fetch(`${t}/api/insights/linked-instructions?${e}`,{headers:{Authorization:`Bearer ${n}`},signal:AbortSignal.timeout(5e3)});return o.ok?await o.json():null}catch{return null}}c(g,"loadLinkedInstructions");export{I as a,U as b,g as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as g}from"./chunk-
|
|
1
|
+
import{c as g}from"./chunk-DANMUHNW.js";import{e as h,f}from"./chunk-GIXHG5FK.js";import{q as u,r as m}from"./chunk-X6CF5KTW.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{f as w}from"./chunk-SWSOEYC7.js";import{a as C}from"./chunk-KGURGIZ2.js";import{a as M}from"./chunk-DVU5PHPM.js";import{a as x,f as b}from"./chunk-FBSZ6KCM.js";import{d as k}from"./chunk-GPBN4ROE.js";import{f as v}from"./chunk-
|
|
1
|
+
import{f as w}from"./chunk-SWSOEYC7.js";import{a as C}from"./chunk-KGURGIZ2.js";import{a as M}from"./chunk-DVU5PHPM.js";import{a as x,f as b}from"./chunk-FBSZ6KCM.js";import{d as k}from"./chunk-GPBN4ROE.js";import{f as v}from"./chunk-GIXHG5FK.js";import{f as y}from"./chunk-XQYAVSUQ.js";import{a as m}from"./chunk-ZLLER3HP.js";function $(t,e={}){let i=e.engine??(e.model||t.engine==="pi"?"claude":t.engine);return{engine:i,model:e.model??(i===t.engine?t.model:void 0)}}m($,"selectEvalJudge");function _(t){let e=$(t.actor,t.pin??{});if(!t.available.includes(e.engine))throw new Error(`configured grader unavailable: ${e.engine}`);if(e.engine==="codex"&&!e.model?.trim())throw new Error("Codex grader requires a model pin");return e}m(_,"resolveMeasurementJudge");function A(t,e){let i=t.measurement?y.parse(t.measurement):void 0,r=i?.engine??x(t.engine),o=i?i.model??void 0:t.model;if(!e){let s=k();e=[...s.claudeBin?["claude"]:[],...s.codexBin?["codex"]:[],...s.piBin?["pi"]:[]]}if(!e.includes(r))throw new Error(`configured actor unavailable: ${r}`);let u=t.skipGrading?$({engine:r,model:o}):_({actor:{engine:r,model:o},pin:t.graderEngine||t.graderModel?{engine:t.graderEngine,model:t.graderModel}:null,available:e});return{engine:r,model:o,graderEngine:u.engine,graderModel:u.model,...i?{measurement:i}:{}}}m(A,"resolveMeasurementJob");async function R(t,e,i=()=>{}){let{eval_:r,configuration:o,targetContent:u,runNumber:s}=t;i(`[${o}] ${r.name} run#${s} \u2014 executing...`);let l=x(e.engine),g=w({targetType:e.targetType,targetContent:u,targetName:e.targetName,engine:l}),c={...e.executionKey?{executionKey:e.executionKey}:{},deliveryRegime:`${e.targetType??"prompt"}:${l}:${g.methodology}`,...e.measurement?{measurement:e.measurement}:{},methodology:g.methodology,delivery:g.delivery,isolated:g.isWorktree,...e.candidateContentHash?{candidateContentHash:e.candidateContentHash}:{},...g.leakedFiles.length?{leakedFiles:g.leakedFiles}:{}};g.isWorktree||i(`[${o}] ${r.name} run#${s} \u2014 \u26A0 no git worktree; running without repo context`),g.leakedFiles.length&&i(`[${o}] ${r.name} run#${s} \u2014 \u26A0 CONTAMINATED: ${g.leakedFiles.join(", ")} survived the strip`);try{let n=await b({prompt:r.prompt,targetContent:g.systemPrompt,workDir:g.workDir,timeout:e.timeout,model:e.model,engine:l});if(n.error){let d=C(n.error);return i(`[${o}] ${r.name} run#${s} \u2014 FAILED (${d.kind}): ${n.error}`),{evalId:r.id,evalTargetId:e.targetId,evalTargetVersion:e.targetVersion,configuration:o,runNumber:s,iteration:e.iteration,status:"failed",outputs:{error:n.error,failureKind:d.kind,failureClass:d.class,...c,engine:n.engine??l,model:n.model??null,...n.provider?{provider:n.provider}:{},...n.costUsd!=null?{costUsd:n.costUsd}:{}},timing:{duration_ms:n.durationMs,total_tokens:n.totalTokens},grading:{},failure:d}}i(`[${o}] ${r.name} run#${s} \u2014 completed in ${(n.durationMs/1e3).toFixed(1)}s`);let a={};if(!e.skipGrading&&r.expectations.length>0){i(`[${o}] ${r.name} run#${s} \u2014 grading...`);let d=await M({prompt:r.prompt,output:n.output,expectations:r.expectations,...$({engine:l,model:e.model},{engine:e.graderEngine,model:e.graderModel}),timeout:e.timeout});a=d,i(`[${o}] ${r.name} run#${s} \u2014 grading done: pass_rate=${d.summary.pass_rate==null?"n/a (all assertions errored)":`${(d.summary.pass_rate*100).toFixed(0)}%`}`)}return{evalId:r.id,evalTargetId:e.targetId,evalTargetVersion:e.targetVersion,configuration:o,runNumber:s,iteration:e.iteration,status:"completed",outputs:{transcript:n.output,...c,engine:n.engine??l,...n.provider?{provider:n.provider}:{},model:n.model??null,...n.costUsd!=null?{costUsd:n.costUsd}:{}},timing:{duration_ms:n.durationMs,total_tokens:n.totalTokens,total_duration_seconds:n.durationMs/1e3},grading:a}}finally{g.cleanup()}}m(R,"executeAndGradeCase");async function B(t){let{cases:e,targetContent:i,concurrency:r,runNumber:o,opts:u,skipBaseline:s,onLog:l=m(()=>{},"onLog")}=t,g=s?["with_target"]:["with_target","without_target"],c=[];for(let a of e)for(let d of g)c.push({eval_:a,configuration:d,targetContent:d==="with_target"?i:void 0,runNumber:o});let n=[];for(let a=0;a<c.length;a+=Math.max(1,r)){let d=c.slice(a,a+Math.max(1,r)),h=await Promise.all(d.map(f=>R(f,u,l)));n.push(...h);let p=[];for(let f of h)try{await v("/api/eval-runs",f)}catch(E){p.push(E instanceof Error?E.message:String(E))}if(p.length)throw new Error(`Could not persist ${p.length} eval run(s); stopped further execution: ${p.join("; ")}`)}try{await v(`/api/eval-targets/${u.targetId}/label-state`,{})}catch(a){l(` \u26A0 label-state notification skipped: ${a instanceof Error?a.message:String(a)}`)}return{completed:n.filter(a=>a.status==="completed").length,failed:n.filter(a=>a.status==="failed").length,results:n}}m(B,"runBatchAndPost");export{$ as a,_ as b,A as c,R as d,B as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,f as a}from"./chunk-
|
|
1
|
+
import{b as o,f as a}from"./chunk-GIXHG5FK.js";import{a as n}from"./chunk-ZLLER3HP.js";function c(e){return e==null?e??null:e instanceof Date?e.toISOString():e}n(c,"serializeDate");async function d(e){let r={provider:e.provider,plan:e.plan,limitType:e.limitType,value:e.value,unit:e.unit,comparator:e.comparator,resetsAt:c(e.resetsAt),sourceType:e.sourceType,sourceUrl:e.sourceUrl,sourceEvidence:e.sourceEvidence,confidence:e.confidence,observedAt:c(e.observedAt)};return a("/api/internal/research/observe",r)}n(d,"postObservation");async function f(e){let r=0,i=0,s=[];for(let u of e)try{await d(u),r++}catch(t){i++;let p=t instanceof o?`HTTP ${t.statusCode}: ${t.message}`:String(t);s.length<5&&s.push(p)}return{posted:r,failed:i,errors:s}}n(f,"postObservations");export{d as a,f as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as E}from"./chunk-
|
|
1
|
+
import{g as E}from"./chunk-7BCZDVIU.js";import{b,e as y,f as k,h as M}from"./chunk-GIXHG5FK.js";import{a as u}from"./chunk-ZLLER3HP.js";var v=50,I=24e3,P=3,R=3,C=40,N=4e3,x=new Set(["fact","decision","correction","convention"]),L=`You are distilling DURABLE, PROJECT-SPECIFIC knowledge from an AI coding session so a future agent working on the SAME project starts smarter.
|
|
2
2
|
|
|
3
3
|
Extract ONLY facts / decisions / corrections / conventions that will STILL be true and useful in FUTURE sessions \u2014 architecture facts, deliberate design decisions, corrections of a wrong approach, or project conventions.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-DQYYHX6K.js";import{a as I}from"./chunk-RBSEE2Z6.js";import{a as w}from"./chunk-M7QSC64D.js";import{c as v,e as h}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-DQYYHX6K.js";import{a as I}from"./chunk-RBSEE2Z6.js";import{a as w}from"./chunk-M7QSC64D.js";import{c as v,e as h}from"./chunk-T47SFA5X.js";import{b as R}from"./chunk-SWSOEYC7.js";import{e as m}from"./chunk-GIXHG5FK.js";import{a as d}from"./chunk-ZLLER3HP.js";var T=6e5;async function P(e,$){let i=d(n=>$?.logger?.info?.(n)??console.log(n),"log"),{evalTargetId:r}=e,k=e.measurement?v(e):{},o=await m(`/api/eval-targets/${r}/judge-calibration`),l=!e.measurement||o.methodology?.measurement?.engine===e.measurement.engine&&o.methodology.measurement.model===e.measurement.model&&o.methodology.current===R(e.measurement.engine),a=I({powered:l&&o.powerCheck.powered,mde:l?o.powerCheck.mde??Number.POSITIVE_INFINITY:Number.POSITIVE_INFINITY},(l?o.caseDiscrimination:void 0)??{total:0,discriminating:0,nonDiscriminating:0,unpaired:0},{runsCompleted:0,maxRuns:e.maxRuns??24,batchesRun:0,maxBatches:1});if(a.action==="stop")return i(`[cron_eval_autorun] ${r}: ${a.reason}`),{skipped:a.code,reason:a.reason};let t=await m(`/api/eval-targets/${r}`);if(t.metadata?.autoRunEnabled===!1)return{skipped:"paused",reason:"Nightly measurement is off for this target."};let c=w(t);if(c)return i(`[cron_eval_autorun] ${r}: ${c.reason}`),c;let p=(await m(`/api/eval-targets/${r}/evals`)).filter(n=>!n.retiredAt);if(p.length===0)return{skipped:"no-live-cases"};let{completed:f,failed:b,results:N}=await h({cases:E(p,e.maxRuns??12),targetContent:t.content,concurrency:2,runNumber:Math.floor(Date.now()/1e3),opts:{targetId:r,targetVersion:t.version??1,iteration:1,timeout:e.timeout??T,model:e.model,graderModel:e.graderModel,graderEngine:e.graderEngine,...k,skipGrading:!1,targetType:t.type,targetName:t.name},onLog:i}),g={};for(let n of N){if(n.status!=="failed")continue;let s=n.failure?.kind??"unknown";g[s]=(g[s]??0)+1}let u=Object.entries(g).sort(([,n],[,s])=>s-n).map(([n,s])=>`${n}x${s}`).join(", ");return i(`[cron_eval_autorun] ${t.name}: ${f} completed, ${b} failed`+(u===""?"":` (${u})`)),{ranRuns:f,failedRuns:b,...u===""?{}:{failures:u},reason:a.reason}}d(P,"cronEvalAutorun");export{P as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,e as E}from"./chunk-
|
|
1
|
+
import{b as t,e as E}from"./chunk-3NWJ7CZ2.js";import{a as r}from"./chunk-ZLLER3HP.js";function s(o=10,_=t){for(let e=1;e<=o;e++)if(E(e,o,_).feasible)return e;return o}r(s,"minFeasibleLiveCases");var S=s(),A=3;export{s as a,S as b,A as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,d as m}from"./chunk-
|
|
1
|
+
import{a as d,d as m}from"./chunk-GIXHG5FK.js";import{a as c,l as a}from"./chunk-PZNWH4VQ.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as g,randomUUID as v}from"node:crypto";import{hostname as y,platform as p}from"node:os";import{existsSync as P,mkdirSync as _,readFileSync as h,writeFileSync as R}from"node:fs";import{join as E}from"node:path";var O="device-id";function u(){let e=o(t=>t==="1"||t==="true","off");return e(process.env.RULEMETRIC_NO_TELEMETRY)||e(process.env.DO_NOT_TRACK)}o(u,"telemetryDisabled");function l(){let e=a(),t=E(e,O);try{if(P(t)){let r=h(t,"utf-8").trim();if(r)return r}}catch{}let n=g("sha256").update(`${v()}:${y()}`).digest("hex").slice(0,32);try{_(e,{recursive:!0}),R(t,n,{mode:384})}catch{}return n}o(l,"getDeviceId");async function U(e,t={},n){if(!u())try{await m("/api/telemetry/cli-events",{method:"POST",body:{event:e,deviceId:l(),cliVersion:n,os:p(),props:t},timeoutMs:5e3})}catch{}}o(U,"emitSetupEvent");async function w(e){if(u())return;let n=`${process.env.RULEMETRIC_API_URL??c().apiUrl??d}/api/telemetry/cli-error`,r=process.env.HTTPS_PROXY,s=process.env.HTTP_PROXY,T=r!==void 0||s!==void 0;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let i=new AbortController,f=setTimeout(()=>i.abort(),4e3);try{await globalThis.fetch(n,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`rulemetric-cli/${e.cliVersion??"unknown"}`},body:JSON.stringify({event:e.event??"onboarding_error",deviceId:l(),command:e.command,statusCode:e.statusCode,message:e.message?e.message.slice(0,500):void 0,cliVersion:e.cliVersion,os:p(),nodeVersion:process.version,proxied:T,props:e.props}),signal:i.signal})}catch{}finally{clearTimeout(f),r!==void 0&&(process.env.HTTPS_PROXY=r),s!==void 0&&(process.env.HTTP_PROXY=s)}}o(w,"emitErrorBeacon");export{u as a,l as b,U as c,w as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{d as u}from"./chunk-
|
|
1
|
+
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{d as u}from"./chunk-WL5ZWQAS.js";import{a}from"./chunk-KEVDLLHT.js";import{a as n}from"./chunk-DX6IPDED.js";import{b as i}from"./chunk-GIXHG5FK.js";import{g as r}from"./chunk-PZNWH4VQ.js";import{a as s}from"./chunk-ZLLER3HP.js";import{Command as f,Flags as h}from"@oclif/core";function p(t){return t instanceof i?t.statusCode>=500||t.statusCode===408||t.statusCode===0:/fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|bad gateway|timed out/i.test(t.message??"")}s(p,"isAvailabilityError");var m=class extends f{static{s(this,"BaseCommand")}static baseFlags={"api-url":h.string({description:"Override API base URL",env:"RULEMETRIC_API_URL",hidden:!0})};async init(){await super.init();let{flags:e}=await this.parse(this.constructor);e["api-url"]&&(process.env.RULEMETRIC_API_URL=e["api-url"]);let o=d(this.config.version);o&&!this.argv.includes("--quiet")&&!process.env.RULEMETRIC_QUIET&&process.stderr.write(`
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
`),c();try{await a()}catch{}}requireAuth(){r()||this.error("Not logged in. Run `rulemetric auth login` to authenticate."),n()}async catch(e){throw p(e)&&await u({command:this.id,statusCode:e instanceof i?e.statusCode:void 0,message:e.message,cliVersion:this.config.version}),e instanceof i&&(e.statusCode===401&&this.error("Session expired. Run `rulemetric auth login` to re-authenticate."),this.error(e.message)),(e.message?.includes("fetch failed")||e.message?.includes("ECONNREFUSED"))&&this.error("Could not connect to the API server. Is it running?"),e}};export{m as a};
|