@evolvingmachines/evolve 0.0.59 → 0.0.61

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.
Files changed (29) hide show
  1. package/dist/chunk-N2LMMVL4.js +427 -0
  2. package/dist/cli/index.cjs +38 -37
  3. package/dist/cli/index.d.cts +3 -1
  4. package/dist/cli/index.d.ts +3 -1
  5. package/dist/cli/index.js +29 -28
  6. package/dist/index.cjs +54 -54
  7. package/dist/index.d.cts +111 -7
  8. package/dist/index.d.ts +111 -7
  9. package/dist/index.js +38 -38
  10. package/dist/{types-DlpTxdR_.d.cts → types-CMEpx9QI.d.cts} +313 -5
  11. package/dist/{types-DlpTxdR_.d.ts → types-CMEpx9QI.d.ts} +313 -5
  12. package/hosted-error-codes.json +6 -0
  13. package/package.json +5 -5
  14. package/skills/evolve-evals/references/cli-reference/analysis.mdx +69 -0
  15. package/skills/evolve-evals/references/cli-reference/check.mdx +86 -0
  16. package/skills/evolve-evals/references/cli-reference/dataset.mdx +13 -0
  17. package/skills/evolve-evals/references/cli-reference/run.mdx +6 -0
  18. package/skills/evolve-evals/references/cli-reference/trial.mdx +71 -2
  19. package/skills/evolve-evals/references/core-concepts/trial-outputs.mdx +14 -0
  20. package/skills/evolve-evals/references/sdk/python.mdx +22 -0
  21. package/skills/evolve-evals/references/sdk/typescript.mdx +22 -0
  22. package/skills/evolve-evals/references/sdk-reference/analyses.mdx +70 -0
  23. package/skills/evolve-evals/references/sdk-reference/checks.mdx +105 -4
  24. package/skills/evolve-evals/references/sdk-reference/datasets.mdx +40 -0
  25. package/skills/evolve-evals/references/sdk-reference/errors.mdx +11 -0
  26. package/skills/evolve-evals/references/sdk-reference/jobs.mdx +1 -1
  27. package/skills/evolve-evals/references/sdk-reference/trials.mdx +70 -0
  28. package/spec/openapi.yaml +3021 -360
  29. package/dist/chunk-JS2UTK2I.js +0 -427
package/dist/cli/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import {X as X$1,W as W$1,ca as ca$1,xa as xa$1,I as I$1,Ka as Ka$1,Ja as Ja$1,Da as Da$1,Ea as Ea$1,Ca as Ca$1,ga as ga$1,Ia as Ia$1,Ha as Ha$1,Ga as Ga$1,ba as ba$1,Fa as Fa$1,ta as ta$1,sa as sa$1,ra as ra$1,za as za$1,V,ja as ja$1,ha as ha$1,ia as ia$1,aa as aa$1,T as T$1,U as U$1,Y,ka as ka$1,wa as wa$1,va as va$1,ua as ua$1}from'../chunk-JS2UTK2I.js';import'../chunk-HQJI3HHU.js';import'../chunk-5GVMBEYI.js';import {realpathSync,readFileSync,existsSync,mkdirSync,writeFileSync,statSync,readdirSync}from'fs';import {join,resolve,dirname,relative,sep}from'path';import {fileURLToPath,pathToFileURL}from'url';import {LineCounter,parseDocument,parse as parse$1}from'yaml';import {parse}from'smol-toml';import {homedir}from'os';var De="evolve",nn="evolve-agents",Re="EVOLVE_SKILLS_DIR",Et="evolve-",an=["references","templates"],Lt=[".mdx",".md"],U=class extends Error{constructor(t){super(t),this.name="SkillsError";}};function pe(e){try{return statSync(e).isDirectory()}catch{return false}}function Rt(e){try{return statSync(e).isFile()}catch{return false}}function rn(e,t){return relative(e,t).split(sep).join("/")}function on(e){let t=[],s=n=>{for(let a of readdirSync(n,{withFileTypes:true})){let r=join(n,a.name);a.isDirectory()?s(r):a.isFile()&&t.push(r);}};return pe(e)&&s(e),t.sort()}function te(e,t=process.env){let s=t[Re];if(s!==void 0&&s!==""){if(!pe(s))throw new U(`${Re} points at nothing: ${s}`);return resolve(s)}for(let n of [join(e,"skills"),join(e,"..","..","skills")])if(pe(n))return resolve(n);throw new U(`skills directory not found; set ${Re} or reinstall @evolvingmachines/evolve`)}function ln(e){let t=join(e,"SKILL.md"),s=readFileSync(t,"utf8"),n=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(s),a=n?s.slice(n[0].length).replace(/^\r?\n+/,""):s,r=null;if(n)try{r=parse$1(n[1]);}catch(c){throw new U(`${t}: front matter does not parse (${c.message})`)}let o=r!==null&&typeof r=="object"&&typeof r.description=="string"?r.description.replace(/\s+/g," ").trim():"",i=e.slice(e.lastIndexOf(sep)+1);return {name:i.startsWith(Et)?i.slice(Et.length):i,dir:e,description:o,content:s,body:a}}function Ue(e){return readdirSync(e,{withFileTypes:true}).filter(t=>t.isDirectory()&&t.name!==nn&&Rt(join(e,t.name,"SKILL.md"))).map(t=>ln(join(e,t.name))).sort((t,s)=>t.name.localeCompare(s.name))}function ge(e){return Ue(e).filter(t=>t.name!==De)}function Dt(e,t){return Ue(e).some(s=>s.name===t)}function se(e,t){let s=Ue(e).find(n=>n.name===t);if(!s){let n=ge(e).map(a=>a.name);throw new U(`unknown skill "${t}" (skills: ${n.join(", ")})`)}return s}function ne(e){return an.flatMap(t=>on(join(e.dir,t)).map(s=>({path:rn(e.dir,s),content:readFileSync(s,"utf8")})))}function Jt(e){return e.startsWith("references/")&&Lt.some(t=>e.endsWith(t))}function un(e){return ne(e).filter(t=>Jt(t.path)).map(t=>t.path.slice(11).replace(/\.mdx?$/,""))}function Ut(e,t){let s=`references/${t.replace(/^\.\//,"")}`,n=new Set([s,...Lt.map(r=>s+r)]),a=ne(e).find(r=>Jt(r.path)&&n.has(r.path));if(!a)throw new U(`no page "${t}" in skill ${e.name} (pages: ${un(e).join(", ")})`);return {page:a.path.slice(11).replace(/\.mdx?$/,""),path:a.path,content:a.content}}var ae=["claude","codex","cursor","copilot","gemini","opencode","agents"];function me(e,t=process.env){if(e==="opencode"){let s=t.XDG_CONFIG_HOME!==void 0&&t.XDG_CONFIG_HOME!==""?t.XDG_CONFIG_HOME:join(homedir(),".config");return join(s,"opencode","skills")}return join(homedir(),`.${e}`,"skills")}function cn(e){let t=e;for(;!existsSync(t);){let s=dirname(t);if(s===t)break;t=s;}return t}function Ft(e,t,s){let n=se(e,De).content,a=[],r=[];for(let o of t){let i=join(o.skillsDir,De,"SKILL.md"),l=cn(i);if(l===i){if(!Rt(i)){r.push(`${i} is a directory, not a file`);continue}let c=readFileSync(i,"utf8")===n;!c&&!s&&r.push(`${i} exists with different content; pass --force to overwrite it`),a.push({destination:o,path:i,write:!c});}else pe(l)?a.push({destination:o,path:i,write:true}):r.push(`${l} is a file, so ${i} cannot be created`);}if(r.length>0)throw new U(r.join(`
3
- `));return a.map(({destination:o,path:i,write:l})=>(l&&(mkdirSync(dirname(i),{recursive:true}),writeFileSync(i,n)),{target:o.target,path:i,status:l?"written":"unchanged"}))}var p=class extends Error{constructor(t){super(t),this.name="CliUsageError";}},et={json:{kind:"boolean",help:"Machine-readable JSON output"},"api-key":{kind:"string",value:"<key>",help:"API key",default:"$EVOLVE_API_KEY"},"base-url":{kind:"string",value:"<url>",help:"API base URL",default:"the Evolve dashboard API"}},I={limit:{kind:"number",short:"l",value:"<n>",help:"Page size",group:"Paging"},cursor:{kind:"string",value:"<c>",help:"Resume from a page cursor",group:"Paging"},columns:{kind:"string",value:"<keys|all|help>",help:"Choose and order columns; 'help' lists them",group:"Output"},quiet:{kind:"boolean",short:"q",help:"Print only ids, one per line",group:"Output"},"no-trunc":{kind:"boolean",help:"Full cell content instead of one-line truncation",group:"Output"},"no-headers":{kind:"boolean",help:"Omit the header row in piped output",group:"Output"}},Fe={kind:"string",value:"<my|shared>",help:"What you created, or your organizations' rows that teammates created",default:"my",group:"Filter"},Me="An analysis id, or its unambiguous prefix, names that run. A trial id, or its prefix, names the trial's latest analysis, the one `trial show` prints on its analysis row. A prefix matching both an analysis and a trial is refused as ambiguous.",he={kind:"number",value:"<n>",help:"Skip the first N events; to resume, pass the count you already hold",group:"Selection"},bs={config:{kind:"string",short:"c",value:"<path>",help:"Job config file, YAML or JSON; flags override its fields",group:"Config"},"print-config":{kind:"boolean",help:"Print the resolved job body as JSON and exit",group:"Config"},"job-name":{kind:"string",value:"<name>",help:"Label for the job",default:"generated",group:"Job"},"n-attempts":{kind:"number",short:"k",value:"<n>",help:"Attempts per task and arm",default:"1",group:"Job"},"n-concurrent":{kind:"number",short:"n",value:"<n>",help:"Parallel trials",default:"4",group:"Job"},yes:{kind:"boolean",short:"y",help:"Accepted for compatibility; a hosted run has nothing to confirm",group:"Job"},dataset:{kind:"repeat",short:"d",value:"<name[@version]>",help:"Dataset to run; repeatable; a bare name is the active version",group:"Datasets"},"include-task-name":{kind:"repeat",short:"i",value:"<glob>",help:"Only tasks matching the glob, in every dataset; repeatable",group:"Datasets"},"exclude-task-name":{kind:"repeat",short:"x",value:"<glob>",help:"Skip tasks matching the glob, in every dataset; repeatable",group:"Datasets"},"n-tasks":{kind:"number",short:"l",value:"<n>",help:"Cap the task count of each dataset, after the filters",group:"Datasets"},agent:{kind:"string",short:"a",value:"<name[@version]>",help:"Agent harness, built-in or registered",group:"Agent"},model:{kind:"repeat",short:"m",value:"<name>",help:"Model; repeatable, one arm per model",group:"Agent"},effort:{kind:"string",value:"<value>",help:"Reasoning effort for every arm; an agent that cannot honor it is refused",default:"the agent's own",group:"Agent"},preset:{kind:"string",value:"<name>",help:"Settings preset for every arm: no-internet or pinned-context",group:"Agent"},ak:{kind:"repeat",aliases:["agent-kwarg"],value:"key=value",help:"Agent kwarg for every arm; repeatable; config=<path|JSON> is the native settings file",group:"Agent"},skill:{kind:"repeat",aliases:["skills"],value:"<ref|path>",help:"Skill for every arm; repeatable: skills.sh/<owner>/<repo>[/<skill>], org/repo[@ref], a git URL, upload:<id>, name:<skill-name>, or a local folder",group:"Agent"},"verifier-env":{kind:"repeat",aliases:["ve"],value:"KEY=VALUE",help:"Env for every verifier run; repeatable; only REWARDKIT_JUDGE and REWARDKIT_MODEL",group:"Verifier"},secret:{kind:"repeat",value:"NAME[@LABEL][=ENVNAME]",help:"Attach a stored env secret to every agent run; repeatable; @LABEL picks a row, =ENVNAME renames it",group:"Secrets"},"secret-inline":{kind:"repeat",value:"NAME[@LABEL]:DELIVERY=VALUE",help:"Store VALUE as an env secret and attach it in one step; repeatable; DELIVERY is brokered or direct",group:"Secrets"},"max-trial-spend":{kind:"number",value:"<usd>",help:"Model-spend cap for each trial, in USD",default:"200",group:"Spend and retries"},"max-retries":{kind:"number",short:"r",value:"<n>",help:"Automatic retries per trial on infrastructure errors; 0 turns them off",default:"2, the platform default",group:"Spend and retries"},"retry-include":{kind:"repeat",value:"<exception>",help:"Exception types to retry on; repeatable",default:"everything --retry-exclude admits",group:"Spend and retries"},"retry-exclude":{kind:"repeat",value:"<exception>",help:"Exception types never retried; repeatable; wins over --retry-include",default:"Harbor's non-retryable set",group:"Spend and retries"},analyze:{kind:"boolean",help:"Analyze each trial's trace against a rubric as it settles",group:"Analysis"},"analyze-model":{kind:"string",value:"<name>",help:"Model for the analyzer; implies --analyze",default:"the analyze default",group:"Analysis"},"analyze-rubric":{kind:"string",value:"<path>",help:"Rubric file for the analyzer, TOML, YAML or JSON; implies --analyze",default:"the built-in rubric",group:"Analysis"},"analyze-prompt":{kind:"string",value:"<path>",help:"Prompt file for the analyzer, replacing the built-in prompt; implies --analyze",group:"Analysis"},"analyze-provider":{kind:"string",value:"<provider>",help:"Sandbox provider for the analyzer; implies --analyze",default:"the analysis default",group:"Analysis"},"analyze-effort":{kind:"string",value:"<value>",help:"Reasoning effort for the analyzer; implies --analyze",default:"the model's own",group:"Analysis"},"timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for every task timeout, this job only",default:"1.0",group:"Timeouts"},"agent-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the agent execution timeout; overrides --timeout-multiplier",group:"Timeouts"},"verifier-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the verifier timeout; overrides --timeout-multiplier",group:"Timeouts"},"agent-setup-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the agent setup timeout; overrides --timeout-multiplier",group:"Timeouts"},"environment-build-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the environment build timeout; overrides --timeout-multiplier",group:"Timeouts"},env:{kind:"string",short:"e",value:"<provider>",help:"Sandbox provider: e2b, daytona or modal",default:"daytona",group:"Environment"},watch:{kind:"boolean",help:"Stream the job's events until it finishes",group:"Output"},quiet:{kind:"boolean",short:"q",help:"With --watch, print only the final block",group:"Output"}};function ws(e){return [`${e} -d terminal-bench-4@4.0 -a codex -m gpt-6-astra -l 5 --watch`,`${e} \\
2
+ import {X as X$1,W,da as da$1,ya as ya$1,I as I$1,La as La$1,Ka as Ka$1,Ea as Ea$1,Fa as Fa$1,Da as Da$1,ha as ha$1,Ja as Ja$1,Ia as Ia$1,Ha as Ha$1,ba as ba$1,Ga as Ga$1,ua as ua$1,ta as ta$1,sa as sa$1,Aa as Aa$1,ca as ca$1,V as V$1,ka as ka$1,ia as ia$1,ja as ja$1,aa as aa$1,T as T$1,U,Y,la as la$1,xa as xa$1,wa as wa$1,va as va$1}from'../chunk-N2LMMVL4.js';import'../chunk-HQJI3HHU.js';import'../chunk-5GVMBEYI.js';import {realpathSync,readFileSync,existsSync,mkdirSync,writeFileSync,statSync,readdirSync}from'fs';import {join,resolve,dirname,relative,sep}from'path';import {fileURLToPath,pathToFileURL}from'url';import {LineCounter,parseDocument,parse as parse$1}from'yaml';import {parse}from'smol-toml';import {homedir}from'os';var ze="evolve",fn="evolve-agents",qe="EVOLVE_SKILLS_DIR",Dt="evolve-",pn=["references","templates"],qt=[".mdx",".md"],F=class extends Error{constructor(t){super(t),this.name="SkillsError";}};function ke(e){try{return statSync(e).isDirectory()}catch{return false}}function zt(e){try{return statSync(e).isFile()}catch{return false}}function gn(e,t){return relative(e,t).split(sep).join("/")}function mn(e){let t=[],s=n=>{for(let a of readdirSync(n,{withFileTypes:true})){let r=join(n,a.name);a.isDirectory()?s(r):a.isFile()&&t.push(r);}};return ke(e)&&s(e),t.sort()}function re(e,t=process.env){let s=t[qe];if(s!==void 0&&s!==""){if(!ke(s))throw new F(`${qe} points at nothing: ${s}`);return resolve(s)}for(let n of [join(e,"skills"),join(e,"..","..","skills")])if(ke(n))return resolve(n);throw new F(`skills directory not found; set ${qe} or reinstall @evolvingmachines/evolve`)}function hn(e){let t=join(e,"SKILL.md"),s=readFileSync(t,"utf8"),n=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(s),a=n?s.slice(n[0].length).replace(/^\r?\n+/,""):s,r=null;if(n)try{r=parse$1(n[1]);}catch(c){throw new F(`${t}: front matter does not parse (${c.message})`)}let i=r!==null&&typeof r=="object"&&typeof r.description=="string"?r.description.replace(/\s+/g," ").trim():"",o=e.slice(e.lastIndexOf(sep)+1);return {name:o.startsWith(Dt)?o.slice(Dt.length):o,dir:e,description:i,content:s,body:a}}function Ve(e){return readdirSync(e,{withFileTypes:true}).filter(t=>t.isDirectory()&&t.name!==fn&&zt(join(e,t.name,"SKILL.md"))).map(t=>hn(join(e,t.name))).sort((t,s)=>t.name.localeCompare(s.name))}function be(e){return Ve(e).filter(t=>t.name!==ze)}function Kt(e,t){return Ve(e).some(s=>s.name===t)}function ie(e,t){let s=Ve(e).find(n=>n.name===t);if(!s){let n=be(e).map(a=>a.name);throw new F(`unknown skill "${t}" (skills: ${n.join(", ")})`)}return s}function oe(e){return pn.flatMap(t=>mn(join(e.dir,t)).map(s=>({path:gn(e.dir,s),content:readFileSync(s,"utf8")})))}function Vt(e){return e.startsWith("references/")&&qt.some(t=>e.endsWith(t))}function yn(e){return oe(e).filter(t=>Vt(t.path)).map(t=>t.path.slice(11).replace(/\.mdx?$/,""))}function Gt(e,t){let s=`references/${t.replace(/^\.\//,"")}`,n=new Set([s,...qt.map(r=>s+r)]),a=oe(e).find(r=>Vt(r.path)&&n.has(r.path));if(!a)throw new F(`no page "${t}" in skill ${e.name} (pages: ${yn(e).join(", ")})`);return {page:a.path.slice(11).replace(/\.mdx?$/,""),path:a.path,content:a.content}}var le=["claude","codex","cursor","copilot","gemini","opencode","agents"];function we(e,t=process.env){if(e==="opencode"){let s=t.XDG_CONFIG_HOME!==void 0&&t.XDG_CONFIG_HOME!==""?t.XDG_CONFIG_HOME:join(homedir(),".config");return join(s,"opencode","skills")}return join(homedir(),`.${e}`,"skills")}function kn(e){let t=e;for(;!existsSync(t);){let s=dirname(t);if(s===t)break;t=s;}return t}function Ht(e,t,s){let n=ie(e,ze).content,a=[],r=[];for(let i of t){let o=join(i.skillsDir,ze,"SKILL.md"),l=kn(o);if(l===o){if(!zt(o)){r.push(`${o} is a directory, not a file`);continue}let c=readFileSync(o,"utf8")===n;!c&&!s&&r.push(`${o} exists with different content; pass --force to overwrite it`),a.push({destination:i,path:o,write:!c});}else ke(l)?a.push({destination:i,path:o,write:true}):r.push(`${l} is a file, so ${o} cannot be created`);}if(r.length>0)throw new F(r.join(`
3
+ `));return a.map(({destination:i,path:o,write:l})=>(l&&(mkdirSync(dirname(o),{recursive:true}),writeFileSync(o,n)),{target:i.target,path:o,status:l?"written":"unchanged"}))}var p=class extends Error{constructor(t){super(t),this.name="CliUsageError";}},ot={json:{kind:"boolean",help:"Machine-readable JSON output"},"api-key":{kind:"string",value:"<key>",help:"API key",default:"$EVOLVE_API_KEY"},"base-url":{kind:"string",value:"<url>",help:"API base URL",default:"the Evolve dashboard API"}},I={limit:{kind:"number",short:"l",value:"<n>",help:"Page size",group:"Paging"},cursor:{kind:"string",value:"<c>",help:"Resume from a page cursor",group:"Paging"},columns:{kind:"string",value:"<keys|all|help>",help:"Choose and order columns; 'help' lists them",group:"Output"},quiet:{kind:"boolean",short:"q",help:"Print only ids, one per line",group:"Output"},"no-trunc":{kind:"boolean",help:"Full cell content instead of one-line truncation",group:"Output"},"no-headers":{kind:"boolean",help:"Omit the header row in piped output",group:"Output"}},Ge={kind:"string",value:"<my|shared>",help:"What you created, or your organizations' rows that teammates created",default:"my",group:"Filter"},He="An analysis id, or its unambiguous prefix, names that run. A trial id, or its prefix, names the trial's latest analysis, the one `trial show` prints on its analysis row. A prefix matching both an analysis and a trial is refused as ambiguous.",ve={kind:"number",value:"<n>",help:"Skip the first N events; to resume, pass the count you already hold",group:"Selection"},Os={config:{kind:"string",short:"c",value:"<path>",help:"Job config file, YAML or JSON; flags override its fields",group:"Config"},"print-config":{kind:"boolean",help:"Print the resolved job body as JSON and exit",group:"Config"},"job-name":{kind:"string",value:"<name>",help:"Label for the job",default:"generated",group:"Job"},"n-attempts":{kind:"number",short:"k",value:"<n>",help:"Attempts per task and arm",default:"1",group:"Job"},"n-concurrent":{kind:"number",short:"n",value:"<n>",help:"Parallel trials",default:"4",group:"Job"},yes:{kind:"boolean",short:"y",help:"Accepted for compatibility; a hosted run has nothing to confirm",group:"Job"},dataset:{kind:"repeat",short:"d",value:"<name[@version]>",help:"Dataset to run; repeatable; a bare name is the active version",group:"Datasets"},"include-task-name":{kind:"repeat",short:"i",value:"<glob>",help:"Only tasks matching the glob, in every dataset; repeatable",group:"Datasets"},"exclude-task-name":{kind:"repeat",short:"x",value:"<glob>",help:"Skip tasks matching the glob, in every dataset; repeatable",group:"Datasets"},"n-tasks":{kind:"number",short:"l",value:"<n>",help:"Cap the task count of each dataset, after the filters",group:"Datasets"},agent:{kind:"string",short:"a",value:"<name[@version]>",help:"Agent harness, built-in or registered",group:"Agent"},model:{kind:"repeat",short:"m",value:"<name>",help:"Model; repeatable, one arm per model",group:"Agent"},effort:{kind:"string",value:"<value>",help:"Reasoning effort for every arm; an agent that cannot honor it is refused",default:"the agent's own",group:"Agent"},preset:{kind:"string",value:"<name>",help:"Settings preset for every arm: no-internet or pinned-context",group:"Agent"},ak:{kind:"repeat",aliases:["agent-kwarg"],value:"key=value",help:"Agent kwarg for every arm; repeatable; config=<path|JSON> is the native settings file",group:"Agent"},skill:{kind:"repeat",aliases:["skills"],value:"<ref|path>",help:"Skill for every arm; repeatable: skills.sh/<owner>/<repo>[/<skill>], org/repo[@ref], a git URL, upload:<id>, name:<skill-name>, or a local folder",group:"Agent"},"verifier-env":{kind:"repeat",aliases:["ve"],value:"KEY=VALUE",help:"Env for every verifier run; repeatable; only REWARDKIT_JUDGE and REWARDKIT_MODEL",group:"Verifier"},secret:{kind:"repeat",value:"NAME[@LABEL][=ENVNAME]",help:"Attach a stored env secret to every agent run; repeatable; @LABEL picks a row, =ENVNAME renames it",group:"Secrets"},"secret-inline":{kind:"repeat",value:"NAME[@LABEL]:DELIVERY=VALUE",help:"Store VALUE as an env secret and attach it in one step; repeatable; DELIVERY is brokered or direct",group:"Secrets"},"max-trial-spend":{kind:"number",value:"<usd>",help:"Model-spend cap for each trial, in USD",default:"200",group:"Spend and retries"},"max-retries":{kind:"number",short:"r",value:"<n>",help:"Automatic retries per trial on infrastructure errors; 0 turns them off",default:"2, the platform default",group:"Spend and retries"},"retry-include":{kind:"repeat",value:"<exception>",help:"Exception types to retry on; repeatable",default:"everything --retry-exclude admits",group:"Spend and retries"},"retry-exclude":{kind:"repeat",value:"<exception>",help:"Exception types never retried; repeatable; wins over --retry-include",default:"Harbor's non-retryable set",group:"Spend and retries"},"system-log":{kind:"boolean",help:"Record the box's own system log stream beside agent and verifier (read it back with `trial logs --stream system`)",group:"Job"},analyze:{kind:"boolean",help:"Analyze each trial's trace against a rubric as it settles",group:"Analysis"},"analyze-model":{kind:"string",value:"<name>",help:"Model for the analyzer; implies --analyze",default:"the analyze default",group:"Analysis"},"analyze-rubric":{kind:"string",value:"<path>",help:"Rubric file for the analyzer, TOML, YAML or JSON; implies --analyze",default:"the built-in rubric",group:"Analysis"},"analyze-prompt":{kind:"string",value:"<path>",help:"Prompt file for the analyzer, replacing the built-in prompt; implies --analyze",group:"Analysis"},"analyze-provider":{kind:"string",value:"<provider>",help:"Sandbox provider for the analyzer; implies --analyze",default:"the analysis default",group:"Analysis"},"analyze-effort":{kind:"string",value:"<value>",help:"Reasoning effort for the analyzer; implies --analyze",default:"the model's own",group:"Analysis"},"timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for every task timeout, this job only",default:"1.0",group:"Timeouts"},"agent-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the agent execution timeout; overrides --timeout-multiplier",group:"Timeouts"},"verifier-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the verifier timeout; overrides --timeout-multiplier",group:"Timeouts"},"agent-setup-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the agent setup timeout; overrides --timeout-multiplier",group:"Timeouts"},"environment-build-timeout-multiplier":{kind:"number",value:"<x>",help:"Multiplier for the environment build timeout; overrides --timeout-multiplier",group:"Timeouts"},env:{kind:"string",short:"e",value:"<provider>",help:"Sandbox provider: e2b, daytona or modal",default:"daytona",group:"Environment"},watch:{kind:"boolean",help:"Stream the job's events until it finishes",group:"Output"},quiet:{kind:"boolean",short:"q",help:"With --watch, print only the final block",group:"Output"}};function Ps(e){return [`${e} -d terminal-bench-4@4.0 -a codex -m gpt-6-astra -l 5 --watch`,`${e} \\
4
4
  -d deep-swe@1.1 \\
5
5
  -a claude -m fable \\
6
6
  --skills skills.sh/acme/skills/pdf \\
7
7
  --secret GITHUB_TOKEN \\
8
8
  -k 2 -n 8 \\
9
- --analyze --watch`,`${e} -c job.yaml --print-config`]}var yn="evolve skills get evals sdk-reference/errors",H={skills:{summary:"The skills the CLI serves to coding agents",notes:"The skills ship with the CLI and match its version. `skills get evals` is the index of the documentation and `skills get evals <page>` one page of it; the `evolve` pointer skill that `skills install` writes is served but never listed. EVOLVE_SKILLS_DIR names another skills directory to serve.",defaultVerb:"list",commands:{list:{summary:"List the skills the installed version serves",flags:{},minPositionals:0,maxPositionals:0,examples:["evolve skills","evolve skills list --json"]},get:{summary:"Print one or more skills, or one reference page",notes:"A second word that is not a skill name is a page of the first skill: its path under references/ without the suffix, as the docs site spells it (`core-concepts/tasks`).",flags:{full:{kind:"boolean",help:"Also print every file under references/ and templates/, each behind a `--- <path> ---` line"},all:{kind:"boolean",help:"Every skill, instead of naming them"}},minPositionals:0,maxPositionals:1/0,positionalUsage:"<name> [name...] | <name> <page>",examples:["evolve skills get evals","evolve skills get evals core-concepts/tasks","evolve skills get create-task --full"]},path:{summary:"Print the skills directory, or one skill's folder",flags:{},minPositionals:0,maxPositionals:1,positionalUsage:"[name]",examples:["evolve skills path","evolve skills path evals"]},install:{summary:"Install the evolve pointer skill for your agents",notes:"Each target gets <folder>/evolve/SKILL.md; the path written is printed. A file already there with different content is left alone unless --force.",flags:{target:{kind:"string",value:`<${[...ae,"all"].join("|")}>`,help:"Which agent home: ~/.claude, ~/.codex, ~/.cursor, ~/.copilot, ~/.gemini, ~/.config/opencode or ~/.agents, each under skills/",default:"all",group:"Destination"},path:{kind:"string",value:"<dir>",help:"A skills directory of your own instead of --target",group:"Destination"},force:{kind:"boolean",help:"Overwrite an installed SKILL.md whose content differs"}},minPositionals:0,maxPositionals:0,examples:["evolve skills install","evolve skills install --target claude","evolve skills install --path ./skills"]}}},job:{summary:"Start, follow, and derive jobs",commands:{start:{summary:"Start a job",flags:bs,minPositionals:0,maxPositionals:0,examples:ws("evolve job start")},list:{summary:"List your jobs, newest first",flags:{...I,search:{kind:"string",value:"<text>",help:"Free-text filter over job name and dataset names",group:"Filter"},scope:Fe},minPositionals:0,maxPositionals:0,examples:["evolve job list","evolve job list --scope shared --search deep-swe","evolve job list -l 20 -q"]},show:{summary:"Show one or more jobs in full",flags:{},minPositionals:1,maxPositionals:1/0,positionalUsage:"<id> [id...]",examples:["evolve job show 3e1f9a2c","evolve job show 3e1f9a2c 9b7d4e10 --json"]},trials:{summary:"List a job's trials",flags:{...I,status:{kind:"string",value:"<s1,s2,...>",help:"Only trials in these statuses",group:"Filter"},dataset:{kind:"string",value:"<name>",help:"Only one dataset's trials",group:"Filter"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job trials 3e1f9a2c","evolve job trials 3e1f9a2c --status INFRASTRUCTURE_ERROR,SCORING_ERROR"]},tasks:{summary:"Show a job's per-task rollup",flags:{...I},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job tasks 3e1f9a2c"]},compare:{summary:"Compare 2 to 10 jobs side by side",flags:{},minPositionals:2,maxPositionals:10,positionalUsage:"<id> <id> [...]",examples:["evolve job compare 3e1f9a2c 9b7d4e10"]},cancel:{summary:"Cancel a job",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job cancel 3e1f9a2c"]},delete:{summary:"Delete a job you created, with everything it stored",flags:{yes:{kind:"boolean",short:"y",help:"Delete without a confirmation prompt"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job delete 3e1f9a2c","evolve job delete 3e1f9a2c --yes"]},stop:{summary:"Stop one dataset's live trials, keeping the job",flags:{dataset:{kind:"string",value:"<name>",help:"The dataset whose live trials to stop; required"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job stop 3e1f9a2c --dataset deep-swe"]},resume:{summary:"Start a linked job over failed or stopped trials",flags:{"filter-error-type":{kind:"repeat",short:"f",value:"<type>",help:"Failure types to resume, by exception type; repeatable",default:"the standard failure set plus stopped trials"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job resume 3e1f9a2c","evolve job resume 3e1f9a2c -f InfrastructureError"]},retry:{summary:"Start a linked job re-running chosen trials",notes:"Without a flag every trial runs again. --failed-only and --trial do not combine.",flags:{"failed-only":{kind:"boolean",help:"Only failed trials: SCORING_ERROR, INFRASTRUCTURE_ERROR, BUDGET, INDETERMINATE",group:"Selection"},trial:{kind:"repeat",short:"t",value:"<trial-id>",help:"Exactly this settled trial; repeatable, all or nothing",group:"Selection"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job retry 3e1f9a2c --failed-only","evolve job retry 3e1f9a2c -t d1a10c4e -t d1a10f72"]},regrade:{summary:"Re-run only the verifier over a finished job",notes:"The result is a new job linked to the source; the source is never changed.",flags:{status:{kind:"string",value:"<s1,s2,...>",help:"Only source trials in these statuses",group:"Selection"},task:{kind:"string",value:"<name>",help:"Only source trials of this task",group:"Selection"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job regrade 3e1f9a2c","evolve job regrade 3e1f9a2c --task tricky-task"]},imports:{summary:"List your job uploads, newest first",flags:{...I,status:{kind:"string",value:"<QUEUED|RUNNING|COMPLETED|FAILED>",help:"Only uploads in this status",group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve job imports","evolve job imports --status RUNNING"]},import:{summary:"Show one job upload, or follow it with --watch",flags:{watch:{kind:"boolean",help:"Poll until the upload is COMPLETED, printing the job, or FAILED"}},minPositionals:1,maxPositionals:1,positionalUsage:"<import-id>",examples:["evolve job import cmfl2q8r30001v4kx9zd1h7wa --watch"]},download:{summary:"Download a job as a Harbor job directory",notes:"The tree lands in <dir>/job-<id>/, with an evolve.json record beside each Harbor file.",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to unpack into",default:"the current directory"},overwrite:{kind:"boolean",help:"Replace an existing <dir>/job-<id>/"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job download 3e1f9a2c -o results/"]},grep:{summary:"Search every trial's trace for a pattern",flags:{type:{kind:"string",value:"<event-type>",help:"Only events of exactly this type",group:"Selection"},limit:{kind:"number",short:"l",value:"<n>",help:"Per-trial match groups per page, at most 200",default:"50",group:"Paging"},cursor:{kind:"string",value:"<c>",help:"Resume after this trial id, the previous page's nextCursor",group:"Paging"}},minPositionals:2,maxPositionals:2,positionalUsage:"<id> <pattern>",examples:["evolve job grep 3e1f9a2c 'permission denied'","evolve job grep 3e1f9a2c 'rm -rf' --type tool_call"]}}},trial:{summary:"Inspect, download, and act on single trials",commands:{show:{summary:"Show one trial in full",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial show d1a10c4e"]},trace:{summary:"Print a trial's parsed trace",flags:{type:{kind:"string",value:"<event-type>",help:"Only events of exactly this type",group:"Selection"},grep:{kind:"string",value:"<pattern>",help:"Only events matching this case-insensitive regex over type and content",group:"Selection"},tail:{kind:"number",value:"<n>",help:"Only the last N matching events",group:"Selection"},cursor:{kind:"string",value:"<seq>",help:"Resume after this seq",group:"Paging"},limit:{kind:"number",short:"l",value:"<n>",help:"Events per page, at most 1000",default:"200",group:"Paging"}},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial trace d1a10c4e","evolve trial trace d1a10c4e --grep 'permission denied' --tail 50"]},download:{summary:"Save a trial's tree, or stream one artifact",notes:"The tree is Harbor's trial directory, with an evolve.json record, under <dir>/<trial-id>/.",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save under",default:"trials/",group:"Save"},overwrite:{kind:"boolean",help:"Replace an existing <dir>/<trial-id>/",group:"Save"},stream:{kind:"string",value:"<artifact>",help:"Print one artifact to stdout instead: trace-parsed, verifier, trace-stdout, trace-stderr, trace-atif (the ATIF trajectory), trajectory (reserved: the harness-native session file) or agent-home",group:"Stream"},cursor:{kind:"string",value:"<seq>",help:"With --stream trace-parsed: resume after this seq",group:"Stream"},limit:{kind:"number",value:"<n>",help:"With --stream trace-parsed: max events per page",group:"Stream"}},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial download d1a10c4e -o trials/","evolve trial download d1a10c4e --stream trace-stdout"]},retry:{summary:"Run one settled trial again, as a new job",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial retry d1a10c4e"]},regrade:{summary:"Re-run only the verifier over one trial, as a new job",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial regrade d1a10c4e"]},stop:{summary:"Stop running trials, keeping their job",flags:{},minPositionals:1,maxPositionals:1/0,positionalUsage:"<trial-id> [trial-id...]",examples:["evolve trial stop d1a10c4e d1a10f72"]}}},analysis:{summary:"List, inspect, and download trace analyses",commands:{list:{summary:"List analysis runs, newest first",flags:{...I,scope:Fe,job:{kind:"string",value:"<job-id>",help:"Only analyses of this job's trials; a prefix works",group:"Filter"},status:{kind:"string",value:"<s1,s2,...>",help:`Only these statuses: ${W$1.join(", ")}`,group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve analysis list","evolve analysis list --job 3e1f9a2c --status failed"]},show:{summary:"Show one analysis run: the verdict",notes:Me,flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id | trial-id>",examples:["evolve analysis show a0a1b2c3","evolve analysis show d1a10c4e"]},trace:{summary:"Print the analyzer's own transcript",notes:Me,flags:{since:he},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id | trial-id>",examples:["evolve analysis trace a0a1b2c3","evolve analysis trace a0a1b2c3 --since 200"]},download:{summary:"Save an analysis run, or stream one artifact",notes:Me,flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save the run's trial folder under",default:"analyses/",group:"Save"},overwrite:{kind:"boolean",help:"Replace an existing folder of the same name",group:"Save"},stream:{kind:"string",value:"<artifact>",help:"Print one artifact to stdout instead: analysis (the verdict), trace-parsed, trace-stdout, trace-stderr or agent-home",group:"Stream"},since:{...he,help:"With --stream trace-parsed: skip the first N events",group:"Stream"}},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id | trial-id>",examples:["evolve analysis download a0a1b2c3 -o analyses/","evolve analysis download a0a1b2c3 --stream trace-stdout"]}}},check:{summary:"Read task quality checks back",commands:{list:{summary:"List your task quality checks, newest first",flags:{...I,scope:Fe,status:{kind:"string",value:"<s1,s2,...>",help:`Only these statuses: ${X$1.join(", ")}`,group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve check list","evolve check list --status running"]},show:{summary:"Show one check: Harbor's check report, one row per task",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<check-id>",examples:["evolve check show 5f2c9b1e"]},trace:{summary:"Print the checker's transcript for one task check",flags:{since:he},minPositionals:1,maxPositionals:1,positionalUsage:"<task-check-id>",examples:["evolve check trace 7c1d2e3f","evolve check trace 7c1d2e3f --since 200"]},download:{summary:"Save a check, one task check, or stream an artifact",notes:"A check id saves Harbor's check job folder, check_report.json and one folder per task, under <dir>/check-<id>/. A task check id saves that task's folder alone.",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save under",default:"checks/",group:"Save"},overwrite:{kind:"boolean",help:"Replace an existing folder of the same name",group:"Save"},stream:{kind:"string",value:"<artifact>",help:"Print one artifact of a task check to stdout instead: task-check (the result), trace-parsed, trace-stdout, trace-stderr or agent-home",group:"Stream"},since:{...he,help:"With --stream trace-parsed: skip the first N events",group:"Stream"}},minPositionals:1,maxPositionals:1,positionalUsage:"<check-id | task-check-id>",examples:["evolve check download 3f9a1c2e -o checks/","evolve check download 7c1d2e3f --stream trace-stdout"]}}},session:{summary:"List and inspect managed-agent sessions",commands:{list:{summary:"List your sessions, newest first",flags:{...I,state:{kind:"string",value:"<live|ended>",help:"Only live or only ended sessions",group:"Filter"},agent:{kind:"string",value:"<name>",help:"Only sessions of this agent harness",group:"Filter"},"tag-prefix":{kind:"string",value:"<prefix>",help:"Only sessions whose tag starts with this prefix",group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve session list","evolve session list --state ended --tag-prefix qa- -q"]},show:{summary:"Show one session in full",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<session-id>",examples:["evolve session show 5f2c1a0e"]}}},dataset:{summary:"Browse and publish the dataset catalog",commands:{list:{summary:"List the dataset catalog",flags:{...I,search:{kind:"string",value:"<text>",help:"Free-text filter over name and description",group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve dataset list","evolve dataset list --search swe -q"]},show:{summary:"Show a dataset's versions, tasks and providers",flags:{limit:{kind:"number",short:"l",value:"<n>",help:"Task-list page size",group:"Paging"},cursor:{kind:"string",value:"<c>",help:"Resume the task list from a cursor",group:"Paging"}},minPositionals:1,maxPositionals:1,positionalUsage:"<name[@version]>",examples:["evolve dataset show terminal-bench-4@4.0"]},check:{summary:"Pre-flight a local corpus without uploading anything",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<dir>",examples:["evolve dataset check ./corpus"]},publish:{summary:"Publish a dataset version",notes:"One source per publish: a pinned git ref, a local directory, or a public tarball or Harbor hub package. --name and --version are required with --git and with --from <url>; a local dataset.toml or a hub package can supply them.",flags:{git:{kind:"string",value:"<url>",help:"Git repository URL, with --ref",group:"Source"},ref:{kind:"string",value:"<ref>",help:"Pinned git ref, a full commit sha or a tag; a branch is refused",group:"Source"},path:{kind:"string",value:"<subfolder>",help:"Repository subfolder holding the corpus, with --git",group:"Source"},dir:{kind:"string",value:"<path>",help:"Local corpus directory, pre-flighted then uploaded",group:"Source"},from:{kind:"string",value:"<url|hub:org/name[@ref]>",help:"A public https tarball URL, or a public Harbor hub package",group:"Source"},name:{kind:"string",value:"<dataset>",help:"Catalog dataset name to create or extend",group:"Version"},version:{kind:"string",value:"<v>",help:"Version label for the published version",group:"Version"},watch:{kind:"boolean",help:"Poll until the version is READY or FAILED",group:"Output"},"skip-preflight":{kind:"boolean",help:"Upload a --dir without the pre-flight check",group:"Source"}},minPositionals:0,maxPositionals:0,examples:["evolve dataset publish --from hub:cookbook/hello-world --watch","evolve dataset publish --dir ./corpus --name my-swe --version 1.0 --watch",`evolve dataset publish \\
9
+ --analyze --watch`,`${e} -c job.yaml --print-config`]}var xn="evolve skills get evals sdk-reference/errors",Q={skills:{summary:"The skills the CLI serves to coding agents",notes:"The skills ship with the CLI and match its version. `skills get evals` is the index of the documentation and `skills get evals <page>` one page of it; the `evolve` pointer skill that `skills install` writes is served but never listed. EVOLVE_SKILLS_DIR names another skills directory to serve.",defaultVerb:"list",commands:{list:{summary:"List the skills the installed version serves",flags:{},minPositionals:0,maxPositionals:0,examples:["evolve skills","evolve skills list --json"]},get:{summary:"Print one or more skills, or one reference page",notes:"A second word that is not a skill name is a page of the first skill: its path under references/ without the suffix, as the docs site spells it (`core-concepts/tasks`).",flags:{full:{kind:"boolean",help:"Also print every file under references/ and templates/, each behind a `--- <path> ---` line"},all:{kind:"boolean",help:"Every skill, instead of naming them"}},minPositionals:0,maxPositionals:1/0,positionalUsage:"<name> [name...] | <name> <page>",examples:["evolve skills get evals","evolve skills get evals core-concepts/tasks","evolve skills get create-task --full"]},path:{summary:"Print the skills directory, or one skill's folder",flags:{},minPositionals:0,maxPositionals:1,positionalUsage:"[name]",examples:["evolve skills path","evolve skills path evals"]},install:{summary:"Install the evolve pointer skill for your agents",notes:"Each target gets <folder>/evolve/SKILL.md; the path written is printed. A file already there with different content is left alone unless --force.",flags:{target:{kind:"string",value:`<${[...le,"all"].join("|")}>`,help:"Which agent home: ~/.claude, ~/.codex, ~/.cursor, ~/.copilot, ~/.gemini, ~/.config/opencode or ~/.agents, each under skills/",default:"all",group:"Destination"},path:{kind:"string",value:"<dir>",help:"A skills directory of your own instead of --target",group:"Destination"},force:{kind:"boolean",help:"Overwrite an installed SKILL.md whose content differs"}},minPositionals:0,maxPositionals:0,examples:["evolve skills install","evolve skills install --target claude","evolve skills install --path ./skills"]}}},job:{summary:"Start, follow, and derive jobs",commands:{start:{summary:"Start a job",flags:Os,minPositionals:0,maxPositionals:0,examples:Ps("evolve job start")},list:{summary:"List your jobs, newest first",flags:{...I,search:{kind:"string",value:"<text>",help:"Free-text filter over job name and dataset names",group:"Filter"},scope:Ge},minPositionals:0,maxPositionals:0,examples:["evolve job list","evolve job list --scope shared --search deep-swe","evolve job list -l 20 -q"]},show:{summary:"Show one or more jobs in full",flags:{},minPositionals:1,maxPositionals:1/0,positionalUsage:"<id> [id...]",examples:["evolve job show 3e1f9a2c","evolve job show 3e1f9a2c 9b7d4e10 --json"]},trials:{summary:"List a job's trials",flags:{...I,status:{kind:"string",value:"<s1,s2,...>",help:"Only trials in these statuses",group:"Filter"},dataset:{kind:"string",value:"<name>",help:"Only one dataset's trials",group:"Filter"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job trials 3e1f9a2c","evolve job trials 3e1f9a2c --status INFRASTRUCTURE_ERROR,SCORING_ERROR"]},tasks:{summary:"Show a job's per-task rollup",flags:{...I},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job tasks 3e1f9a2c"]},compare:{summary:"Compare 2 to 10 jobs side by side",flags:{},minPositionals:2,maxPositionals:10,positionalUsage:"<id> <id> [...]",examples:["evolve job compare 3e1f9a2c 9b7d4e10"]},cancel:{summary:"Cancel a job",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job cancel 3e1f9a2c"]},delete:{summary:"Delete a job you created, with everything it stored",flags:{yes:{kind:"boolean",short:"y",help:"Delete without a confirmation prompt"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job delete 3e1f9a2c","evolve job delete 3e1f9a2c --yes"]},stop:{summary:"Stop one dataset's live trials, keeping the job",flags:{dataset:{kind:"string",value:"<name>",help:"The dataset whose live trials to stop; required"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job stop 3e1f9a2c --dataset deep-swe"]},resume:{summary:"Start a linked job over failed or stopped trials",flags:{"filter-error-type":{kind:"repeat",short:"f",value:"<type>",help:"Failure types to resume, by exception type; repeatable",default:"the standard failure set plus stopped trials"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job resume 3e1f9a2c","evolve job resume 3e1f9a2c -f InfrastructureError"]},retry:{summary:"Start a linked job re-running chosen trials",notes:"Without a flag every trial runs again. --failed-only and --trial do not combine.",flags:{"failed-only":{kind:"boolean",help:"Only failed trials: SCORING_ERROR, INFRASTRUCTURE_ERROR, BUDGET, INDETERMINATE",group:"Selection"},trial:{kind:"repeat",short:"t",value:"<trial-id>",help:"Exactly this settled trial; repeatable, all or nothing",group:"Selection"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job retry 3e1f9a2c --failed-only","evolve job retry 3e1f9a2c -t d1a10c4e -t d1a10f72"]},regrade:{summary:"Re-run only the verifier over a finished job",notes:"The result is a new job linked to the source; the source is never changed.",flags:{status:{kind:"string",value:"<s1,s2,...>",help:"Only source trials in these statuses",group:"Selection"},task:{kind:"string",value:"<name>",help:"Only source trials of this task",group:"Selection"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job regrade 3e1f9a2c","evolve job regrade 3e1f9a2c --task tricky-task"]},imports:{summary:"List your job uploads, newest first",flags:{...I,status:{kind:"string",value:"<QUEUED|RUNNING|COMPLETED|FAILED>",help:"Only uploads in this status",group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve job imports","evolve job imports --status RUNNING"]},import:{summary:"Show one job upload, or follow it with --watch",flags:{watch:{kind:"boolean",help:"Poll until the upload is COMPLETED, printing the job, or FAILED"}},minPositionals:1,maxPositionals:1,positionalUsage:"<import-id>",examples:["evolve job import cmfl2q8r30001v4kx9zd1h7wa --watch"]},download:{summary:"Download a job as a Harbor job directory",notes:"The tree lands in <dir>/job-<id>/, with an evolve.json record beside each Harbor file.",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to unpack into",default:"the current directory"},overwrite:{kind:"boolean",help:"Replace an existing <dir>/job-<id>/"}},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve job download 3e1f9a2c -o results/"]},grep:{summary:"Search every trial's trace for a pattern",flags:{type:{kind:"string",value:"<event-type>",help:"Only events of exactly this type",group:"Selection"},limit:{kind:"number",short:"l",value:"<n>",help:"Per-trial match groups per page, at most 200",default:"50",group:"Paging"},cursor:{kind:"string",value:"<c>",help:"Resume after this trial id, the previous page's nextCursor",group:"Paging"}},minPositionals:2,maxPositionals:2,positionalUsage:"<id> <pattern>",examples:["evolve job grep 3e1f9a2c 'permission denied'","evolve job grep 3e1f9a2c 'rm -rf' --type tool_call"]}}},trial:{summary:"Inspect, download, and act on single trials",commands:{show:{summary:"Show one trial in full",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial show d1a10c4e"]},trace:{summary:"Print a trial's parsed trace",flags:{type:{kind:"string",value:"<event-type>",help:"Only events of exactly this type",group:"Selection"},grep:{kind:"string",value:"<pattern>",help:"Only events matching this case-insensitive regex over type and content",group:"Selection"},tail:{kind:"number",value:"<n>",help:"Only the last N matching events",group:"Selection"},cursor:{kind:"string",value:"<seq>",help:"Resume after this seq",group:"Paging"},limit:{kind:"number",short:"l",value:"<n>",help:"Events per page, at most 1000",default:"200",group:"Paging"}},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial trace d1a10c4e","evolve trial trace d1a10c4e --grep 'permission denied' --tail 50"]},download:{summary:"Save a trial's tree, or stream one artifact",notes:"The tree is Harbor's trial directory, with an evolve.json record, under <dir>/<trial-id>/.",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save under",default:"trials/",group:"Save"},overwrite:{kind:"boolean",help:"Replace an existing <dir>/<trial-id>/",group:"Save"},stream:{kind:"string",value:"<artifact>",help:"Print one artifact to stdout instead: trace-parsed, verifier, trace-stdout, trace-stderr, trace-atif (the ATIF trajectory), trajectory (reserved: the harness-native session file), agent-home or filesystem (the run's file system as one .tar.gz, raw bytes)",group:"Stream"},cursor:{kind:"string",value:"<seq>",help:"With --stream trace-parsed: resume after this seq",group:"Stream"},limit:{kind:"number",value:"<n>",help:"With --stream trace-parsed: max events per page",group:"Stream"}},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial download d1a10c4e -o trials/","evolve trial download d1a10c4e --stream trace-stdout"]},retry:{summary:"Run one settled trial again, as a new job",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial retry d1a10c4e"]},regrade:{summary:"Re-run only the verifier over one trial, as a new job",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial regrade d1a10c4e"]},stop:{summary:"Stop running trials, keeping their job",flags:{},minPositionals:1,maxPositionals:1/0,positionalUsage:"<trial-id> [trial-id...]",examples:["evolve trial stop d1a10c4e d1a10f72"]},"files status":{summary:"File system source: live, captured or none",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial files status d1a10c4e-\u2026"]},"files list":{summary:"List one folder of the file system (default /)",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},limit:{kind:"number",short:"l",value:"<n>",help:"Entries per page (default 500, max 1000)"},cursor:{kind:"string",value:"<name>",help:"Resume after this entry name (the previous page's next_cursor)"}},minPositionals:1,maxPositionals:2,positionalUsage:"<trial-id> [path]",examples:["evolve trial files ls d1a10c4e-\u2026 /app/work"]},"files cat":{summary:"Print one file, raw bytes",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},range:{kind:"string",value:"<bytes=a-b>",help:"One byte range: bytes=a-b, bytes=a- or bytes=-n"}},minPositionals:2,maxPositionals:2,positionalUsage:"<trial-id> <path>",examples:["evolve trial files cat d1a10c4e-\u2026 /app/work/main.py"]},"files search":{summary:"Search the trial's file system for text",flags:{path:{kind:"string",value:"<path>",help:"Folder to search under (default: /, the whole box \u2014 seconds)"},regex:{kind:"boolean",help:"Treat the text as a regular expression"},limit:{kind:"number",short:"l",value:"<n>",help:"Hit cap (default 200, max 1000)"},source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"}},minPositionals:2,maxPositionals:2,positionalUsage:"<trial-id> <text>",examples:["evolve trial files search d1a10c4e-\u2026 'permission denied' --path /app/work"]},"files changes":{summary:"Files created, modified or removed, by phase",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},phase:{kind:"string",value:"<setup|agent|verifier|all>",help:"Only one phase's changes (default all)"},limit:{kind:"number",short:"l",value:"<n>",help:"Rows per page (default 500, max 1000)"},cursor:{kind:"string",value:"<path>",help:"Resume after this path (the previous page's next_cursor)"}},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial files changes d1a10c4e-\u2026 --phase agent"]},"files archive":{summary:"Download one subtree as a .tar.gz",flags:{path:{kind:"string",value:"<path>",help:"Subtree to archive (default: /, the whole tree)"},source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Save the archive into this directory and print its path (default: raw bytes to stdout)"}},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial files archive d1a10c4e-\u2026 --path /app/work -o archives/"]},logs:{summary:"Read one sandbox log stream of the run",flags:{stream:{kind:"string",value:"<name>",help:"Which stream: agent | verifier | system (when the job asked for it); setup and metrics are named but not recorded today (required)"},follow:{kind:"boolean",short:"f",help:"Keep printing lines as they arrive while the box lives"},limit:{kind:"number",short:"l",value:"<n>",help:"Lines per page (default 1000, max 1000)"},cursor:{kind:"string",value:"<seq>",help:"Resume after this line seq"}},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial logs d1a10c4e-\u2026 --stream agent --follow"]},procs:{summary:"The trial's box process list (live only)",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<trial-id>",examples:["evolve trial procs d1a10c4e-\u2026"]}}},analysis:{summary:"List, inspect, and download trace analyses",commands:{list:{summary:"List analysis runs, newest first",flags:{...I,scope:Ge,job:{kind:"string",value:"<job-id>",help:"Only analyses of this job's trials; a prefix works",group:"Filter"},status:{kind:"string",value:"<s1,s2,...>",help:`Only these statuses: ${W.join(", ")}`,group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve analysis list","evolve analysis list --job 3e1f9a2c --status failed"]},show:{summary:"Show one analysis run: the verdict",notes:He,flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id | trial-id>",examples:["evolve analysis show a0a1b2c3","evolve analysis show d1a10c4e"]},trace:{summary:"Print the analyzer's own transcript",notes:He,flags:{since:ve},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id | trial-id>",examples:["evolve analysis trace a0a1b2c3","evolve analysis trace a0a1b2c3 --since 200"]},download:{summary:"Save an analysis run, or stream one artifact",notes:He,flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save the run's trial folder under",default:"analyses/",group:"Save"},overwrite:{kind:"boolean",help:"Replace an existing folder of the same name",group:"Save"},stream:{kind:"string",value:"<artifact>",help:"Print one artifact to stdout instead: analysis (the verdict), trace-parsed, trace-stdout, trace-stderr or agent-home",group:"Stream"},since:{...ve,help:"With --stream trace-parsed: skip the first N events",group:"Stream"}},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id | trial-id>",examples:["evolve analysis download a0a1b2c3 -o analyses/","evolve analysis download a0a1b2c3 --stream trace-stdout"]},"files status":{summary:"File system source: live, captured or none",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id>",examples:["evolve analysis files status a0a1b2c3-\u2026"]},"files list":{summary:"List one folder of the file system (default /)",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},limit:{kind:"number",short:"l",value:"<n>",help:"Entries per page (default 500, max 1000)"},cursor:{kind:"string",value:"<name>",help:"Resume after this entry name (the previous page's next_cursor)"}},minPositionals:1,maxPositionals:2,positionalUsage:"<analysis-id> [path]",examples:["evolve analysis files ls a0a1b2c3-\u2026 /app/work"]},"files cat":{summary:"Print one file, raw bytes",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},range:{kind:"string",value:"<bytes=a-b>",help:"One byte range: bytes=a-b, bytes=a- or bytes=-n"}},minPositionals:2,maxPositionals:2,positionalUsage:"<analysis-id> <path>",examples:["evolve analysis files cat a0a1b2c3-\u2026 /app/work/main.py"]},"files search":{summary:"Search the analysis run's file system for text",flags:{path:{kind:"string",value:"<path>",help:"Folder to search under (default: /, the whole box \u2014 seconds)"},regex:{kind:"boolean",help:"Treat the text as a regular expression"},limit:{kind:"number",short:"l",value:"<n>",help:"Hit cap (default 200, max 1000)"},source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"}},minPositionals:2,maxPositionals:2,positionalUsage:"<analysis-id> <text>",examples:["evolve analysis files search a0a1b2c3-\u2026 'permission denied' --path /app/work"]},"files changes":{summary:"Files created, modified or removed, by phase",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},phase:{kind:"string",value:"<setup|agent|verifier|all>",help:"Only one phase's changes (default all)"},limit:{kind:"number",short:"l",value:"<n>",help:"Rows per page (default 500, max 1000)"},cursor:{kind:"string",value:"<path>",help:"Resume after this path (the previous page's next_cursor)"}},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id>",examples:["evolve analysis files changes a0a1b2c3-\u2026 --phase agent"]},"files archive":{summary:"Download one subtree as a .tar.gz",flags:{path:{kind:"string",value:"<path>",help:"Subtree to archive (default: /, the whole tree)"},source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Save the archive into this directory and print its path (default: raw bytes to stdout)"}},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id>",examples:["evolve analysis files archive a0a1b2c3-\u2026 --path /app/work -o archives/"]},logs:{summary:"Read one sandbox log stream of the run",flags:{stream:{kind:"string",value:"<name>",help:"Which stream: agent | verifier | system (when the job asked for it); setup and metrics are named but not recorded today (required)"},follow:{kind:"boolean",short:"f",help:"Keep printing lines as they arrive while the box lives"},limit:{kind:"number",short:"l",value:"<n>",help:"Lines per page (default 1000, max 1000)"},cursor:{kind:"string",value:"<seq>",help:"Resume after this line seq"}},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id>",examples:["evolve analysis logs a0a1b2c3-\u2026 --stream agent --follow"]},procs:{summary:"The analysis run's box process list (live only)",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<analysis-id>",examples:["evolve analysis procs a0a1b2c3-\u2026"]}}},check:{summary:"Read task quality checks back",commands:{list:{summary:"List your task quality checks, newest first",flags:{...I,scope:Ge,status:{kind:"string",value:"<s1,s2,...>",help:`Only these statuses: ${X$1.join(", ")}`,group:"Filter"},dataset:{kind:"string",short:"d",value:"<name[@version]>",help:"Only checks on this dataset; a bare name is every version",group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve check list","evolve check list --status running","evolve check list --dataset terminal-bench-4@4.0"]},show:{summary:"Show one check: Harbor's check report, one row per task",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<check-id>",examples:["evolve check show 5f2c9b1e"]},trace:{summary:"Print the checker's transcript for one task check",flags:{since:ve},minPositionals:1,maxPositionals:1,positionalUsage:"<task-check-id>",examples:["evolve check trace 7c1d2e3f","evolve check trace 7c1d2e3f --since 200"]},download:{summary:"Save a check, one task check, or stream an artifact",notes:"A check id saves Harbor's check job folder, check_report.json and one folder per task, under <dir>/check-<id>/. A task check id saves that task's folder alone.",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save under",default:"checks/",group:"Save"},overwrite:{kind:"boolean",help:"Replace an existing folder of the same name",group:"Save"},stream:{kind:"string",value:"<artifact>",help:"Print one artifact of a task check to stdout instead: task-check (the result), trace-parsed, trace-stdout, trace-stderr or agent-home",group:"Stream"},since:{...ve,help:"With --stream trace-parsed: skip the first N events",group:"Stream"}},minPositionals:1,maxPositionals:1,positionalUsage:"<check-id | task-check-id>",examples:["evolve check download 3f9a1c2e -o checks/","evolve check download 7c1d2e3f --stream trace-stdout"]},"files status":{summary:"File system source: live, captured or none",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<task-check-id>",examples:["evolve check files status 3f9a1c2e-\u2026"]},"files list":{summary:"List one folder of the file system (default /)",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},limit:{kind:"number",short:"l",value:"<n>",help:"Entries per page (default 500, max 1000)"},cursor:{kind:"string",value:"<name>",help:"Resume after this entry name (the previous page's next_cursor)"}},minPositionals:1,maxPositionals:2,positionalUsage:"<task-check-id> [path]",examples:["evolve check files ls 3f9a1c2e-\u2026 /app/work"]},"files cat":{summary:"Print one file, raw bytes",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},range:{kind:"string",value:"<bytes=a-b>",help:"One byte range: bytes=a-b, bytes=a- or bytes=-n"}},minPositionals:2,maxPositionals:2,positionalUsage:"<task-check-id> <path>",examples:["evolve check files cat 3f9a1c2e-\u2026 /app/work/main.py"]},"files search":{summary:"Search the task check's file system for text",flags:{path:{kind:"string",value:"<path>",help:"Folder to search under (default: /, the whole box \u2014 seconds)"},regex:{kind:"boolean",help:"Treat the text as a regular expression"},limit:{kind:"number",short:"l",value:"<n>",help:"Hit cap (default 200, max 1000)"},source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"}},minPositionals:2,maxPositionals:2,positionalUsage:"<task-check-id> <text>",examples:["evolve check files search 3f9a1c2e-\u2026 'permission denied' --path /app/work"]},"files changes":{summary:"Files created, modified or removed, by phase",flags:{source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},phase:{kind:"string",value:"<setup|agent|verifier|all>",help:"Only one phase's changes (default all)"},limit:{kind:"number",short:"l",value:"<n>",help:"Rows per page (default 500, max 1000)"},cursor:{kind:"string",value:"<path>",help:"Resume after this path (the previous page's next_cursor)"}},minPositionals:1,maxPositionals:1,positionalUsage:"<task-check-id>",examples:["evolve check files changes 3f9a1c2e-\u2026 --phase agent"]},"files archive":{summary:"Download one subtree as a .tar.gz",flags:{path:{kind:"string",value:"<path>",help:"Subtree to archive (default: /, the whole tree)"},source:{kind:"string",value:"<live|capture>",help:"Read the running box (live) or the kept tree (capture); default: whichever the run has"},"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Save the archive into this directory and print its path (default: raw bytes to stdout)"}},minPositionals:1,maxPositionals:1,positionalUsage:"<task-check-id>",examples:["evolve check files archive 3f9a1c2e-\u2026 --path /app/work -o archives/"]},logs:{summary:"Read one sandbox log stream of the run",flags:{stream:{kind:"string",value:"<name>",help:"Which stream: agent | verifier | system (when the job asked for it); setup and metrics are named but not recorded today (required)"},follow:{kind:"boolean",short:"f",help:"Keep printing lines as they arrive while the box lives"},limit:{kind:"number",short:"l",value:"<n>",help:"Lines per page (default 1000, max 1000)"},cursor:{kind:"string",value:"<seq>",help:"Resume after this line seq"}},minPositionals:1,maxPositionals:1,positionalUsage:"<task-check-id>",examples:["evolve check logs 3f9a1c2e-\u2026 --stream agent --follow"]},procs:{summary:"The task check's box process list (live only)",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<task-check-id>",examples:["evolve check procs 3f9a1c2e-\u2026"]}}},session:{summary:"List and inspect managed-agent sessions",commands:{list:{summary:"List your sessions, newest first",flags:{...I,state:{kind:"string",value:"<live|ended>",help:"Only live or only ended sessions",group:"Filter"},agent:{kind:"string",value:"<name>",help:"Only sessions of this agent harness",group:"Filter"},"tag-prefix":{kind:"string",value:"<prefix>",help:"Only sessions whose tag starts with this prefix",group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve session list","evolve session list --state ended --tag-prefix qa- -q"]},show:{summary:"Show one session in full",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<session-id>",examples:["evolve session show 5f2c1a0e"]}}},dataset:{summary:"Browse and publish the dataset catalog",commands:{list:{summary:"List the dataset catalog",flags:{...I,search:{kind:"string",value:"<text>",help:"Free-text filter over name and description",group:"Filter"}},minPositionals:0,maxPositionals:0,examples:["evolve dataset list","evolve dataset list --search swe -q"]},show:{summary:"Show a dataset's versions, tasks and providers",flags:{limit:{kind:"number",short:"l",value:"<n>",help:"Task-list page size",group:"Paging"},cursor:{kind:"string",value:"<c>",help:"Resume the task list from a cursor",group:"Paging"}},minPositionals:1,maxPositionals:1,positionalUsage:"<name[@version]>",examples:["evolve dataset show terminal-bench-4@4.0"]},check:{summary:"Pre-flight a local corpus without uploading anything",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<dir>",examples:["evolve dataset check ./corpus"]},publish:{summary:"Publish a dataset version",notes:"One source per publish: a pinned git ref, a local directory, or a public tarball or Harbor hub package. --name and --version are required with --git and with --from <url>; a local dataset.toml or a hub package can supply them.",flags:{git:{kind:"string",value:"<url>",help:"Git repository URL, with --ref",group:"Source"},ref:{kind:"string",value:"<ref>",help:"Pinned git ref, a full commit sha or a tag; a branch is refused",group:"Source"},path:{kind:"string",value:"<subfolder>",help:"Repository subfolder holding the corpus, with --git",group:"Source"},dir:{kind:"string",value:"<path>",help:"Local corpus directory, pre-flighted then uploaded",group:"Source"},from:{kind:"string",value:"<url|hub:org/name[@ref]>",help:"A public https tarball URL, or a public Harbor hub package",group:"Source"},name:{kind:"string",value:"<dataset>",help:"Catalog dataset name to create or extend",group:"Version"},version:{kind:"string",value:"<v>",help:"Version label for the published version",group:"Version"},watch:{kind:"boolean",help:"Poll until the version is READY or FAILED",group:"Output"},"skip-preflight":{kind:"boolean",help:"Upload a --dir without the pre-flight check",group:"Source"}},minPositionals:0,maxPositionals:0,examples:["evolve dataset publish --from hub:cookbook/hello-world --watch","evolve dataset publish --dir ./corpus --name my-swe --version 1.0 --watch",`evolve dataset publish \\
10
10
  --git https://github.com/acme/tasks \\
11
11
  --ref v1.2.0 \\
12
12
  --path corpus \\
13
- --name acme-tasks --version 1.2.0`]},watch:{summary:"Follow a publish until it is READY or FAILED",notes:"The same follow `dataset publish --watch` prints, re-attached later or from another machine.",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<name | import-id>",examples:["evolve dataset watch my-swe"]},download:{summary:"Download the original corpus package",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save into",default:"the current directory"}},minPositionals:1,maxPositionals:1,positionalUsage:"<name[@version]>",examples:["evolve dataset download my-swe@1.0 -o corpora/"]},activate:{summary:"Make a READY version the dataset's active version",flags:{},minPositionals:2,maxPositionals:2,positionalUsage:"<name> <version>",examples:["evolve dataset activate my-swe 1.0"]}}},skill:{summary:"Upload and manage platform-stored skills",commands:{list:{summary:"List your uploaded skills, newest first",flags:{...I},minPositionals:0,maxPositionals:0,examples:["evolve skill list"]},upload:{summary:"Upload a skill folder; its name becomes a moving pointer",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<dir>",examples:["evolve skill upload ./my-skill"]},show:{summary:"Show one uploaded skill, metadata and SKILL.md",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<id | name:<skill-name>>",examples:["evolve skill show name:my-skill"]},delete:{summary:"Delete an uploaded skill record",notes:"Past jobs keep their locks. A skill a running job references is refused with skill_in_use.",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve skill delete 6f6f1f36"]}}},agent:{summary:"Register and manage your own agents",commands:{list:{summary:"List your registered agents",flags:{...I},minPositionals:0,maxPositionals:0,examples:["evolve agent list"]},show:{summary:"Show one registered agent",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<name>",examples:["evolve agent show acme-cli"]},add:{summary:"Register an agent from an install script or a directory",flags:{"install-script":{kind:"string",value:"<path>",help:"Install script; its contents are uploaded",group:"Source"},dir:{kind:"string",value:"<path>",help:"Local agent directory, uploaded as an archive",group:"Source"},run:{kind:"string",value:"<command>",help:"Run command, executed with sh -c; required",group:"Run"},"agent-env":{kind:"repeat",aliases:["ae"],value:"KEY=VALUE",help:"Env set at run time; repeatable",group:"Run"}},minPositionals:1,maxPositionals:1,positionalUsage:"<name>",examples:[`evolve agent add acme-cli \\
13
+ --name acme-tasks --version 1.2.0`]},watch:{summary:"Follow a publish until it is READY or FAILED",notes:"The same follow `dataset publish --watch` prints, re-attached later or from another machine.",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<name | import-id>",examples:["evolve dataset watch my-swe"]},download:{summary:"Download the original corpus package",flags:{"output-dir":{kind:"string",short:"o",value:"<dir>",help:"Directory to save into",default:"the current directory"}},minPositionals:1,maxPositionals:1,positionalUsage:"<name[@version]>",examples:["evolve dataset download my-swe@1.0 -o corpora/"]},activate:{summary:"Make a READY version the dataset's active version",flags:{},minPositionals:2,maxPositionals:2,positionalUsage:"<name> <version>",examples:["evolve dataset activate my-swe 1.0"]},"files status":{summary:"The task package's file record",flags:{},minPositionals:2,maxPositionals:2,positionalUsage:"<name@version> <task>",examples:["evolve dataset files status my-swe@1.0 abs-1"]},"files list":{summary:"List one folder of the task package (default /)",flags:{limit:{kind:"number",short:"l",value:"<n>",help:"Entries per page (default 500, max 1000)"},cursor:{kind:"string",value:"<name>",help:"Resume after this entry name (the previous page's next_cursor)"}},minPositionals:2,maxPositionals:3,positionalUsage:"<name@version> <task> [path]",examples:["evolve dataset files ls my-swe@1.0 abs-1 /tests"]},"files cat":{summary:"Print one file of the task's package, raw bytes",flags:{range:{kind:"string",value:"<bytes=a-b>",help:"One byte range: bytes=a-b, bytes=a- or bytes=-n"}},minPositionals:3,maxPositionals:3,positionalUsage:"<name@version> <task> <path>",examples:["evolve dataset files cat my-swe@1.0 abs-1 /instruction.md"]}}},skill:{summary:"Upload and manage platform-stored skills",commands:{list:{summary:"List your uploaded skills, newest first",flags:{...I},minPositionals:0,maxPositionals:0,examples:["evolve skill list"]},upload:{summary:"Upload a skill folder; its name becomes a moving pointer",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<dir>",examples:["evolve skill upload ./my-skill"]},show:{summary:"Show one uploaded skill, metadata and SKILL.md",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<id | name:<skill-name>>",examples:["evolve skill show name:my-skill"]},delete:{summary:"Delete an uploaded skill record",notes:"Past jobs keep their locks. A skill a running job references is refused with skill_in_use.",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<id>",examples:["evolve skill delete 6f6f1f36"]}}},agent:{summary:"Register and manage your own agents",commands:{list:{summary:"List your registered agents",flags:{...I},minPositionals:0,maxPositionals:0,examples:["evolve agent list"]},show:{summary:"Show one registered agent",flags:{},minPositionals:1,maxPositionals:1,positionalUsage:"<name>",examples:["evolve agent show acme-cli"]},add:{summary:"Register an agent from an install script or a directory",flags:{"install-script":{kind:"string",value:"<path>",help:"Install script; its contents are uploaded",group:"Source"},dir:{kind:"string",value:"<path>",help:"Local agent directory, uploaded as an archive",group:"Source"},run:{kind:"string",value:"<command>",help:"Run command, executed with sh -c; required",group:"Run"},"agent-env":{kind:"repeat",aliases:["ae"],value:"KEY=VALUE",help:"Env set at run time; repeatable",group:"Run"}},minPositionals:1,maxPositionals:1,positionalUsage:"<name>",examples:[`evolve agent add acme-cli \\
14
14
  --install-script ./install.sh \\
15
15
  --run "acme-cli --headless"`,`evolve agent add acme-cli \\
16
16
  --dir ./acme-agent \\
@@ -20,35 +20,36 @@ import {X as X$1,W as W$1,ca as ca$1,xa as xa$1,I as I$1,Ka as Ka$1,Ja as Ja$1,D
20
20
  --allowed-host api.github.com \\
21
21
  --allowed-path-prefix / \\
22
22
  --allowed-method GET`,`printf %s "$OPENAI_API_KEY" | evolve secrets set OPENAI_API_KEY \\
23
- --delivery direct`]},list:{summary:"List your env secrets",flags:{columns:I.columns,quiet:{kind:"boolean",short:"q",help:"Print only name[:label], one per line",group:"Output"},"no-trunc":I["no-trunc"],"no-headers":I["no-headers"]},minPositionals:0,maxPositionals:0,examples:["evolve secrets list"]},delete:{summary:"Delete an env secret",notes:"Every runtime grant riding the row is revoked with it.",flags:{label:{kind:"string",value:"<label>",help:"The row to delete, when several share the name"}},minPositionals:1,maxPositionals:1,positionalUsage:"<NAME>",examples:["evolve secrets delete GITHUB_TOKEN","evolve secrets delete GITHUB_TOKEN --label staging"]}}}},tt={run:{summary:"Start a job; the short form of job start",flags:bs,minPositionals:0,maxPositionals:0,examples:ws("evolve run")},analyze:{summary:"Judge a finished job's trial traces against a rubric",notes:"Each trial gets its own analysis run; `analysis list --job <id>` finds them again.",flags:{model:{kind:"string",short:"m",value:"<name>",help:"Model the analyzer runs",default:"openrouter/deepseek/deepseek-v4.1-flash",group:"Analyzer"},effort:{kind:"string",value:"<value>",help:"Reasoning effort the analyzer runs at",default:"the model's own",group:"Analyzer"},rubric:{kind:"string",short:"r",value:"<path>",help:"Rubric file, TOML, YAML or JSON, in Harbor's criteria shape",default:"the built-in analyze rubric",group:"Analyzer"},prompt:{kind:"string",short:"p",value:"<path>",help:"Prompt file for the analyzer, replacing the built-in prompt",group:"Analyzer"},env:{kind:"string",short:"e",value:"<provider>",help:"Sandbox provider the analyzer runs on",default:"the analysis default",group:"Analyzer"},"n-concurrent":{kind:"number",short:"n",value:"<n>",help:"Max concurrent trial analyses",default:"your organization's ceiling",group:"Selection"},passing:{kind:"boolean",help:"Only passing trials, reward 1.0",group:"Selection"},failing:{kind:"boolean",help:"Only failing trials, reward below 1.0 or an error",group:"Selection"},"n-trials":{kind:"number",short:"l",value:"<n>",help:"Max trials to analyze, after --passing or --failing",group:"Selection"},watch:{kind:"boolean",help:"Poll until every analysis settles",group:"Output"},quiet:{kind:"boolean",short:"q",help:"With --watch, print only the final block",group:"Output"}},minPositionals:1,maxPositionals:1,positionalUsage:"<job-id>",examples:["evolve analyze 3e1f9a2c --watch",`evolve analyze 3e1f9a2c \\
23
+ --delivery direct`]},list:{summary:"List your env secrets",flags:{columns:I.columns,quiet:{kind:"boolean",short:"q",help:"Print only name[:label], one per line",group:"Output"},"no-trunc":I["no-trunc"],"no-headers":I["no-headers"]},minPositionals:0,maxPositionals:0,examples:["evolve secrets list"]},delete:{summary:"Delete an env secret",notes:"Every runtime grant riding the row is revoked with it.",flags:{label:{kind:"string",value:"<label>",help:"The row to delete, when several share the name"}},minPositionals:1,maxPositionals:1,positionalUsage:"<NAME>",examples:["evolve secrets delete GITHUB_TOKEN","evolve secrets delete GITHUB_TOKEN --label staging"]}}}},lt={run:{summary:"Start a job; the short form of job start",flags:Os,minPositionals:0,maxPositionals:0,examples:Ps("evolve run")},analyze:{summary:"Judge a finished job's trial traces against a rubric",notes:"Each trial gets its own analysis run; `analysis list --job <id>` finds them again.",flags:{model:{kind:"string",short:"m",value:"<name>",help:"Model the analyzer runs",default:"openrouter/deepseek/deepseek-v4.1-flash",group:"Analyzer"},effort:{kind:"string",value:"<value>",help:"Reasoning effort the analyzer runs at",default:"the model's own",group:"Analyzer"},rubric:{kind:"string",short:"r",value:"<path>",help:"Rubric file, TOML, YAML or JSON, in Harbor's criteria shape",default:"the built-in analyze rubric",group:"Analyzer"},prompt:{kind:"string",short:"p",value:"<path>",help:"Prompt file for the analyzer, replacing the built-in prompt",group:"Analyzer"},env:{kind:"string",short:"e",value:"<provider>",help:"Sandbox provider the analyzer runs on",default:"the analysis default",group:"Analyzer"},"n-concurrent":{kind:"number",short:"n",value:"<n>",help:"Max concurrent trial analyses",default:"your organization's ceiling",group:"Selection"},passing:{kind:"boolean",help:"Only passing trials, reward 1.0",group:"Selection"},failing:{kind:"boolean",help:"Only failing trials, reward below 1.0 or an error",group:"Selection"},"n-trials":{kind:"number",short:"l",value:"<n>",help:"Max trials to analyze, after --passing or --failing",group:"Selection"},watch:{kind:"boolean",help:"Poll until every analysis settles",group:"Output"},quiet:{kind:"boolean",short:"q",help:"With --watch, print only the final block",group:"Output"}},minPositionals:1,maxPositionals:1,positionalUsage:"<job-id>",examples:["evolve analyze 3e1f9a2c --watch",`evolve analyze 3e1f9a2c \\
24
24
  -r rubric.toml -p prompt.txt \\
25
25
  --failing -l 20 -n 2 \\
26
- --watch`]},check:{summary:"Check task quality against a rubric",notes:"Checks a local task directory, a directory of them, or with -d a published dataset. Results are read back with the verbs below.",flags:{model:{kind:"string",short:"m",value:"<name>",help:"Model the checker runs",default:"openrouter/deepseek/deepseek-v4.1-flash",group:"Checker"},effort:{kind:"string",value:"<value>",help:"Reasoning effort the checker runs at",default:"the model's own",group:"Checker"},rubric:{kind:"string",short:"r",value:"<path>",help:"Rubric file, TOML, YAML or JSON, in Harbor's criteria shape",default:"the built-in check rubric",group:"Checker"},prompt:{kind:"string",short:"p",value:"<path>",help:"Prompt file for the checker, replacing the built-in prompt",group:"Checker"},env:{kind:"string",short:"e",value:"<provider>",help:"Sandbox provider the checker runs on",default:"the analysis default",group:"Checker"},"n-concurrent":{kind:"number",short:"n",value:"<n>",help:"Max concurrent task checks",default:"your organization's ceiling",group:"Selection"},"include-task-name":{kind:"repeat",short:"i",value:"<glob>",help:"Only tasks matching the glob; repeatable",group:"Selection"},"exclude-task-name":{kind:"repeat",short:"x",value:"<glob>",help:"Skip tasks matching the glob; repeatable",group:"Selection"},"n-tasks":{kind:"number",short:"l",value:"<n>",help:"Max tasks to check, after the globs, in sorted order",group:"Selection"},dataset:{kind:"string",short:"d",value:"<name[@version]>",help:"A published dataset's tasks instead of a local <path>; not both",group:"Source"},watch:{kind:"boolean",help:"Poll until every task check settles",group:"Output"},quiet:{kind:"boolean",short:"q",help:"With --watch, print only the final report",group:"Output"}},minPositionals:0,maxPositionals:1,positionalUsage:"[<path>]",examples:["evolve check ./tasks --watch","evolve check ./tasks -i 'abs-*' -l 5 --watch","evolve check -d terminal-bench-4@4.0 -l 10 --watch"]},upload:{summary:"Upload a Harbor job directory as a finished job",notes:"Takes the directory, its .tar.gz, or with --from a public URL of one, and follows the upload to the job it becomes.",flags:{dataset:{kind:"string",short:"d",value:"<name[@version]>",help:"Link the uploaded trials to a published dataset version by task name",group:"Link"},from:{kind:"string",value:"<url>",help:"A public https URL of the job archive, instead of <job_dir>",group:"Source"},"no-wait":{kind:"boolean",help:"Return with the import id instead of following it; re-attach with job import <id> --watch",group:"Output"}},minPositionals:0,maxPositionals:1,positionalUsage:"<job_dir>",examples:["evolve upload ./job-2026-08-27__12-00-00 -d deep-swe@1.1","evolve upload --from https://example.com/job.tar.gz --no-wait"]}},_s={jobs:"job",trials:"trial",analyses:"analysis",sessions:"session",datasets:"dataset",secret:"secrets"},$s={agents:'"agents" is reserved for the managed-agents CLI (not released yet) \u2014 for eval agent arms use "evolve agent"'},qt={ls:"list"},kn=80,ye=23;function B(e,t="",s=kn){let n=[],a=t;for(let r of e.split(/\s+/).filter(o=>o!==""))a!==t&&a.length+1+r.length>s&&(n.push(a),a=t),a+=(a===t?"":" ")+r;return a!==t&&n.push(a),n}function re(e,t,s){let n="".padEnd(s),[a,...r]=B(t,n);return [` ${e.padEnd(s-2)}${a.slice(s)}`,...r]}function bn(e,t){let s=[...t.short?[`-${t.short}`]:[],...(t.aliases??[]).map(a=>`--${a}`),`--${e}`];return `${t.short?"":" "}${s.join(", ")}${t.value?` ${t.value}`:""}`}function st(e){let t=Object.entries(e),s=t.map(([r,o])=>bn(r,o)),n=Math.min(Math.max(...s.map(r=>r.length))+4,34),a=[];return t.forEach(([,r],o)=>{let i=r.default!==void 0?`${r.help} (default: ${r.default})`:r.help;s[o].length+4>n?a.push(` ${s[o]}`,...B(i,"".padEnd(n))):a.push(...re(s[o],i,n));}),a}function wn(e){let t=new Map;for(let[n,a]of Object.entries(e)){let r=a.group===void 0?"Options":a.group;t.set(r,{...t.get(r)??{},[n]:a});}let s=[];for(let[n,a]of t)s.push("",`${n}:`,...st(a));return s}function _n(e){return e.split(`
27
- `).map((t,s)=>s===0?` ${t}`:` ${t}`)}function zt(e,t){let s=t.positionalUsage?` ${t.positionalUsage}`:"",n=Object.keys(t.flags).length>0?" [options]":"",a=[`evolve ${e} \u2014 ${t.summary}`,"",`Usage: evolve ${e}${s}${n}`];t.notes!==void 0&&a.push("",...B(t.notes)),a.push(...wn(t.flags)),a.push("","Global options:",...st(et));let r=H[e];return r!==void 0&&a.push("","Commands:",...Ss(r)),a.push("","Examples:",...t.examples.flatMap(_n)),a.join(`
28
- `)}function Ss(e){let t=Math.max(...Object.keys(e.commands).map(s=>s.length))+4;return Object.entries(e.commands).flatMap(([s,n])=>re(s,n.summary,t))}function Kt(e){let t=H[e],s=[`evolve ${e} \u2014 ${t.summary}`,"",`Usage: evolve ${e} <command> [options]`];return t.notes!==void 0&&s.push("",...B(t.notes)),s.push("","Commands:",...Ss(t)),s.push("",`Run "evolve ${e} <command> --help" for its options and examples.`),s.join(`
29
- `)}function Ke(){let e=["evolve \u2014 Evolve hosted jobs CLI","","Usage: evolve <command> [options]","","Start here (for AI agents):"," evolve skills get evals","",...B("Skills ship with the CLI and match its version. `skills get evals` is the index of the documentation; `skills get evals <page>` prints one page; `--full` prints every page. Task authoring: `skills get create-task`, `rewardkit`, `create-adapter`, `publish`."," "),"","Commands:"];for(let[t,s]of Object.entries(tt))e.push(...re(t,s.summary,ye));e.push(...re("help [command]","Show help; also -h/--help on any command",ye)),e.push("","Command groups (evolve <group> <verb>):");for(let[t,s]of Object.entries(H))e.push(...re(t,s.summary,ye)),e.push(...B(Object.keys(s.commands).join(", "),"".padEnd(ye)));return e.push("","Global options:",...st({...et,version:{kind:"boolean",short:"v",help:"Print the CLI version"}}),"","Examples:"," evolve run -d terminal-bench-4@4.0 -a codex -m gpt-6-astra -l 5 --watch"," evolve job list"," evolve skills get evals core-concepts/jobs"),e.join(`
30
- `)}var Eo=Ke(),ie=fileURLToPath(new URL("../..",import.meta.url));function $n(){try{return JSON.parse(readFileSync(join(ie,"package.json"),"utf-8")).version??"unknown"}catch{return "unknown"}}function Ve(e,t){let s=[e.flags,et];for(let n of s)for(let[a,r]of Object.entries(n))if(t.long!==void 0){if(a===t.long||(r.aliases??[]).includes(t.long))return {name:a,flag:r}}else if(t.short!==void 0&&r.short===t.short)return {name:a,flag:r}}function Sn(e,t){if(t==="--help"||t==="-h")return true;if(t.startsWith("--")){let s=t.slice(2).split("=")[0];return Ve(e,{long:s})!==void 0}if(t.startsWith("-")&&t.length>1){let s=t.slice(1).split("=")[0];return Ve(e,{short:s})!==void 0}return false}function qe(e,t,s){let n={},a=[];for(let r=0;r<s.length;r++){let o=s[r];if(o==="--help"||o==="-h")return {command:"help",positionals:e.split(" "),flags:{}};let i,l;if(o.startsWith("--")){let m=o.slice(2),y=m.indexOf("=");y!==-1&&(l=m.slice(y+1),m=m.slice(0,y)),i={long:m};}else if(o.startsWith("-")&&o.length>1){let m=o.slice(1),y=m.indexOf("=");y!==-1&&(l=m.slice(y+1),m=m.slice(0,y)),i={short:m};}else {a.push(o);continue}let c=Ve(t,i);if(!c)throw new p(`Unknown option ${o.split("=")[0]} for "${e}"`);let{name:u,flag:d}=c;if(d.kind==="boolean"){if(l!==void 0)throw new p(`Option --${u} takes no value`);n[u]=true;continue}let f=l;if(f===void 0){let m=s[r+1];if(m===void 0||Sn(t,m)){let y=m!==void 0?` (use --${u}=${m} if that is the value)`:"";throw new p(`Option --${u} requires a value${y}`)}f=m,r++;}if(d.kind==="number"){let m=Number(f);if(f.trim()===""||!Number.isFinite(m))throw new p(`Option --${u} expects a number, got "${f}"`);n[u]=m;}else if(d.kind==="repeat"){let m=n[u]??[];m.push(f),n[u]=m;}else n[u]=f;}if(a.length<t.minPositionals)throw new p(`"${e}" requires ${t.positionalUsage??`${t.minPositionals} argument(s)`}`);if(a.length>t.maxPositionals)throw new p(`"${e}" got unexpected argument "${a[t.maxPositionals]}"`);return {command:e,positionals:a,flags:n}}function vn(e){if(e.length===0)return {command:"help",positionals:[],flags:{}};let t=e[0];if(t==="--help"||t==="-h"||t==="help")return {command:"help",positionals:e.slice(1),flags:{}};if(t==="--version"||t==="-v")return {command:"version",positionals:[],flags:{}};let s=tt[t],n=t==="check"&&e[1]!==void 0&&!e[1].startsWith("-")?Ge(H.check,e.slice(1)):null;if(s&&n===null)return qe(t,s,e.slice(1));let a=$s[t];if(a)throw new p(a);let r=_s[t]??t,o=H[r];if(!o)throw new p(`Unknown command "${t}"`);let i=e[1];if(i==="--help"||i==="-h")return {command:"help",positionals:[r],flags:{}};if(i===void 0||i.startsWith("-")){if(o.defaultVerb===void 0){if(i===void 0)return {command:"help",positionals:[r],flags:{}};throw new p(`"${r}" requires a command (run "evolve ${r} --help")`)}return qe(`${r} ${o.defaultVerb}`,o.commands[o.defaultVerb],e.slice(1))}let l=Ge(o,e.slice(1));if(!l){let c=e[2];if(In(o,i)&&(c===void 0||c==="--help"||c==="-h"))return {command:"help",positionals:[r,i],flags:{}};throw new p(`Unknown command "${r} ${i}" (supported: ${Object.keys(o.commands).join(", ")})`)}return qe(`${r} ${l.verb}`,l.spec,e.slice(1+l.words))}function Ge(e,t){let s=t[0],n=t[1];if(s!==void 0&&n!==void 0&&!n.startsWith("-")){let o=`${s} ${qt[n]??n}`,i=e.commands[o];if(i)return {verb:o,spec:i,words:2}}if(s===void 0)return null;let a=qt[s]??s,r=e.commands[a];return r?{verb:a,spec:r,words:1}:null}function In(e,t){return Object.keys(e.commands).some(s=>s.startsWith(`${t} `))}function xn(e){return e.map(t=>typeof t=="object"&&t.tag==="tag:yaml.org,2002:bool"&&t.test?{...t,test:t.identify?.(true)?/^(?:[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/:/^(?:[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/}:t)}var On=/^(?:[-+]?[0-9][0-9_]*\.[0-9_]*|\.[0-9][0-9_]*)$/,jn=/^(?:[-+]?[0-9][0-9_]*\.[0-9_]*|\.[0-9][0-9_]*)[eE][-+][0-9]+$/;function An(e){return e.map(t=>typeof t!="object"||t.tag!=="tag:yaml.org,2002:float"||!t.test?t:t.test.test("1.5e+3")?{...t,test:jn}:t.test.test("1.5")?{...t,test:On}:t)}var En=/^[-+]?(?:0|[1-9][0-9_]*)$/,Pn=/^[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+$/;function Tn(e){return e.map(t=>typeof t!="object"||t.tag!=="tag:yaml.org,2002:int"||!t.test?t:t.test.test("1:00")?{...t,test:Pn}:t.test.test("19")?{...t,test:En}:t)}function Cn(e,t){return vs(e,t).value}function vs(e,t){let s=new LineCounter,n=parseDocument(e,{version:"1.1",schema:"yaml-1.1",resolveKnownTags:false,lineCounter:s,customTags:i=>Tn(An(xn(i)))}),a=n.errors[0]??n.warnings[0];if(a){let i=a.linePos?.[0]?.line??1,l=a.code==="MULTIPLE_DOCS"?"multi-document YAML is not supported here \u2014 one config per file":a.message.replace(/ at line \d+, column \d+:[\s\S]*$/,"");throw new p(`${t}:${i}: ${l}`)}n.options.logLevel="silent";let r;try{r=n.toJS()??{};}catch(i){throw new p(`${t}: ${i.message}`)}return {value:r,locate:i=>{let c=n.getIn(i,true)?.range?.[0];return c===void 0?void 0:s.linePos(c).line}}}var Nn=["../../spec/openapi.yaml","../../../../spec/openapi.yaml"],ke;function Ln(){if(ke)return ke;let e=[],t=Nn.map(n=>fileURLToPath(new URL(n,import.meta.url))),s=process.env.EVOLVE_OPENAPI_SPEC_PATH;s&&t.unshift(s);for(let n of t){if(e.push(n),!existsSync(n))continue;let r=parse$1(readFileSync(n,"utf-8"))?.components?.schemas,o=r?.JobCreate;if(!r||!o||typeof o!="object")throw new Error(`${n} carries no components.schemas.JobCreate \u2014 the contract this CLI validates -c against`);return ke={root:o,components:r},ke}throw new Error(`spec/openapi.yaml not found (tried: ${e.join(", ")}) \u2014 the package ships it; reinstall the SDK, or point EVOLVE_OPENAPI_SPEC_PATH at a contract checkout`)}function Is(e){let t=e.type;return typeof t=="string"?[t]:Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function nt(e,t,s){let n=e.$ref;if(typeof n!="string")return {schema:e,specName:s};let a=n.replace("#/components/schemas/",""),r=t[a];if(!r)throw new Error(`spec/openapi.yaml: unresolvable $ref "${n}"`);return nt(r,t,a)}function Rn(e){return e.length===1&&typeof e[0]=="string"?`"${e[0]}"`:e.map((t,s)=>typeof t=="number"?`[${t}]`:s===0?t:`.${t}`).join("")}function xs(e,t){let s=t.locate?.(e),n=`${t.source}${s!==void 0?`:${s}`:""}`;return e.length===0?n:`${Rn(e)} in ${n}`}function E(e,t,s,n){throw new p(`--config: ${xs(e,t)} ${s} [spec: ${n}]`)}function Dn(e){for(let t=e.length-1;t>=0;t--)if(typeof e[t]=="string")return e[t];return "value"}function Jn(e,t){if(!e)return "a list";let s=nt(e,t.components,""),n=Is(s.schema);return n.includes("string")?"a list of strings":n.includes("object")?"a list of objects":"a list"}function be(e,t,s,n,a,r=false){let{schema:o,specName:i}=nt(t,a.components,n),l=Is(o),c=u=>i?`${i}.${u}`:u;if(e===null){if(l.includes("null"))return;E(s,a,`must be a ${l[0]??"value"}, not null`,i);}if(l.includes("object")){let u=F(o.additionalProperties)?o.additionalProperties:void 0;if(!F(e)){let f=u&&!o.properties?`must be a map of KEY: "value" pairs, not ${G(e)}`:`must be an object like {${Un(o)}: "..."}, not ${G(e)}`;E(s,a,f,i);}let d=F(o.properties)?o.properties:void 0;if(d){if(!r&&Array.isArray(o.required))for(let f of o.required)typeof f=="string"&&e[f]===void 0&&E(s,a,`is missing the required key "${f}"`,i);for(let f of Object.keys(e))if(d[f]===void 0&&!u)throw new p(`--config: unknown key "${f}" in ${xs([...s,f],a)} (allowed: ${Object.keys(d).join(", ")}) [spec: ${i}]`);for(let[f,m]of Object.entries(d)){let y=e[f];y!==void 0&&be(y,m,[...s,f],c(f),a);}}if(u)for(let[f,m]of Object.entries(e))d?.[f]===void 0&&be(m,u,[...s,f],i,a);return}if(l.includes("array")){let u=F(o.items)?o.items:void 0;Array.isArray(e)||E(s,a,`must be ${Jn(u,a)}, not ${G(e)}`,i),typeof o.minItems=="number"&&e.length<o.minItems&&E(s,a,`needs at least ${o.minItems} ${o.minItems===1?"entry":"entries"}`,i),typeof o.maxItems=="number"&&e.length>o.maxItems&&E(s,a,`takes at most ${o.maxItems} entries`,i),u&&e.forEach((d,f)=>be(d,u,[...s,f],i,a));return}if(Array.isArray(o.enum)){o.enum.includes(e)||E(s,a,`must be one of: ${o.enum.join(", ")}`,i);return}if(l.includes("string")){typeof e!="string"&&E(s,a,`must be a string, not ${G(e)} \u2014 quote it (${Dn(s)}: "...")`,i),typeof o.maxLength=="number"&&e.length>o.maxLength&&E(s,a,`must be at most ${o.maxLength} characters (got ${e.length})`,i);return}if(l.includes("integer")||l.includes("number")){let u=l.includes("integer");(typeof e!="number"||u&&!Number.isInteger(e))&&E(s,a,`must be ${u?"an integer":"a number"}, not ${G(e)}`,i),typeof o.minimum=="number"&&e<o.minimum&&E(s,a,`must be at least ${o.minimum}`,i),typeof o.maximum=="number"&&e>o.maximum&&E(s,a,`must be at most ${o.maximum}`,i);return}l.includes("boolean")&&typeof e!="boolean"&&E(s,a,`must be a boolean, not ${G(e)}`,i);}function Un(e){let t=Array.isArray(e.required)?e.required[0]:void 0;return typeof t=="string"?t:(F(e.properties)?Object.keys(e.properties):[])[0]??"name"}function Fn(e,t,s){let{root:n,components:a}=Ln();be(e,n,[],"JobCreate",{source:t,locate:s,components:a},true);}function G(e){return e===null?"null":Array.isArray(e)?"a list":typeof e=="object"?`a ${e.constructor?.name??"object"}`:`a ${typeof e}`}function F(e){if(typeof e!="object"||e===null||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function He(e,t,s,n=new WeakSet){if(!(e===null||typeof e=="string"||typeof e=="boolean")){if(typeof e=="number"){if(Number.isFinite(e))return;throw new p(`--config: ${t} in ${s} is ${Number.isNaN(e)?".nan":"infinite"} \u2014 a JSON body carries finite numbers only`)}if(Array.isArray(e)||F(e)){if(n.has(e))throw new p(`--config: ${t} in ${s} is an alias of a value that contains it \u2014 a JSON body cannot carry a cycle`);if(n.add(e),Array.isArray(e))e.forEach((a,r)=>He(a,`${t}[${r}]`,s,n));else for(let[a,r]of Object.entries(e))He(r,`${t}.${a}`,s,n);n.delete(e);return}throw new p(`--config: ${t} in ${s} resolved to ${G(e)}, which a JSON body cannot carry \u2014 quote the value to keep it text`)}}function Mn(e,t){let s;try{s=t(e);}catch(o){throw new p(`--config: cannot read ${e}: ${o.message}`)}let n,a;if(e.endsWith(".json"))try{n=JSON.parse(s);}catch(o){throw new p(`--config: ${e} is not valid JSON: ${o.message}`)}else ({value:n,locate:a}=vs(s,e));if(!n||typeof n!="object"||Array.isArray(n))throw new p(`--config: ${e} must contain a JSON/YAML object`);let r=n;for(let[o,i]of Object.entries(r))He(i,o,e);return Fn(r,e,a),n}function Vt(e,t){let s=e.indexOf("@");if(s===-1)return {name:e};let n=e.slice(0,s),a=e.slice(s+1);if(!n||!a)throw new p(`Invalid ${t} "${e}": expected name or name@version`);return {name:n,version:a}}function qn(e){let t=e.trim();try{return JSON.parse(t)}catch{return t==="True"?true:t==="False"?false:t==="None"?null:t}}function zn(e,t=s=>readFileSync(s,"utf-8")){let s={};for(let n of e){let a=n.indexOf("=");if(a<=0)throw new p(`Invalid --ak "${n}": expected key=value`);let r=n.slice(0,a).trim(),o=qn(n.slice(a+1));r==="config"&&typeof o=="string"&&(o=Kn(o,t)),s[r]=o;}return s}function Kn(e,t){let s;try{s=t(e);}catch(a){throw new p(`--ak config: cannot read ${e}: ${a.message}`)}let n;if(e.endsWith(".toml"))try{n=parse(s);}catch(a){throw new p(`--ak config: ${e} is not valid TOML: ${a.message}`)}else if(e.endsWith(".json"))try{n=JSON.parse(s);}catch(a){throw new p(`--ak config: ${e} is not valid JSON: ${a.message}`)}else try{n=JSON.parse(s);}catch{try{n=parse(s);}catch{throw new p(`--ak config: ${e} parses as neither JSON nor TOML; use a .json or .toml settings file`)}}if(!n||typeof n!="object"||Array.isArray(n))throw new p(`--ak config: ${e} must contain a settings object`);return n}function at(e,t=s=>readFileSync(s,"utf-8")){let s;try{s=t(e);}catch(n){throw new p(`--prompt: cannot read ${e}: ${n.message}`)}if(s.trim().length===0)throw new p(`--prompt: ${e} is empty \u2014 the analyzer's prompt file must carry the instruction text`);return s}function rt(e,t=s=>readFileSync(s,"utf-8")){let s;try{s=t(e);}catch(o){throw new p(`--rubric: cannot read ${e}: ${o.message}`)}let n;if(e.endsWith(".toml"))try{n=parse(s);}catch(o){throw new p(`--rubric: ${e} is not valid TOML: ${o.message}`)}else if(e.endsWith(".yaml")||e.endsWith(".yml"))n=Cn(s,e);else if(e.endsWith(".json"))try{n=JSON.parse(s);}catch(o){throw new p(`--rubric: ${e} is not valid JSON: ${o.message}`)}else throw new p(`--rubric: unsupported rubric format "${e}" \u2014 use a .toml, .yaml, .yml, or .json file (Harbor's own set)`);if(!F(n))throw new p(`--rubric: ${e} must contain a {criteria: [...]} object`);let a=Object.keys(n).filter(o=>o!=="criteria");if(a.length>0)throw new p(`--rubric: unknown key${a.length===1?"":"s"} ${a.map(o=>`"${o}"`).join(", ")} in ${e} \u2014 a rubric is {criteria: [{name, description, guidance}]}`);let r=n.criteria;if(!Array.isArray(r)||r.length===0)throw new p(`--rubric: ${e} needs a non-empty criteria list ([[criteria]] entries in TOML)`);return {criteria:r.map((o,i)=>{let l=`criteria[${i}] in ${e}`;if(!F(o))throw new p(`--rubric: ${l} must be a {name, description, guidance} object`);let c=Object.keys(o).filter(u=>u!=="name"&&u!=="description"&&u!=="guidance");if(c.length>0)throw new p(`--rubric: unknown key${c.length===1?"":"s"} ${c.map(u=>`"${u}"`).join(", ")} in ${l} \u2014 a criterion is {name, description, guidance}`);for(let u of ["name","description","guidance"])if(typeof o[u]!="string"||o[u].length===0)throw new p(`--rubric: ${l} needs a non-empty string "${u}"`);return {name:o.name,description:o.description,guidance:o.guidance}})}}function Vn(e){return e.map(t=>{let s=t.indexOf("="),n=s===-1?t:t.slice(0,s),a=s===-1?void 0:t.slice(s+1);if(s!==-1&&!a)throw new p(`Invalid --secret "${t}": expected NAME[@LABEL][=ENVNAME]`);let r=n.indexOf("@"),o=r===-1?n:n.slice(0,r),i=r===-1?void 0:n.slice(r+1);if(!o||r!==-1&&!i)throw new p(`Invalid --secret "${t}": expected NAME[@LABEL][=ENVNAME]`);return {name:o,...i!==void 0?{label:i}:{},...a!==void 0?{as:a}:{}}})}function Gn(e){let t="NAME[@LABEL]:brokered|direct=VALUE";return e.map(s=>{let n=s.indexOf("=");if(n===-1)throw new p(`Invalid --secret-inline "${s}": expected ${t}`);let a=s.slice(0,n),r=s.slice(n+1);if(!r)throw new p(`Invalid --secret-inline "${s}": the value must not be empty`);let o=a.lastIndexOf(":");if(o===-1)throw new p(`Invalid --secret-inline "${a}=...": a delivery mode is required \u2014 ${t}`);let i=a.slice(0,o),l=a.slice(o+1);if(l!=="brokered"&&l!=="direct")throw new p(`Invalid --secret-inline delivery "${l}": expected brokered or direct`);let c=i.indexOf("@"),u=c===-1?i:i.slice(0,c),d=c===-1?void 0:i.slice(c+1);if(!u||c!==-1&&!d)throw new p(`Invalid --secret-inline "${a}=...": expected ${t}`);return {name:u,value:r,delivery:l,...d!==void 0?{label:d}:{}}})}function Os(e,t){let s={};for(let n of e){let a=n.indexOf("=");if(a<=0)throw new p(`Invalid ${t} "${n}": expected KEY=VALUE`);s[n.slice(0,a)]=n.slice(a+1);}return s}function Hn(e,t=s=>readFileSync(s,"utf-8")){let s=e.flags,n=typeof s.config=="string"?Mn(s.config,t):{},a;if(s.dataset!==void 0)a=s.dataset.map(h=>{let v=Vt(h,"--dataset");return {name:v.name,...v.version?{version:v.version}:{}}});else if(Array.isArray(n.datasets)&&n.datasets.length>0)a=n.datasets.map(h=>({...h}));else throw new p(`"${e.command}" requires -d/--dataset (or datasets in --config)`);if(s["include-task-name"]!==void 0)for(let h of a)h.task_names=s["include-task-name"];if(s["exclude-task-name"]!==void 0)for(let h of a)h.exclude_task_names=s["exclude-task-name"];if(s["n-tasks"]!==void 0)for(let h of a)h.n_tasks=s["n-tasks"];let r;if(s.agent!==void 0||s.model!==void 0){if(s.agent===void 0)throw new p("-m/--model requires -a/--agent");if(s.model===void 0)throw new p("-a/--agent requires at least one -m/--model (the server applies no model default)");let h=Vt(String(s.agent),"--agent");r=s.model.map(v=>({name:h.name,model_name:v,...h.version?{version:h.version}:{}}));}else if(Array.isArray(n.agents)&&n.agents.length>0)r=n.agents.map(h=>({...h}));else throw new p(`"${e.command}" requires -a/--agent and -m/--model (or agents in --config)`);if(s.effort!==void 0&&(r=r.map(h=>({...h,reasoning_effort:s.effort}))),s.ak!==void 0){let h=zn(s.ak,t);r=r.map(v=>({...v,kwargs:{...v.kwargs??{},...h}}));}s.preset!==void 0&&(r=r.map(h=>({...h,preset:s.preset}))),s.skill!==void 0&&(r=r.map(h=>({...h,skills:[...s.skill]})));let i=n.agent_env,l=s["verifier-env"]!==void 0?Os(s["verifier-env"],"--verifier-env"):n.verifier_env,c=s.secret!==void 0||s["secret-inline"]!==void 0?[...s.secret!==void 0?Vn(s.secret):[],...s["secret-inline"]!==void 0?Gn(s["secret-inline"]):[]]:n.secrets,u=s["job-name"]!==void 0?String(s["job-name"]):n.job_name,d=s["n-attempts"]!==void 0?s["n-attempts"]:n.n_attempts,f=s["n-concurrent"]!==void 0?s["n-concurrent"]:n.n_concurrent_trials,m=s["max-trial-spend"]!==void 0?s["max-trial-spend"]:n.max_trial_spend_usd;if(s.env!==void 0&&!U$1.includes(String(s.env)))throw new p(`-e/--env must be one of: ${U$1.join(", ")}`);let y=s.env!==void 0?s.env:n.sandbox_provider,j={...n.retry??{}};s["max-retries"]!==void 0&&(j.max_retries=s["max-retries"]),s["retry-include"]!==void 0&&(j.include_exceptions=s["retry-include"]),s["retry-exclude"]!==void 0&&(j.exclude_exceptions=s["retry-exclude"]);let S=s.analyze===true||s["analyze-model"]!==void 0||s["analyze-rubric"]!==void 0||s["analyze-prompt"]!==void 0||s["analyze-provider"]!==void 0||s["analyze-effort"]!==void 0||n.analyze!==void 0,_={...n.analyze??{}};s["analyze-model"]!==void 0&&(_.model_name=String(s["analyze-model"])),s["analyze-rubric"]!==void 0&&(_.rubric=rt(String(s["analyze-rubric"]),t)),s["analyze-prompt"]!==void 0&&(_.prompt=at(String(s["analyze-prompt"]),t)),s["analyze-provider"]!==void 0&&(_.sandbox_provider=String(s["analyze-provider"])),s["analyze-effort"]!==void 0&&(_.reasoning_effort=String(s["analyze-effort"]));let $={};for(let[h,v]of [["timeout-multiplier","timeout_multiplier"],["agent-timeout-multiplier","agent_timeout_multiplier"],["verifier-timeout-multiplier","verifier_timeout_multiplier"],["agent-setup-timeout-multiplier","agent_setup_timeout_multiplier"],["environment-build-timeout-multiplier","environment_build_timeout_multiplier"]]){let x=s[h]!==void 0?s[h]:n[v];x!==void 0&&($[v]=x);}return {...u!==void 0?{job_name:u}:{},datasets:a,agents:r,...d!==void 0?{n_attempts:d}:{},...f!==void 0?{n_concurrent_trials:f}:{},...m!==void 0?{max_trial_spend_usd:m}:{},...y!==void 0?{sandbox_provider:y}:{},...Object.keys(j).length>0?{retry:j}:{},...S?{analyze:_}:{},...$,...i!==void 0?{agent_env:i}:{},...l!==void 0?{verifier_env:l}:{},...c!==void 0?{secrets:c}:{}}}function Wn(e){let t=e.flags,s=typeof t.dir=="string",n=typeof t.git=="string"||typeof t.ref=="string"||typeof t.path=="string",a=typeof t.from=="string";if([s,n,a].filter(Boolean).length>1)throw new p('"dataset publish" takes EXACTLY ONE source: --dir, --git/--ref/--path, or --from');if(a){let o=t.from.trim();if(o.startsWith("hub:")){let i=o.slice(4);if(i==="")throw new p('"--from hub:" needs a package reference \u2014 hub:org/name[@ref], e.g. hub:cookbook/hello-world');return {source:{hub_package:i},...typeof t.name=="string"?{name:t.name}:{},...typeof t.version=="string"?{version:t.version}:{}}}if(!o.startsWith("https://"))throw new p(`"--from" takes a public https tarball url or hub:org/name[@ref] (got "${o}")`);for(let i of ["name","version"])if(typeof t[i]!="string")throw new p(`"dataset publish" requires --${i} with --from <url> \u2014 the server fetches the tarball only after the publish is accepted, so nothing can supply it later`);return {source:{archive_url:o},name:t.name,version:t.version}}if(s)return {source:{directory:t.dir},...typeof t.name=="string"?{name:t.name}:{},...typeof t.version=="string"?{version:t.version}:{}};for(let o of ["git","ref","name","version"])if(typeof t[o]!="string"){let i=o==="git"||o==="ref"?" (or --dir for a local corpus directory)":" (a git source cannot take it from dataset.toml \u2014 the repository is only cloned after the publish is accepted)";throw new p(`"dataset publish" requires --${o}${i}`)}return {source:{git_url:t.git,git_ref:t.ref,...typeof t.path=="string"?{git_path:t.path}:{}},name:t.name,version:t.version}}function Yn(e,t=s=>readFileSync(s,"utf-8")){let s=e.flags,n=typeof s.dir=="string",a=typeof s["install-script"]=="string";if(n&&a)throw new p('"agent add" takes EITHER --dir OR --install-script, not both');if(!n&&!a)throw new p('"agent add" requires --install-script (or --dir for a local agent directory)');if(typeof s.run!="string")throw new p('"agent add" requires --run');let r=Os(s["agent-env"]??[],"--agent-env");return {name:e.positionals[0],...n?{directory:s.dir}:{install_script:t(s["install-script"])},run_command:s.run,...Object.keys(r).length>0?{env:r}:{}}}var Bn={out:e=>process.stdout.write(e+`
26
+ --watch`]},check:{summary:"Check task quality against a rubric",notes:"Checks a local task directory, a directory of them, or with -d a published dataset. Results are read back with the verbs below.",flags:{name:{kind:"string",value:"<name>",help:"A name for the check; default: the accept timestamp",group:"Checker"},model:{kind:"string",short:"m",value:"<name>",help:"Model the checker runs",default:"openrouter/deepseek/deepseek-v4.1-flash",group:"Checker"},effort:{kind:"string",value:"<value>",help:"Reasoning effort the checker runs at",default:"the model's own",group:"Checker"},rubric:{kind:"string",short:"r",value:"<path>",help:"Rubric file, TOML, YAML or JSON, in Harbor's criteria shape",default:"the built-in check rubric",group:"Checker"},prompt:{kind:"string",short:"p",value:"<path>",help:"Prompt file for the checker, replacing the built-in prompt",group:"Checker"},env:{kind:"string",short:"e",value:"<provider>",help:"Sandbox provider the checker runs on",default:"the analysis default",group:"Checker"},"show-defaults":{kind:"boolean",help:"Print the built-in prompt, rubric, model, effort and provider, then exit",group:"Checker"},"n-concurrent":{kind:"number",short:"n",value:"<n>",help:"Max concurrent task checks",default:"your organization's ceiling",group:"Selection"},"include-task-name":{kind:"repeat",short:"i",value:"<glob>",help:"Only tasks matching the glob; repeatable",group:"Selection"},"exclude-task-name":{kind:"repeat",short:"x",value:"<glob>",help:"Skip tasks matching the glob; repeatable",group:"Selection"},"n-tasks":{kind:"number",short:"l",value:"<n>",help:"Max tasks to check, after the globs, in sorted order",group:"Selection"},dataset:{kind:"string",short:"d",value:"<name[@version]>",help:"A published dataset's tasks instead of a local <path>; not both",group:"Source"},watch:{kind:"boolean",help:"Poll until every task check settles",group:"Output"},quiet:{kind:"boolean",short:"q",help:"With --watch, print only the final report",group:"Output"}},minPositionals:0,maxPositionals:1,positionalUsage:"[<path>]",examples:["evolve check ./tasks --watch","evolve check -d terminal-bench-4@4.0 -i 'abs-*' -l 10 --watch","evolve check --show-defaults"]},upload:{summary:"Upload a Harbor job directory as a finished job",notes:"Takes the directory, its .tar.gz, or with --from a public URL of one, and follows the upload to the job it becomes.",flags:{dataset:{kind:"string",short:"d",value:"<name[@version]>",help:"Link the uploaded trials to a published dataset version by task name",group:"Link"},from:{kind:"string",value:"<url>",help:"A public https URL of the job archive, instead of <job_dir>",group:"Source"},"no-wait":{kind:"boolean",help:"Return with the import id instead of following it; re-attach with job import <id> --watch",group:"Output"}},minPositionals:0,maxPositionals:1,positionalUsage:"<job_dir>",examples:["evolve upload ./job-2026-08-27__12-00-00 -d deep-swe@1.1","evolve upload --from https://example.com/job.tar.gz --no-wait"]}},js={jobs:"job",trials:"trial",analyses:"analysis",sessions:"session",datasets:"dataset",secret:"secrets"},Es={agents:'"agents" is reserved for the managed-agents CLI (not released yet) \u2014 for eval agent arms use "evolve agent"'},Bt={ls:"list"},In=80,_e=23;function ee(e,t="",s=In){let n=[],a=t;for(let r of e.split(/\s+/).filter(i=>i!==""))a!==t&&a.length+1+r.length>s&&(n.push(a),a=t),a+=(a===t?"":" ")+r;return a!==t&&n.push(a),n}function ce(e,t,s){let n="".padEnd(s),[a,...r]=ee(t,n);return [` ${e.padEnd(s-2)}${a.slice(s)}`,...r]}function On(e,t){let s=[...t.short?[`-${t.short}`]:[],...(t.aliases??[]).map(a=>`--${a}`),`--${e}`];return `${t.short?"":" "}${s.join(", ")}${t.value?` ${t.value}`:""}`}function ut(e){let t=Object.entries(e),s=t.map(([r,i])=>On(r,i)),n=Math.min(Math.max(...s.map(r=>r.length))+4,34),a=[];return t.forEach(([,r],i)=>{let o=r.default!==void 0?`${r.help} (default: ${r.default})`:r.help;s[i].length+4>n?a.push(` ${s[i]}`,...ee(o,"".padEnd(n))):a.push(...ce(s[i],o,n));}),a}function Pn(e){let t=new Map;for(let[n,a]of Object.entries(e)){let r=a.group===void 0?"Options":a.group;t.set(r,{...t.get(r)??{},[n]:a});}let s=[];for(let[n,a]of t)s.push("",`${n}:`,...ut(a));return s}function jn(e){return e.split(`
27
+ `).map((t,s)=>s===0?` ${t}`:` ${t}`)}function Yt(e,t){let s=t.positionalUsage?` ${t.positionalUsage}`:"",n=Object.keys(t.flags).length>0?" [options]":"",a=[`evolve ${e} \u2014 ${t.summary}`,"",`Usage: evolve ${e}${s}${n}`];t.notes!==void 0&&a.push("",...ee(t.notes)),a.push(...Pn(t.flags)),a.push("","Global options:",...ut(ot));let r=Q[e];return r!==void 0&&a.push("","Commands:",...As(r)),a.push("","Examples:",...t.examples.flatMap(jn)),a.join(`
28
+ `)}function As(e){let t=Math.max(...Object.keys(e.commands).map(s=>s.length))+4;return Object.entries(e.commands).flatMap(([s,n])=>ce(s,n.summary,t))}function Xt(e){let t=Q[e],s=[`evolve ${e} \u2014 ${t.summary}`,"",`Usage: evolve ${e} <command> [options]`];return t.notes!==void 0&&s.push("",...ee(t.notes)),s.push("","Commands:",...As(t)),s.push("",`Run "evolve ${e} <command> --help" for its options and examples.`),s.join(`
29
+ `)}function Xe(){let e=["evolve \u2014 Evolve hosted jobs CLI","","Usage: evolve <command> [options]","","Start here (for AI agents):"," evolve skills get evals","",...ee("Skills ship with the CLI and match its version. `skills get evals` is the index of the documentation; `skills get evals <page>` prints one page; `--full` prints every page. Task authoring: `skills get create-task`, `rewardkit`, `create-adapter`, `publish`."," "),"","Commands:"];for(let[t,s]of Object.entries(lt))e.push(...ce(t,s.summary,_e));e.push(...ce("help [command]","Show help; also -h/--help on any command",_e)),e.push("","Command groups (evolve <group> <verb>):");for(let[t,s]of Object.entries(Q))e.push(...ce(t,s.summary,_e)),e.push(...ee(Object.keys(s.commands).join(", "),"".padEnd(_e)));return e.push("","Global options:",...ut({...ot,version:{kind:"boolean",short:"v",help:"Print the CLI version"}}),"","Examples:"," evolve run -d terminal-bench-4@4.0 -a codex -m gpt-6-astra -l 5 --watch"," evolve job list"," evolve skills get evals core-concepts/jobs"),e.join(`
30
+ `)}var Vi=Xe(),fe=fileURLToPath(new URL("../..",import.meta.url));function En(){try{return JSON.parse(readFileSync(join(fe,"package.json"),"utf-8")).version??"unknown"}catch{return "unknown"}}function Qe(e,t){let s=[e.flags,ot];for(let n of s)for(let[a,r]of Object.entries(n))if(t.long!==void 0){if(a===t.long||(r.aliases??[]).includes(t.long))return {name:a,flag:r}}else if(t.short!==void 0&&r.short===t.short)return {name:a,flag:r}}function An(e,t){if(t==="--help"||t==="-h")return true;if(t.startsWith("--")){let s=t.slice(2).split("=")[0];return Qe(e,{long:s})!==void 0}if(t.startsWith("-")&&t.length>1){let s=t.slice(1).split("=")[0];return Qe(e,{short:s})!==void 0}return false}function We(e,t,s){let n={},a=[];for(let r=0;r<s.length;r++){let i=s[r];if(i==="--help"||i==="-h")return {command:"help",positionals:e.split(" "),flags:{}};let o,l;if(i.startsWith("--")){let m=i.slice(2),y=m.indexOf("=");y!==-1&&(l=m.slice(y+1),m=m.slice(0,y)),o={long:m};}else if(i.startsWith("-")&&i.length>1){let m=i.slice(1),y=m.indexOf("=");y!==-1&&(l=m.slice(y+1),m=m.slice(0,y)),o={short:m};}else {a.push(i);continue}let c=Qe(t,o);if(!c)throw new p(`Unknown option ${i.split("=")[0]} for "${e}"`);let{name:u,flag:d}=c;if(d.kind==="boolean"){if(l!==void 0)throw new p(`Option --${u} takes no value`);n[u]=true;continue}let f=l;if(f===void 0){let m=s[r+1];if(m===void 0||An(t,m)){let y=m!==void 0?` (use --${u}=${m} if that is the value)`:"";throw new p(`Option --${u} requires a value${y}`)}f=m,r++;}if(d.kind==="number"){let m=Number(f);if(f.trim()===""||!Number.isFinite(m))throw new p(`Option --${u} expects a number, got "${f}"`);n[u]=m;}else if(d.kind==="repeat"){let m=n[u]??[];m.push(f),n[u]=m;}else n[u]=f;}if(a.length<t.minPositionals)throw new p(`"${e}" requires ${t.positionalUsage??`${t.minPositionals} argument(s)`}`);if(a.length>t.maxPositionals)throw new p(`"${e}" got unexpected argument "${a[t.maxPositionals]}"`);return {command:e,positionals:a,flags:n}}function Tn(e){if(e.length===0)return {command:"help",positionals:[],flags:{}};let t=e[0];if(t==="--help"||t==="-h"||t==="help")return {command:"help",positionals:e.slice(1),flags:{}};if(t==="--version"||t==="-v")return {command:"version",positionals:[],flags:{}};let s=lt[t],n=t==="check"&&e[1]!==void 0&&!e[1].startsWith("-")?Ze(Q.check,e.slice(1)):null;if(s&&n===null)return We(t,s,e.slice(1));let a=Es[t];if(a)throw new p(a);let r=js[t]??t,i=Q[r];if(!i)throw new p(`Unknown command "${t}"`);let o=e[1];if(o==="--help"||o==="-h")return {command:"help",positionals:[r],flags:{}};if(o===void 0||o.startsWith("-")){if(i.defaultVerb===void 0){if(o===void 0)return {command:"help",positionals:[r],flags:{}};throw new p(`"${r}" requires a command (run "evolve ${r} --help")`)}return We(`${r} ${i.defaultVerb}`,i.commands[i.defaultVerb],e.slice(1))}let l=Ze(i,e.slice(1));if(!l){let c=e[2];if(Cn(i,o)&&(c===void 0||c==="--help"||c==="-h"))return {command:"help",positionals:[r,o],flags:{}};throw new p(`Unknown command "${r} ${o}" (supported: ${Object.keys(i.commands).join(", ")})`)}return We(`${r} ${l.verb}`,l.spec,e.slice(1+l.words))}function Ze(e,t){let s=t[0],n=t[1];if(s!==void 0&&n!==void 0&&!n.startsWith("-")){let i=`${s} ${Bt[n]??n}`,o=e.commands[i];if(o)return {verb:i,spec:o,words:2}}if(s===void 0)return null;let a=Bt[s]??s,r=e.commands[a];return r?{verb:a,spec:r,words:1}:null}function Cn(e,t){return Object.keys(e.commands).some(s=>s.startsWith(`${t} `))}function Nn(e){return e.map(t=>typeof t=="object"&&t.tag==="tag:yaml.org,2002:bool"&&t.test?{...t,test:t.identify?.(true)?/^(?:[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/:/^(?:[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/}:t)}var Rn=/^(?:[-+]?[0-9][0-9_]*\.[0-9_]*|\.[0-9][0-9_]*)$/,Ln=/^(?:[-+]?[0-9][0-9_]*\.[0-9_]*|\.[0-9][0-9_]*)[eE][-+][0-9]+$/;function Dn(e){return e.map(t=>typeof t!="object"||t.tag!=="tag:yaml.org,2002:float"||!t.test?t:t.test.test("1.5e+3")?{...t,test:Ln}:t.test.test("1.5")?{...t,test:Rn}:t)}var Un=/^[-+]?(?:0|[1-9][0-9_]*)$/,Jn=/^[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+$/;function Fn(e){return e.map(t=>typeof t!="object"||t.tag!=="tag:yaml.org,2002:int"||!t.test?t:t.test.test("1:00")?{...t,test:Jn}:t.test.test("19")?{...t,test:Un}:t)}function Mn(e,t){return Ts(e,t).value}function Ts(e,t){let s=new LineCounter,n=parseDocument(e,{version:"1.1",schema:"yaml-1.1",resolveKnownTags:false,lineCounter:s,customTags:o=>Fn(Dn(Nn(o)))}),a=n.errors[0]??n.warnings[0];if(a){let o=a.linePos?.[0]?.line??1,l=a.code==="MULTIPLE_DOCS"?"multi-document YAML is not supported here \u2014 one config per file":a.message.replace(/ at line \d+, column \d+:[\s\S]*$/,"");throw new p(`${t}:${o}: ${l}`)}n.options.logLevel="silent";let r;try{r=n.toJS()??{};}catch(o){throw new p(`${t}: ${o.message}`)}return {value:r,locate:o=>{let c=n.getIn(o,true)?.range?.[0];return c===void 0?void 0:s.linePos(c).line}}}var qn=["../../spec/openapi.yaml","../../../../spec/openapi.yaml"],$e;function zn(){if($e)return $e;let e=[],t=qn.map(n=>fileURLToPath(new URL(n,import.meta.url))),s=process.env.EVOLVE_OPENAPI_SPEC_PATH;s&&t.unshift(s);for(let n of t){if(e.push(n),!existsSync(n))continue;let r=parse$1(readFileSync(n,"utf-8"))?.components?.schemas,i=r?.JobCreate;if(!r||!i||typeof i!="object")throw new Error(`${n} carries no components.schemas.JobCreate \u2014 the contract this CLI validates -c against`);return $e={root:i,components:r},$e}throw new Error(`spec/openapi.yaml not found (tried: ${e.join(", ")}) \u2014 the package ships it; reinstall the SDK, or point EVOLVE_OPENAPI_SPEC_PATH at a contract checkout`)}function Cs(e){let t=e.type;return typeof t=="string"?[t]:Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function ct(e,t,s){let n=e.$ref;if(typeof n!="string")return {schema:e,specName:s};let a=n.replace("#/components/schemas/",""),r=t[a];if(!r)throw new Error(`spec/openapi.yaml: unresolvable $ref "${n}"`);return ct(r,t,a)}function Kn(e){return e.length===1&&typeof e[0]=="string"?`"${e[0]}"`:e.map((t,s)=>typeof t=="number"?`[${t}]`:s===0?t:`.${t}`).join("")}function Ns(e,t){let s=t.locate?.(e),n=`${t.source}${s!==void 0?`:${s}`:""}`;return e.length===0?n:`${Kn(e)} in ${n}`}function E(e,t,s,n){throw new p(`--config: ${Ns(e,t)} ${s} [spec: ${n}]`)}function Vn(e){for(let t=e.length-1;t>=0;t--)if(typeof e[t]=="string")return e[t];return "value"}function Gn(e,t){if(!e)return "a list";let s=ct(e,t.components,""),n=Cs(s.schema);return n.includes("string")?"a list of strings":n.includes("object")?"a list of objects":"a list"}function Se(e,t,s,n,a,r=false){let{schema:i,specName:o}=ct(t,a.components,n),l=Cs(i),c=u=>o?`${o}.${u}`:u;if(e===null){if(l.includes("null"))return;E(s,a,`must be a ${l[0]??"value"}, not null`,o);}if(l.includes("object")){let u=K(i.additionalProperties)?i.additionalProperties:void 0;if(!K(e)){let f=u&&!i.properties?`must be a map of KEY: "value" pairs, not ${X(e)}`:`must be an object like {${Hn(i)}: "..."}, not ${X(e)}`;E(s,a,f,o);}let d=K(i.properties)?i.properties:void 0;if(d){if(!r&&Array.isArray(i.required))for(let f of i.required)typeof f=="string"&&e[f]===void 0&&E(s,a,`is missing the required key "${f}"`,o);for(let f of Object.keys(e))if(d[f]===void 0&&!u)throw new p(`--config: unknown key "${f}" in ${Ns([...s,f],a)} (allowed: ${Object.keys(d).join(", ")}) [spec: ${o}]`);for(let[f,m]of Object.entries(d)){let y=e[f];y!==void 0&&Se(y,m,[...s,f],c(f),a);}}if(u)for(let[f,m]of Object.entries(e))d?.[f]===void 0&&Se(m,u,[...s,f],o,a);return}if(l.includes("array")){let u=K(i.items)?i.items:void 0;Array.isArray(e)||E(s,a,`must be ${Gn(u,a)}, not ${X(e)}`,o),typeof i.minItems=="number"&&e.length<i.minItems&&E(s,a,`needs at least ${i.minItems} ${i.minItems===1?"entry":"entries"}`,o),typeof i.maxItems=="number"&&e.length>i.maxItems&&E(s,a,`takes at most ${i.maxItems} entries`,o),u&&e.forEach((d,f)=>Se(d,u,[...s,f],o,a));return}if(Array.isArray(i.enum)){i.enum.includes(e)||E(s,a,`must be one of: ${i.enum.join(", ")}`,o);return}if(l.includes("string")){typeof e!="string"&&E(s,a,`must be a string, not ${X(e)} \u2014 quote it (${Vn(s)}: "...")`,o),typeof i.maxLength=="number"&&e.length>i.maxLength&&E(s,a,`must be at most ${i.maxLength} characters (got ${e.length})`,o);return}if(l.includes("integer")||l.includes("number")){let u=l.includes("integer");(typeof e!="number"||u&&!Number.isInteger(e))&&E(s,a,`must be ${u?"an integer":"a number"}, not ${X(e)}`,o),typeof i.minimum=="number"&&e<i.minimum&&E(s,a,`must be at least ${i.minimum}`,o),typeof i.maximum=="number"&&e>i.maximum&&E(s,a,`must be at most ${i.maximum}`,o);return}l.includes("boolean")&&typeof e!="boolean"&&E(s,a,`must be a boolean, not ${X(e)}`,o);}function Hn(e){let t=Array.isArray(e.required)?e.required[0]:void 0;return typeof t=="string"?t:(K(e.properties)?Object.keys(e.properties):[])[0]??"name"}function Wn(e,t,s){let{root:n,components:a}=zn();Se(e,n,[],"JobCreate",{source:t,locate:s,components:a},true);}function X(e){return e===null?"null":Array.isArray(e)?"a list":typeof e=="object"?`a ${e.constructor?.name??"object"}`:`a ${typeof e}`}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return false;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function et(e,t,s,n=new WeakSet){if(!(e===null||typeof e=="string"||typeof e=="boolean")){if(typeof e=="number"){if(Number.isFinite(e))return;throw new p(`--config: ${t} in ${s} is ${Number.isNaN(e)?".nan":"infinite"} \u2014 a JSON body carries finite numbers only`)}if(Array.isArray(e)||K(e)){if(n.has(e))throw new p(`--config: ${t} in ${s} is an alias of a value that contains it \u2014 a JSON body cannot carry a cycle`);if(n.add(e),Array.isArray(e))e.forEach((a,r)=>et(a,`${t}[${r}]`,s,n));else for(let[a,r]of Object.entries(e))et(r,`${t}.${a}`,s,n);n.delete(e);return}throw new p(`--config: ${t} in ${s} resolved to ${X(e)}, which a JSON body cannot carry \u2014 quote the value to keep it text`)}}function Bn(e,t){let s;try{s=t(e);}catch(i){throw new p(`--config: cannot read ${e}: ${i.message}`)}let n,a;if(e.endsWith(".json"))try{n=JSON.parse(s);}catch(i){throw new p(`--config: ${e} is not valid JSON: ${i.message}`)}else ({value:n,locate:a}=Ts(s,e));if(!n||typeof n!="object"||Array.isArray(n))throw new p(`--config: ${e} must contain a JSON/YAML object`);let r=n;for(let[i,o]of Object.entries(r))et(o,i,e);return Wn(r,e,a),n}function Qt(e,t){let s=e.indexOf("@");if(s===-1)return {name:e};let n=e.slice(0,s),a=e.slice(s+1);if(!n||!a)throw new p(`Invalid ${t} "${e}": expected name or name@version`);return {name:n,version:a}}function Yn(e){let t=e.trim();try{return JSON.parse(t)}catch{return t==="True"?true:t==="False"?false:t==="None"?null:t}}function Xn(e,t=s=>readFileSync(s,"utf-8")){let s={};for(let n of e){let a=n.indexOf("=");if(a<=0)throw new p(`Invalid --ak "${n}": expected key=value`);let r=n.slice(0,a).trim(),i=Yn(n.slice(a+1));r==="config"&&typeof i=="string"&&(i=Qn(i,t)),s[r]=i;}return s}function Qn(e,t){let s;try{s=t(e);}catch(a){throw new p(`--ak config: cannot read ${e}: ${a.message}`)}let n;if(e.endsWith(".toml"))try{n=parse(s);}catch(a){throw new p(`--ak config: ${e} is not valid TOML: ${a.message}`)}else if(e.endsWith(".json"))try{n=JSON.parse(s);}catch(a){throw new p(`--ak config: ${e} is not valid JSON: ${a.message}`)}else try{n=JSON.parse(s);}catch{try{n=parse(s);}catch{throw new p(`--ak config: ${e} parses as neither JSON nor TOML; use a .json or .toml settings file`)}}if(!n||typeof n!="object"||Array.isArray(n))throw new p(`--ak config: ${e} must contain a settings object`);return n}function dt(e,t=s=>readFileSync(s,"utf-8")){let s;try{s=t(e);}catch(n){throw new p(`--prompt: cannot read ${e}: ${n.message}`)}if(s.trim().length===0)throw new p(`--prompt: ${e} is empty \u2014 the analyzer's prompt file must carry the instruction text`);return s}function ft(e,t=s=>readFileSync(s,"utf-8")){let s;try{s=t(e);}catch(i){throw new p(`--rubric: cannot read ${e}: ${i.message}`)}let n;if(e.endsWith(".toml"))try{n=parse(s);}catch(i){throw new p(`--rubric: ${e} is not valid TOML: ${i.message}`)}else if(e.endsWith(".yaml")||e.endsWith(".yml"))n=Mn(s,e);else if(e.endsWith(".json"))try{n=JSON.parse(s);}catch(i){throw new p(`--rubric: ${e} is not valid JSON: ${i.message}`)}else throw new p(`--rubric: unsupported rubric format "${e}" \u2014 use a .toml, .yaml, .yml, or .json file (Harbor's own set)`);if(!K(n))throw new p(`--rubric: ${e} must contain a {criteria: [...]} object`);let a=Object.keys(n).filter(i=>i!=="criteria");if(a.length>0)throw new p(`--rubric: unknown key${a.length===1?"":"s"} ${a.map(i=>`"${i}"`).join(", ")} in ${e} \u2014 a rubric is {criteria: [{name, description, guidance}]}`);let r=n.criteria;if(!Array.isArray(r)||r.length===0)throw new p(`--rubric: ${e} needs a non-empty criteria list ([[criteria]] entries in TOML)`);return {criteria:r.map((i,o)=>{let l=`criteria[${o}] in ${e}`;if(!K(i))throw new p(`--rubric: ${l} must be a {name, description, guidance} object`);let c=Object.keys(i).filter(u=>u!=="name"&&u!=="description"&&u!=="guidance");if(c.length>0)throw new p(`--rubric: unknown key${c.length===1?"":"s"} ${c.map(u=>`"${u}"`).join(", ")} in ${l} \u2014 a criterion is {name, description, guidance}`);for(let u of ["name","description","guidance"])if(typeof i[u]!="string"||i[u].length===0)throw new p(`--rubric: ${l} needs a non-empty string "${u}"`);return {name:i.name,description:i.description,guidance:i.guidance}})}}function Zn(e){return e.map(t=>{let s=t.indexOf("="),n=s===-1?t:t.slice(0,s),a=s===-1?void 0:t.slice(s+1);if(s!==-1&&!a)throw new p(`Invalid --secret "${t}": expected NAME[@LABEL][=ENVNAME]`);let r=n.indexOf("@"),i=r===-1?n:n.slice(0,r),o=r===-1?void 0:n.slice(r+1);if(!i||r!==-1&&!o)throw new p(`Invalid --secret "${t}": expected NAME[@LABEL][=ENVNAME]`);return {name:i,...o!==void 0?{label:o}:{},...a!==void 0?{as:a}:{}}})}function ea(e){let t="NAME[@LABEL]:brokered|direct=VALUE";return e.map(s=>{let n=s.indexOf("=");if(n===-1)throw new p(`Invalid --secret-inline "${s}": expected ${t}`);let a=s.slice(0,n),r=s.slice(n+1);if(!r)throw new p(`Invalid --secret-inline "${s}": the value must not be empty`);let i=a.lastIndexOf(":");if(i===-1)throw new p(`Invalid --secret-inline "${a}=...": a delivery mode is required \u2014 ${t}`);let o=a.slice(0,i),l=a.slice(i+1);if(l!=="brokered"&&l!=="direct")throw new p(`Invalid --secret-inline delivery "${l}": expected brokered or direct`);let c=o.indexOf("@"),u=c===-1?o:o.slice(0,c),d=c===-1?void 0:o.slice(c+1);if(!u||c!==-1&&!d)throw new p(`Invalid --secret-inline "${a}=...": expected ${t}`);return {name:u,value:r,delivery:l,...d!==void 0?{label:d}:{}}})}function Rs(e,t){let s={};for(let n of e){let a=n.indexOf("=");if(a<=0)throw new p(`Invalid ${t} "${n}": expected KEY=VALUE`);s[n.slice(0,a)]=n.slice(a+1);}return s}function ta(e,t=s=>readFileSync(s,"utf-8")){let s=e.flags,n=typeof s.config=="string"?Bn(s.config,t):{},a;if(s.dataset!==void 0)a=s.dataset.map(h=>{let S=Qt(h,"--dataset");return {name:S.name,...S.version?{version:S.version}:{}}});else if(Array.isArray(n.datasets)&&n.datasets.length>0)a=n.datasets.map(h=>({...h}));else throw new p(`"${e.command}" requires -d/--dataset (or datasets in --config)`);if(s["include-task-name"]!==void 0)for(let h of a)h.task_names=s["include-task-name"];if(s["exclude-task-name"]!==void 0)for(let h of a)h.exclude_task_names=s["exclude-task-name"];if(s["n-tasks"]!==void 0)for(let h of a)h.n_tasks=s["n-tasks"];let r;if(s.agent!==void 0||s.model!==void 0){if(s.agent===void 0)throw new p("-m/--model requires -a/--agent");if(s.model===void 0)throw new p("-a/--agent requires at least one -m/--model (the server applies no model default)");let h=Qt(String(s.agent),"--agent");r=s.model.map(S=>({name:h.name,model_name:S,...h.version?{version:h.version}:{}}));}else if(Array.isArray(n.agents)&&n.agents.length>0)r=n.agents.map(h=>({...h}));else throw new p(`"${e.command}" requires -a/--agent and -m/--model (or agents in --config)`);if(s.effort!==void 0&&(r=r.map(h=>({...h,reasoning_effort:s.effort}))),s.ak!==void 0){let h=Xn(s.ak,t);r=r.map(S=>({...S,kwargs:{...S.kwargs??{},...h}}));}s.preset!==void 0&&(r=r.map(h=>({...h,preset:s.preset}))),s.skill!==void 0&&(r=r.map(h=>({...h,skills:[...s.skill]})));let o=n.agent_env,l=s["verifier-env"]!==void 0?Rs(s["verifier-env"],"--verifier-env"):n.verifier_env,c=s.secret!==void 0||s["secret-inline"]!==void 0?[...s.secret!==void 0?Zn(s.secret):[],...s["secret-inline"]!==void 0?ea(s["secret-inline"]):[]]:n.secrets,u=s["job-name"]!==void 0?String(s["job-name"]):n.job_name,d=s["n-attempts"]!==void 0?s["n-attempts"]:n.n_attempts,f=s["n-concurrent"]!==void 0?s["n-concurrent"]:n.n_concurrent_trials,m=s["max-trial-spend"]!==void 0?s["max-trial-spend"]:n.max_trial_spend_usd;if(s.env!==void 0&&!U.includes(String(s.env)))throw new p(`-e/--env must be one of: ${U.join(", ")}`);let y=s.env!==void 0?s.env:n.sandbox_provider,P={...n.retry??{}};s["max-retries"]!==void 0&&(P.max_retries=s["max-retries"]),s["retry-include"]!==void 0&&(P.include_exceptions=s["retry-include"]),s["retry-exclude"]!==void 0&&(P.exclude_exceptions=s["retry-exclude"]);let $=s.analyze===true||s["analyze-model"]!==void 0||s["analyze-rubric"]!==void 0||s["analyze-prompt"]!==void 0||s["analyze-provider"]!==void 0||s["analyze-effort"]!==void 0||n.analyze!==void 0,b={...n.analyze??{}};s["analyze-model"]!==void 0&&(b.model_name=String(s["analyze-model"])),s["analyze-rubric"]!==void 0&&(b.rubric=ft(String(s["analyze-rubric"]),t)),s["analyze-prompt"]!==void 0&&(b.prompt=dt(String(s["analyze-prompt"]),t)),s["analyze-provider"]!==void 0&&(b.sandbox_provider=String(s["analyze-provider"])),s["analyze-effort"]!==void 0&&(b.reasoning_effort=String(s["analyze-effort"]));let _={};for(let[h,S]of [["timeout-multiplier","timeout_multiplier"],["agent-timeout-multiplier","agent_timeout_multiplier"],["verifier-timeout-multiplier","verifier_timeout_multiplier"],["agent-setup-timeout-multiplier","agent_setup_timeout_multiplier"],["environment-build-timeout-multiplier","environment_build_timeout_multiplier"]]){let O=s[h]!==void 0?s[h]:n[S];O!==void 0&&(_[S]=O);}return {...u!==void 0?{job_name:u}:{},datasets:a,agents:r,...d!==void 0?{n_attempts:d}:{},...f!==void 0?{n_concurrent_trials:f}:{},...m!==void 0?{max_trial_spend_usd:m}:{},...y!==void 0?{sandbox_provider:y}:{},...Object.keys(P).length>0?{retry:P}:{},...$?{analyze:b}:{},...s["system-log"]===true||n.system_log===true?{system_log:true}:{},..._,...o!==void 0?{agent_env:o}:{},...l!==void 0?{verifier_env:l}:{},...c!==void 0?{secrets:c}:{}}}function sa(e){let t=e.flags,s=typeof t.dir=="string",n=typeof t.git=="string"||typeof t.ref=="string"||typeof t.path=="string",a=typeof t.from=="string";if([s,n,a].filter(Boolean).length>1)throw new p('"dataset publish" takes EXACTLY ONE source: --dir, --git/--ref/--path, or --from');if(a){let i=t.from.trim();if(i.startsWith("hub:")){let o=i.slice(4);if(o==="")throw new p('"--from hub:" needs a package reference \u2014 hub:org/name[@ref], e.g. hub:cookbook/hello-world');return {source:{hub_package:o},...typeof t.name=="string"?{name:t.name}:{},...typeof t.version=="string"?{version:t.version}:{}}}if(!i.startsWith("https://"))throw new p(`"--from" takes a public https tarball url or hub:org/name[@ref] (got "${i}")`);for(let o of ["name","version"])if(typeof t[o]!="string")throw new p(`"dataset publish" requires --${o} with --from <url> \u2014 the server fetches the tarball only after the publish is accepted, so nothing can supply it later`);return {source:{archive_url:i},name:t.name,version:t.version}}if(s)return {source:{directory:t.dir},...typeof t.name=="string"?{name:t.name}:{},...typeof t.version=="string"?{version:t.version}:{}};for(let i of ["git","ref","name","version"])if(typeof t[i]!="string"){let o=i==="git"||i==="ref"?" (or --dir for a local corpus directory)":" (a git source cannot take it from dataset.toml \u2014 the repository is only cloned after the publish is accepted)";throw new p(`"dataset publish" requires --${i}${o}`)}return {source:{git_url:t.git,git_ref:t.ref,...typeof t.path=="string"?{git_path:t.path}:{}},name:t.name,version:t.version}}function na(e,t=s=>readFileSync(s,"utf-8")){let s=e.flags,n=typeof s.dir=="string",a=typeof s["install-script"]=="string";if(n&&a)throw new p('"agent add" takes EITHER --dir OR --install-script, not both');if(!n&&!a)throw new p('"agent add" requires --install-script (or --dir for a local agent directory)');if(typeof s.run!="string")throw new p('"agent add" requires --run');let r=Rs(s["agent-env"]??[],"--agent-env");return {name:e.positionals[0],...n?{directory:s.dir}:{install_script:t(s["install-script"])},run_command:s.run,...Object.keys(r).length>0?{env:r}:{}}}var aa={out:e=>process.stdout.write(e+`
31
31
  `),err:e=>process.stderr.write(e+`
32
- `),tty:process.stdout.isTTY===true&&process.env.TERM!=="dumb",...process.stdin.isTTY===true?{confirm:async e=>{let{createInterface:t}=await import('readline/promises'),s=t({input:process.stdin,output:process.stderr});try{let n=(await s.question(`${e} [y/N] `)).trim().toLowerCase();return n==="y"||n==="yes"}finally{s.close();}}}:{}};function w(e){if(e.length===0)return [];let t=[];for(let s of e)s.forEach((n,a)=>{t[a]=Math.max(t[a]??0,n.length);});return e.map(s=>s.map((n,a)=>n.padEnd(t[a])).join(" ").trimEnd())}function N(e){return typeof e=="number"?`$${e.toFixed(2)}`:"-"}function X(e){return e.lane==="measured"?N(e.usd):e.lane==="floor"?`at least ${N(e.usd)}`:"-"}function js(e,t){if(!e.upload)return null;let s=e.upload.reported_totals;if(!s||s.cost_usd===null)return "-";let n=t?` (${s.n_trials_reporting}/${e.n_total_trials} trials reporting)`:"";return `reported ${N(s.cost_usd)}${n}`}function ot(e){if(e.input_tokens===null&&e.output_tokens===null)return null;let t=a=>a===null?"-":a.toLocaleString("en-US"),s=[e.cached_input_tokens!==null?`${t(e.cached_input_tokens)} cached`:null,e.cache_write_tokens!==null?`${t(e.cache_write_tokens)} written to cache`:null].filter(a=>a!==null),n=s.length>0?` (${s.join(", ")})`:"";return `in ${t(e.input_tokens)}${n} \xB7 out ${t(e.output_tokens)}`+(e.provisional?" \u2014 provisional":"")}function we(e){let t=`${e.name}:${e.model_name}`;return e.version?`${t}:${e.version}`:t}function We(e){let t=[`${e.n_completed} completed`,`${e.n_failed} failed`,`${e.n_pending} pending`];return e.cost_usd!=null&&t.push(`spent $${e.cost_usd.toFixed(4)}`),t.join(" \xB7 ")}function $e(e){return e.map(t=>`${t.name}@${t.version}`).join(", ")||"-"}function W(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function M(e){return e.replace(/[\t\n\r]+/g," ")}function P(e,t,s,n,a,r){if(e.flags.quiet===true){for(let l of s)t.out(r(l));return}let o=Xn(e,n,a);if(t.tty===true){let l=e.flags["no-trunc"]===true,c=[o.map(u=>u.header)];for(let u of s)c.push(o.map(d=>l?M(d.cell(u)):W(M(d.cell(u)),60)));for(let u of w(c))t.out(u);}else {e.flags["no-headers"]!==true&&t.out(o.map(l=>l.header).join(" "));for(let l of s)t.out(o.map(c=>M(c.cell(l))).join(" "));}}function Xn(e,t,s){let n=e.flags.columns;if(n===void 0)return s.map(r=>t.find(o=>o.key===r));if(n==="all")return t;let a=n.split(",").map(r=>r.trim()).filter(Boolean);if(a.length===0)throw new p("--columns got an empty column list");return a.map(r=>{let o=t.find(i=>i.key===r);if(!o)throw new p(`Unknown column "${r}" (available: ${t.map(i=>i.key).join(", ")}, or "all")`);return o})}function T(e,t,s){if(e.flags.columns!=="help")return false;for(let n of s)t.out(n.key);return true}function L(e,t={}){let s=[["id",e.id],["status",e.status],["datasets",$e(e.datasets)]];s.push(["agents",e.agents.map(we).join(", ")]);for(let o of e.agents){o.skills.length>0&&s.push(["skills",`${we(o)}: ${o.skills.join(", ")}`]);for(let i of o.skill_locks??[])s.push(["skill lock",`${i.name} @ ${i.git_commit_id?i.git_commit_id.slice(0,12):q(i.digest)}`]);}s.push(["size",`${e.counts.agents} agent(s) x ${e.counts.tasks} task(s) = ${e.n_total_trials} trial(s)`]);for(let o of e.build_exclusions)s.push(["build exclusions",o.note]);s.push(["attempts/task",String(e.n_attempts)]),s.push(["concurrency",String(e.n_concurrent_trials)]),s.push(["max spend/trial",N(e.max_trial_spend_usd)]),s.push(["worst case",N(e.worst_case_spend_usd)]),s.push(["retries",`${e.retry.max_retries}/trial on infrastructure errors`+((e.stats.n_retries??0)>0?` (${e.stats.n_retries} used)`:"")]),e.analyze&&s.push(["analyze",`${e.analyze.model_name} \xB7 ${e.analyze.rubric.criteria.length} criteri${e.analyze.rubric.criteria.length===1?"on":"a"}`+(e.analyze.sandbox_provider?` \xB7 ${e.analyze.sandbox_provider}`:"")]);{let i=[["agent",e.agent_timeout_multiplier],["verifier",e.verifier_timeout_multiplier],["agent setup",e.agent_setup_timeout_multiplier],["environment build",e.environment_build_timeout_multiplier]].filter(([,l])=>l!=null);(e.timeout_multiplier!==1||i.length>0)&&s.push(["timeouts",`x${e.timeout_multiplier}`+(i.length>0?` (${i.map(([l,c])=>`${l} x${c}`).join(", ")})`:"")]);}s.push(["provider",e.upload?"ported":e.sandbox_provider??"-"]),s.push(["spent",js(e,true)??X(ja$1(e.stats.cost_usd,e.stats.n_unmeasured_trials))]),e.stats.gpu_cost_usd!=null&&s.push(["gpu compute (est.)",`$${e.stats.gpu_cost_usd.toFixed(4)}`]);let n=e.stats.n_unmeasured_judge_trials;if((e.stats.judge_cost_usd!=null&&e.stats.judge_cost_usd>0||typeof n=="number"&&n>0)&&s.push(["spent (judge)",X(ja$1(e.stats.judge_cost_usd,n))]),e.upload?.reported_totals){let o=e.upload.reported_totals,i=[o.n_input_tokens!==null?`in ${o.n_input_tokens}`:null,o.n_cache_tokens!==null?`cache ${o.n_cache_tokens}`:null,o.n_output_tokens!==null?`out ${o.n_output_tokens}`:null].filter(l=>l!==null);i.length>0&&s.push(["reported tokens",i.join(" \xB7 ")]);}if((t.taskLinksRow??true)&&e.upload?.task_links&&e.upload.task_links.length>0){let o=e.upload.task_links,i=o.reduce((u,d)=>u+d.n_linked,0),l=o.reduce((u,d)=>u+d.n_trials,0),c=Array.from(new Set(o.flatMap(u=>u.datasets)));s.push(["task links",`${i} of ${l} ${l===1?"trial":"trials"} linked`+(c.length>0?` to ${c.join(", ")}`:"")+(i<l?` \u2014 ${l-i} without the task folder`:"")]);}if(e.stats.analysis){s.push(["analysis",We(e.stats.analysis)]);for(let[o,i]of Object.entries(e.stats.analysis.checks))s.push([` ${o}`,`${i.n_pass} pass \xB7 ${i.n_fail} fail \xB7 ${i.n_not_applicable} n/a`+(typeof i.n_unknown=="number"?` \xB7 ${i.n_unknown} unknown`:"")]);}let r=Object.entries(e.trials.byStatus).filter(([,o])=>o>0).map(([o,i])=>`${o} ${i}`).join(" \xB7 ");r&&s.push(["trials",r]);for(let o of e.source_jobs)s.push([o.action==="regrade"?"regrade of":o.action==="retry"?"retry of":"resume of",o.job_id]);if(e.upload){let o=[e.upload.original_job_name,e.upload.original_job_id].filter(i=>i!==null).join(" \xB7 ");s.push(["uploaded",`${e.upload.uploaded_at}${o?` \u2014 originally ${o}`:""}`]);}return e.idempotent_replay&&s.push(["note","idempotent replay of an existing job"]),e.failure&&s.push(["failure",`${e.failure.code}: ${e.failure.message}`]),s.push(["started",e.started_at]),s.push(["updated",e.updated_at]),[...w(s),...Qn(e)]}function Qn(e){let t=Y(e);if(t.length===0)return [];let s=t.map(n=>[` ${n.evals_key}`,n.points.map(a=>`pass@${a.k} ${a.value.toFixed(3)}`).join(" ")]);return ["","pass@k",...w(s)]}var Gt=[{key:"id",header:"ID",cell:e=>e.id},{key:"name",header:"NAME",cell:e=>e.job_name??"-"},{key:"status",header:"STATUS",cell:e=>e.status},{key:"datasets",header:"DATASETS",cell:e=>$e(e.datasets)},{key:"agents",header:"AGENTS",cell:e=>e.agents.map(we).join(", ")},{key:"trials",header:"TRIALS",cell:e=>String(e.trials.total)},{key:"spent",header:"SPENT",cell:e=>js(e,false)??X(ja$1(e.stats.cost_usd,e.stats.n_unmeasured_trials))},{key:"started",header:"STARTED",cell:e=>e.started_at}],Zn=["id","status","datasets","trials","spent","started"],Ht=[{key:"task",header:"TASK",cell:e=>e.task_name},{key:"agent",header:"AGENT",cell:e=>we({name:e.agent_info.name,model_name:e.agent_info.model_info.name,version:e.agent_info.version,reasoning_effort:e.agent_info.reasoning_effort??null})},{key:"attempt",header:"ATTEMPT",cell:e=>String(e.attempt)},{key:"status",header:"STATUS",cell:e=>e.status},{key:"reward",header:"REWARD",cell:e=>e.reward!==null?String(e.reward):"-"},{key:"spent",header:"SPENT",cell:e=>X(ka$1(e))},{key:"tokens",header:"TOKENS",cell:e=>e.usage&&ot(e.usage)||"-"},{key:"gpu",header:"GPU (EST)",cell:e=>e.gpu_cost?.estimate_usd!=null?`$${e.gpu_cost.estimate_usd.toFixed(4)}`:"-"},{key:"id",header:"TRIAL ID",cell:e=>e.id}],ea=["task","agent","attempt","status","reward","spent","id"],Wt=[{key:"task",header:"TASK",cell:e=>e.task_name},{key:"source",header:"DATASET",cell:e=>e.source},{key:"trials",header:"TRIALS",cell:e=>String(e.trials.total)},{key:"statuses",header:"STATUSES",cell:e=>Object.entries(e.trials.byStatus).filter(([,t])=>t>0).map(([t,s])=>`${t} ${s}`).join(" \xB7 ")||"-"},{key:"reward",header:"MEAN REWARD",cell:e=>Be(e.mean_reward)},{key:"spent",header:"SPENT",cell:e=>N(e.cost_usd)},{key:"check",header:"CHECK",cell:e=>sa(e.check)},{key:"check-id",header:"TASK CHECK ID",cell:e=>e.check?.id??"-"}],ta=["task","source","trials","statuses","reward","spent","check"];function As(e){let t={pass:0,fail:0,not_applicable:0,unknown:0};for(let s of Object.values(e??{}))t[s.outcome]+=1;return t}function Se(e){return e===void 0?null:e===null?"custom rubric":e.replace(/_/g," ").toUpperCase()}function Ye(e){let t=Se(e.label);return t===null||e.label===null?t:`${t}${e.executed===true?" \xB7 executed":e.executed===false?" \xB7 not executed":""}`}function sa(e){if(e===null)return "-";if(e.status!=="completed")return e.status;let t=As(e.checks),s=`pass ${t.pass} \xB7 fail ${t.fail} \xB7 n/a ${t.not_applicable} \xB7 unknown ${t.unknown}`,n=Ye(e);return n===null?s:`${n} \xB7 ${s}`}var Yt=[{key:"name",header:"NAME",cell:e=>e.name},{key:"active",header:"ACTIVE",cell:e=>e.active_version?.version??"-"},{key:"state",header:"STATE",cell:e=>e.active_version?.state??"-"},{key:"tasks",header:"TASKS",cell:e=>e.active_version?String(e.active_version.task_count):"-"},{key:"title",header:"TITLE",cell:e=>e.title??"-"}],na=["name","active","state","tasks","title"];function q(e){return e.length>19?`${e.slice(0,19)}\u2026`:e}function _e(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}var Bt=[{key:"name",header:"NAME",cell:e=>e.name},{key:"id",header:"ID",cell:e=>e.id},{key:"digest",header:"DIGEST",cell:e=>q(e.digest)},{key:"size",header:"SIZE",cell:e=>_e(e.size_bytes)},{key:"created",header:"CREATED",cell:e=>e.created_at},{key:"description",header:"DESCRIPTION",cell:e=>e.description??"-"},{key:"ref",header:"REF",cell:e=>e.ref}],aa=["name","id","digest","size","created"],Xt=[{key:"name",header:"NAME",cell:e=>e.name},{key:"source",header:"SOURCE",cell:e=>e.source},{key:"run",header:"RUN COMMAND",cell:e=>e.run_command},{key:"updated",header:"UPDATED",cell:e=>e.updated_at}],ra=["name","source","run","updated"],Qt=[{key:"name",header:"NAME",cell:e=>e.name},{key:"label",header:"LABEL",cell:e=>e.label??"default"},{key:"delivery",header:"DELIVERY",cell:e=>e.delivery??"brokered"},{key:"hosts",header:"ALLOWED HOSTS",cell:e=>e.allowedHosts.join(", ")||"-"},{key:"updated",header:"UPDATED",cell:e=>e.updatedAt},{key:"last-used",header:"LAST USED",cell:e=>e.lastUsedAt??"-"},{key:"id",header:"ID",cell:e=>e.id}],oa=["name","label","delivery","hosts","updated"];function ia(e){let t=[["trial id",e.id],["job",e.job_id],["task",e.task_name],["dataset",e.source],["agent",`${e.agent_info.name}:${e.agent_info.model_info.name}`],["attempt",String(e.attempt)],["status",e.status],["reward",e.reward!==null?String(e.reward):"-"]],s=e.verifier_result?.rewards;if(s&&Object.keys(s).length>0&&t.push(["rewards",Object.entries(s).map(([n,a])=>`${n}=${a}`).join(" \xB7 ")]),t.push(["spent",X(ha$1(e))]),e.judge_result&&t.push(["spent (judge)",X(ia$1(e))]),(e.status==="RUNNING"||e.status==="SCORING")&&e.live_spent_usd!==null){let n=e.live_spend_at?` as of ${e.live_spend_at}`:"";t.push(["spent (live)",`at least $${e.live_spent_usd.toFixed(4)}${n}`]);}if(e.usage){let n=ot(e.usage);n&&t.push(["tokens",n]);}if(e.upload){let n=e.upload.reported_agent_result;n&&n.cost_usd!==null&&t.push(["reported cost",`$${n.cost_usd.toFixed(4)} (the original run's own record \u2014 not platform-metered)`]);let a=n?[n.n_input_tokens!==null?`in ${n.n_input_tokens}`:null,n.n_cache_tokens!==null?`cache ${n.n_cache_tokens}`:null,n.n_output_tokens!==null?`out ${n.n_output_tokens}`:null].filter(r=>r!==null):[];a.length>0&&t.push(["reported tokens",a.join(" \xB7 ")]),t.push(["uploaded from",`${e.upload.original_trial_name} \xB7 task ${e.upload.original_task_name}`+(e.upload.original_trial_id?` \xB7 ${e.upload.original_trial_id}`:"")]);}if(e.attempt_phase&&t.push(["phase",e.attempt_phase]),e.upload?t.push(["provider","ported"]):e.sandbox_provider&&t.push(["provider",e.sandbox_provider]),e.sandbox_provider_degrade){let n=e.sandbox_provider_degrade;t.push(["provider degrade",`${n.from} \u2192 ${n.to}: ${n.reason}`]);}if(e.gpu_cost){let n=e.gpu_cost;if(n.estimate_usd!=null){let a=n.gpu_type??"unknown type",r=n.duration_sec!=null?`${Math.round(n.duration_sec)}s`:"unmeasured",o=`rate card v${n.rate_card.version}${n.rate_card.source?`, ${n.rate_card.source} ${n.rate_card.source_date??""}`.trimEnd():""}`;t.push(["gpu compute (est.)",`$${n.estimate_usd.toFixed(4)} \u2014 ${a} x${n.gpu_count}, ${r} on ${n.provider} (${o})`]);}else t.push(["gpu compute (est.)",`not priced \u2014 ${n.unpriced_reason??"no reason recorded"}`]);}if(e.sandbox_id&&t.push(["sandbox",e.sandbox_id]),e.verifier_environment_mode&&t.push(["verifier",e.verifier_environment_mode]),e.verifier_sandbox_id&&t.push(["verifier sandbox",e.verifier_sandbox_id]),e.agent_info.version&&t.push(["agent version",e.agent_info.version]),e.exception_info&&(t.push(["failure type",e.exception_info.exception_type]),t.push(["failure detail",e.exception_info.exception_message])),e.n_retries>0){t.push(["auto-retries",String(e.n_retries)]);for(let n of e.retries)t.push([`attempt ${n.attempt_number}`,`${n.exception_info.exception_type} \xB7 spent ${N(n.cost_usd)}`+(n.settled_at?` \xB7 settled ${n.settled_at}`:"")]);}if(e.analysis){let n=e.analysis;t.push(["analysis",`${n.status} \xB7 ${n.model_name} \xB7 ${n.id}`]);let a=n.status==="completed"?Se(n.label):null;a!==null&&t.push([" label",a]);for(let[r,o]of Object.entries(n.checks??{}))t.push([` ${r}`,`${o.outcome} \u2014 ${o.explanation}`]);n.summary&&t.push([" summary",n.summary]),n.estimated_cost_usd!==null&&t.push([" analyzer spend",`$${n.estimated_cost_usd.toFixed(4)}`]),n.failure&&t.push([" failure",`${n.failure.phase}: ${n.failure.message}`]);}return e.session_ref&&t.push(["session",e.session_ref]),e.started_at&&t.push(["started",e.started_at]),e.finished_at&&t.push(["finished",e.finished_at]),w(t)}function la(e){let t=e.rubric.criteria.length,s=[["analysis id",e.id],["status",e.status],["model",e.model_name],["rubric",`${t} criteri${t===1?"on":"a"}`]],n=e.status==="completed"?Se(e.label):null;n!==null&&s.push(["label",n]);for(let[a,r]of Object.entries(e.checks??{})){s.push([` ${a}`,`${r.outcome} \u2014 ${r.explanation}`]);for(let o of r.evidence??[])s.push(["",`${o.where} \u2014 ${M(o.quote)}`]);}if(e.summary&&s.push(["summary",e.summary]),e.estimated_cost_usd!==null&&s.push(["spent",`$${e.estimated_cost_usd.toFixed(4)}`]),e.usage){let a=ot(e.usage);a&&s.push(["tokens",a]);}return e.failure&&s.push(["failure",`${e.failure.phase}: ${e.failure.message}`]),s.push(["created",e.created_at]),e.finished_at&&s.push(["finished",e.finished_at]),w(s)}function Es(e){let t=[["name",e.name],["source",e.source],["run command",e.run_command]],s=Object.keys(e.env??{});return s.length>0&&t.push(["env",s.sort().join(", ")]),t.push(["created",e.created_at]),t.push(["updated",e.updated_at]),w(t)}var Ps=["e2b","daytona","modal"];function ua(e){return Ps.filter(t=>e?.[t]!==void 0).map(t=>{let s=e[t];return s.ok?s.degrades_to?`${t} \u2192${s.degrades_to}`:`${t} ok`:`${t} NO`}).join(" \xB7 ")}function ca(e){let t=e.gpus??0;if(t<=0)return null;let s=e.gpu_types&&e.gpu_types.length>0?e.gpu_types.join("|"):"any GPU";return `${t}x ${s}`}function Be(e){return e!==null?String(Math.round(e*1e3)/1e3):"-"}function Ts(e){let t=aa$1(e);if(t!==null){let a=typeof e.data.model=="string"&&e.data.model!==""?e.data.model:"-",r=t.usage,o=`gateway ${a} in=${r.promptTokens} out=${r.completionTokens} cached=${r.cachedTokens} $${r.costUsd.toFixed(6)}${t.startedAt?` ${t.startedAt}`:""}`;return `#${String(e.seq).padStart(4)} ${e.type.padEnd(26)} ${o}`.trimEnd()}let s=e.data?.update;if(s&&typeof s=="object"&&s.sessionUpdate==="usage")return null;let n=W(JSON.stringify(e.data??{}),140);return `#${String(e.seq).padStart(4)} ${e.type.padEnd(26)} ${n}`.trimEnd()}function D(e,t,s){if(t){e.out(JSON.stringify(s));return}let n=Ts(s);n!==null&&e.out(n);}function Cs(e){let t=e.failures?.length?` (${e.failures.length} task failure${e.failures.length===1?"":"s"})`:"";return `${e.message}${t}`}function Ns(e){let t=[["id",e.id],["status",lt(e)]];e.name!==void 0&&t.push(["dataset",e.name]),e.version!==void 0&&t.push(["version",e.version]),e.task_count!==void 0&&t.push(["tasks",String(e.task_count)]);for(let s of e.warnings)t.push(["warning",s.message??s.code]);if(e.failure){t.push(["failure",Cs(e.failure)]);for(let s of e.failure.failures??[])t.push([` ${s.task_name}`,s.error]);}return w(t)}function it(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return `${t}s`;let s=Math.floor(t/60),n=t%60;return s<60?`${s}m${String(n).padStart(2,"0")}s`:`${Math.floor(s/60)}h${String(s%60).padStart(2,"0")}m`}function da(e,t=Date.now()){let s=e.phases[e.phases.length-1],n=[];s!==void 0&&s.total>0&&(n.push(`${s.done}/${s.total}`),s.banked!==void 0&&s.banked>0&&n.push(s.name==="copying"?`${s.banked} of ${s.total} images already banked`:`${s.banked} banked`));let a=s!==void 0?Date.parse(s.started_at):NaN;return Number.isFinite(a)&&n.push(it(t-a)),`phase ${e.phase}${n.length>0?` ${n.join(" \xB7 ")}`:""}`}function fa(e){let t=e.phases.map(a=>{let r=a.completed_at!==void 0?Date.parse(a.completed_at):NaN,o=Date.parse(a.started_at),i=Number.isFinite(r)&&Number.isFinite(o)?it(r-o):"unfinished";return `${a.name} ${i}`}),s=e.images,n=e.codebuild;return w([["phases",t.join(" \xB7 ")],["images",`${s.built} built, ${s.mirrored} mirrored, ${s.banked} banked`],["codebuild",`${n.copy_builds} copy build(s), ${n.billed_minutes} billed minute(s)`]])}function lt(e){return e.receiving===true?`${e.status} (receiving)`:e.status}function pa(e){let t=[];return e.task_count!==void 0&&t.push(`tasks=${e.task_count}`),e.failure&&t.push(W(Cs(e.failure),140)),`status ${lt(e).padEnd(12)} ${t.join(" ")}`.trimEnd()}function ga(e){return `state ${e.state}`}function ma(e,t){let s=[["state",e.state]];if(t){let n=t.active_version?.version??null;s.push(["active",n===e.version?`${n} (this publish)`:n?`${n} (unchanged)`:"none"]);}return w(s)}function ha(e){let t={...e.data??{}},s=[];typeof t.trial_id=="string"&&s.push(t.trial_id),typeof t.task_name=="string"&&s.push(t.task_name),typeof t.status=="string"&&s.push(t.status),typeof t.reward=="number"&&s.push(`reward=${t.reward}`);let n=new Set(["trial_id","task_name","status","reward"]);for(let[r,o]of Object.entries(t))n.has(r)||s.push(`${r}=${typeof o=="object"?JSON.stringify(o):String(o)}`);let a=W(s.join(" "),140);return `#${String(e.seq).padStart(4)} ${e.type.padEnd(26)} ${a}`.trimEnd()}function g(e){let t={};return typeof e.flags["api-key"]=="string"&&(t.apiKey=e.flags["api-key"]),typeof e.flags["base-url"]=="string"&&(t.baseUrl=e.flags["base-url"]),t}var Ls=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ya=/^[0-9a-f][0-9a-f-]{7,34}$/i,Zt=8,Z=200,ka={job:"jobs",trial:"trials",analysis:"analyses","analyzed trial":"analyzed trials",check:"checks","task check":"task checks",session:"sessions",skill:"skills"},es=new WeakMap;function ve(e,t,s){let n=es.get(e);n===void 0&&(n=new Map,es.set(e,n));let a=n.get(t);if(a!==void 0)return a;let r=s();return n.set(t,r),r}async function Ie(e){let t=[];for await(let s of e)t.push(s);return t}function ut(e){let t=xe(e);return t!==void 0?{scope:t}:{}}var Rs=e=>ve(e,"jobs",()=>Ie(Fa$1(g(e)).list({limit:Z,...ut(e)}))),ts=e=>ve(e,"analyses",()=>Ie(Ha$1(g(e)).list({limit:Z,...ut(e)}))),ss=e=>ve(e,"checks",()=>Ie(Ia$1(g(e)).list({limit:Z,...ut(e)})));async function ba(e){let t=Fa$1(g(e)),s=(await Rs(e)).map(r=>r.id),n=[],a=0;for(let r of s){try{for await(let o of t.trials(r,{limit:Z}))n.push(o.id);}catch(o){throw o instanceof xa$1&&o.code==="rate_limited"?new p(`trial id prefixes resolve against every trial of your ${s.length} jobs (one read per job); the API's rate limit refused the walk after ${a} \u2014 pass the full trial id (evolve job trials <job> prints them)`):o}a+=1;}return n}async function wa(e){let t=ga$1(pt(e)),s=[],n;do{let a=await t.list({limit:Z,state:"all",...n!==void 0?{cursor:n}:{}});for(let r of a.items)s.push(r.id);n=a.nextCursor??void 0;}while(n!==void 0);return s}var _a={job:async e=>(await Rs(e)).map(t=>t.id),trial:ba,analysis:async e=>(await ts(e)).map(t=>t.id),"analyzed trial":async e=>(await ts(e)).map(t=>t.trial_id),check:async e=>(await ss(e)).map(t=>t.id),"task check":async e=>(await ss(e)).flatMap(t=>t.results.map(s=>s.id)),session:wa,skill:async e=>(await Ie(Ea$1(g(e)).list({limit:Z}))).map(t=>t.id)},$a=(e,t)=>ve(e,`ids:${t}`,()=>_a[t](e));function Sa(e){return `${/^[aeiou]/.test(e[0])?"an":"a"} ${e.join(" or ")}`}async function ct(e,t,s){if(s===void 0||Ls.test(s))return {noun:null,id:s};if(/^[0-9a-f][0-9a-f-]*$/i.test(s)&&s.length<Zt)throw new p(`"${s}" is too short to name ${Sa(t)} \u2014 id prefixes need at least ${Zt} characters`);if(!ya.test(s))return {noun:null,id:s};let n=s.toLowerCase(),a=[];for(let i of t){let l=new Set((await $a(e,i)).filter(c=>c.startsWith(n)));for(let c of l)a.push({noun:i,id:c});}if(a.length===1)return a[0];if(a.length===0)throw new p(`no ${t.join(" or ")} id starts with "${s}"`);let r=t.map(i=>({noun:i,n:a.filter(l=>l.noun===i).length})).filter(({n:i})=>i>0).map(({noun:i,n:l})=>`${l} ${l===1?i:ka[i]}`),o=a.slice(0,5).map(i=>t.length>1?`${i.noun} ${i.id}`:i.id);throw new p(`"${s}" is ambiguous \u2014 it matches ${r.join(" and ")}: ${o.join(", ")}${a.length>5?", \u2026":""}`)}async function k(e,t,s){return (await ct(e,[t],s)).id}async function dt(e,t,s){let n=await ct(e,["analysis","analyzed trial"],s);if(n.noun==="analysis")return {id:n.id,analysis:null};if(n.noun==="analyzed trial")return ns(e,await Ga$1(g(e)).get(n.id));if(s===void 0||!Ls.test(s))return {id:s,analysis:null};try{return {id:s,analysis:await t.get(s)}}catch(a){if(!(a instanceof xa$1)||a.status!==400)throw a;let r;try{r=await Ga$1(g(e)).get(s);}catch(o){throw o instanceof xa$1&&o.status===404?a:o}return ns(e,r)}}async function ns(e,t){if(t.analysis)return {id:t.analysis.id,analysis:t.analysis};throw (await Fa$1(g(e)).get(t.job_id)).is_regrade?new Error(`${t.id} is a regrade result \u2014 a regrade is never analyzed; analyses belong to its source trial`):new Error(`trial ${t.id} has no analysis yet \u2014 run: evolve analyze ${t.job_id}`)}function Xe(e,t){return t.analysis!==null?Promise.resolve(t.analysis):e.get(t.id)}function O(e){return {...e.flags.limit!==void 0?{limit:e.flags.limit}:{},...e.flags.cursor!==void 0?{cursor:String(e.flags.cursor)}:{}}}function xe(e){if(e.flags.scope===void 0)return;let t=String(e.flags.scope);if(!V.includes(t))throw new p(`--scope must be one of: ${V.join(", ")}; got: ${t}`+(t==="all"?" (Harbor's all adds public rows \u2014 nothing hosted is public)":""));return t}function va(e){if(e.flags.status===void 0)return;let t=String(e.flags.status).split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new p("--status got an empty status list");let s=t.filter(n=>!W$1.includes(n));if(s.length>0)throw new p(`--status must name analysis statuses (${W$1.join(", ")}); got: ${s.join(", ")}`);return t}function Ds(e){if(e.flags.status===void 0)return;let t=String(e.flags.status).split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new p("--status got an empty status list");let s=t.filter(n=>!T$1.includes(n));if(s.length>0)throw new p(`--status must name trial statuses (${T$1.join(", ")}); got: ${s.join(", ")}`);return t}function Ia(e){return e.status==="COMPLETED"?0:e.status==="FAILED"||e.status==="CANCELLED"?1:0}function xa(e){return e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.startsWith("~")}async function Oa(e,t,s){let n=new Set;for(let o of e.agents)for(let i of o.skills??[])xa(i)&&n.add(i);if(n.size===0)return e;let a=Ea$1(g(t)),r=new Map;for(let o of n){let i=await a.upload(o);if(r.set(o,i.map(l=>l.ref)),t.flags.json!==true)for(let l of i)s.err(`Uploaded skill ${l.name} (${l.ref}, ${q(l.digest)})`);}return {...e,agents:e.agents.map(o=>({...o,...o.skills!==void 0&&o.skills!==null?{skills:o.skills.flatMap(i=>r.get(i)??[i])}:{}}))}}async function as(e,t){let s=Hn(e);if(e.flags["print-config"]===true)return t.out(JSON.stringify(s,null,2)),0;let n=e.flags.json===true,a=e.flags.watch===true,r=e.flags.quiet===true,o=Fa$1(g(e)),i=await o.start(await Oa(s,e,t));if(!a){if(n)t.out(JSON.stringify(i));else {for(let c of L(i))t.out(c);t.out(""),t.out(`Follow it with: evolve job show ${i.id}`);}return 0}n?t.out(JSON.stringify({kind:"job.created",job:i})):t.out(`Job ${i.id} (${$e(i.datasets)}) ${i.status} \u2014 watching\u2026`);let l=await o.watch(i.id,{onEvent:c=>{r||t.out(n?JSON.stringify({kind:"event",...c}):ha(c));}});if(n)t.out(JSON.stringify({kind:"job.final",job:l}));else {t.out("");for(let c of L(l))t.out(c);}return Ia(l)}async function ja(e,t){if(T(e,t,Gt))return 0;let s=xe(e),a=await Fa$1(g(e)).list({...O(e),...e.flags.search!==void 0?{search:String(e.flags.search)}:{},...s!==void 0?{scope:s}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):a.items.length===0?(e.flags.quiet!==true&&t.out("No jobs."),0):(P(e,t,a.items,Gt,Zn,r=>r.id),a.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
33
- More: evolve job list --cursor ${a.nextCursor}`),0)}async function Aa(e,t){let s=Fa$1(g(e)),n=[];for(let a of e.positionals)n.push(await s.get(await k(e,"job",a)));return e.flags.json===true?(t.out(JSON.stringify(n.length===1?n[0]:n)),0):(n.forEach((a,r)=>{r>0&&t.out("");for(let o of L(a))t.out(o);}),0)}async function Ea(e,t){if(T(e,t,Ht))return 0;let s=Fa$1(g(e)),n=Ds(e),a=e.flags.dataset,r=await s.trials(await k(e,"job",e.positionals[0]),{...n!==void 0?{status:n}:{},...a!==void 0?{dataset:a}:{},...O(e)});return e.flags.json===true?(t.out(JSON.stringify(r)),0):r.items.length===0?(e.flags.quiet!==true&&t.out("No trials."),0):(P(e,t,r.items,Ht,ea,o=>o.id),t.tty===true&&e.flags.quiet!==true&&(t.out(`
34
- ${r.items.length} trial(s) shown`),r.nextCursor&&t.out(`More: evolve job trials ${e.positionals[0]} --cursor ${r.nextCursor}`)),0)}async function Pa(e,t){if(T(e,t,Wt))return 0;let n=await Fa$1(g(e)).tasks(await k(e,"job",e.positionals[0]),O(e));return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.items.length===0?(e.flags.quiet!==true&&t.out("No tasks."),0):(P(e,t,n.items,Wt,ta,a=>a.task_name),n.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
35
- More: evolve job tasks ${e.positionals[0]} --cursor ${n.nextCursor}`),0)}function Ta(e){let t=[],s=[["ID","DATASETS","STATUS","MEAN REWARD","COVERAGE","SPENT"]];for(let n of e.jobs)s.push([n.id,$e(n.datasets),n.status,Be(n.mean_reward),`${n.coverage.scored}/${n.coverage.total}`,N(n.cost_usd)]);if(t.push(...w(s)),e.taskMatrix.length>0){t.push("","Task matrix (disagreements first; columns in the order above):");let n=[["TASK","DIFF",...e.jobs.map((r,o)=>`JOB ${o+1}`)]],a=e.jobs.map(r=>r.id);for(let r of e.taskMatrix){let o=new Map(r.cells.map(i=>[i.job_id,i]));n.push([r.task_name,r.disagreement?"!":"",...a.map(i=>{let l=o.get(i);return l?l.mean_reward!==null?`${l.status} ${Be(l.mean_reward)}`:l.status:"-"})]);}t.push(...w(n));}return t}async function Ca(e,t){let s=Fa$1(g(e)),n=[];for(let r of e.positionals)n.push(await k(e,"job",r));let a=await s.compare(n);if(e.flags.json===true)t.out(JSON.stringify(a));else for(let r of Ta(a))t.out(r);return 0}async function Na(e,t){let n=await Fa$1(g(e)).cancel(await k(e,"job",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of L(n))t.out(a);return 0}async function La(e,t){let s=Fa$1(g(e)),n=await k(e,"job",e.positionals[0]);if(e.flags.yes!==true){if(t.confirm===void 0)throw new Error("deleting a job is permanent \u2014 trials, traces, analyses and stored files. Re-run with --yes to confirm.");let r=await s.get(n);if(t.err(` ${r.id} ${r.job_name||"\u2014"}`),!await t.confirm("Permanently delete this job and all associated trials?"))return t.err("Delete cancelled."),1}let a=await s.delete(n);return e.flags.json===true?t.out(JSON.stringify(a)):t.out(`Deleted job ${a.job_id}: ${a.trials_deleted} trials, ${a.analyses_deleted} analyses destroyed.`),0}async function Ra(e,t){let s=e.flags.dataset;if(!s)throw new p("job stop needs --dataset <name> (to stop the whole job, use: evolve job cancel <id>)");let n=Fa$1(g(e)),a=await n.get(await k(e,"job",e.positionals[0])),r=a.datasets.map(u=>u.name);if(!r.includes(s))throw new Error(`job ${a.id} does not run dataset ${s}; its datasets: ${r.join(", ")}`);let o=[];for await(let u of n.trials(a.id,{dataset:s}))o.push(u.id);if(o.length===0)return e.flags.json===true?t.out(JSON.stringify({stopped:[],stopped_analyses:[],already_terminal:[],not_found:[]})):t.out(`No trials in ${s}.`),0;let i=Ga$1(g(e)),l={stopped:[],stopped_analyses:[],already_terminal:[],not_found:[]},c=0;try{for(let u=0;u<o.length;u+=100){let d=o.slice(u,u+100),f=await i.stop(d);c+=d.length,l.stopped.push(...f.stopped),l.stopped_analyses.push(...f.stopped_analyses),l.already_terminal.push(...f.already_terminal),l.not_found.push(...f.not_found);}}catch(u){throw rs(l,s,o.length,c,e,t),u}return rs(l,s,o.length,c,e,t),0}function rs(e,t,s,n,a,r){let o=s-n;if(a.flags.json===true){r.out(JSON.stringify(o>0?{...e,partial:true,unreported:o}:e));return}for(let i of e.stopped)r.out(`stopped ${i.id} (${i.task_name}) ${i.status}`);for(let i of e.already_terminal)r.out(`already terminal ${i}`);for(let i of e.not_found)r.out(`not found ${i}`);r.out(`${e.stopped.length} stopped, ${e.already_terminal.length} already terminal, ${e.not_found.length} not found (${t})`),o>0&&r.out(`PARTIAL: ${o} of ${s} trials have no report \u2014 no answer came back for trials ${n+1}-${Math.min(n+100,s)}; rerun the same command to finish the rest.`);}async function Da(e,t){let s=Fa$1(g(e)),n=e.flags["filter-error-type"],a=await s.resume(await k(e,"job",e.positionals[0]),n!==void 0?{filter_error_types:n}:void 0);if(e.flags.json===true)t.out(JSON.stringify(a));else {for(let r of L(a))t.out(r);t.out(""),t.out(`Follow it with: evolve job show ${a.id}`);}return 0}async function Ja(e,t){let s=e.flags.trial,n=e.flags["failed-only"]===true;if(s!==void 0&&n)throw new p('"job retry" takes EITHER -t/--trial OR --failed-only, not both \u2014 explicit ids are already a selection');let a={};s!==void 0&&(a.trial_ids=s),n&&(a.failed_only=true);let r=await Fa$1(g(e)).retry(await k(e,"job",e.positionals[0]),a);if(e.flags.json===true)t.out(JSON.stringify(r));else {for(let o of L(r))t.out(o);t.out(""),t.out(`Follow it with: evolve job show ${r.id}`);}return 0}function Ua(e){if(e.length===0)return ["No analyzed trials."];let t=[["TRIAL","TASK","CHECKS","COST","SUMMARY"]],s=[];for(let n of e){let a=n.analysis,r;if(a.status==="failed")r=`FAILED${a.failure?` (${a.failure.phase})`:""}`,a.failure&&s.push(`analysis failed ${n.id} (${n.task_name}) \u2014 ${a.failure.phase}: ${M(a.failure.message)}`);else {let o=Object.entries(a.checks??{}).map(([l,c])=>`${l} ${c.outcome}`).join(" \xB7 ")||a.status,i=Se(a.label);r=i?`${i} \xB7 ${o}`:o;}t.push([n.id,n.task_name,r,a.estimated_cost_usd!==null?`$${a.estimated_cost_usd.toFixed(4)}`:"-",a.summary?W(M(a.summary),60):"-"]);}return [...w(t),...s]}async function Fa(e,t){let s=e.flags.json===true,n=e.flags.watch===true,a=e.flags.quiet===true,r=Fa$1(g(e)),o=await k(e,"job",e.positionals[0]),i={};e.flags.model!==void 0&&(i.model_name=String(e.flags.model)),e.flags.rubric!==void 0&&(i.rubric=rt(String(e.flags.rubric))),e.flags.prompt!==void 0&&(i.prompt=at(String(e.flags.prompt))),e.flags.env!==void 0&&(i.sandbox_provider=String(e.flags.env)),e.flags.effort!==void 0&&(i.reasoning_effort=String(e.flags.effort)),e.flags["n-concurrent"]!==void 0&&(i.n_concurrent=e.flags["n-concurrent"]),e.flags.passing===true&&(i.passing=true),e.flags.failing===true&&(i.failing=true),e.flags["n-trials"]!==void 0&&(i.n_trials=e.flags["n-trials"]);let l=await r.get(o);if((l.upload?.task_links??[]).some(f=>f.n_unlinked>0))for(let f of ft(l.upload?.task_links??null))t.err(f);else l.upload!==null&&l.upload!==void 0&&l.upload.task_links===null&&t.err(Qa);let c=await r.analyze(o,i);if(!n){if(s)t.out(JSON.stringify(c));else {for(let f of L(c))t.out(f);t.out(""),t.out(`Follow it with: evolve job show ${c.id}`);}return 0}s?t.out(JSON.stringify({kind:"analysis.accepted",job:c})):a||t.out(`Job ${c.id} \u2014 analyses enqueued, watching\u2026`);let u=await r.watchAnalysis(c.id,{onStats:f=>{a||f.stats.analysis&&t.out(s?JSON.stringify({kind:"analysis.stats",analysis:f.stats.analysis}):`analyses ${We(f.stats.analysis)}`);}}),d=[];for await(let f of r.trials(u.id))f.analysis&&d.push(f);if(s)t.out(JSON.stringify({kind:"analysis.final",job:u,trials:d}));else {t.out("");for(let f of Ua(d))t.out(f);u.stats.analysis&&(t.out(""),t.out(`analyses ${We(u.stats.analysis)}`)),t.out("Details: evolve trial show <trial-id>");}return (u.stats.analysis?.n_failed??0)>0?1:0}function Ma(e){return e.replace(/_/g," ").split(" ").map(t=>t&&t[0].toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function Js(e){let t=[],s=e.results.filter(a=>a.status==="failed");if(e.results.length===1){let a=e.results[0];if(a.status==="failed"&&a.failure)return t.push(`\u274C ${a.task_name}: ${a.failure.phase}: ${a.failure.message}`),t;t.push(`Task Quality Checks: ${a.task_name}`);let r=a.status==="completed"?Ye(a):null;r!==null&&t.push(`Label: ${r}`);let o=[["CHECK","OUTCOME","EXPLANATION"]];for(let[i,l]of Object.entries(a.checks??{})){o.push([Ma(i),l.outcome,M(l.explanation)]);for(let c of l.evidence??[])o.push(["","",`${c.where} \u2014 ${M(c.quote)}`]);}return o.length===1&&o.push(["-",a.status,"-"]),t.push(...w(o)),a.cost_usd!==null&&t.push(`Agent cost: $${a.cost_usd.toFixed(4)}`),t.push(`Task check id: ${a.id}`),t}t.push("Task Quality Checks");let n=[["TASK","LABEL","PASS","FAIL","N/A","UNKNOWN","COST ($)","TASK CHECK ID"]];for(let a of e.results){if(a.status==="failed"){n.push([a.task_name,"-","-","-","-","-","-",a.id]);continue}if(a.status!=="completed"){n.push([a.task_name,a.status,"","","","","-",a.id]);continue}let r=As(a.checks);n.push([a.task_name,Ye(a)??"-",String(r.pass),String(r.fail),String(r.not_applicable),String(r.unknown),a.cost_usd!==null?a.cost_usd.toFixed(4):"-",a.id]);}t.push(...w(n));for(let a of s)a.failure&&t.push(`\u274C ${a.task_name}: ${a.failure.phase}: ${a.failure.message.split(`
36
- `)[0]}`);return e.cost_usd!==null&&t.push(`Total agent cost: $${e.cost_usd.toFixed(4)}`),t}function Us(e){let t={};for(let s of e.results)t[s.status]=(t[s.status]??0)+1;return Object.entries(t).map(([s,n])=>`${n} ${s}`).join(" \xB7 ")}function Fs(e){let t=e.rubric.criteria.length,s=[["check id",e.id],["status",e.status],["source",e.source.type==="dataset"?`dataset ${e.source.dataset} (package sha256 ${e.source.sha256.slice(0,12)}\u2026)`:`archive ${e.source.bytes} bytes sha256 ${e.source.sha256.slice(0,12)}\u2026`],["tasks",`${e.results.length} (${Us(e)})`],["model",`${e.model_name} at effort ${e.reasoning_effort}`],["rubric",`${t} criteri${t===1?"on":"a"}`],["provider",e.sandbox_provider]];return e.prompt!==null&&s.push(["prompt","custom (Harbor's -p text)"]),e.n_concurrent!==null&&s.push(["n_concurrent",String(e.n_concurrent)]),e.include_task_names.length>0&&s.push(["include",e.include_task_names.join(", ")]),e.exclude_task_names.length>0&&s.push(["exclude",e.exclude_task_names.join(", ")]),e.n_tasks!==null&&s.push(["n_tasks",String(e.n_tasks)]),s.push(["created",e.created_at]),e.finished_at&&s.push(["finished",e.finished_at]),[...w(s),"",...Js(e)]}async function qa(e,t){let s=e.flags.json===true,n=e.flags.watch===true,a=e.flags.quiet===true,r=Ia$1(g(e)),o={};e.flags.model!==void 0&&(o.model_name=String(e.flags.model)),e.flags.rubric!==void 0&&(o.rubric=rt(String(e.flags.rubric))),e.flags.prompt!==void 0&&(o.prompt=at(String(e.flags.prompt))),e.flags.env!==void 0&&(o.sandbox_provider=String(e.flags.env)),e.flags.effort!==void 0&&(o.reasoning_effort=String(e.flags.effort)),e.flags["n-concurrent"]!==void 0&&(o.n_concurrent=e.flags["n-concurrent"]),e.flags["include-task-name"]!==void 0&&(o.include_task_names=e.flags["include-task-name"]),e.flags["exclude-task-name"]!==void 0&&(o.exclude_task_names=e.flags["exclude-task-name"]),e.flags["n-tasks"]!==void 0&&(o.n_tasks=e.flags["n-tasks"]);let i=e.positionals[0],l=e.flags.dataset;if(i===void 0&&l===void 0)throw new p("check takes a <path> (a task directory, or a directory of them) or -d/--dataset <name[@version]>");if(i!==void 0&&l!==void 0)throw new p("check takes EITHER a <path> OR -d/--dataset, not both");let c=l!==void 0?{dataset:l}:{directory:i};!s&&!a&&t.out("\u{1F50E} Checking task quality...");let u=await r.create({source:c,...o});if(!n){if(s)t.out(JSON.stringify(u));else {for(let f of Fs(u))t.out(f);t.out(""),t.out(`Follow it with: evolve check show ${u.id}`);}return 0}s?t.out(JSON.stringify({kind:"check.accepted",check:u})):a||t.out(`Check ${u.id} \u2014 ${u.results.length} task${u.results.length===1?"":"s"} queued, watching\u2026`);let d=await r.watch(u.id,{onProgress:f=>{a||t.out(s?JSON.stringify({kind:"check.progress",check:f}):`tasks ${Us(f)}`);}});if(s)t.out(JSON.stringify({kind:"check.final",check:d}));else {t.out("");for(let f of Js(d))t.out(f);t.out(""),t.out(`Report: evolve check show ${d.id}`);}return d.results.some(f=>f.status==="failed")?1:0}function za(e){if(e.flags.status===void 0)return;let t=String(e.flags.status).split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new p("--status got an empty status list");let s=t.filter(n=>!X$1.includes(n));if(s.length>0)throw new p(`--status must name check statuses (${X$1.join(", ")}); got: ${s.join(", ")}`);return t}var os=[{key:"id",header:"ID",cell:e=>e.id},{key:"status",header:"STATUS",cell:e=>e.status},{key:"tasks",header:"TASKS",cell:e=>String(e.results.length)},{key:"model",header:"MODEL",cell:e=>e.model_name},{key:"spent",header:"SPENT",cell:e=>e.cost_usd!==null?`$${e.cost_usd.toFixed(4)}`:"-"},{key:"created",header:"CREATED",cell:e=>e.created_at},{key:"finished",header:"FINISHED",cell:e=>e.finished_at??"-"}],Ka=["id","status","tasks","model","spent","created"];async function Va(e,t){if(T(e,t,os))return 0;let s=xe(e),n=za(e),a=await Ia$1(g(e)).list({...O(e),...s!==void 0?{scope:s}:{},...n!==void 0?{status:n}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):a.items.length===0?(e.flags.quiet!==true&&t.out("No checks."),0):(P(e,t,a.items,os,Ka,r=>r.id),a.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
37
- More: evolve check list --cursor ${a.nextCursor}`),0)}async function Ga(e,t){let s=await Ia$1(g(e)).get(await k(e,"check",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of Fs(s))t.out(n);return s.results.some(n=>n.status==="failed")?1:0}async function Ha(e,t){let s=e.flags.json===true,n=e.flags.since,a=await Ia$1(g(e)).transcript(await k(e,"task check",e.positionals[0]),n!==void 0?{since:n}:void 0);for(let r of a.events)D(t,s,r);for(let r of a.gateway_calls)D(t,s,r);return !s&&a.events.length===0&&t.out("No trace events."),0}var is=["task-check","trace-parsed",...ca$1];async function ls(e,t){try{return await e.task(t)}catch(s){throw s instanceof xa$1&&s.status===404?new Error(`'${t}' is not a task check \u2014 --stream reads one task check's artifacts (results[].id on \`evolve check show\`); to save the whole check by its check id, drop --stream`):s}}async function Wa(e,t){let s=Ia$1(g(e)),n=e.flags.json===true,a=e.flags.stream;if(a!==void 0&&(e.flags["output-dir"]!==void 0||e.flags.overwrite===true))throw new p('"check download" takes EITHER --stream OR -o/--overwrite, not both');if((a===void 0||a!=="trace-parsed")&&e.flags.since!==void 0)throw new p("--since pages the parsed events; it applies only to --stream trace-parsed");let r=(await ct(e,a!==void 0?["task check"]:["check","task check"],e.positionals[0])).id,o=r;if(a!==void 0){if(!is.includes(a))throw new p(`--stream must be one of: ${is.join(", ")}`);if(a==="task-check"){let c=await ls(s,o);return t.out(n?JSON.stringify({task_check:c}):JSON.stringify(c,null,2)),0}if(a==="trace-parsed"){let c=e.flags.since,u=await s.transcript(o,c!==void 0?{since:c}:void 0);for(let d of u.events)D(t,n,d);for(let d of u.gateway_calls)D(t,n,d);return !n&&u.events.length===0&&t.out("No trace events."),0}if(await ls(s,o),a==="agent-home"){let c=await s.artifact(o,a);if(c===null)return t.out(n?JSON.stringify({files:null}):`No ${a} content was stored for this task check.`),0;if(n)t.out(JSON.stringify({files:c}));else for(let[u,d]of Object.entries(c))t.out(`===== ${u} (${Buffer.byteLength(d,"utf8")} bytes) =====`),t.out(d);return 0}let l=await s.artifact(o,a);return l===null?(t.out(n?JSON.stringify({log:null}):`No ${a} log was stored for this task check.`),0):(t.out(n?JSON.stringify({log:l}):l),0)}return await Ms(e,t,{fetch:l=>s.download(r,{to:l}),outputDir:e.flags["output-dir"]??"checks",scratchPrefix:"evolve-check-download-",enrich:async l=>{let{readdir:c}=await import('fs/promises'),{join:u}=await import('path'),d=await Oe(e),f=existsSync(u(l,"check_report.json")),m=f?(await c(l,{withFileTypes:true})).filter($=>$.isDirectory()).map($=>u(l,$.name)):[l],y=new Map;for(let $ of m){let h=await Ya($);h!==null&&y.set($,h);}let j=f?r:y.get(l)?.checkId;if(j===void 0)return [];let S=await s.get(j),_=[];f&&(await Qe(u(l,"evolve.json"),wa$1(S,d)),_.push("evolve.json"));for(let[$,h]of y){let v=S.results.find(x=>x.id===h.taskCheckId);v!==void 0&&(await Qe(u($,"evolve.json"),va$1(v,S,d)),_.push(f?`${$.slice(l.length+1)}/evolve.json`:"evolve.json"));}return _}})}async function Ya(e){let{readFile:t}=await import('fs/promises'),{join:s}=await import('path');try{let n=JSON.parse(await t(s(e,"result.json"),"utf8")),a=n.x_evolve?.taskCheckId,r=n.x_evolve?.checkId;return typeof a=="string"&&typeof r=="string"?{taskCheckId:a,checkId:r}:null}catch{return null}}async function Qe(e,t){let{writeFile:s}=await import('fs/promises');await s(e,JSON.stringify(t,null,2)+`
38
- `);}async function Ms(e,t,s){let{mkdtemp:n,rm:a}=await import('fs/promises'),{tmpdir:r}=await import('os'),{join:o}=await import('path'),{extractTarGz:i,tarGzTopLevelName:l}=await import('../tar-GVC4KE52.js'),c=await n(o(r(),s.scratchPrefix));try{let u=await s.fetch(c),d=await l(u),f=o(s.outputDir,d);if(existsSync(f)){if(e.flags.overwrite!==!0)throw new Error(`${f} already exists (pass --overwrite to replace it)`);await a(f,{recursive:!0,force:!0});}let m;try{m=await i(u,s.outputDir,d);}catch(y){throw await a(f,{recursive:!0,force:!0}).catch(()=>{}),y}return m.push(...await s.enrich(f)),e.flags.json===!0?t.out(JSON.stringify({path:f,files:m.length})):t.out(`Saved ${f} (${m.length} files)`),0}finally{await a(c,{recursive:true,force:true}).catch(()=>{});}}async function Ba(e,t){let s=Fa$1(g(e)),n={},a=Ds(e);a!==void 0&&(n.statuses=a),e.flags.task!==void 0&&(n.task_name=String(e.flags.task));let r=await s.regrade(await k(e,"job",e.positionals[0]),n);if(e.flags.json===true)t.out(JSON.stringify(r));else {for(let o of L(r))t.out(o);t.out(""),t.out(`Follow it with: evolve job show ${r.id}`);}return 0}async function Xa(e,t){let s=Fa$1(g(e)),n=await k(e,"job",e.positionals[0]),{join:a}=await import('path'),r=e.flags["output-dir"]??process.cwd(),o=`job-${n}`,i=a(r,o);if(existsSync(i)&&e.flags.overwrite!==true)throw new Error(`${i} already exists (pass --overwrite to replace it)`);let{mkdtemp:l,rm:c}=await import('fs/promises'),{tmpdir:u}=await import('os'),{extractTarGz:d}=await import('../tar-GVC4KE52.js'),f=await l(a(u(),"evolve-job-download-"));try{let m=await s.download(n,{to:f});e.flags.overwrite===!0&&await c(i,{recursive:!0,force:!0});let y;try{y=await d(m,r,o);}catch(x){throw await c(i,{recursive:!0,force:!0}).catch(()=>{}),x}let{readdir:j,readFile:S,writeFile:_}=await import('fs/promises'),$=await s.get(n),h=await Oe(e),v=new Map;for await(let x of s.trials(n))v.set(x.id,x);await _(a(i,"evolve.json"),JSON.stringify(sa$1($,h),null,2)+`
39
- `),y.push("evolve.json");for(let x of await j(i,{withFileTypes:!0})){if(!x.isDirectory())continue;let je;try{je=JSON.parse(await S(a(i,x.name,"result.json"),"utf8")).x_evolve?.trialId;}catch{continue}let mt=je!==void 0?v.get(je):void 0;mt&&(await _(a(i,x.name,"evolve.json"),JSON.stringify(ra$1(mt,$,h),null,2)+`
40
- `),y.push(`${x.name}/evolve.json`));}return e.flags.json===!0?t.out(JSON.stringify({path:i,files:y.length})):t.out(`Saved ${i} (${y.length} files)`),0}finally{await c(f,{recursive:true,force:true}).catch(()=>{});}}function oe(e){return e.receiving?`${e.status} (receiving)`:e.status}function qs(e){let t=[["id",e.id],["status",oe(e)]];return e.source!==null&&t.push(["source",e.source.type==="archive"?`archive (${q(`sha256:${e.source.sha256}`)})`:e.source.type==="archive_url"?`url ${e.source.url}`:`hub job ${e.source.job_id}`]),e.dataset!==null&&t.push(["dataset",e.dataset]),e.job_id!==null&&t.push(["job",e.job_id]),e.n_trials_uploaded!==null&&t.push(["trials",String(e.n_trials_uploaded)]),e.n_trials_skipped!==null&&t.push(["skipped",String(e.n_trials_skipped)]),e.progress!==null&&t.push(["phase",e.progress.phase]),e.failure!==null&&t.push(["failure",`${e.failure.code}: ${e.failure.message}`]),[...w(t),...zs(e.skipped_trials),...ft(e.task_links)]}var us={hash_mismatch:"hash mismatch",task_not_in_dataset:"task not in the dataset",no_dataset_named:"no dataset named",dataset_ambiguous:"same task in two datasets",no_hash_match:"no task with this hash",no_task_digest:"no task digest in the archive"},Qa="uploaded before task linking existed: whether its trials carry the task folder is unknown here; each analysis row records it (task_absent_reason)";function Za(e){return e==="dataset_flag"?"by task name, -d":"task hashes equal"}function ft(e){if(e===null||e.length===0)return [];let t=e.reduce((d,f)=>d+f.n_trials,0),s=e.reduce((d,f)=>d+f.n_linked,0),n=(d,f)=>`${d} ${f}${d===1?"":"s"}`,a=d=>Object.entries(d.link_reasons).map(([f,m])=>`${us[f]??f}${Object.keys(d.link_reasons).length>1?` ${m}`:""}`).join(", ")+(d.candidates.length>0?` [${d.candidates.join(", ")}]`:""),r=e.filter(d=>d.n_unlinked>0);if(s===0){let d=Array.from(new Set(r.flatMap(m=>Object.keys(m.link_reasons)))).map(m=>us[m]??m).join(", "),f=Array.from(new Set(r.flatMap(m=>m.candidates)));return [`no dataset matched (${d}${f.length>0?`: ${f.join(", ")}`:""}); analyses of this job will run without the task folder \u2014 link explicitly with -d`]}let o=new Map,i="";for(let d of e)if(d.n_linked!==0){i=Za(d.linked_by);for(let f of d.datasets)o.set(f,(o.get(f)??0)+d.n_linked);}let l=Array.from(o.entries()),c=l.length===1?l[0][0]:l.map(([d,f])=>`${d} (${f})`).join(", "),u=[`linked ${s} of ${n(t,"trial")} to ${c} (${i})`];return r.length>0&&u.push(`not linked: ${r.map(d=>`${d.task_name} (${n(d.n_unlinked,"trial")}, ${a(d)})`).join(", ")} \u2014 analyses of those trials run without the task folder; link explicitly: evolve upload <dir> -d <name[@version]>`),u}function zs(e){return e===null||e.length===0?[]:e.map(t=>` skipped ${t.trial}: ${t.code}: ${t.message}`)}function er(e){let t=e.failure!==null?W(`${e.failure.code}: ${e.failure.message}`,140):"";return `status ${oe(e).padEnd(20)} ${t}`.trimEnd()}function tr(e,t=Date.now()){let s=it(t-Date.parse(e.started_at));return `phase ${e.phase.padEnd(20)} ${s} elapsed`}async function Ks(e,t,s,n){let a=Fa$1(g(e)),r=e.flags.json===true;r||s.out(n==="accepted"?`Upload accepted: import ${t.id} ${oe(t)} \u2014 watching\u2026`:`Import ${t.id} ${oe(t)} \u2014 watching\u2026`);let o=await a.watchImport(t.id,{onStatus:u=>{r||s.out(er(u));},onProgress:u=>{r||s.out(tr(u));}});if(o.status==="FAILED"||o.job_id===null){let u=o.failure??{code:"import_failed",message:"the import settled without a job and without a recorded failure"};return r&&s.out(JSON.stringify({error:u})),s.err(`Error: ${u.message}`),1}let i=await a.get(o.job_id);if((o.n_trials_skipped??0)>0){s.err(`Skipped ${o.n_trials_skipped} trial(s) \u2014 see: evolve job import ${o.id}`);for(let u of zs(o.skipped_trials))s.err(u);}let l=ft(i.upload?.task_links??null),c=(i.upload?.task_links??[]).some(u=>u.n_unlinked>0);if(r){if(c)for(let u of l)s.err(u);return s.out(JSON.stringify(i)),0}s.out("");for(let u of L(i,{taskLinksRow:false}))s.out(u);if(l.length>0){s.out("");for(let u of l)s.out(u);}return s.out(""),s.out(`Analyze it with: evolve analyze ${i.id}`),0}async function sr(e,t){let s=Fa$1(g(e)),n=e.flags.json===true,a=e.flags.dataset,r=e.flags.from,o=e.positionals[0];if(r!==void 0&&o!==void 0)throw new p('"upload" takes EXACTLY ONE source: <job_dir>, or --from <url>');if(r===void 0&&o===void 0)throw new p('"upload" needs a source: <job_dir> (or its .tar.gz), or --from <url>');if(r!==void 0&&!r.trim().startsWith("https://"))throw new p(`"--from" takes a public https url of a job archive (got "${r}")`);let i=-1,l=await s.upload(r!==void 0?{archive_url:r.trim()}:o,{...a!==void 0?{dataset:a}:{},onUploadProgress:(c,u)=>{if(n)return;let d=u>0?Math.floor(c/u*10):10;d!==i&&(i=d,t.out(`upload ${c}/${u} (${Math.min(100,d*10)}%)`));},onRegistered:c=>{n||t.out(`Registered import ${c} \u2014 re-attach anytime with: evolve job import ${c} --watch`);}});if(e.flags["no-wait"]===true){if(n)return t.out(JSON.stringify(l)),0;for(let c of qs(l))t.out(c);return t.out(""),t.out(`Follow it with: evolve job import ${l.id} --watch`),0}return Ks(e,l,t,"accepted")}var cs=[{key:"id",header:"ID",cell:e=>e.id},{key:"status",header:"STATUS",cell:oe},{key:"job",header:"JOB",cell:e=>e.job_id??"-"},{key:"trials",header:"TRIALS",cell:e=>e.n_trials_uploaded===null?"-":String(e.n_trials_uploaded)},{key:"skipped",header:"SKIPPED",cell:e=>e.n_trials_skipped===null?"-":String(e.n_trials_skipped)},{key:"dataset",header:"DATASET",cell:e=>e.dataset??"-"},{key:"created",header:"CREATED",cell:e=>e.created_at??""}],nr=["id","status","job","trials","skipped","dataset","created"];async function ar(e,t){if(T(e,t,cs))return 0;let s=Fa$1(g(e)),n=e.flags.status;if(n!==void 0&&!["QUEUED","RUNNING","COMPLETED","FAILED"].includes(n))throw new p(`"--status" must be one of QUEUED, RUNNING, COMPLETED, FAILED (got "${n}")`);let a=await s.listImports({...O(e),...n!==void 0?{status:n}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):a.items.length===0?(e.flags.quiet!==true&&t.out("No job imports."),0):(P(e,t,a.items,cs,nr,r=>r.id),a.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
41
- More: evolve job imports --cursor ${a.nextCursor}`),0)}async function rr(e,t){let n=await Fa$1(g(e)).getImport(e.positionals[0]);if(e.flags.watch===true)return Ks(e,n,t,"attached");if(e.flags.json===true)return t.out(JSON.stringify(n)),0;for(let a of qs(n))t.out(a);return 0}async function or(e,t){let n=await Ga$1(g(e)).get(await k(e,"trial",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of ia(n))t.out(a);return 0}var ds=ba$1;async function ir(e,t){let s=Ga$1(g(e)),n=e.flags.json===true,a=e.flags.stream;if(a!==void 0&&(e.flags["output-dir"]!==void 0||e.flags.overwrite===true))throw new p('"trial download" takes EITHER --stream OR -o/--overwrite, not both');if((a===void 0||a!=="trace-parsed")&&(e.flags.cursor!==void 0||e.flags.limit!==void 0))throw new p("--cursor/--limit page the parsed events; they apply only to --stream trace-parsed");let r=await k(e,"trial",e.positionals[0]);if(a!==void 0){if(!ds.includes(a))throw new p(`--stream must be one of: ${ds.join(", ")}`);if(a==="trace-parsed"){let _=0;for await(let $ of s.traceEvents(r,O(e)))D(t,n,$),_+=1;return !n&&_===0&&t.out("No trace events."),0}if(a==="agent-home"){let _=await s.artifact(r,a);if(_===null)return t.out(n?JSON.stringify({files:null}):`No ${a} content was stored for this trial.`),0;if(n)t.out(JSON.stringify({files:_}));else for(let[$,h]of Object.entries(_))t.out(`===== ${$} (${Buffer.byteLength(h,"utf8")} bytes) =====`),t.out(h);return 0}let S=await s.artifact(r,a);return S===null?(t.out(n?JSON.stringify({log:null}):`No ${a} log was stored for this trial.`),0):(t.out(n?JSON.stringify({log:S}):S),0)}let{mkdir:o,writeFile:i}=await import('fs/promises'),{join:l,dirname:c}=await import('path'),u=l(e.flags["output-dir"]??"trials",r);if(existsSync(u)&&e.flags.overwrite!==true)throw new Error(`${u} already exists (pass --overwrite to replace it)`);let d=await s.get(r),f=null;try{f=await Fa$1(g(e)).get(d.job_id);}catch{f=null;}let m=[];for await(let S of s.traceEvents(r))m.push(S);let y=ta$1({trial:d,job:f,events:m,atif:await s.artifact(r,"trace-atif"),verifierLog:await s.artifact(r,"verifier"),stdout:await s.artifact(r,"trace-stdout"),stderr:await s.artifact(r,"trace-stderr"),home:await s.artifact(r,"agent-home"),userId:await Oe(e)});await o(u,{recursive:true});let j=[];for(let S of Object.keys(y).sort()){let _=l(u,...S.split("/"));await o(c(_),{recursive:true}),await i(_,y[S]),j.push(S),n||t.out(S);}return n?t.out(JSON.stringify({path:u,saved:j})):t.out(`Saved ${u}`),0}async function Oe(e){try{return (await Ja$1(g(e)).status()).user_id}catch{return null}}async function lr(e,t){let s=Ga$1(g(e)),n=e.flags.json===true,a=O(e);e.flags.type!==void 0&&(a.type=String(e.flags.type)),e.flags.grep!==void 0&&(a.grep=String(e.flags.grep)),e.flags.tail!==void 0&&(a.tail=e.flags.tail);let r=0;for await(let o of s.traceEvents(await k(e,"trial",e.positionals[0]),a))D(t,n,o),r+=1;return !n&&r===0&&t.out("No trace events."),0}async function ur(e,t){let s=Fa$1(g(e)),n=await k(e,"job",e.positionals[0]),a=O(e);e.flags.type!==void 0&&(a.type=String(e.flags.type));let r=await s.grep(n,e.positionals[1],a);if(e.flags.json===true)return t.out(JSON.stringify(r)),0;if(r.items.length===0)return t.out("No matches."),0;for(let o of r.items){let i=o.match_count===1?"match":"matches";t.out(`${o.trial_id} ${o.task_name??"-"} ${o.match_count} ${i}`);for(let l of o.events){let c=Ts(l);c!==null&&t.out(` ${c}`);}}return r.hasMore&&r.nextCursor&&(t.out(""),t.out(`More trials match \u2014 resume with --cursor ${r.nextCursor}`)),0}async function cr(e,t){let s=await Ga$1(g(e)).retry(await k(e,"trial",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else {for(let n of L(s))t.out(n);t.out(""),t.out(`Follow it with: evolve job show ${s.id}`);}return 0}async function dr(e,t){let s=await Ga$1(g(e)).regrade(await k(e,"trial",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else {for(let n of L(s))t.out(n);t.out(""),t.out(`Follow it with: evolve job show ${s.id}`);}return 0}async function fr(e,t){let s=Ga$1(g(e)),n=[];for(let r of e.positionals)n.push(await k(e,"trial",r));let a=await s.stop(n);if(e.flags.json===true)return t.out(JSON.stringify(a)),0;for(let r of a.stopped)t.out(`stopped ${r.id} (${r.task_name}) ${r.status}`);for(let r of a.stopped_analyses)t.out(`stopped analysis ${r.id} ${r.status}`);for(let r of a.already_terminal)t.out(`already terminal ${r}`);for(let r of a.not_found)t.out(`not found ${r}`);return 0}function pr(e){if(typeof e.estimated_cost_usd=="number")return `$${e.estimated_cost_usd.toFixed(4)}`;let t=e.usage?.spent_usd;return typeof t=="number"&&e.usage?.provisional?`at least $${t.toFixed(4)}`:"-"}var fs=[{key:"id",header:"ID",cell:e=>e.id},{key:"status",header:"STATUS",cell:e=>e.status},{key:"task",header:"TASK",cell:e=>e.task_name},{key:"job",header:"JOB",cell:e=>e.job_id},{key:"trial",header:"TRIAL",cell:e=>e.trial_id},{key:"model",header:"MODEL",cell:e=>e.model_name},{key:"attempts",header:"ATTEMPTS",cell:e=>String(e.attempts??1)},{key:"spent",header:"SPENT",cell:pr},{key:"created",header:"CREATED",cell:e=>e.created_at},{key:"finished",header:"FINISHED",cell:e=>e.finished_at??"-"}],gr=["id","status","task","model","spent","created"];async function mr(e,t){if(T(e,t,fs))return 0;let s=xe(e),n=va(e),a=e.flags.job!==void 0?await k(e,"job",String(e.flags.job)):void 0,o=await Ha$1(g(e)).list({...O(e),...s!==void 0?{scope:s}:{},...a!==void 0?{job:a}:{},...n!==void 0?{status:n}:{}});return e.flags.json===true?(t.out(JSON.stringify(o)),0):o.items.length===0?(e.flags.quiet!==true&&t.out("No analyses."),0):(P(e,t,o.items,fs,gr,i=>i.id),o.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
42
- More: evolve analysis list --cursor ${o.nextCursor}`),0)}async function hr(e,t){let s=Ha$1(g(e)),n=await Xe(s,await dt(e,s,e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of la(n))t.out(a);return 0}async function yr(e,t){let s=Ha$1(g(e)),n=e.flags.json===true,a=e.flags.since,r=await s.transcript((await dt(e,s,e.positionals[0])).id,a!==void 0?{since:a}:void 0);for(let o of r.events)D(t,n,o);for(let o of r.gateway_calls)D(t,n,o);return !n&&r.events.length===0&&t.out("No trace events."),0}var ps=["analysis","trace-parsed",...ca$1];async function kr(e,t){let s=Ha$1(g(e)),n=e.flags.json===true,a=e.flags.stream;if(a!==void 0&&(e.flags["output-dir"]!==void 0||e.flags.overwrite===true))throw new p('"analysis download" takes EITHER --stream OR -o/--overwrite, not both');if((a===void 0||a!=="trace-parsed")&&e.flags.since!==void 0)throw new p("--since pages the parsed events; it applies only to --stream trace-parsed");let r=await dt(e,s,e.positionals[0]),o=r.id;if(a!==void 0){if(!ps.includes(a))throw new p(`--stream must be one of: ${ps.join(", ")}`);if(a==="analysis"){let l=await Xe(s,r);return t.out(n?JSON.stringify({analysis:l}):JSON.stringify(l,null,2)),0}if(a==="trace-parsed"){let l=e.flags.since,c=await s.transcript(o,l!==void 0?{since:l}:void 0);for(let u of c.events)D(t,n,u);for(let u of c.gateway_calls)D(t,n,u);return !n&&c.events.length===0&&t.out("No trace events."),0}if(a==="agent-home"){let l=await s.artifact(o,a);if(l===null)return t.out(n?JSON.stringify({files:null}):`No ${a} content was stored for this analysis.`),0;if(n)t.out(JSON.stringify({files:l}));else for(let[c,u]of Object.entries(l))t.out(`===== ${c} (${Buffer.byteLength(u,"utf8")} bytes) =====`),t.out(u);return 0}let i=await s.artifact(o,a);return i===null?(t.out(n?JSON.stringify({log:null}):`No ${a} log was stored for this analysis.`),0):(t.out(n?JSON.stringify({log:i}):i),0)}return Ms(e,t,{fetch:i=>s.download(o,{to:i}),outputDir:e.flags["output-dir"]??"analyses",scratchPrefix:"evolve-analysis-download-",enrich:async i=>{let{join:l}=await import('path'),c=await Xe(s,r);return await Qe(l(i,"evolve.json"),ua$1(c,await Oe(e))),["evolve.json"]}})}function br(e){switch(e.kind){case "git":{let t=e.ref===e.commit?"":` @ ${e.ref}`;return [`source: ${e.git_url??"?"}${t} (commit ${e.commit.slice(0,12)})`,...e.path?[` subfolder: ${e.path}`]:[]]}case "archive":return [`source: uploaded archive (${q(e.digest)})`];case "archive_url":return [`source: ${e.archive_url} (${q(e.digest)})`];case "hub_package":return [`source: hub:${e.hub_package} (${q(e.digest)})`]}}function wr(e){return e.kind==="git"?e.commit.slice(0,12):q(e.digest)}function Vs(e){let t=w([["name",e.name],["title",e.title??"-"],["description",e.description??"-"],["active version",e.active_version?.version??"-"]]),s=e.selected_version?.source??e.active_version?.source??null;if(s)t.push(...br(s));else if(e.upstream){let a=e.upstream,r=a.ref===a.current_commit?"":` @ ${a.ref}`;t.push(`source: ${a.git_url??"?"}${r} (commit ${a.current_commit.slice(0,12)})`),a.path&&t.push(` subfolder: ${a.path}`);}let n=e.active_version?.manifest;if(n&&(t.push(`manifest: ${n.name}${n.version?`@${n.version}`:""}`+(n.task_count!==null?` (${n.task_count} tasks pinned)`:"")),n.authors.length>0&&t.push(` authors: ${n.authors.map(a=>a.email?`${a.name} <${a.email}>`:a.name).join(", ")}`),n.keywords.length>0&&t.push(` keywords: ${n.keywords.join(", ")}`)),e.versions&&e.versions.length>0){t.push("");let a=e.versions.some(i=>i.source!=null),r=e.versions.some(i=>i.n_failed_tasks>0),o=[["VERSION","STATE","TASKS",...r?["FAILED"]:[],"CREATED",...a?["SOURCE"]:[]]];for(let i of e.versions)o.push([i.version,i.state,String(i.task_count),...r?[i.n_failed_tasks>0?String(i.n_failed_tasks):"-"]:[],i.created_at??"-",...a?[i.source?wr(i.source):"-"]:[]]);t.push(...w(o));}if(e.tasks&&e.tasks.items.length>0){t.push("",`Tasks (version ${e.selected_version?.version??"?"}):`);let a=e.tasks.items.some(l=>(l.gpus??0)>0),r=e.tasks.items.some(l=>(l.notes??[]).length>0),o=[["TASK","AGENT TIMEOUT","VERIFIER TIMEOUT",...a?["GPU"]:[],"PROVIDERS",...r?["NOTES"]:[]]];for(let l of e.tasks.items)o.push([l.task_name,`${l.agent_timeout_sec}s`,`${l.verifier_timeout_sec}s`,...a?[ca(l)??"-"]:[],ua(l.providers),...r?[(l.notes??[]).map(c=>c.code).join(", ")||"-"]:[]]);if(t.push(...w(o)),r){let l=new Map;for(let c of e.tasks.items)for(let u of c.notes??[]){let d=l.get(u.message)??{code:u.code,tasks:[]};d.tasks.push(c.task_name),l.set(u.message,d);}t.push("","Task notes:");for(let[c,u]of l)t.push(` ${u.code} (${u.tasks.length} task${u.tasks.length===1?"":"s"}): ${c}`);}e.tasks.nextCursor&&t.push(`More tasks: evolve dataset show ${e.name} --cursor ${e.tasks.nextCursor}`);let i=new Map;for(let l of e.tasks.items)for(let c of Ps){let u=l.providers?.[c];if(u){if(!u.ok)i.has(`${c}:${u.reason}`)||i.set(`${c}:${u.reason}`,`${c}: ${u.reason}`);else if(u.degrades_to&&u.reason){let d=`${c}:degrade:${u.reason}`;i.has(d)||i.set(d,`${c}: runs on ${u.degrades_to} \u2014 ${u.reason}`);}}}if(i.size>0){t.push("","Provider limitations:");for(let l of i.values())t.push(` ${l}`);}}return t.push(..._r(e)),t}function _r(e){let t=e.failed_tasks??[],s=e.selected_version??e.active_version??null,n=s?.n_failed_tasks??t.length;if(t.length===0&&n===0)return [];let a=["",`Failed tasks (version ${s?.version??"?"}) \u2014 not runnable in this version:`],r=[];for(let o of t)r.push([` ${o.task_name}`,`${o.failure.code} (${o.failure.step}): ${o.failure.message}`]);return a.push(...w(r)),n>t.length&&a.push(` \u2026 ${n-t.length} more (${n} failed in total)`),a.push(" Fix: re-publish a new version \u2014 versions are immutable."),a}function Gs(e){let t=[];for(let s of e){if(!s.upstream?.moved)continue;let n=s.active_version?`@${s.active_version.version}`:"",a=s.upstream.latest_commit??s.upstream.ref,r=s.upstream.git_url??"<url>",o=s.upstream.path?` --path ${s.upstream.path}`:"";t.push(`${s.name}${n} \xB7 upstream ${s.upstream.ref} moved \u2014 run: evolve dataset publish --name ${s.name} --version <new-version> --git ${r} --ref ${a}${o}`);}return t}async function $r(e,t){if(T(e,t,Yt))return 0;let n=await Ca$1(g(e)).list({...O(e),...e.flags.search!==void 0?{search:String(e.flags.search)}:{}});if(e.flags.json===true)return t.out(JSON.stringify(n)),0;if(n.items.length===0)return e.flags.quiet!==true&&t.out("No datasets."),0;if(P(e,t,n.items,Yt,na,a=>a.name),e.flags.quiet!==true)for(let a of Gs(n.items))t.out(a);return 0}async function Sr(e,t){let n=await Ca$1(g(e)).get(e.positionals[0],O(e));if(e.flags.json===true)t.out(JSON.stringify(n));else {for(let a of Vs(n))t.out(a);for(let a of Gs([n]))t.out(a);}return 0}function Ze(e){let t=[`Pre-flight (importer ${e.importer_version}): ${e.tasks_total} task${e.tasks_total===1?"":"s"} \u2014 ${e.tasks_ok} ok, ${e.tasks_refused} refused`];e.manifest!==null&&e.manifest.ok===false&&t.push(` dataset.toml REFUSED: ${e.manifest.reason}`);for(let s of e.tasks){if(!s.ok){t.push(` ${s.name} REFUSED: ${s.reason}`);continue}let n=Object.entries(s.providers??{}).filter(([,a])=>a.ok!==true||"degrades_to"in a).map(([a,r])=>r.ok?`${a}: runs via ${r.degrades_to}`:`${a}: ${r.reason}`);n.length>0&&t.push(` ${s.name}: ${n.join(" \xB7 ")}`);for(let a of s.notes??[])t.push(` ${s.name} NOTE ${a.code}: ${a.message}`);}return t.push(`Checked from task.toml alone; the import also checks: ${e.deferred.map(s=>s.name).join(", ")}.`),t}async function vr(e,t){let n=await Ca$1(g(e)).preflight({source:{directory:e.positionals[0]}});if(e.flags.json===true)t.out(JSON.stringify(n));else for(let r of Ze(n))t.out(r);let a=n.manifest!==null&&n.manifest.ok===false;return n.tasks_refused>0||a?1:0}async function Ir(e,t){let s=e.flags.json===true,n=Ca$1(g(e)),a=Wn(e);if(a.source.directory!==void 0&&e.flags["skip-preflight"]!==true){let u=null;try{u=await n.preflight({source:{directory:a.source.directory}});}catch(d){if(d instanceof xa$1&&d.status===404)t.err("Pre-flight unavailable on this server \u2014 publishing without it.");else throw d}if(u!==null){let d=u.manifest!==null&&u.manifest.ok===false;if(u.tasks_refused>0||d){if(s)t.out(JSON.stringify({kind:"preflight.refused",preflight:u}));else {for(let f of Ze(u))t.out(f);t.out(""),t.out("Nothing was uploaded. Fix the refused tasks, or pass --skip-preflight to publish anyway (a refused task then lands FAILED at import).");}return 1}if(s)e.flags.watch===true&&t.out(JSON.stringify({kind:"preflight.ok",preflight:u}));else for(let f of Ze(u))t.out(f);}}let r=u=>{if(s){e.flags.watch===true&&t.out(JSON.stringify({kind:"import.registered",import_id:u}));return}t.out(`Registered import ${u} \u2014 re-attach anytime with: evolve dataset watch ${u}`);},o=Date.now(),i=-1,l=(u,d)=>{let f=d>0?Math.floor(u/d*10):10;if(!(f<=i)){if(i=f,s){t.out(JSON.stringify({kind:"upload.progress",sent_bytes:u,total_bytes:d,elapsed_sec:(Date.now()-o)/1e3}));return}t.out(`upload ${_e(u)}/${_e(d)} (${Math.min(f*10,100)}%)`);}},c=await n.publish(a,{onRegistered:r,...s&&e.flags.watch!==true?{}:{onUploadProgress:l}});if(e.flags.watch!==true){if(s)t.out(JSON.stringify(c));else {for(let u of Ns(c))t.out(u);t.out(""),t.out(`Follow it with: evolve dataset show ${c.name}`);}return 0}return Hs(n,c,t,s,"created")}async function Hs(e,t,s,n,a){n?s.out(JSON.stringify({kind:`import.${a}`,datasetImport:t})):s.out(a==="created"?`Publish ${t.id} (${t.name}) ${t.status} \u2014 watching\u2026`:`Import ${t.id} (${t.name}@${t.version}) ${lt(t)} \u2014 watching\u2026`);let r=null,o=null,i=new Set,l=d=>{for(let f of d.failed_tasks??[])i.has(f.task_name)||(i.add(f.task_name),s.out(n?JSON.stringify({kind:"task.failed",task:f}):jr(f)));},c;try{c=await e.watchImport(t.id,{onStatus:d=>{s.out(n?JSON.stringify({kind:"import.status",datasetImport:d}):pa(d));},onProgress:d=>{s.out(n?JSON.stringify({kind:"import.progress",progress:d}):da(d));},onVersion:(d,f)=>{r=d,o=f,s.out(n?JSON.stringify({kind:"import.version",version:d}):ga(d)),l(f);}});}catch(d){if(d instanceof za$1)return n&&s.out(JSON.stringify({error:Bs(d)})),s.err(`Error: ${d.message}`),s.err(`Follow it with: evolve dataset show ${d.dataset}@${d.version}`),1;throw d}let u=r;if(u!==null&&u.n_failed_tasks>0)try{let d=await e.get(`${c.name}@${c.version}`);o=d,l(d);}catch{}if(n)s.out(JSON.stringify({kind:"import.final",datasetImport:c}));else {s.out("");for(let d of Ns(c))s.out(d);if(c.progress!==null)for(let d of fa(c.progress))s.out(d);if(r!==null){for(let d of ma(r,o))s.out(d);for(let d of Or(r,c))s.out(d);}}return c.status==="FAILED"?1:0}async function xr(e,t){let s=e.flags.json===true,n=Ca$1(g(e)),a=e.positionals[0],r=null;try{r=await n.getImport(a);}catch(o){if(!(o instanceof xa$1&&o.status===404))throw o}if(r===null){let i=(await n.listImports({dataset:a,limit:50})).items;if(r=i.find(l=>l.status==="QUEUED"||l.status==="RUNNING")??null,r===null){let l=i[0],c=l!==void 0?`its newest import ${l.id} is ${l.status} \u2014 see it with: evolve dataset show ${a}`:"no import id and no dataset of yours carries that name",u=`Nothing to watch for "${a}": ${c}`;return s&&t.out(JSON.stringify({error:{code:"nothing_to_watch",message:u}})),t.err(`Error: ${u}`),1}}try{return await Hs(n,r,t,s,"attached")}catch(o){if(o instanceof xa$1&&o.code==="import_not_found"){let i=`Import ${r.id} no longer exists \u2014 its upload was abandoned or refused before the corpus arrived, so the publish never happened. Re-run the publish to start a new one.`;return s&&t.out(JSON.stringify({error:{code:"import_not_found",message:i}})),t.err(`Error: ${i}`),1}throw o}}function Or(e,t){if(e.n_failed_tasks<=0)return [];let s=e.task_count+e.n_failed_tasks;return [`built ${e.task_count} of ${s} tasks \u2014 ${e.n_failed_tasks} failed to build`,`Reasons: evolve dataset show ${t.name}@${t.version}`,"Fix: re-publish a new version \u2014 versions are immutable."]}function jr(e){return `task ${e.task_name} FAILED \u2014 ${e.failure.code} (${e.failure.step}): ${W(e.failure.message,140)}`}async function Ar(e,t){let n=await Ca$1(g(e)).download(e.positionals[0],{to:e.flags["output-dir"]??process.cwd()});return e.flags.json===true?t.out(JSON.stringify({path:n})):t.out(`Saved ${n}`),0}async function Er(e,t){let s=Ca$1(g(e)),[n,a]=e.positionals,r=await s.activate(n,a);if(e.flags.json===true)t.out(JSON.stringify(r));else for(let o of Vs(r))t.out(o);return 0}function Ws(e){let t=[["name",e.name],["id",e.id],["ref",e.ref],["digest",e.digest],["size",_e(e.size_bytes)]];return e.description&&t.push(["description",e.description]),t.push(["created",e.created_at]),w(t)}async function Pr(e,t){if(T(e,t,Bt))return 0;let n=await Ea$1(g(e)).list(O(e));return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.items.length===0?(e.flags.quiet!==true&&t.out("No uploaded skills."),0):(P(e,t,n.items,Bt,aa,a=>a.id),n.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
43
- More: evolve skill list --cursor ${n.nextCursor}`),0)}async function Tr(e,t){let n=await Ea$1(g(e)).upload(e.positionals[0]);return e.flags.json===true?(t.out(JSON.stringify(n.length===1?n[0]:n)),0):(n.forEach((a,r)=>{r>0&&t.out("");for(let o of Ws(a))t.out(o);}),t.out(""),t.out(`Use it with: evolve run --skill name:${n[0].name} (moving pointer) or --skill ${n[0].ref} (this exact content)`),0)}async function Cr(e,t){let s=await Ea$1(g(e)).get(await k(e,"skill",e.positionals[0]));if(e.flags.json===true)return t.out(JSON.stringify(s)),0;for(let n of Ws(s))t.out(n);return s.skill_md&&(t.out(""),t.out(s.skill_md)),0}async function Nr(e,t){let s=await k(e,"skill",e.positionals[0]);return await Ea$1(g(e)).delete(s),e.flags.json===true?t.out(JSON.stringify({id:s,deleted:true})):t.out(`Deleted skill ${s}`),0}async function Lr(e,t){if(T(e,t,Xt))return 0;let n=await Da$1(g(e)).list(O(e));return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.items.length===0?(e.flags.quiet!==true&&t.out("No registered agents."),0):(P(e,t,n.items,Xt,ra,a=>a.name),0)}async function Rr(e,t){let n=await Da$1(g(e)).get(e.positionals[0]);if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of Es(n))t.out(a);return 0}async function Dr(e,t){let n=await Da$1(g(e)).create(Yn(e));if(e.flags.json===true)t.out(JSON.stringify(n));else {for(let a of Es(n))t.out(a);t.out(""),t.out(`Use it with: evolve run -d <dataset> -a ${n.name} -m <model>`);}return 0}async function Jr(e,t){let s=Da$1(g(e)),n=e.positionals[0];return await s.delete(n),e.flags.json===true?t.out(JSON.stringify({name:n,deleted:true})):t.out(`Deleted agent ${n}`),0}function Ur(e){let t=[["user",e.user_id],["email",e.email??"-"],["key id",e.key.id]];return e.key.label&&t.push(["key label",e.key.label]),t.push(["key created",e.key.created_at]),e.key.last_used_at&&t.push(["key last used",e.key.last_used_at]),w(t)}function pt(e){let t={};return typeof e.flags["api-key"]=="string"&&(t.apiKey=e.flags["api-key"]),typeof e.flags["base-url"]=="string"&&(t.dashboardUrl=e.flags["base-url"]),t}function Ys(e){let t=e.usage;return t&&typeof t.spent_usd=="number"?t.provisional?`at least $${t.spent_usd.toFixed(2)}`:`$${t.spent_usd.toFixed(2)}`:N(e.cost)}var gs=[{key:"id",header:"ID",cell:e=>e.id},{key:"tag",header:"TAG",cell:e=>e.tag},{key:"agent",header:"AGENT",cell:e=>e.agent},{key:"model",header:"MODEL",cell:e=>e.model??"-"},{key:"provider",header:"PROVIDER",cell:e=>e.provider},{key:"sandbox",header:"SANDBOX",cell:e=>e.sandboxId??"-"},{key:"state",header:"STATE",cell:e=>e.state},{key:"runtime",header:"RUNTIME",cell:e=>e.runtimeStatus},{key:"cost",header:"COST",cell:Ys},{key:"steps",header:"STEPS",cell:e=>String(e.stepCount)},{key:"created",header:"CREATED",cell:e=>e.createdAt},{key:"ended",header:"ENDED",cell:e=>e.endedAt??"-"}],Fr=["id","tag","agent","model","state","cost","created"];function Mr(e){let t=[["id",e.id],["tag",e.tag],["agent",e.agent],["model",e.model??"-"],["provider",e.provider],["sandbox",e.sandboxId??"-"],["state",e.state],["runtime",e.runtimeStatus],["cost",Ys(e)]];return e.usage&&t.push(["tokens",`${e.usage.input_tokens??"-"} in / ${e.usage.cached_input_tokens??"-"} cached / `+(e.usage.cache_write_tokens!==null?`${e.usage.cache_write_tokens} written to cache / `:"")+`${e.usage.output_tokens??"-"} out`+(e.usage.provisional?" (provisional)":"")]),t.push(["steps",String(e.stepCount)]),e.toolStats&&Object.keys(e.toolStats).length>0&&t.push(["tools",Object.entries(e.toolStats).map(([s,n])=>`${s} ${n}`).join(", ")]),t.push(["created",e.createdAt]),t.push(["ended",e.endedAt??"-"]),w(t)}async function qr(e,t){if(T(e,t,gs))return 0;let s=e.flags.state===void 0?void 0:String(e.flags.state);if(s!==void 0&&s!=="live"&&s!=="ended")throw new p(`--state must be live or ended; got: ${s}`);let a=await ga$1(pt(e)).list({...O(e),...s!==void 0?{state:s}:{},...e.flags.agent!==void 0?{agent:String(e.flags.agent)}:{},...e.flags["tag-prefix"]!==void 0?{tagPrefix:String(e.flags["tag-prefix"])}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):a.items.length===0?(e.flags.quiet!==true&&t.out("No sessions."),0):(P(e,t,a.items,gs,Fr,r=>r.id),a.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
44
- More: evolve session list --cursor ${a.nextCursor}`),0)}async function zr(e,t){let s=await ga$1(pt(e)).get(await k(e,"session",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of Mr(s))t.out(n);return 0}async function Kr(e,t){let s=await Ja$1(g(e)).status();if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of Ur(s))t.out(n);return 0}var ms=[{key:"slug",header:"SLUG",cell:e=>e.slug},{key:"display_name",header:"DISPLAY NAME",cell:e=>e.display_name},{key:"role",header:"ROLE",cell:e=>e.role??"-"},{key:"personal",header:"PERSONAL",cell:e=>e.personal?"yes":"no"},{key:"created",header:"CREATED",cell:e=>e.created_at}],Vr=["slug","display_name","role","created"];function Gr(e,t){let s=t.toLowerCase();return e.filter(n=>n.slug.toLowerCase().includes(s)||n.display_name.toLowerCase().includes(s)||(n.role??"").toLowerCase().includes(s))}async function Hr(e,t){if(T(e,t,ms))return 0;let s=await Ka$1(g(e)).list(),n=e.flags.search!==void 0?Gr(s,String(e.flags.search)):s;return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.length===0?(e.flags.quiet!==true&&t.out("No organizations found."),0):(P(e,t,n,ms,Vr,a=>a.slug),0)}function Wr(e){let{quota:t,usage:s}=e,n=s.month_spend_usd===null?"unavailable":N(s.month_spend_usd),a=s.month_spend_as_of===null?"":` (as of ${s.month_spend_as_of})`,r=t.monthly_budget_usd===null?`${n} / no budget${a}`:`${n} / ${N(t.monthly_budget_usd)}${a}`,o=[["slug",e.slug],["display name",e.display_name],["personal",e.personal?"yes":"no"],["role",e.role??"-"],["members",String(e.member_count)],["created",e.created_at],["concurrent trials",`${s.in_flight_trials}/${t.max_concurrent_trials}`],["queued trials",`${s.queued_trials}/${t.max_queued_trials}`],["concurrent imports",`${s.in_flight_imports}/${t.max_concurrent_imports}`],["concurrent analyses",`${s.in_flight_analyses}/${t.max_concurrent_analyses}`],["concurrent sessions",`${s.active_sessions}/${t.max_concurrent_sessions}`],["e2b sandbox ceiling",String(t.max_concurrent_sandboxes_e2b)],["daytona sandbox ceiling",String(t.max_concurrent_sandboxes_daytona)],["modal sandbox ceiling",String(t.max_concurrent_sandboxes_modal)],["month spend",r]];return w(o)}async function Yr(e,t){let s=await Ka$1(g(e)).get(e.positionals[0]);if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of Wr(s))t.out(n);return 0}function gt(e){let t={};return typeof e.flags["api-key"]=="string"&&(t.apiKey=e.flags["api-key"]),typeof e.flags["base-url"]=="string"&&(t.dashboardUrl=e.flags["base-url"]),t}function Br(e){let t=e.flags.value;if(typeof t=="string"){if(t.length===0)throw new p("--value must not be empty");return t}if(process.stdin.isTTY)throw new p('no value given: pass --value <value> or pipe the value on stdin (e.g. printf %s "$TOKEN" | evolve secrets set NAME --delivery ...)');let s=readFileSync(0,"utf8"),n=s.endsWith(`\r
32
+ `),tty:process.stdout.isTTY===true&&process.env.TERM!=="dumb",...process.stdin.isTTY===true?{confirm:async e=>{let{createInterface:t}=await import('readline/promises'),s=t({input:process.stdin,output:process.stderr});try{let n=(await s.question(`${e} [y/N] `)).trim().toLowerCase();return n==="y"||n==="yes"}finally{s.close();}}}:{}};function w(e){if(e.length===0)return [];let t=[];for(let s of e)s.forEach((n,a)=>{t[a]=Math.max(t[a]??0,n.length);});return e.map(s=>s.map((n,a)=>n.padEnd(t[a])).join(" ").trimEnd())}function R(e){return typeof e=="number"?`$${e.toFixed(2)}`:"-"}function te(e){return e.lane==="measured"?R(e.usd):e.lane==="floor"?`at least ${R(e.usd)}`:"-"}function Ls(e,t){if(!e.upload)return null;let s=e.upload.reported_totals;if(!s||s.cost_usd===null)return "-";let n=t?` (${s.n_trials_reporting}/${e.n_total_trials} trials reporting)`:"";return `reported ${R(s.cost_usd)}${n}`}function pt(e){if(e.input_tokens===null&&e.output_tokens===null)return null;let t=a=>a===null?"-":a.toLocaleString("en-US"),s=[e.cached_input_tokens!==null?`${t(e.cached_input_tokens)} cached`:null,e.cache_write_tokens!==null?`${t(e.cache_write_tokens)} written to cache`:null].filter(a=>a!==null),n=s.length>0?` (${s.join(", ")})`:"";return `in ${t(e.input_tokens)}${n} \xB7 out ${t(e.output_tokens)}`+(e.provisional?" \u2014 provisional":"")}function xe(e){let t=`${e.name}:${e.model_name}`;return e.version?`${t}:${e.version}`:t}function tt(e){let t=[`${e.n_completed} completed`,`${e.n_failed} failed`,`${e.n_pending} pending`];return e.cost_usd!=null&&t.push(`spent $${e.cost_usd.toFixed(4)}`),t.join(" \xB7 ")}function Ie(e){return e.map(t=>`${t.name}@${t.version}`).join(", ")||"-"}function Z(e,t){return e.length>t?e.slice(0,t-1)+"\u2026":e}function V(e){return e.replace(/[\t\n\r]+/g," ")}function A(e,t,s,n,a,r){if(e.flags.quiet===true){for(let l of s)t.out(r(l));return}let i=ra(e,n,a);if(t.tty===true){let l=e.flags["no-trunc"]===true,c=[i.map(u=>u.header)];for(let u of s)c.push(i.map(d=>l?V(d.cell(u)):Z(V(d.cell(u)),60)));for(let u of w(c))t.out(u);}else {e.flags["no-headers"]!==true&&t.out(i.map(l=>l.header).join(" "));for(let l of s)t.out(i.map(c=>V(c.cell(l))).join(" "));}}function ra(e,t,s){let n=e.flags.columns;if(n===void 0)return s.map(r=>t.find(i=>i.key===r));if(n==="all")return t;let a=n.split(",").map(r=>r.trim()).filter(Boolean);if(a.length===0)throw new p("--columns got an empty column list");return a.map(r=>{let i=t.find(o=>o.key===r);if(!i)throw new p(`Unknown column "${r}" (available: ${t.map(o=>o.key).join(", ")}, or "all")`);return i})}function T(e,t,s){if(e.flags.columns!=="help")return false;for(let n of s)t.out(n.key);return true}function L(e,t={}){let s=[["id",e.id],["status",e.status],["datasets",Ie(e.datasets)]];s.push(["agents",e.agents.map(xe).join(", ")]);for(let i of e.agents){i.skills.length>0&&s.push(["skills",`${xe(i)}: ${i.skills.join(", ")}`]);for(let o of i.skill_locks??[])s.push(["skill lock",`${o.name} @ ${o.git_commit_id?o.git_commit_id.slice(0,12):G(o.digest)}`]);}s.push(["size",`${e.counts.agents} agent(s) x ${e.counts.tasks} task(s) = ${e.n_total_trials} trial(s)`]);for(let i of e.build_exclusions)s.push(["build exclusions",i.note]);s.push(["attempts/task",String(e.n_attempts)]),s.push(["concurrency",String(e.n_concurrent_trials)]),s.push(["max spend/trial",R(e.max_trial_spend_usd)]),s.push(["worst case",R(e.worst_case_spend_usd)]),s.push(["retries",`${e.retry.max_retries}/trial on infrastructure errors`+((e.stats.n_retries??0)>0?` (${e.stats.n_retries} used)`:"")]),e.analyze&&s.push(["analyze",`${e.analyze.model_name} \xB7 ${e.analyze.rubric.criteria.length} criteri${e.analyze.rubric.criteria.length===1?"on":"a"}`+(e.analyze.sandbox_provider?` \xB7 ${e.analyze.sandbox_provider}`:"")]);{let o=[["agent",e.agent_timeout_multiplier],["verifier",e.verifier_timeout_multiplier],["agent setup",e.agent_setup_timeout_multiplier],["environment build",e.environment_build_timeout_multiplier]].filter(([,l])=>l!=null);(e.timeout_multiplier!==1||o.length>0)&&s.push(["timeouts",`x${e.timeout_multiplier}`+(o.length>0?` (${o.map(([l,c])=>`${l} x${c}`).join(", ")})`:"")]);}s.push(["provider",e.upload?"ported":e.sandbox_provider??"-"]),s.push(["spent",Ls(e,true)??te(ka$1(e.stats.cost_usd,e.stats.n_unmeasured_trials))]),e.stats.gpu_cost_usd!=null&&s.push(["gpu compute (est.)",`$${e.stats.gpu_cost_usd.toFixed(4)}`]);let n=e.stats.n_unmeasured_judge_trials;if((e.stats.judge_cost_usd!=null&&e.stats.judge_cost_usd>0||typeof n=="number"&&n>0)&&s.push(["spent (judge)",te(ka$1(e.stats.judge_cost_usd,n))]),e.upload?.reported_totals){let i=e.upload.reported_totals,o=[i.n_input_tokens!==null?`in ${i.n_input_tokens}`:null,i.n_cache_tokens!==null?`cache ${i.n_cache_tokens}`:null,i.n_output_tokens!==null?`out ${i.n_output_tokens}`:null].filter(l=>l!==null);o.length>0&&s.push(["reported tokens",o.join(" \xB7 ")]);}if((t.taskLinksRow??true)&&e.upload?.task_links&&e.upload.task_links.length>0){let i=e.upload.task_links,o=i.reduce((u,d)=>u+d.n_linked,0),l=i.reduce((u,d)=>u+d.n_trials,0),c=Array.from(new Set(i.flatMap(u=>u.datasets)));s.push(["task links",`${o} of ${l} ${l===1?"trial":"trials"} linked`+(c.length>0?` to ${c.join(", ")}`:"")+(o<l?` \u2014 ${l-o} without the task folder`:"")]);}if(e.stats.analysis){s.push(["analysis",tt(e.stats.analysis)]);for(let[i,o]of Object.entries(e.stats.analysis.checks))s.push([` ${i}`,`${o.n_pass} pass \xB7 ${o.n_fail} fail \xB7 ${o.n_not_applicable} n/a`+(typeof o.n_unknown=="number"?` \xB7 ${o.n_unknown} unknown`:"")]);}let r=Object.entries(e.trials.byStatus).filter(([,i])=>i>0).map(([i,o])=>`${i} ${o}`).join(" \xB7 ");r&&s.push(["trials",r]);for(let i of e.source_jobs)s.push([i.action==="regrade"?"regrade of":i.action==="retry"?"retry of":"resume of",i.job_id]);if(e.upload){let i=[e.upload.original_job_name,e.upload.original_job_id].filter(o=>o!==null).join(" \xB7 ");s.push(["uploaded",`${e.upload.uploaded_at}${i?` \u2014 originally ${i}`:""}`]);}return e.idempotent_replay&&s.push(["note","idempotent replay of an existing job"]),e.failure&&s.push(["failure",`${e.failure.code}: ${e.failure.message}`]),s.push(["started",e.started_at]),s.push(["updated",e.updated_at]),[...w(s),...ia(e)]}function ia(e){let t=Y(e);if(t.length===0)return [];let s=t.map(n=>[` ${n.evals_key}`,n.points.map(a=>`pass@${a.k} ${a.value.toFixed(3)}`).join(" ")]);return ["","pass@k",...w(s)]}var Zt=[{key:"id",header:"ID",cell:e=>e.id},{key:"name",header:"NAME",cell:e=>e.job_name??"-"},{key:"status",header:"STATUS",cell:e=>e.status},{key:"datasets",header:"DATASETS",cell:e=>Ie(e.datasets)},{key:"agents",header:"AGENTS",cell:e=>e.agents.map(xe).join(", ")},{key:"trials",header:"TRIALS",cell:e=>String(e.trials.total)},{key:"spent",header:"SPENT",cell:e=>Ls(e,false)??te(ka$1(e.stats.cost_usd,e.stats.n_unmeasured_trials))},{key:"started",header:"STARTED",cell:e=>e.started_at}],oa=["id","status","datasets","trials","spent","started"],es=[{key:"task",header:"TASK",cell:e=>e.task_name},{key:"agent",header:"AGENT",cell:e=>xe({name:e.agent_info.name,model_name:e.agent_info.model_info.name,version:e.agent_info.version,reasoning_effort:e.agent_info.reasoning_effort??null})},{key:"attempt",header:"ATTEMPT",cell:e=>String(e.attempt)},{key:"status",header:"STATUS",cell:e=>e.status},{key:"reward",header:"REWARD",cell:e=>e.reward!==null?String(e.reward):"-"},{key:"spent",header:"SPENT",cell:e=>te(la$1(e))},{key:"tokens",header:"TOKENS",cell:e=>e.usage&&pt(e.usage)||"-"},{key:"gpu",header:"GPU (EST)",cell:e=>e.gpu_cost?.estimate_usd!=null?`$${e.gpu_cost.estimate_usd.toFixed(4)}`:"-"},{key:"id",header:"TRIAL ID",cell:e=>e.id}],la=["task","agent","attempt","status","reward","spent","id"],ts=[{key:"task",header:"TASK",cell:e=>e.task_name},{key:"source",header:"DATASET",cell:e=>e.source},{key:"trials",header:"TRIALS",cell:e=>String(e.trials.total)},{key:"statuses",header:"STATUSES",cell:e=>Object.entries(e.trials.byStatus).filter(([,t])=>t>0).map(([t,s])=>`${t} ${s}`).join(" \xB7 ")||"-"},{key:"reward",header:"MEAN REWARD",cell:e=>nt(e.mean_reward)},{key:"spent",header:"SPENT",cell:e=>R(e.cost_usd)},{key:"check",header:"CHECK",cell:e=>ca(e.check)},{key:"check-id",header:"TASK CHECK ID",cell:e=>e.check?.id??"-"}],ua=["task","source","trials","statuses","reward","spent","check"];function Ds(e){let t={pass:0,fail:0,not_applicable:0,unknown:0};for(let s of Object.values(e??{}))t[s.outcome]+=1;return t}function Oe(e){return e===void 0?null:e===null?"custom rubric":e.replace(/_/g," ").toUpperCase()}function st(e){let t=Oe(e.label);return t===null||e.label===null?t:`${t}${e.executed===true?" \xB7 executed":e.executed===false?" \xB7 not executed":""}`}function ca(e){if(e===null)return "-";if(e.status!=="completed")return e.status;let t=Ds(e.checks),s=`pass ${t.pass} \xB7 fail ${t.fail} \xB7 n/a ${t.not_applicable} \xB7 unknown ${t.unknown}`,n=st(e);return n===null?s:`${n} \xB7 ${s}`}var ss=[{key:"name",header:"NAME",cell:e=>e.name},{key:"active",header:"ACTIVE",cell:e=>e.active_version?.version??"-"},{key:"state",header:"STATE",cell:e=>e.active_version?.state??"-"},{key:"tasks",header:"TASKS",cell:e=>e.active_version?String(e.active_version.task_count):"-"},{key:"title",header:"TITLE",cell:e=>e.title??"-"}],da=["name","active","state","tasks","title"];function G(e){return e.length>19?`${e.slice(0,19)}\u2026`:e}function H(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}var ns=[{key:"name",header:"NAME",cell:e=>e.name},{key:"id",header:"ID",cell:e=>e.id},{key:"digest",header:"DIGEST",cell:e=>G(e.digest)},{key:"size",header:"SIZE",cell:e=>H(e.size_bytes)},{key:"created",header:"CREATED",cell:e=>e.created_at},{key:"description",header:"DESCRIPTION",cell:e=>e.description??"-"},{key:"ref",header:"REF",cell:e=>e.ref}],fa=["name","id","digest","size","created"],as=[{key:"name",header:"NAME",cell:e=>e.name},{key:"source",header:"SOURCE",cell:e=>e.source},{key:"run",header:"RUN COMMAND",cell:e=>e.run_command},{key:"updated",header:"UPDATED",cell:e=>e.updated_at}],pa=["name","source","run","updated"],rs=[{key:"name",header:"NAME",cell:e=>e.name},{key:"label",header:"LABEL",cell:e=>e.label??"default"},{key:"delivery",header:"DELIVERY",cell:e=>e.delivery??"brokered"},{key:"hosts",header:"ALLOWED HOSTS",cell:e=>e.allowedHosts.join(", ")||"-"},{key:"updated",header:"UPDATED",cell:e=>e.updatedAt},{key:"last-used",header:"LAST USED",cell:e=>e.lastUsedAt??"-"},{key:"id",header:"ID",cell:e=>e.id}],ga=["name","label","delivery","hosts","updated"];function ma(e){let t=[["trial id",e.id],["job",e.job_id],["task",e.task_name],["dataset",e.source],["agent",`${e.agent_info.name}:${e.agent_info.model_info.name}`],["attempt",String(e.attempt)],["status",e.status],["reward",e.reward!==null?String(e.reward):"-"]],s=e.verifier_result?.rewards;if(s&&Object.keys(s).length>0&&t.push(["rewards",Object.entries(s).map(([n,a])=>`${n}=${a}`).join(" \xB7 ")]),t.push(["spent",te(ia$1(e))]),e.judge_result&&t.push(["spent (judge)",te(ja$1(e))]),(e.status==="RUNNING"||e.status==="SCORING")&&e.live_spent_usd!==null){let n=e.live_spend_at?` as of ${e.live_spend_at}`:"";t.push(["spent (live)",`at least $${e.live_spent_usd.toFixed(4)}${n}`]);}if(e.usage){let n=pt(e.usage);n&&t.push(["tokens",n]);}if(e.upload){let n=e.upload.reported_agent_result;n&&n.cost_usd!==null&&t.push(["reported cost",`$${n.cost_usd.toFixed(4)} (the original run's own record \u2014 not platform-metered)`]);let a=n?[n.n_input_tokens!==null?`in ${n.n_input_tokens}`:null,n.n_cache_tokens!==null?`cache ${n.n_cache_tokens}`:null,n.n_output_tokens!==null?`out ${n.n_output_tokens}`:null].filter(r=>r!==null):[];a.length>0&&t.push(["reported tokens",a.join(" \xB7 ")]),t.push(["uploaded from",`${e.upload.original_trial_name} \xB7 task ${e.upload.original_task_name}`+(e.upload.original_trial_id?` \xB7 ${e.upload.original_trial_id}`:"")]);}if(e.attempt_phase&&t.push(["phase",e.attempt_phase]),e.upload?t.push(["provider","ported"]):e.sandbox_provider&&t.push(["provider",e.sandbox_provider]),e.sandbox_provider_degrade){let n=e.sandbox_provider_degrade;t.push(["provider degrade",`${n.from} \u2192 ${n.to}: ${n.reason}`]);}if(e.gpu_cost){let n=e.gpu_cost;if(n.estimate_usd!=null){let a=n.gpu_type??"unknown type",r=n.duration_sec!=null?`${Math.round(n.duration_sec)}s`:"unmeasured",i=`rate card v${n.rate_card.version}${n.rate_card.source?`, ${n.rate_card.source} ${n.rate_card.source_date??""}`.trimEnd():""}`;t.push(["gpu compute (est.)",`$${n.estimate_usd.toFixed(4)} \u2014 ${a} x${n.gpu_count}, ${r} on ${n.provider} (${i})`]);}else t.push(["gpu compute (est.)",`not priced \u2014 ${n.unpriced_reason??"no reason recorded"}`]);}if(e.sandbox_id&&t.push(["sandbox",e.sandbox_id]),e.verifier_environment_mode&&t.push(["verifier",e.verifier_environment_mode]),e.verifier_sandbox_id&&t.push(["verifier sandbox",e.verifier_sandbox_id]),e.agent_info.version&&t.push(["agent version",e.agent_info.version]),e.exception_info&&(t.push(["failure type",e.exception_info.exception_type]),t.push(["failure detail",e.exception_info.exception_message])),e.n_retries>0){t.push(["auto-retries",String(e.n_retries)]);for(let n of e.retries)t.push([`attempt ${n.attempt_number}`,`${n.exception_info.exception_type} \xB7 spent ${R(n.cost_usd)}`+(n.settled_at?` \xB7 settled ${n.settled_at}`:"")]);}if(e.analysis){let n=e.analysis;t.push(["analysis",`${n.status} \xB7 ${n.model_name} \xB7 ${n.id}`]);let a=n.status==="completed"?Oe(n.label):null;a!==null&&t.push([" label",a]);for(let[r,i]of Object.entries(n.checks??{}))t.push([` ${r}`,`${i.outcome} \u2014 ${i.explanation}`]);n.summary&&t.push([" summary",n.summary]),n.estimated_cost_usd!==null&&t.push([" analyzer spend",`$${n.estimated_cost_usd.toFixed(4)}`]),n.failure&&t.push([" failure",`${n.failure.phase}: ${n.failure.message}`]);}return e.session_ref&&t.push(["session",e.session_ref]),e.started_at&&t.push(["started",e.started_at]),e.finished_at&&t.push(["finished",e.finished_at]),w(t)}function ha(e){let t=e.rubric.criteria.length,s=[["analysis id",e.id],["status",e.status],["model",e.model_name],["rubric",`${t} criteri${t===1?"on":"a"}`]],n=e.status==="completed"?Oe(e.label):null;n!==null&&s.push(["label",n]);for(let[a,r]of Object.entries(e.checks??{})){s.push([` ${a}`,`${r.outcome} \u2014 ${r.explanation}`]);for(let i of r.evidence??[])s.push(["",`${i.where} \u2014 ${V(i.quote)}`]);}if(e.summary&&s.push(["summary",e.summary]),e.estimated_cost_usd!==null&&s.push(["spent",`$${e.estimated_cost_usd.toFixed(4)}`]),e.usage){let a=pt(e.usage);a&&s.push(["tokens",a]);}return e.failure&&s.push(["failure",`${e.failure.phase}: ${e.failure.message}`]),s.push(["created",e.created_at]),e.finished_at&&s.push(["finished",e.finished_at]),w(s)}function Us(e){let t=[["name",e.name],["source",e.source],["run command",e.run_command]],s=Object.keys(e.env??{});return s.length>0&&t.push(["env",s.sort().join(", ")]),t.push(["created",e.created_at]),t.push(["updated",e.updated_at]),w(t)}var Js=["e2b","daytona","modal"];function ya(e){return Js.filter(t=>e?.[t]!==void 0).map(t=>{let s=e[t];return s.ok?s.degrades_to?`${t} \u2192${s.degrades_to}`:`${t} ok`:`${t} NO`}).join(" \xB7 ")}function ka(e){let t=e.gpus??0;if(t<=0)return null;let s=e.gpu_types&&e.gpu_types.length>0?e.gpu_types.join("|"):"any GPU";return `${t}x ${s}`}function nt(e){return e!==null?String(Math.round(e*1e3)/1e3):"-"}function Fs(e){let t=aa$1(e);if(t!==null){let a=typeof e.data.model=="string"&&e.data.model!==""?e.data.model:"-",r=t.usage,i=`gateway ${a} in=${r.promptTokens} out=${r.completionTokens} cached=${r.cachedTokens} $${r.costUsd.toFixed(6)}${t.startedAt?` ${t.startedAt}`:""}`;return `#${String(e.seq).padStart(4)} ${e.type.padEnd(26)} ${i}`.trimEnd()}let s=e.data?.update;if(s&&typeof s=="object"&&s.sessionUpdate==="usage")return null;let n=Z(JSON.stringify(e.data??{}),140);return `#${String(e.seq).padStart(4)} ${e.type.padEnd(26)} ${n}`.trimEnd()}function D(e,t,s){if(t){e.out(JSON.stringify(s));return}let n=Fs(s);n!==null&&e.out(n);}function Ms(e){let t=e.failures?.length?` (${e.failures.length} task failure${e.failures.length===1?"":"s"})`:"";return `${e.message}${t}`}function qs(e){let t=[["id",e.id],["status",mt(e)]];e.name!==void 0&&t.push(["dataset",e.name]),e.version!==void 0&&t.push(["version",e.version]),e.task_count!==void 0&&t.push(["tasks",String(e.task_count)]);for(let s of e.warnings)t.push(["warning",s.message??s.code]);if(e.failure){t.push(["failure",Ms(e.failure)]);for(let s of e.failure.failures??[])t.push([` ${s.task_name}`,s.error]);}return w(t)}function gt(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return `${t}s`;let s=Math.floor(t/60),n=t%60;return s<60?`${s}m${String(n).padStart(2,"0")}s`:`${Math.floor(s/60)}h${String(s%60).padStart(2,"0")}m`}function ba(e,t=Date.now()){let s=e.phases[e.phases.length-1],n=[];s!==void 0&&s.total>0&&(n.push(`${s.done}/${s.total}`),s.banked!==void 0&&s.banked>0&&n.push(s.name==="copying"?`${s.banked} of ${s.total} images already banked`:`${s.banked} banked`));let a=s!==void 0?Date.parse(s.started_at):NaN;return Number.isFinite(a)&&n.push(gt(t-a)),`phase ${e.phase}${n.length>0?` ${n.join(" \xB7 ")}`:""}`}function wa(e){let t=e.phases.map(a=>{let r=a.completed_at!==void 0?Date.parse(a.completed_at):NaN,i=Date.parse(a.started_at),o=Number.isFinite(r)&&Number.isFinite(i)?gt(r-i):"unfinished";return `${a.name} ${o}`}),s=e.images,n=e.codebuild;return w([["phases",t.join(" \xB7 ")],["images",`${s.built} built, ${s.mirrored} mirrored, ${s.banked} banked`],["codebuild",`${n.copy_builds} copy build(s), ${n.billed_minutes} billed minute(s)`]])}function mt(e){return e.receiving===true?`${e.status} (receiving)`:e.status}function va(e){let t=[];return e.task_count!==void 0&&t.push(`tasks=${e.task_count}`),e.failure&&t.push(Z(Ms(e.failure),140)),`status ${mt(e).padEnd(12)} ${t.join(" ")}`.trimEnd()}function _a(e){return `state ${e.state}`}function $a(e,t){let s=[["state",e.state]];if(t){let n=t.active_version?.version??null;s.push(["active",n===e.version?`${n} (this publish)`:n?`${n} (unchanged)`:"none"]);}return w(s)}function Sa(e){let t={...e.data??{}},s=[];typeof t.trial_id=="string"&&s.push(t.trial_id),typeof t.task_name=="string"&&s.push(t.task_name),typeof t.status=="string"&&s.push(t.status),typeof t.reward=="number"&&s.push(`reward=${t.reward}`);let n=new Set(["trial_id","task_name","status","reward"]);for(let[r,i]of Object.entries(t))n.has(r)||s.push(`${r}=${typeof i=="object"?JSON.stringify(i):String(i)}`);let a=Z(s.join(" "),140);return `#${String(e.seq).padStart(4)} ${e.type.padEnd(26)} ${a}`.trimEnd()}function g(e){let t={};return typeof e.flags["api-key"]=="string"&&(t.apiKey=e.flags["api-key"]),typeof e.flags["base-url"]=="string"&&(t.baseUrl=e.flags["base-url"]),t}var zs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,xa=/^[0-9a-f][0-9a-f-]{7,34}$/i,is=8,ne=200,Ia={job:"jobs",trial:"trials",analysis:"analyses","analyzed trial":"analyzed trials",check:"checks","task check":"task checks",session:"sessions",skill:"skills"},os=new WeakMap;function Pe(e,t,s){let n=os.get(e);n===void 0&&(n=new Map,os.set(e,n));let a=n.get(t);if(a!==void 0)return a;let r=s();return n.set(t,r),r}async function je(e){let t=[];for await(let s of e)t.push(s);return t}function ht(e){let t=Ee(e);return t!==void 0?{scope:t}:{}}var Ks=e=>Pe(e,"jobs",()=>je(Ga$1(g(e)).list({limit:ne,...ht(e)}))),ls=e=>Pe(e,"analyses",()=>je(Ia$1(g(e)).list({limit:ne,...ht(e)}))),us=e=>Pe(e,"checks",()=>je(Ja$1(g(e)).list({limit:ne,...ht(e)})));async function Oa(e){let t=Ga$1(g(e)),s=(await Ks(e)).map(r=>r.id),n=[],a=0;for(let r of s){try{for await(let i of t.trials(r,{limit:ne}))n.push(i.id);}catch(i){throw i instanceof ya$1&&i.code==="rate_limited"?new p(`trial id prefixes resolve against every trial of your ${s.length} jobs (one read per job); the API's rate limit refused the walk after ${a} \u2014 pass the full trial id (evolve job trials <job> prints them)`):i}a+=1;}return n}async function Pa(e){let t=ha$1(wt(e)),s=[],n;do{let a=await t.list({limit:ne,state:"all",...n!==void 0?{cursor:n}:{}});for(let r of a.items)s.push(r.id);n=a.nextCursor??void 0;}while(n!==void 0);return s}var ja={job:async e=>(await Ks(e)).map(t=>t.id),trial:Oa,analysis:async e=>(await ls(e)).map(t=>t.id),"analyzed trial":async e=>(await ls(e)).map(t=>t.trial_id),check:async e=>(await us(e)).map(t=>t.id),"task check":async e=>(await us(e)).flatMap(t=>t.results.map(s=>s.id)),session:Pa,skill:async e=>(await je(Fa$1(g(e)).list({limit:ne}))).map(t=>t.id)},Ea=(e,t)=>Pe(e,`ids:${t}`,()=>ja[t](e));function Aa(e){return `${/^[aeiou]/.test(e[0])?"an":"a"} ${e.join(" or ")}`}async function yt(e,t,s){if(s===void 0||zs.test(s))return {noun:null,id:s};if(/^[0-9a-f][0-9a-f-]*$/i.test(s)&&s.length<is)throw new p(`"${s}" is too short to name ${Aa(t)} \u2014 id prefixes need at least ${is} characters`);if(!xa.test(s))return {noun:null,id:s};let n=s.toLowerCase(),a=[];for(let o of t){let l=new Set((await Ea(e,o)).filter(c=>c.startsWith(n)));for(let c of l)a.push({noun:o,id:c});}if(a.length===1)return a[0];if(a.length===0)throw new p(`no ${t.join(" or ")} id starts with "${s}"`);let r=t.map(o=>({noun:o,n:a.filter(l=>l.noun===o).length})).filter(({n:o})=>o>0).map(({noun:o,n:l})=>`${l} ${l===1?o:Ia[o]}`),i=a.slice(0,5).map(o=>t.length>1?`${o.noun} ${o.id}`:o.id);throw new p(`"${s}" is ambiguous \u2014 it matches ${r.join(" and ")}: ${i.join(", ")}${a.length>5?", \u2026":""}`)}async function k(e,t,s){return (await yt(e,[t],s)).id}async function kt(e,t,s){let n=await yt(e,["analysis","analyzed trial"],s);if(n.noun==="analysis")return {id:n.id,analysis:null};if(n.noun==="analyzed trial")return cs(e,await Ha$1(g(e)).get(n.id));if(s===void 0||!zs.test(s))return {id:s,analysis:null};try{return {id:s,analysis:await t.get(s)}}catch(a){if(!(a instanceof ya$1)||a.status!==400)throw a;let r;try{r=await Ha$1(g(e)).get(s);}catch(i){throw i instanceof ya$1&&i.status===404?a:i}return cs(e,r)}}async function cs(e,t){if(t.analysis)return {id:t.analysis.id,analysis:t.analysis};throw (await Ga$1(g(e)).get(t.job_id)).is_regrade?new Error(`${t.id} is a regrade result \u2014 a regrade is never analyzed; analyses belong to its source trial`):new Error(`trial ${t.id} has no analysis yet \u2014 run: evolve analyze ${t.job_id}`)}function at(e,t){return t.analysis!==null?Promise.resolve(t.analysis):e.get(t.id)}function x(e){return {...e.flags.limit!==void 0?{limit:e.flags.limit}:{},...e.flags.cursor!==void 0?{cursor:String(e.flags.cursor)}:{}}}function Ee(e){if(e.flags.scope===void 0)return;let t=String(e.flags.scope);if(!V$1.includes(t))throw new p(`--scope must be one of: ${V$1.join(", ")}; got: ${t}`+(t==="all"?" (Harbor's all adds public rows \u2014 nothing hosted is public)":""));return t}function Ta(e){if(e.flags.status===void 0)return;let t=String(e.flags.status).split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new p("--status got an empty status list");let s=t.filter(n=>!W.includes(n));if(s.length>0)throw new p(`--status must name analysis statuses (${W.join(", ")}); got: ${s.join(", ")}`);return t}function Vs(e){if(e.flags.status===void 0)return;let t=String(e.flags.status).split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new p("--status got an empty status list");let s=t.filter(n=>!T$1.includes(n));if(s.length>0)throw new p(`--status must name trial statuses (${T$1.join(", ")}); got: ${s.join(", ")}`);return t}function Ca(e){return e.status==="COMPLETED"?0:e.status==="FAILED"||e.status==="CANCELLED"?1:0}function Na(e){return e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.startsWith("~")}async function Ra(e,t,s){let n=new Set;for(let i of e.agents)for(let o of i.skills??[])Na(o)&&n.add(o);if(n.size===0)return e;let a=Fa$1(g(t)),r=new Map;for(let i of n){let o=await a.upload(i);if(r.set(i,o.map(l=>l.ref)),t.flags.json!==true)for(let l of o)s.err(`Uploaded skill ${l.name} (${l.ref}, ${G(l.digest)})`);}return {...e,agents:e.agents.map(i=>({...i,...i.skills!==void 0&&i.skills!==null?{skills:i.skills.flatMap(o=>r.get(o)??[o])}:{}}))}}async function ds(e,t){let s=ta(e);if(e.flags["print-config"]===true)return t.out(JSON.stringify(s,null,2)),0;let n=e.flags.json===true,a=e.flags.watch===true,r=e.flags.quiet===true,i=Ga$1(g(e)),o=await i.start(await Ra(s,e,t));if(!a){if(n)t.out(JSON.stringify(o));else {for(let c of L(o))t.out(c);t.out(""),t.out(`Follow it with: evolve job show ${o.id}`);}return 0}n?t.out(JSON.stringify({kind:"job.created",job:o})):t.out(`Job ${o.id} (${Ie(o.datasets)}) ${o.status} \u2014 watching\u2026`);let l=await i.watch(o.id,{onEvent:c=>{r||t.out(n?JSON.stringify({kind:"event",...c}):Sa(c));}});if(n)t.out(JSON.stringify({kind:"job.final",job:l}));else {t.out("");for(let c of L(l))t.out(c);}return Ca(l)}async function La(e,t){if(T(e,t,Zt))return 0;let s=Ee(e),a=await Ga$1(g(e)).list({...x(e),...e.flags.search!==void 0?{search:String(e.flags.search)}:{},...s!==void 0?{scope:s}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):a.items.length===0?(e.flags.quiet!==true&&t.out("No jobs."),0):(A(e,t,a.items,Zt,oa,r=>r.id),a.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
33
+ More: evolve job list --cursor ${a.nextCursor}`),0)}async function Da(e,t){let s=Ga$1(g(e)),n=[];for(let a of e.positionals)n.push(await s.get(await k(e,"job",a)));return e.flags.json===true?(t.out(JSON.stringify(n.length===1?n[0]:n)),0):(n.forEach((a,r)=>{r>0&&t.out("");for(let i of L(a))t.out(i);}),0)}async function Ua(e,t){if(T(e,t,es))return 0;let s=Ga$1(g(e)),n=Vs(e),a=e.flags.dataset,r=await s.trials(await k(e,"job",e.positionals[0]),{...n!==void 0?{status:n}:{},...a!==void 0?{dataset:a}:{},...x(e)});return e.flags.json===true?(t.out(JSON.stringify(r)),0):r.items.length===0?(e.flags.quiet!==true&&t.out("No trials."),0):(A(e,t,r.items,es,la,i=>i.id),t.tty===true&&e.flags.quiet!==true&&(t.out(`
34
+ ${r.items.length} trial(s) shown`),r.nextCursor&&t.out(`More: evolve job trials ${e.positionals[0]} --cursor ${r.nextCursor}`)),0)}async function Ja(e,t){if(T(e,t,ts))return 0;let n=await Ga$1(g(e)).tasks(await k(e,"job",e.positionals[0]),x(e));return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.items.length===0?(e.flags.quiet!==true&&t.out("No tasks."),0):(A(e,t,n.items,ts,ua,a=>a.task_name),n.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
35
+ More: evolve job tasks ${e.positionals[0]} --cursor ${n.nextCursor}`),0)}function Fa(e){let t=[],s=[["ID","DATASETS","STATUS","MEAN REWARD","COVERAGE","SPENT"]];for(let n of e.jobs)s.push([n.id,Ie(n.datasets),n.status,nt(n.mean_reward),`${n.coverage.scored}/${n.coverage.total}`,R(n.cost_usd)]);if(t.push(...w(s)),e.taskMatrix.length>0){t.push("","Task matrix (disagreements first; columns in the order above):");let n=[["TASK","DIFF",...e.jobs.map((r,i)=>`JOB ${i+1}`)]],a=e.jobs.map(r=>r.id);for(let r of e.taskMatrix){let i=new Map(r.cells.map(o=>[o.job_id,o]));n.push([r.task_name,r.disagreement?"!":"",...a.map(o=>{let l=i.get(o);return l?l.mean_reward!==null?`${l.status} ${nt(l.mean_reward)}`:l.status:"-"})]);}t.push(...w(n));}return t}async function Ma(e,t){let s=Ga$1(g(e)),n=[];for(let r of e.positionals)n.push(await k(e,"job",r));let a=await s.compare(n);if(e.flags.json===true)t.out(JSON.stringify(a));else for(let r of Fa(a))t.out(r);return 0}async function qa(e,t){let n=await Ga$1(g(e)).cancel(await k(e,"job",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of L(n))t.out(a);return 0}async function za(e,t){let s=Ga$1(g(e)),n=await k(e,"job",e.positionals[0]);if(e.flags.yes!==true){if(t.confirm===void 0)throw new Error("deleting a job is permanent \u2014 trials, traces, analyses and stored files. Re-run with --yes to confirm.");let r=await s.get(n);if(t.err(` ${r.id} ${r.job_name||"\u2014"}`),!await t.confirm("Permanently delete this job and all associated trials?"))return t.err("Delete cancelled."),1}let a=await s.delete(n);return e.flags.json===true?t.out(JSON.stringify(a)):t.out(`Deleted job ${a.job_id}: ${a.trials_deleted} trials, ${a.analyses_deleted} analyses destroyed.`),0}async function Ka(e,t){let s=e.flags.dataset;if(!s)throw new p("job stop needs --dataset <name> (to stop the whole job, use: evolve job cancel <id>)");let n=Ga$1(g(e)),a=await n.get(await k(e,"job",e.positionals[0])),r=a.datasets.map(u=>u.name);if(!r.includes(s))throw new Error(`job ${a.id} does not run dataset ${s}; its datasets: ${r.join(", ")}`);let i=[];for await(let u of n.trials(a.id,{dataset:s}))i.push(u.id);if(i.length===0)return e.flags.json===true?t.out(JSON.stringify({stopped:[],stopped_analyses:[],already_terminal:[],not_found:[]})):t.out(`No trials in ${s}.`),0;let o=Ha$1(g(e)),l={stopped:[],stopped_analyses:[],already_terminal:[],not_found:[]},c=0;try{for(let u=0;u<i.length;u+=100){let d=i.slice(u,u+100),f=await o.stop(d);c+=d.length,l.stopped.push(...f.stopped),l.stopped_analyses.push(...f.stopped_analyses),l.already_terminal.push(...f.already_terminal),l.not_found.push(...f.not_found);}}catch(u){throw fs(l,s,i.length,c,e,t),u}return fs(l,s,i.length,c,e,t),0}function fs(e,t,s,n,a,r){let i=s-n;if(a.flags.json===true){r.out(JSON.stringify(i>0?{...e,partial:true,unreported:i}:e));return}for(let o of e.stopped)r.out(`stopped ${o.id} (${o.task_name}) ${o.status}`);for(let o of e.already_terminal)r.out(`already terminal ${o}`);for(let o of e.not_found)r.out(`not found ${o}`);r.out(`${e.stopped.length} stopped, ${e.already_terminal.length} already terminal, ${e.not_found.length} not found (${t})`),i>0&&r.out(`PARTIAL: ${i} of ${s} trials have no report \u2014 no answer came back for trials ${n+1}-${Math.min(n+100,s)}; rerun the same command to finish the rest.`);}async function Va(e,t){let s=Ga$1(g(e)),n=e.flags["filter-error-type"],a=await s.resume(await k(e,"job",e.positionals[0]),n!==void 0?{filter_error_types:n}:void 0);if(e.flags.json===true)t.out(JSON.stringify(a));else {for(let r of L(a))t.out(r);t.out(""),t.out(`Follow it with: evolve job show ${a.id}`);}return 0}async function Ga(e,t){let s=e.flags.trial,n=e.flags["failed-only"]===true;if(s!==void 0&&n)throw new p('"job retry" takes EITHER -t/--trial OR --failed-only, not both \u2014 explicit ids are already a selection');let a={};s!==void 0&&(a.trial_ids=s),n&&(a.failed_only=true);let r=await Ga$1(g(e)).retry(await k(e,"job",e.positionals[0]),a);if(e.flags.json===true)t.out(JSON.stringify(r));else {for(let i of L(r))t.out(i);t.out(""),t.out(`Follow it with: evolve job show ${r.id}`);}return 0}function Ha(e){if(e.length===0)return ["No analyzed trials."];let t=[["TRIAL","TASK","CHECKS","COST","SUMMARY"]],s=[];for(let n of e){let a=n.analysis,r;if(a.status==="failed")r=`FAILED${a.failure?` (${a.failure.phase})`:""}`,a.failure&&s.push(`analysis failed ${n.id} (${n.task_name}) \u2014 ${a.failure.phase}: ${V(a.failure.message)}`);else {let i=Object.entries(a.checks??{}).map(([l,c])=>`${l} ${c.outcome}`).join(" \xB7 ")||a.status,o=Oe(a.label);r=o?`${o} \xB7 ${i}`:i;}t.push([n.id,n.task_name,r,a.estimated_cost_usd!==null?`$${a.estimated_cost_usd.toFixed(4)}`:"-",a.summary?Z(V(a.summary),60):"-"]);}return [...w(t),...s]}async function Wa(e,t){let s=e.flags.json===true,n=e.flags.watch===true,a=e.flags.quiet===true,r=Ga$1(g(e)),i=await k(e,"job",e.positionals[0]),o={};e.flags.model!==void 0&&(o.model_name=String(e.flags.model)),e.flags.rubric!==void 0&&(o.rubric=ft(String(e.flags.rubric))),e.flags.prompt!==void 0&&(o.prompt=dt(String(e.flags.prompt))),e.flags.env!==void 0&&(o.sandbox_provider=String(e.flags.env)),e.flags.effort!==void 0&&(o.reasoning_effort=String(e.flags.effort)),e.flags["n-concurrent"]!==void 0&&(o.n_concurrent=e.flags["n-concurrent"]),e.flags.passing===true&&(o.passing=true),e.flags.failing===true&&(o.failing=true),e.flags["n-trials"]!==void 0&&(o.n_trials=e.flags["n-trials"]);let l=await r.get(i);if((l.upload?.task_links??[]).some(f=>f.n_unlinked>0))for(let f of bt(l.upload?.task_links??null))t.err(f);else l.upload!==null&&l.upload!==void 0&&l.upload.task_links===null&&t.err(or);let c=await r.analyze(i,o);if(!n){if(s)t.out(JSON.stringify(c));else {for(let f of L(c))t.out(f);t.out(""),t.out(`Follow it with: evolve job show ${c.id}`);}return 0}s?t.out(JSON.stringify({kind:"analysis.accepted",job:c})):a||t.out(`Job ${c.id} \u2014 analyses enqueued, watching\u2026`);let u=await r.watchAnalysis(c.id,{onStats:f=>{a||f.stats.analysis&&t.out(s?JSON.stringify({kind:"analysis.stats",analysis:f.stats.analysis}):`analyses ${tt(f.stats.analysis)}`);}}),d=[];for await(let f of r.trials(u.id))f.analysis&&d.push(f);if(s)t.out(JSON.stringify({kind:"analysis.final",job:u,trials:d}));else {t.out("");for(let f of Ha(d))t.out(f);u.stats.analysis&&(t.out(""),t.out(`analyses ${tt(u.stats.analysis)}`)),t.out("Details: evolve trial show <trial-id>");}return (u.stats.analysis?.n_failed??0)>0?1:0}function Ba(e){return e.replace(/_/g," ").split(" ").map(t=>t&&t[0].toUpperCase()+t.slice(1).toLowerCase()).join(" ")}function Gs(e){let t=[],s=e.results.filter(a=>a.status==="failed");if(e.results.length===1){let a=e.results[0];if(a.status==="failed"&&a.failure)return t.push(`\u274C ${a.task_name}: ${a.failure.phase}: ${a.failure.message}`),t;t.push(`Task Quality Checks: ${a.task_name}`);let r=a.status==="completed"?st(a):null;r!==null&&t.push(`Label: ${r}`);let i=[["CHECK","OUTCOME","EXPLANATION"]];for(let[o,l]of Object.entries(a.checks??{})){i.push([Ba(o),l.outcome,V(l.explanation)]);for(let c of l.evidence??[])i.push(["","",`${c.where} \u2014 ${V(c.quote)}`]);}return i.length===1&&i.push(["-",a.status,"-"]),t.push(...w(i)),a.cost_usd!==null&&t.push(`Agent cost: $${a.cost_usd.toFixed(4)}`),t.push(`Task check id: ${a.id}`),t}t.push("Task Quality Checks");let n=[["TASK","LABEL","PASS","FAIL","N/A","UNKNOWN","COST ($)","TASK CHECK ID"]];for(let a of e.results){if(a.status==="failed"){n.push([a.task_name,"-","-","-","-","-","-",a.id]);continue}if(a.status!=="completed"){n.push([a.task_name,a.status,"","","","","-",a.id]);continue}let r=Ds(a.checks);n.push([a.task_name,st(a)??"-",String(r.pass),String(r.fail),String(r.not_applicable),String(r.unknown),a.cost_usd!==null?a.cost_usd.toFixed(4):"-",a.id]);}t.push(...w(n));for(let a of s)a.failure&&t.push(`\u274C ${a.task_name}: ${a.failure.phase}: ${a.failure.message.split(`
36
+ `)[0]}`);return e.cost_usd!==null&&t.push(`Total agent cost: $${e.cost_usd.toFixed(4)}`),t}function Hs(e){let t={};for(let s of e.results)t[s.status]=(t[s.status]??0)+1;return Object.entries(t).map(([s,n])=>`${n} ${s}`).join(" \xB7 ")}function Ws(e){let t=e.rubric.criteria.length,s=[["check id",e.id],["status",e.status],["source",e.source.type==="dataset"?`dataset ${e.source.dataset} (package sha256 ${e.source.sha256.slice(0,12)}\u2026)`:`archive ${e.source.bytes} bytes sha256 ${e.source.sha256.slice(0,12)}\u2026`],["tasks",`${e.results.length} (${Hs(e)})`],["model",`${e.model_name} at effort ${e.reasoning_effort}`],["rubric",`${t} criteri${t===1?"on":"a"}`],["provider",e.sandbox_provider]];return e.prompt!==null&&s.push(["prompt","custom (Harbor's -p text)"]),e.n_concurrent!==null&&s.push(["n_concurrent",String(e.n_concurrent)]),e.include_task_names.length>0&&s.push(["include",e.include_task_names.join(", ")]),e.exclude_task_names.length>0&&s.push(["exclude",e.exclude_task_names.join(", ")]),e.n_tasks!==null&&s.push(["n_tasks",String(e.n_tasks)]),s.push(["created",e.created_at]),e.finished_at&&s.push(["finished",e.finished_at]),[...w(s),"",...Gs(e)]}function Ya(e){let t=e.rubric.criteria.length,s=w([["model",e.model_name],["effort",e.reasoning_effort],["provider",e.sandbox_provider],["rubric",`${t} criteri${t===1?"on":"a"}`]]);s.push("","PROMPT",...e.prompt.split(`
37
+ `),"","RUBRIC");for(let n of e.rubric.criteria)s.push(`${n.name}: ${n.description}`),n.guidance&&s.push(` ${n.guidance}`);return s}async function Xa(e,t){let s=e.flags.json===true,n=e.flags.watch===true,a=e.flags.quiet===true,r=Ja$1(g(e));if(e.flags["show-defaults"]===true){let f=Object.keys(e.flags).filter(y=>!["show-defaults","json","api-key","base-url"].includes(y));if(e.positionals[0]!==void 0||f.length>0)throw new p("--show-defaults prints the platform's check defaults and takes no <path> and no other check flag"+(f.length>0?` (given: ${f.map(y=>"--"+y).join(", ")})`:""));let m=await r.defaults();if(s)t.out(JSON.stringify(m));else for(let y of Ya(m))t.out(y);return 0}let i={};e.flags.name!==void 0&&(i.name=String(e.flags.name)),e.flags.model!==void 0&&(i.model_name=String(e.flags.model)),e.flags.rubric!==void 0&&(i.rubric=ft(String(e.flags.rubric))),e.flags.prompt!==void 0&&(i.prompt=dt(String(e.flags.prompt))),e.flags.env!==void 0&&(i.sandbox_provider=String(e.flags.env)),e.flags.effort!==void 0&&(i.reasoning_effort=String(e.flags.effort)),e.flags["n-concurrent"]!==void 0&&(i.n_concurrent=e.flags["n-concurrent"]),e.flags["include-task-name"]!==void 0&&(i.include_task_names=e.flags["include-task-name"]),e.flags["exclude-task-name"]!==void 0&&(i.exclude_task_names=e.flags["exclude-task-name"]),e.flags["n-tasks"]!==void 0&&(i.n_tasks=e.flags["n-tasks"]);let o=e.positionals[0],l=e.flags.dataset;if(o===void 0&&l===void 0)throw new p("check takes a <path> (a task directory, or a directory of them) or -d/--dataset <name[@version]>");if(o!==void 0&&l!==void 0)throw new p("check takes EITHER a <path> OR -d/--dataset, not both");let c=l!==void 0?{dataset:l}:{directory:o};!s&&!a&&t.out("\u{1F50E} Checking task quality...");let u=await r.create({source:c,...i});if(!n){if(s)t.out(JSON.stringify(u));else {for(let f of Ws(u))t.out(f);t.out(""),t.out(`Follow it with: evolve check show ${u.id}`);}return 0}s?t.out(JSON.stringify({kind:"check.accepted",check:u})):a||t.out(`Check ${u.id} \u2014 ${u.results.length} task${u.results.length===1?"":"s"} queued, watching\u2026`);let d=await r.watch(u.id,{onProgress:f=>{a||t.out(s?JSON.stringify({kind:"check.progress",check:f}):`tasks ${Hs(f)}`);}});if(s)t.out(JSON.stringify({kind:"check.final",check:d}));else {t.out("");for(let f of Gs(d))t.out(f);t.out(""),t.out(`Report: evolve check show ${d.id}`);}return d.results.some(f=>f.status==="failed")?1:0}function Qa(e){if(e.flags.status===void 0)return;let t=String(e.flags.status).split(",").map(n=>n.trim()).filter(Boolean);if(t.length===0)throw new p("--status got an empty status list");let s=t.filter(n=>!X$1.includes(n));if(s.length>0)throw new p(`--status must name check statuses (${X$1.join(", ")}); got: ${s.join(", ")}`);return t}var ps=[{key:"id",header:"ID",cell:e=>e.id},{key:"status",header:"STATUS",cell:e=>e.status},{key:"tasks",header:"TASKS",cell:e=>String(e.results.length)},{key:"model",header:"MODEL",cell:e=>e.model_name},{key:"spent",header:"SPENT",cell:e=>e.cost_usd!==null?`$${e.cost_usd.toFixed(4)}`:"-"},{key:"created",header:"CREATED",cell:e=>e.created_at},{key:"finished",header:"FINISHED",cell:e=>e.finished_at??"-"}],Za=["id","status","tasks","model","spent","created"];async function er(e,t){if(T(e,t,ps))return 0;let s=Ee(e),n=Qa(e),a=e.flags.dataset,r=await Ja$1(g(e)).list({...x(e),...s!==void 0?{scope:s}:{},...n!==void 0?{status:n}:{},...a!==void 0?{dataset:a}:{}});return e.flags.json===true?(t.out(JSON.stringify(r)),0):r.items.length===0?(e.flags.quiet!==true&&t.out("No checks."),0):(A(e,t,r.items,ps,Za,i=>i.id),r.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
38
+ More: evolve check list --cursor ${r.nextCursor}`),0)}async function tr(e,t){let s=await Ja$1(g(e)).get(await k(e,"check",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of Ws(s))t.out(n);return s.results.some(n=>n.status==="failed")?1:0}async function sr(e,t){let s=e.flags.json===true,n=e.flags.since,a=await Ja$1(g(e)).transcript(await k(e,"task check",e.positionals[0]),n!==void 0?{since:n}:void 0);for(let r of a.events)D(t,s,r);for(let r of a.gateway_calls)D(t,s,r);return !s&&a.events.length===0&&t.out("No trace events."),0}var gs=["task-check","trace-parsed",...da$1];async function ms(e,t){try{return await e.task(t)}catch(s){throw s instanceof ya$1&&s.status===404?new Error(`'${t}' is not a task check \u2014 --stream reads one task check's artifacts (results[].id on \`evolve check show\`); to save the whole check by its check id, drop --stream`):s}}async function nr(e,t){let s=Ja$1(g(e)),n=e.flags.json===true,a=e.flags.stream;if(a!==void 0&&(e.flags["output-dir"]!==void 0||e.flags.overwrite===true))throw new p('"check download" takes EITHER --stream OR -o/--overwrite, not both');if((a===void 0||a!=="trace-parsed")&&e.flags.since!==void 0)throw new p("--since pages the parsed events; it applies only to --stream trace-parsed");let r=(await yt(e,a!==void 0?["task check"]:["check","task check"],e.positionals[0])).id,i=r;if(a!==void 0){if(!gs.includes(a))throw new p(`--stream must be one of: ${gs.join(", ")}`);if(a==="task-check"){let c=await ms(s,i);return t.out(n?JSON.stringify({task_check:c}):JSON.stringify(c,null,2)),0}if(a==="trace-parsed"){let c=e.flags.since,u=await s.transcript(i,c!==void 0?{since:c}:void 0);for(let d of u.events)D(t,n,d);for(let d of u.gateway_calls)D(t,n,d);return !n&&u.events.length===0&&t.out("No trace events."),0}if(await ms(s,i),a==="agent-home"){let c=await s.artifact(i,a);if(c===null)return t.out(n?JSON.stringify({files:null}):`No ${a} content was stored for this task check.`),0;if(n)t.out(JSON.stringify({files:c}));else for(let[u,d]of Object.entries(c))t.out(`===== ${u} (${Buffer.byteLength(d,"utf8")} bytes) =====`),t.out(d);return 0}let l=await s.artifact(i,a);return l===null?(t.out(n?JSON.stringify({log:null}):`No ${a} log was stored for this task check.`),0):(t.out(n?JSON.stringify({log:l}):l),0)}return await Bs(e,t,{fetch:l=>s.download(r,{to:l}),outputDir:e.flags["output-dir"]??"checks",scratchPrefix:"evolve-check-download-",enrich:async l=>{let{readdir:c}=await import('fs/promises'),{join:u}=await import('path'),d=await Ae(e),f=existsSync(u(l,"check_report.json")),m=f?(await c(l,{withFileTypes:true})).filter(_=>_.isDirectory()).map(_=>u(l,_.name)):[l],y=new Map;for(let _ of m){let h=await ar(_);h!==null&&y.set(_,h);}let P=f?r:y.get(l)?.checkId;if(P===void 0)return [];let $=await s.get(P),b=[];f&&(await rt(u(l,"evolve.json"),xa$1($,d)),b.push("evolve.json"));for(let[_,h]of y){let S=$.results.find(O=>O.id===h.taskCheckId);S!==void 0&&(await rt(u(_,"evolve.json"),wa$1(S,$,d)),b.push(f?`${_.slice(l.length+1)}/evolve.json`:"evolve.json"));}return b}})}async function ar(e){let{readFile:t}=await import('fs/promises'),{join:s}=await import('path');try{let n=JSON.parse(await t(s(e,"result.json"),"utf8")),a=n.x_evolve?.taskCheckId,r=n.x_evolve?.checkId;return typeof a=="string"&&typeof r=="string"?{taskCheckId:a,checkId:r}:null}catch{return null}}async function rt(e,t){let{writeFile:s}=await import('fs/promises');await s(e,JSON.stringify(t,null,2)+`
39
+ `);}async function Bs(e,t,s){let{mkdtemp:n,rm:a}=await import('fs/promises'),{tmpdir:r}=await import('os'),{join:i}=await import('path'),{extractTarGz:o,tarGzTopLevelName:l}=await import('../tar-GVC4KE52.js'),c=await n(i(r(),s.scratchPrefix));try{let u=await s.fetch(c),d=await l(u),f=i(s.outputDir,d);if(existsSync(f)){if(e.flags.overwrite!==!0)throw new Error(`${f} already exists (pass --overwrite to replace it)`);await a(f,{recursive:!0,force:!0});}let m;try{m=await o(u,s.outputDir,d);}catch(y){throw await a(f,{recursive:!0,force:!0}).catch(()=>{}),y}return m.push(...await s.enrich(f)),e.flags.json===!0?t.out(JSON.stringify({path:f,files:m.length})):t.out(`Saved ${f} (${m.length} files)`),0}finally{await a(c,{recursive:true,force:true}).catch(()=>{});}}async function rr(e,t){let s=Ga$1(g(e)),n={},a=Vs(e);a!==void 0&&(n.statuses=a),e.flags.task!==void 0&&(n.task_name=String(e.flags.task));let r=await s.regrade(await k(e,"job",e.positionals[0]),n);if(e.flags.json===true)t.out(JSON.stringify(r));else {for(let i of L(r))t.out(i);t.out(""),t.out(`Follow it with: evolve job show ${r.id}`);}return 0}async function ir(e,t){let s=Ga$1(g(e)),n=await k(e,"job",e.positionals[0]),{join:a}=await import('path'),r=e.flags["output-dir"]??process.cwd(),i=`job-${n}`,o=a(r,i);if(existsSync(o)&&e.flags.overwrite!==true)throw new Error(`${o} already exists (pass --overwrite to replace it)`);let{mkdtemp:l,rm:c}=await import('fs/promises'),{tmpdir:u}=await import('os'),{extractTarGz:d}=await import('../tar-GVC4KE52.js'),f=await l(a(u(),"evolve-job-download-"));try{let m=await s.download(n,{to:f});e.flags.overwrite===!0&&await c(o,{recursive:!0,force:!0});let y;try{y=await d(m,r,i);}catch(O){throw await c(o,{recursive:!0,force:!0}).catch(()=>{}),O}let{readdir:P,readFile:$,writeFile:b}=await import('fs/promises'),_=await s.get(n),h=await Ae(e),S=new Map;for await(let O of s.trials(n))S.set(O.id,O);await b(a(o,"evolve.json"),JSON.stringify(ta$1(_,h),null,2)+`
40
+ `),y.push("evolve.json");for(let O of await P(o,{withFileTypes:!0})){if(!O.isDirectory())continue;let Ce;try{Ce=JSON.parse(await $(a(o,O.name,"result.json"),"utf8")).x_evolve?.trialId;}catch{continue}let _t=Ce!==void 0?S.get(Ce):void 0;_t&&(await b(a(o,O.name,"evolve.json"),JSON.stringify(sa$1(_t,_,h),null,2)+`
41
+ `),y.push(`${O.name}/evolve.json`));}return e.flags.json===!0?t.out(JSON.stringify({path:o,files:y.length})):t.out(`Saved ${o} (${y.length} files)`),0}finally{await c(f,{recursive:true,force:true}).catch(()=>{});}}function de(e){return e.receiving?`${e.status} (receiving)`:e.status}function Ys(e){let t=[["id",e.id],["status",de(e)]];return e.source!==null&&t.push(["source",e.source.type==="archive"?`archive (${G(`sha256:${e.source.sha256}`)})`:e.source.type==="archive_url"?`url ${e.source.url}`:`hub job ${e.source.job_id}`]),e.dataset!==null&&t.push(["dataset",e.dataset]),e.job_id!==null&&t.push(["job",e.job_id]),e.n_trials_uploaded!==null&&t.push(["trials",String(e.n_trials_uploaded)]),e.n_trials_skipped!==null&&t.push(["skipped",String(e.n_trials_skipped)]),e.progress!==null&&t.push(["phase",e.progress.phase]),e.failure!==null&&t.push(["failure",`${e.failure.code}: ${e.failure.message}`]),[...w(t),...Xs(e.skipped_trials),...bt(e.task_links)]}var hs={hash_mismatch:"hash mismatch",task_not_in_dataset:"task not in the dataset",no_dataset_named:"no dataset named",dataset_ambiguous:"same task in two datasets",no_hash_match:"no task with this hash",no_task_digest:"no task digest in the archive"},or="uploaded before task linking existed: whether its trials carry the task folder is unknown here; each analysis row records it (task_absent_reason)";function lr(e){return e==="dataset_flag"?"by task name, -d":"task hashes equal"}function bt(e){if(e===null||e.length===0)return [];let t=e.reduce((d,f)=>d+f.n_trials,0),s=e.reduce((d,f)=>d+f.n_linked,0),n=(d,f)=>`${d} ${f}${d===1?"":"s"}`,a=d=>Object.entries(d.link_reasons).map(([f,m])=>`${hs[f]??f}${Object.keys(d.link_reasons).length>1?` ${m}`:""}`).join(", ")+(d.candidates.length>0?` [${d.candidates.join(", ")}]`:""),r=e.filter(d=>d.n_unlinked>0);if(s===0){let d=Array.from(new Set(r.flatMap(m=>Object.keys(m.link_reasons)))).map(m=>hs[m]??m).join(", "),f=Array.from(new Set(r.flatMap(m=>m.candidates)));return [`no dataset matched (${d}${f.length>0?`: ${f.join(", ")}`:""}); analyses of this job will run without the task folder \u2014 link explicitly with -d`]}let i=new Map,o="";for(let d of e)if(d.n_linked!==0){o=lr(d.linked_by);for(let f of d.datasets)i.set(f,(i.get(f)??0)+d.n_linked);}let l=Array.from(i.entries()),c=l.length===1?l[0][0]:l.map(([d,f])=>`${d} (${f})`).join(", "),u=[`linked ${s} of ${n(t,"trial")} to ${c} (${o})`];return r.length>0&&u.push(`not linked: ${r.map(d=>`${d.task_name} (${n(d.n_unlinked,"trial")}, ${a(d)})`).join(", ")} \u2014 analyses of those trials run without the task folder; link explicitly: evolve upload <dir> -d <name[@version]>`),u}function Xs(e){return e===null||e.length===0?[]:e.map(t=>` skipped ${t.trial}: ${t.code}: ${t.message}`)}function ur(e){let t=e.failure!==null?Z(`${e.failure.code}: ${e.failure.message}`,140):"";return `status ${de(e).padEnd(20)} ${t}`.trimEnd()}function cr(e,t=Date.now()){let s=gt(t-Date.parse(e.started_at));return `phase ${e.phase.padEnd(20)} ${s} elapsed`}async function Qs(e,t,s,n){let a=Ga$1(g(e)),r=e.flags.json===true;r||s.out(n==="accepted"?`Upload accepted: import ${t.id} ${de(t)} \u2014 watching\u2026`:`Import ${t.id} ${de(t)} \u2014 watching\u2026`);let i=await a.watchImport(t.id,{onStatus:u=>{r||s.out(ur(u));},onProgress:u=>{r||s.out(cr(u));}});if(i.status==="FAILED"||i.job_id===null){let u=i.failure??{code:"import_failed",message:"the import settled without a job and without a recorded failure"};return r&&s.out(JSON.stringify({error:u})),s.err(`Error: ${u.message}`),1}let o=await a.get(i.job_id);if((i.n_trials_skipped??0)>0){s.err(`Skipped ${i.n_trials_skipped} trial(s) \u2014 see: evolve job import ${i.id}`);for(let u of Xs(i.skipped_trials))s.err(u);}let l=bt(o.upload?.task_links??null),c=(o.upload?.task_links??[]).some(u=>u.n_unlinked>0);if(r){if(c)for(let u of l)s.err(u);return s.out(JSON.stringify(o)),0}s.out("");for(let u of L(o,{taskLinksRow:false}))s.out(u);if(l.length>0){s.out("");for(let u of l)s.out(u);}return s.out(""),s.out(`Analyze it with: evolve analyze ${o.id}`),0}async function dr(e,t){let s=Ga$1(g(e)),n=e.flags.json===true,a=e.flags.dataset,r=e.flags.from,i=e.positionals[0];if(r!==void 0&&i!==void 0)throw new p('"upload" takes EXACTLY ONE source: <job_dir>, or --from <url>');if(r===void 0&&i===void 0)throw new p('"upload" needs a source: <job_dir> (or its .tar.gz), or --from <url>');if(r!==void 0&&!r.trim().startsWith("https://"))throw new p(`"--from" takes a public https url of a job archive (got "${r}")`);let o=-1,l=await s.upload(r!==void 0?{archive_url:r.trim()}:i,{...a!==void 0?{dataset:a}:{},onUploadProgress:(c,u)=>{if(n)return;let d=u>0?Math.floor(c/u*10):10;d!==o&&(o=d,t.out(`upload ${c}/${u} (${Math.min(100,d*10)}%)`));},onRegistered:c=>{n||t.out(`Registered import ${c} \u2014 re-attach anytime with: evolve job import ${c} --watch`);}});if(e.flags["no-wait"]===true){if(n)return t.out(JSON.stringify(l)),0;for(let c of Ys(l))t.out(c);return t.out(""),t.out(`Follow it with: evolve job import ${l.id} --watch`),0}return Qs(e,l,t,"accepted")}var ys=[{key:"id",header:"ID",cell:e=>e.id},{key:"status",header:"STATUS",cell:de},{key:"job",header:"JOB",cell:e=>e.job_id??"-"},{key:"trials",header:"TRIALS",cell:e=>e.n_trials_uploaded===null?"-":String(e.n_trials_uploaded)},{key:"skipped",header:"SKIPPED",cell:e=>e.n_trials_skipped===null?"-":String(e.n_trials_skipped)},{key:"dataset",header:"DATASET",cell:e=>e.dataset??"-"},{key:"created",header:"CREATED",cell:e=>e.created_at??""}],fr=["id","status","job","trials","skipped","dataset","created"];async function pr(e,t){if(T(e,t,ys))return 0;let s=Ga$1(g(e)),n=e.flags.status;if(n!==void 0&&!["QUEUED","RUNNING","COMPLETED","FAILED"].includes(n))throw new p(`"--status" must be one of QUEUED, RUNNING, COMPLETED, FAILED (got "${n}")`);let a=await s.listImports({...x(e),...n!==void 0?{status:n}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):a.items.length===0?(e.flags.quiet!==true&&t.out("No job imports."),0):(A(e,t,a.items,ys,fr,r=>r.id),a.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
42
+ More: evolve job imports --cursor ${a.nextCursor}`),0)}async function gr(e,t){let n=await Ga$1(g(e)).getImport(e.positionals[0]);if(e.flags.watch===true)return Qs(e,n,t,"attached");if(e.flags.json===true)return t.out(JSON.stringify(n)),0;for(let a of Ys(n))t.out(a);return 0}async function mr(e,t){let n=await Ha$1(g(e)).get(await k(e,"trial",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of ma(n))t.out(a);return 0}var ks=ba$1;async function hr(e,t){let s=Ha$1(g(e)),n=e.flags.json===true,a=e.flags.stream;if(a!==void 0&&(e.flags["output-dir"]!==void 0||e.flags.overwrite===true))throw new p('"trial download" takes EITHER --stream OR -o/--overwrite, not both');if((a===void 0||a!=="trace-parsed")&&(e.flags.cursor!==void 0||e.flags.limit!==void 0))throw new p("--cursor/--limit page the parsed events; they apply only to --stream trace-parsed");let r=await k(e,"trial",e.positionals[0]);if(a!==void 0){if(!ks.includes(a))throw new p(`--stream must be one of: ${ks.join(", ")}`);if(a==="trace-parsed"){let b=0;for await(let _ of s.traceEvents(r,x(e)))D(t,n,_),b+=1;return !n&&b===0&&t.out("No trace events."),0}if(a==="agent-home"){let b=await s.artifact(r,a);if(b===null)return t.out(n?JSON.stringify({files:null}):`No ${a} content was stored for this trial.`),0;if(n)t.out(JSON.stringify({files:b}));else for(let[_,h]of Object.entries(b))t.out(`===== ${_} (${Buffer.byteLength(h,"utf8")} bytes) =====`),t.out(h);return 0}if(a==="filesystem"){let b=await s.filesystem(r).archive();return n?t.out(JSON.stringify({stream:"filesystem",bytes:b.length,encoding:"base64",data:b.toString("base64")})):(t.bytes??(_=>process.stdout.write(_)))(b),0}let $=await s.artifact(r,a);return $===null?(t.out(n?JSON.stringify({log:null}):`No ${a} log was stored for this trial.`),0):(t.out(n?JSON.stringify({log:$}):$),0)}let{mkdir:i,writeFile:o}=await import('fs/promises'),{join:l,dirname:c}=await import('path'),u=l(e.flags["output-dir"]??"trials",r);if(existsSync(u)&&e.flags.overwrite!==true)throw new Error(`${u} already exists (pass --overwrite to replace it)`);let d=await s.get(r),f=null;try{f=await Ga$1(g(e)).get(d.job_id);}catch{f=null;}let m=[];for await(let $ of s.traceEvents(r))m.push($);let y=ua$1({trial:d,job:f,events:m,atif:await s.artifact(r,"trace-atif"),verifierLog:await s.artifact(r,"verifier"),stdout:await s.artifact(r,"trace-stdout"),stderr:await s.artifact(r,"trace-stderr"),home:await s.artifact(r,"agent-home"),userId:await Ae(e)});await i(u,{recursive:true});let P=[];for(let $ of Object.keys(y).sort()){let b=l(u,...$.split("/"));await i(c(b),{recursive:true}),await o(b,y[$]),P.push($),n||t.out($);}return n?t.out(JSON.stringify({path:u,saved:P})):t.out(`Saved ${u}`),0}async function Ae(e){try{return (await Ka$1(g(e)).status()).user_id}catch{return null}}async function yr(e,t){let s=Ha$1(g(e)),n=e.flags.json===true,a=x(e);e.flags.type!==void 0&&(a.type=String(e.flags.type)),e.flags.grep!==void 0&&(a.grep=String(e.flags.grep)),e.flags.tail!==void 0&&(a.tail=e.flags.tail);let r=0;for await(let i of s.traceEvents(await k(e,"trial",e.positionals[0]),a))D(t,n,i),r+=1;return !n&&r===0&&t.out("No trace events."),0}async function kr(e,t){let s=Ga$1(g(e)),n=await k(e,"job",e.positionals[0]),a=x(e);e.flags.type!==void 0&&(a.type=String(e.flags.type));let r=await s.grep(n,e.positionals[1],a);if(e.flags.json===true)return t.out(JSON.stringify(r)),0;if(r.items.length===0)return t.out("No matches."),0;for(let i of r.items){let o=i.match_count===1?"match":"matches";t.out(`${i.trial_id} ${i.task_name??"-"} ${i.match_count} ${o}`);for(let l of i.events){let c=Fs(l);c!==null&&t.out(` ${c}`);}}return r.hasMore&&r.nextCursor&&(t.out(""),t.out(`More trials match \u2014 resume with --cursor ${r.nextCursor}`)),0}async function br(e,t){let s=await Ha$1(g(e)).retry(await k(e,"trial",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else {for(let n of L(s))t.out(n);t.out(""),t.out(`Follow it with: evolve job show ${s.id}`);}return 0}async function wr(e,t){let s=await Ha$1(g(e)).regrade(await k(e,"trial",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else {for(let n of L(s))t.out(n);t.out(""),t.out(`Follow it with: evolve job show ${s.id}`);}return 0}async function vr(e){let t=await k(e,"trial",e.positionals[0]);return {fs:Ha$1(g(e)).filesystem(t),label:t,pathAt:1}}async function _r(e){let t=await k(e,"analysis",e.positionals[0]);return {fs:Ia$1(g(e)).filesystem(t),label:t,pathAt:1}}async function $r(e){let t=await k(e,"task check",e.positionals[0]),s=Ja$1(g(e)),n=await s.task(t);return {fs:s.taskFilesystem(n.check_id,t),label:t,pathAt:1}}async function Sr(e){let[t,s]=e.positionals,n=Da$1(g(e)),a;try{a=n.taskFiles(t,s);}catch(r){throw new p(r instanceof Error?r.message:String(r))}return {fs:a,label:`${t}/${s}`,pathAt:2}}function ue(e){let t=e.flags.source;if(t!==void 0){if(t!=="live"&&t!=="capture")throw new p("--source must be live or capture");return t}}function bs(e,t){(e.bytes??(s=>process.stdout.write(s)))(t);}function xr(e){let t=[["state",e.state],["box",e.box?`${e.box.provider} ${e.box.id} (${e.box.role}, since ${e.box.since})`:"-"],["watcher",e.watcher??"-"],["work dir",e.work_dir]];if(e.capture){let s=e.capture;t.push(["capture",`${s.status} \xB7 ${s.phase} \xB7 ${s.entries} entries \xB7 ${s.changed_files} changed (${H(s.changed_bytes)}) \xB7 ${s.at}`]),s.left_out.length>0&&t.push(["left out",s.left_out.join(", ")]);}return t.map(([s,n])=>`${s.padEnd(10)} ${n}`)}function Ir(e){let t=[e.changed?`${e.changed}${e.phase?` (${e.phase})`:""}`:"",e.captured===false?"image only":""].filter(Boolean).join(", "),s=e.type==="dir"?`${e.name}/`:e.target?`${e.name} -> ${e.target}`:e.name;return `${e.type.padEnd(7)} ${e.mode.padEnd(5)} ${H(e.size).padStart(8)} ${e.mtime} ${s}${t?` [${t}]`:""}`}function Te(e){let t=s=>s.flags.json===true;return {async status(s,n){let{fs:a}=await e(s),r=await a.status();if(t(s))n.out(JSON.stringify(r));else for(let i of xr(r))n.out(i);return 0},async list(s,n){let{fs:a,pathAt:r}=await e(s),i=await a.list({path:s.positionals[r]??"/",source:ue(s),...x(s)});if(t(s))return n.out(JSON.stringify(i)),0;for(let o of i.entries)n.out(Ir(o));return i.entries.length===0&&n.out(`(empty) ${i.path}`),i.next_cursor!==null&&n.out(`\u2026 more: --cursor ${i.next_cursor}`),0},async cat(s,n){let{fs:a,pathAt:r}=await e(s),i=s.positionals[r];if(i===void 0)throw new p("cat needs a <path>");let o=s.flags.range!==void 0?Or(String(s.flags.range)):void 0,l=await a.read(i,{source:ue(s),range:o});return t(s)?n.out(JSON.stringify({path:i,bytes:l.length,encoding:"base64",data:l.toString("base64")})):bs(n,l),0},async search(s,n){let{fs:a,pathAt:r}=await e(s);if(!a.search)throw new p("this owner has no search");let i=s.positionals[r];if(i===void 0)throw new p("search needs the text to find");let o=await a.search({q:i,path:s.flags.path!==void 0?String(s.flags.path):void 0,regex:s.flags.regex===true,limit:s.flags.limit!==void 0?s.flags.limit:void 0,source:ue(s)});if(t(s))return n.out(JSON.stringify(o)),0;for(let l of o.hits)n.out(`${l.path}:${l.line}: ${l.snippet}`);return o.hits.length===0&&n.out("No hits."),o.truncated&&n.out("(truncated \u2014 narrow the path or the text)"),o.image_files_excluded&&n.out("(files the run never touched were not searched)"),0},async changes(s,n){let{fs:a}=await e(s);if(!a.changes)throw new p("this owner has no change list");let r=s.flags.phase!==void 0?String(s.flags.phase):void 0;if(r!==void 0&&!["setup","agent","verifier","all"].includes(r))throw new p("--phase must be setup, agent, verifier or all");let i=await a.changes({source:ue(s),phase:r,...x(s)});if(t(s))return n.out(JSON.stringify(i)),0;n.out(`${i.total} changed (${H(i.changed_bytes)}), ${i.source}`);for(let o of i.items)n.out(`${o.changed.padEnd(8)} ${o.phase.padEnd(8)} ${H(o.size).padStart(8)} ${o.path}`);return i.next_cursor!==null&&n.out(`\u2026 more: --cursor ${i.next_cursor}`),0},async archive(s,n){let{fs:a,label:r}=await e(s);if(!a.archive)throw new p("this owner has no archive");let i={path:s.flags.path!==void 0?String(s.flags.path):void 0,source:ue(s)},o=s.flags["output-dir"];if(o!==void 0){let c=await a.archive({...i,to:String(o)});return n.out(t(s)?JSON.stringify({saved:c}):c),0}let l=await a.archive(i);return t(s)?n.out(JSON.stringify({label:r,bytes:l.length,encoding:"base64",data:l.toString("base64")})):bs(n,l),0},async logs(s,n){let{fs:a}=await e(s);if(!a.logs||!a.logEvents)throw new p("this owner has no sandbox logs");let r=String(s.flags.stream??"");if(!ca$1.includes(r))throw new p(`--stream must be one of: ${ca$1.join(", ")}`);let i=l=>{t(s)?n.out(JSON.stringify(l)):n.out(`${l.t??"-"} ${l.fd==="err"?"!":" "} ${l.line}`);};if(s.flags.follow===true){let l=s.flags.cursor!==void 0?`${r}:${s.flags.cursor}`:void 0;for await(let c of a.logEvents({lastEventId:l}))c.event==="line"&&c.data.stream===r&&i(c.data);return 0}let o=await a.logs({stream:r,...x(s)});if(t(s))return n.out(JSON.stringify(o)),0;for(let l of o.lines)i(l);return o.lines.length===0&&n.out("No lines."),o.next_cursor!==null&&n.out(`\u2026 more: --cursor ${o.next_cursor}`),0},async procs(s,n){let{fs:a}=await e(s);if(!a.procs)throw new p("this owner has no process list");let r=await a.procs();return n.out(t(s)?JSON.stringify(r):r.text),0}}}function Or(e){let t=/^bytes=(\d*)-(\d*)$/.exec(e.trim());if(!t||t[1]===""&&t[2]==="")throw new p("--range must be bytes=start-end, bytes=start- or bytes=-suffix");return t[1]===""?{suffix:Number(t[2])}:t[2]===""?{start:Number(t[1])}:{start:Number(t[1]),end:Number(t[2])}}var M=Te(vr),q=Te(_r),z=Te($r),Be=Te(Sr);async function Pr(e,t){let s=Ha$1(g(e)),n=[];for(let r of e.positionals)n.push(await k(e,"trial",r));let a=await s.stop(n);if(e.flags.json===true)return t.out(JSON.stringify(a)),0;for(let r of a.stopped)t.out(`stopped ${r.id} (${r.task_name}) ${r.status}`);for(let r of a.stopped_analyses)t.out(`stopped analysis ${r.id} ${r.status}`);for(let r of a.already_terminal)t.out(`already terminal ${r}`);for(let r of a.not_found)t.out(`not found ${r}`);return 0}function jr(e){if(typeof e.estimated_cost_usd=="number")return `$${e.estimated_cost_usd.toFixed(4)}`;let t=e.usage?.spent_usd;return typeof t=="number"&&e.usage?.provisional?`at least $${t.toFixed(4)}`:"-"}var ws=[{key:"id",header:"ID",cell:e=>e.id},{key:"status",header:"STATUS",cell:e=>e.status},{key:"task",header:"TASK",cell:e=>e.task_name},{key:"job",header:"JOB",cell:e=>e.job_id},{key:"trial",header:"TRIAL",cell:e=>e.trial_id},{key:"model",header:"MODEL",cell:e=>e.model_name},{key:"attempts",header:"ATTEMPTS",cell:e=>String(e.attempts??1)},{key:"spent",header:"SPENT",cell:jr},{key:"created",header:"CREATED",cell:e=>e.created_at},{key:"finished",header:"FINISHED",cell:e=>e.finished_at??"-"}],Er=["id","status","task","model","spent","created"];async function Ar(e,t){if(T(e,t,ws))return 0;let s=Ee(e),n=Ta(e),a=e.flags.job!==void 0?await k(e,"job",String(e.flags.job)):void 0,i=await Ia$1(g(e)).list({...x(e),...s!==void 0?{scope:s}:{},...a!==void 0?{job:a}:{},...n!==void 0?{status:n}:{}});return e.flags.json===true?(t.out(JSON.stringify(i)),0):i.items.length===0?(e.flags.quiet!==true&&t.out("No analyses."),0):(A(e,t,i.items,ws,Er,o=>o.id),i.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
43
+ More: evolve analysis list --cursor ${i.nextCursor}`),0)}async function Tr(e,t){let s=Ia$1(g(e)),n=await at(s,await kt(e,s,e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of ha(n))t.out(a);return 0}async function Cr(e,t){let s=Ia$1(g(e)),n=e.flags.json===true,a=e.flags.since,r=await s.transcript((await kt(e,s,e.positionals[0])).id,a!==void 0?{since:a}:void 0);for(let i of r.events)D(t,n,i);for(let i of r.gateway_calls)D(t,n,i);return !n&&r.events.length===0&&t.out("No trace events."),0}var vs=["analysis","trace-parsed",...da$1];async function Nr(e,t){let s=Ia$1(g(e)),n=e.flags.json===true,a=e.flags.stream;if(a!==void 0&&(e.flags["output-dir"]!==void 0||e.flags.overwrite===true))throw new p('"analysis download" takes EITHER --stream OR -o/--overwrite, not both');if((a===void 0||a!=="trace-parsed")&&e.flags.since!==void 0)throw new p("--since pages the parsed events; it applies only to --stream trace-parsed");let r=await kt(e,s,e.positionals[0]),i=r.id;if(a!==void 0){if(!vs.includes(a))throw new p(`--stream must be one of: ${vs.join(", ")}`);if(a==="analysis"){let l=await at(s,r);return t.out(n?JSON.stringify({analysis:l}):JSON.stringify(l,null,2)),0}if(a==="trace-parsed"){let l=e.flags.since,c=await s.transcript(i,l!==void 0?{since:l}:void 0);for(let u of c.events)D(t,n,u);for(let u of c.gateway_calls)D(t,n,u);return !n&&c.events.length===0&&t.out("No trace events."),0}if(a==="agent-home"){let l=await s.artifact(i,a);if(l===null)return t.out(n?JSON.stringify({files:null}):`No ${a} content was stored for this analysis.`),0;if(n)t.out(JSON.stringify({files:l}));else for(let[c,u]of Object.entries(l))t.out(`===== ${c} (${Buffer.byteLength(u,"utf8")} bytes) =====`),t.out(u);return 0}let o=await s.artifact(i,a);return o===null?(t.out(n?JSON.stringify({log:null}):`No ${a} log was stored for this analysis.`),0):(t.out(n?JSON.stringify({log:o}):o),0)}return Bs(e,t,{fetch:o=>s.download(i,{to:o}),outputDir:e.flags["output-dir"]??"analyses",scratchPrefix:"evolve-analysis-download-",enrich:async o=>{let{join:l}=await import('path'),c=await at(s,r);return await rt(l(o,"evolve.json"),va$1(c,await Ae(e))),["evolve.json"]}})}function Rr(e){switch(e.kind){case "git":{let t=e.ref===e.commit?"":` @ ${e.ref}`;return [`source: ${e.git_url??"?"}${t} (commit ${e.commit.slice(0,12)})`,...e.path?[` subfolder: ${e.path}`]:[]]}case "archive":return [`source: uploaded archive (${G(e.digest)})`];case "archive_url":return [`source: ${e.archive_url} (${G(e.digest)})`];case "hub_package":return [`source: hub:${e.hub_package} (${G(e.digest)})`]}}function Lr(e){return e.kind==="git"?e.commit.slice(0,12):G(e.digest)}function Zs(e){let t=w([["name",e.name],["title",e.title??"-"],["description",e.description??"-"],["active version",e.active_version?.version??"-"]]),s=e.selected_version?.source??e.active_version?.source??null;if(s)t.push(...Rr(s));else if(e.upstream){let a=e.upstream,r=a.ref===a.current_commit?"":` @ ${a.ref}`;t.push(`source: ${a.git_url??"?"}${r} (commit ${a.current_commit.slice(0,12)})`),a.path&&t.push(` subfolder: ${a.path}`);}let n=e.active_version?.manifest;if(n&&(t.push(`manifest: ${n.name}${n.version?`@${n.version}`:""}`+(n.task_count!==null?` (${n.task_count} tasks pinned)`:"")),n.authors.length>0&&t.push(` authors: ${n.authors.map(a=>a.email?`${a.name} <${a.email}>`:a.name).join(", ")}`),n.keywords.length>0&&t.push(` keywords: ${n.keywords.join(", ")}`)),e.versions&&e.versions.length>0){t.push("");let a=e.versions.some(o=>o.source!=null),r=e.versions.some(o=>o.n_failed_tasks>0),i=[["VERSION","STATE","TASKS",...r?["FAILED"]:[],"CREATED",...a?["SOURCE"]:[]]];for(let o of e.versions)i.push([o.version,o.state,String(o.task_count),...r?[o.n_failed_tasks>0?String(o.n_failed_tasks):"-"]:[],o.created_at??"-",...a?[o.source?Lr(o.source):"-"]:[]]);t.push(...w(i));}if(e.tasks&&e.tasks.items.length>0){t.push("",`Tasks (version ${e.selected_version?.version??"?"}):`);let a=e.tasks.items.some(l=>(l.gpus??0)>0),r=e.tasks.items.some(l=>(l.notes??[]).length>0),i=[["TASK","AGENT TIMEOUT","VERIFIER TIMEOUT",...a?["GPU"]:[],"PROVIDERS",...r?["NOTES"]:[]]];for(let l of e.tasks.items)i.push([l.task_name,`${l.agent_timeout_sec}s`,`${l.verifier_timeout_sec}s`,...a?[ka(l)??"-"]:[],ya(l.providers),...r?[(l.notes??[]).map(c=>c.code).join(", ")||"-"]:[]]);if(t.push(...w(i)),r){let l=new Map;for(let c of e.tasks.items)for(let u of c.notes??[]){let d=l.get(u.message)??{code:u.code,tasks:[]};d.tasks.push(c.task_name),l.set(u.message,d);}t.push("","Task notes:");for(let[c,u]of l)t.push(` ${u.code} (${u.tasks.length} task${u.tasks.length===1?"":"s"}): ${c}`);}e.tasks.nextCursor&&t.push(`More tasks: evolve dataset show ${e.name} --cursor ${e.tasks.nextCursor}`);let o=new Map;for(let l of e.tasks.items)for(let c of Js){let u=l.providers?.[c];if(u){if(!u.ok)o.has(`${c}:${u.reason}`)||o.set(`${c}:${u.reason}`,`${c}: ${u.reason}`);else if(u.degrades_to&&u.reason){let d=`${c}:degrade:${u.reason}`;o.has(d)||o.set(d,`${c}: runs on ${u.degrades_to} \u2014 ${u.reason}`);}}}if(o.size>0){t.push("","Provider limitations:");for(let l of o.values())t.push(` ${l}`);}}return t.push(...Dr(e)),t}function Dr(e){let t=e.failed_tasks??[],s=e.selected_version??e.active_version??null,n=s?.n_failed_tasks??t.length;if(t.length===0&&n===0)return [];let a=["",`Failed tasks (version ${s?.version??"?"}) \u2014 not runnable in this version:`],r=[];for(let i of t)r.push([` ${i.task_name}`,`${i.failure.code} (${i.failure.step}): ${i.failure.message}`]);return a.push(...w(r)),n>t.length&&a.push(` \u2026 ${n-t.length} more (${n} failed in total)`),a.push(" Fix: re-publish a new version \u2014 versions are immutable."),a}function en(e){let t=[];for(let s of e){if(!s.upstream?.moved)continue;let n=s.active_version?`@${s.active_version.version}`:"",a=s.upstream.latest_commit??s.upstream.ref,r=s.upstream.git_url??"<url>",i=s.upstream.path?` --path ${s.upstream.path}`:"";t.push(`${s.name}${n} \xB7 upstream ${s.upstream.ref} moved \u2014 run: evolve dataset publish --name ${s.name} --version <new-version> --git ${r} --ref ${a}${i}`);}return t}async function Ur(e,t){if(T(e,t,ss))return 0;let n=await Da$1(g(e)).list({...x(e),...e.flags.search!==void 0?{search:String(e.flags.search)}:{}});if(e.flags.json===true)return t.out(JSON.stringify(n)),0;if(n.items.length===0)return e.flags.quiet!==true&&t.out("No datasets."),0;if(A(e,t,n.items,ss,da,a=>a.name),e.flags.quiet!==true)for(let a of en(n.items))t.out(a);return 0}async function Jr(e,t){let n=await Da$1(g(e)).get(e.positionals[0],x(e));if(e.flags.json===true)t.out(JSON.stringify(n));else {for(let a of Zs(n))t.out(a);for(let a of en([n]))t.out(a);}return 0}function it(e){let t=[`Pre-flight (importer ${e.importer_version}): ${e.tasks_total} task${e.tasks_total===1?"":"s"} \u2014 ${e.tasks_ok} ok, ${e.tasks_refused} refused`];e.manifest!==null&&e.manifest.ok===false&&t.push(` dataset.toml REFUSED: ${e.manifest.reason}`);for(let s of e.tasks){if(!s.ok){t.push(` ${s.name} REFUSED: ${s.reason}`);continue}let n=Object.entries(s.providers??{}).filter(([,a])=>a.ok!==true||"degrades_to"in a).map(([a,r])=>r.ok?`${a}: runs via ${r.degrades_to}`:`${a}: ${r.reason}`);n.length>0&&t.push(` ${s.name}: ${n.join(" \xB7 ")}`);for(let a of s.notes??[])t.push(` ${s.name} NOTE ${a.code}: ${a.message}`);}return t.push(`Checked from task.toml alone; the import also checks: ${e.deferred.map(s=>s.name).join(", ")}.`),t}async function Fr(e,t){let n=await Da$1(g(e)).preflight({source:{directory:e.positionals[0]}});if(e.flags.json===true)t.out(JSON.stringify(n));else for(let r of it(n))t.out(r);let a=n.manifest!==null&&n.manifest.ok===false;return n.tasks_refused>0||a?1:0}async function Mr(e,t){let s=e.flags.json===true,n=Da$1(g(e)),a=sa(e);if(a.source.directory!==void 0&&e.flags["skip-preflight"]!==true){let u=null;try{u=await n.preflight({source:{directory:a.source.directory}});}catch(d){if(d instanceof ya$1&&d.status===404)t.err("Pre-flight unavailable on this server \u2014 publishing without it.");else throw d}if(u!==null){let d=u.manifest!==null&&u.manifest.ok===false;if(u.tasks_refused>0||d){if(s)t.out(JSON.stringify({kind:"preflight.refused",preflight:u}));else {for(let f of it(u))t.out(f);t.out(""),t.out("Nothing was uploaded. Fix the refused tasks, or pass --skip-preflight to publish anyway (a refused task then lands FAILED at import).");}return 1}if(s)e.flags.watch===true&&t.out(JSON.stringify({kind:"preflight.ok",preflight:u}));else for(let f of it(u))t.out(f);}}let r=u=>{if(s){e.flags.watch===true&&t.out(JSON.stringify({kind:"import.registered",import_id:u}));return}t.out(`Registered import ${u} \u2014 re-attach anytime with: evolve dataset watch ${u}`);},i=Date.now(),o=-1,l=(u,d)=>{let f=d>0?Math.floor(u/d*10):10;if(!(f<=o)){if(o=f,s){t.out(JSON.stringify({kind:"upload.progress",sent_bytes:u,total_bytes:d,elapsed_sec:(Date.now()-i)/1e3}));return}t.out(`upload ${H(u)}/${H(d)} (${Math.min(f*10,100)}%)`);}},c=await n.publish(a,{onRegistered:r,...s&&e.flags.watch!==true?{}:{onUploadProgress:l}});if(e.flags.watch!==true){if(s)t.out(JSON.stringify(c));else {for(let u of qs(c))t.out(u);t.out(""),t.out(`Follow it with: evolve dataset show ${c.name}`);}return 0}return tn(n,c,t,s,"created")}async function tn(e,t,s,n,a){n?s.out(JSON.stringify({kind:`import.${a}`,datasetImport:t})):s.out(a==="created"?`Publish ${t.id} (${t.name}) ${t.status} \u2014 watching\u2026`:`Import ${t.id} (${t.name}@${t.version}) ${mt(t)} \u2014 watching\u2026`);let r=null,i=null,o=new Set,l=d=>{for(let f of d.failed_tasks??[])o.has(f.task_name)||(o.add(f.task_name),s.out(n?JSON.stringify({kind:"task.failed",task:f}):Kr(f)));},c;try{c=await e.watchImport(t.id,{onStatus:d=>{s.out(n?JSON.stringify({kind:"import.status",datasetImport:d}):va(d));},onProgress:d=>{s.out(n?JSON.stringify({kind:"import.progress",progress:d}):ba(d));},onVersion:(d,f)=>{r=d,i=f,s.out(n?JSON.stringify({kind:"import.version",version:d}):_a(d)),l(f);}});}catch(d){if(d instanceof Aa$1)return n&&s.out(JSON.stringify({error:an(d)})),s.err(`Error: ${d.message}`),s.err(`Follow it with: evolve dataset show ${d.dataset}@${d.version}`),1;throw d}let u=r;if(u!==null&&u.n_failed_tasks>0)try{let d=await e.get(`${c.name}@${c.version}`);i=d,l(d);}catch{}if(n)s.out(JSON.stringify({kind:"import.final",datasetImport:c}));else {s.out("");for(let d of qs(c))s.out(d);if(c.progress!==null)for(let d of wa(c.progress))s.out(d);if(r!==null){for(let d of $a(r,i))s.out(d);for(let d of zr(r,c))s.out(d);}}return c.status==="FAILED"?1:0}async function qr(e,t){let s=e.flags.json===true,n=Da$1(g(e)),a=e.positionals[0],r=null;try{r=await n.getImport(a);}catch(i){if(!(i instanceof ya$1&&i.status===404))throw i}if(r===null){let o=(await n.listImports({dataset:a,limit:50})).items;if(r=o.find(l=>l.status==="QUEUED"||l.status==="RUNNING")??null,r===null){let l=o[0],c=l!==void 0?`its newest import ${l.id} is ${l.status} \u2014 see it with: evolve dataset show ${a}`:"no import id and no dataset of yours carries that name",u=`Nothing to watch for "${a}": ${c}`;return s&&t.out(JSON.stringify({error:{code:"nothing_to_watch",message:u}})),t.err(`Error: ${u}`),1}}try{return await tn(n,r,t,s,"attached")}catch(i){if(i instanceof ya$1&&i.code==="import_not_found"){let o=`Import ${r.id} no longer exists \u2014 its upload was abandoned or refused before the corpus arrived, so the publish never happened. Re-run the publish to start a new one.`;return s&&t.out(JSON.stringify({error:{code:"import_not_found",message:o}})),t.err(`Error: ${o}`),1}throw i}}function zr(e,t){if(e.n_failed_tasks<=0)return [];let s=e.task_count+e.n_failed_tasks;return [`built ${e.task_count} of ${s} tasks \u2014 ${e.n_failed_tasks} failed to build`,`Reasons: evolve dataset show ${t.name}@${t.version}`,"Fix: re-publish a new version \u2014 versions are immutable."]}function Kr(e){return `task ${e.task_name} FAILED \u2014 ${e.failure.code} (${e.failure.step}): ${Z(e.failure.message,140)}`}async function Vr(e,t){let n=await Da$1(g(e)).download(e.positionals[0],{to:e.flags["output-dir"]??process.cwd()});return e.flags.json===true?t.out(JSON.stringify({path:n})):t.out(`Saved ${n}`),0}async function Gr(e,t){let s=Da$1(g(e)),[n,a]=e.positionals,r=await s.activate(n,a);if(e.flags.json===true)t.out(JSON.stringify(r));else for(let i of Zs(r))t.out(i);return 0}function sn(e){let t=[["name",e.name],["id",e.id],["ref",e.ref],["digest",e.digest],["size",H(e.size_bytes)]];return e.description&&t.push(["description",e.description]),t.push(["created",e.created_at]),w(t)}async function Hr(e,t){if(T(e,t,ns))return 0;let n=await Fa$1(g(e)).list(x(e));return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.items.length===0?(e.flags.quiet!==true&&t.out("No uploaded skills."),0):(A(e,t,n.items,ns,fa,a=>a.id),n.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
44
+ More: evolve skill list --cursor ${n.nextCursor}`),0)}async function Wr(e,t){let n=await Fa$1(g(e)).upload(e.positionals[0]);return e.flags.json===true?(t.out(JSON.stringify(n.length===1?n[0]:n)),0):(n.forEach((a,r)=>{r>0&&t.out("");for(let i of sn(a))t.out(i);}),t.out(""),t.out(`Use it with: evolve run --skill name:${n[0].name} (moving pointer) or --skill ${n[0].ref} (this exact content)`),0)}async function Br(e,t){let s=await Fa$1(g(e)).get(await k(e,"skill",e.positionals[0]));if(e.flags.json===true)return t.out(JSON.stringify(s)),0;for(let n of sn(s))t.out(n);return s.skill_md&&(t.out(""),t.out(s.skill_md)),0}async function Yr(e,t){let s=await k(e,"skill",e.positionals[0]);return await Fa$1(g(e)).delete(s),e.flags.json===true?t.out(JSON.stringify({id:s,deleted:true})):t.out(`Deleted skill ${s}`),0}async function Xr(e,t){if(T(e,t,as))return 0;let n=await Ea$1(g(e)).list(x(e));return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.items.length===0?(e.flags.quiet!==true&&t.out("No registered agents."),0):(A(e,t,n.items,as,pa,a=>a.name),0)}async function Qr(e,t){let n=await Ea$1(g(e)).get(e.positionals[0]);if(e.flags.json===true)t.out(JSON.stringify(n));else for(let a of Us(n))t.out(a);return 0}async function Zr(e,t){let n=await Ea$1(g(e)).create(na(e));if(e.flags.json===true)t.out(JSON.stringify(n));else {for(let a of Us(n))t.out(a);t.out(""),t.out(`Use it with: evolve run -d <dataset> -a ${n.name} -m <model>`);}return 0}async function ei(e,t){let s=Ea$1(g(e)),n=e.positionals[0];return await s.delete(n),e.flags.json===true?t.out(JSON.stringify({name:n,deleted:true})):t.out(`Deleted agent ${n}`),0}function ti(e){let t=[["user",e.user_id],["email",e.email??"-"],["key id",e.key.id]];return e.key.label&&t.push(["key label",e.key.label]),t.push(["key created",e.key.created_at]),e.key.last_used_at&&t.push(["key last used",e.key.last_used_at]),w(t)}function wt(e){let t={};return typeof e.flags["api-key"]=="string"&&(t.apiKey=e.flags["api-key"]),typeof e.flags["base-url"]=="string"&&(t.dashboardUrl=e.flags["base-url"]),t}function nn(e){let t=e.usage;return t&&typeof t.spent_usd=="number"?t.provisional?`at least $${t.spent_usd.toFixed(2)}`:`$${t.spent_usd.toFixed(2)}`:R(e.cost)}var _s=[{key:"id",header:"ID",cell:e=>e.id},{key:"tag",header:"TAG",cell:e=>e.tag},{key:"agent",header:"AGENT",cell:e=>e.agent},{key:"model",header:"MODEL",cell:e=>e.model??"-"},{key:"provider",header:"PROVIDER",cell:e=>e.provider},{key:"sandbox",header:"SANDBOX",cell:e=>e.sandboxId??"-"},{key:"state",header:"STATE",cell:e=>e.state},{key:"runtime",header:"RUNTIME",cell:e=>e.runtimeStatus},{key:"cost",header:"COST",cell:nn},{key:"steps",header:"STEPS",cell:e=>String(e.stepCount)},{key:"created",header:"CREATED",cell:e=>e.createdAt},{key:"ended",header:"ENDED",cell:e=>e.endedAt??"-"}],si=["id","tag","agent","model","state","cost","created"];function ni(e){let t=[["id",e.id],["tag",e.tag],["agent",e.agent],["model",e.model??"-"],["effort",e.reasoningEffort??"-"],["provider",e.provider],["sandbox",e.sandboxId??"-"],["state",e.state],["runtime",e.runtimeStatus],["cost",nn(e)]];return e.usage&&t.push(["tokens",`${e.usage.input_tokens??"-"} in / ${e.usage.cached_input_tokens??"-"} cached / `+(e.usage.cache_write_tokens!==null?`${e.usage.cache_write_tokens} written to cache / `:"")+`${e.usage.output_tokens??"-"} out`+(e.usage.provisional?" (provisional)":"")]),t.push(["steps",String(e.stepCount)]),e.toolStats&&Object.keys(e.toolStats).length>0&&t.push(["tools",Object.entries(e.toolStats).map(([s,n])=>`${s} ${n}`).join(", ")]),t.push(["created",e.createdAt]),t.push(["ended",e.endedAt??"-"]),w(t)}async function ai(e,t){if(T(e,t,_s))return 0;let s=e.flags.state===void 0?void 0:String(e.flags.state);if(s!==void 0&&s!=="live"&&s!=="ended")throw new p(`--state must be live or ended; got: ${s}`);let a=await ha$1(wt(e)).list({...x(e),...s!==void 0?{state:s}:{},...e.flags.agent!==void 0?{agent:String(e.flags.agent)}:{},...e.flags["tag-prefix"]!==void 0?{tagPrefix:String(e.flags["tag-prefix"])}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):a.items.length===0?(e.flags.quiet!==true&&t.out("No sessions."),0):(A(e,t,a.items,_s,si,r=>r.id),a.nextCursor&&t.tty===true&&e.flags.quiet!==true&&t.out(`
45
+ More: evolve session list --cursor ${a.nextCursor}`),0)}async function ri(e,t){let s=await ha$1(wt(e)).get(await k(e,"session",e.positionals[0]));if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of ni(s))t.out(n);return 0}async function ii(e,t){let s=await Ka$1(g(e)).status();if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of ti(s))t.out(n);return 0}var $s=[{key:"slug",header:"SLUG",cell:e=>e.slug},{key:"display_name",header:"DISPLAY NAME",cell:e=>e.display_name},{key:"role",header:"ROLE",cell:e=>e.role??"-"},{key:"personal",header:"PERSONAL",cell:e=>e.personal?"yes":"no"},{key:"created",header:"CREATED",cell:e=>e.created_at}],oi=["slug","display_name","role","created"];function li(e,t){let s=t.toLowerCase();return e.filter(n=>n.slug.toLowerCase().includes(s)||n.display_name.toLowerCase().includes(s)||(n.role??"").toLowerCase().includes(s))}async function ui(e,t){if(T(e,t,$s))return 0;let s=await La$1(g(e)).list(),n=e.flags.search!==void 0?li(s,String(e.flags.search)):s;return e.flags.json===true?(t.out(JSON.stringify(n)),0):n.length===0?(e.flags.quiet!==true&&t.out("No organizations found."),0):(A(e,t,n,$s,oi,a=>a.slug),0)}function ci(e){let{quota:t,usage:s}=e,n=s.month_spend_usd===null?"unavailable":R(s.month_spend_usd),a=s.month_spend_as_of===null?"":` (as of ${s.month_spend_as_of})`,r=t.monthly_budget_usd===null?`${n} / no budget${a}`:`${n} / ${R(t.monthly_budget_usd)}${a}`,i=[["slug",e.slug],["display name",e.display_name],["personal",e.personal?"yes":"no"],["role",e.role??"-"],["members",String(e.member_count)],["created",e.created_at],["concurrent trials",`${s.in_flight_trials}/${t.max_concurrent_trials}`],["queued trials",`${s.queued_trials}/${t.max_queued_trials}`],["concurrent imports",`${s.in_flight_imports}/${t.max_concurrent_imports}`],["concurrent analyses",`${s.in_flight_analyses}/${t.max_concurrent_analyses}`],["concurrent sessions",`${s.active_sessions}/${t.max_concurrent_sessions}`],["e2b sandbox ceiling",String(t.max_concurrent_sandboxes_e2b)],["daytona sandbox ceiling",String(t.max_concurrent_sandboxes_daytona)],["modal sandbox ceiling",String(t.max_concurrent_sandboxes_modal)],["month spend",r]];return w(i)}async function di(e,t){let s=await La$1(g(e)).get(e.positionals[0]);if(e.flags.json===true)t.out(JSON.stringify(s));else for(let n of ci(s))t.out(n);return 0}function vt(e){let t={};return typeof e.flags["api-key"]=="string"&&(t.apiKey=e.flags["api-key"]),typeof e.flags["base-url"]=="string"&&(t.dashboardUrl=e.flags["base-url"]),t}function fi(e){let t=e.flags.value;if(typeof t=="string"){if(t.length===0)throw new p("--value must not be empty");return t}if(process.stdin.isTTY)throw new p('no value given: pass --value <value> or pipe the value on stdin (e.g. printf %s "$TOKEN" | evolve secrets set NAME --delivery ...)');let s=readFileSync(0,"utf8"),n=s.endsWith(`\r
45
46
  `)?s.slice(0,-2):s.endsWith(`
46
- `)?s.slice(0,-1):s;if(n.length===0)throw new p("stdin carried no value");return n}async function Xr(e,t){let s=e.positionals[0],n=e.flags.delivery;if(n!=="brokered"&&n!=="direct")throw new p("--delivery is required: 'brokered' or 'direct'");let a=Br(e),o=await I$1(gt(e)).set({name:s,value:a,delivery:n,...typeof e.flags.label=="string"?{label:e.flags.label}:{},...e.flags["allowed-host"]!==void 0?{allowedHosts:e.flags["allowed-host"]}:{},...e.flags["allowed-path-prefix"]!==void 0?{allowedPathPrefixes:e.flags["allowed-path-prefix"]}:{},...e.flags["allowed-method"]!==void 0?{allowedMethods:e.flags["allowed-method"]}:{}});if(e.flags.json===true)return t.out(JSON.stringify(o)),0;let i=o.secret;return t.out(`${o.status==="created"?"Stored":"Updated"} env secret ${i.name} (label ${i.label??"default"}, delivery ${i.delivery??"brokered"})`),0}async function Qr(e,t){if(T(e,t,Qt))return 0;let n=await I$1(gt(e)).list();return e.flags.json===true?(t.out(JSON.stringify({secrets:n})),0):n.length===0?(e.flags.quiet!==true&&t.out("No env secrets stored."),0):(P(e,t,n,Qt,oa,a=>a.label&&a.label!=="default"?`${a.name}:${a.label}`:a.name),0)}async function Zr(e,t){let s=e.positionals[0],a=await I$1(gt(e)).delete({name:s,...typeof e.flags.label=="string"?{label:e.flags.label}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):(t.out(`Deleted env secret ${a.name} (label ${a.label})`),0)}function hs(e,t){e.out(t.endsWith(`
47
- `)?t.slice(0,-1):t);}function eo(e,t){let s=[e.body];if(t)for(let n of ne(e))s.push(`
47
+ `)?s.slice(0,-1):s;if(n.length===0)throw new p("stdin carried no value");return n}async function pi(e,t){let s=e.positionals[0],n=e.flags.delivery;if(n!=="brokered"&&n!=="direct")throw new p("--delivery is required: 'brokered' or 'direct'");let a=fi(e),i=await I$1(vt(e)).set({name:s,value:a,delivery:n,...typeof e.flags.label=="string"?{label:e.flags.label}:{},...e.flags["allowed-host"]!==void 0?{allowedHosts:e.flags["allowed-host"]}:{},...e.flags["allowed-path-prefix"]!==void 0?{allowedPathPrefixes:e.flags["allowed-path-prefix"]}:{},...e.flags["allowed-method"]!==void 0?{allowedMethods:e.flags["allowed-method"]}:{}});if(e.flags.json===true)return t.out(JSON.stringify(i)),0;let o=i.secret;return t.out(`${i.status==="created"?"Stored":"Updated"} env secret ${o.name} (label ${o.label??"default"}, delivery ${o.delivery??"brokered"})`),0}async function gi(e,t){if(T(e,t,rs))return 0;let n=await I$1(vt(e)).list();return e.flags.json===true?(t.out(JSON.stringify({secrets:n})),0):n.length===0?(e.flags.quiet!==true&&t.out("No env secrets stored."),0):(A(e,t,n,rs,ga,a=>a.label&&a.label!=="default"?`${a.name}:${a.label}`:a.name),0)}async function mi(e,t){let s=e.positionals[0],a=await I$1(vt(e)).delete({name:s,...typeof e.flags.label=="string"?{label:e.flags.label}:{}});return e.flags.json===true?(t.out(JSON.stringify(a)),0):(t.out(`Deleted env secret ${a.name} (label ${a.label})`),0)}function Ss(e,t){e.out(t.endsWith(`
48
+ `)?t.slice(0,-1):t);}function hi(e,t){let s=[e.body];if(t)for(let n of oe(e))s.push(`
48
49
  --- ${n.path} ---
49
50
 
50
- ${n.content}`);return s.join("")}function to(e,t){if(e.length<=t)return e;let s=e.slice(0,t-3),n=s.lastIndexOf(" ");return `${(n>0?s.slice(0,n):s).trimEnd()}...`}async function so(e,t){let s=ge(te(ie));if(e.flags.json===true)return t.out(JSON.stringify(s.map(a=>({name:a.name,description:a.description,path:a.dir})))),0;let n=Math.max(...s.map(a=>a.name.length));for(let a of s)t.out(` ${a.name.padEnd(n)} ${to(a.description,70)}`);return 0}async function no(e,t){let s=te(ie),n=e.flags.full===true,a=e.flags.all===true,r=e.positionals;if(a&&r.length>0)throw new p('"skills get" takes either names or --all, not both');if(!a&&r.length===0)throw new p('"skills get" requires <name> [name...] or --all');if(!a&&r.length===2&&!Dt(s,r[1])){if(n)throw new p("--full applies to a skill; a page is one file");let i=se(s,r[0]),l=Ut(i,r[1]);return e.flags.json===true?t.out(JSON.stringify([{name:i.name,page:l.page,path:join(i.dir,l.path),content:l.content}])):hs(t,l.content),0}let o=a?ge(s):r.map(i=>se(s,i));return e.flags.json===true?(t.out(JSON.stringify(o.map(i=>({name:i.name,path:i.dir,content:i.content,...n?{files:ne(i)}:{}})))),0):(hs(t,o.map(i=>eo(i,n)).join(`
51
+ ${n.content}`);return s.join("")}function yi(e,t){if(e.length<=t)return e;let s=e.slice(0,t-3),n=s.lastIndexOf(" ");return `${(n>0?s.slice(0,n):s).trimEnd()}...`}async function ki(e,t){let s=be(re(fe));if(e.flags.json===true)return t.out(JSON.stringify(s.map(a=>({name:a.name,description:a.description,path:a.dir})))),0;let n=Math.max(...s.map(a=>a.name.length));for(let a of s)t.out(` ${a.name.padEnd(n)} ${yi(a.description,70)}`);return 0}async function bi(e,t){let s=re(fe),n=e.flags.full===true,a=e.flags.all===true,r=e.positionals;if(a&&r.length>0)throw new p('"skills get" takes either names or --all, not both');if(!a&&r.length===0)throw new p('"skills get" requires <name> [name...] or --all');if(!a&&r.length===2&&!Kt(s,r[1])){if(n)throw new p("--full applies to a skill; a page is one file");let o=ie(s,r[0]),l=Gt(o,r[1]);return e.flags.json===true?t.out(JSON.stringify([{name:o.name,page:l.page,path:join(o.dir,l.path),content:l.content}])):Ss(t,l.content),0}let i=a?be(s):r.map(o=>ie(s,o));return e.flags.json===true?(t.out(JSON.stringify(i.map(o=>({name:o.name,path:o.dir,content:o.content,...n?{files:oe(o)}:{}})))),0):(Ss(t,i.map(o=>hi(o,n)).join(`
51
52
  ---
52
53
 
53
- `)),0)}async function ao(e,t){let s=te(ie);if(e.positionals.length===0)return t.out(e.flags.json===true?JSON.stringify({path:s}):s),0;let n=se(s,e.positionals[0]);return t.out(e.flags.json===true?JSON.stringify({name:n.name,path:n.dir}):n.dir),0}async function ro(e,t){let s=te(ie),n=typeof e.flags.target=="string"?e.flags.target:void 0,a=typeof e.flags.path=="string"?e.flags.path:void 0;if(n!==void 0&&a!==void 0)throw new p("--target and --path both name the destination; pass one of them");let r;if(a!==void 0)r=[{target:"path",skillsDir:resolve(a)}];else {let i=n??"all";if(i!=="all"&&!ae.includes(i))throw new p(`--target must be one of ${[...ae,"all"].join(", ")}, got "${i}"`);let c=i==="all"?[...ae]:[i],u=i==="all"?c.filter(d=>existsSync(dirname(me(d)))):c;if(i==="all"){for(let d of c.filter(f=>!u.includes(f)))t.err(`skipped ${d}: no ${dirname(me(d))}`);u.length===0&&t.err("no agent home found; name one with --target <agent> or a folder with --path <dir>");}r=u.map(d=>({target:d,skillsDir:me(d)}));}let o=Ft(s,r,e.flags.force===true);if(e.flags.json===true)t.out(JSON.stringify(o));else for(let i of o)t.out(i.path);return 0}function oo(e){if(e.length===0)return {text:Ke(),code:0};let t=tt[e[0]];if(t&&(e.length===1||!H[e[0]]))return {text:zt(e[0],t),code:0};let s=$s[e[0]];if(s)return {text:s,code:0};let n=_s[e[0]]??e[0],a=H[n];if(!a)return {text:Ke(),code:0};if(e.length===1)return {text:Kt(n),code:0};let r=Ge(a,e.slice(1));return r?{text:zt(`${n} ${r.verb}`,r.spec),code:0}:{text:Kt(n),code:0}}var io={run:as,analyze:Fa,check:qa,upload:sr,"skills list":so,"skills get":no,"skills path":ao,"skills install":ro,"job start":as,"job list":ja,"job show":Aa,"job trials":Ea,"job tasks":Pa,"job compare":Ca,"job cancel":Na,"job delete":La,"job stop":Ra,"job resume":Da,"job retry":Ja,"job regrade":Ba,"job download":Xa,"job imports":ar,"job import":rr,"job grep":ur,"trial show":or,"trial trace":lr,"trial download":ir,"trial retry":cr,"trial regrade":dr,"trial stop":fr,"analysis list":mr,"analysis show":hr,"analysis trace":yr,"analysis download":kr,"check list":Va,"check show":Ga,"check trace":Ha,"check download":Wa,"session list":qr,"session show":zr,"dataset list":$r,"dataset show":Sr,"dataset check":vr,"dataset publish":Ir,"dataset watch":xr,"dataset download":Ar,"dataset activate":Er,"skill list":Pr,"skill upload":Tr,"skill show":Cr,"skill delete":Nr,"agent list":Lr,"agent show":Rr,"agent add":Dr,"agent remove":Jr,"auth status":Kr,"auth org list":Hr,"auth org show":Yr,"secrets set":Xr,"secrets list":Qr,"secrets delete":Zr};function Bs(e){return e instanceof xa$1?{code:e.code,message:e.message,...e.param!==void 0?{param:e.param}:{},...e.details!==void 0?{details:e.details}:{},...e.retryAfterSec!==void 0?{retryAfterSec:e.retryAfterSec}:{},...e.requestId!==void 0?{request_id:e.requestId}:{}}:e instanceof za$1?{code:e.code,message:e.message}:{message:e instanceof Error?e.message:String(e)}}async function lo(e,t=Bn){let s;try{s=vn(e);}catch(n){if(n instanceof p)return t.err(`Error: ${n.message}`),t.err('Run "evolve help" for usage.'),2;throw n}if(s.command==="help"){let{text:n,code:a}=oo(s.positionals);return t.out(n),a}if(s.command==="version")return t.out($n()),0;try{let n=io[s.command];return n?await n(s,t):(t.err(`Error: unknown command "${s.command}"`),2)}catch(n){if(n instanceof p)return t.err(`Error: ${n.message}`),t.err(`Run "evolve ${s.command} --help" for usage.`),2;s.flags.json===true&&t.out(JSON.stringify({error:Bs(n)}));let a=uo(n,t);return n instanceof xa$1&&t.err(`Docs: ${yn}`),a}}function uo(e,t){if(e instanceof xa$1&&e.code==="quota_exceeded")return t.err(`Launch quota exceeded: ${e.message}`),2;if(e instanceof xa$1&&e.status===429){let s=e.retryAfterSec!==void 0?`retry in ${e.retryAfterSec}s`:"retry shortly";return t.err(`Error: rate limited by the server \u2014 ${s}.`),1}if(t.err(`Error: ${Xs(e.message)}`),e instanceof xa$1&&e.code==="task_failed_to_build"){let s=e.details??{},n=Array.isArray(s.failed_tasks)?s.failed_tasks:[];for(let a of n){if(!a||typeof a!="object")continue;let r=a.failure??{},o=typeof r.message=="string"&&r.message?`${r.code??"?"} (${r.step??"?"}): ${r.message}`:"build failed (reason not recorded)";t.err(` ${a.task_name}: ${o}`);}t.err(" Fix: re-publish a new version, or drop the failed task(s) from --include-task-name.");}return 1}var co=(()=>{let e=process.argv[1];if(!e)return false;let t=s=>{try{return import.meta.url===pathToFileURL(s).href}catch{return false}};if(t(e))return true;try{return t(realpathSync(e))}catch{return false}})();co&&lo(process.argv.slice(2)).then(e=>{process.exitCode=e;},e=>{process.stderr.write(`Error: ${Xs(e?.message??String(e))}
54
- `),process.exitCode=1;});function Xs(e){return e.replace(/^\w+\(\) requires an API key\. Set EVOLVE_API_KEY or pass \{ apiKey \} in config\./,"An API key is required. Set EVOLVE_API_KEY or pass --api-key <key>.")}export{p as CliUsageError,Ht as TRIAL_COLUMNS,Eo as USAGE,la as analysisDetailLines,Ua as analysisResultLines,Yn as buildAgentInput,Hn as buildJobInput,Wn as buildPublishInput,Or as buildSettleSummaryLines,Fs as checkDetailLines,Js as checkResultLines,Xs as cliMessage,ha as eventLine,jr as failedTaskOutcomeLine,da as importProgressLine,pa as importStatusLine,at as loadPromptFile,rt as loadRubricFile,zn as parseAgentKwargs,vn as parseArgs,Os as parseEnvPairs,Gn as parseInlineSecrets,Vn as parseSecretRefs,Cn as parseYamlConfig,vs as parseYamlConfigLocated,fa as progressSettleLines,lo as runCli,Ts as traceEventLine,ia as trialDetailLines,ga as versionStatusLine};
54
+ `)),0)}async function wi(e,t){let s=re(fe);if(e.positionals.length===0)return t.out(e.flags.json===true?JSON.stringify({path:s}):s),0;let n=ie(s,e.positionals[0]);return t.out(e.flags.json===true?JSON.stringify({name:n.name,path:n.dir}):n.dir),0}async function vi(e,t){let s=re(fe),n=typeof e.flags.target=="string"?e.flags.target:void 0,a=typeof e.flags.path=="string"?e.flags.path:void 0;if(n!==void 0&&a!==void 0)throw new p("--target and --path both name the destination; pass one of them");let r;if(a!==void 0)r=[{target:"path",skillsDir:resolve(a)}];else {let o=n??"all";if(o!=="all"&&!le.includes(o))throw new p(`--target must be one of ${[...le,"all"].join(", ")}, got "${o}"`);let c=o==="all"?[...le]:[o],u=o==="all"?c.filter(d=>existsSync(dirname(we(d)))):c;if(o==="all"){for(let d of c.filter(f=>!u.includes(f)))t.err(`skipped ${d}: no ${dirname(we(d))}`);u.length===0&&t.err("no agent home found; name one with --target <agent> or a folder with --path <dir>");}r=u.map(d=>({target:d,skillsDir:we(d)}));}let i=Ht(s,r,e.flags.force===true);if(e.flags.json===true)t.out(JSON.stringify(i));else for(let o of i)t.out(o.path);return 0}function _i(e){if(e.length===0)return {text:Xe(),code:0};let t=lt[e[0]];if(t&&(e.length===1||!Q[e[0]]))return {text:Yt(e[0],t),code:0};let s=Es[e[0]];if(s)return {text:s,code:0};let n=js[e[0]]??e[0],a=Q[n];if(!a)return {text:Xe(),code:0};if(e.length===1)return {text:Xt(n),code:0};let r=Ze(a,e.slice(1));return r?{text:Yt(`${n} ${r.verb}`,r.spec),code:0}:{text:Xt(n),code:0}}var $i={run:ds,analyze:Wa,check:Xa,upload:dr,"skills list":ki,"skills get":bi,"skills path":wi,"skills install":vi,"job start":ds,"job list":La,"job show":Da,"job trials":Ua,"job tasks":Ja,"job compare":Ma,"job cancel":qa,"job delete":za,"job stop":Ka,"job resume":Va,"job retry":Ga,"job regrade":rr,"job download":ir,"job imports":pr,"job import":gr,"job grep":kr,"trial show":mr,"trial trace":yr,"trial download":hr,"trial retry":br,"trial regrade":wr,"trial stop":Pr,"trial files status":M.status,"trial files list":M.list,"trial files cat":M.cat,"trial files search":M.search,"trial files changes":M.changes,"trial files archive":M.archive,"trial logs":M.logs,"trial procs":M.procs,"analysis list":Ar,"analysis show":Tr,"analysis trace":Cr,"analysis download":Nr,"analysis files status":q.status,"analysis files list":q.list,"analysis files cat":q.cat,"analysis files search":q.search,"analysis files changes":q.changes,"analysis files archive":q.archive,"analysis logs":q.logs,"analysis procs":q.procs,"check list":er,"check show":tr,"check trace":sr,"check download":nr,"check files status":z.status,"check files list":z.list,"check files cat":z.cat,"check files search":z.search,"check files changes":z.changes,"check files archive":z.archive,"check logs":z.logs,"check procs":z.procs,"session list":ai,"session show":ri,"dataset list":Ur,"dataset show":Jr,"dataset check":Fr,"dataset publish":Mr,"dataset watch":qr,"dataset download":Vr,"dataset activate":Gr,"dataset files status":Be.status,"dataset files list":Be.list,"dataset files cat":Be.cat,"skill list":Hr,"skill upload":Wr,"skill show":Br,"skill delete":Yr,"agent list":Xr,"agent show":Qr,"agent add":Zr,"agent remove":ei,"auth status":ii,"auth org list":ui,"auth org show":di,"secrets set":pi,"secrets list":gi,"secrets delete":mi};function an(e){return e instanceof ya$1?{code:e.code,message:e.message,...e.param!==void 0?{param:e.param}:{},...e.details!==void 0?{details:e.details}:{},...e.retryAfterSec!==void 0?{retryAfterSec:e.retryAfterSec}:{},...e.requestId!==void 0?{request_id:e.requestId}:{}}:e instanceof Aa$1?{code:e.code,message:e.message}:{message:e instanceof Error?e.message:String(e)}}async function Si(e,t=aa){let s;try{s=Tn(e);}catch(n){if(n instanceof p)return t.err(`Error: ${n.message}`),t.err('Run "evolve help" for usage.'),2;throw n}if(s.command==="help"){let{text:n,code:a}=_i(s.positionals);return t.out(n),a}if(s.command==="version")return t.out(En()),0;try{let n=$i[s.command];return n?await n(s,t):(t.err(`Error: unknown command "${s.command}"`),2)}catch(n){if(n instanceof p)return t.err(`Error: ${n.message}`),t.err(`Run "evolve ${s.command} --help" for usage.`),2;s.flags.json===true&&t.out(JSON.stringify({error:an(n)}));let a=xi(n,t);return n instanceof ya$1&&t.err(`Docs: ${xn}`),a}}function xi(e,t){if(e instanceof ya$1&&e.code==="quota_exceeded")return t.err(`Launch quota exceeded: ${e.message}`),2;if(e instanceof ya$1&&e.status===429){let s=e.retryAfterSec!==void 0?`retry in ${e.retryAfterSec}s`:"retry shortly";return t.err(`Error: rate limited by the server \u2014 ${s}.`),1}if(t.err(`Error: ${rn(e.message)}`),e instanceof ya$1&&e.code==="task_failed_to_build"){let s=e.details??{},n=Array.isArray(s.failed_tasks)?s.failed_tasks:[];for(let a of n){if(!a||typeof a!="object")continue;let r=a.failure??{},i=typeof r.message=="string"&&r.message?`${r.code??"?"} (${r.step??"?"}): ${r.message}`:"build failed (reason not recorded)";t.err(` ${a.task_name}: ${i}`);}t.err(" Fix: re-publish a new version, or drop the failed task(s) from --include-task-name.");}return 1}var Ii=(()=>{let e=process.argv[1];if(!e)return false;let t=s=>{try{return import.meta.url===pathToFileURL(s).href}catch{return false}};if(t(e))return true;try{return t(realpathSync(e))}catch{return false}})();Ii&&Si(process.argv.slice(2)).then(e=>{process.exitCode=e;},e=>{process.stderr.write(`Error: ${rn(e?.message??String(e))}
55
+ `),process.exitCode=1;});function rn(e){return e.replace(/^\w+\(\) requires an API key\. Set EVOLVE_API_KEY or pass \{ apiKey \} in config\./,"An API key is required. Set EVOLVE_API_KEY or pass --api-key <key>.")}export{p as CliUsageError,es as TRIAL_COLUMNS,Vi as USAGE,ha as analysisDetailLines,Ha as analysisResultLines,na as buildAgentInput,ta as buildJobInput,sa as buildPublishInput,zr as buildSettleSummaryLines,Ws as checkDetailLines,Gs as checkResultLines,rn as cliMessage,Sa as eventLine,Kr as failedTaskOutcomeLine,ba as importProgressLine,va as importStatusLine,dt as loadPromptFile,ft as loadRubricFile,Xn as parseAgentKwargs,Tn as parseArgs,Rs as parseEnvPairs,ea as parseInlineSecrets,Zn as parseSecretRefs,Mn as parseYamlConfig,Ts as parseYamlConfigLocated,wa as progressSettleLines,Si as runCli,Fs as traceEventLine,ma as trialDetailLines,_a as versionStatusLine};