@skyramp/testbot-core 0.13.0-v3.284 → 0.13.0-v3.285

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/post.js CHANGED
@@ -115,11 +115,11 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}fun
115
115
  `+p.slice(I+1):_+=p.slice(S),_.slice(1)}function Bt(p){let m="",E=0;for(let Q=0;Q<p.length;E>=65536?Q+=2:Q++){E=ut(p,Q);let S=ae[E];!S&&wt(E)?(m+=p[Q],E>=65536&&(m+=p[Q+1])):m+=S||Pe(E)}return m}function mi(p,m,E){let Q="",S=p.tag;for(let v=0,I=E.length;v<I;v+=1){let x=E[v];p.replacer&&(x=p.replacer.call(E,String(v),x)),(g(p,m,x,!1,!1)||typeof x>"u"&&g(p,m,null,!1,!1))&&(Q!==""&&(Q+=","+(p.condenseFlow?"":" ")),Q+=p.dump)}p.tag=S,p.dump="["+Q+"]"}function Kn(p,m,E,Q){let S="",v=p.tag;for(let I=0,x=E.length;I<x;I+=1){let _=E[I];p.replacer&&(_=p.replacer.call(E,String(I),_)),(g(p,m+1,_,!0,!0,!1,!0)||typeof _>"u"&&g(p,m+1,null,!0,!0,!1,!0))&&((!Q||S!=="")&&(S+=ct(p,m)),p.dump&&c===p.dump.charCodeAt(0)?S+="-":S+="- ",S+=p.dump)}p.tag=v,p.dump=S||"[]"}function yi(p,m,E){let Q="",S=p.tag,v=Object.keys(E);for(let I=0,x=v.length;I<x;I+=1){let _="";Q!==""&&(_+=", "),p.condenseFlow&&(_+='"');let P=v[I],O=E[P];p.replacer&&(O=p.replacer.call(E,P,O)),g(p,m,P,!1,!1)&&(p.dump.length>1024&&(_+="? "),_+=p.dump+(p.condenseFlow?'"':"")+":"+(p.condenseFlow?"":" "),g(p,m,O,!1,!1)&&(_+=p.dump,Q+=_))}p.tag=S,p.dump="{"+Q+"}"}function Ei(p,m,E,Q){let S="",v=p.tag,I=Object.keys(E);if(p.sortKeys===!0)I.sort();else if(typeof p.sortKeys=="function")I.sort(p.sortKeys);else if(p.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let x=0,_=I.length;x<_;x+=1){let P="";(!Q||S!=="")&&(P+=ct(p,m));let O=I[x],q=E[O];if(p.replacer&&(q=p.replacer.call(E,O,q)),!g(p,m+1,O,!0,!0,!0))continue;let J=p.tag!==null&&p.tag!=="?"||p.dump&&p.dump.length>1024;J&&(p.dump&&c===p.dump.charCodeAt(0)?P+="?":P+="? "),P+=p.dump,J&&(P+=ct(p,m)),g(p,m+1,q,!0,J)&&(p.dump&&c===p.dump.charCodeAt(0)?P+=":":P+=": ",P+=p.dump,S+=P)}p.tag=v,p.dump=S||"{}"}function a(p,m,E){let Q=E?p.explicitTypes:p.implicitTypes;for(let S=0,v=Q.length;S<v;S+=1){let I=Q[S];if((I.instanceOf||I.predicate)&&(!I.instanceOf||typeof m=="object"&&m instanceof I.instanceOf)&&(!I.predicate||I.predicate(m))){if(E?I.multi&&I.representName?p.tag=I.representName(m):p.tag=I.tag:p.tag="?",I.represent){let x=p.styleMap[I.tag]||I.defaultStyle,_;if(r.call(I.represent)==="[object Function]")_=I.represent(m,x);else if(s.call(I.represent,x))_=I.represent[x](m,x);else throw new e("!<"+I.tag+'> tag resolver accepts not "'+x+'" style');p.dump=_}return!0}}return!1}function g(p,m,E,Q,S,v,I){p.tag=null,p.dump=E,a(p,E,!1)||a(p,E,!0);let x=r.call(p.dump),_=Q;Q&&(Q=p.flowLevel<0||p.flowLevel>m);let P=x==="[object Object]"||x==="[object Array]",O,q;if(P&&(O=p.duplicates.indexOf(E),q=O!==-1),(p.tag!==null&&p.tag!=="?"||q||p.indent!==2&&m>0)&&(S=!1),q&&p.usedDuplicates[O])p.dump="*ref_"+O;else{if(P&&q&&!p.usedDuplicates[O]&&(p.usedDuplicates[O]=!0),x==="[object Object]")Q&&Object.keys(p.dump).length!==0?(Ei(p,m,p.dump,S),q&&(p.dump="&ref_"+O+p.dump)):(yi(p,m,p.dump),q&&(p.dump="&ref_"+O+" "+p.dump));else if(x==="[object Array]")Q&&p.dump.length!==0?(p.noArrayIndent&&!I&&m>0?Kn(p,m-1,p.dump,S):Kn(p,m,p.dump,S),q&&(p.dump="&ref_"+O+p.dump)):(mi(p,m,p.dump),q&&(p.dump="&ref_"+O+" "+p.dump));else if(x==="[object String]")p.tag!=="?"&&Vr(p,p.dump,m,v,_);else{if(x==="[object Undefined]")return!1;if(p.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+x)}if(p.tag!==null&&p.tag!=="?"){let J=encodeURI(p.tag[0]==="!"?p.tag.slice(1):p.tag).replace(/!/g,"%21");p.tag[0]==="!"?J="!"+J:J.slice(0,18)==="tag:yaml.org,2002:"?J="!!"+J.slice(18):J="!<"+J+">",p.dump=J+" "+p.dump}}return!0}function w(p,m){let E=[],Q=[];b(p,E,Q);let S=Q.length;for(let v=0;v<S;v+=1)m.duplicates.push(E[Q[v]]);m.usedDuplicates=new Array(S)}function b(p,m,E){if(p!==null&&typeof p=="object"){let Q=m.indexOf(p);if(Q!==-1)E.indexOf(Q)===-1&&E.push(Q);else if(m.push(p),Array.isArray(p))for(let S=0,v=p.length;S<v;S+=1)b(p[S],m,E);else{let S=Object.keys(p);for(let v=0,I=S.length;v<I;v+=1)b(p[S[v]],m,E)}}}function C(p,m){m=m||{};let E=new Le(m);E.noRefs||w(p,E);let Q=p;return E.replacer&&(Q=E.replacer.call({"":Q},"",Q)),g(E,0,Q,!0,!0)?E.dump+`
