@rulemetric/cli 0.12.3 → 0.12.5
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-LVAROIKP.js → chunk-22ZDUL6H.js} +1 -1
- package/dist/{chunk-Y6TAPCA5.js → chunk-2DWUGAJ4.js} +1 -1
- package/dist/{chunk-FNMJ6E6F.js → chunk-2KJAM2NG.js} +1 -1
- package/dist/{chunk-D4UDSY7Y.js → chunk-2MD5QLYF.js} +1 -1
- package/dist/{chunk-2MZFB46B.js → chunk-5OX6YKTR.js} +1 -1
- package/dist/{chunk-K6T4ODPZ.js → chunk-5PM4E27L.js} +1 -1
- package/dist/{chunk-IS2AZIG7.js → chunk-7PWPWJXC.js} +1 -1
- package/dist/chunk-7R3WWD7V.js +1 -0
- package/dist/{chunk-VC3DJPUB.js → chunk-A2LHEUNW.js} +1 -1
- package/dist/{chunk-4Y54EMS6.js → chunk-A5P3RCPI.js} +1 -1
- package/dist/{chunk-7BLO7ECB.js → chunk-AGK5AUWT.js} +1 -1
- package/dist/{chunk-YRTG6SX6.js → chunk-AKXGUQ5B.js} +1 -1
- package/dist/chunk-APXQLQZY.js +1 -0
- package/dist/{chunk-J35L3LR3.js → chunk-ARC4Q3GL.js} +1 -1
- package/dist/{chunk-XZY2W3D3.js → chunk-BTQQPQRG.js} +1 -1
- package/dist/{chunk-ASQG7BTP.js → chunk-BXFDEQCX.js} +1 -1
- package/dist/{chunk-QLG6OCYF.js → chunk-CZTTW3MZ.js} +1 -1
- package/dist/{chunk-65TQMBNF.js → chunk-DSJNZWCZ.js} +1 -1
- package/dist/{chunk-ZQJWKIJS.js → chunk-E4RGYYBC.js} +1 -1
- package/dist/{chunk-VTUTSUFW.js → chunk-EZHL527S.js} +1 -1
- package/dist/{chunk-MOY7XDR6.js → chunk-FE2UWAIP.js} +1 -1
- package/dist/{chunk-LW3UE2FY.js → chunk-G3HODHFN.js} +1 -1
- package/dist/{chunk-OCHAV6YZ.js → chunk-GCLTMV7V.js} +1 -1
- package/dist/{chunk-VIFE47RC.js → chunk-GHWBW2IW.js} +1 -1
- package/dist/{chunk-OEZNBFJ2.js → chunk-GOA5Q6TY.js} +1 -1
- package/dist/{chunk-RK2LZIBA.js → chunk-GRPUY2EZ.js} +1 -1
- package/dist/{chunk-E7N5R3HV.js → chunk-HQCPGDQE.js} +1 -1
- package/dist/{chunk-UQSUSB6G.js → chunk-MILLBGCB.js} +1 -1
- package/dist/{chunk-FIPW2SGV.js → chunk-MJ5H7RDK.js} +1 -1
- package/dist/{chunk-2IEYDOFE.js → chunk-NKJTNGXR.js} +1 -1
- package/dist/{chunk-LDQ6FLET.js → chunk-O65AQZYB.js} +1 -1
- package/dist/{chunk-6PUH7HEL.js → chunk-OOFGV7EX.js} +1 -1
- package/dist/{chunk-SD626JBZ.js → chunk-PWTTCSQA.js} +1 -1
- package/dist/{chunk-6LJD6TXN.js → chunk-R6MCQNSH.js} +1 -1
- package/dist/{chunk-5BTNALJL.js → chunk-RUTWW6N6.js} +1 -1
- package/dist/{chunk-4XLMX642.js → chunk-S2SKT5PV.js} +1 -1
- package/dist/chunk-SIGZEQ3K.js +1 -0
- package/dist/{chunk-XUGWUFIQ.js → chunk-TBU5SWA4.js} +1 -1
- package/dist/{chunk-CRPOQMQ2.js → chunk-UA5GEVGW.js} +1 -1
- package/dist/{chunk-2AVGUZ2P.js → chunk-UGACB66X.js} +1 -1
- package/dist/{chunk-PMW35N32.js → chunk-UTAETY5Z.js} +1 -1
- package/dist/chunk-UXB6DRR7.js +3 -0
- package/dist/{chunk-3JSYVZOB.js → chunk-VEFLUZH5.js} +1 -1
- package/dist/{chunk-WRQEHXSN.js → chunk-VYZKKSX4.js} +1 -1
- package/dist/{chunk-T67L2YTW.js → chunk-W23MESHM.js} +1 -1
- package/dist/{chunk-LYP3LNFL.js → chunk-W67DO5PT.js} +1 -1
- package/dist/{chunk-TJYXSMQV.js → chunk-WCIX5KWG.js} +1 -1
- package/dist/{chunk-OOGTQOL3.js → chunk-WMIUFMDI.js} +5 -5
- package/dist/{chunk-SVON2JIS.js → chunk-WTMJSL7R.js} +1 -1
- package/dist/{chunk-SZUH54L4.js → chunk-Y3BYR4M7.js} +1 -1
- package/dist/{chunk-YTPQ7VBO.js → chunk-YSLKV4XC.js} +1 -1
- package/dist/{chunk-PQMWZHEY.js → chunk-YXNAGHHQ.js} +1 -1
- package/dist/{chunk-NMWP3JLW.js → chunk-Z4YVOVMM.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/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/attribution-recovery.js +1 -0
- package/dist/lib/ensure-api-key.js +1 -1
- package/dist/lib/ensure-fresh-token.js +1 -1
- package/dist/lib/eval-benchmark.js +1 -1
- package/dist/lib/eval-candidate-run.js +1 -1
- package/dist/lib/eval-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/nomination/nominate.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 -0
- 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/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/judge-review-runner.js +1 -1
- package/dist/lib/manual-tasks-meta.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/oclif.manifest.json +3 -3
- package/package.json +7 -7
- package/dist/chunk-2WTCH4RR.js +0 -1
- package/dist/chunk-GY5IJ4RS.js +0 -1
package/dist/base-command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-DSJNZWCZ.js";import"./chunk-IZTIYR5Q.js";import"./chunk-OOFGV7EX.js";import"./chunk-VYZKKSX4.js";import"./chunk-YSLKV4XC.js";import"./chunk-3AV3GTMP.js";import"./chunk-UGACB66X.js";import"./chunk-WMIUFMDI.js";import"./chunk-PZNWH4VQ.js";import"./chunk-ZLLER3HP.js";export{a as BaseCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as r}from"./chunk-
|
|
1
|
+
import{f as r}from"./chunk-UGACB66X.js";import{a as i}from"./chunk-ZLLER3HP.js";async function p(e,t,n,o){await r(`/api/instruction-suggestions/${encodeURIComponent(e)}/events`,{eventType:"accepted",projectPath:t,instructionId:n,actor:o})}i(p,"logAccepted");async function a(e,t,n,o,s="redundant"){await r(`/api/instruction-suggestions/${encodeURIComponent(e)}/events`,{eventType:s,projectPath:t,instructionId:n,actor:o})}i(a,"logRefused");export{p as a,a as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as I}from"./chunk-5RBLIVBF.js";import{a as j,d as O}from"./chunk-3UKZJAFS.js";import{c as U}from"./chunk-
|
|
1
|
+
import{a as I}from"./chunk-5RBLIVBF.js";import{a as j,d as O}from"./chunk-3UKZJAFS.js";import{c as U}from"./chunk-FE2UWAIP.js";import{a as T,b as P,c as H,d as A}from"./chunk-SJKS3PYX.js";import{a as W}from"./chunk-HQCPGDQE.js";import{c as x,d as L,f as S}from"./chunk-QBNLZJIR.js";import{e as _,f as J,h as d}from"./chunk-UGACB66X.js";import{a as z,b as F}from"./chunk-WMIUFMDI.js";import{a as f}from"./chunk-ZLLER3HP.js";var B=f((l,{limit:a,sort:n,eventTypes:s})=>_(`/api/sessions/${l}/events?limit=${a}&sort=${n}&eventType=${encodeURIComponent(s.join(","))}&hasContent=true`),"fetchTranscriptTurns");async function is(l,a){let{mirrorId:n,projectPath:s,projectId:r,config:g}=l,t=f(e=>a.logger.info(e),"log");if(g?.sessionId)return Y({mirrorId:n,sessionId:g.sessionId},t);t(`Processing insights job ${n}...`),await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"reading_data"}});try{let{repaired:e}=await J("/api/sessions/repair-analyzed-at",{});e>0&&t(` Repaired analyzed_at on ${e} orphan session(s).`)}catch(e){t(` Warning: analyzed_at repair failed: ${e instanceof Error?e.message:String(e)}`)}let p=20,w=200,v=15*6e4,D=3,C=Date.now()+v;if(L()!=="none"){let e=0,o=0;try{for(;e<w&&Date.now()<C;){let c=await _(`/api/sessions?needsFacets=true&graderVersion=${2}&limit=${p}&offset=${o}`);if(c.length===0)break;t(` Generating facets for ${c.length} un-analyzed sessions (drained ${e} so far)...`);for(let $=0;$<c.length&&!(e>=w||Date.now()>=C);$+=D){let R=c.slice($,$+D);await Promise.all(R.map(async m=>{if(!(e>=w||Date.now()>=C))try{let u=await O(q=>B(m.id,q));if(u.turnCount<2){e++,o++;return}let k=await S(A,u.text,4096);k&&typeof k.outcome=="string"?(await d(`/api/sessions/${m.id}/enrich`,{analysis:{source:"generated_facets",...k,graderVersion:2},...m.eventCount!=null?{analyzedEventCount:m.eventCount}:{},analyzedTurnCount:u.turnCount}),t(` Generated facets for session ${m.id} (${m.tool}, ${u.turnCount} turns)`)):o++,e++}catch(u){t(` Failed to generate facets for session ${m.id}: ${u instanceof Error?u.message:String(u)}`),e++,o++}}))}if(c.length<p)break}}catch(c){t(` Warning: facet generation failed after ${e} sessions: ${c instanceof Error?c.message:String(c)}`)}if(e>0){let c=Date.now()>=C?`time budget (${Math.round(v/6e4)}m)`:e>=w?`hard cap (${w})`:"queue empty";t(` Facet drain stopped on ${c} after ${e} session(s); the rest resume next run.`)}}let b=await K(s,r);if(!b)throw new I("No session data found \u2014 ensure sessions are captured and enriched.");t(` Found ${b.stats.sessions} sessions, generating recommendations...`);let E=await Z(s,t);E&&t(` Generator memory: ${E.split(`
|
|
2
2
|
`).length} lines of prior-advice context`);let i={},y=[],h=P.length+1;for(let e=0;e<P.length;e++){let o=P[e];t(` [${e+1}/${h}] Generating ${o.name}...`);try{await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:o.name,current:e+1,total:h,partial:{...i}}})}catch(u){t(` Warning: progress update failed for ${o.name}: ${u instanceof Error?u.message:String(u)}`)}t(` Running LLM prompt for ${o.name}...`);let c=o.usesGeneratorMemory&&E?`${b.summary}
|
|
3
3
|
${E}`:b.summary,$=Date.now(),R=await S(o.prompt,c,o.maxTokens,{timeoutMs:o.timeoutMs}),m=Date.now()-$;R?(i[o.name]=R,t(` Got result for ${o.name} (${Math.round(m/1e3)}s)`)):(y.push(o.name),t(` No result for ${o.name} after ${Math.round(m/1e3)}s (budget ${Math.round((o.timeoutMs??12e4)/1e3)}s) \u2014 section DROPPED`))}t(` [${h}/${h}] Generating at_a_glance...`),await d(`/api/insights-jobs/${n}/progress`,{status:"running",progress:{step:"at_a_glance",current:h,total:h,partial:{...i}}});let V=[b.summary,i.what_works?`
|
|
4
4
|
## What Works
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g,c as m}from"./chunk-N7ODX6PO.js";import{e as s,h as c}from"./chunk-
|
|
1
|
+
import{b as g,c as m}from"./chunk-N7ODX6PO.js";import{e as s,h as c}from"./chunk-UGACB66X.js";import{a as i}from"./chunk-ZLLER3HP.js";var u=6e4;function o(t,e){try{t(JSON.stringify({ts:new Date().toISOString(),...e}))}catch{t(`[tt-heartbeat] log_error event=${e.event}`)}}i(o,"structuredLog");function d(t,e){return e.aborted?Promise.resolve(!1):t<=0?Promise.resolve(!0):new Promise(r=>{let a=setTimeout(()=>{e.removeEventListener("abort",n),r(!0)},t),n=i(()=>{clearTimeout(a),e.removeEventListener("abort",n),r(!1)},"onAbort");e.addEventListener("abort",n,{once:!0})})}i(d,"abortableSleep");async function l(t,e){if(t.kind!=="tmux")return;let a=(await g(m(t.target))).code===0?"active":"missing";try{await c(`/api/terminal-targets/${t.id}/status`,{status:a,lastSeenAt:new Date().toISOString()}),o(e,{event:"tt_heartbeat",targetId:t.id,target:t.target,status:a})}catch(n){o(e,{event:"tt_heartbeat_error",targetId:t.id,target:t.target,error:n instanceof Error?n.message:String(n)})}}i(l,"probeAndReport");async function b(t){let e;try{e=await s("/api/terminal-targets?status=active")}catch(r){o(t,{event:"tt_heartbeat_list_error",error:r instanceof Error?r.message:String(r)});return}for(let r of e.targets??[])try{await l(r,t)}catch(a){o(t,{event:"tt_heartbeat_probe_error",targetId:r.id,error:a instanceof Error?a.message:String(a)})}}i(b,"runOneHeartbeatCycle");async function p(t){let e=t.log??(()=>{}),r=t.intervalMs??u;for(o(e,{event:"tt_heartbeat_start",intervalMs:r});!t.signal.aborted&&(await b(e),!!await d(r,t.signal)););o(e,{event:"tt_heartbeat_stop"})}i(p,"startTerminalTargetHeartbeat");export{l as a,b,p as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as k,k as b}from"./chunk-3QXRLIGC.js";import{m as v,s as f,u as y}from"./chunk-
|
|
1
|
+
import{f as k,k as b}from"./chunk-3QXRLIGC.js";import{m as v,s as f,u as y}from"./chunk-WMIUFMDI.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as D}from"node:crypto";import{existsSync as d,readFileSync as H,writeFileSync as O,mkdirSync as I}from"node:fs";import{delimiter as R,dirname as j,join as m,resolve as w}from"node:path";function P(e){return b(m(e,".claude"),!1)}o(P,"adoptedHookSettingsPath");function B(e){return D("sha256").update(e).digest("hex")}o(B,"sha256");function h(e){return B(d(e)?H(e,"utf-8"):"")}o(h,"fileHash");function x(e){if(!d(e))return{settings:{}};let t=H(e,"utf-8");try{let n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?{unreadable:!0}:{settings:n}}catch{return{unreadable:!0}}}o(x,"readSettings");function p(e,t){let n=e.hooks;if(!n||typeof n!="object")return[];let r=n[t];return Array.isArray(r)?r:[]}o(p,"hookBlocks");function A(e,t){return p(e,t).flatMap(n=>(n?.hooks??[]).map(r=>r?.command).filter(r=>typeof r=="string"))}o(A,"commandsFor");function W(e){let t=P(e.dir);if(!t.endsWith("settings.local.json"))return{status:"refused",reason:`refusing to write ${t}: adopted hooks are machine-local and only ever land in settings.local.json`};let n=x(t);if("unreadable"in n)return{status:"refused",reason:`${t} exists but is not readable as JSON. Nothing was written \u2014 installing would mean replacing a settings file this command could not read.`};let r=n.settings,s=y(e.spec.command,e.instructionId),a=h(t),l=o((g,S)=>({kind:"remove-hook-entry",file:f,event:e.spec.event,command:s,backupPath:S,hashAtWrite:g}),"inverseFor");if(A(r,e.spec.event).includes(s))return{status:"already-present",target:f,command:s,inverse:l(a,`${t}.bak`),beforeHash:a};let c={...e.spec.matcher?{matcher:e.spec.matcher}:{},hooks:[{type:"command",command:s}]},u=r.hooks&&typeof r.hooks=="object"?r.hooks:{};u[e.spec.event]=[...p(r,e.spec.event),c],r.hooks=u;let{backupPath:i}=k(t,r);return i||(i=`${t}.bak`,I(j(i),{recursive:!0}),O(i,`{}
|
|
2
2
|
`)),{status:"installed",target:f,command:s,inverse:l(h(t),i),beforeHash:a}}o(W,"installHook");function _(e){let t=w(e.dir,e.inverse.file);if(!d(t))return{removed:!1,drifted:!0,code:"file-missing",reason:`${e.inverse.file} no longer exists`};let n=x(t);if("unreadable"in n)return{removed:!1,drifted:!0,code:"unreadable",reason:`${e.inverse.file} is not readable as JSON; refusing to rewrite it`};let r=n.settings,s=h(t)!==e.inverse.hashAtWrite,a=A(r,e.inverse.event).filter(i=>i===e.inverse.command);if(a.length===0)return{removed:!1,drifted:s,code:"not-present",reason:"the recorded entry is no longer present \u2014 nothing to remove"};if(a.length>1)return{removed:!1,drifted:s,code:"ambiguous",reason:`${a.length} entries carry this exact command; refusing to guess which one this artifact installed`};let l=p(r,e.inverse.event).map(i=>({...i,hooks:(i?.hooks??[]).filter(g=>g?.command!==e.inverse.command)})).filter(i=>(i.hooks??[]).length>0),c=r.hooks;l.length===0?delete c[e.inverse.event]:c[e.inverse.event]=l,Object.keys(c).length===0&&delete r.hooks;let{backupPath:u}=k(t,r);return{removed:!0,drifted:s,backupPath:u}}o(_,"uninstallHook");function K(e){return(process.env.PATH??"").split(R).filter(Boolean).some(n=>d(m(n,e)))}o(K,"commandOnPath");function $(e,t){return d(m(e,".agents","skills",t))||d(m(e,".claude","skills",t))}o($,"skillInstalled");function z(e,t){let n={satisfied:[],missing:[],unverifiable:[]};for(let r of t){let s=v(r);if(!s)continue;let[a,...l]=s.split(":"),c=l.join(":").trim();if(!c){n.unverifiable.push(s);continue}a==="cmd"?(K(c)?n.satisfied:n.missing).push(s):a==="skill"?($(e,c)?n.satisfied:n.missing).push(s):a==="file"?(d(w(e,c))?n.satisfied:n.missing).push(s):n.unverifiable.push(s)}return n}o(z,"checkDependencies");export{P as a,W as b,_ as c,z as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f}from"./chunk-QBNLZJIR.js";import{b as S,e as a,h as y}from"./chunk-
|
|
1
|
+
import{f}from"./chunk-QBNLZJIR.js";import{b as S,e as a,h as y}from"./chunk-UGACB66X.js";import{a as p}from"./chunk-ZLLER3HP.js";var _=1800*1e3,G=300*1e3,T=10,h=`Given these messages from an AI coding session, write a 1-2 sentence summary of what the user is trying to accomplish. Focus on the goal, not the steps. No preamble.
|
|
2
2
|
|
|
3
3
|
Return strict JSON in the form: {"goalSummary": "..."}`;async function k(n,e={}){let d=e.llm??f,o=e.now??Date.now,w=e.getSession??(async s=>{try{return await a(`/api/sessions/${s}`)}catch(t){if(t instanceof S&&t.statusCode===404)return null;throw t}}),m=e.getEvents??((s,t)=>a(`/api/sessions/${s}/events?limit=${t.limit}&sort=${t.sort}`)),v=e.saveGoal??(async(s,t)=>{await y(`/api/sessions/${s}/enrich`,{analysis:t})}),i=await w(n.sessionId);if(!i)return{skipped:"not_found"};let[P]=await m(n.sessionId,{limit:1,sort:"desc"}),A=new Date(P?.timestamp??i.startedAt).getTime();if(o()-A>_)return{skipped:"stale"};let l=i.analysis??{},c=l.goalSummaryAt?new Date(l.goalSummaryAt).getTime():0;if(c&&o()-c<G)return{skipped:"recent"};let g=(await m(n.sessionId,{limit:T*2,sort:"asc"})).filter(s=>s.content&&(s.eventType==="user_message"||s.eventType==="assistant_response")).map(s=>`${s.eventType==="user_message"?"USER":"ASSISTANT"}: ${s.content}`).join(`
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as $}from"./chunk-KJRMGTAO.js";import{a as C}from"./chunk-AFYZYXQ3.js";import{a as y}from"./chunk-BJSVATVJ.js";import{d as f}from"./chunk-TZA4HAVF.js";import{e as h,f as w}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-KJRMGTAO.js";import{a as C}from"./chunk-AFYZYXQ3.js";import{a as y}from"./chunk-BJSVATVJ.js";import{d as f}from"./chunk-TZA4HAVF.js";import{e as h,f as w}from"./chunk-UGACB66X.js";import{a as v}from"./chunk-ZLLER3HP.js";async function N(n,i,p){let{conversationId:a,messageId:g,messageContent:r}=n,o=await h(`/api/eval-targets/${i}`),c=await h(`/api/eval-targets/${i}/evals`),e=await h(`/api/eval-conversations/${a}/messages`),t=e.findIndex(l=>l.id===g);if(t>=0&&e.slice(t+1).some(u=>u.role==="assistant"&&(u.type==="results"||u.type==="proposal"||u.type==="generated"||u.type==="text"))){p(`Message ${g} already processed \u2014 skipping (idempotency guard)`);return}let s=v(async(l,u,m)=>{await w(`/api/eval-conversations/${a}/messages/assistant`,{content:l,type:u,data:m})},"postMessage"),d=await _(o,c,e,r,p);p(`Action: ${d.action}`);try{switch(d.action){case"run_evals":await x(o,c,a,s,p);break;case"generate_cases":await k(o,i,a,s,p);break;case"analyze_results":case"propose_changes":await E(o,c,e,r,a,s,p);break;case"respond":await s(d.response,"text");break}}catch(l){let u=l instanceof Error?l.message:String(l);throw await s(`Something went wrong: ${u}`,"text").catch(()=>{}),l}}v(N,"processConversationJob");async function _(n,i,p,a,g){let r=p.slice(-10).map(e=>`${e.role}: ${e.content.slice(0,200)}`).join(`
|
|
2
2
|
`),o=`You are an eval assistant. Decide what action to take based on the user's message.
|
|
3
3
|
|
|
4
4
|
## Current State
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Re}from"./chunk-M7QSC64D.js";import{i as Ae}from"./chunk-DPCAPIQB.js";import{b as ce,i as ue,j as pe,k as de,l as ge,m as me,n as fe}from"./chunk-LB24UKHZ.js";import{c as we}from"./chunk-G7V4ZZZ3.js";import{a as Pe,b as ye,c as ve,d as ke,e as ee,f as Ce}from"./chunk-T67L2YTW.js";import{d as he,e as be,g as $e}from"./chunk-SD626JBZ.js";import{d as se,e as Z,f as le}from"./chunk-VBXL7XO7.js";import{e as P,f as K}from"./chunk-2AVGUZ2P.js";import{a as u}from"./chunk-ZLLER3HP.js";import{createHash as We}from"node:crypto";import{existsSync as Ee,readFileSync as Se,writeFileSync as Ne}from"node:fs";var W=u(a=>We("sha256").update(a).digest("hex"),"sha256"),Ie=1.3,te=4,Le=20;function Fe(a,i){if(!a.configured||i<=0)return te;let t=Math.ceil(a.minPairs*Ie/i);return Math.min(Le,Math.max(te,t))}u(Fe,"passCapFor");function je(a,i=10,t=te){if(a<=0)return{passes:0,expectedPairs:0,feasible:!1,reason:"no live cases"};let l=Math.ceil(i*Ie),e=Math.min(t,Math.ceil(l/a)),r=e*a;return r<i?{passes:e,expectedPairs:r,feasible:!1,reason:`${a} live case(s) x ${t} passes = ${a*t} pairs at best, below the ${i} a controlled verdict requires \u2014 add cases rather than replaying these`}:{passes:e,expectedPairs:r,feasible:!0}}u(je,"planPasses");var Ue=60,qe=u(a=>typeof a=="object"&&a!==null&&typeof a.withScore=="number"&&typeof a.withoutScore=="number","isPair");function Ge(a,i,t){let l=[...a].sort((e,r)=>Date.parse(r.createdAt)-Date.parse(e.createdAt));for(let e of l){if(e.applied)continue;let r=e.gates?.accumulation;if(!r||typeof r!="object"||r.priorContentHash!==i||r.targetPairs!==t||typeof r.candidateContentHash!="string"||!Array.isArray(r.pairs))continue;let o=r.pairs.filter(qe);if(o.length===r.pairs.length&&!(o.length>=t))return{promotionId:e.id,candidateContentHash:r.candidateContentHash,pairs:o,runs:typeof r.runs=="number"?r.runs:1}}return null}u(Ge,"findOpenAccumulation");var Be=5,xe=u(a=>Array.isArray(a)?a.filter(i=>typeof i=="string"):[],"stringList"),j=u(a=>typeof a=="number"&&Number.isFinite(a)?a:null,"finite");function Xe(a,i,t=Be){let l=[...a].filter(o=>o.fromContentHash===i).sort((o,g)=>Date.parse(g.createdAt)-Date.parse(o.createdAt)),e=[],r=new Set;for(let o of l){let g=o.toContentHash??o.id;if(r.has(g))continue;r.add(g);let y=o.verdict??null,S=j(y?.delta),x=j(y?.ci?.lower),H=j(y?.ci?.upper),C=j(y?.nWith),ne=y?.sufficient===!0&&S!=null&&x!=null&&H!=null&&C!=null?{delta:S,ciLower:x,ciUpper:H,nPairs:C}:null;if(e.push({decision:typeof o.decision=="string"?o.decision:"unknown",applied:o.applied===!0,at:typeof o.createdAt=="string"?o.createdAt:"",rationale:typeof o.proposalRationale=="string"?o.proposalRationale:"",touched:xe(o.touchedSections),refusals:xe(o.refusals),measured:ne}),e.length>=t)break}return e}u(Xe,"summarisePriorDecisions");function ze(a,i){let t=i.accumulate??(a.autoEvolveAccumulate===!0||a.autoEvolveAccumulate==="true"),l=i.accumulateTargetPairs??a.autoEvolveAccumulateTarget,e=typeof l=="string"?Number.parseInt(l,10):l,r=typeof e=="number"&&Number.isInteger(e)&&e>0?e:Ue;return{enabled:t,targetPairs:r}}u(ze,"readAccumulateConfig");function Qe(a){let i=a.accumulateEnabled&&a.pairCount<a.targetPairs;return{apply:a.consented&&!i,peeking:i}}u(Qe,"resolveApply");async function it(a,i){let t=u(n=>i?.logger?.info?.(n)??console.log(n),"log"),{evalTargetId:l}=a,e=`[cron_instruction_evolution] ${l}`,r=await P(`/api/eval-targets/${l}`),o=r.metadata??{},g=null,y=!1;if(r.name.startsWith("/")&&Ee(r.name))try{if(g=Se(r.name,"utf8"),g!==r.content){let n=await K(`/api/eval-targets/${l}/sync-content`,{content:g});y=n.synced,t(`${e}: target content drifted from disk by ${Math.abs(g.length-r.content.length)} chars \u2014 synced to disk truth (v${n.version}). Prior verdicts against the old text dissolve via content-hash keying.`),r={...r,content:g,version:n.version}}}catch(n){t(`${e}: disk sync failed (${n instanceof Error?n.message:String(n)}) \u2014 measuring the stored snapshot`)}let S=!1;try{S=(await P("/api/settings/evolution-account")).paused}catch(n){t(`${e}: could not read the account switch (${n instanceof Error?n.message:String(n)}) \u2014 pausing to be safe`),S=!0}if(S)return t(`${e}: PAUSED for the whole account (profiles.evolution_paused) \u2014 no model budget spent.`),{skipped:"paused-account"};if(pe(o))return t(`${e}: PAUSED (metadata.autoEvolvePaused) \u2014 no model budget spent. Opt-in is intact.`),{skipped:"paused"};let x=Re(r);if(x)return t(`${e}: ${x.reason}`),x;let H=a.apply??(o.autoEvolveApply===!0||o.autoEvolveApply==="true"),C=Ve(o);if(C==null){if(H)return t(`${e}: refusing \u2014 metadata.immutableSections is unset. Set it (use [] to explicitly protect nothing) before letting the loop edit this target unattended.`),{skipped:"immutable-sections-unset"};t(`${e}: metadata.immutableSections unset \u2014 measure-only cycle proceeds with [] (nothing protected). Writing still requires setting it explicitly.`),C=[]}let $=(await P(`/api/eval-targets/${l}/evals`)).filter(n=>!n.retiredAt);if($.length===0)return{skipped:"no-live-cases"};let N=ue(o);N.note&&t(`${e}: ${N.note}`);let v=je($.length,N.minPairs,Fe(N,$.length));if(!v.feasible)return t(`${e}: cannot reach a sufficient verdict \u2014 ${v.reason}`),{skipped:"cannot-reach-min-n",reason:v.reason};let He=de({liveCases:$.length,passes:v.passes});t(`${e}: budget for this run \u2014 ${fe(He)}`);let U=await P(`/api/eval-targets/${l}/judge-calibration`);if(!U.powerCheck.adequate){let n=(U.powerCheck.reasons??[]).join("; ");return t(`${e}: not adequately powered, skipping before spending budget \u2014 ${n}`),{skipped:"not-adequate",reason:n}}let re=le,_e=Date.now()-re*24*60*60*1e3,q=await P(`/api/eval-targets/${l}/promotions?limit=200`),ae=q.promotions.filter(n=>n.applied&&Date.parse(n.createdAt)>=_e).length;if(ae>=Z)return t(`${e}: change budget looks exhausted (${ae}/${Z} applied in ${re}d), skipping before spending budget`),{skipped:"budget-exhausted"};try{let n=await P("/api/usage/current-limits"),c=we({limits:n,now:new Date});if(!c.ok)return t(`${e}: deferring before spending budget \u2014 ${c.reason}`),{skipped:"quota-exhausted",reason:c.reason}}catch(n){t(`${e}: quota unknown (${n instanceof Error?n.message:String(n)}) \u2014 proceeding`)}let L=se();if(!L.green)return t(`${e}: A/A canary is RED \u2014 halting. ${L.failures.join(" | ")}`),{skipped:"canary-red",reason:L.failures.join(" | ")};let G=r.content,D=W(G),p=ze(o,a),k=p.enabled?Ge(q.promotions,D,p.targetPairs):null,m,F,w=[],_=0,B=ce,f=k?null:ye(o,D);if(f){m=f.content,F="",B=0;try{w=await ke({evalTargetId:l,candidateContentHash:f.hash})}catch(n){return t(`${e}: could not rebuild banked pairs (${n instanceof Error?n.message:String(n)})`),{skipped:"resume-read-failed",reason:f.hash}}t(`${e}: resuming interrupted cycle \u2014 ${w.length}/${f.plannedPairs} pair(s) rebuilt from eval_runs, no proposal call spent`)}else if(k){let n=await P(`/api/promotions/${k.promotionId}`);if(W(n.toContent)!==k.candidateContentHash)return t(`${e}: stored candidate does not match its recorded hash \u2014 refusing to continue`),{skipped:"accumulation-hash-mismatch",reason:k.promotionId};m=n.toContent,F=n.proposalRationale??"",w=k.pairs,_=k.runs,B=0,t(`${e}: continuing accumulation ${k.promotionId} \u2014 ${w.length}/${p.targetPairs} pair(s) carried from ${_} prior run(s)`)}else{let n=U.caseDiscrimination?.cases??[],c=[];if(r.name.startsWith("/")){let s=r.name.slice(0,r.name.lastIndexOf("/"));try{let b=await P(`/api/insights/evidence?projectPath=${encodeURIComponent(s)}`);b.analyzedAt&&(c=[...b.friction.map(Y=>`Real-session friction (insights, ${b.analyzedAt.slice(0,10)}): ${Y}`),...b.whatWorks.map(Y=>`Working well in real sessions \u2014 do not break: ${Y}`)],c.length>0&&t(`${e}: proposer sees ${b.friction.length} friction + ${b.whatWorks.length} what-works item(s) from insights`))}catch(b){t(`${e}: insights evidence unavailable (${b instanceof Error?b.message:String(b)}) \u2014 proposing without it`)}}let T=[];try{T=Xe(q.promotions,D)}catch(s){t(`${e}: could not summarise prior decisions (${s instanceof Error?s.message:String(s)}) \u2014 proposing without them`)}T.length>0&&t(`${e}: proposer sees ${T.length} prior decision(s) against this exact body (${T.map(s=>`${s.decision}${s.measured?"/measured":""}`).join(", ")})`);let M=await Ae({currentContent:r.content,targetType:r.type,targetName:r.name,immutableSections:C,evidence:{nonDiscriminating:n.filter(s=>!s.discriminating).map(s=>`${s.name??s.assertion??"unnamed"} \u2014 ${s.note}`),weakest:n.filter(s=>s.discriminating&&s.withPassRate<s.withoutPassRate).map(s=>({name:s.name??s.assertion??"unnamed",withPassRate:s.withPassRate,withoutPassRate:s.withoutPassRate})),priorDecisions:T,notes:c}});if(!M.ok)return t(`${e}: no usable proposal \u2014 ${M.reason}`),{skipped:"no-proposal",reason:M.reason};m=M.proposal.candidateContent,F=M.proposal.rationale}let I=f?ve({plannedPairs:f.plannedPairs||v.expectedPairs,carriedPairs:w.length,liveCases:$.length}):v.passes;t(`${e}: measuring ${$.length} case(s) x ${I} pass(es) = up to ${$.length*I} pairs, candidate vs prior version`+(f?` (resumed; ${w.length} pair(s) already banked)`:""));let A=[],X=[],Oe=Date.now(),oe=0,z=0;for(let n=1;n<=I;n++){let c=await $e({cases:$,candidateContent:m,priorVersionContent:G,concurrency:a.concurrency??2,runNumber:n,opts:{targetId:l,targetVersion:r.version??1,iteration:1,timeout:a.timeout??24e4,model:a.model,graderModel:a.graderModel,skipGrading:!1,targetType:r.type,targetName:r.name,candidateContentHash:W(m)},onLog:t});if(A.push(...c.pairs),X.push(...c.results),oe+=c.completed,z+=c.failed,t(`${e}: pass ${n}/${I} \u2014 ${c.pairs.length} pair(s), running total ${A.length}`),c.abortedForQuota){t(`${e}: stopping after pass ${n}/${I} \u2014 ${c.abortedForQuota}. Remaining passes would spend against an exhausted account.`);break}}let R=[...w,...A],O=he(X),Q=A.length>0,d=ge({runs:X,plannedPairs:v.expectedPairs,usablePairs:A.length,verdictPairs:Q?R.length:A.length,proposalCalls:B,passes:I,liveCases:$.length,wallMs:Date.now()-Oe});if(t(`${e}: ${oe} completed, ${z} failed, ${A.length} usable pair(s) \u2014 spent ~${d.modelCalls} model calls (${d.proposalCalls} proposal + ${d.executorCalls} executor + >=${d.graderCalls} grader) in ${(d.wallMs/6e4).toFixed(1)} min`+(Q?`; the ${d.verdictPairs} pair(s) behind this verdict resolve +/-${me(d.mde)} at 80% power`:"")),!Q)return{skipped:O.infrastructureFailed?"infrastructure-failure":"no-pairs",reason:O.infrastructureFailed?`${O.infrastructureFailed} run(s) never executed (${O.summary.describe()}) \u2014 the environment failed, not the target`:`${z} run(s) failed or were ungradeable`,cost:d};let V=be({pairs:R.length,minPairs:10,accounting:O});if(V.kind==="infrastructure-incomplete")return t(`${e}: not posting a verdict \u2014 ${V.reason}`),await ee({evalTargetId:l,meta:o,blob:Ce({content:m,hash:W(m),priorHash:D,plannedPairs:f?.plannedPairs||v.expectedPairs,now:new Date}),log:t,tag:e}),{skipped:"infrastructure-incomplete",reason:V.reason,cost:d};p.enabled&&t(`${e}: accumulated ${R.length}/${p.targetPairs} pair(s) over ${_+1} run(s) on one candidate`);let ie=H,{apply:Te,peeking:Me}=Qe({consented:ie,accumulateEnabled:p.enabled,pairCount:R.length,targetPairs:p.targetPairs});ie&&Me&&t(`${e}: interim readout at ${R.length}/${p.targetPairs} pairs \u2014 recording the decision but not acting until the target is reached`);let h=await K(`/api/eval-targets/${l}/promotions`,{candidateContent:m,proposalSource:"llm",proposalRationale:F,pairs:R,canaryGreen:L.green,measuredAgainstContentHash:D,immutableSections:C,apply:Te,measurementCost:d,...p.enabled?{accumulation:{candidateContentHash:W(m),priorContentHash:D,targetPairs:p.targetPairs,carriedPairs:w.length,runs:_+1}}:{}});t(`${e}: ${h.decision}${h.applied?" (APPLIED)":""} \u2014 ${h.rationale}`+(h.refusals.length>0?` | refusals: ${h.refusals.join("; ")}`:"")),(f||o[Pe])&&await ee({evalTargetId:l,meta:o,blob:null,log:t,tag:e});let J=!1,E;if(h.applied&&r.name.startsWith("/"))try{Ee(r.name)?Se(r.name,"utf8")!==G?E="file changed since measurement started \u2014 refusing to clobber; next cycle re-syncs":(Ne(r.name,m,"utf8"),J=!0):E="file no longer exists on disk",t(J?`${e}: measured improvement written to ${r.name} (undo: git checkout -- ${r.name})`:`${e}: NOT written to disk \u2014 ${E}`)}catch(n){E=n instanceof Error?n.message:String(n),t(`${e}: disk write-back failed \u2014 ${E}. The eval target is updated; the file is not.`)}return{decision:h.decision,applied:h.applied,nPairs:R.length,promotionId:h.id,cost:d,diskSynced:y,...h.applied?{fileWritten:J,...E?{fileWriteSkipped:E}:{}}:{},...p.enabled?{carriedPairs:w.length,accumulationRuns:_+1}:{}}}u(it,"cronInstructionEvolution");function Ve(a){let i=a.immutableSections;return i==null||!Array.isArray(i)?null:i.filter(t=>typeof t=="string")}u(Ve,"readImmutableSections");export{Ie as a,te as b,Le as c,Fe as d,je as e,Ue as f,Ge as g,Be as h,Xe as i,ze as j,Qe as k,it as l,Ve as m};
|
|
1
|
+
import{a as Re}from"./chunk-M7QSC64D.js";import{i as Ae}from"./chunk-DPCAPIQB.js";import{a as Pe,b as ye,c as ve,d as ke,e as ee,f as Ce}from"./chunk-W23MESHM.js";import{b as ce,i as ue,j as pe,k as de,l as ge,m as me,n as fe}from"./chunk-LB24UKHZ.js";import{c as we}from"./chunk-G7V4ZZZ3.js";import{d as he,e as be,g as $e}from"./chunk-PWTTCSQA.js";import{d as se,e as Z,f as le}from"./chunk-VBXL7XO7.js";import{e as P,f as K}from"./chunk-UGACB66X.js";import{a as u}from"./chunk-ZLLER3HP.js";import{createHash as We}from"node:crypto";import{existsSync as Ee,readFileSync as Se,writeFileSync as Ne}from"node:fs";var W=u(a=>We("sha256").update(a).digest("hex"),"sha256"),Ie=1.3,te=4,Le=20;function Fe(a,i){if(!a.configured||i<=0)return te;let t=Math.ceil(a.minPairs*Ie/i);return Math.min(Le,Math.max(te,t))}u(Fe,"passCapFor");function je(a,i=10,t=te){if(a<=0)return{passes:0,expectedPairs:0,feasible:!1,reason:"no live cases"};let l=Math.ceil(i*Ie),e=Math.min(t,Math.ceil(l/a)),r=e*a;return r<i?{passes:e,expectedPairs:r,feasible:!1,reason:`${a} live case(s) x ${t} passes = ${a*t} pairs at best, below the ${i} a controlled verdict requires \u2014 add cases rather than replaying these`}:{passes:e,expectedPairs:r,feasible:!0}}u(je,"planPasses");var Ue=60,qe=u(a=>typeof a=="object"&&a!==null&&typeof a.withScore=="number"&&typeof a.withoutScore=="number","isPair");function Ge(a,i,t){let l=[...a].sort((e,r)=>Date.parse(r.createdAt)-Date.parse(e.createdAt));for(let e of l){if(e.applied)continue;let r=e.gates?.accumulation;if(!r||typeof r!="object"||r.priorContentHash!==i||r.targetPairs!==t||typeof r.candidateContentHash!="string"||!Array.isArray(r.pairs))continue;let o=r.pairs.filter(qe);if(o.length===r.pairs.length&&!(o.length>=t))return{promotionId:e.id,candidateContentHash:r.candidateContentHash,pairs:o,runs:typeof r.runs=="number"?r.runs:1}}return null}u(Ge,"findOpenAccumulation");var Be=5,xe=u(a=>Array.isArray(a)?a.filter(i=>typeof i=="string"):[],"stringList"),j=u(a=>typeof a=="number"&&Number.isFinite(a)?a:null,"finite");function Xe(a,i,t=Be){let l=[...a].filter(o=>o.fromContentHash===i).sort((o,g)=>Date.parse(g.createdAt)-Date.parse(o.createdAt)),e=[],r=new Set;for(let o of l){let g=o.toContentHash??o.id;if(r.has(g))continue;r.add(g);let y=o.verdict??null,S=j(y?.delta),x=j(y?.ci?.lower),H=j(y?.ci?.upper),C=j(y?.nWith),ne=y?.sufficient===!0&&S!=null&&x!=null&&H!=null&&C!=null?{delta:S,ciLower:x,ciUpper:H,nPairs:C}:null;if(e.push({decision:typeof o.decision=="string"?o.decision:"unknown",applied:o.applied===!0,at:typeof o.createdAt=="string"?o.createdAt:"",rationale:typeof o.proposalRationale=="string"?o.proposalRationale:"",touched:xe(o.touchedSections),refusals:xe(o.refusals),measured:ne}),e.length>=t)break}return e}u(Xe,"summarisePriorDecisions");function ze(a,i){let t=i.accumulate??(a.autoEvolveAccumulate===!0||a.autoEvolveAccumulate==="true"),l=i.accumulateTargetPairs??a.autoEvolveAccumulateTarget,e=typeof l=="string"?Number.parseInt(l,10):l,r=typeof e=="number"&&Number.isInteger(e)&&e>0?e:Ue;return{enabled:t,targetPairs:r}}u(ze,"readAccumulateConfig");function Qe(a){let i=a.accumulateEnabled&&a.pairCount<a.targetPairs;return{apply:a.consented&&!i,peeking:i}}u(Qe,"resolveApply");async function it(a,i){let t=u(n=>i?.logger?.info?.(n)??console.log(n),"log"),{evalTargetId:l}=a,e=`[cron_instruction_evolution] ${l}`,r=await P(`/api/eval-targets/${l}`),o=r.metadata??{},g=null,y=!1;if(r.name.startsWith("/")&&Ee(r.name))try{if(g=Se(r.name,"utf8"),g!==r.content){let n=await K(`/api/eval-targets/${l}/sync-content`,{content:g});y=n.synced,t(`${e}: target content drifted from disk by ${Math.abs(g.length-r.content.length)} chars \u2014 synced to disk truth (v${n.version}). Prior verdicts against the old text dissolve via content-hash keying.`),r={...r,content:g,version:n.version}}}catch(n){t(`${e}: disk sync failed (${n instanceof Error?n.message:String(n)}) \u2014 measuring the stored snapshot`)}let S=!1;try{S=(await P("/api/settings/evolution-account")).paused}catch(n){t(`${e}: could not read the account switch (${n instanceof Error?n.message:String(n)}) \u2014 pausing to be safe`),S=!0}if(S)return t(`${e}: PAUSED for the whole account (profiles.evolution_paused) \u2014 no model budget spent.`),{skipped:"paused-account"};if(pe(o))return t(`${e}: PAUSED (metadata.autoEvolvePaused) \u2014 no model budget spent. Opt-in is intact.`),{skipped:"paused"};let x=Re(r);if(x)return t(`${e}: ${x.reason}`),x;let H=a.apply??(o.autoEvolveApply===!0||o.autoEvolveApply==="true"),C=Ve(o);if(C==null){if(H)return t(`${e}: refusing \u2014 metadata.immutableSections is unset. Set it (use [] to explicitly protect nothing) before letting the loop edit this target unattended.`),{skipped:"immutable-sections-unset"};t(`${e}: metadata.immutableSections unset \u2014 measure-only cycle proceeds with [] (nothing protected). Writing still requires setting it explicitly.`),C=[]}let $=(await P(`/api/eval-targets/${l}/evals`)).filter(n=>!n.retiredAt);if($.length===0)return{skipped:"no-live-cases"};let N=ue(o);N.note&&t(`${e}: ${N.note}`);let v=je($.length,N.minPairs,Fe(N,$.length));if(!v.feasible)return t(`${e}: cannot reach a sufficient verdict \u2014 ${v.reason}`),{skipped:"cannot-reach-min-n",reason:v.reason};let He=de({liveCases:$.length,passes:v.passes});t(`${e}: budget for this run \u2014 ${fe(He)}`);let U=await P(`/api/eval-targets/${l}/judge-calibration`);if(!U.powerCheck.adequate){let n=(U.powerCheck.reasons??[]).join("; ");return t(`${e}: not adequately powered, skipping before spending budget \u2014 ${n}`),{skipped:"not-adequate",reason:n}}let re=le,_e=Date.now()-re*24*60*60*1e3,q=await P(`/api/eval-targets/${l}/promotions?limit=200`),ae=q.promotions.filter(n=>n.applied&&Date.parse(n.createdAt)>=_e).length;if(ae>=Z)return t(`${e}: change budget looks exhausted (${ae}/${Z} applied in ${re}d), skipping before spending budget`),{skipped:"budget-exhausted"};try{let n=await P("/api/usage/current-limits"),c=we({limits:n,now:new Date});if(!c.ok)return t(`${e}: deferring before spending budget \u2014 ${c.reason}`),{skipped:"quota-exhausted",reason:c.reason}}catch(n){t(`${e}: quota unknown (${n instanceof Error?n.message:String(n)}) \u2014 proceeding`)}let L=se();if(!L.green)return t(`${e}: A/A canary is RED \u2014 halting. ${L.failures.join(" | ")}`),{skipped:"canary-red",reason:L.failures.join(" | ")};let G=r.content,D=W(G),p=ze(o,a),k=p.enabled?Ge(q.promotions,D,p.targetPairs):null,m,F,w=[],_=0,B=ce,f=k?null:ye(o,D);if(f){m=f.content,F="",B=0;try{w=await ke({evalTargetId:l,candidateContentHash:f.hash})}catch(n){return t(`${e}: could not rebuild banked pairs (${n instanceof Error?n.message:String(n)})`),{skipped:"resume-read-failed",reason:f.hash}}t(`${e}: resuming interrupted cycle \u2014 ${w.length}/${f.plannedPairs} pair(s) rebuilt from eval_runs, no proposal call spent`)}else if(k){let n=await P(`/api/promotions/${k.promotionId}`);if(W(n.toContent)!==k.candidateContentHash)return t(`${e}: stored candidate does not match its recorded hash \u2014 refusing to continue`),{skipped:"accumulation-hash-mismatch",reason:k.promotionId};m=n.toContent,F=n.proposalRationale??"",w=k.pairs,_=k.runs,B=0,t(`${e}: continuing accumulation ${k.promotionId} \u2014 ${w.length}/${p.targetPairs} pair(s) carried from ${_} prior run(s)`)}else{let n=U.caseDiscrimination?.cases??[],c=[];if(r.name.startsWith("/")){let s=r.name.slice(0,r.name.lastIndexOf("/"));try{let b=await P(`/api/insights/evidence?projectPath=${encodeURIComponent(s)}`);b.analyzedAt&&(c=[...b.friction.map(Y=>`Real-session friction (insights, ${b.analyzedAt.slice(0,10)}): ${Y}`),...b.whatWorks.map(Y=>`Working well in real sessions \u2014 do not break: ${Y}`)],c.length>0&&t(`${e}: proposer sees ${b.friction.length} friction + ${b.whatWorks.length} what-works item(s) from insights`))}catch(b){t(`${e}: insights evidence unavailable (${b instanceof Error?b.message:String(b)}) \u2014 proposing without it`)}}let T=[];try{T=Xe(q.promotions,D)}catch(s){t(`${e}: could not summarise prior decisions (${s instanceof Error?s.message:String(s)}) \u2014 proposing without them`)}T.length>0&&t(`${e}: proposer sees ${T.length} prior decision(s) against this exact body (${T.map(s=>`${s.decision}${s.measured?"/measured":""}`).join(", ")})`);let M=await Ae({currentContent:r.content,targetType:r.type,targetName:r.name,immutableSections:C,evidence:{nonDiscriminating:n.filter(s=>!s.discriminating).map(s=>`${s.name??s.assertion??"unnamed"} \u2014 ${s.note}`),weakest:n.filter(s=>s.discriminating&&s.withPassRate<s.withoutPassRate).map(s=>({name:s.name??s.assertion??"unnamed",withPassRate:s.withPassRate,withoutPassRate:s.withoutPassRate})),priorDecisions:T,notes:c}});if(!M.ok)return t(`${e}: no usable proposal \u2014 ${M.reason}`),{skipped:"no-proposal",reason:M.reason};m=M.proposal.candidateContent,F=M.proposal.rationale}let I=f?ve({plannedPairs:f.plannedPairs||v.expectedPairs,carriedPairs:w.length,liveCases:$.length}):v.passes;t(`${e}: measuring ${$.length} case(s) x ${I} pass(es) = up to ${$.length*I} pairs, candidate vs prior version`+(f?` (resumed; ${w.length} pair(s) already banked)`:""));let A=[],X=[],Oe=Date.now(),oe=0,z=0;for(let n=1;n<=I;n++){let c=await $e({cases:$,candidateContent:m,priorVersionContent:G,concurrency:a.concurrency??2,runNumber:n,opts:{targetId:l,targetVersion:r.version??1,iteration:1,timeout:a.timeout??24e4,model:a.model,graderModel:a.graderModel,skipGrading:!1,targetType:r.type,targetName:r.name,candidateContentHash:W(m)},onLog:t});if(A.push(...c.pairs),X.push(...c.results),oe+=c.completed,z+=c.failed,t(`${e}: pass ${n}/${I} \u2014 ${c.pairs.length} pair(s), running total ${A.length}`),c.abortedForQuota){t(`${e}: stopping after pass ${n}/${I} \u2014 ${c.abortedForQuota}. Remaining passes would spend against an exhausted account.`);break}}let R=[...w,...A],O=he(X),Q=A.length>0,d=ge({runs:X,plannedPairs:v.expectedPairs,usablePairs:A.length,verdictPairs:Q?R.length:A.length,proposalCalls:B,passes:I,liveCases:$.length,wallMs:Date.now()-Oe});if(t(`${e}: ${oe} completed, ${z} failed, ${A.length} usable pair(s) \u2014 spent ~${d.modelCalls} model calls (${d.proposalCalls} proposal + ${d.executorCalls} executor + >=${d.graderCalls} grader) in ${(d.wallMs/6e4).toFixed(1)} min`+(Q?`; the ${d.verdictPairs} pair(s) behind this verdict resolve +/-${me(d.mde)} at 80% power`:"")),!Q)return{skipped:O.infrastructureFailed?"infrastructure-failure":"no-pairs",reason:O.infrastructureFailed?`${O.infrastructureFailed} run(s) never executed (${O.summary.describe()}) \u2014 the environment failed, not the target`:`${z} run(s) failed or were ungradeable`,cost:d};let V=be({pairs:R.length,minPairs:10,accounting:O});if(V.kind==="infrastructure-incomplete")return t(`${e}: not posting a verdict \u2014 ${V.reason}`),await ee({evalTargetId:l,meta:o,blob:Ce({content:m,hash:W(m),priorHash:D,plannedPairs:f?.plannedPairs||v.expectedPairs,now:new Date}),log:t,tag:e}),{skipped:"infrastructure-incomplete",reason:V.reason,cost:d};p.enabled&&t(`${e}: accumulated ${R.length}/${p.targetPairs} pair(s) over ${_+1} run(s) on one candidate`);let ie=H,{apply:Te,peeking:Me}=Qe({consented:ie,accumulateEnabled:p.enabled,pairCount:R.length,targetPairs:p.targetPairs});ie&&Me&&t(`${e}: interim readout at ${R.length}/${p.targetPairs} pairs \u2014 recording the decision but not acting until the target is reached`);let h=await K(`/api/eval-targets/${l}/promotions`,{candidateContent:m,proposalSource:"llm",proposalRationale:F,pairs:R,canaryGreen:L.green,measuredAgainstContentHash:D,immutableSections:C,apply:Te,measurementCost:d,...p.enabled?{accumulation:{candidateContentHash:W(m),priorContentHash:D,targetPairs:p.targetPairs,carriedPairs:w.length,runs:_+1}}:{}});t(`${e}: ${h.decision}${h.applied?" (APPLIED)":""} \u2014 ${h.rationale}`+(h.refusals.length>0?` | refusals: ${h.refusals.join("; ")}`:"")),(f||o[Pe])&&await ee({evalTargetId:l,meta:o,blob:null,log:t,tag:e});let J=!1,E;if(h.applied&&r.name.startsWith("/"))try{Ee(r.name)?Se(r.name,"utf8")!==G?E="file changed since measurement started \u2014 refusing to clobber; next cycle re-syncs":(Ne(r.name,m,"utf8"),J=!0):E="file no longer exists on disk",t(J?`${e}: measured improvement written to ${r.name} (undo: git checkout -- ${r.name})`:`${e}: NOT written to disk \u2014 ${E}`)}catch(n){E=n instanceof Error?n.message:String(n),t(`${e}: disk write-back failed \u2014 ${E}. The eval target is updated; the file is not.`)}return{decision:h.decision,applied:h.applied,nPairs:R.length,promotionId:h.id,cost:d,diskSynced:y,...h.applied?{fileWritten:J,...E?{fileWriteSkipped:E}:{}}:{},...p.enabled?{carriedPairs:w.length,accumulationRuns:_+1}:{}}}u(it,"cronInstructionEvolution");function Ve(a){let i=a.immutableSections;return i==null||!Array.isArray(i)?null:i.filter(t=>typeof t=="string")}u(Ve,"readImmutableSections");export{Ie as a,te as b,Le as c,Fe as d,je as e,Ue as f,Ge as g,Be as h,Xe as i,ze as j,Qe as k,it as l,Ve as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as G}from"./chunk-2KJAM2NG.js";import{b as q}from"./chunk-IEQDLURA.js";import{a as M}from"./chunk-W67DO5PT.js";import{a as L}from"./chunk-2DWUGAJ4.js";import{a as B}from"./chunk-UTAETY5Z.js";import{b as N}from"./chunk-E4RGYYBC.js";import{a as V}from"./chunk-O65AQZYB.js";import{a as W}from"./chunk-ARC4Q3GL.js";import{a as x}from"./chunk-ZYGBABMZ.js";import{b as T}from"./chunk-5RBLIVBF.js";import{a as C}from"./chunk-5OX6YKTR.js";import{a as U}from"./chunk-R6MCQNSH.js";import{a as O}from"./chunk-UA5GEVGW.js";import{a as A}from"./chunk-PZS55PW2.js";import{a as K}from"./chunk-AKXGUQ5B.js";import{e as S}from"./chunk-Z4YVOVMM.js";import{b as D}from"./chunk-NKJTNGXR.js";import{a as P}from"./chunk-MJ5H7RDK.js";import{a as F}from"./chunk-RUTWW6N6.js";import{a as $}from"./chunk-S2SKT5PV.js";import{a as J}from"./chunk-GRPUY2EZ.js";import{a as y}from"./chunk-UXB6DRR7.js";import{l as R}from"./chunk-7PWPWJXC.js";import{d as H}from"./chunk-NF2BIEAF.js";import{b as E,e as I,f as _}from"./chunk-UGACB66X.js";import{a}from"./chunk-ZLLER3HP.js";var j={process_eval:M,process_insights:L,process_launch:N,process_send_message:x,process_conversation:P,process_session_goal:C,distill_memories:D,memory_ab:V,process_run_cleanup:W,cron_refine_cases:U,cron_retire_unused_skills:K,cron_reconcile_attribution:y,cron_suggest_instructions:S,cron_refresh_skills:A,cron_refresh_pricing:O,cron_eval_autorun:$,cron_auto_accept_suggestions:F,cron_instruction_training:J,cron_instruction_evolution:R,process_judge_review:B},Q=Object.keys(j),ne=new Set([]);function re(e=process.env){return e.DATABASE_URL?Q:Q.filter(n=>!ne.has(n))}a(re,"availableCapabilities");var te=3e4,oe=3e4,se=3e4,X=500,Y=1e4,ae=`thin-agent-${process.pid}`,b=null;function ie(e,n,r,c){let i;try{let u=H();i={claude:u.claudeBin!=null,codex:u.codexBin!=null,codexModel:u.codexConfiguredModel}}catch{}let m=a(u=>{_("/api/workers/heartbeat",{workerType:"cli-worker",clientName:ae,clientVersion:c,workerVersion:"0.1.0",currentJobId:null,inFlightCount:0,lastError:null,status:u,metadata:{capabilities:e,mode:"thin-agent",llmEngines:i}}).then(d=>{let l=d?.advisory;l&&l.message!==b?(b=l.message,s(r,{event:"worker_advisory",code:l.code,message:l.message})):l||(b=null)}).catch(d=>{s(r,{event:"presence_heartbeat_error",error:d instanceof Error?d.message:String(d)})})},"send");m("alive");let o=setInterval(()=>m("alive"),se);n.addEventListener("abort",()=>{clearInterval(o),m("shutting_down")},{once:!0})}a(ie,"startPresenceHeartbeat");function s(e,n){try{e(JSON.stringify({ts:new Date().toISOString(),...n}))}catch{e(`[agent-loop] log_error event=${n.event}`)}}a(s,"structuredLog");function z(e,n){return n.aborted?Promise.resolve(!1):e<=0?Promise.resolve(!0):new Promise(r=>{let c=setTimeout(()=>{n.removeEventListener("abort",i),r(!0)},e),i=a(()=>{clearTimeout(c),n.removeEventListener("abort",i),r(!1)},"onAbort");n.addEventListener("abort",i,{once:!0})})}a(z,"abortableSleep");async function le(e,n){let r=`capabilities=${encodeURIComponent(e.join(","))}&waitMs=${n}`,c=await I(`/api/work/next?${r}`);return c==null||typeof c=="string"?null:c}a(le,"pollForWork");function ce(e,n){return{logger:{info:a(r=>n(r),"info"),warn:a(r=>n(r),"warn"),error:a(r=>n(r),"error")},job:{attempts:e}}}a(ce,"makeHelpers");async function de(e,n,r){let c=j[e.kind],i=Date.now();if(s(r,{event:"claim",jobId:e.id,kind:e.kind,attempts:e.attempts}),!c){let o=`unknown kind: ${e.kind}`;s(r,{event:"fail",jobId:e.id,kind:e.kind,terminal:!0,error:o}),await _(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:o,terminal:!0}).catch(()=>{});return}let m=setInterval(()=>{s(r,{event:"heartbeat",jobId:e.id}),_(`/api/work/${e.id}/heartbeat`,{leaseToken:e.leaseToken}).catch(o=>{s(r,{event:"heartbeat_error",jobId:e.id,error:o instanceof Error?o.message:String(o)})})},n);try{let o=ce(e.attempts,r),u=await c(e.payload,o)??{};clearInterval(m),s(r,{event:"complete",jobId:e.id,kind:e.kind,durationMs:Date.now()-i}),await _(`/api/work/${e.id}/complete`,{leaseToken:e.leaseToken,result:u})}catch(o){clearInterval(m);let u=T(o),d=o instanceof Error?o.message:String(o);s(r,{event:"fail",jobId:e.id,kind:e.kind,durationMs:Date.now()-i,terminal:u,error:d}),await _(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:d,terminal:u}).catch(l=>{s(r,{event:"fail_post_error",jobId:e.id,error:l instanceof Error?l.message:String(l)})})}}a(de,"runOne");var Z=new Set(["process_eval","process_conversation","process_insights","process_session_goal","distill_memories","memory_ab","cron_suggest_instructions","cron_eval_autorun","cron_instruction_evolution","process_judge_review"]);async function Ve(e){let n=e.log??(()=>{}),r=e.pollWaitMs??te,c=e.heartbeatIntervalMs??oe,i=e.capabilities??re();s(n,{event:"agent_start",capabilities:i,pollWaitMs:r,heartbeatIntervalMs:c});try{let t=q();t.removed.length>0&&s(n,{event:"eval_worktrees_swept",removed:t.removed.length})}catch(t){s(n,{event:"eval_worktree_sweep_failed",error:t instanceof Error?t.message:String(t)})}ie(i,e.signal,n,e.version),G({signal:e.signal,log:n}).catch(t=>{s(n,{event:"tt_heartbeat_fatal",error:t instanceof Error?t.message:String(t)})});let m=5*6e4,o=0,u=a(()=>{if(!e.readInstalledVersion||!e.version)return!1;let t=Date.now();if(t-o<m)return!1;o=t;let f=e.readInstalledVersion();return!!(f&&f!==e.version)},"versionDrifted"),d=new AbortController,l=d.signal;e.signal.aborted?d.abort():e.signal.addEventListener("abort",()=>d.abort(),{once:!0});let v=a(async(t,f)=>{let g=X;for(;!l.aborted;){if(u()){s(n,{event:"agent_version_drift",bootVersion:e.version,installedVersion:e.readInstalledVersion?.()??null}),d.abort(),e.onVersionDrift?.();break}let h=null;try{h=await le([...f],r)}catch(p){let ee=p instanceof E?p.statusCode:void 0;if(s(n,{event:"poll_error",lane:t,status:ee,error:p instanceof Error?p.message:String(p)}),!await z(g,l))break;g=Math.min(g*2,Y);continue}if(!h){if(s(n,{event:"poll_204",lane:t}),!await z(g,l))break;g=Math.min(g*2,Y);continue}g=X,await de(h,c,n)}},"runLane"),k=i.filter(t=>Z.has(t)),w=i.filter(t=>!Z.has(t));k.length>0&&w.length>0?(s(n,{event:"agent_lanes",heavy:k.length,fast:w.length}),await Promise.all([v("heavy",k),v("fast",w)])):await v("single",i),s(n,{event:"agent_stop"})}a(Ve,"runAgentLoop");export{j as a,Q as b,re as c,le as d,Ve as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-UGACB66X.js";import{a as e}from"./chunk-ZLLER3HP.js";function i(){return process.env.RULEMETRIC_API_URL??a}e(i,"apiUrl");function u(){let n=process.env.RULEMETRIC_API_KEY??process.env.RULEMETRIC_ACCESS_TOKEN;if(!n)throw new Error("not signed in \u2014 run `rulemetric auth login`");return n}e(u,"authToken");async function t(n,o){let r=await fetch(`${i()}${n}`,{...o,headers:{Authorization:`Bearer ${u()}`,"Content-Type":"application/json",...o?.headers??{}},signal:AbortSignal.timeout(1e4)});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return await r.json()}e(t,"request");function c({limit:n}){return t(`/api/launch-jobs?limit=${n}`)}e(c,"fetchLaunchJobs");function h(n){return t("/api/launch-jobs",{method:"POST",body:JSON.stringify(n)})}e(h,"createLaunchJob");function l(n){return t(`/api/launch-jobs/${n}/cancel`,{method:"POST"})}e(l,"cancelLaunchJob");function p(){return t("/api/launchers")}e(p,"listLaunchers");export{c as a,h as b,l as c,p as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t,e as E}from"./chunk-
|
|
1
|
+
import{b as t,e as E}from"./chunk-7PWPWJXC.js";import{a as r}from"./chunk-ZLLER3HP.js";function s(o=10,_=t){for(let e=1;e<=o;e++)if(E(e,o,_).feasible)return e;return o}r(s,"minFeasibleLiveCases");var S=s(),A=3;export{s as a,S as b,A as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as E,m}from"./chunk-E7XOYGL5.js";import{a as d}from"./chunk-
|
|
1
|
+
import{c as E,m}from"./chunk-E7XOYGL5.js";import{a as d}from"./chunk-UGACB66X.js";import{a as c}from"./chunk-ZLLER3HP.js";import*as p from"node:fs";import*as u from"node:path";import*as _ from"node:os";function T(){if(process.env.RULEMETRIC_API_KEY||process.env.RULEMETRIC_ACCESS_TOKEN)return;let s=u.join(_.homedir(),".config","rulemetric","env");C(s)||C(u.join(process.cwd(),".env.local"))}c(T,"ensureEnv");function C(s){try{let t=p.readFileSync(s,"utf-8");for(let n of t.split(`
|
|
2
2
|
`)){let e=n.trim();if(!e||e.startsWith("#"))continue;let o=e.indexOf("=");if(o<0)continue;let r=e.slice(0,o).trim(),i=e.slice(o+1).trim();process.env[r]||(process.env[r]=i)}return!!(process.env.RULEMETRIC_API_KEY||process.env.RULEMETRIC_ACCESS_TOKEN)}catch{return!1}}c(C,"loadEnvFile");T();async function I(s){let t={totalSessions:0,totalCalls:0,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,totalCacheWriteTokens:0,totalCostUSD:0,providers:{}},n=await m(s);t.providers={};for(let a of n)t.providers[a.provider]=(t.providers[a.provider]||0)+1;let e=new E,o=n.filter(a=>a.provider==="claude");for(let a of o)try{let h=p.readdirSync(a.path).filter(f=>f.endsWith(".jsonl"));t.totalSessions+=h.length;for(let f of h){let v=p.readFileSync(u.join(a.path,f),"utf-8"),R=e.parse(v);for(let l of R.events)l.tokenUsage&&(t.totalCalls++,t.totalInputTokens+=l.tokenUsage.input,t.totalOutputTokens+=l.tokenUsage.output,t.totalCacheReadTokens+=l.tokenUsage.cacheRead??0,t.totalCacheWriteTokens+=l.tokenUsage.cacheWrite??0)}}catch{}let r=15,i=75;return t.totalCostUSD=Math.round((t.totalInputTokens/1e6*r+t.totalOutputTokens/1e6*i+t.totalCacheReadTokens/1e6*(r*.1)+t.totalCacheWriteTokens/1e6*(r*1.25))*100)/100,t}c(I,"loadLocalStats");async function U(s){let t=process.env.RULEMETRIC_API_URL??d,n=process.env.RULEMETRIC_API_KEY,e=process.env.RULEMETRIC_ACCESS_TOKEN,o=n??e;if(!o)return null;let r=new URLSearchParams;s&&r.set("projectPath",s);try{let i=await fetch(`${t}/api/insights/compute?${r}`,{headers:{Authorization:`Bearer ${o}`},signal:AbortSignal.timeout(5e3)});return i.ok?await i.json():null}catch{return null}}c(U,"loadApiInsights");async function g(s){let t=process.env.RULEMETRIC_API_URL??d,n=process.env.RULEMETRIC_API_KEY??process.env.RULEMETRIC_ACCESS_TOKEN;if(!n)return null;let e=new URLSearchParams;s&&e.set("projectPath",s);try{let o=await fetch(`${t}/api/insights/linked-instructions?${e}`,{headers:{Authorization:`Bearer ${n}`},signal:AbortSignal.timeout(5e3)});return o.ok?await o.json():null}catch{return null}}c(g,"loadLinkedInstructions");export{I as a,U as b,g as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as g}from"./chunk-3ZHVP3KE.js";import{d as k,e as h}from"./chunk-
|
|
1
|
+
import{b as g}from"./chunk-3ZHVP3KE.js";import{d as k,e as h}from"./chunk-WCIX5KWG.js";import{e as m,i as f}from"./chunk-UGACB66X.js";import{a as c}from"./chunk-ZLLER3HP.js";import{existsSync as b}from"node:fs";async function w($,y){let r=c(t=>y?.logger?.info?.(t)??console.log(t),"log"),{projectPath:s}=$,n=`[cron_retire_unused_skills] ${s}`;if(!s||!b(s))return{skipped:"project-missing",reason:`${s} does not exist on this machine \u2014 refusing to delete files for a project that is not here.`};let o=await m("/api/insights/groom-candidates"),e=g({captureHealthy:o.skillCaptureHealthy===!0,captureReason:o.skillCaptureHealthy===void 0?"API did not report skill capture health (older deployment)":o.skillCaptureReason,candidates:o.unusedSkills??[]});if(e.refused)return r(`${n} ${e.refused}: ${e.summary}`),{skipped:e.refused,reason:e.summary,held:e.held.length};r(`${n} ${e.summary}`);let a=[],d=[],l=0;for(let t of e.retire){let u=k({kind:"skill_file",target:t.name,cwd:s});if(!u.ok){l+=1,r(`${n} could not plan removal of ${t.name}: ${u.refusal??"unresolved"}`);continue}let R=new Date().toISOString().replace(/[:.]/g,"-"),i=h(u,R);if(!i.applied){l+=1,r(`${n} failed to remove ${t.name}: ${i.error??"unknown error"}`);continue}a.push(t.name),i.backupPath&&d.push(i.backupPath),r(`${n} retired ${t.name} (backup: ${i.backupPath??"none"})`);try{await f(`/api/instructions/${t.instructionId}`)}catch(p){r(`${n} removed ${t.name} but could not archive its instruction row: ${p instanceof Error?p.message:String(p)}`)}}return{retired:a.length,failed:l,held:e.held.length,names:a,backups:d,reason:e.summary}}c(w,"cronRetireUnusedSkills");export{w as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=[{name:"cron_check_changelog",description:"Parse CHANGELOG.md and create draft announcement rows for new versions.",scheduledBy:"manual only \u2014 announcement drafts are reminder-driven, never scheduled"},{name:"cron_suggest_instructions",description:"Precompute per-project instruction suggestions for the SessionStart hook.",scheduledBy:"Supabase pg_cron daily 04:30 UTC \u2192 agent_jobs \u2192 agent loop (migration 00083)"},{name:"cron_reconcile_attribution",description:"Re-attribute captured sessions that never resolved to a project (project_id NULL), using git anchors read from the checkouts on this machine.",scheduledBy:"Supabase pg_cron hourly :20 \u2192 agent_jobs \u2192 agent loop (migration 00206)"},{name:"cron_refresh_skills",description:"Refresh the skills registry from GitHub sources (disk JSON + public instructions sync). Requires GITHUB_TOKEN.",scheduledBy:"Supabase pg_cron daily 03:30 UTC \u2192 agent_jobs \u2192 agent loop (migration 00086)"}];export{e as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as f}from"./chunk-RFISMWRW.js";import{a as l}from"./chunk-5RBLIVBF.js";import{b as g,e as k}from"./chunk-
|
|
1
|
+
import{c as f}from"./chunk-RFISMWRW.js";import{a as l}from"./chunk-5RBLIVBF.js";import{b as g,e as k}from"./chunk-UGACB66X.js";import{a as m}from"./chunk-ZLLER3HP.js";async function C(w,i={}){let R=i.removeWorktreeFn??f,t=i.log??(e=>process.stderr.write(`[process_run_cleanup] ${e}
|
|
2
2
|
`)),j=i.getRunDetail??(async e=>{try{return await k(`/api/runs/${e}`)}catch(r){if(r instanceof g&&r.statusCode===404)return null;throw r}}),{runId:o}=w,n=await j(o);if(!n)throw new l(`Run ${o} not found`);if(!n.run.projectPath)throw new l(`Run ${o} has no projectPath; cannot resolve a repo root for worktree cleanup`);let a=n.run.projectPath,$=n.sessions.filter(e=>e.endedAt!=null),s=[],u=0,c=0,p=0,d=0,h=new Set;for(let e of $)if(!(!e.projectPath||e.projectPath===a)&&!h.has(e.projectPath)){h.add(e.projectPath);try{let r=await R({repoRoot:a,worktreePath:e.projectPath});r.removed?(u++,s.push({sessionId:e.id,worktreePath:e.projectPath,status:"removed"}),t(`removed worktree ${e.projectPath} (session ${e.id})`)):r.reason==="dirty"?(c++,s.push({sessionId:e.id,worktreePath:e.projectPath,status:"skipped-dirty"}),t(`skipped dirty worktree ${e.projectPath} (session ${e.id}) \u2014 uncommitted changes`)):(p++,s.push({sessionId:e.id,worktreePath:e.projectPath,status:"absent"}),t(`worktree absent ${e.projectPath} (session ${e.id})`))}catch(r){let P=r instanceof Error?r.message:String(r);d++,s.push({sessionId:e.id,worktreePath:e.projectPath,status:"error",error:P.slice(0,1e3)}),t(`error removing worktree ${e.projectPath} (session ${e.id}): ${P}`)}}return t(`run ${o} cleanup: removed=${u} skippedDirty=${c} absent=${p} errored=${d}`),{runId:o,repoRoot:a,removed:u,skippedDirty:c,absent:p,errored:d,worktrees:s}}m(C,"processRunCleanup");export{C as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as $}from"./chunk-VBXL7XO7.js";import{e as w,f as k}from"./chunk-
|
|
1
|
+
import{b as $}from"./chunk-VBXL7XO7.js";import{e as w,f as k}from"./chunk-UGACB66X.js";import{a as u}from"./chunk-ZLLER3HP.js";function h(e){if(e.length===0)return{mean:0,stddev:0,min:0,max:0};let n=e.reduce((s,a)=>s+a,0)/e.length,o=e.reduce((s,a)=>s+(a-n)**2,0)/e.length;return{mean:Math.round(n*1e3)/1e3,stddev:Math.round(Math.sqrt(o)*1e3)/1e3,min:Math.min(...e),max:Math.max(...e)}}u(h,"computeStats");var x="with_target",E="without_target";function _(e){let n=e.grading.summary?.pass_rate;return typeof n=="number"&&n>=1}u(_,"fullPass");function b(e){return e.grading.summary?.pass_rate!=null}u(b,"hasGrading");function R(e){let n=e.timing.total_tokens;return typeof n=="number"&&n>0?n:void 0}u(R,"tokensOf");function v(e){let n=e.timing.duration_ms;return typeof n=="number"&&!isNaN(n)?n/1e3:void 0}u(v,"secondsOf");function y(e,n){let o={};for(let s of e)(o[n(s)]??=[]).push(s);return o}u(y,"groupBy");function C(e,n){let o=y(e.filter(b),i=>i.evalId),s=y(n.filter(b),i=>i.evalId),a=u((i,l)=>i.runNumber-l.runNumber,"byRun"),t=[];for(let i of Object.keys(o)){let l=o[i].sort(a),d=(s[i]??[]).sort(a);for(let r=0;r<Math.min(l.length,d.length);r++){let c={withScore:_(l[r])?1:0,withoutScore:_(d[r])?1:0},f=R(l[r]),g=R(d[r]);f!=null&&g!=null&&(c.withCost=f,c.withoutCost=g);let p=v(l[r]),m=v(d[r]);p!=null&&m!=null&&(c.withLatency=p,c.withoutLatency=m),t.push(c)}}return t}u(C,"pairRunsByEval");function T(e){let n=e.filter(r=>r.status==="completed");if(n.length===0)return{runSummary:{},verdict:null,notes:["No completed runs found"],totalRuns:0};let o=y(n,r=>r.configuration),s={},a=[];for(let[r,c]of Object.entries(o)){let f=c.filter(b).map(m=>m.grading.summary.pass_rate),g=c.map(v).filter(m=>m!=null),p=c.map(R).filter(m=>m!=null);s[r]={},f.length>0&&(s[r].pass_rate=h(f)),g.length>0&&(s[r].time_seconds=h(g)),p.length>0&&(s[r].tokens=h(p))}let t=null,i=o[x]??[],l=o[E]??[],d=C(i,l);if(d.length>0){if(t=$(d),!t.sufficient)a.push(t.insufficientReason??"Insufficient data for a significance verdict.");else if(t.significant){let r=t.delta>=0?"improves":"reduces",c=t.pValue!=null?`, McNemar p=${t.pValue.toFixed(4)}`:"";a.push(`Target ${r} the pass rate by ${Math.abs(t.delta*100).toFixed(0)}% (95% CI ${(t.ci.lower*100).toFixed(0)}\u2013${(t.ci.upper*100).toFixed(0)}%, n=${t.nWith}${c}).`)}else a.push(`No significant effect on pass rate (95% CI ${(t.ci.lower*100).toFixed(0)}\u2013${(t.ci.upper*100).toFixed(0)}%, n=${t.nWith}).`);t.costDelta!=null&&Math.round(t.costDelta)!==0&&a.push(`Token cost delta: ${t.costDelta>=0?"+":""}${Math.round(t.costDelta)} tokens/task.`),t.latencyDelta!=null&&Math.abs(t.latencyDelta)>1&&a.push(`Target ${t.latencyDelta>0?"adds":"saves"} ${Math.abs(t.latencyDelta).toFixed(1)}s/task.`)}for(let r of Object.values(s))if(r.pass_rate&&r.pass_rate.stddev>.2){a.push(`High pass-rate variance (stddev=${r.pass_rate.stddev.toFixed(2)}) \u2014 results may be unreliable.`);break}return{runSummary:s,verdict:t,notes:a,totalRuns:n.length}}u(T,"summarizeRuns");async function S(e,n){let o=n?`&iteration=${n}`:"",s=100,a=[];for(let t=0;t<1e5;t+=s){let i=await w(`/api/eval-targets/${e}/runs?limit=${s}&offset=${t}&activeCasesOnly=1${o}`);if(a.push(...i),i.length<s)break}return T(a)}u(S,"aggregateBenchmark");async function B(e,n,o){return k(`/api/eval-targets/${e}/benchmarks`,{iteration:n,runSummary:o.runSummary,notes:o.notes})}u(B,"postBenchmark");export{T as a,S as b,B as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as m}from"./chunk-
|
|
1
|
+
import{b as m}from"./chunk-A5P3RCPI.js";import{a as g}from"./chunk-ZLLER3HP.js";var p=5;function b(t){let r=g((e,f)=>({retire:[],survivingCases:0,replacementsRequired:!1,refused:e,summary:f}),"none");if(!t||t.cases.length===0&&t.unpairedCases.length===0)return r("no-discrimination-data","No case-discrimination data yet \u2014 the target needs runs in BOTH cohorts before any case can be judged dead.");let c=[...t.cases.filter(e=>!e.discriminating).map(e=>({evalId:e.evalId,name:e.name,feedback:{name:e.name,withPassRate:e.withPassRate,withoutPassRate:e.withoutPassRate,reason:e.note}})),...t.unpairedCases.map(e=>({evalId:e.evalId,name:e.name,feedback:{name:e.name,withPassRate:e.withPassRate??0,withoutPassRate:e.withoutPassRate,reason:"runs in only one cohort (no with-vs-without comparison possible)"}}))];if(c.length===0)return r("all-discriminating","Every case discriminates \u2014 nothing to retire.");let s=new Map(t.cases.map(e=>[e.evalId,e.separation])),o=[...c].sort((e,f)=>(s.get(e.evalId)??-1)-(s.get(f.evalId)??-1)).slice(0,p),u=c.length-o.length,d=t.total+t.unpaired,l=d-o.length,i=l<m,n=`${o.length} of ${d} live case(s) carry no treatment signal`+(u>0?` (${u} more over the ${p}-per-run cap)`:"")+(i?`; retiring them leaves ${l}, below the ${m}-case evolution floor, so replacements must be generated first`:"");return{retire:o,survivingCases:l,replacementsRequired:i,refused:null,summary:n}}g(b,"planCaseRefinement");async function v(t,r){let h=r.log??(()=>{}),c=g((n,e)=>({retired:0,generated:0,skipped:n,summary:e,retiredNames:[],generatedNames:[]}),"empty");if(t.refused)return c(t.refused,t.summary);let s=await r.generate(t.retire.map(n=>n.feedback)),a=[];for(let n of s??[]){let e=await r.createCase(n);a.push(e.name),h(` + ${e.name} (${e.id})`)}let o=t.survivingCases+t.retire.length+a.length,u=Math.max(0,o-m),d=t.retire.slice(0,Math.min(t.retire.length,u)),l=t.retire.length-d.length;if(d.length===0)return{retired:0,generated:a.length,skipped:s===null?"no-llm-backend":"no-replacements-generated",summary:`${t.summary}. `+(s===null?"No local LLM backend available, so nothing was retired":`The generator produced ${a.length} usable replacement(s), not enough to retire anything`)+` \u2014 dropping below the ${m}-case floor would silently disenrol the target from the nightly loop.`,retiredNames:[],generatedNames:a};let i=[];for(let n of d)await r.retireCase(n.evalId,n.feedback.reason),i.push(n.name),h(` retired ${n.name}`);return{retired:i.length,generated:a.length,skipped:null,summary:`Retired ${i.length} non-discriminating case(s), added ${a.length} replacement(s)`+(l>0?`; held ${l} back to stay at the ${m}-case floor (they remain condemned and will be retired once replacements exist)`:"")+". The replacements have no runs yet \u2014 the next autorun batch builds their depth.",retiredNames:i,generatedNames:a}}g(v,"executeCaseRefinement");export{p as a,b,v as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,b as D}from"./chunk-LUCVMLHV.js";import{e as _,f as C}from"./chunk-
|
|
1
|
+
import{a as h,b as D}from"./chunk-LUCVMLHV.js";import{e as _,f as C}from"./chunk-WMIUFMDI.js";import{a as o}from"./chunk-ZLLER3HP.js";import*as m from"node:fs/promises";import*as x from"node:path";import{eq as z}from"drizzle-orm";import{randomBytes as H}from"node:crypto";var A="#0d9488",g="#1a1a1a",y="#666666",M="#f5f5f7",k="#ffffff",I="#e5e5e9",O=["Added","Changed","Fixed","Removed","Deprecated","Security"];function U(e){let t=["January","February","March","April","May","June","July","August","September","October","November","December"],[n,r,a]=e.split("-").map(p=>parseInt(p,10));return!n||!r||!a||r<1||r>12?e:`${t[r-1]} ${a}, ${n}`}o(U,"formatIsoDate");function l(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}o(l,"escapeHtml");function P(e){let t=[];for(let n of O){let r=e[n];r&&r.length>0&&t.push({name:n,items:r})}return t}o(P,"orderedSections");function v(e){let{version:t,date:n,sections:r,unsubscribeUrl:a,productUrl:p,recipientName:u}=e,c=U(n),s=`What's new in RuleMetric \u2014 ${c}`,b=u?`Hi ${u},`:"Hi there,",i=P(r),d=new Date().getUTCFullYear(),E=i.map(({name:$,items:R})=>{let w=R.map(S=>` <li style="margin:0 0 6px 0;font-size:15px;line-height:1.5;color:${g};">${l(S)}</li>`).join(`
|
|
2
2
|
`);return` <h3 style="margin:24px 0 8px 0;font-size:16px;line-height:1.3;font-weight:600;color:${g};">${$}</h3>
|
|
3
3
|
<ul style="margin:0 0 8px 0;padding-left:20px;">
|
|
4
4
|
${w}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{d as u}from"./chunk-
|
|
1
|
+
import{a as c,c as d}from"./chunk-IZTIYR5Q.js";import{d as u}from"./chunk-OOFGV7EX.js";import{a}from"./chunk-VYZKKSX4.js";import{a as n}from"./chunk-YSLKV4XC.js";import{b as i}from"./chunk-UGACB66X.js";import{g as r}from"./chunk-PZNWH4VQ.js";import{a as s}from"./chunk-ZLLER3HP.js";import{Command as f,Flags as h}from"@oclif/core";function p(t){return t instanceof i?t.statusCode>=500||t.statusCode===408||t.statusCode===0:/fetch failed|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|bad gateway|timed out/i.test(t.message??"")}s(p,"isAvailabilityError");var m=class extends f{static{s(this,"BaseCommand")}static baseFlags={"api-url":h.string({description:"Override API base URL",env:"RULEMETRIC_API_URL",hidden:!0})};async init(){await super.init();let{flags:e}=await this.parse(this.constructor);e["api-url"]&&(process.env.RULEMETRIC_API_URL=e["api-url"]);let o=d(this.config.version);o&&!this.argv.includes("--quiet")&&!process.env.RULEMETRIC_QUIET&&process.stderr.write(`
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
`),c();try{await a()}catch{}}requireAuth(){r()||this.error("Not logged in. Run `rulemetric auth login` to authenticate."),n()}async catch(e){throw p(e)&&await u({command:this.id,statusCode:e instanceof i?e.statusCode:void 0,message:e.message,cliVersion:this.config.version}),e instanceof i&&(e.statusCode===401&&this.error("Session expired. Run `rulemetric auth login` to re-authenticate."),this.error(e.message)),(e.message?.includes("fetch failed")||e.message?.includes("ECONNREFUSED"))&&this.error("Could not connect to the API server. Is it running?"),e}};export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as l}from"./chunk-RFISMWRW.js";import{a as p}from"./chunk-5RBLIVBF.js";import{h}from"./chunk-
|
|
1
|
+
import{b as l}from"./chunk-RFISMWRW.js";import{a as p}from"./chunk-5RBLIVBF.js";import{h}from"./chunk-UGACB66X.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-XEWF3R3N.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,4 +1,4 @@
|
|
|
1
|
-
import{b as E,d as R}from"./chunk-
|
|
1
|
+
import{b as E,d as R}from"./chunk-UGACB66X.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as C}from"node:crypto";import{existsSync as A,mkdirSync as I,readFileSync as p,renameSync as L,rmdirSync as M,writeFileSync as m}from"node:fs";import{homedir as U,tmpdir as x}from"node:os";import{join as c}from"node:path";var $=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function v(t){return $.test(t)?t:`antigravity-${C("sha256").update(t).digest("hex").slice(0,16)}`}o(v,"hookSessionKey");var _=100,F=new Set(["RUN_COMMAND","VIEW_FILE","LIST_DIRECTORY","CODE_ACTION","GREP_SEARCH","SEARCH_WEB"]),H=new Set(["CONVERSATION_HISTORY","KNOWLEDGE_ARTIFACTS","CHECKPOINT"]);function T(){return process.env.RULEMETRIC_CONFIG_DIR??c(U(),".config","rulemetric")}o(T,"configDir");function O(){return c(T(),"antigravity-state")}o(O,"stateDir");function P(t){return c(O(),`${t}.json`)}o(P,"stateFile");function k(){let t=c(T(),"env");if(A(t))try{let n=p(t,"utf-8");for(let r of n.split(/\r?\n/)){let e=r.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);if(!e)continue;let i=e[1];if(process.env[i]!==void 0)continue;let s=e[2];(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),process.env[i]=s}}catch{}}o(k,"loadEnvFile");function b(t){try{let n=p(P(t),"utf-8"),r=JSON.parse(n);if(r&&typeof r=="object"&&"lastStepIdx"in r){let e=r.lastStepIdx;if(typeof e=="number"&&Number.isFinite(e))return{lastStepIdx:e}}}catch{}return null}o(b,"loadState");function g(t,n){I(O(),{recursive:!0});let r=P(t),e=`${r}.tmp`;m(e,JSON.stringify(n),{mode:384});try{L(e,r)}catch{m(r,JSON.stringify(n),{mode:384})}}o(g,"saveState");function N(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=c(r,v(t));try{return p(e,"utf-8").trim()||null}catch{return null}}o(N,"resolveRwSessionId");function W(t){let n=process.env.TMPDIR??x(),r=c(n,"rulemetric"),e=v(t),i=c(r,`${e}.seq`),s=c(r,`${e}.seqlock`),l=Date.now()+5e3;for(;Date.now()<l;)try{I(s);break}catch{}let a=1;try{a=parseInt(p(i,"utf-8").trim(),10)+1,(!Number.isFinite(a)||a<1)&&(a=1)}catch{a=1}try{m(i,String(a))}catch{}try{M(s)}catch{}return a}o(W,"nextSequence");function Y(t,n){let r;try{r=p(t,"utf-8")}catch{return[]}let e=[];for(let i of r.split(/\r?\n/))if(i.trim())try{let s=JSON.parse(i);typeof s.step_index=="number"&&s.step_index>n&&e.push(s)}catch{}return e.sort((i,s)=>i.step_index-s.step_index),e}o(Y,"readNewRecords");function G(t){let n;try{n=p(t,"utf-8")}catch{return-1}let r=-1;for(let e of n.split(/\r?\n/))if(e.trim())try{let i=JSON.parse(e);typeof i.step_index=="number"&&i.step_index>r&&(r=i.step_index)}catch{}return r}o(G,"findMaxStepIndex");function J(t){let n=t.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/);return n?n[1].trim():t.trim()}o(J,"extractUserPrompt");function j(t,n){let r=t.created_at??new Date().toISOString(),e={antigravityStepIndex:t.step_index,antigravitySource:t.source,antigravityType:t.type};if(H.has(t.type)||F.has(t.type))return null;if(t.source==="USER_EXPLICIT"&&t.type==="USER_INPUT")return{sequence:n,eventType:"user_message",content:J(t.content??""),timestamp:r,metadata:e};if(t.source==="MODEL"&&t.type==="PLANNER_RESPONSE"){let i=[];return t.thinking&&t.thinking.trim()&&i.push(`[thinking]
|
|
2
2
|
${t.thinking.trim()}`),t.content&&t.content.trim()&&i.push(t.content.trim()),t.tool_calls&&t.tool_calls.length>0&&(e.antigravityToolCalls=t.tool_calls.map(s=>s.name).filter(Boolean)),{sequence:n,eventType:"assistant_response",content:i.join(`
|
|
3
3
|
|
|
4
4
|
`)||null,timestamp:r,metadata:e}}return t.source==="MODEL"&&t.type==="GENERIC"?{sequence:n,eventType:"tool_result",content:t.content??null,timestamp:r,metadata:e}:t.source==="SYSTEM"&&(t.type==="SYSTEM_MESSAGE"||t.type==="ERROR_MESSAGE")?null:{sequence:n,eventType:`antigravity_${t.type.toLowerCase()}`,content:t.content??null,timestamp:r,metadata:e}}o(j,"classifyRecord");function q(t){try{let n=JSON.parse(t);return n&&typeof n=="object"?n:null}catch{return null}}o(q,"parseHookPayload");async function K(t,n,r,e,i={}){let s=i.errorSink??(u=>process.stderr.write(u)),l=0,a=0,d=0,S=0,f=e;for(let u of t){l++,i.onProgress?.({attempted:l,total:t.length,record:u});let w=W(r),y=j(u,w);if(!y)S++;else try{await R(`/api/sessions/${n}/events`,{method:"POST",body:y}),a++}catch(h){d++;let D=h instanceof E?h.statusCode:"unknown";s(`[antigravity-tailer] failed step=${u.step_index} type=${u.type} status=${D}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as p}from"./chunk-LJRE3LZ2.js";import{y as f}from"./chunk-
|
|
1
|
+
import{e as p}from"./chunk-LJRE3LZ2.js";import{y as f}from"./chunk-WMIUFMDI.js";import{a as r}from"./chunk-ZLLER3HP.js";var g=80,h=/\b(must|never|always|do not|don'?t|avoid|prefer|require[sd]?|before|after|only|instead of|use|run|add|keep|stop|refuse|check|verify|ask|write|read)\b/i,m=200,k=r(()=>({asks:[],omitted:0}),"empty");function A(s){return s.replace(/\s+/g," ").trim().toLowerCase()}r(A,"key");function I(s){let t=[];for(let o of s.split(`
|
|
2
2
|
`)){let e=o.trim(),n=t.length>0?t[t.length-1]:"",i=e===""||/^(?:[-*+]|\d+[.)]|#|```|>|\||!)/.test(e);if(n!==""&&!/[.!?:;]$/.test(n)&&!/^(?:#|```)/.test(n)&&!i){t[t.length-1]=`${n} ${e}`;continue}t.push(e)}return t.join(`
|
|
3
3
|
`)}r(I,"unwrap");function y(s,t=p){if(!s)return k();try{let o=new Set,e=[],n=[];for(let l of t(s))for(let d of f(I(l.content))){let c=A(d);if(c===""||o.has(c))continue;o.add(c);let a=d.replace(/\s+/g," ").trim(),u=a.length>m?`${a.slice(0,m)}\u2026`:a;(h.test(u)?e:n).push(u)}let i=[...e,...n];return{asks:i.slice(0,g),omitted:Math.max(0,i.length-g)}}catch{return k()}}r(y,"readInstalledAsks");export{g as a,m as b,y as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
1
|
+
import{c as u}from"./chunk-OOFGV7EX.js";import{b as c,e as y,f as m}from"./chunk-UGACB66X.js";import{a as n,b as t,i as s,k as p}from"./chunk-PZNWH4VQ.js";import{a}from"./chunk-ZLLER3HP.js";import{hostname as l}from"node:os";async function R(f,r,h){t();let o=process.env.RULEMETRIC_API_KEY,d=n().apiKey;if(o||d)try{await y("/api/profile");return}catch(e){if(!(e instanceof c)||e.statusCode!==401)return;if(o){r('Your exported RULEMETRIC_API_KEY was rejected (revoked?). Unset it or replace it with a fresh key (`rulemetric auth create-key --name "my-laptop"`).');return}p(),t(),r("Stored API key was rejected (revoked?) \u2014 replacing it with a fresh one.")}let i=`${l()} (auto)`;try{let e=await m("/api/auth/api-keys",{name:i});s(e.key,process.env.RULEMETRIC_API_URL),t(),f(`Created API key "${i}" for hooks + proxy auth (saved to your config).`),u("key_created",{},h)}catch(e){let k=e instanceof Error?e.message:String(e);r(`Could not auto-create an API key (${k}). Hooks/proxy will work via your session token for ABOUT AN HOUR \u2014 the token expires, and capture then stops until a key exists. Run \`rulemetric auth create-key --name "my-laptop"\` (or \`rulemetric auth login\` again) to fix this permanently.`)}}a(R,"ensureDeviceApiKey");export{R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I}from"./chunk-
|
|
1
|
+
import{a as I}from"./chunk-22ZDUL6H.js";import{b as A,c as l,d as b}from"./chunk-2MD5QLYF.js";import{f as k}from"./chunk-UGACB66X.js";import{n as f,o as g,p as u,v,w as $,x as y}from"./chunk-WMIUFMDI.js";import{a as c}from"./chunk-ZLLER3HP.js";import{randomUUID as P}from"node:crypto";async function H(s){let{applyMode:e="human",...r}=s;await k("/api/recommendation-applications",{...r,harness:"claude_code",applyMode:e,status:"applied",applyBatchId:P(),applySeq:0})}c(H,"recordApplication");async function M(s,e){let r=c(t=>({action:"manual-required",instructionId:e.id,name:e.name,fileModified:!1,messages:t}),"refuse");if(s.actor!=="human")return r([`Not installed: ${e.name} is a hook, and a hook is a command this machine runs unattended.`,"Installing one is always a human decision \u2014 the same refusal the API makes server-side.",` Review it: rulemetric suggestions accept ${s.suggestionId}`]);let n=y(e);if(!n.spec)return r([`Not installed: ${e.name} does not contain an installable hook spec.`,...n.problems.map(t=>` ${t.field}: ${t.message}`)]);if(n.problems.length>0)return r([`Not installed: ${e.name}'s hook spec is not fit to act on.`,...n.problems.map(t=>` ${t.field}: ${t.message}`)]);let w=u(e.frontmatter),i=v(n.spec,w??void 0),p=f(i);if(p.length>0)return r([`Not installed: ${e.name}'s artifact spec is not fit to act on.`,...p.map(t=>` ${t.field}: ${t.message}`)]);let o=b(s.dir,i.requires);if(o.missing.length>0)return r([`Not installed: ${e.name} needs ${o.missing.join(", ")}, which is not present here.`,"It is left unapplied rather than installed and broken \u2014 a hook whose command is missing still runs, and fails, on every matching event.","Accept it again once the dependency exists."]);let a=A({dir:s.dir,instructionId:e.id,spec:n.spec});if(a.status==="refused")return r([`Not installed: ${e.name}.`,` ${a.reason}`]);let m=g(i,a.inverse);if(m.length>0)return l({dir:s.dir,inverse:a.inverse}),r([`Not installed: ${e.name} was written and then rolled back \u2014 the actuator could not produce a valid inverse.`,...m.map(t=>` ${t.field}: ${t.message}`)]);try{await H({instructionId:e.id,projectPath:s.projectPath,targetPath:a.target,beforeHash:a.beforeHash,appliedHash:a.inverse.hashAtWrite,boundaryClass:i.boundaryClass,targets:i.targets,inverse:a.inverse,requires:i.requires,provides:i.provides})}catch(t){let h=l({dir:s.dir,inverse:a.inverse});return r([`Not installed: ${e.name} \u2014 the effect could not be recorded, so it was undone.`,` ${t instanceof Error?t.message:String(t)}`,h.removed?" The hook was removed; your settings are as they were.":` WARNING: the rollback did not complete (${h.reason??"unknown reason"}). Check ${a.target} for the entry tagged with ${e.id}.`])}await I(s.suggestionId,s.projectPath,e.id,s.actor);let d=a.status==="installed"?[`Accepted: installed a ${n.spec.event} hook into ${a.target}.`]:[`Already present: this hook is already installed in ${a.target}.`];for(let t of $(n.spec))d.push(` ${t}`);return o.unverifiable.length>0&&d.push(` unchecked: ${o.unverifiable.join(", ")} \u2014 this command cannot verify that namespace.`),d.push(`Undo with: rulemetric suggestions undo ${e.id}`),{action:a.status==="installed"?"added":"already-present",instructionId:e.id,name:e.name,fileModified:a.status==="installed",messages:d}}c(M,"acceptHook");export{H as a,M as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as j}from"./chunk-
|
|
1
|
+
import{a as j}from"./chunk-TBU5SWA4.js";import{a as E}from"./chunk-NBTC5FNV.js";import{a as J}from"./chunk-TU2AR6XO.js";import{d as T}from"./chunk-NJ5UED3H.js";import{b as I,c as P,d as v}from"./chunk-A2LHEUNW.js";import{a as b}from"./chunk-ZLLER3HP.js";import{useEffect as R,useState as i}from"react";import{Box as l,Text as s,useInput as Z}from"ink";import{jsx as t,jsxs as a}from"react/jsx-runtime";function K({onClose:A,activeOrg:F,defaultProjectPath:y,width:_}){let{jobs:u,error:L,loading:$,refetch:S}=j(20),[M,C]=i([]),[d,m]=i("list"),[f,w]=i(0),[h,g]=i(null),[x,B]=i(null),[p,c]=i(null);R(()=>{v().then(C).catch(o=>{let r=o instanceof Error?o.message:String(o);c(`couldn't load launchers: ${r}`),C([{tool:"claude_code",capabilities:{headless:!0,interactive:!0,remoteSpawn:!0}}])})},[]),R(()=>{if(!p)return;let o=setTimeout(()=>c(null),5e3);return()=>clearTimeout(o)},[p]),Z((o,r)=>{if(h){if(o==="y"||o==="Y"){let e=h.id;g(null),P(e).then(()=>{S(),c(`cancelled ${e.slice(0,8)}`)}).catch(n=>c(`cancel failed: ${n instanceof Error?n.message:String(n)}`))}else(o==="n"||o==="N"||r.escape)&&g(null);return}if(r.escape){if(d!=="none"){m("none");return}A();return}if(r.tab){m(e=>e==="list"?"form":e==="form"?"none":"list");return}if(o!=="q"&&d==="list"){if(r.upArrow)w(e=>Math.max(0,e-1));else if(r.downArrow)w(e=>Math.min(u.length-1,e+1));else if(o==="c"){let e=u[f];e&&(e.status==="running"||e.status==="queued"||e.status==="pending")&&g(e)}else if(o==="r"){let e=u[f],n=e?.result?.externalSessionId;e&&e.tool==="claude_code"&&n?(B({tool:"claude_code",projectPath:e.config.projectPath,resumeSessionId:n}),m("form")):c("resume needs a Claude Code session with a session id")}else if(o==="o"){let n=u[f]?.result?.externalSessionId;if(n){let O=process.env.RULEMETRIC_WEB_URL??"http://localhost:5174";import("node:child_process").then(({spawn:U})=>{U("open",[`${O}/sessions/${n}`],{detached:!0,stdio:"ignore"}).unref()})}}}});async function N(o){await I(o),B(null),m("list"),c("launched"),S()}return b(N,"handleSubmit"),a(l,{flexDirection:"column",borderStyle:"round",borderColor:T,width:_,paddingX:1,children:[a(l,{children:[t(s,{bold:!0,color:T,children:"Launcher"}),t(s,{dimColor:!0,children:" active org: "}),t(s,{children:F??"(none)"}),$&&t(s,{dimColor:!0,children:" loading\u2026"}),L&&a(s,{color:"#F55B5B",children:[" \u26A0 ",L]})]}),t(l,{marginTop:1,children:t(E,{jobs:u,selectedIndex:f,focused:d==="list"})}),t(l,{marginTop:1,children:t(J,{launchers:M,defaultProjectPath:x?.projectPath??y,defaultTool:x?.tool,defaultResumeSessionId:x?.resumeSessionId,focused:d==="form",onSubmit:N})}),h&&t(l,{marginTop:1,children:a(s,{color:"#FFD700",children:["Cancel job ",h.id.slice(0,8),"? (y/n)"]})}),p&&t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\xB7 ",p]})}),t(l,{marginTop:1,children:a(s,{dimColor:!0,children:["\u2191\u2193 select tab focus c cancel r resume o open esc ",d==="none"?"close":"back"]})})]})}b(K,"LauncherOverlay");export{K as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,f as a}from"./chunk-
|
|
1
|
+
import{b as o,f as a}from"./chunk-UGACB66X.js";import{a as n}from"./chunk-ZLLER3HP.js";function c(e){return e==null?e??null:e instanceof Date?e.toISOString():e}n(c,"serializeDate");async function d(e){let r={provider:e.provider,plan:e.plan,limitType:e.limitType,value:e.value,unit:e.unit,comparator:e.comparator,resetsAt:c(e.resetsAt),sourceType:e.sourceType,sourceUrl:e.sourceUrl,sourceEvidence:e.sourceEvidence,confidence:e.confidence,observedAt:c(e.observedAt)};return a("/api/internal/research/observe",r)}n(d,"postObservation");async function f(e){let r=0,i=0,s=[];for(let u of e)try{await d(u),r++}catch(t){i++;let p=t instanceof o?`HTTP ${t.statusCode}: ${t.message}`:String(t);s.length<5&&s.push(p)}return{posted:r,failed:i,errors:s}}n(f,"postObservations");export{d as a,f as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as c,f as d}from"./chunk-
|
|
1
|
+
import{e as c,f as d}from"./chunk-UGACB66X.js";import{a as m}from"./chunk-ZLLER3HP.js";async function f(g,p){let r=m(e=>p?.logger?.info?.(e)??console.log(e),"log"),{projectPath:s}=g,i=`[cron_instruction_training] ${s}`;if(!s)return{skipped:"no-project-path"};let n=await d("/api/instruction-experiments/settle",{projectPath:s}),o=n.settled.map(e=>e.outcome),a=o.filter(e=>e==="graduated").length;for(let e of n.settled)r(`${i}: experiment ${e.experimentId} \u2192 ${e.outcome}`);n.examined>0&&r(`${i}: examined ${n.examined} running experiment(s) \u2014 ${n.settled.length} settled (${a} graduated), ${n.stillRunning} still gathering`);let t=await c(`/api/instruction-suggestions/trialable?projectPath=${encodeURIComponent(s)}`);for(let e of t.refused)r(`${i}: not trialling "${e.name}" \u2014 ${e.reason}`);if(t.candidates.length===0)return r(`${i}: no new trial started (${t.running}/${t.limits.maxConcurrent} running, ${t.slots} slot(s) free)`),{examined:n.examined,settled:n.settled.length,graduated:a,nominated:0,running:t.running,outcomes:o};let u=0;for(let e of t.candidates)try{await d("/api/instruction-experiments",{instructionId:e.instructionId,projectPath:s,source:"trial"}),u+=1,r(`${i}: now measuring "${e.name}" (score ${e.score.toFixed(2)})`)}catch(l){r(`${i}: could not measure "${e.name}" \u2014 ${l instanceof Error?l.message:String(l)}`)}return{examined:n.examined,settled:n.settled.length,graduated:a,nominated:u,running:t.running+u,outcomes:o}}m(f,"cronInstructionTraining");export{f as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as u}from"./chunk-
|
|
1
|
+
import{f as u}from"./chunk-UGACB66X.js";import{a as m}from"./chunk-ZLLER3HP.js";async function p(n,a,s){if(a)try{let t=Array.isArray(n.recommendation_candidates)?n.recommendation_candidates.filter(e=>typeof e.title=="string"&&typeof e.artifact=="string"&&typeof e.canonicalBody=="string"&&e.canonicalBody.trim().length>=12).map(e=>({title:String(e.title).trim(),artifact:String(e.artifact),canonicalBody:String(e.canonicalBody).trim(),rationale:String(e.rationale??""),evidence:Array.isArray(e.evidence)?e.evidence:[],outcomeMetric:String(e.outcomeMetric??"session_outcome"),renderings:Array.isArray(e.renderings)?e.renderings:[]})):[],i=n.suggestions,l=Array.isArray(i?.claude_md_additions)?i.claude_md_additions.filter(e=>typeof e?.addition=="string"&&e.addition.trim().length>=12).map(e=>({addition:String(e.addition).trim(),why:String(e.why??"")})):[],d=Array.isArray(n.recommended_skills)?n.recommended_skills.filter(e=>typeof e?.skillId=="string"&&e.skillId.length>0).map(e=>({skillId:String(e.skillId),reason:String(e.reason??"")})):[],g=Array.isArray(i?.features_to_try)?i.features_to_try.filter(e=>typeof e?.feature=="string"&&e.feature.trim().length>=2).map(e=>({feature:String(e.feature).trim(),one_liner:String(e.one_liner??""),why_for_you:String(e.why_for_you??""),example_code:String(e.example_code??"")})):[],c=[...Array.isArray(i?.usage_patterns)?i.usage_patterns.map(e=>({title:String(e.title??"").trim(),lead:String(e.suggestion??""),detail:String(e.detail??""),copyable_prompt:String(e.copyable_prompt??""),origin:"usage_pattern"})):[],...Array.isArray(n.on_the_horizon?.opportunities)?n.on_the_horizon.opportunities.map(e=>({title:String(e.title??"").trim(),lead:String(e.whats_possible??""),detail:String(e.how_to_try??""),copyable_prompt:String(e.copyable_prompt??""),origin:"opportunity"})):[]].filter(e=>e.title.length>=2);if(t.length===0&&l.length===0&&d.length===0&&g.length===0&&c.length===0)return;let r=await u("/api/insights/recommendations/nominate",{projectPath:a,candidates:t.slice(0,40),additions:l.slice(0,20),skills:d.slice(0,20),features:g.slice(0,20),advice:c.slice(0,40)}),o=r.additionsRejected??[];s(` ${r.nominated} recommendation(s) nominated into the suggestion feed (${r.additionsCreated} new instruction(s)`+((r.featuresCreated??0)>0?`, ${r.featuresCreated} feature proposal(s)`:"")+((r.adviceCreated??0)>0?`, ${r.adviceCreated} pattern/opportunity`:"")+(r.skillsUnresolved>0?`, ${r.skillsUnresolved} skill slug(s) unresolved`:"")+(o.length>0?`, ${o.length} rejected as unfilled templates`:"")+")");for(let e of o)s(` rejected "${e.name}" \u2014 unfilled placeholder(s): ${e.placeholders.join(", ")}`);for(let e of r.itemsFailed??[])s(` failed "${e.name}" \u2014 ${e.error}`)}catch(t){s(` nomination skipped (whole batch): ${t instanceof Error?t.message:String(t)}`)}}m(p,"nominateRecommendations");export{p as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as D,c as j}from"./chunk-6UEFCMR2.js";import{b as B,c as R,d as N,e as z}from"./chunk-NF2BIEAF.js";import{a as G}from"./chunk-BJSVATVJ.js";import{c as J}from"./chunk-RIVEBBZC.js";import{e as f,g as T}from"./chunk-
|
|
1
|
+
import{b as D,c as j}from"./chunk-6UEFCMR2.js";import{b as B,c as R,d as N,e as z}from"./chunk-NF2BIEAF.js";import{a as G}from"./chunk-BJSVATVJ.js";import{c as J}from"./chunk-RIVEBBZC.js";import{e as f,g as T}from"./chunk-UGACB66X.js";import{a as p}from"./chunk-ZLLER3HP.js";function W(r,a,s){return s?r.reviewerModel===s||r.reviewerModel===`${a}:${s}`:r.reviewerEngine===a}p(W,"reviewMatchesReviewer");var C=100;function Z(r){let a=new Set;return r.forEach((s,d)=>{s.method!=="deterministic"&&a.add(d)}),a}p(Z,"llmExpectationIndexes");var w=class extends Error{constructor(s,d){super(d);this.reason=s}static{p(this,"JudgeReviewSkip")}};async function oe(r){let a=r.log??(()=>{}),s=r.warn??a,d=r.targetId,K=r.parallel??3,U=r.timeoutMs??12e4,v=await f(`/api/eval-targets/${d}`),u=(await f(`/api/eval-targets/${d}/annotations?limit=500`)).filter(e=>e.judgeMethod==="llm");if(u.length===0)throw new w("no-labels",`No human labels on "${v.name}" yet \u2014 label some runs in the Review tab first.`);let n;try{n=z({engineFlag:r.engineFlag??"auto",modelFlag:r.modelFlag,availability:N(),judgeModels:[...new Set(u.map(e=>e.judgeModel).filter(e=>e!=null))]})}catch(e){throw new w("no-engine",e instanceof Error?e.message:String(e))}a(`Reviewer: ${n.rationale}`);let c=0,b=u;if(r.skipReviewed){let e=await f(`/api/eval-targets/${d}/judge-reviews`),t=new Set(e.filter(i=>W(i,n.engine,r.modelFlag)).map(i=>`${i.evalRunId}:${i.expectationIndex}`));if(b=u.filter(i=>!t.has(`${i.evalRunId}:${i.expectationIndex}`)),c=u.length-b.length,b.length===0)return{targetName:v.name,reviewer:n,judgeModels:[],reviewerModel:n.model??`${n.engine} (CLI default)`,report:j([],0),persisted:0,alreadyReviewed:c,deferredPartialRuns:0}}let y=new Map;for(let e=0;;e+=C){let t=await f(`/api/eval-targets/${d}/runs?limit=${C}&offset=${e}`);for(let i of t)y.set(i.id,i);if(t.length<C)break}let q=await f(`/api/eval-targets/${d}/evals`),X=new Map(q.map(e=>[e.id,e.prompt])),o=new Map;for(let e of b){let t=o.get(e.evalRunId)??[];t.push(e),o.set(e.evalRunId,t)}let P=new Map;for(let e of u){let t=P.get(e.evalRunId)??new Set;t.add(e.expectationIndex),P.set(e.evalRunId,t)}let x=0;for(let[e]of[...o]){let t=y.get(e)?.grading?.expectations;if(!t)continue;let i=Z(t),g=P.get(e)??new Set;[...i].every(h=>g.has(h))||(o.delete(e),x+=1)}if(x>0&&a(`${x} partially-labeled run(s) deferred \u2014 a run is re-graded once, after all its assertions are labeled.`),o.size===0)return{targetName:v.name,reviewer:n,judgeModels:[],reviewerModel:n.model??`${n.engine} (CLI default)`,report:j([],0),persisted:0,alreadyReviewed:c,deferredPartialRuns:x};if(n.engine==="codex"&&n.model){let e=await J({prompt:"Reply with exactly: OK",model:n.model,timeout:6e4});if(e.error&&B(e.error)){if(n.model===R)throw new w("preflight-failed",`Codex fallback model ${R} is also unrunnable: ${e.error}`);s(`Your codex model "${n.model}" can't run on the installed CLI/account \u2014 falling back to ${R}.`),n={...n,model:R}}else if(e.error)throw new w("preflight-failed",`Codex preflight failed: ${e.error}`)}let S=[...o.values()].flat(),Y=[...new Set(S.map(e=>e.judgeModel).filter(e=>e!=null))];a(`Re-grading ${o.size} annotated run(s) / ${S.length} assertion(s) on "${v.name}"`+(c?` (${c} already reviewed \u2014 skipped)`:"")+".");let $=[],I=0,k=new Set,m=r.limit!=null?[...o.entries()].slice(0,Math.max(1,r.limit)):[...o.entries()];m.length<o.size&&a(`Sampling ${m.length} of ${o.size} annotated runs (limit).`);let H=0,Q=p(async()=>{for(;;){let e=H++;if(e>=m.length)return;let[t,i]=m[e],g=y.get(t),h=g?.grading?.expectations,O=g?.outputs?.transcript,F=g?X.get(g.evalId):void 0;if(!g||!h?.length||!O||!F){I+=i.length,s(`run ${t.slice(0,8)}: missing output/expectations/prompt \u2014 skipped`);continue}let M=await G({prompt:F,output:O,expectations:h.map(l=>l.text),model:n.model??void 0,timeout:U,engine:n.engine});M.judge_model&&k.add(M.judge_model);for(let l of i){let L=h[l.expectationIndex],A=M.expectations[l.expectationIndex];if(!L||!A||L.text!==l.expectationText){I+=1;continue}if(M.judge_model==null&&A.method==="llm"){I+=1;continue}$.push({runId:t,expectationIndex:l.expectationIndex,text:l.expectationText,humanPassed:D(l.verdict,l.judgePassed),judgeAPassed:l.judgePassed,judgeBPassed:A.passed})}a(` ${e+1}/${m.length} re-graded`)}},"workerFn");await Promise.all(Array.from({length:Math.max(1,Math.min(K,m.length))},Q));let V=j($,I),_=[...k][0]??n.model??`${n.engine} (CLI default)`,E=0;if($.length>0)try{E=(await T(`/api/eval-targets/${d}/judge-reviews`,{reviewerEngine:n.engine,reviewerModel:_,verdicts:$.map(t=>({evalRunId:t.runId,expectationIndex:t.expectationIndex,expectationText:t.text,judgePassed:t.judgeAPassed,humanPassed:t.humanPassed,reviewerPassed:t.judgeBPassed}))})).upserted,a(`Persisted ${E} reviewer verdict(s) \u2014 disagreements appear on the Review tab.`)}catch(e){s(`Could not persist reviewer verdicts: ${e instanceof Error?e.message:e}`)}return{targetName:v.name,reviewer:n,judgeModels:Y,reviewerModel:_,report:V,persisted:E,alreadyReviewed:c,deferredPartialRuns:x}}p(oe,"runJudgeReviewPass");export{W as a,Z as b,w as c,oe as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-5PM4E27L.js";import{h as s}from"./chunk-UGACB66X.js";import{a as n}from"./chunk-ZLLER3HP.js";async function l(a,c){let{mirrorId:g,evalTargetId:p,config:r}=a,e=n(o=>c.logger.info(o),"log");await i(r,p,e);let t={type:"conversation",conversationId:r.conversationId};return await s(`/api/eval-jobs/${g}/state`,{result:t}).catch(o=>{e(`result persist failed: ${o instanceof Error?o.message:String(o)}`)}),t}n(l,"processConversation");export{l as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as E}from"./chunk-QBNLZJIR.js";import{b,e as y,f as k,h as M}from"./chunk-
|
|
1
|
+
import{f as E}from"./chunk-QBNLZJIR.js";import{b,e as y,f as k,h as M}from"./chunk-UGACB66X.js";import{a as u}from"./chunk-ZLLER3HP.js";var v=50,I=24e3,P=3,R=3,C=40,N=4e3,x=new Set(["fact","decision","correction","convention"]),L=`You are distilling DURABLE, PROJECT-SPECIFIC knowledge from an AI coding session so a future agent working on the SAME project starts smarter.
|
|
2
2
|
|
|
3
3
|
Extract ONLY facts / decisions / corrections / conventions that will STILL be true and useful in FUTURE sessions \u2014 architecture facts, deliberate design decisions, corrections of a wrong approach, or project conventions.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk-BJSVATVJ.js";import{b as E}from"./chunk-VBXL7XO7.js";import{d as P}from"./chunk-TZA4HAVF.js";import{b as d,e as p,h as w}from"./chunk-
|
|
1
|
+
import{a as h}from"./chunk-BJSVATVJ.js";import{b as E}from"./chunk-VBXL7XO7.js";import{d as P}from"./chunk-TZA4HAVF.js";import{b as d,e as p,h as w}from"./chunk-UGACB66X.js";import{a as u}from"./chunk-ZLLER3HP.js";var b=u(n=>(n.summary.pass_rate??0)>=1?1:0,"fullPassScore");async function G(n,i={}){let c=i.executeEval??P,g=i.grade??h,v=i.getExperiment??(async r=>{try{return await p(`/api/memory-experiments/${r}`)}catch(t){if(t instanceof d&&t.statusCode===404)return null;throw t}}),M=i.getMemoryBody??(async r=>{try{return(await p(`/api/memories/${r}`)).body}catch(t){if(t instanceof d&&t.statusCode===404)return null;throw t}}),s=i.updateExperiment??(async(r,t)=>{await w(`/api/memory-experiments/${r}`,t)}),e=await v(n.experimentId);if(!e)return{skipped:"not_found"};if(e.status==="completed"||e.status==="failed")return{skipped:"already_terminal",status:e.status};let y=await M(e.memoryId);if(y==null)return await s(e.id,{status:"failed",error:"memory no longer exists"}),{skipped:"memory_gone",status:"failed"};await s(e.id,{status:"running"});let f=e.expectations??[],o=e.model??void 0,a=[],x=0;try{for(let t=0;t<e.trials;t++){let l=await c({prompt:e.taskPrompt,targetContent:y,model:o}),m=await c({prompt:e.taskPrompt,model:o});if(l.error||m.error){x++;continue}let[k,R]=await Promise.all([g({prompt:e.taskPrompt,output:l.output,expectations:f,model:o}),g({prompt:e.taskPrompt,output:m.output,expectations:f,model:o})]);a.push({withScore:b(k),withoutScore:b(R),withLatency:l.durationMs/1e3,withoutLatency:m.durationMs/1e3})}if(a.length===0){let t=`no trials completed (${x}/${e.trials} runs errored \u2014 is the claude CLI available?)`;return await s(e.id,{status:"failed",error:t}),{status:"failed",requestedTrials:e.trials,completedTrials:0}}let r=E(a);return await s(e.id,{status:"completed",result:{verdict:r,pairs:a,completedTrials:a.length,model:o??null}}),{status:"completed",requestedTrials:e.trials,completedTrials:a.length,significant:r.significant,delta:r.delta}}catch(r){let t=r instanceof Error?r.message:String(r);return await s(e.id,{status:"failed",error:t.slice(0,500)}).catch(()=>{}),{status:"failed",requestedTrials:e.trials,completedTrials:a.length}}}u(G,"processMemoryAb");export{G as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,d as m}from"./chunk-
|
|
1
|
+
import{a as d,d as m}from"./chunk-UGACB66X.js";import{a as c,l as a}from"./chunk-PZNWH4VQ.js";import{a as o}from"./chunk-ZLLER3HP.js";import{createHash as g,randomUUID as v}from"node:crypto";import{hostname as y,platform as p}from"node:os";import{existsSync as P,mkdirSync as _,readFileSync as h,writeFileSync as R}from"node:fs";import{join as E}from"node:path";var O="device-id";function u(){let e=o(t=>t==="1"||t==="true","off");return e(process.env.RULEMETRIC_NO_TELEMETRY)||e(process.env.DO_NOT_TRACK)}o(u,"telemetryDisabled");function l(){let e=a(),t=E(e,O);try{if(P(t)){let r=h(t,"utf-8").trim();if(r)return r}}catch{}let n=g("sha256").update(`${v()}:${y()}`).digest("hex").slice(0,32);try{_(e,{recursive:!0}),R(t,n,{mode:384})}catch{}return n}o(l,"getDeviceId");async function U(e,t={},n){if(!u())try{await m("/api/telemetry/cli-events",{method:"POST",body:{event:e,deviceId:l(),cliVersion:n,os:p(),props:t},timeoutMs:5e3})}catch{}}o(U,"emitSetupEvent");async function w(e){if(u())return;let n=`${process.env.RULEMETRIC_API_URL??c().apiUrl??d}/api/telemetry/cli-error`,r=process.env.HTTPS_PROXY,s=process.env.HTTP_PROXY,T=r!==void 0||s!==void 0;delete process.env.HTTPS_PROXY,delete process.env.HTTP_PROXY;let i=new AbortController,f=setTimeout(()=>i.abort(),4e3);try{await globalThis.fetch(n,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":`rulemetric-cli/${e.cliVersion??"unknown"}`},body:JSON.stringify({event:e.event??"onboarding_error",deviceId:l(),command:e.command,statusCode:e.statusCode,message:e.message?e.message.slice(0,500):void 0,cliVersion:e.cliVersion,os:p(),nodeVersion:process.version,proxied:T,props:e.props}),signal:i.signal})}catch{}finally{clearTimeout(f),r!==void 0&&(process.env.HTTPS_PROXY=r),s!==void 0&&(process.env.HTTP_PROXY=s)}}o(w,"emitErrorBeacon");export{u as a,l as b,U as c,w as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./chunk-
|
|
1
|
+
import{a as E}from"./chunk-WTMJSL7R.js";import{b as R,c as x}from"./chunk-KGURGIZ2.js";import{f as F}from"./chunk-UGACB66X.js";import{a as s}from"./chunk-ZLLER3HP.js";var A="with_candidate",$="with_prior_version";function k(n){let t=n.filter(e=>e.configuration===A),r=[];for(let e of t){let u=n.find(o=>o.configuration===$&&o.evalId===e.evalId&&o.runNumber===e.runNumber);if(!u)continue;let l=h(e),f=h(u);l==null||f==null||r.push({withScore:l,withoutScore:f})}return r}s(k,"pairCandidateRuns");function h(n){return n.status!=="completed"?null:n.grading?.summary?.pass_rate??null}s(h,"evidenceOf");function P(n){let t=[],r=0;for(let e of n){if(e.status==="failed"){t.push(e.failure??{kind:"unknown",class:"infrastructure"});continue}h(e)==null&&(r+=1)}return{infrastructureFailed:t.length,ungradeable:r,summary:R(t)}}s(P,"accountForFailures");function Q(n){let{pairs:t,minPairs:r,accounting:e}=n;return t>=r?{kind:"proceed"}:e.infrastructureFailed<=0?{kind:"proceed"}:{kind:"infrastructure-incomplete",reason:`${t}/${r} pair(s) \u2014 ${e.infrastructureFailed} run(s) never executed (${e.summary.describe()}). Retry when the environment recovers; this is not a statement about the target.`}}s(Q,"attributeShortfall");function w(n,t,r,e){let u=[];for(let l of n)u.push({eval_:l,configuration:A,targetContent:t,runNumber:e}),u.push({eval_:l,configuration:$,targetContent:r,runNumber:e});return u}s(w,"buildCandidateQueue");async function N(n){let{cases:t,candidateContent:r,priorVersionContent:e,concurrency:u,runNumber:l,opts:f,onLog:o=s(()=>{},"onLog")}=n,p=w(t,r,e,l),i=[],b=Math.max(1,u),g=null;for(let a=0;a<p.length;a+=b){let d=p.slice(a,a+b);i.push(...await Promise.all(d.map(c=>E(c,f,o))));let y=i.find(c=>c.failure&&x(c.failure.kind));if(y?.failure){g=y.failure.kind;let c=p.length-i.length;o(` \u26D4 aborting batch \u2014 ${g}: the account is out of quota. Skipped ${c} remaining run(s) that would certainly have failed.`);break}}for(let a of i)try{await F("/api/eval-runs",a)}catch(d){o(` \u26A0 failed to post a run result: ${d instanceof Error?d.message:String(d)}`)}let C=k(i),m=P(i),v=t.length-C.length;if(v>0){let a=m.infrastructureFailed?` \u2014 ${m.infrastructureFailed} run(s) never executed (${m.summary.describe()})`:"";o(` \u26A0 ${v}/${t.length} case(s) produced no usable pair (failed or ungradeable arm)${a}`)}return{completed:i.filter(a=>a.status==="completed").length,failed:i.filter(a=>a.status==="failed").length,results:i,pairs:C,accounting:m,abortedForQuota:g}}s(N,"runCandidateBatchAndPost");export{A as a,$ as b,k as c,P as d,Q as e,w as f,N as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,c as d}from"./chunk-
|
|
1
|
+
import{b as u,c as d}from"./chunk-BXFDEQCX.js";import{b as g}from"./chunk-KJRMGTAO.js";import{e as m,f as p,h as l}from"./chunk-UGACB66X.js";import{a as s}from"./chunk-ZLLER3HP.js";async function x(f,R){let r=s(e=>R?.logger?.info?.(e)??console.log(e),"log"),{evalTargetId:n}=f,i=`[cron_refine_cases] ${n}`,t=await m(`/api/eval-targets/${n}`);if(!(t.metadata?.autoRefineCases===!0))return r(`${i} not opted in (metadata.autoRefineCases)`),{skipped:"not-opted-in",reason:`"${t.name}" has not opted into automatic case refinement. Set metadata.autoRefineCases=true to let the loop cull cases that carry no treatment signal, or run \`rulemetric evals refine-cases ${n}\` by hand.`,targetName:t.name};let C=await m(`/api/eval-targets/${n}/judge-calibration`),a=u(C.caseDiscrimination);if(a.refused)return r(`${i} ${a.refused}: ${a.summary}`),{skipped:a.refused,reason:a.summary,targetName:t.name};r(`${i} ${a.summary}`);let o=await d(a,{generate:s(e=>g({content:t.content,name:t.name,feedback:e}),"generate"),createCase:s(e=>p(`/api/eval-targets/${n}/evals`,{name:e.name,prompt:e.prompt,expectations:e.expectations}),"createCase"),retireCase:s(async(e,y)=>{await l(`/api/eval-targets/${n}/evals/${e}`,{retire:!0,retiredReason:y})},"retireCase"),log:r});r(`${i} ${o.summary}`);let{skipped:c,...$}=o;return{...$,targetName:t.name,...c?{skipped:c,reason:o.summary}:{}}}s(x,"cronRefineCases");export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as $}from"./chunk-
|
|
1
|
+
import{d as $}from"./chunk-YXNAGHHQ.js";import{e as b}from"./chunk-UGACB66X.js";import{a as g}from"./chunk-ZLLER3HP.js";import{existsSync as k,statSync as A}from"node:fs";async function v(y,h){let s=g(n=>h?.logger?.info?.(n)??console.log(n),"log"),{projectPath:o}=y,r=`[cron_auto_accept_suggestions] ${o}`;if(!o)return{skipped:"no-project-path"};if(!k(o)||!A(o).isDirectory())return s(`${r}: project directory no longer exists on this machine \u2014 skipping`),{skipped:"project-path-missing"};let e=await b(`/api/instruction-suggestions/auto-acceptable?projectPath=${encodeURIComponent(o)}`);if(!e.consent.allowed)return s(`${r}: ${e.consent.reason??"no consent"} (${e.consent.source})`),{skipped:"no-consent",reason:e.consent.reason};for(let n of e.refused)s(`${r}: refused "${n.name}" \u2014 ${n.reason}`);if(e.eligible.length===0)return s(`${r}: nothing to adopt`+(e.budget?` (rules ${e.budget.used}/${e.budget.max}`+(e.budget.skillsUsed!==void 0?`, skills ${e.budget.skillsUsed}`+(e.budget.skillsMax==null?" (uncapped)":`/${e.budget.skillsMax}`):"")+` used in ${e.budget.windowDays}d)`:"")),{skipped:"nothing-eligible",refused:e.refused.length,adopted:0};let i=0,f=0,a=0,l=0,d=0,u=0,c=0,m=[];for(let n of e.eligible)try{let t=await $({suggestionId:n.id,dir:o,projectPath:o,actor:"auto"});if(t.action==="added")i+=1,m.push(t.name),n.type==="skill"&&(f+=1),s(`${r}: adopted ${n.type==="skill"?"skill":"rule"} "${t.name}" (score ${n.score.toFixed(2)})`);else if(t.action==="redundant"){t.partialOverlap?d+=1:l+=1;for(let p of t.messages)s(`${r}: ${p}`)}else if(t.action==="unresolvable-reference"){u+=1;for(let p of t.messages)s(`${r}: ${p}`)}else a+=1,s(`${r}: "${t.name}" was already in CLAUDE.md`)}catch(t){c+=1,s(`${r}: failed to adopt "${n.name}" \u2014 ${t instanceof Error?t.message:String(t)}`)}return s(`${r}: ${i} adopted, ${a} already present, ${l} already covered in other words, ${d} refused for partial overlap, ${u} refused for naming files this project does not have, ${c} failed, ${e.refused.length} refused upstream. Undo any of them with \`rulemetric suggestions undo <instruction-id>\`.`),{adopted:i,skills:f,alreadyPresent:a,redundant:l,partialOverlaps:d,unresolvableReferences:u,failed:c,refused:e.refused.length,names:m}}g(v,"cronAutoAcceptSuggestions");export{v as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./chunk-RBSEE2Z6.js";import{a as R}from"./chunk-M7QSC64D.js";import{b}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-RBSEE2Z6.js";import{a as R}from"./chunk-M7QSC64D.js";import{b}from"./chunk-WTMJSL7R.js";import{e as u}from"./chunk-UGACB66X.js";import{a as d}from"./chunk-ZLLER3HP.js";var k=6e5;async function T(a,w){let i=d(e=>w?.logger?.info?.(e)??console.log(e),"log"),{evalTargetId:n}=a,l=await u(`/api/eval-targets/${n}/judge-calibration`),o=v({powered:l.powerCheck.powered,mde:l.powerCheck.mde??Number.POSITIVE_INFINITY},l.caseDiscrimination??{total:0,discriminating:0,nonDiscriminating:0,unpaired:0},{runsCompleted:0,maxRuns:a.maxRuns??24,batchesRun:0,maxBatches:1});if(o.action==="stop")return i(`[cron_eval_autorun] ${n}: ${o.reason}`),{skipped:o.code,reason:o.reason};let r=await u(`/api/eval-targets/${n}`),c=R(r);if(c)return i(`[cron_eval_autorun] ${n}: ${c.reason}`),c;let p=(await u(`/api/eval-targets/${n}/evals`)).filter(e=>!e.retiredAt);if(p.length===0)return{skipped:"no-live-cases"};let{completed:g,failed:f,results:$}=await b({cases:p,targetContent:r.content,concurrency:2,runNumber:1,opts:{targetId:n,targetVersion:r.version??1,iteration:1,timeout:a.timeout??k,model:a.model,graderModel:a.graderModel,skipGrading:!1,targetType:r.type,targetName:r.name},onLog:i}),m={};for(let e of $){if(e.status!=="failed")continue;let t=e.failure?.kind??"unknown";m[t]=(m[t]??0)+1}let s=Object.entries(m).sort(([,e],[,t])=>t-e).map(([e,t])=>`${e}x${t}`).join(", ");return i(`[cron_eval_autorun] ${r.name}: ${g} completed, ${f} failed`+(s===""?"":` (${s})`)),{ranRuns:g,failedRuns:f,...s===""?{}:{failures:s},reason:o.reason}}d(T,"cronEvalAutorun");export{T as a};
|