@rulemetric/cli 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +1 -1
- package/dist/chunk-355GZ7LR.js +1 -0
- package/dist/{chunk-V5XRGRJC.js → chunk-3737WF6X.js} +1 -1
- package/dist/chunk-3CX6YUEX.js +1 -0
- package/dist/chunk-3RN3LDUC.js +1 -0
- package/dist/{chunk-EJZGGT52.js → chunk-3TSZ77FB.js} +1 -1
- package/dist/chunk-3UKZJAFS.js +7 -0
- package/dist/chunk-3ZHVP3KE.js +1 -0
- package/dist/{chunk-R4SSIFKY.js → chunk-4MXLDBLV.js} +1 -1
- package/dist/{chunk-UT3EQR4C.js → chunk-4NAYH7VA.js} +1 -1
- package/dist/{chunk-SBFTRVZM.js → chunk-4QW5DQNL.js} +1 -1
- package/dist/{chunk-HWZTQXNM.js → chunk-76MON4SR.js} +1 -1
- package/dist/chunk-7EKHB3U7.js +1 -0
- package/dist/{chunk-KDFBKYXK.js → chunk-7FY23IMS.js} +1 -1
- package/dist/{chunk-MQ47NLPC.js → chunk-7H4HJ2RV.js} +1 -1
- package/dist/chunk-7HJJCRYK.js +1 -0
- package/dist/{chunk-AJN2BLMV.js → chunk-ADZ7HHCD.js} +1 -1
- package/dist/{chunk-LWUA3NUZ.js → chunk-BFDXMIXO.js} +1 -1
- package/dist/{chunk-FF5TAMDH.js → chunk-BTKKWYIU.js} +1 -1
- package/dist/{chunk-XVRQ5WUB.js → chunk-CQARFIJB.js} +1 -1
- package/dist/chunk-DS4P5C4F.js +48 -0
- package/dist/{chunk-BMDHPIW6.js → chunk-E2QYH6EF.js} +1 -1
- package/dist/{chunk-4PWGV2OW.js → chunk-E7BOAZ3X.js} +35 -20
- package/dist/chunk-E7XOYGL5.js +20 -0
- package/dist/{chunk-W4ZDAJ6S.js → chunk-FPOPUEA6.js} +1 -1
- package/dist/chunk-GAFMAVFO.js +1 -0
- package/dist/{chunk-RUIX6AZ6.js → chunk-GJKHHZSQ.js} +1 -1
- package/dist/{chunk-DN2T3FXN.js → chunk-GN3ZHQ46.js} +1 -1
- package/dist/{chunk-MPDSQALK.js → chunk-GP46IPK2.js} +1 -1
- package/dist/{chunk-FM4LTGMI.js → chunk-HNAVHRGY.js} +1 -1
- package/dist/chunk-HPN22ZIN.js +1 -0
- package/dist/{chunk-YWALNDT3.js → chunk-I2CXODLD.js} +1 -1
- package/dist/chunk-IEQDLURA.js +1 -0
- package/dist/chunk-IS4JRZK2.js +12 -0
- package/dist/{chunk-WOBFJCMO.js → chunk-IZHJNPER.js} +1 -1
- package/dist/{chunk-FAOSXPRO.js → chunk-JKXU7FAY.js} +1 -1
- package/dist/{chunk-OUXWBHCI.js → chunk-JPW4LP2O.js} +1 -1
- package/dist/{chunk-IPL2DHU4.js → chunk-KOQRNWIW.js} +1 -1
- package/dist/chunk-L6NQNVK2.js +3 -0
- package/dist/{chunk-BL4BN6RU.js → chunk-LB24UKHZ.js} +1 -1
- package/dist/chunk-LUCVMLHV.js +1 -0
- package/dist/chunk-M7QSC64D.js +1 -0
- package/dist/{chunk-YZNP4TW4.js → chunk-NEP5EWHJ.js} +1 -1
- package/dist/chunk-NIEP5G3T.js +13 -0
- package/dist/{chunk-IOV2BEW7.js → chunk-NNOSORNV.js} +1 -1
- package/dist/chunk-NQSB4YVT.js +1 -0
- package/dist/{chunk-SBJNQ5Q6.js → chunk-OASW7DOD.js} +1 -1
- package/dist/{chunk-SV7FDAKW.js → chunk-OJSWNU56.js} +1 -1
- package/dist/{chunk-RS4LSJI2.js → chunk-OZRUGBN5.js} +1 -1
- package/dist/chunk-QEKWPQDQ.js +2 -0
- package/dist/chunk-RBSEE2Z6.js +1 -0
- package/dist/{chunk-CLCRZWAG.js → chunk-RDXWQDNZ.js} +1 -1
- package/dist/{chunk-6QKI756T.js → chunk-RFISMWRW.js} +1 -1
- package/dist/chunk-RHVU6IFW.js +1 -0
- package/dist/chunk-SCBOQFZ4.js +16 -0
- package/dist/chunk-SDBQOHXY.js +1 -0
- package/dist/{chunk-ZXOAI65J.js → chunk-TGIUOJUB.js} +1 -1
- package/dist/chunk-UK5JOTMW.js +1 -0
- package/dist/chunk-UPFH72PF.js +2 -0
- package/dist/{chunk-7FWIIVMC.js → chunk-V3CAUY7M.js} +1 -1
- package/dist/{chunk-G5BXZT6F.js → chunk-VBXL7XO7.js} +1 -1
- package/dist/{chunk-R4W4QDTP.js → chunk-W54I75IW.js} +1 -1
- package/dist/{chunk-NPNSUG3N.js → chunk-X5WOTWT4.js} +1 -1
- package/dist/{chunk-JPUH3V67.js → chunk-XLVOAGSG.js} +3 -3
- package/dist/{chunk-RE7DDQ3O.js → chunk-Y3T5Q5CD.js} +1 -1
- package/dist/{chunk-W44E3DYZ.js → chunk-YE5ARPHO.js} +1 -1
- package/dist/chunk-ZL5LUOBZ.js +1 -0
- 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 +5 -6
- 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/dist-XEWF3R3N.js +1 -0
- 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/architecture/domain-layout.js +1 -0
- package/dist/lib/auto-run.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-conversation-handler.js +1 -1
- package/dist/lib/eval-grader.js +1 -1
- package/dist/lib/eval-resume.js +1 -1
- package/dist/lib/eval-run-batch.js +1 -1
- package/dist/lib/evolution-cost.js +1 -1
- package/dist/lib/evolution-enrolment.js +1 -1
- package/dist/lib/insights/generation/grading-transcript.js +1 -0
- package/dist/lib/insights/generation/installed-asks.js +1 -0
- package/dist/lib/insights/generation/prompts.js +1 -0
- package/dist/lib/insights/nomination/nominate.js +1 -0
- package/dist/lib/instruction-proposer.js +1 -1
- package/dist/lib/instructions/acceptance/accept-events.js +1 -0
- package/dist/lib/instructions/acceptance/accept-hook.js +1 -0
- package/dist/lib/instructions/acceptance/accept-types.js +0 -0
- package/dist/lib/instructions/acceptance/claude-md-blocks.js +1 -0
- package/dist/lib/instructions/acceptance/hook-install.js +1 -0
- package/dist/lib/instructions/acceptance/reverse-applications.js +1 -0
- package/dist/lib/instructions/acceptance/suggestion-accept.js +1 -0
- package/dist/lib/instructions/applications/render.js +1 -0
- package/dist/lib/instructions/applications/tagged-block.js +11 -0
- package/dist/lib/jobs/handlers/cron-auto-accept-suggestions.js +1 -0
- package/dist/lib/jobs/handlers/cron-eval-autorun.js +1 -0
- package/dist/lib/jobs/handlers/cron-instruction-evolution.js +1 -0
- package/dist/lib/jobs/handlers/cron-instruction-training.js +1 -0
- package/dist/lib/jobs/handlers/cron-refine-cases.js +1 -0
- package/dist/lib/jobs/handlers/cron-refresh-pricing.js +1 -0
- package/dist/lib/jobs/handlers/cron-refresh-skills.js +1 -0
- package/dist/lib/jobs/handlers/cron-retire-unused-skills.js +1 -0
- package/dist/lib/jobs/handlers/cron-suggest-instructions.js +1 -0
- package/dist/lib/jobs/handlers/distill-memories.js +1 -0
- package/dist/lib/jobs/handlers/process-changelog.js +1 -0
- package/dist/lib/jobs/handlers/process-conversation.js +1 -0
- package/dist/lib/jobs/handlers/process-eval.js +1 -0
- package/dist/lib/jobs/handlers/process-insights.js +1 -0
- package/dist/lib/jobs/handlers/process-judge-review.js +1 -0
- package/dist/lib/jobs/handlers/process-launch.js +1 -0
- package/dist/lib/jobs/handlers/process-memory-ab.js +1 -0
- package/dist/lib/jobs/handlers/process-run-cleanup.js +1 -0
- package/dist/lib/jobs/handlers/process-send-message.js +1 -0
- package/dist/lib/jobs/handlers/process-session-goal.js +1 -0
- package/dist/lib/judge-review-runner.js +1 -1
- package/dist/lib/manual-tasks.js +1 -1
- package/dist/lib/optimize-compare.js +1 -1
- package/dist/lib/projects/workspace/eval-workspace.js +1 -0
- package/dist/lib/projects/workspace/eval-worktree.js +1 -0
- package/dist/lib/projects/workspace/repo-artifacts.js +1 -0
- package/dist/lib/projects/workspace/sweep-eval-worktrees.js +1 -0
- package/dist/lib/projects/workspace/worktree.js +1 -0
- package/dist/lib/refine-cases.js +1 -0
- 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/skill-paths.js +1 -1
- package/dist/lib/skill-retirement.js +1 -0
- package/dist/lib/target-anchor.js +1 -0
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/terminal-target-heartbeat.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +8 -6
- package/dist/chunk-35KBN23A.js +0 -1
- package/dist/chunk-7DFNBRLY.js +0 -61
- package/dist/chunk-AC2NUNFC.js +0 -1
- package/dist/chunk-BMN2WZM2.js +0 -1
- package/dist/chunk-CJRYYV76.js +0 -1
- package/dist/chunk-E4U6AOTM.js +0 -46
- package/dist/chunk-FOUGYDLH.js +0 -11
- package/dist/chunk-GL3ZDOKJ.js +0 -1
- package/dist/chunk-LZO6YBUW.js +0 -2
- package/dist/chunk-PK6PSCIP.js +0 -1
- package/dist/chunk-RZTVYUX4.js +0 -11
- package/dist/chunk-XK52UAFB.js +0 -17
- package/dist/dist-FAVALJ5C.js +0 -1
- package/dist/lib/claude-md-blocks.js +0 -1
- package/dist/lib/eval-workspace.js +0 -1
- package/dist/lib/eval-worktree.js +0 -1
- package/dist/lib/handlers/cron-auto-accept-suggestions.js +0 -1
- package/dist/lib/handlers/cron-eval-autorun.js +0 -1
- package/dist/lib/handlers/cron-instruction-evolution.js +0 -1
- package/dist/lib/handlers/cron-instruction-training.js +0 -1
- package/dist/lib/handlers/cron-refresh-pricing.js +0 -1
- package/dist/lib/handlers/cron-refresh-skills.js +0 -1
- package/dist/lib/handlers/cron-suggest-instructions.js +0 -1
- package/dist/lib/handlers/distill-memories.js +0 -1
- package/dist/lib/handlers/process-changelog.js +0 -1
- package/dist/lib/handlers/process-conversation.js +0 -1
- package/dist/lib/handlers/process-eval.js +0 -1
- package/dist/lib/handlers/process-insights.js +0 -1
- package/dist/lib/handlers/process-judge-review.js +0 -1
- package/dist/lib/handlers/process-launch.js +0 -1
- package/dist/lib/handlers/process-memory-ab.js +0 -1
- package/dist/lib/handlers/process-run-cleanup.js +0 -1
- package/dist/lib/handlers/process-send-message.js +0 -1
- package/dist/lib/handlers/process-session-goal.js +0 -1
- package/dist/lib/insights-prompts.js +0 -1
- package/dist/lib/repo-artifacts.js +0 -1
- package/dist/lib/suggestion-accept.js +0 -1
- package/dist/lib/worktree.js +0 -1
- /package/dist/{chunk-UGIUIZ2V.js → chunk-5INUF4A4.js} +0 -0
- /package/dist/{chunk-FK73GD2X.js → chunk-LJRE3LZ2.js} +0 -0
- /package/dist/{chunk-UF6US7VU.js → chunk-PZS55PW2.js} +0 -0
- /package/dist/{chunk-Z72VHGV7.js → chunk-U2NT5OSQ.js} +0 -0
- /package/dist/{chunk-RSKQRVPJ.js → chunk-ZYGBABMZ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as D,c as j}from"./chunk-6UEFCMR2.js";import{b as B,c as R,d as N,e as z}from"./chunk-NTKO4H2K.js";import{a as G}from"./chunk-
|
|
1
|
+
import{b as D,c as j}from"./chunk-6UEFCMR2.js";import{b as B,c as R,d as N,e as z}from"./chunk-NTKO4H2K.js";import{a as G}from"./chunk-XLVOAGSG.js";import{c as J}from"./chunk-XRTZU7IZ.js";import{e as f,g as T}from"./chunk-GP46IPK2.js";import{a as p}from"./chunk-ZLLER3HP.js";function W(r,a,s){return s?r.reviewerModel===s||r.reviewerModel===`${a}:${s}`:r.reviewerEngine===a}p(W,"reviewMatchesReviewer");var C=100;function Z(r){let a=new Set;return r.forEach((s,d)=>{s.method!=="deterministic"&&a.add(d)}),a}p(Z,"llmExpectationIndexes");var w=class extends Error{constructor(s,d){super(d);this.reason=s}static{p(this,"JudgeReviewSkip")}};async function oe(r){let a=r.log??(()=>{}),s=r.warn??a,d=r.targetId,K=r.parallel??3,U=r.timeoutMs??12e4,v=await f(`/api/eval-targets/${d}`),u=(await f(`/api/eval-targets/${d}/annotations?limit=500`)).filter(e=>e.judgeMethod==="llm");if(u.length===0)throw new w("no-labels",`No human labels on "${v.name}" yet \u2014 label some runs in the Review tab first.`);let n;try{n=z({engineFlag:r.engineFlag??"auto",modelFlag:r.modelFlag,availability:N(),judgeModels:[...new Set(u.map(e=>e.judgeModel).filter(e=>e!=null))]})}catch(e){throw new w("no-engine",e instanceof Error?e.message:String(e))}a(`Reviewer: ${n.rationale}`);let c=0,b=u;if(r.skipReviewed){let e=await f(`/api/eval-targets/${d}/judge-reviews`),t=new Set(e.filter(i=>W(i,n.engine,r.modelFlag)).map(i=>`${i.evalRunId}:${i.expectationIndex}`));if(b=u.filter(i=>!t.has(`${i.evalRunId}:${i.expectationIndex}`)),c=u.length-b.length,b.length===0)return{targetName:v.name,reviewer:n,judgeModels:[],reviewerModel:n.model??`${n.engine} (CLI default)`,report:j([],0),persisted:0,alreadyReviewed:c,deferredPartialRuns:0}}let y=new Map;for(let e=0;;e+=C){let t=await f(`/api/eval-targets/${d}/runs?limit=${C}&offset=${e}`);for(let i of t)y.set(i.id,i);if(t.length<C)break}let q=await f(`/api/eval-targets/${d}/evals`),X=new Map(q.map(e=>[e.id,e.prompt])),o=new Map;for(let e of b){let t=o.get(e.evalRunId)??[];t.push(e),o.set(e.evalRunId,t)}let P=new Map;for(let e of u){let t=P.get(e.evalRunId)??new Set;t.add(e.expectationIndex),P.set(e.evalRunId,t)}let x=0;for(let[e]of[...o]){let t=y.get(e)?.grading?.expectations;if(!t)continue;let i=Z(t),g=P.get(e)??new Set;[...i].every(h=>g.has(h))||(o.delete(e),x+=1)}if(x>0&&a(`${x} partially-labeled run(s) deferred \u2014 a run is re-graded once, after all its assertions are labeled.`),o.size===0)return{targetName:v.name,reviewer:n,judgeModels:[],reviewerModel:n.model??`${n.engine} (CLI default)`,report:j([],0),persisted:0,alreadyReviewed:c,deferredPartialRuns:x};if(n.engine==="codex"&&n.model){let e=await J({prompt:"Reply with exactly: OK",model:n.model,timeout:6e4});if(e.error&&B(e.error)){if(n.model===R)throw new w("preflight-failed",`Codex fallback model ${R} is also unrunnable: ${e.error}`);s(`Your codex model "${n.model}" can't run on the installed CLI/account \u2014 falling back to ${R}.`),n={...n,model:R}}else if(e.error)throw new w("preflight-failed",`Codex preflight failed: ${e.error}`)}let S=[...o.values()].flat(),Y=[...new Set(S.map(e=>e.judgeModel).filter(e=>e!=null))];a(`Re-grading ${o.size} annotated run(s) / ${S.length} assertion(s) on "${v.name}"`+(c?` (${c} already reviewed \u2014 skipped)`:"")+".");let $=[],I=0,k=new Set,m=r.limit!=null?[...o.entries()].slice(0,Math.max(1,r.limit)):[...o.entries()];m.length<o.size&&a(`Sampling ${m.length} of ${o.size} annotated runs (limit).`);let H=0,Q=p(async()=>{for(;;){let e=H++;if(e>=m.length)return;let[t,i]=m[e],g=y.get(t),h=g?.grading?.expectations,O=g?.outputs?.transcript,F=g?X.get(g.evalId):void 0;if(!g||!h?.length||!O||!F){I+=i.length,s(`run ${t.slice(0,8)}: missing output/expectations/prompt \u2014 skipped`);continue}let M=await G({prompt:F,output:O,expectations:h.map(l=>l.text),model:n.model??void 0,timeout:U,engine:n.engine});M.judge_model&&k.add(M.judge_model);for(let l of i){let L=h[l.expectationIndex],A=M.expectations[l.expectationIndex];if(!L||!A||L.text!==l.expectationText){I+=1;continue}if(M.judge_model==null&&A.method==="llm"){I+=1;continue}$.push({runId:t,expectationIndex:l.expectationIndex,text:l.expectationText,humanPassed:D(l.verdict,l.judgePassed),judgeAPassed:l.judgePassed,judgeBPassed:A.passed})}a(` ${e+1}/${m.length} re-graded`)}},"workerFn");await Promise.all(Array.from({length:Math.max(1,Math.min(K,m.length))},Q));let V=j($,I),_=[...k][0]??n.model??`${n.engine} (CLI default)`,E=0;if($.length>0)try{E=(await T(`/api/eval-targets/${d}/judge-reviews`,{reviewerEngine:n.engine,reviewerModel:_,verdicts:$.map(t=>({evalRunId:t.runId,expectationIndex:t.expectationIndex,expectationText:t.text,judgePassed:t.judgeAPassed,humanPassed:t.humanPassed,reviewerPassed:t.judgeBPassed}))})).upserted,a(`Persisted ${E} reviewer verdict(s) \u2014 disagreements appear on the Review tab.`)}catch(e){s(`Could not persist reviewer verdicts: ${e instanceof Error?e.message:e}`)}return{targetName:v.name,reviewer:n,judgeModels:Y,reviewerModel:_,report:V,persisted:E,alreadyReviewed:c,deferredPartialRuns:x}}p(oe,"runJudgeReviewPass");export{W as a,Z as b,w as c,oe as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as n,c as a,d as g}from"./chunk-3AV3GTMP.js";import{e as o}from"./chunk-
|
|
1
|
+
import{a as s,b as n,c as a,d as g}from"./chunk-3AV3GTMP.js";import{e as o}from"./chunk-GP46IPK2.js";import{a as e}from"./chunk-ZLLER3HP.js";var i=!1;async function c(){if(process.env.RULEMETRIC_ORG_ID)return;let r=s();if(!(r&&!g(r)))try{let t=await o("/api/profile");if(!t.activeOrgId){a();return}if(r&&t.activeOrgId===r.orgId){n({orgId:r.orgId,orgSlug:r.orgSlug,syncedAt:Date.now()});return}let d=(await o("/api/orgs")).find(l=>l.id===t.activeOrgId);n({orgId:t.activeOrgId,orgSlug:d?.slug,syncedAt:Date.now()})}catch{}}e(c,"syncActiveOrgFromServer");async function p(){i||(i=!0,await c())}e(p,"maybeRefreshActiveOrg");async function v(){i=!0,await c()}e(v,"bootstrapActiveOrg");function O(){i=!1}e(O,"_resetRefreshAttempt");export{p as a,v as b,O as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as $}from"./chunk-CNOD6HWU.js";import{a as C}from"./chunk-AFYZYXQ3.js";import{a as y}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-CNOD6HWU.js";import{a as C}from"./chunk-AFYZYXQ3.js";import{a as y}from"./chunk-XLVOAGSG.js";import{d as f}from"./chunk-TZA4HAVF.js";import{e as h,f as w}from"./chunk-GP46IPK2.js";import{a as v}from"./chunk-ZLLER3HP.js";async function N(n,i,p){let{conversationId:a,messageId:g,messageContent:r}=n,o=await h(`/api/eval-targets/${i}`),c=await h(`/api/eval-targets/${i}/evals`),e=await h(`/api/eval-conversations/${a}/messages`),t=e.findIndex(l=>l.id===g);if(t>=0&&e.slice(t+1).some(u=>u.role==="assistant"&&(u.type==="results"||u.type==="proposal"||u.type==="generated"||u.type==="text"))){p(`Message ${g} already processed \u2014 skipping (idempotency guard)`);return}let s=v(async(l,u,m)=>{await w(`/api/eval-conversations/${a}/messages/assistant`,{content:l,type:u,data:m})},"postMessage"),d=await _(o,c,e,r,p);p(`Action: ${d.action}`);try{switch(d.action){case"run_evals":await x(o,c,a,s,p);break;case"generate_cases":await k(o,i,a,s,p);break;case"analyze_results":case"propose_changes":await E(o,c,e,r,a,s,p);break;case"respond":await s(d.response,"text");break}}catch(l){let u=l instanceof Error?l.message:String(l);throw await s(`Something went wrong: ${u}`,"text").catch(()=>{}),l}}v(N,"processConversationJob");async function _(n,i,p,a,g){let r=p.slice(-10).map(e=>`${e.role}: ${e.content.slice(0,200)}`).join(`
|
|
2
2
|
`),o=`You are an eval assistant. Decide what action to take based on the user's message.
|
|
3
3
|
|
|
4
4
|
## Current State
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{f as k,k as b}from"./chunk-3QXRLIGC.js";import{l as v,r as f,t as y}from"./chunk-DS4P5C4F.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as D}from"node:crypto";import{existsSync as d,readFileSync as H,writeFileSync as O,mkdirSync as I}from"node:fs";import{delimiter as R,dirname as j,join as m,resolve as w}from"node:path";function P(e){return b(m(e,".claude"),!1)}o(P,"adoptedHookSettingsPath");function B(e){return D("sha256").update(e).digest("hex")}o(B,"sha256");function h(e){return B(d(e)?H(e,"utf-8"):"")}o(h,"fileHash");function x(e){if(!d(e))return{settings:{}};let t=H(e,"utf-8");try{let n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?{unreadable:!0}:{settings:n}}catch{return{unreadable:!0}}}o(x,"readSettings");function p(e,t){let n=e.hooks;if(!n||typeof n!="object")return[];let r=n[t];return Array.isArray(r)?r:[]}o(p,"hookBlocks");function A(e,t){return p(e,t).flatMap(n=>(n?.hooks??[]).map(r=>r?.command).filter(r=>typeof r=="string"))}o(A,"commandsFor");function W(e){let t=P(e.dir);if(!t.endsWith("settings.local.json"))return{status:"refused",reason:`refusing to write ${t}: adopted hooks are machine-local and only ever land in settings.local.json`};let n=x(t);if("unreadable"in n)return{status:"refused",reason:`${t} exists but is not readable as JSON. Nothing was written \u2014 installing would mean replacing a settings file this command could not read.`};let r=n.settings,s=y(e.spec.command,e.instructionId),a=h(t),l=o((g,S)=>({kind:"remove-hook-entry",file:f,event:e.spec.event,command:s,backupPath:S,hashAtWrite:g}),"inverseFor");if(A(r,e.spec.event).includes(s))return{status:"already-present",target:f,command:s,inverse:l(a,`${t}.bak`),beforeHash:a};let c={...e.spec.matcher?{matcher:e.spec.matcher}:{},hooks:[{type:"command",command:s}]},u=r.hooks&&typeof r.hooks=="object"?r.hooks:{};u[e.spec.event]=[...p(r,e.spec.event),c],r.hooks=u;let{backupPath:i}=k(t,r);return i||(i=`${t}.bak`,I(j(i),{recursive:!0}),O(i,`{}
|
|
2
|
+
`)),{status:"installed",target:f,command:s,inverse:l(h(t),i),beforeHash:a}}o(W,"installHook");function _(e){let t=w(e.dir,e.inverse.file);if(!d(t))return{removed:!1,drifted:!0,code:"file-missing",reason:`${e.inverse.file} no longer exists`};let n=x(t);if("unreadable"in n)return{removed:!1,drifted:!0,code:"unreadable",reason:`${e.inverse.file} is not readable as JSON; refusing to rewrite it`};let r=n.settings,s=h(t)!==e.inverse.hashAtWrite,a=A(r,e.inverse.event).filter(i=>i===e.inverse.command);if(a.length===0)return{removed:!1,drifted:s,code:"not-present",reason:"the recorded entry is no longer present \u2014 nothing to remove"};if(a.length>1)return{removed:!1,drifted:s,code:"ambiguous",reason:`${a.length} entries carry this exact command; refusing to guess which one this artifact installed`};let l=p(r,e.inverse.event).map(i=>({...i,hooks:(i?.hooks??[]).filter(g=>g?.command!==e.inverse.command)})).filter(i=>(i.hooks??[]).length>0),c=r.hooks;l.length===0?delete c[e.inverse.event]:c[e.inverse.event]=l,Object.keys(c).length===0&&delete r.hooks;let{backupPath:u}=k(t,r);return{removed:!0,drifted:s,backupPath:u}}o(_,"uninstallHook");function K(e){return(process.env.PATH??"").split(R).filter(Boolean).some(n=>d(m(n,e)))}o(K,"commandOnPath");function $(e,t){return d(m(e,".agents","skills",t))||d(m(e,".claude","skills",t))}o($,"skillInstalled");function z(e,t){let n={satisfied:[],missing:[],unverifiable:[]};for(let r of t){let s=v(r);if(!s)continue;let[a,...l]=s.split(":"),c=l.join(":").trim();if(!c){n.unverifiable.push(s);continue}a==="cmd"?(K(c)?n.satisfied:n.missing).push(s):a==="skill"?($(e,c)?n.satisfied:n.missing).push(s):a==="file"?(d(w(e,c))?n.satisfied:n.missing).push(s):n.unverifiable.push(s)}return n}o(z,"checkDependencies");export{P as a,W as b,_ as c,z as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./chunk-ZLLER3HP.js";var o=i(n=>Number.isFinite(n)?`\xB1${Math.round(n*100)}pp`:"unknown (no runs yet)","mdePp");function d(n,t,e,a={}){let r=a.targetEffectPp??20,c=a.materialFraction??.5,m=a.minBatchesBeforeRefineGate??2;if(n.powered)return{action:"stop",code:"powered",reason:`powered \u2014 MDE ${o(n.mde)} \u2264 \xB1${r}pp target effect`};if(e.batchesRun>=m&&t.total>0){let s=t.nonDiscriminating+t.unpaired;if(s/t.total>=c)return{action:"stop",code:"needs-refine",reason:`${s}/${t.total} cases don't discriminate \u2014 more runs can't lower the MDE; run \`evals refine-cases\` to cull + regenerate, then auto-run again`}}if(e.runsCompleted>=e.maxRuns||e.batchesRun>=e.maxBatches)return{action:"stop",code:"budget",reason:`budget reached (${e.runsCompleted}/${e.maxRuns} runs, ${e.batchesRun}/${e.maxBatches} batches); MDE ${o(n.mde)} still > \xB1${r}pp \u2014 raise --max-runs or accept the current precision`};let p=Number.isFinite(n.mde)&&n.mde<=r/100,u=`(${e.runsCompleted}/${e.maxRuns} runs so far)`;return{action:"run",code:"continue",reason:p?`MDE ${o(n.mde)} is under \xB1${r}pp but the sample is too thin to trust it \u2014 running another batch ${u}`:`MDE ${o(n.mde)} > \xB1${r}pp \u2014 running another batch ${u}`}}i(d,"decideAutoRunStep");export{d as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,d as m}from"./chunk-
|
|
1
|
+
import{a as d,d as m}from"./chunk-GP46IPK2.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,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{w}from"./chunk-E7XOYGL5.js";import{a as m}from"./chunk-N7ODX6PO.js";import{a as s}from"./chunk-ZLLER3HP.js";import{spawn as g}from"node:child_process";import d from"node:fs";import b from"node:path";function c(e,t){return new Promise((r,n)=>{let o=g("git",e,{cwd:t,stdio:["ignore","pipe","pipe"],env:m()}),i="",f="";o.stdout.on("data",a=>{i+=a.toString()}),o.stderr.on("data",a=>{f+=a.toString()}),o.on("error",a=>n(new Error(`git ${e.join(" ")} failed to spawn: ${a.message}`))),o.on("close",a=>{a===0?r({code:a,stdout:i,stderr:f}):n(new Error(`git ${e.join(" ")} exited ${a}: ${f.trim()||i.trim()}`))})})}s(c,"runGit");async function k(e,t){if(!t||!t.trim())throw new Error('invalid branch name "": branch must be a non-empty git refname');if(t.startsWith("-"))throw new Error(`invalid branch name "${t}": must not start with "-" (git would parse it as an option)`);if(/\s/.test(t))throw new Error(`invalid branch name "${t}": must not contain whitespace`);try{await c(["check-ref-format","--branch",t],e)}catch{throw new Error(`invalid branch name "${t}": not a valid git refname`)}}s(k,"assertValidBranch");function h(e){let t=b.resolve(e);try{return d.realpathSync(t)}catch{return t}}s(h,"canonical");function y(e){let t=[],r=null;for(let n of e.split(`
|
|
2
2
|
`))n.startsWith("worktree ")?(r&&t.push(r),r={path:n.slice(9).trim()}):n.startsWith("branch ")&&r&&(r.branch=n.slice(7).trim().replace(/^refs\/heads\//,""));return r&&t.push(r),t}s(y,"parseWorktreeList");async function v(e,t){try{return await c(["show-ref","--verify","--quiet",`refs/heads/${t}`],e),!0}catch{return!1}}s(v,"branchExists");async function B(e){let{repoRoot:t,branch:r,baseRef:n,allowExistingBranch:o=!1}=e;await k(t,r);let i=w({repoRoot:t,branch:r,basePath:e.basePath}),f=await c(["worktree","list","--porcelain"],t),a=y(f.stdout),p=a.find(u=>u.branch===r);if(p)return{path:h(p.path),branch:r,created:!1};let l=a.find(u=>h(u.path)===i);if(l)return{path:h(l.path),branch:l.branch??r,created:!1};if(await v(t,r)){if(!o)throw new Error(`branch "${r}" already exists with no worktree; refusing to clobber (pass allowExistingBranch:true to attach a worktree onto it)`);return await c(["worktree","add",i,r],t),{path:h(i),branch:r,created:!0}}return await c(["worktree","add",i,"-b",r,n],t),{path:h(i),branch:r,created:!0}}s(B,"ensureWorktree");async function S(e){let{repoRoot:t,worktreePath:r}=e;if(!d.existsSync(r))return{removed:!1,reason:"absent"};let n=!1;try{n=(await c(["status","--porcelain"],r)).stdout.trim().length>0}catch{n=!1}if(n)return{removed:!1,reason:"dirty"};try{return await c(["worktree","remove",r],t),{removed:!0}}catch(o){let i=o instanceof Error?o.message:String(o);if(/not a working tree|No such file or directory|not a valid path|is not a working tree/i.test(i))return{removed:!1,reason:"absent"};throw o}}s(S,"removeWorktree");export{c as a,B as b,S as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as t,e as E}from"./chunk-7EKHB3U7.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};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{g as E}from"./chunk-B3BHB26P.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
|
+
`):" (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
|
+
`)}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
|
+
`)}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(`
|
|
5
|
+
`)}r(P,"buildProposerData");function T(e,t,o){let n=e.lastIndexOf(o);if(n<0)return null;let i=e.lastIndexOf(t,n);return i<0?null:e.slice(i+t.length,n)}r(T,"between");function A(e){let t=e.split(`
|
|
6
|
+
`);for(;t.length>0&&t[0].trim()==="";)t.shift();for(;t.length>0&&t[t.length-1].trim()==="";)t.pop();if(t.length<2)return t.join(`
|
|
7
|
+
`);let o=t[0].trim(),n=t[t.length-1].trim(),i=/^(`{3,}|~{3,})[a-zA-Z0-9_-]*$/.test(o),s=/^(`{3,}|~{3,})$/.test(n);return i&&s?t.slice(1,-1).join(`
|
|
8
|
+
`):t.join(`
|
|
9
|
+
`)}r(A,"stripWrappingFence");function w(e,t){if(!e||e.trim()==="")return{ok:!1,reason:"proposer returned nothing"};let o=T(e,u,p);if(o==null)return{ok:!1,reason:`proposer reply had no ${u}\u2026${p} block`};let n=A(o).split(`
|
|
10
|
+
`).filter(a=>{let l=a.trim();return l!==g&&l!==m}).join(`
|
|
11
|
+
`).trim();if(n==="")return{ok:!1,reason:"proposed content was empty"};if(n===t.trim())return{ok:!1,reason:"proposal is identical to the current version"};let i=n.length/Math.max(1,t.trim().length);if(i<d)return{ok:!1,reason:`proposal retains only ${(i*100).toFixed(0)}% of the predecessor's length (floor ${(d*100).toFixed(0)}%) \u2014 treating it as a truncated or summarised reply rather than an edit`};if(i>f)return{ok:!1,reason:`proposal is ${i.toFixed(1)}x the predecessor's length (ceiling ${f}x) \u2014 treating it as runaway generation`};let s=(T(e,b,R)??"").trim();return{ok:!0,proposal:{candidateContent:n,rationale:s===""?"(proposer supplied no rationale)":s}}}r(w,"parseProposalResponse");async function x(e,t=16e3,o=E){let n=y(e),i=P(e),s=await o(n,i,t);if(s==null)return{ok:!1,reason:"no LLM backend available, or the proposer call failed"};let a=w(s,e.currentContent);if(a.ok||!N(a.reason))return a;let l=await o(n,`${i}
|
|
12
|
+
|
|
13
|
+
## YOUR PREVIOUS ATTEMPT WAS DISCARDED
|
|
14
|
+
|
|
15
|
+
- ${a.reason}
|
|
16
|
+
Produce the proposal again, within the stated length bounds.`,t);if(l==null)return a;let c=w(l,e.currentContent);return c.ok?c:{ok:!1,reason:`${c.reason} (after one retry: ${a.reason})`}}r(x,"proposeInstructionEdit");function N(e){return e.includes("retains only")||e.includes("runaway generation")}r(N,"isLengthBoundFailure");export{g as a,m as b,d as c,f as d,y as e,O as f,P as g,w as h,x as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as K}from"./chunk-BFDXMIXO.js";import{b as G}from"./chunk-IEQDLURA.js";import{a as W}from"./chunk-X5WOTWT4.js";import{b as L}from"./chunk-NEP5EWHJ.js";import{a as D}from"./chunk-3TSZ77FB.js";import{a as V}from"./chunk-I2CXODLD.js";import{a as P}from"./chunk-ZYGBABMZ.js";import{a as x}from"./chunk-JPW4LP2O.js";import{a as y}from"./chunk-PZS55PW2.js";import{a as U}from"./chunk-3CX6YUEX.js";import{e as S}from"./chunk-W54I75IW.js";import{b as C}from"./chunk-GJKHHZSQ.js";import{a as N}from"./chunk-4QW5DQNL.js";import{a as T}from"./chunk-3737WF6X.js";import{a as M}from"./chunk-NIEP5G3T.js";import{b as R}from"./chunk-5RBLIVBF.js";import{a as $}from"./chunk-GAFMAVFO.js";import{a as O}from"./chunk-ZL5LUOBZ.js";import{a as F}from"./chunk-FPOPUEA6.js";import{a as J}from"./chunk-HPN22ZIN.js";import{a as B}from"./chunk-CQARFIJB.js";import{l as H}from"./chunk-7EKHB3U7.js";import{d as A}from"./chunk-NTKO4H2K.js";import{b as E,e as I,f as _}from"./chunk-GP46IPK2.js";import{a}from"./chunk-ZLLER3HP.js";var Z={process_eval:T,process_insights:M,process_launch:L,process_send_message:P,process_conversation:N,process_session_goal:x,distill_memories:C,memory_ab:D,process_run_cleanup:V,cron_refine_cases:J,cron_retire_unused_skills:U,cron_suggest_instructions:S,cron_refresh_skills:y,cron_refresh_pricing:B,cron_eval_autorun:O,cron_auto_accept_suggestions:$,cron_instruction_training:F,cron_instruction_evolution:H,process_judge_review:W},q=Object.keys(Z),ee=new Set([]);function ne(e=process.env){return e.DATABASE_URL?q:q.filter(n=>!ee.has(n))}a(ne,"availableCapabilities");var re=3e4,te=3e4,oe=3e4,Q=500,X=1e4,se=`thin-agent-${process.pid}`,b=null;function ae(e,n,r,c){let i;try{let u=A();i={claude:u.claudeBin!=null,codex:u.codexBin!=null,codexModel:u.codexConfiguredModel}}catch{}let m=a(u=>{_("/api/workers/heartbeat",{workerType:"cli-worker",clientName:se,clientVersion:c,workerVersion:"0.1.0",currentJobId:null,inFlightCount:0,lastError:null,status:u,metadata:{capabilities:e,mode:"thin-agent",llmEngines:i}}).then(d=>{let l=d?.advisory;l&&l.message!==b?(b=l.message,s(r,{event:"worker_advisory",code:l.code,message:l.message})):l||(b=null)}).catch(d=>{s(r,{event:"presence_heartbeat_error",error:d instanceof Error?d.message:String(d)})})},"send");m("alive");let o=setInterval(()=>m("alive"),oe);n.addEventListener("abort",()=>{clearInterval(o),m("shutting_down")},{once:!0})}a(ae,"startPresenceHeartbeat");function s(e,n){try{e(JSON.stringify({ts:new Date().toISOString(),...n}))}catch{e(`[agent-loop] log_error event=${n.event}`)}}a(s,"structuredLog");function Y(e,n){return n.aborted?Promise.resolve(!1):e<=0?Promise.resolve(!0):new Promise(r=>{let c=setTimeout(()=>{n.removeEventListener("abort",i),r(!0)},e),i=a(()=>{clearTimeout(c),n.removeEventListener("abort",i),r(!1)},"onAbort");n.addEventListener("abort",i,{once:!0})})}a(Y,"abortableSleep");async function ie(e,n){let r=`capabilities=${encodeURIComponent(e.join(","))}&waitMs=${n}`,c=await I(`/api/work/next?${r}`);return c==null||typeof c=="string"?null:c}a(ie,"pollForWork");function le(e,n){return{logger:{info:a(r=>n(r),"info"),warn:a(r=>n(r),"warn"),error:a(r=>n(r),"error")},job:{attempts:e}}}a(le,"makeHelpers");async function ce(e,n,r){let c=Z[e.kind],i=Date.now();if(s(r,{event:"claim",jobId:e.id,kind:e.kind,attempts:e.attempts}),!c){let o=`unknown kind: ${e.kind}`;s(r,{event:"fail",jobId:e.id,kind:e.kind,terminal:!0,error:o}),await _(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:o,terminal:!0}).catch(()=>{});return}let m=setInterval(()=>{s(r,{event:"heartbeat",jobId:e.id}),_(`/api/work/${e.id}/heartbeat`,{leaseToken:e.leaseToken}).catch(o=>{s(r,{event:"heartbeat_error",jobId:e.id,error:o instanceof Error?o.message:String(o)})})},n);try{let o=le(e.attempts,r),u=await c(e.payload,o)??{};clearInterval(m),s(r,{event:"complete",jobId:e.id,kind:e.kind,durationMs:Date.now()-i}),await _(`/api/work/${e.id}/complete`,{leaseToken:e.leaseToken,result:u})}catch(o){clearInterval(m);let u=R(o),d=o instanceof Error?o.message:String(o);s(r,{event:"fail",jobId:e.id,kind:e.kind,durationMs:Date.now()-i,terminal:u,error:d}),await _(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:d,terminal:u}).catch(l=>{s(r,{event:"fail_post_error",jobId:e.id,error:l instanceof Error?l.message:String(l)})})}}a(ce,"runOne");var z=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"]);async function Ce(e){let n=e.log??(()=>{}),r=e.pollWaitMs??re,c=e.heartbeatIntervalMs??te,i=e.capabilities??ne();s(n,{event:"agent_start",capabilities:i,pollWaitMs:r,heartbeatIntervalMs:c});try{let t=G();t.removed.length>0&&s(n,{event:"eval_worktrees_swept",removed:t.removed.length})}catch(t){s(n,{event:"eval_worktree_sweep_failed",error:t instanceof Error?t.message:String(t)})}ae(i,e.signal,n,e.version),K({signal:e.signal,log:n}).catch(t=>{s(n,{event:"tt_heartbeat_fatal",error:t instanceof Error?t.message:String(t)})});let m=5*6e4,o=0,u=a(()=>{if(!e.readInstalledVersion||!e.version)return!1;let t=Date.now();if(t-o<m)return!1;o=t;let f=e.readInstalledVersion();return!!(f&&f!==e.version)},"versionDrifted"),d=new AbortController,l=d.signal;e.signal.aborted?d.abort():e.signal.addEventListener("abort",()=>d.abort(),{once:!0});let v=a(async(t,f)=>{let g=Q;for(;!l.aborted;){if(u()){s(n,{event:"agent_version_drift",bootVersion:e.version,installedVersion:e.readInstalledVersion?.()??null}),d.abort(),e.onVersionDrift?.();break}let h=null;try{h=await ie([...f],r)}catch(p){let j=p instanceof E?p.statusCode:void 0;if(s(n,{event:"poll_error",lane:t,status:j,error:p instanceof Error?p.message:String(p)}),!await Y(g,l))break;g=Math.min(g*2,X);continue}if(!h){if(s(n,{event:"poll_204",lane:t}),!await Y(g,l))break;g=Math.min(g*2,X);continue}g=Q,await ce(h,c,n)}},"runLane"),k=i.filter(t=>z.has(t)),w=i.filter(t=>!z.has(t));k.length>0&&w.length>0?(s(n,{event:"agent_lanes",heavy:k.length,fast:w.length}),await Promise.all([v("heavy",k),v("fast",w)])):await v("single",i),s(n,{event:"agent_stop"})}a(Ce,"runAgentLoop");export{Z as a,q as b,ne as c,ie as d,Ce as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as d}from"./chunk-QWCEZEDO.js";import{d as g}from"./chunk-NTKO4H2K.js";import{a as R,g as v,h as T,j as I,m as C}from"./chunk-3QXRLIGC.js";import{e as _}from"./chunk-GP46IPK2.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(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as u}from"./chunk-GP46IPK2.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-ZLLER3HP.js";import*as r from"node:fs";import*as o from"node:path";import g from"gray-matter";var k=".agents/skills",p=".claude/skills",f=64,d=1024;function y(t){return(t??"").replace(/^skills--/,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,f).replace(/-+$/,"")||"skill"}a(y,"skillDirName");function b(t){let i=[];return t||i.push("name is required"),t.length>f&&i.push(`name exceeds ${f} characters`),/[^a-z0-9-]/.test(t)&&i.push("name may only contain lowercase letters, digits and hyphens"),/^-|-$/.test(t)&&i.push("name must not start or end with a hyphen"),t.includes("--")&&i.push("name must not contain consecutive hyphens"),i}a(b,"validateSkillName");function h(t){let i=t.trim();return!i||/^[#>|<]|^```|^~~~/.test(i)||/^!?\[[^\]]*\]\s*(\([^)]*\))?$/.test(i)||!/[A-Za-z]{3}/.test(i)?"":i}a(h,"usableDescription");function S(t){let i=!1;for(let n of t.split(`
|
|
2
|
+
`)){let e=n.trim();if(!e)continue;if(e.startsWith("```")||e.startsWith("~~~")){i=!i;continue}if(i||/^[#>|<-]|^---/.test(e))continue;let s=e.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[*+]\s+/,"").replace(/[*_`]/g,"").trim();if(!(s.length<20)&&s.includes(" ")&&/[A-Za-z]{3}/.test(s))return s}return""}a(S,"firstMeaningfulLine");function w(t){let i=[],n={},e=t.content,s=!1;try{let c=g(t.content);s=t.content.trimStart().startsWith("---")&&Object.keys(c.data).length>0,s&&(n={...c.data},e=c.content)}catch{i.push("existing frontmatter was not valid YAML and was replaced")}typeof n.name=="string"&&n.name!==t.dirName&&i.push(`frontmatter name "${n.name}" renamed to "${t.dirName}" to match its directory`),n.name=t.dirName;let l=h(typeof n.description=="string"?n.description:"");if(l)l.length>d&&(n.description=l.slice(0,d),i.push(`description truncated to the ${d}-character spec limit`));else{let c=h(t.description??"")||S(e);c?(n.description=c.slice(0,d),i.push("description was missing and has been derived; agents match on it, so review it")):(n.description=`Skill: ${t.dirName}`,i.push("no description available \u2014 a placeholder was written, and this skill will rarely trigger until it is written properly"))}return{text:g.stringify(e,n),addedFrontmatter:!s,warnings:i}}a(w,"buildSkillFile");function L(t,i){let n=o.join(t,k,i),e=o.join(t,p,i);return{realDir:n,skillFile:o.join(n,"SKILL.md"),linkPath:e,linkTarget:o.relative(o.dirname(e),n)}}a(L,"skillTargets");function D(t){let i=y(t.name),n=L(t.dir,i),e=w({dirName:i,content:t.content,description:t.description}),s=[...e.warnings];r.mkdirSync(n.realDir,{recursive:!0}),r.writeFileSync(n.skillFile,e.text,"utf8"),r.mkdirSync(o.dirname(n.linkPath),{recursive:!0});let l=P(n.linkPath);if(l){if(l.isSymbolicLink()&&F(n.linkPath)===n.linkTarget)return{dirName:i,skillFile:n.skillFile,linkPath:n.linkPath,linkKind:"symlink",warnings:s};if(!t.force)return s.push(`${n.linkPath} already exists and was not written by this command \u2014 left as is. Re-run with --force to replace it.`),{dirName:i,skillFile:n.skillFile,linkPath:n.linkPath,linkKind:"none",warnings:s};r.rmSync(n.linkPath,{recursive:!0,force:!0})}let c=x(n);return s.push(...c.warnings),{dirName:i,skillFile:n.skillFile,linkPath:n.linkPath,linkKind:c.linkKind,warnings:s}}a(D,"writeSkill");function x(t,i=(n,e)=>r.symlinkSync(n,e,"dir")){try{return i(t.linkTarget,t.linkPath),{linkKind:"symlink",warnings:[]}}catch{return r.cpSync(t.realDir,t.linkPath,{recursive:!0}),{linkKind:"copy",warnings:[`symlink refused by this platform \u2014 wrote a copy to ${t.linkPath}. Re-install after editing the skill, or the two will drift.`]}}}a(x,"linkOrCopy");function P(t){try{return r.lstatSync(t)}catch{return null}}a(P,"lstatOrNull");function F(t){try{return r.readlinkSync(t)}catch{return null}}a(F,"safeReadlink");var m=[k,p];function K(t){let i=new Map;for(let n of m){let e=o.join(t,n),s;try{s=r.readdirSync(e,{withFileTypes:!0})}catch{continue}for(let l of s){if(!l.isDirectory()&&!l.isSymbolicLink())continue;let c=i.get(l.name);if(c&&c.content)continue;let u="";try{u=r.readFileSync(o.join(e,l.name,"SKILL.md"),"utf8")}catch{u=""}i.set(l.name,{name:l.name,content:u})}}return[...i.values()]}a(K,"readInstalledSkills");function N(t,i){for(let n of m){let e=o.join(t,n,i,"SKILL.md");if(r.existsSync(e))return e}return o.join(t,k,i,"SKILL.md")}a(N,"installedSkillPath");export{k as a,p as b,y as c,b as d,w as e,L as f,D as g,x as h,K as i,N as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-GP46IPK2.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{a as i}from"./chunk-ZLLER3HP.js";var _=1.959963984540054;function F(n,t,e=_){if(t===0)return{lower:0,upper:1};let o=n/t,r=e*e,c=1+r/t,l=(o+r/(2*t))/c,u=e/c*Math.sqrt(o*(1-o)/t+r/(4*t*t));return{lower:Math.max(0,l-u),upper:Math.min(1,l+u)}}i(F,"wilsonInterval");function O(n,t){let e=n,o=t,r=e+o;if(r===0)return{pValue:1,nDiscordant:0};let c=Math.min(e,o),l=Math.pow(.5,r),u=l;for(let s=1;s<=c;s++)l*=(r-s+1)/s,u+=l;return{pValue:Math.min(1,2*u),nDiscordant:r}}i(O,"mcnemarExact");function k(n,t,e=10){return{sufficient:n>=e&&t>=e,minN:e,nWith:n,nWithout:t,shortfall:{with:Math.max(0,e-n),without:Math.max(0,e-t)}}}i(k,"assessSufficiency");function M(n){let t=n>>>0;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}i(M,"seededRandom");function T(n,t){let e=n.length;if(e===1)return n[0];let o=(e-1)*t,r=Math.floor(o),c=Math.ceil(o);return r===c?n[r]:n[r]+(o-r)*(n[c]-n[r])}i(T,"sortedQuantile");function L(n,t={}){let e=n.length;if(e===0)return{estimate:0,lower:0,upper:0,iterations:0};let o=t.iterations??1e4,r=t.ciLevel??.95,c=M(t.seed??1),l=n.reduce((a,m)=>a+m,0)/e,u=new Array(o);for(let a=0;a<o;a++){let m=0;for(let h=0;h<e;h++)m+=n[c()*e|0];u[a]=m/e}u.sort((a,m)=>a-m);let s=(1-r)/2;return{estimate:l,lower:T(u,s),upper:T(u,1-s),iterations:o}}i(L,"pairedBootstrapCI");function U(n,t={}){let e=n.filter(d=>d.withScores.length>0&&d.withoutScores.length>0);if(e.length===0)return{estimate:0,lower:0,upper:0,pValue:1,iterations:0};let o=i(d=>d.reduce((p,g)=>p+g,0)/d.length,"mean"),r=e.map(d=>d.withScores.length*d.withoutScores.length/(d.withScores.length+d.withoutScores.length)),c=r.reduce((d,p)=>d+p,0),l=i(d=>d.reduce((p,g,w)=>p+r[w]*g,0)/c,"combine"),u=l(e.map(d=>o(d.withScores)-o(d.withoutScores))),s=t.iterations??1e4,a=t.ciLevel??.95,m=M(t.seed??1),h=new Array(s),S=0,A=0;for(let d=0;d<s;d++){let p=e.map(w=>{let $=0;for(let v=0;v<w.withScores.length;v++)$+=w.withScores[m()*w.withScores.length|0];let y=0;for(let v=0;v<w.withoutScores.length;v++)y+=w.withoutScores[m()*w.withoutScores.length|0];return $/w.withScores.length-y/w.withoutScores.length}),g=l(p);h[d]=g,g<=0&&S++,g>=0&&A++}h.sort((d,p)=>d-p);let b=(1-a)/2;return{estimate:u,lower:T(h,b),upper:T(h,1-b),pValue:Math.min(1,2*Math.min(S,A)/s),iterations:s}}i(U,"stratifiedBootstrapCI");function H(n,t){let e=n.length,o=t.length;if(e===0||o===0)return 0;let r=[...n.map(a=>({t:a,exposed:!0})),...t.map(a=>({t:a,exposed:!1}))].sort((a,m)=>a.t-m.t),c=0,l=0;for(;l<r.length;){let a=l;for(;a+1<r.length&&r[a+1].t===r[l].t;)a++;let m=(l+1+a+1)/2;for(let h=l;h<=a;h++)r[h].exposed&&(c+=m);l=a+1}let s=(c-e*(e+1)/2)/(e*o);return Math.abs(s-.5)}i(H,"cohortTimeSeparation");var C=.35,N=900*1e3;function j(n,t,e=C,o=N){if(n.length===0||t.length===0)return!1;let r=[...n,...t];return Math.max(...r)-Math.min(...r)<o?!1:H(n,t)>e}i(j,"isTimeSeparated");var G=i(n=>n===0||n===1,"isBinary");function J(n,t,e){return n.every(r=>r[t]!=null&&r[e]!=null)?n.reduce((r,c)=>r+(c[t]-c[e]),0)/n.length:null}i(J,"meanPairDelta");function W(n,t={}){let e=t.baseline??"no-rule",o=t.minN??10,r=n.length,c=n.map(d=>d.withScore-d.withoutScore),l=r===0?0:c.reduce((d,p)=>d+p,0)/r,u=L(c,{seed:t.seed,iterations:t.iterations}),s={lower:u.lower,upper:u.upper},a=n.every(d=>G(d.withScore)&&G(d.withoutScore)),m=null;if(a&&r>0){let d=0,p=0;for(let g of n)g.withScore===1&&g.withoutScore===0?d++:g.withScore===0&&g.withoutScore===1&&p++;m=O(d,p).pValue}let{sufficient:h}=k(r,r,o),S=s.lower>0||s.upper<0,b={mode:"controlled",baseline:e,delta:l,ci:s,pValue:m,significant:h&&S,sufficient:h,nWith:r,nWithout:r,costDelta:J(n,"withCost","withoutCost"),latencyDelta:J(n,"withLatency","withoutLatency"),confounded:!1};return h||(b.insufficientReason=`insufficient data: need >= ${o} paired tasks per cohort, have ${r}`),b}i(W,"buildControlledVerdict");var de=2;function z(n,t={}){let e=t.minN??10,o=t.minPerStratum??de,r=t.maxTimeSeparation??C,c=t.minStratumSpanMs??N,l=n.filter(f=>f.withScores.length>=o&&f.withoutScores.length>=o),u=l.filter(f=>f.withTimes!=null&&f.withoutTimes!=null&&j(f.withTimes,f.withoutTimes,r,c)),s=new Set(u.map(f=>f.key)),a=l.filter(f=>!s.has(f.key)),m=n.filter(f=>f.withScores.length>0&&f.withoutScores.length>0&&(f.withScores.length<o||f.withoutScores.length<o)).length,h=a.reduce((f,x)=>f+x.withScores.length,0),S=a.reduce((f,x)=>f+x.withoutScores.length,0),A=U(a,{seed:t.seed,iterations:t.iterations}),b={lower:A.lower,upper:A.upper},d=A.estimate,p=a.length>0&&h>=e&&S>=e,g=a.length>0?A.pValue:null,w=p&&(b.lower>0||b.upper<0),$=n.reduce((f,x)=>f+x.withScores.length+x.withoutScores.length,0),y=$>0?(h+S)/$:0,v={mode:"observational",baseline:t.baseline??"no-rule",delta:d,ci:b,pValue:g,significant:w,sufficient:p,nWith:h,nWithout:S,costDelta:null,latencyDelta:null,confounded:!0,strata:a.length,strataDroppedForTimeSeparation:u.length,coverage:y};if(!p){let f=m>0?` (${m} project(s) had both cohorts but fewer than ${o} sessions in one of them)`:"",x=u.length>0?` ${u.length} project-month(s) held both cohorts but their sessions are separated in time (exposure predicts when a session ran), so the difference within them is a calendar difference, not a treatment effect`:"";v.insufficientReason=a.length===0?u.length>0?`insufficient data: no comparable cohort.${x}${f}`:`insufficient data: no project has >= ${o} exposed AND >= ${o} unexposed sessions to compare within${f}`:`insufficient data: need >= ${e} sessions per cohort across comparable projects, have ${h} exposed / ${S} unexposed${f}${x?`.${x}`:""}`}return v}i(z,"buildStratifiedVerdict");function Q(n){let t=new Map;for(let e of n){let o=t.get(e.stratum);o||(o={key:e.stratum,withScores:[],withoutScores:[],withTimes:[],withoutTimes:[]},t.set(e.stratum,o)),(e.exposed?o.withScores:o.withoutScores).push(e.score),e.time!=null&&(e.exposed?o.withTimes:o.withoutTimes).push(e.time)}for(let e of t.values())(e.withTimes.length!==e.withScores.length||e.withoutTimes.length!==e.withoutScores.length)&&(delete e.withTimes,delete e.withoutTimes);return[...t.values()]}i(Q,"toStrata");var R=.05;function K(n,t={}){let e=t.trialIndex??0,o=t.seed??1,r=t.exposedFraction??.5,c=t.effect??0,l=M(o+e*2),u=n.map(s=>{let a=l()<r;return{stratum:s.stratum,score:a?s.score+c:s.score,exposed:a,time:s.time}});return z(Q(u),{seed:o+e*2+1,iterations:t.iterations??500,minN:t.minN,minPerStratum:t.minPerStratum})}i(K,"runCalibrationTrial");function q(n,t={}){let e=t.trials??200,o=[];for(let r=0;r<e;r++)o.push(K(n,{...t,trialIndex:r}));return D(o,t.effect??0)}i(q,"calibrate");function D(n,t){let e=0,o=0,r=0,c=0;for(let s of n)s.sufficient&&(e++,s.significant&&o++,r+=s.delta,c=Math.max(c,Math.abs(s.delta)));let l=e>0?o/e:0,u=F(o,e,_);return{trials:n.length,evaluated:e,insufficient:n.length-e,significantTrials:o,significantRate:l,significantRateCi:u,meanDelta:e>0?r/e:0,maxAbsDelta:c,alpha:R,effect:t,calibrated:t===0&&e>0&&u.lower<=R&&R<=u.upper}}i(D,"summarizeTrials");function I(n,t={}){return q(n,{...t,effect:0})}i(I,"aaCalibration");function Y(n,t,e={}){return q(n,{...e,effect:t})}i(Y,"powerCheck");var he=.8416212335729143;var te=[{ym:"2026-03",n:122,mean:.287},{ym:"2026-04",n:50,mean:.07},{ym:"2026-05",n:267,mean:.089},{ym:"2026-06",n:61,mean:.201},{ym:"2026-07",n:162,mean:.071}],B=662;function Z(n=2){let t=[];for(let e of te){let o=Math.round(e.n*e.mean);for(let r=0;r<e.n;r++)t.push({stratum:`proj-${r%n}|${e.ym}`,score:r<o?1:0})}if(n===2&&t.length!==B)throw new Error(`realisticCanaryCorpus: expected ${B} sessions, built ${t.length}`);return t}i(Z,"realisticCanaryCorpus");function ne(n=600){return Array.from({length:n},(t,e)=>({stratum:"only",score:e%4===0?1:0}))}i(ne,"flatCanaryCorpus");var oe=50,re=4,P={min:.2,max:.7};function me(n,t){let e=M(t),o=P.max-P.min;return Array.from({length:n},()=>P.min+e()*o)}i(me,"caseDifficulties");function ee(n,t,e){let o=0;for(let r=0;r<t;r++)e()<n&&o++;return o/t}i(ee,"passRate");function ie(n={}){let t=n.trialIndex??0,e=n.seed??1,o=n.cases??oe,r=n.assertions??re,c=n.effect??0,l=me(o,e),u=M(e+t*2),s=l.map(a=>({withScore:ee(a+c,r,u),withoutScore:ee(a,r,u)}));return W(s,{baseline:"prior-version",seed:e+t*2+1,iterations:n.iterations??500,minN:n.minN})}i(ie,"runControlledCalibrationTrial");function X(n={}){let t=n.trials??200,e=[];for(let o=0;o<t;o++)e.push(ie({...n,trialIndex:o}));return D(e,n.effect??0)}i(X,"controlledCalibration");function ae(n={}){return X({...n,effect:0})}i(ae,"controlledAaCalibration");function se(n,t={}){return X({...t,effect:n})}i(se,"controlledPowerCheck");var ce={maxSignificantRate:.15,maxMeanAbsDelta:.02,maxWorstCaseDelta:.15,powerProbeEffect:.2,minPower:.9,minPowerMeanDelta:.15};function E(n,t,e){let o=e.filter(r=>!r.ok).map(r=>r.why);return{name:n,passed:o.length===0,detail:o.length===0?`${n}: ok (rate=${t.significantRate.toFixed(3)}, meanDelta=${t.meanDelta.toFixed(4)}, evaluated=${t.evaluated}/${t.trials})`:`${n}: ${o.join("; ")}`,result:t}}i(E,"check");function pe(n={}){let t=n.trials??200,e=n.powerTrials??200,o=ce,r=[],c=I(ne(),{trials:t,seed:11});r.push(E("aa-flat",c,[{ok:c.calibrated,why:`\u03B1=${R} outside rate CI [${c.significantRateCi.lower.toFixed(3)}, ${c.significantRateCi.upper.toFixed(3)}]`},{ok:c.significantRate<o.maxSignificantRate,why:`false-positive rate ${c.significantRate.toFixed(3)} \u2265 ${o.maxSignificantRate}`},{ok:Math.abs(c.meanDelta)<o.maxMeanAbsDelta,why:`mean delta ${c.meanDelta.toFixed(4)} not centred on zero`}]));let l=I(Z(),{trials:t,seed:23});r.push(E("aa-realistic",l,[{ok:l.calibrated,why:`\u03B1=${R} outside rate CI [${l.significantRateCi.lower.toFixed(3)}, ${l.significantRateCi.upper.toFixed(3)}]`},{ok:l.significantRate<o.maxSignificantRate,why:`false-positive rate ${l.significantRate.toFixed(3)} \u2265 ${o.maxSignificantRate}`},{ok:Math.abs(l.meanDelta)<o.maxMeanAbsDelta,why:`mean delta ${l.meanDelta.toFixed(4)} not centred on zero`},{ok:l.maxAbsDelta<o.maxWorstCaseDelta,why:`worst single-trial delta ${l.maxAbsDelta.toFixed(3)} \u2265 ${o.maxWorstCaseDelta}`}]));let u=Y(Z(),o.powerProbeEffect,{trials:e,seed:5});r.push(E("power-observational",u,[{ok:u.significantRate>o.minPower,why:`detects +${o.powerProbeEffect} only ${u.significantRate.toFixed(3)} of the time`},{ok:u.meanDelta>o.minPowerMeanDelta,why:`measured mean delta ${u.meanDelta.toFixed(3)} understates the injected +${o.powerProbeEffect}`}]));let s=ae({trials:t,seed:31});r.push(E("aa-controlled",s,[{ok:s.calibrated,why:`\u03B1=${R} outside rate CI [${s.significantRateCi.lower.toFixed(3)}, ${s.significantRateCi.upper.toFixed(3)}]`},{ok:s.significantRate<o.maxSignificantRate,why:`false-positive rate ${s.significantRate.toFixed(3)} \u2265 ${o.maxSignificantRate}`},{ok:Math.abs(s.meanDelta)<o.maxMeanAbsDelta,why:`mean delta ${s.meanDelta.toFixed(4)} not centred on zero`}]));let a=se(o.powerProbeEffect,{trials:e,seed:37});r.push(E("power-controlled",a,[{ok:a.significantRate>o.minPower,why:`detects +${o.powerProbeEffect} only ${a.significantRate.toFixed(3)} of the time`}]));let m=r.filter(h=>!h.passed).map(h=>h.detail);return{green:m.length===0,checks:r,failures:m}}i(pe,"runPromotionCanary");var we=3,xe=7;export{_ as a,W as b,he as c,pe as d,we as e,xe as f};
|
|
1
|
+
import{a as i}from"./chunk-ZLLER3HP.js";var _=1.959963984540054;function F(n,t,e=_){if(t===0)return{lower:0,upper:1};let o=n/t,r=e*e,c=1+r/t,l=(o+r/(2*t))/c,u=e/c*Math.sqrt(o*(1-o)/t+r/(4*t*t));return{lower:Math.max(0,l-u),upper:Math.min(1,l+u)}}i(F,"wilsonInterval");function O(n,t){let e=n,o=t,r=e+o;if(r===0)return{pValue:1,nDiscordant:0};let c=Math.min(e,o),l=Math.pow(.5,r),u=l;for(let s=1;s<=c;s++)l*=(r-s+1)/s,u+=l;return{pValue:Math.min(1,2*u),nDiscordant:r}}i(O,"mcnemarExact");function k(n,t,e=10){return{sufficient:n>=e&&t>=e,minN:e,nWith:n,nWithout:t,shortfall:{with:Math.max(0,e-n),without:Math.max(0,e-t)}}}i(k,"assessSufficiency");function M(n){let t=n>>>0;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}i(M,"seededRandom");function T(n,t){let e=n.length;if(e===1)return n[0];let o=(e-1)*t,r=Math.floor(o),c=Math.ceil(o);return r===c?n[r]:n[r]+(o-r)*(n[c]-n[r])}i(T,"sortedQuantile");function L(n,t={}){let e=n.length;if(e===0)return{estimate:0,lower:0,upper:0,iterations:0};let o=t.iterations??1e4,r=t.ciLevel??.95,c=M(t.seed??1),l=n.reduce((a,m)=>a+m,0)/e,u=new Array(o);for(let a=0;a<o;a++){let m=0;for(let h=0;h<e;h++)m+=n[c()*e|0];u[a]=m/e}u.sort((a,m)=>a-m);let s=(1-r)/2;return{estimate:l,lower:T(u,s),upper:T(u,1-s),iterations:o}}i(L,"pairedBootstrapCI");function U(n,t={}){let e=n.filter(d=>d.withScores.length>0&&d.withoutScores.length>0);if(e.length===0)return{estimate:0,lower:0,upper:0,pValue:1,iterations:0};let o=i(d=>d.reduce((p,g)=>p+g,0)/d.length,"mean"),r=e.map(d=>d.withScores.length*d.withoutScores.length/(d.withScores.length+d.withoutScores.length)),c=r.reduce((d,p)=>d+p,0),l=i(d=>d.reduce((p,g,w)=>p+r[w]*g,0)/c,"combine"),u=l(e.map(d=>o(d.withScores)-o(d.withoutScores))),s=t.iterations??1e4,a=t.ciLevel??.95,m=M(t.seed??1),h=new Array(s),b=0,A=0;for(let d=0;d<s;d++){let p=e.map(w=>{let $=0;for(let v=0;v<w.withScores.length;v++)$+=w.withScores[m()*w.withScores.length|0];let y=0;for(let v=0;v<w.withoutScores.length;v++)y+=w.withoutScores[m()*w.withoutScores.length|0];return $/w.withScores.length-y/w.withoutScores.length}),g=l(p);h[d]=g,g<=0&&b++,g>=0&&A++}h.sort((d,p)=>d-p);let S=(1-a)/2;return{estimate:u,lower:T(h,S),upper:T(h,1-S),pValue:Math.min(1,2*Math.min(b,A)/s),iterations:s}}i(U,"stratifiedBootstrapCI");function H(n,t){let e=n.length,o=t.length;if(e===0||o===0)return 0;let r=[...n.map(a=>({t:a,exposed:!0})),...t.map(a=>({t:a,exposed:!1}))].sort((a,m)=>a.t-m.t),c=0,l=0;for(;l<r.length;){let a=l;for(;a+1<r.length&&r[a+1].t===r[l].t;)a++;let m=(l+1+a+1)/2;for(let h=l;h<=a;h++)r[h].exposed&&(c+=m);l=a+1}let s=(c-e*(e+1)/2)/(e*o);return Math.abs(s-.5)}i(H,"cohortTimeSeparation");var C=.35,N=900*1e3;function j(n,t,e=C,o=N){if(n.length===0||t.length===0)return!1;let r=[...n,...t];return Math.max(...r)-Math.min(...r)<o?!1:H(n,t)>e}i(j,"isTimeSeparated");var G=i(n=>n===0||n===1,"isBinary");function J(n,t,e){return n.every(r=>r[t]!=null&&r[e]!=null)?n.reduce((r,c)=>r+(c[t]-c[e]),0)/n.length:null}i(J,"meanPairDelta");function W(n,t={}){let e=t.baseline??"no-rule",o=t.minN??10,r=n.length,c=n.map(d=>d.withScore-d.withoutScore),l=r===0?0:c.reduce((d,p)=>d+p,0)/r,u=L(c,{seed:t.seed,iterations:t.iterations}),s={lower:u.lower,upper:u.upper},a=n.every(d=>G(d.withScore)&&G(d.withoutScore)),m=null;if(a&&r>0){let d=0,p=0;for(let g of n)g.withScore===1&&g.withoutScore===0?d++:g.withScore===0&&g.withoutScore===1&&p++;m=O(d,p).pValue}let{sufficient:h}=k(r,r,o),b=s.lower>0||s.upper<0,S={mode:"controlled",baseline:e,delta:l,ci:s,pValue:m,significant:h&&b,sufficient:h,nWith:r,nWithout:r,costDelta:J(n,"withCost","withoutCost"),latencyDelta:J(n,"withLatency","withoutLatency"),confounded:!1};return h||(S.insufficientReason=`insufficient data: need >= ${o} paired tasks per cohort, have ${r}`),S}i(W,"buildControlledVerdict");var de=2;function z(n,t={}){let e=t.minN??10,o=t.minPerStratum??de,r=t.maxTimeSeparation??C,c=t.minStratumSpanMs??N,l=n.filter(f=>f.withScores.length>=o&&f.withoutScores.length>=o),u=l.filter(f=>f.withTimes!=null&&f.withoutTimes!=null&&j(f.withTimes,f.withoutTimes,r,c)),s=new Set(u.map(f=>f.key)),a=l.filter(f=>!s.has(f.key)),m=n.filter(f=>f.withScores.length>0&&f.withoutScores.length>0&&(f.withScores.length<o||f.withoutScores.length<o)).length,h=a.reduce((f,x)=>f+x.withScores.length,0),b=a.reduce((f,x)=>f+x.withoutScores.length,0),A=U(a,{seed:t.seed,iterations:t.iterations}),S={lower:A.lower,upper:A.upper},d=A.estimate,p=a.length>0&&h>=e&&b>=e,g=a.length>0?A.pValue:null,w=p&&(S.lower>0||S.upper<0),$=n.reduce((f,x)=>f+x.withScores.length+x.withoutScores.length,0),y=$>0?(h+b)/$:0,v={mode:"observational",baseline:t.baseline??"no-rule",delta:d,ci:S,pValue:g,significant:w,sufficient:p,nWith:h,nWithout:b,costDelta:null,latencyDelta:null,confounded:!0,strata:a.length,strataDroppedForTimeSeparation:u.length,coverage:y};if(!p){let f=m>0?` (${m} project(s) had both cohorts but fewer than ${o} sessions in one of them)`:"",x=u.length>0?` ${u.length} project-month(s) held both cohorts but their sessions are separated in time (exposure predicts when a session ran), so the difference within them is a calendar difference, not a treatment effect`:"";v.insufficientReason=a.length===0?u.length>0?`insufficient data: no comparable cohort.${x}${f}`:`insufficient data: no project has >= ${o} exposed AND >= ${o} unexposed sessions to compare within${f}`:`insufficient data: need >= ${e} sessions per cohort across comparable projects, have ${h} exposed / ${b} unexposed${f}${x?`.${x}`:""}`}return v}i(z,"buildStratifiedVerdict");function Q(n){let t=new Map;for(let e of n){let o=t.get(e.stratum);o||(o={key:e.stratum,withScores:[],withoutScores:[],withTimes:[],withoutTimes:[]},t.set(e.stratum,o)),(e.exposed?o.withScores:o.withoutScores).push(e.score),e.time!=null&&(e.exposed?o.withTimes:o.withoutTimes).push(e.time)}for(let e of t.values())(e.withTimes.length!==e.withScores.length||e.withoutTimes.length!==e.withoutScores.length)&&(delete e.withTimes,delete e.withoutTimes);return[...t.values()]}i(Q,"toStrata");var R=.05;function K(n,t={}){let e=t.trialIndex??0,o=t.seed??1,r=t.exposedFraction??.5,c=t.effect??0,l=M(o+e*2),u=n.map(s=>{let a=l()<r;return{stratum:s.stratum,score:a?s.score+c:s.score,exposed:a,time:s.time}});return z(Q(u),{seed:o+e*2+1,iterations:t.iterations??500,minN:t.minN,minPerStratum:t.minPerStratum})}i(K,"runCalibrationTrial");function q(n,t={}){let e=t.trials??200,o=[];for(let r=0;r<e;r++)o.push(K(n,{...t,trialIndex:r}));return D(o,t.effect??0)}i(q,"calibrate");function D(n,t){let e=0,o=0,r=0,c=0;for(let s of n)s.sufficient&&(e++,s.significant&&o++,r+=s.delta,c=Math.max(c,Math.abs(s.delta)));let l=e>0?o/e:0,u=F(o,e,_);return{trials:n.length,evaluated:e,insufficient:n.length-e,significantTrials:o,significantRate:l,significantRateCi:u,meanDelta:e>0?r/e:0,maxAbsDelta:c,alpha:R,effect:t,calibrated:t===0&&e>0&&u.lower<=R&&R<=u.upper}}i(D,"summarizeTrials");function I(n,t={}){return q(n,{...t,effect:0})}i(I,"aaCalibration");function Y(n,t,e={}){return q(n,{...e,effect:t})}i(Y,"powerCheck");var he=.8416212335729143;var te=[{ym:"2026-03",n:122,mean:.287},{ym:"2026-04",n:50,mean:.07},{ym:"2026-05",n:267,mean:.089},{ym:"2026-06",n:61,mean:.201},{ym:"2026-07",n:162,mean:.071}],B=662;function Z(n=2){let t=[];for(let e of te){let o=Math.round(e.n*e.mean);for(let r=0;r<e.n;r++)t.push({stratum:`proj-${r%n}|${e.ym}`,score:r<o?1:0})}if(n===2&&t.length!==B)throw new Error(`realisticCanaryCorpus: expected ${B} sessions, built ${t.length}`);return t}i(Z,"realisticCanaryCorpus");function ne(n=600){return Array.from({length:n},(t,e)=>({stratum:"only",score:e%4===0?1:0}))}i(ne,"flatCanaryCorpus");var oe=50,re=4,P={min:.2,max:.7};function me(n,t){let e=M(t),o=P.max-P.min;return Array.from({length:n},()=>P.min+e()*o)}i(me,"caseDifficulties");function ee(n,t,e){let o=0;for(let r=0;r<t;r++)e()<n&&o++;return o/t}i(ee,"passRate");function ie(n={}){let t=n.trialIndex??0,e=n.seed??1,o=n.cases??oe,r=n.assertions??re,c=n.effect??0,l=me(o,e),u=M(e+t*2),s=l.map(a=>({withScore:ee(a+c,r,u),withoutScore:ee(a,r,u)}));return W(s,{baseline:"prior-version",seed:e+t*2+1,iterations:n.iterations??500,minN:n.minN})}i(ie,"runControlledCalibrationTrial");function X(n={}){let t=n.trials??200,e=[];for(let o=0;o<t;o++)e.push(ie({...n,trialIndex:o}));return D(e,n.effect??0)}i(X,"controlledCalibration");function ae(n={}){return X({...n,effect:0})}i(ae,"controlledAaCalibration");function se(n,t={}){return X({...t,effect:n})}i(se,"controlledPowerCheck");var ce={maxSignificantRate:.15,maxMeanAbsDelta:.02,maxWorstCaseDelta:.15,powerProbeEffect:.2,minPower:.9,minPowerMeanDelta:.15};function E(n,t,e){let o=e.filter(r=>!r.ok).map(r=>r.why);return{name:n,passed:o.length===0,detail:o.length===0?`${n}: ok (rate=${t.significantRate.toFixed(3)}, meanDelta=${t.meanDelta.toFixed(4)}, evaluated=${t.evaluated}/${t.trials})`:`${n}: ${o.join("; ")}`,result:t}}i(E,"check");function pe(n={}){let t=n.trials??200,e=n.powerTrials??200,o=ce,r=[],c=I(ne(),{trials:t,seed:11});r.push(E("aa-flat",c,[{ok:c.calibrated,why:`\u03B1=${R} outside rate CI [${c.significantRateCi.lower.toFixed(3)}, ${c.significantRateCi.upper.toFixed(3)}]`},{ok:c.significantRate<o.maxSignificantRate,why:`false-positive rate ${c.significantRate.toFixed(3)} \u2265 ${o.maxSignificantRate}`},{ok:Math.abs(c.meanDelta)<o.maxMeanAbsDelta,why:`mean delta ${c.meanDelta.toFixed(4)} not centred on zero`}]));let l=I(Z(),{trials:t,seed:23});r.push(E("aa-realistic",l,[{ok:l.calibrated,why:`\u03B1=${R} outside rate CI [${l.significantRateCi.lower.toFixed(3)}, ${l.significantRateCi.upper.toFixed(3)}]`},{ok:l.significantRate<o.maxSignificantRate,why:`false-positive rate ${l.significantRate.toFixed(3)} \u2265 ${o.maxSignificantRate}`},{ok:Math.abs(l.meanDelta)<o.maxMeanAbsDelta,why:`mean delta ${l.meanDelta.toFixed(4)} not centred on zero`},{ok:l.maxAbsDelta<o.maxWorstCaseDelta,why:`worst single-trial delta ${l.maxAbsDelta.toFixed(3)} \u2265 ${o.maxWorstCaseDelta}`}]));let u=Y(Z(),o.powerProbeEffect,{trials:e,seed:5});r.push(E("power-observational",u,[{ok:u.significantRate>o.minPower,why:`detects +${o.powerProbeEffect} only ${u.significantRate.toFixed(3)} of the time`},{ok:u.meanDelta>o.minPowerMeanDelta,why:`measured mean delta ${u.meanDelta.toFixed(3)} understates the injected +${o.powerProbeEffect}`}]));let s=ae({trials:t,seed:31});r.push(E("aa-controlled",s,[{ok:s.calibrated,why:`\u03B1=${R} outside rate CI [${s.significantRateCi.lower.toFixed(3)}, ${s.significantRateCi.upper.toFixed(3)}]`},{ok:s.significantRate<o.maxSignificantRate,why:`false-positive rate ${s.significantRate.toFixed(3)} \u2265 ${o.maxSignificantRate}`},{ok:Math.abs(s.meanDelta)<o.maxMeanAbsDelta,why:`mean delta ${s.meanDelta.toFixed(4)} not centred on zero`}]));let a=se(o.powerProbeEffect,{trials:e,seed:37});r.push(E("power-controlled",a,[{ok:a.significantRate>o.minPower,why:`detects +${o.powerProbeEffect} only ${a.significantRate.toFixed(3)} of the time`}]));let m=r.filter(h=>!h.passed).map(h=>h.detail);return{green:m.length===0,checks:r,failures:m}}i(pe,"runPromotionCanary");var we=3,xe=7;export{_ as a,W as b,he as c,pe as d,we as e,xe as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as D}from"./chunk-HOQPVOMF.js";import{b as B}from"./chunk-GIRPEMTW.js";import{a as T}from"./chunk-MODXEGCU.js";import{d as U,f as J}from"./chunk-B3BHB26P.js";import{e as w,f as R}from"./chunk-
|
|
1
|
+
import{c as D}from"./chunk-HOQPVOMF.js";import{b as B}from"./chunk-GIRPEMTW.js";import{a as T}from"./chunk-MODXEGCU.js";import{d as U,f as J}from"./chunk-B3BHB26P.js";import{e as w,f as R}from"./chunk-GP46IPK2.js";import{b as G,c as H}from"./chunk-DS4P5C4F.js";import{a as u}from"./chunk-ZLLER3HP.js";import{readFileSync as Y,realpathSync as X}from"node:fs";import y from"node:path";import O from"node:os";function q(s){let o=y.resolve(s);if(o===y.resolve(O.homedir()))return!1;let a=y.parse(o).root;if(o===a)return!1;try{let n=X(O.tmpdir());if(X(o)===n)return!1}catch{}return!0}u(q,"isScorableProjectPath");var Q=5,Z=Number(process.env.RULEMETRIC_MAX_SUGGESTION_PROJECTS??10),tt=48,et=.5,x=400,ot=3,nt=.6,rt=1;function st(s){let o=s.bloated??[],a=new Set([...s.harmful.map(n=>n.id),...s.candidates.map(n=>n.id)]);return o.filter(n=>!a.has(n.id)).slice(0,rt).map(n=>({instructionId:n.id,estimatedTokens:n.estimatedTokens,topProjectId:n.topProjectId??null,score:.55,reason:`Costs ~${n.estimatedTokens} tokens every session and measures neutral across ${n.exposures} exposed session(s) \u2014 enough data to detect an effect, and none found. Consider shortening "${n.name}" rather than removing it.`+(n.containsSafetyLanguage?" CAUTION: it contains guardrail language (destructive-command or credential rules) \u2014 preserve those lines when shortening.":"")}))}u(st,"buildTrimProposals");async function at(s,o,a){let n=[],i=0;for(let d of s)try{await a("/api/instruction-experiments",{instructionId:d.instructionId,projectPath:o,source:"groom"}),i++}catch(g){let m=g instanceof Error?g.message:String(g);n.push({...d,reason:`${d.reason} (not measurable by withholding: ${m})`})}return{nominated:i,unmeasurable:n}}u(at,"nominateRemovals");function it(s){let o=[];for(let n of s.harmful){let i=n.verdict.delta;o.push({instructionId:n.id,score:Math.min(.95,.75+Math.abs(i)),topProjectId:n.topProjectId??null,reason:`Measured harmful: sessions using "${n.name}" scored ${(i*100).toFixed(1)}pp worse across ${n.exposures} exposed session(s). Observational \u2014 review before archiving.`})}let a=new Set(s.harmful.map(n=>n.id));for(let n of s.candidates)a.has(n.id)||o.push({instructionId:n.id,score:nt,topProjectId:n.topProjectId??null,reason:`Unused: "${n.name}" is ${n.reason} (${n.totalExposures} lifetime exposure(s)) but still costs context budget every session.`});return o.slice(0,ot)}u(it,"buildRemovalProposals");async function ct(){let s=y.join(O.homedir(),".config","rulemetric","skills-registry.json");try{let o=Y(s,"utf-8"),a=JSON.parse(o);return Date.now()-new Date(a.generatedAt).getTime()>tt*60*60*1e3}catch{return!0}}u(ct,"checkSkillsRegistryStale");var wt=u(async(s,o)=>{let a=U(),n=a!=="none";n?o.logger.info(`Scoring backend: ${a}`):o.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="+Z)).projectPaths}catch(t){o.logger.warn(`Failed to fetch project paths: ${t instanceof Error?t.message:String(t)}`);return}if(i.length===0){o.logger.info("No recent project paths; nothing to score");return}let d=new Map;try{let t=await w("/api/projects?limit=200");for(let e of t.projects??[])e.primaryCheckoutPath&&d.set(T(e.primaryCheckoutPath),e.id)}catch(t){o.logger.warn(`Failed to fetch projects for id resolution: ${t instanceof Error?t.message:String(t)}`)}let g=new Map;try{let t=await w(`/api/catalog?limit=200&contentPreview=${x}`);for(let e of t)g.set(e.id,{id:e.id,name:e.name,description:e.description??"",tags:e.tags??[],contentPreview:(e.contentPreview??"").slice(0,x)})}catch(t){o.logger.warn(`Failed to fetch catalog: ${t instanceof Error?t.message:String(t)}`)}try{let t=await w("/api/instructions?limit=100");for(let e of t.instructions??[])g.has(e.id)||g.set(e.id,{id:e.id,name:e.name,description:e.description??"",tags:e.tags??[],contentPreview:(e.content??"").slice(0,x)})}catch(t){o.logger.warn(`Failed to fetch personal instructions: ${t instanceof Error?t.message:String(t)}`)}let m=[],p=[];try{let t=await w("/api/insights/groom-candidates");if(!t.captureHealthy)o.logger.info(`Grooming paused: ${t.reason??"capture unhealthy"}`);else{m=it(t),p=st(t);let e=t.safetyGuarded+t.harmfulSafetyGuarded;o.logger.info(`Removal proposals: ${m.length} (${t.harmful.length} measured-harmful, ${t.candidates.length} never-used, ${e} withheld by the safety allowlist); trim proposals: ${p.length} (${(t.bloated??[]).length} measured-neutral and expensive, ${t.trimSafetyFlagged??0} flagged as containing guardrail language)`)}}catch(t){o.logger.warn(`Failed to fetch groom candidates: ${t instanceof Error?t.message:String(t)}`)}let I=[...g.values()];if(I.length===0&&m.length===0&&p.length===0){o.logger.info("No candidate instructions and nothing to retire; nothing to score");return}o.logger.info(`Scoring ${I.length} candidates across ${i.length} project(s)`);let M=0,l=null,$=new Set;for(let t of i)try{let e=T(t);if(!q(e)){o.logger.info(`Skipping ${e}: not a project directory (home/root)`);continue}let f=B(e),S=n&&f.length>0;f.length===0&&o.logger.info(`${e}: insufficient language signals; removal/trim only`);let v=D(e),V={name:y.basename(e),description:v.description,languages:f,topics:v.topics,dependencies:v.dependencies},k=S?H(I):[];S&&o.logger.info(`Scoring ${I.length} candidates for ${e} in ${k.length} batch(es)`);let E=[],b=0;for(let r of k)try{let c=await J(G(V,r),"",4096);if(!c){b++;continue}let _=c.recommendations??[];for(let P of _)typeof P.instructionId=="string"&&typeof P.score=="number"&&typeof P.reason=="string"&&E.push({instructionId:P.instructionId,score:P.score,reason:P.reason})}catch(c){b++,o.logger.warn(`Batch failed for ${e}: ${c instanceof Error?c.message:String(c)}`)}b>0&&o.logger.warn(`${b}/${k.length} batch(es) failed for ${e} (backend ${a}); suggestions are partial`),S&&E.length===0&&o.logger.warn(`No usable LLM output for ${e} (backend ${a})`);let z=E.filter(r=>r.score>=et).sort((r,c)=>c.score-r.score).slice(0,Q),C=d.get(e),K=l===null||l===e;l===null&&(l=e);let A=u(r=>r.topProjectId?r.topProjectId===C:K,"placeHere"),L=m.filter(A),{nominated:N,unmeasurable:F}=await at(L,e,R);N>0&&o.logger.info(`${e}: ${N} removal candidate(s) nominated for randomised withholding instead of the feed`);let h=[...z.map(r=>({instructionId:r.instructionId,score:r.score,reason:r.reason,kind:"add"})),...F.map(({topProjectId:r,...c})=>({...c,kind:"remove"})),...p.filter(A).map(({estimatedTokens:r,topProjectId:c,..._})=>({..._,kind:"trim"}))];if(h.length===0){o.logger.info(`Nothing to suggest for ${e}`);continue}await R("/api/instruction-suggestions/batch-upsert",{projectPath:e,...C?{projectId:C}:{},suggestions:h}),o.logger.info(`${e}: ${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"&&$.add(r.instructionId);let W=new Set(F.map(r=>r.instructionId));for(let r of L)W.has(r.instructionId)||$.add(r.instructionId);M++}catch(e){o.logger.warn(`Failed to score ${t}: ${e instanceof Error?e.message:String(e)}`)}let j=[...m.filter(t=>!$.has(t.instructionId)),...p.filter(t=>!$.has(t.instructionId)).map(({estimatedTokens:t,...e})=>e)];if(j.length>0&&l)try{let t=new Set(p.map(e=>e.instructionId));await R("/api/instruction-suggestions/batch-upsert",{projectPath:l,...d.get(l)?{projectId:d.get(l)}:{},suggestions:j.map(({topProjectId:e,...f})=>({...f,kind:t.has(f.instructionId)?"trim":"remove"}))}),o.logger.info(`Orphan sweep: ${j.length} proposal(s) whose project was not scored this run placed on ${l}`)}catch(t){o.logger.warn(`Orphan sweep failed: ${t instanceof Error?t.message:String(t)}`)}if(await ct())try{await R("/api/instruction-suggestions/mark-stale",{}),o.logger.warn("Skills registry is stale (>48h); marked all suggestions stale")}catch{}o.logger.info(`Done: scored ${M}/${i.length} projects`)},"cronSuggestInstructions");export{q as a,st as b,at as c,it as d,wt as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,d as t}from"./chunk-
|
|
1
|
+
import{c as d,d as t}from"./chunk-OASW7DOD.js";import{a as r}from"./chunk-ZLLER3HP.js";async function g(o,i){let{evalTargetId:s}=o;try{let e=await t({targetId:s,engineFlag:"auto",skipReviewed:!0,log:r(a=>i.logger.info(`[judge-review] ${a}`),"log"),warn:r(a=>i.logger.warn(`[judge-review] ${a}`),"warn")});return{evalTargetId:s,reviewerModel:e.reviewerModel,comparedPairs:e.report.pairs,disagreements:e.report.disagreements.length,persisted:e.persisted,alreadyReviewed:e.alreadyReviewed,deferredPartialRuns:e.deferredPartialRuns}}catch(e){if(e instanceof d)return i.logger.info(`[judge-review] skipped (${e.reason}): ${e.message}`),{evalTargetId:s,skipped:e.reason};throw e}}r(g,"processJudgeReview");export{g as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as w,b as S}from"./chunk-CDY7TQFZ.js";import{c as A}from"./chunk-XRTZU7IZ.js";import{d as _}from"./chunk-TZA4HAVF.js";import{a as p}from"./chunk-ZLLER3HP.js";var j=`You are a rigorous eval grader. Your job is to evaluate whether an AI assistant's output meets a set of expectations.
|
|
2
2
|
|
|
3
3
|
You will receive:
|
|
4
4
|
1. The original prompt that was given to the AI
|
|
@@ -45,7 +45,7 @@ You MUST respond with ONLY a valid JSON object matching this exact structure (no
|
|
|
45
45
|
"suggestions": [{ "assertion": "suggested new assertion", "reason": "why it matters" }],
|
|
46
46
|
"overall": "brief summary assessment"
|
|
47
47
|
}
|
|
48
|
-
}`;async function
|
|
48
|
+
}`;async function q(E){let{prompt:O,output:f,expectations:h,model:d,timeout:v=12e4,engine:x="claude"}=E,n=new Array(h.length),c=[];h.forEach((r,e)=>{let t=w(r);if(t){let i=S(t,f);n[e]={text:r,passed:i.passed,evidence:i.evidence,method:"deterministic",...i.errored?{errored:!0}:{}}}else c.push({text:r,index:e})});let g=null,m=p((r,e)=>{let t=n.filter(a=>!a.errored),i=n.length-t.length,o=t.filter(a=>a.passed).length,s=t.length;return{expectations:n,summary:{passed:o,failed:s-o,total:s,pass_rate:s>0?o/s:null,...i>0?{errored:i}:{}},claims:r,eval_feedback:e,judge_model:g,judge_model_requested:d??null}},"finish"),y=p((r,e)=>{for(let t of c)n[t.index]={text:t.text,passed:!1,evidence:r,method:"llm",errored:!0};return m([],{suggestions:[],overall:e})},"errorSubjective");if(c.length===0)return m([],{suggestions:[],overall:"All expectations verified deterministically \u2014 LLM judge skipped."});let b=`## Original Prompt
|
|
49
49
|
|
|
50
50
|
${O}
|
|
51
51
|
|
|
@@ -58,4 +58,4 @@ ${f}
|
|
|
58
58
|
${c.map((r,e)=>`${e+1}. ${r.text}`).join(`
|
|
59
59
|
`)}
|
|
60
60
|
|
|
61
|
-
Grade the output against each expectation. Respond with ONLY valid JSON.`;if(x==="codex"&&!
|
|
61
|
+
Grade the output against each expectation. Respond with ONLY valid JSON.`;if(x==="codex"&&!d)return y("Grader error: the codex engine requires an explicit --model","Grading failed: codex engine requires an explicit model");let k=2,u={evidence:"Grader error: judge did not run",overall:"Grading failed"};for(let r=1;r<=k;r++){let e;if(x==="codex"?e=await A({prompt:b,systemPrompt:j,model:d,timeout:v}):e=await _({prompt:b,targetContent:j,timeout:v,model:d}),g=e.model??g,e.error){u={evidence:`Grader error: ${e.error}`,overall:`Grading failed: ${e.error}`};continue}try{let t=e.output.trim(),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1].trim());let o=t.match(/\{[\s\S]*\}/);o&&(t=o[0]);let s=JSON.parse(t);return c.forEach((a,R)=>{let l=s.expectations?.[R],G=l?.flag==="non_discriminating"||l?.flag==="unverifiable"?l.flag:void 0;n[a.index]=l?{text:a.text,passed:l.passed,evidence:l.evidence??"",method:"llm",...G?{flag:G}:{}}:{text:a.text,passed:!1,evidence:"Judge did not return a grade for this expectation",method:"llm",errored:!0}}),m(s.claims??[],s.eval_feedback??{suggestions:[],overall:""})}catch{u={evidence:"Grader output was not valid JSON",overall:`Grader returned unparseable output: ${e.output.slice(0,200)}`}}}return y(u.evidence,u.overall)}p(q,"gradeEvalOutput");export{q as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as l}from"./chunk-
|
|
1
|
+
import{c as l}from"./chunk-GP46IPK2.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,2 +1,2 @@
|
|
|
1
|
-
import{c as E,
|
|
1
|
+
import{c as E,m}from"./chunk-E7XOYGL5.js";import{a as d}from"./chunk-GP46IPK2.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as v}from"./chunk-RBSEE2Z6.js";import{a as R}from"./chunk-M7QSC64D.js";import{b}from"./chunk-7FY23IMS.js";import{e as u}from"./chunk-GP46IPK2.js";import{a as d}from"./chunk-ZLLER3HP.js";var k=6e5;async function T(a,w){let i=d(e=>w?.logger?.info?.(e)??console.log(e),"log"),{evalTargetId:n}=a,l=await u(`/api/eval-targets/${n}/judge-calibration`),o=v({powered:l.powerCheck.powered,mde:l.powerCheck.mde??Number.POSITIVE_INFINITY},l.caseDiscrimination??{total:0,discriminating:0,nonDiscriminating:0,unpaired:0},{runsCompleted:0,maxRuns:a.maxRuns??24,batchesRun:0,maxBatches:1});if(o.action==="stop")return i(`[cron_eval_autorun] ${n}: ${o.reason}`),{skipped:o.code,reason:o.reason};let r=await u(`/api/eval-targets/${n}`),c=R(r);if(c)return i(`[cron_eval_autorun] ${n}: ${c.reason}`),c;let p=(await u(`/api/eval-targets/${n}/evals`)).filter(e=>!e.retiredAt);if(p.length===0)return{skipped:"no-live-cases"};let{completed:g,failed:f,results:$}=await b({cases:p,targetContent:r.content,concurrency:2,runNumber:1,opts:{targetId:n,targetVersion:r.version??1,iteration:1,timeout:a.timeout??k,model:a.model,graderModel:a.graderModel,skipGrading:!1,targetType:r.type,targetName:r.name},onLog:i}),m={};for(let e of $){if(e.status!=="failed")continue;let t=e.failure?.kind??"unknown";m[t]=(m[t]??0)+1}let s=Object.entries(m).sort(([,e],[,t])=>t-e).map(([e,t])=>`${e}x${t}`).join(", ");return i(`[cron_eval_autorun] ${r.name}: ${g} completed, ${f} failed`+(s===""?"":` (${s})`)),{ranRuns:g,failedRuns:f,...s===""?{}:{failures:s},reason:o.reason}}d(T,"cronEvalAutorun");export{T as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as v,b as u,e as y,g as d}from"../../chunk-
|
|
1
|
+
import{a as v,b as u,e as y,g as d}from"../../chunk-HNAVHRGY.js";import{a as h}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as n}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import{f as r}from"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as f}from"../../chunk-4MXLDBLV.js";import{a as w}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import{c}from"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import{b as n}from"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import{b as r,d as a}from"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as s}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as k}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import{e as n,i as c}from"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as g}from"../../chunk-4MXLDBLV.js";import{a as h}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import{c as d}from"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import{b as l}from"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import{b as m,d as p}from"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as c}from"../../chunk-W2MV25SB.js";import{a as g}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-SHYP27B7.js";import{b as C,c as w,f as v,g as b}from"../../chunk-QXPYGN7I.js";import{a as u}from"../../chunk-
|
|
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-SHYP27B7.js";import{b as C,c as w,f as v,g as b}from"../../chunk-QXPYGN7I.js";import{a as u}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as g,b as d,c as p}from"../../chunk-W2MV25SB.js";import{a as c}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-
|
|
1
|
+
import{a as i}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import{f as n}from"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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-GY5IJ4RS.js";import{a as n}from"../../chunk-
|
|
1
|
+
import{a as o}from"../../chunk-GY5IJ4RS.js";import{a as n}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.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 u}from"../../chunk-GY5IJ4RS.js";import{a as c}from"../../chunk-
|
|
1
|
+
import{a as u}from"../../chunk-GY5IJ4RS.js";import{a as c}from"../../chunk-JKXU7FAY.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RDXWQDNZ.js";import"../../chunk-Y3T5Q5CD.js";import"../../chunk-OJSWNU56.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GP46IPK2.js";import"../../chunk-DS4P5C4F.js";import"../../chunk-PZNWH4VQ.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{Args as g,Flags as f}from"@oclif/core";var i=class m extends c{static{l(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:g.string({description:"Task name (run `rulemetric crons list` to see all)",required:!0})};static flags={quiet:f.boolean({char:"q",description:"Suppress per-line log output; print summary only"})};async run(){let{args:s,flags:d}=await this.parse(m);this.requireAuth();let n=u.find(e=>e.name===s.name);n||this.error(`Unknown task: ${s.name}
|
|
2
2
|
Run \`rulemetric crons list\` to see available tasks.`);let o;try{({runManualTask:o}=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.\nThese maintenance tasks connect to the database directly \u2014 run them from a full RuleMetric checkout with DATABASE_URL and the worker dependencies installed."),e}this.log(`\u25B6 Running ${n.name} \u2026`);let h=Date.now(),t=await o(s.name);if(!d.quiet)for(let e of t.logs){let r=e.level==="error"||e.level==="warn"?`[${e.level}]`:"";this.log(` ${r} ${e.message}`)}let a=((t.durationMs??Date.now()-h)/1e3).toFixed(1);t.ok?this.log(`\u2713 ${n.name} completed in ${a}s (${t.logs.length} log line${t.logs.length===1?"":"s"})`):this.error(`\u2717 ${n.name} failed after ${a}s: ${t.error}`)}};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-JKXU7FAY.js";import"../chunk-IZTIYR5Q.js";import"../chunk-RDXWQDNZ.js";import"../chunk-Y3T5Q5CD.js";import"../chunk-OJSWNU56.js";import"../chunk-3AV3GTMP.js";import"../chunk-GP46IPK2.js";import"../chunk-DS4P5C4F.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};
|