@skyramp/testbot-core 0.13.0-v3.365 → 0.13.0-v3.366
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +162 -162
- package/dist/post.js +2 -2
- package/dist/runner-client.cjs +2 -2
- package/package.json +1 -1
package/dist/post.js
CHANGED
|
@@ -113,7 +113,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}fun
|
|
|
113
113
|
`+A.slice(Q,$),Q=$+1),w=D;return O+=`
|
|
114
114
|
`,A.length-Q>v&&w>Q?O+=A.slice(Q,w)+`
|
|
115
115
|
`+A.slice(w+1):O+=A.slice(Q),O.slice(1)}function on(A){let v="",I=0;for(let x=0;x<A.length;I>=65536?x+=2:x++){I=Ft(A,x);let Q=le[I];!Q&&_t(I)?(v+=A[x],I>=65536&&(v+=A[x+1])):v+=Q||je(I)}return v}function da(A,v,I){let x="",Q=A.tag;for(let $=0,w=I.length;$<w;$+=1){let D=I[$];A.replacer&&(D=A.replacer.call(I,String($),D)),(y(A,v,D,!1,!1)||typeof D>"u"&&y(A,v,null,!1,!1))&&(x!==""&&(x+=","+(A.condenseFlow?"":" ")),x+=A.dump)}A.tag=Q,A.dump="["+x+"]"}function oi(A,v,I,x){let Q="",$=A.tag;for(let w=0,D=I.length;w<D;w+=1){let O=I[w];A.replacer&&(O=A.replacer.call(I,String(w),O)),(y(A,v+1,O,!0,!0,!1,!0)||typeof O>"u"&&y(A,v+1,null,!0,!0,!1,!0))&&((!x||Q!=="")&&(Q+=et(A,v)),A.dump&&a===A.dump.charCodeAt(0)?Q+="-":Q+="- ",Q+=A.dump)}A.tag=$,A.dump=Q||"[]"}function pa(A,v,I){let x="",Q=A.tag,$=Object.keys(I);for(let w=0,D=$.length;w<D;w+=1){let O="";x!==""&&(O+=", "),A.condenseFlow&&(O+='"');let z=$[w],q=I[z];A.replacer&&(q=A.replacer.call(I,z,q)),y(A,v,z,!1,!1)&&(A.dump.length>1024&&(O+="? "),O+=A.dump+(A.condenseFlow?'"':"")+":"+(A.condenseFlow?"":" "),y(A,v,q,!1,!1)&&(O+=A.dump,x+=O))}A.tag=Q,A.dump="{"+x+"}"}function fa(A,v,I,x){let Q="",$=A.tag,w=Object.keys(I);if(A.sortKeys===!0)w.sort();else if(typeof A.sortKeys=="function")w.sort(A.sortKeys);else if(A.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let D=0,O=w.length;D<O;D+=1){let z="";(!x||Q!=="")&&(z+=et(A,v));let q=w[D],X=I[q];if(A.replacer&&(X=A.replacer.call(I,q,X)),!y(A,v+1,q,!0,!0,!0))continue;let re=A.tag!==null&&A.tag!=="?"||A.dump&&A.dump.length>1024;re&&(A.dump&&a===A.dump.charCodeAt(0)?z+="?":z+="? "),z+=A.dump,re&&(z+=et(A,v)),y(A,v+1,X,!0,re)&&(A.dump&&a===A.dump.charCodeAt(0)?z+=":":z+=": ",z+=A.dump,Q+=z)}A.tag=$,A.dump=Q||"{}"}function l(A,v,I){let x=I?A.explicitTypes:A.implicitTypes;for(let Q=0,$=x.length;Q<$;Q+=1){let w=x[Q];if((w.instanceOf||w.predicate)&&(!w.instanceOf||typeof v=="object"&&v instanceof w.instanceOf)&&(!w.predicate||w.predicate(v))){if(I?w.multi&&w.representName?A.tag=w.representName(v):A.tag=w.tag:A.tag="?",w.represent){let D=A.styleMap[w.tag]||w.defaultStyle,O;if(i.call(w.represent)==="[object Function]")O=w.represent(v,D);else if(r.call(w.represent,D))O=w.represent[D](v,D);else throw new t("!<"+w.tag+'> tag resolver accepts not "'+D+'" style');A.dump=O}return!0}}return!1}function y(A,v,I,x,Q,$,w){A.tag=null,A.dump=I,l(A,I,!1)||l(A,I,!0);let D=i.call(A.dump),O=x;x&&(x=A.flowLevel<0||A.flowLevel>v);let z=D==="[object Object]"||D==="[object Array]",q,X;if(z&&(q=A.duplicates.indexOf(I),X=q!==-1),(A.tag!==null&&A.tag!=="?"||X||A.indent!==2&&v>0)&&(Q=!1),X&&A.usedDuplicates[q])A.dump="*ref_"+q;else{if(z&&X&&!A.usedDuplicates[q]&&(A.usedDuplicates[q]=!0),D==="[object Object]")x&&Object.keys(A.dump).length!==0?(fa(A,v,A.dump,Q),X&&(A.dump="&ref_"+q+A.dump)):(pa(A,v,A.dump),X&&(A.dump="&ref_"+q+" "+A.dump));else if(D==="[object Array]")x&&A.dump.length!==0?(A.noArrayIndent&&!w&&v>0?oi(A,v-1,A.dump,Q):oi(A,v,A.dump,Q),X&&(A.dump="&ref_"+q+A.dump)):(da(A,v,A.dump),X&&(A.dump="&ref_"+q+" "+A.dump));else if(D==="[object String]")A.tag!=="?"&&us(A,A.dump,v,$,O);else{if(D==="[object Undefined]")return!1;if(A.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+D)}if(A.tag!==null&&A.tag!=="?"){let re=encodeURI(A.tag[0]==="!"?A.tag.slice(1):A.tag).replace(/!/g,"%21");A.tag[0]==="!"?re="!"+re:re.slice(0,18)==="tag:yaml.org,2002:"?re="!!"+re.slice(18):re="!<"+re+">",A.dump=re+" "+A.dump}}return!0}function B(A,v){let I=[],x=[];R(A,I,x);let Q=x.length;for(let $=0;$<Q;$+=1)v.duplicates.push(I[x[$]]);v.usedDuplicates=new Array(Q)}function R(A,v,I){if(A!==null&&typeof A=="object"){let x=v.indexOf(A);if(x!==-1)I.indexOf(x)===-1&&I.push(x);else if(v.push(A),Array.isArray(A))for(let Q=0,$=A.length;Q<$;Q+=1)R(A[Q],v,I);else{let Q=Object.keys(A);for(let $=0,w=Q.length;$<w;$+=1)R(A[Q[$]],v,I)}}}function b(A,v){v=v||{};let I=new jt(v);I.noRefs||B(A,I);let x=A;return I.replacer&&(x=I.replacer.call({"":x},"",x)),y(I,0,x,!0,!0)?I.dump+`
|
|
116
|
-
`:""}return pS.dump=b,pS}var aV;function zae(){if(aV)return kn;aV=1;let e=Vae(),t=Gae();function n(i,r){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}return kn.Type=Mn(),kn.Schema=cV(),kn.FAILSAFE_SCHEMA=pV(),kn.JSON_SCHEMA=mV(),kn.CORE_SCHEMA=yV(),kn.DEFAULT_SCHEMA=fS(),kn.load=e.load,kn.loadAll=e.loadAll,kn.dump=t.dump,kn.YAMLException=Hp(),kn.types={binary:IV(),float:gV(),map:dV(),null:fV(),pairs:wV(),set:CV(),timestamp:EV(),bool:AV(),int:hV(),merge:vV(),omap:bV(),seq:lV(),str:uV()},kn.safeLoad=n("safeLoad","load"),kn.safeLoadAll=n("safeLoadAll","loadAll"),kn.safeDump=n("safeDump","dump"),kn}var qae=zae(),Jae=Lae(qae),{Type:ERe,Schema:vRe,FAILSAFE_SCHEMA:IRe,JSON_SCHEMA:kV,CORE_SCHEMA:bRe,DEFAULT_SCHEMA:wRe,load:zr,loadAll:Hae,dump:CRe,YAMLException:kRe,types:SRe,safeLoad:BRe,safeLoadAll:RRe,safeDump:xRe}=Jae;var _s=e=>typeof e=="string"?e:void 0;function BV(e){let t={services:[]},n;try{let c=SV.readFileSync(e,"utf8");n=zr(c,{schema:kV})}catch(c){return At(`Lenient parse: failed to read/parse ${e}: ${c.message}`),t}if(!n||typeof n!="object"||Array.isArray(n))return At(`Lenient parse: ${e} did not contain a YAML object`),t;let i=n,r=i.metadata&&typeof i.metadata=="object"?i.metadata:void 0,s=r?{executorVersion:_s(r.executorVersion),mcpVersion:_s(r.mcpVersion)}:void 0,a=(Array.isArray(i.services)?i.services:[]).reduce((c,u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return At(`Lenient parse: services[${d}] is not an object \u2014 skipping`),c;let f=u,h=_s(f.serviceName);if(!h)return At(`Lenient parse: services[${d}] missing or non-string serviceName \u2014 skipping`),c;let g=f.api&&typeof f.api=="object"?f.api:void 0,m=f.runtimeDetails&&typeof f.runtimeDetails=="object"?f.runtimeDetails:void 0;return c.push({serviceName:h,language:_s(f.language),framework:_s(f.framework),testDirectory:_s(f.testDirectory),api:g?{baseUrl:_s(g.baseUrl)}:void 0,runtimeDetails:m?{serverStartCommand:_s(m.serverStartCommand),serverTeardownCommand:_s(m.serverTeardownCommand)}:void 0}),c},[]);return{metadata:s,services:a}}async function xV(e){let t=RV.resolve(e.workingDirectory),n=new Qm(t),i=[],r=e.targetSetupCommand,s=e.targetTeardownCommand,o=e.skyrampExecutorVersion,a=e.skyrampMcpVersion;if(await n.exists()){Lr(`Found ${n.getConfigPath()}, loading workspace configuration...`);try{let u;try{u=await n.read()}catch(f){At(`${n.getConfigPath()} failed strict validation: ${f.message}. Re-reading with per-field lenient parse \u2014 invalid fields will fall back to action input defaults.`),u=BV(n.getConfigPath())}u.metadata&&(!o&&u.metadata.executorVersion&&(o=u.metadata.executorVersion),!a&&u.metadata.mcpVersion&&(a=u.metadata.mcpVersion));for(let f of u.services??[])i.push({serviceName:f.serviceName,language:f.language,framework:f.framework,baseUrl:f.api?.baseUrl,testDirectory:f.testDirectory});let d=(u.services??[])[0];if(d){!r&&d.runtimeDetails?.serverStartCommand&&(r=d.runtimeDetails.serverStartCommand);let f=d.runtimeDetails?.serverTeardownCommand;!s&&typeof f=="string"&&(s=f)}}catch(u){At(`Failed to parse ${n.getConfigPath()}: ${u.message} \u2014 falling back to action input defaults`)}}else Fp("No .skyramp/workspace.yml found, using action input defaults");o||(o="v1.3.54"),a||(a="latest"),r||(r="docker compose up -d --build");let c={targetSetupCommand:r,authTokenCommand:e.authTokenCommand,targetTeardownCommand:s,skipTargetTeardown:e.skipTargetTeardown,skyrampExecutorVersion:o,skyrampMcpVersion:a,skyrampMcpSource:e.skyrampMcpSource,skyrampMcpGithubRef:e.skyrampMcpGithubRef,nodeVersion:e.nodeVersion,skipTargetSetup:e.skipTargetSetup,targetReadyCheckCommand:e.targetReadyCheckCommand,targetReadyCheckTimeout:e.targetReadyCheckTimeout,targetReadyCheckInterval:e.targetReadyCheckInterval,targetReadyCheckDiagnosticsCommand:e.targetReadyCheckDiagnosticsCommand,autoCommit:e.autoCommit,commitMessage:e.commitMessage,generatedTestsMode:e.generatedTestsMode,postPrComment:e.postPrComment,testExecutionTimeout:e.testExecutionTimeout,maxRecommendations:e.maxRecommendations,maxGenerate:e.maxGenerate,perTestMaxFixAttempts:e.perTestMaxFixAttempts,testbotMaxRetries:e.testbotMaxRetries,testbotRetryDelay:e.testbotRetryDelay,testbotTimeout:e.testbotTimeout,targetSetupRetries:e.targetSetupRetries,targetSetupRetryDelay:e.targetSetupRetryDelay,authTokenRetries:e.authTokenRetries,authTokenRetryDelay:e.authTokenRetryDelay,reportCollapsed:e.reportCollapsed,language:e.language,enableDebug:e.enableDebug,testRepoPath:e.testRepoPath,relatedRepoPaths:e.relatedRepoPaths,services:i};pm("Resolved configuration");for(let[u,d]of Object.entries(c))u==="authTokenCommand"?Lr(` ${u}: [REDACTED]`):u==="services"?Lr(` ${u}: ${JSON.stringify(d)}`):Lr(` ${u}: ${d}`);return fm(),c}bn();bn();ok();var $V=he(require("child_process")),AS=class extends Error{constructor(t){super(t),this.name="ExecTimeoutError"}},Tm=class extends Error{constructor(t){super(t),this.name="ExecAbortedError"}};function QV(e,t){if(!(!e||e.destroyed||e.writableEnded))try{e.write(t)}catch(n){At(`stream write failed: ${n instanceof Error?n.message:String(n)}`)}}async function TV(e,t=[],n={}){let i="",r="",s={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:a=>{i+=a.toString(),QV(n.stdoutStream,a)},stderr:a=>{r+=a.toString()}}};if(n.timeout||n.signal){let a=n.signal;return a?.aborted?Promise.reject(new Tm(`Command aborted before start: ${e}`)):new Promise((c,u)=>{let d=$V.spawn(e,t,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});d.stdout?.on("data",E=>{i+=E.toString(),n.silent||process.stdout.write(E),QV(n.stdoutStream,E)}),d.stderr?.on("data",E=>{r+=E.toString(),n.silent||process.stderr.write(E)}),n.input&&d.stdin?.end(n.input);let f=()=>{m&&clearTimeout(m),a?.removeEventListener("abort",g)},h=E=>{f();try{d.kill("SIGTERM")}catch{}u(E)},g=()=>h(new Tm(`Command aborted: ${e}`)),m=n.timeout?setTimeout(()=>h(new AS(`Command timed out after ${Math.round(n.timeout/6e4)}m: ${e}`)),n.timeout):void 0;a?.addEventListener("abort",g,{once:!0}),d.on("close",E=>{f();let S=E??1;S!==0&&!n.ignoreReturnCode?u(new Error(`The process '${e}' failed with exit code ${S}`)):c({exitCode:S,stdout:i,stderr:r})}),d.on("error",E=>{f(),u(E)})})}return{exitCode:await l1(e,t,s),stdout:i,stderr:r}}async function _V(e,t){pm(e);try{return await t()}finally{fm()}}function hS(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}async function NV(e,t){await _V("Tearing down services",async()=>{if(e.skipTargetTeardown){Fp("Skipping service teardown (skipTargetTeardown=true)");return}if(!e.targetTeardownCommand){Lr("No targetTeardownCommand configured, skipping teardown");return}Lr(`Running teardown command: ${e.targetTeardownCommand}`);try{await TV("bash",["-c",e.targetTeardownCommand],{cwd:t}),Fp("Services torn down successfully")}catch(n){let i=n instanceof Error?n.message:String(n);At(`Service teardown command failed (non-fatal): ${i}`)}})}var Gi=["-c","core.fsmonitor=false"],DV=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"]),gS=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 _m(e){return DV.has(e)||e.startsWith("INPUT_")}function St(e=process.env,t,n="repo-command"){let i={};for(let[r,s]of Object.entries(e))n==="repo-command"&&gS.has(r)||(i[r]=s);Object.assign(i,t??{});for(let r of Object.keys(i))(DV.has(r)||r.startsWith("INPUT_"))&&delete i[r];return i}var WV=require("child_process");var YV=he(require("path"));var p={};Nr(p,{BRAND:()=>vce,DIRTY:()=>ac,EMPTY_PATH:()=>Kae,INVALID:()=>Be,NEVER:()=>iue,OK:()=>Sn,ParseStatus:()=>dn,Schema:()=>qe,ZodAny:()=>Ro,ZodArray:()=>Us,ZodBigInt:()=>uc,ZodBoolean:()=>lc,ZodBranded:()=>Wp,ZodCatch:()=>Ic,ZodDate:()=>dc,ZodDefault:()=>vc,ZodDiscriminatedUnion:()=>Pm,ZodEffects:()=>Hr,ZodEnum:()=>yc,ZodError:()=>rr,ZodFirstPartyTypeKind:()=>Te,ZodFunction:()=>Fm,ZodIntersection:()=>hc,ZodIssueCode:()=>W,ZodLazy:()=>gc,ZodLiteral:()=>mc,ZodMap:()=>hl,ZodNaN:()=>ml,ZodNativeEnum:()=>Ec,ZodNever:()=>Ei,ZodNull:()=>fc,ZodNullable:()=>Ji,ZodNumber:()=>cc,ZodObject:()=>ir,ZodOptional:()=>qr,ZodParsedType:()=>ue,ZodPipeline:()=>Zp,ZodPromise:()=>xo,ZodReadonly:()=>bc,ZodRecord:()=>Um,ZodSchema:()=>qe,ZodSet:()=>gl,ZodString:()=>Bo,ZodSymbol:()=>fl,ZodTransformer:()=>Hr,ZodTuple:()=>qi,ZodType:()=>qe,ZodUndefined:()=>pc,ZodUnion:()=>Ac,ZodUnknown:()=>Ps,ZodVoid:()=>Al,addIssueToContext:()=>oe,any:()=>xce,array:()=>_ce,bigint:()=>Cce,boolean:()=>qV,coerce:()=>rue,custom:()=>VV,date:()=>kce,datetimeRegex:()=>LV,defaultErrorMap:()=>Ns,discriminatedUnion:()=>Uce,effect:()=>Yce,enum:()=>qce,function:()=>Vce,getErrorMap:()=>ll,getParsedType:()=>zi,instanceof:()=>bce,intersection:()=>Fce,isAborted:()=>Nm,isAsync:()=>dl,isDirty:()=>Dm,isValid:()=>So,late:()=>Ice,lazy:()=>Gce,literal:()=>zce,makeIssue:()=>Yp,map:()=>Lce,nan:()=>wce,nativeEnum:()=>Jce,never:()=>$ce,null:()=>Rce,nullable:()=>Zce,number:()=>zV,object:()=>Nce,objectUtil:()=>mS,oboolean:()=>nue,onumber:()=>tue,optional:()=>Wce,ostring:()=>eue,pipeline:()=>Xce,preprocess:()=>Kce,promise:()=>Hce,quotelessJson:()=>Yae,record:()=>Mce,set:()=>jce,setErrorMap:()=>Zae,strictObject:()=>Dce,string:()=>GV,symbol:()=>Sce,transformer:()=>Yce,tuple:()=>Oce,undefined:()=>Bce,union:()=>Pce,unknown:()=>Qce,util:()=>Ke,void:()=>Tce});var Ke;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{let s={};for(let o of r)s[o]=o;return s},e.getValidEnumValues=r=>{let s=e.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(let a of s)o[a]=r[a];return e.objectValues(o)},e.objectValues=r=>e.objectKeys(r).map(function(s){return r[s]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},e.find=(r,s)=>{for(let o of r)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=i,e.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ke||(Ke={}));var mS;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mS||(mS={}));var ue=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zi=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}};var W=Ke.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"]),Yae=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),rr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(s){return s.message},i={_errors:[]},r=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)i._errors.push(n(o));else{let a=i,c=0;for(;c<o.path.length;){let u=o.path[c],d=c===o.path.length-1;if(u==="_errors"){d&&a._errors.push(n(o)),c++;continue}Object.prototype.hasOwnProperty.call(a,u)||(u==="__proto__"?Object.defineProperty(a,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[u]={_errors:[]}),a=a[u],d&&a._errors.push(n(o)),c++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let s=r.path[0];n[s]=n[s]||[],n[s].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};rr.create=e=>new rr(e);var Wae=(e,t)=>{let n;switch(e.code){case W.invalid_type:e.received===ue.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case W.invalid_union:n="Invalid input";break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n="Invalid function arguments";break;case W.invalid_return_type:n="Invalid function return type";break;case W.invalid_date:n="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case W.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case W.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case W.custom:n="Invalid input";break;case W.invalid_intersection_types:n="Intersection results could not be merged";break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}},Ns=Wae;var PV=Ns;function Zae(e){PV=e}function ll(){return PV}var Yp=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,s=[...n,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let a="",c=i.filter(u=>!!u).slice().reverse();for(let u of c)a=u(o,{data:t,defaultError:a}).message;return{...r,path:s,message:a}},Kae=[];function oe(e,t){let n=ll(),i=Yp({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ns?void 0:Ns].filter(r=>!!r)});e.common.issues.push(i)}var dn=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return Be;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let s=await r.key,o=await r.value;i.push({key:s,value:o})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(i[s.value]=o.value)}return{status:t.value,value:i}}},Be=Object.freeze({status:"aborted"}),ac=e=>({status:"dirty",value:e}),Sn=e=>({status:"valid",value:e}),Nm=e=>e.status==="aborted",Dm=e=>e.status==="dirty",So=e=>e.status==="valid",dl=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(me||(me={}));var Jr=class{constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},UV=(e,t)=>{if(So(t))return{success:!0,data:t.value};if(!e.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 rr(e.common.issues);return this._error=n,this._error}}};function Me(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(o,a)=>{let{message:c}=e;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??i??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:r}}var qe=class{get description(){return this._def.description}_getType(t){return zi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:zi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new dn,ctx:{common:t.parent.common,data:t.data,parsedType:zi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(dl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zi(t)},r=this._parseSync({data:t,path:i.path,parent:i});return UV(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zi(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return So(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>So(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zi(t)},r=this._parse({data:t,path:i.path,parent:i}),s=await(dl(r)?r:Promise.resolve(r));return UV(i,s)}refine(t,n){let i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,s)=>{let o=t(r),a=()=>s.addIssue({code:W.custom,...i(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Hr({schema:this,typeName:Te.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 qr.create(this,this._def)}nullable(){return Ji.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Us.create(this)}promise(){return xo.create(this,this._def)}or(t){return Ac.create([this,t],this._def)}and(t){return hc.create(this,t,this._def)}transform(t){return new Hr({...Me(this._def),schema:this,typeName:Te.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new vc({...Me(this._def),innerType:this,defaultValue:n,typeName:Te.ZodDefault})}brand(){return new Wp({typeName:Te.ZodBranded,type:this,...Me(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Ic({...Me(this._def),innerType:this,catchValue:n,typeName:Te.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Zp.create(this,t)}readonly(){return bc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xae=/^c[^\s-]{8,}$/i,ece=/^[0-9a-z]+$/,tce=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nce=/^[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,rce=/^[a-z0-9_-]{21}$/i,ice=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sce=/^[-+]?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)?)??$/,oce=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ace="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",yS,cce=/^(?:(?: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])$/,uce=/^(?:(?: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])$/,lce=/^(([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]))$/,dce=/^(([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])$/,pce=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OV="((\\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])))",Ace=new RegExp(`^${OV}$`);function MV(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function hce(e){return new RegExp(`^${MV(e)}$`)}function LV(e){let t=`${OV}T${MV(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function gce(e,t){return!!((t==="v4"||!t)&&cce.test(e)||(t==="v6"||!t)&&lce.test(e))}function mce(e,t){if(!ice.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}function yce(e,t){return!!((t==="v4"||!t)&&uce.test(e)||(t==="v6"||!t)&&dce.test(e))}var Bo=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_type,expected:ue.string,received:s.parsedType}),Be}let i=new dn,r;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){let o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(r=this._getOrReturnCtx(t,r),o?oe(r,{code:W.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&oe(r,{code:W.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")oce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"email",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")yS||(yS=new RegExp(ace,"u")),yS.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"emoji",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")nce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"uuid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")rce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"nanoid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")Xae.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"cuid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")ece.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"cuid2",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")tce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"ulid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),oe(r,{validation:"url",code:W.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"regex",code:W.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?LV(s).test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?Ace.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?hce(s).test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?sce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"duration",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?gce(t.data,s.version)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"ip",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?mce(t.data,s.alg)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"jwt",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?yce(t.data,s.version)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"cidr",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?pce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"base64",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?fce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"base64url",code:W.invalid_string,message:s.message}),i.dirty()):Ke.assertNever(s);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:W.invalid_string,...me.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...me.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...me.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...me.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Bo.create=e=>new Bo({checks:[],typeName:Te.ZodString,coerce:e?.coerce??!1,...Me(e)});function Ece(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(e.toFixed(r).replace(".","")),o=Number.parseInt(t.toFixed(r).replace(".",""));return s%o/10**r}var cc=class e extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ue.number){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_type,expected:ue.number,received:s.parsedType}),Be}let i,r=new dn;for(let s of this._def.checks)s.kind==="int"?Ke.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{code:W.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Ece(t.data,s.value)!==0&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{code:W.not_finite,message:s.message}),r.dirty()):Ke.assertNever(s);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:me.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ke.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};cc.create=e=>new cc({checks:[],typeName:Te.ZodNumber,coerce:e?.coerce||!1,...Me(e)});var uc=class e extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ue.bigint)return this._getInvalidInput(t);let i,r=new dn;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ke.assertNever(s);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return oe(n,{code:W.invalid_type,expected:ue.bigint,received:n.parsedType}),Be}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:me.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};uc.create=e=>new uc({checks:[],typeName:Te.ZodBigInt,coerce:e?.coerce??!1,...Me(e)});var lc=class extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.boolean,received:i.parsedType}),Be}return Sn(t.data)}};lc.create=e=>new lc({typeName:Te.ZodBoolean,coerce:e?.coerce||!1,...Me(e)});var dc=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_type,expected:ue.date,received:s.parsedType}),Be}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_date}),Be}let i=new dn,r;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ke.assertNever(s);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};dc.create=e=>new dc({checks:[],coerce:e?.coerce||!1,typeName:Te.ZodDate,...Me(e)});var fl=class extends qe{_parse(t){if(this._getType(t)!==ue.symbol){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.symbol,received:i.parsedType}),Be}return Sn(t.data)}};fl.create=e=>new fl({typeName:Te.ZodSymbol,...Me(e)});var pc=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.undefined,received:i.parsedType}),Be}return Sn(t.data)}};pc.create=e=>new pc({typeName:Te.ZodUndefined,...Me(e)});var fc=class extends qe{_parse(t){if(this._getType(t)!==ue.null){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.null,received:i.parsedType}),Be}return Sn(t.data)}};fc.create=e=>new fc({typeName:Te.ZodNull,...Me(e)});var Ro=class extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};Ro.create=e=>new Ro({typeName:Te.ZodAny,...Me(e)});var Ps=class extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};Ps.create=e=>new Ps({typeName:Te.ZodUnknown,...Me(e)});var Ei=class extends qe{_parse(t){let n=this._getOrReturnCtx(t);return oe(n,{code:W.invalid_type,expected:ue.never,received:n.parsedType}),Be}};Ei.create=e=>new Ei({typeName:Te.ZodNever,...Me(e)});var Al=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.void,received:i.parsedType}),Be}return Sn(t.data)}};Al.create=e=>new Al({typeName:Te.ZodVoid,...Me(e)});var Us=class e extends qe{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==ue.array)return oe(n,{code:W.invalid_type,expected:ue.array,received:n.parsedType}),Be;if(r.exactLength!==null){let o=n.data.length>r.exactLength.value,a=n.data.length<r.exactLength.value;(o||a)&&(oe(n,{code:o?W.too_big:W.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(oe(n,{code:W.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(oe(n,{code:W.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>r.type._parseAsync(new Jr(n,o,n.path,a)))).then(o=>dn.mergeArray(i,o));let s=[...n.data].map((o,a)=>r.type._parseSync(new Jr(n,o,n.path,a)));return dn.mergeArray(i,s)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}};Us.create=(e,t)=>new Us({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Te.ZodArray,...Me(t)});function pl(e){if(e instanceof ir){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=qr.create(pl(i))}return new ir({...e._def,shape:()=>t})}else return e instanceof Us?new Us({...e._def,type:pl(e.element)}):e instanceof qr?qr.create(pl(e.unwrap())):e instanceof Ji?Ji.create(pl(e.unwrap())):e instanceof qi?qi.create(e.items.map(t=>pl(t))):e}var ir=class e extends qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ke.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ue.object){let u=this._getOrReturnCtx(t);return oe(u,{code:W.invalid_type,expected:ue.object,received:u.parsedType}),Be}let{status:i,ctx:r}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ei&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||a.push(u);let c=[];for(let u of o){let d=s[u],f=r.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Jr(r,f,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Ei){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(u==="strict")a.length>0&&(oe(r,{code:W.unrecognized_keys,keys:a}),i.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let f=r.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Jr(r,f,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>dn.mergeObjectSync(i,u)):dn.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Te.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Ke.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let i of Ke.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return pl(this)}partial(t){let n={};for(let i of Ke.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let i of Ke.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof qr;)s=s._def.innerType;n[i]=s}return new e({...this._def,shape:()=>n})}keyof(){return jV(Ke.objectKeys(this.shape))}};ir.create=(e,t)=>new ir({shape:()=>e,unknownKeys:"strip",catchall:Ei.create(),typeName:Te.ZodObject,...Me(t)});ir.strictCreate=(e,t)=>new ir({shape:()=>e,unknownKeys:"strict",catchall:Ei.create(),typeName:Te.ZodObject,...Me(t)});ir.lazycreate=(e,t)=>new ir({shape:e,unknownKeys:"strip",catchall:Ei.create(),typeName:Te.ZodObject,...Me(t)});var Ac=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new rr(a.ctx.common.issues));return oe(n,{code:W.invalid_union,unionErrors:o}),Be}if(n.common.async)return Promise.all(i.map(async s=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(r);{let s,o=[];for(let c of i){let u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(c=>new rr(c));return oe(n,{code:W.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}};Ac.create=(e,t)=>new Ac({options:e,typeName:Te.ZodUnion,...Me(t)});var Ds=e=>e instanceof gc?Ds(e.schema):e instanceof Hr?Ds(e.innerType()):e instanceof mc?[e.value]:e instanceof yc?e.options:e instanceof Ec?Ke.objectValues(e.enum):e instanceof vc?Ds(e._def.innerType):e instanceof pc?[void 0]:e instanceof fc?[null]:e instanceof qr?[void 0,...Ds(e.unwrap())]:e instanceof Ji?[null,...Ds(e.unwrap())]:e instanceof Wp||e instanceof bc?Ds(e.unwrap()):e instanceof Ic?Ds(e._def.innerType):[],Pm=class e extends qe{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return oe(n,{code:W.invalid_type,expected:ue.object,received:n.parsedType}),Be;let i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(oe(n,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let s of n){let o=Ds(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,s)}}return new e({typeName:Te.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Me(i)})}};function ES(e,t){let n=zi(e),i=zi(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&i===ue.object){let r=Ke.objectKeys(t),s=Ke.objectKeys(e).filter(a=>r.indexOf(a)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let a of s){if(a==="__proto__")continue;let c=ES(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===ue.array&&i===ue.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let s=0;s<e.length;s++){let o=e[s],a=t[s],c=ES(o,a);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return n===ue.date&&i===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var hc=class extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(s,o)=>{if(Nm(s)||Nm(o))return Be;let a=ES(s.value,o.value);return a.valid?((Dm(s)||Dm(o))&&n.dirty(),{status:n.value,value:a.data}):(oe(i,{code:W.invalid_intersection_types}),Be)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};hc.create=(e,t,n)=>new hc({left:e,right:t,typeName:Te.ZodIntersection,...Me(n)});var qi=class e extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.array)return oe(i,{code:W.invalid_type,expected:ue.array,received:i.parsedType}),Be;if(i.data.length<this._def.items.length)return oe(i,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Be;!this._def.rest&&i.data.length>this._def.items.length&&(oe(i,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...i.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Jr(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(s).then(o=>dn.mergeArray(n,o)):dn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};qi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qi({items:e,typeName:Te.ZodTuple,rest:null,...Me(t)})};var Um=class e extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.object)return oe(i,{code:W.invalid_type,expected:ue.object,received:i.parsedType}),Be;let r=[],s=this._def.keyType,o=this._def.valueType;for(let a in i.data)r.push({key:s._parse(new Jr(i,a,i.path,a)),value:o._parse(new Jr(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?dn.mergeObjectAsync(n,r):dn.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof qe?new e({keyType:t,valueType:n,typeName:Te.ZodRecord,...Me(i)}):new e({keyType:Bo.create(),valueType:t,typeName:Te.ZodRecord,...Me(n)})}},hl=class extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.map)return oe(i,{code:W.invalid_type,expected:ue.map,received:i.parsedType}),Be;let r=this._def.keyType,s=this._def.valueType,o=[...i.data.entries()].map(([a,c],u)=>({key:r._parse(new Jr(i,a,i.path,[u,"key"])),value:s._parse(new Jr(i,c,i.path,[u,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of o){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}};hl.create=(e,t,n)=>new hl({valueType:t,keyType:e,typeName:Te.ZodMap,...Me(n)});var gl=class e extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.set)return oe(i,{code:W.invalid_type,expected:ue.set,received:i.parsedType}),Be;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(oe(i,{code:W.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(oe(i,{code:W.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let s=this._def.valueType;function o(c){let u=new Set;for(let d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}let a=[...i.data.values()].map((c,u)=>s._parse(new Jr(i,c,i.path,u)));return i.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};gl.create=(e,t)=>new gl({valueType:e,minSize:null,maxSize:null,typeName:Te.ZodSet,...Me(t)});var Fm=class e extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.function)return oe(n,{code:W.invalid_type,expected:ue.function,received:n.parsedType}),Be;function i(a,c){return Yp({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ll(),Ns].filter(u=>!!u),issueData:{code:W.invalid_arguments,argumentsError:c}})}function r(a,c){return Yp({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ll(),Ns].filter(u=>!!u),issueData:{code:W.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof xo){let a=this;return Sn(async function(...c){let u=new rr([]),d=await a._def.args.parseAsync(c,s).catch(g=>{throw u.addIssue(i(c,g)),u}),f=await Reflect.apply(o,this,d);return await a._def.returns._def.type.parseAsync(f,s).catch(g=>{throw u.addIssue(r(f,g)),u})})}else{let a=this;return Sn(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new rr([i(c,u.error)]);let d=Reflect.apply(o,this,u.data),f=a._def.returns.safeParse(d,s);if(!f.success)throw new rr([r(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:qi.create(t).rest(Ps.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||qi.create([]).rest(Ps.create()),returns:n||Ps.create(),typeName:Te.ZodFunction,...Me(i)})}},gc=class extends qe{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};gc.create=(e,t)=>new gc({getter:e,typeName:Te.ZodLazy,...Me(t)});var mc=class extends qe{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return oe(n,{received:n.data,code:W.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}};mc.create=(e,t)=>new mc({value:e,typeName:Te.ZodLiteral,...Me(t)});function jV(e,t){return new yc({values:e,typeName:Te.ZodEnum,...Me(t)})}var yc=class e extends qe{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return oe(n,{expected:Ke.joinValues(i),received:n.parsedType,code:W.invalid_type}),Be}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return oe(n,{received:n.data,code:W.invalid_enum_value,options:i}),Be}return Sn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};yc.create=jV;var Ec=class extends qe{_parse(t){let n=Ke.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==ue.string&&i.parsedType!==ue.number){let r=Ke.objectValues(n);return oe(i,{expected:Ke.joinValues(r),received:i.parsedType,code:W.invalid_type}),Be}if(this._cache||(this._cache=new Set(Ke.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Ke.objectValues(n);return oe(i,{received:i.data,code:W.invalid_enum_value,options:r}),Be}return Sn(t.data)}get enum(){return this._def.values}};Ec.create=(e,t)=>new Ec({values:e,typeName:Te.ZodNativeEnum,...Me(t)});var xo=class extends qe{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.promise&&n.common.async===!1)return oe(n,{code:W.invalid_type,expected:ue.promise,received:n.parsedType}),Be;let i=n.parsedType===ue.promise?n.data:Promise.resolve(n.data);return Sn(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};xo.create=(e,t)=>new xo({type:e,typeName:Te.ZodPromise,...Me(t)});var Hr=class extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:o=>{oe(i,o),o.fatal?n.abort():n.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let o=r.transform(i.data,s);if(i.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Be;let c=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return c.status==="aborted"?Be:c.status==="dirty"?ac(c.value):n.value==="dirty"?ac(c.value):c});{if(n.value==="aborted")return Be;let a=this._def.schema._parseSync({data:o,path:i.path,parent:i});return a.status==="aborted"?Be:a.status==="dirty"?ac(a.value):n.value==="dirty"?ac(a.value):a}}if(r.type==="refinement"){let o=a=>{let c=r.refinement(a,s);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Be:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){let o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!So(o))return Be;let a=r.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>So(o)?Promise.resolve(r.transform(o.value,s)).then(a=>({status:n.value,value:a})):Be);Ke.assertNever(r)}};Hr.create=(e,t,n)=>new Hr({schema:e,typeName:Te.ZodEffects,effect:t,...Me(n)});Hr.createWithPreprocess=(e,t,n)=>new Hr({schema:t,effect:{type:"preprocess",transform:e},typeName:Te.ZodEffects,...Me(n)});var qr=class extends qe{_parse(t){return this._getType(t)===ue.undefined?Sn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};qr.create=(e,t)=>new qr({innerType:e,typeName:Te.ZodOptional,...Me(t)});var Ji=class extends qe{_parse(t){return this._getType(t)===ue.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ji.create=(e,t)=>new Ji({innerType:e,typeName:Te.ZodNullable,...Me(t)});var vc=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===ue.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};vc.create=(e,t)=>new vc({innerType:e,typeName:Te.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Me(t)});var Ic=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return dl(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Ic.create=(e,t)=>new Ic({innerType:e,typeName:Te.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Me(t)});var ml=class extends qe{_parse(t){if(this._getType(t)!==ue.nan){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.nan,received:i.parsedType}),Be}return{status:"valid",value:t.data}}};ml.create=e=>new ml({typeName:Te.ZodNaN,...Me(e)});var vce=Symbol("zod_brand"),Wp=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Zp=class e extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Be:s.status==="dirty"?(n.dirty(),ac(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Be:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:Te.ZodPipeline})}},bc=class extends qe{_parse(t){let n=this._def.innerType._parse(t),i=r=>(So(r)&&(r.value=Object.freeze(r.value)),r);return dl(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};bc.create=(e,t)=>new bc({innerType:e,typeName:Te.ZodReadonly,...Me(t)});function FV(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function VV(e,t={},n){return e?Ro.create().superRefine((i,r)=>{let s=e(i);if(s instanceof Promise)return s.then(o=>{if(!o){let a=FV(t,i),c=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:c})}});if(!s){let o=FV(t,i),a=o.fatal??n??!0;r.addIssue({code:"custom",...o,fatal:a})}}):Ro.create()}var Ice={object:ir.lazycreate},Te;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Te||(Te={}));var bce=(e,t={message:`Input not instance of ${e.name}`})=>VV(n=>n instanceof e,t),GV=Bo.create,zV=cc.create,wce=ml.create,Cce=uc.create,qV=lc.create,kce=dc.create,Sce=fl.create,Bce=pc.create,Rce=fc.create,xce=Ro.create,Qce=Ps.create,$ce=Ei.create,Tce=Al.create,_ce=Us.create,Nce=ir.create,Dce=ir.strictCreate,Pce=Ac.create,Uce=Pm.create,Fce=hc.create,Oce=qi.create,Mce=Um.create,Lce=hl.create,jce=gl.create,Vce=Fm.create,Gce=gc.create,zce=mc.create,qce=yc.create,Jce=Ec.create,Hce=xo.create,Yce=Hr.create,Wce=qr.create,Zce=Ji.create,Kce=Hr.createWithPreprocess,Xce=Zp.create,eue=()=>GV().optional(),tue=()=>zV().optional(),nue=()=>qV().optional(),rue={string:(e=>Bo.create({...e,coerce:!0})),number:(e=>cc.create({...e,coerce:!0})),boolean:(e=>lc.create({...e,coerce:!0})),bigint:(e=>uc.create({...e,coerce:!0})),date:(e=>dc.create({...e,coerce:!0}))};var iue=Be;var yl=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(yl||{}),Qo=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(Qo||{}),Kp=e=>e==="ready"||e==="needs_inputs",Om=300,Nt=p.string().trim().min(1),sue=p.object({action:p.enum(["start","run","wait"]),text:Nt,source:p.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Nt.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),oue=/^[A-Za-z_][A-Za-z0-9_]*$/,Yr=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,El=(o=>(o.VersionEndpoint="version_endpoint",o.DeployWorkflow="deploy_workflow",o.KubernetesLabels="kubernetes_labels",o.Command="command",o.Api="api",o.NotTracked="not_tracked",o))(El||{}),sr="shared",aue=Nt.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),vl=p.object({address:aue,readyWhen:Nt.nullable(),credentials:p.array(p.string().regex(Yr)).max(50),revisionSources:p.array(p.object({method:p.nativeEnum(El),detail:Nt.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:p.array(Nt).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),vS={steps:p.array(sue).max(20).optional().describe("how it starts, in order"),kind:p.enum(["web_app","service","database","external_service"]).optional(),from:p.object({file:Nt,service:Nt.nullable()}).strict().optional(),credentials:p.array(p.string().max(100).regex(oue)).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")},Mm=p.object({name:Nt,repository:Nt.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:p.boolean(),...vS,deployed:Nt.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')}),cue=p.object({name:p.string().regex(Yr).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:p.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:p.boolean().describe("false only when the SUT starts without it, with less working"),how:Nt.max(Om).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),uue=p.object({component:Nt,problem:Nt,evidence:Nt.describe("the exact command and output that shows it"),fix:Nt.describe("what the user must provide, and where")}),lue=p.object({framework:Nt,file:Nt.describe("the test file run, relative to its repository root"),result:p.enum(["pass","fail","error"])}),due=p.object({input:Nt.describe("the part of the user's SUT input, as given"),reason:Nt}),JV=p.object({schemaVersion:p.literal(1),status:p.nativeEnum(Qo).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:p.array(Mm),suites:p.array(lue).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:p.array(Nt).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:p.array(p.object({input:Nt.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Nt.describe("what the recipe did with it")})).optional(),inputsNotUsed:p.array(due).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:p.array(uue).describe("required (non-empty) when status is blocked"),inputs:p.array(cue).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),environment:vl.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 Xp=64*1024,ef=512*1024,IS=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Wr=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Wr||{}),vi=p.string().trim().min(1),HV=p.object({url:p.string().optional().describe("the URL probed, if the check is an HTTP request"),command:p.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:p.record(p.string()).optional(),status:p.union([p.number(),p.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:vi.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),bS=p.array(p.object({component:vi.describe("a shared component listed above"),url:vi.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:vi.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"),pue=p.object({name:vi.describe("the credential's environment variable name, as listed above; never its value"),component:vi.describe("the component that refused it"),status:p.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:vi.describe("the request or command you tested it with and what came back, never the value")}),tf=p.object({schemaVersion:p.literal(1),baseUrls:p.record(p.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:HV.optional(),teardown:vi.describe("command that tears the SUT down"),dependencies:p.record(p.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:p.nativeEnum(Wr).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:p.array(p.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:p.object({command:vi,output:vi}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:p.array(p.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:p.boolean(),startedAt:vi.describe("ISO timestamp"),revisions:bS.optional(),credentialsRefused:p.array(pue).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:p.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});function wS(e){let t=[],n=r=>!!r&&typeof r=="object"&&!Array.isArray(r);return e.outcome!=="change-broke-bringup"&&e.outcome!=="bringup-failed"?(!n(e.baseUrls)||Object.keys(e.baseUrls).length===0?t.push("baseUrls must be a non-empty object of service \u2192 url"):Object.values(e.baseUrls).every(r=>typeof r=="string"&&r.trim())||t.push("every baseUrls value must be a non-empty url string"),n(e.health)?!(typeof e.health.url=="string"&&e.health.url.trim())&&!(typeof e.health.command=="string"&&e.health.command.trim())&&t.push("health must record a url or a command (what you actually ran)"):t.push("health must be an object"),(!n(e.dependencies)||Object.keys(e.dependencies).length===0)&&t.push("dependencies must be a non-empty object of name \u2192 boolean (real vs mocked) when the SUT came up \u2014 account for every backing service so a mocked one can't be hidden behind a green run")):(n(e.bringupError)||t.push(`outcome "${String(e.outcome)}" requires bringupError { command, output } \u2014 the exact failing bring-up command and what it printed`),e.outcome==="change-broke-bringup"&&!(Array.isArray(e.suspectFiles)&&e.suspectFiles.length>0&&e.suspectFiles.every(r=>typeof r=="string"&&r.trim()))&&t.push("change-broke-bringup requires non-empty suspectFiles[] \u2014 the changed file(s) the failure points at; if you cannot point at a file this PR changed, the outcome is bringup-failed (environment/harness), not the PR's fault")),e.outcome==="recipe-drift"&&!(Array.isArray(e.recipeFixes)&&e.recipeFixes.length>0)&&t.push("recipe-drift outcome requires a non-empty recipeFixes[] describing what was corrected"),t}var pn=p.string().trim().min(1),Lm=pn,CS=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(CS||{}),jm=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],kS=p.object({schemaVersion:p.literal(1),type:p.nativeEnum(CS).optional(),repository:Lm.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:p.enum(["ready","blocked"]),environment:vl.optional(),components:p.array(p.object({name:pn,repository:pn.describe(`owner/repo, or "${sr}" for a customer-deployed component no repository builds`),healthy:p.boolean(),url:p.string().min(1).nullable(),...vS,credentials:p.array(p.string().regex(Yr)).max(50).optional(),deployed:pn.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:p.array(p.object({framework:pn,file:pn,result:p.enum(["pass","fail","error"])}).strict()),inputsUsed:p.array(pn),inputsUsedHow:p.array(p.object({input:pn,how:pn}).strict()).optional(),inputsNotUsed:p.array(p.object({input:pn,reason:pn}).strict()),blockers:p.array(p.object({component:pn,problem:pn,evidence:pn,fix:pn}).strict()),replay:p.object({outcome:pn,durationSeconds:p.number().nonnegative().nullable()}).strict().nullable(),files:p.array(p.object({path:pn,content:p.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,s)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:p.ZodIssueCode.custom,path:["inputsUsedHow",s,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,s)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:p.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,s)=>{r.components.forEach((o,a)=>{i.has(o)||t.addIssue({code:p.ZodIssueCode.custom,path:["environment","revisionSources",s,"components",a],message:"not one of components"})})}),e.components.forEach((r,s)=>{r.deployed!==void 0!==n&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===sr&&!n&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"repository"],message:`only a customer_deployed component is ${sr}`})}),n&&(e.components.forEach((r,s)=>{e.components.findIndex(o=>o.name===r.name)!==s&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:p.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,s)=>{jm.includes(r.path)&&t.addIssue({code:p.ZodIssueCode.custom,path:["files",s,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(s=>s.components));e.components.forEach((s,o)=>{s.repository!==sr&&!r.has(s.name)&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",o,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var mxe=["clean","recipe-drift"];function nf(e){let t=YV.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}function SS(e){return[...new Set([...e.components.flatMap(t=>t.credentials??[]),...e.environment?.credentials??[]])].filter(t=>Yr.test(t))}var BS=[".skyramp/sut",".skyramp/workspace.yml"];var ZV=256*1024*1024,fue=3e4;function RS(e,t,n=fue){let i=(0,WV.spawnSync)("git",[...Gi,...t],{env:St(),cwd:e,encoding:"utf-8",timeout:n,maxBuffer:ZV});return i.status===0?i.stdout.trimEnd():void 0}var Cxe=["--",":/",...BS.map(e=>`:(exclude)${e}`)],KV="--literal-pathspecs";function xS(e,t){return!!RS(e,[KV,"status","--porcelain","--",t])}function QS(e,t){return/ blob /.test(RS(e,[KV,"ls-tree","HEAD","--",t])??"")}bn();bn();var wc=(s=>(s.NotFound="not_found",s.NoAccess="no_access",s.Unavailable="unavailable",s.AccessLost="access_lost",s.CannotOpen="cannot_open",s))(wc||{});var $S=e=>`${e.source}:${e.site??""}:${e.key}`;var rf=/^pasted-[0-9a-f]{16}$/,$o=/^file-[0-9a-f]{16}$/,sf=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(sf||{}),of=e=>e.trim().toUpperCase(),XV=(e,t)=>{let n=e.trim();return rf.test(n.toLowerCase())?"Pasted text":$o.test(n.toLowerCase())?t?.get(of(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()};var Vm=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(Vm||{}),To=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(To||{}),Cc=(C=>(C.RelatedChangeConflict="related_change_conflict",C.ReferenceOutsideTarget="reference_outside_target",C.SourceAccessLost="source_access_lost",C.ConfigurationIncomplete="configuration_incomplete",C.CredentialUnavailable="credential_unavailable",C.WorkflowBindingUnverified="workflow_binding_unverified",C.WorkflowRefUnprotected="workflow_ref_unprotected",C.BedrockWorkflowRequired="bedrock_workflow_required",C.DeploymentReview="deployment_review",C.SutRevisionMismatch="sut_revision_mismatch",C.IsolationUnavailable="isolation_unavailable",C.EvidenceInsufficient="evidence_insufficient",C.ConfigurationUnresolved="configuration_unresolved",C.ModelProviderDenied="model_provider_denied",C.ModelProviderUnavailable="model_provider_unavailable",C.RunnerProviderNotReady="runner_provider_not_ready",C.MergeConflict="merge_conflict",C))(Cc||{}),_o=(s=>(s.CiCheck="ci_check",s.TestReport="test_report",s.StaticAnalysis="static_analysis",s.CodeReview="code_review",s.Other="other",s))(_o||{}),af=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(af||{}),cf=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(cf||{});var Gm=(n=>(n.Probe="probe",n.Agent="agent",n))(Gm||{}),zm=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(zm||{}),qm=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(qm||{});var en=e=>e.slice(0,12);var hue=["generate-unit","native-run"],xxe=["preflight","plan","write",...hue,"report","deliver"];var TS=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(TS||{}),gue=Object.values(TS);var No=(o=>(o.Place="place",o.Update="update",o.Regenerate="regenerate",o.Delete="delete",o.Verify="verify",o.None="none",o))(No||{}),Kr=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(Kr||{}),Zr=p.string().trim().min(1),uf=p.array(p.string().url().max(2048).regex(/^https?:\/\//i)).max(50),eG=p.object({case:Zr.describe("a covers id \u2014 the recommend case this test realizes"),status:p.nativeEnum(Kr),runtimeTargets:uf.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),fromJourney:p.boolean().optional()}),tG=p.object({exit:p.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:p.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:p.array(eG).optional().describe("ONE ENTRY PER CASE the file covers; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one)")}),nG=p.object({from:p.string().optional().describe("staged path \u2014 required for placements"),file:Zr.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Zr.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:p.nativeEnum(No),covers:p.array(p.string()).optional().describe("recommend ids a placed test covers"),repro:p.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:p.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:p.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Zr.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Zr.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:tG,assertionCount:p.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:p.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),rG=(n=>(n.Junit="junit",n.Converter="converter",n))(rG||{}),mue=Zr.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),yue=p.object({results:Zr.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:p.nativeEnum(rG),run:Zr.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:p.array(Zr).min(1).describe("the items[].file paths this run covered"),cases:p.array(p.object({test:Zr.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:Zr.describe("the covers id it realizes"),file:mue})).describe("map each reported test name to the case it covers")}),Eue=p.object({suites:p.array(yue).min(1)}),_S=p.object({schemaVersion:p.literal(1),items:p.array(nG),runnerResults:Eue.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:p.array(p.string()).describe("existing tests assessed and deliberately left untouched"),summary:Zr.describe("one paragraph")});var df=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(df||{}),Km=(s=>(s.Trigger="TRIGGER",s.Baseline="BASELINE",s.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",s.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",s.ManualOverride="MANUAL_OVERRIDE",s))(Km||{}),pf=(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))(pf||{}),vue=["sut_setup"],Iue=["sut_setup","schedule","revision_read"];var Xm=(t=>(t.PullRequest="pull_request",t))(Xm||{}),DS=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(DS||{}),iG=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var ey=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s.RevisionsUploaded="revisions_uploaded",s))(ey||{}),mG=(n=>(n.Running="running",n.Ended="ended",n))(mG||{}),ty=(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))(ty||{}),PS=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(PS||{}),ff=(n=>(n.Started="started",n.Finished="finished",n))(ff||{}),US=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(US||{});var FS=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(FS||{});var ny=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(ny||{}),Af=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(Af||{}),lf=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(lf||{});var hf=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(hf||{}),Xr=p.string().regex(/^[1-9][0-9]{0,18}$/),Ii=p.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),wl=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Bn=p.string().regex(wl),Ln=p.string().regex(/^[0-9a-f]{64}$/),Zm=p.object({id:Bn,revision:Xr}).strict(),ry={provider:p.literal("github"),providerAccountId:Xr,providerRepositoryId:Xr},iy={provider:p.literal("azure-devops"),providerAccountId:Bn,providerRepositoryId:Bn},Rr=p.discriminatedUnion("provider",[p.object(ry).strict(),p.object(iy).strict()]),OS=p.discriminatedUnion("provider",[p.object(ry).passthrough(),p.object(iy).passthrough()]),kc=e=>`${e.provider}:${e.providerRepositoryId}`,sG={namespace:p.string().min(1),name:p.string().min(1)},yG=p.discriminatedUnion("provider",[p.object({...ry,...sG}).strict(),p.object({...iy,...sG}).strict()]),oG=p.object({ref:p.string().min(1),revision:Ii}).strict(),bue=p.object({kind:p.nativeEnum(DS),number:Xr.optional(),ref:p.string().min(1),revision:Ii,reason:p.nativeEnum(Km)}).strict(),wue=p.object({repository:yG,revision:Ii,ref:p.string().nullable(),reason:p.nativeEnum(Km),change:p.object({kind:p.nativeEnum(Xm),number:Xr,base:oG.optional()}).strict().nullable(),compareWith:oG.optional(),merge:p.array(bue).min(2).optional()}).strict();function Cue(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,i=new Set;for(let[s,o]of t.entries()){if(o.kind==="pull_request"!=(o.number!==void 0))return{path:["merge",s,"number"],message:"a pull request names its number, and a branch none"};if(!iG.includes(o.reason))return{path:["merge",s,"reason"],message:`${o.reason} does not select a merged revision`};if(o.kind==="branch"&&o.reason!=="MANUAL_OVERRIDE")return{path:["merge",s,"reason"],message:"only a person chooses a branch to merge"};if(o.ref===e.ref)return{path:["merge",s,"ref"],message:"the baseline branch is what the source merges onto"};if(o.number!==void 0&&n.has(o.number)||i.has(o.ref))return{path:["merge",s],message:"names a revision the source already merges"};o.number!==void 0&&n.add(o.number),i.add(o.ref)}let r=iG.find(s=>t.some(o=>o.reason===s));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}function kue(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(u=>u!=null).length>1)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let o=new Set(e.sources.map(u=>kc(u.repository))),a=new Set(r.map(u=>kc(u.repository)));return a.size===r.length&&a.size===o.size&&[...a].every(u=>o.has(u))?null:"names every source of the snapshot, once"}var EG=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,vG=/^[1-9][0-9]{0,18}$/,aG=new RegExp(`${EG.source}|${vG.source}`),cG=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,Sue=p.union([p.object({source:p.literal("jira"),site:p.string().regex(cG),key:p.string().regex(EG),updated:p.string().datetime(),contentHash:Ln}).strict(),p.object({source:p.literal("confluence"),site:p.string().regex(cG),key:p.string().regex(vG),version:p.number().int().positive(),contentHash:Ln}).strict(),p.object({source:p.literal("other"),key:p.string().regex(rf),contentHash:Ln}).strict(),p.object({source:p.literal("other"),key:p.string().regex($o),contentHash:Ln,fileName:p.string().min(1).max(255),mediaType:p.nativeEnum(sf)}).strict()]),uG=p.union([p.literal("jira"),p.literal("confluence")]),Bue=p.object({schemaVersion:p.literal(1),items:p.array(p.union([p.object({source:uG,site:p.string(),key:p.string().regex(aG),state:p.literal("read"),text:p.string(),version:p.string().min(1),contentMatches:p.boolean()}).strict(),p.object({source:uG,site:p.string(),key:p.string().regex(aG),state:p.literal("not_read"),reason:p.nativeEnum(wc)}).strict(),p.object({source:p.literal("other"),key:p.string().regex(rf),state:p.literal("read"),text:p.string(),version:p.string().min(1),contentMatches:p.boolean()}).strict(),p.object({source:p.literal("other"),key:p.string().regex(rf),state:p.literal("not_read"),reason:p.nativeEnum(wc)}).strict(),p.object({source:p.literal("other"),key:p.string().regex($o),state:p.literal("read"),version:Ln,fileName:p.string().min(1).max(255),mediaType:p.nativeEnum(sf)}).strict(),p.object({source:p.literal("other"),key:p.string().regex($o),state:p.literal("not_read"),reason:p.nativeEnum(wc)}).strict()])),instructions:p.array(p.string()).optional()}).strict(),Rue=p.object({resultId:p.string().min(1),repository:p.string().min(1),testType:p.string().min(1),path:p.string(),finding:p.string().min(1)}).strict(),xue=p.object({schemaVersion:p.literal(1),runId:Bn,skyrampOrgId:Bn,target:Zm,policy:Zm.nullable(),trigger:p.object({kind:p.nativeEnum(pf),requestedAt:p.string().datetime()}).strict(),configuration:p.object({captureId:Bn,revision:Xr.nullable(),hash:Ln}).strict(),baseline:p.object({confirmedRunId:Bn.nullable(),initialBaselineId:Bn.optional(),comparisonBaselineId:Bn.optional(),knownFailures:p.array(Rue).optional(),sources:p.array(p.object({repository:Rr,revision:Ii}).strict()).optional()}).strict().optional(),sources:p.array(wue).min(1).max(1e3),execution:p.object({provider:p.nativeEnum(df),repository:yG,workflowPath:p.string(),ref:p.string()}).strict(),credentials:p.array(p.object({name:p.string(),purpose:p.nativeEnum(yl),required:p.boolean()}).strict()),requirements:p.array(Sue).min(1).optional(),instructions:p.object({contentHash:Ln}).strict().optional(),deployedRevisions:p.array(p.object({repository:Rr,revision:Ii}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((c,u)=>{let d="fileName"in c?"file":"pasted";c.source==="other"&&c.key!==`${d}-${c.contentHash.slice(0,16)}`&&t.addIssue({code:p.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",u,"key"]});let f=$S({source:c.source,key:c.key});n.has(f)&&t.addIssue({code:p.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",u,"key"]}),n.add(f)});let i=e.trigger.kind,r=vue.includes(i);r!==(e.policy===null)&&t.addIssue({code:p.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:p.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let s=kue(e);s&&t.addIssue({code:p.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:s}),Iue.includes(i)&&e.sources.forEach((c,u)=>{c.reason!=="BASELINE"&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:p.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let o=new Set(e.sources.map(c=>kc(c.repository))),a=new Set;(e.deployedRevisions??[]).forEach((c,u)=>{let d=kc(c.repository);o.has(d)?a.has(d)&&t.addIssue({code:p.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"repository appears twice"}):t.addIssue({code:p.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"names a repository outside the snapshot"}),a.add(d)}),e.sources.forEach((c,u)=>{c.compareWith&&(c.reason!=="MANUAL_OVERRIDE"||c.change)&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(c.change?.base||c.compareWith||c.merge)&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let d=Cue(c);d&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u,...d.path],message:d.message})})});var MS=(n=>(n.Person="person",n.Policy="policy",n))(MS||{}),Que=p.object({kind:p.nativeEnum(MS),name:p.string().min(1).max(256)}).strict(),$ue=p.object({mcp:p.discriminatedUnion("source",[p.object({source:p.literal("npm"),version:p.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),p.object({source:p.literal("github"),ref:p.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:p.object({region:p.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:p.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Lxe=p.object({schemaVersion:p.literal(1),attempt:p.object({id:Bn,number:p.number().int().positive(),deadlineAt:p.string().datetime()}).strict(),manifest:xue,manifestHash:Ln,entitlements:p.array(p.string()).optional(),runToken:p.string().min(1).optional(),requestedBy:Que.nullable().optional(),writeAllowed:p.boolean().optional(),claudeCodeVersion:p.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:p.array(p.object({repository:Rr,revision:Ii}).strict()).optional(),statedRevisions:p.array(p.object({repository:Rr,revision:Ii}).strict()).optional(),runSettings:$ue.optional()}).strict(),lG={providerRunAttempt:p.number().int().positive(),workflowRef:p.string().min(1)},Tue=p.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),jxe=p.object({schemaVersion:p.literal(1),runId:Bn,execution:p.discriminatedUnion("provider",[p.object({...lG,provider:p.literal("github"),repository:p.object(ry).strict(),providerRunId:Xr}).strict(),p.object({...lG,provider:p.literal("azure-devops"),repository:p.object(iy).strict(),providerRunId:Tue}).strict()]),requester:p.literal(!0).optional(),writeCheck:p.literal(!0).optional(),claudeCodePin:p.literal(!0).optional(),deployedPins:p.literal(!0).optional(),statedPins:p.literal(!0).optional(),runSettings:p.literal(!0).optional()}).strict(),dG=p.object({repository:Rr,number:Xr,commitSha:Ii.optional()}).strict(),Hm=p.array(p.object({repository:Rr,reason:p.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),_ue=p.discriminatedUnion("status",[p.object({status:p.literal("none"),noTests:Hm}).strict(),p.object({status:p.literal("delivered"),noTests:Hm,pullRequests:p.array(dG).min(1)}).strict(),p.object({status:p.literal("partial"),noTests:Hm,pullRequests:p.array(dG).min(1),failures:p.array(p.object({repository:Rr,message:p.string()}).strict()).min(1)}).strict(),p.object({status:p.literal("failed"),message:p.string(),noTests:Hm}).strict()]),LS=1024*1024,IG=16*1024*1024,Ym=e=>p.array(p.object({[e]:p.string()}).strict()).optional(),Nue=p.object({language:p.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:p.string(),validation:p.object({rationale:p.string(),gaps:p.array(p.string())}).strict().optional(),changes:p.array(p.object({id:p.string(),text:p.string()}).strict()).optional(),issuesFound:Ym("description"),newTestsCreated:Ym("description"),testResults:Ym("details"),caveats:Ym("text")}).strict(),Due=p.object({blockedPreflight:p.object({file:p.string().min(1),repository:p.string().min(1).optional(),reason:p.string().min(1).max(300),evidence:p.string().min(1).max(400)}).strict().optional(),sufficiency:p.nativeEnum(To),rationale:p.string().min(1),gaps:p.array(p.string().min(1)),acceptedEvidence:p.array(p.object({kind:p.nativeEnum(_o),repository:p.string().min(1),revision:Ii,reference:p.string().min(1),summary:p.string().min(1)}).strict()),actionRequired:p.array(p.nativeEnum(Cc))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:p.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Wm=500,bG=2048,wG=1e3,Pue=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,pG=e=>e.length>0&&e.length<=64&&e===e.trim()&&!Pue.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),CG=e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&pG(n)&&pG(i)},Uue=p.object({testResults:p.array(p.object({resultId:p.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:p.string().refine(CG,"Invalid"),testType:p.string(),runtimeTargets:uf.optional(),endpoint:p.string(),status:p.enum(["Pass","Fail","Skipped"]),details:p.string(),fileName:p.string().optional(),testId:p.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:p.object({kind:p.nativeEnum(af),family:p.nativeEnum(cf).optional()}).strict().optional(),origin:p.nativeEnum(Vm).optional()}).strict()),validation:Due,changes:p.array(p.object({id:p.string().min(1).max(512),text:p.string().max(16384),source:p.string().max(bG),testedBy:p.array(p.string().min(1).max(1024)).max(Wm),writtenBy:p.array(p.string().min(1).max(1024)).max(Wm),maintainedBy:p.array(p.string().min(1).max(1024)).max(Wm)}).strict()).max(wG).optional(),traceVersion:p.literal(1),display:Nue.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let s of["issuesFound","newTestsCreated","testResults","caveats"]){let o=n?.[s];o&&o.length!==(Array.isArray(i[s])?i[s].length:0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["display",s],message:`has not one row per ${s} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((s,o)=>{let a=s.failureCause;a&&s.status==="Pass"&&t.addIssue({code:p.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"a passing result has no failure cause"}),a&&a.kind==="environment"!=(a.family!==void 0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"an environment cause names its family, and no other cause does"});let c=["testResults",o,"resultId"],u=s.resultId.slice(`${s.repository}:${s.testType}:`.length);(!s.resultId.startsWith(`${s.repository}:${s.testType}:`)||u===""||u.startsWith("/")||u.startsWith("#"))&&t.addIssue({code:p.ZodIssueCode.custom,path:c,message:"is not repository:testType:path for this result"}),r.has(s.resultId)&&t.addIssue({code:p.ZodIssueCode.custom,path:c,message:"stable identity repeated"}),r.add(s.resultId)})});var kG=50,fG=p.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),SG=p.discriminatedUnion("kind",[p.object({kind:p.literal("branch_pushed"),repository:Rr,branch:fG,commit:Ii}).strict(),p.object({kind:p.enum(["pull_request_opened","pull_request_edited"]),repository:Rr,number:Xr,branch:fG}).strict()]),Fue=p.object({schemaVersion:p.literal(1),run:p.object({runId:Bn,attemptNumber:p.number().int().positive(),manifestHash:Ln}).strict(),target:Zm,policy:Zm,provenance:p.object({sources:p.array(p.object({repository:Rr,revision:Ii}).strict()),firstQualification:p.literal(!0).optional()}).strict(),delivery:p.object({generatedTests:_ue}).strict(),producer:p.object({testbot:p.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:p.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Uue,githubWrites:p.array(SG).max(kG).optional()}).strict(),jS=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(jS||{}),VS=200,Oue=p.object({cause:p.nativeEnum(jS),credential:p.string().regex(Yr).optional(),reason:p.string().trim().min(1).max(VS).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),Mue=p.object({name:p.string().regex(Yr),purpose:p.enum(["sut_access","other"]),required:p.boolean(),how:p.string().trim().min(1).max(Om)}).strict(),Vxe=Fue.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:kS,check:Oue.optional(),inputs:p.array(Mue).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=(s,o)=>t.addIssue({code:p.ZodIssueCode.custom,path:["recipe",...s],message:o});e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((s,o)=>{nf(s.path)||n(["files",o,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),i.has(s.path)&&n(["files",o,"path"],"file repeated"),i.add(s.path),IS.test(s.content)&&n(["files",o,"content"],"is not text");let a=Buffer.byteLength(s.content,"utf8");r+=a,a>Xp&&n(["files",o,"content"],`larger than ${Xp} bytes`)}),r>ef&&n(["files"],`recipe text over ${ef} bytes in total`)}),Gxe=p.object({components:p.array(p.object({name:p.string().min(1),repository:p.string().refine(CG,"Invalid"),observedRevision:p.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:p.nativeEnum(Gm),evidence:p.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Lue=p.object({schemaVersion:p.literal(1),stage:p.nativeEnum(PS),event:p.nativeEnum(ff),status:p.nativeEnum(US).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Cl=100,GS=5e3,Do=2e3,NS=100,zS=/^[A-Za-z0-9_-]{1,64}$/,BG=20,RG=200,xG=100,QG=100,jue=200,AG="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Vue=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${AG}/${AG})$`),$G=500,TG=50,_G=10,NG=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,kl=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,Br=e=>p.string().max(e).refine(t=>t.trim().length>0&&!kl.test(t),"blank, or not text"),Hi={sequence:p.number().int().min(1).max(GS),at:p.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},DG=p.object({...Hi,kind:p.literal("reply"),to:p.string().uuid(),outcome:p.nativeEnum(ny),accepted:p.boolean(),text:Br(Do),note:p.object({source:p.enum(["target","environment"]),quote:Br(Do)}).strict().optional(),kept:Br(Do).optional()}).strict();function PG(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:p.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:p.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:p.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}var UG=p.discriminatedUnion("kind",[p.object({...Hi,kind:p.literal("log"),phase:p.nativeEnum(Af),text:Br(Do)}).strict(),p.object({...Hi,kind:p.literal("component"),name:Br(NS),repository:Br(jue).refine(e=>Vue.test(e)||e===sr,"not owner/name"),file:Br($G).nullable(),status:p.nativeEnum(hf),version:Br(QG).optional()}).strict(),DG,p.object({...Hi,kind:p.literal("question"),id:p.string().regex(zS),type:p.nativeEnum(FS),text:Br(Do),component:Br(NS).nullable(),choices:p.array(Br(RG)).max(BG),placeholder:Br(xG).optional()}).strict(),p.object({...Hi,kind:p.literal("delivered"),ids:p.array(p.string().uuid()).max(Cl)}).strict(),p.object({...Hi,kind:p.literal("credentials"),names:p.array(p.string().regex(Yr)).min(1).max(TG),logins:p.array(p.object({key:p.string().regex(NG),usernameVariable:p.string().regex(Yr),passwordVariable:p.string().regex(Yr)}).strict()).min(1).max(_G).optional()}).strict()]).superRefine((e,t)=>{if(PG(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>hS(i.key));new Set(n).size!==n.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let s of["usernameVariable","passwordVariable"])e.names.includes(i[s])||t.addIssue({code:p.ZodIssueCode.custom,path:["logins",r,s],message:"not one of the names"})})}e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Gue=p.object({schemaVersion:p.literal(1),events:p.array(UG).max(Cl)}).strict(),FG=p.discriminatedUnion("kind",[p.object({...Hi,kind:p.literal("log"),stage:p.nativeEnum(lf),text:Br(Do)}).strict(),DG,p.object({...Hi,kind:p.literal("delivered"),ids:p.array(p.string().uuid()).max(Cl)}).strict(),p.object({...Hi,kind:p.literal("stage"),stage:p.nativeEnum(lf),event:p.nativeEnum(ff)}).strict(),p.object({...Hi,kind:p.literal("test"),resultId:p.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:p.enum(["Pass","Fail","Skipped"]),details:p.string().max(Do).refine(e=>!kl.test(e),"not text")}).strict()]).superRefine(PG),zue=p.object({schemaVersion:p.literal(1),events:p.array(FG).max(Cl)}).strict(),hG={id:p.string().uuid(),text:p.string(),by:p.string().nullable(),at:p.string(),replied:p.literal(!0).optional()},OG=p.discriminatedUnion("kind",[p.object({...hG,kind:p.literal("instruction"),question:p.null()}),p.object({...hG,kind:p.literal("answer"),question:p.string().regex(zS)})]),MG=p.string().regex(/^[A-Za-z0-9+/]{43}=$/),que=p.object({id:p.string().uuid(),revision:p.string(),by:p.string().nullable(),at:p.string(),target:p.string(),own:p.object({source:p.enum(["policy","test_environment"]),text:p.string()}).nullable()}),Jue=p.object({schemaVersion:p.literal(1),leftOut:p.array(p.string()),messages:p.array(OG).optional(),stop:p.object({key:MG}).optional(),notes:que.optional()}),Hue=p.object({schemaVersion:p.literal(1),messages:p.array(OG).optional()});var LG=500*1024*1024,jG=p.object({id:Xr,name:p.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Xr,expiresAt:p.string().datetime()}).strict(),Yue=p.object({schemaVersion:p.literal(1),artifact:jG,sessionId:Bn,contentHash:Ln,bytes:p.number().int().min(1).max(LG)}).strict(),Wue=p.object({schemaVersion:p.literal(1),checkpoint:p.object({artifact:jG,repository:p.object({namespace:p.string().min(1),name:p.string().min(1)}).strict(),sessionId:Bn,contentHash:Ln,key:MG}).strict().nullable()}).strict(),Zue=200,bl=100,qS=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(qS||{}),Kue=p.object({kind:p.nativeEnum(qS),setup:p.object({runId:Bn,endedAt:p.string().nullable(),outcome:p.string().nullable()}).strict(),components:p.array(p.object({name:p.string().min(1),repository:p.string().min(1),status:p.nativeEnum(hf)}).strict()).max(bl),credentials:p.array(p.string().min(1)).max(bl),answers:p.array(p.object({question:p.string(),answer:p.string().nullable()}).strict()).max(bl),instructions:p.array(p.object({text:p.string(),reply:p.string().nullable()}).strict()).max(bl),log:p.array(p.object({phase:p.nativeEnum(Af),text:p.string()}).strict()).max(Zue),recipe:p.object({files:p.array(p.object({path:p.string().min(1),content:p.string()}).strict()).max(bl),blockers:p.array(p.object({component:p.string(),problem:p.string(),evidence:p.string(),fix:p.string()}).strict()).max(bl)}).strict().optional()}).strict(),Xue=p.object({schemaVersion:p.literal(1),context:Kue.nullable()}).strict(),ele=p.object({schemaVersion:p.literal(1),configuration:p.object({captureId:Bn,revision:Xr.nullable(),hash:Ln}).strict(),capture:p.object({schemaVersion:p.literal(1),settings:p.object({target:p.object({environment:p.unknown()}).passthrough(),timeoutMinutes:p.number().int().positive(),answerWaitMinutes:p.number().int().positive().optional(),testEnvironment:p.object({name:p.string().min(1),address:p.string().min(1).optional(),readyWhen:p.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:p.object({}).passthrough(),hash:Ln}).strict()}).strict(),tle=vl.extend({version:p.number().int().positive(),components:p.array(p.object({name:p.string().min(1),repository:p.string().min(1)}).strict()),contentHash:Ln.optional(),files:p.array(p.object({path:p.string().refine(e=>nf(e)&&!jm.includes(e),"not a file of a customer_deployed plan"),content:p.string()}).strict()).optional()}).strict(),nle=p.object({schemaVersion:p.literal(1),testEnvironment:tle.nullable().optional(),runtimePlan:p.object({version:p.number().int().positive(),contentHash:Ln,files:p.array(p.object({path:p.string().refine(nf,"not a recipe file path"),content:p.string()}).strict()).min(1),repository:Lm.optional(),recipeRepository:Lm.optional(),recipe:p.record(p.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),rle=p.object({schemaVersion:p.literal(1),state:p.nativeEnum(mG),ending:p.nativeEnum(ey).nullable(),cause:p.nativeEnum(ty).nullable(),deadlineAt:p.string().datetime()}).strict();var VG=50,GG=p.object({repository:Rr,revisions:p.array(p.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:p.array(p.string().min(1)).min(1).max(VG)}).strict();function zG(e){return e.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:e.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:e.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:e.mergeConflict&&gG(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict}:{schemaVersion:1,reason:"no_report",cause:gG({...e,mergeConflict:void 0})}}function gG(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}var qG=he(require("path"));var Sl=he(require("fs")),Sc=he(require("path"));var ile=8;function tn(e,t,n={}){let i=t.slice(0,ile),r=t.length-i.length;return{name:e,passed:!1,details:i.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}function Po(e){if(Sl.existsSync(e))try{return JSON.parse(Sl.readFileSync(e,"utf-8"))}catch{return}}function st(e,t){return Po(Sc.join(e.outputsDir,t))}function Rn(e,t,n,i){if(!n)throw new Error(`${t}.json unexpectedly invalid at artifact time: ${i[0]}`);let r=Sc.join(e.outputsDir,`${t}.json`);return Sl.writeFileSync(r,JSON.stringify(n,null,2)+`
|
|
116
|
+
`:""}return pS.dump=b,pS}var aV;function zae(){if(aV)return kn;aV=1;let e=Vae(),t=Gae();function n(i,r){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}return kn.Type=Mn(),kn.Schema=cV(),kn.FAILSAFE_SCHEMA=pV(),kn.JSON_SCHEMA=mV(),kn.CORE_SCHEMA=yV(),kn.DEFAULT_SCHEMA=fS(),kn.load=e.load,kn.loadAll=e.loadAll,kn.dump=t.dump,kn.YAMLException=Hp(),kn.types={binary:IV(),float:gV(),map:dV(),null:fV(),pairs:wV(),set:CV(),timestamp:EV(),bool:AV(),int:hV(),merge:vV(),omap:bV(),seq:lV(),str:uV()},kn.safeLoad=n("safeLoad","load"),kn.safeLoadAll=n("safeLoadAll","loadAll"),kn.safeDump=n("safeDump","dump"),kn}var qae=zae(),Jae=Lae(qae),{Type:ERe,Schema:vRe,FAILSAFE_SCHEMA:IRe,JSON_SCHEMA:kV,CORE_SCHEMA:bRe,DEFAULT_SCHEMA:wRe,load:zr,loadAll:Hae,dump:CRe,YAMLException:kRe,types:SRe,safeLoad:BRe,safeLoadAll:RRe,safeDump:xRe}=Jae;var _s=e=>typeof e=="string"?e:void 0;function BV(e){let t={services:[]},n;try{let c=SV.readFileSync(e,"utf8");n=zr(c,{schema:kV})}catch(c){return At(`Lenient parse: failed to read/parse ${e}: ${c.message}`),t}if(!n||typeof n!="object"||Array.isArray(n))return At(`Lenient parse: ${e} did not contain a YAML object`),t;let i=n,r=i.metadata&&typeof i.metadata=="object"?i.metadata:void 0,s=r?{executorVersion:_s(r.executorVersion),mcpVersion:_s(r.mcpVersion)}:void 0,a=(Array.isArray(i.services)?i.services:[]).reduce((c,u,d)=>{if(!u||typeof u!="object"||Array.isArray(u))return At(`Lenient parse: services[${d}] is not an object \u2014 skipping`),c;let f=u,h=_s(f.serviceName);if(!h)return At(`Lenient parse: services[${d}] missing or non-string serviceName \u2014 skipping`),c;let g=f.api&&typeof f.api=="object"?f.api:void 0,m=f.runtimeDetails&&typeof f.runtimeDetails=="object"?f.runtimeDetails:void 0;return c.push({serviceName:h,language:_s(f.language),framework:_s(f.framework),testDirectory:_s(f.testDirectory),api:g?{baseUrl:_s(g.baseUrl)}:void 0,runtimeDetails:m?{serverStartCommand:_s(m.serverStartCommand),serverTeardownCommand:_s(m.serverTeardownCommand)}:void 0}),c},[]);return{metadata:s,services:a}}async function xV(e){let t=RV.resolve(e.workingDirectory),n=new Qm(t),i=[],r=e.targetSetupCommand,s=e.targetTeardownCommand,o=e.skyrampExecutorVersion,a=e.skyrampMcpVersion;if(await n.exists()){Lr(`Found ${n.getConfigPath()}, loading workspace configuration...`);try{let u;try{u=await n.read()}catch(f){At(`${n.getConfigPath()} failed strict validation: ${f.message}. Re-reading with per-field lenient parse \u2014 invalid fields will fall back to action input defaults.`),u=BV(n.getConfigPath())}u.metadata&&(!o&&u.metadata.executorVersion&&(o=u.metadata.executorVersion),!a&&u.metadata.mcpVersion&&(a=u.metadata.mcpVersion));for(let f of u.services??[])i.push({serviceName:f.serviceName,language:f.language,framework:f.framework,baseUrl:f.api?.baseUrl,testDirectory:f.testDirectory});let d=(u.services??[])[0];if(d){!r&&d.runtimeDetails?.serverStartCommand&&(r=d.runtimeDetails.serverStartCommand);let f=d.runtimeDetails?.serverTeardownCommand;!s&&typeof f=="string"&&(s=f)}}catch(u){At(`Failed to parse ${n.getConfigPath()}: ${u.message} \u2014 falling back to action input defaults`)}}else Fp("No .skyramp/workspace.yml found, using action input defaults");o||(o="v1.3.54"),a||(a="latest"),r||(r="docker compose up -d --build");let c={targetSetupCommand:r,authTokenCommand:e.authTokenCommand,targetTeardownCommand:s,skipTargetTeardown:e.skipTargetTeardown,skyrampExecutorVersion:o,skyrampMcpVersion:a,skyrampMcpSource:e.skyrampMcpSource,skyrampMcpGithubRef:e.skyrampMcpGithubRef,nodeVersion:e.nodeVersion,skipTargetSetup:e.skipTargetSetup,targetReadyCheckCommand:e.targetReadyCheckCommand,targetReadyCheckTimeout:e.targetReadyCheckTimeout,targetReadyCheckInterval:e.targetReadyCheckInterval,targetReadyCheckDiagnosticsCommand:e.targetReadyCheckDiagnosticsCommand,autoCommit:e.autoCommit,commitMessage:e.commitMessage,generatedTestsMode:e.generatedTestsMode,postPrComment:e.postPrComment,testExecutionTimeout:e.testExecutionTimeout,maxRecommendations:e.maxRecommendations,maxGenerate:e.maxGenerate,perTestMaxFixAttempts:e.perTestMaxFixAttempts,testbotMaxRetries:e.testbotMaxRetries,testbotRetryDelay:e.testbotRetryDelay,testbotTimeout:e.testbotTimeout,targetSetupRetries:e.targetSetupRetries,targetSetupRetryDelay:e.targetSetupRetryDelay,authTokenRetries:e.authTokenRetries,authTokenRetryDelay:e.authTokenRetryDelay,reportCollapsed:e.reportCollapsed,language:e.language,enableDebug:e.enableDebug,testRepoPath:e.testRepoPath,relatedRepoPaths:e.relatedRepoPaths,services:i};pm("Resolved configuration");for(let[u,d]of Object.entries(c))u==="authTokenCommand"?Lr(` ${u}: [REDACTED]`):u==="services"?Lr(` ${u}: ${JSON.stringify(d)}`):Lr(` ${u}: ${d}`);return fm(),c}bn();bn();ok();var $V=he(require("child_process")),AS=class extends Error{constructor(t){super(t),this.name="ExecTimeoutError"}},Tm=class extends Error{constructor(t){super(t),this.name="ExecAbortedError"}};function QV(e,t){if(!(!e||e.destroyed||e.writableEnded))try{e.write(t)}catch(n){At(`stream write failed: ${n instanceof Error?n.message:String(n)}`)}}async function TV(e,t=[],n={}){let i="",r="",s={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:a=>{i+=a.toString(),QV(n.stdoutStream,a)},stderr:a=>{r+=a.toString()}}};if(n.timeout||n.signal){let a=n.signal;return a?.aborted?Promise.reject(new Tm(`Command aborted before start: ${e}`)):new Promise((c,u)=>{let d=$V.spawn(e,t,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});d.stdout?.on("data",E=>{i+=E.toString(),n.silent||process.stdout.write(E),QV(n.stdoutStream,E)}),d.stderr?.on("data",E=>{r+=E.toString(),n.silent||process.stderr.write(E)}),n.input&&d.stdin?.end(n.input);let f=()=>{m&&clearTimeout(m),a?.removeEventListener("abort",g)},h=E=>{f();try{d.kill("SIGTERM")}catch{}u(E)},g=()=>h(new Tm(`Command aborted: ${e}`)),m=n.timeout?setTimeout(()=>h(new AS(`Command timed out after ${Math.round(n.timeout/6e4)}m: ${e}`)),n.timeout):void 0;a?.addEventListener("abort",g,{once:!0}),d.on("close",E=>{f();let S=E??1;S!==0&&!n.ignoreReturnCode?u(new Error(`The process '${e}' failed with exit code ${S}`)):c({exitCode:S,stdout:i,stderr:r})}),d.on("error",E=>{f(),u(E)})})}return{exitCode:await l1(e,t,s),stdout:i,stderr:r}}async function _V(e,t){pm(e);try{return await t()}finally{fm()}}function hS(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}async function NV(e,t){await _V("Tearing down services",async()=>{if(e.skipTargetTeardown){Fp("Skipping service teardown (skipTargetTeardown=true)");return}if(!e.targetTeardownCommand){Lr("No targetTeardownCommand configured, skipping teardown");return}Lr(`Running teardown command: ${e.targetTeardownCommand}`);try{await TV("bash",["-c",e.targetTeardownCommand],{cwd:t}),Fp("Services torn down successfully")}catch(n){let i=n instanceof Error?n.message:String(n);At(`Service teardown command failed (non-fatal): ${i}`)}})}var Gi=["-c","core.fsmonitor=false"],DV=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"]),gS=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 _m(e){return DV.has(e)||e.startsWith("INPUT_")}function St(e=process.env,t,n="repo-command"){let i={};for(let[r,s]of Object.entries(e))n==="repo-command"&&gS.has(r)||(i[r]=s);Object.assign(i,t??{});for(let r of Object.keys(i))(DV.has(r)||r.startsWith("INPUT_"))&&delete i[r];return i}var WV=require("child_process");var YV=he(require("path"));var p={};Nr(p,{BRAND:()=>vce,DIRTY:()=>ac,EMPTY_PATH:()=>Kae,INVALID:()=>Be,NEVER:()=>iue,OK:()=>Sn,ParseStatus:()=>dn,Schema:()=>qe,ZodAny:()=>Ro,ZodArray:()=>Us,ZodBigInt:()=>uc,ZodBoolean:()=>lc,ZodBranded:()=>Wp,ZodCatch:()=>Ic,ZodDate:()=>dc,ZodDefault:()=>vc,ZodDiscriminatedUnion:()=>Pm,ZodEffects:()=>Hr,ZodEnum:()=>yc,ZodError:()=>rr,ZodFirstPartyTypeKind:()=>Te,ZodFunction:()=>Fm,ZodIntersection:()=>hc,ZodIssueCode:()=>W,ZodLazy:()=>gc,ZodLiteral:()=>mc,ZodMap:()=>hl,ZodNaN:()=>ml,ZodNativeEnum:()=>Ec,ZodNever:()=>Ei,ZodNull:()=>fc,ZodNullable:()=>Ji,ZodNumber:()=>cc,ZodObject:()=>ir,ZodOptional:()=>qr,ZodParsedType:()=>ue,ZodPipeline:()=>Zp,ZodPromise:()=>xo,ZodReadonly:()=>bc,ZodRecord:()=>Um,ZodSchema:()=>qe,ZodSet:()=>gl,ZodString:()=>Bo,ZodSymbol:()=>fl,ZodTransformer:()=>Hr,ZodTuple:()=>qi,ZodType:()=>qe,ZodUndefined:()=>pc,ZodUnion:()=>Ac,ZodUnknown:()=>Ps,ZodVoid:()=>Al,addIssueToContext:()=>oe,any:()=>xce,array:()=>_ce,bigint:()=>Cce,boolean:()=>qV,coerce:()=>rue,custom:()=>VV,date:()=>kce,datetimeRegex:()=>LV,defaultErrorMap:()=>Ns,discriminatedUnion:()=>Uce,effect:()=>Yce,enum:()=>qce,function:()=>Vce,getErrorMap:()=>ll,getParsedType:()=>zi,instanceof:()=>bce,intersection:()=>Fce,isAborted:()=>Nm,isAsync:()=>dl,isDirty:()=>Dm,isValid:()=>So,late:()=>Ice,lazy:()=>Gce,literal:()=>zce,makeIssue:()=>Yp,map:()=>Lce,nan:()=>wce,nativeEnum:()=>Jce,never:()=>$ce,null:()=>Rce,nullable:()=>Zce,number:()=>zV,object:()=>Nce,objectUtil:()=>mS,oboolean:()=>nue,onumber:()=>tue,optional:()=>Wce,ostring:()=>eue,pipeline:()=>Xce,preprocess:()=>Kce,promise:()=>Hce,quotelessJson:()=>Yae,record:()=>Mce,set:()=>jce,setErrorMap:()=>Zae,strictObject:()=>Dce,string:()=>GV,symbol:()=>Sce,transformer:()=>Yce,tuple:()=>Oce,undefined:()=>Bce,union:()=>Pce,unknown:()=>Qce,util:()=>Ke,void:()=>Tce});var Ke;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{let s={};for(let o of r)s[o]=o;return s},e.getValidEnumValues=r=>{let s=e.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(let a of s)o[a]=r[a];return e.objectValues(o)},e.objectValues=r=>e.objectKeys(r).map(function(s){return r[s]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},e.find=(r,s)=>{for(let o of r)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=i,e.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ke||(Ke={}));var mS;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(mS||(mS={}));var ue=Ke.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zi=e=>{switch(typeof e){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(e)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(e)?ue.array:e===null?ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ue.promise:typeof Map<"u"&&e instanceof Map?ue.map:typeof Set<"u"&&e instanceof Set?ue.set:typeof Date<"u"&&e instanceof Date?ue.date:ue.object;default:return ue.unknown}};var W=Ke.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"]),Yae=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),rr=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(s){return s.message},i={_errors:[]},r=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)i._errors.push(n(o));else{let a=i,c=0;for(;c<o.path.length;){let u=o.path[c],d=c===o.path.length-1;if(u==="_errors"){d&&a._errors.push(n(o)),c++;continue}Object.prototype.hasOwnProperty.call(a,u)||(u==="__proto__"?Object.defineProperty(a,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):a[u]={_errors:[]}),a=a[u],d&&a._errors.push(n(o)),c++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ke.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let s=r.path[0];n[s]=n[s]||[],n[s].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};rr.create=e=>new rr(e);var Wae=(e,t)=>{let n;switch(e.code){case W.invalid_type:e.received===ue.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case W.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ke.jsonStringifyReplacer)}`;break;case W.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ke.joinValues(e.keys,", ")}`;break;case W.invalid_union:n="Invalid input";break;case W.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ke.joinValues(e.options)}`;break;case W.invalid_enum_value:n=`Invalid enum value. Expected ${Ke.joinValues(e.options)}, received '${e.received}'`;break;case W.invalid_arguments:n="Invalid function arguments";break;case W.invalid_return_type:n="Invalid function return type";break;case W.invalid_date:n="Invalid date";break;case W.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ke.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case W.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case W.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case W.custom:n="Invalid input";break;case W.invalid_intersection_types:n="Intersection results could not be merged";break;case W.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case W.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ke.assertNever(e)}return{message:n}},Ns=Wae;var PV=Ns;function Zae(e){PV=e}function ll(){return PV}var Yp=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,s=[...n,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let a="",c=i.filter(u=>!!u).slice().reverse();for(let u of c)a=u(o,{data:t,defaultError:a}).message;return{...r,path:s,message:a}},Kae=[];function oe(e,t){let n=ll(),i=Yp({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Ns?void 0:Ns].filter(r=>!!r)});e.common.issues.push(i)}var dn=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return Be;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let s=await r.key,o=await r.value;i.push({key:s,value:o})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return Be;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(i[s.value]=o.value)}return{status:t.value,value:i}}},Be=Object.freeze({status:"aborted"}),ac=e=>({status:"dirty",value:e}),Sn=e=>({status:"valid",value:e}),Nm=e=>e.status==="aborted",Dm=e=>e.status==="dirty",So=e=>e.status==="valid",dl=e=>typeof Promise<"u"&&e instanceof Promise;var me;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(me||(me={}));var Jr=class{constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},UV=(e,t)=>{if(So(t))return{success:!0,data:t.value};if(!e.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 rr(e.common.issues);return this._error=n,this._error}}};function Me(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(o,a)=>{let{message:c}=e;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??i??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:r}}var qe=class{get description(){return this._def.description}_getType(t){return zi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:zi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new dn,ctx:{common:t.parent.common,data:t.data,parsedType:zi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(dl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zi(t)},r=this._parseSync({data:t,path:i.path,parent:i});return UV(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zi(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return So(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>So(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zi(t)},r=this._parse({data:t,path:i.path,parent:i}),s=await(dl(r)?r:Promise.resolve(r));return UV(i,s)}refine(t,n){let i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,s)=>{let o=t(r),a=()=>s.addIssue({code:W.custom,...i(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Hr({schema:this,typeName:Te.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 qr.create(this,this._def)}nullable(){return Ji.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Us.create(this)}promise(){return xo.create(this,this._def)}or(t){return Ac.create([this,t],this._def)}and(t){return hc.create(this,t,this._def)}transform(t){return new Hr({...Me(this._def),schema:this,typeName:Te.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new vc({...Me(this._def),innerType:this,defaultValue:n,typeName:Te.ZodDefault})}brand(){return new Wp({typeName:Te.ZodBranded,type:this,...Me(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new Ic({...Me(this._def),innerType:this,catchValue:n,typeName:Te.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Zp.create(this,t)}readonly(){return bc.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xae=/^c[^\s-]{8,}$/i,ece=/^[0-9a-z]+$/,tce=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nce=/^[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,rce=/^[a-z0-9_-]{21}$/i,ice=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,sce=/^[-+]?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)?)??$/,oce=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ace="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",yS,cce=/^(?:(?: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])$/,uce=/^(?:(?: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])$/,lce=/^(([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]))$/,dce=/^(([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])$/,pce=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OV="((\\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])))",Ace=new RegExp(`^${OV}$`);function MV(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function hce(e){return new RegExp(`^${MV(e)}$`)}function LV(e){let t=`${OV}T${MV(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function gce(e,t){return!!((t==="v4"||!t)&&cce.test(e)||(t==="v6"||!t)&&lce.test(e))}function mce(e,t){if(!ice.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}function yce(e,t){return!!((t==="v4"||!t)&&uce.test(e)||(t==="v6"||!t)&&dce.test(e))}var Bo=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ue.string){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_type,expected:ue.string,received:s.parsedType}),Be}let i=new dn,r;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){let o=t.data.length>s.value,a=t.data.length<s.value;(o||a)&&(r=this._getOrReturnCtx(t,r),o?oe(r,{code:W.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&oe(r,{code:W.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")oce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"email",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")yS||(yS=new RegExp(ace,"u")),yS.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"emoji",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")nce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"uuid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")rce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"nanoid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")Xae.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"cuid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")ece.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"cuid2",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")tce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"ulid",code:W.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),oe(r,{validation:"url",code:W.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"regex",code:W.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?LV(s).test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?Ace.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?hce(s).test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{code:W.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?sce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"duration",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?gce(t.data,s.version)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"ip",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?mce(t.data,s.alg)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"jwt",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?yce(t.data,s.version)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"cidr",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?pce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"base64",code:W.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?fce.test(t.data)||(r=this._getOrReturnCtx(t,r),oe(r,{validation:"base64url",code:W.invalid_string,message:s.message}),i.dirty()):Ke.assertNever(s);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:W.invalid_string,...me.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...me.errToObj(t)})}url(t){return this._addCheck({kind:"url",...me.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...me.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...me.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...me.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...me.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...me.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...me.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...me.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...me.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...me.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...me.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...me.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...me.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...me.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...me.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...me.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...me.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...me.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...me.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...me.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...me.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...me.errToObj(n)})}nonempty(t){return this.min(1,me.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Bo.create=e=>new Bo({checks:[],typeName:Te.ZodString,coerce:e?.coerce??!1,...Me(e)});function Ece(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(e.toFixed(r).replace(".","")),o=Number.parseInt(t.toFixed(r).replace(".",""));return s%o/10**r}var cc=class e extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ue.number){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_type,expected:ue.number,received:s.parsedType}),Be}let i,r=new dn;for(let s of this._def.checks)s.kind==="int"?Ke.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{code:W.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Ece(t.data,s.value)!==0&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),oe(i,{code:W.not_finite,message:s.message}),r.dirty()):Ke.assertNever(s);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:me.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:me.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:me.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:me.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:me.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ke.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};cc.create=e=>new cc({checks:[],typeName:Te.ZodNumber,coerce:e?.coerce||!1,...Me(e)});var uc=class e extends qe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==ue.bigint)return this._getInvalidInput(t);let i,r=new dn;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),oe(i,{code:W.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ke.assertNever(s);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return oe(n,{code:W.invalid_type,expected:ue.bigint,received:n.parsedType}),Be}gte(t,n){return this.setLimit("min",t,!0,me.toString(n))}gt(t,n){return this.setLimit("min",t,!1,me.toString(n))}lte(t,n){return this.setLimit("max",t,!0,me.toString(n))}lt(t,n){return this.setLimit("max",t,!1,me.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:me.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:me.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:me.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:me.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:me.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:me.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};uc.create=e=>new uc({checks:[],typeName:Te.ZodBigInt,coerce:e?.coerce??!1,...Me(e)});var lc=class extends qe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ue.boolean){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.boolean,received:i.parsedType}),Be}return Sn(t.data)}};lc.create=e=>new lc({typeName:Te.ZodBoolean,coerce:e?.coerce||!1,...Me(e)});var dc=class e extends qe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ue.date){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_type,expected:ue.date,received:s.parsedType}),Be}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return oe(s,{code:W.invalid_date}),Be}let i=new dn,r;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),oe(r,{code:W.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ke.assertNever(s);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:me.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:me.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};dc.create=e=>new dc({checks:[],coerce:e?.coerce||!1,typeName:Te.ZodDate,...Me(e)});var fl=class extends qe{_parse(t){if(this._getType(t)!==ue.symbol){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.symbol,received:i.parsedType}),Be}return Sn(t.data)}};fl.create=e=>new fl({typeName:Te.ZodSymbol,...Me(e)});var pc=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.undefined,received:i.parsedType}),Be}return Sn(t.data)}};pc.create=e=>new pc({typeName:Te.ZodUndefined,...Me(e)});var fc=class extends qe{_parse(t){if(this._getType(t)!==ue.null){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.null,received:i.parsedType}),Be}return Sn(t.data)}};fc.create=e=>new fc({typeName:Te.ZodNull,...Me(e)});var Ro=class extends qe{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};Ro.create=e=>new Ro({typeName:Te.ZodAny,...Me(e)});var Ps=class extends qe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};Ps.create=e=>new Ps({typeName:Te.ZodUnknown,...Me(e)});var Ei=class extends qe{_parse(t){let n=this._getOrReturnCtx(t);return oe(n,{code:W.invalid_type,expected:ue.never,received:n.parsedType}),Be}};Ei.create=e=>new Ei({typeName:Te.ZodNever,...Me(e)});var Al=class extends qe{_parse(t){if(this._getType(t)!==ue.undefined){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.void,received:i.parsedType}),Be}return Sn(t.data)}};Al.create=e=>new Al({typeName:Te.ZodVoid,...Me(e)});var Us=class e extends qe{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==ue.array)return oe(n,{code:W.invalid_type,expected:ue.array,received:n.parsedType}),Be;if(r.exactLength!==null){let o=n.data.length>r.exactLength.value,a=n.data.length<r.exactLength.value;(o||a)&&(oe(n,{code:o?W.too_big:W.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(oe(n,{code:W.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(oe(n,{code:W.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>r.type._parseAsync(new Jr(n,o,n.path,a)))).then(o=>dn.mergeArray(i,o));let s=[...n.data].map((o,a)=>r.type._parseSync(new Jr(n,o,n.path,a)));return dn.mergeArray(i,s)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:me.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:me.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:me.toString(n)}})}nonempty(t){return this.min(1,t)}};Us.create=(e,t)=>new Us({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Te.ZodArray,...Me(t)});function pl(e){if(e instanceof ir){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=qr.create(pl(i))}return new ir({...e._def,shape:()=>t})}else return e instanceof Us?new Us({...e._def,type:pl(e.element)}):e instanceof qr?qr.create(pl(e.unwrap())):e instanceof Ji?Ji.create(pl(e.unwrap())):e instanceof qi?qi.create(e.items.map(t=>pl(t))):e}var ir=class e extends qe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ke.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==ue.object){let u=this._getOrReturnCtx(t);return oe(u,{code:W.invalid_type,expected:ue.object,received:u.parsedType}),Be}let{status:i,ctx:r}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ei&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||a.push(u);let c=[];for(let u of o){let d=s[u],f=r.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Jr(r,f,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Ei){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(u==="strict")a.length>0&&(oe(r,{code:W.unrecognized_keys,keys:a}),i.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let f=r.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Jr(r,f,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>dn.mergeObjectSync(i,u)):dn.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(t){return me.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:me.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Te.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Ke.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let i of Ke.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return pl(this)}partial(t){let n={};for(let i of Ke.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let i of Ke.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof qr;)s=s._def.innerType;n[i]=s}return new e({...this._def,shape:()=>n})}keyof(){return jV(Ke.objectKeys(this.shape))}};ir.create=(e,t)=>new ir({shape:()=>e,unknownKeys:"strip",catchall:Ei.create(),typeName:Te.ZodObject,...Me(t)});ir.strictCreate=(e,t)=>new ir({shape:()=>e,unknownKeys:"strict",catchall:Ei.create(),typeName:Te.ZodObject,...Me(t)});ir.lazycreate=(e,t)=>new ir({shape:e,unknownKeys:"strip",catchall:Ei.create(),typeName:Te.ZodObject,...Me(t)});var Ac=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let o=s.map(a=>new rr(a.ctx.common.issues));return oe(n,{code:W.invalid_union,unionErrors:o}),Be}if(n.common.async)return Promise.all(i.map(async s=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(r);{let s,o=[];for(let c of i){let u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(c=>new rr(c));return oe(n,{code:W.invalid_union,unionErrors:a}),Be}}get options(){return this._def.options}};Ac.create=(e,t)=>new Ac({options:e,typeName:Te.ZodUnion,...Me(t)});var Ds=e=>e instanceof gc?Ds(e.schema):e instanceof Hr?Ds(e.innerType()):e instanceof mc?[e.value]:e instanceof yc?e.options:e instanceof Ec?Ke.objectValues(e.enum):e instanceof vc?Ds(e._def.innerType):e instanceof pc?[void 0]:e instanceof fc?[null]:e instanceof qr?[void 0,...Ds(e.unwrap())]:e instanceof Ji?[null,...Ds(e.unwrap())]:e instanceof Wp||e instanceof bc?Ds(e.unwrap()):e instanceof Ic?Ds(e._def.innerType):[],Pm=class e extends qe{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.object)return oe(n,{code:W.invalid_type,expected:ue.object,received:n.parsedType}),Be;let i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(oe(n,{code:W.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Be)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let s of n){let o=Ds(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of o){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,s)}}return new e({typeName:Te.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Me(i)})}};function ES(e,t){let n=zi(e),i=zi(t);if(e===t)return{valid:!0,data:e};if(n===ue.object&&i===ue.object){let r=Ke.objectKeys(t),s=Ke.objectKeys(e).filter(a=>r.indexOf(a)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let a of s){if(a==="__proto__")continue;let c=ES(e[a],t[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===ue.array&&i===ue.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let s=0;s<e.length;s++){let o=e[s],a=t[s],c=ES(o,a);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return n===ue.date&&i===ue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var hc=class extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(s,o)=>{if(Nm(s)||Nm(o))return Be;let a=ES(s.value,o.value);return a.valid?((Dm(s)||Dm(o))&&n.dirty(),{status:n.value,value:a.data}):(oe(i,{code:W.invalid_intersection_types}),Be)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};hc.create=(e,t,n)=>new hc({left:e,right:t,typeName:Te.ZodIntersection,...Me(n)});var qi=class e extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.array)return oe(i,{code:W.invalid_type,expected:ue.array,received:i.parsedType}),Be;if(i.data.length<this._def.items.length)return oe(i,{code:W.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Be;!this._def.rest&&i.data.length>this._def.items.length&&(oe(i,{code:W.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...i.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Jr(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(s).then(o=>dn.mergeArray(n,o)):dn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};qi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qi({items:e,typeName:Te.ZodTuple,rest:null,...Me(t)})};var Um=class e extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.object)return oe(i,{code:W.invalid_type,expected:ue.object,received:i.parsedType}),Be;let r=[],s=this._def.keyType,o=this._def.valueType;for(let a in i.data)r.push({key:s._parse(new Jr(i,a,i.path,a)),value:o._parse(new Jr(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?dn.mergeObjectAsync(n,r):dn.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof qe?new e({keyType:t,valueType:n,typeName:Te.ZodRecord,...Me(i)}):new e({keyType:Bo.create(),valueType:t,typeName:Te.ZodRecord,...Me(n)})}},hl=class extends qe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.map)return oe(i,{code:W.invalid_type,expected:ue.map,received:i.parsedType}),Be;let r=this._def.keyType,s=this._def.valueType,o=[...i.data.entries()].map(([a,c],u)=>({key:r._parse(new Jr(i,a,i.path,[u,"key"])),value:s._parse(new Jr(i,c,i.path,[u,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{let a=new Map;for(let c of o){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return Be;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}};hl.create=(e,t,n)=>new hl({valueType:t,keyType:e,typeName:Te.ZodMap,...Me(n)});var gl=class e extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==ue.set)return oe(i,{code:W.invalid_type,expected:ue.set,received:i.parsedType}),Be;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(oe(i,{code:W.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(oe(i,{code:W.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let s=this._def.valueType;function o(c){let u=new Set;for(let d of c){if(d.status==="aborted")return Be;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}let a=[...i.data.values()].map((c,u)=>s._parse(new Jr(i,c,i.path,u)));return i.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(t,n){return new e({...this._def,minSize:{value:t,message:me.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:me.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};gl.create=(e,t)=>new gl({valueType:e,minSize:null,maxSize:null,typeName:Te.ZodSet,...Me(t)});var Fm=class e extends qe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.function)return oe(n,{code:W.invalid_type,expected:ue.function,received:n.parsedType}),Be;function i(a,c){return Yp({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ll(),Ns].filter(u=>!!u),issueData:{code:W.invalid_arguments,argumentsError:c}})}function r(a,c){return Yp({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ll(),Ns].filter(u=>!!u),issueData:{code:W.invalid_return_type,returnTypeError:c}})}let s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof xo){let a=this;return Sn(async function(...c){let u=new rr([]),d=await a._def.args.parseAsync(c,s).catch(g=>{throw u.addIssue(i(c,g)),u}),f=await Reflect.apply(o,this,d);return await a._def.returns._def.type.parseAsync(f,s).catch(g=>{throw u.addIssue(r(f,g)),u})})}else{let a=this;return Sn(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new rr([i(c,u.error)]);let d=Reflect.apply(o,this,u.data),f=a._def.returns.safeParse(d,s);if(!f.success)throw new rr([r(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:qi.create(t).rest(Ps.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||qi.create([]).rest(Ps.create()),returns:n||Ps.create(),typeName:Te.ZodFunction,...Me(i)})}},gc=class extends qe{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};gc.create=(e,t)=>new gc({getter:e,typeName:Te.ZodLazy,...Me(t)});var mc=class extends qe{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return oe(n,{received:n.data,code:W.invalid_literal,expected:this._def.value}),Be}return{status:"valid",value:t.data}}get value(){return this._def.value}};mc.create=(e,t)=>new mc({value:e,typeName:Te.ZodLiteral,...Me(t)});function jV(e,t){return new yc({values:e,typeName:Te.ZodEnum,...Me(t)})}var yc=class e extends qe{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return oe(n,{expected:Ke.joinValues(i),received:n.parsedType,code:W.invalid_type}),Be}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return oe(n,{received:n.data,code:W.invalid_enum_value,options:i}),Be}return Sn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};yc.create=jV;var Ec=class extends qe{_parse(t){let n=Ke.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==ue.string&&i.parsedType!==ue.number){let r=Ke.objectValues(n);return oe(i,{expected:Ke.joinValues(r),received:i.parsedType,code:W.invalid_type}),Be}if(this._cache||(this._cache=new Set(Ke.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Ke.objectValues(n);return oe(i,{received:i.data,code:W.invalid_enum_value,options:r}),Be}return Sn(t.data)}get enum(){return this._def.values}};Ec.create=(e,t)=>new Ec({values:e,typeName:Te.ZodNativeEnum,...Me(t)});var xo=class extends qe{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==ue.promise&&n.common.async===!1)return oe(n,{code:W.invalid_type,expected:ue.promise,received:n.parsedType}),Be;let i=n.parsedType===ue.promise?n.data:Promise.resolve(n.data);return Sn(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};xo.create=(e,t)=>new xo({type:e,typeName:Te.ZodPromise,...Me(t)});var Hr=class extends qe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:o=>{oe(i,o),o.fatal?n.abort():n.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let o=r.transform(i.data,s);if(i.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Be;let c=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return c.status==="aborted"?Be:c.status==="dirty"?ac(c.value):n.value==="dirty"?ac(c.value):c});{if(n.value==="aborted")return Be;let a=this._def.schema._parseSync({data:o,path:i.path,parent:i});return a.status==="aborted"?Be:a.status==="dirty"?ac(a.value):n.value==="dirty"?ac(a.value):a}}if(r.type==="refinement"){let o=a=>{let c=r.refinement(a,s);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Be:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?Be:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){let o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!So(o))return Be;let a=r.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>So(o)?Promise.resolve(r.transform(o.value,s)).then(a=>({status:n.value,value:a})):Be);Ke.assertNever(r)}};Hr.create=(e,t,n)=>new Hr({schema:e,typeName:Te.ZodEffects,effect:t,...Me(n)});Hr.createWithPreprocess=(e,t,n)=>new Hr({schema:t,effect:{type:"preprocess",transform:e},typeName:Te.ZodEffects,...Me(n)});var qr=class extends qe{_parse(t){return this._getType(t)===ue.undefined?Sn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};qr.create=(e,t)=>new qr({innerType:e,typeName:Te.ZodOptional,...Me(t)});var Ji=class extends qe{_parse(t){return this._getType(t)===ue.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Ji.create=(e,t)=>new Ji({innerType:e,typeName:Te.ZodNullable,...Me(t)});var vc=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===ue.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};vc.create=(e,t)=>new vc({innerType:e,typeName:Te.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Me(t)});var Ic=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return dl(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new rr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Ic.create=(e,t)=>new Ic({innerType:e,typeName:Te.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Me(t)});var ml=class extends qe{_parse(t){if(this._getType(t)!==ue.nan){let i=this._getOrReturnCtx(t);return oe(i,{code:W.invalid_type,expected:ue.nan,received:i.parsedType}),Be}return{status:"valid",value:t.data}}};ml.create=e=>new ml({typeName:Te.ZodNaN,...Me(e)});var vce=Symbol("zod_brand"),Wp=class extends qe{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Zp=class e extends qe{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Be:s.status==="dirty"?(n.dirty(),ac(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Be:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:Te.ZodPipeline})}},bc=class extends qe{_parse(t){let n=this._def.innerType._parse(t),i=r=>(So(r)&&(r.value=Object.freeze(r.value)),r);return dl(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};bc.create=(e,t)=>new bc({innerType:e,typeName:Te.ZodReadonly,...Me(t)});function FV(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}function VV(e,t={},n){return e?Ro.create().superRefine((i,r)=>{let s=e(i);if(s instanceof Promise)return s.then(o=>{if(!o){let a=FV(t,i),c=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:c})}});if(!s){let o=FV(t,i),a=o.fatal??n??!0;r.addIssue({code:"custom",...o,fatal:a})}}):Ro.create()}var Ice={object:ir.lazycreate},Te;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Te||(Te={}));var bce=(e,t={message:`Input not instance of ${e.name}`})=>VV(n=>n instanceof e,t),GV=Bo.create,zV=cc.create,wce=ml.create,Cce=uc.create,qV=lc.create,kce=dc.create,Sce=fl.create,Bce=pc.create,Rce=fc.create,xce=Ro.create,Qce=Ps.create,$ce=Ei.create,Tce=Al.create,_ce=Us.create,Nce=ir.create,Dce=ir.strictCreate,Pce=Ac.create,Uce=Pm.create,Fce=hc.create,Oce=qi.create,Mce=Um.create,Lce=hl.create,jce=gl.create,Vce=Fm.create,Gce=gc.create,zce=mc.create,qce=yc.create,Jce=Ec.create,Hce=xo.create,Yce=Hr.create,Wce=qr.create,Zce=Ji.create,Kce=Hr.createWithPreprocess,Xce=Zp.create,eue=()=>GV().optional(),tue=()=>zV().optional(),nue=()=>qV().optional(),rue={string:(e=>Bo.create({...e,coerce:!0})),number:(e=>cc.create({...e,coerce:!0})),boolean:(e=>lc.create({...e,coerce:!0})),bigint:(e=>uc.create({...e,coerce:!0})),date:(e=>dc.create({...e,coerce:!0}))};var iue=Be;var yl=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(yl||{}),Qo=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(Qo||{}),Kp=e=>e==="ready"||e==="needs_inputs",Om=300,Nt=p.string().trim().min(1),sue=p.object({action:p.enum(["start","run","wait"]),text:Nt,source:p.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Nt.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),oue=/^[A-Za-z_][A-Za-z0-9_]*$/,Yr=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,El=(o=>(o.VersionEndpoint="version_endpoint",o.DeployWorkflow="deploy_workflow",o.KubernetesLabels="kubernetes_labels",o.Command="command",o.Api="api",o.NotTracked="not_tracked",o))(El||{}),sr="shared",aue=Nt.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),vl=p.object({address:aue,readyWhen:Nt.nullable(),credentials:p.array(p.string().regex(Yr)).max(50),revisionSources:p.array(p.object({method:p.nativeEnum(El),detail:Nt.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:p.array(Nt).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),vS={steps:p.array(sue).max(20).optional().describe("how it starts, in order"),kind:p.enum(["web_app","service","database","external_service"]).optional(),from:p.object({file:Nt,service:Nt.nullable()}).strict().optional(),credentials:p.array(p.string().max(100).regex(oue)).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")},Mm=p.object({name:Nt,repository:Nt.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:p.boolean(),...vS,deployed:Nt.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')}),cue=p.object({name:p.string().regex(Yr).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:p.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:p.boolean().describe("false only when the SUT starts without it, with less working"),how:Nt.max(Om).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),uue=p.object({component:Nt,problem:Nt,evidence:Nt.describe("the exact command and output that shows it"),fix:Nt.describe("what the user must provide, and where")}),lue=p.object({framework:Nt,file:Nt.describe("the test file run, relative to its repository root"),result:p.enum(["pass","fail","error"])}),due=p.object({input:Nt.describe("the part of the user's SUT input, as given"),reason:Nt}),JV=p.object({schemaVersion:p.literal(1),status:p.nativeEnum(Qo).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:p.array(Mm),suites:p.array(lue).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:p.array(Nt).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:p.array(p.object({input:Nt.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Nt.describe("what the recipe did with it")})).optional(),inputsNotUsed:p.array(due).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:p.array(uue).describe("required (non-empty) when status is blocked"),inputs:p.array(cue).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),environment:vl.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 Xp=64*1024,ef=512*1024,IS=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Wr=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Wr||{}),vi=p.string().trim().min(1),HV=p.object({url:p.string().optional().describe("the URL probed, if the check is an HTTP request"),command:p.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:p.record(p.string()).optional(),status:p.union([p.number(),p.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:vi.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),bS=p.array(p.object({component:vi.describe("a shared component listed above"),url:vi.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:vi.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"),pue=p.object({name:vi.describe("the credential's environment variable name, as listed above; never its value"),component:vi.describe("the component that refused it"),status:p.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:vi.describe("the request or command you tested it with and what came back, never the value")}),tf=p.object({schemaVersion:p.literal(1),baseUrls:p.record(p.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:HV.optional(),teardown:vi.describe("command that tears the SUT down"),dependencies:p.record(p.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:p.nativeEnum(Wr).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:p.array(p.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:p.object({command:vi,output:vi}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:p.array(p.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:p.boolean(),startedAt:vi.describe("ISO timestamp"),revisions:bS.optional(),credentialsRefused:p.array(pue).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:p.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});function wS(e){let t=[],n=r=>!!r&&typeof r=="object"&&!Array.isArray(r);return e.outcome!=="change-broke-bringup"&&e.outcome!=="bringup-failed"?(!n(e.baseUrls)||Object.keys(e.baseUrls).length===0?t.push("baseUrls must be a non-empty object of service \u2192 url"):Object.values(e.baseUrls).every(r=>typeof r=="string"&&r.trim())||t.push("every baseUrls value must be a non-empty url string"),n(e.health)?!(typeof e.health.url=="string"&&e.health.url.trim())&&!(typeof e.health.command=="string"&&e.health.command.trim())&&t.push("health must record a url or a command (what you actually ran)"):t.push("health must be an object"),(!n(e.dependencies)||Object.keys(e.dependencies).length===0)&&t.push("dependencies must be a non-empty object of name \u2192 boolean (real vs mocked) when the SUT came up \u2014 account for every backing service so a mocked one can't be hidden behind a green run")):(n(e.bringupError)||t.push(`outcome "${String(e.outcome)}" requires bringupError { command, output } \u2014 the exact failing bring-up command and what it printed`),e.outcome==="change-broke-bringup"&&!(Array.isArray(e.suspectFiles)&&e.suspectFiles.length>0&&e.suspectFiles.every(r=>typeof r=="string"&&r.trim()))&&t.push("change-broke-bringup requires non-empty suspectFiles[] \u2014 the changed file(s) the failure points at; if you cannot point at a file this PR changed, the outcome is bringup-failed (environment/harness), not the PR's fault")),e.outcome==="recipe-drift"&&!(Array.isArray(e.recipeFixes)&&e.recipeFixes.length>0)&&t.push("recipe-drift outcome requires a non-empty recipeFixes[] describing what was corrected"),t}var pn=p.string().trim().min(1),Lm=pn,CS=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(CS||{}),jm=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],kS=p.object({schemaVersion:p.literal(1),type:p.nativeEnum(CS).optional(),repository:Lm.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:p.enum(["ready","blocked"]),environment:vl.optional(),components:p.array(p.object({name:pn,repository:pn.describe(`owner/repo, or "${sr}" for a customer-deployed component no repository builds`),healthy:p.boolean(),url:p.string().min(1).nullable(),...vS,credentials:p.array(p.string().regex(Yr)).max(50).optional(),deployed:pn.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:p.array(p.object({framework:pn,file:pn,result:p.enum(["pass","fail","error"])}).strict()),inputsUsed:p.array(pn),inputsUsedHow:p.array(p.object({input:pn,how:pn}).strict()).optional(),inputsNotUsed:p.array(p.object({input:pn,reason:pn}).strict()),blockers:p.array(p.object({component:pn,problem:pn,evidence:pn,fix:pn}).strict()),replay:p.object({outcome:pn,durationSeconds:p.number().nonnegative().nullable()}).strict().nullable(),files:p.array(p.object({path:pn,content:p.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,s)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:p.ZodIssueCode.custom,path:["inputsUsedHow",s,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,s)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:p.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,s)=>{r.components.forEach((o,a)=>{i.has(o)||t.addIssue({code:p.ZodIssueCode.custom,path:["environment","revisionSources",s,"components",a],message:"not one of components"})})}),e.components.forEach((r,s)=>{r.deployed!==void 0!==n&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===sr&&!n&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"repository"],message:`only a customer_deployed component is ${sr}`})}),n&&(e.components.forEach((r,s)=>{e.components.findIndex(o=>o.name===r.name)!==s&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",s,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:p.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,s)=>{jm.includes(r.path)&&t.addIssue({code:p.ZodIssueCode.custom,path:["files",s,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(s=>s.components));e.components.forEach((s,o)=>{s.repository!==sr&&!r.has(s.name)&&t.addIssue({code:p.ZodIssueCode.custom,path:["components",o,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var mxe=["clean","recipe-drift"];function nf(e){let t=YV.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}function SS(e){return[...new Set([...e.components.flatMap(t=>t.credentials??[]),...e.environment?.credentials??[]])].filter(t=>Yr.test(t))}var BS=[".skyramp/sut",".skyramp/workspace.yml"];var ZV=256*1024*1024,fue=3e4;function RS(e,t,n=fue){let i=(0,WV.spawnSync)("git",[...Gi,...t],{env:St(),cwd:e,encoding:"utf-8",timeout:n,maxBuffer:ZV});return i.status===0?i.stdout.trimEnd():void 0}var Cxe=["--",":/",...BS.map(e=>`:(exclude)${e}`)],KV="--literal-pathspecs";function xS(e,t){return!!RS(e,[KV,"status","--porcelain","--",t])}function QS(e,t){return/ blob /.test(RS(e,[KV,"ls-tree","HEAD","--",t])??"")}bn();bn();var wc=(s=>(s.NotFound="not_found",s.NoAccess="no_access",s.Unavailable="unavailable",s.AccessLost="access_lost",s.CannotOpen="cannot_open",s))(wc||{});var $S=e=>`${e.source}:${e.site??""}:${e.key}`;var rf=/^pasted-[0-9a-f]{16}$/,$o=/^file-[0-9a-f]{16}$/,sf=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(sf||{}),of=e=>e.trim().toUpperCase(),XV=(e,t)=>{let n=e.trim();return rf.test(n.toLowerCase())?"Pasted text":$o.test(n.toLowerCase())?t?.get(of(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()};var Vm=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(Vm||{}),To=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(To||{}),Cc=(C=>(C.RelatedChangeConflict="related_change_conflict",C.ReferenceOutsideTarget="reference_outside_target",C.SourceAccessLost="source_access_lost",C.ConfigurationIncomplete="configuration_incomplete",C.CredentialUnavailable="credential_unavailable",C.WorkflowBindingUnverified="workflow_binding_unverified",C.WorkflowRefUnprotected="workflow_ref_unprotected",C.BedrockWorkflowRequired="bedrock_workflow_required",C.DeploymentReview="deployment_review",C.SutRevisionMismatch="sut_revision_mismatch",C.IsolationUnavailable="isolation_unavailable",C.EvidenceInsufficient="evidence_insufficient",C.ConfigurationUnresolved="configuration_unresolved",C.ModelProviderDenied="model_provider_denied",C.ModelProviderUnavailable="model_provider_unavailable",C.RunnerProviderNotReady="runner_provider_not_ready",C.MergeConflict="merge_conflict",C))(Cc||{}),_o=(s=>(s.CiCheck="ci_check",s.TestReport="test_report",s.StaticAnalysis="static_analysis",s.CodeReview="code_review",s.Other="other",s))(_o||{}),af=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(af||{}),cf=(a=>(a.AuthToken="auth_token",a.Secret="secret",a.DataConnection="data_connection",a.AppNotStarted="app_not_started",a.Login="login",a.ExternalDependency="external_dependency",a.RecordingReplay="recording_replay",a))(cf||{});var Gm=(n=>(n.Probe="probe",n.Agent="agent",n))(Gm||{}),zm=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(zm||{}),qm=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(qm||{});var en=e=>e.slice(0,12);var hue=["generate-unit","native-run"],xxe=["preflight","plan","write",...hue,"report","deliver"];var TS=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(TS||{}),gue=Object.values(TS);var No=(o=>(o.Place="place",o.Update="update",o.Regenerate="regenerate",o.Delete="delete",o.Verify="verify",o.None="none",o))(No||{}),Kr=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(Kr||{}),Zr=p.string().trim().min(1),uf=p.array(p.string().url().max(2048).regex(/^https?:\/\//i)).max(50),eG=p.object({case:Zr.describe("a covers id \u2014 the recommend case this test realizes"),status:p.nativeEnum(Kr),runtimeTargets:uf.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),fromJourney:p.boolean().optional()}),tG=p.object({exit:p.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:p.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:p.array(eG).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),nG=p.object({from:p.string().optional().describe("staged path \u2014 required for placements"),file:Zr.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Zr.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:p.nativeEnum(No),covers:p.array(p.string()).optional().describe("recommend ids a placed test covers"),repro:p.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:p.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:p.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Zr.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Zr.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:tG,assertionCount:p.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:p.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),rG=(n=>(n.Junit="junit",n.Converter="converter",n))(rG||{}),mue=Zr.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),yue=p.object({results:Zr.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:p.nativeEnum(rG),run:Zr.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:p.array(Zr).min(1).describe("the items[].file paths this run covered"),cases:p.array(p.object({test:Zr.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:Zr.describe("the covers id it realizes"),file:mue})).describe("map each reported test name to the case it covers")}),Eue=p.object({suites:p.array(yue).min(1)}),_S=p.object({schemaVersion:p.literal(1),items:p.array(nG),runnerResults:Eue.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:p.array(p.string()).describe("existing tests assessed and deliberately left untouched"),summary:Zr.describe("one paragraph")});var df=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(df||{}),Km=(s=>(s.Trigger="TRIGGER",s.Baseline="BASELINE",s.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",s.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",s.ManualOverride="MANUAL_OVERRIDE",s))(Km||{}),pf=(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))(pf||{}),vue=["sut_setup"],Iue=["sut_setup","schedule","revision_read"];var Xm=(t=>(t.PullRequest="pull_request",t))(Xm||{}),DS=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(DS||{}),iG=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var ey=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s.RevisionsUploaded="revisions_uploaded",s))(ey||{}),mG=(n=>(n.Running="running",n.Ended="ended",n))(mG||{}),ty=(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))(ty||{}),PS=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(PS||{}),ff=(n=>(n.Started="started",n.Finished="finished",n))(ff||{}),US=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(US||{});var FS=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(FS||{});var ny=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(ny||{}),Af=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(Af||{}),lf=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(lf||{});var hf=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(hf||{}),Xr=p.string().regex(/^[1-9][0-9]{0,18}$/),Ii=p.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),wl=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,Bn=p.string().regex(wl),Ln=p.string().regex(/^[0-9a-f]{64}$/),Zm=p.object({id:Bn,revision:Xr}).strict(),ry={provider:p.literal("github"),providerAccountId:Xr,providerRepositoryId:Xr},iy={provider:p.literal("azure-devops"),providerAccountId:Bn,providerRepositoryId:Bn},Rr=p.discriminatedUnion("provider",[p.object(ry).strict(),p.object(iy).strict()]),OS=p.discriminatedUnion("provider",[p.object(ry).passthrough(),p.object(iy).passthrough()]),kc=e=>`${e.provider}:${e.providerRepositoryId}`,sG={namespace:p.string().min(1),name:p.string().min(1)},yG=p.discriminatedUnion("provider",[p.object({...ry,...sG}).strict(),p.object({...iy,...sG}).strict()]),oG=p.object({ref:p.string().min(1),revision:Ii}).strict(),bue=p.object({kind:p.nativeEnum(DS),number:Xr.optional(),ref:p.string().min(1),revision:Ii,reason:p.nativeEnum(Km)}).strict(),wue=p.object({repository:yG,revision:Ii,ref:p.string().nullable(),reason:p.nativeEnum(Km),change:p.object({kind:p.nativeEnum(Xm),number:Xr,base:oG.optional()}).strict().nullable(),compareWith:oG.optional(),merge:p.array(bue).min(2).optional()}).strict();function Cue(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,i=new Set;for(let[s,o]of t.entries()){if(o.kind==="pull_request"!=(o.number!==void 0))return{path:["merge",s,"number"],message:"a pull request names its number, and a branch none"};if(!iG.includes(o.reason))return{path:["merge",s,"reason"],message:`${o.reason} does not select a merged revision`};if(o.kind==="branch"&&o.reason!=="MANUAL_OVERRIDE")return{path:["merge",s,"reason"],message:"only a person chooses a branch to merge"};if(o.ref===e.ref)return{path:["merge",s,"ref"],message:"the baseline branch is what the source merges onto"};if(o.number!==void 0&&n.has(o.number)||i.has(o.ref))return{path:["merge",s],message:"names a revision the source already merges"};o.number!==void 0&&n.add(o.number),i.add(o.ref)}let r=iG.find(s=>t.some(o=>o.reason===s));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}function kue(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(u=>u!=null).length>1)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let o=new Set(e.sources.map(u=>kc(u.repository))),a=new Set(r.map(u=>kc(u.repository)));return a.size===r.length&&a.size===o.size&&[...a].every(u=>o.has(u))?null:"names every source of the snapshot, once"}var EG=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,vG=/^[1-9][0-9]{0,18}$/,aG=new RegExp(`${EG.source}|${vG.source}`),cG=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,Sue=p.union([p.object({source:p.literal("jira"),site:p.string().regex(cG),key:p.string().regex(EG),updated:p.string().datetime(),contentHash:Ln}).strict(),p.object({source:p.literal("confluence"),site:p.string().regex(cG),key:p.string().regex(vG),version:p.number().int().positive(),contentHash:Ln}).strict(),p.object({source:p.literal("other"),key:p.string().regex(rf),contentHash:Ln}).strict(),p.object({source:p.literal("other"),key:p.string().regex($o),contentHash:Ln,fileName:p.string().min(1).max(255),mediaType:p.nativeEnum(sf)}).strict()]),uG=p.union([p.literal("jira"),p.literal("confluence")]),Bue=p.object({schemaVersion:p.literal(1),items:p.array(p.union([p.object({source:uG,site:p.string(),key:p.string().regex(aG),state:p.literal("read"),text:p.string(),version:p.string().min(1),contentMatches:p.boolean()}).strict(),p.object({source:uG,site:p.string(),key:p.string().regex(aG),state:p.literal("not_read"),reason:p.nativeEnum(wc)}).strict(),p.object({source:p.literal("other"),key:p.string().regex(rf),state:p.literal("read"),text:p.string(),version:p.string().min(1),contentMatches:p.boolean()}).strict(),p.object({source:p.literal("other"),key:p.string().regex(rf),state:p.literal("not_read"),reason:p.nativeEnum(wc)}).strict(),p.object({source:p.literal("other"),key:p.string().regex($o),state:p.literal("read"),version:Ln,fileName:p.string().min(1).max(255),mediaType:p.nativeEnum(sf)}).strict(),p.object({source:p.literal("other"),key:p.string().regex($o),state:p.literal("not_read"),reason:p.nativeEnum(wc)}).strict()])),instructions:p.array(p.string()).optional()}).strict(),Rue=p.object({resultId:p.string().min(1),repository:p.string().min(1),testType:p.string().min(1),path:p.string(),finding:p.string().min(1)}).strict(),xue=p.object({schemaVersion:p.literal(1),runId:Bn,skyrampOrgId:Bn,target:Zm,policy:Zm.nullable(),trigger:p.object({kind:p.nativeEnum(pf),requestedAt:p.string().datetime()}).strict(),configuration:p.object({captureId:Bn,revision:Xr.nullable(),hash:Ln}).strict(),baseline:p.object({confirmedRunId:Bn.nullable(),initialBaselineId:Bn.optional(),comparisonBaselineId:Bn.optional(),knownFailures:p.array(Rue).optional(),sources:p.array(p.object({repository:Rr,revision:Ii}).strict()).optional()}).strict().optional(),sources:p.array(wue).min(1).max(1e3),execution:p.object({provider:p.nativeEnum(df),repository:yG,workflowPath:p.string(),ref:p.string()}).strict(),credentials:p.array(p.object({name:p.string(),purpose:p.nativeEnum(yl),required:p.boolean()}).strict()),requirements:p.array(Sue).min(1).optional(),instructions:p.object({contentHash:Ln}).strict().optional(),deployedRevisions:p.array(p.object({repository:Rr,revision:Ii}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((c,u)=>{let d="fileName"in c?"file":"pasted";c.source==="other"&&c.key!==`${d}-${c.contentHash.slice(0,16)}`&&t.addIssue({code:p.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",u,"key"]});let f=$S({source:c.source,key:c.key});n.has(f)&&t.addIssue({code:p.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",u,"key"]}),n.add(f)});let i=e.trigger.kind,r=vue.includes(i);r!==(e.policy===null)&&t.addIssue({code:p.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:p.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let s=kue(e);s&&t.addIssue({code:p.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:s}),Iue.includes(i)&&e.sources.forEach((c,u)=>{c.reason!=="BASELINE"&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:p.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let o=new Set(e.sources.map(c=>kc(c.repository))),a=new Set;(e.deployedRevisions??[]).forEach((c,u)=>{let d=kc(c.repository);o.has(d)?a.has(d)&&t.addIssue({code:p.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"repository appears twice"}):t.addIssue({code:p.ZodIssueCode.custom,path:["deployedRevisions",u,"repository"],message:"names a repository outside the snapshot"}),a.add(d)}),e.sources.forEach((c,u)=>{c.compareWith&&(c.reason!=="MANUAL_OVERRIDE"||c.change)&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(c.change?.base||c.compareWith||c.merge)&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let d=Cue(c);d&&t.addIssue({code:p.ZodIssueCode.custom,path:["sources",u,...d.path],message:d.message})})});var MS=(n=>(n.Person="person",n.Policy="policy",n))(MS||{}),Que=p.object({kind:p.nativeEnum(MS),name:p.string().min(1).max(256)}).strict(),$ue=p.object({mcp:p.discriminatedUnion("source",[p.object({source:p.literal("npm"),version:p.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),p.object({source:p.literal("github"),ref:p.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:p.object({region:p.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:p.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Lxe=p.object({schemaVersion:p.literal(1),attempt:p.object({id:Bn,number:p.number().int().positive(),deadlineAt:p.string().datetime()}).strict(),manifest:xue,manifestHash:Ln,entitlements:p.array(p.string()).optional(),runToken:p.string().min(1).optional(),requestedBy:Que.nullable().optional(),writeAllowed:p.boolean().optional(),claudeCodeVersion:p.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:p.array(p.object({repository:Rr,revision:Ii}).strict()).optional(),statedRevisions:p.array(p.object({repository:Rr,revision:Ii}).strict()).optional(),runSettings:$ue.optional()}).strict(),lG={providerRunAttempt:p.number().int().positive(),workflowRef:p.string().min(1)},Tue=p.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),jxe=p.object({schemaVersion:p.literal(1),runId:Bn,execution:p.discriminatedUnion("provider",[p.object({...lG,provider:p.literal("github"),repository:p.object(ry).strict(),providerRunId:Xr}).strict(),p.object({...lG,provider:p.literal("azure-devops"),repository:p.object(iy).strict(),providerRunId:Tue}).strict()]),requester:p.literal(!0).optional(),writeCheck:p.literal(!0).optional(),claudeCodePin:p.literal(!0).optional(),deployedPins:p.literal(!0).optional(),statedPins:p.literal(!0).optional(),runSettings:p.literal(!0).optional()}).strict(),dG=p.object({repository:Rr,number:Xr,commitSha:Ii.optional()}).strict(),Hm=p.array(p.object({repository:Rr,reason:p.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),_ue=p.discriminatedUnion("status",[p.object({status:p.literal("none"),noTests:Hm}).strict(),p.object({status:p.literal("delivered"),noTests:Hm,pullRequests:p.array(dG).min(1)}).strict(),p.object({status:p.literal("partial"),noTests:Hm,pullRequests:p.array(dG).min(1),failures:p.array(p.object({repository:Rr,message:p.string()}).strict()).min(1)}).strict(),p.object({status:p.literal("failed"),message:p.string(),noTests:Hm}).strict()]),LS=1024*1024,IG=16*1024*1024,Ym=e=>p.array(p.object({[e]:p.string()}).strict()).optional(),Nue=p.object({language:p.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:p.string(),validation:p.object({rationale:p.string(),gaps:p.array(p.string())}).strict().optional(),changes:p.array(p.object({id:p.string(),text:p.string()}).strict()).optional(),issuesFound:Ym("description"),newTestsCreated:Ym("description"),testResults:Ym("details"),caveats:Ym("text")}).strict(),Due=p.object({blockedPreflight:p.object({file:p.string().min(1),repository:p.string().min(1).optional(),reason:p.string().min(1).max(300),evidence:p.string().min(1).max(400)}).strict().optional(),sufficiency:p.nativeEnum(To),rationale:p.string().min(1),gaps:p.array(p.string().min(1)),acceptedEvidence:p.array(p.object({kind:p.nativeEnum(_o),repository:p.string().min(1),revision:Ii,reference:p.string().min(1),summary:p.string().min(1)}).strict()),actionRequired:p.array(p.nativeEnum(Cc))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:p.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Wm=500,bG=2048,wG=1e3,Pue=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,pG=e=>e.length>0&&e.length<=64&&e===e.trim()&&!Pue.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),CG=e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&pG(n)&&pG(i)},Uue=p.object({testResults:p.array(p.object({resultId:p.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:p.string().refine(CG,"Invalid"),testType:p.string(),runtimeTargets:uf.optional(),endpoint:p.string(),status:p.enum(["Pass","Fail","Skipped"]),details:p.string(),fileName:p.string().optional(),testId:p.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:p.object({kind:p.nativeEnum(af),family:p.nativeEnum(cf).optional()}).strict().optional(),origin:p.nativeEnum(Vm).optional()}).strict()),validation:Due,changes:p.array(p.object({id:p.string().min(1).max(512),text:p.string().max(16384),source:p.string().max(bG),testedBy:p.array(p.string().min(1).max(1024)).max(Wm),writtenBy:p.array(p.string().min(1).max(1024)).max(Wm),maintainedBy:p.array(p.string().min(1).max(1024)).max(Wm)}).strict()).max(wG).optional(),traceVersion:p.literal(1),display:Nue.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let s of["issuesFound","newTestsCreated","testResults","caveats"]){let o=n?.[s];o&&o.length!==(Array.isArray(i[s])?i[s].length:0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["display",s],message:`has not one row per ${s} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((s,o)=>{let a=s.failureCause;a&&s.status==="Pass"&&t.addIssue({code:p.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"a passing result has no failure cause"}),a&&a.kind==="environment"!=(a.family!==void 0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"an environment cause names its family, and no other cause does"});let c=["testResults",o,"resultId"],u=s.resultId.slice(`${s.repository}:${s.testType}:`.length);(!s.resultId.startsWith(`${s.repository}:${s.testType}:`)||u===""||u.startsWith("/")||u.startsWith("#"))&&t.addIssue({code:p.ZodIssueCode.custom,path:c,message:"is not repository:testType:path for this result"}),r.has(s.resultId)&&t.addIssue({code:p.ZodIssueCode.custom,path:c,message:"stable identity repeated"}),r.add(s.resultId)})});var kG=50,fG=p.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),SG=p.discriminatedUnion("kind",[p.object({kind:p.literal("branch_pushed"),repository:Rr,branch:fG,commit:Ii}).strict(),p.object({kind:p.enum(["pull_request_opened","pull_request_edited"]),repository:Rr,number:Xr,branch:fG}).strict()]),Fue=p.object({schemaVersion:p.literal(1),run:p.object({runId:Bn,attemptNumber:p.number().int().positive(),manifestHash:Ln}).strict(),target:Zm,policy:Zm,provenance:p.object({sources:p.array(p.object({repository:Rr,revision:Ii}).strict()),firstQualification:p.literal(!0).optional()}).strict(),delivery:p.object({generatedTests:_ue}).strict(),producer:p.object({testbot:p.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:p.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:Uue,githubWrites:p.array(SG).max(kG).optional()}).strict(),jS=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(jS||{}),VS=200,Oue=p.object({cause:p.nativeEnum(jS),credential:p.string().regex(Yr).optional(),reason:p.string().trim().min(1).max(VS).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),Mue=p.object({name:p.string().regex(Yr),purpose:p.enum(["sut_access","other"]),required:p.boolean(),how:p.string().trim().min(1).max(Om)}).strict(),Vxe=Fue.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:kS,check:Oue.optional(),inputs:p.array(Mue).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=(s,o)=>t.addIssue({code:p.ZodIssueCode.custom,path:["recipe",...s],message:o});e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((s,o)=>{nf(s.path)||n(["files",o,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),i.has(s.path)&&n(["files",o,"path"],"file repeated"),i.add(s.path),IS.test(s.content)&&n(["files",o,"content"],"is not text");let a=Buffer.byteLength(s.content,"utf8");r+=a,a>Xp&&n(["files",o,"content"],`larger than ${Xp} bytes`)}),r>ef&&n(["files"],`recipe text over ${ef} bytes in total`)}),Gxe=p.object({components:p.array(p.object({name:p.string().min(1),repository:p.string().refine(CG,"Invalid"),observedRevision:p.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:p.nativeEnum(Gm),evidence:p.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var Lue=p.object({schemaVersion:p.literal(1),stage:p.nativeEnum(PS),event:p.nativeEnum(ff),status:p.nativeEnum(US).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Cl=100,GS=5e3,Do=2e3,NS=100,zS=/^[A-Za-z0-9_-]{1,64}$/,BG=20,RG=200,xG=100,QG=100,jue=200,AG="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Vue=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${AG}/${AG})$`),$G=500,TG=50,_G=10,NG=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,kl=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,Br=e=>p.string().max(e).refine(t=>t.trim().length>0&&!kl.test(t),"blank, or not text"),Hi={sequence:p.number().int().min(1).max(GS),at:p.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},DG=p.object({...Hi,kind:p.literal("reply"),to:p.string().uuid(),outcome:p.nativeEnum(ny),accepted:p.boolean(),text:Br(Do),note:p.object({source:p.enum(["target","environment"]),quote:Br(Do)}).strict().optional(),kept:Br(Do).optional()}).strict();function PG(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:p.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:p.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:p.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}var UG=p.discriminatedUnion("kind",[p.object({...Hi,kind:p.literal("log"),phase:p.nativeEnum(Af),text:Br(Do)}).strict(),p.object({...Hi,kind:p.literal("component"),name:Br(NS),repository:Br(jue).refine(e=>Vue.test(e)||e===sr,"not owner/name"),file:Br($G).nullable(),status:p.nativeEnum(hf),version:Br(QG).optional()}).strict(),DG,p.object({...Hi,kind:p.literal("question"),id:p.string().regex(zS),type:p.nativeEnum(FS),text:Br(Do),component:Br(NS).nullable(),choices:p.array(Br(RG)).max(BG),placeholder:Br(xG).optional()}).strict(),p.object({...Hi,kind:p.literal("delivered"),ids:p.array(p.string().uuid()).max(Cl)}).strict(),p.object({...Hi,kind:p.literal("credentials"),names:p.array(p.string().regex(Yr)).min(1).max(TG),logins:p.array(p.object({key:p.string().regex(NG),usernameVariable:p.string().regex(Yr),passwordVariable:p.string().regex(Yr)}).strict()).min(1).max(_G).optional()}).strict()]).superRefine((e,t)=>{if(PG(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>hS(i.key));new Set(n).size!==n.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let s of["usernameVariable","passwordVariable"])e.names.includes(i[s])||t.addIssue({code:p.ZodIssueCode.custom,path:["logins",r,s],message:"not one of the names"})})}e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:p.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:p.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Gue=p.object({schemaVersion:p.literal(1),events:p.array(UG).max(Cl)}).strict(),FG=p.discriminatedUnion("kind",[p.object({...Hi,kind:p.literal("log"),stage:p.nativeEnum(lf),text:Br(Do)}).strict(),DG,p.object({...Hi,kind:p.literal("delivered"),ids:p.array(p.string().uuid()).max(Cl)}).strict(),p.object({...Hi,kind:p.literal("stage"),stage:p.nativeEnum(lf),event:p.nativeEnum(ff)}).strict(),p.object({...Hi,kind:p.literal("test"),resultId:p.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:p.enum(["Pass","Fail","Skipped"]),details:p.string().max(Do).refine(e=>!kl.test(e),"not text")}).strict()]).superRefine(PG),zue=p.object({schemaVersion:p.literal(1),events:p.array(FG).max(Cl)}).strict(),hG={id:p.string().uuid(),text:p.string(),by:p.string().nullable(),at:p.string(),replied:p.literal(!0).optional()},OG=p.discriminatedUnion("kind",[p.object({...hG,kind:p.literal("instruction"),question:p.null()}),p.object({...hG,kind:p.literal("answer"),question:p.string().regex(zS)})]),MG=p.string().regex(/^[A-Za-z0-9+/]{43}=$/),que=p.object({id:p.string().uuid(),revision:p.string(),by:p.string().nullable(),at:p.string(),target:p.string(),own:p.object({source:p.enum(["policy","test_environment"]),text:p.string()}).nullable()}),Jue=p.object({schemaVersion:p.literal(1),leftOut:p.array(p.string()),messages:p.array(OG).optional(),stop:p.object({key:MG}).optional(),notes:que.optional()}),Hue=p.object({schemaVersion:p.literal(1),messages:p.array(OG).optional()});var LG=500*1024*1024,jG=p.object({id:Xr,name:p.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Xr,expiresAt:p.string().datetime()}).strict(),Yue=p.object({schemaVersion:p.literal(1),artifact:jG,sessionId:Bn,contentHash:Ln,bytes:p.number().int().min(1).max(LG)}).strict(),Wue=p.object({schemaVersion:p.literal(1),checkpoint:p.object({artifact:jG,repository:p.object({namespace:p.string().min(1),name:p.string().min(1)}).strict(),sessionId:Bn,contentHash:Ln,key:MG}).strict().nullable()}).strict(),Zue=200,bl=100,qS=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(qS||{}),Kue=p.object({kind:p.nativeEnum(qS),setup:p.object({runId:Bn,endedAt:p.string().nullable(),outcome:p.string().nullable()}).strict(),components:p.array(p.object({name:p.string().min(1),repository:p.string().min(1),status:p.nativeEnum(hf)}).strict()).max(bl),credentials:p.array(p.string().min(1)).max(bl),answers:p.array(p.object({question:p.string(),answer:p.string().nullable()}).strict()).max(bl),instructions:p.array(p.object({text:p.string(),reply:p.string().nullable()}).strict()).max(bl),log:p.array(p.object({phase:p.nativeEnum(Af),text:p.string()}).strict()).max(Zue),recipe:p.object({files:p.array(p.object({path:p.string().min(1),content:p.string()}).strict()).max(bl),blockers:p.array(p.object({component:p.string(),problem:p.string(),evidence:p.string(),fix:p.string()}).strict()).max(bl)}).strict().optional()}).strict(),Xue=p.object({schemaVersion:p.literal(1),context:Kue.nullable()}).strict(),ele=p.object({schemaVersion:p.literal(1),configuration:p.object({captureId:Bn,revision:Xr.nullable(),hash:Ln}).strict(),capture:p.object({schemaVersion:p.literal(1),settings:p.object({target:p.object({environment:p.unknown()}).passthrough(),timeoutMinutes:p.number().int().positive(),answerWaitMinutes:p.number().int().positive().optional(),testEnvironment:p.object({name:p.string().min(1),address:p.string().min(1).optional(),readyWhen:p.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:p.object({}).passthrough(),hash:Ln}).strict()}).strict(),tle=vl.extend({version:p.number().int().positive(),components:p.array(p.object({name:p.string().min(1),repository:p.string().min(1)}).strict()),contentHash:Ln.optional(),files:p.array(p.object({path:p.string().refine(e=>nf(e)&&!jm.includes(e),"not a file of a customer_deployed plan"),content:p.string()}).strict()).optional()}).strict(),nle=p.object({schemaVersion:p.literal(1),testEnvironment:tle.nullable().optional(),runtimePlan:p.object({version:p.number().int().positive(),contentHash:Ln,files:p.array(p.object({path:p.string().refine(nf,"not a recipe file path"),content:p.string()}).strict()).min(1),repository:Lm.optional(),recipeRepository:Lm.optional(),recipe:p.record(p.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),rle=p.object({schemaVersion:p.literal(1),state:p.nativeEnum(mG),ending:p.nativeEnum(ey).nullable(),cause:p.nativeEnum(ty).nullable(),deadlineAt:p.string().datetime()}).strict();var VG=50,GG=p.object({repository:Rr,revisions:p.array(p.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:p.array(p.string().min(1)).min(1).max(VG)}).strict();function zG(e){return e.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:e.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:e.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:e.mergeConflict&&gG(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict}:{schemaVersion:1,reason:"no_report",cause:gG({...e,mergeConflict:void 0})}}function gG(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}var qG=he(require("path"));var Sl=he(require("fs")),Sc=he(require("path"));var ile=8;function tn(e,t,n={}){let i=t.slice(0,ile),r=t.length-i.length;return{name:e,passed:!1,details:i.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}function Po(e){if(Sl.existsSync(e))try{return JSON.parse(Sl.readFileSync(e,"utf-8"))}catch{return}}function st(e,t){return Po(Sc.join(e.outputsDir,t))}function Rn(e,t,n,i){if(!n)throw new Error(`${t}.json unexpectedly invalid at artifact time: ${i[0]}`);let r=Sc.join(e.outputsDir,`${t}.json`);return Sl.writeFileSync(r,JSON.stringify(n,null,2)+`
|
|
117
117
|
`),{[t]:Sc.relative(e.runDir,r)}}function or(e,t){return{name:e,verify(n,i){let{errors:r}=t(n,i);return r.length===0?{name:this.name,passed:!0}:tn(this.name,r,{fatal:!0})}}}function gf(e){return e.replace(/\s+/g," ").trim()}var mf=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");function sy(e,t,n){return e.some(i=>i.path===n&&i.repository.toLowerCase()===t.toLowerCase())}function Yi(e){if(e.outputsDir)return Po(qG.join(e.outputsDir,"preflight.json"))}var Os=he(require("path"));var JG=require("child_process");var yf=he(require("path"));var Fs="Skyramp Testbot",Uo="test-bot@skyramp.dev";var sle=(e,t)=>(0,JG.execFileSync)("git",t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();function HG(e){let t="";try{t=sle(e,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(t);return n&&!t.startsWith("/")&&!t.startsWith(".")?`${n[1]}/${n[2]}`:`local/${yf.basename(yf.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}var eQe=new Set(Object.values(_o));var tQe=p.object({checks:p.array(p.object({repository:p.string().optional(),name:p.string().min(1),headSha:p.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:p.string().default("completed"),conclusion:p.string().nullable().optional(),url:p.string().optional(),summary:p.string().optional()}))});var JS=new Map;function ale(e){return e.repositorySlug?e.repositorySlug:(JS.has(e.repositoryPath)||JS.set(e.repositoryPath,HG(e.repositoryPath)),JS.get(e.repositoryPath))}function xn(e){return[{slug:ale(e),path:e.repositoryPath,writable:!0,working:!0},...(e.relatedRepos??[]).map(t=>({slug:t.slug,path:t.path,writable:t.writable===!0,working:!1}))]}function Fo(e){return xn(e)[0]}function HS(e,t){return YG(xn(e),t)}function YG(e,t){return[...e].sort((n,i)=>i.path.length-n.path.length).find(n=>{let i=Os.relative(n.path,t);return!i.startsWith("..")&&!Os.isAbsolute(i)})}var Bl=(e,t)=>e.toLowerCase()===t.toLowerCase();function oy(e,t){return t?.trim()?e.find(n=>Bl(n.slug,t.trim())):e[0]}function Ms(e,t){return oy(xn(e),t)}var cle=(e,t)=>`${t} is not a repository of this run (${xn(e).map(n=>n.slug).join(", ")})`;function Rl(e,t){let n=Ms(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${xn(e).filter(i=>i.writable).map(i=>i.slug).join(", ")}`}:{error:cle(e,t)}}var dQe={focused:"Focused",impacted_critical:"Impacted and critical",broad:"Broad"};var o4=he(require("path"));var ay="\xABredacted\xBB";function lle(e){return e.replace(/AUTHORIZATION: (basic|bearer) \S+/gi,"AUTHORIZATION: $1 ***").replace(/x-access-token:[^@\s]+@/gi,"x-access-token:***@")}function Qn(e,t){if(!e||t.length===0)return e;let n=e;for(let i of t)!i||!n.includes(i)||(n=n.split(i).join(ay));return n}function Ef(e,t){return Qn(lle(e),t)}function dle(e,t){let n=i=>typeof i=="string"?t(i):Array.isArray(i)?i.map(n):i&&typeof i=="object"?Object.fromEntries(Object.entries(i).map(([r,s])=>[r,n(s)])):i;return n(e)}function bi(e,t){return t.length===0?e:dle(e,n=>Qn(n,t))}var mQe=new TextDecoder("utf-8",{fatal:!0});function Pt(e,t=[]){let n=e.trim();if(!n)return{error:"session produced no output"};let i=c=>{try{let u=JSON.parse(c);return typeof u=="object"&&u!==null&&!Array.isArray(u)?u:void 0}catch{return}},r=i(n);if(r!==void 0)return{value:r};let s;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(c){s=c instanceof Error?c.message:String(c)}let o=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let c=o.length-1;c>=0;c--){let u=i(o[c][1].trim());if(u!==void 0)return{value:u}}let a;for(let c=n.indexOf("{");c!==-1;c=n.indexOf("{",c+1)){let u=0,d=!1,f=!1;for(let h=c;h<n.length;h++){let g=n[h];if(f){f=!1;continue}if(g==="\\"){f=d;continue}if(g==='"'){d=!d;continue}if(!d){if(g==="{")u++;else if(g==="}"&&(u--,u===0)){let m=i(n.slice(c,h+1));m!==void 0&&Object.keys(m).length>0&&(a=m,c=h);break}}}}return s&&(a===void 0||Object.keys(a).length<3)?{error:`final message is not valid JSON \u2014 ${s}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:a!==void 0?{value:a}:s?{error:`final message is not valid JSON \u2014 ${s}. 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: "${ple(Qn(n,t))}"`}}var WG=240;function ple(e){let t=e.replace(/\s+/g," ").trim();return t.length<=WG?t:`\u2026${t.slice(-WG)}`}function KG(e,t=0,n=new Set){return vf(e,t,n)}var ZG=e=>" ".repeat(e);function vf(e,t,n){let i=fle(e);switch(i._def.typeName){case"ZodObject":{let s=i.shape,o=Object.keys(s).filter(c=>!n.has(c)&&!s[c].description?.startsWith("[derived]"));return o.length===0?"{}":`{
|
|
118
118
|
${o.map((c,u)=>{let d=s[c],f=d.isOptional()?" (optional)":"",h=d.description?` // ${d.description}`:"",g=vf(d,t+2,n);return`${ZG(t+2)}"${c}": ${g}${u<o.length-1?",":""}${f}${h}`}).join(`
|
|
119
119
|
`)}
|
|
@@ -193,7 +193,7 @@ health check cancelled`,c(1)},f=setTimeout(u,Math.max(1,t.deadlineMs-Date.now())
|
|
|
193
193
|
%{http_code}`,...lEe(r),i],{deadlineMs:Math.min(e,Date.now()+25e3),signal:t});if(o.exitCode!==0)return{error:(o.stderr||"curl failed").trim()};let a=o.stdout??"",c=a.lastIndexOf(`
|
|
194
194
|
`),u=Number(a.slice(c+1).trim());return{status:Number.isFinite(u)?u:0,body:a.slice(0,c)}},async runCommand(i,r){let{steps:s,reason:o}=xf(i);if(!s)return{exitCode:1,output:`${IW}${o}`};let a="";for(let c of s){if(Date.now()>=e)return{exitCode:1,output:"health check time limit reached"};let u=await EW(c,{cwd:r,deadlineMs:Math.min(e,Date.now()+6e4),env:St(),signal:t});if(a+=`${u.stdout??""}${u.stderr??""}`,u.exitCode!==0)return{exitCode:u.exitCode,output:a}}return{exitCode:0,output:a}}}}function lEe(e){return e?Object.entries(e).flatMap(([t,n])=>["-H",`${t}: ${n}`]):[]}function bW(e){return e.trim().replace(/^\.\//,"").replace(/\/+$/,"")}function dEe(e){if(!e.inputs)return[];let t=Yi(e),n=r=>{let s=typeof r=="string"?r:r?.path??r?.file;return typeof s=="string"&&s.trim()?bW(s):void 0},i=(r,s)=>r?(s??[]).flatMap(o=>{let a=n(o);return a?[{repository:r,path:a}]:[]}):[];return[...i(Fo(e.inputs).slug,[...t?.changedFiles??[],...t?.newFiles??[]]),...(t?.relatedChanges??[]).flatMap(r=>i(r.repository,r.changedFiles))]}function pEe(e,t){let n=ea.resolve(e.inputs.repositoryPath,t.trim()),i=HS(e.inputs,n),r=i&&ea.relative(i.path,n);return i&&r?{repository:i.slug,path:r.split(ea.sep).join("/")}:void 0}function Mv(e=a0(),t={}){let n=t.budgetMs??iEe,i=t.intervalMs??sEe;return{name:"deploy-health",async verify(r,s){if(r.signal?.aborted)return{name:this.name,passed:!1,details:"health check cancelled"};let{deploy:o,errors:a}=Yc(s,r.inputs?.repositoryPath,r.secretValues);if(!o)return{name:this.name,passed:!1,details:a.slice(0,6).join("; ")};if(o.outcome==="bringup-failed")return{name:this.name,passed:!0};if(o.outcome==="change-broke-bringup"){let k=dEe(r),P=(o.suspectFiles??[]).map(bW),U=P.filter(G=>{let ne=pEe(r,G);return!!ne&&sy(k,ne.repository,ne.path)});return k.length>0&&U.length===0?{name:this.name,passed:!1,details:`change-broke-bringup claimed, but none of suspectFiles [${P.slice(0,4).join(", ")}] is a file this PR changed \u2014 that is not attributable to the PR. Re-run bring-up; if it still fails for a reason outside the diff, record outcome "bringup-failed" (with bringupError) instead.`}:{name:this.name,passed:!0}}let c=o.health;if(!c)return{name:this.name,passed:!1,details:"health is missing although the app is recorded as up"};let u=Object.values(c.headers??{}).some(k=>/<[^>]+>/.test(String(k))),d=(k,P=!1)=>({ok:!1,details:k,transient:P}),f=async()=>{if(!CB(c.url,r.inputs.repositoryPath))return d(`health url ${c.url} is not the app under test \u2014 this gate probes only loopback or a host declared in .skyramp/workspace.yml, never an arbitrary destination. Record the URL the deployed app actually answers on.`);let k=await e.httpGet(c.url,c.headers);if("error"in k)return d(`health url ${c.url} unreachable: ${k.error}`,!0);let P=Number(c.status??200);if(k.status!==P)return d(`health url returned ${k.status}, expected ${P}`,!0);if(!k.body.trim())return d("health url returned empty body \u2014 must return data",!0);let U=(c.output??"").trim();if(U){let G=mW(U,k.body);if(!G.ok)return d(`health url ${c.url} no longer answers as recorded \u2014 ${G.why}. Either the app is not answering as it did at deploy time, or health.output is not verbatim: record ONLY the response body, with no commentary appended.`)}return{ok:!0}},h=async()=>{let k=await e.runCommand(c.command,r.inputs.repositoryPath),P=k.output.startsWith(IW);if(k.exitCode!==0)return d(`health command exited ${k.exitCode}: ${k.output.slice(0,200)}`,!P);if(!k.output.trim())return d("health command produced no output",!0);let U=(c.output??"").trim();if(U.length<16)return d(`health command output "${U}" is too thin to be a data check \u2014 the check must return real application data, not a status token`);let G=mW(U,k.output);return G.ok?{ok:!0}:d(`health command did not reproduce its recorded check \u2014 ${G.why}. Either the app is not answering as it did at deploy time, or health.output is not verbatim: record ONLY what the command wrote, with no commentary appended.`)},g;if(c.command&&(u||!c.url))g=h;else{if(c.url&&u)return{name:this.name,passed:!1,details:`health.headers contains a documented placeholder (${Object.entries(c.headers??{}).filter(([,k])=>/<[^>]+>/.test(String(k))).map(([k])=>k).join(", ")}), and this gate RE-EXECUTES the probe \u2014 a placeholder cannot authenticate. Record a health.command instead (a script that fetches its own token and hits the URL); do not put a real credential in the artifact.`};c.url?g=f:c.command&&(g=h)}if(!g)return{name:this.name,passed:!1,details:"health has neither url nor command"};let m=Date.now(),E=m+n,S=await g();for(;!S.ok&&S.transient&&!r.signal?.aborted&&Date.now()+i<E&&(await new Promise((k,P)=>{let U,G=ye=>{clearTimeout(U),r.signal?.removeEventListener("abort",ne),ye?P(ye):k()},ne=()=>G();if(r.signal?.addEventListener("abort",ne,{once:!0}),r.signal?.aborted){G();return}t.sleep?t.sleep(i).then(()=>G(),G):U=setTimeout(()=>G(),i)}),!r.signal?.aborted);)S=await g();if(r.signal?.aborted)return{name:this.name,passed:!1,details:"health check cancelled"};if(S.ok)return{name:this.name,passed:!0};let C=Math.round((Date.now()-m)/1e3);return{name:this.name,passed:!1,details:S.transient&&C>0?`${S.details} (still failing after ${C}s)`:S.details}}}}function c0(e){return u0(e)&&_A(e).length===0&&o0(e.inputs?.sharedEnvironment).length===0}function u0(e){let t=fEe(e);if(!t&&e.state.stages.deploy?.status!=="passed")return!1;let n=st(e,"deploy.json");return n?wW(n):!t}function wW(e){return e?.outcome==="clean"||e?.outcome==="recipe-drift"}function fEe(e){let t=e.state.stages.plan,n=e.state.stages.deploy;return!(e.inputs?.pipeline?e.inputs.pipeline==="two-step":!n)||t?.status!=="passed"?!1:!n||n.updatedAt<=t.updatedAt}async function AEe(e,t,n){let i=new URL(t.url).origin;return(URL.canParse(e.url)?new URL(e.url).origin:e.url)===i?Uv(e.url,n):{error:`${e.url} is not on ${i}, where ${t.name} runs`}}async function hEe(e,t,n){let i=Fv(e.inputs??{}),r=[];for(let s of t){let o=i.find(d=>d.name===s.component);if(!o){r.push(`revisions names "${s.component}", which is not a shared component listed for a revision check`);continue}let a=await AEe(s,o,n);if("error"in a){r.push(`the revision check of ${o.name} could not be re-run: ${bi(a.error,e.secretValues??[]).slice(0,200)}`);continue}let c=Pv(o.expectedRevision,{body:s.output}),u=Pv(o.expectedRevision,a);c.observedRevision!==u.observedRevision&&r.push(`the revision check of ${o.name} names ${u.observedRevision??"no commit"} when re-run, but its recorded output names ${c.observedRevision??"no commit"} \u2014 record what the check returned, verbatim, or leave the component out`)}return r}function CW(e){return{name:"shared-revisions",async verify(t,n){let{deploy:i}=Yc(n,t.inputs?.repositoryPath,t.secretValues),r=await hEe(t,i?.revisions??[],e);return r.length?{name:this.name,passed:!1,details:r.join("; ")}:{name:this.name,passed:!0}}}}async function kW(e,t,n){let i=e.inputs?.sharedEnvironment;if(!i0(i))return{};let{deploy:r}=Yc(t,e.inputs.repositoryPath,e.secretValues),s=await lW(i,r?.revisions??[],n,e.secretValues??[]);return Rn(e,yd,bi(s,e.secretValues??[]),[])}function SW(e,t){let{deploy:n,errors:i}=Yc(t,e.inputs?.repositoryPath,e.secretValues),r=n?.health?.headers?{...n,health:{...n.health,headers:Object.fromEntries(Object.keys(n.health.headers).map(o=>[o,"<redacted>"]))}}:n,s=bi(r,e.secretValues??[]);return Rn(e,"deploy",s,i)}var ePe=10*6e4;var jv=(r=>(r.RestApi="rest-api",r.Frontend="frontend",r.FullStack="full-stack",r.Other="other",r))(jv||{}),Wc=(r=>(r.Critical="critical",r.High="high",r.Medium="medium",r.Low="low",r))(Wc||{}),Zc=(i=>(i.Suspected="suspected",i.Latent="latent",i.Refuted="refuted",i))(Zc||{}),p0=(i=>(i.Skyramp="skyramp",i.External="external",i.Unknown="unknown",i))(p0||{}),f0=(r=>(r.Cascade="cascade",r.Restrict="restrict",r.Orphan="orphan",r.Unknown="unknown",r))(f0||{}),ns=(r=>(r.RequirementReference="requirement-reference",r.Spec="spec",r.PrDescription="pr-description",r.CouldBreak="could-break",r))(ns||{}),gt=p.string().trim().min(1),Ed=gt.describe("file:line"),BW=e=>gt.refine(t=>t.length<=400,t=>({message:`is ${t.length} characters, over the 400 cap \u2014 ${e}`})),NA=gt.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'),d0=p.object({method:gt,path:gt,service:p.string().optional(),evidence:Ed,repository:NA}),vEe=p.object({id:gt.describe("short-slug, e.g. R9"),statement:gt.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:p.nativeEnum(ns).describe("spec outranks pr-description when both state it"),evidence:gt.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),IEe=p.object({id:gt.describe("short-slug"),statement:gt.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:gt.describe("METHOD /path, or a component/page name"),evidence:gt.describe("file:line from the diff that introduces it"),repository:NA,satisfies:p.array(gt).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)")}),bEe=p.object({id:gt.describe("short-slug"),file:gt,line:p.number().optional(),claim:BW("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:p.nativeEnum(Wc),evidence:BW("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:p.nativeEnum(Zc),repository:NA,conflictsWith:p.array(gt).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),wEe=p.object({name:gt,language:p.string().optional(),framework:p.string().optional(),evidence:Ed,repository:NA}),CEe=p.object({dir:gt,framework:p.string().optional(),kind:p.nativeEnum(p0),evidence:Ed,repository:NA}),kEe=p.object({from:gt,to:gt,onDelete:p.nativeEnum(f0),evidence:Ed}),SEe=p.object({entity:gt,field:gt,values:p.array(p.string()),evidence:Ed}),BEe=p.object({entities:p.array(p.object({name:gt,evidence:Ed})),references:p.array(kEe).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:p.array(SEe)}),A0=p.object({schemaVersion:p.literal(1),repository:p.object({path:gt.describe("absolute repo path"),currentBranch:gt,baseBranch:gt}),project:p.object({type:p.nativeEnum(jv),primaryLanguage:gt,languages:p.array(p.string()),frameworks:p.array(p.string())}),services:p.array(wEe),infrastructure:p.object({containerized:p.boolean(),hasDockerCompose:p.boolean(),composeFiles:p.array(p.string()),hasCiCd:p.boolean()}),diff:p.object({changedFiles:p.array(p.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:p.boolean(),summary:gt.describe("\u2264400 chars")}),endpoints:p.object({new:p.array(d0),modified:p.array(d0),removed:p.array(d0)}),existingTests:p.object({locations:p.array(CEe)}),entityMap:BEe,requirements:p.array(vEe).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:p.array(IEe),findings:p.array(bEe),unexamined:p.array(p.string()).describe("files or areas outside this change you did not open"),summary:gt.describe("one paragraph on what this change does and its test-relevant risk")});var $Ee=p.object({route:p.string().describe('the page this step happens on, e.g. "/products/:id"'),action:p.string().describe('what the user does there, through the UI, e.g. "clicks Add to cart"'),clauses:p.array(p.string()).optional().describe("the plan clause ids this step exercises"),check:p.string().optional().describe("what the user then sees that shows the step worked; the test asserts it")}),DA=(n=>(n.InProcess="in-process",n.Browser="browser",n))(DA||{}),RW=(i=>(i.Spec="spec",i.PrDescription="pr-description",i.Inferred="inferred",i))(RW||{}),xW=p.object({id:p.string().describe('e.g. "J1"'),name:p.string().describe(`the flow in a user's words, e.g. "buy a product with a coupon"`),entry:p.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:p.array($Ee).describe("every step, in order, from the entry page to the outcome: at least two"),outcome:p.string().describe("what the user sees at the end that shows the flow worked: every part of it"),finishes:p.string().optional().describe('the user action that completes the task, verb first, e.g. "places the order"; the journey walks on to it'),kind:p.nativeEnum(DA).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:p.nativeEnum(RW).optional().describe("spec or pr-description when one describes this flow (quote it under evidence), else inferred"),evidence:p.string().optional().describe("for spec or pr-description: its words that describe the flow"),testFile:p.string().describe("the browser test file it goes in, beside the repo's existing e2e tests")}),Vv=p.object({journey:p.string().describe("the plan's journey id"),file:p.string().describe("the browser test file that walks it"),brokeAt:p.object({step:p.number().int().describe("the 1-based step whose check failed first"),expected:p.string(),actual:p.string().describe("what the app did instead, from the runner's output"),notReached:p.array(p.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:p.string().describe("the title of the one test in that file that walks it end to end")});var pPe=Object.fromEntries([...["ts","tsx","mts","cts","js","jsx","mjs","cjs"].map(e=>[e,"node"]),...["java","kt","kts","groovy","scala"].map(e=>[e,"jvm"]),["py","python"],["go","go"]]);var fPe=["stale_test","open_question"],APe=["low","medium","high","critical"];var QW=String.raw`(?:\[[^\]]*\]|\([^)]*\))`,TEe=String.raw`(?:["'\u201c\u2018\x60]|\*{1,2})?[^\s:"'\u201c\u201d\u2018\u2019\x60*()[\],]+(?:["'\u201d\u2019\x60]|\*{1,2})?`,$W=String.raw`(?:${QW}|${TEe}(?:\s*${QW})?)`,TW=String.raw`(?:\s*:|\s+[\u2014\u2013-])`,mPe=new RegExp(String.raw`^\s*(?:${$W}(?:,\s*${$W})*(?::L?\d+(?:[-\u2013]\d+)?${TW}?|${TW})|\[[^\]\s]+\]|\([^)\s]+\))\s+`);var PA=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(PA||{}),Hs=p.string().trim().min(1),_Ee=p.object({case:Hs.describe("recommend id this assertion enforces"),evidence:Hs.describe("the exact assertion line from the file that checks that case's observable")}),h0=p.object({kind:p.nativeEnum(zm).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:Hs.describe("the dependency, endpoint or data it affects"),mechanism:p.nativeEnum(qm).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:Hs.describe("what it sets up"),worker:Hs.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:Hs.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")}),NEe=p.object({file:Hs.describe("staged path under .skyramp/staged/"),source:p.nativeEnum(PA),language:Hs,covers:p.array(p.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:p.array(_Ee).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:p.array(h0).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")}),g0=p.object({schemaVersion:p.literal(1),tests:p.array(NEe),deferredUi:p.array(p.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:Hs.describe("one paragraph")});var Ys=p.string().trim().min(1),Ws=72,DEe=p.object({repository:Ys.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:p.string(),command:p.string().describe("the exact command you ran, scoped to the changed files"),clean:p.boolean(),fixed:p.array(p.string()).optional().describe("files you fixed"),uncovered:p.array(p.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.")}),m0=p.object({schemaVersion:p.literal(1),lint:p.array(DEe).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:p.object({ok:p.boolean(),notes:p.string().optional()}),ciReadiness:p.object({covered:p.boolean().describe("will the repo's CI run these tests?"),notes:p.string().optional()}),dependencies:p.object({added:p.array(p.object({package:p.string(),manifest:p.string(),repository:Ys.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:Ys.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:p.array(p.object({file:Ys,repository:Ys.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:p.object({message:Ys.refine(e=>e.split(`
|
|
195
195
|
`)[0].length<=Ws,{message:`subject line must be <= ${Ws} chars`})}),pr:p.object({title:Ys.max(Ws,`must be <= ${Ws} chars`),body:Ys}),ready:p.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:p.array(p.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:Ys.describe("one paragraph")});function UA(e){return(e?.blockers??[]).slice(0,3).join("; ")}var na=he(require("fs")),bd=he(require("path")),PW=require("child_process");var _n="{junit}",Gv=(r=>(r.Junit="junit",r.Trx="trx",r.GoTestJson="go-test-json",r.JestJson="jest-json",r))(Gv||{}),y0=(t=>(t.Minitest="minitest",t))(y0||{}),_W=p.string().trim().min(1),vd=p.object({cwd:_W.describe('repo-relative directory the command starts in ("." for the root)'),argv:p.array(_W).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${_n}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:p.record(p.string(),p.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:p.object({format:p.nativeEnum(Gv).describe(`junit (JUnit XML to ${_n}), trx (to ${_n}), jest-json (Jest's --json or Vitest's --reporter=json, --outputFile=${_n}), or go-test-json (go test -json on the command's output)`),reporter:p.nativeEnum(y0).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 Id="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)",SPe=`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 ${_n} in the reporter's argument or env setting), trx (a TRX file to ${_n}, which every dotnet test writes with its built-in logger), jest-json (Jest's --json --outputFile=${_n}, or Vitest's --reporter=json --outputFile=${_n}: built in, no reporter package), or go-test-json (go test -json, read from the command's output). A Maven or Gradle command names no ${_n}: 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 ${_n} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${_n} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${_n} in argv and env with its report path, executes the command, and reads that report.`;var ta=(r=>(r.ExistingEvidenceSufficient="existing_evidence_sufficient",r.TargetedUnit="targeted_unit",r.RuntimeRequired="runtime_required",r.BlockedPreflight="blocked_preflight",r))(ta||{}),Zs=(s=>(s.ExistingEvidence="existing_evidence",s.Unaffected="unaffected",s.ExistingUnit="existing_unit",s.NewUnit="new_unit",s.Runtime="runtime",s))(Zs||{}),E0=(n=>(n.Repository="repository",n.Testbot="testbot",n))(E0||{}),v0=(i=>(i.Identified="identified",i.Passed="passed",i.Failed="failed",i))(v0||{}),fr=p.string().trim().min(1),PEe=p.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var UEe=p.object({id:PEe,source:p.nativeEnum(E0),kind:p.nativeEnum(_o),outcome:p.nativeEnum(v0),summary:fr.max(400).describe("one line: what it shows"),tests:p.array(fr).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:fr.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:fr.optional().describe("source testbot: the exact command you ran, as you ran it"),run:vd.optional().describe(`source repository, for tests in ${Id}: how the run executes the whole of each of these test files, all of them in one command, never narrowed to the named tests and never only listed, with the repository's own runner writing JUnit XML to {junit}. A test is credited to a file only by its name or by a report that names the file`)}),FEe=p.object({behaviorId:fr.describe("an id from analyze's behaviors"),mechanism:p.nativeEnum(Zs),evidenceIds:p.array(fr).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:p.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')}),I0=(i=>(i.Browser="browser",i.RunningApp="running-app",i.Outside="outside",i))(I0||{}),OEe=p.object({behaviorId:p.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:fr.max(600).describe("the evidence that is required and cannot be obtained in this run"),needs:p.nativeEnum(I0).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)")}),MEe=p.object({file:fr.describe("the changed file the failure is in"),repository:fr.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:fr.max(300).describe("what prerequisite the change fails"),evidence:fr.max(400).describe("the error line, quoted")}),LEe=p.object({behaviorId:fr.describe("an id from analyze's behaviors"),reason:fr.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)")}),FA=p.object({schemaVersion:p.literal(1),decision:p.nativeEnum(ta),evidence:p.array(UEe).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:p.array(FEe).describe("how each changed behavior's evidence is obtained"),gaps:p.array(OEe),outOfScope:p.array(LEe).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:MEe.optional().describe("only for blocked_preflight"),rationale:fr.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function OA(e){let t=st(e,"recommend.json");if(!t||!Array.isArray(t.generate)||!Array.isArray(t.maintenance))return;let n=t;return{...n,maintenance:n.maintenance.map(({repository:i,...r})=>({...r,test:r.test.trim().replace(/^\.\//,""),...i?.trim()?{repository:i.trim()}:{}}))}}function zEe(e){return $n(g0,e).errors}function qEe(e,t=[]){let{value:n,error:i}=Pt(e,t);if(i)return{errors:[i]};let r=zEe(n);return r.length>0?{errors:r}:{generate:n,errors:[]}}function zv(e,t=[]){return qEe(e.stdout,t)}function JEe(e){return e.generate.filter(t=>t.type!=="ui").map(t=>t.id)}function UW(e){return e.generate.filter(t=>t.type==="ui").map(t=>t.id)}var qv={backend:{stage:"generate",cases:JEe,noRecommendCoverage:"recommend.json missing or malformed \u2014 cannot check coverage",noRecommendIntent:"recommend.json missing or malformed \u2014 cannot check intent",uncovered:e=>`recommend case "${e}" is not covered by any generated test`,unknownCovered:e=>`test covers unknown recommend id "${e}"`,unasserted:e=>`case "${e}" has no verified assertion enforcing its expected_observable`,usedCodegen:XY,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:UW,noRecommendCoverage:"recommend.json not found \u2014 cannot check UI coverage",noRecommendIntent:"recommend.json not found \u2014 cannot check UI intent",uncovered:e=>`UI case "${e}" is not covered by any generated UI test`,unknownCovered:e=>`test covers "${e}" which is not a recommend UI case`,unasserted:e=>`UI case "${e}" has no verified assertion enforcing its expected_observable`,usedCodegen:eW,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."}},sUe=or("generate-schema",(e,t)=>zv(t,e.secretValues));function HEe(e){let t=qv[e];return{name:`${t.stage}-coverage`,verify(n,i){let{generate:r,errors:s}=zv(i,n.secretValues);if(!r)return tn(this.name,s);let o=OA(n);if(!o)return tn(this.name,[t.noRecommendCoverage]);let a=new Set(r.tests.flatMap(f=>f.covers)),c=[],u=t.cases(o);for(let f of u)a.has(f)||c.push(t.uncovered(f));let d=new Set(e==="ui"?u:o.generate.map(f=>f.id));for(let f of a)d.has(f)||c.push(t.unknownCovered(f));if(e==="backend"){let f=new Set(r.deferredUi),h=new Set(UW(o));for(let g of h)!f.has(g)&&!a.has(g)&&c.push(`UI case "${g}" is neither covered nor deferred to the UI stage`);for(let g of f)h.has(g)||c.push(`deferredUi lists "${g}" which is not a UI case`)}return c.length===0?{name:this.name,passed:!0}:tn(this.name,c)}}}function YEe(e){let t=qv[e];return{name:`${t.stage}-intent`,verify(n,i){let{generate:r,errors:s}=zv(i,n.secretValues);if(!r)return tn(this.name,s);let o=OA(n);if(!o)return tn(this.name,[t.noRecommendIntent]);let{asserted:a,errors:c,badFiles:u}=nve(r,n.inputs.repositoryPath),d=c.length;for(let h of t.cases(o))a.has(h)||c.push(t.unasserted(h));if(c.length===0)return{name:this.name,passed:!0};let f=tn(this.name,c);return d>0&&d===c.length&&u.size>0?{...f,droppable:[...u]}:f}}}function WEe(e){let t=qv[e];return n=>{if(!n.inputs.skyrampMcp?.command||e==="backend"&&!c0(n))return;let i=bd.join(n.outputsDir,`${t.stage}-stream.ndjson`);if(!(!na.existsSync(i)||t.usedCodegen(i)))return tW(i)?t.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 oUe=HEe("backend"),aUe=YEe("backend"),cUe=WEe("backend");var NW=e=>e.replace(/\s+/g,"");var b0={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[e,t]of[["javascript","typescript"],["kotlin","java"]])b0[e]=b0[t];function ZEe(e,t){if(e.includes(gf(t))||NW(e).includes(NW(t)))return!0;let n=t.split(/\r?\n/).map(i=>i.trim()).filter(i=>i&&!/^(\/\/|#|\*|\/\*)/.test(i));return n.length>0&&n.every(i=>e.includes(gf(i)))?!0:tve(e,t)}var KEe=/\bassert\w*\b|\bexpect\s*\(|\.should\b|\brequire\s*\(/i,XEe=12,eve=/,\s*\(\s*#|,\s*f?["'`]|\s+#\s|\s+\/\/|\s*\((?:line|lines|at line)\b|\s*,\s*$/i;function tve(e,t){let n=t.split(/\s*;\s*|\s*\.\.\.\s*|\r?\n/),i=0;for(let r of n){let s=KEe.exec(r);if(!s)continue;let o=r.slice(s.index),a=eve.exec(o);if(a&&(o=o.slice(0,a.index)),o=gf(o).replace(/[,\s]+$/,""),o.length<XEe||!e.includes(o))return!1;i++}return i>0}function nve(e,t){let n=new Set,i=[],r=new Set;for(let s of e.tests){let o=bd.resolve(t,s.file);if(!na.existsSync(o))continue;let a=gf(na.readFileSync(o,"utf-8"));for(let c of s.assertions??[]){if(!ZEe(a,c.evidence)){i.push(`assertion evidence for "${c.case}" not found in ${s.file} \u2014 cite the real assertion line`),r.add(s.file);continue}s.covers.includes(c.case)?n.add(c.case):(i.push(`assertion cites case "${c.case}" not in that test's covers[]`),r.add(s.file))}}return{asserted:n,errors:i,badFiles:r}}var rve=/\.(spec|test)\.[cm]?[jt]sx?$/i;function FW(e){let t;try{t=(0,PW.execFileSync)("git",[...Gi,"status","--porcelain","--untracked-files=all"],{env:St(),cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]})}catch{return}let n=r=>/_scaffold/i.test(r)||mf.test(r),i=[];for(let r of t.split(`
|
|
196
|
-
`)){if(!r.trim()||r.length>1&&r[1]==="D")continue;let s=r.slice(3).trim(),o=s.indexOf(" -> ");if(o!==-1&&(s=s.slice(o+4).trim()),s=s.replace(/^"|"$/g,""),!s)continue;let a=s.replace(/^\.\//,"");a.startsWith(".skyramp/")||!n(a)||i.push(a)}return i}function ive(e){let t=qv[e],n=e==="ui";return{name:`${t.stage}-no-litter`,verify(i){let r=FW(i.inputs.repositoryPath);if(r===void 0)return{name:this.name,passed:!0};let s=r.filter(o=>rve.test(o)===n);return s.length===0?{name:this.name,passed:!0}:tn(this.name,[`${t.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${s.slice(0,6).join(", ")}`])}}}var uUe=ive("backend");var cve="write-stale-updates",uve={[cve]:"stale test updates"};var MA=he(require("fs")),Kc=he(require("path"));function jW(e){return $n(_S,e).errors}function pve(e,t=[]){let{value:n,error:i}=Pt(e,t);if(i)return{errors:[i]};let r=jW(n);return r.length>0?{errors:r}:{adapt:n,errors:[]}}var fve="adapt-scratch",MW=`${fve}/adapt-result.json`;function VW(e,t){let n=Kc.join(e.outputsDir,MW),i;try{i=MA.readFileSync(n,"utf-8")}catch{i=void 0}if(i!==void 0&&(e.secretValues??[]).some(o=>i.includes(o)))return{errors:[`${MW} contains a secret value (token / credential) \u2014 never write it anywhere`]};let r=pve(t.stdout,e.secretValues);if(r.adapt)return r;let s=i!==void 0?Po(n):void 0;return s!==void 0&&jW(s).length===0?{adapt:s,errors:[]}:r}var PUe=or("adapt-schema",VW);var GW=require("child_process");function w0(e){return Ave(e)??[]}function Ave(e){let t;try{t=(0,GW.execFileSync)("git",[...Gi,"status","--porcelain","-z","--untracked-files=all"],{env:St(),cwd:e,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return}let n=t.split("\0"),i=[];for(let r=0;r<n.length;r++){let s=n[r];if(s.length<4)continue;let o=s.slice(0,2);i.push({code:o,path:s.slice(3)}),(o[0]==="R"||o[0]==="C")&&r++}return i}var zUe=2*1024*1024;var Jv=p.string().trim().min(1),hve=p.object({cwd:Jv.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:p.array(Jv).min(1).describe("the command as separate arguments, run without a shell"),env:p.record(p.string(),p.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),gve=p.object({file:Jv.describe("a file of the test's checkout, relative to its root"),line:Jv.describe("a line of that file, quoted exactly from where its command starts to its end")}),zW=p.object({collected:p.boolean().describe("whether the repo's CI runs this test as it is"),steps:p.array(gve).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:p.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:hve.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:p.string().optional().describe("when not collected: why the repo's CI will not run it")});var Ee=p.string().trim().min(1),bve=e=>{if(!e||typeof e!="object")return e;let t=e;return typeof t.skip=="string"&&t.skip.trim()&&(t.expected===void 0||t.expected===null)?{...t,expected:"(not tested)"}:e},wve=p.preprocess(bve,p.object({id:Ee.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:Ee.describe("one testable part of the requirement"),expected:Ee.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:p.string().optional().describe("only when no test can check this clause here: why"),type:p.nativeEnum(Js).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:p.string().optional().describe('its "METHOD /path", or the page / flow'),steps:p.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:p.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:p.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:p.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:p.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:p.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:p.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)"),quote:p.string().optional().describe("the words of the spec, plan, ticket or PR description that state this clause, copied exactly; a file of the repository: its path:line first. Leave it out when no source states it"),inferred:p.boolean().optional().describe("leave it out: Testbot sets it when no source states this clause (contracts/clause-grounding.ts)")})),JW=p.object({spec:p.string().optional().describe("file:line of a spec in the repository"),prDescription:p.boolean().optional().describe("or true when a pull request description says otherwise"),reference:p.string().optional().describe("or the key of an item the run was given, as listed"),says:Ee.describe("what it says there, in its own words, copied exactly"),criterion:p.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(e=>[!!e.prDescription,!!e.spec?.trim(),!!e.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`}),Cve=p.object({id:Ee.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:Ee,source:p.nativeEnum(ns).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:p.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:Ee.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:p.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"),alsoFrom:p.array(p.object({reference:Ee.regex($o).describe("the key of another uploaded document stating the same obligation"),says:Ee.describe("that document's own words, copied exactly; never infer equivalence from a shared criterion number"),criterion:p.number().int().positive().optional().describe("leave out; Testbot grounds and numbers this source separately")})).optional().describe("equivalent uploaded source criteria sharing this requirement's planned cases; retain every source with its own quote. Different conditions or boundaries need distinct requirements"),notInChange:p.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"),unchanged:p.boolean().optional().describe("true when it asks only that behaviour stay as it was (an update or refactor that must not change how something works), whatever its source"),overrules:p.array(JW).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:p.array(wve)}),HW=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(HW||{}),kve=p.object({id:Ee.describe('e.g. "F1"'),file:Ee,line:p.number().optional(),claim:Ee.describe("the defect, in one sentence"),severity:p.nativeEnum(Wc),evidence:Ee.describe("the code line, or the probe request and response, that shows it"),conflictsWith:p.array(Ee).optional().describe("requirement or clause ids it violates"),keeps:p.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:p.nativeEnum(HW).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:p.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:p.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)")}),Sve=p.object({id:Ee.describe('e.g. "Q1"'),question:Ee.describe("what is unsettled, as a question the PR author can answer"),readings:p.array(Ee).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:p.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:p.array(JW).optional().describe("when sources of the same rank disagree on it: each of them")}),Bve=p.object({id:Ee.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:p.nativeEnum(Js).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:Ee.describe('"METHOD /path", or the page / flow'),clause:p.string().optional().describe("the clause id this case checks"),finding:p.string().optional().describe("the finding id this case catches"),steps:Ee.describe("what the test does"),expected:Ee.describe("the expected outcome, from the clause"),mutates:p.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")}),Rve=p.object({test:Ee.describe("existing test file"),action:p.nativeEnum(ts),reason:Ee,mutates:p.boolean().optional().describe("true when the maintained test changes state"),clauses:p.array(Ee).optional().describe("the clause ids this test checks")}),qW=p.array(Mm).optional(),xve=p.object({components:p.preprocess(e=>qW.safeParse(e).success?e:void 0,qW).describe("when saving a new or changed recipe: every app and backing service actually brought up, its source repository, and whether it is healthy"),outcome:p.nativeEnum(Wr).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:p.record(p.string()).optional().describe("service \u2192 base URL of the running app"),health:p.object({url:p.string().optional(),command:p.string().optional(),output:p.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:p.string().optional().describe("command that stops the app"),dependencies:p.record(p.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:p.array(p.string()).optional().describe("what you changed in the recipe"),error:p.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:p.array(p.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:p.object({username:Ee,password:p.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:bS.optional()}),BFe=p.object({schemaVersion:p.literal(1),requirements:p.array(Cve),findings:p.array(kve),cases:p.array(Bve).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:p.array(Sve).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:p.array(Rve),journeys:p.array(xW).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:p.array(p.object({clause:Ee,why:Ee})).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:p.array(p.object({components:p.array(Ee).min(1).describe("changed components, as the change lists them"),why:Ee})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:FA.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:xve.optional().describe("omit when no app was needed or none was started"),summary:Ee.describe("one paragraph: what the change does and where the risk is")});var LA=(n=>(n.Backend="backend",n.Ui="ui",n))(LA||{});var ra=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(ra||{}),Qve=p.object({file:Ee.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:p.nativeEnum(LA),change:p.nativeEnum(ra).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:p.array(p.string()).describe("the plan case ids this file tests, each with its own result under result.cases"),defect:p.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:p.object({requirement:Ee.describe("the requirement or clause id the change deliberately alters"),line:Ee.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 or deleted: why it is out of date"),result:p.object({exit:p.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:p.array(p.object({case:Ee,status:p.nativeEnum(Kr),runtimeTargets:uf.optional().describe("HTTP(S) URLs this case actually exercised in its current run, from its request or browser evidence; omit for local in-process/mocked checks, never list the shared app merely because it is configured"),defect:p.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:p.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:p.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:p.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:p.string().optional().describe("what failed and why, or why it was not run")}),assertions:p.array(p.object({case:Ee,evidence:Ee})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:p.array(p.object({name:Ee.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:p.array(Ee).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:p.object({draft:p.union([p.string(),p.array(p.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:p.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:p.array(h0).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:Ee.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:zW.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:vd.optional().describe(`for a file in ${Id}, 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, trx or jest-json to ${_n}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),$ve=e=>{if(!e||typeof e!="object")return e;let{test:t,...n}=e;return typeof t=="string"&&t.trim()&&n.tests===void 0?{...n,tests:[t]}:e},Tve=p.preprocess($ve,p.object({description:Ee.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:p.nativeEnum(Wc).optional(),sourceFile:p.string().optional().describe("the app file at fault"),sourceLine:p.number().optional(),tests:p.array(Ee).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:p.string().optional().describe("the plan's finding id, when it is one"),requirements:p.array(Ee).optional().describe("the plan's requirement or clause ids it violates")})),RFe=p.object({schemaVersion:p.literal(1),tests:p.array(Qve),notWritten:p.array(p.object({case:Ee,reason:Ee,coveredBy:p.object({file:Ee.describe("the test file, relative to the working checkout; prefix a related checkout as for tests[].file"),name:Ee.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)")}).optional().describe("only for an existing test triage independently linked to this exact case: its exact runner name (including class or describe titles). Testbot must finish re-running it with every result passed. If your own test covers the case, include the case in its covers and function cases instead")})).describe("every plan case no test covers, and why"),journeys:p.array(Vv).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:p.object({command:p.string(),clean:p.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:p.array(p.object({package:Ee,manifest:Ee.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:Ee.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:Ee.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:p.array(Ee).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:p.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:p.object({message:Ee.describe("subject line at most 72 characters, following the repository's commit-message checks"),prTitle:Ee.describe("at most 72 characters, following the repository's PR-title checks"),prBody:Ee.describe("what the tests cover and what they found")}),report:p.object({summary:Ee.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:p.array(Tve).describe("every defect the tests found"),nextSteps:p.array(p.string()),noTests:p.array(p.object({repository:Ee,reason:Ee.max(4096)})).max(1e3).optional().describe("each Change Set repository where no test was added or updated: its owner/repo and why, naming the other repository when its tests went there"),notesDeviation:p.string().trim().max(4096).optional().describe("when the Target notes say where tests go and a test you added went elsewhere: where it went, and why; omit otherwise")})});var xFe={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var WW=(i=>(i.Requirement="requirement",i.PrDescription="pr_description",i.Code="code",i))(WW||{}),mn=p.string().trim().min(1),_ve=p.object({expectation:mn.max(300).describe("the behavior this assertion pins, in words"),source:p.nativeEnum(WW),expected:mn.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),Nve=p.object({file:mn.describe("path of the NEW test file you wrote, relative to its repository"),repository:mn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:mn.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:vd.optional().describe(`for ${Id}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:p.array(mn).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:p.array(mn).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:p.array(_ve).min(1)}),jA=(n=>(n.Updated="updated",n.Deleted="deleted",n))(jA||{}),YW=300,Dve=p.object({file:mn.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:mn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:p.nativeEnum(jA),staleBecause:p.object({requirement:mn.describe("the requirement or clause id the change deliberately alters"),line:mn.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:p.preprocess(e=>typeof e=="string"?e.trim().slice(0,YW):e,mn.max(YW)).describe("what the change deliberately altered that made the test wrong")}),C0=p.object({schemaVersion:p.literal(1),tests:p.array(Nve),maintained:p.array(Dve).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:p.array(p.object({id:mn,reason:mn.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:p.array(Vv).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:p.array(p.object({journey:mn,missing:mn.transform(e=>e.length>300?`${e.slice(0,299)}\u2026`:e)})).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:p.object({command:p.string(),clean:p.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:mn.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var VA="generate-unit.json";function Uve(e){let{value:t,error:n}=Pt(e);if(n)return{errors:[n]};let{value:i,errors:r}=$n(C0,t);return r.length?{errors:r}:{output:i,errors:[]}}function Fve(e){return Uve(e.stdout)}var gOe=or("generate-unit-schema",(e,t)=>Fve(t));var Hv=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,mOe=[[/\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+["']${Hv}["']|\bimport\s+["']${Hv}["']|require\(\s*["']${Hv}["']\s*\)|\bimport\(\s*["']${Hv}["']\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 POe=new Set(["targeted_unit","existing_evidence_sufficient"]);var ia=he(require("path"));var YOe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var S0=e=>new Map((e??[]).flatMap(t=>t.file?[[of(t.key),t.file.name]]:[])),Vve=10*1024*1024,Gve=e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r4=(e,t)=>ia.join(ia.dirname(e),`${ia.basename(e,ia.extname(e))}${t}`),zve=e=>r4(e,".extracted.txt");var qve=e=>r4(e,".quotes.txt");function i4(e){return Gve(e.file)?zve(e.path):e.file?.mediaType==="application/pdf"?qve(e.path):e.path}var Yve="triage.json";var GMe=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),zMe={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 Wve(e){let{value:t,error:n}=Pt(e);if(n)return{errors:[n]};let{value:i,errors:r}=$n(FA,t);return r.length?{errors:r}:{triage:i,errors:[]}}function Zve(e){return Wve(e.stdout)}var qMe=or("triage-schema",(e,t)=>Zve(t));function Kve(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}function B0(e){if(Kve(e)?.status==="passed")return Po(o4.join(e.outputsDir,Yve))}function R0(e){return AW(s0(e.inputs,st(e,`${yd}.json`),B0(e)?.sutRequired))}var JMe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);bn();bn();function a4(e,t){return t?`<!-- skyramp-testbot-run: ${t} -->
|
|
196
|
+
`)){if(!r.trim()||r.length>1&&r[1]==="D")continue;let s=r.slice(3).trim(),o=s.indexOf(" -> ");if(o!==-1&&(s=s.slice(o+4).trim()),s=s.replace(/^"|"$/g,""),!s)continue;let a=s.replace(/^\.\//,"");a.startsWith(".skyramp/")||!n(a)||i.push(a)}return i}function ive(e){let t=qv[e],n=e==="ui";return{name:`${t.stage}-no-litter`,verify(i){let r=FW(i.inputs.repositoryPath);if(r===void 0)return{name:this.name,passed:!0};let s=r.filter(o=>rve.test(o)===n);return s.length===0?{name:this.name,passed:!0}:tn(this.name,[`${t.stage} left files outside .skyramp/ \u2014 move the staged test into .skyramp/staged/ and delete any codegen draft (e.g. *_scaffold.*): ${s.slice(0,6).join(", ")}`])}}}var uUe=ive("backend");var cve="write-stale-updates",uve={[cve]:"stale test updates"};var MA=he(require("fs")),Kc=he(require("path"));function jW(e){return $n(_S,e).errors}function pve(e,t=[]){let{value:n,error:i}=Pt(e,t);if(i)return{errors:[i]};let r=jW(n);return r.length>0?{errors:r}:{adapt:n,errors:[]}}var fve="adapt-scratch",MW=`${fve}/adapt-result.json`;function VW(e,t){let n=Kc.join(e.outputsDir,MW),i;try{i=MA.readFileSync(n,"utf-8")}catch{i=void 0}if(i!==void 0&&(e.secretValues??[]).some(o=>i.includes(o)))return{errors:[`${MW} contains a secret value (token / credential) \u2014 never write it anywhere`]};let r=pve(t.stdout,e.secretValues);if(r.adapt)return r;let s=i!==void 0?Po(n):void 0;return s!==void 0&&jW(s).length===0?{adapt:s,errors:[]}:r}var PUe=or("adapt-schema",VW);var GW=require("child_process");function w0(e){return Ave(e)??[]}function Ave(e){let t;try{t=(0,GW.execFileSync)("git",[...Gi,"status","--porcelain","-z","--untracked-files=all"],{env:St(),cwd:e,encoding:"utf-8",maxBuffer:16*1024*1024})}catch{return}let n=t.split("\0"),i=[];for(let r=0;r<n.length;r++){let s=n[r];if(s.length<4)continue;let o=s.slice(0,2);i.push({code:o,path:s.slice(3)}),(o[0]==="R"||o[0]==="C")&&r++}return i}var zUe=2*1024*1024;var Jv=p.string().trim().min(1),hve=p.object({cwd:Jv.describe(`directory the command starts in, relative to the test's checkout ("." for its root)`),argv:p.array(Jv).min(1).describe("the command as separate arguments, run without a shell"),env:p.record(p.string(),p.string()).optional().describe("plain settings the listing needs beyond the CI step's own; never a credential or PATH")}),gve=p.object({file:Jv.describe("a file of the test's checkout, relative to its root"),line:Jv.describe("a line of that file, quoted exactly from where its command starts to its end")}),zW=p.object({collected:p.boolean().describe("whether the repo's CI runs this test as it is"),steps:p.array(gve).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:p.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:hve.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:p.string().optional().describe("when not collected: why the repo's CI will not run it")});var Ee=p.string().trim().min(1),bve=e=>{if(!e||typeof e!="object")return e;let t=e;return typeof t.skip=="string"&&t.skip.trim()&&(t.expected===void 0||t.expected===null)?{...t,expected:"(not tested)"}:e},wve=p.preprocess(bve,p.object({id:Ee.describe(`its requirement's id plus a letter, e.g. "R1a", "AC-3a"`),clause:Ee.describe("one testable part of the requirement"),expected:Ee.describe("the outcome the requirement calls for \u2014 taken from the requirement, never from what the code does"),skip:p.string().optional().describe("only when no test can check this clause here: why"),type:p.nativeEnum(Js).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:p.string().optional().describe('its "METHOD /path", or the page / flow'),steps:p.string().optional().describe("what that test does; its expected outcome is this clause's"),finding:p.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:p.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:p.string().optional().describe("the description's or spec's own words that state this clause, copied exactly, when they do"),mutates:p.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:p.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:p.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)"),quote:p.string().optional().describe("the words of the spec, plan, ticket or PR description that state this clause, copied exactly; a file of the repository: its path:line first. Leave it out when no source states it"),inferred:p.boolean().optional().describe("leave it out: Testbot sets it when no source states this clause (contracts/clause-grounding.ts)")})),JW=p.object({spec:p.string().optional().describe("file:line of a spec in the repository"),prDescription:p.boolean().optional().describe("or true when a pull request description says otherwise"),reference:p.string().optional().describe("or the key of an item the run was given, as listed"),says:Ee.describe("what it says there, in its own words, copied exactly"),criterion:p.number().int().positive().optional().describe("an item's only: leave it out; Testbot numbers it")}).refine(e=>[!!e.prDescription,!!e.spec?.trim(),!!e.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`}),Cve=p.object({id:Ee.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:Ee,source:p.nativeEnum(ns).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:p.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:Ee.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:p.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"),alsoFrom:p.array(p.object({reference:Ee.regex($o).describe("the key of another uploaded document stating the same obligation"),says:Ee.describe("that document's own words, copied exactly; never infer equivalence from a shared criterion number"),criterion:p.number().int().positive().optional().describe("leave out; Testbot grounds and numbers this source separately")})).optional().describe("equivalent uploaded source criteria sharing this requirement's planned cases; retain every source with its own quote. Different conditions or boundaries need distinct requirements"),notInChange:p.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"),unchanged:p.boolean().optional().describe("true when it asks only that behaviour stay as it was (an update or refactor that must not change how something works), whatever its source"),overrules:p.array(JW).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:p.array(wve)}),HW=(r=>(r.ServerError="server-error",r.DataLost="data-lost",r.FinalState="final-state",r.DerivedValues="derived-values",r))(HW||{}),kve=p.object({id:Ee.describe('e.g. "F1"'),file:Ee,line:p.number().optional(),claim:Ee.describe("the defect, in one sentence"),severity:p.nativeEnum(Wc),evidence:Ee.describe("the code line, or the probe request and response, that shows it"),conflictsWith:p.array(Ee).optional().describe("requirement or clause ids it violates"),keeps:p.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:p.nativeEnum(HW).optional().describe("for a defect that breaks a rule every app keeps, which nothing needs to state: which one"),existing:p.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:p.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)")}),Sve=p.object({id:Ee.describe('e.g. "Q1"'),question:Ee.describe("what is unsettled, as a question the PR author can answer"),readings:p.array(Ee).min(2).describe("each reasonable behaviour, with what points to it (file:line, or the words that suggest it)"),about:p.string().optional().describe("the requirement or clause id it is about, when there is one"),sources:p.array(JW).optional().describe("when sources of the same rank disagree on it: each of them")}),Bve=p.object({id:Ee.describe('unique, a short kebab-case name for what the case checks, e.g. "ship-twice-409"'),type:p.nativeEnum(Js).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:Ee.describe('"METHOD /path", or the page / flow'),clause:p.string().optional().describe("the clause id this case checks"),finding:p.string().optional().describe("the finding id this case catches"),steps:Ee.describe("what the test does"),expected:Ee.describe("the expected outcome, from the clause"),mutates:p.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")}),Rve=p.object({test:Ee.describe("existing test file"),action:p.nativeEnum(ts),reason:Ee,mutates:p.boolean().optional().describe("true when the maintained test changes state"),clauses:p.array(Ee).optional().describe("the clause ids this test checks")}),qW=p.array(Mm).optional(),xve=p.object({components:p.preprocess(e=>qW.safeParse(e).success?e:void 0,qW).describe("when saving a new or changed recipe: every app and backing service actually brought up, its source repository, and whether it is healthy"),outcome:p.nativeEnum(Wr).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:p.record(p.string()).optional().describe("service \u2192 base URL of the running app"),health:p.object({url:p.string().optional(),command:p.string().optional(),output:p.string().optional()}).optional().describe("the check that shows the app serves real data, and what it returned"),teardown:p.string().optional().describe("command that stops the app"),dependencies:p.record(p.boolean()).optional().describe("every backing service: true = really running, false = mocked"),recipeFixes:p.array(p.string()).optional().describe("what you changed in the recipe"),error:p.string().optional().describe("when it did not come up: the failing command and what it printed"),suspectFiles:p.array(p.string()).optional().describe("change-broke-bringup: the changed files to blame"),login:p.object({username:Ee,password:p.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:bS.optional()}),BFe=p.object({schemaVersion:p.literal(1),requirements:p.array(Cve),findings:p.array(kve),cases:p.array(Bve).describe("a second test for a clause, and one case per finding that fails on this branch"),questions:p.array(Sve).optional().describe("behaviours the change leaves unsettled; no case asserts any of them"),maintenance:p.array(Rve),journeys:p.array(xW).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:p.array(p.object({clause:Ee,why:Ee})).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:p.array(p.object({components:p.array(Ee).min(1).describe("changed components, as the change lists them"),why:Ee})).optional().describe("changed components no clause reaches, and why their change needs no test; several may share one reason"),triage:FA.optional().describe("the validation triage decision, made before the app is started; its behaviorIds are clause ids"),app:xve.optional().describe("omit when no app was needed or none was started"),summary:Ee.describe("one paragraph: what the change does and where the risk is")});var LA=(n=>(n.Backend="backend",n.Ui="ui",n))(LA||{});var ra=(r=>(r.Added="added",r.Updated="updated",r.Deleted="deleted",r.Unchanged="unchanged",r))(ra||{}),Qve=p.object({file:Ee.describe("repo-relative path; in another repo of the change, that repo's directory name then its path"),kind:p.nativeEnum(LA),change:p.nativeEnum(ra).describe("added: a file you created; updated / deleted / unchanged: an existing test"),covers:p.array(p.string()).describe("the plan case ids this file tests, each with its own result under result.cases"),defect:p.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:p.object({requirement:Ee.describe("the requirement or clause id the change deliberately alters"),line:Ee.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 or deleted: why it is out of date"),result:p.object({exit:p.number().nullable().describe("exit code of your last run of this file; null if it could not be run"),cases:p.array(p.object({case:Ee,status:p.nativeEnum(Kr),runtimeTargets:uf.optional().describe("HTTP(S) URLs this case actually exercised in its current run, from its request or browser evidence; omit for local in-process/mocked checks, never list the shared app merely because it is configured"),defect:p.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:p.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:p.string().optional().describe("for a case you keep as a defect: path:line of the application code that makes it fail"),requires:p.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:p.string().optional().describe("what failed and why, or why it was not run"),noCases:p.string().optional().describe("for a failed run whose runner reported none of this file's tests (it failed to compile, import or collect): why")}),assertions:p.array(p.object({case:Ee,evidence:Ee})).optional().describe("per covered case, the assertion line that checks its expected outcome"),functions:p.array(p.object({name:Ee.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)"),cases:p.array(Ee).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:p.object({draft:p.union([p.string(),p.array(p.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:p.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:p.array(h0).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:Ee.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:zW.optional().describe("for a file you added or updated: whether the repo's CI will run it, and how you know"),run:vd.optional().describe(`for a file in ${Id}, 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, trx or jest-json to ${_n}, or go-test-json); Testbot runs it before write ends and re-runs the tests with it`)}),$ve=e=>{if(!e||typeof e!="object")return e;let{test:t,...n}=e;return typeof t=="string"&&t.trim()&&n.tests===void 0?{...n,tests:[t]}:e},Tve=p.preprocess($ve,p.object({description:Ee.describe("what is wrong and how to reproduce it: endpoint or page, input, what you got vs what was expected"),severity:p.nativeEnum(Wc).optional(),sourceFile:p.string().optional().describe("the app file at fault"),sourceLine:p.number().optional(),tests:p.array(Ee).optional().describe("every test file that fails because of it: a defect several tests show is one issue"),finding:p.string().optional().describe("the plan's finding id, when it is one"),requirements:p.array(Ee).optional().describe("the plan's requirement or clause ids it violates")})),RFe=p.object({schemaVersion:p.literal(1),tests:p.array(Qve),notWritten:p.array(p.object({case:Ee,reason:Ee,coveredBy:p.object({file:Ee.describe("the test file, relative to the working checkout; prefix a related checkout as for tests[].file"),name:Ee.describe("the test function as the runner names it within its file, without the file (test_x, TestClass::test_x, TestSuite/TestCase)")}).optional().describe("only for an existing test triage independently linked to this exact case: its exact runner name (including class or describe titles). Testbot must finish re-running it with every result passed. If your own test covers the case, include the case in its covers and function cases instead")})).describe("every plan case no test covers, and why"),journeys:p.array(Vv).optional().describe("one entry per planned user journey: the browser test that walks it end to end"),lint:p.object({command:p.string(),clean:p.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:p.array(p.object({package:Ee,manifest:Ee.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:Ee.optional().describe("owner/repo of the manifest's checkout; omit for the repo under test"),reason:Ee.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:p.array(Ee).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:p.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:p.object({message:Ee.describe("subject line at most 72 characters, following the repository's commit-message checks"),prTitle:Ee.describe("at most 72 characters, following the repository's PR-title checks"),prBody:Ee.describe("what the tests cover and what they found")}),report:p.object({summary:Ee.describe("1-2 sentences for the PR author: does the change do what it says?"),issues:p.array(Tve).describe("every defect the tests found"),nextSteps:p.array(p.string()),noTests:p.array(p.object({repository:Ee,reason:Ee.max(4096)})).max(1e3).optional().describe("each Change Set repository where no test was added or updated: its owner/repo and why, naming the other repository when its tests went there"),notesDeviation:p.string().trim().max(4096).optional().describe("when the Target notes say where tests go and a test you added went elsewhere: where it went, and why; omit otherwise")})});var xFe={added:"place",updated:"update",deleted:"delete",unchanged:"verify"};var WW=(i=>(i.Requirement="requirement",i.PrDescription="pr_description",i.Code="code",i))(WW||{}),mn=p.string().trim().min(1),_ve=p.object({expectation:mn.max(300).describe("the behavior this assertion pins, in words"),source:p.nativeEnum(WW),expected:mn.max(200).describe("the exact value or outcome asserted, as the test asserts it")}),Nve=p.object({file:mn.describe("path of the NEW test file you wrote, relative to its repository"),repository:mn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),framework:mn.describe("the framework the repository runs this file with: pytest, jest, vitest, node-test, or the name of any other"),run:vd.optional().describe(`for ${Id}: how the run executes only the tests in names, with the repository's own runner writing JUnit XML to {junit}`),covers:p.array(mn).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:p.array(mn).min(1).describe("the test functions/cases in the file that provide evidence for that behavior, as the framework names them"),assertions:p.array(_ve).min(1)}),jA=(n=>(n.Updated="updated",n.Deleted="deleted",n))(jA||{}),YW=300,Dve=p.object({file:mn.describe("path of the EXISTING test file you updated or deleted, relative to its repository"),repository:mn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),change:p.nativeEnum(jA),staleBecause:p.object({requirement:mn.describe("the requirement or clause id the change deliberately alters"),line:mn.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:p.preprocess(e=>typeof e=="string"?e.trim().slice(0,YW):e,mn.max(YW)).describe("what the change deliberately altered that made the test wrong")}),C0=p.object({schemaVersion:p.literal(1),tests:p.array(Nve),maintained:p.array(Dve).optional().describe("existing tests the change made stale that you updated or deleted; omit when there were none"),defectsNotTested:p.array(p.object({id:mn,reason:mn.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:p.array(Vv).optional().describe("one entry per planned user journey: the in-process test that walks it end to end"),journeysNotWritten:p.array(p.object({journey:mn,missing:mn.transform(e=>e.length>300?`${e.slice(0,299)}\u2026`:e)})).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:p.object({command:p.string(),clean:p.boolean()}).optional().describe("the linter/formatter you ran on your test files, if the repository has one you can run; omit otherwise"),commitMessage:mn.optional().describe("the commit message for your tests: a subject line of at most 72 characters, then what they cover")});var VA="generate-unit.json";function Uve(e){let{value:t,error:n}=Pt(e);if(n)return{errors:[n]};let{value:i,errors:r}=$n(C0,t);return r.length?{errors:r}:{output:i,errors:[]}}function Fve(e){return Uve(e.stdout)}var gOe=or("generate-unit-schema",(e,t)=>Fve(t));var Hv=String.raw`(?:node:)?(?:http|https|http2|net|tls|dgram)`,mOe=[[/\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+["']${Hv}["']|\bimport\s+["']${Hv}["']|require\(\s*["']${Hv}["']\s*\)|\bimport\(\s*["']${Hv}["']\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 POe=new Set(["targeted_unit","existing_evidence_sufficient"]);var ia=he(require("path"));var YOe={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var S0=e=>new Map((e??[]).flatMap(t=>t.file?[[of(t.key),t.file.name]]:[])),Vve=10*1024*1024,Gve=e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r4=(e,t)=>ia.join(ia.dirname(e),`${ia.basename(e,ia.extname(e))}${t}`),zve=e=>r4(e,".extracted.txt");var qve=e=>r4(e,".quotes.txt");function i4(e){return Gve(e.file)?zve(e.path):e.file?.mediaType==="application/pdf"?qve(e.path):e.path}var Yve="triage.json";var GMe=new Set(["existing_evidence","unaffected","existing_unit","new_unit","runtime"]),zMe={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 Wve(e){let{value:t,error:n}=Pt(e);if(n)return{errors:[n]};let{value:i,errors:r}=$n(FA,t);return r.length?{errors:r}:{triage:i,errors:[]}}function Zve(e){return Wve(e.stdout)}var qMe=or("triage-schema",(e,t)=>Zve(t));function Kve(e){let t=e.inputs?.pipeline;return t?e.state.stages[t==="two-step"?"plan":"triage"]:e.state.stages.triage??e.state.stages.plan}function B0(e){if(Kve(e)?.status==="passed")return Po(o4.join(e.outputsDir,Yve))}function R0(e){return AW(s0(e.inputs,st(e,`${yd}.json`),B0(e)?.sutRequired))}var JMe=new Set(["deploy","recommend","generate","generate-ui","adapt","generate-unit","native-run","finalize","deliver"]);bn();bn();function a4(e,t){return t?`<!-- skyramp-testbot-run: ${t} -->
|
|
197
197
|
${e}`:e}var u4=600,Yv=300;function c4(e){return typeof e=="string"?e.trim():e instanceof Buffer?e.toString("utf-8").trim():""}function Xve(e){let t=e,n=(typeof t?.message=="string"?t.message:String(e)).trim(),i=[c4(t?.stderr),c4(t?.stdout)].filter(Boolean);return i.length?[n.split(`
|
|
198
198
|
`)[0],...i].join(`
|
|
199
199
|
`):n}function l4(e,t,n,i=0){let r=e.join(t);if(r.length<=n)return r;let[s="",...o]=e;if(!o.length)return`${s.slice(0,n-1)}\u2026`;let a=s.length<=i?s:s.slice(0,Math.floor(n/3)),c=n-a.length-t.length-1;return`${a}${t}\u2026${o.join(t).slice(-c)}`}function d4(e,t){return l4(e.trim().split(`
|