@rulemetric/cli 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +1 -1
- package/dist/{chunk-POEMCITL.js → chunk-3NWJ7CZ2.js} +1 -1
- package/dist/{chunk-RMRVUI7B.js → chunk-5PMTNNA6.js} +1 -1
- package/dist/{chunk-EMLLGASZ.js → chunk-5TM7AOH2.js} +1 -1
- package/dist/{chunk-QAMHZY2P.js → chunk-5VNEHPGC.js} +1 -1
- package/dist/{chunk-HNYHZO2J.js → chunk-6AAAHV2B.js} +1 -1
- package/dist/{chunk-3FNTV2TW.js → chunk-6T6YFPBW.js} +1 -1
- package/dist/{chunk-XGMOVQ5G.js → chunk-6TGFU6RU.js} +1 -1
- package/dist/chunk-77FH6UZP.js +111 -0
- package/dist/{chunk-N4YPDZJF.js → chunk-7BCZDVIU.js} +1 -1
- package/dist/{chunk-WWQWHC4K.js → chunk-BDQTVYYF.js} +1 -1
- package/dist/chunk-CQD2R3BA.js +3 -0
- package/dist/{chunk-I6ZQOMZS.js → chunk-CVPAKEEZ.js} +1 -1
- package/dist/{chunk-QRIJ3AHP.js → chunk-CYCH2EQC.js} +1 -1
- package/dist/{chunk-AGEZAKCC.js → chunk-CZBO3A6B.js} +1 -1
- package/dist/{chunk-JTYVBR5H.js → chunk-DANMUHNW.js} +1 -1
- package/dist/{chunk-4FJYVYCU.js → chunk-DX6IPDED.js} +1 -1
- package/dist/{chunk-OP4U3XBZ.js → chunk-DXNUCWUX.js} +1 -1
- package/dist/{chunk-BMT5WMEV.js → chunk-EBWV4SUS.js} +1 -1
- package/dist/{chunk-NYNHX7OX.js → chunk-F5PJN2EY.js} +1 -1
- package/dist/{chunk-MMLRWCBW.js → chunk-FS3TAQAE.js} +1 -1
- package/dist/{chunk-RXZLBSDO.js → chunk-FXQS7AEZ.js} +1 -1
- package/dist/{chunk-LJRJ2RAC.js → chunk-FZMO7XSN.js} +3 -3
- package/dist/{chunk-XMTKP74H.js → chunk-GDLQNY4V.js} +1 -1
- package/dist/{chunk-76UKAFNM.js → chunk-GIXHG5FK.js} +1 -1
- package/dist/{chunk-XJ25HFIT.js → chunk-GLBWNB2N.js} +1 -1
- package/dist/{chunk-IO46ICZY.js → chunk-H2FMAJUJ.js} +1 -1
- package/dist/{chunk-BAITMD76.js → chunk-H33XYL7O.js} +1 -1
- package/dist/{chunk-6ANODRDT.js → chunk-H4QPAEEA.js} +1 -1
- package/dist/{chunk-V55ROUNP.js → chunk-HM63AB2C.js} +1 -1
- package/dist/{chunk-B5X6HCBK.js → chunk-ISYU5BMU.js} +1 -1
- package/dist/{chunk-AIYFT4P6.js → chunk-J6RQ5AH2.js} +1 -1
- package/dist/{chunk-YK2IEHLB.js → chunk-KE5K3F7J.js} +1 -1
- package/dist/{chunk-VIFOLTZT.js → chunk-KEVDLLHT.js} +1 -1
- package/dist/{chunk-OVS7ZDJ4.js → chunk-L562Y4RN.js} +1 -1
- package/dist/chunk-MOJY6S5J.js +1 -0
- package/dist/{chunk-IQEZ3T5A.js → chunk-MYGVN6X4.js} +1 -1
- package/dist/{chunk-44TYRMIS.js → chunk-NWV66NMA.js} +1 -1
- package/dist/{chunk-43VKTVM3.js → chunk-O4K4M5G6.js} +1 -1
- package/dist/{chunk-5Z3H5JHK.js → chunk-PJ4RIUI3.js} +1 -1
- package/dist/{chunk-XMA6SWOT.js → chunk-PXYK4MBX.js} +1 -1
- package/dist/{chunk-EUHRTEVJ.js → chunk-QENSCK77.js} +1 -1
- package/dist/{chunk-5BT375C7.js → chunk-QNSIBPWG.js} +1 -1
- package/dist/{chunk-3IMRLHJJ.js → chunk-QPAOX7P2.js} +1 -1
- package/dist/{chunk-RG3R4EAB.js → chunk-QPVUGTDP.js} +1 -1
- package/dist/{chunk-2UK4DZFW.js → chunk-RE7RAZQ5.js} +1 -1
- package/dist/{chunk-MXHAXY66.js → chunk-RR7V5CK5.js} +1 -1
- package/dist/{chunk-SCQK52SL.js → chunk-RSVNQ2XI.js} +1 -1
- package/dist/{chunk-35YVHBLL.js → chunk-RYCVPQYK.js} +1 -1
- package/dist/{chunk-VU24IH5S.js → chunk-SFZPFNC6.js} +1 -1
- package/dist/{chunk-H6FVXVGG.js → chunk-T47SFA5X.js} +1 -1
- package/dist/{chunk-BFQVAU6N.js → chunk-UVCVJKEN.js} +1 -1
- package/dist/{chunk-GKVHFXUQ.js → chunk-VCUW2NAP.js} +1 -1
- package/dist/{chunk-CT6GJQIR.js → chunk-VXNICAVG.js} +1 -1
- package/dist/{chunk-FYZ6HHCV.js → chunk-WIKCYUZC.js} +1 -1
- package/dist/{chunk-FKTT7A4H.js → chunk-WL5ZWQAS.js} +1 -1
- package/dist/{chunk-MU7KKU3O.js → chunk-WUCACPGC.js} +1 -1
- package/dist/{chunk-42A4PUW7.js → chunk-X6CF5KTW.js} +4 -4
- package/dist/{chunk-VXL5H3VZ.js → chunk-XIOYV5A7.js} +1 -1
- package/dist/{chunk-W23OYQXI.js → chunk-XXPWPKTD.js} +1 -1
- package/dist/chunk-XZW5ZHFC.js +15 -0
- package/dist/{chunk-RAQLVO2X.js → chunk-ZTQUGAZG.js} +1 -1
- package/dist/commands/antigravity/backfill.js +1 -1
- package/dist/commands/auth/create-key.js +1 -1
- package/dist/commands/auth/login.js +1 -1
- package/dist/commands/auth/logout.js +1 -1
- package/dist/commands/auth/revoke-key.js +1 -1
- package/dist/commands/auth/signup.js +1 -1
- package/dist/commands/auth/status.js +1 -1
- package/dist/commands/capture/scope.js +1 -1
- package/dist/commands/catalog/index.js +1 -1
- package/dist/commands/catalog/recommend.js +1 -1
- package/dist/commands/crons/list.js +1 -1
- package/dist/commands/crons/run.js +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/diagnostics.js +1 -1
- package/dist/commands/eval-targets/create.js +1 -1
- package/dist/commands/eval-targets/list.js +1 -1
- package/dist/commands/evals/agent.js +1 -1
- package/dist/commands/evals/auto-run.js +1 -1
- package/dist/commands/evals/benchmark.js +1 -1
- package/dist/commands/evals/compare.js +1 -1
- package/dist/commands/evals/create.js +1 -1
- package/dist/commands/evals/optimize-description.js +1 -1
- package/dist/commands/evals/optimize.js +1 -1
- package/dist/commands/evals/refine-cases.js +1 -1
- package/dist/commands/evals/run.js +1 -1
- package/dist/commands/evals/validate-judge.js +1 -1
- package/dist/commands/experiments/list.js +1 -1
- package/dist/commands/gateway/ensure.js +1 -1
- package/dist/commands/hooks/install.js +1 -1
- package/dist/commands/hooks/run.js +1 -1
- package/dist/commands/hooks/uninstall.js +1 -1
- package/dist/commands/instructions/create.js +1 -1
- package/dist/commands/instructions/dedupe.js +1 -1
- package/dist/commands/instructions/delete.js +1 -1
- package/dist/commands/instructions/fork.js +1 -1
- package/dist/commands/instructions/get.js +1 -1
- package/dist/commands/instructions/list.js +1 -1
- package/dist/commands/instructions/promote.js +1 -1
- package/dist/commands/instructions/pull.js +1 -1
- package/dist/commands/instructions/restore.js +1 -1
- package/dist/commands/instructions/retract.js +1 -1
- package/dist/commands/instructions/upstream.js +1 -1
- package/dist/commands/instructions/versions.js +1 -1
- package/dist/commands/launcher.js +1 -1
- package/dist/commands/local/down.js +1 -1
- package/dist/commands/local/up.js +1 -1
- package/dist/commands/org/current.js +1 -1
- package/dist/commands/org/list.js +1 -1
- package/dist/commands/org/switch.js +1 -1
- package/dist/commands/packs/add-instruction.js +1 -1
- package/dist/commands/packs/apply.js +1 -1
- package/dist/commands/packs/create.js +1 -1
- package/dist/commands/packs/fork.js +1 -1
- package/dist/commands/packs/get.js +1 -1
- package/dist/commands/packs/list.js +1 -1
- package/dist/commands/packs/remove-instruction.js +1 -1
- package/dist/commands/proxy/env.js +1 -1
- package/dist/commands/proxy/logs.js +1 -1
- package/dist/commands/proxy/restart.js +1 -1
- package/dist/commands/proxy/setup.js +1 -1
- package/dist/commands/proxy/start.js +1 -1
- package/dist/commands/proxy/status.js +1 -1
- package/dist/commands/proxy/stop.js +1 -1
- package/dist/commands/research/backfill.js +1 -1
- package/dist/commands/research/tail-transcript.js +1 -1
- package/dist/commands/service/install.js +1 -1
- package/dist/commands/service/status.js +1 -1
- package/dist/commands/service/uninstall.js +1 -1
- package/dist/commands/sessions/analyze.js +1 -1
- package/dist/commands/sessions/delete.js +1 -1
- package/dist/commands/sessions/end.js +1 -1
- package/dist/commands/sessions/import.js +1 -1
- package/dist/commands/sessions/list.js +1 -1
- package/dist/commands/sessions/start.js +1 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/skills/export-approved.js +1 -1
- package/dist/commands/skills/install.js +1 -1
- package/dist/commands/skills/list.js +1 -1
- package/dist/commands/skills/publish.js +1 -1
- package/dist/commands/skills/search.js +1 -1
- package/dist/commands/skills/update.js +1 -1
- package/dist/commands/suggestions/accept.js +1 -1
- package/dist/commands/suggestions/auto.js +1 -1
- package/dist/commands/suggestions/dismiss.js +1 -1
- package/dist/commands/suggestions/list.js +1 -1
- package/dist/commands/suggestions/refresh.js +1 -1
- package/dist/commands/suggestions/undo.js +1 -1
- package/dist/dashboard/Dashboard.js +1 -1
- package/dist/dashboard/data.js +1 -1
- package/dist/dashboard/launcher/LauncherOverlay.js +1 -1
- package/dist/dashboard/launcher/api.js +1 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +1 -1
- package/dist/dashboard/panels/measurement.js +1 -1
- package/dist/lib/active-org-refresh.js +1 -1
- package/dist/lib/agent-loop.js +1 -1
- package/dist/lib/antigravity-transcript.js +1 -1
- package/dist/lib/api-client.js +1 -1
- package/dist/lib/ensure-api-key.js +1 -1
- package/dist/lib/ensure-fresh-token.js +1 -1
- package/dist/lib/eval-benchmark.js +1 -1
- package/dist/lib/eval-candidate-run.js +1 -1
- package/dist/lib/eval-case-generator.js +1 -1
- package/dist/lib/eval-conversation-handler.js +1 -1
- package/dist/lib/eval-resume.js +1 -1
- package/dist/lib/eval-run-batch.js +1 -1
- package/dist/lib/evolution-enrolment.js +1 -1
- package/dist/lib/insights/generation/installed-asks.js +1 -1
- package/dist/lib/insights/generation/project-evidence.js +1 -0
- package/dist/lib/insights/generation/prompts.js +1 -1
- package/dist/lib/insights/nomination/nominate.js +1 -1
- package/dist/lib/instruction-proposer.js +1 -1
- package/dist/lib/instructions/acceptance/accept-events.js +1 -1
- package/dist/lib/instructions/acceptance/accept-hook.js +1 -1
- package/dist/lib/instructions/acceptance/hook-install.js +1 -1
- package/dist/lib/instructions/acceptance/reverse-applications.js +1 -1
- package/dist/lib/instructions/acceptance/suggestion-accept.js +1 -1
- package/dist/lib/jobs/handlers/cron-auto-accept-suggestions.js +1 -1
- package/dist/lib/jobs/handlers/cron-eval-autorun.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-evolution.js +1 -1
- package/dist/lib/jobs/handlers/cron-instruction-training.js +1 -1
- package/dist/lib/jobs/handlers/cron-reconcile-attribution.js +1 -1
- package/dist/lib/jobs/handlers/cron-refine-cases.js +1 -1
- package/dist/lib/jobs/handlers/cron-refresh-pricing.js +1 -1
- package/dist/lib/jobs/handlers/cron-retire-unused-skills.js +1 -1
- package/dist/lib/jobs/handlers/cron-suggest-instructions.js +1 -1
- package/dist/lib/jobs/handlers/distill-memories.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab-verdict.js +1 -1
- package/dist/lib/jobs/handlers/harbor-ab.js +1 -1
- package/dist/lib/jobs/handlers/process-changelog.js +1 -1
- package/dist/lib/jobs/handlers/process-conversation.js +1 -1
- package/dist/lib/jobs/handlers/process-eval.js +1 -1
- package/dist/lib/jobs/handlers/process-insights.js +1 -1
- package/dist/lib/jobs/handlers/process-judge-review.js +1 -1
- package/dist/lib/jobs/handlers/process-launch.js +1 -1
- package/dist/lib/jobs/handlers/process-memory-ab.js +1 -1
- package/dist/lib/jobs/handlers/process-run-cleanup.js +1 -1
- package/dist/lib/jobs/handlers/process-session-goal.js +1 -1
- package/dist/lib/jobs/shed-retry.js +1 -1
- package/dist/lib/judge-review-runner.js +1 -1
- package/dist/lib/llm-client.js +1 -1
- package/dist/lib/manual-tasks.js +1 -1
- package/dist/lib/refine-cases.js +1 -1
- package/dist/lib/research-client.js +1 -1
- package/dist/lib/retraction.js +1 -1
- package/dist/lib/setup-steps.js +1 -1
- package/dist/lib/telemetry.js +1 -1
- package/dist/lib/terminal-target-heartbeat.js +1 -1
- package/dist/lib/work-report.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-DHX4U6EC.js +0 -13
- package/dist/chunk-E7GQJML3.js +0 -1
- package/dist/chunk-SJKS3PYX.js +0 -109
|
@@ -36,13 +36,13 @@ Only include instructions with a relevance score >= ${.5}. Order by score descen
|
|
|
36
36
|
Name: ${e.name}
|
|
37
37
|
Description: ${e.description}
|
|
38
38
|
Tags: ${e.tags.join(", ")}
|
|
39
|
-
Preview: ${e.contentPreview}`.length+2}i(le,"renderedSize");var H=["Added","Changed","Fixed","Removed","Deprecated","Security"],ue=/^##\s+\[([^\]]+)\](?:\s*[-–]\s*(\d{4}-\d{2}-\d{2}))?\s*$/,me=/^###\s+(.+?)\s*$/,de=/^[-*]\s+(.*\S)\s*$/,pe=/^ {2,}(\S.*)$/;function fe(e){let t=e.split(/\r?\n/),n=[],o=null,r=null,s=null;for(let a of t){let c=a.match(ue);if(c){o&&n.push(o);let m=c[1].trim();o={version:m,date:c[2]??null,unreleased:m.toLowerCase()==="unreleased",sections:{}},r=null,s=null;continue}if(!o)continue;let l=a.match(me);if(l){let m=l[1].trim();H.includes(m)?(r=m,o.sections[r]||(o.sections[r]=[]),s=o.sections[r]):(r=null,s=null);continue}if(!r||!s)continue;let u=a.match(de);if(u){s.push(u[1]);continue}let f=a.match(pe);if(f&&s.length>0){s[s.length-1]+=" "+f[1].trim();continue}}return o&&n.push(o),{entries:n}}i(fe,"parseChangelog");function he(e){return e.entries.filter(t=>t.unreleased?!1:Object.values(t.sections).some(n=>n&&n.length>0))}i(he,"announceableEntries");function
|
|
40
|
-
`),r=[];for(let m=0;m<o.length;m+=1)
|
|
39
|
+
Preview: ${e.contentPreview}`.length+2}i(le,"renderedSize");var H=["Added","Changed","Fixed","Removed","Deprecated","Security"],ue=/^##\s+\[([^\]]+)\](?:\s*[-–]\s*(\d{4}-\d{2}-\d{2}))?\s*$/,me=/^###\s+(.+?)\s*$/,de=/^[-*]\s+(.*\S)\s*$/,pe=/^ {2,}(\S.*)$/;function fe(e){let t=e.split(/\r?\n/),n=[],o=null,r=null,s=null;for(let a of t){let c=a.match(ue);if(c){o&&n.push(o);let m=c[1].trim();o={version:m,date:c[2]??null,unreleased:m.toLowerCase()==="unreleased",sections:{}},r=null,s=null;continue}if(!o)continue;let l=a.match(me);if(l){let m=l[1].trim();H.includes(m)?(r=m,o.sections[r]||(o.sections[r]=[]),s=o.sections[r]):(r=null,s=null);continue}if(!r||!s)continue;let u=a.match(de);if(u){s.push(u[1]);continue}let f=a.match(pe);if(f&&s.length>0){s[s.length-1]+=" "+f[1].trim();continue}}return o&&n.push(o),{entries:n}}i(fe,"parseChangelog");function he(e){return e.entries.filter(t=>t.unreleased?!1:Object.values(t.sections).some(n=>n&&n.length>0))}i(he,"announceableEntries");function E(e){let t=/^(#{1,6})\s+/.exec(e);return t?t[1].length:0}i(E,"headingLevel");function B(e){return e.replace(/^#{1,6}\s+/,"").replace(/[`*_~]/g,"").trim().toLowerCase()}i(B,"normaliseHeading");function ge(e,t){let n=B(t);if(n.length===0)return{content:e,removed:!1,removedText:null,reason:"not-found"};let o=e.split(`
|
|
40
|
+
`),r=[];for(let m=0;m<o.length;m+=1)E(o[m])>0&&B(o[m])===n&&r.push(m);if(r.length===0)return{content:e,removed:!1,removedText:null,reason:"not-found"};if(r.length>1)return{content:e,removed:!1,removedText:null,reason:"ambiguous"};let s=r[0],a=E(o[s]),c=o.length;for(let m=s+1;m<o.length;m+=1){let v=E(o[m]);if(v>0&&v<=a){c=m;break}}let l=o.slice(s,c).join(`
|
|
41
41
|
`),u=[...o.slice(0,s),...o.slice(c)];return u.join("").trim().length===0?{content:e,removed:!1,removedText:null,reason:"would-empty-file"}:{content:u.join(`
|
|
42
42
|
`).replace(/\n{3,}/g,`
|
|
43
43
|
|
|
44
44
|
`),removed:!0,removedText:l}}i(ge,"removeMarkdownSection");function ye(e,t){let n=t.trim();if(n.length===0)return{content:e,removed:!1,removedText:null,reason:"not-found"};let o=e.indexOf(n);if(o===-1)return{content:e,removed:!1,removedText:null,reason:"not-found"};if(e.indexOf(n,o+1)!==-1)return{content:e,removed:!1,removedText:null,reason:"ambiguous"};let r=(e.slice(0,o)+e.slice(o+n.length)).replace(/\n{3,}/g,`
|
|
45
45
|
|
|
46
|
-
`);return r.trim().length===0?{content:e,removed:!1,removedText:null,reason:"would-empty-file"}:{content:r,removed:!0,removedText:n}}i(ye,"removeExactBlock");var U=["HTTPS_PROXY","HTTP_PROXY","NODE_EXTRA_CA_CERTS"];function xe(e,t){if(!e||typeof e!="object")return{value:e,removed:!1,removedDescriptions:[],reason:"not-found"};let n=structuredClone(e);if(!n.hooks)return{value:n,removed:!1,removedDescriptions:[],reason:"not-found"};let o=[];for(let[r,s]of Object.entries(n.hooks)){if(!Array.isArray(s))continue;let a=s.filter(c=>{let l=(c.hooks??[]).some(u=>typeof u.command=="string"&&u.command.includes(t));return l&&o.push(`${r}: ${c.matcher??"*"} \u2192 ${(c.hooks??[]).map(u=>u.command).join(", ")}`),!l});a.length===0?delete n.hooks[r]:n.hooks[r]=a}return Object.keys(n.hooks).length===0&&delete n.hooks,{value:n,removed:o.length>0,removedDescriptions:o,...o.length===0?{reason:"not-found"}:{}}}i(xe,"removeHookByCommand");function _e(e,t){if(!e||typeof e!="object")return{value:e,removed:!1,removedDescriptions:[],reason:"not-found"};let n=structuredClone(e);return!n.mcpServers||!(t in n.mcpServers)?{value:n,removed:!1,removedDescriptions:[],reason:"not-found"}:(delete n.mcpServers[t],Object.keys(n.mcpServers).length===0&&delete n.mcpServers,{value:n,removed:!0,removedDescriptions:[`mcpServers.${t}`]})}i(_e,"removeMcpServer");function v(e){if(!e||typeof e!="object")return[];let t=e.env;return t?U.filter(n=>n in t):[]}i(v,"protectedEnvKeysPresent");function Ee(e,t){let n=v(e),o=new Set(v(t));return n.filter(r=>!o.has(r))}i(Ee,"lostProtectedEnvKeys");function Se(e,t){let n=`HTTP ${e}`;if(!t||typeof t!="object")return{message:n};let o=t,r=typeof o.error=="string"&&o.error?o.error:o.error?JSON.stringify(o.error):n,s=typeof o.code=="string"&&o.code?o.code:void 0;return s?{message:r,code:s}:{message:r}}i(Se,"parseApiError");var T=["inside","outside"];function y(e){return e.trim().toLowerCase()}i(y,"normalizeDependencyKey");function ve(e){let t=[];if(T.includes(e.boundaryClass)||t.push({field:"boundaryClass",message:`must be one of ${T.join(" | ")}`}),!Array.isArray(e.targets)||e.targets.length===0)t.push({field:"targets",message:"a proposal that cannot name the paths it writes cannot be applied"});else{for(let r of e.targets)if(typeof r!="string"||r.trim().length===0){t.push({field:"targets",message:"target paths must be non-empty"});break}let n=e.targets.filter(r=>typeof r=="string"&&(r.startsWith("/")||/^[A-Za-z]:[\\/]/.test(r)));n.length>0&&t.push({field:"targets",message:`targets must be project-relative (absolute: ${n.join(", ")})`});let o=e.targets.filter(r=>typeof r=="string"&&r.split(/[\\/]/).includes(".."));o.length>0&&t.push({field:"targets",message:`targets must not traverse outside the project (${o.join(", ")})`})}for(let n of["requires","provides"]){let o=e[n];if(!Array.isArray(o)){t.push({field:n,message:"must be an array of dependency keys"});continue}o.some(r=>typeof r!="string"||r.trim().length===0)&&t.push({field:n,message:"dependency keys must be non-empty strings"})}return t}i(ve,"validateArtifactSpec");function Ae(e,t){let n=[],o=new Set(e.targets??[]);if(t.kind==="delete-paths"){e.boundaryClass!=="inside"&&n.push({field:"inverse",message:"deleting paths is only an inverse for `inside` artifacts; an `outside` path may hold text we did not write"}),t.paths.length===0&&n.push({field:"inverse.paths",message:"nothing to delete \u2014 this is not an inverse"});let r=t.paths.filter(s=>!o.has(s));return r.length>0&&n.push({field:"inverse.paths",message:`would delete paths the spec never declared: ${r.join(", ")}`}),n}return e.boundaryClass!=="outside"&&n.push({field:"inverse",message:"a compensation is only an inverse for `outside` artifacts; an `inside` path owes an exact undo"}),(!t.backupPath||t.backupPath.trim().length===0)&&n.push({field:"inverse.backupPath",message:"an `outside` write owes a backup"}),(!t.hashAtWrite||t.hashAtWrite.trim().length===0)&&n.push({field:"inverse.hashAtWrite",message:"without the post-write hash the undo cannot tell a drifted file from an untouched one"}),o.has(t.file)||n.push({field:"inverse.file",message:`wrote ${t.file}, which the spec did not declare as a target`}),t.kind==="remove-marked-region"?(!t.startMarker||!t.endMarker)&&n.push({field:"inverse",message:"an `outside` region needs both markers, or the undo cannot tell where our text ends"}):t.command.trim().length===0&&n.push({field:"inverse.command",message:"the exact command written is the identity of the entry; without it the undo is a search"}),n}i(Ae,"validateArtifactInverse");var z="artifact";function A(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}i(A,"stringArray");function Te(e){if(!e||typeof e!="object")return null;let t=e[z];if(!t||typeof t!="object")return null;let n=t;return{boundaryClass:n.boundaryClass,targets:A(n.targets),requires:A(n.requires),provides:A(n.provides)}}i(Te,"parseArtifactSpec");var be=["applied","measuring","improved","inconclusive","harmful","rollback_ready"];function K(e){return e.appliedAt?e.appliedAt instanceof Date?e.appliedAt.getTime():new Date(e.appliedAt).getTime():0}i(K,"appliedAtMs");function ke(e){return[...e].sort((t,n)=>{let o=K(n)-K(t);return o!==0?o:(n.applySeq??0)-(t.applySeq??0)})}i(ke,"orderForReversal");var Y=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PostToolUse","PreCompact","Notification","Stop","SubagentStop"],b=".claude/settings.local.json";function G(e){return`# rm-artifact:${e}`}i(G,"hookTag");function Ce(e,t){return`${e.trim()} ${G(t)}`}i(Ce,"taggedHookCommand");var Oe=new Set(["if","then","else","elif","fi","for","while","until","do","done","case","esac","function","return","exit","cd","echo","test","true","false"]);function k(e){let t=e.trim().split(/\s+/)[0]??"";return!/^[a-z][a-z0-9_-]*$/.test(t)||Oe.has(t)?null:y(`cmd:${t}`)}i(k,"inferredCommandRequirement");function we(e,t){let n=new Set((t?.requires??[]).map(y).filter(Boolean)),o=k(e.command);return o&&n.add(o),{boundaryClass:"outside",targets:[b],requires:[...n],provides:(t?.provides??[]).map(y).filter(Boolean)}}i(we,"hookArtifactSpec");function x(e){let t=[];Y.includes(e.event)||t.push({field:"event",message:`unknown hook event ${JSON.stringify(e.event)} \u2014 a hook on an event that never fires is indistinguishable from one that was never installed`});let n=(e.command??"").trim();return n.length===0?t.push({field:"command",message:"a hook with no command installs nothing"}):(/[\r\n]/.test(n)&&t.push({field:"command",message:"multi-line commands are refused: the identity tag is a trailing shell comment, which would silence only the final line, and a human reviewing an install should read one line"}),n.includes("\0")&&t.push({field:"command",message:"command contains a NUL byte"}),n.includes("rulemetric")&&t.push({field:"command",message:'refused: `rulemetric hooks uninstall` deletes every hook whose command contains "rulemetric", so installing one here would make this hook collateral damage of an unrelated command'}),n.includes("rm-artifact:")&&t.push({field:"command",message:"command already carries an artifact tag \u2014 installing it would produce two identities for one entry"})),e.matcher!==void 0&&(typeof e.matcher!="string"||e.matcher.trim().length===0)&&t.push({field:"matcher",message:"matcher must be a non-empty string when present"}),t}i(x,"validateHookSpec");function Re(e){let t=[`runs on: ${e.event}${e.matcher?` (tools matching ${e.matcher})`:""}`,`spawns: ${e.command.trim()}`,`writes: ${b} (one entry, tagged with this artifact's id)`],n=k(e.command);return n&&t.push(`needs: ${n} on PATH`),t}i(Re,"describeHookCapability");var q="hook";function h(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(h,"asRecord");function F(e){let t=e.event,n=e.command;if(typeof t!="string"||typeof n!="string")return null;let o=typeof e.matcher=="string"?e.matcher:void 0;return{event:t,matcher:o,command:n}}i(F,"readBareSpec");function W(e){let t=h(e.hooks)??e,n=[];for(let[o,r]of Object.entries(t))if(Array.isArray(r))for(let s of r){let a=h(s);if(!a)continue;let c=typeof a.matcher=="string"&&a.matcher.length>0?a.matcher:void 0,l=Array.isArray(a.hooks)?a.hooks:[];for(let u of l){let f=h(u)?.command;typeof f=="string"&&n.push({event:o,matcher:c,command:f})}}return n.length===0?{spec:null,problems:[]}:n.length>1?{spec:null,problems:[{field:"hook",message:`proposal describes ${n.length} hook entries; one proposal installs exactly one hook, so its inverse stays exact and its review stays readable`}]}:{spec:n[0],problems:[]}}i(W,"readSettingsFragment");function Le(e){let t=[],n=/```[a-zA-Z]*\n([\s\S]*?)```/g,o;for(;(o=n.exec(e))!==null;)t.push(o[1]);return t}i(Le,"fencedBlocks");function Ie(e){let t=h(h(e.frontmatter)?.artifact),n=t?h(t[q]):null;if(n){let o=F(n);if(o)return{spec:o,problems:x(o),source:"envelope"};let r=W(n);if(r.spec)return{spec:r.spec,problems:x(r.spec),source:"envelope"};if(r.problems.length>0)return{spec:null,problems:r.problems,source:"envelope"}}for(let o of Le(e.content??"")){let r;try{r=JSON.parse(o)}catch{continue}let s=h(r);if(!s)continue;let a=F(s);if(a)return{spec:a,problems:x(a),source:"content-fragment"};let c=W(s);if(c.spec)return{spec:c.spec,problems:x(c.spec),source:"content-fragment"};if(c.problems.length>0)return{spec:null,problems:c.problems,source:"content-fragment"}}return{spec:null,problems:[{field:"hook",message:"no hook spec found \u2014 a hook proposal must carry {event, command} in its artifact envelope or a JSON settings fragment in its body"}],source:"none"}}i(Ie,"parseHookSpec");var V=25,C=N,X=[{task:"rm-batch-task",instructions:"rm-batch-task/inject.md",class:"proven",axis:"reward",measured:"2026-09-02 n=25/arm Haiku 4.5: 0/25 \u2192 25/25, delta +1.000, 95% CI [+0.734, +1.000]"},{task:"rm-locality-task",instructions:"rm-locality-task/inject.md",class:"proven",axis:"cost",measured:"2026-09-02 n=25/arm Haiku 4.5: 25/25 both arms, cost \u221225.6%/trial, 95% CI [\u22120.0171, \u22120.0107]"},{task:"rm-migrations-task",instructions:"rm-migrations-task/inject.md",class:"negative",axis:"reward",measured:"2026-08-31 Haiku 4.5: flat after two reworks \u2014 redundant with the model's priors on this shape"},{task:"rm-pagination-task",instructions:"rm-pagination-task/inject.md",class:"negative",axis:"reward",measured:"2026-09-02 n=25/arm Haiku 4.5: 25/25 baseline under --allowedTools Bash; the rule costs +8.0%/trial and buys nothing"}];function Ne(e){return X.filter(t=>t.class===e)}i(Ne,"harborTasksOfClass");function J(e,t){return t?.engine==="pi"?"Pi is supported for eval trials, not Harbor tasks":t?.engine==="codex"&&e.axis==="cost"?`${e.task}: dollar-cost telemetry is unavailable for Codex; reward calibration remains supported`:null}i(J,"harborTaskSupport");function Pe(e,t,n=null){let o=n?I.parse(n):null,r=J(e,o);if(r)throw new Error(r);let s=!o||o.engine==="claude"&&o.model===C;return{task:e.task,instructions:e.instructions,class:s?e.class:"unvalidated",axis:e.axis,model:o?.model??C,...o?{measurement:o}:{},nTrials:V,lane:t}}i(Pe,"harborPayloadFor");var De=/[\p{L}\p{N}]+/gu;function O(e){let t=new Set;for(let n of e.toLowerCase().matchAll(De)){let o=` ${n[0]} `;for(let r=0;r+3<=o.length;r+=1)t.add(o.slice(r,r+3))}return t}i(O,"trigrams");function g(e,t){let n=O(e),o=O(t);if(n.size===0||o.size===0)return 0;let r=0,[s,a]=n.size<=o.size?[n,o]:[o,n];for(let l of s)a.has(l)&&(r+=1);let c=n.size+o.size-r;return c===0?0:r/c}i(g,"trigramSimilarity");var R=.3,je=15;function w(e){let n=e.replace(/<!--[\s\S]*?-->/g," ").replace(/```[\s\S]*?```/g," "),o=[];for(let r of n.split(`
|
|
46
|
+
`);return r.trim().length===0?{content:e,removed:!1,removedText:null,reason:"would-empty-file"}:{content:r,removed:!0,removedText:n}}i(ye,"removeExactBlock");var U=["HTTPS_PROXY","HTTP_PROXY","NODE_EXTRA_CA_CERTS"];function xe(e,t){if(!e||typeof e!="object")return{value:e,removed:!1,removedDescriptions:[],reason:"not-found"};let n=structuredClone(e);if(!n.hooks)return{value:n,removed:!1,removedDescriptions:[],reason:"not-found"};let o=[];for(let[r,s]of Object.entries(n.hooks)){if(!Array.isArray(s))continue;let a=s.filter(c=>{let l=(c.hooks??[]).some(u=>typeof u.command=="string"&&u.command.includes(t));return l&&o.push(`${r}: ${c.matcher??"*"} \u2192 ${(c.hooks??[]).map(u=>u.command).join(", ")}`),!l});a.length===0?delete n.hooks[r]:n.hooks[r]=a}return Object.keys(n.hooks).length===0&&delete n.hooks,{value:n,removed:o.length>0,removedDescriptions:o,...o.length===0?{reason:"not-found"}:{}}}i(xe,"removeHookByCommand");function _e(e,t){if(!e||typeof e!="object")return{value:e,removed:!1,removedDescriptions:[],reason:"not-found"};let n=structuredClone(e);return!n.mcpServers||!(t in n.mcpServers)?{value:n,removed:!1,removedDescriptions:[],reason:"not-found"}:(delete n.mcpServers[t],Object.keys(n.mcpServers).length===0&&delete n.mcpServers,{value:n,removed:!0,removedDescriptions:[`mcpServers.${t}`]})}i(_e,"removeMcpServer");function S(e){if(!e||typeof e!="object")return[];let t=e.env;return t?U.filter(n=>n in t):[]}i(S,"protectedEnvKeysPresent");function ve(e,t){let n=S(e),o=new Set(S(t));return n.filter(r=>!o.has(r))}i(ve,"lostProtectedEnvKeys");function Ee(e,t){let n=`HTTP ${e}`;if(!t||typeof t!="object")return{message:n};let o=t,r=typeof o.error=="string"&&o.error?o.error:o.error?JSON.stringify(o.error):n,s=typeof o.code=="string"&&o.code?o.code:void 0;return s?{message:r,code:s}:{message:r}}i(Ee,"parseApiError");var T=["inside","outside"];function y(e){return e.trim().toLowerCase()}i(y,"normalizeDependencyKey");function Se(e){let t=[];if(T.includes(e.boundaryClass)||t.push({field:"boundaryClass",message:`must be one of ${T.join(" | ")}`}),!Array.isArray(e.targets)||e.targets.length===0)t.push({field:"targets",message:"a proposal that cannot name the paths it writes cannot be applied"});else{for(let r of e.targets)if(typeof r!="string"||r.trim().length===0){t.push({field:"targets",message:"target paths must be non-empty"});break}let n=e.targets.filter(r=>typeof r=="string"&&(r.startsWith("/")||/^[A-Za-z]:[\\/]/.test(r)));n.length>0&&t.push({field:"targets",message:`targets must be project-relative (absolute: ${n.join(", ")})`});let o=e.targets.filter(r=>typeof r=="string"&&r.split(/[\\/]/).includes(".."));o.length>0&&t.push({field:"targets",message:`targets must not traverse outside the project (${o.join(", ")})`})}for(let n of["requires","provides"]){let o=e[n];if(!Array.isArray(o)){t.push({field:n,message:"must be an array of dependency keys"});continue}o.some(r=>typeof r!="string"||r.trim().length===0)&&t.push({field:n,message:"dependency keys must be non-empty strings"})}return t}i(Se,"validateArtifactSpec");function Ae(e,t){let n=[],o=new Set(e.targets??[]);if(t.kind==="delete-paths"){e.boundaryClass!=="inside"&&n.push({field:"inverse",message:"deleting paths is only an inverse for `inside` artifacts; an `outside` path may hold text we did not write"}),t.paths.length===0&&n.push({field:"inverse.paths",message:"nothing to delete \u2014 this is not an inverse"});let r=t.paths.filter(s=>!o.has(s));return r.length>0&&n.push({field:"inverse.paths",message:`would delete paths the spec never declared: ${r.join(", ")}`}),n}return e.boundaryClass!=="outside"&&n.push({field:"inverse",message:"a compensation is only an inverse for `outside` artifacts; an `inside` path owes an exact undo"}),(!t.backupPath||t.backupPath.trim().length===0)&&n.push({field:"inverse.backupPath",message:"an `outside` write owes a backup"}),(!t.hashAtWrite||t.hashAtWrite.trim().length===0)&&n.push({field:"inverse.hashAtWrite",message:"without the post-write hash the undo cannot tell a drifted file from an untouched one"}),o.has(t.file)||n.push({field:"inverse.file",message:`wrote ${t.file}, which the spec did not declare as a target`}),t.kind==="remove-marked-region"?(!t.startMarker||!t.endMarker)&&n.push({field:"inverse",message:"an `outside` region needs both markers, or the undo cannot tell where our text ends"}):t.command.trim().length===0&&n.push({field:"inverse.command",message:"the exact command written is the identity of the entry; without it the undo is a search"}),n}i(Ae,"validateArtifactInverse");var z="artifact";function A(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}i(A,"stringArray");function Te(e){if(!e||typeof e!="object")return null;let t=e[z];if(!t||typeof t!="object")return null;let n=t;return{boundaryClass:n.boundaryClass,targets:A(n.targets),requires:A(n.requires),provides:A(n.provides)}}i(Te,"parseArtifactSpec");var be=["applied","measuring","improved","inconclusive","harmful","rollback_ready"];function K(e){return e.appliedAt?e.appliedAt instanceof Date?e.appliedAt.getTime():new Date(e.appliedAt).getTime():0}i(K,"appliedAtMs");function ke(e){return[...e].sort((t,n)=>{let o=K(n)-K(t);return o!==0?o:(n.applySeq??0)-(t.applySeq??0)})}i(ke,"orderForReversal");var Y=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PostToolUse","PreCompact","Notification","Stop","SubagentStop"],b=".claude/settings.local.json";function G(e){return`# rm-artifact:${e}`}i(G,"hookTag");function Ce(e,t){return`${e.trim()} ${G(t)}`}i(Ce,"taggedHookCommand");var Oe=new Set(["if","then","else","elif","fi","for","while","until","do","done","case","esac","function","return","exit","cd","echo","test","true","false"]);function k(e){let t=e.trim().split(/\s+/)[0]??"";return!/^[a-z][a-z0-9_-]*$/.test(t)||Oe.has(t)?null:y(`cmd:${t}`)}i(k,"inferredCommandRequirement");function we(e,t){let n=new Set((t?.requires??[]).map(y).filter(Boolean)),o=k(e.command);return o&&n.add(o),{boundaryClass:"outside",targets:[b],requires:[...n],provides:(t?.provides??[]).map(y).filter(Boolean)}}i(we,"hookArtifactSpec");function x(e){let t=[];Y.includes(e.event)||t.push({field:"event",message:`unknown hook event ${JSON.stringify(e.event)} \u2014 a hook on an event that never fires is indistinguishable from one that was never installed`});let n=(e.command??"").trim();return n.length===0?t.push({field:"command",message:"a hook with no command installs nothing"}):(/[\r\n]/.test(n)&&t.push({field:"command",message:"multi-line commands are refused: the identity tag is a trailing shell comment, which would silence only the final line, and a human reviewing an install should read one line"}),n.includes("\0")&&t.push({field:"command",message:"command contains a NUL byte"}),n.includes("rulemetric")&&t.push({field:"command",message:'refused: `rulemetric hooks uninstall` deletes every hook whose command contains "rulemetric", so installing one here would make this hook collateral damage of an unrelated command'}),n.includes("rm-artifact:")&&t.push({field:"command",message:"command already carries an artifact tag \u2014 installing it would produce two identities for one entry"})),e.matcher!==void 0&&(typeof e.matcher!="string"||e.matcher.trim().length===0)&&t.push({field:"matcher",message:"matcher must be a non-empty string when present"}),t}i(x,"validateHookSpec");function Re(e){let t=[`runs on: ${e.event}${e.matcher?` (tools matching ${e.matcher})`:""}`,`spawns: ${e.command.trim()}`,`writes: ${b} (one entry, tagged with this artifact's id)`],n=k(e.command);return n&&t.push(`needs: ${n} on PATH`),t}i(Re,"describeHookCapability");var q="hook";function h(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(h,"asRecord");function F(e){let t=e.event,n=e.command;if(typeof t!="string"||typeof n!="string")return null;let o=typeof e.matcher=="string"?e.matcher:void 0;return{event:t,matcher:o,command:n}}i(F,"readBareSpec");function W(e){let t=h(e.hooks)??e,n=[];for(let[o,r]of Object.entries(t))if(Array.isArray(r))for(let s of r){let a=h(s);if(!a)continue;let c=typeof a.matcher=="string"&&a.matcher.length>0?a.matcher:void 0,l=Array.isArray(a.hooks)?a.hooks:[];for(let u of l){let f=h(u)?.command;typeof f=="string"&&n.push({event:o,matcher:c,command:f})}}return n.length===0?{spec:null,problems:[]}:n.length>1?{spec:null,problems:[{field:"hook",message:`proposal describes ${n.length} hook entries; one proposal installs exactly one hook, so its inverse stays exact and its review stays readable`}]}:{spec:n[0],problems:[]}}i(W,"readSettingsFragment");function Le(e){let t=[],n=/```[a-zA-Z]*\n([\s\S]*?)```/g,o;for(;(o=n.exec(e))!==null;)t.push(o[1]);return t}i(Le,"fencedBlocks");function Ie(e){let t=h(h(e.frontmatter)?.artifact),n=t?h(t[q]):null;if(n){let o=F(n);if(o)return{spec:o,problems:x(o),source:"envelope"};let r=W(n);if(r.spec)return{spec:r.spec,problems:x(r.spec),source:"envelope"};if(r.problems.length>0)return{spec:null,problems:r.problems,source:"envelope"}}for(let o of Le(e.content??"")){let r;try{r=JSON.parse(o)}catch{continue}let s=h(r);if(!s)continue;let a=F(s);if(a)return{spec:a,problems:x(a),source:"content-fragment"};let c=W(s);if(c.spec)return{spec:c.spec,problems:x(c.spec),source:"content-fragment"};if(c.problems.length>0)return{spec:null,problems:c.problems,source:"content-fragment"}}return{spec:null,problems:[{field:"hook",message:"no hook spec found \u2014 a hook proposal must carry {event, command} in its artifact envelope or a JSON settings fragment in its body"}],source:"none"}}i(Ie,"parseHookSpec");var V=25,C=N,X=[{task:"rm-batch-task",instructions:"rm-batch-task/inject.md",class:"proven",axis:"reward",measured:"2026-09-02 n=25/arm Haiku 4.5: 0/25 \u2192 25/25, delta +1.000, 95% CI [+0.734, +1.000]"},{task:"rm-locality-task",instructions:"rm-locality-task/inject.md",class:"proven",axis:"cost",measured:"2026-09-02 n=25/arm Haiku 4.5: 25/25 both arms, cost \u221225.6%/trial, 95% CI [\u22120.0171, \u22120.0107]"},{task:"rm-migrations-task",instructions:"rm-migrations-task/inject.md",class:"negative",axis:"reward",measured:"2026-08-31 Haiku 4.5: inconclusive after two exploratory reworks; redundancy unestablished"},{task:"rm-pagination-task",instructions:"rm-pagination-task/inject.md",class:"negative",axis:"reward",measured:"2026-09-02 n=25/arm Haiku 4.5: 25/25 baseline under --allowedTools Bash; observed cost +8.0%/trial; reward equivalence unestablished"}];function Ne(e){return X.filter(t=>t.class===e)}i(Ne,"harborTasksOfClass");function J(e,t){return t?.engine==="pi"?"Pi is supported for eval trials, not Harbor tasks":t?.engine==="codex"&&e.axis==="cost"?`${e.task}: dollar-cost telemetry is unavailable for Codex; reward calibration remains supported`:null}i(J,"harborTaskSupport");function Pe(e,t,n=null){let o=n?I.parse(n):null,r=J(e,o);if(r)throw new Error(r);let s=!o||o.engine==="claude"&&o.model===C;return{task:e.task,instructions:e.instructions,class:s?e.class:"unvalidated",axis:e.axis,model:o?.model??C,...o?{measurement:o}:{},nTrials:V,lane:t}}i(Pe,"harborPayloadFor");var De=/[\p{L}\p{N}]+/gu;function O(e){let t=new Set;for(let n of e.toLowerCase().matchAll(De)){let o=` ${n[0]} `;for(let r=0;r+3<=o.length;r+=1)t.add(o.slice(r,r+3))}return t}i(O,"trigrams");function g(e,t){let n=O(e),o=O(t);if(n.size===0||o.size===0)return 0;let r=0,[s,a]=n.size<=o.size?[n,o]:[o,n];for(let l of s)a.has(l)&&(r+=1);let c=n.size+o.size-r;return c===0?0:r/c}i(g,"trigramSimilarity");var R=.3,je=15;function w(e){let n=e.replace(/<!--[\s\S]*?-->/g," ").replace(/```[\s\S]*?```/g," "),o=[];for(let r of n.split(`
|
|
47
47
|
`)){let s=r.trim();if(s.length===0||s.startsWith("#"))continue;let a=s.replace(/^(?:[-*+]|\d+[.)])\s+/,"").trim();if(a.length!==0)for(let c of a.split(/(?<=[.!?])\s+(?=[A-Z(`"'*])/)){let l=c.trim();l.length>=je&&o.push(l)}}return o}i(w,"splitDirectives");function Z(e,t,n=R){let o=w(e);if(o.length===0)return{redundant:!1,coverage:0,matches:[],novel:[]};let r=t.flatMap(c=>w(c.content).map(l=>({text:l,id:c.id,source:c.source}))),s=[],a=[];for(let c of o){let l=null;for(let u of r){let f=g(c,u.text);f<n||(l===null||f>l.similarity)&&(l={directive:c,matchedDirective:u.text,matchedId:u.id,matchedSource:u.source,similarity:f})}l?s.push(l):a.push(c)}return{redundant:a.length===0,coverage:s.length/o.length,matches:s,novel:a}}i(Z,"assessRedundancy");function $e(e,t=R){let n=[];for(let o=0;o<e.length;o+=1){let r=Z(e[o].content,e.slice(0,o),t);r.matches.length>0&&n.push({instruction:e[o],verdict:r})}return n}i($e,"findInternalRedundancy");var Q=.5,Me=/-(?=[0-9a-f]{6}$)[0-9a-f]*[0-9][0-9a-f]*$/;function L(e){return e.trim().toLowerCase().replace(/^skills--/,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(Me,"").replace(/-+$/,"")}i(L,"skillNameStem");function He(e,t,n=Q){let o=L(e.name);for(let s of t)if(o.length>0&&L(s.name)===o)return{name:s.name,similarity:g(e.content,s.content),reason:"name-stem"};let r=null;for(let s of t){let a=g(e.content,s.content);a<n||(r===null||a>r.similarity)&&(r={name:s.name,similarity:a,reason:"body"})}return r}i(He,"assessSkillDuplication");var Be=new Set(["sh","bash","zsh","fish"]),Ue=new Set(["mjs","cjs","js","ts","py","rb","pl"]),Ke=/(?:^|[\s(`'"])(?:sudo\s+)?(?:node|npx|pnpm|npm|yarn|bun|deno|tsx|ts-node|vitest|jest|python3?|python|ruby|perl|bash|sh|zsh|exec|run|dlx)\s+(?:[-\w=@./]+\s+)*$/,ze=/(?:\.\/)?(?:[\w.@-]+\/)+[\w.@-]+\.\w+/g;function Fe(e){return e.replace(/```[\w-]*\n?/g," ").replace(/`/g," ")}i(Fe,"stripCodeMarkers");function We(e){let t=e.trim();return t=t.replace(/[.,;:)\]]+$/,""),t.startsWith("./")&&(t=t.slice(2)),t.length===0||t.startsWith("/")||t.startsWith("~")||t.startsWith("..")||/[<>{}*?]/.test(t)?null:t}i(We,"normalise");function ee(e){let t=Fe(e),n=new Set,o=[];for(let r of t.matchAll(ze)){let s=r[0],a=r.index??0,c=t.slice(Math.max(0,a-1),a);if(c.length>0&&!/[\s(['"=]/.test(c))continue;let l=We(s);if(!l)continue;let u=l.slice(l.lastIndexOf(".")+1).toLowerCase();(Be.has(u)||Ue.has(u)&&(s.startsWith("./")||Ke.test(t.slice(t.lastIndexOf(`
|
|
48
|
-
`,Math.max(0,a-1))+1,a))))&&(n.has(l)||(n.add(l),o.push({reference:s,path:l})))}return o}i(ee,"extractCommandReferences");function Ye(e,t){return ee(e).filter(n=>!t(n.path))}i(Ye,"findUnresolvableReferences");import Yt from"gray-matter";import{z as te}from"zod";var Xt=te.object({type:te.enum(["instruction","prompt"])});export{se as a,ie as b,_ as c,M as d,fe as e,he as f,ge as g,ye as h,xe as i,_e as j,
|
|
48
|
+
`,Math.max(0,a-1))+1,a))))&&(n.has(l)||(n.add(l),o.push({reference:s,path:l})))}return o}i(ee,"extractCommandReferences");function Ye(e,t){return ee(e).filter(n=>!t(n.path))}i(Ye,"findUnresolvableReferences");import Yt from"gray-matter";import{z as te}from"zod";var Xt=te.object({type:te.enum(["instruction","prompt"])});export{se as a,ie as b,_ as c,M as d,fe as e,he as f,ge as g,ye as h,xe as i,_e as j,ve as k,Ee as l,y as m,Se as n,Ae as o,Te as p,be as q,ke as r,b as s,G as t,Ce as u,we as v,Re as w,Ie as x,C as y,Ne as z,J as A,Pe as B,w as C,Z as D,$e as E,He as F,Ye as G};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l}from"./chunk-ISFPPDDB.js";import{a as p}from"./chunk-5RBLIVBF.js";import{h}from"./chunk-
|
|
1
|
+
import{b as l}from"./chunk-ISFPPDDB.js";import{a as p}from"./chunk-5RBLIVBF.js";import{h}from"./chunk-GIXHG5FK.js";import{a as c}from"./chunk-ZLLER3HP.js";async function g(t){if(!t.worktree?.create)return t;let{branch:e,baseRef:s}=t.worktree,n=await l({repoRoot:t.projectPath,branch:e,baseRef:s});return{...t,projectPath:n.path,gitBranch:n.branch}}c(g,"resolveWorktreeForLaunch");async function L(t,e){let{mirrorId:s,tool:n}=t,{config:r}=t,a=c(o=>e.logger.info(o),"log");if(e.job.attempts>1)throw new p(`process_launch is not safe to retry (attempt ${e.job.attempts}). Re-launch manually.`);r=await g(r),r.worktree?.create&&a(`Worktree resolved: ${r.projectPath} (branch ${r.gitBranch})`),a(`Launching ${n}...`);let{getLauncher:f}=await import("./dist-GSHUC7UU.js"),i=await f(n).launch(r);a(`Launch completed: sessionId=${i.sessionId}`);let u={...i,worktreePath:r.worktree?.create?r.projectPath:void 0,runId:r.runId};return await h(`/api/launch-jobs/${s}/state`,{result:u}).catch(o=>{a(`result persist failed: ${o instanceof Error?o.message:String(o)}`)}),u}c(L,"processLaunch");export{g as a,L as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c,f as m}from"./chunk-
|
|
1
|
+
import{b as c,f as m}from"./chunk-GIXHG5FK.js";import{a as s}from"./chunk-ZLLER3HP.js";var R=new Set([408,429,502,503,504]),_=12e4,T=2e4,b=1e3,l=15e3;function p(t,e){try{t(JSON.stringify({ts:new Date().toISOString(),...e}))}catch{t(`[agent-loop] log_error event=${e.event}`)}}s(p,"structuredLog");function f(t,e){return e.aborted?Promise.resolve(!1):t<=0?Promise.resolve(!0):new Promise(r=>{let a=setTimeout(()=>{e.removeEventListener("abort",o),r(!0)},t),o=s(()=>{clearTimeout(a),e.removeEventListener("abort",o),r(!1)},"onAbort");e.addEventListener("abort",o,{once:!0})})}s(f,"abortableSleep");function g(t){return t instanceof c?R.has(t.statusCode):!0}s(g,"isRetryableReportError");async function S(t,e,r){let a=Date.now()+r.budgetMs,o=b;for(let i=1;;i++)try{return await m(t,e),{ok:!0,attempts:i}}catch(n){let u=a-Date.now();if(!g(n)||u<=0||r.signal.aborted)return{ok:!1,attempts:i,error:n};if(p(r.log,{event:`${r.event}_retry`,jobId:r.jobId,attempt:i,status:n instanceof c?n.statusCode:void 0,error:n instanceof Error?n.message:String(n),retryInMs:Math.min(o,u)}),!await f(Math.min(o,u),r.signal))return{ok:!1,attempts:i,error:n};o=Math.min(o*2,l)}}s(S,"postReportWithRetry");export{R as a,_ as b,T as c,b as d,l as e,p as f,f as g,g as h,S as i};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{a as M}from"./chunk-5RBLIVBF.js";import{c as q}from"./chunk-GLBWNB2N.js";import{a as K,b as Y}from"./chunk-CQD2R3BA.js";import{a as A,d as N}from"./chunk-3UKZJAFS.js";import{a as j,b as k,c as V,d as D}from"./chunk-77FH6UZP.js";import{a as Z}from"./chunk-KE5K3F7J.js";import{b as W,e as B,g as T}from"./chunk-7BCZDVIU.js";import{e as h,f as U,h as m}from"./chunk-GIXHG5FK.js";import{a as L,b as H}from"./chunk-X6CF5KTW.js";import{a as f}from"./chunk-ZLLER3HP.js";var Q=f((l,{limit:a,sort:n,eventTypes:s})=>h(`/api/sessions/${l}/events?limit=${a}&sort=${n}&eventType=${encodeURIComponent(s.join(","))}&hasContent=true`),"fetchTranscriptTurns");async function ms(l,a){let{mirrorId:n,projectPath:s,projectId:r,config:u}=l,e=f(t=>a.logger.info(t),"log");if(u?.sessionId)return es({mirrorId:n,sessionId:u.sessionId},e);e(`Processing insights job ${n}...`),await m(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"reading_data"}});try{let{repaired:t}=await U("/api/sessions/repair-analyzed-at",{});t>0&&e(` Repaired analyzed_at on ${t} orphan session(s).`)}catch(t){e(` Warning: analyzed_at repair failed: ${t instanceof Error?t.message:String(t)}`)}let p=20,C=200,z=15*6e4,F=3,E=Date.now()+z,I=B()==="none"?"no-llm-backend":null;if(I&&a.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"),!I){let t=0,i=0;try{for(;t<C&&Date.now()<E;){let c=await h(`/api/sessions?needsFacets=true&graderVersion=${2}&limit=${p}&offset=${i}`);if(c.length===0)break;e(` Generating facets for ${c.length} un-analyzed sessions (drained ${t} so far)...`);for(let b=0;b<c.length&&!(t>=C||Date.now()>=E);b+=F){let R=c.slice(b,b+F);await Promise.all(R.map(async g=>{if(!(t>=C||Date.now()>=E))try{let d=await N(ss=>Q(g.id,ss));if(d.turnCount<2){t++,i++;return}let O=await T(D,d.text,4096);O&&typeof O.outcome=="string"?(await m(`/api/sessions/${g.id}/enrich`,{analysis:{source:"generated_facets",...O,graderVersion:2},...g.eventCount!=null?{analyzedEventCount:g.eventCount}:{},analyzedTurnCount:d.turnCount}),e(` Generated facets for session ${g.id} (${g.tool}, ${d.turnCount} turns)`)):i++,t++}catch(d){e(` Failed to generate facets for session ${g.id}: ${d instanceof Error?d.message:String(d)}`),t++,i++}}))}if(c.length<p)break}}catch(c){e(` Warning: facet generation failed after ${t} sessions: ${c instanceof Error?c.message:String(c)}`)}if(t>0){let c=Date.now()>=E?`time budget (${Math.round(z/6e4)}m)`:t>=C?`hard cap (${C})`:"queue empty";e(` Facet drain stopped on ${c} after ${t} session(s); the rest resume next run.`)}}let _=await ns(s,r);if(!_)throw new M("No session data found \u2014 ensure sessions are captured and enriched.");e(` Found ${_.stats.sessions} sessions, generating recommendations...`);let y=await Y({projectId:r,projectPath:s},h);_.summary+=`
|
|
2
|
+
|
|
3
|
+
${y.text}`,e(` Session evidence: ${y.sessionIds.length} usable, ${y.failedSessionIds.length} unavailable`);let S=await ts(s,e);S&&e(` Generator memory: ${S.split(`
|
|
4
|
+
`).length} lines of prior-advice context`);let o={},$=[],w=k.length+1;for(let t=0;t<k.length;t++){let i=k[t];e(` [${t+1}/${w}] Generating ${i.name}...`);try{await m(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:i.name,current:t+1,total:w,partial:{...o}}})}catch(d){e(` Warning: progress update failed for ${i.name}: ${d instanceof Error?d.message:String(d)}`)}e(` Running LLM prompt for ${i.name}...`);let c=i.usesGeneratorMemory&&S?`${_.summary}
|
|
5
|
+
${S}`:_.summary,b=Date.now(),R=await T(i.prompt,c,i.maxTokens,{timeoutMs:i.timeoutMs}),g=Date.now()-b;R?(o[i.name]=R,e(` Got result for ${i.name} (${Math.round(g/1e3)}s)`)):($.push(i.name),e(` No result for ${i.name} after ${Math.round(g/1e3)}s (budget ${Math.round((i.timeoutMs??12e4)/1e3)}s) \u2014 section DROPPED`))}e(` [${w}/${w}] Generating at_a_glance...`),await m(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"at_a_glance",current:w,total:w,partial:{...o}}});let X=[_.summary,o.what_works?`
|
|
6
|
+
## What Works
|
|
7
|
+
${JSON.stringify(o.what_works)}`:"",o.friction_analysis?`
|
|
8
|
+
## Friction
|
|
9
|
+
${JSON.stringify(o.friction_analysis)}`:"",o.suggestions?`
|
|
10
|
+
## Suggestions
|
|
11
|
+
${JSON.stringify(o.suggestions)}`:"",o.on_the_horizon?`
|
|
12
|
+
## On the Horizon
|
|
13
|
+
${JSON.stringify(o.on_the_horizon)}`:""].join(`
|
|
14
|
+
`),x=await T(V,X,8192);x&&(o.at_a_glance=x),e(" Uploading results..."),e(` Done! Recommendations generated for job ${n}`),H(o);let v=K(o.recommendation_candidates,y.sessionIds);o.recommendation_candidates=v.candidates;let P=o.suggestions;if(P&&typeof P=="object"&&!Array.isArray(P)){let t=P;t.recommendation_candidates=v.candidates,t.claude_md_additions=[],t.features_to_try=[]}L(o);let J={recommendations:o,sessionEvidence:{sessionIds:y.sessionIds,failedSessionIds:y.failedSessionIds,emptySessionIds:y.emptySessionIds,selection:"recent-8-head-tail",rejectedCandidateTitles:v.rejected},...$.length>0?{sectionsFailed:$}:{},...I?{facetsSkipped:I}:{}};return $.length>0&&e(` \u26A0 ${$.length} section(s) produced nothing: ${$.join(", ")}`),await m(`/api/insights-jobs/${n}/state`,{result:J}).catch(t=>{e(`result persist failed: ${t instanceof Error?t.message:String(t)}`)}),await Z(o,s,e),J}f(ms,"processInsights");async function es(l,a){let{mirrorId:n,sessionId:s}=l;a(`Analyzing session ${s} via tool CLI...`),await m(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"fetching_session"}});let r=await h(`/api/sessions/${s}`);if(r.analysis&&r.analysis.source==="session_analysis")return a(` Session ${s} already analyzed \u2014 skipping (idempotency guard)`),{sessionId:s,skipped:!0,reason:"already_analyzed"};let u=await N(p=>Q(s,p));if(u.turnCount<2)throw new M("Session has too few conversation turns to analyze");await m(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"running_analysis",tool:r.tool}});let e=await W(r.tool,D,u.text);if(!e.ok)throw new Error(`Analysis failed \u2014 ${e.reason}`);return await m(`/api/sessions/${s}/enrich`,{analysis:{source:"session_analysis",tool:r.tool,...e.value,graderVersion:2},...r.eventCount!=null?{analyzedEventCount:r.eventCount}:{},analyzedTurnCount:u.turnCount}),a(` Session ${s} analyzed via ${r.tool}`),{sessionId:s,tool:r.tool,facets:e.value}}f(es,"processSessionAnalysisInline");async function ts(l,a,n=h,s=q){let{asks:r,omitted:u}=s(l);try{let e=await n(`/api/insights/recommendations/history?projectPath=${encodeURIComponent(l??"")}`);return!e||!Array.isArray(e.dismissed)||!Array.isArray(e.repeated)?j({dismissed:[],repeated:[],installed:r,installedOmitted:u}):j({...e,installed:r,installedOmitted:u})}catch(e){return a(` Warning: generator memory unavailable (${e instanceof Error?e.message:String(e)}) \u2014 generating without it`),j({dismissed:[],repeated:[],installed:r,installedOmitted:u})}}f(ts,"fetchGeneratorMemory");async function ns(l,a){try{let n=new URLSearchParams;a?n.set("projectId",a):l&&n.set("projectPath",l);let s=await h(`/api/insights/compute?${n}`);if(!s||s.total_sessions===0)return null;let r=Object.entries(s.tool_counts??{}).sort((e,p)=>p[1]-e[1]).slice(0,10).map(([e,p])=>`${e}: ${p}`).join(", ");return{summary:[`Sessions: ${s.total_sessions}, Messages: ${s.total_messages}, Session-hours: ${Math.round(s.total_duration_hours)} (sum of per-session spans across ${s.sessions_with_meta} measured sessions; concurrent sessions counted separately, so this exceeds elapsed time)`,`Top tools: ${r}`,s.goal_categories&&Object.keys(s.goal_categories).length>0?`Goals: ${JSON.stringify(s.goal_categories)}`:"",s.friction&&Object.keys(s.friction).length>0?`Friction: ${JSON.stringify(s.friction)}`:"",s.outcomes&&Object.keys(s.outcomes).length>0?`Outcomes: ${JSON.stringify(s.outcomes)}`:"",s.projects&&Object.keys(s.projects).length>0?`Projects: ${JSON.stringify(s.projects)}`:""].filter(Boolean).join(`
|
|
15
|
+
`),stats:{sessions:s.total_sessions,totalMessages:s.total_messages,totalSessionHours:s.total_duration_hours,measuredSessions:s.sessions_with_meta,toolCounts:s.tool_counts,goalCounts:s.goal_categories,frictionCounts:s.friction}}}catch(n){throw new G(n instanceof Error?n.message:String(n))}}f(ns,"buildDataSummaryFromApi");var G=class extends Error{static{f(this,"InsightsSummaryUnavailableError")}constructor(a){super(`Could not read session summary (retryable): ${a}`),this.name="InsightsSummaryUnavailableError"}};export{ms as a,ts as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as z}from"./chunk-5RBLIVBF.js";import{a as L}from"./chunk-7MTYUTUN.js";import{b as A}from"./chunk-
|
|
1
|
+
import{a as z}from"./chunk-5RBLIVBF.js";import{a as L}from"./chunk-7MTYUTUN.js";import{b as A}from"./chunk-DXNUCWUX.js";import{a as j,c as G}from"./chunk-T47SFA5X.js";import{f as P}from"./chunk-SWSOEYC7.js";import{a as S}from"./chunk-DVU5PHPM.js";import{a as J,f as T}from"./chunk-FBSZ6KCM.js";import{e as y,f as R,h as f}from"./chunk-GIXHG5FK.js";import{a as E}from"./chunk-ZLLER3HP.js";async function X(s,v){let{mirrorId:l,evalTargetId:u}=s,o=s.measurement?{...s.config,...G({...s.config,measurement:s.measurement})}:s.config,a=E(e=>v.logger.info(e),"log"),i=await y(`/api/eval-targets/${u}`),b=await y(`/api/eval-targets/${u}/evals`);if(b.length===0&&o.generateIfEmpty){a("No eval cases on target \u2014 generating from content via local LLM...");let e=await A({content:i.content,name:i.name,...s.measurement?{measurement:s.measurement}:{}});if(e===null)throw new Error("Case generation requires a local LLM backend (Claude or Codex CLI) \u2014 none available on this worker.");let r=[];for(let t of e)r.push(await R(`/api/eval-targets/${u}/evals`,t));b=r,a(`Generated ${r.length} eval case(s)`)}if(b.length===0)throw new z("No evals defined for target");let F=o.runsPerEval??1,_=o.timeout??12e4,I=o.iteration??1,k=new Set;if(v.job.attempts>1)for(let r=0;;r+=100){let t=await y(`/api/eval-targets/${u}/runs?jobId=${l}&limit=100&offset=${r}`);for(let n of t)k.add(`${n.evalId}|${n.configuration}|${n.runNumber}|${n.iteration}`);if(t.length<100)break}let M=[{name:"with_target",content:i.content}];o.skipBaseline||M.push({name:"without_target"});let d=[];for(let e of b)for(let r of M)for(let t=1;t<=F;t++)k.has(`${e.id}|${r.name}|${t}|${I}`)||d.push({eval_:e,configuration:r.name,targetContent:r.content,runNumber:t});k.size>0&&a(`Resuming attempt ${v.job.attempts}: ${k.size} run(s) already persisted, ${d.length} remaining`);let g=d.length,c=0,$=J(o.engine),p=Math.min(o.parallel??1,4);await f(`/api/eval-jobs/${l}/progress`,{status:"running",progress:{total:g,completed:0,current:null,message:`Starting ${g} eval runs (concurrency: ${p})...`}});let h=[];async function x(e){let r=`${e.configuration} \xB7 ${e.eval_.name} \xB7 run#${e.runNumber}`;a(`[${c+1}/${g}] ${r}`);let t=P({targetType:i.type,targetContent:e.targetContent,targetName:i.name,engine:$});t.leakedFiles.length&&a(`\u26A0 CONTAMINATED ${r}: ${t.leakedFiles.join(", ")} survived the strip`);try{let n=await T({prompt:e.eval_.prompt,targetContent:t.systemPrompt,workDir:t.workDir,timeout:_,model:o.model,engine:$}),m={};return!o.skipGrading&&e.eval_.expectations.length>0&&!n.error&&(m=await S({...j({engine:$,model:o.model},{engine:o.graderEngine,model:o.graderModel}),prompt:e.eval_.prompt,output:n.output,expectations:e.eval_.expectations,timeout:_})),{jobId:l,evalId:e.eval_.id,evalTargetId:i.id,evalTargetVersion:i.version,configuration:e.configuration,runNumber:e.runNumber,iteration:I,status:n.error?"failed":"completed",outputs:{...n.error?{error:n.error}:{transcript:n.output,...n.model?{model:n.model}:{}},methodology:t.methodology,delivery:t.delivery,isolated:t.isWorktree,engine:n.engine??$,model:n.model??null,deliveryRegime:`${i.type}:${$}:${t.methodology}`,...s.measurement?{measurement:s.measurement}:{},...n.provider?{provider:n.provider}:{},...n.costUsd!=null?{costUsd:n.costUsd}:{},...t.leakedFiles.length?{leakedFiles:t.leakedFiles}:{}},timing:{duration_ms:n.durationMs,total_tokens:n.totalTokens},grading:m,worktree:t.isWorktree?!0:void 0}}finally{t.cleanup()}}if(E(x,"processItem"),p<=1)for(let e of d){let r=`${e.configuration} \xB7 ${e.eval_.name} \xB7 run#${e.runNumber}`;await f(`/api/eval-jobs/${l}/progress`,{status:"running",progress:{total:g,completed:c,current:r,message:`Executing ${r}...`}});let t=await x(e);await R("/api/eval-runs",t),h.push(t),c++,await f(`/api/eval-jobs/${l}/progress`,{status:"running",progress:{total:g,completed:c,current:r,message:`Completed ${r}`}})}else{a(`Running ${g} evals with concurrency=${p} (worktree isolation)`);for(let e=0;e<d.length;e+=p){let r=d.slice(e,e+p),t=`batch ${Math.floor(e/p)+1}/${Math.ceil(d.length/p)}`;await f(`/api/eval-jobs/${l}/progress`,{status:"running",progress:{total:g,completed:c,current:t,message:`Executing ${t} (${r.length} parallel)...`}});let n=await Promise.all(r.map(x));for(let m of n)await R("/api/eval-runs",m),h.push(m),c++;await f(`/api/eval-jobs/${l}/progress`,{status:"running",progress:{total:g,completed:c,current:t,message:`Completed ${t}`}})}}let N=O(h),w;if(!o.skipGrading&&h.some(e=>e.grading&&Object.keys(e.grading).length>0))try{a(`Running meta-judge for job ${l}...`);let e=b.map(r=>{let n=h.filter(m=>m.evalId===r.id&&m.configuration==="with_target")[0];return{evalName:r.name,prompt:r.prompt,expectations:r.expectations,grading:n?.grading?n.grading:null,output:n?.outputs?.transcript?.slice(0,500)}});w=await L({...j({engine:$,model:o.model},{engine:o.graderEngine,model:o.graderModel}),targetName:i.name,evalResults:e,timeout:6e4}),a(`Meta-judge: quality=${w.quality_score}/5, issues=${w.issues.length}`)}catch(e){a(`Meta-judge failed (non-fatal): ${e instanceof Error?e.message:String(e)}`)}let C=w?{...N,meta_judgement:w}:N;return a(`Job ${l} completed: ${c}/${g} runs`),await f(`/api/eval-jobs/${l}/state`,{result:C}).catch(e=>{a(`result persist failed: ${e instanceof Error?e.message:String(e)}`)}),C}E(X,"processEval");function O(s){let v=s.filter(a=>a.status==="completed"),l=s.filter(a=>a.status==="failed"),u=v.filter(a=>{let i=a.grading;return i&&Object.keys(i).length>0}),o=u.length>0?u.reduce((a,i)=>a+(i.grading?.summary?.pass_rate??0),0)/u.length:null;return{total:s.length,completed:v.length,failed:l.length,avgPassRate:o}}E(O,"buildSummary");export{X as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as v,b as u,e as y,g as d}from"../../chunk-
|
|
1
|
+
import{a as v,b as u,e as y,g as d}from"../../chunk-BDQTVYYF.js";import{a as h}from"../../chunk-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{f as r}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-QPVUGTDP.js";import{a as w}from"../../chunk-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import{c}from"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import{b as n}from"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{b as r,d as a}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{e as n,i as c}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-QPVUGTDP.js";import{a as h}from"../../chunk-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import{c as d}from"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import{b as l}from"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{b as m,d as p}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{f as n}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{e as b}from"../../chunk-GIXHG5FK.js";import{A as f,B as g,z as h}from"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../chunk-IZTIYR5Q.js";import"../chunk-WL5ZWQAS.js";import"../chunk-KEVDLLHT.js";import"../chunk-DX6IPDED.js";import"../chunk-3AV3GTMP.js";import"../chunk-GIXHG5FK.js";import"../chunk-X6CF5KTW.js";import"../chunk-XQYAVSUQ.js";import"../chunk-PZNWH4VQ.js";import{a as i}from"../chunk-ZLLER3HP.js";import{Flags as r}from"@oclif/core";var a=class s extends o{static{i(this,"Dashboard")}static description="Interactive TUI dashboard showing session analytics, outcomes, friction, and insights";static examples=["<%= config.bin %> dashboard","<%= config.bin %> dashboard --period 30days","<%= config.bin %> dashboard --launcher"];static flags={period:r.string({char:"p",default:"week",options:["today","week","30days","month","all"],description:"Initial time period"}),launcher:r.boolean({char:"l",default:!1,description:"Open the launcher overlay immediately"})};async run(){let{flags:e}=await this.parse(s),{renderDashboard:t}=await import("../dashboard/Dashboard.js");await t(e.period,{openLauncher:e.launcher})}};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as q,d as K}from"../chunk-TYFEWLYZ.js";import{b as L,c as W}from"../chunk-V5U3E4BZ.js";import{a as J}from"../chunk-2TJ7Q2OU.js";import{e as O,f as _,g as M}from"../chunk-QWCEZEDO.js";import"../chunk-KKDHD4XA.js";import"../chunk-SZ62CP55.js";import{d as oe,e as ne}from"../chunk-POEMCITL.js";import"../chunk-M7QSC64D.js";import"../chunk-XGMOVQ5G.js";import{i as z,j as Q,k as Z,m as ee,n as te}from"../chunk-LB24UKHZ.js";import"../chunk-G7V4ZZZ3.js";import"../chunk-43VKTVM3.js";import"../chunk-AHLVY52I.js";import"../chunk-SCQK52SL.js";import"../chunk-ZK3ACE4T.js";import"../chunk-N4YPDZJF.js";import"../chunk-PPAHIVG5.js";import"../chunk-5MXZJWQS.js";import"../chunk-CT7FWSIU.js";import"../chunk-N7ODX6PO.js";import{a as V}from"../chunk-OZQNSELV.js";import"../chunk-HFGO5762.js";import"../chunk-VS5ROGDP.js";import"../chunk-H6FVXVGG.js";import"../chunk-SWSOEYC7.js";import"../chunk-U2NT5OSQ.js";import"../chunk-KGURGIZ2.js";import"../chunk-GYNZ3OZF.js";import"../chunk-UPFH72PF.js";import"../chunk-DVU5PHPM.js";import"../chunk-CDY7TQFZ.js";import"../chunk-VBXL7XO7.js";import"../chunk-FBSZ6KCM.js";import"../chunk-JP6ULOEX.js";import"../chunk-SG4UDDHB.js";import{d as F}from"../chunk-GPBN4ROE.js";import"../chunk-6XTLP2G7.js";import"../chunk-PJ3WHQ67.js";import{a as X,b as D,c as Y,g as j,h as G}from"../chunk-QI3FJKGK.js";import{a as B}from"../chunk-MU7KKU3O.js";import"../chunk-IZTIYR5Q.js";import"../chunk-FKTT7A4H.js";import"../chunk-VIFOLTZT.js";import"../chunk-4FJYVYCU.js";import"../chunk-3AV3GTMP.js";import{a as U,e as y}from"../chunk-76UKAFNM.js";import"../chunk-42A4PUW7.js";import"../chunk-XQYAVSUQ.js";import{a as N,g as v,l as x}from"../chunk-PZNWH4VQ.js";import{a as S}from"../chunk-ZLLER3HP.js";import{spawnSync as le}from"node:child_process";import{existsSync as ce,readFileSync as ue}from"node:fs";import{join as se}from"node:path";var I=class h extends B{static{S(this,"Diagnostics")}static description='Diagnose capture / proxy / connectivity problems (e.g. a client-side "502 Bad Gateway")';static examples=["<%= config.bin %> diagnostics"];baseUrl(){return process.env.RULEMETRIC_API_URL??N().apiUrl??U}async checkDirect(){let r=process.env.HTTPS_PROXY,i=process.env.HTTP_PROXY;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let s=new AbortController,l=setTimeout(()=>s.abort(),8e3);try{return(await globalThis.fetch(`${this.baseUrl()}/health`,{signal:s.signal})).ok}catch{return!1}finally{clearTimeout(l),r!==void 0&&(process.env.HTTPS_PROXY=r),i!==void 0&&(process.env.HTTP_PROXY=i)}}configuredProxy(){if(process.env.HTTPS_PROXY)return process.env.HTTPS_PROXY;for(let r of["settings.local.json","settings.json"]){let i=se(process.cwd(),".claude",r);if(ce(i))try{let s=JSON.parse(ue(i,"utf8"));if(s.env?.HTTPS_PROXY)return s.env.HTTPS_PROXY}catch{}}return null}checkThroughProxy(r){let i=le("curl",["-sS","-x",r,"--max-time","8","-o","/dev/null","-w","%{http_code}",`${this.baseUrl()}/health`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return i.error||typeof i.stdout!="string"?null:i.stdout.trim()==="200"}async run(){await this.parse(h);let r=process.version,i=this.configuredProxy(),s=i!=null,[l,m,d]=await Promise.all([this.checkDirect(),M(O),M(_)]),p=s&&i?this.checkThroughProxy(i):null,t=S((e,c,T)=>{let u=c===null?"\u2013":c?"[OK]":"[!!]";this.log(` ${u} ${e.padEnd(22)} ${T}`)},"line");this.log("RuleMetric diagnostics"),this.log(""),t("Node",!L(r),`${r}${L(r)?" (< 20.11 \u2014 breaks the bundled proxy)":""}`),t("API (direct)",l,`${this.baseUrl()}/health ${l?"reachable":"UNREACHABLE"}`),t("Authenticated",v(),v()?"yes":"no \u2014 run `rulemetric auth login`"),t("Proxy configured",s?!0:null,s?i:"no HTTPS_PROXY set"),s&&(t("Gateway :"+O,m,m?"listening":"NOT listening"),t("mitmproxy :"+_,d,d?"listening":"not listening (gateway should route direct)"),t("API (via proxy)",p,p===null?"inconclusive (curl unavailable)":p?"reachable":"FAILED \u2014 502/blocked through your proxy"));let a=F();t("claude CLI",a.claudeBin!=null,a.claudeBin??"not found \u2014 LLM features (grading, distill) will no-op"),t("codex CLI",a.codexBin!=null?!0:null,a.codexBin?`${a.codexBin}${a.codexConfiguredModel?` (model ${a.codexConfiguredModel})`:""}`:"not found \u2014 optional; enables the cross-vendor reviewer (evals validate-judge)");let o=null;if(v()&&l)try{o=await y("/api/workers/health")}catch{o=null}if(o){let e=o.worker;t("Worker",!!e.active,e.present?e.active?`online (last heartbeat ${e.ageSeconds??"?"}s ago${e.clientVersion?`, v${e.clientVersion}`:""})`:`NOT RUNNING \u2014 last heartbeat ${A(e.ageSeconds)} ago`:"never connected \u2014 no worker has ever reported in");let c=o.worker.engines;if(c!=null){let u=[c.claude&&"claude",c.codex&&"codex"].filter(Boolean);t("LLM engine",u.length>0,u.length>0?`${u.join(" + ")} available to the worker`:"NONE \u2014 the worker found no `claude` and no `codex`. LLM jobs will complete with empty output rather than failing.")}let T=o.pending.reduce((u,E)=>u+E.count,0);if(T>0){let u=o.verdict.stuck.reduce(($,k)=>$+k.count,0),E=o.verdict.unclaimable.reduce(($,k)=>$+k.count,0),R=(o.verdict.engineBlocked??[]).reduce(($,k)=>$+k.count,0);t("Job queue",u===0&&R===0,`${T} pending`+(u>0?` \u2014 ${u} waiting on this worker`:"")+(R>0?` \u2014 ${R} need a local LLM engine`:"")+(E>0?` \u2014 ${E} need a worker with DATABASE_URL`:""))}else t("Job queue",!0,"empty")}else v()&&l&&t("Worker",null,"could not read /workers/health (older API?)");let n=o?.worker.machine;if(n){let e=n.suspends+n.stalls,c=n.lastPause;t("Worker pauses",e===0?!0:null,e===0?`none since ${n.since} \u2014 no sleep or stall seen by the worker`:`${n.suspends} suspend${n.suspends===1?"":"s"}`+(n.stalls>0?` + ${n.stalls} event-loop stall${n.stalls===1?"":"s"}`:"")+` since ${n.since}, ${A(Math.round(n.pausedMs/1e3))} paused total`+(c?`; last: ${c.kind} of ${A(Math.round(c.wallGapMs/1e3))} ending ${c.detectedAt}`:"")+" \u2014 jobs in flight during a suspend lose their lease and are redone on wake")}let f=await q();if(f){t("Machine sleep (pmset)",f.sleeps===0?!0:null,K(f));for(let e of f.recent.slice(-3)){let c=e.seconds!=null?` (${A(e.seconds)})`:"";this.log(` \u21B3 ${e.at.toISOString()} ${e.kind}${c}: ${e.reason.slice(0,80)}`)}}let C=V(process.cwd()),g=await D({configDir:x()}),re=await Y({configDir:x()}),w=` \u2014 ${G(re)}`,b=J(process.cwd()),H=[b.user&&`user hooks (${b.user})`,b.workspace&&`workspace hooks (${b.workspace})`].filter(Boolean),ie={claude_code:`session hooks (+ proxy for instruction linking)${w}`,codex:`worker transcript sync of ~/.codex/sessions \u2014 ${j(g)}`,cursor:`user hooks (~/.cursor/hooks.json)${w}`,copilot_agent:`workspace hooks${w}`,antigravity:H.length>0?`${H.join(" + ")}${w}`:"NOT CAPTURED \u2014 no rulemetric block in ~/.gemini/config/hooks.json or .agents/hooks.json; run `rulemetric hooks install` (user hooks are on by default)"};this.log(""),this.log(" Capture coverage (agents found on this machine):");for(let e of C)this.log(` \u2022 ${e.padEnd(15)} ${ie[e]??"captured"}`);if(C.includes("codex"))if(g.error)this.log(` ! ${g.error}`);else if(g.mode==="allowlist")for(let e of g.roots)this.log(` \u21B3 ${e}`);else g.mode==="all"&&this.log(` \u21B3 scope it with ${se(x(),X)} ({"codex":{"roots":["/path/to/repo"]}}) or RULEMETRIC_CODEX_CAPTURE=off`);o&&!o.worker.active&&C.includes("codex")&&g.mode!=="off"&&this.log(" ! Codex capture runs INSIDE the worker \u2014 it is stopped while the worker is down."),v()&&l&&await this.reportEvolutionSpend();let P=W({nodeVersion:r,directApiOk:l,httpsProxySet:s,gatewayAlive:m,mitmproxyAlive:d,proxyPathOk:p});this.log("");let ae=P.severity==="ok"?"[OK]":P.severity==="warn"?"[!!]":"[XX]";this.log(`${ae} ${P.headline}`);for(let e of P.hints)this.log(` \u2022 ${e}`);if(o&&o.verdict.severity!=="ok"){let e=o.verdict.severity==="warn"?"[!!]":"[XX]";this.log(""),this.log(`${e} ${o.verdict.headline}`);for(let c of o.verdict.hints)this.log(` \u2022 ${c}`)}}async reportEvolutionSpend(){let r;try{r=await y("/api/eval-targets?type=instruction&limit=200")}catch{return}let i=r.filter(s=>{let l=s.metadata??{};return l.autoEvolveEnabled===!0||l.autoEvolveEnabled==="true"});if(i.length!==0){this.log(""),this.log(" Nightly instruction evolution (cron_instruction_evolution, 07:30 UTC):");for(let s of i){let l=s.metadata??{},m=Q(l),d=z(l);if(m){this.log(` \u2022 ${s.name} \u2014 PAUSED (metadata.autoEvolvePaused). Opt-in preserved.`),this.log(" \u21B3 resume: set autoEvolvePaused=false");continue}let p=null;try{p=(await y(`/api/eval-targets/${s.id}/evals`)).filter(a=>!a.retiredAt).length}catch{}if(this.log(` \u2022 ${s.name}`),p!=null){let t=ne(p,d.minPairs,oe(d,p));if(!t.feasible)this.log(` \u21B3 cannot reach a verdict \u2014 ${t.reason}`);else{let a=Z({liveCases:p,passes:t.passes});this.log(` \u21B3 each night: ${te(a)}`)}}this.log(` \u21B3 pairs budget ${d.minPairs}`+(d.configured?" (metadata.autoEvolvePairs)":" (default)")+` \xB7 writes ${l.autoEvolveApply===!0||l.autoEvolveApply==="true"?"ENABLED":"off (dry run)"}`),d.note&&this.log(` ! ${d.note}`);try{let t=await y(`/api/eval-targets/${s.id}/promotions?limit=1`),a=t.promotions[0];if(a){let n=a.gates?.cost,f=n?.modelCalls?`${n.modelCalls} model calls, ${n.usablePairs??"?"} usable pair(s)`+(n.mde!=null?`, resolved +/-${ee(n.mde)}`:"")+(n.wallMs?`, ${(n.wallMs/6e4).toFixed(0)} min`:""):"cost not recorded (decision predates cost tracking)";this.log(` \u21B3 last run ${new Date(a.createdAt).toISOString().slice(0,10)}: ${a.decision}${a.applied?" (APPLIED)":""} \u2014 ${f}`)}let o=t.counts??{};this.log(` \u21B3 lifetime: ${o.promote??0} promote / ${o.revert??0} revert / ${o.refuse??0} refuse`)}catch{}}this.log(" \u21B3 pause the spend: metadata.autoEvolvePaused=true (keeps the opt-in)")}}};function A(h){if(h===null)return"never";if(h<90)return`${Math.round(h)}s`;let r=Math.round(h/60);return r<90?`${r}m`:`${Math.round(r/60)}h`}S(A,"formatAge");export{I as default};
|
|
1
|
+
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-3NWJ7CZ2.js";import"../chunk-M7QSC64D.js";import"../chunk-6TGFU6RU.js";import{i as z,j as Q,k as Z,m as ee,n as te}from"../chunk-LB24UKHZ.js";import"../chunk-G7V4ZZZ3.js";import"../chunk-O4K4M5G6.js";import"../chunk-AHLVY52I.js";import"../chunk-RSVNQ2XI.js";import"../chunk-ZK3ACE4T.js";import"../chunk-7BCZDVIU.js";import"../chunk-PPAHIVG5.js";import"../chunk-CT7FWSIU.js";import"../chunk-5MXZJWQS.js";import"../chunk-N7ODX6PO.js";import{a as V}from"../chunk-OZQNSELV.js";import"../chunk-HFGO5762.js";import"../chunk-VS5ROGDP.js";import"../chunk-T47SFA5X.js";import"../chunk-SWSOEYC7.js";import"../chunk-U2NT5OSQ.js";import"../chunk-KGURGIZ2.js";import"../chunk-GYNZ3OZF.js";import"../chunk-UPFH72PF.js";import"../chunk-DVU5PHPM.js";import"../chunk-CDY7TQFZ.js";import"../chunk-VBXL7XO7.js";import"../chunk-FBSZ6KCM.js";import"../chunk-JP6ULOEX.js";import"../chunk-SG4UDDHB.js";import{d as F}from"../chunk-GPBN4ROE.js";import"../chunk-6XTLP2G7.js";import"../chunk-PJ3WHQ67.js";import{a as X,b as D,c as Y,g as j,h as G}from"../chunk-QI3FJKGK.js";import{a as B}from"../chunk-WUCACPGC.js";import"../chunk-IZTIYR5Q.js";import"../chunk-WL5ZWQAS.js";import"../chunk-KEVDLLHT.js";import"../chunk-DX6IPDED.js";import"../chunk-3AV3GTMP.js";import{a as U,e as y}from"../chunk-GIXHG5FK.js";import"../chunk-X6CF5KTW.js";import"../chunk-XQYAVSUQ.js";import{a as N,g as v,l as x}from"../chunk-PZNWH4VQ.js";import{a as S}from"../chunk-ZLLER3HP.js";import{spawnSync as le}from"node:child_process";import{existsSync as ce,readFileSync as ue}from"node:fs";import{join as se}from"node:path";var I=class h extends B{static{S(this,"Diagnostics")}static description='Diagnose capture / proxy / connectivity problems (e.g. a client-side "502 Bad Gateway")';static examples=["<%= config.bin %> diagnostics"];baseUrl(){return process.env.RULEMETRIC_API_URL??N().apiUrl??U}async checkDirect(){let r=process.env.HTTPS_PROXY,i=process.env.HTTP_PROXY;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let s=new AbortController,l=setTimeout(()=>s.abort(),8e3);try{return(await globalThis.fetch(`${this.baseUrl()}/health`,{signal:s.signal})).ok}catch{return!1}finally{clearTimeout(l),r!==void 0&&(process.env.HTTPS_PROXY=r),i!==void 0&&(process.env.HTTP_PROXY=i)}}configuredProxy(){if(process.env.HTTPS_PROXY)return process.env.HTTPS_PROXY;for(let r of["settings.local.json","settings.json"]){let i=se(process.cwd(),".claude",r);if(ce(i))try{let s=JSON.parse(ue(i,"utf8"));if(s.env?.HTTPS_PROXY)return s.env.HTTPS_PROXY}catch{}}return null}checkThroughProxy(r){let i=le("curl",["-sS","-x",r,"--max-time","8","-o","/dev/null","-w","%{http_code}",`${this.baseUrl()}/health`],{encoding:"utf8",stdio:["ignore","pipe","ignore"]});return i.error||typeof i.stdout!="string"?null:i.stdout.trim()==="200"}async run(){await this.parse(h);let r=process.version,i=this.configuredProxy(),s=i!=null,[l,m,d]=await Promise.all([this.checkDirect(),M(O),M(_)]),p=s&&i?this.checkThroughProxy(i):null,t=S((e,c,T)=>{let u=c===null?"\u2013":c?"[OK]":"[!!]";this.log(` ${u} ${e.padEnd(22)} ${T}`)},"line");this.log("RuleMetric diagnostics"),this.log(""),t("Node",!L(r),`${r}${L(r)?" (< 20.11 \u2014 breaks the bundled proxy)":""}`),t("API (direct)",l,`${this.baseUrl()}/health ${l?"reachable":"UNREACHABLE"}`),t("Authenticated",v(),v()?"yes":"no \u2014 run `rulemetric auth login`"),t("Proxy configured",s?!0:null,s?i:"no HTTPS_PROXY set"),s&&(t("Gateway :"+O,m,m?"listening":"NOT listening"),t("mitmproxy :"+_,d,d?"listening":"not listening (gateway should route direct)"),t("API (via proxy)",p,p===null?"inconclusive (curl unavailable)":p?"reachable":"FAILED \u2014 502/blocked through your proxy"));let a=F();t("claude CLI",a.claudeBin!=null,a.claudeBin??"not found \u2014 LLM features (grading, distill) will no-op"),t("codex CLI",a.codexBin!=null?!0:null,a.codexBin?`${a.codexBin}${a.codexConfiguredModel?` (model ${a.codexConfiguredModel})`:""}`:"not found \u2014 optional; enables the cross-vendor reviewer (evals validate-judge)");let o=null;if(v()&&l)try{o=await y("/api/workers/health")}catch{o=null}if(o){let e=o.worker;t("Worker",!!e.active,e.present?e.active?`online (last heartbeat ${e.ageSeconds??"?"}s ago${e.clientVersion?`, v${e.clientVersion}`:""})`:`NOT RUNNING \u2014 last heartbeat ${A(e.ageSeconds)} ago`:"never connected \u2014 no worker has ever reported in");let c=o.worker.engines;if(c!=null){let u=[c.claude&&"claude",c.codex&&"codex"].filter(Boolean);t("LLM engine",u.length>0,u.length>0?`${u.join(" + ")} available to the worker`:"NONE \u2014 the worker found no `claude` and no `codex`. LLM jobs will complete with empty output rather than failing.")}let T=o.pending.reduce((u,E)=>u+E.count,0);if(T>0){let u=o.verdict.stuck.reduce(($,k)=>$+k.count,0),E=o.verdict.unclaimable.reduce(($,k)=>$+k.count,0),R=(o.verdict.engineBlocked??[]).reduce(($,k)=>$+k.count,0);t("Job queue",u===0&&R===0,`${T} pending`+(u>0?` \u2014 ${u} waiting on this worker`:"")+(R>0?` \u2014 ${R} need a local LLM engine`:"")+(E>0?` \u2014 ${E} need a worker with DATABASE_URL`:""))}else t("Job queue",!0,"empty")}else v()&&l&&t("Worker",null,"could not read /workers/health (older API?)");let n=o?.worker.machine;if(n){let e=n.suspends+n.stalls,c=n.lastPause;t("Worker pauses",e===0?!0:null,e===0?`none since ${n.since} \u2014 no sleep or stall seen by the worker`:`${n.suspends} suspend${n.suspends===1?"":"s"}`+(n.stalls>0?` + ${n.stalls} event-loop stall${n.stalls===1?"":"s"}`:"")+` since ${n.since}, ${A(Math.round(n.pausedMs/1e3))} paused total`+(c?`; last: ${c.kind} of ${A(Math.round(c.wallGapMs/1e3))} ending ${c.detectedAt}`:"")+" \u2014 jobs in flight during a suspend lose their lease and are redone on wake")}let f=await q();if(f){t("Machine sleep (pmset)",f.sleeps===0?!0:null,K(f));for(let e of f.recent.slice(-3)){let c=e.seconds!=null?` (${A(e.seconds)})`:"";this.log(` \u21B3 ${e.at.toISOString()} ${e.kind}${c}: ${e.reason.slice(0,80)}`)}}let C=V(process.cwd()),g=await D({configDir:x()}),re=await Y({configDir:x()}),w=` \u2014 ${G(re)}`,b=J(process.cwd()),H=[b.user&&`user hooks (${b.user})`,b.workspace&&`workspace hooks (${b.workspace})`].filter(Boolean),ie={claude_code:`session hooks (+ proxy for instruction linking)${w}`,codex:`worker transcript sync of ~/.codex/sessions \u2014 ${j(g)}`,cursor:`user hooks (~/.cursor/hooks.json)${w}`,copilot_agent:`workspace hooks${w}`,antigravity:H.length>0?`${H.join(" + ")}${w}`:"NOT CAPTURED \u2014 no rulemetric block in ~/.gemini/config/hooks.json or .agents/hooks.json; run `rulemetric hooks install` (user hooks are on by default)"};this.log(""),this.log(" Capture coverage (agents found on this machine):");for(let e of C)this.log(` \u2022 ${e.padEnd(15)} ${ie[e]??"captured"}`);if(C.includes("codex"))if(g.error)this.log(` ! ${g.error}`);else if(g.mode==="allowlist")for(let e of g.roots)this.log(` \u21B3 ${e}`);else g.mode==="all"&&this.log(` \u21B3 scope it with ${se(x(),X)} ({"codex":{"roots":["/path/to/repo"]}}) or RULEMETRIC_CODEX_CAPTURE=off`);o&&!o.worker.active&&C.includes("codex")&&g.mode!=="off"&&this.log(" ! Codex capture runs INSIDE the worker \u2014 it is stopped while the worker is down."),v()&&l&&await this.reportEvolutionSpend();let P=W({nodeVersion:r,directApiOk:l,httpsProxySet:s,gatewayAlive:m,mitmproxyAlive:d,proxyPathOk:p});this.log("");let ae=P.severity==="ok"?"[OK]":P.severity==="warn"?"[!!]":"[XX]";this.log(`${ae} ${P.headline}`);for(let e of P.hints)this.log(` \u2022 ${e}`);if(o&&o.verdict.severity!=="ok"){let e=o.verdict.severity==="warn"?"[!!]":"[XX]";this.log(""),this.log(`${e} ${o.verdict.headline}`);for(let c of o.verdict.hints)this.log(` \u2022 ${c}`)}}async reportEvolutionSpend(){let r;try{r=await y("/api/eval-targets?type=instruction&limit=200")}catch{return}let i=r.filter(s=>{let l=s.metadata??{};return l.autoEvolveEnabled===!0||l.autoEvolveEnabled==="true"});if(i.length!==0){this.log(""),this.log(" Nightly instruction evolution (cron_instruction_evolution, 07:30 UTC):");for(let s of i){let l=s.metadata??{},m=Q(l),d=z(l);if(m){this.log(` \u2022 ${s.name} \u2014 PAUSED (metadata.autoEvolvePaused). Opt-in preserved.`),this.log(" \u21B3 resume: set autoEvolvePaused=false");continue}let p=null;try{p=(await y(`/api/eval-targets/${s.id}/evals`)).filter(a=>!a.retiredAt).length}catch{}if(this.log(` \u2022 ${s.name}`),p!=null){let t=ne(p,d.minPairs,oe(d,p));if(!t.feasible)this.log(` \u21B3 cannot reach a verdict \u2014 ${t.reason}`);else{let a=Z({liveCases:p,passes:t.passes});this.log(` \u21B3 each night: ${te(a)}`)}}this.log(` \u21B3 pairs budget ${d.minPairs}`+(d.configured?" (metadata.autoEvolvePairs)":" (default)")+` \xB7 writes ${l.autoEvolveApply===!0||l.autoEvolveApply==="true"?"ENABLED":"off (dry run)"}`),d.note&&this.log(` ! ${d.note}`);try{let t=await y(`/api/eval-targets/${s.id}/promotions?limit=1`),a=t.promotions[0];if(a){let n=a.gates?.cost,f=n?.modelCalls?`${n.modelCalls} model calls, ${n.usablePairs??"?"} usable pair(s)`+(n.mde!=null?`, resolved +/-${ee(n.mde)}`:"")+(n.wallMs?`, ${(n.wallMs/6e4).toFixed(0)} min`:""):"cost not recorded (decision predates cost tracking)";this.log(` \u21B3 last run ${new Date(a.createdAt).toISOString().slice(0,10)}: ${a.decision}${a.applied?" (APPLIED)":""} \u2014 ${f}`)}let o=t.counts??{};this.log(` \u21B3 lifetime: ${o.promote??0} promote / ${o.revert??0} revert / ${o.refuse??0} refuse`)}catch{}}this.log(" \u21B3 pause the spend: metadata.autoEvolvePaused=true (keeps the opt-in)")}}};function A(h){if(h===null)return"never";if(h<90)return`${Math.round(h)}s`;let r=Math.round(h/60);return r<90?`${r}m`:`${Math.round(r/60)}h`}S(A,"formatAge");export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../../chunk-
|
|
1
|
+
import{a}from"../../chunk-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{f as s}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as s}from"../../chunk-ZLLER3HP.js";import{Flags as m}from"@oclif/core";import{printTable as d}from"@oclif/table";var r=class l extends o{static{s(this,"EvalTargetList")}static description="List eval targets";static examples=["<%= config.bin %> eval-targets list","<%= config.bin %> eval-targets list --type instruction"];static flags={type:m.string({char:"t",description:"Filter by type",options:["instruction","skill","prompt","plan"]})};async run(){let{flags:i}=await this.parse(l);this.requireAuth();let c=i.type?`?type=${i.type}`:"",a=await n(`/api/eval-targets${c}`);if(a.length===0){this.log("No eval targets found. Create one with `rulemetric eval-targets create`.");return}d({data:a.map(t=>({Name:e(t.name,30),Type:t.type,Version:`v${t.version}`,Description:e(t.description,40),Updated:p(t.updatedAt)})),columns:["Name","Type","Version","Description","Updated"]})}};export{r as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as G,b as V,c as j,d as q}from"../../chunk-J4W6GNCF.js";import{b as M}from"../../chunk-GH4EZK2O.js";import{c as g}from"../../chunk-Q776YUBD.js";import{e as D}from"../../chunk-
|
|
1
|
+
import{a as G,b as V,c as j,d as q}from"../../chunk-J4W6GNCF.js";import{b as M}from"../../chunk-GH4EZK2O.js";import{c as g}from"../../chunk-Q776YUBD.js";import{e as D}from"../../chunk-H33XYL7O.js";import"../../chunk-XXPWPKTD.js";import"../../chunk-5TM7AOH2.js";import"../../chunk-IEQDLURA.js";import"../../chunk-KINIFUZQ.js";import"../../chunk-ZYGBABMZ.js";import"../../chunk-HM63AB2C.js";import"../../chunk-PXYK4MBX.js";import"../../chunk-ZTQUGAZG.js";import"../../chunk-XZW5ZHFC.js";import"../../chunk-F5PJN2EY.js";import"../../chunk-XIOYV5A7.js";import"../../chunk-5VNEHPGC.js";import"../../chunk-5PMTNNA6.js";import"../../chunk-ISFPPDDB.js";import"../../chunk-5RBLIVBF.js";import"../../chunk-H4QPAEEA.js";import"../../chunk-J6RQ5AH2.js";import"../../chunk-PZS55PW2.js";import"../../chunk-QPAOX7P2.js";import"../../chunk-3ZHVP3KE.js";import"../../chunk-QENSCK77.js";import"../../chunk-HOQPVOMF.js";import"../../chunk-VCUW2NAP.js";import"../../chunk-FZMO7XSN.js";import"../../chunk-MOJY6S5J.js";import"../../chunk-CYCH2EQC.js";import"../../chunk-VXNICAVG.js";import"../../chunk-L562Y4RN.js";import"../../chunk-CZBO3A6B.js";import"../../chunk-CVPAKEEZ.js";import"../../chunk-GLBWNB2N.js";import"../../chunk-CQD2R3BA.js";import"../../chunk-3UKZJAFS.js";import"../../chunk-77FH6UZP.js";import"../../chunk-KE5K3F7J.js";import"../../chunk-PIVEJTNF.js";import"../../chunk-7MTYUTUN.js";import"../../chunk-FS3TAQAE.js";import"../../chunk-GIRPEMTW.js";import"../../chunk-SIGZEQ3K.js";import"../../chunk-DQYYHX6K.js";import"../../chunk-RE7RAZQ5.js";import"../../chunk-6T6YFPBW.js";import"../../chunk-ISYU5BMU.js";import"../../chunk-DANMUHNW.js";import"../../chunk-T75KAEJO.js";import"../../chunk-FXQS7AEZ.js";import"../../chunk-LJRE3LZ2.js";import"../../chunk-RR7V5CK5.js";import"../../chunk-WIKCYUZC.js";import"../../chunk-DXNUCWUX.js";import"../../chunk-6AAAHV2B.js";import"../../chunk-6UEFCMR2.js";import"../../chunk-MODXEGCU.js";import"../../chunk-MHVHGKDK.js";import"../../chunk-RBSEE2Z6.js";import"../../chunk-KOYHJFB3.js";import"../../chunk-3NWJ7CZ2.js";import"../../chunk-M7QSC64D.js";import"../../chunk-6TGFU6RU.js";import"../../chunk-LB24UKHZ.js";import"../../chunk-G7V4ZZZ3.js";import"../../chunk-O4K4M5G6.js";import"../../chunk-AHLVY52I.js";import"../../chunk-RSVNQ2XI.js";import"../../chunk-ZK3ACE4T.js";import"../../chunk-7BCZDVIU.js";import"../../chunk-PPAHIVG5.js";import"../../chunk-CT7FWSIU.js";import"../../chunk-5MXZJWQS.js";import"../../chunk-N7ODX6PO.js";import"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import"../../chunk-T47SFA5X.js";import"../../chunk-SWSOEYC7.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-GYNZ3OZF.js";import"../../chunk-UPFH72PF.js";import"../../chunk-DVU5PHPM.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-VBXL7XO7.js";import"../../chunk-FBSZ6KCM.js";import"../../chunk-JP6ULOEX.js";import"../../chunk-SG4UDDHB.js";import"../../chunk-GPBN4ROE.js";import"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import{b as A,d as C,g as S,i as E,j as L,k as $}from"../../chunk-QI3FJKGK.js";import{a as O}from"../../chunk-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{f as m}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.js";import"../../chunk-XQYAVSUQ.js";import{e as I,l as p}from"../../chunk-PZNWH4VQ.js";import{a as e}from"../../chunk-ZLLER3HP.js";import{trace as de,context as me}from"@opentelemetry/api";import{NodeSDK as W}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as Y}from"@opentelemetry/exporter-trace-otlp-http";import{BatchSpanProcessor as J,ConsoleSpanExporter as z,SimpleSpanProcessor as Q}from"@opentelemetry/sdk-trace-node";import{Resource as Z}from"@opentelemetry/resources";import{ATTR_SERVICE_NAME as ee,ATTR_SERVICE_VERSION as te}from"@opentelemetry/semantic-conventions";function F(r){if(!r)return{};let n={};for(let o of r.split(",")){let s=o.indexOf("=");if(s===-1)continue;let i=o.slice(0,s).trim(),c=o.slice(s+1).trim();i&&(n[i]=c)}return n}e(F,"parseOtlpHeaders");var u=null;function T(){return process.env.TELEMETRY_ENABLED!=="false"}e(T,"isTelemetryEnabled");function x(r){if(!T()||u!==null)return"off";let n=new Z({[ee]:r.serviceName,[te]:r.serviceVersion??"0.1.0"}),o=process.env.OTEL_EXPORTER_OTLP_ENDPOINT,s,i;if(o){let c=F(process.env.OTEL_EXPORTER_OTLP_HEADERS),l=new Y({url:`${o}/v1/traces`,headers:c});i=new J(l),s="otlp"}else if(process.env.OTEL_SPAN_EXPORT==="none")i=void 0,s="silent";else{let c=new z;i=new Q(c),s="console"}return u=new W({resource:n,spanProcessors:i?[i]:[]}),u.start(),s}e(x,"initTelemetry");async function h(){u&&(await u.shutdown(),u=null)}e(h,"shutdownTelemetry");import{SpanKind as Pe,SpanStatusCode as Re}from"@opentelemetry/api";import{trace as Ie,context as Oe}from"@opentelemetry/api";import*as f from"@sentry/node";var v=!1;function w(r){if(v)return!1;let n=process.env.SENTRY_DSN;return n?(f.init({dsn:n,serverName:r.serviceName,environment:process.env.NODE_ENV??"development",tracesSampleRate:0}),v=!0,!0):!1}e(w,"initSentry");async function y(r){v&&await f.flush(r)}e(y,"flushSentry");import{existsSync as ne,mkdirSync as oe,readFileSync as k,unlinkSync as X,writeFileSync as U}from"node:fs";import{dirname as se,join as R}from"node:path";import{execFileSync as ie}from"node:child_process";var a=R(p(),"evals-agent.lock");function ce(r){try{return process.kill(r,0),!0}catch(n){return n.code==="EPERM"}}e(ce,"pidAlive");function ae(r){if(!ce(r))return!1;try{let n=ie("ps",["-p",String(r),"-o","command="],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return/run\.js\s+evals\s+agent|evals\s+agent/.test(n)}catch{return!0}}e(ae,"isLiveAgent");function le(){try{oe(se(a),{recursive:!0})}catch{}for(let r=0;r<2;r++)try{return U(a,String(process.pid),{flag:"wx"}),{ok:!0}}catch(n){if(n.code!=="EEXIST")throw n;let o=0;try{o=Number(k(a,"utf-8").trim())}catch{}if(o&&o!==process.pid&&ae(o))return{ok:!1,holder:o};try{X(a)}catch{}}try{U(a,String(process.pid))}catch{}return{ok:!0}}e(le,"acquireAgentLock");function P(){try{ne(a)&&Number(k(a,"utf-8").trim())===process.pid&&X(a)}catch{}}e(P,"releaseAgentLock");var N=class r extends O{static{e(this,"EvalAgentCommand")}static description="The worker daemon: long-polls /api/work/next, claims jobs, and runs them locally. Installed as a launchd service by `rulemetric service install`.";static examples=["<%= config.bin %> evals agent"];async run(){await this.parse(r),this.requireAuth();let n=le();if(!n.ok){this.log(`Another rulemetric evals agent is already running (pid ${n.holder}). Refusing to start a second instance.`);return}process.env.PG_APPLICATION_NAME||="rulemetric-agent",w({serviceName:"rulemetric-agent"})&&this.log("[sentry] error capture enabled");let s=x({serviceName:"rulemetric-agent"});s==="otlp"?this.log(`[otel] traces exporting to ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}`):s==="console"?this.log("[otel] cron spans printing to stdout (set OTEL_EXPORTER_OTLP_ENDPOINT to ship to a backend)"):this.log("[otel] disabled (TELEMETRY_ENABLED=false)"),!I()&&!process.env.RULEMETRIC_API_KEY&&this.error("No auth token found. Run `rulemetric auth login` first."),this.log("Starting thin agent (Phase 4b parallel-run)..."),this.log(`Long-polling /api/work/next. Press Ctrl+C to stop.
|
|
2
2
|
`);let c=new AbortController,l=await A({configDir:p()});if(this.log(`[transcript-sync] Codex capture: ${S(l)}`),l.error)this.log(`[transcript-sync] WARNING: ${l.error}`);else if(l.mode==="allowlist")for(let t of l.roots)this.log(`[transcript-sync] \u2022 ${t}`);let d=await C({configDir:p()});if(this.log(`[transcript-sync] Pi capture: ${E(d)}`),d.error)this.log(`[transcript-sync] WARNING: ${d.error}`);else if(d.mode==="allowlist")for(let t of d.roots)this.log(`[transcript-sync] \u2022 ${t}`);let B=new M({postSnapshot:e((t,K)=>m(`/api/sessions/${t}/context-snapshots`,K),"postSnapshot"),linkInstructions:e(t=>m("/api/sessions/link-instructions",{sessionId:t}),"linkInstructions"),log:e(t=>this.log(`[transcript-sync] ${t}`),"log")}),H=new G({providers:[V(void 0,void 0,L({configDir:p(),onChange:e(t=>this.log(`[transcript-sync] Codex capture changed: ${S(t)}`),"onChange")})),j(void 0,void 0,$({configDir:p(),onChange:e(t=>this.log(`[transcript-sync] Pi capture changed: ${E(t)}`),"onChange")}))],statePath:R(p(),"transcript-sync-state.json"),importTranscript:e(t=>m("/api/sessions/import",t),"importTranscript"),emitInstructions:e(t=>B.emit(t),"emitInstructions"),log:e(t=>this.log(`[transcript-sync] ${t}`),"log")});q(H,{signal:c.signal,log:e(t=>this.log(`[transcript-sync] ${t}`),"log")});let _=e(async t=>{this.log(`
|
|
3
3
|
[${t}] shutting down agent...`),c.abort(),await Promise.allSettled([y(2e3),h(),g()]),P(),process.exit(0)},"shutdown");process.on("SIGINT",()=>{_("SIGINT")}),process.on("SIGTERM",()=>{_("SIGTERM")});let b=!1;try{await D({signal:c.signal,log:e(t=>this.log(t),"log"),version:this.config.version,readInstalledVersion:e(()=>{try{return JSON.parse(k(R(this.config.root,"package.json"),"utf-8")).version??null}catch{return null}},"readInstalledVersion"),onVersionDrift:e(()=>{b=!0},"onVersionDrift")}),b&&(this.log("[upgrade] Installed CLI version changed \u2014 restarting worker onto the new code."),await Promise.allSettled([y(2e3),h(),g()]),P(),process.exit(1))}finally{P(),await g()}}};export{N as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as k}from"../../chunk-RBSEE2Z6.js";import{e as $}from"../../chunk-
|
|
1
|
+
import{a as k}from"../../chunk-RBSEE2Z6.js";import{e as $}from"../../chunk-T47SFA5X.js";import"../../chunk-SWSOEYC7.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-GYNZ3OZF.js";import"../../chunk-UPFH72PF.js";import"../../chunk-DVU5PHPM.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-FBSZ6KCM.js";import"../../chunk-JP6ULOEX.js";import"../../chunk-SG4UDDHB.js";import"../../chunk-GPBN4ROE.js";import"../../chunk-6XTLP2G7.js";import"../../chunk-PJ3WHQ67.js";import{a as w}from"../../chunk-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{e as n}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.js";import"../../chunk-XQYAVSUQ.js";import"../../chunk-PZNWH4VQ.js";import{a as h}from"../../chunk-ZLLER3HP.js";import{Args as A,Flags as r}from"@oclif/core";var m=class y extends w{static{h(this,"EvalAutoRun")}static description="Run evals in a loop until the effect verdict is statistically powered (\xA76f auto-run-to-power)";static examples=["<%= config.bin %> evals auto-run <target-id> # preview (cost + plan)","<%= config.bin %> evals auto-run <target-id> --yes # run until powered / budget","<%= config.bin %> evals auto-run <target-id> --yes --max-runs 120 --batch-parallel 4"];static args={targetId:A.string({description:"Eval target ID",required:!0})};static flags={yes:r.boolean({char:"y",description:"Actually run. Without this, only previews the plan + cost."}),"max-runs":r.integer({description:"Hard ceiling on completed runs",default:200}),"batch-parallel":r.integer({description:"Concurrent executions within a batch",default:3}),timeout:r.integer({description:"Timeout per eval in ms",default:12e4}),model:r.string({description:"Model for eval execution"}),"grader-model":r.string({description:"Model for grading"}),"skip-baseline":r.boolean({description:"Skip without_target runs (no delta \u2014 not recommended)",default:!1})};async run(){let{args:C,flags:e}=await this.parse(y);this.requireAuth();let i=C.targetId,c=20,a=await n(`/api/eval-targets/${i}`),l=await n(`/api/eval-targets/${i}/evals`);l.length===0&&this.error(`No active cases on "${a.name}". Generate some (\`evals create\` / the web Generate button) or run \`evals refine-cases\` first.`);let b=l.length*(e["skip-baseline"]?1:2),f=Math.ceil(e["max-runs"]/b);if(this.log(`Auto-run "${a.name}" v${a.version} toward a powered \xB1${c}pp verdict.`),this.log(`Plan: up to ${e["max-runs"]} runs (${l.length} active case(s) \xD7 ${e["skip-baseline"]?1:2}/batch = ${b}/batch, \u2264${f} batches). Each run is a synthetic \`claude -p\` execution + grade.`),this.log('Note: this is a controlled synthetic A/B. For a DEPLOYED instruction with real usage, the Insights observational verdict is cheaper and uses real sessions \u2014 auto-run is for pre-deploy, catalog skills, or targets with no real "without" cohort.'),!e.yes){this.log(`
|
|
2
2
|
Preview only. Re-run with --yes to start.`);return}let t={runsCompleted:0,maxRuns:e["max-runs"],batchesRun:0,maxBatches:f},x={targetId:i,targetVersion:a.version,iteration:1,timeout:e.timeout,model:e.model,graderModel:e["grader-model"],skipGrading:!1,targetType:a.type,targetName:a.name};for(;;){let s;try{s=await n(`/api/eval-targets/${i}/judge-calibration`)}catch(o){this.log(`
|
|
3
3
|
\u25A0 stopping \u2014 could not read the power check: ${o instanceof Error?o.message:String(o)}`);break}let E={powered:s.powerCheck?.powered??!1,mde:s.powerCheck?.mde==null?1/0:s.powerCheck.mde},B=s.caseDiscrimination??{total:0,discriminating:0,nonDiscriminating:0,unpaired:0},p=k(E,B,t,{targetEffectPp:c});if(this.log(`
|
|
4
4
|
${p.action==="stop"?"\u25A0":"\u25B8"} ${p.reason}`),p.action==="stop")break;let v=await n(`/api/eval-targets/${i}/evals`);if(v.length===0){this.log("\u25A0 no active cases left \u2014 stopping.");break}let{completed:g,failed:D}=await $({cases:v,targetContent:a.content,concurrency:e["batch-parallel"],runNumber:t.batchesRun+1,opts:x,skipBaseline:e["skip-baseline"],onLog:h(o=>this.log(o),"onLog")});if(t.runsCompleted+=g,t.batchesRun+=1,this.log(`Batch ${t.batchesRun}: ${g} completed, ${D} failed \u2014 ${t.runsCompleted}/${t.maxRuns} runs, ${t.batchesRun}/${t.maxBatches} batches.`),g===0){this.log("\u25A0 batch produced 0 completed runs \u2014 the executor appears broken (check the model / `claude -p`). Aborting.");break}}let d=await n(`/api/eval-targets/${i}/judge-calibration`),u=d.powerCheck?.mde,R=u==null||!Number.isFinite(u)?"unknown":`\xB1${Math.round(u*100)}pp`;this.log(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as h,c as f}from"../../chunk-
|
|
1
|
+
import{b as h,c as f}from"../../chunk-H2FMAJUJ.js";import"../../chunk-VBXL7XO7.js";import{a as m}from"../../chunk-WUCACPGC.js";import"../../chunk-IZTIYR5Q.js";import"../../chunk-WL5ZWQAS.js";import"../../chunk-KEVDLLHT.js";import"../../chunk-DX6IPDED.js";import"../../chunk-3AV3GTMP.js";import{e as c}from"../../chunk-GIXHG5FK.js";import"../../chunk-X6CF5KTW.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(`
|