@skyramp/testbot-core 0.0.0-pr597.130 → 0.0.0-pr597.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
package/dist/VERSION.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.0.0-pr597.
|
|
1
|
+
{"version":"0.0.0-pr597.132","commit":"16e36a2c8c13674c1d30f8c1df0b67b67e6ea7d5"}
|
package/dist/main.js
CHANGED
|
@@ -563,7 +563,7 @@ ${s}`}var nO=require("child_process");var Ax=$(require("fs")),sd=$(require("path
|
|
|
563
563
|
`)}function Ygr(t,e,r){let n=r.map(i=>i.details??"").join(`
|
|
564
564
|
`),s=[];return/over the 400 cap/.test(n)&&s.push("The length caps are the ONLY thing wrong with those findings \u2014 keep each one, keep its id, and trim the named field. Do not drop a finding to get under a cap."),/changed file|changedFiles/.test(n)&&s.push('diff.changedFiles must be paths git reports. A glob is accepted for a run of near-identical files (`dir/<star>/x.json`), but it must match them and any "(N files)" count must be right \u2014 so list them plainly if you are unsure.'),/is not in requirements\[\]/.test(n)&&s.push("Every satisfies/conflictsWith id must be one you declared in requirements[] \u2014 check the spelling, don't invent one."),/nothing satisfies or conflictsWith it/.test(n)&&s.push("Every requirements[] entry needs a link: add its id to a behavior's satisfies when the diff implements it correctly, or to a finding's conflictsWith when the diff doesn't (or implements something else)."),s.length?s.join(`
|
|
565
565
|
`):void 0}var Yut=wn({name:"analyze",requires:["preflight"],model:"opus",timeoutMinutes:20,validateInput:qgr,prepare:Wut,buildPrompt:Wgr,allowedTools:["Read","Grep","Glob","Bash(git diff:*)","Bash(git log:*)","Bash(git show:*)","Bash(git blame:*)","Bash(git status:*)"],selfVerification:['Every finding is behavior a test could catch, and one this change causes \u2014 a pre-existing defect is "latent".',"No two behaviors state the same obligation: if ONE test would pin both, they are one entry. Spend the room on a surface nothing describes yet.","You swept every changed file, not only the biggest one \u2014 a file with a single behavior beside one with a dozen is a sweep that stopped early.","Your final message is one JSON object matching the schema."],buildReadDirs:t=>(t.inputs.relatedRepos??[]).map(e=>e.path),exitGates:[Dut,Out],retryHint:Ygr,adversarialReview:Qut,onPassed:(t,e)=>({...Mut(t,e),diff:Qge}),salvage:(t,e)=>jut(t,e,{diff:Qge})});var Zdt=$(require("fs")),Ex=$(require("path")),ept=require("child_process");var sO=["browser_assert","browser_assert_api_request","browser_assert_hidden","browser_assert_table_cell","browser_blueprint","browser_click","browser_drag","browser_evaluate","browser_file_upload","browser_gojs_add_node","browser_gojs_link","browser_hover","browser_mouse_action","browser_navigate","browser_navigate_back","browser_press_key","browser_select_option","browser_snapshot","browser_tabs","browser_take_screenshot","browser_type","browser_visual_snapshot","browser_wait_for"],Jgr=[...sO,"skyramp_export_zip","skyramp_actions","skyramp_analyze_changes","skyramp_analyze_test_health","skyramp_batch_mock_generation","skyramp_batch_scenario_test_generation","skyramp_contract_test_generation","skyramp_e2e_test_generation","skyramp_enhance_assertions","skyramp_enrich_test_with_mocks","skyramp_execute_test","skyramp_fix_errors","skyramp_fuzz_test_generation","skyramp_generate_enriched_integration_test","skyramp_init_scan","skyramp_init_workspace","skyramp_integration_test_generation","skyramp_load_test_generation","skyramp_login","skyramp_logout","skyramp_mock_generation","skyramp_modularization","skyramp_one_click_tool","skyramp_preflight_mock_check","skyramp_query_proxy_mocks","skyramp_recommend_tests","skyramp_register_test_plan","skyramp_reuse_code","skyramp_run_existing_tests","skyramp_setup_local_dev_worker","skyramp_smoke_test_generation","skyramp_start_trace_collection","skyramp_stop_trace_collection","skyramp_submit_report","skyramp_ui_test_generation"],Lge=["skyramp_init_workspace","skyramp_contract_test_generation","skyramp_integration_test_generation","skyramp_mock_generation","skyramp_fix_errors"],Uge=["skyramp_init_workspace","skyramp_ui_test_generation","skyramp_mock_generation","skyramp_fix_errors","skyramp_start_trace_collection","skyramp_stop_trace_collection","skyramp_export_zip",...sO],Fge=["skyramp_reuse_code","skyramp_modularization","skyramp_enhance_assertions","skyramp_fix_errors","skyramp_execute_test","skyramp_run_existing_tests"],$ge=["skyramp_init_scan","skyramp_init_workspace"],zV=["Bash(ls:*)","Bash(cat:*)","Bash(head:*)","Bash(tail:*)","Bash(wc:*)","Bash(find:*)","Bash(grep:*)","Bash(rg:*)","Bash(diff:*)","Bash(sort:*)","Bash(env:*)","Bash(echo:*)","Bash(pwd:*)","Bash(which:*)","Bash(cp:*)","Bash(curl:*)","Bash(jq:*)","Bash(true:*)"],Kgr=t=>`mcp__${Iv}__${t}`;function Nm(t){let e=new Set(t);return Jgr.filter(r=>!e.has(r)).map(Kgr).sort()}var iO=$(require("fs")),id=$(require("path")),Vv=id.join(".skyramp","sut"),Jut=id.join(".skyramp","workspace.yml");function Xgr(t){return t.startsWith(`${Vv}${id.sep}`)||t.startsWith(".skyramp/sut/")||t===Jut||t===".skyramp/workspace.yml"||/(^|\/)(docker-compose|compose)[^/]*\.ya?ml$/.test(t)||/(^|\/)Dockerfile[^/]*$/.test(t)||/^\.github\/workflows\//.test(t)}function Ja(t,e,r={}){let n=e.split(/[\\/]+/).filter(Boolean),s=t;for(let[i,o]of n.entries()){s=id.join(s,o);let a=iO.lstatSync(s,{throwIfNoEntry:!1}),c=i===n.length-1;if(!a||a.isSymbolicLink()||(c?r.directory?!a.isDirectory():!a.isFile():!a.isDirectory()))return}return n.length?s:void 0}function Jc(t,e=[]){let r=p=>Ja(t,p),n=r(id.join(Vv,"setup.sh")),s=r(id.join(Vv,"teardown.sh")),i=r(id.join(Vv,"get-auth-token.sh")),o=r(Jut),a,c=r(id.join(Vv,"health.json"));if(c)try{let p=JSON.parse(iO.readFileSync(c,"utf-8"));p&&(p.url||p.command)&&(a=p)}catch{}let l,u=r(id.join(Vv,"deploy-budget.json"));if(u)try{let p=JSON.parse(iO.readFileSync(u,"utf-8"));typeof p?.minutes=="number"&&Number.isFinite(p.minutes)&&p.minutes>0&&(l=p.minutes)}catch{}let d=e.filter(Xgr);return{setupScript:n,teardownScript:s,authTokenScript:i,workspaceFile:o,healthHint:a,budgetMinutes:l,present:!!(n||o),staleFiles:d,stale:d.length>0}}var Zgr=50,eAr=50,tAr=4096,rAr=8e3,nAr=2048,qge=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f]/,sAr=/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[A-Za-z0-9._/ -]{1,255}$/,iAr=/^\.github\/workflows\/[A-Za-z0-9._-]+\.ya?ml$/,oAr=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Xut=(i=>(i.Command="command",i.ComposeFile="compose_file",i.DeploymentWorkflow="deployment_workflow",i.Url="url",i.Guidance="guidance",i))(Xut||{}),aAr={command:"optional",compose_file:"required",deployment_workflow:"required",url:"none",guidance:"none"},Kut=t=>y.string().max(t).refine(e=>e.trim().length>0&&!qge.test(e),"must be non-blank text with no control characters other than tab, LF and CR");function cAr(t){let e;try{e=new URL(t)}catch{return"invalid URL"}if(e.protocol!=="https:"&&e.protocol!=="http:")return"only http and https URLs";if(e.username||e.password)return"a URL cannot carry a login"}var lAr={command:Kut(tAr),compose_file:y.string().regex(sAr,"must be a relative path inside the repository"),deployment_workflow:y.string().regex(iAr,"must be a .github/workflows/*.yml path"),url:y.string().max(nAr).superRefine((t,e)=>{let r=cAr(t);r&&e.addIssue({code:y.ZodIssueCode.custom,message:r})}),guidance:Kut(rAr)},uAr=y.object({kind:y.nativeEnum(Xut),value:y.string(),repository:ey.nullable()}).strict().superRefine((t,e)=>{let r=aAr[t.kind];r==="required"&&!t.repository&&e.addIssue({code:y.ZodIssueCode.custom,path:["repository"],message:"a file belongs to a repository"}),r==="none"&&t.repository&&e.addIssue({code:y.ZodIssueCode.custom,path:["repository"],message:`a ${t.kind} names no repository`});let n=lAr[t.kind].safeParse(t.value);if(!n.success)for(let s of n.error.issues)e.addIssue({code:y.ZodIssueCode.custom,path:["value"],message:s.message})}),dAr=y.object({name:y.string().regex(oAr,"must be a GitHub Actions secret name (A-Z, 0-9, _; not GITHUB_ or SKYRAMP_RUNNER_)"),purpose:y.nativeEnum(zG),required:y.boolean()}).strict(),pAr=y.object({knowledge:y.array(uAr).max(Zgr),credentials:y.array(dAr).max(eAr)}).strict().superRefine((t,e)=>{let r=new Set;t.credentials.forEach((n,s)=>{r.has(n.name)&&e.addIssue({code:y.ZodIssueCode.custom,path:["credentials",s,"name"],message:"named twice"}),r.add(n.name)})});function mAr(t){return t.map(e=>`$${e.path.map(r=>typeof r=="number"?`[${r}]`:`.${r}`).join("")}: ${e.message}`).join("; ")}function Hge(t,e="SUT environment"){let r=pAr.safeParse(t);if(!r.success)throw new Error(`${e} is not valid SUT / Environment settings \u2014 ${mAr(r.error.issues)}`);return r.data}function Zut(t,e="SUT environment"){if(!t.trim())return;let r;try{r=JSON.parse(t)}catch(n){throw new Error(`${e} is not JSON: ${n instanceof Error?n.message:String(n)}`)}return Hge(r,e)}function GV(t,e=process.env){return(t?.credentials??[]).map(r=>e[r.name]).filter(r=>!!r?.trim())}var fAr={command:"command",compose_file:"compose file",deployment_workflow:"deployment workflow",url:"URL",guidance:"guidance"},hAr={model_provider:"model provider",sut_access:"SUT access",skyramp:"Skyramp",other:"other"};function edt(t,e){let r=t.knowledge.map(n=>{let s=n.repository,i=s?` in ${e(s)??`the Target repository with ${s.provider} id ${s.providerRepositoryId}`}`:"";return`- ${fAr[n.kind]}${i}: ${n.value.trim().split(/\r?\n/).join(`
|
|
566
|
-
`)}`});if(t.credentials.length>0){let n=t.credentials.map(s=>`${s.name} (${hAr[s.purpose]}${s.required?"":", optional"})`);r.push(`- Secrets the workflow provides as environment variables: ${n.join(", ")} \u2014 the recipe reads each by exactly that variable name.`)}return r}var Wv=$(require("fs")),VV=$(require("path"));function zge(t,e){let{value:r,error:n}=Yr(t);if(n)return{errors:[n]};let s=e&&!e.testEnvironment?gAr(r,e):r,i=ev(s)&&s.schemaVersion===void 0?{schemaVersion:1,...s}:s,{value:o,errors:a}=tv(C_,$me,i);return o?{onboard:o,errors:[]}:{errors:a}}function gAr(t,e){if(!ev(t))return t;let{environment:r,...n}=t,s=[...e.repositorySlug?[{slug:e.repositorySlug,path:e.repositoryPath}]:[],...(e.relatedRepos??[]).map(a=>({slug:a.slug,path:a.path}))],i=a=>typeof a=="string"?s.find(c=>Ja(c.path,a))?.slug:void 0,o=Array.isArray(n.components)?n.components.map(a=>{if(!ev(a))return a;let{deployed:c,...l}=a;if(l.repository!==yn)return l;let u=ev(l.from)?l.from.file:void 0,d=i(u)??s[0]?.slug;return d?{...l,repository:d}:l}):n.components;return{...n,components:o}}var jV=".skyramp/sut/health.json",AAr={[jV]:`${jV} (with a url or command)`,".skyramp/workspace.yml":".skyramp/workspace.yml (create it with skyramp_init_scan and skyramp_init_workspace)"};function tdt(){return{name:"onboard-recipe",verify(t,e){let{onboard:r,errors:n}=zge(e.stdout,t.inputs);if(!r)return Re(this.name,n,{fatal:!0});let s=r.environment!==void 0;if(r.status==="blocked")return{name:this.name,passed:!0};let i=t.inputs.repositoryPath,o=Jc(i),a=s?QR.filter(u=>Ja(i,u)):[];if(a.length>0)return Re(this.name,[`an answer with "environment" tests a deployment where it runs and never starts or stops it: delete ${a.join(" and ")}, keep the health check, and answer "ready" again`]);let l=(s?Jme:Yme).filter(u=>!Ja(i,u)).map(u=>AAr[u]??u);return Ja(i,jV)&&!o.healthHint&&l.push(`${jV} (with a url or command)`),o.present&&l.length===0?{name:this.name,passed:!0}:Re(this.name,[`status is "ready" but the recipe deploy replays is incomplete in ${t.inputs.repositoryPath} \u2014 missing (each must be a regular file, not a symlink): ${l.join(", ")}. Write the missing files as the skill specifies and answer "ready" again, or answer "blocked" with the blocker that stopped you.`])}}}function rdt(t,e,r=process.env){let n=[...t.components.flatMap(s=>s.credentials??[]),...t.environment?.credentials??[]];return[...new Set(n)].filter(s=>e.includes(s)&&!r[s])}function ndt(t,e){let r=t.components.filter(s=>s.credentials?.some(i=>e.includes(i))).map(s=>s.name),n=e.join(", ");return{component:(r.length>0?r:t.components.map(s=>s.name)).join(", ")||"SUT",problem:`${n} ${e.length===1?"has":"have"} no value in this setup`,evidence:`The workflow supplies ${e.length===1?"it":"each"} from a GitHub Actions secret, which is missing or empty.`,fix:`Set that secret in the workflow host's repository, or choose the secret that supplies ${e.length===1?"it":"each"} under Credentials, then run setup again.`}}function sdt(){return{name:"deployed-revisions",async verify(t,e,r,n){let s={name:this.name,passed:!0},i=t.checkDeployedRevisions;if(!i)return s;let{onboard:o}=zge(e.stdout,t.inputs);if(!o?.environment||o.status==="blocked")return s;let a=Qw(oO(t.inputs.repositoryPath).recipeFiles);if(!a)return s;let c=o.components.map(({name:d,repository:p})=>({name:d,repository:p})),{blockers:l}=await i(a.content,c,o.environment.credentials);if(l.length===0)return s;let u=l.map(d=>`${d.component}: ${d.problem} (${d.evidence})`).join("; ");return n?.retryLeft?Re(this.name,[`Testbot ran ${$a} twice, with GH_TOKEN, and it failed the check the setup's plan must pass: ${u}. Your session has no GH_TOKEN, so the part that reads GitHub ran in full only there. Fix the script so each component a repository builds gets the full commit it runs, the same on each run, from its own repository, then answer "ready" again, or answer "blocked" with the blocker that stops you.`]):{...s,details:`${$a} still fails Testbot's check, so the plan is saved blocked: ${u}`}}}}function yAr(t){try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(t)}catch{return}}function oO(t){let e=[],r=o=>{let a;try{a=Wv.readdirSync(VV.join(t,o),{withFileTypes:!0})}catch{return}for(let c of a.sort((l,u)=>l.name.localeCompare(u.name))){let l=VV.posix.join(o,c.name);c.isDirectory()&&!c.name.startsWith(".")?r(l):c.isFile()&&e.push(l)}};Ja(t,".skyramp/sut",{directory:!0})&&r(".skyramp/sut"),Ja(t,".skyramp/workspace.yml")&&e.push(".skyramp/workspace.yml");let n=[],s=[],i=0;for(let o of e){let a=Ja(t,o);if(!a)continue;let l=Wv.statSync(a).size;if(l>Ow){s.push({path:o,reason:`larger than ${Ow} bytes`});continue}if(i+l>Mw){s.push({path:o,reason:`recipe text over ${Mw} bytes in total`});continue}let u=yAr(Wv.readFileSync(a));if(u===void 0||BG.test(u)){s.push({path:o,reason:"not text"});continue}n.push({path:o,content:u}),i+=l}return{recipeFiles:n,recipeFilesOmitted:s}}function idt(t,e){let{onboard:r,errors:n}=zge(e.stdout,t.inputs),s=r&&{...r,...oO(t.inputs.repositoryPath)};return tr(t,"onboard",Xr(s,t.secretValues??[]),n)}function WV(t){if(t.state.stages.onboard?.status==="passed")return ae(t,"onboard.json")}var ws=$(require("fs")),km=$(require("path"));var mdt=require("child_process"),fdt=require("crypto"),po=$(require("fs")),od=$(require("path"));var odt=$(require("fs")),by=$(require("path"));var Gge={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"},adt=t=>Gge[t].toLowerCase(),ga=t=>new Map((t??[]).flatMap(e=>e.file?[[qa(e.key),e.file.name]]:[])),cdt=10*1024*1024,yx=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ldt=(t,e)=>by.join(by.dirname(t),`${by.basename(t,by.extname(t))}${e}`),bx=t=>ldt(t,".extracted.txt");function jge(t){try{return/\S/.test(odt.readFileSync(bx(t),"utf-8"))}catch{return!1}}var Vge=t=>ldt(t,".quotes.txt");function udt(t){return yx(t.file)?bx(t.path):t.file?.mediaType==="application/pdf"?Vge(t.path):t.path}function YV(t){return t.map(e=>e.state!=="read"||!yx(e.file)||jge(e.path)?e:{...YA(e),file:e.file,state:"not_read",reason:"cannot_open"})}var bAr=10*6e4;function hdt(t,e){return t.getTime()-e.getTime()-bAr}var ddt="This attempt revoked its scoped GitHub credentials; it mints no more.",EAr=10*6e4,wAr=3e4,xAr=3,uo=class extends Error{constructor(r,n,s){super(r);this.status=n;this.code=s}status;code},Yv=class extends Error{};function Jge(t){let e;try{e=new URL(t)}catch{throw new Error(`skyrampAppOrigin "${t}" is not a URL`)}if(e.protocol!=="https:"||e.origin!==t.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${t}"`);return e.origin}function SAr(t,e){if(!qR.test(t))throw new Error(`The ${e} "${t}" is not a uuid`);return t}function Kge(t,e){return`${t.replace(/\/+$/,"")}/runs/${e}`}function gdt(t,e,r){throw e<500&&e!==429?new uo(t,e,r):new Yv(t)}async function Adt(t,e,r,n){let s=Jge(t.origin),i;for(let o=1;o<=xAr;o+=1){o>1&&await new Promise(a=>setTimeout(a,(t.retryDelayMs??2e3)*(o-1)));try{let a=await t.idToken(s),c=await(t.fetch??fetch)(new URL(e,s).toString(),{...r(a),redirect:"error",signal:AbortSignal.timeout(wAr)}).catch(l=>{throw new Yv(l instanceof Error?l.message:String(l),{cause:l})});return await n(c)}catch(a){if(a instanceof uo)throw a;i=a}}throw i}function ydt(t,e,r,n){return Adt(t,r,i=>({method:e,headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"application/json"},body:e==="GET"?void 0:JSON.stringify(n)}),async i=>{let o=await i.json().catch(()=>({}));if(i.ok)return o.data;let a=o.error?.fields,c=typeof a?.path=="string"&&typeof a.reason=="string"?` at ${a.path}: ${a.reason}`:"",l=`The Skyramp app refused ${e} ${r}: ${i.status} ${o.error?.code??"no error code"}${c}`;return gdt(l,i.status,o.error?.code)})}function CAr(t,e,r){return Adt(t,e,s=>({method:"GET",headers:{Authorization:`Bearer ${s}`,Accept:"application/octet-stream"}}),async s=>{if(!s.ok)return gdt(`The Skyramp app refused GET ${e}: ${s.status}`,s.status);let i=Buffer.from(await s.arrayBuffer());if(i.length>r)throw new uo(`The Skyramp app answered GET ${e} with more than ${r} bytes`,s.status);return i})}var Wge=class{constructor(e,r,n,s,i,o,a,c,l){this.attemptId=e;this.attemptNumber=r;this.deadlineAt=n;this.manifest=s;this.deps=i;this.license=o;this.requestedBy=a;this.writeAllowed=c;this.claudeCodeVersion=l}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;budgetMs(e){return hdt(this.deadlineAt,e)}get skyrampRunUrl(){return Kge(Jge(this.deps.origin),this.manifest.runId)}send(e,r,n){return ydt(this.deps,e,r,n)}readBytes(e,r){return CAr(this.deps,e,r)}issuedTokens=[];closure;modelKey;credentials;revocation;async token(){if(this.revocation)throw new Error(ddt);let e=(this.deps.now??(()=>new Date))().getTime(),r=this.credentials,n=r&&await r.catch(()=>{});if(this.credentials!==r)return(await this.credentials).token;if(n&&n.expiresAt-e>=EAr)return n.token;if(this.revocation)throw new Error(ddt);let s=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,{schemaVersion:1}).then(i=>{let o={...i,token:i.token??this.jobToken()};this.issuedTokens.push(o.token),this.deps.mask?.(o.token),!n&&o.anthropicApiKey&&(this.modelKey=o.anthropicApiKey,this.deps.mask?.(o.anthropicApiKey));let a=n?"Renewed":"Received";return i.token&&this.deps.log?.(`${a} scoped GitHub credentials; they expire at ${o.expiresAt}.`),{token:o.token,expiresAt:i.token?new Date(o.expiresAt).getTime():Number.POSITIVE_INFINITY}},i=>{if(!(i instanceof uo)||i.code!=="CREDENTIALS_UNAVAILABLE")throw i;let o=l=>[...new Set(l.map(u=>u.namespace))].join(", "),a=this.manifest.sources.map(l=>l.repository);if(new Set(a.map(l=>l.providerAccountId)).size>1)throw new uo(`${i.message}. The run's repositories are on more than one GitHub account (${o(a)}), which Skyramp does not support yet.`,i.status,i.code);let c=o([...a,this.manifest.execution.repository]);throw new uo(`${i.message}. Check the Skyramp GitHub App installation on ${c}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,i.status,i.code)});return this.credentials=s,(await s).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(e){return e.fetch??this.deps.fetch??fetch}revokeTokens(e={}){let r=e.host??Zr();return this.revocation??=r.revokeToken?this.revokeIssued(n=>r.revokeToken(n,this.sourceFetch(e))):Promise.resolve([]),this.revocation}async revokeIssued(e){let r=[...this.issuedTokens],n=Promise.all(r.map(o=>this.revokeOne(o,e)));await this.credentials?.catch(()=>{});let s=this.issuedTokens.filter(o=>!r.includes(o));return[...await n,...await Promise.all(s.map(o=>this.revokeOne(o,e)))].filter(o=>o!==void 0)}async revokeOne(e,r){try{await r(e);return}catch(n){return`token ${this.issuedTokens.indexOf(e)+1} of ${this.issuedTokens.length}: ${n instanceof Error?n.message:String(n)}`}}};async function bdt(t,e,r){SAr(t,"run id"),Jge(r.origin);let n=Pst(t,e),s=Bst(await ydt(r,"POST",`/api/v1/runner/runs/${t}/attempts`,n));if(s.manifest.runId!==t)throw new Error(`The app answered the handshake of run ${t} with the manifest of another run (${s.manifest.runId})`);let i=s.manifest.sources.find(a=>a.repository.provider!==n.execution.provider);if(i)throw new Error(`The manifest of run ${t} names ${i.repository.namespace}/${i.repository.name} on ${i.repository.provider}, but this job runs on ${n.execution.provider}`);s.runToken&&r.mask?.(s.runToken);let o=s.runToken?{entitlements:s.entitlements??[],runToken:s.runToken}:void 0;return new Wge(s.attempt.id,s.attempt.number,new Date(s.attempt.deadlineAt),s.manifest,r,o,s.requestedBy??void 0,s.writeAllowed,s.claudeCodeVersion??void 0)}var IAr=6e4;async function Edt(t){return vst.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/heartbeat`,{schemaVersion:1}))}async function wdt(t,e=()=>new Date){if(t.closure)return t.closure;let r=await Edt(t).then(n=>bfe(n,e())).catch(()=>null);return r&&(t.closure=r),r}function xdt(t,e,r={}){let n=!1,s,i=async()=>{try{let a=bfe(await Edt(t),(r.now??(()=>new Date))());a&&!n&&(n=!0,t.closure=a,e(a))}catch(a){a instanceof uo&&(n=!0)}n||o(r.intervalMs??IAr)},o=a=>{s=setTimeout(()=>{i()},a),s.unref?.()};return o(0),{stop(){n=!0,clearTimeout(s)}}}var RAr=10*6e4,vAr=(t,e,r)=>(0,mdt.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","pipe"],env:r??process.env,timeout:RAr}).trim(),TAr=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];async function Sdt(t,e){let r=e.git??vAr,n=e.host??Zr(),s=e.cloneUrl??(c=>n.cloneUrl(c)),{sources:i}=t.manifest;for(let c of i){if(TAr.includes(c.reason)&&!c.change?.base)throw new Error(`${c.repository.namespace}/${c.repository.name} was selected as ${c.reason}, but its change names no base revision to compare it with`);if(c.change?.kind==="pull_request"&&!c.change.base)throw new Error(`${c.repository.namespace}/${c.repository.name} pull request ${c.change.number} names no base revision to compare it with`);n.checkSourceName(c.repository)}if(po.existsSync(e.workspace)&&po.lstatSync(e.workspace).isSymbolicLink())throw new Error(`The sources workspace ${e.workspace} is a symlink; refusing to clear it`);po.rmSync(e.workspace,{recursive:!0,force:!0});let o=new Map((t.manifest.baseline.sources??[]).map(c=>[B_(c.repository),c.revision])),a=[];for(let c of i){let{namespace:l,name:u}=c.repository,d=od.join(e.workspace,l,u);po.mkdirSync(d,{recursive:!0});let p={...process.env,GIT_TERMINAL_PROMPT:"0",...n.gitAuthEnv(await t.token())};r(d,["init","-q"]),r(d,["remote","add","origin",s(c.repository)]);let m=c.change?.base??c.compareWith,f=o.get(B_(c.repository)),h=m?.revision??(f!==c.revision?f:void 0);r(d,["fetch","-q","--no-tags","origin",c.revision,...h?[h]:[]],p);let b=m??(c.ref?{ref:c.ref,revision:f??c.revision}:null);b&&(r(d,["update-ref",`refs/remotes/origin/${b.ref}`,b.revision]),r(d,["symbolic-ref","refs/remotes/origin/HEAD",`refs/remotes/origin/${b.ref}`])),c.ref?r(d,["checkout","-q","-B",c.ref,c.revision]):r(d,["checkout","-q","--detach",c.revision]),a.push({repository:c.repository,revision:r(d,["rev-parse","HEAD"]),path:d,slug:`${l}/${u}`})}return a}async function Cdt(t,e={}){let r=e.host??Zr(),n={token:()=>t.token(),fetch:t.sourceFetch(e)},s=[];for(let i of t.manifest.sources){if(i.change?.kind!=="pull_request")continue;let{namespace:o,name:a}=i.repository,c=`${o}/${a}`,l=i.change.number;try{s.push({repository:c,number:l,...await r.pullRequest(i.repository,l,n)})}catch(u){let d=u instanceof Error?u.message:String(u);s.push({repository:c,number:l,note:`could not be read: ${d}`})}}return s}async function Idt(t,e,r,n={}){return(n.host??Zr()).commitLookup(e,r,{token:()=>t.token(),fetch:t.sourceFetch(n)})}function Rdt(t,e){let r=t.sources.find(s=>s.reason==="TRIGGER"&&s.change?.kind==="pull_request"),n=r&&e.find(s=>s.repository.providerRepositoryId===r.repository.providerRepositoryId);return n&&r.change?{repository:n.slug,path:n.path,number:Number(r.change.number)}:void 0}var NAr=[".skyramp/sut/setup.sh",".skyramp/workspace.yml"];function vdt(t){let e=t.find(r=>NAr.some(n=>po.existsSync(od.join(r.path,n))))??t[0];return{repositoryPath:e.path,repositorySlug:e.slug,relatedRepos:t.filter(r=>r!==e).map(r=>({slug:r.slug,path:r.path,writable:!0}))}}var kAr=y.object({tests:y.object({placements:y.array(y.unknown()).optional()}).passthrough().optional()}).passthrough(),PAr=y.object({repository:ife,testType:y.nativeEnum(Yw),directory:y.string()}).passthrough();function Tdt(t,e){let r=kAr.safeParse(t.settings.target??{}),n=[];for(let s of(r.success?r.data.tests?.placements:void 0)??[]){let i=PAr.safeParse(s);if(!i.success)continue;let{repository:o,testType:a}=i.data,c=e.find(d=>d.repository.provider===o.provider&&d.repository.providerRepositoryId===o.providerRepositoryId),l=i.data.directory.trim(),u=!l||od.isAbsolute(l)||l.split(/[\\/]/).includes("..");!c||u||n.push({repository:c.slug,testType:a,directory:l})}return n}var BAr=y.object({report:y.object({language:y.string()}).passthrough()}).passthrough();function Xge(t){let e=BAr.safeParse(t?.settings.target);return e.success?Uq(e.data.report.language):"en"}var _Ar=y.object({environment:y.object({components:y.array(y.unknown()).optional(),dependencies:y.array(y.unknown()).optional()}).passthrough()}).passthrough(),DAr=y.object({name:y.string().min(1),provision:y.literal("existing"),url:y.string().min(1),repository:ife.optional(),revisionUrl:y.string().min(1).optional()}).passthrough(),OAr=y.object({name:y.string().min(1),url:y.string().nullable(),versionUrl:y.string().nullable(),notes:y.string().nullable()}).passthrough();function Ndt(t,e){let r=_Ar.safeParse(t.settings.target),n=r.success?r.data.environment:{},s=(n.components??[]).flatMap(a=>{let c=DAr.safeParse(a);if(!c.success)return[];let{name:l,url:u,repository:d,revisionUrl:p}=c.data;if(!d)return[{name:l,url:u}];let m=e.sources.find(f=>f.repository.provider===d.provider&&f.repository.providerRepositoryId===d.providerRepositoryId);return m?[{name:l,url:u,repository:`${m.repository.namespace}/${m.repository.name}`,expectedRevision:m.revision,...p?{revisionUrl:p}:{}}]:[{name:l,url:u,repository:`${d.provider} repository ${d.providerRepositoryId}`}]}),i=(n.dependencies??[]).flatMap(a=>{let c=OAr.safeParse(a);return c.success?[{name:c.data.name,url:c.data.url,versionUrl:c.data.versionUrl,notes:c.data.notes}]:[]});if(s.length===0&&i.length===0)return;let o=y.object({allowSharedEnvironmentMutation:y.boolean()}).passthrough().safeParse(t.settings.policy);return{components:s,dependencies:i,allowMutation:o.success&&o.data.allowSharedEnvironmentMutation}}var MAr=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function pdt(t,e){if(!MAr.has(t.reason))return{};let r=`${t.repository.namespace}/${t.repository.name}`,n=t.change?.kind==="pull_request"?t.change.number:void 0,s=n===void 0?void 0:e.find(a=>Pj(a.repository,r)&&a.number===n),i=s?.merged===!0?s.mergeCommit:void 0,o=i&&s?.mergedHead?{mergedHead:s.mergedHead}:{};return{touched:!0,acceptedRevisions:{frozen:t.revision,...i&&i!==t.revision?{mergeCommit:i,...o}:{}}}}function kdt(t,e,r,n,s){let i=u=>r.sources.find(d=>Pj(`${d.repository.namespace}/${d.repository.name}`,u)),o=(t?.components??[]).map(u=>{let d=u.expectedRevision?i(u.repository):void 0;return d?{...u,...pdt(d,s)}:u}),a=Qw(e.files)!==void 0,c=e.components.map(u=>{if(u.repository===yn)return{name:u.name,url:e.address};let d=i(u.repository),p=a?void 0:uhe(e,u.name);return{name:u.name,url:e.address,repository:u.repository,...d?{expectedRevision:d.revision}:{},...p?{revisionUrl:p}:{},...a?{revisionScript:!0}:{},...d?pdt(d,s):{}}}),l=y.object({allowSharedEnvironmentMutation:y.boolean()}).passthrough().safeParse(n?.settings.policy);return{components:[...o,...c],dependencies:t?.dependencies??[],allowMutation:t?.allowMutation??(l.success&&l.data.allowSharedEnvironmentMutation)}}function Pdt(t){let e=r=>t.testResults.filter(n=>n.status===r).length;return{passed:e("Pass"),failed:e("Fail"),skipped:e("Skipped")}}function QAr(t){let{passed:e,failed:r,skipped:n}=Pdt(t);return e+r===0?{sufficiency:"insufficient",rationale:n>0?`Every test was skipped (${n}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${e+r} tests ran against the frozen sources: ${e} passed, ${r} failed${n?`, ${n} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}function LAr(t,e){let r=t.testResults.map(c=>({result:c,repository:c.repository??e,path:c.fileName||c.testType})),n=new Map;for(let c of r){let l=`${c.repository}:${c.result.testType}:${c.path}`;n.set(l,(n.get(l)??0)+1)}let s=r.map(({result:c,repository:l,path:u})=>{let d=(n.get(`${l}:${c.testType}:${u}`)??0)>1;return c.resultId??JG(l,c.testType,u,d&&c.endpoint||void 0)}),i=new Map;for(let c of s)i.set(c,(i.get(c)??0)+1);let o=new Set(s.filter(c=>i.get(c)===1)),a=r.map(({result:c,repository:l},u)=>{let d=s[u],p=d;if(i.get(d)>1&&o.has(d))for(let m=2;o.has(p)||p===d;m+=1)p=d.includes("#")?`${d}.${m}`:`${d}#${m}`;return o.add(p),{...c,repository:l,resultId:p}});return{...t,testResults:a,...UAr(t,a,e),validation:FAr(t,t.validation??QAr(t)),traceVersion:1}}function UAr(t,e,r){if(!t.testExecutionContexts)return{};let n=new Set,s=a=>{let c=a;for(let l=2;n.has(c);l+=1)c=`${a}#${l}`;return n.add(c),c},i=[],o=new Map;for(let{repository:a,...c}of t.testExecutionContexts){let l=c.status==="not_run"?[]:e.filter(u=>u.fileName===c.test&&u.repository===(a?.trim()||r));l.length||i.push(c);for(let{resultId:u}of l){let d=o.get(u),p=d!==void 0&&i[d].cleanup.status==="failed"?i[d].cleanup:c.cleanup,m={...c,cleanup:p,test:u,resultId:u};d===void 0?o.set(u,i.push(m)-1):i[d]=m}}for(let a of i)a.resultId&&n.add(a.resultId);return{testExecutionContexts:i.map(a=>a.resultId?a:{...a,test:s(a.test.slice(0,512))}).slice(0,5e3)}}function FAr(t,e){let{passed:r,failed:n}=Pdt(t);return e.sufficiency!=="sufficient"||r+n>0||e.acceptedEvidence.length>0?e:{...e,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}async function Bdt(t,e){let r=Wu([...t.issuedTokens,...e.secrets??[]]),n=Dst({manifest:t.manifest,attemptNumber:t.attemptNumber,checkedOut:e.sources.map(s=>({repository:s.repository,revision:s.revision})),generatedTests:Xr(e.delivery,r),producer:e.producer,report:Xr(LAr(e.report,e.workingSlug),r),githubWrites:e.githubWrites});await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/report`,n)}async function Zge(t){let e=Ist.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/configuration`,void 0)),r=t.manifest.configuration,{configuration:n,capture:s}=e;if(n.captureId!==r.captureId||n.revision!==r.revision||n.hash!==r.hash||s.hash!==r.hash||kst(s)!==r.hash)throw new Error("The app answered the configuration of another capture than the manifest names");return e}var Yge=class extends Error{};async function JV(t){let{runtimePlan:e,testEnvironment:r}=Rst.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/runtime-plan`,void 0));if(e&&Tst(e.files)!==e.contentHash)throw new Yge(`Stored SUT recipe version ${e.version} does not match its hash`);return{runtimePlan:e,testEnvironment:r??null}}async function _dt(t,e,r=()=>{}){try{po.rmSync(e,{recursive:!0,force:!0})}catch{}let n=t.manifest.requirements??[];if(n.length===0&&!t.manifest.instructions)return{items:[],instructions:[]};let s,i=[];try{let a=hst.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/requirements`,void 0));s=new Map(a.items.map(c=>[Oc(c),c])),i=t.manifest.instructions?a.instructions??[]:[]}catch(a){let c=a instanceof Error?a.message:String(a);r(`Testbot V3: could not read the run's requirement items: ${c}`),s=new Map}try{po.mkdirSync(e,{recursive:!0,mode:448})}catch{}let o=[];for(let a of n){let c={...YA(a),..."fileName"in a?{file:{name:a.fileName,mediaType:a.mediaType}}:{}},l=s.get(Oc(c));if(!l)o.push({...c,state:"not_read",reason:Uw.test(c.key)?"cannot_open":"unavailable"});else if(l.state==="not_read")o.push({...c,state:"not_read",reason:l.reason});else if(!("text"in l))o.push(await $Ar(t,e,c,a.contentHash,r));else{let u=od.join(e,Ddt(c));try{po.writeFileSync(u,l.text,{mode:384}),o.push({...c,state:"read",path:u,contentMatches:l.contentMatches,version:l.version})}catch(d){r(`Testbot V3: could not write the requirement item ${c.key}: ${d instanceof Error?d.message:String(d)}`),o.push({...c,state:"not_read",reason:"unavailable"})}}}return{items:o,instructions:i}}async function $Ar(t,e,r,n,s){let i=c=>(s(`Testbot V3: could not open the uploaded document ${r.key}: ${c}`),{...r,state:"not_read",reason:"cannot_open"});if(!r.file)return i("the manifest names no file");let o;try{let c=ust.requirementFile.replace(":attemptId",t.attemptId).replace(":key",r.key);o=await t.readBytes(c,cdt)}catch(c){return i(c instanceof Error?c.message:String(c))}if((0,fdt.createHash)("sha256").update(o).digest("hex")!==n)return i("its bytes do not match its hash");let a=od.join(e,Ddt(r));try{po.writeFileSync(a,o,{mode:384})}catch(c){return i(c instanceof Error?c.message:String(c))}return{...r,state:"read",path:a,contentMatches:!0,version:n}}function Ddt(t){let e=t.source==="other"?[]:[new URL(t.site).hostname],r=t.file?adt(t.file.mediaType):"txt";return`${[t.source,...e,t.key].join("-")}.${r}`}async function eAe(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/progress`,Ast.parse(e))}async function Odt(t,e){return Est.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-events`,yst.parse(e)))}async function Mdt(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-checkpoint`,xst.parse(e))}async function Qdt(t){return(await Udt(t,"setup-checkpoint",Sst))?.checkpoint??null}async function Ldt(t){return(await Udt(t,"setup-context",Cst))?.context??null}async function Udt(t,e,r){try{return r.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/${e}`,void 0))}catch(n){if(n instanceof uo&&n.status===404)return null;throw n}}async function tAe(t,e){let r=Wu([...t.issuedTokens,...e.secrets??[]]),n=Ost(t.manifest,t.attemptNumber,e.sources.map(s=>({repository:s.repository,revision:s.revision})),Xr(e.recipe,r),e.producer);await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/sut-recipe`,n)}function Fdt(t,e,r,n=e[0].slug,s,i={}){let{record:o,entries:a}=qdt(t,e,n),c=tu({outputsDir:t,state:QV(od.join(od.dirname(t),"state.json"))});if(!o&&Dj(i,r.system,c?.sutRequired).length>0)return{status:"none"};let l=f=>$dt(e,f),u=[],d=[];for(let{record:f,repository:h,number:b}of a)if(h&&b)u.push({repository:h,number:b});else if(h&&f.prFailure){let E=f.prDetail?`${f.prFailure}: ${f.prDetail}`:f.prFailure;d.push({repository:h,message:E,slug:f.repository??n})}else h&&f.committed&&d.push({repository:h,message:f.reason??"The tests were committed but no pull request was opened.",slug:f.repository??n});let p=new Set([...u,...d].map(({repository:f})=>f.providerRepositoryId)),m=[...new Set(r.newTestsCreated.map(f=>(f.repository??n).toLowerCase()))];for(let f of m){let h=l(f);h&&!p.has(h.providerRepositoryId)&&d.push({repository:h,message:s??"Generated tests were not proposed in a pull request.",slug:f})}return u.length&&d.length?{status:"partial",pullRequests:u,failures:d.map(({repository:f,message:h})=>({repository:f,message:h}))}:u.length?{status:"delivered",pullRequests:u}:d.length?{status:"failed",message:o?.deliveries?d.map(f=>`${f.slug}: ${f.message}`).join("; "):d[0].message}:r.newTestsCreated.length>0?{status:"failed",message:s??"Generated tests were not proposed in a pull request."}:{status:"none"}}function $dt(t,e){let r=t.find(n=>n.slug.toLowerCase()===e.toLowerCase());return r&&{provider:r.repository.provider,providerAccountId:r.repository.providerAccountId,providerRepositoryId:r.repository.providerRepositoryId}}function qdt(t,e,r){let n=od.join(t,"deliver.json"),s=po.existsSync(n)?JSON.parse(po.readFileSync(n,"utf-8")):void 0,i=s?.deliveries??(s?[s]:[]);return{record:s,entries:i.map(o=>({record:o,repository:$dt(e,o.repository??r),number:/\/pull\/([1-9][0-9]*)$/.exec(o.prUrl??"")?.[1]}))}}function Hdt(t,e,r=e[0].slug){let n=new Map,s=(i,o)=>{ufe.safeParse(i).success&&n.set(`${i.kind}:${i.repository.providerRepositoryId}:${o}`,i)};for(let{record:i,repository:o,number:a}of qdt(t,e,r).entries){if(!o||!i.branch)continue;let c=i.pushedCommits??(i.pushed&&i.commitSha?[i.commitSha]:[]);for(let u of c)s({kind:"branch_pushed",repository:o,branch:i.branch,commit:u},`${i.branch}:${u}`);if(!a)continue;let l=i.prAction==="retargeted"?i.retargetedAs??"created":i.prAction;l==="created"?s({kind:"pull_request_opened",repository:o,number:a,branch:i.branch},a):(l==="updated"||l==="unchanged")&&s({kind:"pull_request_edited",repository:o,number:a,branch:i.branch},a)}return[...n.values()].slice(0,lfe)}function zdt(t,e){return t.credentials.filter(r=>r.required&&!e[r.name]).map(r=>r.name)}var rAe=[/\bgh[pousr]_[A-Za-z0-9]{36,}/g,/\bgithub_pat_[A-Za-z0-9_]{22,}/g,/\bsk-ant-[A-Za-z0-9_-]{20,}/g,/\bsk-[A-Za-z0-9]{32,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g],Gdt=t=>rAe.some(e=>new RegExp(e.source).test(t));var Oh=".skyramp/setup-events.ndjson",aO=".skyramp/setup-left-out.json",cO=".skyramp/setup-inbox.json",nAe=".skyramp/setup-inbox-read.json",eW=".skyramp/setup-hook-ran",qAr=6e4,HAr=5e3,zAr=300,ri=t=>{let e=typeof t=="string"?t:typeof t=="number"?String(t):"";return e.trim()==="null"?"":e},KV=t=>Array.isArray(t)?t:[],ZV=(t,e)=>Object.values(t).find(r=>r===ri(e).trim().toLowerCase()),GAr={running:"up",healthy:"up",ready:"up",started:"up",building:"starting",pending:"starting",installing:"starting",skipped:"out_of_scope",excluded:"out_of_scope","out-of-scope":"out_of_scope"},jAr=t=>ZV(Q_,t)??GAr[ri(t).trim().toLowerCase()]??"found",jdt=t=>y.string().uuid().safeParse(t).success,VAr=t=>XG.test(t)?t:t.replace(/[^A-Za-z0-9_-]+/g,"-").slice(0,64).replace(/^-+|-+$/g,"")||"question",WAr=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,YAr=/github\.com[/:]([^/\s]+)\/([^/\s?#]+?)(?:\.git)?(?:[/?#]|$)/i;function JAr(t){if(t.kind!=="question"||t.placeholder===void 0)return t;let{placeholder:e,...r}=t;return r}var Vdt=new RegExp(Afe.source,"g"),tW=class{constructor(e,r,n){this.checkout=e;this.send=r;this.opts=n}checkout;send;opts;offset=0;sequence=1;pending=[];started=!1;closed=!1;capped=!1;flushing=0;emptyRefused=!1;placeholderRefused=!1;unreadSince;saidHookSilent=!1;timer;queue=Promise.resolve();phase="discover";messageIds=new Set;stopHeard=!1;start(){if(!this.timer){if(!this.started){this.started=!0;let e=km.join(this.checkout,Oh);ws.mkdirSync(km.dirname(e),{recursive:!0}),ws.writeFileSync(e,"");for(let r of[aO,cO,nAe,eW])ws.rmSync(km.join(this.checkout,r),{force:!0})}this.timer=setInterval(()=>{this.flushing===0&&this.flush()},this.opts.intervalMs??HAr),this.timer.unref?.()}}async stop(){this.timer&&clearInterval(this.timer),this.timer=void 0,await this.flush()}flush(){return this.flushing+=1,this.queue=this.queue.then(()=>this.drain()).catch(e=>this.opts.warn(`Testbot V3: could not send setup events: ${XV(e)}`)).finally(()=>{this.flushing-=1}),this.queue}async drain(){if(!this.closed){if(this.collect(),this.pending.length===0&&!this.emptyRefused){await this.sendBatch([]);return}for(;this.pending.length>0&&!this.closed;){let e=this.pending.slice(0,HR);if(await this.sendBatch(e)==="unanswered")return;this.pending.splice(0,e.length)}}}async sendBatch(e){this.placeholderRefused&&(e=e.map(JAr));let r;try{r=await this.send({schemaVersion:1,events:e})}catch(n){if(n instanceof uo&&n.code==="RUN_CLOSED")return this.closed=!0,this.pending=[],"done";if(n instanceof uo&&e.length===0)return this.emptyRefused=!0,"done";if(n instanceof uo){if(e.length>1){for(let i of e){if(this.closed)return"done";if(await this.sendBatch([i])==="unanswered")return"unanswered"}return"done"}if(e[0].kind==="question"&&e[0].placeholder!==void 0)return this.placeholderRefused=!0,this.sendBatch(e);let s=e[0].kind==="log"?void 0:KAr(e[0]);return s?(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is sent as a log line: ${n.message}`),this.sendBatch([{sequence:e[0].sequence,at:e[0].at,kind:"log",phase:this.phase,text:s}])):(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is dropped: ${n.message}`),"done")}return n instanceof y.ZodError?(this.opts.warn(`Testbot V3: the app's answer to setup events was not understood: ${n.issues[0]?.message}`),"done"):(this.opts.warn(`Testbot V3: could not send setup events, trying again: ${XV(n)}`),"unanswered")}try{this.writeLeftOut(r.leftOut)}catch(n){this.opts.warn(`Testbot V3: could not write ${aO}: ${XV(n)}`)}try{this.writeInbox(r.messages??[])}catch(n){this.opts.warn(`Testbot V3: could not write ${cO}: ${XV(n)}`)}return r.stop&&!this.stopHeard&&(this.stopHeard=!0,this.opts.onStop?.(r.stop.key)),"done"}collect(){if(this.capped)return;let e=km.join(this.checkout,Oh),r;try{r=ws.statSync(e).size}catch{return}if(r<this.offset&&(this.offset=0),r===this.offset)return;let n=Buffer.alloc(r-this.offset),s=ws.openSync(e,"r");try{ws.readSync(s,n,0,n.length,this.offset)}finally{ws.closeSync(s)}let i=n.lastIndexOf(10);if(i<0)return;let o=n.subarray(0,i).toString("utf-8").split(`
|
|
566
|
+
`)}`});if(t.credentials.length>0){let n=t.credentials.map(s=>`${s.name} (${hAr[s.purpose]}${s.required?"":", optional"})`);r.push(`- Secrets the workflow provides as environment variables: ${n.join(", ")} \u2014 the recipe reads each by exactly that variable name.`)}return r}var Wv=$(require("fs")),VV=$(require("path"));function zge(t,e){let{value:r,error:n}=Yr(t);if(n)return{errors:[n]};let s=e&&!e.testEnvironment?gAr(r,e):r,i=ev(s)&&s.schemaVersion===void 0?{schemaVersion:1,...s}:s,{value:o,errors:a}=tv(C_,$me,i);return o?{onboard:o,errors:[]}:{errors:a}}function gAr(t,e){if(!ev(t))return t;let{environment:r,...n}=t,s=[...e.repositorySlug?[{slug:e.repositorySlug,path:e.repositoryPath}]:[],...(e.relatedRepos??[]).map(a=>({slug:a.slug,path:a.path}))],i=a=>typeof a=="string"?s.find(c=>Ja(c.path,a))?.slug:void 0,o=Array.isArray(n.components)?n.components.map(a=>{if(!ev(a))return a;let{deployed:c,...l}=a;if(l.repository!==yn)return l;let u=ev(l.from)?l.from.file:void 0,d=i(u)??s[0]?.slug;return d?{...l,repository:d}:l}):n.components;return{...n,components:o}}var jV=".skyramp/sut/health.json",AAr={[jV]:`${jV} (with a url or command)`,".skyramp/workspace.yml":".skyramp/workspace.yml (create it with skyramp_init_scan and skyramp_init_workspace)"};function tdt(){return{name:"onboard-recipe",verify(t,e){let{onboard:r,errors:n}=zge(e.stdout,t.inputs);if(!r)return Re(this.name,n,{fatal:!0});let s=r.environment!==void 0;if(r.status==="blocked")return{name:this.name,passed:!0};let i=t.inputs.repositoryPath,o=Jc(i),a=s?QR.filter(u=>Ja(i,u)):[];if(a.length>0)return Re(this.name,[`an answer with "environment" tests a deployment where it runs and never starts or stops it: delete ${a.join(" and ")}, keep the health check, and answer "ready" again`]);let l=(s?Jme:Yme).filter(u=>!Ja(i,u)).map(u=>AAr[u]??u);return Ja(i,jV)&&!o.healthHint&&l.push(`${jV} (with a url or command)`),o.present&&l.length===0?{name:this.name,passed:!0}:Re(this.name,[`status is "ready" but the recipe deploy replays is incomplete in ${t.inputs.repositoryPath} \u2014 missing (each must be a regular file, not a symlink): ${l.join(", ")}. Write the missing files as the skill specifies and answer "ready" again, or answer "blocked" with the blocker that stopped you.`])}}}function rdt(t,e,r=process.env){let n=[...t.components.flatMap(s=>s.credentials??[]),...t.environment?.credentials??[]];return[...new Set(n)].filter(s=>e.includes(s)&&!r[s])}function ndt(t,e){let r=t.components.filter(s=>s.credentials?.some(i=>e.includes(i))).map(s=>s.name),n=e.join(", ");return{component:(r.length>0?r:t.components.map(s=>s.name)).join(", ")||"SUT",problem:`${n} ${e.length===1?"has":"have"} no value in this setup`,evidence:`The workflow supplies ${e.length===1?"it":"each"} from a GitHub Actions secret, which is missing or empty.`,fix:`Set that secret in the workflow host's repository, or choose the secret that supplies ${e.length===1?"it":"each"} under Credentials, then run setup again.`}}function sdt(){return{name:"deployed-revisions",async verify(t,e,r,n){let s={name:this.name,passed:!0},i=t.checkDeployedRevisions;if(!i)return s;let{onboard:o}=zge(e.stdout,t.inputs);if(!o?.environment||o.status==="blocked")return s;let a=Qw(oO(t.inputs.repositoryPath).recipeFiles);if(!a)return s;let c=o.components.map(({name:d,repository:p})=>({name:d,repository:p})),{blockers:l}=await i(a.content,c,o.environment.credentials);if(l.length===0)return s;let u=l.map(d=>`${d.component}: ${d.problem} (${d.evidence})`).join("; ");return n?.retryLeft?Re(this.name,[`Testbot ran ${$a} twice, with GH_TOKEN, and it failed the check the setup's plan must pass: ${u}. Your session has no GH_TOKEN, so the part that reads GitHub ran in full only there. Fix the script so each component a repository builds gets the full commit it runs, the same on each run, from its own repository, then answer "ready" again, or answer "blocked" with the blocker that stops you.`]):{...s,details:`${$a} still fails Testbot's check, so the plan is saved blocked: ${u}`}}}}function yAr(t){try{return new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(t)}catch{return}}function oO(t){let e=[],r=o=>{let a;try{a=Wv.readdirSync(VV.join(t,o),{withFileTypes:!0})}catch{return}for(let c of a.sort((l,u)=>l.name.localeCompare(u.name))){let l=VV.posix.join(o,c.name);c.isDirectory()&&!c.name.startsWith(".")?r(l):c.isFile()&&e.push(l)}};Ja(t,".skyramp/sut",{directory:!0})&&r(".skyramp/sut"),Ja(t,".skyramp/workspace.yml")&&e.push(".skyramp/workspace.yml");let n=[],s=[],i=0;for(let o of e){let a=Ja(t,o);if(!a)continue;let l=Wv.statSync(a).size;if(l>Ow){s.push({path:o,reason:`larger than ${Ow} bytes`});continue}if(i+l>Mw){s.push({path:o,reason:`recipe text over ${Mw} bytes in total`});continue}let u=yAr(Wv.readFileSync(a));if(u===void 0||BG.test(u)){s.push({path:o,reason:"not text"});continue}n.push({path:o,content:u}),i+=l}return{recipeFiles:n,recipeFilesOmitted:s}}function idt(t,e){let{onboard:r,errors:n}=zge(e.stdout,t.inputs),s=r&&{...r,...oO(t.inputs.repositoryPath)};return tr(t,"onboard",Xr(s,t.secretValues??[]),n)}function WV(t){if(t.state.stages.onboard?.status==="passed")return ae(t,"onboard.json")}var ws=$(require("fs")),km=$(require("path"));var mdt=require("child_process"),fdt=require("crypto"),po=$(require("fs")),od=$(require("path"));var odt=$(require("fs")),by=$(require("path"));var Gge={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"},adt=t=>Gge[t].toLowerCase(),ga=t=>new Map((t??[]).flatMap(e=>e.file?[[qa(e.key),e.file.name]]:[])),cdt=10*1024*1024,yx=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",ldt=(t,e)=>by.join(by.dirname(t),`${by.basename(t,by.extname(t))}${e}`),bx=t=>ldt(t,".extracted.txt");function jge(t){try{return/\S/.test(odt.readFileSync(bx(t),"utf-8"))}catch{return!1}}var Vge=t=>ldt(t,".quotes.txt");function udt(t){return yx(t.file)?bx(t.path):t.file?.mediaType==="application/pdf"?Vge(t.path):t.path}function YV(t){return t.map(e=>e.state!=="read"||!yx(e.file)||jge(e.path)?e:{...YA(e),file:e.file,state:"not_read",reason:"cannot_open"})}var bAr=10*6e4;function hdt(t,e){return t.getTime()-e.getTime()-bAr}var ddt="This attempt revoked its scoped GitHub credentials; it mints no more.",EAr=10*6e4,wAr=3e4,xAr=3,uo=class extends Error{constructor(r,n,s){super(r);this.status=n;this.code=s}status;code},Yv=class extends Error{};function Jge(t){let e;try{e=new URL(t)}catch{throw new Error(`skyrampAppOrigin "${t}" is not a URL`)}if(e.protocol!=="https:"||e.origin!==t.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${t}"`);return e.origin}function SAr(t,e){if(!qR.test(t))throw new Error(`The ${e} "${t}" is not a uuid`);return t}function Kge(t,e){return`${t.replace(/\/+$/,"")}/runs/${e}`}function gdt(t,e,r){throw e<500&&e!==429?new uo(t,e,r):new Yv(t)}async function Adt(t,e,r,n){let s=Jge(t.origin),i;for(let o=1;o<=xAr;o+=1){o>1&&await new Promise(a=>setTimeout(a,(t.retryDelayMs??2e3)*(o-1)));try{let a=await t.idToken(s),c=await(t.fetch??fetch)(new URL(e,s).toString(),{...r(a),redirect:"error",signal:AbortSignal.timeout(wAr)}).catch(l=>{throw new Yv(l instanceof Error?l.message:String(l),{cause:l})});return await n(c)}catch(a){if(a instanceof uo)throw a;i=a}}throw i}function ydt(t,e,r,n){return Adt(t,r,i=>({method:e,headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json",Accept:"application/json"},body:e==="GET"?void 0:JSON.stringify(n)}),async i=>{let o=await i.json().catch(()=>({}));if(i.ok)return o.data;let a=o.error?.fields,c=typeof a?.path=="string"&&typeof a.reason=="string"?` at ${a.path}: ${a.reason}`:"",l=`The Skyramp app refused ${e} ${r}: ${i.status} ${o.error?.code??"no error code"}${c}`;return gdt(l,i.status,o.error?.code)})}function CAr(t,e,r){return Adt(t,e,s=>({method:"GET",headers:{Authorization:`Bearer ${s}`,Accept:"application/octet-stream"}}),async s=>{if(!s.ok)return gdt(`The Skyramp app refused GET ${e}: ${s.status}`,s.status);let i=Buffer.from(await s.arrayBuffer());if(i.length>r)throw new uo(`The Skyramp app answered GET ${e} with more than ${r} bytes`,s.status);return i})}var Wge=class{constructor(e,r,n,s,i,o,a,c,l){this.attemptId=e;this.attemptNumber=r;this.deadlineAt=n;this.manifest=s;this.deps=i;this.license=o;this.requestedBy=a;this.writeAllowed=c;this.claudeCodeVersion=l}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;budgetMs(e){return hdt(this.deadlineAt,e)}get skyrampRunUrl(){return Kge(Jge(this.deps.origin),this.manifest.runId)}send(e,r,n){return ydt(this.deps,e,r,n)}readBytes(e,r){return CAr(this.deps,e,r)}issuedTokens=[];closure;modelKey;credentials;revocation;async token(){if(this.revocation)throw new Error(ddt);let e=(this.deps.now??(()=>new Date))().getTime(),r=this.credentials,n=r&&await r.catch(()=>{});if(this.credentials!==r)return(await this.credentials).token;if(n&&n.expiresAt-e>=EAr)return n.token;if(this.revocation)throw new Error(ddt);let s=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,{schemaVersion:1}).then(i=>{let o={...i,token:i.token??this.jobToken()};this.issuedTokens.push(o.token),this.deps.mask?.(o.token),!n&&o.anthropicApiKey&&(this.modelKey=o.anthropicApiKey,this.deps.mask?.(o.anthropicApiKey));let a=n?"Renewed":"Received";return i.token&&this.deps.log?.(`${a} scoped GitHub credentials; they expire at ${o.expiresAt}.`),{token:o.token,expiresAt:i.token?new Date(o.expiresAt).getTime():Number.POSITIVE_INFINITY}},i=>{if(!(i instanceof uo)||i.code!=="CREDENTIALS_UNAVAILABLE")throw i;let o=l=>[...new Set(l.map(u=>u.namespace))].join(", "),a=this.manifest.sources.map(l=>l.repository);if(new Set(a.map(l=>l.providerAccountId)).size>1)throw new uo(`${i.message}. The run's repositories are on more than one GitHub account (${o(a)}), which Skyramp does not support yet.`,i.status,i.code);let c=o([...a,this.manifest.execution.repository]);throw new uo(`${i.message}. Check the Skyramp GitHub App installation on ${c}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,i.status,i.code)});return this.credentials=s,(await s).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(e){return e.fetch??this.deps.fetch??fetch}revokeTokens(e={}){let r=e.host??Zr();return this.revocation??=r.revokeToken?this.revokeIssued(n=>r.revokeToken(n,this.sourceFetch(e))):Promise.resolve([]),this.revocation}async revokeIssued(e){let r=[...this.issuedTokens],n=Promise.all(r.map(o=>this.revokeOne(o,e)));await this.credentials?.catch(()=>{});let s=this.issuedTokens.filter(o=>!r.includes(o));return[...await n,...await Promise.all(s.map(o=>this.revokeOne(o,e)))].filter(o=>o!==void 0)}async revokeOne(e,r){try{await r(e);return}catch(n){return`token ${this.issuedTokens.indexOf(e)+1} of ${this.issuedTokens.length}: ${n instanceof Error?n.message:String(n)}`}}};async function bdt(t,e,r){SAr(t,"run id"),Jge(r.origin);let n=Pst(t,e),s=Bst(await ydt(r,"POST",`/api/v1/runner/runs/${t}/attempts`,n));if(s.manifest.runId!==t)throw new Error(`The app answered the handshake of run ${t} with the manifest of another run (${s.manifest.runId})`);let i=s.manifest.sources.find(a=>a.repository.provider!==n.execution.provider);if(i)throw new Error(`The manifest of run ${t} names ${i.repository.namespace}/${i.repository.name} on ${i.repository.provider}, but this job runs on ${n.execution.provider}`);s.runToken&&r.mask?.(s.runToken);let o=s.runToken?{entitlements:s.entitlements??[],runToken:s.runToken}:void 0;return new Wge(s.attempt.id,s.attempt.number,new Date(s.attempt.deadlineAt),s.manifest,r,o,s.requestedBy??void 0,s.writeAllowed,s.claudeCodeVersion??void 0)}var IAr=6e4;async function Edt(t){return vst.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/heartbeat`,{schemaVersion:1}))}async function wdt(t,e=()=>new Date){if(t.closure)return t.closure;let r=await Edt(t).then(n=>bfe(n,e())).catch(()=>null);return r&&(t.closure=r),r}function xdt(t,e,r={}){let n=!1,s,i=async()=>{try{let a=bfe(await Edt(t),(r.now??(()=>new Date))());a&&!n&&(n=!0,t.closure=a,e(a))}catch(a){a instanceof uo&&(n=!0)}n||o(r.intervalMs??IAr)},o=a=>{s=setTimeout(()=>{i()},a),s.unref?.()};return o(0),{stop(){n=!0,clearTimeout(s)}}}var RAr=10*6e4,vAr=(t,e,r)=>(0,mdt.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","pipe"],env:r??process.env,timeout:RAr}).trim(),TAr=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];async function Sdt(t,e){let r=e.git??vAr,n=e.host??Zr(),s=e.cloneUrl??(c=>n.cloneUrl(c)),{sources:i}=t.manifest;for(let c of i){if(TAr.includes(c.reason)&&!c.change?.base)throw new Error(`${c.repository.namespace}/${c.repository.name} was selected as ${c.reason}, but its change names no base revision to compare it with`);if(c.change?.kind==="pull_request"&&!c.change.base)throw new Error(`${c.repository.namespace}/${c.repository.name} pull request ${c.change.number} names no base revision to compare it with`);n.checkSourceName(c.repository)}if(po.existsSync(e.workspace)&&po.lstatSync(e.workspace).isSymbolicLink())throw new Error(`The sources workspace ${e.workspace} is a symlink; refusing to clear it`);po.rmSync(e.workspace,{recursive:!0,force:!0});let o=new Map((t.manifest.baseline.sources??[]).map(c=>[B_(c.repository),c.revision])),a=[];for(let c of i){let{namespace:l,name:u}=c.repository,d=od.join(e.workspace,l,u);po.mkdirSync(d,{recursive:!0});let p={...process.env,GIT_TERMINAL_PROMPT:"0",...n.gitAuthEnv(await t.token())};r(d,["init","-q"]),r(d,["remote","add","origin",s(c.repository)]);let m=c.change?.base??c.compareWith,f=o.get(B_(c.repository)),h=m?.revision??(f!==c.revision?f:void 0);r(d,["fetch","-q","--no-tags","origin",c.revision,...h?[h]:[]],p);let b=m??(c.ref?{ref:c.ref,revision:f??c.revision}:null);b&&(r(d,["update-ref",`refs/remotes/origin/${b.ref}`,b.revision]),r(d,["symbolic-ref","refs/remotes/origin/HEAD",`refs/remotes/origin/${b.ref}`])),c.ref?r(d,["checkout","-q","-B",c.ref,c.revision]):r(d,["checkout","-q","--detach",c.revision]),a.push({repository:c.repository,revision:r(d,["rev-parse","HEAD"]),path:d,slug:`${l}/${u}`})}return a}async function Cdt(t,e={}){let r=e.host??Zr(),n={token:()=>t.token(),fetch:t.sourceFetch(e)},s=[];for(let i of t.manifest.sources){if(i.change?.kind!=="pull_request")continue;let{namespace:o,name:a}=i.repository,c=`${o}/${a}`,l=i.change.number;try{s.push({repository:c,number:l,...await r.pullRequest(i.repository,l,n)})}catch(u){let d=u instanceof Error?u.message:String(u);s.push({repository:c,number:l,note:`could not be read: ${d}`})}}return s}async function Idt(t,e,r,n={}){return(n.host??Zr()).commitLookup(e,r,{token:()=>t.token(),fetch:t.sourceFetch(n)})}function Rdt(t,e){let r=t.sources.find(s=>s.reason==="TRIGGER"&&s.change?.kind==="pull_request"),n=r&&e.find(s=>s.repository.providerRepositoryId===r.repository.providerRepositoryId);return n&&r.change?{repository:n.slug,path:n.path,number:Number(r.change.number)}:void 0}var NAr=[".skyramp/sut/setup.sh",".skyramp/workspace.yml"];function vdt(t){let e=t.find(r=>NAr.some(n=>po.existsSync(od.join(r.path,n))))??t[0];return{repositoryPath:e.path,repositorySlug:e.slug,relatedRepos:t.filter(r=>r!==e).map(r=>({slug:r.slug,path:r.path,writable:!0}))}}var kAr=y.object({tests:y.object({placements:y.array(y.unknown()).optional()}).passthrough().optional()}).passthrough(),PAr=y.object({repository:ife,testType:y.nativeEnum(Yw),directory:y.string()}).passthrough();function Tdt(t,e){let r=kAr.safeParse(t.settings.target??{}),n=[];for(let s of(r.success?r.data.tests?.placements:void 0)??[]){let i=PAr.safeParse(s);if(!i.success)continue;let{repository:o,testType:a}=i.data,c=e.find(d=>d.repository.provider===o.provider&&d.repository.providerRepositoryId===o.providerRepositoryId),l=i.data.directory.trim(),u=!l||od.isAbsolute(l)||l.split(/[\\/]/).includes("..");!c||u||n.push({repository:c.slug,testType:a,directory:l})}return n}var BAr=y.object({report:y.object({language:y.string()}).passthrough()}).passthrough();function Xge(t){let e=BAr.safeParse(t?.settings.target);return e.success?Uq(e.data.report.language):"en"}var _Ar=y.object({environment:y.object({components:y.array(y.unknown()).optional(),dependencies:y.array(y.unknown()).optional()}).passthrough()}).passthrough(),DAr=y.object({name:y.string().min(1),provision:y.literal("existing"),url:y.string().min(1),repository:ife.optional(),revisionUrl:y.string().min(1).optional()}).passthrough(),OAr=y.object({name:y.string().min(1),url:y.string().nullable(),versionUrl:y.string().nullable(),notes:y.string().nullable()}).passthrough();function Ndt(t,e){let r=_Ar.safeParse(t.settings.target),n=r.success?r.data.environment:{},s=(n.components??[]).flatMap(a=>{let c=DAr.safeParse(a);if(!c.success)return[];let{name:l,url:u,repository:d,revisionUrl:p}=c.data;if(!d)return[{name:l,url:u}];let m=e.sources.find(f=>f.repository.provider===d.provider&&f.repository.providerRepositoryId===d.providerRepositoryId);return m?[{name:l,url:u,repository:`${m.repository.namespace}/${m.repository.name}`,expectedRevision:m.revision,...p?{revisionUrl:p}:{}}]:[{name:l,url:u,repository:`${d.provider} repository ${d.providerRepositoryId}`}]}),i=(n.dependencies??[]).flatMap(a=>{let c=OAr.safeParse(a);return c.success?[{name:c.data.name,url:c.data.url,versionUrl:c.data.versionUrl,notes:c.data.notes}]:[]});if(s.length===0&&i.length===0)return;let o=y.object({allowSharedEnvironmentMutation:y.boolean()}).passthrough().safeParse(t.settings.policy);return{components:s,dependencies:i,allowMutation:o.success&&o.data.allowSharedEnvironmentMutation}}var MAr=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function pdt(t,e){if(!MAr.has(t.reason))return{};let r=`${t.repository.namespace}/${t.repository.name}`,n=t.change?.kind==="pull_request"?t.change.number:void 0,s=n===void 0?void 0:e.find(a=>Pj(a.repository,r)&&a.number===n),i=s?.merged===!0?s.mergeCommit:void 0,o=i&&s?.mergedHead?{mergedHead:s.mergedHead}:{};return{touched:!0,acceptedRevisions:{frozen:t.revision,...i&&i!==t.revision?{mergeCommit:i,...o}:{}}}}function kdt(t,e,r,n,s){let i=u=>r.sources.find(d=>Pj(`${d.repository.namespace}/${d.repository.name}`,u)),o=(t?.components??[]).map(u=>{let d=u.expectedRevision?i(u.repository):void 0;return d?{...u,...pdt(d,s)}:u}),a=Qw(e.files)!==void 0,c=e.components.map(u=>{if(u.repository===yn)return{name:u.name,url:e.address};let d=i(u.repository),p=a?void 0:uhe(e,u.name);return{name:u.name,url:e.address,repository:u.repository,...d?{expectedRevision:d.revision}:{},...p?{revisionUrl:p}:{},...a?{revisionScript:!0}:{},...d?pdt(d,s):{}}}),l=y.object({allowSharedEnvironmentMutation:y.boolean()}).passthrough().safeParse(n?.settings.policy);return{components:[...o,...c],dependencies:t?.dependencies??[],allowMutation:t?.allowMutation??(l.success&&l.data.allowSharedEnvironmentMutation)}}function Pdt(t){let e=r=>t.testResults.filter(n=>n.status===r).length;return{passed:e("Pass"),failed:e("Fail"),skipped:e("Skipped")}}function QAr(t){let{passed:e,failed:r,skipped:n}=Pdt(t);return e+r===0?{sufficiency:"insufficient",rationale:n>0?`Every test was skipped (${n}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${e+r} tests ran against the frozen sources: ${e} passed, ${r} failed${n?`, ${n} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}function LAr(t,e){let r=t.testResults.map(c=>({result:c,repository:c.repository??e,path:c.fileName||c.testType})),n=new Map;for(let c of r){let l=`${c.repository}:${c.result.testType}:${c.path}`;n.set(l,(n.get(l)??0)+1)}let s=r.map(({result:c,repository:l,path:u})=>{let d=(n.get(`${l}:${c.testType}:${u}`)??0)>1;return c.resultId??JG(l,c.testType,u,d&&c.endpoint||void 0)}),i=new Map;for(let c of s)i.set(c,(i.get(c)??0)+1);let o=new Set(s.filter(c=>i.get(c)===1)),a=r.map(({result:c,repository:l},u)=>{let d=s[u],p=d;if(i.get(d)>1&&o.has(d))for(let m=2;o.has(p)||p===d;m+=1)p=d.includes("#")?`${d}.${m}`:`${d}#${m}`;return o.add(p),{...c,repository:l,resultId:p}});return{...t,testResults:a,...UAr(t,a,e),validation:FAr(t,t.validation??QAr(t)),traceVersion:1}}function UAr(t,e,r){if(!t.testExecutionContexts)return{};let n=new Set,s=a=>{let c=a;for(let l=2;n.has(c);l+=1)c=`${a}#${l}`;return n.add(c),c},i=[],o=new Map;for(let{repository:a,...c}of t.testExecutionContexts){let l=c.status==="not_run"?[]:e.filter(u=>u.fileName===c.test&&u.repository===(a?.trim()||r));l.length||i.push(c);for(let{resultId:u}of l){let d=o.get(u),p=d!==void 0&&i[d].cleanup.status==="failed"?i[d].cleanup:c.cleanup,m={...c,cleanup:p,test:u,resultId:u};d===void 0?o.set(u,i.push(m)-1):i[d]=m}}for(let a of i)a.resultId&&n.add(a.resultId);return{testExecutionContexts:i.map(a=>a.resultId?a:{...a,test:s(a.test.slice(0,512))}).slice(0,5e3)}}function FAr(t,e){let{passed:r,failed:n}=Pdt(t);return e.sufficiency!=="sufficient"||r+n>0||e.acceptedEvidence.length>0?e:{...e,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}async function Bdt(t,e){let r=Wu([...t.issuedTokens,...e.secrets??[]]),n=Dst({manifest:t.manifest,attemptNumber:t.attemptNumber,checkedOut:e.sources.map(s=>({repository:s.repository,revision:s.revision})),generatedTests:Xr(e.delivery,r),producer:e.producer,report:Xr(LAr(e.report,e.workingSlug),r),githubWrites:e.githubWrites});await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/report`,n)}async function Zge(t){let e=Ist.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/configuration`,void 0)),r=t.manifest.configuration,{configuration:n,capture:s}=e;if(n.captureId!==r.captureId||n.revision!==r.revision||n.hash!==r.hash||s.hash!==r.hash||kst(s)!==r.hash)throw new Error("The app answered the configuration of another capture than the manifest names");return e}var Yge=class extends Error{};async function JV(t){let{runtimePlan:e,testEnvironment:r}=Rst.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/runtime-plan`,void 0));if(e&&Tst(e.files)!==e.contentHash)throw new Yge(`Stored SUT recipe version ${e.version} does not match its hash`);return{runtimePlan:e,testEnvironment:r??null}}async function _dt(t,e,r=()=>{}){try{po.rmSync(e,{recursive:!0,force:!0})}catch{}let n=t.manifest.requirements??[];if(n.length===0&&!t.manifest.instructions)return{items:[],instructions:[]};let s,i=[];try{let a=hst.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/requirements`,void 0));s=new Map(a.items.map(c=>[Oc(c),c])),i=t.manifest.instructions?a.instructions??[]:[]}catch(a){let c=a instanceof Error?a.message:String(a);r(`Testbot V3: could not read the run's requirement items: ${c}`),s=new Map}try{po.mkdirSync(e,{recursive:!0,mode:448})}catch{}let o=[];for(let a of n){let c={...YA(a),..."fileName"in a?{file:{name:a.fileName,mediaType:a.mediaType}}:{}},l=s.get(Oc(c));if(!l)o.push({...c,state:"not_read",reason:Uw.test(c.key)?"cannot_open":"unavailable"});else if(l.state==="not_read")o.push({...c,state:"not_read",reason:l.reason});else if(!("text"in l))o.push(await $Ar(t,e,c,a.contentHash,r));else{let u=od.join(e,Ddt(c));try{po.writeFileSync(u,l.text,{mode:384}),o.push({...c,state:"read",path:u,contentMatches:l.contentMatches,version:l.version})}catch(d){r(`Testbot V3: could not write the requirement item ${c.key}: ${d instanceof Error?d.message:String(d)}`),o.push({...c,state:"not_read",reason:"unavailable"})}}}return{items:o,instructions:i}}async function $Ar(t,e,r,n,s){let i=c=>(s(`Testbot V3: could not open the uploaded document ${r.key}: ${c}`),{...r,state:"not_read",reason:"cannot_open"});if(!r.file)return i("the manifest names no file");let o;try{let c=ust.requirementFile.replace(":attemptId",t.attemptId).replace(":key",r.key);o=await t.readBytes(c,cdt)}catch(c){return i(c instanceof Error?c.message:String(c))}if((0,fdt.createHash)("sha256").update(o).digest("hex")!==n)return i("its bytes do not match its hash");let a=od.join(e,Ddt(r));try{po.writeFileSync(a,o,{mode:384})}catch(c){return i(c instanceof Error?c.message:String(c))}return{...r,state:"read",path:a,contentMatches:!0,version:n}}function Ddt(t){let e=t.source==="other"?[]:[new URL(t.site).hostname],r=t.file?adt(t.file.mediaType):"txt";return`${[t.source,...e,t.key].join("-")}.${r}`}async function eAe(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/progress`,Ast.parse(e))}async function Odt(t,e){return Est.parse(await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-events`,yst.parse(e)))}async function Mdt(t,e){await t.send("POST",`/api/v1/runner/attempts/${t.attemptId}/setup-checkpoint`,xst.parse(e))}async function Qdt(t){return(await Udt(t,"setup-checkpoint",Sst))?.checkpoint??null}async function Ldt(t){return(await Udt(t,"setup-context",Cst))?.context??null}async function Udt(t,e,r){try{return r.parse(await t.send("GET",`/api/v1/runner/attempts/${t.attemptId}/${e}`,void 0))}catch(n){if(n instanceof uo&&n.status===404)return null;throw n}}async function tAe(t,e){let r=Wu([...t.issuedTokens,...e.secrets??[]]),n=Ost(t.manifest,t.attemptNumber,e.sources.map(s=>({repository:s.repository,revision:s.revision})),Xr(e.recipe,r),e.producer);await t.send("PUT",`/api/v1/runner/attempts/${t.attemptId}/sut-recipe`,n)}function Fdt(t,e,r,n=e[0].slug,s,i={}){let{record:o,entries:a}=qdt(t,e,n),c=tu({outputsDir:t,state:QV(od.join(od.dirname(t),"state.json"))});if(!o&&Dj(i,r.system,c?.sutRequired).length>0)return{status:"none"};let l=f=>$dt(e,f),u=[],d=[];for(let{record:f,repository:h,number:b}of a)if(h&&b)u.push({repository:h,number:b});else if(h&&f.prFailure){let E=f.prDetail?`${f.prFailure}: ${f.prDetail}`:f.prFailure;d.push({repository:h,message:E,slug:f.repository??n})}else h&&f.committed&&d.push({repository:h,message:f.reason??"The tests were committed but no pull request was opened.",slug:f.repository??n});let p=new Set([...u,...d].map(({repository:f})=>f.providerRepositoryId)),m=[...new Set(r.newTestsCreated.map(f=>(f.repository??n).toLowerCase()))];for(let f of m){let h=l(f);h&&!p.has(h.providerRepositoryId)&&d.push({repository:h,message:s??"Generated tests were not proposed in a pull request.",slug:f})}return u.length&&d.length?{status:"partial",pullRequests:u,failures:d.map(({repository:f,message:h})=>({repository:f,message:h}))}:u.length?{status:"delivered",pullRequests:u}:d.length?{status:"failed",message:o?.deliveries?d.map(f=>`${f.slug}: ${f.message}`).join("; "):d[0].message}:r.newTestsCreated.length>0?{status:"failed",message:s??"Generated tests were not proposed in a pull request."}:{status:"none"}}function $dt(t,e){let r=t.find(n=>n.slug.toLowerCase()===e.toLowerCase());return r&&{provider:r.repository.provider,providerAccountId:r.repository.providerAccountId,providerRepositoryId:r.repository.providerRepositoryId}}function qdt(t,e,r){let n=od.join(t,"deliver.json"),s=po.existsSync(n)?JSON.parse(po.readFileSync(n,"utf-8")):void 0,i=s?.deliveries??(s?[s]:[]);return{record:s,entries:i.map(o=>({record:o,repository:$dt(e,o.repository??r),number:/\/pull(?:request)?\/([1-9][0-9]*)$/.exec(o.prUrl??"")?.[1]}))}}function Hdt(t,e,r=e[0].slug){let n=new Map,s=(i,o)=>{ufe.safeParse(i).success&&n.set(`${i.kind}:${i.repository.providerRepositoryId}:${o}`,i)};for(let{record:i,repository:o,number:a}of qdt(t,e,r).entries){if(!o||!i.branch)continue;let c=i.pushedCommits??(i.pushed&&i.commitSha?[i.commitSha]:[]);for(let u of c)s({kind:"branch_pushed",repository:o,branch:i.branch,commit:u},`${i.branch}:${u}`);if(!a)continue;let l=i.prAction==="retargeted"?i.retargetedAs??"created":i.prAction;l==="created"?s({kind:"pull_request_opened",repository:o,number:a,branch:i.branch},a):(l==="updated"||l==="unchanged")&&s({kind:"pull_request_edited",repository:o,number:a,branch:i.branch},a)}return[...n.values()].slice(0,lfe)}function zdt(t,e){return t.credentials.filter(r=>r.required&&!e[r.name]).map(r=>r.name)}var rAe=[/\bgh[pousr]_[A-Za-z0-9]{36,}/g,/\bgithub_pat_[A-Za-z0-9_]{22,}/g,/\bsk-ant-[A-Za-z0-9_-]{20,}/g,/\bsk-[A-Za-z0-9]{32,}/g,/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g],Gdt=t=>rAe.some(e=>new RegExp(e.source).test(t));var Oh=".skyramp/setup-events.ndjson",aO=".skyramp/setup-left-out.json",cO=".skyramp/setup-inbox.json",nAe=".skyramp/setup-inbox-read.json",eW=".skyramp/setup-hook-ran",qAr=6e4,HAr=5e3,zAr=300,ri=t=>{let e=typeof t=="string"?t:typeof t=="number"?String(t):"";return e.trim()==="null"?"":e},KV=t=>Array.isArray(t)?t:[],ZV=(t,e)=>Object.values(t).find(r=>r===ri(e).trim().toLowerCase()),GAr={running:"up",healthy:"up",ready:"up",started:"up",building:"starting",pending:"starting",installing:"starting",skipped:"out_of_scope",excluded:"out_of_scope","out-of-scope":"out_of_scope"},jAr=t=>ZV(Q_,t)??GAr[ri(t).trim().toLowerCase()]??"found",jdt=t=>y.string().uuid().safeParse(t).success,VAr=t=>XG.test(t)?t:t.replace(/[^A-Za-z0-9_-]+/g,"-").slice(0,64).replace(/^-+|-+$/g,"")||"question",WAr=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,YAr=/github\.com[/:]([^/\s]+)\/([^/\s?#]+?)(?:\.git)?(?:[/?#]|$)/i;function JAr(t){if(t.kind!=="question"||t.placeholder===void 0)return t;let{placeholder:e,...r}=t;return r}var Vdt=new RegExp(Afe.source,"g"),tW=class{constructor(e,r,n){this.checkout=e;this.send=r;this.opts=n}checkout;send;opts;offset=0;sequence=1;pending=[];started=!1;closed=!1;capped=!1;flushing=0;emptyRefused=!1;placeholderRefused=!1;unreadSince;saidHookSilent=!1;timer;queue=Promise.resolve();phase="discover";messageIds=new Set;stopHeard=!1;start(){if(!this.timer){if(!this.started){this.started=!0;let e=km.join(this.checkout,Oh);ws.mkdirSync(km.dirname(e),{recursive:!0}),ws.writeFileSync(e,"");for(let r of[aO,cO,nAe,eW])ws.rmSync(km.join(this.checkout,r),{force:!0})}this.timer=setInterval(()=>{this.flushing===0&&this.flush()},this.opts.intervalMs??HAr),this.timer.unref?.()}}async stop(){this.timer&&clearInterval(this.timer),this.timer=void 0,await this.flush()}flush(){return this.flushing+=1,this.queue=this.queue.then(()=>this.drain()).catch(e=>this.opts.warn(`Testbot V3: could not send setup events: ${XV(e)}`)).finally(()=>{this.flushing-=1}),this.queue}async drain(){if(!this.closed){if(this.collect(),this.pending.length===0&&!this.emptyRefused){await this.sendBatch([]);return}for(;this.pending.length>0&&!this.closed;){let e=this.pending.slice(0,HR);if(await this.sendBatch(e)==="unanswered")return;this.pending.splice(0,e.length)}}}async sendBatch(e){this.placeholderRefused&&(e=e.map(JAr));let r;try{r=await this.send({schemaVersion:1,events:e})}catch(n){if(n instanceof uo&&n.code==="RUN_CLOSED")return this.closed=!0,this.pending=[],"done";if(n instanceof uo&&e.length===0)return this.emptyRefused=!0,"done";if(n instanceof uo){if(e.length>1){for(let i of e){if(this.closed)return"done";if(await this.sendBatch([i])==="unanswered")return"unanswered"}return"done"}if(e[0].kind==="question"&&e[0].placeholder!==void 0)return this.placeholderRefused=!0,this.sendBatch(e);let s=e[0].kind==="log"?void 0:KAr(e[0]);return s?(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is sent as a log line: ${n.message}`),this.sendBatch([{sequence:e[0].sequence,at:e[0].at,kind:"log",phase:this.phase,text:s}])):(this.opts.warn(`Testbot V3: the app refused setup event ${e[0].sequence}, so it is dropped: ${n.message}`),"done")}return n instanceof y.ZodError?(this.opts.warn(`Testbot V3: the app's answer to setup events was not understood: ${n.issues[0]?.message}`),"done"):(this.opts.warn(`Testbot V3: could not send setup events, trying again: ${XV(n)}`),"unanswered")}try{this.writeLeftOut(r.leftOut)}catch(n){this.opts.warn(`Testbot V3: could not write ${aO}: ${XV(n)}`)}try{this.writeInbox(r.messages??[])}catch(n){this.opts.warn(`Testbot V3: could not write ${cO}: ${XV(n)}`)}return r.stop&&!this.stopHeard&&(this.stopHeard=!0,this.opts.onStop?.(r.stop.key)),"done"}collect(){if(this.capped)return;let e=km.join(this.checkout,Oh),r;try{r=ws.statSync(e).size}catch{return}if(r<this.offset&&(this.offset=0),r===this.offset)return;let n=Buffer.alloc(r-this.offset),s=ws.openSync(e,"r");try{ws.readSync(s,n,0,n.length,this.offset)}finally{ws.closeSync(s)}let i=n.lastIndexOf(10);if(i<0)return;let o=n.subarray(0,i).toString("utf-8").split(`
|
|
567
567
|
`);this.offset+=i+1;for(let a of o){if(a.trim()==="")continue;if(this.sequence>KG){this.opts.warn(`Testbot V3: the setup sent ${KG} events, the most a run may; the rest are not sent.`),this.capped=!0;return}let c=this.toEvent(a);c&&(this.pending.push(c),this.sequence+=1)}}toEvent(e){let r;try{r=JSON.parse(e)}catch{r=void 0}let n=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:void 0,s=this.opts.secrets(),i=(m,f=1/0)=>rAe.reduce((b,E)=>b.replace(E,I_),Dr(m,s)).replace(Vdt," ").trim().slice(0,f).replace(Vdt," ").trim(),o=m=>i(i(m).replace(/\s+/g," "),zAr),a={sequence:this.sequence,at:(this.opts.now?.()??new Date).toISOString()};if(!n)return this.asLog(a,o(e),"a setup event line that is not one JSON event");let c=this.putRight(n,a,i,o),l=c?yfe.safeParse(c):void 0;if(l?.success)return l.data.kind==="log"&&(this.phase=l.data.phase),l.data;let u=l&&!l.success?` (${l.error.issues[0]?.path.join(".")}: ${l.error.issues[0]?.message})`:"",d=KV(n.names).map(ri).filter(Boolean),p=o(ri(n.text)||[ri(n.name),ri(n.status)].filter(Boolean).join(": ")||(d.length?`Needs credentials: ${d.join(", ")}`:""))||o(e);return this.asLog(a,p,`a setup event the app would refuse${u}`)}putRight(e,r,n,s){let i=ZV(sfe,e.kind);if(i==="log")return{...r,kind:i,phase:ZV(FR,e.phase)??this.phase,text:s(ri(e.text))};if(i==="component"){let o=n(ri(e.file),hfe)||null,a=n(ri(e.version),ffe);return{...r,kind:i,name:n(ri(e.name),__),repository:this.repositoryOf(n(ri(e.repository)),o),file:o,status:jAr(e.status),...a&&{version:a}}}if(i==="reply")return{...r,kind:i,to:this.messageIdOf(ri(e.to).trim()),accepted:e.accepted!==!1,text:s(ri(e.text))};if(i==="question"){let o=[...new Set(KV(e.choices).map(d=>n(n(ri(d)).replace(/\s+/g," "),pfe)).filter(Boolean))].slice(0,dfe),a=ZV(VG,e.type)??"free_text";o.length===0&&(a="free_text");let c=ri(e.text);a==="free_text"&&o.length>0&&([c,o]=[`${c} (${o.join(", ")})`,[]]);let l=ri(e.id).trim(),u=n(ri(e.placeholder)).replace(/\s+/g," ");return{...r,kind:i,id:VAr(l),type:a,text:s(c),component:n(ri(e.component),__)||null,choices:o,...u&&u.length<=mfe&&{placeholder:u}}}if(i==="credentials"){let o=[...new Set(KV(e.names).map(a=>ri(a).trim().toUpperCase()).filter(a=>WA.test(a)))].slice(0,gfe);return{...r,kind:i,names:o}}if(i==="delivered")return{...r,kind:i,ids:[...new Set(KV(e.ids).map(o=>this.messageIdOf(ri(o).trim())).filter(jdt))]}}repositoryOf(e,r){let n=this.opts.repositories??[],s=l=>n.find(u=>u.slug.toLowerCase()===l.toLowerCase())?.slug,i=s(e);if(i)return i;if(WAr.test(e)&&n.length===0)return e;if(e===yn&&this.opts.shared)return yn;let o=YAr.exec(e);if(o){let l=`${o[1]}/${o[2]}`,u=s(l);if(u||n.length===0)return u??l}let a=n.find(l=>l.slug.split("/").pop()?.toLowerCase()===e.toLowerCase());if(a)return a.slug;let c=r?n.find(l=>ws.existsSync(km.join(l.path,r))):void 0;return c?c.slug:this.opts.shared?yn:n[0]?.slug??e}messageIdOf(e){if(jdt(e))return e;let r=[...this.messageIds],n=e?r.filter(s=>s.startsWith(e.toLowerCase())||e.toLowerCase().includes(s)):[];return n.length===1?n[0]:r.length===1?r[0]:e}asLog(e,r,n){if(!r){this.opts.warn(`Testbot V3: left out ${n}: it says nothing.`);return}return this.opts.warn(`Testbot V3: sent ${n} as a log line.`),{...e,kind:"log",phase:this.phase,text:r}}writeInbox(e){for(let s of e)this.messageIds.add(s.id);let r=km.join(this.checkout,cO);if(ws.writeFileSync(`${r}.tmp`,`${JSON.stringify(e)}
|
|
568
568
|
`),ws.renameSync(`${r}.tmp`,r),e.length===0||ws.existsSync(km.join(this.checkout,eW))){this.unreadSince=void 0;return}let n=(this.opts.now?.()??new Date).getTime();this.unreadSince??=n,!this.saidHookSilent&&n-this.unreadSince>=qAr&&(this.saidHookSilent=!0,this.opts.warn("Testbot V3: people sent this setup messages, but the session's setup hook has not run, so they do not reach it."))}writeLeftOut(e){let r=km.join(this.checkout,aO);ws.writeFileSync(`${r}.tmp`,`${JSON.stringify(e)}
|
|
569
569
|
`),ws.renameSync(`${r}.tmp`,r)}},XV=t=>t instanceof Error?t.message:String(t);function KAr(t){return t.kind==="component"?`${t.name}: ${t.status}`:t.kind==="reply"||t.kind==="question"||t.kind==="log"?t.text:t.kind==="credentials"?`Needs credentials: ${t.names.join(", ")}`:""}var rW=$(require("fs")),Wdt=$(require("path"));var XAr=600,ZAr=5*6e4,eyr=30,tyr="From the Setup page: a person sent this setup the messages below, each one's text in quotes. Use what they say to set up the SUT, as the setup rules say, and never put repository content, environment values or credentials in a setup event for it. A message is newer than the SUT notes: where they differ, follow the message. Before anything else, write a reply line for each instruction (setup events): what you will do differently, or accepted false only when it is not about setting up the SUT or breaks a setup rule. Then act on it, redoing only the steps it changes. An answer is to the question it names; go on with what it unblocks.",ryr=`// Skyramp Testbot: hands a running setup the Setup page's messages (SKYR-4843). Written by the runner.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/testbot-core",
|
|
3
|
-
"version": "0.0.0-pr597.
|
|
3
|
+
"version": "0.0.0-pr597.132",
|
|
4
4
|
"description": "Skyramp Testbot engine: AI-powered deterministic test generation, execution and maintenance",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"//files": "An explicit allowlist, never a glob. `dist/` is gitignored, so without this key npm's .gitignore fallback would publish a package with no engine in it; with a glob it would publish the sourcemaps, whose sourcesContent embeds every src/*.ts verbatim. eval-entry.js is a development entry and must not ship. dist/VERSION.json exists only in a release-engine.yml build. assets/gen-reference/ is the staged codegen reference corpus, which generate.ts finds at ../assets from dist/.",
|