116
116
  `:""}return mE.dump=C,mE}var WT;function HJ(){if(WT)return Pt;WT=1;let t=GJ(),e=jJ();function n(r,s){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return Pt.Type=Jt(),Pt.Schema=zT(),Pt.FAILSAFE_SCHEMA=e0(),Pt.JSON_SCHEMA=i0(),Pt.CORE_SCHEMA=o0(),Pt.DEFAULT_SCHEMA=yE(),Pt.load=t.load,Pt.loadAll=t.loadAll,Pt.dump=e.dump,Pt.YAMLException=Hu(),Pt.types={binary:u0(),float:s0(),map:XT(),null:t0(),pairs:d0(),set:A0(),timestamp:a0(),bool:n0(),int:r0(),merge:c0(),omap:l0(),seq:ZT(),str:KT()},Pt.safeLoad=n("safeLoad","load"),Pt.safeLoadAll=n("safeLoadAll","loadAll"),Pt.safeDump=n("safeDump","dump"),Pt}var qJ=HJ(),YJ=$J(qJ),{Type:e7,Schema:t7,FAILSAFE_SCHEMA:n7,JSON_SCHEMA:p0,CORE_SCHEMA:r7,DEFAULT_SCHEMA:s7,load:As,loadAll:JJ,dump:i7,YAMLException:o7,types:a7,safeLoad:c7,safeLoadAll:u7,safeDump:l7}=YJ;var ps=t=>typeof t=="string"?t:void 0;function h0(t){let e={services:[]},n;try{let l=f0.readFileSync(t,"utf8");n=As(l,{schema:p0})}catch(l){return He(`Lenient parse: failed to read/parse ${t}: ${l.message}`),e}if(!n||typeof n!="object"||Array.isArray(n))return He(`Lenient parse: ${t} did not contain a YAML object`),e;let r=n,s=r.metadata&&typeof r.metadata=="object"?r.metadata:void 0,i=s?{executorVersion:ps(s.executorVersion),mcpVersion:ps(s.mcpVersion)}:void 0,c=(Array.isArray(r.services)?r.services:[]).reduce((l,d,A)=>{if(!d||typeof d!="object"||Array.isArray(d))return He(`Lenient parse: services[${A}] is not an object \u2014 skipping`),l;let f=d,h=ps(f.serviceName);if(!h)return He(`Lenient parse: services[${A}] missing or non-string serviceName \u2014 skipping`),l;let y=f.api&&typeof f.api=="object"?f.api:void 0,B=f.runtimeDetails&&typeof f.runtimeDetails=="object"?f.runtimeDetails:void 0;return l.push({serviceName:h,language:ps(f.language),framework:ps(f.framework),testDirectory:ps(f.testDirectory),api:y?{baseUrl:ps(y.baseUrl)}:void 0,runtimeDetails:B?{serverStartCommand:ps(B.serverStartCommand),serverTeardownCommand:ps(B.serverTeardownCommand)}:void 0}),l},[]);return{metadata:i,services:c}}async function m0(t){let e=g0.resolve(t.workingDirectory),n=new cp(e),r=[],s=t.targetSetupCommand,i=t.targetTeardownCommand,o=t.skyrampExecutorVersion,c=t.skyrampMcpVersion;if(await n.exists()){Dn(`Found ${n.getConfigPath()}, loading workspace configuration...`);try{let d;try{d=await n.read()}catch(f){He(`${n.getConfigPath()} failed strict validation: ${f.message}. Re-reading with per-field lenient parse \u2014 invalid fields will fall back to action input defaults.`),d=h0(n.getConfigPath())}d.metadata&&(!o&&d.metadata.executorVersion&&(o=d.metadata.executorVersion),!c&&d.metadata.mcpVersion&&(c=d.metadata.mcpVersion));for(let f of d.services??[])r.push({serviceName:f.serviceName,language:f.language,framework:f.framework,baseUrl:f.api?.baseUrl,testDirectory:f.testDirectory});let A=(d.services??[])[0];if(A){!s&&A.runtimeDetails?.serverStartCommand&&(s=A.runtimeDetails.serverStartCommand);let f=A.runtimeDetails?.serverTeardownCommand;!i&&typeof f=="string"&&(i=f)}}catch(d){He(`Failed to parse ${n.getConfigPath()}: ${d.message} \u2014 falling back to action input defaults`)}}else Mu("No .skyramp/workspace.yml found, using action input defaults");o||(o="v1.3.54"),c||(c="latest"),s||(s="docker compose up -d --build");let l={targetSetupCommand:s,authTokenCommand:t.authTokenCommand,targetTeardownCommand:i,skipTargetTeardown:t.skipTargetTeardown,skyrampExecutorVersion:o,skyrampMcpVersion:c,skyrampMcpSource:t.skyrampMcpSource,skyrampMcpGithubRef:t.skyrampMcpGithubRef,nodeVersion:t.nodeVersion,skipTargetSetup:t.skipTargetSetup,targetReadyCheckCommand:t.targetReadyCheckCommand,targetReadyCheckTimeout:t.targetReadyCheckTimeout,targetReadyCheckInterval:t.targetReadyCheckInterval,targetReadyCheckDiagnosticsCommand:t.targetReadyCheckDiagnosticsCommand,autoCommit:t.autoCommit,commitMessage:t.commitMessage,generatedTestsMode:t.generatedTestsMode,postPrComment:t.postPrComment,testExecutionTimeout:t.testExecutionTimeout,maxRecommendations:t.maxRecommendations,maxGenerate:t.maxGenerate,perTestMaxFixAttempts:t.perTestMaxFixAttempts,testbotMaxRetries:t.testbotMaxRetries,testbotRetryDelay:t.testbotRetryDelay,testbotTimeout:t.testbotTimeout,targetSetupRetries:t.targetSetupRetries,targetSetupRetryDelay:t.targetSetupRetryDelay,authTokenRetries:t.authTokenRetries,authTokenRetryDelay:t.authTokenRetryDelay,reportCollapsed:t.reportCollapsed,language:t.language,enableDebug:t.enableDebug,testRepoPath:t.testRepoPath,relatedRepoPaths:t.relatedRepoPaths,services:r};GA("Resolved configuration");for(let[d,A]of Object.entries(l))d==="authTokenCommand"?Dn(` ${d}: [REDACTED]`):d==="services"?Dn(` ${d}: ${JSON.stringify(A)}`):Dn(` ${d}: ${A}`);return jA(),l}qt();qt();dy();var E0=ce(require("child_process")),EE=class extends Error{constructor(e){super(e),this.name="ExecTimeoutError"}},lp=class extends Error{constructor(e){super(e),this.name="ExecAbortedError"}};function y0(t,e){if(!(!t||t.destroyed||t.writableEnded))try{t.write(e)}catch(n){He(`stream write failed: ${n instanceof Error?n.message:String(n)}`)}}async function C0(t,e=[],n={}){let r="",s="",i={cwd:n.cwd,silent:n.silent??!1,ignoreReturnCode:n.ignoreReturnCode??!1,env:n.env?{...process.env,...n.env}:void 0,input:n.input,listeners:{stdout:c=>{r+=c.toString(),y0(n.stdoutStream,c)},stderr:c=>{s+=c.toString()}}};if(n.timeout||n.signal){let c=n.signal;return c?.aborted?Promise.reject(new lp(`Command aborted before start: ${t}`)):new Promise((l,d)=>{let A=E0.spawn(t,e,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});A.stdout?.on("data",R=>{r+=R.toString(),n.silent||process.stdout.write(R),y0(n.stdoutStream,R)}),A.stderr?.on("data",R=>{s+=R.toString(),n.silent||process.stderr.write(R)}),n.input&&A.stdin?.end(n.input);let f=()=>{B&&clearTimeout(B),c?.removeEventListener("abort",y)},h=R=>{f();try{A.kill("SIGTERM")}catch{}d(R)},y=()=>h(new lp(`Command aborted: ${t}`)),B=n.timeout?setTimeout(()=>h(new EE(`Command timed out after ${Math.round(n.timeout/6e4)}m: ${t}`)),n.timeout):void 0;c?.addEventListener("abort",y,{once:!0}),A.on("close",R=>{f();let F=R??1;F!==0&&!n.ignoreReturnCode?d(new Error(`The process '${t}' failed with exit code ${F}`)):l({exitCode:F,stdout:r,stderr:s})}),A.on("error",R=>{f(),d(R)})})}return{exitCode:await Xk(t,e,i),stdout:r,stderr:s}}async function I0(t,e){GA(t);try{return await e()}finally{jA()}}async function w0(t,e){await I0("Tearing down services",async()=>{if(t.skipTargetTeardown){Mu("Skipping service teardown (skipTargetTeardown=true)");return}if(!t.targetTeardownCommand){Dn("No targetTeardownCommand configured, skipping teardown");return}Dn(`Running teardown command: ${t.targetTeardownCommand}`);try{await C0("bash",["-c",t.targetTeardownCommand],{cwd:e}),Mu("Services torn down successfully")}catch(n){let r=n instanceof Error?n.message:String(n);He(`Service teardown command failed (non-fatal): ${r}`)}})}qt();qt();var fo=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(fo||{});var CE=t=>`${t.source}:${t.site??""}:${t.key}`;var qu=/^pasted-[0-9a-f]{16}$/,Za=/^file-[0-9a-f]{16}$/,Yu=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(Yu||{}),Ju=t=>t.trim().toUpperCase(),b0=(t,e)=>{let n=t.trim();return qu.test(n.toLowerCase())?"Pasted text":Za.test(n.toLowerCase())?e?.get(Ju(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()};var dp=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(dp||{}),ho=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(ho||{}),Xa=(k=>(k.RelatedChangeConflict="related_change_conflict",k.ReferenceOutsideTarget="reference_outside_target",k.SourceAccessLost="source_access_lost",k.ConfigurationIncomplete="configuration_incomplete",k.CredentialUnavailable="credential_unavailable",k.WorkflowBindingUnverified="workflow_binding_unverified",k.WorkflowRefUnprotected="workflow_ref_unprotected",k.BedrockWorkflowRequired="bedrock_workflow_required",k.DeploymentReview="deployment_review",k.SutRevisionMismatch="sut_revision_mismatch",k.IsolationUnavailable="isolation_unavailable",k.EvidenceInsufficient="evidence_insufficient",k.ConfigurationUnresolved="configuration_unresolved",k.ModelProviderDenied="model_provider_denied",k.ModelProviderUnavailable="model_provider_unavailable",k.RunnerProviderNotReady="runner_provider_not_ready",k.MergeConflict="merge_conflict",k))(Xa||{}),Zs=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(Zs||{}),Ap=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(Ap||{}),pp=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(pp||{});var fp=(n=>(n.Probe="probe",n.Agent="agent",n))(fp||{}),hp=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(hp||{}),gp=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(gp||{});var ec=t=>t.slice(0,12);var zJ=["generate-unit","native-run"],I7=["preflight","plan","write",...zJ,"report","deliver"];var yp=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(yp||{});var vl=ce(require("path"));var Ep="\xABredacted\xBB";function KJ(t){return t.replace(/AUTHORIZATION: (basic|bearer) \S+/gi,"AUTHORIZATION: $1 ***").replace(/x-access-token:[^@\s]+@/gi,"x-access-token:***@")}function bn(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(Ep));return n}function Cp(t,e){return bn(KJ(t),e)}var R7=new TextDecoder("utf-8",{fatal:!0});function yt(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=l=>{try{let d=JSON.parse(l);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(l){i=l instanceof Error?l.message:String(l)}let o=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let l=o.length-1;l>=0;l--){let d=r(o[l][1].trim());if(d!==void 0)return{value:d}}let c;for(let l=n.indexOf("{");l!==-1;l=n.indexOf("{",l+1)){let d=0,A=!1,f=!1;for(let h=l;h<n.length;h++){let y=n[h];if(f){f=!1;continue}if(y==="\\"){f=A;continue}if(y==='"'){A=!A;continue}if(!A){if(y==="{")d++;else if(y==="}"&&(d--,d===0)){let B=r(n.slice(l,h+1));B!==void 0&&Object.keys(B).length>0&&(c=B,l=h);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:i?{error:`final message is not valid JSON \u2014 ${i}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${ZJ(bn(n,e))}"`}}var B0=240;function ZJ(t){let e=t.replace(/\s+/g," ").trim();return e.length<=B0?e:`\u2026${e.slice(-B0)}`}var Wu=ce(require("fs")),zu=ce(require("path"));var XJ=8;function kt(t,e,n={}){let r=e.slice(0,XJ),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}function go(t){if(Wu.existsSync(t))try{return JSON.parse(Wu.readFileSync(t,"utf-8"))}catch{return}}function Ze(t,e){return go(zu.join(t.outputsDir,e))}function Un(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:kt(this.name,s,{fatal:!0})}}}function Ku(t){return t.replace(/\s+/g," ").trim()}var Ip=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var u={};If(u,{BRAND:()=>QW,DIRTY:()=>mo,EMPTY_PATH:()=>rW,INVALID:()=>Ae,NEVER:()=>uz,OK:()=>Ot,ParseStatus:()=>xt,Schema:()=>Se,ZodAny:()=>ti,ZodArray:()=>ms,ZodBigInt:()=>Eo,ZodBoolean:()=>Co,ZodBranded:()=>Xu,ZodCatch:()=>To,ZodDate:()=>Io,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>Bp,ZodEffects:()=>Ln,ZodEnum:()=>Ro,ZodError:()=>on,ZodFirstPartyTypeKind:()=>me,ZodFunction:()=>Sp,ZodIntersection:()=>Qo,ZodIssueCode:()=>G,ZodLazy:()=>So,ZodLiteral:()=>vo,ZodMap:()=>ac,ZodNaN:()=>uc,ZodNativeEnum:()=>ko,ZodNever:()=>lr,ZodNull:()=>bo,ZodNullable:()=>Fr,ZodNumber:()=>yo,ZodObject:()=>an,ZodOptional:()=>Pn,ZodParsedType:()=>X,ZodPipeline:()=>el,ZodPromise:()=>ni,ZodReadonly:()=>No,ZodRecord:()=>Qp,ZodSchema:()=>Se,ZodSet:()=>cc,ZodString:()=>ei,ZodSymbol:()=>ic,ZodTransformer:()=>Ln,ZodTuple:()=>Dr,ZodType:()=>Se,ZodUndefined:()=>wo,ZodUnion:()=>Bo,ZodUnknown:()=>gs,ZodVoid:()=>oc,addIssueToContext:()=>K,any:()=>FW,array:()=>PW,bigint:()=>kW,boolean:()=>_0,coerce:()=>cz,custom:()=>N0,date:()=>xW,datetimeRegex:()=>x0,defaultErrorMap:()=>fs,discriminatedUnion:()=>VW,effect:()=>ez,enum:()=>KW,function:()=>JW,getErrorMap:()=>nc,getParsedType:()=>Nr,instanceof:()=>vW,intersection:()=>GW,isAborted:()=>wp,isAsync:()=>rc,isDirty:()=>bp,isValid:()=>Xs,late:()=>SW,lazy:()=>WW,literal:()=>zW,makeIssue:()=>Zu,map:()=>qW,nan:()=>RW,nativeEnum:()=>ZW,never:()=>MW,null:()=>DW,nullable:()=>nz,number:()=>F0,object:()=>OW,objectUtil:()=>IE,oboolean:()=>az,onumber:()=>oz,optional:()=>tz,ostring:()=>iz,pipeline:()=>sz,preprocess:()=>rz,promise:()=>XW,quotelessJson:()=>eW,record:()=>HW,set:()=>YW,setErrorMap:()=>nW,strictObject:()=>LW,string:()=>D0,symbol:()=>TW,transformer:()=>ez,tuple:()=>jW,undefined:()=>NW,union:()=>$W,unknown:()=>_W,util:()=>xe,void:()=>UW});var xe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),o={};for(let c of i)o[c]=s[c];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(let o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(xe||(xe={}));var IE;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(IE||(IE={}));var X=xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nr=t=>{switch(typeof t){case"undefined":return X.undefined;case"string":return X.string;case"number":return Number.isNaN(t)?X.nan:X.number;case"boolean":return X.boolean;case"function":return X.function;case"bigint":return X.bigint;case"symbol":return X.symbol;case"object":return Array.isArray(t)?X.array:t===null?X.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?X.promise:typeof Map<"u"&&t instanceof Map?X.map:typeof Set<"u"&&t instanceof Set?X.set:typeof Date<"u"&&t instanceof Date?X.date:X.object;default:return X.unknown}};var G=xe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),eW=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),on=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let c=r,l=0;for(;l<o.path.length;){let d=o.path[l],A=l===o.path.length-1;if(d==="_errors"){A&&c._errors.push(n(o)),l++;continue}Object.prototype.hasOwnProperty.call(c,d)||(d==="__proto__"?Object.defineProperty(c,d,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[d]={_errors:[]}),c=c[d],A&&c._errors.push(n(o)),l++}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};on.create=t=>new on(t);var tW=(t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===X.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,xe.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${xe.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${xe.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${xe.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:xe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case G.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case G.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=e.defaultError,xe.assertNever(t)}return{message:n}},fs=tW;var Q0=fs;function nW(t){Q0=t}function nc(){return Q0}var Zu=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)c=d(o,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},rW=[];function K(t,e){let n=nc(),r=Zu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===fs?void 0:fs].filter(s=>!!s)});t.common.issues.push(r)}var xt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return Ae;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,o=await s.value;r.push({key:i,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ae;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}},Ae=Object.freeze({status:"aborted"}),mo=t=>({status:"dirty",value:t}),Ot=t=>({status:"valid",value:t}),wp=t=>t.status==="aborted",bp=t=>t.status==="dirty",Xs=t=>t.status==="valid",rc=t=>typeof Promise<"u"&&t instanceof Promise;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(re||(re={}));var On=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},S0=(t,e)=>{if(Xs(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new on(t.common.issues);return this._error=n,this._error}}};function be(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,c)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??r??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:l??n??c.defaultError}},description:s}}var Se=class{get description(){return this._def.description}_getType(e){return Nr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xt,ctx:{common:e.parent.common,data:e.data,parsedType:Nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(rc(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)},s=this._parseSync({data:e,path:r.path,parent:r});return S0(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Xs(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Xs(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(rc(s)?s:Promise.resolve(s));return S0(r,i)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{let o=e(s),c=()=>i.addIssue({code:G.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Ln({schema:this,typeName:me.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Pn.create(this,this._def)}nullable(){return Fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ms.create(this)}promise(){return ni.create(this,this._def)}or(e){return Bo.create([this,e],this._def)}and(e){return Qo.create(this,e,this._def)}transform(e){return new Ln({...be(this._def),schema:this,typeName:me.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new xo({...be(this._def),innerType:this,defaultValue:n,typeName:me.ZodDefault})}brand(){return new Xu({typeName:me.ZodBranded,type:this,...be(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new To({...be(this._def),innerType:this,catchValue:n,typeName:me.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return el.create(this,e)}readonly(){return No.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sW=/^c[^\s-]{8,}$/i,iW=/^[0-9a-z]+$/,oW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aW=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,cW=/^[a-z0-9_-]{21}$/i,uW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lW=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,dW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AW="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",wE,pW=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fW=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,hW=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,gW=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mW=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yW=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,R0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",EW=new RegExp(`^${R0}$`);function k0(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function CW(t){return new RegExp(`^${k0(t)}$`)}function x0(t){let e=`${R0}T${k0(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function IW(t,e){return!!((e==="v4"||!e)&&pW.test(t)||(e==="v6"||!e)&&hW.test(t))}function wW(t,e){if(!uW.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function bW(t,e){return!!((e==="v4"||!e)&&fW.test(t)||(e==="v6"||!e)&&gW.test(t))}var ei=class t extends Se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==X.string){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.string,received:i.parsedType}),Ae}let r=new xt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,c=e.data.length<i.value;(o||c)&&(s=this._getOrReturnCtx(e,s),o?K(s,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&K(s,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")dW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"email",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")wE||(wE=new RegExp(AW,"u")),wE.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"emoji",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")aW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"uuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")cW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"nanoid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")sW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")iW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid2",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")oW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ulid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),K(s,{validation:"url",code:G.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"regex",code:G.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?x0(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?EW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?CW(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?lW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"duration",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?IW(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ip",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?wW(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"jwt",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?bW(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cidr",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?mW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?yW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64url",code:G.invalid_string,message:i.message}),r.dirty()):xe.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:G.invalid_string,...re.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...re.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...re.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...re.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...re.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...re.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...re.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...re.errToObj(n)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ei.create=t=>new ei({checks:[],typeName:me.ZodString,coerce:t?.coerce??!1,...be(t)});function BW(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var yo=class t extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==X.number){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.number,received:i.parsedType}),Ae}let r,s=new xt;for(let i of this._def.checks)i.kind==="int"?xe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),K(r,{code:G.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?BW(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_finite,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&xe.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};yo.create=t=>new yo({checks:[],typeName:me.ZodNumber,coerce:t?.coerce||!1,...be(t)});var Eo=class t extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==X.bigint)return this._getInvalidInput(e);let r,s=new xt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return K(n,{code:G.invalid_type,expected:X.bigint,received:n.parsedType}),Ae}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Eo.create=t=>new Eo({checks:[],typeName:me.ZodBigInt,coerce:t?.coerce??!1,...be(t)});var Co=class extends Se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==X.boolean){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.boolean,received:r.parsedType}),Ae}return Ot(e.data)}};Co.create=t=>new Co({typeName:me.ZodBoolean,coerce:t?.coerce||!1,...be(t)});var Io=class t extends Se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==X.date){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.date,received:i.parsedType}),Ae}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_date}),Ae}let r=new xt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):xe.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Io.create=t=>new Io({checks:[],coerce:t?.coerce||!1,typeName:me.ZodDate,...be(t)});var ic=class extends Se{_parse(e){if(this._getType(e)!==X.symbol){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.symbol,received:r.parsedType}),Ae}return Ot(e.data)}};ic.create=t=>new ic({typeName:me.ZodSymbol,...be(t)});var wo=class extends Se{_parse(e){if(this._getType(e)!==X.undefined){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.undefined,received:r.parsedType}),Ae}return Ot(e.data)}};wo.create=t=>new wo({typeName:me.ZodUndefined,...be(t)});var bo=class extends Se{_parse(e){if(this._getType(e)!==X.null){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.null,received:r.parsedType}),Ae}return Ot(e.data)}};bo.create=t=>new bo({typeName:me.ZodNull,...be(t)});var ti=class extends Se{constructor(){super(...arguments),this._any=!0}_parse(e){return Ot(e.data)}};ti.create=t=>new ti({typeName:me.ZodAny,...be(t)});var gs=class extends Se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ot(e.data)}};gs.create=t=>new gs({typeName:me.ZodUnknown,...be(t)});var lr=class extends Se{_parse(e){let n=this._getOrReturnCtx(e);return K(n,{code:G.invalid_type,expected:X.never,received:n.parsedType}),Ae}};lr.create=t=>new lr({typeName:me.ZodNever,...be(t)});var oc=class extends Se{_parse(e){if(this._getType(e)!==X.undefined){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.void,received:r.parsedType}),Ae}return Ot(e.data)}};oc.create=t=>new oc({typeName:me.ZodVoid,...be(t)});var ms=class t extends Se{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==X.array)return K(n,{code:G.invalid_type,expected:X.array,received:n.parsedType}),Ae;if(s.exactLength!==null){let o=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(o||c)&&(K(n,{code:o?G.too_big:G.too_small,minimum:c?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(K(n,{code:G.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(K(n,{code:G.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>s.type._parseAsync(new On(n,o,n.path,c)))).then(o=>xt.mergeArray(r,o));let i=[...n.data].map((o,c)=>s.type._parseSync(new On(n,o,n.path,c)));return xt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:re.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:re.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:re.toString(n)}})}nonempty(e){return this.min(1,e)}};ms.create=(t,e)=>new ms({type:t,minLength:null,maxLength:null,exactLength:null,typeName:me.ZodArray,...be(e)});function sc(t){if(t instanceof an){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Pn.create(sc(r))}return new an({...t._def,shape:()=>e})}else return t instanceof ms?new ms({...t._def,type:sc(t.element)}):t instanceof Pn?Pn.create(sc(t.unwrap())):t instanceof Fr?Fr.create(sc(t.unwrap())):t instanceof Dr?Dr.create(t.items.map(e=>sc(e))):t}var an=class t extends Se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=xe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==X.object){let d=this._getOrReturnCtx(e);return K(d,{code:G.invalid_type,expected:X.object,received:d.parsedType}),Ae}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof lr&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||c.push(d);let l=[];for(let d of o){let A=i[d],f=s.data[d];l.push({key:{status:"valid",value:d},value:A._parse(new On(s,f,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof lr){let d=this._def.unknownKeys;if(d==="passthrough")for(let A of c)l.push({key:{status:"valid",value:A},value:{status:"valid",value:s.data[A]}});else if(d==="strict")c.length>0&&(K(s,{code:G.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let A of c){let f=s.data[A];l.push({key:{status:"valid",value:A},value:d._parse(new On(s,f,s.path,A)),alwaysSet:A in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let A of l){let f=await A.key,h=await A.value;d.push({key:f,value:h,alwaysSet:A.alwaysSet})}return d}).then(d=>xt.mergeObjectSync(r,d)):xt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:re.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:me.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of xe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of xe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return sc(this)}partial(e){let n={};for(let r of xe.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of xe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Pn;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return T0(xe.objectKeys(this.shape))}};an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:lr.create(),typeName:me.ZodObject,...be(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:lr.create(),typeName:me.ZodObject,...be(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:lr.create(),typeName:me.ZodObject,...be(e)});var Bo=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let o=i.map(c=>new on(c.ctx.common.issues));return K(n,{code:G.invalid_union,unionErrors:o}),Ae}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},A=l._parseSync({data:n.data,path:n.path,parent:d});if(A.status==="valid")return A;A.status==="dirty"&&!i&&(i={result:A,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=o.map(l=>new on(l));return K(n,{code:G.invalid_union,unionErrors:c}),Ae}}get options(){return this._def.options}};Bo.create=(t,e)=>new Bo({options:t,typeName:me.ZodUnion,...be(e)});var hs=t=>t instanceof So?hs(t.schema):t instanceof Ln?hs(t.innerType()):t instanceof vo?[t.value]:t instanceof Ro?t.options:t instanceof ko?xe.objectValues(t.enum):t instanceof xo?hs(t._def.innerType):t instanceof wo?[void 0]:t instanceof bo?[null]:t instanceof Pn?[void 0,...hs(t.unwrap())]:t instanceof Fr?[null,...hs(t.unwrap())]:t instanceof Xu||t instanceof No?hs(t.unwrap()):t instanceof To?hs(t._def.innerType):[],Bp=class t extends Se{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.object)return K(n,{code:G.invalid_type,expected:X.object,received:n.parsedType}),Ae;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(K(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let o=hs(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of o){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:me.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...be(r)})}};function bE(t,e){let n=Nr(t),r=Nr(e);if(t===e)return{valid:!0,data:t};if(n===X.object&&r===X.object){let s=xe.objectKeys(e),i=xe.objectKeys(t).filter(c=>s.indexOf(c)!==-1),o={...t,...e};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let c of i){if(c==="__proto__")continue;let l=bE(t[c],e[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(n===X.array&&r===X.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let o=t[i],c=e[i],l=bE(o,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===X.date&&r===X.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Qo=class extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(wp(i)||wp(o))return Ae;let c=bE(i.value,o.value);return c.valid?((bp(i)||bp(o))&&n.dirty(),{status:n.value,value:c.data}):(K(r,{code:G.invalid_intersection_types}),Ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Qo.create=(t,e,n)=>new Qo({left:t,right:e,typeName:me.ZodIntersection,...be(n)});var Dr=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.array)return K(r,{code:G.invalid_type,expected:X.array,received:r.parsedType}),Ae;if(r.data.length<this._def.items.length)return K(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ae;!this._def.rest&&r.data.length>this._def.items.length&&(K(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((o,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new On(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>xt.mergeArray(n,o)):xt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Dr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dr({items:t,typeName:me.ZodTuple,rest:null,...be(e)})};var Qp=class t extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.object)return K(r,{code:G.invalid_type,expected:X.object,received:r.parsedType}),Ae;let s=[],i=this._def.keyType,o=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new On(r,c,r.path,c)),value:o._parse(new On(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?xt.mergeObjectAsync(n,s):xt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Se?new t({keyType:e,valueType:n,typeName:me.ZodRecord,...be(r)}):new t({keyType:ei.create(),valueType:e,typeName:me.ZodRecord,...be(n)})}},ac=class extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.map)return K(r,{code:G.invalid_type,expected:X.map,received:r.parsedType}),Ae;let s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([c,l],d)=>({key:s._parse(new On(r,c,r.path,[d,"key"])),value:i._parse(new On(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of o){let d=await l.key,A=await l.value;if(d.status==="aborted"||A.status==="aborted")return Ae;(d.status==="dirty"||A.status==="dirty")&&n.dirty(),c.set(d.value,A.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let l of o){let d=l.key,A=l.value;if(d.status==="aborted"||A.status==="aborted")return Ae;(d.status==="dirty"||A.status==="dirty")&&n.dirty(),c.set(d.value,A.value)}return{status:n.value,value:c}}}};ac.create=(t,e,n)=>new ac({valueType:e,keyType:t,typeName:me.ZodMap,...be(n)});var cc=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.set)return K(r,{code:G.invalid_type,expected:X.set,received:r.parsedType}),Ae;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(K(r,{code:G.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(K(r,{code:G.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function o(l){let d=new Set;for(let A of l){if(A.status==="aborted")return Ae;A.status==="dirty"&&n.dirty(),d.add(A.value)}return{status:n.value,value:d}}let c=[...r.data.values()].map((l,d)=>i._parse(new On(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>o(l)):o(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:re.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:re.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};cc.create=(t,e)=>new cc({valueType:t,minSize:null,maxSize:null,typeName:me.ZodSet,...be(e)});var Sp=class t extends Se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.function)return K(n,{code:G.invalid_type,expected:X.function,received:n.parsedType}),Ae;function r(c,l){return Zu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nc(),fs].filter(d=>!!d),issueData:{code:G.invalid_arguments,argumentsError:l}})}function s(c,l){return Zu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nc(),fs].filter(d=>!!d),issueData:{code:G.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ni){let c=this;return Ot(async function(...l){let d=new on([]),A=await c._def.args.parseAsync(l,i).catch(y=>{throw d.addIssue(r(l,y)),d}),f=await Reflect.apply(o,this,A);return await c._def.returns._def.type.parseAsync(f,i).catch(y=>{throw d.addIssue(s(f,y)),d})})}else{let c=this;return Ot(function(...l){let d=c._def.args.safeParse(l,i);if(!d.success)throw new on([r(l,d.error)]);let A=Reflect.apply(o,this,d.data),f=c._def.returns.safeParse(A,i);if(!f.success)throw new on([s(A,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Dr.create(e).rest(gs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Dr.create([]).rest(gs.create()),returns:n||gs.create(),typeName:me.ZodFunction,...be(r)})}},So=class extends Se{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};So.create=(t,e)=>new So({getter:t,typeName:me.ZodLazy,...be(e)});var vo=class extends Se{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return K(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),Ae}return{status:"valid",value:e.data}}get value(){return this._def.value}};vo.create=(t,e)=>new vo({value:t,typeName:me.ZodLiteral,...be(e)});function T0(t,e){return new Ro({values:t,typeName:me.ZodEnum,...be(e)})}var Ro=class t extends Se{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return K(n,{expected:xe.joinValues(r),received:n.parsedType,code:G.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return K(n,{received:n.data,code:G.invalid_enum_value,options:r}),Ae}return Ot(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ro.create=T0;var ko=class extends Se{_parse(e){let n=xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==X.string&&r.parsedType!==X.number){let s=xe.objectValues(n);return K(r,{expected:xe.joinValues(s),received:r.parsedType,code:G.invalid_type}),Ae}if(this._cache||(this._cache=new Set(xe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=xe.objectValues(n);return K(r,{received:r.data,code:G.invalid_enum_value,options:s}),Ae}return Ot(e.data)}get enum(){return this._def.values}};ko.create=(t,e)=>new ko({values:t,typeName:me.ZodNativeEnum,...be(e)});var ni=class extends Se{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.promise&&n.common.async===!1)return K(n,{code:G.invalid_type,expected:X.promise,received:n.parsedType}),Ae;let r=n.parsedType===X.promise?n.data:Promise.resolve(n.data);return Ot(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ni.create=(t,e)=>new ni({type:t,typeName:me.ZodPromise,...be(e)});var Ln=class extends Se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{K(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return Ae;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Ae:l.status==="dirty"?mo(l.value):n.value==="dirty"?mo(l.value):l});{if(n.value==="aborted")return Ae;let c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?Ae:c.status==="dirty"?mo(c.value):n.value==="dirty"?mo(c.value):c}}if(s.type==="refinement"){let o=c=>{let l=s.refinement(c,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Ae:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Ae:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Xs(o))return Ae;let c=s.transform(o.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Xs(o)?Promise.resolve(s.transform(o.value,i)).then(c=>({status:n.value,value:c})):Ae);xe.assertNever(s)}};Ln.create=(t,e,n)=>new Ln({schema:t,typeName:me.ZodEffects,effect:e,...be(n)});Ln.createWithPreprocess=(t,e,n)=>new Ln({schema:e,effect:{type:"preprocess",transform:t},typeName:me.ZodEffects,...be(n)});var Pn=class extends Se{_parse(e){return this._getType(e)===X.undefined?Ot(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pn.create=(t,e)=>new Pn({innerType:t,typeName:me.ZodOptional,...be(e)});var Fr=class extends Se{_parse(e){return this._getType(e)===X.null?Ot(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fr.create=(t,e)=>new Fr({innerType:t,typeName:me.ZodNullable,...be(e)});var xo=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===X.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:me.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...be(e)});var To=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return rc(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new on(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new on(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};To.create=(t,e)=>new To({innerType:t,typeName:me.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...be(e)});var uc=class extends Se{_parse(e){if(this._getType(e)!==X.nan){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.nan,received:r.parsedType}),Ae}return{status:"valid",value:e.data}}};uc.create=t=>new uc({typeName:me.ZodNaN,...be(t)});var QW=Symbol("zod_brand"),Xu=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},el=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ae:i.status==="dirty"?(n.dirty(),mo(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ae:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:me.ZodPipeline})}},No=class extends Se{_parse(e){let n=this._def.innerType._parse(e),r=s=>(Xs(s)&&(s.value=Object.freeze(s.value)),s);return rc(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};No.create=(t,e)=>new No({innerType:t,typeName:me.ZodReadonly,...be(e)});function v0(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function N0(t,e={},n){return t?ti.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let c=v0(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let o=v0(e,r),c=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:c})}}):ti.create()}var SW={object:an.lazycreate},me;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(me||(me={}));var vW=(t,e={message:`Input not instance of ${t.name}`})=>N0(n=>n instanceof t,e),D0=ei.create,F0=yo.create,RW=uc.create,kW=Eo.create,_0=Co.create,xW=Io.create,TW=ic.create,NW=wo.create,DW=bo.create,FW=ti.create,_W=gs.create,MW=lr.create,UW=oc.create,PW=ms.create,OW=an.create,LW=an.strictCreate,$W=Bo.create,VW=Bp.create,GW=Qo.create,jW=Dr.create,HW=Qp.create,qW=ac.create,YW=cc.create,JW=Sp.create,WW=So.create,zW=vo.create,KW=Ro.create,ZW=ko.create,XW=ni.create,ez=Ln.create,tz=Pn.create,nz=Fr.create,rz=Ln.createWithPreprocess,sz=el.create,iz=()=>D0().optional(),oz=()=>F0().optional(),az=()=>_0().optional(),cz={string:(t=>ei.create({...t,coerce:!0})),number:(t=>yo.create({...t,coerce:!0})),boolean:(t=>Co.create({...t,coerce:!0})),bigint:(t=>Eo.create({...t,coerce:!0})),date:(t=>Io.create({...t,coerce:!0}))};var uz=Ae;function lz(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),o=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${o}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}function Bn(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=(i,o)=>o.reduce((c,l)=>c&&typeof c=="object"?c[l]:void 0,i),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((o,{path:c})=>M0(o,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:lz(n.error)}}function M0(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=M0(s[n],r):delete s[n],s}var U0=require("child_process");var tl=ce(require("path"));var ys="Skyramp Testbot",ri="test-bot@skyramp.dev";var dz=(t,e)=>(0,U0.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();function P0(t){let e="";try{e=dz(t,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(e);return n&&!e.startsWith("/")&&!e.startsWith(".")?`${n[1]}/${n[2]}`:`local/${tl.basename(tl.resolve(t)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}var Aee=new Set(Object.values(Zs));var pee=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var BE=new Map;function Az(t){return t.repositorySlug?t.repositorySlug:(BE.has(t.repositoryPath)||BE.set(t.repositoryPath,P0(t.repositoryPath)),BE.get(t.repositoryPath))}function dr(t){return[{slug:Az(t),path:t.repositoryPath,writable:!0,working:!0},...(t.relatedRepos??[]).map(e=>({slug:e.slug,path:e.path,writable:e.writable===!0,working:!1}))]}var QE=(t,e)=>t.toLowerCase()===e.toLowerCase();function SE(t,e){return e?.trim()?t.find(n=>QE(n.slug,e.trim())):t[0]}function lc(t,e){return SE(dr(t),e)}var pz=(t,e)=>`${e} is not a repository of this run (${dr(t).map(n=>n.slug).join(", ")})`;function nl(t,e){let n=lc(t,e);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${dr(t).filter(r=>r.writable).map(r=>r.slug).join(", ")}`}:{error:pz(t,e)}}function vE(t){let e=t.split(/[\\/]/)[0];return e===".skyramp"||e===".testbot"}var Cs=ce(require("path"));var si=["-c","core.fsmonitor=false"],fz=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),RE=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Lt(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&RE.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(fz.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}var V0=require("child_process");var $0=ce(require("path"));var Do=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Do||{}),at=u.string().trim().min(1),hz=u.object({action:u.enum(["start","run","wait"]),text:at,source:u.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:at.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),gz=/^[A-Za-z_][A-Za-z0-9_]*$/,dc=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Ac=(o=>(o.VersionEndpoint="version_endpoint",o.DeployWorkflow="deploy_workflow",o.KubernetesLabels="kubernetes_labels",o.Command="command",o.Api="api",o.NotTracked="not_tracked",o))(Ac||{}),cn="shared",mz=at.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),pc=u.object({address:mz,readyWhen:at.nullable(),credentials:u.array(u.string().regex(dc)).max(50),revisionSources:u.array(u.object({method:u.nativeEnum(Ac),detail:at.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:u.array(at).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),kE={steps:u.array(hz).max(20).optional().describe("how it starts, in order"),kind:u.enum(["web_app","service","database","external_service"]).optional(),from:u.object({file:at,service:at.nullable()}).strict().optional(),credentials:u.array(u.string().max(100).regex(gz)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},yz=u.object({name:at,repository:at.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:u.boolean(),...kE,deployed:at.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),Ez=u.object({component:at,problem:at,evidence:at.describe("the exact command and output that shows it"),fix:at.describe("what the user must provide, and where")}),Cz=u.object({framework:at,file:at.describe("the test file run, relative to its repository root"),result:u.enum(["pass","fail","error"])}),Iz=u.object({input:at.describe("the part of the user's SUT input, as given"),reason:at}),O0=u.object({schemaVersion:u.literal(1),status:u.nativeEnum(Do).describe("ready only if every component came up healthy and the recipe is written"),components:u.array(yz),suites:u.array(Cz).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:u.array(at).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:u.array(u.object({input:at.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:at.describe("what the recipe did with it")})).optional(),inputsNotUsed:u.array(Iz).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one the repositories or the app show is wrong, such as a file, command, port, route or setting that is not there. Something outside them that does not answer is not one: that is a blocker"),blockers:u.array(Ez).describe("required (non-empty) when status is blocked"),environment:pc.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var rl=64*1024,sl=512*1024,xE=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Es=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(Es||{}),Ar=u.string().trim().min(1),wz=u.object({url:u.string().optional().describe("the URL probed, if the check is an HTTP request"),command:u.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:u.record(u.string()).optional(),status:u.union([u.number(),u.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:Ar.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),TE=u.array(u.object({component:Ar.describe("a shared component listed above"),url:Ar.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:Ar.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),bz=u.object({name:Ar.describe("the credential's environment variable name, as listed above; never its value"),component:Ar.describe("the component that refused it"),status:u.number().int().min(400).max(599).optional().describe("the HTTP status it got, such as 401 or 403; leave it out when the refusal was not an HTTP answer"),evidence:Ar.describe("the request or command you tested it with and what came back, never the value")}),L0=u.object({schemaVersion:u.literal(1),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:wz.optional(),teardown:Ar.describe("command that tears the SUT down"),dependencies:u.record(u.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:u.nativeEnum(Es).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:u.array(u.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:u.object({command:Ar,output:Ar}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:u.array(u.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:u.boolean(),startedAt:Ar.describe("ISO timestamp"),revisions:TE.optional(),credentialsRefused:u.array(bz).optional().describe("only for credentials the prompt lists to test: each that was refused when you tested it, such as with a 401 or 403; leave it out when none was, or when none is listed"),recipeRecorded:u.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var Tt=u.string().trim().min(1),vp=Tt,NE=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(NE||{}),Rp=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],DE=u.object({schemaVersion:u.literal(1),type:u.nativeEnum(NE).optional(),repository:vp.optional().describe("namespace/name of the source whose checkout the recipe was written and proven in (SKYR-5380); a run replays it from there. Never on a customer_deployed plan"),status:u.enum(["ready","blocked"]),environment:pc.optional(),components:u.array(u.object({name:Tt,repository:Tt.describe(`owner/repo, or "${cn}" for a customer-deployed component no repository builds`),healthy:u.boolean(),url:u.string().min(1).nullable(),...kE,credentials:u.array(u.string().regex(dc)).max(50).optional(),deployed:Tt.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:u.array(u.object({framework:Tt,file:Tt,result:u.enum(["pass","fail","error"])}).strict()),inputsUsed:u.array(Tt),inputsUsedHow:u.array(u.object({input:Tt,how:Tt}).strict()).optional(),inputsNotUsed:u.array(u.object({input:Tt,reason:Tt}).strict()),blockers:u.array(u.object({component:Tt,problem:Tt,evidence:Tt,fix:Tt}).strict()),replay:u.object({outcome:Tt,durationSeconds:u.number().nonnegative().nullable()}).strict().nullable(),files:u.array(u.object({path:Tt,content:u.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:u.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=t.type==="customer_deployed";n!==(t.environment!==void 0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&t.repository!==void 0&&e.addIssue({code:u.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((o,c)=>{r.has(o)||e.addIssue({code:u.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",c],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===cn&&!n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${cn}`})}),n&&(t.components.forEach((s,i)=>{t.components.findIndex(o=>o.name===s.name)!==i&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:u.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{Rp.includes(s.path)&&e.addIssue({code:u.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,o)=>{i.repository!==cn&&!s.has(i.name)&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var Ree=["clean","recipe-drift"];function il(t){let e=$0.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}var FE=[".skyramp/sut",".skyramp/workspace.yml"];var Bz=256*1024*1024,Qz=3e4;function G0(t,e,n=Qz){let r=(0,V0.spawnSync)("git",[...si,...e],{env:Lt(),cwd:t,encoding:"utf-8",timeout:n,maxBuffer:Bz});return r.status===0?r.stdout.trimEnd():void 0}var _ee=["--",":/",...FE.map(t=>`:(exclude)${t}`)],j0="--literal-pathspecs";function H0(t,e){return!!G0(t,[j0,"status","--porcelain","--",e])}function _E(t,e){return/ blob /.test(G0(t,[j0,"ls-tree","HEAD","--",e])??"")}var ol=ce(require("fs")),Xe=ce(require("path"));var kp=ce(require("fs")),Fo=ce(require("path"));var fc=ce(require("path"));var Pee=fc.join(".skyramp","workspace.yml");var Sz={py:"python",go:"go",java:"java",kt:"kotlin",rb:"ruby",cs:"csharp",ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",kts:"kotlin",rs:"rust",php:"php",scala:"scala",swift:"swift",ex:"elixir",exs:"elixir",dart:"dart",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",groovy:"groovy"};var Oee=new Set(Object.values(Sz));var Jee=5*6e4;function UE(t){try{let r=JSON.parse(kp.readFileSync(Fo.join(t,"package.json"),"utf-8")).packageManager,s=typeof r=="string"?r.match(/^(pnpm|yarn|bun|npm)\b/):null;if(s)return s[1]}catch{}let e=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["bun.lockb","bun"],["bun.lock","bun"],["package-lock.json","npm"]],n=Fo.resolve(t);for(let r=0;r<6;r++){for(let[i,o]of e)if(kp.existsSync(Fo.join(n,i)))return o;let s=Fo.dirname(n);if(s===n)break;n=s}return"npm"}var q0=["package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],vz={"package.json":q0,"pyproject.toml":["poetry.lock","uv.lock","pdm.lock"],Pipfile:["Pipfile.lock"]};function OE(t,e){let n=Xe.basename(e),r=vz[n];if(!r)return[];let s=Xe.resolve(t),i=Xe.dirname(Xe.resolve(s,e)),o=Xe.relative(s,i);if(o===".."||o.startsWith(`..${Xe.sep}`)||Xe.isAbsolute(o))return[];let c=(d,A)=>A.map(f=>Xe.join(Xe.relative(s,d),f)).filter(f=>_E(s,f)),l=c(i,r);if(l.length)return l;for(let d=i;d!==s;){d=Xe.dirname(d);let A=Rz(d,Xe.relative(d,i).split(Xe.sep).join("/"),n);if(A)return c(d,A)}return[]}function Y0(t,e){return e.filter(n=>H0(t,n)&&xp(Xe.join(t,n)))}function Rz(t,e,n){if(n==="package.json"){let r=Dz(Xe.join(t,"pnpm-workspace.yaml"));if(PE(r?.packages,e))return["pnpm-lock.yaml"];let i=xz(Xe.join(t,"package.json"))?.workspaces,o=Array.isArray(i)?i:i?.packages;return PE(o,e)?q0.filter(c=>c!=="pnpm-lock.yaml"):void 0}if(n==="pyproject.toml"){let r=kz(Xe.join(t,"pyproject.toml"));if(r&&PE([...r.members,...r.exclude.map(s=>`!${s}`)],e))return["uv.lock"]}}function PE(t,e){if(!Array.isArray(t))return!1;let n=o=>o.trim().replace(/^\.\//,"").replace(/\/+$/,""),r=t.filter(o=>typeof o=="string"),s=r.filter(o=>!o.startsWith("!")).map(n),i=r.filter(o=>o.startsWith("!")).map(o=>n(o.slice(1)));return s.some(o=>Xe.matchesGlob(e,o))&&!i.some(o=>Xe.matchesGlob(e,o))}function kz(t){let e;try{e=ol.readFileSync(t,"utf-8")}catch{return}let n=e.split(`
117
117
  `),r=n.findIndex(c=>c.trim()==="[tool.uv.workspace]");if(r<0)return;let s=n.findIndex((c,l)=>l>r&&c.trim().startsWith("[")),i=n.slice(r+1,s<0?void 0:s).join(`
118
- `),o=c=>{let l=i.match(new RegExp(`^\\s*${c}\\s*=\\s*\\[([^\\]]*)\\]`,"m"));return l?[...l[1].matchAll(/["']([^"']+)["']/g)].map(d=>d[1]):[]};return{members:o("members"),exclude:o("exclude")}}function xz(t){return Tz(J0(t))}function Tz(t){try{return JSON.parse(t)}catch{return}}function Nz(t){try{return As(t)}catch{return}}function Dz(t){return Nz(J0(t))}function J0(t){try{return ol.readFileSync(t,"utf-8")}catch{return""}}function xp(t){try{return ol.lstatSync(t).isFile()}catch{return!1}}var LE="test-package.json";var Fz=["node_modules",".venv","test-results","playwright-report","blob-report","__pycache__",".pytest_cache"],W0=t=>t.split(Cs.sep).join("/");function $E(t,e){let n=W0(t);return e.some(r=>n===r||n.startsWith(`${r}/`))}function z0(t){return W0(t).split("/").some(e=>Fz.includes(e))}var _z=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Z0=/%[psdifjo#]|\$[A-Za-z_][\w.]*/g;var Mz=/ (?:>|›) /;function Uz(t){return t.split(Z0).map(e=>e.split(Mz).map(_z).join("(?: > | \u203A | )")).join(".+?")}function X0(t,e){return new RegExp(Z0.source).test(e)?new RegExp(`^(?:.* )?${Uz(e)}$`).test(t):!1}var al=(n=>(n.Full="full",n.Static="static",n))(al||{}),ii=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(ii||{}),cl=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(cl||{}),Is=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(Is||{}),Tp=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(Tp||{});var Qn=u.string().trim().min(1),Vz=u.object({subject:Qn.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(Tp),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),Gz=u.object({test:Qn.describe("existing test path, relative to its repository"),repository:Qn.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(Is),evidence:Qn.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers")});var jz=u.object({surface:Qn.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(cl)}),Hz=u.object({id:Qn.describe("short-slug, unique across generate[]"),type:u.nativeEnum(ii),target:Qn.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:jz.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Qn.describe("why this test matters"),expected_observable:Qn.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:Vz.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Qn.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),qz=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Yz=u.object({surface:Qn.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(cl).map(t=>[t,qz])))}),eN=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(al),maintenance:u.array(Gz),generate:u.array(Hz),surfaces:u.array(Yz).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:Qn}),summary:Qn.describe("one paragraph")});var dl=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(dl||{}),_p=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(_p||{}),Al=(o=>(o.PullRequest="pull_request",o.ReadyForReview="ready_for_review",o.Schedule="schedule",o.Manual="manual",o.SutSetup="sut_setup",o.RevisionRead="revision_read",o))(Al||{}),Jz=["sut_setup"],Wz=["sut_setup","schedule","revision_read"];var Mp=(e=>(e.PullRequest="pull_request",e))(Mp||{}),GE=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(GE||{}),tN=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"],pl=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(pl||{});var Up=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(Up||{}),fN=(n=>(n.Running="running",n.Ended="ended",n))(fN||{}),Pp=(f=>(f.TimedOut="timed_out",f.AgentFailed="agent_failed",f.SetupFailed="setup_failed",f.CredentialMissing="credential_missing",f.RunnerLost="runner_lost",f.CheckoutFailed="checkout_failed",f.EnvironmentUnverified="environment_unverified",f.ModelProviderDenied="model_provider_denied",f.ModelProviderUnavailable="model_provider_unavailable",f.RunnerProviderNotReady="runner_provider_not_ready",f.MergeConflict="merge_conflict",f))(Pp||{}),jE=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(jE||{}),HE=(n=>(n.Started="started",n.Finished="finished",n))(HE||{}),qE=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(qE||{});var YE=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(YE||{});var fl=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(fl||{}),hl=(s=>(s.ValidationPlan="validation_plan",s.TestEnvironment="test_environment",s.TestConditions="test_conditions",s.Tests="tests",s))(hl||{});var gl=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(gl||{}),Vn=u.string().regex(/^[1-9][0-9]{0,18}$/),pr=u.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),gc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,It=u.string().regex(gc),Wt=u.string().regex(/^[0-9a-f]{64}$/),Fp=u.object({id:It,revision:Vn}).strict(),Op={provider:u.literal("github"),providerAccountId:Vn,providerRepositoryId:Vn},Lp={provider:u.literal("azure-devops"),providerAccountId:It,providerRepositoryId:It},Gn=u.discriminatedUnion("provider",[u.object(Op).strict(),u.object(Lp).strict()]),JE=u.discriminatedUnion("provider",[u.object(Op).passthrough(),u.object(Lp).passthrough()]),_o=t=>`${t.provider}:${t.providerRepositoryId}`,nN={namespace:u.string().min(1),name:u.string().min(1)},hN=u.discriminatedUnion("provider",[u.object({...Op,...nN}).strict(),u.object({...Lp,...nN}).strict()]),rN=u.object({ref:u.string().min(1),revision:pr}).strict(),zz=u.object({kind:u.nativeEnum(GE),number:Vn.optional(),ref:u.string().min(1),revision:pr,reason:u.nativeEnum(_p)}).strict(),Kz=u.object({repository:hN,revision:pr,ref:u.string().nullable(),reason:u.nativeEnum(_p),change:u.object({kind:u.nativeEnum(Mp),number:Vn,base:rN.optional()}).strict().nullable(),compareWith:rN.optional(),merge:u.array(zz).min(2).optional()}).strict();function Zz(t){let e=t.merge;if(!e)return null;if(t.change||t.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(t.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,r=new Set;for(let[i,o]of e.entries()){if(o.kind==="pull_request"!=(o.number!==void 0))return{path:["merge",i,"number"],message:"a pull request names its number, and a branch none"};if(!tN.includes(o.reason))return{path:["merge",i,"reason"],message:`${o.reason} does not select a merged revision`};if(o.kind==="branch"&&o.reason!=="MANUAL_OVERRIDE")return{path:["merge",i,"reason"],message:"only a person chooses a branch to merge"};if(o.ref===t.ref)return{path:["merge",i,"ref"],message:"the baseline branch is what the source merges onto"};if(o.number!==void 0&&n.has(o.number)||r.has(o.ref))return{path:["merge",i],message:"names a revision the source already merges"};o.number!==void 0&&n.add(o.number),r.add(o.ref)}let s=tN.find(i=>e.some(o=>o.reason===i));return t.reason!==s?{path:["reason"],message:`a source that merges these revisions is ${s}`}:null}function Xz(t){if(t.trigger.kind==="revision_read"!=!t.baseline)return t.baseline?"a revision_read run names no baseline":"names its baseline";if(!t.baseline)return null;let{confirmedRunId:e,initialBaselineId:n,sources:r}=t.baseline;if(e!==null&&n!==void 0)return"a run compares with one baseline";let s=t.trigger.kind==="schedule"&&e!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(e===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(t.sources.map(l=>_o(l.repository))),o=new Set(r.map(l=>_o(l.repository)));return o.size===r.length&&o.size===i.size&&[...o].every(l=>i.has(l))?null:"names every source of the snapshot, once"}var gN=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,mN=/^[1-9][0-9]{0,18}$/,sN=new RegExp(`${gN.source}|${mN.source}`),iN=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,e9=u.union([u.object({source:u.literal("jira"),site:u.string().regex(iN),key:u.string().regex(gN),updated:u.string().datetime(),contentHash:Wt}).strict(),u.object({source:u.literal("confluence"),site:u.string().regex(iN),key:u.string().regex(mN),version:u.number().int().positive(),contentHash:Wt}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),contentHash:Wt}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),contentHash:Wt,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(Yu)}).strict()]),oN=u.union([u.literal("jira"),u.literal("confluence")]),t9=u.object({schemaVersion:u.literal(1),items:u.array(u.union([u.object({source:oN,site:u.string(),key:u.string().regex(sN),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:oN,site:u.string(),key:u.string().regex(sN),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),state:u.literal("read"),version:Wt,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(Yu)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict()])),instructions:u.array(u.string()).optional()}).strict(),n9=u.object({schemaVersion:u.literal(1),runId:It,skyrampOrgId:It,target:Fp,policy:Fp.nullable(),trigger:u.object({kind:u.nativeEnum(Al),requestedAt:u.string().datetime()}).strict(),configuration:u.object({captureId:It,revision:Vn.nullable(),hash:Wt}).strict(),baseline:u.object({confirmedRunId:It.nullable(),initialBaselineId:It.optional(),sources:u.array(u.object({repository:Gn,revision:pr}).strict()).optional()}).strict().optional(),sources:u.array(Kz).min(1),execution:u.object({provider:u.nativeEnum(dl),repository:hN,workflowPath:u.string(),ref:u.string()}).strict(),credentials:u.array(u.object({name:u.string(),purpose:u.nativeEnum(pl),required:u.boolean()}).strict()),requirements:u.array(e9).min(1).optional(),instructions:u.object({contentHash:Wt}).strict().optional(),deployedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).min(1).optional()}).strict().superRefine((t,e)=>{let n=new Set;(t.requirements??[]).forEach((l,d)=>{let A="fileName"in l?"file":"pasted";l.source==="other"&&l.key!==`${A}-${l.contentHash.slice(0,16)}`&&e.addIssue({code:u.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let f=CE({source:l.source,key:l.key});n.has(f)&&e.addIssue({code:u.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(f)});let r=t.trigger.kind,s=Jz.includes(r);s!==(t.policy===null)&&e.addIssue({code:u.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=Xz(t);i&&e.addIssue({code:u.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),Wz.includes(r)&&t.sources.forEach((l,d)=>{l.reason!=="BASELINE"&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),t.deployedRevisions&&r!=="manual"&&e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let o=new Set(t.sources.map(l=>_o(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let A=_o(l.repository);o.has(A)?c.has(A)&&e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),c.add(A)}),t.sources.forEach((l,d)=>{l.compareWith&&(l.reason!=="MANUAL_OVERRIDE"||l.change)&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"});let A=Zz(l);A&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,...A.path],message:A.message})})});var WE=(n=>(n.Person="person",n.Policy="policy",n))(WE||{}),r9=u.object({kind:u.nativeEnum(WE),name:u.string().min(1).max(256)}).strict(),s9=u.object({mcp:u.discriminatedUnion("source",[u.object({source:u.literal("npm"),version:u.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),u.object({source:u.literal("github"),ref:u.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:u.object({region:u.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:u.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Fte=u.object({schemaVersion:u.literal(1),attempt:u.object({id:It,number:u.number().int().positive(),deadlineAt:u.string().datetime()}).strict(),manifest:n9,manifestHash:Wt,entitlements:u.array(u.string()).optional(),runToken:u.string().min(1).optional(),requestedBy:r9.nullable().optional(),writeAllowed:u.boolean().optional(),claudeCodeVersion:u.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).optional(),statedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).optional(),runSettings:s9.optional(),credentialRelay:u.boolean().optional()}).strict(),aN={providerRunAttempt:u.number().int().positive(),workflowRef:u.string().min(1)},i9=u.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),_te=u.object({schemaVersion:u.literal(1),runId:It,execution:u.discriminatedUnion("provider",[u.object({...aN,provider:u.literal("github"),repository:u.object(Op).strict(),providerRunId:Vn}).strict(),u.object({...aN,provider:u.literal("azure-devops"),repository:u.object(Lp).strict(),providerRunId:i9}).strict()]),requester:u.literal(!0).optional(),writeCheck:u.literal(!0).optional(),claudeCodePin:u.literal(!0).optional(),deployedPins:u.literal(!0).optional(),statedPins:u.literal(!0).optional(),runSettings:u.literal(!0).optional(),credentialRelay:u.literal(!0).optional()}).strict(),cN=u.object({repository:Gn,number:Vn,commitSha:pr.optional()}).strict(),o9=u.discriminatedUnion("status",[u.object({status:u.literal("none")}).strict(),u.object({status:u.literal("delivered"),pullRequests:u.array(cN).min(1)}).strict(),u.object({status:u.literal("partial"),pullRequests:u.array(cN).min(1),failures:u.array(u.object({repository:Gn,message:u.string()}).strict()).min(1)}).strict(),u.object({status:u.literal("failed"),message:u.string()}).strict()]),a9=1024*1024,Np=t=>u.array(u.object({[t]:u.string()}).strict()).optional(),c9=u.object({language:u.custom(t=>t==="ja","Invalid"),businessCaseAnalysis:u.string(),validation:u.object({rationale:u.string(),gaps:u.array(u.string())}).strict().optional(),changes:u.array(u.object({id:u.string(),text:u.string()}).strict()).optional(),issuesFound:Np("description"),newTestsCreated:Np("description"),testResults:Np("details"),caveats:Np("text")}).strict(),u9=u.object({blockedPreflight:u.object({file:u.string().min(1),repository:u.string().min(1).optional(),reason:u.string().min(1).max(300),evidence:u.string().min(1).max(400)}).strict().optional(),sufficiency:u.nativeEnum(ho),rationale:u.string().min(1),gaps:u.array(u.string().min(1)),acceptedEvidence:u.array(u.object({kind:u.nativeEnum(Zs),repository:u.string().min(1),revision:pr,reference:u.string().min(1),summary:u.string().min(1)}).strict()),actionRequired:u.array(u.nativeEnum(Xa))}).strict().superRefine((t,e)=>{t.sufficiency==="insufficient"!=t.gaps.length>0&&e.addIssue({code:u.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Dp=500,yN=2048,EN=1e3,l9=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,uN=t=>t.length>0&&t.length<=64&&t===t.trim()&&!l9.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),d9=t=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(t))return!0;let[e,n,r,...s]=t.split("/");return t.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(e)&&uN(n)&&uN(r)},A9=u.object({testResults:u.array(u.object({resultId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:u.string().refine(d9,"Invalid"),testType:u.string(),endpoint:u.string(),status:u.enum(["Pass","Fail","Skipped"]),details:u.string(),fileName:u.string().optional(),testId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:u.object({kind:u.nativeEnum(Ap),family:u.nativeEnum(pp).optional()}).strict().optional(),origin:u.nativeEnum(dp).optional()}).strict()),validation:u9,changes:u.array(u.object({id:u.string().min(1).max(512),text:u.string().max(16384),source:u.string().max(yN),testedBy:u.array(u.string().min(1).max(1024)).max(Dp),writtenBy:u.array(u.string().min(1).max(1024)).max(Dp),maintainedBy:u.array(u.string().min(1).max(1024)).max(Dp)}).strict()).max(EN).optional(),traceVersion:u.literal(1),display:c9.optional()}).passthrough().superRefine((t,e)=>{let n=t.display,r={issuesFound:t.issuesFound,newTestsCreated:t.newTestsCreated,testResults:t.testResults,caveats:t.caveats};for(let i of["issuesFound","newTestsCreated","testResults","caveats"]){let o=n?.[i];o&&o.length!==(Array.isArray(r[i])?r[i].length:0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["display",i],message:`has not one row per ${i} row`})}n?.validation&&n.validation.gaps.length!==t.validation.gaps.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let s=new Set;t.testResults.forEach((i,o)=>{let c=i.failureCause;c&&i.status==="Pass"&&e.addIssue({code:u.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"a passing result has no failure cause"}),c&&c.kind==="environment"!=(c.family!==void 0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"an environment cause names its family, and no other cause does"});let l=["testResults",o,"resultId"],d=i.resultId.slice(`${i.repository}:${i.testType}:`.length);(!i.resultId.startsWith(`${i.repository}:${i.testType}:`)||d===""||d.startsWith("/")||d.startsWith("#"))&&e.addIssue({code:u.ZodIssueCode.custom,path:l,message:"is not repository:testType:path for this result"}),s.has(i.resultId)&&e.addIssue({code:u.ZodIssueCode.custom,path:l,message:"stable identity repeated"}),s.add(i.resultId)})});var CN=50,lN=u.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),IN=u.discriminatedUnion("kind",[u.object({kind:u.literal("branch_pushed"),repository:Gn,branch:lN,commit:pr}).strict(),u.object({kind:u.enum(["pull_request_opened","pull_request_edited"]),repository:Gn,number:Vn,branch:lN}).strict()]),p9=u.object({schemaVersion:u.literal(1),run:u.object({runId:It,attemptNumber:u.number().int().positive(),manifestHash:Wt}).strict(),target:Fp,policy:Fp,provenance:u.object({sources:u.array(u.object({repository:Gn,revision:pr}).strict()),firstQualification:u.literal(!0).optional()}).strict(),delivery:u.object({generatedTests:o9}).strict(),producer:u.object({testbot:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:A9,githubWrites:u.array(IN).max(CN).optional()}).strict(),Mte=p9.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:DE}).strict().superRefine(({recipe:t},e)=>{let n=(i,o)=>e.addIssue({code:u.ZodIssueCode.custom,path:["recipe",...i],message:o});t.status==="blocked"&&t.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;t.files.forEach((i,o)=>{il(i.path)||n(["files",o,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",o,"path"],"file repeated"),r.add(i.path),xE.test(i.content)&&n(["files",o,"content"],"is not text");let c=Buffer.byteLength(i.content,"utf8");s+=c,c>rl&&n(["files",o,"content"],`larger than ${rl} bytes`)}),s>sl&&n(["files"],`recipe text over ${sl} bytes in total`)}),Ute=u.object({components:u.array(u.object({name:u.string().min(1),repository:u.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:u.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:u.nativeEnum(fp),evidence:u.string()}).strict().refine(t=>t.source!=="agent"||t.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var f9=u.object({schemaVersion:u.literal(1),stage:u.nativeEnum(jE),event:u.nativeEnum(HE),status:u.nativeEnum(qE).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),oi=100,zE=5e3,ll=2e3,VE=100,KE=/^[A-Za-z0-9_-]{1,64}$/,wN=20,bN=200,BN=100,QN=100,h9=200,dN="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",g9=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${dN}/${dN})$`),SN=500,vN=50,ml=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,$n=t=>u.string().max(t).refine(e=>e.trim().length>0&&!ml.test(e),"blank, or not text"),ws={sequence:u.number().int().min(1).max(zE),at:u.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},RN=u.discriminatedUnion("kind",[u.object({...ws,kind:u.literal("log"),phase:u.nativeEnum(fl),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("component"),name:$n(VE),repository:$n(h9).refine(t=>g9.test(t)||t===cn,"not owner/name"),file:$n(SN).nullable(),status:u.nativeEnum(gl),version:$n(QN).optional()}).strict(),u.object({...ws,kind:u.literal("reply"),to:u.string().uuid(),accepted:u.boolean(),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("question"),id:u.string().regex(KE),type:u.nativeEnum(YE),text:$n(ll),component:$n(VE).nullable(),choices:u.array($n(bN)).max(wN),placeholder:$n(BN).optional()}).strict(),u.object({...ws,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max(oi)}).strict(),u.object({...ws,kind:u.literal("credentials"),names:u.array(u.string().regex(dc)).min(1).max(vN)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),m9=u.object({schemaVersion:u.literal(1),events:u.array(RN).max(oi)}).strict(),kN=u.discriminatedUnion("kind",[u.object({...ws,kind:u.literal("log"),stage:u.nativeEnum(hl),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("reply"),to:u.string().uuid(),accepted:u.boolean(),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max(oi)}).strict()]),y9=u.object({schemaVersion:u.literal(1),events:u.array(kN).max(oi)}).strict(),AN={id:u.string().uuid(),text:u.string(),by:u.string().nullable(),at:u.string(),replied:u.literal(!0).optional()},xN=u.discriminatedUnion("kind",[u.object({...AN,kind:u.literal("instruction"),question:u.null()}),u.object({...AN,kind:u.literal("answer"),question:u.string().regex(KE)})]),TN=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),E9=u.object({id:u.string().uuid(),revision:u.string(),by:u.string().nullable(),at:u.string(),target:u.string(),own:u.object({source:u.enum(["policy","test_environment"]),text:u.string()}).nullable()}),NN=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),C9=u.object({ephemeralPublicKey:NN,iv:u.string().regex(/^[A-Za-z0-9+/]{16}$/),ciphertext:u.string().min(1).max(65536),tag:u.string().regex(/^[A-Za-z0-9+/]{22}==$/)}).strict();var I9=/^[A-Z][A-Z0-9_]{0,99}$/,w9=new Set(["PATH","HOME","SHELL","USER","LOGNAME","PWD","OLDPWD","TMPDIR","TMP","TEMP","IFS","ENV","BASH_ENV","CDPATH","PS4","NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_TLS_REJECT_UNAUTHORIZED","PYTHONPATH","PYTHONHOME","PYTHONSTARTUP","RUBYOPT","RUBYLIB","PERL5OPT","PERL5LIB","JAVA_TOOL_OPTIONS","SSL_CERT_FILE","SSL_CERT_DIR","CURL_CA_BUNDLE","REQUESTS_CA_BUNDLE","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","ALL_PROXY","SSH_AUTH_SOCK","DOCKER_HOST","GIT_SSH","GIT_SSH_COMMAND","GIT_ASKPASS","GIT_EXEC_PATH","GIT_DIR","GIT_WORK_TREE","GIT_PROXY_COMMAND"]),b9=["LD_","DYLD_","GIT_CONFIG","GITHUB_","RUNNER_","ACTIONS_","INPUT_","SKYRAMP_RUNNER_"],B9=t=>I9.test(t)&&!w9.has(t)&&!b9.some(e=>t.startsWith(e)),DN=u.string().refine(B9,"not a name a relay may set"),ul={id:It,credentialName:DN},Q9=u.discriminatedUnion("status",[u.object({...ul,status:u.literal("sealed"),sealed:C9}),u.object({...ul,status:u.literal("pending")}),u.object({...ul,status:u.literal("empty")}),u.object({...ul,status:u.literal("failed")}),u.object({...ul,status:u.literal("expired")})]),Pte=u.object({schemaVersion:u.literal(1),relayId:It,attemptId:It,credentialName:DN,publicKey:NN}).strict(),S9=u.object({schemaVersion:u.literal(1),leftOut:u.array(u.string()),messages:u.array(xN).optional(),stop:u.object({key:TN}).optional(),notes:E9.optional(),relays:u.array(u.unknown()).transform(t=>t.flatMap(e=>{let n=Q9.safeParse(e);return n.success?[n.data]:[]})).optional()}),v9=u.object({schemaVersion:u.literal(1),messages:u.array(xN).optional()});var FN=500*1024*1024,_N=u.object({id:Vn,name:u.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Vn,expiresAt:u.string().datetime()}).strict(),R9=u.object({schemaVersion:u.literal(1),artifact:_N,sessionId:It,contentHash:Wt,bytes:u.number().int().min(1).max(FN)}).strict(),k9=u.object({schemaVersion:u.literal(1),checkpoint:u.object({artifact:_N,repository:u.object({namespace:u.string().min(1),name:u.string().min(1)}).strict(),sessionId:It,contentHash:Wt,key:TN}).strict().nullable()}).strict(),x9=200,hc=100,ZE=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(ZE||{}),T9=u.object({kind:u.nativeEnum(ZE),setup:u.object({runId:It,endedAt:u.string().nullable(),outcome:u.string().nullable()}).strict(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1),status:u.nativeEnum(gl)}).strict()).max(hc),credentials:u.array(u.string().min(1)).max(hc),answers:u.array(u.object({question:u.string(),answer:u.string().nullable()}).strict()).max(hc),instructions:u.array(u.object({text:u.string(),reply:u.string().nullable()}).strict()).max(hc),log:u.array(u.object({phase:u.nativeEnum(fl),text:u.string()}).strict()).max(x9),recipe:u.object({files:u.array(u.object({path:u.string().min(1),content:u.string()}).strict()).max(hc),blockers:u.array(u.object({component:u.string(),problem:u.string(),evidence:u.string(),fix:u.string()}).strict()).max(hc)}).strict().optional()}).strict(),N9=u.object({schemaVersion:u.literal(1),context:T9.nullable()}).strict(),D9=u.object({schemaVersion:u.literal(1),configuration:u.object({captureId:It,revision:Vn.nullable(),hash:Wt}).strict(),capture:u.object({schemaVersion:u.literal(1),settings:u.object({target:u.object({environment:u.unknown()}).passthrough(),timeoutMinutes:u.number().int().positive(),answerWaitMinutes:u.number().int().positive().optional(),testEnvironment:u.object({name:u.string().min(1),address:u.string().min(1).optional(),readyWhen:u.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:u.object({}).passthrough(),hash:Wt}).strict()}).strict(),F9=pc.extend({version:u.number().int().positive(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1)}).strict()),contentHash:Wt.optional(),files:u.array(u.object({path:u.string().refine(t=>il(t)&&!Rp.includes(t),"not a file of a customer_deployed plan"),content:u.string()}).strict()).optional()}).strict(),_9=u.object({schemaVersion:u.literal(1),testEnvironment:F9.nullable().optional(),runtimePlan:u.object({version:u.number().int().positive(),contentHash:Wt,files:u.array(u.object({path:u.string().refine(il,"not a recipe file path"),content:u.string()}).strict()).min(1),repository:vp.optional(),recipeRepository:vp.optional(),recipe:u.record(u.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),M9=u.object({schemaVersion:u.literal(1),state:u.nativeEnum(fN),ending:u.nativeEnum(Up).nullable(),cause:u.nativeEnum(Pp).nullable(),deadlineAt:u.string().datetime()}).strict();var MN=50,UN=u.object({repository:Gn,revisions:u.array(u.number().int().nonnegative()).min(1).max(2).refine(t=>t.length<2||t[0]<t[1],"two revisions name the earlier first"),files:u.array(u.string().min(1)).min(1).max(MN)}).strict();function PN(t){return t.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:t.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:t.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:t.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:t.mergeConflict&&pN(t)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:t.mergeConflict}:{schemaVersion:1,reason:"no_report",cause:pN({...t,mergeConflict:void 0})}}function pN(t){return t.runnerProviderNotReady?"runner_provider_not_ready":t.credentialMissing?"credential_missing":t.mergeConflict?"merge_conflict":t.checkoutFailed?"checkout_failed":t.environmentUnverified?"environment_unverified":t.setupFailed?"setup_failed":t.timedOut?"timed_out":t.modelProviderDenied?"model_provider_denied":t.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}var ON=".skyramp/sut/deployed-revisions.sh",XE=(n=>(n.Running="running",n.Requested="requested",n))(XE||{});var jte=new Set(Object.values(XE));var Hte=`Fix ${ON} so it prints the full commit each component runs, then set it up again.`;var yl="shared-environment";var rne=64*1024;var sne=new Set(["version_endpoint","api"]);function Vp(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}var eC=(t,e)=>!!t&&!!e&&t.toLowerCase()===e.toLowerCase(),O9=(t,e)=>t.name===e.name&&eC(t.repository,e.repository);function LN(t){return Vp(t).length>0||(t?.dependencies.length??0)>0}function $N(t){let e=t.inputs?.sharedEnvironment;if(!LN(e))return;let n=Ze(t,`${yl}.json`);if(n)return{components:GN(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:Vp(e).map(s=>VN(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}var VN=(t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e});function GN(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=Vp(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>VN(s,"Not checked: the run recorded no read of it."))]}function tC(t){return($N(t)?.components??[]).filter(e=>e.status!=="verified")}function nC(t,e,n){if(!t.appRunning||n===!1)return[];let r=(t.sharedEnvironment?.components??[]).filter(s=>s.touched);return GN(t.sharedEnvironment,e?.components??[]).filter(s=>s.status!=="verified"&&r.some(i=>O9(i,s)))}function jN(t){let e=n=>{let r=`${n.name} (${n.repository}) must run ${ec(n.expectedRevision)}`;if(n.observedRevision&&n.expectedRevision&&(n.observedRevision.startsWith(n.expectedRevision)||n.expectedRevision.startsWith(n.observedRevision)))return`${r}: ${n.evidence}`;let s=n.observedRevision?`runs ${ec(n.observedRevision)}`:"no revision could be read";return`${r}, but ${s}: ${n.evidence}`};return t.length?`the Test Environment does not verifiably run the change: ${t.map(e).join("; ")}`:void 0}function rC(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}function sC(t){return iC(t)&&tC(t).length===0&&rC(t.inputs?.sharedEnvironment).length===0}function iC(t){let e=H9(t);if(!e&&t.state.stages.deploy?.status!=="passed")return!1;let n=Ze(t,"deploy.json");return n?YN(n):!e}function YN(t){return t?.outcome==="clean"||t?.outcome==="recipe-drift"}function H9(t){let e=t.state.stages.plan,n=t.state.stages.deploy;return!(t.inputs?.pipeline?t.inputs.pipeline==="two-step":!n)||e?.status!=="passed"?!1:!n||n.updatedAt<=e.updatedAt}var Mo=(o=>(o.Place="place",o.Update="update",o.Regenerate="regenerate",o.Delete="delete",o.Verify="verify",o.None="none",o))(Mo||{}),qn=(r=>(r.Pass="pass",r.Fail="fail",r.Skip="skip",r))(qn||{}),Hn=u.string().trim().min(1),JN=u.object({case:Hn.describe("a covers id \u2014 the recommend case this test realizes"),status:u.nativeEnum(qn)}),WN=u.object({exit:u.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:u.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:u.array(JN).optional().describe("ONE ENTRY PER CASE the file covers; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one)")}),zN=u.object({from:u.string().optional().describe("staged path \u2014 required for placements"),file:Hn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Hn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(Mo),covers:u.array(u.string()).optional().describe("recommend ids a placed test covers"),repro:u.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:u.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:u.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Hn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Hn.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:WN,assertionCount:u.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time")}).refine(t=>t.action!=="place"||typeof t.from=="string"&&t.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),KN=(n=>(n.Junit="junit",n.Converter="converter",n))(KN||{}),q9=Hn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),Y9=u.object({results:Hn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:u.nativeEnum(KN),run:Hn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:u.array(Hn).min(1).describe("the items[].file paths this run covered"),cases:u.array(u.object({test:Hn.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:Hn.describe("the covers id it realizes"),file:q9})).describe("map each reported test name to the case it covers")}),J9=u.object({suites:u.array(Y9).min(1)}),oC=u.object({schemaVersion:u.literal(1),items:u.array(zN),runnerResults:J9.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:u.array(u.string()).describe("existing tests assessed and deliberately left untouched"),summary:Hn.describe("one paragraph")});var Gp=(s=>(s.RestApi="rest-api",s.Frontend="frontend",s.FullStack="full-stack",s.Other="other",s))(Gp||{}),Uo=(s=>(s.Critical="critical",s.High="high",s.Medium="medium",s.Low="low",s))(Uo||{}),Po=(r=>(r.Suspected="suspected",r.Latent="latent",r.Refuted="refuted",r))(Po||{}),cC=(r=>(r.Skyramp="skyramp",r.External="external",r.Unknown="unknown",r))(cC||{}),uC=(s=>(s.Cascade="cascade",s.Restrict="restrict",s.Orphan="orphan",s.Unknown="unknown",s))(uC||{}),_r=(s=>(s.RequirementReference="requirement-reference",s.Spec="spec",s.PrDescription="pr-description",s.CouldBreak="could-break",s))(_r||{}),qe=u.string().trim().min(1),mc=qe.describe("file:line"),ZN=t=>qe.refine(e=>e.length<=400,e=>({message:`is ${e.length} characters, over the 400 cap \u2014 ${t}`})),Il=qe.optional().describe('multi-repo only: the OTHER checkout this lives in \u2014 its "owner/repo" slug, or the directory name if the run discovered it; omit for the working checkout'),aC=u.object({method:qe,path:qe,service:u.string().optional(),evidence:mc,repository:Il}),W9=u.object({id:qe.describe("short-slug, e.g. R9"),statement:qe.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:u.nativeEnum(_r).describe("spec outranks pr-description when both state it"),evidence:qe.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),z9=u.object({id:qe.describe("short-slug"),statement:qe.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:qe.describe("METHOD /path, or a component/page name"),evidence:qe.describe("file:line from the diff that introduces it"),repository:Il,satisfies:u.array(qe).optional().describe("requirement ids (from `requirements`) this behaviour correctly implements \u2014 a requirement met only in part is ALSO named by the finding that shows the rest (conflictsWith)")}),K9=u.object({id:qe.describe("short-slug"),file:qe,line:u.number().optional(),claim:ZN("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:u.nativeEnum(Uo),evidence:ZN("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:u.nativeEnum(Po),repository:Il,conflictsWith:u.array(qe).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),Z9=u.object({name:qe,language:u.string().optional(),framework:u.string().optional(),evidence:mc,repository:Il}),X9=u.object({dir:qe,framework:u.string().optional(),kind:u.nativeEnum(cC),evidence:mc,repository:Il}),eK=u.object({from:qe,to:qe,onDelete:u.nativeEnum(uC),evidence:mc}),tK=u.object({entity:qe,field:qe,values:u.array(u.string()),evidence:mc}),nK=u.object({entities:u.array(u.object({name:qe,evidence:mc})),references:u.array(eK).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:u.array(tK)}),lC=u.object({schemaVersion:u.literal(1),repository:u.object({path:qe.describe("absolute repo path"),currentBranch:qe,baseBranch:qe}),project:u.object({type:u.nativeEnum(Gp),primaryLanguage:qe,languages:u.array(u.string()),frameworks:u.array(u.string())}),services:u.array(Z9),infrastructure:u.object({containerized:u.boolean(),hasDockerCompose:u.boolean(),composeFiles:u.array(u.string()),hasCiCd:u.boolean()}),diff:u.object({changedFiles:u.array(u.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:u.boolean(),summary:qe.describe("\u2264400 chars")}),endpoints:u.object({new:u.array(aC),modified:u.array(aC),removed:u.array(aC)}),existingTests:u.object({locations:u.array(X9)}),entityMap:nK,requirements:u.array(W9).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:u.array(z9),findings:u.array(K9),unexamined:u.array(u.string()).describe("files or areas outside this change you did not open"),summary:qe.describe("one paragraph on what this change does and its test-relevant risk")});var jp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(jp||{}),bs=u.string().trim().min(1),rK=u.object({case:bs.describe("recommend id this assertion enforces"),evidence:bs.describe("the exact assertion line from the file that checks that case's observable")}),dC=u.object({kind:u.nativeEnum(hp).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:bs.describe("the dependency, endpoint or data it affects"),mechanism:u.nativeEnum(gp).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:bs.describe("what it sets up"),worker:bs.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:bs.optional().describe("seed: a command that removes the data when the test does not, run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that")}),sK=u.object({file:bs.describe("staged path under .skyramp/staged/"),source:u.nativeEnum(jp),language:bs,covers:u.array(u.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:u.array(rK).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:u.array(dC).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),AC=u.object({schemaVersion:u.literal(1),tests:u.array(sK),deferredUi:u.array(u.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:bs.describe("one paragraph")});var Bs=u.string().trim().min(1),wl=72,iK=u.object({repository:Bs.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:u.string(),command:u.string().describe("the exact command you ran, scoped to the changed files"),clean:u.boolean(),fixed:u.array(u.string()).optional().describe("files you fixed"),uncovered:u.array(u.string()).describe("changed/new files this linter's own config does not match (wrong extension, wrong directory) \u2014 so `clean` never examined them, even though CI may still execute them. Empty array, not omitted, when every changed/new file IS covered.")}),One=u.object({schemaVersion:u.literal(1),lint:u.array(iK).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:u.object({ok:u.boolean(),notes:u.string().optional()}),ciReadiness:u.object({covered:u.boolean().describe("will the repo's CI run these tests?"),notes:u.string().optional()}),dependencies:u.object({added:u.array(u.object({package:u.string(),manifest:u.string(),repository:Bs.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:Bs.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).describe("every package added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own")}),support:u.array(u.object({file:Bs,repository:Bs.optional().describe("owner/repo of the file's checkout; omit for the working checkout")})).optional().describe("the files the tests need besides themselves (helper modules, page objects, fixtures, snapshots), delivered with them"),commit:u.object({message:Bs.refine(t=>t.split(`
118
+ `),o=c=>{let l=i.match(new RegExp(`^\\s*${c}\\s*=\\s*\\[([^\\]]*)\\]`,"m"));return l?[...l[1].matchAll(/["']([^"']+)["']/g)].map(d=>d[1]):[]};return{members:o("members"),exclude:o("exclude")}}function xz(t){return Tz(J0(t))}function Tz(t){try{return JSON.parse(t)}catch{return}}function Nz(t){try{return As(t)}catch{return}}function Dz(t){return Nz(J0(t))}function J0(t){try{return ol.readFileSync(t,"utf-8")}catch{return""}}function xp(t){try{return ol.lstatSync(t).isFile()}catch{return!1}}var LE="test-package.json";var Fz=["node_modules",".venv","test-results","playwright-report","blob-report","__pycache__",".pytest_cache"],W0=t=>t.split(Cs.sep).join("/");function $E(t,e){let n=W0(t);return e.some(r=>n===r||n.startsWith(`${r}/`))}function z0(t){return W0(t).split("/").some(e=>Fz.includes(e))}var _z=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Z0=/%[psdifjo#]|\$[A-Za-z_][\w.]*/g;var Mz=/ (?:>|›) /;function Uz(t){return t.split(Z0).map(e=>e.split(Mz).map(_z).join("(?: > | \u203A | )")).join(".+?")}function X0(t,e){return new RegExp(Z0.source).test(e)?new RegExp(`^(?:.* )?${Uz(e)}$`).test(t):!1}var al=(n=>(n.Full="full",n.Static="static",n))(al||{}),ii=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(ii||{}),cl=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(cl||{}),Is=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(Is||{}),Tp=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(Tp||{});var Qn=u.string().trim().min(1),Vz=u.object({subject:Qn.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:u.nativeEnum(Tp),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),Gz=u.object({test:Qn.describe("existing test path, relative to its repository"),repository:Qn.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(Is),evidence:Qn.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers")});var jz=u.object({surface:Qn.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(cl)}),Hz=u.object({id:Qn.describe("short-slug, unique across generate[]"),type:u.nativeEnum(ii),target:Qn.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:jz.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Qn.describe("why this test matters"),expected_observable:Qn.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:Vz.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Qn.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),qz=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Yz=u.object({surface:Qn.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(cl).map(t=>[t,qz])))}),eN=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(al),maintenance:u.array(Gz),generate:u.array(Hz),surfaces:u.array(Yz).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:Qn}),summary:Qn.describe("one paragraph")});var dl=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(dl||{}),_p=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(_p||{}),Al=(o=>(o.PullRequest="pull_request",o.ReadyForReview="ready_for_review",o.Schedule="schedule",o.Manual="manual",o.SutSetup="sut_setup",o.RevisionRead="revision_read",o))(Al||{}),Jz=["sut_setup"],Wz=["sut_setup","schedule","revision_read"];var Mp=(e=>(e.PullRequest="pull_request",e))(Mp||{}),GE=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(GE||{}),tN=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"],pl=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(pl||{});var Up=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(Up||{}),fN=(n=>(n.Running="running",n.Ended="ended",n))(fN||{}),Pp=(f=>(f.TimedOut="timed_out",f.AgentFailed="agent_failed",f.SetupFailed="setup_failed",f.CredentialMissing="credential_missing",f.RunnerLost="runner_lost",f.CheckoutFailed="checkout_failed",f.EnvironmentUnverified="environment_unverified",f.ModelProviderDenied="model_provider_denied",f.ModelProviderUnavailable="model_provider_unavailable",f.RunnerProviderNotReady="runner_provider_not_ready",f.MergeConflict="merge_conflict",f))(Pp||{}),jE=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(jE||{}),HE=(n=>(n.Started="started",n.Finished="finished",n))(HE||{}),qE=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(qE||{});var YE=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(YE||{});var fl=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(fl||{}),hl=(s=>(s.ValidationPlan="validation_plan",s.TestEnvironment="test_environment",s.TestConditions="test_conditions",s.Tests="tests",s))(hl||{});var gl=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(gl||{}),Vn=u.string().regex(/^[1-9][0-9]{0,18}$/),pr=u.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),gc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,It=u.string().regex(gc),Wt=u.string().regex(/^[0-9a-f]{64}$/),Fp=u.object({id:It,revision:Vn}).strict(),Op={provider:u.literal("github"),providerAccountId:Vn,providerRepositoryId:Vn},Lp={provider:u.literal("azure-devops"),providerAccountId:It,providerRepositoryId:It},Gn=u.discriminatedUnion("provider",[u.object(Op).strict(),u.object(Lp).strict()]),JE=u.discriminatedUnion("provider",[u.object(Op).passthrough(),u.object(Lp).passthrough()]),_o=t=>`${t.provider}:${t.providerRepositoryId}`,nN={namespace:u.string().min(1),name:u.string().min(1)},hN=u.discriminatedUnion("provider",[u.object({...Op,...nN}).strict(),u.object({...Lp,...nN}).strict()]),rN=u.object({ref:u.string().min(1),revision:pr}).strict(),zz=u.object({kind:u.nativeEnum(GE),number:Vn.optional(),ref:u.string().min(1),revision:pr,reason:u.nativeEnum(_p)}).strict(),Kz=u.object({repository:hN,revision:pr,ref:u.string().nullable(),reason:u.nativeEnum(_p),change:u.object({kind:u.nativeEnum(Mp),number:Vn,base:rN.optional()}).strict().nullable(),compareWith:rN.optional(),merge:u.array(zz).min(2).optional()}).strict();function Zz(t){let e=t.merge;if(!e)return null;if(t.change||t.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(t.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,r=new Set;for(let[i,o]of e.entries()){if(o.kind==="pull_request"!=(o.number!==void 0))return{path:["merge",i,"number"],message:"a pull request names its number, and a branch none"};if(!tN.includes(o.reason))return{path:["merge",i,"reason"],message:`${o.reason} does not select a merged revision`};if(o.kind==="branch"&&o.reason!=="MANUAL_OVERRIDE")return{path:["merge",i,"reason"],message:"only a person chooses a branch to merge"};if(o.ref===t.ref)return{path:["merge",i,"ref"],message:"the baseline branch is what the source merges onto"};if(o.number!==void 0&&n.has(o.number)||r.has(o.ref))return{path:["merge",i],message:"names a revision the source already merges"};o.number!==void 0&&n.add(o.number),r.add(o.ref)}let s=tN.find(i=>e.some(o=>o.reason===i));return t.reason!==s?{path:["reason"],message:`a source that merges these revisions is ${s}`}:null}function Xz(t){if(t.trigger.kind==="revision_read"!=!t.baseline)return t.baseline?"a revision_read run names no baseline":"names its baseline";if(!t.baseline)return null;let{confirmedRunId:e,initialBaselineId:n,sources:r}=t.baseline;if(e!==null&&n!==void 0)return"a run compares with one baseline";let s=t.trigger.kind==="schedule"&&e!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(e===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(t.sources.map(l=>_o(l.repository))),o=new Set(r.map(l=>_o(l.repository)));return o.size===r.length&&o.size===i.size&&[...o].every(l=>i.has(l))?null:"names every source of the snapshot, once"}var gN=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,mN=/^[1-9][0-9]{0,18}$/,sN=new RegExp(`${gN.source}|${mN.source}`),iN=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,e9=u.union([u.object({source:u.literal("jira"),site:u.string().regex(iN),key:u.string().regex(gN),updated:u.string().datetime(),contentHash:Wt}).strict(),u.object({source:u.literal("confluence"),site:u.string().regex(iN),key:u.string().regex(mN),version:u.number().int().positive(),contentHash:Wt}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),contentHash:Wt}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),contentHash:Wt,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(Yu)}).strict()]),oN=u.union([u.literal("jira"),u.literal("confluence")]),t9=u.object({schemaVersion:u.literal(1),items:u.array(u.union([u.object({source:oN,site:u.string(),key:u.string().regex(sN),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:oN,site:u.string(),key:u.string().regex(sN),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),state:u.literal("read"),version:Wt,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(Yu)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict()])),instructions:u.array(u.string()).optional()}).strict(),n9=u.object({schemaVersion:u.literal(1),runId:It,skyrampOrgId:It,target:Fp,policy:Fp.nullable(),trigger:u.object({kind:u.nativeEnum(Al),requestedAt:u.string().datetime()}).strict(),configuration:u.object({captureId:It,revision:Vn.nullable(),hash:Wt}).strict(),baseline:u.object({confirmedRunId:It.nullable(),initialBaselineId:It.optional(),sources:u.array(u.object({repository:Gn,revision:pr}).strict()).optional()}).strict().optional(),sources:u.array(Kz).min(1),execution:u.object({provider:u.nativeEnum(dl),repository:hN,workflowPath:u.string(),ref:u.string()}).strict(),credentials:u.array(u.object({name:u.string(),purpose:u.nativeEnum(pl),required:u.boolean()}).strict()),requirements:u.array(e9).min(1).optional(),instructions:u.object({contentHash:Wt}).strict().optional(),deployedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).min(1).optional()}).strict().superRefine((t,e)=>{let n=new Set;(t.requirements??[]).forEach((l,d)=>{let A="fileName"in l?"file":"pasted";l.source==="other"&&l.key!==`${A}-${l.contentHash.slice(0,16)}`&&e.addIssue({code:u.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let f=CE({source:l.source,key:l.key});n.has(f)&&e.addIssue({code:u.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(f)});let r=t.trigger.kind,s=Jz.includes(r);s!==(t.policy===null)&&e.addIssue({code:u.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=Xz(t);i&&e.addIssue({code:u.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),Wz.includes(r)&&t.sources.forEach((l,d)=>{l.reason!=="BASELINE"&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),t.deployedRevisions&&r!=="manual"&&e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let o=new Set(t.sources.map(l=>_o(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let A=_o(l.repository);o.has(A)?c.has(A)&&e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),c.add(A)}),t.sources.forEach((l,d)=>{l.compareWith&&(l.reason!=="MANUAL_OVERRIDE"||l.change)&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"});let A=Zz(l);A&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,...A.path],message:A.message})})});var WE=(n=>(n.Person="person",n.Policy="policy",n))(WE||{}),r9=u.object({kind:u.nativeEnum(WE),name:u.string().min(1).max(256)}).strict(),s9=u.object({mcp:u.discriminatedUnion("source",[u.object({source:u.literal("npm"),version:u.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),u.object({source:u.literal("github"),ref:u.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:u.object({region:u.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:u.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Fte=u.object({schemaVersion:u.literal(1),attempt:u.object({id:It,number:u.number().int().positive(),deadlineAt:u.string().datetime()}).strict(),manifest:n9,manifestHash:Wt,entitlements:u.array(u.string()).optional(),runToken:u.string().min(1).optional(),requestedBy:r9.nullable().optional(),writeAllowed:u.boolean().optional(),claudeCodeVersion:u.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).optional(),statedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).optional(),runSettings:s9.optional(),credentialRelay:u.boolean().optional()}).strict(),aN={providerRunAttempt:u.number().int().positive(),workflowRef:u.string().min(1)},i9=u.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),_te=u.object({schemaVersion:u.literal(1),runId:It,execution:u.discriminatedUnion("provider",[u.object({...aN,provider:u.literal("github"),repository:u.object(Op).strict(),providerRunId:Vn}).strict(),u.object({...aN,provider:u.literal("azure-devops"),repository:u.object(Lp).strict(),providerRunId:i9}).strict()]),requester:u.literal(!0).optional(),writeCheck:u.literal(!0).optional(),claudeCodePin:u.literal(!0).optional(),deployedPins:u.literal(!0).optional(),statedPins:u.literal(!0).optional(),runSettings:u.literal(!0).optional(),credentialRelay:u.literal(!0).optional()}).strict(),cN=u.object({repository:Gn,number:Vn,commitSha:pr.optional()}).strict(),o9=u.discriminatedUnion("status",[u.object({status:u.literal("none")}).strict(),u.object({status:u.literal("delivered"),pullRequests:u.array(cN).min(1)}).strict(),u.object({status:u.literal("partial"),pullRequests:u.array(cN).min(1),failures:u.array(u.object({repository:Gn,message:u.string()}).strict()).min(1)}).strict(),u.object({status:u.literal("failed"),message:u.string()}).strict()]),a9=1024*1024,Np=t=>u.array(u.object({[t]:u.string()}).strict()).optional(),c9=u.object({language:u.custom(t=>t==="ja","Invalid"),businessCaseAnalysis:u.string(),validation:u.object({rationale:u.string(),gaps:u.array(u.string())}).strict().optional(),changes:u.array(u.object({id:u.string(),text:u.string()}).strict()).optional(),issuesFound:Np("description"),newTestsCreated:Np("description"),testResults:Np("details"),caveats:Np("text")}).strict(),u9=u.object({blockedPreflight:u.object({file:u.string().min(1),repository:u.string().min(1).optional(),reason:u.string().min(1).max(300),evidence:u.string().min(1).max(400)}).strict().optional(),sufficiency:u.nativeEnum(ho),rationale:u.string().min(1),gaps:u.array(u.string().min(1)),acceptedEvidence:u.array(u.object({kind:u.nativeEnum(Zs),repository:u.string().min(1),revision:pr,reference:u.string().min(1),summary:u.string().min(1)}).strict()),actionRequired:u.array(u.nativeEnum(Xa))}).strict().superRefine((t,e)=>{t.sufficiency==="insufficient"!=t.gaps.length>0&&e.addIssue({code:u.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Dp=500,yN=2048,EN=1e3,l9=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,uN=t=>t.length>0&&t.length<=64&&t===t.trim()&&!l9.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),d9=t=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(t))return!0;let[e,n,r,...s]=t.split("/");return t.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(e)&&uN(n)&&uN(r)},A9=u.object({testResults:u.array(u.object({resultId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:u.string().refine(d9,"Invalid"),testType:u.string(),endpoint:u.string(),status:u.enum(["Pass","Fail","Skipped"]),details:u.string(),fileName:u.string().optional(),testId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:u.object({kind:u.nativeEnum(Ap),family:u.nativeEnum(pp).optional()}).strict().optional(),origin:u.nativeEnum(dp).optional()}).strict()),validation:u9,changes:u.array(u.object({id:u.string().min(1).max(512),text:u.string().max(16384),source:u.string().max(yN),testedBy:u.array(u.string().min(1).max(1024)).max(Dp),writtenBy:u.array(u.string().min(1).max(1024)).max(Dp),maintainedBy:u.array(u.string().min(1).max(1024)).max(Dp)}).strict()).max(EN).optional(),traceVersion:u.literal(1),display:c9.optional()}).passthrough().superRefine((t,e)=>{let n=t.display,r={issuesFound:t.issuesFound,newTestsCreated:t.newTestsCreated,testResults:t.testResults,caveats:t.caveats};for(let i of["issuesFound","newTestsCreated","testResults","caveats"]){let o=n?.[i];o&&o.length!==(Array.isArray(r[i])?r[i].length:0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["display",i],message:`has not one row per ${i} row`})}n?.validation&&n.validation.gaps.length!==t.validation.gaps.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let s=new Set;t.testResults.forEach((i,o)=>{let c=i.failureCause;c&&i.status==="Pass"&&e.addIssue({code:u.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"a passing result has no failure cause"}),c&&c.kind==="environment"!=(c.family!==void 0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"an environment cause names its family, and no other cause does"});let l=["testResults",o,"resultId"],d=i.resultId.slice(`${i.repository}:${i.testType}:`.length);(!i.resultId.startsWith(`${i.repository}:${i.testType}:`)||d===""||d.startsWith("/")||d.startsWith("#"))&&e.addIssue({code:u.ZodIssueCode.custom,path:l,message:"is not repository:testType:path for this result"}),s.has(i.resultId)&&e.addIssue({code:u.ZodIssueCode.custom,path:l,message:"stable identity repeated"}),s.add(i.resultId)})});var CN=50,lN=u.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),IN=u.discriminatedUnion("kind",[u.object({kind:u.literal("branch_pushed"),repository:Gn,branch:lN,commit:pr}).strict(),u.object({kind:u.enum(["pull_request_opened","pull_request_edited"]),repository:Gn,number:Vn,branch:lN}).strict()]),p9=u.object({schemaVersion:u.literal(1),run:u.object({runId:It,attemptNumber:u.number().int().positive(),manifestHash:Wt}).strict(),target:Fp,policy:Fp,provenance:u.object({sources:u.array(u.object({repository:Gn,revision:pr}).strict()),firstQualification:u.literal(!0).optional()}).strict(),delivery:u.object({generatedTests:o9}).strict(),producer:u.object({testbot:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:A9,githubWrites:u.array(IN).max(CN).optional()}).strict(),Mte=p9.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:DE}).strict().superRefine(({recipe:t},e)=>{let n=(i,o)=>e.addIssue({code:u.ZodIssueCode.custom,path:["recipe",...i],message:o});t.status==="blocked"&&t.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;t.files.forEach((i,o)=>{il(i.path)||n(["files",o,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",o,"path"],"file repeated"),r.add(i.path),xE.test(i.content)&&n(["files",o,"content"],"is not text");let c=Buffer.byteLength(i.content,"utf8");s+=c,c>rl&&n(["files",o,"content"],`larger than ${rl} bytes`)}),s>sl&&n(["files"],`recipe text over ${sl} bytes in total`)}),Ute=u.object({components:u.array(u.object({name:u.string().min(1),repository:u.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:u.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:u.nativeEnum(fp),evidence:u.string()}).strict().refine(t=>t.source!=="agent"||t.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var f9=u.object({schemaVersion:u.literal(1),stage:u.nativeEnum(jE),event:u.nativeEnum(HE),status:u.nativeEnum(qE).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),oi=100,zE=5e3,ll=2e3,VE=100,KE=/^[A-Za-z0-9_-]{1,64}$/,wN=20,bN=200,BN=100,QN=100,h9=200,dN="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",g9=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${dN}/${dN})$`),SN=500,vN=50,ml=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,$n=t=>u.string().max(t).refine(e=>e.trim().length>0&&!ml.test(e),"blank, or not text"),ws={sequence:u.number().int().min(1).max(zE),at:u.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},RN=u.discriminatedUnion("kind",[u.object({...ws,kind:u.literal("log"),phase:u.nativeEnum(fl),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("component"),name:$n(VE),repository:$n(h9).refine(t=>g9.test(t)||t===cn,"not owner/name"),file:$n(SN).nullable(),status:u.nativeEnum(gl),version:$n(QN).optional()}).strict(),u.object({...ws,kind:u.literal("reply"),to:u.string().uuid(),accepted:u.boolean(),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("question"),id:u.string().regex(KE),type:u.nativeEnum(YE),text:$n(ll),component:$n(VE).nullable(),choices:u.array($n(bN)).max(wN),placeholder:$n(BN).optional()}).strict(),u.object({...ws,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max(oi)}).strict(),u.object({...ws,kind:u.literal("credentials"),names:u.array(u.string().regex(dc)).min(1).max(vN)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),m9=u.object({schemaVersion:u.literal(1),events:u.array(RN).max(oi)}).strict(),kN=u.discriminatedUnion("kind",[u.object({...ws,kind:u.literal("log"),stage:u.nativeEnum(hl),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("reply"),to:u.string().uuid(),accepted:u.boolean(),text:$n(ll)}).strict(),u.object({...ws,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max(oi)}).strict()]),y9=u.object({schemaVersion:u.literal(1),events:u.array(kN).max(oi)}).strict(),AN={id:u.string().uuid(),text:u.string(),by:u.string().nullable(),at:u.string(),replied:u.literal(!0).optional()},xN=u.discriminatedUnion("kind",[u.object({...AN,kind:u.literal("instruction"),question:u.null()}),u.object({...AN,kind:u.literal("answer"),question:u.string().regex(KE)})]),TN=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),E9=u.object({id:u.string().uuid(),revision:u.string(),by:u.string().nullable(),at:u.string(),target:u.string(),own:u.object({source:u.enum(["policy","test_environment"]),text:u.string()}).nullable()}),NN=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),C9=u.object({ephemeralPublicKey:NN,iv:u.string().regex(/^[A-Za-z0-9+/]{16}$/),ciphertext:u.string().min(1).max(65536),tag:u.string().regex(/^[A-Za-z0-9+/]{22}==$/)}).strict();var I9=/^[A-Z][A-Z0-9_]{0,99}$/,w9=new Set(["PATH","HOME","SHELL","USER","LOGNAME","PWD","OLDPWD","TMPDIR","TMP","TEMP","IFS","ENV","BASH_ENV","CDPATH","PS4","NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_TLS_REJECT_UNAUTHORIZED","PYTHONPATH","PYTHONHOME","PYTHONSTARTUP","RUBYOPT","RUBYLIB","PERL5OPT","PERL5LIB","JAVA_TOOL_OPTIONS","SSL_CERT_FILE","SSL_CERT_DIR","CURL_CA_BUNDLE","REQUESTS_CA_BUNDLE","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","ALL_PROXY","SSH_AUTH_SOCK","DOCKER_HOST","GIT_SSH","GIT_SSH_COMMAND","GIT_ASKPASS","GIT_EXEC_PATH","GIT_DIR","GIT_WORK_TREE","GIT_PROXY_COMMAND"]),b9=["LD_","DYLD_","GIT_CONFIG","GITHUB_","RUNNER_","ACTIONS_","INPUT_","SKYRAMP_RUNNER_"],B9=t=>I9.test(t)&&!w9.has(t)&&!b9.some(e=>t.startsWith(e)),DN=u.string().refine(B9,"not a name a relay may set"),ul={id:It,credentialName:DN},Q9=u.discriminatedUnion("status",[u.object({...ul,status:u.literal("sealed"),sealed:C9}),u.object({...ul,status:u.literal("pending")}),u.object({...ul,status:u.literal("empty")}),u.object({...ul,status:u.literal("failed")}),u.object({...ul,status:u.literal("expired")})]),Pte=u.object({schemaVersion:u.literal(1),relayId:It,attemptId:It,credentialName:DN,publicKey:NN}).strict(),S9=u.object({schemaVersion:u.literal(1),leftOut:u.array(u.string()),messages:u.array(xN).optional(),stop:u.object({key:TN}).optional(),notes:E9.optional(),relays:u.array(u.unknown()).transform(t=>t.flatMap(e=>{let n=Q9.safeParse(e);return n.success?[n.data]:[]})).optional()}),v9=u.object({schemaVersion:u.literal(1),messages:u.array(xN).optional()});var FN=500*1024*1024,_N=u.object({id:Vn,name:u.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Vn,expiresAt:u.string().datetime()}).strict(),R9=u.object({schemaVersion:u.literal(1),artifact:_N,sessionId:It,contentHash:Wt,bytes:u.number().int().min(1).max(FN)}).strict(),k9=u.object({schemaVersion:u.literal(1),checkpoint:u.object({artifact:_N,repository:u.object({namespace:u.string().min(1),name:u.string().min(1)}).strict(),sessionId:It,contentHash:Wt,key:TN}).strict().nullable()}).strict(),x9=200,hc=100,ZE=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(ZE||{}),T9=u.object({kind:u.nativeEnum(ZE),setup:u.object({runId:It,endedAt:u.string().nullable(),outcome:u.string().nullable()}).strict(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1),status:u.nativeEnum(gl)}).strict()).max(hc),credentials:u.array(u.string().min(1)).max(hc),answers:u.array(u.object({question:u.string(),answer:u.string().nullable()}).strict()).max(hc),instructions:u.array(u.object({text:u.string(),reply:u.string().nullable()}).strict()).max(hc),log:u.array(u.object({phase:u.nativeEnum(fl),text:u.string()}).strict()).max(x9),recipe:u.object({files:u.array(u.object({path:u.string().min(1),content:u.string()}).strict()).max(hc),blockers:u.array(u.object({component:u.string(),problem:u.string(),evidence:u.string(),fix:u.string()}).strict()).max(hc)}).strict().optional()}).strict(),N9=u.object({schemaVersion:u.literal(1),context:T9.nullable()}).strict(),D9=u.object({schemaVersion:u.literal(1),configuration:u.object({captureId:It,revision:Vn.nullable(),hash:Wt}).strict(),capture:u.object({schemaVersion:u.literal(1),settings:u.object({target:u.object({environment:u.unknown()}).passthrough(),timeoutMinutes:u.number().int().positive(),answerWaitMinutes:u.number().int().positive().optional(),testEnvironment:u.object({name:u.string().min(1),address:u.string().min(1).optional(),readyWhen:u.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:u.object({}).passthrough(),hash:Wt}).strict()}).strict(),F9=pc.extend({version:u.number().int().positive(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1)}).strict()),contentHash:Wt.optional(),files:u.array(u.object({path:u.string().refine(t=>il(t)&&!Rp.includes(t),"not a file of a customer_deployed plan"),content:u.string()}).strict()).optional()}).strict(),_9=u.object({schemaVersion:u.literal(1),testEnvironment:F9.nullable().optional(),runtimePlan:u.object({version:u.number().int().positive(),contentHash:Wt,files:u.array(u.object({path:u.string().refine(il,"not a recipe file path"),content:u.string()}).strict()).min(1),repository:vp.optional(),recipeRepository:vp.optional(),recipe:u.record(u.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),M9=u.object({schemaVersion:u.literal(1),state:u.nativeEnum(fN),ending:u.nativeEnum(Up).nullable(),cause:u.nativeEnum(Pp).nullable(),deadlineAt:u.string().datetime()}).strict();var MN=50,UN=u.object({repository:Gn,revisions:u.array(u.number().int().nonnegative()).min(1).max(2).refine(t=>t.length<2||t[0]<t[1],"two revisions name the earlier first"),files:u.array(u.string().min(1)).min(1).max(MN)}).strict();function PN(t){return t.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:t.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:t.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:t.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:t.mergeConflict&&pN(t)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:t.mergeConflict}:{schemaVersion:1,reason:"no_report",cause:pN({...t,mergeConflict:void 0})}}function pN(t){return t.runnerProviderNotReady?"runner_provider_not_ready":t.credentialMissing?"credential_missing":t.mergeConflict?"merge_conflict":t.checkoutFailed?"checkout_failed":t.environmentUnverified?"environment_unverified":t.setupFailed?"setup_failed":t.timedOut?"timed_out":t.modelProviderDenied?"model_provider_denied":t.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}var ON=".skyramp/sut/deployed-revisions.sh",XE=(n=>(n.Running="running",n.Requested="requested",n))(XE||{});var jte=new Set(Object.values(XE));var Hte=`Fix ${ON} so it prints the full commit each component runs, then set it up again.`;var yl="shared-environment";var rne=64*1024;var sne=new Set(["version_endpoint","api"]);function Vp(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}var eC=(t,e)=>!!t&&!!e&&t.toLowerCase()===e.toLowerCase(),O9=(t,e)=>t.name===e.name&&eC(t.repository,e.repository);function LN(t){return Vp(t).length>0||(t?.dependencies.length??0)>0}function $N(t){let e=t.inputs?.sharedEnvironment;if(!LN(e))return;let n=Ze(t,`${yl}.json`);if(n)return{components:GN(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:Vp(e).map(s=>VN(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}var VN=(t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e});function GN(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=Vp(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>VN(s,"Not checked: the run recorded no read of it."))]}function tC(t){return($N(t)?.components??[]).filter(e=>e.status!=="verified")}function nC(t,e,n){if(!t.appRunning||n===!1)return[];let r=(t.sharedEnvironment?.components??[]).filter(s=>s.touched);return GN(t.sharedEnvironment,e?.components??[]).filter(s=>s.status!=="verified"&&r.some(i=>O9(i,s)))}function jN(t){let e=n=>{let r=`${n.name} (${n.repository}) must run ${ec(n.expectedRevision)}`;if(n.observedRevision&&n.expectedRevision&&(n.observedRevision.startsWith(n.expectedRevision)||n.expectedRevision.startsWith(n.observedRevision)))return`${r}: ${n.evidence}`;let s=n.observedRevision?`runs ${ec(n.observedRevision)}`:"no revision could be read";return`${r}, but ${s}: ${n.evidence}`};return t.length?`the Test Environment does not verifiably run the change: ${t.map(e).join("; ")}`:void 0}function rC(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}function sC(t){return iC(t)&&tC(t).length===0&&rC(t.inputs?.sharedEnvironment).length===0}function iC(t){let e=H9(t);if(!e&&t.state.stages.deploy?.status!=="passed")return!1;let n=Ze(t,"deploy.json");return n?YN(n):!e}function YN(t){return t?.outcome==="clean"||t?.outcome==="recipe-drift"}function H9(t){let e=t.state.stages.plan,n=t.state.stages.deploy;return!(t.inputs?.pipeline?t.inputs.pipeline==="two-step":!n)||e?.status!=="passed"?!1:!n||n.updatedAt<=e.updatedAt}var Mo=(o=>(o.Place="place",o.Update="update",o.Regenerate="regenerate",o.Delete="delete",o.Verify="verify",o.None="none",o))(Mo||{}),qn=(r=>(r.Pass="pass",r.Fail="fail",r.Skip="skip",r))(qn||{}),Hn=u.string().trim().min(1),JN=u.object({case:Hn.describe("a covers id \u2014 the recommend case this test realizes"),status:u.nativeEnum(qn),fromJourney:u.boolean().optional()}),WN=u.object({exit:u.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:u.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:u.array(JN).optional().describe("ONE ENTRY PER CASE the file covers; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one)")}),zN=u.object({from:u.string().optional().describe("staged path \u2014 required for placements"),file:Hn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Hn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(Mo),covers:u.array(u.string()).optional().describe("recommend ids a placed test covers"),repro:u.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:u.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:u.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Hn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Hn.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:WN,assertionCount:u.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time")}).refine(t=>t.action!=="place"||typeof t.from=="string"&&t.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),KN=(n=>(n.Junit="junit",n.Converter="converter",n))(KN||{}),q9=Hn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),Y9=u.object({results:Hn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:u.nativeEnum(KN),run:Hn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:u.array(Hn).min(1).describe("the items[].file paths this run covered"),cases:u.array(u.object({test:Hn.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:Hn.describe("the covers id it realizes"),file:q9})).describe("map each reported test name to the case it covers")}),J9=u.object({suites:u.array(Y9).min(1)}),oC=u.object({schemaVersion:u.literal(1),items:u.array(zN),runnerResults:J9.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:u.array(u.string()).describe("existing tests assessed and deliberately left untouched"),summary:Hn.describe("one paragraph")});var Gp=(s=>(s.RestApi="rest-api",s.Frontend="frontend",s.FullStack="full-stack",s.Other="other",s))(Gp||{}),Uo=(s=>(s.Critical="critical",s.High="high",s.Medium="medium",s.Low="low",s))(Uo||{}),Po=(r=>(r.Suspected="suspected",r.Latent="latent",r.Refuted="refuted",r))(Po||{}),cC=(r=>(r.Skyramp="skyramp",r.External="external",r.Unknown="unknown",r))(cC||{}),uC=(s=>(s.Cascade="cascade",s.Restrict="restrict",s.Orphan="orphan",s.Unknown="unknown",s))(uC||{}),_r=(s=>(s.RequirementReference="requirement-reference",s.Spec="spec",s.PrDescription="pr-description",s.CouldBreak="could-break",s))(_r||{}),qe=u.string().trim().min(1),mc=qe.describe("file:line"),ZN=t=>qe.refine(e=>e.length<=400,e=>({message:`is ${e.length} characters, over the 400 cap \u2014 ${t}`})),Il=qe.optional().describe('multi-repo only: the OTHER checkout this lives in \u2014 its "owner/repo" slug, or the directory name if the run discovered it; omit for the working checkout'),aC=u.object({method:qe,path:qe,service:u.string().optional(),evidence:mc,repository:Il}),W9=u.object({id:qe.describe("short-slug, e.g. R9"),statement:qe.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:u.nativeEnum(_r).describe("spec outranks pr-description when both state it"),evidence:qe.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),z9=u.object({id:qe.describe("short-slug"),statement:qe.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:qe.describe("METHOD /path, or a component/page name"),evidence:qe.describe("file:line from the diff that introduces it"),repository:Il,satisfies:u.array(qe).optional().describe("requirement ids (from `requirements`) this behaviour correctly implements \u2014 a requirement met only in part is ALSO named by the finding that shows the rest (conflictsWith)")}),K9=u.object({id:qe.describe("short-slug"),file:qe,line:u.number().optional(),claim:ZN("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:u.nativeEnum(Uo),evidence:ZN("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:u.nativeEnum(Po),repository:Il,conflictsWith:u.array(qe).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),Z9=u.object({name:qe,language:u.string().optional(),framework:u.string().optional(),evidence:mc,repository:Il}),X9=u.object({dir:qe,framework:u.string().optional(),kind:u.nativeEnum(cC),evidence:mc,repository:Il}),eK=u.object({from:qe,to:qe,onDelete:u.nativeEnum(uC),evidence:mc}),tK=u.object({entity:qe,field:qe,values:u.array(u.string()),evidence:mc}),nK=u.object({entities:u.array(u.object({name:qe,evidence:mc})),references:u.array(eK).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:u.array(tK)}),lC=u.object({schemaVersion:u.literal(1),repository:u.object({path:qe.describe("absolute repo path"),currentBranch:qe,baseBranch:qe}),project:u.object({type:u.nativeEnum(Gp),primaryLanguage:qe,languages:u.array(u.string()),frameworks:u.array(u.string())}),services:u.array(Z9),infrastructure:u.object({containerized:u.boolean(),hasDockerCompose:u.boolean(),composeFiles:u.array(u.string()),hasCiCd:u.boolean()}),diff:u.object({changedFiles:u.array(u.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:u.boolean(),summary:qe.describe("\u2264400 chars")}),endpoints:u.object({new:u.array(aC),modified:u.array(aC),removed:u.array(aC)}),existingTests:u.object({locations:u.array(X9)}),entityMap:nK,requirements:u.array(W9).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:u.array(z9),findings:u.array(K9),unexamined:u.array(u.string()).describe("files or areas outside this change you did not open"),summary:qe.describe("one paragraph on what this change does and its test-relevant risk")});var jp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(jp||{}),bs=u.string().trim().min(1),rK=u.object({case:bs.describe("recommend id this assertion enforces"),evidence:bs.describe("the exact assertion line from the file that checks that case's observable")}),dC=u.object({kind:u.nativeEnum(hp).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:bs.describe("the dependency, endpoint or data it affects"),mechanism:u.nativeEnum(gp).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:bs.describe("what it sets up"),worker:bs.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:bs.optional().describe("seed: a command that removes the data when the test does not, run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that")}),sK=u.object({file:bs.describe("staged path under .skyramp/staged/"),source:u.nativeEnum(jp),language:bs,covers:u.array(u.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:u.array(rK).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:u.array(dC).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),AC=u.object({schemaVersion:u.literal(1),tests:u.array(sK),deferredUi:u.array(u.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:bs.describe("one paragraph")});var Bs=u.string().trim().min(1),wl=72,iK=u.object({repository:Bs.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:u.string(),command:u.string().describe("the exact command you ran, scoped to the changed files"),clean:u.boolean(),fixed:u.array(u.string()).optional().describe("files you fixed"),uncovered:u.array(u.string()).describe("changed/new files this linter's own config does not match (wrong extension, wrong directory) \u2014 so `clean` never examined them, even though CI may still execute them. Empty array, not omitted, when every changed/new file IS covered.")}),One=u.object({schemaVersion:u.literal(1),lint:u.array(iK).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:u.object({ok:u.boolean(),notes:u.string().optional()}),ciReadiness:u.object({covered:u.boolean().describe("will the repo's CI run these tests?"),notes:u.string().optional()}),dependencies:u.object({added:u.array(u.object({package:u.string(),manifest:u.string(),repository:Bs.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:Bs.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).describe("every package added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own")}),support:u.array(u.object({file:Bs,repository:Bs.optional().describe("owner/repo of the file's checkout; omit for the working checkout")})).optional().describe("the files the tests need besides themselves (helper modules, page objects, fixtures, snapshots), delivered with them"),commit:u.object({message:Bs.refine(t=>t.split(`
119
119
  `)[0].length<=wl,{message:`subject line must be <= ${wl} chars`})}),pr:u.object({title:Bs.max(wl,`must be <= ${wl} chars`),body:Bs}),ready:u.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:u.array(u.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:Bs.describe("one paragraph")});var ci=ce(require("fs")),Cc=ce(require("path")),iD=require("child_process");var Yn="{junit}",Hp=(r=>(r.Junit="junit",r.Trx="trx",r.GoTestJson="go-test-json",r))(Hp||{}),pC=(e=>(e.Minitest="minitest",e))(pC||{}),XN=u.string().trim().min(1),yc=u.object({cwd:XN.describe('repo-relative directory the command starts in ("." for the root)'),argv:u.array(XN).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${Yn}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:u.record(u.string(),u.string()).optional().describe("plain test or reporter settings beyond the repository's CI test job (RAILS_ENV=test, PLAYWRIGHT_JUNIT_OUTPUT_FILE={junit}); never a credential, PATH, or a tool's install path"),report:u.object({format:u.nativeEnum(Hp).describe(`junit (JUnit XML to ${Yn}), trx (to ${Yn}), or go-test-json (go test -json on the command's output)`),reporter:u.nativeEnum(pC).optional().describe("a reporter Testbot loads for a runner that writes no report: minitest")}).optional().describe("the report the command writes; junit when omitted")});var Ec="a framework other than pytest, jest, vitest and node --test (go test, rails test, mvn, dotnet test), or one the repository's test script runs through another command (ng test, nx test)",Gne=`pytest, Jest, Vitest and node --test tests run as the run already knows them, unless the repository's test script runs them through another command (ng test, nx test), which may be the only one that compiles them. A test in any other framework, or one run that way, also gives "run": the repository's own command for only those tests, from the directory the repository runs it in, as separate arguments without a shell. Its "report" says what the runner writes: junit (JUnit XML to ${Yn} in the reporter's argument or env setting), trx (a TRX file to ${Yn}, which every dotnet test writes with its built-in logger), or go-test-json (go test -json, read from the command's output). A Maven or Gradle command names no ${Yn}: its build writes JUnit XML to its own report directory, which the run reads. Use a reporter the repository already has, or one of those; a reporter or converter the command fetches is the version the repository pins, or else its latest release (an older one may not build with the repository's toolchain). For minitest, which writes none, give report.reporter "minitest" and the run fills ${Yn} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${Yn} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${Yn} in argv and env with its report path, executes the command, and reads that report.`;var Oo=(s=>(s.ExistingEvidenceSufficient="existing_evidence_sufficient",s.TargetedUnit="targeted_unit",s.RuntimeRequired="runtime_required",s.BlockedPreflight="blocked_preflight",s))(Oo||{}),ai=(i=>(i.ExistingEvidence="existing_evidence",i.Unaffected="unaffected",i.ExistingUnit="existing_unit",i.NewUnit="new_unit",i.Runtime="runtime",i))(ai||{}),fC=(n=>(n.Repository="repository",n.Testbot="testbot",n))(fC||{}),hC=(r=>(r.Identified="identified",r.Passed="passed",r.Failed="failed",r))(hC||{}),un=u.string().trim().min(1),oK=u.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var aK=u.object({id:oK,source:u.nativeEnum(fC),kind:u.nativeEnum(Zs),outcome:u.nativeEnum(hC),summary:un.max(400).describe("one line: what it shows"),tests:u.array(un).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:un.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:un.optional().describe("source testbot: the exact command you ran, as you ran it"),run:yc.optional().describe(`source repository, for tests in ${Ec}: how the run executes only these tests, all of them in one command, with the repository's own runner writing JUnit XML to {junit}. Name each test (path::test-name): a test is credited to a file only by its name or by a report that names the file`)}),cK=u.object({behaviorId:un.describe("an id from analyze's behaviors"),mechanism:u.nativeEnum(ai),evidenceIds:u.array(un).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:u.string().trim().optional().describe('new_unit / runtime: the missing evidence this obtains, e.g. "the boundary the change moved"; unaffected: why the change cannot reach it, citing path:line')}),gC=(r=>(r.Browser="browser",r.RunningApp="running-app",r.Outside="outside",r))(gC||{}),uK=u.object({behaviorId:u.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:un.max(600).describe("the evidence that is required and cannot be obtained in this run"),needs:u.nativeEnum(gC).optional().describe("what that evidence needs: browser (only a real browser shows it), running-app (only the running app or its server shows it: its real requests, sign-in and permissions, what it saves), or outside (something the running app here could not give either: a third-party service it calls, hardware)")}),lK=u.object({file:un.describe("the changed file the failure is in"),repository:un.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:un.max(300).describe("what prerequisite the change fails"),evidence:un.max(400).describe("the error line, quoted")}),dK=u.object({behaviorId:un.describe("an id from analyze's behaviors"),reason:un.max(600).describe("\u2264600 characters: why this change leaves the behavior's result as it was, citing the unchanged line that decides it (path:line)")}),bl=u.object({schemaVersion:u.literal(1),decision:u.nativeEnum(Oo),evidence:u.array(aK).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:u.array(cK).describe("how each changed behavior's evidence is obtained"),gaps:u.array(uK),outOfScope:u.array(dK).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:lK.optional().describe("only for blocked_preflight"),rationale:un.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function qp(t){let e=Ze(t,"recommend.json");if(!e||!Array.isArray(e.generate)||!Array.isArray(e.maintenance))return;let n=e;return{...n,maintenance:n.maintenance.map(({repository:r,...s})=>({...s,test:s.test.trim().replace(/^\.\//,""),...r?.trim()?{repository:r.trim()}:{}}))}}var Lo=ce(require("fs"));function eD(t){let e=[];for(let n of hK(t)){let r=n;r?.type==="tool_use"&&typeof r.name=="string"&&e.push(r.name)}return e}function tD(t){return eD(t).some(e=>/^mcp__skyramp__skyramp_(contract|integration)_test_generation$/.test(e))}function nD(t){return eD(t).some(e=>e==="mcp__skyramp__skyramp_ui_test_generation")}function fK(t){if(!Lo.existsSync(t))return{};for(let e of Lo.readFileSync(t,"utf-8").split(`
120
120
  `)){let n=e.trim();if(n)try{let r=JSON.parse(n);if(r.type==="system"&&r.subtype==="init"&&Array.isArray(r.mcp_servers))return Object.fromEntries(r.mcp_servers.filter(s=>typeof s.name=="string").map(s=>[s.name,typeof s.status=="string"?s.status:"unknown"]))}catch{}}return{}}function rD(t){let e=fK(t).skyramp;return e===void 0||e==="connected"}function hK(t){if(!Lo.existsSync(t))return[];let e=[];for(let n of Lo.readFileSync(t,"utf-8").split(`
121
121
  `)){let r=n.trim();if(!r)continue;let s;try{s=JSON.parse(r)}catch{continue}let i=s.message?.content;Array.isArray(i)&&e.push(...i)}return e}function mK(t){return Bn(AC,t).errors}function yK(t,e=[]){let{value:n,error:r}=yt(t,e);if(r)return{errors:[r]};let s=mK(n);return s.length>0?{errors:s}:{generate:n,errors:[]}}function Yp(t,e=[]){return yK(t.stdout,e)}function EK(t){return t.generate.filter(e=>e.type!=="ui").map(e=>e.id)}function oD(t){return t.generate.filter(e=>e.type==="ui").map(e=>e.id)}var Jp={backend:{stage:"generate",cases:EK,noRecommendCoverage:"recommend.json missing or malformed \u2014 cannot check coverage",noRecommendIntent:"recommend.json missing or malformed \u2014 cannot check intent",uncovered:t=>`recommend case "${t}" is not covered by any generated test`,unknownCovered:t=>`test covers unknown recommend id "${t}"`,unasserted:t=>`case "${t}" has no verified assertion enforcing its expected_observable`,usedCodegen:tD,codegenHint:"These tests were hand-written. Skyramp codegen (skyramp_contract_test_generation / skyramp_integration_test_generation) was available but not used \u2014 it computes valid sample data and response correlations. Prefer scaffolding with it and then refining, especially for the failures above."},ui:{stage:"generate-ui",cases:oD,noRecommendCoverage:"recommend.json not found \u2014 cannot check UI coverage",noRecommendIntent:"recommend.json not found \u2014 cannot check UI intent",uncovered:t=>`UI case "${t}" is not covered by any generated UI test`,unknownCovered:t=>`test covers "${t}" which is not a recommend UI case`,unasserted:t=>`UI case "${t}" has no verified assertion enforcing its expected_observable`,usedCodegen:nD,codegenHint:"This UI test was hand-authored. Skyramp UI codegen (skyramp_ui_test_generation) was available but not used. Prefer scaffolding with it and then refining, especially for the failures above."}},Bre=Un("generate-schema",(t,e)=>Yp(e,t.secretValues));function CK(t){let e=Jp[t];return{name:`${e.stage}-coverage`,verify(n,r){let{generate:s,errors:i}=Yp(r,n.secretValues);if(!s)return kt(this.name,i);let o=qp(n);if(!o)return kt(this.name,[e.noRecommendCoverage]);let c=new Set(s.tests.flatMap(f=>f.covers)),l=[],d=e.cases(o);for(let f of d)c.has(f)||l.push(e.uncovered(f));let A=new Set(t==="ui"?d:o.generate.map(f=>f.id));for(let f of c)A.has(f)||l.push(e.unknownCovered(f));if(t==="backend"){let f=new Set(s.deferredUi),h=new Set(oD(o));for(let y of h)!f.has(y)&&!c.has(y)&&l.push(`UI case "${y}" is neither covered nor deferred to the UI stage`);for(let y of f)h.has(y)||l.push(`deferredUi lists "${y}" which is not a UI case`)}return l.length===0?{name:this.name,passed:!0}:kt(this.name,l)}}}function IK(t){let e=Jp[t];return{name:`${e.stage}-intent`,verify(n,r){let{generate:s,errors:i}=Yp(r,n.secretValues);if(!s)return kt(this.name,i);let o=qp(n);if(!o)return kt(this.name,[e.noRecommendIntent]);let{asserted:c,errors:l,badFiles:d}=RK(s,n.inputs.repositoryPath),A=l.length;for(let h of e.cases(o))c.has(h)||l.push(e.unasserted(h));if(l.length===0)return{name:this.name,passed:!0};let f=kt(this.name,l);return A>0&&A===l.length&&d.size>0?{...f,droppable:[...d]}:f}}}function wK(t){let e=Jp[t];return n=>{if(!n.inputs.skyrampMcp?.command||t==="backend"&&!sC(n))return;let r=Cc.join(n.outputsDir,`${e.stage}-stream.ndjson`);if(!(!ci.existsSync(r)||e.usedCodegen(r)))return rD(r)?e.codegenHint:"Skyramp codegen tools were configured but the MCP server did not connect this session, so they were not available. Hand-authoring was the only option; this is an environment problem, not yours."}}var Qre=CK("backend"),Sre=IK("backend"),vre=wK("backend");var sD=t=>t.replace(/\s+/g,"");var mC={python:[/\bassert\s*[({\w"'`]/g,/\bpytest\.raises\s*\(/g,/\bself\.assert\w*\s*\(/g],typescript:[/\bexpect\s*\(/g,/\.should\b/g,/\bassert\s*[.(]/g],go:[/\bt\.(Error|Errorf|Fatal|Fatalf|Fail|FailNow)\s*\(/g,/\b(assert|require)\.\w+\s*\(/g],java:[/\bassert\w*\s*\(/g,/\bassertThat\s*\(/g],ruby:[/\bexpect\s*[({]/g,/\bassert\w*\b/g,/\.should\b/g]};for(let[t,e]of[["javascript","typescript"],["kotlin","java"]])mC[t]=mC[e];function bK(t,e){if(t.includes(Ku(e))||sD(t).includes(sD(e)))return!0;let n=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r&&!/^(\/\/|#|\*|\/\*)/.test(r));return n.length>0&&n.every(r=>t.includes(Ku(r)))?!0:vK(t,e)}var BK=/\bassert\w*\b|\bexpect\s*\(|\.should\b|\brequire\s*\(/i,QK=12,SK=/,\s*\(\s*#|,\s*f?["'`]|\s+#\s|\s+\/\/|\s*\((?:line|lines|at line)\b|\s*,\s*$/i;function vK(t,e){let n=e.split(/\s*;\s*|\s*\.\.\.\s*|\r?\n/),r=0;for(let s of n){let i=BK.exec(s);if(!i)continue;let o=s.slice(i.index),c=SK.exec(o);if(c&&(o=o.slice(0,c.index)),o=Ku(o).replace(/[,\s]+$/,""),o.length<QK||!t.includes(o))return!1;r++}return r>0}function RK(t,e){let n=new Set,r=[],s=new Set;for(let i of t.tests){let o=Cc.resolve(e,i.file);if(!ci.existsSync(o))continue;let c=Ku(ci.readFileSync(o,"utf-8"));for(let l of i.assertions??[]){if(!bK(c,l.evidence)){r.push(`assertion evidence for "${l.case}" not found in ${i.file} \u2014 cite the real assertion line`),s.add(i.file);continue}i.covers.includes(l.case)?n.add(l.case):(r.push(`assertion cites case "${l.case}" not in that test's covers[]`),s.add(i.file))}}return{asserted:n,errors:r,badFiles:s}}var kK=/\.(spec|test)\.[cm]?[jt]sx?$/i;function aD(t){let e;try{e=(0,iD.execFileSync)("git",[...si,"status","--porcelain","--untracked-files=all"],{env:Lt(),cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return}let n=s=>/_scaffold/i.test(s)||Ip.test(s),r=[];for(let s of e.split(`
122
- `)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),o=i.indexOf(" -> ");if(o!==-1&&(i=i.slice(o+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let c=i.replace(/^\.\//,"");c.startsWith(".skyramp/")||!n(c)||r.push(c)}return r}function xK(t){let e=Jp[t],n=t==="ui";return{name:`${e.stage}-no-litter`,verify(r){let s=aD(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(o=>kK.test(o)===n);return i.length===0?{name:this.name,passed:!0}:kt(this.name,[`${e.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}var Rre=xK("backend");var Bl=ce(require("fs")),$o=ce(require("path"));var Vre=10*6e4;function lD(t){return Bn(oC,t).errors}function UK(t,e=[]){let{value:n,error:r}=yt(t,e);if(r)return{errors:[r]};let s=lD(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}var PK="adapt-scratch",uD=`${PK}/adapt-result.json`;function dD(t,e){let n=$o.join(t.outputsDir,uD),r;try{r=Bl.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(t.secretValues??[]).some(o=>r.includes(o)))return{errors:[`${uD} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=UK(e.stdout,t.secretValues);if(s.adapt)return s;let i=r!==void 0?go(n):void 0;return i!==void 0&&lD(i).length===0?{adapt:i,errors:[]}:s}var use=Un("adapt-schema",dD);var AD=require("child_process");function pD(t){return OK(t)??[]}function OK(t){let e;try{e=(0,AD.execFileSync)("git",[...si,"status","--porcelain","-z","--untracked-files=all"],{env:Lt(),cwd:t,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return}let n=e.split("\0"),r=[];for(let s=0;s<n.length;s++){let i=n[s];if(i.length<4)continue;let o=i.slice(0,2);r.push({code:o,path:i.slice(3)}),(o[0]==="R"||o[0]==="C")&&s++}return r}var yse=2*1024*1024;var zp=u.string().trim().min(1),LK=u.object({cwd:zp.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:u.array(zp).min(1).describe("the command as separate arguments, run without a shell"),env:u.record(u.string(),u.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),$K=u.object({file:zp.describe("a file of the test's checkout, relative to its root"),line:zp.describe("a line of that file, quoted exactly from where its command starts to its end")}),fD=u.object({collected:u.boolean().describe("whether the repo's CI runs this test as it is"),steps:u.array($K).optional().describe("when collected: the line in a CI file that starts the tests, then each line it runs on the way to the test runner"),runner:u.string().optional().describe("when collected: the test runner the last of those lines starts, by the name that line and the list command both use"),list:LK.optional().describe("when collected: a command that lists the tests that runner collects without running them; Testbot runs it, and its output must name this file"),why:u.string().optional().describe("when not collected: why the repo's CI will not run it")});var HK=u.object({route:u.string().describe('the page this step happens on, e.g. "/products/:id"'),action:u.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:u.array(u.string()).optional().describe("the plan clause ids this step exercises"),check:u.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),Ql=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Ql||{}),hD=(r=>(r.Spec="spec",r.PrDescription="pr-description",r.Inferred="inferred",r))(hD||{}),gD=u.object({id:u.string().describe('e.g. "J1"'),name:u.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:u.string().describe("the route the user starts the flow on: the app's normal starting page for it, never a deep link into its middle"),steps:u.array(HK).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:u.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:u.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:u.nativeEnum(Ql).optional().describe("in-process when the repo's in-process tests (components, app routes) can walk the whole flow and check it; else browser"),source:u.nativeEnum(hD).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:u.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:u.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),Kp=u.object({journey:u.string().describe("the plan's journey id"),file:u.string().describe("the browser test file that walks it"),brokeAt:u.object({step:u.number().int().describe("the 1-based step whose check failed first"),expected:u.string(),actual:u.string().describe("what the app did instead, from the runner's output"),notReached:u.array(u.number().int()).optional().describe("later steps the test could not get to")}).optional().describe("only when the journey's test failed on a check: where"),test:u.string().describe("the title of the one test in that file that walks it end to end")});var kse=["stale_test","open_question"],xse=["low","medium","high","critical"];var pe=u.string().trim().min(1),zK=t=>{if(!t||typeof t!="object")return t;let e=t;return typeof e.skip=="string"&&e.skip.trim()&&(e.expected===void 0||e.expected===null)?{...e,expected:"(not tested)"}:t},KK=u.preprocess(zK,u.object({id:pe.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:pe.describe("one testable part of the requirement"),expected:pe.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:u.string().optional().describe("only when no test can check this clause here: why"),type:u.nativeEnum(ii).optional().describe("the test that checks this clause: contract / integration (the API, or code called directly in-process: a function, hook or module) or ui (a page)"),target:u.string().optional().describe('its "METHOD /path", or the page / flow'),steps:u.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:u.string().optional().describe("the finding id, when this clause's test also catches that defect (the defect still gets a case of its own)"),code:u.string().optional().describe("path:line of the code that decides this clause, when there is one; in another repo of the change, that repo's directory name then its path"),stated:u.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:u.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes"),browserOnly:u.boolean().optional().describe("true when its behaviour happens only in a browser: real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript"),browserHarness:u.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)")})),mD=u.object({spec:u.string().optional().describe("file:line of a spec in the repository"),prDescription:u.boolean().optional().describe("or true when a pull request description says otherwise"),reference:u.string().optional().describe("or the key of an item the run was given, as listed"),says:pe.describe("what it says there, in its own words, copied exactly"),criterion:u.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(t=>[!!t.prDescription,!!t.spec?.trim(),!!t.reference?.trim()].filter(Boolean).length===1,{message:`names no source, or more than one: give "spec" its file:line or "reference" an item's key, or set "prDescription", one of them; list each source as its own entry`}),ZK=u.object({id:pe.describe('the label its source gives it ("AC-3", "REQ-12"; item 4 of a numbered list is "R4"), else "R1", "R2"\u2026 in order'),statement:pe,source:u.nativeEnum(_r).describe("requirement-reference (an item the run was given), spec, pr-description (also for what the change is evidently meant to do when nothing is written down), or could-break (what the change could break that no requirement mentions)"),reference:u.string().optional().describe('requirement-reference only: the key of its item as listed, e.g. "PAY-184", or a Confluence page id such as "3021"'),evidence:pe.describe("where it is stated: for requirement-reference, the item's own words, copied exactly; else file:line, a doc section, or the quoted phrase"),criterion:u.number().int().positive().optional().describe("requirement-reference only: leave it out; Testbot numbers each criterion by the item's own label (AC2, 2.), else after the item's labels"),notInChange:u.string().optional().describe("requirement-reference only: when the change does not touch this criterion at all (e.g. a later step of a staged rollout), why; give it no clauses"),overrules:u.array(mD).optional().describe("requirement-reference only: each lower-ranked source that says otherwise, a spec in the repository, a PR description or another item; this requirement wins, so test what it says"),clauses:u.array(KK)}),yD=(s=>(s.ServerError="server-error",s.DataLost="data-lost",s.FinalState="final-state",s.DerivedValues="derived-values",s))(yD||{}),XK=u.object({id:pe.describe('e.g. "F1"'),file:pe,line:u.number().optional(),claim:pe.describe("the defect, in one sentence"),severity:u.nativeEnum(Uo),evidence:pe.describe("the code line, or the probe request and response, that shows it"),conflictsWith:u.array(pe).optional().describe("requirement or clause ids it violates"),keeps:u.string().optional().describe("for a defect no requirement or clause states: path:line of the code beside the change that keeps the rule it breaks"),rule:u.nativeEnum(yD).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:u.string().optional().describe("only when the base already does this, in code the change left as it was: where the base does it (its file:line); such a defect gets no case"),needsApp:u.enum(["browser","live-api"]).optional().describe("only when the running app alone can show this defect and the repo has no in-process test that can: browser (page script, what the user sees after a click or a save) or live-api (code the repo tests only against the running app's API)")}),e3=u.object({id:pe.describe('e.g. "Q1"'),question:pe.describe("what is unsettled, as a question the PR author can answer"),readings:u.array(pe).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:u.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:u.array(mD).optional().describe("when sources of the same rank disagree on it: each of them")}),t3=u.object({id:pe.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:u.nativeEnum(ii).describe("contract / integration: checks the API, or calls code directly in-process (a function, hook or module); ui: checks what a user sees or does on a page"),target:pe.describe('"METHOD /path", or the page / flow'),clause:u.string().optional().describe("the clause id this case checks"),finding:u.string().optional().describe("the finding id this case catches"),steps:pe.describe("what the test does"),expected:pe.describe("the expected outcome, from the clause"),mutates:u.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes")}),n3=u.object({test:pe.describe("existing test file"),action:u.nativeEnum(Is),reason:pe,mutates:u.boolean().optional().describe("true when the maintained test changes state"),clauses:u.array(pe).optional().describe("the clause ids this test checks")}),r3=u.object({outcome:u.nativeEnum(Es).describe("clean | recipe-drift (you had to fix the recipe) | change-broke-bringup (this PR broke start-up) | bringup-failed (the environment, not the PR)"),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app"),health:u.object({url:u.string().optional(),command:u.string().optional(),output:u.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:u.string().optional().describe("command that stops the app"),dependencies:u.record(u.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:u.array(u.string()).optional().describe("what you changed in the recipe"),error:u.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:u.array(u.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:u.object({username:pe,password:u.string()}).optional().describe("the account the tests sign in as, when they sign in: each a literal value the recipe seeds, or $VARIABLE when a secret in the environment holds it"),revisions:TE.optional()}),oie=u.object({schemaVersion:u.literal(1),requirements:u.array(ZK),findings:u.array(XK),cases:u.array(t3).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:u.array(e3).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:u.array(n3),journeys:u.array(gD).optional().describe("the user journeys that, together, pass through everything the change alters that a user sees or does; empty when it alters nothing a user sees"),notInJourney:u.array(u.object({clause:pe,why:pe})).optional().describe("a clause a user sees or does that no journey walks, and why: none can reach it through the UI, or it is downstream of this change and not walked here"),unplannedComponents:u.array(u.object({components:u.array(pe).min(1).describe("changed components, as the change lists them"),why:pe})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:bl.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:r3.optional().describe("omit when no app was needed or none was started"),summary:pe.describe("one paragraph: what the change does and where the risk is")});var ED=(n=>(n.Backend="backend",n.Ui="ui",n))(ED||{});var Sl=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Sl||{}),s3=u.object({file:pe.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:u.nativeEnum(ED),change:u.nativeEnum(Sl).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:u.array(u.string()).describe("the plan case ids this file tests"),defect:u.boolean().optional().describe("true when a case of it fails because the app is wrong and the test is right \u2014 kept failing on purpose"),staleBecause:u.object({requirement:pe.describe("the requirement or clause id the change deliberately alters"),line:pe.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),result:u.object({exit:u.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:u.array(u.object({case:pe,status:u.nativeEnum(qn),defect:u.boolean().optional().describe("for a failing case: true when the app is wrong and the test is right; false when the test is at fault and you could not fix it"),failure:u.string().optional().describe("for a failing case: the runner's failure for it as printed (the error and the line it was raised at), not a summary"),cause:u.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:u.string().optional().describe("for a case you keep as a defect: the words of the PR description, a requirement or clause of the plan, or the code a finding's keeps names, that state what its failing check expects, quoted exactly")})).describe("one entry per covered case, from the runner's own output"),details:u.string().optional().describe("what failed and why, or why it was not run")}),assertions:u.array(u.object({case:pe,evidence:pe})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:u.array(u.object({name:pe.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:u.array(pe).describe("the plan case ids it checks")})).optional().describe("for a file you added or updated: each test function in it and the plan case ids it checks"),skyramp:u.object({draft:u.union([u.string(),u.array(u.string())]).optional().describe("the draft path the Skyramp helper returned for this test, or each path when the test was made from several drafts"),handWritten:u.string().optional().describe("why it is written by hand: the helper call you made and what it returned")}).optional().describe("only for a test of a case the Skyramp API block lists: where it came from"),context:u.array(dC).optional().describe("what the test sets up outside its own process that another test could run into: data it creates in the app, a Skyramp mock, an env override; omit when none"),isolatedRun:pe.optional().describe("for a test with a context: the command, from its checkout's root and without a shell, that runs only this file"),ci:fD.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:yc.optional().describe(`for a file in ${Ec}, added, updated or re-run: how the run executes only this file's tests, with the repository's own runner and the report it writes (junit or trx to ${Yn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),i3=t=>{if(!t||typeof t!="object")return t;let{test:e,...n}=t;return typeof e=="string"&&e.trim()&&n.tests===void 0?{...n,tests:[e]}:t},o3=u.preprocess(i3,u.object({description:pe.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:u.nativeEnum(Uo).optional(),sourceFile:u.string().optional().describe("the app file at fault"),sourceLine:u.number().optional(),tests:u.array(pe).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:u.string().optional().describe("the plan's finding id, when it is one"),requirements:u.array(pe).optional().describe("the plan's requirement or clause ids it violates")})),aie=u.object({schemaVersion:u.literal(1),tests:u.array(s3),notWritten:u.array(u.object({case:pe,reason:pe})).describe("every plan case no test covers, and why"),journeys:u.array(Kp).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:u.object({command:u.string(),clean:u.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repo has one: the exact command, with its file paths (Testbot re-runs it)"),dependenciesAdded:u.array(u.object({package:pe,manifest:pe.describe("the manifest file's path relative to its checkout (e.g. package.json, pom.xml or pyproject.toml), and nothing else; name another checkout in repository"),repository:pe.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:pe.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).optional().describe("every package you added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own"),supportFiles:u.array(pe).optional().describe("every file that is not a test you created or changed for your tests, which they need to compile or run (a helper module, page object, fixture, or a snapshot the runner wrote for them), named as you name a test; Testbot delivers only the tests you list and the files under supportFiles"),ciNotes:u.string().optional().describe("for each test whose ci says the repo's CI will not run it: the test, and the exact change the author must make for CI to run it"),commit:u.object({message:pe.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:pe.describe("at most 72 characters"),prBody:pe.describe("what the tests cover and what they found")}),report:u.object({summary:pe.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:u.array(o3).describe("every defect the tests found"),nextSteps:u.array(u.string())})});var cie={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var ID=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(ID||{}),Nt=u.string().trim().min(1),a3=u.object({expectation:Nt.max(300).describe("the behavior this assertion pins, in words"),source:u.nativeEnum(ID),expected:Nt.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),c3=u.object({file:Nt.describe("path of the NEW test file you wrote, relative to its repository"),repository:Nt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Nt.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:yc.optional().describe(`for ${Ec}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:u.array(Nt).length(1).describe("the ONE behavior id, or defect id, from the plan that the tests in names provide evidence for; a file covering several is listed once per id"),names:u.array(Nt).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:u.array(a3).min(1)}),Zp=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Zp||{}),CD=300,u3=u.object({file:Nt.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Nt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:u.nativeEnum(Zp),staleBecause:u.object({requirement:Nt.describe("the requirement or clause id the change deliberately alters"),line:Nt.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),reason:u.preprocess(t=>typeof t=="string"?t.trim().slice(0,CD):t,Nt.max(CD)).describe("what the change deliberately altered that made the test wrong")}),EC=u.object({schemaVersion:u.literal(1),tests:u.array(c3),maintained:u.array(u3).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:u.array(u.object({id:Nt,reason:Nt.max(300)})).optional().describe("defects the plan found that no in-process test can reach, each with why; omit when every defect has a test"),journeys:u.array(Kp).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:u.array(u.object({journey:Nt,missing:Nt.transform(t=>t.length>300?`${t.slice(0,299)}\u2026`:t)})).optional().describe("a planned journey no in-process test can walk here, with what it needs that is missing; it is reported as not covered"),lint:u.object({command:u.string(),clean:u.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Nt.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var ef="generate-unit.json";function A3(t){let{value:e,error:n}=yt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Bn(EC,e);return s.length?{errors:s}:{output:r,errors:[]}}function p3(t){return A3(t.stdout)}var Yie=Un("generate-unit-schema",(t,e)=>p3(e));var Xp=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,Jie=[[/\b(localhost|127\.0\.0\.1|0\.0\.0\.0)\b/,"a local server address"],[/^\s*(import|from)\s+(requests|aiohttp|urllib3|websockets?)\b/m,"an HTTP client"],[/^\s*(?:import|from)\s+(?:urllib\.request|http\.client|http\.server|socket|ssl|ftplib|smtplib|telnetlib)\b|^\s*from\s+urllib\s+import\b[^\n]*\brequest\b|\burlopen\s*\(/m,"a standard-library network client"],[/\bfrom\s+["'](axios|node-fetch|undici|ws)["']|require\(\s*["'](axios|node-fetch|undici|ws)["']\s*\)/,"an HTTP client"],[new RegExp(String.raw`\bfrom\s+["']${Xp}["']|\bimport\s+["']${Xp}["']|require\(\s*["']${Xp}["']\s*\)|\bimport\(\s*["']${Xp}["']\s*\)`),"Node's network modules"],[/\bfetch\s*\(|\bnew\s+(XMLHttpRequest|WebSocket)\b/,"a network call (fetch, XMLHttpRequest, WebSocket)"],[/\bskyramp\b/i,"the Skyramp runtime (a runtime mock or client)"]];var ui=ce(require("path"));var soe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var CC=t=>new Map((t??[]).flatMap(e=>e.file?[[Ju(e.key),e.file.name]]:[])),h3=10*1024*1024,g3=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",QD=(t,e)=>ui.join(ui.dirname(t),`${ui.basename(t,ui.extname(t))}${e}`),m3=t=>QD(t,".extracted.txt");var y3=t=>QD(t,".quotes.txt");function SD(t){return g3(t.file)?m3(t.path):t.file?.mediaType==="application/pdf"?y3(t.path):t.path}var hoe=new Set(["targeted_unit","existing_evidence_sufficient"]);var w3="triage.json";var sae=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),iae={existing_evidence:"existing evidence",unaffected:"showing the change cannot reach it",existing_unit:"running the existing unit tests",new_unit:"a new unit test",runtime:"tests against the running application"};function b3(t){let{value:e,error:n}=yt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Bn(bl,e);return s.length?{errors:s}:{triage:r,errors:[]}}function B3(t){return b3(t.stdout)}var oae=Un("triage-schema",(t,e)=>B3(e));function Q3(t){let e=t.inputs?.pipeline;return e?t.state.stages[e==="two-step"?"plan":"triage"]:t.state.stages.triage??t.state.stages.plan}function wC(t){if(Q3(t)?.status==="passed")return go(vl.join(t.outputsDir,w3))}function bC(t){return jN(nC(t.inputs,Ze(t,`${yl}.json`),wC(t)?.sutRequired))}var aae=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);qt();qt();function RD(t,e){return e?`<!-- skyramp-testbot-run: ${e} -->
122
+ `)){if(!s.trim()||s.length>1&&s[1]==="D")continue;let i=s.slice(3).trim(),o=i.indexOf(" -> ");if(o!==-1&&(i=i.slice(o+4).trim()),i=i.replace(/^"|"$/g,""),!i)continue;let c=i.replace(/^\.\//,"");c.startsWith(".skyramp/")||!n(c)||r.push(c)}return r}function xK(t){let e=Jp[t],n=t==="ui";return{name:`${e.stage}-no-litter`,verify(r){let s=aD(r.inputs.repositoryPath);if(s===void 0)return{name:this.name,passed:!0};let i=s.filter(o=>kK.test(o)===n);return i.length===0?{name:this.name,passed:!0}:kt(this.name,[`${e.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${i.slice(0,6).join(", ")}`])}}}var Rre=xK("backend");var Bl=ce(require("fs")),$o=ce(require("path"));var Vre=10*6e4;function lD(t){return Bn(oC,t).errors}function UK(t,e=[]){let{value:n,error:r}=yt(t,e);if(r)return{errors:[r]};let s=lD(n);return s.length>0?{errors:s}:{adapt:n,errors:[]}}var PK="adapt-scratch",uD=`${PK}/adapt-result.json`;function dD(t,e){let n=$o.join(t.outputsDir,uD),r;try{r=Bl.readFileSync(n,"utf-8")}catch{r=void 0}if(r!==void 0&&(t.secretValues??[]).some(o=>r.includes(o)))return{errors:[`${uD} contains a secret value (token / credential) \u2014 never write it anywhere`]};let s=UK(e.stdout,t.secretValues);if(s.adapt)return s;let i=r!==void 0?go(n):void 0;return i!==void 0&&lD(i).length===0?{adapt:i,errors:[]}:s}var use=Un("adapt-schema",dD);var AD=require("child_process");function pD(t){return OK(t)??[]}function OK(t){let e;try{e=(0,AD.execFileSync)("git",[...si,"status","--porcelain","-z","--untracked-files=all"],{env:Lt(),cwd:t,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return}let n=e.split("\0"),r=[];for(let s=0;s<n.length;s++){let i=n[s];if(i.length<4)continue;let o=i.slice(0,2);r.push({code:o,path:i.slice(3)}),(o[0]==="R"||o[0]==="C")&&s++}return r}var yse=2*1024*1024;var zp=u.string().trim().min(1),LK=u.object({cwd:zp.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:u.array(zp).min(1).describe("the command as separate arguments, run without a shell"),env:u.record(u.string(),u.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),$K=u.object({file:zp.describe("a file of the test's checkout, relative to its root"),line:zp.describe("a line of that file, quoted exactly from where its command starts to its end")}),fD=u.object({collected:u.boolean().describe("whether the repo's CI runs this test as it is"),steps:u.array($K).optional().describe("when collected: the line in a CI file that starts the tests, then each line it runs on the way to the test runner"),runner:u.string().optional().describe("when collected: the test runner the last of those lines starts, by the name that line and the list command both use"),list:LK.optional().describe("when collected: a command that lists the tests that runner collects without running them; Testbot runs it, and its output must name this file"),why:u.string().optional().describe("when not collected: why the repo's CI will not run it")});var HK=u.object({route:u.string().describe('the page this step happens on, e.g. "/products/:id"'),action:u.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:u.array(u.string()).optional().describe("the plan clause ids this step exercises"),check:u.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),Ql=(n=>(n.InProcess="in-process",n.Browser="browser",n))(Ql||{}),hD=(r=>(r.Spec="spec",r.PrDescription="pr-description",r.Inferred="inferred",r))(hD||{}),gD=u.object({id:u.string().describe('e.g. "J1"'),name:u.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:u.string().describe("the route the user starts the flow on: the app's normal starting page for it, never a deep link into its middle"),steps:u.array(HK).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:u.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:u.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:u.nativeEnum(Ql).optional().describe("in-process when the repo's in-process tests (components, app routes) can walk the whole flow and check it; else browser"),source:u.nativeEnum(hD).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:u.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:u.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),Kp=u.object({journey:u.string().describe("the plan's journey id"),file:u.string().describe("the browser test file that walks it"),brokeAt:u.object({step:u.number().int().describe("the 1-based step whose check failed first"),expected:u.string(),actual:u.string().describe("what the app did instead, from the runner's output"),notReached:u.array(u.number().int()).optional().describe("later steps the test could not get to")}).optional().describe("only when the journey's test failed on a check: where"),test:u.string().describe("the title of the one test in that file that walks it end to end")});var kse=["stale_test","open_question"],xse=["low","medium","high","critical"];var pe=u.string().trim().min(1),zK=t=>{if(!t||typeof t!="object")return t;let e=t;return typeof e.skip=="string"&&e.skip.trim()&&(e.expected===void 0||e.expected===null)?{...e,expected:"(not tested)"}:t},KK=u.preprocess(zK,u.object({id:pe.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:pe.describe("one testable part of the requirement"),expected:pe.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:u.string().optional().describe("only when no test can check this clause here: why"),type:u.nativeEnum(ii).optional().describe("the test that checks this clause: contract / integration (the API, or code called directly in-process: a function, hook or module) or ui (a page)"),target:u.string().optional().describe('its "METHOD /path", or the page / flow'),steps:u.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:u.string().optional().describe("the finding id, when this clause's test also catches that defect (the defect still gets a case of its own)"),code:u.string().optional().describe("path:line of the code that decides this clause, when there is one; in another repo of the change, that repo's directory name then its path"),stated:u.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:u.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes"),browserOnly:u.boolean().optional().describe("true when its behaviour happens only in a browser: real clicks or keys driving page script, client-side sorting or filtering, script-driven DOM updates, focus, drag-and-drop, navigation, rendering that depends on CSS or JavaScript"),browserHarness:u.string().optional().describe("browserOnly, off the runtime path: the path of the repo's in-process browser suite its test goes in (e.g. a Django StaticLiveServerTestCase test that drives Selenium)")})),mD=u.object({spec:u.string().optional().describe("file:line of a spec in the repository"),prDescription:u.boolean().optional().describe("or true when a pull request description says otherwise"),reference:u.string().optional().describe("or the key of an item the run was given, as listed"),says:pe.describe("what it says there, in its own words, copied exactly"),criterion:u.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(t=>[!!t.prDescription,!!t.spec?.trim(),!!t.reference?.trim()].filter(Boolean).length===1,{message:`names no source, or more than one: give "spec" its file:line or "reference" an item's key, or set "prDescription", one of them; list each source as its own entry`}),ZK=u.object({id:pe.describe('the label its source gives it ("AC-3", "REQ-12"; item 4 of a numbered list is "R4"), else "R1", "R2"\u2026 in order'),statement:pe,source:u.nativeEnum(_r).describe("requirement-reference (an item the run was given), spec, pr-description (also for what the change is evidently meant to do when nothing is written down), or could-break (what the change could break that no requirement mentions)"),reference:u.string().optional().describe('requirement-reference only: the key of its item as listed, e.g. "PAY-184", or a Confluence page id such as "3021"'),evidence:pe.describe("where it is stated: for requirement-reference, the item's own words, copied exactly; else file:line, a doc section, or the quoted phrase"),criterion:u.number().int().positive().optional().describe("requirement-reference only: leave it out; Testbot numbers each criterion by the item's own label (AC2, 2.), else after the item's labels"),notInChange:u.string().optional().describe("requirement-reference only: when the change does not touch this criterion at all (e.g. a later step of a staged rollout), why; give it no clauses"),overrules:u.array(mD).optional().describe("requirement-reference only: each lower-ranked source that says otherwise, a spec in the repository, a PR description or another item; this requirement wins, so test what it says"),clauses:u.array(KK)}),yD=(s=>(s.ServerError="server-error",s.DataLost="data-lost",s.FinalState="final-state",s.DerivedValues="derived-values",s))(yD||{}),XK=u.object({id:pe.describe('e.g. "F1"'),file:pe,line:u.number().optional(),claim:pe.describe("the defect, in one sentence"),severity:u.nativeEnum(Uo),evidence:pe.describe("the code line, or the probe request and response, that shows it"),conflictsWith:u.array(pe).optional().describe("requirement or clause ids it violates"),keeps:u.string().optional().describe("for a defect no requirement or clause states: path:line of the code beside the change that keeps the rule it breaks"),rule:u.nativeEnum(yD).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:u.string().optional().describe("only when the base already does this, in code the change left as it was: where the base does it (its file:line); such a defect gets no case"),needsApp:u.enum(["browser","live-api"]).optional().describe("only when the running app alone can show this defect and the repo has no in-process test that can: browser (page script, what the user sees after a click or a save) or live-api (code the repo tests only against the running app's API)")}),e3=u.object({id:pe.describe('e.g. "Q1"'),question:pe.describe("what is unsettled, as a question the PR author can answer"),readings:u.array(pe).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:u.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:u.array(mD).optional().describe("when sources of the same rank disagree on it: each of them")}),t3=u.object({id:pe.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:u.nativeEnum(ii).describe("contract / integration: checks the API, or calls code directly in-process (a function, hook or module); ui: checks what a user sees or does on a page"),target:pe.describe('"METHOD /path", or the page / flow'),clause:u.string().optional().describe("the clause id this case checks"),finding:u.string().optional().describe("the finding id this case catches"),steps:pe.describe("what the test does"),expected:pe.describe("the expected outcome, from the clause"),mutates:u.boolean().optional().describe("true when its test changes state, in the test or its setup: an API POST, PUT, PATCH or DELETE, or a UI flow that submits, creates, edits or deletes")}),n3=u.object({test:pe.describe("existing test file"),action:u.nativeEnum(Is),reason:pe,mutates:u.boolean().optional().describe("true when the maintained test changes state"),clauses:u.array(pe).optional().describe("the clause ids this test checks")}),r3=u.object({outcome:u.nativeEnum(Es).describe("clean | recipe-drift (you had to fix the recipe) | change-broke-bringup (this PR broke start-up) | bringup-failed (the environment, not the PR)"),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app"),health:u.object({url:u.string().optional(),command:u.string().optional(),output:u.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:u.string().optional().describe("command that stops the app"),dependencies:u.record(u.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:u.array(u.string()).optional().describe("what you changed in the recipe"),error:u.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:u.array(u.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:u.object({username:pe,password:u.string()}).optional().describe("the account the tests sign in as, when they sign in: each a literal value the recipe seeds, or $VARIABLE when a secret in the environment holds it"),revisions:TE.optional()}),oie=u.object({schemaVersion:u.literal(1),requirements:u.array(ZK),findings:u.array(XK),cases:u.array(t3).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:u.array(e3).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:u.array(n3),journeys:u.array(gD).optional().describe("the user journeys that, together, pass through everything the change alters that a user sees or does; empty when it alters nothing a user sees"),notInJourney:u.array(u.object({clause:pe,why:pe})).optional().describe("a clause a user sees or does that no journey walks, and why: none can reach it through the UI, or it is downstream of this change and not walked here"),unplannedComponents:u.array(u.object({components:u.array(pe).min(1).describe("changed components, as the change lists them"),why:pe})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:bl.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:r3.optional().describe("omit when no app was needed or none was started"),summary:pe.describe("one paragraph: what the change does and where the risk is")});var ED=(n=>(n.Backend="backend",n.Ui="ui",n))(ED||{});var Sl=(s=>(s.Added="added",s.Updated="updated",s.Deleted="deleted",s.Unchanged="unchanged",s))(Sl||{}),s3=u.object({file:pe.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:u.nativeEnum(ED),change:u.nativeEnum(Sl).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:u.array(u.string()).describe("the plan case ids this file tests, each with its own result under result.cases"),defect:u.boolean().optional().describe("true when a case of it fails because the app is wrong and the test is right \u2014 kept failing on purpose"),staleBecause:u.object({requirement:pe.describe("the requirement or clause id the change deliberately alters"),line:pe.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),result:u.object({exit:u.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:u.array(u.object({case:pe,status:u.nativeEnum(qn),defect:u.boolean().optional().describe("for a failing case: true when the app is wrong and the test is right; false when the test is at fault and you could not fix it"),failure:u.string().optional().describe("for a failing case: the runner's failure for it as printed (the error and the line it was raised at), not a summary"),cause:u.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:u.string().optional().describe("for a case you keep as a defect: the words of the PR description, a requirement or clause of the plan, or the code a finding's keeps names, that state what its failing check expects, quoted exactly")})).describe("one entry per covered case, from the runner's own output"),details:u.string().optional().describe("what failed and why, or why it was not run")}),assertions:u.array(u.object({case:pe,evidence:pe})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:u.array(u.object({name:pe.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:u.array(pe).describe("the plan case ids it checks")})).optional().describe("for a file you added or updated: each test function in it and the plan case ids it checks"),skyramp:u.object({draft:u.union([u.string(),u.array(u.string())]).optional().describe("the draft path the Skyramp helper returned for this test, or each path when the test was made from several drafts"),handWritten:u.string().optional().describe("why it is written by hand: the helper call you made and what it returned")}).optional().describe("only for a test of a case the Skyramp API block lists: where it came from"),context:u.array(dC).optional().describe("what the test sets up outside its own process that another test could run into: data it creates in the app, a Skyramp mock, an env override; omit when none"),isolatedRun:pe.optional().describe("for a test with a context: the command, from its checkout's root and without a shell, that runs only this file"),ci:fD.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:yc.optional().describe(`for a file in ${Ec}, added, updated or re-run: how the run executes only this file's tests, with the repository's own runner and the report it writes (junit or trx to ${Yn}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),i3=t=>{if(!t||typeof t!="object")return t;let{test:e,...n}=t;return typeof e=="string"&&e.trim()&&n.tests===void 0?{...n,tests:[e]}:t},o3=u.preprocess(i3,u.object({description:pe.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:u.nativeEnum(Uo).optional(),sourceFile:u.string().optional().describe("the app file at fault"),sourceLine:u.number().optional(),tests:u.array(pe).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:u.string().optional().describe("the plan's finding id, when it is one"),requirements:u.array(pe).optional().describe("the plan's requirement or clause ids it violates")})),aie=u.object({schemaVersion:u.literal(1),tests:u.array(s3),notWritten:u.array(u.object({case:pe,reason:pe})).describe("every plan case no test covers, and why"),journeys:u.array(Kp).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:u.object({command:u.string(),clean:u.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repo has one: the exact command, with its file paths (Testbot re-runs it)"),dependenciesAdded:u.array(u.object({package:pe,manifest:pe.describe("the manifest file's path relative to its checkout (e.g. package.json, pom.xml or pyproject.toml), and nothing else; name another checkout in repository"),repository:pe.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:pe.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).optional().describe("every package you added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own"),supportFiles:u.array(pe).optional().describe("every file that is not a test you created or changed for your tests, which they need to compile or run (a helper module, page object, fixture, or a snapshot the runner wrote for them), named as you name a test; Testbot delivers only the tests you list and the files under supportFiles"),ciNotes:u.string().optional().describe("for each test whose ci says the repo's CI will not run it: the test, and the exact change the author must make for CI to run it"),commit:u.object({message:pe.describe('"Skyramp Testbot: \u2026", subject line at most 72 characters'),prTitle:pe.describe("at most 72 characters"),prBody:pe.describe("what the tests cover and what they found")}),report:u.object({summary:pe.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:u.array(o3).describe("every defect the tests found"),nextSteps:u.array(u.string())})});var cie={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var ID=(r=>(r.Requirement="requirement",r.PrDescription="pr_description",r.Code="code",r))(ID||{}),Nt=u.string().trim().min(1),a3=u.object({expectation:Nt.max(300).describe("the behavior this assertion pins, in words"),source:u.nativeEnum(ID),expected:Nt.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),c3=u.object({file:Nt.describe("path of the NEW test file you wrote, relative to its repository"),repository:Nt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:Nt.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:yc.optional().describe(`for ${Ec}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:u.array(Nt).length(1).describe("the ONE behavior id, or defect id, from the plan that the tests in names provide evidence for; a file covering several is listed once per id"),names:u.array(Nt).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:u.array(a3).min(1)}),Zp=(n=>(n.Updated="updated",n.Deleted="deleted",n))(Zp||{}),CD=300,u3=u.object({file:Nt.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:Nt.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:u.nativeEnum(Zp),staleBecause:u.object({requirement:Nt.describe("the requirement or clause id the change deliberately alters"),line:Nt.describe("path:line (or path) of the application code the change altered that makes this test's old expectation wrong")}).optional().describe("for an existing test you updated: why it is out of date"),reason:u.preprocess(t=>typeof t=="string"?t.trim().slice(0,CD):t,Nt.max(CD)).describe("what the change deliberately altered that made the test wrong")}),EC=u.object({schemaVersion:u.literal(1),tests:u.array(c3),maintained:u.array(u3).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:u.array(u.object({id:Nt,reason:Nt.max(300)})).optional().describe("defects the plan found that no in-process test can reach, each with why; omit when every defect has a test"),journeys:u.array(Kp).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:u.array(u.object({journey:Nt,missing:Nt.transform(t=>t.length>300?`${t.slice(0,299)}\u2026`:t)})).optional().describe("a planned journey no in-process test can walk here, with what it needs that is missing; it is reported as not covered"),lint:u.object({command:u.string(),clean:u.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:Nt.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var ef="generate-unit.json";function A3(t){let{value:e,error:n}=yt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Bn(EC,e);return s.length?{errors:s}:{output:r,errors:[]}}function p3(t){return A3(t.stdout)}var Yie=Un("generate-unit-schema",(t,e)=>p3(e));var Xp=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,Jie=[[/\b(localhost|127\.0\.0\.1|0\.0\.0\.0)\b/,"a local server address"],[/^\s*(import|from)\s+(requests|aiohttp|urllib3|websockets?)\b/m,"an HTTP client"],[/^\s*(?:import|from)\s+(?:urllib\.request|http\.client|http\.server|socket|ssl|ftplib|smtplib|telnetlib)\b|^\s*from\s+urllib\s+import\b[^\n]*\brequest\b|\burlopen\s*\(/m,"a standard-library network client"],[/\bfrom\s+["'](axios|node-fetch|undici|ws)["']|require\(\s*["'](axios|node-fetch|undici|ws)["']\s*\)/,"an HTTP client"],[new RegExp(String.raw`\bfrom\s+["']${Xp}["']|\bimport\s+["']${Xp}["']|require\(\s*["']${Xp}["']\s*\)|\bimport\(\s*["']${Xp}["']\s*\)`),"Node's network modules"],[/\bfetch\s*\(|\bnew\s+(XMLHttpRequest|WebSocket)\b/,"a network call (fetch, XMLHttpRequest, WebSocket)"],[/\bskyramp\b/i,"the Skyramp runtime (a runtime mock or client)"]];var ui=ce(require("path"));var soe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var CC=t=>new Map((t??[]).flatMap(e=>e.file?[[Ju(e.key),e.file.name]]:[])),h3=10*1024*1024,g3=t=>t?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||t?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",QD=(t,e)=>ui.join(ui.dirname(t),`${ui.basename(t,ui.extname(t))}${e}`),m3=t=>QD(t,".extracted.txt");var y3=t=>QD(t,".quotes.txt");function SD(t){return g3(t.file)?m3(t.path):t.file?.mediaType==="application/pdf"?y3(t.path):t.path}var hoe=new Set(["targeted_unit","existing_evidence_sufficient"]);var w3="triage.json";var sae=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),iae={existing_evidence:"existing evidence",unaffected:"showing the change cannot reach it",existing_unit:"running the existing unit tests",new_unit:"a new unit test",runtime:"tests against the running application"};function b3(t){let{value:e,error:n}=yt(t);if(n)return{errors:[n]};let{value:r,errors:s}=Bn(bl,e);return s.length?{errors:s}:{triage:r,errors:[]}}function B3(t){return b3(t.stdout)}var oae=Un("triage-schema",(t,e)=>B3(e));function Q3(t){let e=t.inputs?.pipeline;return e?t.state.stages[e==="two-step"?"plan":"triage"]:t.state.stages.triage??t.state.stages.plan}function wC(t){if(Q3(t)?.status==="passed")return go(vl.join(t.outputsDir,w3))}function bC(t){return jN(nC(t.inputs,Ze(t,`${yl}.json`),wC(t)?.sutRequired))}var aae=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);qt();qt();function RD(t,e){return e?`<!-- skyramp-testbot-run: ${e} -->
123
123
  ${t}`:t}var xD=600,nf=300;function kD(t){return typeof t=="string"?t.trim():t instanceof Buffer?t.toString("utf-8").trim():""}function S3(t){let e=t,n=(typeof e?.message=="string"?e.message:String(t)).trim(),r=[kD(e?.stderr),kD(e?.stdout)].filter(Boolean);return r.length?[n.split(`
124
124
  `)[0],...r].join(`
125
125
  `):n}function TD(t,e,n,r=0){let s=t.join(e);if(s.length<=n)return s;let[i="",...o]=t;if(!o.length)return`${i.slice(0,n-1)}\u2026`;let c=i.length<=r?i:i.slice(0,Math.floor(n/3)),l=n-c.length-e.length-1;return`${c}${e}\u2026${o.join(e).slice(-l)}`}function ND(t,e){return TD(t.trim().split(`