@rulemetric/cli 0.18.0 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +1 -1
- package/dist/{chunk-WLLIFRRE.js → chunk-2EXQM3UF.js} +1 -1
- package/dist/chunk-2RZDFKX4.js +1 -0
- package/dist/{chunk-NSO2EBYE.js → chunk-2WRP6ZJF.js} +1 -1
- package/dist/chunk-35NZJWFC.js +4 -0
- package/dist/{chunk-3ZHBOILE.js → chunk-45CCW25C.js} +1 -1
- package/dist/{chunk-NMCQ7JZZ.js → chunk-52RILE5M.js} +1 -1
- package/dist/{chunk-B45MMFZ4.js → chunk-5O62P6KC.js} +6 -6
- package/dist/chunk-6WX3AXMI.js +1 -0
- package/dist/{chunk-ENW5SUQJ.js → chunk-6XCD343D.js} +1 -1
- package/dist/chunk-6Z4JNHBO.js +1 -0
- package/dist/{chunk-MJLW5KN2.js → chunk-75H3CKWA.js} +1 -1
- package/dist/{chunk-XAGNGQL3.js → chunk-7CQBFCHP.js} +1 -1
- package/dist/{chunk-ZFEDOPRU.js → chunk-AEIKPNLG.js} +1 -1
- package/dist/{chunk-XCN2YPWI.js → chunk-ANPGOUIO.js} +1 -1
- package/dist/chunk-B56GMANB.js +1 -0
- package/dist/{chunk-CXENLSMR.js → chunk-B5FBLLKT.js} +1 -1
- package/dist/{chunk-KIQK7NVF.js → chunk-CLPIN7TY.js} +1 -1
- package/dist/{chunk-4LVSD2XZ.js → chunk-DRX65ZLX.js} +1 -1
- package/dist/{chunk-5VWVQCNR.js → chunk-E5FI5YHO.js} +1 -1
- package/dist/{chunk-7MQZPDDZ.js → chunk-E6O2IFOK.js} +1 -1
- package/dist/{chunk-BOYWPUV2.js → chunk-EA3X4TAE.js} +1 -1
- package/dist/{chunk-AZWY2DOT.js → chunk-EBGVDX3Z.js} +1 -1
- package/dist/{chunk-FGGESTXG.js → chunk-EYRM7BT4.js} +1 -1
- package/dist/chunk-FD272ZXG.js +2 -0
- package/dist/chunk-FKUFJWII.js +1 -0
- package/dist/chunk-G2MRNA45.js +1 -0
- package/dist/{chunk-C3XWDYZJ.js → chunk-G2UGWEMO.js} +1 -1
- package/dist/chunk-GRTEWHXU.js +5 -0
- package/dist/{chunk-RRBFKVCI.js → chunk-HEO56SKT.js} +1 -1
- package/dist/chunk-HRU6WGCG.js +1 -0
- package/dist/{chunk-MHLHLJ5T.js → chunk-I2U5GNNM.js} +2 -2
- package/dist/{chunk-AZRGURHR.js → chunk-ICULHHNZ.js} +1 -1
- package/dist/{chunk-BRYURAUN.js → chunk-ID47WFUP.js} +1 -1
- package/dist/chunk-IQOBKWVY.js +5 -0
- package/dist/chunk-JE2JX7IJ.js +4 -0
- package/dist/chunk-JVTSJFFI.js +1 -0
- package/dist/{chunk-D7L7IMJQ.js → chunk-K2PI3OGV.js} +1 -1
- package/dist/chunk-K4LO27GG.js +1 -0
- package/dist/chunk-KCX2YDC3.js +1 -0
- package/dist/{chunk-5LTJNYCP.js → chunk-KTLRSRHF.js} +1 -1
- package/dist/{chunk-K65DDLTZ.js → chunk-LKOUL3IF.js} +1 -1
- package/dist/{chunk-GWQ24FQP.js → chunk-LQRXWLFJ.js} +1 -1
- package/dist/{chunk-A2JFQUDW.js → chunk-NI6RDOZ5.js} +1 -1
- package/dist/{chunk-JCZOEIL7.js → chunk-NJKPUZNM.js} +1 -1
- package/dist/{chunk-PPQFN62M.js → chunk-NN4M476J.js} +1 -1
- package/dist/chunk-NX3PF3EQ.js +1 -0
- package/dist/{chunk-7J7H7YFQ.js → chunk-O662MWOR.js} +1 -1
- package/dist/{chunk-UROUVE3D.js → chunk-OHMVGDWQ.js} +1 -1
- package/dist/{chunk-RQBN7WNS.js → chunk-OLOECA5V.js} +7 -7
- package/dist/{chunk-IYX65N6T.js → chunk-ONDOPTSL.js} +1 -1
- package/dist/chunk-ONSRPEUQ.js +7 -0
- package/dist/{chunk-UQJNUESP.js → chunk-OT7ZUHJF.js} +1 -1
- package/dist/{chunk-CAQLSYOK.js → chunk-PCSSIYH6.js} +1 -1
- package/dist/chunk-PD4BUQ2X.js +1 -0
- package/dist/{chunk-WSUKOU3X.js → chunk-PRC5N4NB.js} +1 -1
- package/dist/chunk-Q37D6V2G.js +2 -0
- package/dist/chunk-Q42RXJ4R.js +1 -0
- package/dist/{chunk-3EZZGA72.js → chunk-RFLO7L5X.js} +1 -1
- package/dist/{chunk-QRKMRG6W.js → chunk-RR5EE23Q.js} +1 -1
- package/dist/{chunk-5U5SHJJA.js → chunk-RYMQMJ7O.js} +1 -1
- package/dist/chunk-S7ZQTZNB.js +3 -0
- package/dist/{chunk-LELSVLNK.js → chunk-SFZSHNZZ.js} +1 -1
- package/dist/{chunk-7N55TWYQ.js → chunk-T7DAU6DV.js} +1 -1
- package/dist/{chunk-HNPC5U3C.js → chunk-TUSFCQBL.js} +1 -1
- package/dist/chunk-UFRJ75FW.js +1 -0
- package/dist/{chunk-I2FPXRA6.js → chunk-VGBATQZ3.js} +1 -1
- package/dist/{chunk-NAS7FIGM.js → chunk-WLLSWFAJ.js} +1 -1
- package/dist/chunk-WUDHDZOG.js +1 -0
- package/dist/{chunk-A6JUIZ3H.js → chunk-WYDRKFXO.js} +1 -1
- package/dist/{chunk-YLEXR62G.js → chunk-XPVI6H2L.js} +6 -6
- package/dist/{chunk-IPNBW7ZW.js → chunk-XQEI7NOC.js} +1 -1
- package/dist/{chunk-EKTNI6RV.js → chunk-Y6VBAURK.js} +1 -1
- package/dist/chunk-YMIO3CVV.js +2 -0
- package/dist/{chunk-RAMQVEJB.js → chunk-YRGNBYZZ.js} +1 -1
- package/dist/{chunk-TQFHRD5B.js → chunk-Z7LBSVG3.js} +1 -1
- package/dist/{chunk-ANLPPIMS.js → chunk-ZFIGOHQ6.js} +1 -1
- package/dist/chunk-ZVCKDNBT.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 +3 -3
- package/dist/commands/evals/auto-run.js +1 -5
- package/dist/commands/evals/benchmark.js +1 -1
- package/dist/commands/evals/compare.js +1 -31
- package/dist/commands/evals/create.js +1 -1
- package/dist/commands/evals/optimize-description.js +1 -59
- package/dist/commands/evals/optimize.js +1 -5
- package/dist/commands/evals/refine-cases.js +1 -1
- package/dist/commands/evals/run.js +1 -3
- package/dist/commands/evals/validate-judge.js +1 -1
- package/dist/commands/experiments/enroll.js +1 -0
- 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/resume-scoped-outcomes.js +1 -1
- package/dist/commands/research/tail-transcript.js +1 -1
- package/dist/commands/service/install.js +37 -37
- package/dist/commands/service/status.js +1 -1
- package/dist/commands/service/uninstall.js +1 -1
- package/dist/commands/service/updates.js +1 -0
- package/dist/commands/sessions/analyze.js +1 -1
- package/dist/commands/sessions/delete.js +1 -1
- package/dist/commands/sessions/end.js +1 -1
- package/dist/commands/sessions/import.js +1 -1
- package/dist/commands/sessions/list.js +1 -1
- package/dist/commands/sessions/start.js +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/skills/export-approved.js +1 -1
- package/dist/commands/skills/install.js +1 -1
- package/dist/commands/skills/list.js +1 -1
- package/dist/commands/skills/publish.js +1 -1
- package/dist/commands/skills/search.js +1 -1
- package/dist/commands/skills/update.js +1 -1
- package/dist/commands/suggestions/accept.js +1 -1
- package/dist/commands/suggestions/auto.js +1 -1
- package/dist/commands/suggestions/dismiss.js +1 -1
- package/dist/commands/suggestions/list.js +1 -1
- package/dist/commands/suggestions/refresh.js +1 -1
- package/dist/commands/suggestions/undo.js +1 -1
- package/dist/dashboard/Dashboard.js +1 -1
- package/dist/dashboard/data.js +1 -1
- package/dist/dashboard/launcher/LauncherOverlay.js +1 -1
- package/dist/dashboard/launcher/api.js +1 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +1 -1
- package/dist/dashboard/panels/measurement.js +1 -1
- package/dist/dashboard/telemetry.js +1 -1
- package/dist/{dist-ZJY72TUD.js → dist-TNM2RNPT.js} +1 -1
- package/dist/lib/active-org-refresh.js +1 -1
- package/dist/lib/agent-loop.js +1 -1
- package/dist/lib/agent-presence.js +1 -1
- package/dist/lib/antigravity-transcript.js +1 -1
- package/dist/lib/api-client.js +1 -1
- package/dist/lib/case-refinement-policy.js +1 -0
- package/dist/lib/discovery-evidence.js +1 -0
- package/dist/lib/discovery-repository.js +1 -0
- package/dist/lib/ensure-api-key.js +1 -1
- package/dist/lib/ensure-fresh-token.js +1 -1
- package/dist/lib/eval-benchmark.js +1 -1
- package/dist/lib/eval-candidate-run.js +1 -1
- package/dist/lib/eval-case-generator.js +1 -1
- package/dist/lib/eval-compare.js +1 -1
- package/dist/lib/eval-conversation-handler.js +1 -1
- package/dist/lib/eval-quota-gate.js +1 -1
- package/dist/lib/eval-resume.js +1 -1
- package/dist/lib/eval-run-batch.js +1 -1
- package/dist/lib/eval-trigger-tester.js +8 -1
- package/dist/lib/insights/generation/installed-asks.js +1 -1
- package/dist/lib/insights/generation/project-evidence.js +1 -1
- package/dist/lib/insights/generation/quality-review.js +1 -1
- package/dist/lib/insights/nomination/nominate.js +1 -1
- package/dist/lib/instruction-proposer.js +16 -1
- package/dist/lib/instruction-restoration.js +1 -1
- package/dist/lib/instructions/acceptance/accept-events.js +1 -1
- package/dist/lib/instructions/acceptance/accept-hook.js +1 -1
- package/dist/lib/instructions/acceptance/hook-install.js +1 -1
- package/dist/lib/instructions/acceptance/reverse-applications.js +1 -1
- package/dist/lib/instructions/acceptance/suggestion-accept.js +1 -1
- package/dist/lib/jobs/handlers/cron-auto-accept-suggestions.js +1 -1
- package/dist/lib/jobs/handlers/cron-eval-autorun.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-training.js +1 -1
- package/dist/lib/jobs/handlers/cron-reconcile-attribution.js +1 -1
- package/dist/lib/jobs/handlers/cron-refine-cases.js +1 -1
- package/dist/lib/jobs/handlers/cron-refresh-pricing.js +1 -1
- package/dist/lib/jobs/handlers/cron-retire-unused-skills.js +1 -1
- package/dist/lib/jobs/handlers/cron-suggest-instructions.js +1 -1
- package/dist/lib/jobs/handlers/distill-memories.js +1 -1
- package/dist/lib/jobs/handlers/finalize-scoped-launch.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab.js +1 -1
- package/dist/lib/jobs/handlers/prepare-isolated-launch.js +1 -0
- package/dist/lib/jobs/handlers/prepare-suggestion-live.js +1 -1
- package/dist/lib/jobs/handlers/process-changelog.js +1 -1
- package/dist/lib/jobs/handlers/process-conversation.js +1 -1
- package/dist/lib/jobs/handlers/process-eval.js +1 -1
- package/dist/lib/jobs/handlers/process-insights.js +1 -1
- package/dist/lib/jobs/handlers/process-judge-review.js +1 -1
- package/dist/lib/jobs/handlers/process-launch.js +1 -1
- package/dist/lib/jobs/handlers/process-run-cleanup.js +1 -1
- package/dist/lib/jobs/handlers/process-session-goal.js +1 -1
- package/dist/lib/jobs/handlers/process-suggestion-adoption.js +1 -1
- package/dist/lib/jobs/handlers/process-suggestion-discovery.js +1 -1
- package/dist/lib/jobs/handlers/process-suggestion-eval.js +1 -1
- package/dist/lib/jobs/handlers/restore-instruction.js +1 -0
- package/dist/lib/jobs/shed-retry.js +1 -1
- package/dist/lib/judge-review-runner.js +1 -1
- package/dist/lib/llm-client.js +1 -1
- package/dist/lib/manual-tasks.js +1 -1
- package/dist/lib/projects/workspace/worktree.js +1 -1
- package/dist/lib/refine-cases.js +1 -1
- package/dist/lib/research-client.js +1 -1
- package/dist/lib/retraction.js +1 -1
- package/dist/lib/session-updates.js +1 -1
- package/dist/lib/setup-steps.js +1 -1
- package/dist/lib/study-result-store.js +1 -0
- package/dist/lib/suggestion-discovery.js +1 -1
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/terminal-target-heartbeat.js +1 -1
- package/dist/lib/transcript-sync.js +1 -1
- package/dist/lib/work-report.js +1 -1
- package/dist/lib/worker-updates.js +1 -0
- package/oclif.manifest.json +322 -199
- package/package.json +7 -7
- package/dist/chunk-2C7CFCMM.js +0 -1
- package/dist/chunk-647M2I2Y.js +0 -1
- package/dist/chunk-7OTOAC6C.js +0 -8
- package/dist/chunk-A6XQSO62.js +0 -4
- package/dist/chunk-AHLVY52I.js +0 -1
- package/dist/chunk-BDWQ6J4V.js +0 -1
- package/dist/chunk-BU3ZGLQG.js +0 -1
- package/dist/chunk-CJ2WSSHD.js +0 -1
- package/dist/chunk-DTTR4EUJ.js +0 -1
- package/dist/chunk-DZRBB34J.js +0 -16
- package/dist/chunk-FLJTAD2R.js +0 -1
- package/dist/chunk-G7V4ZZZ3.js +0 -1
- package/dist/chunk-GHUW7P55.js +0 -2
- package/dist/chunk-GYKYJJNF.js +0 -1
- package/dist/chunk-KFNFLMUR.js +0 -3
- package/dist/chunk-KOIFFSYW.js +0 -2
- package/dist/chunk-KR32Y5Q5.js +0 -1
- package/dist/chunk-L5ILEWHH.js +0 -1
- package/dist/chunk-LZPE6424.js +0 -5
- package/dist/chunk-MRQIYIQE.js +0 -1
- package/dist/chunk-NLUHMHPM.js +0 -1
- package/dist/chunk-NVOYP4HX.js +0 -1
- package/dist/chunk-P577DWWL.js +0 -1
- package/dist/chunk-PMMHMRFS.js +0 -1
- package/dist/chunk-R26SQ3BE.js +0 -5
- package/dist/chunk-RITL4NU3.js +0 -1
- package/dist/chunk-RWQG25JU.js +0 -1
- package/dist/chunk-YZQZD2E6.js +0 -1
- package/dist/chunk-ZJABRHIP.js +0 -1
- package/dist/lib/eval-accumulation.js +0 -1
- package/dist/lib/evolution-cost.js +0 -1
- package/dist/lib/evolution-enrolment.js +0 -1
- package/dist/lib/jobs/handlers/cron-instruction-evolution.js +0 -1
- package/dist/lib/jobs/handlers/process-memory-ab.js +0 -1
- package/dist/lib/optimize-compare.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as N}from"./chunk-5RBLIVBF.js";import{a as O,b as M,c as Q,d as G}from"./chunk-77FH6UZP.js";import{b as Z,d as X}from"./chunk-
|
|
1
|
+
import{a as N}from"./chunk-5RBLIVBF.js";import{c as ee}from"./chunk-NI6RDOZ5.js";import{a as O,b as M,c as Q,d as G}from"./chunk-77FH6UZP.js";import{b as Z,d as X}from"./chunk-LKOUL3IF.js";import{a as se}from"./chunk-SFZSHNZZ.js";import{b as K,c as Y}from"./chunk-GRTEWHXU.js";import{a as A,d as F}from"./chunk-3UKZJAFS.js";import{b as B,e as V,g as R}from"./chunk-LQRXWLFJ.js";import{e as $,f as U,h as f}from"./chunk-E5FI5YHO.js";import{a as q,b as W}from"./chunk-I2U5GNNM.js";import{a as _}from"./chunk-ZLLER3HP.js";var te=_((c,{limit:i,sort:n,eventTypes:e})=>$(`/api/sessions/${c}/events?limit=${i}&sort=${n}&eventType=${encodeURIComponent(e.join(","))}&hasContent=true`),"fetchTranscriptTurns");async function _e(c,i){let{mirrorId:n,projectPath:e,projectId:r,config:u}=c,s=_(t=>i.logger.info(t),"log");if(u?.sessionId)return re({mirrorId:n,sessionId:u.sessionId},s);s(`Processing insights job ${n}...`),await f(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"reading_data"}});try{let{repaired:t}=await U("/api/sessions/repair-analyzed-at",{});t>0&&s(` Repaired analyzed_at on ${t} orphan session(s).`)}catch(t){s(` Warning: analyzed_at repair failed: ${t instanceof Error?t.message:String(t)}`)}let y=20,w=200,x=15*6e4,J=3,v=Date.now()+x,C=V()==="none"?"no-llm-backend":null,g={attempted:0,generated:0,failed:0,ungradeable:0,stopReason:C??"queue-exhausted"};if(C&&i.logger.warn?.("[process-insights] no LLM backend (no claude/codex CLI and no ANTHROPIC_API_KEY) \u2014 facet grading SKIPPED for this run; the summary below is computed from already-graded sessions only"),!C){let t=0,a=0;try{for(;t<w&&Date.now()<v;){let d=await $(`/api/sessions?needsFacets=true&graderVersion=${2}&limit=${y}&offset=${a}`);if(d.length===0)break;s(` Generating facets for ${d.length} un-analyzed sessions (drained ${t} so far)...`);for(let I=0;I<d.length&&!(t>=w||Date.now()>=v);I+=J){let j=d.slice(I,I+J);await Promise.all(j.map(async p=>{if(!(t>=w||Date.now()>=v)){g.attempted++;try{let l=await F(oe=>te(p.id,oe));if(l.turnCount<2){g.ungradeable++,t++,a++;return}let D=await R(G,l.text,4096);D&&typeof D.outcome=="string"?(await f(`/api/sessions/${p.id}/enrich`,{analysis:{source:"generated_facets",...D,graderVersion:2},...p.eventCount!=null?{analyzedEventCount:p.eventCount}:{},analyzedTurnCount:l.turnCount}),s(` Generated facets for session ${p.id} (${p.tool}, ${l.turnCount} turns)`),g.generated++):(a++,g.failed++),t++}catch(l){g.failed++,s(` Failed to generate facets for session ${p.id}: ${l instanceof Error?l.message:String(l)}`),t++,a++}}}))}if(d.length<y)break}}catch(d){g.stopReason="read-failed",s(` Warning: facet generation failed after ${t} sessions: ${d instanceof Error?d.message:String(d)}`)}if(g.stopReason!=="read-failed"&&(g.stopReason=Date.now()>=v?"time-budget":t>=w?"hard-cap":"queue-exhausted"),t>0||g.stopReason==="read-failed"){let d=g.stopReason==="read-failed"?"database read failure":Date.now()>=v?`time budget (${Math.round(x/6e4)}m)`:t>=w?`hard cap (${w})`:"end of queue scan";s(` Facet drain stopped on ${d} after ${t} session(s); the rest resume next run.`)}}let b=await ie(e,r);if(!b)throw new N("No session data found \u2014 ensure sessions are captured and enriched.");s(` Found ${b.stats.sessions} sessions, generating recommendations...`);let m=await Y({projectId:r,projectPath:e},$);b.summary+=`
|
|
2
2
|
|
|
3
3
|
${m.text}`,s(` Session evidence: ${m.sessionIds.length} usable, ${m.failedSessionIds.length} unavailable`);let P=await ae(e,s);P&&s(` Generator memory: ${P.split(`
|
|
4
4
|
`).length} lines of prior-advice context`);let o={},E=[],h=M.length+1;for(let t=0;t<M.length;t++){let a=M[t];s(` [${t+1}/${h}] Generating ${a.name}...`);try{await f(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:a.name,current:t+1,total:h,partial:{...o}}})}catch(l){s(` Warning: progress update failed for ${a.name}: ${l instanceof Error?l.message:String(l)}`)}s(` Running LLM prompt for ${a.name}...`);let d=a.usesGeneratorMemory&&P?`${b.summary}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{
|
|
1
|
+
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{a}from"./chunk-RFLO7L5X.js";import{d as u}from"./chunk-KTLRSRHF.js";import{a as n}from"./chunk-7CQBFCHP.js";import{b as i}from"./chunk-E5FI5YHO.js";import{g as r}from"./chunk-PZNWH4VQ.js";import{a as s}from"./chunk-ZLLER3HP.js";import{Command as f,Flags as h}from"@oclif/core";function p(t){return t instanceof i?t.statusCode>=500||t.statusCode===408||t.statusCode===0:/fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|bad gateway|timed out/i.test(t.message??"")}s(p,"isAvailabilityError");var m=class extends f{static{s(this,"BaseCommand")}static baseFlags={"api-url":h.string({description:"Override API base URL",env:"RULEMETRIC_API_URL",hidden:!0})};async init(){await super.init();let{flags:e}=await this.parse(this.constructor);e["api-url"]&&(process.env.RULEMETRIC_API_URL=e["api-url"]);let o=d(this.config.version);o&&!this.argv.includes("--quiet")&&!process.env.RULEMETRIC_QUIET&&process.stderr.write(`
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
`),c();try{await a()}catch{}}requireAuth(){r()||this.error("Not logged in. Run `rulemetric auth login` to authenticate."),n()}async catch(e){throw p(e)&&await u({command:this.id,statusCode:e instanceof i?e.statusCode:void 0,message:e.message,cliVersion:this.config.version}),e instanceof i&&(e.statusCode===401&&this.error("Session expired. Run `rulemetric auth login` to re-authenticate."),this.error(e.message)),(e.message?.includes("fetch failed")||e.message?.includes("ECONNREFUSED"))&&this.error("Could not connect to the API server. Is it running?"),e}};export{m as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{h as R}from"./chunk-
|
|
1
|
+
import{h as R}from"./chunk-ICULHHNZ.js";import{h as _}from"./chunk-WUDHDZOG.js";import{a as $,b as E,c as v,f as w,g as P}from"./chunk-SIGZEQ3K.js";import{e as y,f}from"./chunk-E5FI5YHO.js";import{a as c}from"./chunk-ZLLER3HP.js";import{execFileSync as A}from"node:child_process";import{openSync as x,readSync as C,closeSync as M,readFileSync as O}from"node:fs";var T=12e4,j=3e4;function B(l){let t;try{t=x(l,"r");let o=Buffer.alloc(64*1024),a=C(t,o,0,o.length,0),i=o.subarray(0,a).toString("utf-8");for(let s of i.split(`
|
|
2
2
|
`))if(s.startsWith("{"))try{let n=JSON.parse(s).cwd;if(typeof n=="string"&&n.startsWith("/"))return n}catch{}return null}catch{return null}finally{t!==void 0&&M(t)}}c(B,"readTranscriptCwd");function D(l){let t=c(s=>{try{return A("git",["-C",l,...s],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],timeout:5e3}).trim()||null}catch{return null}},"git");if(!t(["rev-parse","--show-toplevel"]))return null;let a=t(["rev-parse","--git-dir"]),i=t(["rev-parse","--git-common-dir"]);return{gitRemote:t(["remote","get-url","origin"]),gitRootCommit:t(["rev-list","--max-parents=0","HEAD"])?.split(`
|
|
3
3
|
`).pop()?.trim()??null,gitBranch:t(["branch","--show-current"]),isWorktree:!!a&&!!i&&a!==i}}c(D,"gitAnchors");async function L(l,t,o=E(D,B)){let a=Math.min(l.limit??200,1e3),i=!1;try{let e=await _(r=>t.logger.info(r),{signal:t.leaseSignal,sweepBudgetMs:T,requestTimeoutMs:j});e.scanned>0&&t.logger.info(`scoped outcomes: scanned=${e.scanned} delivered=${e.delivered} failed=${e.failed} unmeasured=${e.unmeasured} pending=${e.pending} deferred=${e.deferred} stop=${e.stopReason}`),i=e.stopReason==="lease_lost"}catch(e){t.logger.info(`scoped outcome resume sweep failed: ${e.message}`),i=!!t.leaseSignal?.aborted}if(i)return t.logger.warn("lease lost during scoped outcome resume; attribution repair skipped for this claim"),{scanned:0,repaired:0,reimported:0,unrepairable:0,remaining:0};let s=await R(()=>y(`/api/sessions/unattributed?limit=${a}`),{log:c(e=>t.logger.info(e),"log"),label:"sessions/unattributed",idempotent:!0}),n=s.sessions??[],b=s.total??n.length;if(n.length===0)return t.logger.info("no unattributed sessions"),{scanned:0,repaired:0,reimported:0,unrepairable:0,remaining:0};let m=0,g=0,d=0;for(let e of n){if(!e.externalSessionId){d++;continue}let r=P(e,o);if(!r){d++;continue}try{await f("/api/sessions",{tool:e.tool,externalSessionId:e.externalSessionId,projectPath:r.projectPath,...r.gitBranch?{gitBranch:r.gitBranch}:{},metadata:{...r.gitRemote?{gitRemote:r.gitRemote}:{},...r.gitRootCommit?{gitRootCommit:r.gitRootCommit}:{},isWorktree:r.isWorktree,reconciledAttribution:!0}}),m++}catch(u){d++,t.logger.info(`reconcile failed for ${e.externalSessionId}: ${u.message}`);continue}let p=e.tool==="claude_code"?v(e.externalSessionId,o):null,S=w({tool:e.tool,pathWasJunk:!!e.projectPath&&$(e.projectPath),endedAt:e.endedAt??null,transcript:p?o.stat(p):null});if(S.reimport&&p)try{let u=O(p,"utf-8");await f(`/api/sessions/${e.id}/reimport`,{content:u,tool:"claude_code"}),g++}catch(u){t.logger.info(`reimport failed for ${e.externalSessionId} (${S.reason}): ${u.message}`)}}let h=b-m;return t.logger.info(`reconciled attribution: scanned=${n.length} repaired=${m} reimported=${g} unrepairable=${d} remaining=${h} (of ${b} total)`),{scanned:n.length,repaired:m,reimported:g,unrepairable:d,remaining:h}}c(L,"cronReconcileAttribution");export{L as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as c}from"./chunk-FD272ZXG.js";import{f as p}from"./chunk-E5FI5YHO.js";import{a as s}from"./chunk-ZLLER3HP.js";import{execFile as u}from"node:child_process";import{promisify as m}from"node:util";import{join as h}from"node:path";import{pathToFileURL as l}from"node:url";import{createHash as w}from"node:crypto";import{scriptsDir as d}from"@rulemetric/hooks/scripts-dir";var f=m(u);async function v(r,o,n){let e=c.parse(o);if(!e.execution||!e.verification)throw new Error("Missing isolated execution contract");return await x(r,e.execution.setup,n),(await import(l(h(d,"scoped-live.mjs")).href)).observeScopedEnvironment(r,e)}s(v,"prepareIsolatedRepository");async function x(r,o,n){for(let t of o)await f(t[0],t.slice(1),{cwd:r,signal:n,timeout:12e4,maxBuffer:2e5,env:{PATH:process.env.PATH,HOME:process.env.HOME,TMPDIR:process.env.TMPDIR,CI:"1"}});let{stdout:e}=await f("git",["status","--porcelain"],{cwd:r,signal:n,timeout:5e3});if(e.trim())throw new Error("Repository setup changed the frozen checkout; refusing task execution")}s(x,"runIsolatedSetup");async function I(r,o,n,e){let t=c.parse(n);if(!o.worktree?.requireFresh||o.worktree.baseRef!==t.verification?.environment.repositoryRevision)throw new Error("Launch checkout differs from the frozen revision");let i=await v(o.projectPath,t,e);if(w("sha256").update(JSON.stringify({harnessVersion:i.harnessVersion,repositoryRevision:i.repositoryRevision,contextHashes:i.contextHashes})).digest("hex")!==t.configurationHash)throw new Error("Isolated checkout environment differs from frozen scope");let a={projectPath:o.projectPath,environment:i,createdFresh:!0};return await p(`/api/launch-jobs/${r}/isolation`,a,{signal:e,timeoutMs:3e4}),a}s(I,"prepareIsolatedLaunch");export{v as a,x as b,I as c};
|
|
@@ -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-TUSFCQBL.js";import{a as h}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as p}from"../../chunk-ZLLER3HP.js";import{Args as k,Flags as o}from"@oclif/core";import{existsSync as T}from"node:fs";import{homedir as P}from"node:os";import{join as I}from"node:path";var A=I(P(),".gemini","antigravity-ide","brain"),g=class x extends h{static{p(this,"AntigravityBackfill")}static description="Backfill historical events from an Antigravity conversation transcript into a RuleMetric session. Useful for seeding a conversation that existed before hooks were installed \u2014 the live hook intentionally only captures forward.";static examples=["<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --session 158db9aa-68ee-43fc-961b-f3a180578694","<%= config.bin %> antigravity backfill 26fd215d-f43b-4ea5-b177-dc2c0e696f97 --dry-run"];static args={conversationId:k.string({description:"Antigravity conversationId (UUID) \u2014 the directory name under ~/.gemini/antigravity-ide/brain/",required:!0})};static flags={session:o.string({char:"s",description:"RuleMetric session UUID to POST events into. If omitted, resolved from the hook tmp file ($TMPDIR/rulemetric/<conversationId>) \u2014 fails if neither is present."}),transcript:o.string({description:"Path to the transcript.jsonl file. Defaults to ~/.gemini/antigravity-ide/brain/<conversationId>/.system_generated/logs/transcript.jsonl"}),"after-step":o.integer({description:"Only emit records with step_index > this value. Default: read from existing state file, else -1 (everything)."}),limit:o.integer({description:"Cap on the number of records to process this run."}),"dry-run":o.boolean({default:!1,description:"Classify records without POSTing. Reports counts only."}),"save-state":o.boolean({default:!0,allowNo:!0,description:"After backfill, persist the highest step_index so the live hook resumes from there."})};async run(){let{args:b,flags:e}=await this.parse(x),t=b.conversationId;d.loadEnvFile(),process.env.RULEMETRIC_API_URL||this.error("RULEMETRIC_API_URL is not set. Configure it via env or ~/.config/rulemetric/env.");let l=e.transcript??I(A,t,".system_generated","logs","transcript.jsonl");T(l)||this.error(`Transcript not found: ${l}`);let m=e.session??d.resolveRwSessionId(t);m||this.error(`No RuleMetric session resolved. Pass --session <uuid>, or run the Antigravity hook at least once so $TMPDIR/rulemetric/${t} is populated.`);let n=e["after-step"];n===void 0&&(n=d.load(t)?.lastStepIdx??-1);let i=v(l,n);e.limit!==void 0&&i.length>e.limit&&(i=i.slice(0,e.limit));let R=u(l);if(this.log(`Conversation ${t}: transcript max step = ${R}, after-step = ${n}, records to process = ${i.length}`),i.length===0){this.log("Nothing to backfill.");return}if(e["dry-run"]){let r=0,a=0,c={};for(let S of i){let f=(await import("../../lib/antigravity-transcript.js")).classifyRecord(S,0);f?(r++,c[f.eventType]=(c[f.eventType]??0)+1):a++}this.log(`Dry run: would emit ${r}, skip ${a}. By eventType: ${JSON.stringify(c)}`);return}let w=Date.now(),s=await y(i,m,t,n,{onProgress:p(({attempted:r,total:a})=>{(r%100===0||r===a)&&process.stderr.write(` \u2026${r}/${a}
|
|
2
2
|
`)},"onProgress")}),$=((Date.now()-w)/1e3).toFixed(1);this.log(`Backfill complete in ${$}s. attempted=${s.attempted} emitted=${s.emitted} skipped=${s.skipped} failed=${s.failed} highestStepIdx=${s.highestStepIdx}`),e["save-state"]?(d.save(t,{lastStepIdx:s.highestStepIdx}),this.log(`State saved \u2192 live hook will resume from step_index > ${s.highestStepIdx}.`)):this.log("State NOT saved (--no-save-state). Live hook will re-emit any new records from after-step.")}};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"../../chunk-
|
|
1
|
+
import{a as n}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as r}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{i as o,l as s}from"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import*as c from"node:path";import{Flags as l}from"@oclif/core";var t=class g extends n{static{a(this,"AuthCreateKey")}static description="Create a long-lived API key for CLI and proxy authentication";static examples=['<%= config.bin %> auth create-key --name "laptop"','<%= config.bin %> auth create-key --name "ci token" --no-save'];static flags={name:l.string({char:"n",description:"Name for this key",required:!0}),save:l.boolean({char:"s",description:"Save key to ~/.config/rulemetric/env for hooks/proxy",default:!0,allowNo:!0})};async run(){let{flags:i}=await this.parse(g),e=await r("/api/auth/api-keys",{name:i.name});this.log(""),this.log("API key created successfully:"),this.log(""),this.log(` Name: ${e.name}`),this.log(` Key: ${e.key}`),this.log(` Prefix: ${e.keyPrefix}`),this.log(""),this.warn("Save this key now \u2014 it will not be shown again."),i.save&&(o(e.key,process.env.RULEMETRIC_API_URL),this.log(""),this.log(`Key saved to ${c.join(s(),"env")} (RULEMETRIC_API_KEY)`),this.log("Hooks and proxy will use this key automatically."))}};export{t as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as f}from"../../chunk-
|
|
1
|
+
import{a as f}from"../../chunk-NJKPUZNM.js";import{a as w}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import{c}from"../../chunk-KTLRSRHF.js";import{b as n}from"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{b as r,d as a}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{b as m,d,h as u,i as g}from"../../chunk-PZNWH4VQ.js";import{a as l}from"../../chunk-ZLLER3HP.js";import{Flags as p}from"@oclif/core";var h=class y extends w{static{l(this,"AuthLogin")}static description="Log in to RuleMetric";static examples=["<%= config.bin %> auth login","<%= config.bin %> auth login -e user@example.com"];static flags={email:p.string({char:"e",description:"Email address"}),password:p.string({char:"p",description:"Password (for non-interactive use)"}),"api-key":p.string({description:"Authenticate with an API key from https://rulemetric.com/connect (required for Google/GitHub sign-ins, which have no password)",exclusive:["password"]})};async run(){let{flags:s}=await this.parse(y);if(s["api-key"]){await this.loginWithApiKey(s["api-key"]);return}let e=s.email,t=s.password;if(!e||!t){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p, or set RULEMETRIC_API_KEY (create a key at https://rulemetric.com/connect).");let{input:o,password:k}=await import("@inquirer/prompts");this.log("Signed up with Google or GitHub? You have no password \u2014 press Ctrl-C and run:"),this.log(" rulemetric auth login --api-key <key> (create one at https://rulemetric.com/connect)"),this.log(""),e||(e=await o({message:"Email:"})),t||(t=await k({message:"Password:"}))}let i;try{i=await a("/auth/login",{method:"POST",body:{email:e,password:t},timeoutMs:2e4})}catch(o){throw o instanceof r&&o.statusCode===401&&this.error(`Invalid email or password.
|
|
2
2
|
|
|
3
3
|
If you signed up with Google or GitHub, you have no password \u2014 that is why this cannot work. Create an API key at https://rulemetric.com/connect, then run:
|
|
4
4
|
rulemetric auth login --api-key <key>`),o}let v=i.expiresAt??new Date(Date.now()+3600*1e3).toISOString();d({accessToken:i.accessToken,refreshToken:i.refreshToken,expiresAt:v,email:i.email}),u(i.accessToken,process.env.RULEMETRIC_API_URL),await n(),await f(this.log.bind(this),this.warn.bind(this),this.config.version),c("auth_login",{},this.config.version),this.log(`Logged in as ${i.email}`)}async loginWithApiKey(s){let e=s.trim();e||this.error("Empty --api-key. Create one at https://rulemetric.com/connect"),process.env.RULEMETRIC_API_KEY=e;try{await a("/api/setup/status",{timeoutMs:2e4})}catch(t){throw delete process.env.RULEMETRIC_API_KEY,t instanceof r&&(t.statusCode===401||t.statusCode===403)&&this.error("That API key was rejected. Check you copied it whole (it is shown only once at creation) or mint a new one at https://rulemetric.com/connect"),t}g(e,process.env.RULEMETRIC_API_URL),m(),await n(),c("auth_login",{method:"api_key"},this.config.version),this.log(`Authenticated with API key ${e.slice(0,11)}...`),this.log("Verify any time with: rulemetric auth status")}};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"../../chunk-
|
|
1
|
+
import{a as s}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{f as i,j as r}from"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";var e=class t extends s{static{o(this,"AuthLogout")}static description="Log out of RuleMetric";static examples=["<%= config.bin %> auth logout"];async run(){await this.parse(t),i(),r(),this.log("Logged out successfully.")}};export{e as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k}from"../../chunk-
|
|
1
|
+
import{a as k}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as n,i as c}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Args as y}from"@oclif/core";var a=class m extends k{static{s(this,"AuthRevokeKey")}static description="Revoke an API key (run with no argument to list active keys)";static examples=["<%= config.bin %> auth revoke-key","<%= config.bin %> auth revoke-key rm_abc12345",'<%= config.bin %> auth revoke-key "my-laptop (auto)"'];static args={id:y.string({description:"API key ID, prefix (rm_xxxxxxxx), or name"})};async run(){let{args:o}=await this.parse(m),r=(await n("/api/auth/api-keys")).filter(e=>!e.revokedAt);if(!o.id){if(r.length===0){this.log("No active API keys.");return}this.log(`Active API keys \u2014 pass an id, prefix, or name to revoke one:
|
|
2
2
|
`);for(let e of r)this.log(` ${e.id} ${e.keyPrefix}... ${e.name}`);return}let i=o.id,t=r.filter(e=>e.id===i||e.name===i||i.startsWith("rm_")&&i.startsWith(e.keyPrefix));t.length===0&&this.error(`No active API key matches "${i}". Run \`rulemetric auth revoke-key\` with no argument to list keys.`),t.length>1&&this.error(`"${i}" matches ${t.length} keys \u2014 use the exact key ID:
|
|
3
3
|
`+t.map(e=>` ${e.id} ${e.keyPrefix}... ${e.name}`).join(`
|
|
4
4
|
`)),await c(`/api/auth/api-keys/${t[0].id}`),this.log(`API key ${t[0].keyPrefix}... ("${t[0].name}") revoked.`)}};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"../../chunk-
|
|
1
|
+
import{a as g}from"../../chunk-NJKPUZNM.js";import{a as h}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import{c as d}from"../../chunk-KTLRSRHF.js";import{b as l}from"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{b as m,d as p}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{d as n,h as c}from"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as u}from"@oclif/core";var t=class f extends h{static{o(this,"AuthSignup")}static description="Create a RuleMetric account from the CLI";static examples=["<%= config.bin %> auth signup","<%= config.bin %> auth signup -e user@example.com"];static flags={email:u.string({char:"e",description:"Email address"}),password:u.string({char:"p",description:"Password (min 8 chars; for non-interactive use)"})};async run(){let{flags:a}=await this.parse(f),i=a.email,r=a.password;if(!i||!r){process.stdin.isTTY||this.error("Missing credentials in a non-interactive shell. Pass --email/-e and --password/-p.");let{input:s,password:v}=await import("@inquirer/prompts");i||(i=await s({message:"Email:"})),r||(r=await v({message:"Password (min 8 chars):"}))}let e;try{e=await p("/auth/signup",{method:"POST",body:{email:i,password:r},timeoutMs:2e4})}catch(s){throw s instanceof m&&s.statusCode===409&&this.error(`An account with ${i} already exists. Run: rulemetric auth login -e ${i}`),s}if(e.confirmationRequired||!e.accessToken||!e.refreshToken){this.log(`Account created for ${e.email}.`),this.log("Check your email and click the confirmation link, then run:"),this.log(` rulemetric auth login -e ${e.email}`);return}let w=e.expiresAt??new Date(Date.now()+3600*1e3).toISOString();n({accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:w,email:e.email}),c(e.accessToken,process.env.RULEMETRIC_API_URL),await l(),await g(this.log.bind(this),this.warn.bind(this),this.config.version),d("auth_signup",{},this.config.version),this.log(`Signed up and logged in as ${e.email}`)}};export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-W2MV25SB.js";import{a as g}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-W2MV25SB.js";import{a as g}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{a,e as l,l as t}from"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import*as u from"node:path";var o=class h extends g{static{r(this,"AuthStatus")}static description="Show current authentication status";static examples=["<%= config.bin %> auth status"];async run(){await this.parse(h);let e=l(),i=process.env.RULEMETRIC_API_KEY,s=a().apiKey;if(i||s){let m=i||s,p=i?"RULEMETRIC_API_KEY env var":u.join(t(),"env");this.log(`Authenticated via API key ${m.slice(0,11)}... (${p})`),e&&this.log(`Logged in as: ${e.email}`),this.log(`Config: ${t()}`);return}if(!e){this.log("Not logged in. Run `rulemetric auth login` to authenticate.");return}let n=new Date(e.expiresAt).getTime();if(Number.isNaN(n)||Date.now()>=n){this.log("Session expired. Run `rulemetric auth login` to re-authenticate.");return}this.log(`Logged in as: ${e.email}`),this.log(`Session expires: ${c(e.expiresAt)}`),this.log(`Config: ${t()}`)}};export{o as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as f,b as k,c as S,d as x,e as R,f as n,g as y}from"../../chunk-VALRPZXH.js";import{b as C,c as w,g as v,h as b}from"../../chunk-QI3FJKGK.js";import{a as u}from"../../chunk-
|
|
1
|
+
import{a as f,b as k,c as S,d as x,e as R,f as n,g as y}from"../../chunk-VALRPZXH.js";import{b as C,c as w,g as v,h as b}from"../../chunk-QI3FJKGK.js";import{a as u}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{l as m}from"../../chunk-PZNWH4VQ.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{existsSync as O}from"node:fs";import{Flags as c}from"@oclif/core";var g=class E extends u{static{h(this,"CaptureScope")}static description="Show or set which projects RuleMetric captures \u2014 the Codex sweep and hook-driven sessions each have their own scope";static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --add ~/work/client-a --add ~/work/client-b","<%= config.bin %> <%= command.id %> --tool hooks --add ~/work/client-a","<%= config.bin %> <%= command.id %> --tool hooks --off","<%= config.bin %> <%= command.id %> --remove ~/work/client-a","<%= config.bin %> <%= command.id %> --off","<%= config.bin %> <%= command.id %> --all"];static flags={tool:c.string({description:'Which capture path to edit: "codex" (the worker transcript sweep, the default) or "hooks" (Claude Code / Cursor / Copilot / Antigravity hook sessions).',options:["codex","hooks"],default:"codex"}),add:c.string({description:"Capture sessions under this path (repeatable). Implies an allowlist.",multiple:!0}),remove:c.string({description:"Stop capturing under this path (repeatable).",multiple:!0}),off:c.boolean({description:"Turn this capture path off entirely.",exclusive:["all"]}),all:c.boolean({description:"Capture every project (the default).",exclusive:["off"]}),clear:c.boolean({description:"Remove this scope, restoring the default."})};async run(){let{flags:o}=await this.parse(E),s=m(),d=f(s);if(!((o.add?.length??0)>0||(o.remove?.length??0)>0||o.off||o.all||o.clear)){await this.show(s,d);return}for(let t of[...o.add??[],...o.remove??[]])R(t)||this.error(`Not an absolute path: ${t}
|
|
2
2
|
Use an absolute path or ~/\u2026 \u2014 relative paths cannot be matched against a session's cwd.`);for(let t of o.add??[]){let a=x(t);O(a)||this.warn(`${a} does not exist yet \u2014 added anyway, but nothing will match until it does.`)}let e;try{e=k(s)}catch(t){o.clear||this.error(t instanceof Error?t.message:String(t));let a=y(s);this.warn(`${f(s)} was not valid JSON \u2014 saved it to ${a} and starting fresh.`),e={}}let i=o.tool??"codex",r=void 0,l=!1;if(o.clear&&({config:e}=n(e,{op:"clear"},r,i)),o.off&&({config:e}=n(e,{op:"mode",mode:"off"},r,i)),o.all&&({config:e}=n(e,{op:"mode",mode:"all"},r,i)),o.remove?.length){let t=n(e,{op:"remove",roots:o.remove},r,i);e=t.config,l=t.emptiedToOff}o.add?.length&&({config:e}=n(e,{op:"add",roots:o.add},r,i)),S(s,e),l&&(this.log(`Removed the last root \u2014 ${i==="hooks"?"hook":"Codex"} capture is now OFF rather than silently capturing everything.`),this.log("Use --all to go back to capturing every project.")),await this.show(s,d),this.log(""),this.log(i==="hooks"?"Takes effect on the next hook fire. No restart needed.":"Takes effect on the next sweep (within ~30s). No restart needed.")}async show(o,s){let d=await C({configDir:o}),p=await w({configDir:o}),e=h((i,r,l,t)=>{if(this.log(`${i}: ${l}`),r.roots.length)for(let a of r.roots)this.log(` \u2022 ${a}`);r.error&&(this.log(" This scope is FAILING CLOSED \u2014 nothing is being captured on this path."),this.log(` Fix the file, or run \`rulemetric capture scope ${i==="Hook capture"?"--tool hooks ":""}--clear\` to start over.`)),r.source==="env"&&this.log(` Set by environment variable, which outranks the config file (${t}).`)},"print");e("Codex capture",d,v(d),"RULEMETRIC_CODEX_CAPTURE / RULEMETRIC_CODEX_ROOTS"),e("Hook capture",p,b(p),"RULEMETRIC_HOOKS_CAPTURE / RULEMETRIC_HOOKS_ROOTS"),this.log(`Config: ${s}`)}};export{g as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g,b as d,c as p}from"../../chunk-W2MV25SB.js";import{a as c}from"../../chunk-
|
|
1
|
+
import{a as g,b as d,c as p}from"../../chunk-W2MV25SB.js";import{a as c}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a}from"../../chunk-ZLLER3HP.js";import{Flags as i}from"@oclif/core";var o=class m extends c{static{a(this,"Catalog")}static description="Browse the org instruction catalog";static flags={badge:i.string({description:"Filter by badge",options:["recommended","required"]}),scope:i.string({description:"Filter by scope",options:["org","team"]}),search:i.string({description:"Search by name or description"})};async run(){let{flags:e}=await this.parse(m);this.requireAuth();let s=new URLSearchParams;e.badge&&s.set("badge",e.badge),e.scope&&s.set("scope",e.scope),e.search&&s.set("search",e.search);let r=await n(`/api/catalog?${s.toString()}`);if(r.length===0){this.log("No instructions found in catalog.");return}for(let t of r){let l=t.badge?` [${t.badge}]`:"",f=t.tags?.length?` (${t.tags.join(", ")})`:"";this.log(` ${d(t.name,40)} \u2014 ${p(t.scope)}${l} v${t.version}${f} ${g(t.updatedAt)}`)}this.log(`
|
|
2
2
|
${r.length} instruction(s) found.`)}};export{o as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as i}from"../../chunk-
|
|
1
|
+
import{a as i}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as n}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as c}from"@oclif/core";var o=class s extends i{static{t(this,"CatalogRecommend")}static description="Get AI-powered instruction recommendations for a project";static args={projectId:c.string({description:"ID of the project",required:!0})};async run(){let{args:a}=await this.parse(s);this.requireAuth(),this.log(`Analyzing project and generating recommendations...
|
|
2
2
|
`);let r=await n(`/api/projects/${a.projectId}/recommendations`,{});if(r.error&&this.warn(`Note: ${r.error}`),r.recommendations.length===0){this.log("No recommendations found.");return}for(let e of r.recommendations)this.log(` ${(e.score*100).toFixed(0)}% \u2014 ${e.instructionId}`),this.log(` ${e.reason}
|
|
3
3
|
`)}};export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../../chunk-4VN5PG2S.js";import{a as n}from"../../chunk-
|
|
1
|
+
import{a as o}from"../../chunk-4VN5PG2S.js";import{a as n}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as i}from"../../chunk-ZLLER3HP.js";import{printTable as t}from"@oclif/table";var a=class s extends n{static{i(this,"CronsList")}static description="List manually-runnable maintenance tasks";static examples=["<%= config.bin %> crons list"];async run(){await this.parse(s),t({data:o.map(e=>({Name:e.name,"Scheduled by":e.scheduledBy,Description:e.description})),columns:["Name","Scheduled by","Description"]}),this.log(""),this.log("Scheduled crons run in Supabase pg_cron \u2014 audit them with:"),this.log(` psql "$DATABASE_URL" -c 'select jobname, schedule, active from cron.job;'`),this.log("Run any task above on demand with: rulemetric crons run <name>")}};export{a as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as $}from"../../chunk-4VN5PG2S.js";import{a as k}from"../../chunk-
|
|
1
|
+
import{a as $}from"../../chunk-4VN5PG2S.js";import{a as k}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as b}from"../../chunk-E5FI5YHO.js";import{A as f,B as g,z as h}from"../../chunk-I2U5GNNM.js";import{f as p}from"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as d}from"../../chunk-ZLLER3HP.js";import{Args as _,Flags as y}from"@oclif/core";var l=class w extends k{static{d(this,"CronsRun")}static description="Run a maintenance task synchronously, right now";static examples=["<%= config.bin %> crons run cron_check_changelog","<%= config.bin %> crons run cron_suggest_instructions --quiet"];static args={name:_.string({description:"Task name (run `rulemetric crons list` to see all)",required:!0})};static flags={"dry-run":y.boolean({description:"For Harbor, print the saved engine/model and supported tasks without running them"}),quiet:y.boolean({char:"q",description:"Suppress per-line log output; print summary only"})};async run(){let{args:s,flags:a}=await this.parse(w);this.requireAuth();let o=$.find(e=>e.name===s.name);o||this.error(`Unknown task: ${s.name}
|
|
2
2
|
Run \`rulemetric crons list\` to see available tasks.`);let t=null;if(s.name==="harbor_ab"){let e=await b("/api/settings/measurement");t=e.execution.harbor?p.parse(e.execution.harbor):null;for(let r of h("proven")){let m=f(r,t);if(m){this.log(`Unsupported: ${m}`);continue}let i=g(r,"manual",t);this.log(`${r.task}: ${t?.engine??"claude"} / ${i.model}, ${i.class}, ${i.nTrials} trials per arm`)}if(a["dry-run"])return}else a["dry-run"]&&this.error("--dry-run is currently supported only for harbor_ab");let u;try{({runManualTask:u}=await import("../../lib/manual-tasks.js"))}catch(e){let r=e?.code;throw(r==="ERR_MODULE_NOT_FOUND"||r==="MODULE_NOT_FOUND")&&this.error("`crons run` needs the worker runtime, which isn't available in this install.\nReinstall the CLI and verify that its runtime dependencies are present. A database credential is not required for end-user maintenance tasks."),e}this.log(`\u25B6 Running ${o.name} \u2026`);let v=Date.now(),n=await u(s.name,{measurement:t});if(!a.quiet)for(let e of n.logs){let r=e.level==="error"||e.level==="warn"?`[${e.level}]`:"";this.log(` ${r} ${e.message}`)}let c=((n.durationMs??Date.now()-v)/1e3).toFixed(1);n.ok?this.log(`\u2713 ${o.name} completed in ${c}s (${n.logs.length} log line${n.logs.length===1?"":"s"})`):this.error(`\u2717 ${o.name} failed after ${c}s: ${n.error}`)}};export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-Z7LBSVG3.js";import"../chunk-IZTIYR5Q.js";import"../chunk-RFLO7L5X.js";import"../chunk-KTLRSRHF.js";import"../chunk-7CQBFCHP.js";import"../chunk-3AV3GTMP.js";import"../chunk-E5FI5YHO.js";import"../chunk-I2U5GNNM.js";import"../chunk-XQYAVSUQ.js";import"../chunk-PZNWH4VQ.js";import{a as i}from"../chunk-ZLLER3HP.js";import{Flags as r}from"@oclif/core";var a=class s extends o{static{i(this,"Dashboard")}static description="Interactive TUI dashboard showing session analytics, outcomes, friction, and insights";static examples=["<%= config.bin %> dashboard","<%= config.bin %> dashboard --period 30days"];static flags={period:r.string({char:"p",default:"week",options:["today","week","30days","month","all"],description:"Initial time period"})};async run(){let{flags:e}=await this.parse(s),{renderDashboard:t}=await import("../dashboard/Dashboard.js");await t(e.period)}};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as q,d as K}from"../chunk-TYFEWLYZ.js";import{b as L,c as W}from"../chunk-V5U3E4BZ.js";import{a as J}from"../chunk-2TJ7Q2OU.js";import{e as O,f as _,g as M}from"../chunk-QWCEZEDO.js";import"../chunk-KKDHD4XA.js";import"../chunk-SZ62CP55.js";import{d as oe,e as ne}from"../chunk-L5ILEWHH.js";import"../chunk-M7QSC64D.js";import"../chunk-DZRBB34J.js";import"../chunk-KR32Y5Q5.js";import"../chunk-G7V4ZZZ3.js";import"../chunk-RITL4NU3.js";import{i as z,j as Q,k as Z,m as ee,n as te}from"../chunk-GYKYJJNF.js";import"../chunk-V6L25LFD.js";import"../chunk-GWQ24FQP.js";import"../chunk-PPAHIVG5.js";import"../chunk-CT7FWSIU.js";import"../chunk-5MXZJWQS.js";import"../chunk-AHLVY52I.js";import"../chunk-PPQFN62M.js";import"../chunk-N7ODX6PO.js";import{a as V}from"../chunk-OZQNSELV.js";import"../chunk-HFGO5762.js";import"../chunk-VS5ROGDP.js";import"../chunk-NAS7FIGM.js";import"../chunk-VZYNZS5U.js";import"../chunk-U2NT5OSQ.js";import"../chunk-KGURGIZ2.js";import"../chunk-GYNZ3OZF.js";import"../chunk-UPFH72PF.js";import"../chunk-3HJT572X.js";import"../chunk-CDY7TQFZ.js";import"../chunk-KFNFLMUR.js";import"../chunk-FLP6WIJV.js";import"../chunk-JP6ULOEX.js";import"../chunk-SVZYRGO5.js";import"../chunk-WULEBQPI.js";import{d as F}from"../chunk-GPBN4ROE.js";import"../chunk-6XTLP2G7.js";import"../chunk-PJ3WHQ67.js";import{a as X,b as D,c as Y,g as j,h as G}from"../chunk-QI3FJKGK.js";import{a as B}from"../chunk-TQFHRD5B.js";import"../chunk-IZTIYR5Q.js";import"../chunk-5LTJNYCP.js";import"../chunk-3EZZGA72.js";import"../chunk-XAGNGQL3.js";import"../chunk-3AV3GTMP.js";import{a as U,e as y}from"../chunk-5VWVQCNR.js";import"../chunk-MHLHLJ5T.js";import"../chunk-XQYAVSUQ.js";import{a as N,g as v,l as x}from"../chunk-PZNWH4VQ.js";import{a as S}from"../chunk-ZLLER3HP.js";import{spawnSync as le}from"node:child_process";import{existsSync as ce,readFileSync as ue}from"node:fs";import{join as se}from"node:path";var I=class h extends B{static{S(this,"Diagnostics")}static description='Diagnose capture / proxy / connectivity problems (e.g. a client-side "502 Bad Gateway")';static examples=["<%= config.bin %> diagnostics"];baseUrl(){return process.env.RULEMETRIC_API_URL??N().apiUrl??U}async checkDirect(){let r=process.env.HTTPS_PROXY,i=process.env.HTTP_PROXY;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let s=new AbortController,l=setTimeout(()=>s.abort(),8e3);try{return(await globalThis.fetch(`${this.baseUrl()}/health`,{signal:s.signal})).ok}catch{return!1}finally{clearTimeout(l),r!==void 0&&(process.env.HTTPS_PROXY=r),i!==void 0&&(process.env.HTTP_PROXY=i)}}configuredProxy(){if(process.env.HTTPS_PROXY)return process.env.HTTPS_PROXY;for(let r of["settings.local.json","settings.json"]){let i=se(process.cwd(),".claude",r);if(ce(i))try{let s=JSON.parse(ue(i,"utf8"));if(s.env?.HTTPS_PROXY)return s.env.HTTPS_PROXY}catch{}}return null}checkThroughProxy(r){let i=le("curl",["-sS","-x",r,"--max-time","8","-o","/dev/null","-w","%{http_code}",`${this.baseUrl()}/health`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return i.error||typeof i.stdout!="string"?null:i.stdout.trim()==="200"}async run(){await this.parse(h);let r=process.version,i=this.configuredProxy(),s=i!=null,[l,m,d]=await Promise.all([this.checkDirect(),M(O),M(_)]),p=s&&i?this.checkThroughProxy(i):null,t=S((e,c,T)=>{let u=c===null?"\u2013":c?"[OK]":"[!!]";this.log(` ${u} ${e.padEnd(22)} ${T}`)},"line");this.log("RuleMetric diagnostics"),this.log(""),t("Node",!L(r),`${r}${L(r)?" (< 20.11 \u2014 breaks the bundled proxy)":""}`),t("API (direct)",l,`${this.baseUrl()}/health ${l?"reachable":"UNREACHABLE"}`),t("Authenticated",v(),v()?"yes":"no \u2014 run `rulemetric auth login`"),t("Proxy configured",s?!0:null,s?i:"no HTTPS_PROXY set"),s&&(t("Gateway :"+O,m,m?"listening":"NOT listening"),t("mitmproxy :"+_,d,d?"listening":"not listening (gateway should route direct)"),t("API (via proxy)",p,p===null?"inconclusive (curl unavailable)":p?"reachable":"FAILED \u2014 502/blocked through your proxy"));let a=F();t("claude CLI",a.claudeBin!=null,a.claudeBin??"not found \u2014 LLM features (grading, distill) will no-op"),t("codex CLI",a.codexBin!=null?!0:null,a.codexBin?`${a.codexBin}${a.codexConfiguredModel?` (model ${a.codexConfiguredModel})`:""}`:"not found \u2014 optional; enables the cross-vendor reviewer (evals validate-judge)");let o=null;if(v()&&l)try{o=await y("/api/workers/health")}catch{o=null}if(o){let e=o.worker;t("Worker",!!e.active,e.present?e.active?`online (last heartbeat ${e.ageSeconds??"?"}s ago${e.clientVersion?`, v${e.clientVersion}`:""})`:`NOT RUNNING \u2014 last heartbeat ${A(e.ageSeconds)} ago`:"never connected \u2014 no worker has ever reported in");let c=o.worker.engines;if(c!=null){let u=[c.claude&&"claude",c.codex&&"codex"].filter(Boolean);t("LLM engine",u.length>0,u.length>0?`${u.join(" + ")} available to the worker`:"NONE \u2014 the worker found no `claude` and no `codex`. LLM jobs will complete with empty output rather than failing.")}let T=o.pending.reduce((u,E)=>u+E.count,0);if(T>0){let u=o.verdict.stuck.reduce(($,k)=>$+k.count,0),E=o.verdict.unclaimable.reduce(($,k)=>$+k.count,0),R=(o.verdict.engineBlocked??[]).reduce(($,k)=>$+k.count,0);t("Job queue",u===0&&R===0,`${T} pending`+(u>0?` \u2014 ${u} waiting on this worker`:"")+(R>0?` \u2014 ${R} need a local LLM engine`:"")+(E>0?` \u2014 ${E} need a worker with DATABASE_URL`:""))}else t("Job queue",!0,"empty")}else v()&&l&&t("Worker",null,"could not read /workers/health (older API?)");let n=o?.worker.machine;if(n){let e=n.suspends+n.stalls,c=n.lastPause;t("Worker pauses",e===0?!0:null,e===0?`none since ${n.since} \u2014 no sleep or stall seen by the worker`:`${n.suspends} suspend${n.suspends===1?"":"s"}`+(n.stalls>0?` + ${n.stalls} event-loop stall${n.stalls===1?"":"s"}`:"")+` since ${n.since}, ${A(Math.round(n.pausedMs/1e3))} paused total`+(c?`; last: ${c.kind} of ${A(Math.round(c.wallGapMs/1e3))} ending ${c.detectedAt}`:"")+" \u2014 jobs in flight during a suspend lose their lease and are redone on wake")}let f=await q();if(f){t("Machine sleep (pmset)",f.sleeps===0?!0:null,K(f));for(let e of f.recent.slice(-3)){let c=e.seconds!=null?` (${A(e.seconds)})`:"";this.log(` \u21B3 ${e.at.toISOString()} ${e.kind}${c}: ${e.reason.slice(0,80)}`)}}let C=V(process.cwd()),g=await D({configDir:x()}),re=await Y({configDir:x()}),w=` \u2014 ${G(re)}`,b=J(process.cwd()),H=[b.user&&`user hooks (${b.user})`,b.workspace&&`workspace hooks (${b.workspace})`].filter(Boolean),ie={claude_code:`session hooks (+ proxy for instruction linking)${w}`,codex:`worker transcript sync of ~/.codex/sessions \u2014 ${j(g)}`,cursor:`user hooks (~/.cursor/hooks.json)${w}`,copilot_agent:`workspace hooks${w}`,antigravity:H.length>0?`${H.join(" + ")}${w}`:"NOT CAPTURED \u2014 no rulemetric block in ~/.gemini/config/hooks.json or .agents/hooks.json; run `rulemetric hooks install` (user hooks are on by default)"};this.log(""),this.log(" Capture coverage (agents found on this machine):");for(let e of C)this.log(` \u2022 ${e.padEnd(15)} ${ie[e]??"captured"}`);if(C.includes("codex"))if(g.error)this.log(` ! ${g.error}`);else if(g.mode==="allowlist")for(let e of g.roots)this.log(` \u21B3 ${e}`);else g.mode==="all"&&this.log(` \u21B3 scope it with ${se(x(),X)} ({"codex":{"roots":["/path/to/repo"]}}) or RULEMETRIC_CODEX_CAPTURE=off`);o&&!o.worker.active&&C.includes("codex")&&g.mode!=="off"&&this.log(" ! Codex capture runs INSIDE the worker \u2014 it is stopped while the worker is down."),v()&&l&&await this.reportEvolutionSpend();let P=W({nodeVersion:r,directApiOk:l,httpsProxySet:s,gatewayAlive:m,mitmproxyAlive:d,proxyPathOk:p});this.log("");let ae=P.severity==="ok"?"[OK]":P.severity==="warn"?"[!!]":"[XX]";this.log(`${ae} ${P.headline}`);for(let e of P.hints)this.log(` \u2022 ${e}`);if(o&&o.verdict.severity!=="ok"){let e=o.verdict.severity==="warn"?"[!!]":"[XX]";this.log(""),this.log(`${e} ${o.verdict.headline}`);for(let c of o.verdict.hints)this.log(` \u2022 ${c}`)}}async reportEvolutionSpend(){let r;try{r=await y("/api/eval-targets?type=instruction&limit=200")}catch{return}let i=r.filter(s=>{let l=s.metadata??{};return l.autoEvolveEnabled===!0||l.autoEvolveEnabled==="true"});if(i.length!==0){this.log(""),this.log(" Nightly instruction evolution (cron_instruction_evolution, 07:30 UTC):");for(let s of i){let l=s.metadata??{},m=Q(l),d=z(l);if(m){this.log(` \u2022 ${s.name} \u2014 PAUSED (metadata.autoEvolvePaused). Opt-in preserved.`),this.log(" \u21B3 resume: set autoEvolvePaused=false");continue}let p=null;try{p=(await y(`/api/eval-targets/${s.id}/evals`)).filter(a=>!a.retiredAt).length}catch{}if(this.log(` \u2022 ${s.name}`),p!=null){let t=ne(p,d.minPairs,oe(d,p));if(!t.feasible)this.log(` \u21B3 cannot reach a verdict \u2014 ${t.reason}`);else{let a=Z({liveCases:p,passes:t.passes});this.log(` \u21B3 each night: ${te(a)}`)}}this.log(` \u21B3 pairs budget ${d.minPairs}`+(d.configured?" (metadata.autoEvolvePairs)":" (default)")+` \xB7 writes ${l.autoEvolveApply===!0||l.autoEvolveApply==="true"?"ENABLED":"off (dry run)"}`),d.note&&this.log(` ! ${d.note}`);try{let t=await y(`/api/eval-targets/${s.id}/promotions?limit=1`),a=t.promotions[0];if(a){let n=a.gates?.cost,f=n?.modelCalls?`${n.modelCalls} model calls, ${n.usablePairs??"?"} usable pair(s)`+(n.mde!=null?`, resolved +/-${ee(n.mde)}`:"")+(n.wallMs?`, ${(n.wallMs/6e4).toFixed(0)} min`:""):"cost not recorded (decision predates cost tracking)";this.log(` \u21B3 last run ${new Date(a.createdAt).toISOString().slice(0,10)}: ${a.decision}${a.applied?" (APPLIED)":""} \u2014 ${f}`)}let o=t.counts??{};this.log(` \u21B3 lifetime: ${o.promote??0} promote / ${o.revert??0} revert / ${o.refuse??0} refuse`)}catch{}}this.log(" \u21B3 pause the spend: metadata.autoEvolvePaused=true (keeps the opt-in)")}}};function A(h){if(h===null)return"never";if(h<90)return`${Math.round(h)}s`;let r=Math.round(h/60);return r<90?`${r}m`:`${Math.round(r/60)}h`}S(A,"formatAge");export{I as default};
|
|
1
|
+
import{c as q,d as K}from"../chunk-TYFEWLYZ.js";import{b as E,c as F}from"../chunk-V5U3E4BZ.js";import{a as J}from"../chunk-2TJ7Q2OU.js";import{e as _,f as C,g as M}from"../chunk-QWCEZEDO.js";import"../chunk-KKDHD4XA.js";import"../chunk-SZ62CP55.js";import{d as W}from"../chunk-GPBN4ROE.js";import"../chunk-6XTLP2G7.js";import"../chunk-PJ3WHQ67.js";import{a as V}from"../chunk-OZQNSELV.js";import"../chunk-HFGO5762.js";import"../chunk-VS5ROGDP.js";import{a as B,b as Y,c as D,g as j,h as G}from"../chunk-QI3FJKGK.js";import{a as U}from"../chunk-Z7LBSVG3.js";import"../chunk-IZTIYR5Q.js";import"../chunk-RFLO7L5X.js";import"../chunk-KTLRSRHF.js";import"../chunk-7CQBFCHP.js";import"../chunk-3AV3GTMP.js";import{a as X,e as N}from"../chunk-E5FI5YHO.js";import"../chunk-I2U5GNNM.js";import"../chunk-XQYAVSUQ.js";import{a as I,g as f,l as x}from"../chunk-PZNWH4VQ.js";import{a as T}from"../chunk-ZLLER3HP.js";import{spawnSync as oe}from"node:child_process";import{existsSync as te,readFileSync as ne}from"node:fs";import{join as z}from"node:path";var L=class p extends U{static{T(this,"Diagnostics")}static description='Diagnose capture / proxy / connectivity problems (e.g. a client-side "502 Bad Gateway")';static examples=["<%= config.bin %> diagnostics"];baseUrl(){return process.env.RULEMETRIC_API_URL??I().apiUrl??X}async checkDirect(){let n=process.env.HTTPS_PROXY,s=process.env.HTTP_PROXY;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let l=new AbortController,c=setTimeout(()=>l.abort(),8e3);try{return(await globalThis.fetch(`${this.baseUrl()}/health`,{signal:l.signal})).ok}catch{return!1}finally{clearTimeout(c),n!==void 0&&(process.env.HTTPS_PROXY=n),s!==void 0&&(process.env.HTTP_PROXY=s)}}configuredProxy(){if(process.env.HTTPS_PROXY)return process.env.HTTPS_PROXY;for(let n of["settings.local.json","settings.json"]){let s=z(process.cwd(),".claude",n);if(te(s))try{let l=JSON.parse(ne(s,"utf8"));if(l.env?.HTTPS_PROXY)return l.env.HTTPS_PROXY}catch{}}return null}checkThroughProxy(n){let s=oe("curl",["-sS","-x",n,"--max-time","8","-o","/dev/null","-w","%{http_code}",`${this.baseUrl()}/health`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return s.error||typeof s.stdout!="string"?null:s.stdout.trim()==="200"}async run(){await this.parse(p);let n=process.version,s=this.configuredProxy(),l=s!=null,[c,m,A]=await Promise.all([this.checkDirect(),M(_),M(C)]),k=l&&s?this.checkThroughProxy(s):null,t=T((e,r,b)=>{let a=r===null?"\u2013":r?"[OK]":"[!!]";this.log(` ${a} ${e.padEnd(22)} ${b}`)},"line");this.log("RuleMetric diagnostics"),this.log(""),t("Node",!E(n),`${n}${E(n)?" (< 20.11 \u2014 breaks the bundled proxy)":""}`),t("API (direct)",c,`${this.baseUrl()}/health ${c?"reachable":"UNREACHABLE"}`),t("Authenticated",f(),f()?"yes":"no \u2014 run `rulemetric auth login`"),t("Proxy configured",l?!0:null,l?s:"no HTTPS_PROXY set"),l&&(t("Gateway :"+_,m,m?"listening":"NOT listening"),t("mitmproxy :"+C,A,A?"listening":"not listening (gateway should route direct)"),t("API (via proxy)",k,k===null?"inconclusive (curl unavailable)":k?"reachable":"FAILED \u2014 502/blocked through your proxy"));let d=W();t("claude CLI",d.claudeBin!=null,d.claudeBin??"not found \u2014 LLM features (grading, distill) will no-op"),t("codex CLI",d.codexBin!=null?!0:null,d.codexBin?`${d.codexBin}${d.codexConfiguredModel?` (model ${d.codexConfiguredModel})`:""}`:"not found \u2014 optional; enables the cross-vendor reviewer (evals validate-judge)");let o=null;if(f()&&c)try{o=await N("/api/workers/health")}catch{o=null}if(o){let e=o.worker;t("Worker",!!e.active,e.present?e.active?`online (last heartbeat ${e.ageSeconds??"?"}s ago${e.clientVersion?`, v${e.clientVersion}`:""})`:`NOT RUNNING \u2014 last heartbeat ${S(e.ageSeconds)} ago`:"never connected \u2014 no worker has ever reported in");let r=o.worker.engines;if(r!=null){let a=[r.claude&&"claude",r.codex&&"codex"].filter(Boolean);t("LLM engine",a.length>0,a.length>0?`${a.join(" + ")} available to the worker`:"NONE \u2014 the worker found no `claude` and no `codex`. LLM jobs will complete with empty output rather than failing.")}let b=o.pending.reduce((a,P)=>a+P.count,0);if(b>0){let a=o.verdict.stuck.reduce((h,g)=>h+g.count,0),P=o.verdict.unclaimable.reduce((h,g)=>h+g.count,0),O=(o.verdict.engineBlocked??[]).reduce((h,g)=>h+g.count,0);t("Job queue",a===0&&O===0,`${b} pending`+(a>0?` \u2014 ${a} waiting on this worker`:"")+(O>0?` \u2014 ${O} need a local LLM engine`:"")+(P>0?` \u2014 ${P} need a worker with DATABASE_URL`:""))}else t("Job queue",!0,"empty")}else f()&&c&&t("Worker",null,"could not read /workers/health (older API?)");let i=o?.worker.machine;if(i){let e=i.suspends+i.stalls,r=i.lastPause;t("Worker pauses",e===0?!0:null,e===0?`none since ${i.since} \u2014 no sleep or stall seen by the worker`:`${i.suspends} suspend${i.suspends===1?"":"s"}`+(i.stalls>0?` + ${i.stalls} event-loop stall${i.stalls===1?"":"s"}`:"")+` since ${i.since}, ${S(Math.round(i.pausedMs/1e3))} paused total`+(r?`; last: ${r.kind} of ${S(Math.round(r.wallGapMs/1e3))} ending ${r.detectedAt}`:"")+" \u2014 jobs in flight during a suspend lose their lease and are redone on wake")}let v=await q();if(v){t("Machine sleep (pmset)",v.sleeps===0?!0:null,K(v));for(let e of v.recent.slice(-3)){let r=e.seconds!=null?` (${S(e.seconds)})`:"";this.log(` \u21B3 ${e.at.toISOString()} ${e.kind}${r}: ${e.reason.slice(0,80)}`)}}let R=V(process.cwd()),u=await Y({configDir:x()}),Q=await D({configDir:x()}),$=` \u2014 ${G(Q)}`,w=J(process.cwd()),H=[w.user&&`user hooks (${w.user})`,w.workspace&&`workspace hooks (${w.workspace})`].filter(Boolean),Z={claude_code:`session hooks (+ proxy for instruction linking)${$}`,codex:`worker transcript sync of ~/.codex/sessions \u2014 ${j(u)}`,cursor:`user hooks (~/.cursor/hooks.json)${$}`,copilot_agent:`workspace hooks${$}`,antigravity:H.length>0?`${H.join(" + ")}${$}`:"NOT CAPTURED \u2014 no rulemetric block in ~/.gemini/config/hooks.json or .agents/hooks.json; run `rulemetric hooks install` (user hooks are on by default)"};this.log(""),this.log(" Capture coverage (agents found on this machine):");for(let e of R)this.log(` \u2022 ${e.padEnd(15)} ${Z[e]??"captured"}`);if(R.includes("codex"))if(u.error)this.log(` ! ${u.error}`);else if(u.mode==="allowlist")for(let e of u.roots)this.log(` \u21B3 ${e}`);else u.mode==="all"&&this.log(` \u21B3 scope it with ${z(x(),B)} ({"codex":{"roots":["/path/to/repo"]}}) or RULEMETRIC_CODEX_CAPTURE=off`);o&&!o.worker.active&&R.includes("codex")&&u.mode!=="off"&&this.log(" ! Codex capture runs INSIDE the worker \u2014 it is stopped while the worker is down.");let y=F({nodeVersion:n,directApiOk:c,httpsProxySet:l,gatewayAlive:m,mitmproxyAlive:A,proxyPathOk:k});this.log("");let ee=y.severity==="ok"?"[OK]":y.severity==="warn"?"[!!]":"[XX]";this.log(`${ee} ${y.headline}`);for(let e of y.hints)this.log(` \u2022 ${e}`);if(o&&o.verdict.severity!=="ok"){let e=o.verdict.severity==="warn"?"[!!]":"[XX]";this.log(""),this.log(`${e} ${o.verdict.headline}`);for(let r of o.verdict.hints)this.log(` \u2022 ${r}`)}}};function S(p){if(p===null)return"never";if(p<90)return`${Math.round(p)}s`;let n=Math.round(p/60);return n<90?`${n}m`:`${Math.round(n/60)}h`}T(S,"formatAge");export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as s}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as o}from"../../chunk-ZLLER3HP.js";import{Flags as e}from"@oclif/core";import{readFileSync as p}from"node:fs";var n=class c extends a{static{o(this,"EvalTargetCreate")}static description="Create an eval target (instruction, skill, prompt, or plan to test)";static examples=["<%= config.bin %> eval-targets create --name my-rules --type instruction --file ./CLAUDE.md",'<%= config.bin %> eval-targets create --name my-prompt --type prompt --content "Always use TypeScript"'];static flags={name:e.string({char:"n",description:"Name for the eval target",required:!0}),type:e.string({char:"t",description:"Target type",options:["instruction","skill","prompt","plan"],required:!0}),file:e.string({char:"f",description:"Path to content file"}),content:e.string({char:"c",description:"Content string (alternative to --file)"}),description:e.string({char:"d",description:"Description of the target",default:""})};async run(){let{flags:t}=await this.parse(c);this.requireAuth();let i;t.file?i=p(t.file,"utf-8"):t.content?i=t.content:this.error("Provide either --file or --content");let r=await s("/api/eval-targets",{name:t.name,type:t.type,content:i,description:t.description});this.log(`Created eval target: ${r.name} (${r.id}) v${r.version}`)}};export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as p,b as e}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-
|
|
1
|
+
import{a as p,b as e}from"../../chunk-W2MV25SB.js";import{a as o}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Flags as m}from"@oclif/core";import{printTable as d}from"@oclif/table";var r=class l extends o{static{s(this,"EvalTargetList")}static description="List eval targets";static examples=["<%= config.bin %> eval-targets list","<%= config.bin %> eval-targets list --type instruction"];static flags={type:m.string({char:"t",description:"Filter by type",options:["instruction","skill","prompt","plan"]})};async run(){let{flags:i}=await this.parse(l);this.requireAuth();let c=i.type?`?type=${i.type}`:"",a=await n(`/api/eval-targets${c}`);if(a.length===0){this.log("No eval targets found. Create one with `rulemetric eval-targets create`.");return}d({data:a.map(t=>({Name:e(t.name,30),Type:t.type,Version:`v${t.version}`,Description:e(t.description,40),Updated:p(t.updatedAt)})),columns:["Name","Type","Version","Description","Updated"]})}};export{r as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`);let
|
|
3
|
-
[${t}] shutting down agent...`),
|
|
1
|
+
import{a as j,b as q,c as F,d as X}from"../../chunk-DRX65ZLX.js";import{b as W}from"../../chunk-GH4EZK2O.js";import{c as g}from"../../chunk-HRU6WGCG.js";import{e as U}from"../../chunk-NX3PF3EQ.js";import"../../chunk-RYMQMJ7O.js";import"../../chunk-IEQDLURA.js";import"../../chunk-KINIFUZQ.js";import"../../chunk-2EXQM3UF.js";import"../../chunk-ZYGBABMZ.js";import"../../chunk-RR5EE23Q.js";import"../../chunk-K2PI3OGV.js";import"../../chunk-JVTSJFFI.js";import"../../chunk-IQOBKWVY.js";import"../../chunk-KCX2YDC3.js";import"../../chunk-UFRJ75FW.js";import"../../chunk-6WX3AXMI.js";import"../../chunk-ONDOPTSL.js";import"../../chunk-35NZJWFC.js";import"../../chunk-6Z4JNHBO.js";import"../../chunk-JU5ZNXPK.js";import"../../chunk-YRGNBYZZ.js";import"../../chunk-ID47WFUP.js";import"../../chunk-PD4BUQ2X.js";import"../../chunk-HEO56SKT.js";import"../../chunk-ZVCKDNBT.js";import"../../chunk-FD272ZXG.js";import"../../chunk-5RBLIVBF.js";import"../../chunk-75H3CKWA.js";import"../../chunk-SW24KZ5C.js";import"../../chunk-2WRP6ZJF.js";import"../../chunk-3ZHVP3KE.js";import"../../chunk-2RZDFKX4.js";import"../../chunk-HOQPVOMF.js";import"../../chunk-PRC5N4NB.js";import"../../chunk-JE2JX7IJ.js";import"../../chunk-MOJY6S5J.js";import"../../chunk-XQEI7NOC.js";import"../../chunk-Q42RXJ4R.js";import"../../chunk-M7QSC64D.js";import"../../chunk-E6O2IFOK.js";import"../../chunk-ZFIGOHQ6.js";import"../../chunk-ICULHHNZ.js";import"../../chunk-B5FBLLKT.js";import"../../chunk-NI6RDOZ5.js";import"../../chunk-77FH6UZP.js";import"../../chunk-LKOUL3IF.js";import"../../chunk-SFZSHNZZ.js";import"../../chunk-B56GMANB.js";import"../../chunk-PX2E644Q.js";import"../../chunk-WLLSWFAJ.js";import"../../chunk-VZYNZS5U.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-EYRM7BT4.js";import"../../chunk-NBTH6ZKD.js";import"../../chunk-GIRPEMTW.js";import"../../chunk-ONSRPEUQ.js";import"../../chunk-GRTEWHXU.js";import"../../chunk-3UKZJAFS.js";import"../../chunk-Q37D6V2G.js";import"../../chunk-RBSEE2Z6.js";import"../../chunk-DQYYHX6K.js";import"../../chunk-FKUFJWII.js";import"../../chunk-45CCW25C.js";import"../../chunk-PIVEJTNF.js";import"../../chunk-EA3X4TAE.js";import"../../chunk-6XCD343D.js";import"../../chunk-PCSSIYH6.js";import"../../chunk-G2UGWEMO.js";import"../../chunk-GYNZ3OZF.js";import"../../chunk-OLOECA5V.js";import"../../chunk-WUDHDZOG.js";import"../../chunk-XFOG2PDJ.js";import"../../chunk-SIGZEQ3K.js";import{h as V,i as G}from"../../chunk-YMIO3CVV.js";import"../../chunk-EBGVDX3Z.js";import"../../chunk-UPFH72PF.js";import"../../chunk-LJRE3LZ2.js";import"../../chunk-G2MRNA45.js";import"../../chunk-OT7ZUHJF.js";import"../../chunk-FLXWL4F4.js";import"../../chunk-V6L25LFD.js";import"../../chunk-LQRXWLFJ.js";import"../../chunk-PPAHIVG5.js";import"../../chunk-CT7FWSIU.js";import"../../chunk-5MXZJWQS.js";import"../../chunk-K4LO27GG.js";import"../../chunk-CLPIN7TY.js";import"../../chunk-6UEFCMR2.js";import"../../chunk-3HJT572X.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-FLP6WIJV.js";import"../../chunk-JP6ULOEX.js";import"../../chunk-SVZYRGO5.js";import"../../chunk-WULEBQPI.js";import"../../chunk-MODXEGCU.js";import"../../chunk-MHVHGKDK.js";import"../../chunk-N7ODX6PO.js";import"../../chunk-S7ZQTZNB.js";import"../../chunk-GPBN4ROE.js";import"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import{b as L,d as D,g as v,i as x,j as $,k as M}from"../../chunk-QI3FJKGK.js";import{a as C}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as E}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import{e as A,l as c}from"../../chunk-PZNWH4VQ.js";import{a as e}from"../../chunk-ZLLER3HP.js";import{trace as he,context as ye}from"@opentelemetry/api";import{NodeSDK as z}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as Q}from"@opentelemetry/exporter-trace-otlp-http";import{BatchSpanProcessor as Z,ConsoleSpanExporter as ee,SimpleSpanProcessor as te}from"@opentelemetry/sdk-trace-node";import{Resource as re}from"@opentelemetry/resources";import{ATTR_SERVICE_NAME as oe,ATTR_SERVICE_VERSION as ne}from"@opentelemetry/semantic-conventions";function K(r){if(!r)return{};let o={};for(let n of r.split(",")){let i=n.indexOf("=");if(i===-1)continue;let a=n.slice(0,i).trim(),s=n.slice(i+1).trim();a&&(o[a]=s)}return o}e(K,"parseOtlpHeaders");var f=null;function R(){return process.env.TELEMETRY_ENABLED!=="false"}e(R,"isTelemetryEnabled");function w(r){if(!R()||f!==null)return"off";let o=new re({[oe]:r.serviceName,[ne]:r.serviceVersion??"0.1.0"}),n=process.env.OTEL_EXPORTER_OTLP_ENDPOINT,i,a;if(n){let s=K(process.env.OTEL_EXPORTER_OTLP_HEADERS),p=new Q({url:`${n}/v1/traces`,headers:s});a=new Z(p),i="otlp"}else if(process.env.OTEL_SPAN_EXPORT==="none")a=void 0,i="silent";else{let s=new ee;a=new te(s),i="console"}return f=new z({resource:o,spanProcessors:a?[a]:[]}),f.start(),i}e(w,"initTelemetry");async function h(){f&&(await f.shutdown(),f=null)}e(h,"shutdownTelemetry");import{SpanKind as Ne,SpanStatusCode as _e}from"@opentelemetry/api";import{trace as Ce,context as Le}from"@opentelemetry/api";import*as d from"@sentry/node";var P=!1;function k(r){if(P)return!1;let o=process.env.SENTRY_DSN;return o?(d.init({dsn:o,serverName:r.serviceName,environment:process.env.NODE_ENV??"development",tracesSampleRate:0}),P=!0,!0):!1}e(k,"initSentry");async function y(r){P&&await d.flush(r)}e(y,"flushSentry");import{existsSync as ie,mkdirSync as ae,readFileSync as b,unlinkSync as H,writeFileSync as B}from"node:fs";import{dirname as ce,join as N}from"node:path";import{execFileSync as le}from"node:child_process";var l=N(c(),"evals-agent.lock");function pe(r){try{return process.kill(r,0),!0}catch(o){return o.code==="EPERM"}}e(pe,"pidAlive");function ue(r){if(!pe(r))return!1;try{let o=le("ps",["-p",String(r),"-o","command="],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return/run\.js\s+evals\s+agent|evals\s+agent/.test(o)}catch{return!0}}e(ue,"isLiveAgent");function fe(){try{ae(ce(l),{recursive:!0})}catch{}for(let r=0;r<2;r++)try{return B(l,String(process.pid),{flag:"wx"}),{ok:!0}}catch(o){if(o.code!=="EEXIST")throw o;let n=0;try{n=Number(b(l,"utf-8").trim())}catch{}if(n&&n!==process.pid&&ue(n))return{ok:!1,holder:n};try{H(l)}catch{}}try{B(l,String(process.pid))}catch{}return{ok:!0}}e(fe,"acquireAgentLock");function T(){try{ie(l)&&Number(b(l,"utf-8").trim())===process.pid&&H(l)}catch{}}e(T,"releaseAgentLock");var _=class r extends C{static{e(this,"EvalAgentCommand")}static description="The worker daemon: long-polls /api/work/next, claims jobs, and runs them locally. Installed as a launchd service by `rulemetric service install`.";static examples=["<%= config.bin %> evals agent"];async run(){await this.parse(r),this.requireAuth();let o=fe();if(!o.ok){this.log(`Another rulemetric evals agent is already running (pid ${o.holder}). Refusing to start a second instance.`);return}process.env.PG_APPLICATION_NAME||="rulemetric-agent",k({serviceName:"rulemetric-agent"})&&this.log("[sentry] error capture enabled");let i=w({serviceName:"rulemetric-agent"});i==="otlp"?this.log(`[otel] traces exporting to ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}`):i==="console"?this.log("[otel] cron spans printing to stdout (set OTEL_EXPORTER_OTLP_ENDPOINT to ship to a backend)"):this.log("[otel] disabled (TELEMETRY_ENABLED=false)"),!A()&&!process.env.RULEMETRIC_API_KEY&&this.error("No auth token found. Run `rulemetric auth login` first."),this.log("Starting thin agent (Phase 4b parallel-run)..."),this.log(`Long-polling /api/work/next. Press Ctrl+C to stop.
|
|
2
|
+
`);let s=new AbortController,p=await L({configDir:c()});if(this.log(`[transcript-sync] Codex capture: ${v(p)}`),p.error)this.log(`[transcript-sync] WARNING: ${p.error}`);else if(p.mode==="allowlist")for(let t of p.roots)this.log(`[transcript-sync] \u2022 ${t}`);let m=await D({configDir:c()});if(this.log(`[transcript-sync] Pi capture: ${x(m)}`),m.error)this.log(`[transcript-sync] WARNING: ${m.error}`);else if(m.mode==="allowlist")for(let t of m.roots)this.log(`[transcript-sync] \u2022 ${t}`);let Y=new W({postSnapshot:e((t,u)=>E(`/api/sessions/${t}/context-snapshots`,u),"postSnapshot"),linkInstructions:e(t=>E("/api/sessions/link-instructions",{sessionId:t}),"linkInstructions"),log:e(t=>this.log(`[transcript-sync] ${t}`),"log")}),J=new j({providers:[q(void 0,void 0,$({configDir:c(),onChange:e(t=>this.log(`[transcript-sync] Codex capture changed: ${v(t)}`),"onChange")})),F(void 0,void 0,M({configDir:c(),onChange:e(t=>this.log(`[transcript-sync] Pi capture changed: ${x(t)}`),"onChange")}))],statePath:N(c(),"transcript-sync-state.json"),importTranscript:e(t=>E("/api/sessions/import",t),"importTranscript"),emitInstructions:e(t=>Y.emit(t),"emitInstructions"),log:e(t=>this.log(`[transcript-sync] ${t}`),"log")});X(J,{signal:s.signal,log:e(t=>this.log(`[transcript-sync] ${t}`),"log")});let I=e(async t=>{this.log(`
|
|
3
|
+
[${t}] shutting down agent...`),s.abort(),await Promise.allSettled([y(2e3),h(),g()]),T(),process.exit(0)},"shutdown");process.on("SIGINT",()=>{I("SIGINT")}),process.on("SIGTERM",()=>{I("SIGTERM")});let O=!1,S=V({configDir:c(),packageRoot:this.config.root,version:this.config.version,managed:process.env.RULEMETRIC_MANAGED_WORKER==="1",signal:s.signal,log:e(t=>this.log(`[update] ${t}`),"log")});try{await U({signal:s.signal,log:e(u=>this.log(u),"log"),version:this.config.version,shouldDrain:e(()=>S.target()!==void 0,"shouldDrain"),readInstalledVersion:e(()=>{try{return JSON.parse(b(N(this.config.root,"package.json"),"utf-8")).version??null}catch{return null}},"readInstalledVersion"),onVersionDrift:e(()=>{O=!0},"onVersionDrift")});let t=S.target();t&&!s.signal.aborted&&(s.abort(),S.stop(),await Promise.allSettled([y(2e3),h(),g()]),await G({configDir:c(),packageRoot:this.config.root,currentVersion:this.config.version,targetVersion:t,log:e(u=>this.log(`[update] ${u}`),"log")}),T(),process.exit(1)),O&&(this.log("[upgrade] Installed CLI version changed \u2014 restarting worker onto the new code."),await Promise.allSettled([y(2e3),h(),g()]),T(),process.exit(1))}finally{S.stop(),T(),await g()}}};export{_ as default};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
Preview only. Re-run with --yes to start.`);return}let t={runsCompleted:0,maxRuns:e["max-runs"],batchesRun:0,maxBatches:f},x={targetId:i,targetVersion:a.version,iteration:1,timeout:e.timeout,model:e.model,graderModel:e["grader-model"],skipGrading:!1,targetType:a.type,targetName:a.name};for(;;){let s;try{s=await n(`/api/eval-targets/${i}/judge-calibration`)}catch(o){this.log(`
|
|
3
|
-
\u25A0 stopping \u2014 could not read the power check: ${o instanceof Error?o.message:String(o)}`);break}let E={powered:s.powerCheck?.powered??!1,mde:s.powerCheck?.mde==null?1/0:s.powerCheck.mde},B=s.caseDiscrimination??{total:0,discriminating:0,nonDiscriminating:0,unpaired:0},p=k(E,B,t,{targetEffectPp:c});if(this.log(`
|
|
4
|
-
${p.action==="stop"?"\u25A0":"\u25B8"} ${p.reason}`),p.action==="stop")break;let v=await n(`/api/eval-targets/${i}/evals`);if(v.length===0){this.log("\u25A0 no active cases left \u2014 stopping.");break}let{completed:g,failed:D}=await $({cases:v,targetContent:a.content,concurrency:e["batch-parallel"],runNumber:t.batchesRun+1,opts:x,skipBaseline:e["skip-baseline"],onLog:h(o=>this.log(o),"onLog")});if(t.runsCompleted+=g,t.batchesRun+=1,this.log(`Batch ${t.batchesRun}: ${g} completed, ${D} failed \u2014 ${t.runsCompleted}/${t.maxRuns} runs, ${t.batchesRun}/${t.maxBatches} batches.`),g===0){this.log("\u25A0 batch produced 0 completed runs \u2014 the executor appears broken (check the model / `claude -p`). Aborting.");break}}let d=await n(`/api/eval-targets/${i}/judge-calibration`),u=d.powerCheck?.mde,R=u==null||!Number.isFinite(u)?"unknown":`\xB1${Math.round(u*100)}pp`;this.log(`
|
|
5
|
-
Done: ${t.runsCompleted} run(s) over ${t.batchesRun} batch(es). Final MDE ${R} vs \xB1${c}pp target \u2014 powered: ${d.powerCheck?.powered?"yes":"no"}.`),d.powerCheck?.powered||this.log("Review the Benchmarks/Review tab for the current estimate; raise --max-runs to keep going.")}};export{m as default};
|
|
1
|
+
import{a as i}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as t}from"../../chunk-ZLLER3HP.js";import{Args as o,Flags as e}from"@oclif/core";var r=class extends i{static{t(this,"EvalAutoRun")}static description="Retired adaptive loop; use evals run for one bounded experiment";static examples=["<%= config.bin %> evals run <target-id>"];static args={targetId:o.string({description:"Eval target ID",required:!0})};static flags={yes:e.boolean({char:"y",description:"Actually run. Without this, only previews the plan + cost."}),"max-runs":e.integer({description:"Hard ceiling on completed runs",default:200}),"batch-parallel":e.integer({description:"Concurrent executions within a batch",default:3}),timeout:e.integer({description:"Timeout per eval in ms",default:12e4}),model:e.string({description:"Model for eval execution"}),"grader-model":e.string({description:"Model for grading"}),"skip-baseline":e.boolean({description:"Skip without_target runs (no delta \u2014 not recommended)",default:!1})};async run(){this.error("Adaptive auto-run is retired. Use evals run for one bounded experiment, or enable the target schedule.")}};export{r as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as h,c as f}from"../../chunk-
|
|
1
|
+
import{b as h,c as f}from"../../chunk-T7DAU6DV.js";import"../../chunk-S7ZQTZNB.js";import{a as m}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{e as c}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as u}from"../../chunk-ZLLER3HP.js";import{Args as p,Flags as v}from"@oclif/core";var d=class b extends m{static{u(this,"EvalBenchmarkCommand")}static description="Aggregate eval runs into a benchmark for a target";static examples=["<%= config.bin %> evals benchmark <target-id>","<%= config.bin %> evals benchmark <target-id> --iteration 2"];static args={targetId:p.string({description:"Eval target ID",required:!0})};static flags={iteration:v.integer({description:"Filter runs by iteration",default:1})};async run(){let{args:o,flags:l}=await this.parse(b);this.requireAuth();let g=await c(`/api/eval-targets/${o.targetId}`);this.log(`Aggregating benchmark for "${g.name}" v${g.version}, iteration ${l.iteration}`);let a=await h(o.targetId,l.iteration);a.totalRuns===0&&this.error("No completed runs found. Run evals first with `rulemetric evals run`."),this.log(`
|
|
2
2
|
Aggregated ${a.totalRuns} runs
|
|
3
3
|
`);for(let[e,n]of Object.entries(a.runSummary)){this.log(`${e}:`);for(let[r,i]of Object.entries(n)){let s=i;this.log(` ${r}: mean=${s.mean} stddev=${s.stddev} [${s.min}, ${s.max}]`)}}let t=a.verdict;if(t)if(this.log(`
|
|
4
4
|
Verdict (${t.mode}, baseline=${t.baseline}):`),!t.sufficient)this.log(` ${t.insufficientReason??"insufficient data"} \u2014 no effect claimed`);else{let e=t.delta>=0?"+":"";this.log(` pass-rate delta: ${e}${(t.delta*100).toFixed(0)}% (n=${t.nWith} paired)`),this.log(` 95% CI: ${(t.ci.lower*100).toFixed(0)}\u2013${(t.ci.upper*100).toFixed(0)}%`),t.pValue!=null&&this.log(` McNemar p: ${t.pValue.toFixed(4)}`),this.log(` significant: ${t.significant?"YES":"no"}`)}if(a.notes.length>0){this.log(`
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`);let a=Math.random()>.5,E=a?r.content:e.content,T=a?e.content:r.content,C=a?r.name:e.name,x=a?e.name:r.name,v=[];for(let t of m){this.log(`[${t.name}] Running A...`);let s=await p({prompt:t.prompt,targetContent:E,timeout:o.timeout,model:o.model});this.log(`[${t.name}] Running B...`);let d=await p({prompt:t.prompt,targetContent:T,timeout:o.timeout,model:o.model});(s.error||d.error)&&this.error(`[${t.name}] execution failed (A: ${s.error??"ok"} | B: ${d.error??"ok"}) \u2014 aborting before the blind comparison`),v.push({evalName:t.name,outputA:s.output,outputB:d.output})}this.log(`
|
|
3
|
-
Running blind comparison...`);let N=v.map(t=>`
|
|
4
|
-
## Eval: ${t.evalName}
|
|
5
|
-
|
|
6
|
-
### Output A
|
|
7
|
-
${t.outputA}
|
|
8
|
-
|
|
9
|
-
### Output B
|
|
10
|
-
${t.outputB}
|
|
11
|
-
`).join(`
|
|
12
|
-
---
|
|
13
|
-
`),i=await p({prompt:`Compare these two sets of outputs. For each eval, determine which output (A or B) is better.
|
|
14
|
-
Then provide an overall winner with reasoning.
|
|
15
|
-
|
|
16
|
-
${N}
|
|
17
|
-
|
|
18
|
-
Respond with JSON:
|
|
19
|
-
{
|
|
20
|
-
"per_eval": [
|
|
21
|
-
{ "eval_name": "...", "winner": "A|B|TIE", "reasoning": "..." }
|
|
22
|
-
],
|
|
23
|
-
"overall": {
|
|
24
|
-
"winner": "A|B|TIE",
|
|
25
|
-
"reasoning": "...",
|
|
26
|
-
"strengths_winner": ["..."],
|
|
27
|
-
"weaknesses_loser": ["..."]
|
|
28
|
-
}
|
|
29
|
-
}`,timeout:o.timeout,model:o.model});i.error&&this.error(`Blind comparison failed: ${i.error}`),this.log(`
|
|
30
|
-
=== Comparison Results ===
|
|
31
|
-
`),this.log(`A = "${C}" | B = "${x}"`),a&&this.log("(Labels were swapped for blind comparison)"),this.log(""),this.log(i.output);let u=$(i.output),n=u?A(u,{targetAId:e.id,targetBId:r.id,isSwapped:a}):null;try{let t=await w("/api/eval-comparisons",{targetAId:e.id,targetBId:r.id,targetAVersion:e.version,targetBVersion:r.version,isSwapped:a,winnerTargetId:n?.winnerTargetId??null,perEval:n?.perEval??[],overall:n?.overall??{},rawOutput:i.output,model:o.model??null,status:u?"completed":"parse_failed"});if(this.log(""),n){let s=n.winnerTargetId===e.id?`"${e.name}" v${e.version}`:n.winnerTargetId===r.id?`"${r.name}" v${r.version}`:"TIE";this.log(`Winner: ${s}`)}else this.warn("Judge output was not parseable JSON \u2014 saved as parse_failed with the raw output.");this.log(`Comparison saved: ${t.id} (web: /eval-targets/${e.id} \u2192 Comparisons tab)`)}catch(t){this.error(`Comparison ran but could not be persisted: ${t instanceof Error?t.message:String(t)}`)}}};export{c as default};
|
|
1
|
+
import{a as t}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as r}from"../../chunk-ZLLER3HP.js";import{Args as i,Flags as s}from"@oclif/core";var e=class extends t{static{r(this,"EvalCompareCommand")}static description="Retired blind comparison; use evals run for recorded task outcomes";static examples=["<%= config.bin %> evals run <target-id>"];static args={targetA:i.string({description:"First eval target ID",required:!0}),targetB:i.string({description:"Second eval target ID",required:!0})};static flags={model:s.string({description:"Model for execution and comparison"}),timeout:s.integer({description:"Timeout per eval in ms",default:12e4})};async run(){this.error("Blind preference comparisons are archived. Use evals run to create an experiment with recorded task outcomes.")}};export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"../../chunk-
|
|
1
|
+
import{a as c}from"../../chunk-Z7LBSVG3.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-RFLO7L5X.js";import"../../chunk-KTLRSRHF.js";import"../../chunk-7CQBFCHP.js";import"../../chunk-3AV3GTMP.js";import{f as i}from"../../chunk-E5FI5YHO.js";import"../../chunk-I2U5GNNM.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as m}from"../../chunk-ZLLER3HP.js";import{Args as f,Flags as r}from"@oclif/core";import{readFileSync as g}from"node:fs";var s=class d extends c{static{m(this,"EvalCreate")}static description="Create test cases (evals) for an eval target";static examples=['<%= config.bin %> evals create <target-id> --name "ts-check" --prompt "Write a function to add two numbers"',"<%= config.bin %> evals create <target-id> --from-file evals.json"];static args={targetId:f.string({description:"Eval target ID",required:!0})};static flags={name:r.string({char:"n",description:"Eval name"}),prompt:r.string({char:"p",description:"Test prompt"}),expectations:r.string({char:"e",description:"Assertion (repeatable)",multiple:!0}),"from-file":r.string({description:"Bulk create from JSON file"})};async run(){let{args:n,flags:e}=await this.parse(d);if(this.requireAuth(),e["from-file"]){let a=JSON.parse(g(e["from-file"],"utf-8")),p=Array.isArray(a)?a:a.evals;for(let t of p){let l=await i(`/api/eval-targets/${n.targetId}/evals`,{name:t.name,prompt:t.prompt,expectations:t.expectations??[],files:t.files??[]});this.log(`Created eval: ${l.name} (${l.id})`)}this.log(`Created ${p.length} evals.`);return}(!e.name||!e.prompt)&&this.error("Provide --name and --prompt, or use --from-file for bulk creation");let o=await i(`/api/eval-targets/${n.targetId}/evals`,{name:e.name,prompt:e.prompt,expectations:e.expectations??[]});this.log(`Created eval: ${o.name} (${o.id})`)}};export{s as default};
|