@rulemetric/cli 0.12.6 → 0.12.7
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/chunk-EVD5A3VI.js +1 -0
- package/dist/commands/evals/agent.js +1 -1
- package/dist/lib/agent-loop.js +1 -1
- package/oclif.manifest.json +326 -326
- package/package.json +6 -6
- package/dist/chunk-ONRQDI3N.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as X}from"./chunk-2KJAM2NG.js";import{b as Y}from"./chunk-IEQDLURA.js";import{d as z,e as Z}from"./chunk-UUFCTEBT.js";import{a as V}from"./chunk-ZYGBABMZ.js";import{a as $}from"./chunk-5OX6YKTR.js";import{a as C}from"./chunk-MJ5H7RDK.js";import{a as L}from"./chunk-W67DO5PT.js";import{a as N}from"./chunk-WO6MS654.js";import{a as F}from"./chunk-UTAETY5Z.js";import{b as x}from"./chunk-E4RGYYBC.js";import{a as B}from"./chunk-O65AQZYB.js";import{a as O}from"./chunk-ARC4Q3GL.js";import{b as D}from"./chunk-5RBLIVBF.js";import{a as G}from"./chunk-GRPUY2EZ.js";import{a as P}from"./chunk-UXB6DRR7.js";import{a as q}from"./chunk-INSKP5ED.js";import{a as J}from"./chunk-UA5GEVGW.js";import{a as R}from"./chunk-PZS55PW2.js";import{a as Q}from"./chunk-AKXGUQ5B.js";import{e as H}from"./chunk-Z4YVOVMM.js";import{b as W}from"./chunk-NKJTNGXR.js";import{a as K}from"./chunk-C6GLNE6X.js";import{a as U}from"./chunk-S2SKT5PV.js";import{l as M}from"./chunk-FUYR7CFD.js";import{d as T}from"./chunk-NF2BIEAF.js";import{b as S,e as A,f as k}from"./chunk-UGACB66X.js";import{a as s}from"./chunk-ZLLER3HP.js";var y=null,b=null,oe={process_eval:L,process_insights:N,process_launch:x,process_send_message:V,process_conversation:C,process_session_goal:$,distill_memories:W,memory_ab:B,process_run_cleanup:O,cron_refine_cases:q,cron_retire_unused_skills:Q,cron_reconcile_attribution:P,cron_suggest_instructions:H,cron_refresh_skills:R,cron_refresh_pricing:J,cron_eval_autorun:U,cron_auto_accept_suggestions:K,cron_instruction_training:G,cron_instruction_evolution:M,process_judge_review:F},j=Object.keys(oe),ae=new Set([]);function ie(e=process.env){return e.DATABASE_URL?j:j.filter(n=>!ae.has(n))}s(ie,"availableCapabilities");var le=3e4,ce=3e4,de=3e4,ee=500,ne=1e4,ue=`thin-agent-${process.pid}`,E=null;function me(e,n,r,c){let i;try{let l=T();i={claude:l.claudeBin!=null,codex:l.codexBin!=null,codexModel:l.codexConfiguredModel}}catch{}let g=s(l=>k("/api/workers/heartbeat",{workerType:"cli-worker",clientName:ue,clientVersion:c,workerVersion:"0.1.0",currentJobId:null,inFlightCount:0,lastError:null,status:l,metadata:{capabilities:e,mode:"thin-agent",llmEngines:i,machine:y?.summary()}}).then(u=>{let d=u?.advisory;d&&d.message!==E?(E=d.message,a(r,{event:"worker_advisory",code:d.code,message:d.message})):d||(E=null)}).catch(u=>{a(r,{event:"presence_heartbeat_error",error:u instanceof Error?u.message:String(u)})}),"send");g("alive");let f=setInterval(()=>g("alive"),de),o=null,m=s(()=>o||(clearInterval(f),o=Promise.race([g("shutting_down"),new Promise(l=>setTimeout(l,2e3).unref())]),o),"sayGoodbye");return n.addEventListener("abort",()=>{m()},{once:!0}),{shutdown:m}}s(me,"startPresenceHeartbeat");function a(e,n){try{e(JSON.stringify({ts:new Date().toISOString(),...n}))}catch{e(`[agent-loop] log_error event=${n.event}`)}}s(a,"structuredLog");function re(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=s(()=>{clearTimeout(c),n.removeEventListener("abort",i),r(!1)},"onAbort");n.addEventListener("abort",i,{once:!0})})}s(re,"abortableSleep");async function ge(e,n){let r=`capabilities=${encodeURIComponent(e.join(","))}&waitMs=${n}`,c=await A(`/api/work/next?${r}`);return c==null||typeof c=="string"?null:c}s(ge,"pollForWork");function pe(e,n){return{logger:{info:s(r=>n(r),"info"),warn:s(r=>n(r),"warn"),error:s(r=>n(r),"error")},job:{attempts:e}}}s(pe,"makeHelpers");async function _e(e,n,r){let c=oe[e.kind],i=Date.now();if(a(r,{event:"claim",jobId:e.id,kind:e.kind,attempts:e.attempts}),!c){let o=`unknown kind: ${e.kind}`;a(r,{event:"fail",jobId:e.id,kind:e.kind,terminal:!0,error:o}),await k(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:o,terminal:!0}).catch(()=>{});return}let g=s(()=>{a(r,{event:"heartbeat",jobId:e.id}),k(`/api/work/${e.id}/heartbeat`,{leaseToken:e.leaseToken}).catch(o=>{a(r,{event:"heartbeat_error",jobId:e.id,error:o instanceof Error?o.message:String(o)})})},"beat"),f=setInterval(g,n);b={jobId:e.id,beat:g};try{let o=pe(e.attempts,r),m=await c(e.payload,o)??{};clearInterval(f),a(r,{event:"complete",jobId:e.id,kind:e.kind,durationMs:Date.now()-i}),await k(`/api/work/${e.id}/complete`,{leaseToken:e.leaseToken,result:m})}catch(o){clearInterval(f);let m=D(o),l=Z(y?.pausesSince(i)??[]),u=o instanceof Error?o.message:String(o),d=l?`${l}; ${u}`:u;a(r,{event:"fail",jobId:e.id,kind:e.kind,durationMs:Date.now()-i,terminal:m,error:d,...l?{pausedDuringJob:!0}:{}}),await k(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:d,terminal:m}).catch(p=>{a(r,{event:"fail_post_error",jobId:e.id,error:p instanceof Error?p.message:String(p)})})}finally{b=null}}s(_e,"runOne");var te=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 Je(e){let n=e.log??(()=>{}),r=e.pollWaitMs??le,c=e.heartbeatIntervalMs??ce,i=e.capabilities??ie();a(n,{event:"agent_start",capabilities:i,pollWaitMs:r,heartbeatIntervalMs:c});try{let t=Y();t.removed.length>0&&a(n,{event:"eval_worktrees_swept",removed:t.removed.length})}catch(t){a(n,{event:"eval_worktree_sweep_failed",error:t instanceof Error?t.message:String(t)})}y=z({signal:e.signal,onPause:s(t=>{a(n,{event:"machine_pause",...t,jobId:b?.jobId??null}),b?.beat()},"onPause")});let g=me(i,e.signal,n,e.version);X({signal:e.signal,log:n}).catch(t=>{a(n,{event:"tt_heartbeat_fatal",error:t instanceof Error?t.message:String(t)})});let f=5*6e4,o=0,m=s(()=>{if(!e.readInstalledVersion||!e.version)return!1;let t=Date.now();if(t-o<f)return!1;o=t;let w=e.readInstalledVersion();return!!(w&&w!==e.version)},"versionDrifted"),l=new AbortController,u=l.signal;e.signal.aborted?l.abort():e.signal.addEventListener("abort",()=>l.abort(),{once:!0});let d=s(async(t,w)=>{let _=ee;for(;!u.aborted;){if(m()){a(n,{event:"agent_version_drift",bootVersion:e.version,installedVersion:e.readInstalledVersion?.()??null}),l.abort(),e.onVersionDrift?.();break}let I=null;try{I=await ge([...w],r)}catch(v){let se=v instanceof S?v.statusCode:void 0;if(a(n,{event:"poll_error",lane:t,status:se,error:v instanceof Error?v.message:String(v)}),!await re(_,u))break;_=Math.min(_*2,ne);continue}if(!I){if(a(n,{event:"poll_204",lane:t}),!await re(_,u))break;_=Math.min(_*2,ne);continue}_=ee,await _e(I,c,n)}},"runLane"),p=i.filter(t=>te.has(t)),h=i.filter(t=>!te.has(t));p.length>0&&h.length>0?(a(n,{event:"agent_lanes",heavy:p.length,fast:h.length}),await Promise.all([d("heavy",p),d("fast",h)])):await d("single",i),await g.shutdown(),a(n,{event:"agent_stop"})}s(Je,"runAgentLoop");export{oe as a,j as b,ie as c,ge as d,Je as e};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as C,b as L,c as D}from"../../chunk-GWDZNGUP.js";import{c as d}from"../../chunk-LUCVMLHV.js";import{e as I}from"../../chunk-
|
|
1
|
+
import{a as C,b as L,c as D}from"../../chunk-GWDZNGUP.js";import{c as d}from"../../chunk-LUCVMLHV.js";import{e as I}from"../../chunk-EVD5A3VI.js";import"../../chunk-2KJAM2NG.js";import"../../chunk-IEQDLURA.js";import"../../chunk-UUFCTEBT.js";import"../../chunk-ZYGBABMZ.js";import"../../chunk-5OX6YKTR.js";import"../../chunk-MJ5H7RDK.js";import"../../chunk-W67DO5PT.js";import"../../chunk-WO6MS654.js";import"../../chunk-UTAETY5Z.js";import"../../chunk-E4RGYYBC.js";import"../../chunk-O65AQZYB.js";import"../../chunk-ARC4Q3GL.js";import"../../chunk-RFISMWRW.js";import"../../chunk-5RBLIVBF.js";import"../../chunk-GRPUY2EZ.js";import"../../chunk-UXB6DRR7.js";import"../../chunk-INSKP5ED.js";import"../../chunk-UA5GEVGW.js";import"../../chunk-PZS55PW2.js";import"../../chunk-AKXGUQ5B.js";import"../../chunk-3ZHVP3KE.js";import"../../chunk-Z4YVOVMM.js";import"../../chunk-HOQPVOMF.js";import"../../chunk-NKJTNGXR.js";import"../../chunk-C6GLNE6X.js";import"../../chunk-S2SKT5PV.js";import"../../chunk-HQCPGDQE.js";import"../../chunk-3UKZJAFS.js";import"../../chunk-FE2UWAIP.js";import"../../chunk-SJKS3PYX.js";import"../../chunk-XFAFMYIP.js";import"../../chunk-5PM4E27L.js";import"../../chunk-GIRPEMTW.js";import"../../chunk-SIGZEQ3K.js";import"../../chunk-RLEMDKQ4.js";import"../../chunk-PVPYLKB3.js";import"../../chunk-22ZDUL6H.js";import"../../chunk-CPDMJGTC.js";import"../../chunk-E7XOYGL5.js";import"../../chunk-WCIX5KWG.js";import"../../chunk-LJRE3LZ2.js";import"../../chunk-UKOI2Q4J.js";import"../../chunk-5N5S3NKS.js";import"../../chunk-KJRMGTAO.js";import"../../chunk-MILLBGCB.js";import"../../chunk-6UEFCMR2.js";import"../../chunk-MODXEGCU.js";import"../../chunk-RBSEE2Z6.js";import"../../chunk-AFYZYXQ3.js";import"../../chunk-FUYR7CFD.js";import"../../chunk-M7QSC64D.js";import"../../chunk-DPCAPIQB.js";import"../../chunk-G7V4ZZZ3.js";import"../../chunk-W23MESHM.js";import"../../chunk-LB24UKHZ.js";import"../../chunk-PWTTCSQA.js";import"../../chunk-NF2BIEAF.js";import"../../chunk-OZQNSELV.js";import"../../chunk-HFGO5762.js";import"../../chunk-VS5ROGDP.js";import"../../chunk-WTMJSL7R.js";import"../../chunk-GN3ZHQ46.js";import"../../chunk-U2NT5OSQ.js";import"../../chunk-KGURGIZ2.js";import"../../chunk-UPFH72PF.js";import"../../chunk-BJSVATVJ.js";import"../../chunk-CDY7TQFZ.js";import"../../chunk-RIVEBBZC.js";import"../../chunk-QBNLZJIR.js";import"../../chunk-N7ODX6PO.js";import"../../chunk-PJ3WHQ67.js";import"../../chunk-VBXL7XO7.js";import"../../chunk-TZA4HAVF.js";import{b as k,f as h,h as A}from"../../chunk-QXPYGN7I.js";import{a as O}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{f as b}from"../../chunk-UGACB66X.js";import"../../chunk-WMIUFMDI.js";import{e as P,l as f}from"../../chunk-PZNWH4VQ.js";import{a as e}from"../../chunk-ZLLER3HP.js";import{trace as se,context as ie}from"@opentelemetry/api";import{NodeSDK as j}from"@opentelemetry/sdk-node";import{OTLPTraceExporter as q}from"@opentelemetry/exporter-trace-otlp-http";import{BatchSpanProcessor as F,ConsoleSpanExporter as U,SimpleSpanProcessor as X}from"@opentelemetry/sdk-trace-node";import{Resource as B}from"@opentelemetry/resources";import{ATTR_SERVICE_NAME as H,ATTR_SERVICE_VERSION as K}from"@opentelemetry/semantic-conventions";function $(t){if(!t)return{};let r={};for(let n of t.split(",")){let s=n.indexOf("=");if(s===-1)continue;let i=n.slice(0,s).trim(),a=n.slice(s+1).trim();i&&(r[i]=a)}return r}e($,"parseOtlpHeaders");var p=null;function y(){return process.env.TELEMETRY_ENABLED!=="false"}e(y,"isTelemetryEnabled");function S(t){if(!y()||p!==null)return"off";let r=new B({[H]:t.serviceName,[K]:t.serviceVersion??"0.1.0"}),n=process.env.OTEL_EXPORTER_OTLP_ENDPOINT,s,i;if(n){let a=$(process.env.OTEL_EXPORTER_OTLP_HEADERS),l=new q({url:`${n}/v1/traces`,headers:a});i=new F(l),s="otlp"}else if(process.env.OTEL_SPAN_EXPORT==="none")i=void 0,s="silent";else{let a=new U;i=new X(a),s="console"}return p=new j({resource:r,spanProcessors:i?[i]:[]}),p.start(),s}e(S,"initTelemetry");async function m(){p&&(await p.shutdown(),p=null)}e(m,"shutdownTelemetry");import{SpanKind as he,SpanStatusCode as ye}from"@opentelemetry/api";import{trace as ve,context as we}from"@opentelemetry/api";import*as u from"@sentry/node";var E=!1;function T(t){if(E)return!1;let r=process.env.SENTRY_DSN;return r?(u.init({dsn:r,serverName:t.serviceName,environment:process.env.NODE_ENV??"development",tracesSampleRate:0}),E=!0,!0):!1}e(T,"initSentry");async function g(t){E&&await u.flush(t)}e(g,"flushSentry");import{existsSync as J,mkdirSync as W,readFileSync as R,unlinkSync as V,writeFileSync as M}from"node:fs";import{dirname as z,join as v}from"node:path";import{execFileSync as Q}from"node:child_process";var c=v(f(),"evals-agent.lock");function Z(t){try{return process.kill(t,0),!0}catch(r){return r.code==="EPERM"}}e(Z,"pidAlive");function ee(t){if(!Z(t))return!1;try{let r=Q("ps",["-p",String(t),"-o","command="],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]});return/run\.js\s+evals\s+agent|evals\s+agent/.test(r)}catch{return!0}}e(ee,"isLiveAgent");function te(){try{W(z(c),{recursive:!0})}catch{}for(let t=0;t<2;t++)try{return M(c,String(process.pid),{flag:"wx"}),{ok:!0}}catch(r){if(r.code!=="EEXIST")throw r;let n=0;try{n=Number(R(c,"utf-8").trim())}catch{}if(n&&n!==process.pid&&ee(n))return{ok:!1,holder:n};try{V(c)}catch{}}try{M(c,String(process.pid))}catch{}return{ok:!0}}e(te,"acquireAgentLock");function x(){try{J(c)&&Number(R(c,"utf-8").trim())===process.pid&&V(c)}catch{}}e(x,"releaseAgentLock");var w=class t extends O{static{e(this,"EvalAgentCommand")}static description="The worker daemon: long-polls /api/work/next, claims jobs, and runs them locally. Installed as a launchd service by `rulemetric service install`.";static examples=["<%= config.bin %> evals agent"];async run(){await this.parse(t),this.requireAuth();let r=te();if(!r.ok){this.log(`Another rulemetric evals agent is already running (pid ${r.holder}). Refusing to start a second instance.`);return}process.env.PG_APPLICATION_NAME||="rulemetric-agent",T({serviceName:"rulemetric-agent"})&&this.log("[sentry] error capture enabled");let s=S({serviceName:"rulemetric-agent"});s==="otlp"?this.log(`[otel] traces exporting to ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}`):s==="console"?this.log("[otel] cron spans printing to stdout (set OTEL_EXPORTER_OTLP_ENDPOINT to ship to a backend)"):this.log("[otel] disabled (TELEMETRY_ENABLED=false)"),!P()&&!process.env.RULEMETRIC_API_KEY&&this.error("No auth token found. Run `rulemetric auth login` first."),this.log("Starting thin agent (Phase 4b parallel-run)..."),this.log(`Long-polling /api/work/next. Press Ctrl+C to stop.
|
|
2
2
|
`);let a=new AbortController,l=await k({configDir:f()});if(this.log(`[transcript-sync] Codex capture: ${h(l)}`),l.error)this.log(`[transcript-sync] WARNING: ${l.error}`);else if(l.mode==="allowlist")for(let o of l.roots)this.log(`[transcript-sync] \u2022 ${o}`);let G=new C({providers:[L(void 0,void 0,A({configDir:f(),onChange:e(o=>this.log(`[transcript-sync] Codex capture changed: ${h(o)}`),"onChange")}))],statePath:v(f(),"transcript-sync-state.json"),importTranscript:e(o=>b("/api/sessions/import",o),"importTranscript"),log:e(o=>this.log(`[transcript-sync] ${o}`),"log")});D(G,{signal:a.signal,log:e(o=>this.log(`[transcript-sync] ${o}`),"log")});let N=e(async o=>{this.log(`
|
|
3
3
|
[${o}] shutting down agent...`),a.abort(),await Promise.allSettled([g(2e3),m(),d()]),x(),process.exit(0)},"shutdown");process.on("SIGINT",()=>{N("SIGINT")}),process.on("SIGTERM",()=>{N("SIGTERM")});let _=!1;try{await I({signal:a.signal,log:e(o=>this.log(o),"log"),version:this.config.version,readInstalledVersion:e(()=>{try{return JSON.parse(R(v(this.config.root,"package.json"),"utf-8")).version??null}catch{return null}},"readInstalledVersion"),onVersionDrift:e(()=>{_=!0},"onVersionDrift")}),_&&(this.log("[upgrade] Installed CLI version changed \u2014 restarting worker onto the new code."),await Promise.allSettled([g(2e3),m(),d()]),x(),process.exit(1))}finally{x(),await d()}}};export{w as default};
|
package/dist/lib/agent-loop.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-EVD5A3VI.js";import"../chunk-2KJAM2NG.js";import"../chunk-IEQDLURA.js";import"../chunk-UUFCTEBT.js";import"../chunk-ZYGBABMZ.js";import"../chunk-5OX6YKTR.js";import"../chunk-MJ5H7RDK.js";import"../chunk-W67DO5PT.js";import"../chunk-WO6MS654.js";import"../chunk-UTAETY5Z.js";import"../chunk-E4RGYYBC.js";import"../chunk-O65AQZYB.js";import"../chunk-ARC4Q3GL.js";import"../chunk-RFISMWRW.js";import"../chunk-5RBLIVBF.js";import"../chunk-GRPUY2EZ.js";import"../chunk-UXB6DRR7.js";import"../chunk-INSKP5ED.js";import"../chunk-UA5GEVGW.js";import"../chunk-PZS55PW2.js";import"../chunk-AKXGUQ5B.js";import"../chunk-3ZHVP3KE.js";import"../chunk-Z4YVOVMM.js";import"../chunk-HOQPVOMF.js";import"../chunk-NKJTNGXR.js";import"../chunk-C6GLNE6X.js";import"../chunk-S2SKT5PV.js";import"../chunk-HQCPGDQE.js";import"../chunk-3UKZJAFS.js";import"../chunk-FE2UWAIP.js";import"../chunk-SJKS3PYX.js";import"../chunk-XFAFMYIP.js";import"../chunk-5PM4E27L.js";import"../chunk-GIRPEMTW.js";import"../chunk-SIGZEQ3K.js";import"../chunk-RLEMDKQ4.js";import"../chunk-PVPYLKB3.js";import"../chunk-22ZDUL6H.js";import"../chunk-CPDMJGTC.js";import"../chunk-E7XOYGL5.js";import"../chunk-WCIX5KWG.js";import"../chunk-LJRE3LZ2.js";import"../chunk-UKOI2Q4J.js";import"../chunk-5N5S3NKS.js";import"../chunk-KJRMGTAO.js";import"../chunk-MILLBGCB.js";import"../chunk-6UEFCMR2.js";import"../chunk-MODXEGCU.js";import"../chunk-RBSEE2Z6.js";import"../chunk-AFYZYXQ3.js";import"../chunk-FUYR7CFD.js";import"../chunk-M7QSC64D.js";import"../chunk-DPCAPIQB.js";import"../chunk-G7V4ZZZ3.js";import"../chunk-W23MESHM.js";import"../chunk-LB24UKHZ.js";import"../chunk-PWTTCSQA.js";import"../chunk-NF2BIEAF.js";import"../chunk-OZQNSELV.js";import"../chunk-HFGO5762.js";import"../chunk-VS5ROGDP.js";import"../chunk-WTMJSL7R.js";import"../chunk-GN3ZHQ46.js";import"../chunk-U2NT5OSQ.js";import"../chunk-KGURGIZ2.js";import"../chunk-UPFH72PF.js";import"../chunk-BJSVATVJ.js";import"../chunk-CDY7TQFZ.js";import"../chunk-RIVEBBZC.js";import"../chunk-QBNLZJIR.js";import"../chunk-N7ODX6PO.js";import"../chunk-PJ3WHQ67.js";import"../chunk-VBXL7XO7.js";import"../chunk-TZA4HAVF.js";import"../chunk-UGACB66X.js";import"../chunk-WMIUFMDI.js";import"../chunk-PZNWH4VQ.js";import"../chunk-ZLLER3HP.js";export{b as CAPABILITIES,a as HANDLERS,c as availableCapabilities,d as pollForWork,e as runAgentLoop};
|
package/oclif.manifest.json
CHANGED
|
@@ -284,13 +284,18 @@
|
|
|
284
284
|
"backfill.js"
|
|
285
285
|
]
|
|
286
286
|
},
|
|
287
|
-
"
|
|
287
|
+
"capture:scope": {
|
|
288
288
|
"aliases": [],
|
|
289
289
|
"args": {},
|
|
290
|
-
"description": "
|
|
290
|
+
"description": "Show or set which projects RuleMetric captures — the Codex sweep and hook-driven sessions each have their own scope",
|
|
291
291
|
"examples": [
|
|
292
|
-
"<%= config.bin %>
|
|
293
|
-
"<%= config.bin %>
|
|
292
|
+
"<%= config.bin %> <%= command.id %>",
|
|
293
|
+
"<%= config.bin %> <%= command.id %> --add ~/work/client-a --add ~/work/client-b",
|
|
294
|
+
"<%= config.bin %> <%= command.id %> --tool hooks --add ~/work/client-a",
|
|
295
|
+
"<%= config.bin %> <%= command.id %> --tool hooks --off",
|
|
296
|
+
"<%= config.bin %> <%= command.id %> --remove ~/work/client-a",
|
|
297
|
+
"<%= config.bin %> <%= command.id %> --off",
|
|
298
|
+
"<%= config.bin %> <%= command.id %> --all"
|
|
294
299
|
],
|
|
295
300
|
"flags": {
|
|
296
301
|
"api-url": {
|
|
@@ -302,26 +307,60 @@
|
|
|
302
307
|
"multiple": false,
|
|
303
308
|
"type": "option"
|
|
304
309
|
},
|
|
305
|
-
"
|
|
306
|
-
"
|
|
307
|
-
"
|
|
308
|
-
"
|
|
309
|
-
"required": true,
|
|
310
|
+
"tool": {
|
|
311
|
+
"description": "Which capture path to edit: \"codex\" (the worker transcript sweep, the default) or \"hooks\" (Claude Code / Cursor / Copilot / Antigravity hook sessions).",
|
|
312
|
+
"name": "tool",
|
|
313
|
+
"default": "codex",
|
|
310
314
|
"hasDynamicHelp": false,
|
|
311
315
|
"multiple": false,
|
|
316
|
+
"options": [
|
|
317
|
+
"codex",
|
|
318
|
+
"hooks"
|
|
319
|
+
],
|
|
312
320
|
"type": "option"
|
|
313
321
|
},
|
|
314
|
-
"
|
|
315
|
-
"
|
|
316
|
-
"
|
|
317
|
-
"
|
|
318
|
-
"
|
|
322
|
+
"add": {
|
|
323
|
+
"description": "Capture sessions under this path (repeatable). Implies an allowlist.",
|
|
324
|
+
"name": "add",
|
|
325
|
+
"hasDynamicHelp": false,
|
|
326
|
+
"multiple": true,
|
|
327
|
+
"type": "option"
|
|
328
|
+
},
|
|
329
|
+
"remove": {
|
|
330
|
+
"description": "Stop capturing under this path (repeatable).",
|
|
331
|
+
"name": "remove",
|
|
332
|
+
"hasDynamicHelp": false,
|
|
333
|
+
"multiple": true,
|
|
334
|
+
"type": "option"
|
|
335
|
+
},
|
|
336
|
+
"off": {
|
|
337
|
+
"description": "Turn this capture path off entirely.",
|
|
338
|
+
"exclusive": [
|
|
339
|
+
"all"
|
|
340
|
+
],
|
|
341
|
+
"name": "off",
|
|
342
|
+
"allowNo": false,
|
|
343
|
+
"type": "boolean"
|
|
344
|
+
},
|
|
345
|
+
"all": {
|
|
346
|
+
"description": "Capture every project (the default).",
|
|
347
|
+
"exclusive": [
|
|
348
|
+
"off"
|
|
349
|
+
],
|
|
350
|
+
"name": "all",
|
|
351
|
+
"allowNo": false,
|
|
352
|
+
"type": "boolean"
|
|
353
|
+
},
|
|
354
|
+
"clear": {
|
|
355
|
+
"description": "Remove this scope, restoring the default.",
|
|
356
|
+
"name": "clear",
|
|
357
|
+
"allowNo": false,
|
|
319
358
|
"type": "boolean"
|
|
320
359
|
}
|
|
321
360
|
},
|
|
322
361
|
"hasDynamicHelp": false,
|
|
323
362
|
"hiddenAliases": [],
|
|
324
|
-
"id": "
|
|
363
|
+
"id": "capture:scope",
|
|
325
364
|
"pluginAlias": "@rulemetric/cli",
|
|
326
365
|
"pluginName": "@rulemetric/cli",
|
|
327
366
|
"pluginType": "core",
|
|
@@ -331,18 +370,14 @@
|
|
|
331
370
|
"relativePath": [
|
|
332
371
|
"dist",
|
|
333
372
|
"commands",
|
|
334
|
-
"
|
|
335
|
-
"
|
|
373
|
+
"capture",
|
|
374
|
+
"scope.js"
|
|
336
375
|
]
|
|
337
376
|
},
|
|
338
|
-
"
|
|
377
|
+
"catalog": {
|
|
339
378
|
"aliases": [],
|
|
340
379
|
"args": {},
|
|
341
|
-
"description": "
|
|
342
|
-
"examples": [
|
|
343
|
-
"<%= config.bin %> auth login",
|
|
344
|
-
"<%= config.bin %> auth login -e user@example.com"
|
|
345
|
-
],
|
|
380
|
+
"description": "Browse the org instruction catalog",
|
|
346
381
|
"flags": {
|
|
347
382
|
"api-url": {
|
|
348
383
|
"description": "Override API base URL",
|
|
@@ -353,62 +388,31 @@
|
|
|
353
388
|
"multiple": false,
|
|
354
389
|
"type": "option"
|
|
355
390
|
},
|
|
356
|
-
"
|
|
357
|
-
"
|
|
358
|
-
"
|
|
359
|
-
"name": "email",
|
|
391
|
+
"badge": {
|
|
392
|
+
"description": "Filter by badge",
|
|
393
|
+
"name": "badge",
|
|
360
394
|
"hasDynamicHelp": false,
|
|
361
395
|
"multiple": false,
|
|
396
|
+
"options": [
|
|
397
|
+
"recommended",
|
|
398
|
+
"required"
|
|
399
|
+
],
|
|
362
400
|
"type": "option"
|
|
363
401
|
},
|
|
364
|
-
"
|
|
365
|
-
"
|
|
366
|
-
"
|
|
367
|
-
"name": "password",
|
|
402
|
+
"scope": {
|
|
403
|
+
"description": "Filter by scope",
|
|
404
|
+
"name": "scope",
|
|
368
405
|
"hasDynamicHelp": false,
|
|
369
406
|
"multiple": false,
|
|
370
|
-
"
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
"description": "Authenticate with an API key from https://rulemetric.com/connect (required for Google/GitHub sign-ins, which have no password)",
|
|
374
|
-
"exclusive": [
|
|
375
|
-
"password"
|
|
407
|
+
"options": [
|
|
408
|
+
"org",
|
|
409
|
+
"team"
|
|
376
410
|
],
|
|
377
|
-
"name": "api-key",
|
|
378
|
-
"hasDynamicHelp": false,
|
|
379
|
-
"multiple": false,
|
|
380
411
|
"type": "option"
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
"id": "auth:login",
|
|
386
|
-
"pluginAlias": "@rulemetric/cli",
|
|
387
|
-
"pluginName": "@rulemetric/cli",
|
|
388
|
-
"pluginType": "core",
|
|
389
|
-
"strict": true,
|
|
390
|
-
"enableJsonFlag": false,
|
|
391
|
-
"isESM": true,
|
|
392
|
-
"relativePath": [
|
|
393
|
-
"dist",
|
|
394
|
-
"commands",
|
|
395
|
-
"auth",
|
|
396
|
-
"login.js"
|
|
397
|
-
]
|
|
398
|
-
},
|
|
399
|
-
"auth:logout": {
|
|
400
|
-
"aliases": [],
|
|
401
|
-
"args": {},
|
|
402
|
-
"description": "Log out of RuleMetric",
|
|
403
|
-
"examples": [
|
|
404
|
-
"<%= config.bin %> auth logout"
|
|
405
|
-
],
|
|
406
|
-
"flags": {
|
|
407
|
-
"api-url": {
|
|
408
|
-
"description": "Override API base URL",
|
|
409
|
-
"env": "RULEMETRIC_API_URL",
|
|
410
|
-
"hidden": true,
|
|
411
|
-
"name": "api-url",
|
|
412
|
+
},
|
|
413
|
+
"search": {
|
|
414
|
+
"description": "Search by name or description",
|
|
415
|
+
"name": "search",
|
|
412
416
|
"hasDynamicHelp": false,
|
|
413
417
|
"multiple": false,
|
|
414
418
|
"type": "option"
|
|
@@ -416,7 +420,7 @@
|
|
|
416
420
|
},
|
|
417
421
|
"hasDynamicHelp": false,
|
|
418
422
|
"hiddenAliases": [],
|
|
419
|
-
"id": "
|
|
423
|
+
"id": "catalog",
|
|
420
424
|
"pluginAlias": "@rulemetric/cli",
|
|
421
425
|
"pluginName": "@rulemetric/cli",
|
|
422
426
|
"pluginType": "core",
|
|
@@ -426,24 +430,20 @@
|
|
|
426
430
|
"relativePath": [
|
|
427
431
|
"dist",
|
|
428
432
|
"commands",
|
|
429
|
-
"
|
|
430
|
-
"
|
|
433
|
+
"catalog",
|
|
434
|
+
"index.js"
|
|
431
435
|
]
|
|
432
436
|
},
|
|
433
|
-
"
|
|
437
|
+
"catalog:recommend": {
|
|
434
438
|
"aliases": [],
|
|
435
439
|
"args": {
|
|
436
|
-
"
|
|
437
|
-
"description": "
|
|
438
|
-
"name": "
|
|
440
|
+
"projectId": {
|
|
441
|
+
"description": "ID of the project",
|
|
442
|
+
"name": "projectId",
|
|
443
|
+
"required": true
|
|
439
444
|
}
|
|
440
445
|
},
|
|
441
|
-
"description": "
|
|
442
|
-
"examples": [
|
|
443
|
-
"<%= config.bin %> auth revoke-key",
|
|
444
|
-
"<%= config.bin %> auth revoke-key rm_abc12345",
|
|
445
|
-
"<%= config.bin %> auth revoke-key \"my-laptop (auto)\""
|
|
446
|
-
],
|
|
446
|
+
"description": "Get AI-powered instruction recommendations for a project",
|
|
447
447
|
"flags": {
|
|
448
448
|
"api-url": {
|
|
449
449
|
"description": "Override API base URL",
|
|
@@ -457,7 +457,7 @@
|
|
|
457
457
|
},
|
|
458
458
|
"hasDynamicHelp": false,
|
|
459
459
|
"hiddenAliases": [],
|
|
460
|
-
"id": "
|
|
460
|
+
"id": "catalog:recommend",
|
|
461
461
|
"pluginAlias": "@rulemetric/cli",
|
|
462
462
|
"pluginName": "@rulemetric/cli",
|
|
463
463
|
"pluginType": "core",
|
|
@@ -467,17 +467,16 @@
|
|
|
467
467
|
"relativePath": [
|
|
468
468
|
"dist",
|
|
469
469
|
"commands",
|
|
470
|
-
"
|
|
471
|
-
"
|
|
470
|
+
"catalog",
|
|
471
|
+
"recommend.js"
|
|
472
472
|
]
|
|
473
473
|
},
|
|
474
|
-
"
|
|
474
|
+
"crons:list": {
|
|
475
475
|
"aliases": [],
|
|
476
476
|
"args": {},
|
|
477
|
-
"description": "
|
|
477
|
+
"description": "List manually-runnable maintenance tasks",
|
|
478
478
|
"examples": [
|
|
479
|
-
"<%= config.bin %>
|
|
480
|
-
"<%= config.bin %> auth signup -e user@example.com"
|
|
479
|
+
"<%= config.bin %> crons list"
|
|
481
480
|
],
|
|
482
481
|
"flags": {
|
|
483
482
|
"api-url": {
|
|
@@ -488,27 +487,11 @@
|
|
|
488
487
|
"hasDynamicHelp": false,
|
|
489
488
|
"multiple": false,
|
|
490
489
|
"type": "option"
|
|
491
|
-
},
|
|
492
|
-
"email": {
|
|
493
|
-
"char": "e",
|
|
494
|
-
"description": "Email address",
|
|
495
|
-
"name": "email",
|
|
496
|
-
"hasDynamicHelp": false,
|
|
497
|
-
"multiple": false,
|
|
498
|
-
"type": "option"
|
|
499
|
-
},
|
|
500
|
-
"password": {
|
|
501
|
-
"char": "p",
|
|
502
|
-
"description": "Password (min 8 chars; for non-interactive use)",
|
|
503
|
-
"name": "password",
|
|
504
|
-
"hasDynamicHelp": false,
|
|
505
|
-
"multiple": false,
|
|
506
|
-
"type": "option"
|
|
507
490
|
}
|
|
508
491
|
},
|
|
509
492
|
"hasDynamicHelp": false,
|
|
510
493
|
"hiddenAliases": [],
|
|
511
|
-
"id": "
|
|
494
|
+
"id": "crons:list",
|
|
512
495
|
"pluginAlias": "@rulemetric/cli",
|
|
513
496
|
"pluginName": "@rulemetric/cli",
|
|
514
497
|
"pluginType": "core",
|
|
@@ -518,16 +501,23 @@
|
|
|
518
501
|
"relativePath": [
|
|
519
502
|
"dist",
|
|
520
503
|
"commands",
|
|
521
|
-
"
|
|
522
|
-
"
|
|
504
|
+
"crons",
|
|
505
|
+
"list.js"
|
|
523
506
|
]
|
|
524
507
|
},
|
|
525
|
-
"
|
|
508
|
+
"crons:run": {
|
|
526
509
|
"aliases": [],
|
|
527
|
-
"args": {
|
|
528
|
-
|
|
510
|
+
"args": {
|
|
511
|
+
"name": {
|
|
512
|
+
"description": "Task name (run `rulemetric crons list` to see all)",
|
|
513
|
+
"name": "name",
|
|
514
|
+
"required": true
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
"description": "Run a maintenance task synchronously, right now",
|
|
529
518
|
"examples": [
|
|
530
|
-
"<%= config.bin %>
|
|
519
|
+
"<%= config.bin %> crons run cron_check_changelog",
|
|
520
|
+
"<%= config.bin %> crons run cron_suggest_instructions --quiet"
|
|
531
521
|
],
|
|
532
522
|
"flags": {
|
|
533
523
|
"api-url": {
|
|
@@ -538,11 +528,18 @@
|
|
|
538
528
|
"hasDynamicHelp": false,
|
|
539
529
|
"multiple": false,
|
|
540
530
|
"type": "option"
|
|
531
|
+
},
|
|
532
|
+
"quiet": {
|
|
533
|
+
"char": "q",
|
|
534
|
+
"description": "Suppress per-line log output; print summary only",
|
|
535
|
+
"name": "quiet",
|
|
536
|
+
"allowNo": false,
|
|
537
|
+
"type": "boolean"
|
|
541
538
|
}
|
|
542
539
|
},
|
|
543
540
|
"hasDynamicHelp": false,
|
|
544
541
|
"hiddenAliases": [],
|
|
545
|
-
"id": "
|
|
542
|
+
"id": "crons:run",
|
|
546
543
|
"pluginAlias": "@rulemetric/cli",
|
|
547
544
|
"pluginName": "@rulemetric/cli",
|
|
548
545
|
"pluginType": "core",
|
|
@@ -552,22 +549,17 @@
|
|
|
552
549
|
"relativePath": [
|
|
553
550
|
"dist",
|
|
554
551
|
"commands",
|
|
555
|
-
"
|
|
556
|
-
"
|
|
552
|
+
"crons",
|
|
553
|
+
"run.js"
|
|
557
554
|
]
|
|
558
555
|
},
|
|
559
|
-
"
|
|
556
|
+
"auth:create-key": {
|
|
560
557
|
"aliases": [],
|
|
561
558
|
"args": {},
|
|
562
|
-
"description": "
|
|
559
|
+
"description": "Create a long-lived API key for CLI and proxy authentication",
|
|
563
560
|
"examples": [
|
|
564
|
-
"<%= config.bin %>
|
|
565
|
-
"<%= config.bin %>
|
|
566
|
-
"<%= config.bin %> <%= command.id %> --tool hooks --add ~/work/client-a",
|
|
567
|
-
"<%= config.bin %> <%= command.id %> --tool hooks --off",
|
|
568
|
-
"<%= config.bin %> <%= command.id %> --remove ~/work/client-a",
|
|
569
|
-
"<%= config.bin %> <%= command.id %> --off",
|
|
570
|
-
"<%= config.bin %> <%= command.id %> --all"
|
|
561
|
+
"<%= config.bin %> auth create-key --name \"laptop\"",
|
|
562
|
+
"<%= config.bin %> auth create-key --name \"ci token\" --no-save"
|
|
571
563
|
],
|
|
572
564
|
"flags": {
|
|
573
565
|
"api-url": {
|
|
@@ -579,60 +571,26 @@
|
|
|
579
571
|
"multiple": false,
|
|
580
572
|
"type": "option"
|
|
581
573
|
},
|
|
582
|
-
"
|
|
583
|
-
"
|
|
584
|
-
"
|
|
585
|
-
"
|
|
574
|
+
"name": {
|
|
575
|
+
"char": "n",
|
|
576
|
+
"description": "Name for this key",
|
|
577
|
+
"name": "name",
|
|
578
|
+
"required": true,
|
|
586
579
|
"hasDynamicHelp": false,
|
|
587
580
|
"multiple": false,
|
|
588
|
-
"options": [
|
|
589
|
-
"codex",
|
|
590
|
-
"hooks"
|
|
591
|
-
],
|
|
592
581
|
"type": "option"
|
|
593
582
|
},
|
|
594
|
-
"
|
|
595
|
-
"
|
|
596
|
-
"
|
|
597
|
-
"
|
|
598
|
-
"
|
|
599
|
-
"type": "option"
|
|
600
|
-
},
|
|
601
|
-
"remove": {
|
|
602
|
-
"description": "Stop capturing under this path (repeatable).",
|
|
603
|
-
"name": "remove",
|
|
604
|
-
"hasDynamicHelp": false,
|
|
605
|
-
"multiple": true,
|
|
606
|
-
"type": "option"
|
|
607
|
-
},
|
|
608
|
-
"off": {
|
|
609
|
-
"description": "Turn this capture path off entirely.",
|
|
610
|
-
"exclusive": [
|
|
611
|
-
"all"
|
|
612
|
-
],
|
|
613
|
-
"name": "off",
|
|
614
|
-
"allowNo": false,
|
|
615
|
-
"type": "boolean"
|
|
616
|
-
},
|
|
617
|
-
"all": {
|
|
618
|
-
"description": "Capture every project (the default).",
|
|
619
|
-
"exclusive": [
|
|
620
|
-
"off"
|
|
621
|
-
],
|
|
622
|
-
"name": "all",
|
|
623
|
-
"allowNo": false,
|
|
624
|
-
"type": "boolean"
|
|
625
|
-
},
|
|
626
|
-
"clear": {
|
|
627
|
-
"description": "Remove this scope, restoring the default.",
|
|
628
|
-
"name": "clear",
|
|
629
|
-
"allowNo": false,
|
|
583
|
+
"save": {
|
|
584
|
+
"char": "s",
|
|
585
|
+
"description": "Save key to ~/.config/rulemetric/env for hooks/proxy",
|
|
586
|
+
"name": "save",
|
|
587
|
+
"allowNo": true,
|
|
630
588
|
"type": "boolean"
|
|
631
589
|
}
|
|
632
590
|
},
|
|
633
591
|
"hasDynamicHelp": false,
|
|
634
592
|
"hiddenAliases": [],
|
|
635
|
-
"id": "
|
|
593
|
+
"id": "auth:create-key",
|
|
636
594
|
"pluginAlias": "@rulemetric/cli",
|
|
637
595
|
"pluginName": "@rulemetric/cli",
|
|
638
596
|
"pluginType": "core",
|
|
@@ -642,14 +600,18 @@
|
|
|
642
600
|
"relativePath": [
|
|
643
601
|
"dist",
|
|
644
602
|
"commands",
|
|
645
|
-
"
|
|
646
|
-
"
|
|
603
|
+
"auth",
|
|
604
|
+
"create-key.js"
|
|
647
605
|
]
|
|
648
606
|
},
|
|
649
|
-
"
|
|
607
|
+
"auth:login": {
|
|
650
608
|
"aliases": [],
|
|
651
609
|
"args": {},
|
|
652
|
-
"description": "
|
|
610
|
+
"description": "Log in to RuleMetric",
|
|
611
|
+
"examples": [
|
|
612
|
+
"<%= config.bin %> auth login",
|
|
613
|
+
"<%= config.bin %> auth login -e user@example.com"
|
|
614
|
+
],
|
|
653
615
|
"flags": {
|
|
654
616
|
"api-url": {
|
|
655
617
|
"description": "Override API base URL",
|
|
@@ -660,68 +622,28 @@
|
|
|
660
622
|
"multiple": false,
|
|
661
623
|
"type": "option"
|
|
662
624
|
},
|
|
663
|
-
"
|
|
664
|
-
"
|
|
665
|
-
"
|
|
625
|
+
"email": {
|
|
626
|
+
"char": "e",
|
|
627
|
+
"description": "Email address",
|
|
628
|
+
"name": "email",
|
|
666
629
|
"hasDynamicHelp": false,
|
|
667
630
|
"multiple": false,
|
|
668
|
-
"options": [
|
|
669
|
-
"recommended",
|
|
670
|
-
"required"
|
|
671
|
-
],
|
|
672
631
|
"type": "option"
|
|
673
632
|
},
|
|
674
|
-
"
|
|
675
|
-
"
|
|
676
|
-
"
|
|
633
|
+
"password": {
|
|
634
|
+
"char": "p",
|
|
635
|
+
"description": "Password (for non-interactive use)",
|
|
636
|
+
"name": "password",
|
|
677
637
|
"hasDynamicHelp": false,
|
|
678
638
|
"multiple": false,
|
|
679
|
-
"options": [
|
|
680
|
-
"org",
|
|
681
|
-
"team"
|
|
682
|
-
],
|
|
683
639
|
"type": "option"
|
|
684
640
|
},
|
|
685
|
-
"
|
|
686
|
-
"description": "
|
|
687
|
-
"
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
"
|
|
691
|
-
}
|
|
692
|
-
},
|
|
693
|
-
"hasDynamicHelp": false,
|
|
694
|
-
"hiddenAliases": [],
|
|
695
|
-
"id": "catalog",
|
|
696
|
-
"pluginAlias": "@rulemetric/cli",
|
|
697
|
-
"pluginName": "@rulemetric/cli",
|
|
698
|
-
"pluginType": "core",
|
|
699
|
-
"strict": true,
|
|
700
|
-
"enableJsonFlag": false,
|
|
701
|
-
"isESM": true,
|
|
702
|
-
"relativePath": [
|
|
703
|
-
"dist",
|
|
704
|
-
"commands",
|
|
705
|
-
"catalog",
|
|
706
|
-
"index.js"
|
|
707
|
-
]
|
|
708
|
-
},
|
|
709
|
-
"catalog:recommend": {
|
|
710
|
-
"aliases": [],
|
|
711
|
-
"args": {
|
|
712
|
-
"projectId": {
|
|
713
|
-
"description": "ID of the project",
|
|
714
|
-
"name": "projectId",
|
|
715
|
-
"required": true
|
|
716
|
-
}
|
|
717
|
-
},
|
|
718
|
-
"description": "Get AI-powered instruction recommendations for a project",
|
|
719
|
-
"flags": {
|
|
720
|
-
"api-url": {
|
|
721
|
-
"description": "Override API base URL",
|
|
722
|
-
"env": "RULEMETRIC_API_URL",
|
|
723
|
-
"hidden": true,
|
|
724
|
-
"name": "api-url",
|
|
641
|
+
"api-key": {
|
|
642
|
+
"description": "Authenticate with an API key from https://rulemetric.com/connect (required for Google/GitHub sign-ins, which have no password)",
|
|
643
|
+
"exclusive": [
|
|
644
|
+
"password"
|
|
645
|
+
],
|
|
646
|
+
"name": "api-key",
|
|
725
647
|
"hasDynamicHelp": false,
|
|
726
648
|
"multiple": false,
|
|
727
649
|
"type": "option"
|
|
@@ -729,7 +651,7 @@
|
|
|
729
651
|
},
|
|
730
652
|
"hasDynamicHelp": false,
|
|
731
653
|
"hiddenAliases": [],
|
|
732
|
-
"id": "
|
|
654
|
+
"id": "auth:login",
|
|
733
655
|
"pluginAlias": "@rulemetric/cli",
|
|
734
656
|
"pluginName": "@rulemetric/cli",
|
|
735
657
|
"pluginType": "core",
|
|
@@ -739,16 +661,16 @@
|
|
|
739
661
|
"relativePath": [
|
|
740
662
|
"dist",
|
|
741
663
|
"commands",
|
|
742
|
-
"
|
|
743
|
-
"
|
|
664
|
+
"auth",
|
|
665
|
+
"login.js"
|
|
744
666
|
]
|
|
745
667
|
},
|
|
746
|
-
"
|
|
668
|
+
"auth:logout": {
|
|
747
669
|
"aliases": [],
|
|
748
670
|
"args": {},
|
|
749
|
-
"description": "
|
|
671
|
+
"description": "Log out of RuleMetric",
|
|
750
672
|
"examples": [
|
|
751
|
-
"<%= config.bin %>
|
|
673
|
+
"<%= config.bin %> auth logout"
|
|
752
674
|
],
|
|
753
675
|
"flags": {
|
|
754
676
|
"api-url": {
|
|
@@ -763,7 +685,7 @@
|
|
|
763
685
|
},
|
|
764
686
|
"hasDynamicHelp": false,
|
|
765
687
|
"hiddenAliases": [],
|
|
766
|
-
"id": "
|
|
688
|
+
"id": "auth:logout",
|
|
767
689
|
"pluginAlias": "@rulemetric/cli",
|
|
768
690
|
"pluginName": "@rulemetric/cli",
|
|
769
691
|
"pluginType": "core",
|
|
@@ -773,23 +695,23 @@
|
|
|
773
695
|
"relativePath": [
|
|
774
696
|
"dist",
|
|
775
697
|
"commands",
|
|
776
|
-
"
|
|
777
|
-
"
|
|
698
|
+
"auth",
|
|
699
|
+
"logout.js"
|
|
778
700
|
]
|
|
779
701
|
},
|
|
780
|
-
"
|
|
702
|
+
"auth:revoke-key": {
|
|
781
703
|
"aliases": [],
|
|
782
704
|
"args": {
|
|
783
|
-
"
|
|
784
|
-
"description": "
|
|
785
|
-
"name": "
|
|
786
|
-
"required": true
|
|
705
|
+
"id": {
|
|
706
|
+
"description": "API key ID, prefix (rm_xxxxxxxx), or name",
|
|
707
|
+
"name": "id"
|
|
787
708
|
}
|
|
788
709
|
},
|
|
789
|
-
"description": "
|
|
710
|
+
"description": "Revoke an API key (run with no argument to list active keys)",
|
|
790
711
|
"examples": [
|
|
791
|
-
"<%= config.bin %>
|
|
792
|
-
"<%= config.bin %>
|
|
712
|
+
"<%= config.bin %> auth revoke-key",
|
|
713
|
+
"<%= config.bin %> auth revoke-key rm_abc12345",
|
|
714
|
+
"<%= config.bin %> auth revoke-key \"my-laptop (auto)\""
|
|
793
715
|
],
|
|
794
716
|
"flags": {
|
|
795
717
|
"api-url": {
|
|
@@ -800,18 +722,11 @@
|
|
|
800
722
|
"hasDynamicHelp": false,
|
|
801
723
|
"multiple": false,
|
|
802
724
|
"type": "option"
|
|
803
|
-
},
|
|
804
|
-
"quiet": {
|
|
805
|
-
"char": "q",
|
|
806
|
-
"description": "Suppress per-line log output; print summary only",
|
|
807
|
-
"name": "quiet",
|
|
808
|
-
"allowNo": false,
|
|
809
|
-
"type": "boolean"
|
|
810
725
|
}
|
|
811
726
|
},
|
|
812
727
|
"hasDynamicHelp": false,
|
|
813
728
|
"hiddenAliases": [],
|
|
814
|
-
"id": "
|
|
729
|
+
"id": "auth:revoke-key",
|
|
815
730
|
"pluginAlias": "@rulemetric/cli",
|
|
816
731
|
"pluginName": "@rulemetric/cli",
|
|
817
732
|
"pluginType": "core",
|
|
@@ -821,17 +736,17 @@
|
|
|
821
736
|
"relativePath": [
|
|
822
737
|
"dist",
|
|
823
738
|
"commands",
|
|
824
|
-
"
|
|
825
|
-
"
|
|
739
|
+
"auth",
|
|
740
|
+
"revoke-key.js"
|
|
826
741
|
]
|
|
827
742
|
},
|
|
828
|
-
"
|
|
743
|
+
"auth:signup": {
|
|
829
744
|
"aliases": [],
|
|
830
745
|
"args": {},
|
|
831
|
-
"description": "Create
|
|
746
|
+
"description": "Create a RuleMetric account from the CLI",
|
|
832
747
|
"examples": [
|
|
833
|
-
"<%= config.bin %>
|
|
834
|
-
"<%= config.bin %>
|
|
748
|
+
"<%= config.bin %> auth signup",
|
|
749
|
+
"<%= config.bin %> auth signup -e user@example.com"
|
|
835
750
|
],
|
|
836
751
|
"flags": {
|
|
837
752
|
"api-url": {
|
|
@@ -843,51 +758,18 @@
|
|
|
843
758
|
"multiple": false,
|
|
844
759
|
"type": "option"
|
|
845
760
|
},
|
|
846
|
-
"
|
|
847
|
-
"char": "
|
|
848
|
-
"description": "
|
|
849
|
-
"name": "
|
|
850
|
-
"required": true,
|
|
851
|
-
"hasDynamicHelp": false,
|
|
852
|
-
"multiple": false,
|
|
853
|
-
"type": "option"
|
|
854
|
-
},
|
|
855
|
-
"type": {
|
|
856
|
-
"char": "t",
|
|
857
|
-
"description": "Target type",
|
|
858
|
-
"name": "type",
|
|
859
|
-
"required": true,
|
|
860
|
-
"hasDynamicHelp": false,
|
|
861
|
-
"multiple": false,
|
|
862
|
-
"options": [
|
|
863
|
-
"instruction",
|
|
864
|
-
"skill",
|
|
865
|
-
"prompt",
|
|
866
|
-
"plan"
|
|
867
|
-
],
|
|
868
|
-
"type": "option"
|
|
869
|
-
},
|
|
870
|
-
"file": {
|
|
871
|
-
"char": "f",
|
|
872
|
-
"description": "Path to content file",
|
|
873
|
-
"name": "file",
|
|
874
|
-
"hasDynamicHelp": false,
|
|
875
|
-
"multiple": false,
|
|
876
|
-
"type": "option"
|
|
877
|
-
},
|
|
878
|
-
"content": {
|
|
879
|
-
"char": "c",
|
|
880
|
-
"description": "Content string (alternative to --file)",
|
|
881
|
-
"name": "content",
|
|
761
|
+
"email": {
|
|
762
|
+
"char": "e",
|
|
763
|
+
"description": "Email address",
|
|
764
|
+
"name": "email",
|
|
882
765
|
"hasDynamicHelp": false,
|
|
883
766
|
"multiple": false,
|
|
884
767
|
"type": "option"
|
|
885
768
|
},
|
|
886
|
-
"
|
|
887
|
-
"char": "
|
|
888
|
-
"description": "
|
|
889
|
-
"name": "
|
|
890
|
-
"default": "",
|
|
769
|
+
"password": {
|
|
770
|
+
"char": "p",
|
|
771
|
+
"description": "Password (min 8 chars; for non-interactive use)",
|
|
772
|
+
"name": "password",
|
|
891
773
|
"hasDynamicHelp": false,
|
|
892
774
|
"multiple": false,
|
|
893
775
|
"type": "option"
|
|
@@ -895,7 +777,7 @@
|
|
|
895
777
|
},
|
|
896
778
|
"hasDynamicHelp": false,
|
|
897
779
|
"hiddenAliases": [],
|
|
898
|
-
"id": "
|
|
780
|
+
"id": "auth:signup",
|
|
899
781
|
"pluginAlias": "@rulemetric/cli",
|
|
900
782
|
"pluginName": "@rulemetric/cli",
|
|
901
783
|
"pluginType": "core",
|
|
@@ -905,17 +787,16 @@
|
|
|
905
787
|
"relativePath": [
|
|
906
788
|
"dist",
|
|
907
789
|
"commands",
|
|
908
|
-
"
|
|
909
|
-
"
|
|
790
|
+
"auth",
|
|
791
|
+
"signup.js"
|
|
910
792
|
]
|
|
911
793
|
},
|
|
912
|
-
"
|
|
794
|
+
"auth:status": {
|
|
913
795
|
"aliases": [],
|
|
914
796
|
"args": {},
|
|
915
|
-
"description": "
|
|
797
|
+
"description": "Show current authentication status",
|
|
916
798
|
"examples": [
|
|
917
|
-
"<%= config.bin %>
|
|
918
|
-
"<%= config.bin %> eval-targets list --type instruction"
|
|
799
|
+
"<%= config.bin %> auth status"
|
|
919
800
|
],
|
|
920
801
|
"flags": {
|
|
921
802
|
"api-url": {
|
|
@@ -926,25 +807,11 @@
|
|
|
926
807
|
"hasDynamicHelp": false,
|
|
927
808
|
"multiple": false,
|
|
928
809
|
"type": "option"
|
|
929
|
-
},
|
|
930
|
-
"type": {
|
|
931
|
-
"char": "t",
|
|
932
|
-
"description": "Filter by type",
|
|
933
|
-
"name": "type",
|
|
934
|
-
"hasDynamicHelp": false,
|
|
935
|
-
"multiple": false,
|
|
936
|
-
"options": [
|
|
937
|
-
"instruction",
|
|
938
|
-
"skill",
|
|
939
|
-
"prompt",
|
|
940
|
-
"plan"
|
|
941
|
-
],
|
|
942
|
-
"type": "option"
|
|
943
810
|
}
|
|
944
811
|
},
|
|
945
812
|
"hasDynamicHelp": false,
|
|
946
813
|
"hiddenAliases": [],
|
|
947
|
-
"id": "
|
|
814
|
+
"id": "auth:status",
|
|
948
815
|
"pluginAlias": "@rulemetric/cli",
|
|
949
816
|
"pluginName": "@rulemetric/cli",
|
|
950
817
|
"pluginType": "core",
|
|
@@ -954,8 +821,8 @@
|
|
|
954
821
|
"relativePath": [
|
|
955
822
|
"dist",
|
|
956
823
|
"commands",
|
|
957
|
-
"
|
|
958
|
-
"
|
|
824
|
+
"auth",
|
|
825
|
+
"status.js"
|
|
959
826
|
]
|
|
960
827
|
},
|
|
961
828
|
"evals:agent": {
|
|
@@ -1774,6 +1641,139 @@
|
|
|
1774
1641
|
"ensure.js"
|
|
1775
1642
|
]
|
|
1776
1643
|
},
|
|
1644
|
+
"eval-targets:create": {
|
|
1645
|
+
"aliases": [],
|
|
1646
|
+
"args": {},
|
|
1647
|
+
"description": "Create an eval target (instruction, skill, prompt, or plan to test)",
|
|
1648
|
+
"examples": [
|
|
1649
|
+
"<%= config.bin %> eval-targets create --name my-rules --type instruction --file ./CLAUDE.md",
|
|
1650
|
+
"<%= config.bin %> eval-targets create --name my-prompt --type prompt --content \"Always use TypeScript\""
|
|
1651
|
+
],
|
|
1652
|
+
"flags": {
|
|
1653
|
+
"api-url": {
|
|
1654
|
+
"description": "Override API base URL",
|
|
1655
|
+
"env": "RULEMETRIC_API_URL",
|
|
1656
|
+
"hidden": true,
|
|
1657
|
+
"name": "api-url",
|
|
1658
|
+
"hasDynamicHelp": false,
|
|
1659
|
+
"multiple": false,
|
|
1660
|
+
"type": "option"
|
|
1661
|
+
},
|
|
1662
|
+
"name": {
|
|
1663
|
+
"char": "n",
|
|
1664
|
+
"description": "Name for the eval target",
|
|
1665
|
+
"name": "name",
|
|
1666
|
+
"required": true,
|
|
1667
|
+
"hasDynamicHelp": false,
|
|
1668
|
+
"multiple": false,
|
|
1669
|
+
"type": "option"
|
|
1670
|
+
},
|
|
1671
|
+
"type": {
|
|
1672
|
+
"char": "t",
|
|
1673
|
+
"description": "Target type",
|
|
1674
|
+
"name": "type",
|
|
1675
|
+
"required": true,
|
|
1676
|
+
"hasDynamicHelp": false,
|
|
1677
|
+
"multiple": false,
|
|
1678
|
+
"options": [
|
|
1679
|
+
"instruction",
|
|
1680
|
+
"skill",
|
|
1681
|
+
"prompt",
|
|
1682
|
+
"plan"
|
|
1683
|
+
],
|
|
1684
|
+
"type": "option"
|
|
1685
|
+
},
|
|
1686
|
+
"file": {
|
|
1687
|
+
"char": "f",
|
|
1688
|
+
"description": "Path to content file",
|
|
1689
|
+
"name": "file",
|
|
1690
|
+
"hasDynamicHelp": false,
|
|
1691
|
+
"multiple": false,
|
|
1692
|
+
"type": "option"
|
|
1693
|
+
},
|
|
1694
|
+
"content": {
|
|
1695
|
+
"char": "c",
|
|
1696
|
+
"description": "Content string (alternative to --file)",
|
|
1697
|
+
"name": "content",
|
|
1698
|
+
"hasDynamicHelp": false,
|
|
1699
|
+
"multiple": false,
|
|
1700
|
+
"type": "option"
|
|
1701
|
+
},
|
|
1702
|
+
"description": {
|
|
1703
|
+
"char": "d",
|
|
1704
|
+
"description": "Description of the target",
|
|
1705
|
+
"name": "description",
|
|
1706
|
+
"default": "",
|
|
1707
|
+
"hasDynamicHelp": false,
|
|
1708
|
+
"multiple": false,
|
|
1709
|
+
"type": "option"
|
|
1710
|
+
}
|
|
1711
|
+
},
|
|
1712
|
+
"hasDynamicHelp": false,
|
|
1713
|
+
"hiddenAliases": [],
|
|
1714
|
+
"id": "eval-targets:create",
|
|
1715
|
+
"pluginAlias": "@rulemetric/cli",
|
|
1716
|
+
"pluginName": "@rulemetric/cli",
|
|
1717
|
+
"pluginType": "core",
|
|
1718
|
+
"strict": true,
|
|
1719
|
+
"enableJsonFlag": false,
|
|
1720
|
+
"isESM": true,
|
|
1721
|
+
"relativePath": [
|
|
1722
|
+
"dist",
|
|
1723
|
+
"commands",
|
|
1724
|
+
"eval-targets",
|
|
1725
|
+
"create.js"
|
|
1726
|
+
]
|
|
1727
|
+
},
|
|
1728
|
+
"eval-targets:list": {
|
|
1729
|
+
"aliases": [],
|
|
1730
|
+
"args": {},
|
|
1731
|
+
"description": "List eval targets",
|
|
1732
|
+
"examples": [
|
|
1733
|
+
"<%= config.bin %> eval-targets list",
|
|
1734
|
+
"<%= config.bin %> eval-targets list --type instruction"
|
|
1735
|
+
],
|
|
1736
|
+
"flags": {
|
|
1737
|
+
"api-url": {
|
|
1738
|
+
"description": "Override API base URL",
|
|
1739
|
+
"env": "RULEMETRIC_API_URL",
|
|
1740
|
+
"hidden": true,
|
|
1741
|
+
"name": "api-url",
|
|
1742
|
+
"hasDynamicHelp": false,
|
|
1743
|
+
"multiple": false,
|
|
1744
|
+
"type": "option"
|
|
1745
|
+
},
|
|
1746
|
+
"type": {
|
|
1747
|
+
"char": "t",
|
|
1748
|
+
"description": "Filter by type",
|
|
1749
|
+
"name": "type",
|
|
1750
|
+
"hasDynamicHelp": false,
|
|
1751
|
+
"multiple": false,
|
|
1752
|
+
"options": [
|
|
1753
|
+
"instruction",
|
|
1754
|
+
"skill",
|
|
1755
|
+
"prompt",
|
|
1756
|
+
"plan"
|
|
1757
|
+
],
|
|
1758
|
+
"type": "option"
|
|
1759
|
+
}
|
|
1760
|
+
},
|
|
1761
|
+
"hasDynamicHelp": false,
|
|
1762
|
+
"hiddenAliases": [],
|
|
1763
|
+
"id": "eval-targets:list",
|
|
1764
|
+
"pluginAlias": "@rulemetric/cli",
|
|
1765
|
+
"pluginName": "@rulemetric/cli",
|
|
1766
|
+
"pluginType": "core",
|
|
1767
|
+
"strict": true,
|
|
1768
|
+
"enableJsonFlag": false,
|
|
1769
|
+
"isESM": true,
|
|
1770
|
+
"relativePath": [
|
|
1771
|
+
"dist",
|
|
1772
|
+
"commands",
|
|
1773
|
+
"eval-targets",
|
|
1774
|
+
"list.js"
|
|
1775
|
+
]
|
|
1776
|
+
},
|
|
1777
1777
|
"hooks:emit-instructions": {
|
|
1778
1778
|
"aliases": [],
|
|
1779
1779
|
"args": {},
|
|
@@ -4787,5 +4787,5 @@
|
|
|
4787
4787
|
]
|
|
4788
4788
|
}
|
|
4789
4789
|
},
|
|
4790
|
-
"version": "0.12.
|
|
4790
|
+
"version": "0.12.7"
|
|
4791
4791
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulemetric/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"postgres": "^3.4.0",
|
|
81
81
|
"react": "^19.0.0",
|
|
82
82
|
"zod": "^3.24.0",
|
|
83
|
-
"@rulemetric/
|
|
84
|
-
"@rulemetric/
|
|
85
|
-
"@rulemetric/skills-registry": "0.12.
|
|
83
|
+
"@rulemetric/hooks": "0.12.7",
|
|
84
|
+
"@rulemetric/proxy": "0.12.7",
|
|
85
|
+
"@rulemetric/skills-registry": "0.12.7"
|
|
86
86
|
},
|
|
87
87
|
"//deps": "Worker (`evals agent`) runtime deps: the @opentelemetry/* set, @sentry/node, and postgres are STATIC top-level imports loaded at worker startup (via bundled @rulemetric/{telemetry,db}) — they MUST be runtime deps or a clean `npm i -g` crashes with ModuleLoadError. `better-sqlite3` is optionalDependencies (below): it's a native module, lazy `require()`'d inside a try/catch (packages/session providers cursor/opencode) so a missing binary degrades gracefully — making it a hard dep would break `npm i -g` on platforms without prebuilt binaries. `resend` stays a devDep: lazy `await import('resend')` guarded by RESEND_API_KEY, which end-user workers never set (provider falls back to noop). Classification verified via import-graph scan of dist/commands/evals/agent.js + per-importer static/lazy check.",
|
|
88
88
|
"optionalDependencies": {
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
"vitest": "^3.2.0",
|
|
105
105
|
"@rulemetric/api": "0.0.1",
|
|
106
106
|
"@rulemetric/core": "0.0.1",
|
|
107
|
-
"@rulemetric/db": "0.0.1",
|
|
108
107
|
"@rulemetric/effectiveness": "0.0.1",
|
|
109
|
-
"@rulemetric/email": "0.0.1",
|
|
110
108
|
"@rulemetric/session": "0.2.1",
|
|
109
|
+
"@rulemetric/email": "0.0.1",
|
|
111
110
|
"@rulemetric/telemetry": "0.0.1",
|
|
111
|
+
"@rulemetric/db": "0.0.1",
|
|
112
112
|
"@rulemetric/typescript-config": "0.0.0"
|
|
113
113
|
},
|
|
114
114
|
"scripts": {
|
package/dist/chunk-ONRQDI3N.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as X}from"./chunk-2KJAM2NG.js";import{b as Y}from"./chunk-IEQDLURA.js";import{d as z,e as Z}from"./chunk-UUFCTEBT.js";import{a as V}from"./chunk-ZYGBABMZ.js";import{a as $}from"./chunk-5OX6YKTR.js";import{a as C}from"./chunk-MJ5H7RDK.js";import{a as L}from"./chunk-W67DO5PT.js";import{a as N}from"./chunk-WO6MS654.js";import{a as F}from"./chunk-UTAETY5Z.js";import{b as x}from"./chunk-E4RGYYBC.js";import{a as B}from"./chunk-O65AQZYB.js";import{a as O}from"./chunk-ARC4Q3GL.js";import{b as D}from"./chunk-5RBLIVBF.js";import{a as G}from"./chunk-GRPUY2EZ.js";import{a as T}from"./chunk-UXB6DRR7.js";import{a as q}from"./chunk-INSKP5ED.js";import{a as J}from"./chunk-UA5GEVGW.js";import{a as R}from"./chunk-PZS55PW2.js";import{a as Q}from"./chunk-AKXGUQ5B.js";import{e as H}from"./chunk-Z4YVOVMM.js";import{b as W}from"./chunk-NKJTNGXR.js";import{a as K}from"./chunk-C6GLNE6X.js";import{a as U}from"./chunk-S2SKT5PV.js";import{l as P}from"./chunk-FUYR7CFD.js";import{d as M}from"./chunk-NF2BIEAF.js";import{b as S,e as A,f as k}from"./chunk-UGACB66X.js";import{a as s}from"./chunk-ZLLER3HP.js";var y=null,b=null,oe={process_eval:L,process_insights:N,process_launch:x,process_send_message:V,process_conversation:C,process_session_goal:$,distill_memories:W,memory_ab:B,process_run_cleanup:O,cron_refine_cases:q,cron_retire_unused_skills:Q,cron_reconcile_attribution:T,cron_suggest_instructions:H,cron_refresh_skills:R,cron_refresh_pricing:J,cron_eval_autorun:U,cron_auto_accept_suggestions:K,cron_instruction_training:G,cron_instruction_evolution:P,process_judge_review:F},j=Object.keys(oe),ae=new Set([]);function ie(e=process.env){return e.DATABASE_URL?j:j.filter(n=>!ae.has(n))}s(ie,"availableCapabilities");var le=3e4,ce=3e4,de=3e4,ee=500,ne=1e4,ue=`thin-agent-${process.pid}`,E=null;function me(e,n,r,c){let i;try{let t=M();i={claude:t.claudeBin!=null,codex:t.codexBin!=null,codexModel:t.codexConfiguredModel}}catch{}let u=s(t=>k("/api/workers/heartbeat",{workerType:"cli-worker",clientName:ue,clientVersion:c,workerVersion:"0.1.0",currentJobId:null,inFlightCount:0,lastError:null,status:t,metadata:{capabilities:e,mode:"thin-agent",llmEngines:i,machine:y?.summary()}}).then(d=>{let l=d?.advisory;l&&l.message!==E?(E=l.message,a(r,{event:"worker_advisory",code:l.code,message:l.message})):l||(E=null)}).catch(d=>{a(r,{event:"presence_heartbeat_error",error:d instanceof Error?d.message:String(d)})}),"send");u("alive");let p=setInterval(()=>u("alive"),de);return{shutdown:s(async()=>{clearInterval(p),await Promise.race([u("shutting_down"),new Promise(t=>setTimeout(t,2e3).unref())])},"shutdown")}}s(me,"startPresenceHeartbeat");function a(e,n){try{e(JSON.stringify({ts:new Date().toISOString(),...n}))}catch{e(`[agent-loop] log_error event=${n.event}`)}}s(a,"structuredLog");function re(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=s(()=>{clearTimeout(c),n.removeEventListener("abort",i),r(!1)},"onAbort");n.addEventListener("abort",i,{once:!0})})}s(re,"abortableSleep");async function ge(e,n){let r=`capabilities=${encodeURIComponent(e.join(","))}&waitMs=${n}`,c=await A(`/api/work/next?${r}`);return c==null||typeof c=="string"?null:c}s(ge,"pollForWork");function pe(e,n){return{logger:{info:s(r=>n(r),"info"),warn:s(r=>n(r),"warn"),error:s(r=>n(r),"error")},job:{attempts:e}}}s(pe,"makeHelpers");async function _e(e,n,r){let c=oe[e.kind],i=Date.now();if(a(r,{event:"claim",jobId:e.id,kind:e.kind,attempts:e.attempts}),!c){let t=`unknown kind: ${e.kind}`;a(r,{event:"fail",jobId:e.id,kind:e.kind,terminal:!0,error:t}),await k(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:t,terminal:!0}).catch(()=>{});return}let u=s(()=>{a(r,{event:"heartbeat",jobId:e.id}),k(`/api/work/${e.id}/heartbeat`,{leaseToken:e.leaseToken}).catch(t=>{a(r,{event:"heartbeat_error",jobId:e.id,error:t instanceof Error?t.message:String(t)})})},"beat"),p=setInterval(u,n);b={jobId:e.id,beat:u};try{let t=pe(e.attempts,r),d=await c(e.payload,t)??{};clearInterval(p),a(r,{event:"complete",jobId:e.id,kind:e.kind,durationMs:Date.now()-i}),await k(`/api/work/${e.id}/complete`,{leaseToken:e.leaseToken,result:d})}catch(t){clearInterval(p);let d=D(t),l=Z(y?.pausesSince(i)??[]),_=t instanceof Error?t.message:String(t),f=l?`${l}; ${_}`:_;a(r,{event:"fail",jobId:e.id,kind:e.kind,durationMs:Date.now()-i,terminal:d,error:f,...l?{pausedDuringJob:!0}:{}}),await k(`/api/work/${e.id}/fail`,{leaseToken:e.leaseToken,error:f,terminal:d}).catch(m=>{a(r,{event:"fail_post_error",jobId:e.id,error:m instanceof Error?m.message:String(m)})})}finally{b=null}}s(_e,"runOne");var te=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 Je(e){let n=e.log??(()=>{}),r=e.pollWaitMs??le,c=e.heartbeatIntervalMs??ce,i=e.capabilities??ie();a(n,{event:"agent_start",capabilities:i,pollWaitMs:r,heartbeatIntervalMs:c});try{let o=Y();o.removed.length>0&&a(n,{event:"eval_worktrees_swept",removed:o.removed.length})}catch(o){a(n,{event:"eval_worktree_sweep_failed",error:o instanceof Error?o.message:String(o)})}y=z({signal:e.signal,onPause:s(o=>{a(n,{event:"machine_pause",...o,jobId:b?.jobId??null}),b?.beat()},"onPause")});let u=me(i,e.signal,n,e.version);X({signal:e.signal,log:n}).catch(o=>{a(n,{event:"tt_heartbeat_fatal",error:o instanceof Error?o.message:String(o)})});let p=5*6e4,t=0,d=s(()=>{if(!e.readInstalledVersion||!e.version)return!1;let o=Date.now();if(o-t<p)return!1;t=o;let w=e.readInstalledVersion();return!!(w&&w!==e.version)},"versionDrifted"),l=new AbortController,_=l.signal;e.signal.aborted?l.abort():e.signal.addEventListener("abort",()=>l.abort(),{once:!0});let f=s(async(o,w)=>{let g=ee;for(;!_.aborted;){if(d()){a(n,{event:"agent_version_drift",bootVersion:e.version,installedVersion:e.readInstalledVersion?.()??null}),l.abort(),e.onVersionDrift?.();break}let I=null;try{I=await ge([...w],r)}catch(v){let se=v instanceof S?v.statusCode:void 0;if(a(n,{event:"poll_error",lane:o,status:se,error:v instanceof Error?v.message:String(v)}),!await re(g,_))break;g=Math.min(g*2,ne);continue}if(!I){if(a(n,{event:"poll_204",lane:o}),!await re(g,_))break;g=Math.min(g*2,ne);continue}g=ee,await _e(I,c,n)}},"runLane"),m=i.filter(o=>te.has(o)),h=i.filter(o=>!te.has(o));m.length>0&&h.length>0?(a(n,{event:"agent_lanes",heavy:m.length,fast:h.length}),await Promise.all([f("heavy",m),f("fast",h)])):await f("single",i),await u.shutdown(),a(n,{event:"agent_stop"})}s(Je,"runAgentLoop");export{oe as a,j as b,ie as c,ge as d,Je as e};
|