@weppy/roblox-mcp 2.17.13 → 2.17.14

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/index.js CHANGED
@@ -242,7 +242,341 @@ run().catch(() => {
242
242
 
243
243
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of t.seen.entries()){let s=o[1];if(e===o[0]){a(o);continue}if(t.external){let l=t.external.registry.get(o[0])?.id;if(e!==o[0]&&l){a(o);continue}}if(t.metadataRegistry.get(o[0])?.id){a(o);continue}if(s.cycle){a(o);continue}if(s.count>1&&t.reused==="ref"){a(o);continue}}}function qo(t,e){let n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=o=>{let s=t.seen.get(o);if(s.ref===null)return;let c=s.def??s.schema,l={...c},u=s.ref;if(s.ref=null,u){r(u);let p=t.seen.get(u),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Object.assign(c,m),Object.assign(c,l),o._zod.parent===u)for(let g in c)g==="$ref"||g==="allOf"||g in l||delete c[g];if(m.$ref&&p.def)for(let g in c)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(c[g])===JSON.stringify(p.def[g])&&delete c[g]}let d=o._zod.parent;if(d&&d!==u){r(d);let p=t.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m]}t.override({zodSchema:o,jsonSchema:c,path:s.path??[]})};for(let o of[...t.seen.entries()].reverse())r(o[0]);let i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let o=t.external.registry.get(e)?.id;if(!o)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(o)}Object.assign(i,n.def??n.schema);let a=t.external?.defs??{};for(let o of t.seen.entries()){let s=o[1];s.def&&s.defId&&(a[s.defId]=s.def)}t.external||Object.keys(a).length>0&&(t.target==="draft-2020-12"?i.$defs=a:i.definitions=a);try{let o=JSON.parse(JSON.stringify(i));return Object.defineProperty(o,"~standard",{value:{...e["~standard"],jsonSchema:{input:nu(e,"input",t.processors),output:nu(e,"output",t.processors)}},enumerable:!1,writable:!1}),o}catch{throw new Error("Error converting schema to JSON.")}}function zn(t,e){let n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return zn(r.element,n);if(r.type==="set")return zn(r.valueType,n);if(r.type==="lazy")return zn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return zn(r.innerType,n);if(r.type==="intersection")return zn(r.left,n)||zn(r.right,n);if(r.type==="record"||r.type==="map")return zn(r.keyType,n)||zn(r.valueType,n);if(r.type==="pipe")return zn(r.in,n)||zn(r.out,n);if(r.type==="object"){for(let i in r.shape)if(zn(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(let i of r.options)if(zn(i,n))return!0;return!1}if(r.type==="tuple"){for(let i of r.items)if(zn(i,n))return!0;return!!(r.rest&&zn(r.rest,n))}return!1}var pk=(t,e={})=>n=>{let r=zo({...n,processors:e});return Ne(t,r),Fo(r,t),qo(r,t)},nu=(t,e,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=zo({...i??{},target:a,io:e,processors:n});return Ne(t,o),Fo(o,t),qo(o,t)};var die={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mk=(t,e,n,r)=>{let i=n;i.type="string";let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof a=="number"&&(i.minLength=a),typeof o=="number"&&(i.maxLength=o),s&&(i.format=die[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let u=[...c];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},fk=(t,e,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=t._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a=="number"&&(i.minimum=a,typeof u=="number"&&e.target!=="draft-04"&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o=="number"&&(i.maximum=o,typeof l=="number"&&e.target!=="draft-04"&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},gk=(t,e,n,r)=>{n.type="boolean"},hk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},yk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},vk=(t,e,n,r)=>{e.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},bk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},_k=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Sk=(t,e,n,r)=>{n.not={}},xk=(t,e,n,r)=>{},wk=(t,e,n,r)=>{},Ik=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Pk=(t,e,n,r)=>{let i=t._zod.def,a=Kp(i.entries);a.every(o=>typeof o=="number")&&(n.type="number"),a.every(o=>typeof o=="string")&&(n.type="string"),n.enum=a},Ck=(t,e,n,r)=>{let i=t._zod.def,a=[];for(let o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let o=a[0];n.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[o]:n.const=o}else a.every(o=>typeof o=="number")&&(n.type="number"),a.every(o=>typeof o=="string")&&(n.type="string"),a.every(o=>typeof o=="boolean")&&(n.type="boolean"),a.every(o=>o===null)&&(n.type="null"),n.enum=a},kk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Rk=(t,e,n,r)=>{let i=n,a=t._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=a.source},Ek=(t,e,n,r)=>{let i=n,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:c}=t._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(i,a)},Ak=(t,e,n,r)=>{n.type="boolean"},Tk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ok=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Dk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Nk=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},$k=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},jk=(t,e,n,r)=>{let i=n,a=t._zod.def,{minimum:o,maximum:s}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=Ne(a.element,e,{...r,path:[...r.path,"items"]})},Mk=(t,e,n,r)=>{let i=n,a=t._zod.def;i.type="object",i.properties={};let o=a.shape;for(let l in o)i.properties[l]=Ne(o[l],e,{...r,path:[...r.path,"properties",l]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(l=>{let u=a.shape[l]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type==="never"?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Ne(a.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},r_=(t,e,n,r)=>{let i=t._zod.def,a=i.inclusive===!1,o=i.options.map((s,c)=>Ne(s,e,{...r,path:[...r.path,a?"oneOf":"anyOf",c]}));a?n.oneOf=o:n.anyOf=o},Lk=(t,e,n,r)=>{let i=t._zod.def,a=Ne(i.left,e,{...r,path:[...r.path,"allOf",0]}),o=Ne(i.right,e,{...r,path:[...r.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c},Uk=(t,e,n,r)=>{let i=n,a=t._zod.def;i.type="array";let o=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=a.items.map((p,m)=>Ne(p,e,{...r,path:[...r.path,o,m]})),l=a.rest?Ne(a.rest,e,{...r,path:[...r.path,s,...e.target==="openapi-3.0"?[a.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=c,l&&(i.items=l)):e.target==="openapi-3.0"?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=t._zod.bag;typeof u=="number"&&(i.minItems=u),typeof d=="number"&&(i.maxItems=d)},zk=(t,e,n,r)=>{let i=n,a=t._zod.def;i.type="object";let o=a.keyType,c=o._zod.bag?.patterns;if(a.mode==="loose"&&c&&c.size>0){let u=Ne(a.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Ne(a.keyType,e,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=Ne(a.valueType,e,{...r,path:[...r.path,"additionalProperties"]});let l=o._zod.values;if(l){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},Fk=(t,e,n,r)=>{let i=t._zod.def,a=Ne(i.innerType,e,r),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},qk=(t,e,n,r)=>{let i=t._zod.def;Ne(i.innerType,e,r);let a=e.seen.get(t);a.ref=i.innerType},Bk=(t,e,n,r)=>{let i=t._zod.def;Ne(i.innerType,e,r);let a=e.seen.get(t);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Vk=(t,e,n,r)=>{let i=t._zod.def;Ne(i.innerType,e,r);let a=e.seen.get(t);a.ref=i.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Wk=(t,e,n,r)=>{let i=t._zod.def;Ne(i.innerType,e,r);let a=e.seen.get(t);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},Hk=(t,e,n,r)=>{let i=t._zod.def,a=e.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;Ne(a,e,r);let o=e.seen.get(t);o.ref=a},Zk=(t,e,n,r)=>{let i=t._zod.def;Ne(i.innerType,e,r);let a=e.seen.get(t);a.ref=i.innerType,n.readOnly=!0},Gk=(t,e,n,r)=>{let i=t._zod.def;Ne(i.innerType,e,r);let a=e.seen.get(t);a.ref=i.innerType},i_=(t,e,n,r)=>{let i=t._zod.def;Ne(i.innerType,e,r);let a=e.seen.get(t);a.ref=i.innerType},Jk=(t,e,n,r)=>{let i=t._zod.innerType;Ne(i,e,r);let a=e.seen.get(t);a.ref=i},n_={string:mk,number:fk,boolean:gk,bigint:hk,symbol:yk,null:vk,undefined:bk,void:_k,never:Sk,any:xk,unknown:wk,date:Ik,enum:Pk,literal:Ck,nan:kk,template_literal:Rk,file:Ek,success:Ak,custom:Tk,function:Ok,transform:Dk,map:Nk,set:$k,array:jk,object:Mk,union:r_,intersection:Lk,tuple:Uk,record:zk,nullable:Fk,nonoptional:qk,default:Bk,prefault:Vk,catch:Wk,pipe:Hk,readonly:Zk,promise:Gk,optional:i_,lazy:Jk};function ru(t,e){if("_idmap"in t){let r=t,i=zo({...e,processors:n_}),a={};for(let c of r._idmap.entries()){let[l,u]=c;Ne(u,i)}let o={},s={registry:r,uri:e?.uri,defs:a};i.external=s;for(let c of r._idmap.entries()){let[l,u]=c;Fo(i,u),o[l]=qo(i,u)}if(Object.keys(a).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:a}}return{schemas:o}}let n=zo({...e,processors:n_});return Ne(t,n),Fo(n,t),qo(n,t)}var a_=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let n=e?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=zo({processors:n_,target:n,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,n={path:[],schemaPath:[]}){return Ne(e,this.ctx,n)}emit(e,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),Fo(this.ctx,e);let r=qo(this.ctx,e),{"~standard":i,...a}=r;return a}};var F4={};var jm={};Pn(jm,{ZodAny:()=>hR,ZodArray:()=>_R,ZodBase64:()=>P_,ZodBase64URL:()=>C_,ZodBigInt:()=>lu,ZodBigIntFormat:()=>E_,ZodBoolean:()=>cu,ZodCIDRv4:()=>w_,ZodCIDRv6:()=>I_,ZodCUID:()=>h_,ZodCUID2:()=>y_,ZodCatch:()=>zR,ZodCodec:()=>$_,ZodCustom:()=>Hm,ZodCustomStringFormat:()=>ou,ZodDate:()=>Fm,ZodDefault:()=>NR,ZodDiscriminatedUnion:()=>xR,ZodE164:()=>k_,ZodEmail:()=>m_,ZodEmoji:()=>f_,ZodEnum:()=>iu,ZodExactOptional:()=>TR,ZodFile:()=>ER,ZodFunction:()=>JR,ZodGUID:()=>Mm,ZodIPv4:()=>S_,ZodIPv6:()=>x_,ZodIntersection:()=>wR,ZodJWT:()=>R_,ZodKSUID:()=>__,ZodLazy:()=>HR,ZodLiteral:()=>RR,ZodMAC:()=>pR,ZodMap:()=>CR,ZodNaN:()=>qR,ZodNanoID:()=>g_,ZodNever:()=>vR,ZodNonOptional:()=>D_,ZodNull:()=>gR,ZodNullable:()=>DR,ZodNumber:()=>su,ZodNumberFormat:()=>sc,ZodObject:()=>qm,ZodOptional:()=>O_,ZodPipe:()=>N_,ZodPrefault:()=>jR,ZodPromise:()=>GR,ZodReadonly:()=>BR,ZodRecord:()=>Wm,ZodSet:()=>kR,ZodString:()=>au,ZodStringFormat:()=>Be,ZodSuccess:()=>UR,ZodSymbol:()=>mR,ZodTemplateLiteral:()=>WR,ZodTransform:()=>AR,ZodTuple:()=>IR,ZodType:()=>ae,ZodULID:()=>v_,ZodURL:()=>zm,ZodUUID:()=>Ji,ZodUndefined:()=>fR,ZodUnion:()=>Bm,ZodUnknown:()=>yR,ZodVoid:()=>bR,ZodXID:()=>b_,ZodXor:()=>SR,_ZodString:()=>p_,_default:()=>$R,_function:()=>VU,any:()=>CU,array:()=>me,base64:()=>lU,base64url:()=>uU,bigint:()=>SU,boolean:()=>Tt,catch:()=>FR,check:()=>WU,cidrv4:()=>sU,cidrv6:()=>cU,codec:()=>FU,cuid:()=>Q4,cuid2:()=>eU,custom:()=>j_,date:()=>RU,describe:()=>HU,discriminatedUnion:()=>Vm,e164:()=>dU,email:()=>B4,emoji:()=>Y4,enum:()=>pn,exactOptional:()=>OR,file:()=>MU,float32:()=>yU,float64:()=>vU,function:()=>VU,guid:()=>V4,hash:()=>hU,hex:()=>gU,hostname:()=>fU,httpUrl:()=>K4,instanceof:()=>GU,int:()=>d_,int32:()=>bU,int64:()=>xU,intersection:()=>du,ipv4:()=>iU,ipv6:()=>oU,json:()=>KU,jwt:()=>pU,keyof:()=>EU,ksuid:()=>rU,lazy:()=>ZR,literal:()=>H,looseObject:()=>dn,looseRecord:()=>DU,mac:()=>aU,map:()=>NU,meta:()=>ZU,nan:()=>zU,nanoid:()=>X4,nativeEnum:()=>jU,never:()=>A_,nonoptional:()=>LR,null:()=>uu,nullable:()=>Lm,nullish:()=>LU,number:()=>Ae,object:()=>B,optional:()=>tt,partialRecord:()=>OU,pipe:()=>Um,prefault:()=>MR,preprocess:()=>Zm,promise:()=>BU,readonly:()=>VR,record:()=>Je,refine:()=>KR,set:()=>$U,strictObject:()=>AU,string:()=>E,stringFormat:()=>mU,stringbool:()=>JU,success:()=>UU,superRefine:()=>YR,symbol:()=>IU,templateLiteral:()=>qU,transform:()=>T_,tuple:()=>PR,uint32:()=>_U,uint64:()=>wU,ulid:()=>tU,undefined:()=>PU,union:()=>Ue,unknown:()=>Ve,url:()=>J4,uuid:()=>W4,uuidv4:()=>H4,uuidv6:()=>Z4,uuidv7:()=>G4,void:()=>kU,xid:()=>nU,xor:()=>TU});var o_={};Pn(o_,{endsWith:()=>ec,gt:()=>gi,gte:()=>un,includes:()=>Xs,length:()=>Uo,lowercase:()=>Ks,lt:()=>fi,lte:()=>Un,maxLength:()=>Lo,maxSize:()=>Ua,mime:()=>tc,minLength:()=>Gi,minSize:()=>hi,multipleOf:()=>La,negative:()=>Om,nonnegative:()=>Nm,nonpositive:()=>Dm,normalize:()=>nc,overwrite:()=>Wr,positive:()=>Tm,property:()=>$m,regex:()=>Js,size:()=>Mo,slugify:()=>tu,startsWith:()=>Qs,toLowerCase:()=>ic,toUpperCase:()=>ac,trim:()=>rc,uppercase:()=>Ys});var Bo={};Pn(Bo,{ZodISODate:()=>c_,ZodISODateTime:()=>s_,ZodISODuration:()=>u_,ZodISOTime:()=>l_,date:()=>Yk,datetime:()=>Kk,duration:()=>Qk,time:()=>Xk});var s_=I("ZodISODateTime",(t,e)=>{hv.init(t,e),Be.init(t,e)});function Kk(t){return xb(s_,t)}var c_=I("ZodISODate",(t,e)=>{yv.init(t,e),Be.init(t,e)});function Yk(t){return wb(c_,t)}var l_=I("ZodISOTime",(t,e)=>{vv.init(t,e),Be.init(t,e)});function Xk(t){return Ib(l_,t)}var u_=I("ZodISODuration",(t,e)=>{bv.init(t,e),Be.init(t,e)});function Qk(t){return Pb(u_,t)}var q4=(t,e)=>{tm.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>Ul(t,n)},flatten:{value:n=>Ll(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,$l,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,$l,2)}},isEmpty:{get(){return t.issues.length===0}}})},mie=I("ZodError",q4),ir=I("ZodError",q4,{Parent:Error});var eR=zl(ir),tR=ql(ir),nR=Vl(ir),rR=Wl(ir),iR=qy(ir),aR=By(ir),oR=Vy(ir),sR=Wy(ir),cR=Hy(ir),lR=Zy(ir),uR=Gy(ir),dR=Jy(ir);var ae=I("ZodType",(t,e)=>(te.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:nu(t,"input"),output:nu(t,"output")}}),t.toJSONSchema=pk(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone(O.mergeDefs(e,{checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),t.with=t.check,t.clone=(n,r)=>ln(t,n,r),t.brand=()=>t,t.register=(n,r)=>(n.add(t,r),t),t.parse=(n,r)=>eR(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>nR(t,n,r),t.parseAsync=async(n,r)=>tR(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>rR(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>iR(t,n,r),t.decode=(n,r)=>aR(t,n,r),t.encodeAsync=async(n,r)=>oR(t,n,r),t.decodeAsync=async(n,r)=>sR(t,n,r),t.safeEncode=(n,r)=>cR(t,n,r),t.safeDecode=(n,r)=>lR(t,n,r),t.safeEncodeAsync=async(n,r)=>uR(t,n,r),t.safeDecodeAsync=async(n,r)=>dR(t,n,r),t.refine=(n,r)=>t.check(KR(n,r)),t.superRefine=n=>t.check(YR(n)),t.overwrite=n=>t.check(Wr(n)),t.optional=()=>tt(t),t.exactOptional=()=>OR(t),t.nullable=()=>Lm(t),t.nullish=()=>tt(Lm(t)),t.nonoptional=n=>LR(t,n),t.array=()=>me(t),t.or=n=>Ue([t,n]),t.and=n=>du(t,n),t.transform=n=>Um(t,T_(n)),t.default=n=>$R(t,n),t.prefault=n=>MR(t,n),t.catch=n=>FR(t,n),t.pipe=n=>Um(t,n),t.readonly=()=>VR(t),t.describe=n=>{let r=t.clone();return Gt.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return Gt.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Gt.get(t);let r=t.clone();return Gt.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),p_=I("_ZodString",(t,e)=>{jo.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(r,i,a)=>mk(t,r,i,a);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(Js(...r)),t.includes=(...r)=>t.check(Xs(...r)),t.startsWith=(...r)=>t.check(Qs(...r)),t.endsWith=(...r)=>t.check(ec(...r)),t.min=(...r)=>t.check(Gi(...r)),t.max=(...r)=>t.check(Lo(...r)),t.length=(...r)=>t.check(Uo(...r)),t.nonempty=(...r)=>t.check(Gi(1,...r)),t.lowercase=r=>t.check(Ks(r)),t.uppercase=r=>t.check(Ys(r)),t.trim=()=>t.check(rc()),t.normalize=(...r)=>t.check(nc(...r)),t.toLowerCase=()=>t.check(ic()),t.toUpperCase=()=>t.check(ac()),t.slugify=()=>t.check(tu())}),au=I("ZodString",(t,e)=>{jo.init(t,e),p_.init(t,e),t.email=n=>t.check(dm(m_,n)),t.url=n=>t.check(eu(zm,n)),t.jwt=n=>t.check(Am(R_,n)),t.emoji=n=>t.check(hm(f_,n)),t.guid=n=>t.check(Ql(Mm,n)),t.uuid=n=>t.check(pm(Ji,n)),t.uuidv4=n=>t.check(mm(Ji,n)),t.uuidv6=n=>t.check(fm(Ji,n)),t.uuidv7=n=>t.check(gm(Ji,n)),t.nanoid=n=>t.check(ym(g_,n)),t.guid=n=>t.check(Ql(Mm,n)),t.cuid=n=>t.check(vm(h_,n)),t.cuid2=n=>t.check(bm(y_,n)),t.ulid=n=>t.check(_m(v_,n)),t.base64=n=>t.check(km(P_,n)),t.base64url=n=>t.check(Rm(C_,n)),t.xid=n=>t.check(Sm(b_,n)),t.ksuid=n=>t.check(xm(__,n)),t.ipv4=n=>t.check(wm(S_,n)),t.ipv6=n=>t.check(Im(x_,n)),t.cidrv4=n=>t.check(Pm(w_,n)),t.cidrv6=n=>t.check(Cm(I_,n)),t.e164=n=>t.check(Em(k_,n)),t.datetime=n=>t.check(Kk(n)),t.date=n=>t.check(Yk(n)),t.time=n=>t.check(Xk(n)),t.duration=n=>t.check(Qk(n))});function E(t){return vb(au,t)}var Be=I("ZodStringFormat",(t,e)=>{Le.init(t,e),p_.init(t,e)}),m_=I("ZodEmail",(t,e)=>{sv.init(t,e),Be.init(t,e)});function B4(t){return dm(m_,t)}var Mm=I("ZodGUID",(t,e)=>{av.init(t,e),Be.init(t,e)});function V4(t){return Ql(Mm,t)}var Ji=I("ZodUUID",(t,e)=>{ov.init(t,e),Be.init(t,e)});function W4(t){return pm(Ji,t)}function H4(t){return mm(Ji,t)}function Z4(t){return fm(Ji,t)}function G4(t){return gm(Ji,t)}var zm=I("ZodURL",(t,e)=>{cv.init(t,e),Be.init(t,e)});function J4(t){return eu(zm,t)}function K4(t){return eu(zm,{protocol:/^https?$/,hostname:rr.domain,...O.normalizeParams(t)})}var f_=I("ZodEmoji",(t,e)=>{lv.init(t,e),Be.init(t,e)});function Y4(t){return hm(f_,t)}var g_=I("ZodNanoID",(t,e)=>{uv.init(t,e),Be.init(t,e)});function X4(t){return ym(g_,t)}var h_=I("ZodCUID",(t,e)=>{dv.init(t,e),Be.init(t,e)});function Q4(t){return vm(h_,t)}var y_=I("ZodCUID2",(t,e)=>{pv.init(t,e),Be.init(t,e)});function eU(t){return bm(y_,t)}var v_=I("ZodULID",(t,e)=>{mv.init(t,e),Be.init(t,e)});function tU(t){return _m(v_,t)}var b_=I("ZodXID",(t,e)=>{fv.init(t,e),Be.init(t,e)});function nU(t){return Sm(b_,t)}var __=I("ZodKSUID",(t,e)=>{gv.init(t,e),Be.init(t,e)});function rU(t){return xm(__,t)}var S_=I("ZodIPv4",(t,e)=>{_v.init(t,e),Be.init(t,e)});function iU(t){return wm(S_,t)}var pR=I("ZodMAC",(t,e)=>{xv.init(t,e),Be.init(t,e)});function aU(t){return _b(pR,t)}var x_=I("ZodIPv6",(t,e)=>{Sv.init(t,e),Be.init(t,e)});function oU(t){return Im(x_,t)}var w_=I("ZodCIDRv4",(t,e)=>{wv.init(t,e),Be.init(t,e)});function sU(t){return Pm(w_,t)}var I_=I("ZodCIDRv6",(t,e)=>{Iv.init(t,e),Be.init(t,e)});function cU(t){return Cm(I_,t)}var P_=I("ZodBase64",(t,e)=>{Pv.init(t,e),Be.init(t,e)});function lU(t){return km(P_,t)}var C_=I("ZodBase64URL",(t,e)=>{Cv.init(t,e),Be.init(t,e)});function uU(t){return Rm(C_,t)}var k_=I("ZodE164",(t,e)=>{kv.init(t,e),Be.init(t,e)});function dU(t){return Em(k_,t)}var R_=I("ZodJWT",(t,e)=>{Rv.init(t,e),Be.init(t,e)});function pU(t){return Am(R_,t)}var ou=I("ZodCustomStringFormat",(t,e)=>{Ev.init(t,e),Be.init(t,e)});function mU(t,e,n={}){return oc(ou,t,e,n)}function fU(t){return oc(ou,"hostname",rr.hostname,t)}function gU(t){return oc(ou,"hex",rr.hex,t)}function hU(t,e){let n=e?.enc??"hex",r=`${t}_${n}`,i=rr[r];if(!i)throw new Error(`Unrecognized hash format: ${r}`);return oc(ou,r,i,e)}var su=I("ZodNumber",(t,e)=>{am.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(r,i,a)=>fk(t,r,i,a),t.gt=(r,i)=>t.check(gi(r,i)),t.gte=(r,i)=>t.check(un(r,i)),t.min=(r,i)=>t.check(un(r,i)),t.lt=(r,i)=>t.check(fi(r,i)),t.lte=(r,i)=>t.check(Un(r,i)),t.max=(r,i)=>t.check(Un(r,i)),t.int=r=>t.check(d_(r)),t.safe=r=>t.check(d_(r)),t.positive=r=>t.check(gi(0,r)),t.nonnegative=r=>t.check(un(0,r)),t.negative=r=>t.check(fi(0,r)),t.nonpositive=r=>t.check(Un(0,r)),t.multipleOf=(r,i)=>t.check(La(r,i)),t.step=(r,i)=>t.check(La(r,i)),t.finite=()=>t;let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Ae(t){return Cb(su,t)}var sc=I("ZodNumberFormat",(t,e)=>{Av.init(t,e),su.init(t,e)});function d_(t){return Rb(sc,t)}function yU(t){return Eb(sc,t)}function vU(t){return Ab(sc,t)}function bU(t){return Tb(sc,t)}function _U(t){return Ob(sc,t)}var cu=I("ZodBoolean",(t,e)=>{Gl.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>gk(t,n,r,i)});function Tt(t){return Db(cu,t)}var lu=I("ZodBigInt",(t,e)=>{om.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(r,i,a)=>hk(t,r,i,a),t.gte=(r,i)=>t.check(un(r,i)),t.min=(r,i)=>t.check(un(r,i)),t.gt=(r,i)=>t.check(gi(r,i)),t.gte=(r,i)=>t.check(un(r,i)),t.min=(r,i)=>t.check(un(r,i)),t.lt=(r,i)=>t.check(fi(r,i)),t.lte=(r,i)=>t.check(Un(r,i)),t.max=(r,i)=>t.check(Un(r,i)),t.positive=r=>t.check(gi(BigInt(0),r)),t.negative=r=>t.check(fi(BigInt(0),r)),t.nonpositive=r=>t.check(Un(BigInt(0),r)),t.nonnegative=r=>t.check(un(BigInt(0),r)),t.multipleOf=(r,i)=>t.check(La(r,i));let n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null});function SU(t){return $b(lu,t)}var E_=I("ZodBigIntFormat",(t,e)=>{Tv.init(t,e),lu.init(t,e)});function xU(t){return Mb(E_,t)}function wU(t){return Lb(E_,t)}var mR=I("ZodSymbol",(t,e)=>{Ov.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>yk(t,n,r,i)});function IU(t){return Ub(mR,t)}var fR=I("ZodUndefined",(t,e)=>{Dv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>bk(t,n,r,i)});function PU(t){return zb(fR,t)}var gR=I("ZodNull",(t,e)=>{Nv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>vk(t,n,r,i)});function uu(t){return Fb(gR,t)}var hR=I("ZodAny",(t,e)=>{$v.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>xk(t,n,r,i)});function CU(){return qb(hR)}var yR=I("ZodUnknown",(t,e)=>{jv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>wk(t,n,r,i)});function Ve(){return Bb(yR)}var vR=I("ZodNever",(t,e)=>{Mv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Sk(t,n,r,i)});function A_(t){return Vb(vR,t)}var bR=I("ZodVoid",(t,e)=>{Lv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>_k(t,n,r,i)});function kU(t){return Wb(bR,t)}var Fm=I("ZodDate",(t,e)=>{Uv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(r,i,a)=>Ik(t,r,i,a),t.min=(r,i)=>t.check(un(r,i)),t.max=(r,i)=>t.check(Un(r,i));let n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null});function RU(t){return Hb(Fm,t)}var _R=I("ZodArray",(t,e)=>{zv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>jk(t,n,r,i),t.element=e.element,t.min=(n,r)=>t.check(Gi(n,r)),t.nonempty=n=>t.check(Gi(1,n)),t.max=(n,r)=>t.check(Lo(n,r)),t.length=(n,r)=>t.check(Uo(n,r)),t.unwrap=()=>t.element});function me(t,e){return dk(_R,t,e)}function EU(t){let e=t._zod.def.shape;return pn(Object.keys(e))}var qm=I("ZodObject",(t,e)=>{uk.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Mk(t,n,r,i),O.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>pn(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ve()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ve()}),t.strict=()=>t.clone({...t._zod.def,catchall:A_()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>O.extend(t,n),t.safeExtend=n=>O.safeExtend(t,n),t.merge=n=>O.merge(t,n),t.pick=n=>O.pick(t,n),t.omit=n=>O.omit(t,n),t.partial=(...n)=>O.partial(O_,t,n[0]),t.required=(...n)=>O.required(D_,t,n[0])});function B(t,e){let n={type:"object",shape:t??{},...O.normalizeParams(e)};return new qm(n)}function AU(t,e){return new qm({type:"object",shape:t,catchall:A_(),...O.normalizeParams(e)})}function dn(t,e){return new qm({type:"object",shape:t,catchall:Ve(),...O.normalizeParams(e)})}var Bm=I("ZodUnion",(t,e)=>{Jl.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>r_(t,n,r,i),t.options=e.options});function Ue(t,e){return new Bm({type:"union",options:t,...O.normalizeParams(e)})}var SR=I("ZodXor",(t,e)=>{Bm.init(t,e),Fv.init(t,e),t._zod.processJSONSchema=(n,r,i)=>r_(t,n,r,i),t.options=e.options});function TU(t,e){return new SR({type:"union",options:t,inclusive:!1,...O.normalizeParams(e)})}var xR=I("ZodDiscriminatedUnion",(t,e)=>{Bm.init(t,e),qv.init(t,e)});function Vm(t,e,n){return new xR({type:"union",options:e,discriminator:t,...O.normalizeParams(n)})}var wR=I("ZodIntersection",(t,e)=>{Bv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Lk(t,n,r,i)});function du(t,e){return new wR({type:"intersection",left:t,right:e})}var IR=I("ZodTuple",(t,e)=>{sm.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Uk(t,n,r,i),t.rest=n=>t.clone({...t._zod.def,rest:n})});function PR(t,e,n){let r=e instanceof te,i=r?n:e,a=r?e:null;return new IR({type:"tuple",items:t,rest:a,...O.normalizeParams(i)})}var Wm=I("ZodRecord",(t,e)=>{Vv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>zk(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType});function Je(t,e,n){return new Wm({type:"record",keyType:t,valueType:e,...O.normalizeParams(n)})}function OU(t,e,n){let r=ln(t);return r._zod.values=void 0,new Wm({type:"record",keyType:r,valueType:e,...O.normalizeParams(n)})}function DU(t,e,n){return new Wm({type:"record",keyType:t,valueType:e,mode:"loose",...O.normalizeParams(n)})}var CR=I("ZodMap",(t,e)=>{Wv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Nk(t,n,r,i),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...n)=>t.check(hi(...n)),t.nonempty=n=>t.check(hi(1,n)),t.max=(...n)=>t.check(Ua(...n)),t.size=(...n)=>t.check(Mo(...n))});function NU(t,e,n){return new CR({type:"map",keyType:t,valueType:e,...O.normalizeParams(n)})}var kR=I("ZodSet",(t,e)=>{Hv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>$k(t,n,r,i),t.min=(...n)=>t.check(hi(...n)),t.nonempty=n=>t.check(hi(1,n)),t.max=(...n)=>t.check(Ua(...n)),t.size=(...n)=>t.check(Mo(...n))});function $U(t,e){return new kR({type:"set",valueType:t,...O.normalizeParams(e)})}var iu=I("ZodEnum",(t,e)=>{Zv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(r,i,a)=>Pk(t,r,i,a),t.enum=e.entries,t.options=Object.values(e.entries);let n=new Set(Object.keys(e.entries));t.extract=(r,i)=>{let a={};for(let o of r)if(n.has(o))a[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new iu({...e,checks:[],...O.normalizeParams(i),entries:a})},t.exclude=(r,i)=>{let a={...e.entries};for(let o of r)if(n.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new iu({...e,checks:[],...O.normalizeParams(i),entries:a})}});function pn(t,e){let n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new iu({type:"enum",entries:n,...O.normalizeParams(e)})}function jU(t,e){return new iu({type:"enum",entries:t,...O.normalizeParams(e)})}var RR=I("ZodLiteral",(t,e)=>{Gv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Ck(t,n,r,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function H(t,e){return new RR({type:"literal",values:Array.isArray(t)?t:[t],...O.normalizeParams(e)})}var ER=I("ZodFile",(t,e)=>{Jv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Ek(t,n,r,i),t.min=(n,r)=>t.check(hi(n,r)),t.max=(n,r)=>t.check(Ua(n,r)),t.mime=(n,r)=>t.check(tc(Array.isArray(n)?n:[n],r))});function MU(t){return Jb(ER,t)}var AR=I("ZodTransform",(t,e)=>{Kv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Dk(t,n,r,i),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new To(t.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(O.issue(a,n.value,e));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),n.issues.push(O.issue(o))}};let i=e.transform(n.value,n);return i instanceof Promise?i.then(a=>(n.value=a,n)):(n.value=i,n)}});function T_(t){return new AR({type:"transform",transform:t})}var O_=I("ZodOptional",(t,e)=>{cm.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>i_(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function tt(t){return new O_({type:"optional",innerType:t})}var TR=I("ZodExactOptional",(t,e)=>{Yv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>i_(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function OR(t){return new TR({type:"optional",innerType:t})}var DR=I("ZodNullable",(t,e)=>{Xv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Fk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function Lm(t){return new DR({type:"nullable",innerType:t})}function LU(t){return tt(Lm(t))}var NR=I("ZodDefault",(t,e)=>{Qv.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Bk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function $R(t,e){return new NR({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():O.shallowClone(e)}})}var jR=I("ZodPrefault",(t,e)=>{eb.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Vk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function MR(t,e){return new jR({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():O.shallowClone(e)}})}var D_=I("ZodNonOptional",(t,e)=>{tb.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>qk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function LR(t,e){return new D_({type:"nonoptional",innerType:t,...O.normalizeParams(e)})}var UR=I("ZodSuccess",(t,e)=>{nb.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Ak(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function UU(t){return new UR({type:"success",innerType:t})}var zR=I("ZodCatch",(t,e)=>{rb.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Wk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function FR(t,e){return new zR({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var qR=I("ZodNaN",(t,e)=>{ib.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>kk(t,n,r,i)});function zU(t){return Gb(qR,t)}var N_=I("ZodPipe",(t,e)=>{ab.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Hk(t,n,r,i),t.in=e.in,t.out=e.out});function Um(t,e){return new N_({type:"pipe",in:t,out:e})}var $_=I("ZodCodec",(t,e)=>{N_.init(t,e),Kl.init(t,e)});function FU(t,e,n){return new $_({type:"pipe",in:t,out:e,transform:n.decode,reverseTransform:n.encode})}var BR=I("ZodReadonly",(t,e)=>{ob.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Zk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function VR(t){return new BR({type:"readonly",innerType:t})}var WR=I("ZodTemplateLiteral",(t,e)=>{sb.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Rk(t,n,r,i)});function qU(t,e){return new WR({type:"template_literal",parts:t,...O.normalizeParams(e)})}var HR=I("ZodLazy",(t,e)=>{ub.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Jk(t,n,r,i),t.unwrap=()=>t._zod.def.getter()});function ZR(t){return new HR({type:"lazy",getter:t})}var GR=I("ZodPromise",(t,e)=>{lb.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Gk(t,n,r,i),t.unwrap=()=>t._zod.def.innerType});function BU(t){return new GR({type:"promise",innerType:t})}var JR=I("ZodFunction",(t,e)=>{cb.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Ok(t,n,r,i)});function VU(t){return new JR({type:"function",input:Array.isArray(t?.input)?PR(t?.input):t?.input??me(Ve()),output:t?.output??Ve()})}var Hm=I("ZodCustom",(t,e)=>{db.init(t,e),ae.init(t,e),t._zod.processJSONSchema=(n,r,i)=>Tk(t,n,r,i)});function WU(t){let e=new qe({check:"custom"});return e._zod.check=t,e}function j_(t,e){return Kb(Hm,t??(()=>!0),e)}function KR(t,e={}){return Yb(Hm,t,e)}function YR(t){return Xb(t)}var HU=Qb,ZU=e_;function GU(t,e={}){let n=new Hm({type:"custom",check:"custom",fn:r=>r instanceof t,abort:!0,...O.normalizeParams(e)});return n._zod.bag.Class=t,n._zod.check=r=>{r.value instanceof t||r.issues.push({code:"invalid_type",expected:t.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var JU=(...t)=>t_({Codec:$_,Boolean:cu,String:au},...t);function KU(t){let e=ZR(()=>Ue([E(t),Ae(),Tt(),uu(),me(e),Je(E(),e)]));return e}function Zm(t,e){return Um(T_(t),e)}var gie={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function hie(t){ht({customError:t})}function yie(){return ht().customError}var XR;XR||(XR={});var U={...jm,...o_,iso:Bo},vie=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function bie(t,e){let n=t.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function _ie(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=t.slice(1).split("/").filter(Boolean);if(n.length===0)return e.rootSchema;let r=e.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let i=n[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${t}`);return e.defs[i]}throw new Error(`Reference not found: ${t}`)}function YU(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return U.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let i=t.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return U.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let a=_ie(i,e),o=kn(a,e);return e.refs.set(i,o),e.processing.delete(i),o}if(t.enum!==void 0){let i=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&i.length===1&&i[0]===null)return U.null();if(i.length===0)return U.never();if(i.length===1)return U.literal(i[0]);if(i.every(o=>typeof o=="string"))return U.enum(i);let a=i.map(o=>U.literal(o));return a.length<2?a[0]:U.union([a[0],a[1],...a.slice(2)])}if(t.const!==void 0)return U.literal(t.const);let n=t.type;if(Array.isArray(n)){let i=n.map(a=>{let o={...t,type:a};return YU(o,e)});return i.length===0?U.never():i.length===1?i[0]:U.union(i)}if(!n)return U.any();let r;switch(n){case"string":{let i=U.string();if(t.format){let a=t.format;a==="email"?i=i.check(U.email()):a==="uri"||a==="uri-reference"?i=i.check(U.url()):a==="uuid"||a==="guid"?i=i.check(U.uuid()):a==="date-time"?i=i.check(U.iso.datetime()):a==="date"?i=i.check(U.iso.date()):a==="time"?i=i.check(U.iso.time()):a==="duration"?i=i.check(U.iso.duration()):a==="ipv4"?i=i.check(U.ipv4()):a==="ipv6"?i=i.check(U.ipv6()):a==="mac"?i=i.check(U.mac()):a==="cidr"?i=i.check(U.cidrv4()):a==="cidr-v6"?i=i.check(U.cidrv6()):a==="base64"?i=i.check(U.base64()):a==="base64url"?i=i.check(U.base64url()):a==="e164"?i=i.check(U.e164()):a==="jwt"?i=i.check(U.jwt()):a==="emoji"?i=i.check(U.emoji()):a==="nanoid"?i=i.check(U.nanoid()):a==="cuid"?i=i.check(U.cuid()):a==="cuid2"?i=i.check(U.cuid2()):a==="ulid"?i=i.check(U.ulid()):a==="xid"?i=i.check(U.xid()):a==="ksuid"&&(i=i.check(U.ksuid()))}typeof t.minLength=="number"&&(i=i.min(t.minLength)),typeof t.maxLength=="number"&&(i=i.max(t.maxLength)),t.pattern&&(i=i.regex(new RegExp(t.pattern))),r=i;break}case"number":case"integer":{let i=n==="integer"?U.number().int():U.number();typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),typeof t.exclusiveMinimum=="number"?i=i.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(i=i.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?i=i.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(i=i.lt(t.maximum)),typeof t.multipleOf=="number"&&(i=i.multipleOf(t.multipleOf)),r=i;break}case"boolean":{r=U.boolean();break}case"null":{r=U.null();break}case"object":{let i={},a=t.properties||{},o=new Set(t.required||[]);for(let[c,l]of Object.entries(a)){let u=kn(l,e);i[c]=o.has(c)?u:u.optional()}if(t.propertyNames){let c=kn(t.propertyNames,e),l=t.additionalProperties&&typeof t.additionalProperties=="object"?kn(t.additionalProperties,e):U.any();if(Object.keys(i).length===0){r=U.record(c,l);break}let u=U.object(i).passthrough(),d=U.looseRecord(c,l);r=U.intersection(u,d);break}if(t.patternProperties){let c=t.patternProperties,l=Object.keys(c),u=[];for(let p of l){let m=kn(c[p],e),f=U.string().regex(new RegExp(p));u.push(U.looseRecord(f,m))}let d=[];if(Object.keys(i).length>0&&d.push(U.object(i).passthrough()),d.push(...u),d.length===0)r=U.object({}).passthrough();else if(d.length===1)r=d[0];else{let p=U.intersection(d[0],d[1]);for(let m=2;m<d.length;m++)p=U.intersection(p,d[m]);r=p}break}let s=U.object(i);t.additionalProperties===!1?r=s.strict():typeof t.additionalProperties=="object"?r=s.catchall(kn(t.additionalProperties,e)):r=s.passthrough();break}case"array":{let i=t.prefixItems,a=t.items;if(i&&Array.isArray(i)){let o=i.map(c=>kn(c,e)),s=a&&typeof a=="object"&&!Array.isArray(a)?kn(a,e):void 0;s?r=U.tuple(o).rest(s):r=U.tuple(o),typeof t.minItems=="number"&&(r=r.check(U.minLength(t.minItems))),typeof t.maxItems=="number"&&(r=r.check(U.maxLength(t.maxItems)))}else if(Array.isArray(a)){let o=a.map(c=>kn(c,e)),s=t.additionalItems&&typeof t.additionalItems=="object"?kn(t.additionalItems,e):void 0;s?r=U.tuple(o).rest(s):r=U.tuple(o),typeof t.minItems=="number"&&(r=r.check(U.minLength(t.minItems))),typeof t.maxItems=="number"&&(r=r.check(U.maxLength(t.maxItems)))}else if(a!==void 0){let o=kn(a,e),s=U.array(o);typeof t.minItems=="number"&&(s=s.min(t.minItems)),typeof t.maxItems=="number"&&(s=s.max(t.maxItems)),r=s}else r=U.array(U.any());break}default:throw new Error(`Unsupported type: ${n}`)}return t.description&&(r=r.describe(t.description)),t.default!==void 0&&(r=r.default(t.default)),r}function kn(t,e){if(typeof t=="boolean")return t?U.any():U.never();let n=YU(t,e),r=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let s=t.anyOf.map(l=>kn(l,e)),c=U.union(s);n=r?U.intersection(n,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let s=t.oneOf.map(l=>kn(l,e)),c=U.xor(s);n=r?U.intersection(n,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)n=r?n:U.any();else{let s=r?n:kn(t.allOf[0],e),c=r?0:1;for(let l=c;l<t.allOf.length;l++)s=U.intersection(s,kn(t.allOf[l],e));n=s}t.nullable===!0&&e.version==="openapi-3.0"&&(n=U.nullable(n)),t.readOnly===!0&&(n=U.readonly(n));let i={},a=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of a)s in t&&(i[s]=t[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in t&&(i[s]=t[s]);for(let s of Object.keys(t))vie.has(s)||(i[s]=t[s]);return Object.keys(i).length>0&&e.registry.add(n,i),n}function XU(t,e){if(typeof t=="boolean")return t?U.any():U.never();let n=bie(t,e?.defaultTarget),r=t.$defs||t.definitions||{},i={version:n,defs:r,refs:new Map,processing:new Set,rootSchema:t,registry:e?.registry??Gt};return kn(t,i)}var QR={};Pn(QR,{bigint:()=>Iie,boolean:()=>wie,date:()=>Pie,number:()=>xie,string:()=>Sie});function Sie(t){return bb(au,t)}function xie(t){return kb(su,t)}function wie(t){return Nb(cu,t)}function Iie(t){return jb(lu,t)}function Pie(t){return Zb(Fm,t)}ht(pb());var tE="2025-11-25";var QU=[tE,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Vo="io.modelcontextprotocol/related-task",L_="2.0",mn=j_(t=>t!==null&&(typeof t=="object"||typeof t=="function")),ez=Ue([E(),Ae().int()]),tz=E(),gqe=dn({ttl:Ue([Ae(),uu()]).optional(),pollInterval:Ae().optional()}),kie=B({ttl:Ae().optional()}),Rie=B({taskId:E()}),nE=dn({progressToken:ez.optional(),[Vo]:Rie.optional()}),Cr=B({_meta:nE.optional()}),Gm=Cr.extend({task:kie.optional()}),nz=t=>Gm.safeParse(t).success,fn=B({method:E(),params:Cr.loose().optional()}),Hr=B({_meta:nE.optional()}),Zr=B({method:E(),params:Hr.loose().optional()}),gn=dn({_meta:nE.optional()}),U_=Ue([E(),Ae().int()]),rz=B({jsonrpc:H(L_),id:U_,...fn.shape}).strict(),rE=t=>rz.safeParse(t).success,iz=B({jsonrpc:H(L_),...Zr.shape}).strict(),az=t=>iz.safeParse(t).success,iE=B({jsonrpc:H(L_),id:U_,result:gn}).strict(),Jm=t=>iE.safeParse(t).success;var xe;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(xe||(xe={}));var aE=B({jsonrpc:H(L_),id:U_.optional(),error:B({code:Ae().int(),message:E(),data:Ve().optional()})}).strict();var oz=t=>aE.safeParse(t).success;var sz=Ue([rz,iz,iE,aE]),hqe=Ue([iE,aE]),z_=gn.strict(),Eie=Hr.extend({requestId:U_.optional(),reason:E().optional()}),F_=Zr.extend({method:H("notifications/cancelled"),params:Eie}),Aie=B({src:E(),mimeType:E().optional(),sizes:me(E()).optional(),theme:pn(["light","dark"]).optional()}),Km=B({icons:me(Aie).optional()}),pu=B({name:E(),title:E().optional()}),cz=pu.extend({...pu.shape,...Km.shape,version:E(),websiteUrl:E().optional(),description:E().optional()}),Tie=du(B({applyDefaults:Tt().optional()}),Je(E(),Ve())),Oie=Zm(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,du(B({form:Tie.optional(),url:mn.optional()}),Je(E(),Ve()).optional())),Die=dn({list:mn.optional(),cancel:mn.optional(),requests:dn({sampling:dn({createMessage:mn.optional()}).optional(),elicitation:dn({create:mn.optional()}).optional()}).optional()}),Nie=dn({list:mn.optional(),cancel:mn.optional(),requests:dn({tools:dn({call:mn.optional()}).optional()}).optional()}),$ie=B({experimental:Je(E(),mn).optional(),sampling:B({context:mn.optional(),tools:mn.optional()}).optional(),elicitation:Oie.optional(),roots:B({listChanged:Tt().optional()}).optional(),tasks:Die.optional()}),jie=Cr.extend({protocolVersion:E(),capabilities:$ie,clientInfo:cz}),oE=fn.extend({method:H("initialize"),params:jie});var Mie=B({experimental:Je(E(),mn).optional(),logging:mn.optional(),completions:mn.optional(),prompts:B({listChanged:Tt().optional()}).optional(),resources:B({subscribe:Tt().optional(),listChanged:Tt().optional()}).optional(),tools:B({listChanged:Tt().optional()}).optional(),tasks:Nie.optional()}),Lie=gn.extend({protocolVersion:E(),capabilities:Mie,serverInfo:cz,instructions:E().optional()}),sE=Zr.extend({method:H("notifications/initialized"),params:Hr.optional()});var q_=fn.extend({method:H("ping"),params:Cr.optional()}),Uie=B({progress:Ae(),total:tt(Ae()),message:tt(E())}),zie=B({...Hr.shape,...Uie.shape,progressToken:ez}),B_=Zr.extend({method:H("notifications/progress"),params:zie}),Fie=Cr.extend({cursor:tz.optional()}),Ym=fn.extend({params:Fie.optional()}),Xm=gn.extend({nextCursor:tz.optional()}),qie=pn(["working","input_required","completed","failed","cancelled"]),Qm=B({taskId:E(),status:qie,ttl:Ue([Ae(),uu()]),createdAt:E(),lastUpdatedAt:E(),pollInterval:tt(Ae()),statusMessage:tt(E())}),mu=gn.extend({task:Qm}),Bie=Hr.merge(Qm),ef=Zr.extend({method:H("notifications/tasks/status"),params:Bie}),V_=fn.extend({method:H("tasks/get"),params:Cr.extend({taskId:E()})}),W_=gn.merge(Qm),H_=fn.extend({method:H("tasks/result"),params:Cr.extend({taskId:E()})}),yqe=gn.loose(),Z_=Ym.extend({method:H("tasks/list")}),G_=Xm.extend({tasks:me(Qm)}),J_=fn.extend({method:H("tasks/cancel"),params:Cr.extend({taskId:E()})}),lz=gn.merge(Qm),uz=B({uri:E(),mimeType:tt(E()),_meta:Je(E(),Ve()).optional()}),dz=uz.extend({text:E()}),cE=E().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),pz=uz.extend({blob:cE}),tf=pn(["user","assistant"]),fu=B({audience:me(tf).optional(),priority:Ae().min(0).max(1).optional(),lastModified:Bo.datetime({offset:!0}).optional()}),mz=B({...pu.shape,...Km.shape,uri:E(),description:tt(E()),mimeType:tt(E()),annotations:fu.optional(),_meta:tt(dn({}))}),Vie=B({...pu.shape,...Km.shape,uriTemplate:E(),description:tt(E()),mimeType:tt(E()),annotations:fu.optional(),_meta:tt(dn({}))}),lE=Ym.extend({method:H("resources/list")}),Wie=Xm.extend({resources:me(mz)}),Hie=Ym.extend({method:H("resources/templates/list")}),Zie=Xm.extend({resourceTemplates:me(Vie)}),uE=Cr.extend({uri:E()}),Gie=uE,dE=fn.extend({method:H("resources/read"),params:Gie}),Jie=gn.extend({contents:me(Ue([dz,pz]))}),Kie=Zr.extend({method:H("notifications/resources/list_changed"),params:Hr.optional()}),Yie=uE,Xie=fn.extend({method:H("resources/subscribe"),params:Yie}),Qie=uE,eae=fn.extend({method:H("resources/unsubscribe"),params:Qie}),tae=Hr.extend({uri:E()}),nae=Zr.extend({method:H("notifications/resources/updated"),params:tae}),rae=B({name:E(),description:tt(E()),required:tt(Tt())}),iae=B({...pu.shape,...Km.shape,description:tt(E()),arguments:tt(me(rae)),_meta:tt(dn({}))}),aae=Ym.extend({method:H("prompts/list")}),oae=Xm.extend({prompts:me(iae)}),sae=Cr.extend({name:E(),arguments:Je(E(),E()).optional()}),cae=fn.extend({method:H("prompts/get"),params:sae}),pE=B({type:H("text"),text:E(),annotations:fu.optional(),_meta:Je(E(),Ve()).optional()}),mE=B({type:H("image"),data:cE,mimeType:E(),annotations:fu.optional(),_meta:Je(E(),Ve()).optional()}),fE=B({type:H("audio"),data:cE,mimeType:E(),annotations:fu.optional(),_meta:Je(E(),Ve()).optional()}),lae=B({type:H("tool_use"),name:E(),id:E(),input:Je(E(),Ve()),_meta:Je(E(),Ve()).optional()}),uae=B({type:H("resource"),resource:Ue([dz,pz]),annotations:fu.optional(),_meta:Je(E(),Ve()).optional()}),dae=mz.extend({type:H("resource_link")}),gE=Ue([pE,mE,fE,dae,uae]),pae=B({role:tf,content:gE}),mae=gn.extend({description:E().optional(),messages:me(pae)}),fae=Zr.extend({method:H("notifications/prompts/list_changed"),params:Hr.optional()}),gae=B({title:E().optional(),readOnlyHint:Tt().optional(),destructiveHint:Tt().optional(),idempotentHint:Tt().optional(),openWorldHint:Tt().optional()}),hae=B({taskSupport:pn(["required","optional","forbidden"]).optional()}),fz=B({...pu.shape,...Km.shape,description:E().optional(),inputSchema:B({type:H("object"),properties:Je(E(),mn).optional(),required:me(E()).optional()}).catchall(Ve()),outputSchema:B({type:H("object"),properties:Je(E(),mn).optional(),required:me(E()).optional()}).catchall(Ve()).optional(),annotations:gae.optional(),execution:hae.optional(),_meta:Je(E(),Ve()).optional()}),hE=Ym.extend({method:H("tools/list")}),yae=Xm.extend({tools:me(fz)}),K_=gn.extend({content:me(gE).default([]),structuredContent:Je(E(),Ve()).optional(),isError:Tt().optional()}),vqe=K_.or(gn.extend({toolResult:Ve()})),vae=Gm.extend({name:E(),arguments:Je(E(),Ve()).optional()}),nf=fn.extend({method:H("tools/call"),params:vae}),bae=Zr.extend({method:H("notifications/tools/list_changed"),params:Hr.optional()}),bqe=B({autoRefresh:Tt().default(!0),debounceMs:Ae().int().nonnegative().default(300)}),rf=pn(["debug","info","notice","warning","error","critical","alert","emergency"]),_ae=Cr.extend({level:rf}),yE=fn.extend({method:H("logging/setLevel"),params:_ae}),Sae=Hr.extend({level:rf,logger:E().optional(),data:Ve()}),xae=Zr.extend({method:H("notifications/message"),params:Sae}),wae=B({name:E().optional()}),Iae=B({hints:me(wae).optional(),costPriority:Ae().min(0).max(1).optional(),speedPriority:Ae().min(0).max(1).optional(),intelligencePriority:Ae().min(0).max(1).optional()}),Pae=B({mode:pn(["auto","required","none"]).optional()}),Cae=B({type:H("tool_result"),toolUseId:E().describe("The unique identifier for the corresponding tool call."),content:me(gE).default([]),structuredContent:B({}).loose().optional(),isError:Tt().optional(),_meta:Je(E(),Ve()).optional()}),kae=Vm("type",[pE,mE,fE]),M_=Vm("type",[pE,mE,fE,lae,Cae]),Rae=B({role:tf,content:Ue([M_,me(M_)]),_meta:Je(E(),Ve()).optional()}),Eae=Gm.extend({messages:me(Rae),modelPreferences:Iae.optional(),systemPrompt:E().optional(),includeContext:pn(["none","thisServer","allServers"]).optional(),temperature:Ae().optional(),maxTokens:Ae().int(),stopSequences:me(E()).optional(),metadata:mn.optional(),tools:me(fz).optional(),toolChoice:Pae.optional()}),Aae=fn.extend({method:H("sampling/createMessage"),params:Eae}),vE=gn.extend({model:E(),stopReason:tt(pn(["endTurn","stopSequence","maxTokens"]).or(E())),role:tf,content:kae}),bE=gn.extend({model:E(),stopReason:tt(pn(["endTurn","stopSequence","maxTokens","toolUse"]).or(E())),role:tf,content:Ue([M_,me(M_)])}),Tae=B({type:H("boolean"),title:E().optional(),description:E().optional(),default:Tt().optional()}),Oae=B({type:H("string"),title:E().optional(),description:E().optional(),minLength:Ae().optional(),maxLength:Ae().optional(),format:pn(["email","uri","date","date-time"]).optional(),default:E().optional()}),Dae=B({type:pn(["number","integer"]),title:E().optional(),description:E().optional(),minimum:Ae().optional(),maximum:Ae().optional(),default:Ae().optional()}),Nae=B({type:H("string"),title:E().optional(),description:E().optional(),enum:me(E()),default:E().optional()}),$ae=B({type:H("string"),title:E().optional(),description:E().optional(),oneOf:me(B({const:E(),title:E()})),default:E().optional()}),jae=B({type:H("string"),title:E().optional(),description:E().optional(),enum:me(E()),enumNames:me(E()).optional(),default:E().optional()}),Mae=Ue([Nae,$ae]),Lae=B({type:H("array"),title:E().optional(),description:E().optional(),minItems:Ae().optional(),maxItems:Ae().optional(),items:B({type:H("string"),enum:me(E())}),default:me(E()).optional()}),Uae=B({type:H("array"),title:E().optional(),description:E().optional(),minItems:Ae().optional(),maxItems:Ae().optional(),items:B({anyOf:me(B({const:E(),title:E()}))}),default:me(E()).optional()}),zae=Ue([Lae,Uae]),Fae=Ue([jae,Mae,zae]),qae=Ue([Fae,Tae,Oae,Dae]),Bae=Gm.extend({mode:H("form").optional(),message:E(),requestedSchema:B({type:H("object"),properties:Je(E(),qae),required:me(E()).optional()})}),Vae=Gm.extend({mode:H("url"),message:E(),elicitationId:E(),url:E().url()}),Wae=Ue([Bae,Vae]),Hae=fn.extend({method:H("elicitation/create"),params:Wae}),Zae=Hr.extend({elicitationId:E()}),Gae=Zr.extend({method:H("notifications/elicitation/complete"),params:Zae}),Y_=gn.extend({action:pn(["accept","decline","cancel"]),content:Zm(t=>t===null?void 0:t,Je(E(),Ue([E(),Ae(),Tt(),me(E())])).optional())}),Jae=B({type:H("ref/resource"),uri:E()});var Kae=B({type:H("ref/prompt"),name:E()}),Yae=Cr.extend({ref:Ue([Kae,Jae]),argument:B({name:E(),value:E()}),context:B({arguments:Je(E(),E()).optional()}).optional()}),Xae=fn.extend({method:H("completion/complete"),params:Yae});var Qae=gn.extend({completion:dn({values:me(E()).max(100),total:tt(Ae().int()),hasMore:tt(Tt())})}),eoe=B({uri:E().startsWith("file://"),name:E().optional(),_meta:Je(E(),Ve()).optional()}),toe=fn.extend({method:H("roots/list"),params:Cr.optional()}),_E=gn.extend({roots:me(eoe)}),noe=Zr.extend({method:H("notifications/roots/list_changed"),params:Hr.optional()}),_qe=Ue([q_,oE,Xae,yE,cae,aae,lE,Hie,dE,Xie,eae,nf,hE,V_,H_,Z_,J_]),Sqe=Ue([F_,B_,sE,noe,ef]),xqe=Ue([z_,vE,bE,Y_,_E,W_,G_,mu]),wqe=Ue([q_,Aae,Hae,toe,V_,H_,Z_,J_]),Iqe=Ue([F_,B_,xae,nae,Kie,bae,fae,ef,Gae]),Pqe=Ue([z_,Lie,Qae,mae,oae,Wie,Zie,Jie,K_,yae,W_,G_,mu]),ue=class t extends Error{constructor(e,n,r){super(`MCP error ${e}: ${n}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,n,r){if(e===xe.UrlElicitationRequired&&r){let i=r;if(i.elicitations)return new eE(i.elicitations,n)}return new t(e,n,r)}},eE=class extends ue{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super(xe.UrlElicitationRequired,n,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};var X_=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
244
244
  `);if(e===-1)return null;let n=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),roe(n)}clear(){this._buffer=void 0}};function roe(t){return sz.parse(JSON.parse(t))}function gz(t){return JSON.stringify(t)+`
245
- `}var Q_=class{constructor(e=hz.stdin,n=hz.stdout){this._stdin=e,this._stdout=n,this._readBuffer=new X_,this._started=!1,this._ondata=r=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=r=>{this.onerror?.(r)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(n=>{let r=gz(e);this._stdout.write(r)?n():this._stdout.once("drain",n)})}};var eS=class{startPromise=null;stopPromise=null;start(e){return this.startPromise??=e(),this.startPromise}stop(e){return this.stopPromise??=(async()=>{this.startPromise&&await this.startPromise.catch(()=>{}),await e()})(),this.stopPromise}};var be;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(be||(be={}));var yz;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(yz||(yz={}));var V=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),za=t=>{switch(typeof t){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(t)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":return Array.isArray(t)?V.array:t===null?V.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?V.promise:typeof Map<"u"&&t instanceof Map?V.map:typeof Set<"u"&&t instanceof Set?V.set:typeof Date<"u"&&t instanceof Date?V.date:V.object;default:return V.unknown}};var D=be.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"]);var kr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let s=r,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(n(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};kr.create=t=>new kr(t);var ioe=(t,e)=>{let n;switch(t.code){case D.invalid_type:t.received===V.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case D.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case D.invalid_union:n="Invalid input";break;case D.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case D.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case D.invalid_arguments:n="Invalid function arguments";break;case D.invalid_return_type:n="Invalid function return type";break;case D.invalid_date:n="Invalid date";break;case D.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:be.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case D.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case D.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case D.custom:n="Invalid input";break;case D.invalid_intersection_types:n="Intersection results could not be merged";break;case D.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case D.not_finite:n="Number must be finite";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},Wo=ioe;var aoe=Wo;function af(){return aoe}var tS=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}};function z(t,e){let n=af(),r=tS({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Wo?void 0:Wo].filter(i=>!!i)});t.common.issues.push(r)}var Rn=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return Q;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let a=await i.key,o=await i.value;r.push({key:a,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Q;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),gu=t=>({status:"dirty",value:t}),Fn=t=>({status:"valid",value:t}),SE=t=>t.status==="aborted",xE=t=>t.status==="dirty",cc=t=>t.status==="valid",of=t=>typeof Promise<"u"&&t instanceof Promise;var W;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(W||(W={}));var Gr=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}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}},vz=(t,e)=>{if(cc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new kr(t.common.issues);return this._error=n,this._error}}};function oe(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??n??s.defaultError}},description:i}}var fe=class{get description(){return this._def.description}_getType(e){return za(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:za(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Rn,ctx:{common:e.parent.common,data:e.data,parsedType:za(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(of(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:za(e)},i=this._parseSync({data:e,path:r.path,parent:r});return vz(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:za(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return cc(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>cc(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:za(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(of(i)?i:Promise.resolve(i));return vz(r,a)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:D.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new vi({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return yi.create(this,this._def)}nullable(){return Ba.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zo.create(this)}promise(){return lc.create(this,this._def)}or(e){return _u.create([this,e],this._def)}and(e){return Su.create(this,e,this._def)}transform(e){return new vi({...oe(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Cu({...oe(this._def),innerType:this,defaultValue:n,typeName:J.ZodDefault})}brand(){return new nS({typeName:J.ZodBranded,type:this,...oe(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ku({...oe(this._def),innerType:this,catchValue:n,typeName:J.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return rS.create(this,e)}readonly(){return Ru.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ooe=/^c[^\s-]{8,}$/i,soe=/^[0-9a-z]+$/,coe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,loe=/^[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,uoe=/^[a-z0-9_-]{21}$/i,doe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,poe=/^[-+]?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)?)??$/,moe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,foe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wE,goe=/^(?:(?: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])$/,hoe=/^(?:(?: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])$/,yoe=/^(([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]))$/,voe=/^(([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])$/,boe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_oe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bz="((\\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])))",Soe=new RegExp(`^${bz}$`);function _z(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function xoe(t){return new RegExp(`^${_z(t)}$`)}function woe(t){let e=`${bz}T${_z(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ioe(t,e){return!!((e==="v4"||!e)&&goe.test(t)||(e==="v6"||!e)&&yoe.test(t))}function Poe(t,e){if(!doe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Coe(t,e){return!!((e==="v4"||!e)&&hoe.test(t)||(e==="v6"||!e)&&voe.test(t))}var yu=class t extends fe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==V.string){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_type,expected:V.string,received:a.parsedType}),Q}let r=new Rn,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?z(i,{code:D.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&z(i,{code:D.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")moe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"email",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")wE||(wE=new RegExp(foe,"u")),wE.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"emoji",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")loe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"uuid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")uoe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"nanoid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")ooe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")soe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid2",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")coe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ulid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),z(i,{validation:"url",code:D.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"regex",code:D.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?woe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Soe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?xoe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?poe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"duration",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Ioe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ip",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Poe(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"jwt",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Coe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cidr",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?boe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?_oe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64url",code:D.invalid_string,message:a.message}),r.dirty()):be.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:D.invalid_string,...W.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...W.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...W.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...W.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...W.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...W.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...W.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...W.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...W.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...W.errToObj(n)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};yu.create=t=>new yu({checks:[],typeName:J.ZodString,coerce:t?.coerce??!1,...oe(t)});function koe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var sf=class t extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==V.number){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_type,expected:V.number,received:a.parsedType}),Q}let r,i=new Rn;for(let a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),z(r,{code:D.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?koe(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),z(r,{code:D.not_finite,message:a.message}),i.dirty()):be.assertNever(a);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:W.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&be.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};sf.create=t=>new sf({checks:[],typeName:J.ZodNumber,coerce:t?.coerce||!1,...oe(t)});var cf=class t extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==V.bigint)return this._getInvalidInput(e);let r,i=new Rn;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):be.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return z(n,{code:D.invalid_type,expected:V.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:W.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};cf.create=t=>new cf({checks:[],typeName:J.ZodBigInt,coerce:t?.coerce??!1,...oe(t)});var lf=class extends fe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==V.boolean){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.boolean,received:r.parsedType}),Q}return Fn(e.data)}};lf.create=t=>new lf({typeName:J.ZodBoolean,coerce:t?.coerce||!1,...oe(t)});var uf=class t extends fe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==V.date){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_type,expected:V.date,received:a.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_date}),Q}let r=new Rn,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):be.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:W.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};uf.create=t=>new uf({checks:[],coerce:t?.coerce||!1,typeName:J.ZodDate,...oe(t)});var df=class extends fe{_parse(e){if(this._getType(e)!==V.symbol){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.symbol,received:r.parsedType}),Q}return Fn(e.data)}};df.create=t=>new df({typeName:J.ZodSymbol,...oe(t)});var vu=class extends fe{_parse(e){if(this._getType(e)!==V.undefined){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.undefined,received:r.parsedType}),Q}return Fn(e.data)}};vu.create=t=>new vu({typeName:J.ZodUndefined,...oe(t)});var bu=class extends fe{_parse(e){if(this._getType(e)!==V.null){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.null,received:r.parsedType}),Q}return Fn(e.data)}};bu.create=t=>new bu({typeName:J.ZodNull,...oe(t)});var pf=class extends fe{constructor(){super(...arguments),this._any=!0}_parse(e){return Fn(e.data)}};pf.create=t=>new pf({typeName:J.ZodAny,...oe(t)});var Ho=class extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fn(e.data)}};Ho.create=t=>new Ho({typeName:J.ZodUnknown,...oe(t)});var Ki=class extends fe{_parse(e){let n=this._getOrReturnCtx(e);return z(n,{code:D.invalid_type,expected:V.never,received:n.parsedType}),Q}};Ki.create=t=>new Ki({typeName:J.ZodNever,...oe(t)});var mf=class extends fe{_parse(e){if(this._getType(e)!==V.undefined){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.void,received:r.parsedType}),Q}return Fn(e.data)}};mf.create=t=>new mf({typeName:J.ZodVoid,...oe(t)});var Zo=class t extends fe{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==V.array)return z(n,{code:D.invalid_type,expected:V.array,received:n.parsedType}),Q;if(i.exactLength!==null){let o=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(o||s)&&(z(n,{code:o?D.too_big:D.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(z(n,{code:D.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(z(n,{code:D.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,s)=>i.type._parseAsync(new Gr(n,o,n.path,s)))).then(o=>Rn.mergeArray(r,o));let a=[...n.data].map((o,s)=>i.type._parseSync(new Gr(n,o,n.path,s)));return Rn.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:W.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:W.toString(n)}})}nonempty(e){return this.min(1,e)}};Zo.create=(t,e)=>new Zo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...oe(e)});function hu(t){if(t instanceof Rr){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=yi.create(hu(r))}return new Rr({...t._def,shape:()=>e})}else return t instanceof Zo?new Zo({...t._def,type:hu(t.element)}):t instanceof yi?yi.create(hu(t.unwrap())):t instanceof Ba?Ba.create(hu(t.unwrap())):t instanceof qa?qa.create(t.items.map(e=>hu(e))):t}var Rr=class t extends fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==V.object){let l=this._getOrReturnCtx(e);return z(l,{code:D.invalid_type,expected:V.object,received:l.parsedType}),Q}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ki&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||s.push(l);let c=[];for(let l of o){let u=a[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Gr(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Ki){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(z(i,{code:D.unrecognized_keys,keys:s}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Gr(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>Rn.mergeObjectSync(r,l)):Rn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:W.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of be.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of be.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return hu(this)}partial(e){let n={};for(let r of be.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of be.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof yi;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return Sz(be.objectKeys(this.shape))}};Rr.create=(t,e)=>new Rr({shape:()=>t,unknownKeys:"strip",catchall:Ki.create(),typeName:J.ZodObject,...oe(e)});Rr.strictCreate=(t,e)=>new Rr({shape:()=>t,unknownKeys:"strict",catchall:Ki.create(),typeName:J.ZodObject,...oe(e)});Rr.lazycreate=(t,e)=>new Rr({shape:t,unknownKeys:"strip",catchall:Ki.create(),typeName:J.ZodObject,...oe(e)});var _u=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new kr(s.ctx.common.issues));return z(n,{code:D.invalid_union,unionErrors:o}),Q}if(n.common.async)return Promise.all(r.map(async a=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new kr(c));return z(n,{code:D.invalid_union,unionErrors:s}),Q}}get options(){return this._def.options}};_u.create=(t,e)=>new _u({options:t,typeName:J.ZodUnion,...oe(e)});var Fa=t=>t instanceof xu?Fa(t.schema):t instanceof vi?Fa(t.innerType()):t instanceof wu?[t.value]:t instanceof Iu?t.options:t instanceof Pu?be.objectValues(t.enum):t instanceof Cu?Fa(t._def.innerType):t instanceof vu?[void 0]:t instanceof bu?[null]:t instanceof yi?[void 0,...Fa(t.unwrap())]:t instanceof Ba?[null,...Fa(t.unwrap())]:t instanceof nS||t instanceof Ru?Fa(t.unwrap()):t instanceof ku?Fa(t._def.innerType):[],IE=class t extends fe{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==V.object)return z(n,{code:D.invalid_type,expected:V.object,received:n.parsedType}),Q;let r=this.discriminator,i=n.data[r],a=this.optionsMap.get(i);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(z(n,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let a of n){let o=Fa(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...oe(r)})}};function PE(t,e){let n=za(t),r=za(e);if(t===e)return{valid:!0,data:t};if(n===V.object&&r===V.object){let i=be.objectKeys(e),a=be.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=PE(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(n===V.array&&r===V.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],c=PE(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===V.date&&r===V.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Su=class extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(a,o)=>{if(SE(a)||SE(o))return Q;let s=PE(a.value,o.value);return s.valid?((xE(a)||xE(o))&&n.dirty(),{status:n.value,value:s.data}):(z(r,{code:D.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Su.create=(t,e,n)=>new Su({left:t,right:e,typeName:J.ZodIntersection,...oe(n)});var qa=class t extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.array)return z(r,{code:D.invalid_type,expected:V.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return z(r,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(z(r,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Gr(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>Rn.mergeArray(n,o)):Rn.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};qa.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qa({items:t,typeName:J.ZodTuple,rest:null,...oe(e)})};var CE=class t extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.object)return z(r,{code:D.invalid_type,expected:V.object,received:r.parsedType}),Q;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:a._parse(new Gr(r,s,r.path,s)),value:o._parse(new Gr(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?Rn.mergeObjectAsync(n,i):Rn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof fe?new t({keyType:e,valueType:n,typeName:J.ZodRecord,...oe(r)}):new t({keyType:yu.create(),valueType:e,typeName:J.ZodRecord,...oe(n)})}},ff=class extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.map)return z(r,{code:D.invalid_type,expected:V.map,received:r.parsedType}),Q;let i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([s,c],l)=>({key:i._parse(new Gr(r,s,r.path,[l,"key"])),value:a._parse(new Gr(r,c,r.path,[l,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Q;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Q;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}}}};ff.create=(t,e,n)=>new ff({valueType:e,keyType:t,typeName:J.ZodMap,...oe(n)});var gf=class t extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.set)return z(r,{code:D.invalid_type,expected:V.set,received:r.parsedType}),Q;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(z(r,{code:D.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(z(r,{code:D.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return Q;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}let s=[...r.data.values()].map((c,l)=>a._parse(new Gr(r,c,r.path,l)));return r.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,n){return new t({...this._def,minSize:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:W.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};gf.create=(t,e)=>new gf({valueType:t,minSize:null,maxSize:null,typeName:J.ZodSet,...oe(e)});var kE=class t extends fe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==V.function)return z(n,{code:D.invalid_type,expected:V.function,received:n.parsedType}),Q;function r(s,c){return tS({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,af(),Wo].filter(l=>!!l),issueData:{code:D.invalid_arguments,argumentsError:c}})}function i(s,c){return tS({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,af(),Wo].filter(l=>!!l),issueData:{code:D.invalid_return_type,returnTypeError:c}})}let a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof lc){let s=this;return Fn(async function(...c){let l=new kr([]),u=await s._def.args.parseAsync(c,a).catch(m=>{throw l.addIssue(r(c,m)),l}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(m=>{throw l.addIssue(i(d,m)),l})})}else{let s=this;return Fn(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new kr([r(c,l.error)]);let u=Reflect.apply(o,this,l.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new kr([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:qa.create(e).rest(Ho.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||qa.create([]).rest(Ho.create()),returns:n||Ho.create(),typeName:J.ZodFunction,...oe(r)})}},xu=class extends fe{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};xu.create=(t,e)=>new xu({getter:t,typeName:J.ZodLazy,...oe(e)});var wu=class extends fe{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return z(n,{received:n.data,code:D.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};wu.create=(t,e)=>new wu({value:t,typeName:J.ZodLiteral,...oe(e)});function Sz(t,e){return new Iu({values:t,typeName:J.ZodEnum,...oe(e)})}var Iu=class t extends fe{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return z(n,{expected:be.joinValues(r),received:n.parsedType,code:D.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return z(n,{received:n.data,code:D.invalid_enum_value,options:r}),Q}return Fn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Iu.create=Sz;var Pu=class extends fe{_parse(e){let n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==V.string&&r.parsedType!==V.number){let i=be.objectValues(n);return z(r,{expected:be.joinValues(i),received:r.parsedType,code:D.invalid_type}),Q}if(this._cache||(this._cache=new Set(be.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=be.objectValues(n);return z(r,{received:r.data,code:D.invalid_enum_value,options:i}),Q}return Fn(e.data)}get enum(){return this._def.values}};Pu.create=(t,e)=>new Pu({values:t,typeName:J.ZodNativeEnum,...oe(e)});var lc=class extends fe{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==V.promise&&n.common.async===!1)return z(n,{code:D.invalid_type,expected:V.promise,received:n.parsedType}),Q;let r=n.parsedType===V.promise?n.data:Promise.resolve(n.data);return Fn(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};lc.create=(t,e)=>new lc({type:t,typeName:J.ZodPromise,...oe(e)});var vi=class extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{z(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?gu(c.value):n.value==="dirty"?gu(c.value):c});{if(n.value==="aborted")return Q;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?gu(s.value):n.value==="dirty"?gu(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Q:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!cc(o))return Q;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>cc(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:n.value,value:s})):Q);be.assertNever(i)}};vi.create=(t,e,n)=>new vi({schema:t,typeName:J.ZodEffects,effect:e,...oe(n)});vi.createWithPreprocess=(t,e,n)=>new vi({schema:e,effect:{type:"preprocess",transform:t},typeName:J.ZodEffects,...oe(n)});var yi=class extends fe{_parse(e){return this._getType(e)===V.undefined?Fn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yi.create=(t,e)=>new yi({innerType:t,typeName:J.ZodOptional,...oe(e)});var Ba=class extends fe{_parse(e){return this._getType(e)===V.null?Fn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:J.ZodNullable,...oe(e)});var Cu=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===V.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Cu.create=(t,e)=>new Cu({innerType:t,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});var ku=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return of(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new kr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ku.create=(t,e)=>new ku({innerType:t,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});var hf=class extends fe{_parse(e){if(this._getType(e)!==V.nan){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};hf.create=t=>new hf({typeName:J.ZodNaN,...oe(t)});var Kqe=Symbol("zod_brand"),nS=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},rS=class t extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?(n.dirty(),gu(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Q:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:J.ZodPipeline})}},Ru=class extends fe{_parse(e){let n=this._def.innerType._parse(e),r=i=>(cc(i)&&(i.value=Object.freeze(i.value)),i);return of(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};Ru.create=(t,e)=>new Ru({innerType:t,typeName:J.ZodReadonly,...oe(e)});var Yqe={object:Rr.lazycreate},J;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(J||(J={}));var Xqe=yu.create,Qqe=sf.create,eBe=hf.create,tBe=cf.create,nBe=lf.create,rBe=uf.create,iBe=df.create,aBe=vu.create,oBe=bu.create,sBe=pf.create,cBe=Ho.create,lBe=Ki.create,uBe=mf.create,dBe=Zo.create,Roe=Rr.create,pBe=Rr.strictCreate,mBe=_u.create,fBe=IE.create,gBe=Su.create,hBe=qa.create,yBe=CE.create,vBe=ff.create,bBe=gf.create,_Be=kE.create,SBe=xu.create,xBe=wu.create,wBe=Iu.create,IBe=Pu.create,PBe=lc.create,CBe=vi.create,kBe=yi.create,RBe=Ba.create,EBe=vi.createWithPreprocess,ABe=rS.create;function Eu(t){return!!t._zod}function Go(t,e){return Eu(t)?Zs(t,e):t.safeParse(e)}function iS(t){if(!t)return;let e;if(Eu(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Iz(t){if(Eu(t)){let a=t._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let r=t.value;if(r!==void 0)return r}function Jo(t){return t==="completed"||t==="failed"||t==="cancelled"}var $oe=Symbol("Let zodToJsonSchema decide on which parser to use");var U2e=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function RE(t){let n=iS(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let r=Iz(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function EE(t,e){let n=Go(t,e);if(!n.success)throw n.error;return n.data}var Foe=6e4,aS=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(F_,n=>{this._oncancel(n)}),this.setNotificationHandler(B_,n=>{this._onprogress(n)}),this.setRequestHandler(q_,n=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(V_,async(n,r)=>{let i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new ue(xe.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(H_,async(n,r)=>{let i=async()=>{let a=n.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(a,r.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),s.type==="response")u(c);else{let d=c,p=new ue(d.error.code,d.error.message,d.error.data);u(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let o=await this._taskStore.getTask(a,r.sessionId);if(!o)throw new ue(xe.InvalidParams,`Task not found: ${a}`);if(!Jo(o.status))return await this._waitForTaskUpdate(a,r.signal),await i();if(Jo(o.status)){let s=await this._taskStore.getTaskResult(a,r.sessionId);return this._clearTaskQueue(a),{...s,_meta:{...s._meta,[Vo]:{taskId:a}}}}return await i()};return await i()}),this.setRequestHandler(Z_,async(n,r)=>{try{let{tasks:i,nextCursor:a}=await this._taskStore.listTasks(n.params?.cursor,r.sessionId);return{tasks:i,nextCursor:a,_meta:{}}}catch(i){throw new ue(xe.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(J_,async(n,r)=>{try{let i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new ue(xe.InvalidParams,`Task not found: ${n.params.taskId}`);if(Jo(i.status))throw new ue(xe.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);let a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ue(xe.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof ue?i:new ue(xe.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,n,r,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return!1;let r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),ue.fromError(xe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=a=>{r?.(a),this._onerror(a)};let i=this._transport?.onmessage;this._transport.onmessage=(a,o)=>{i?.(a,o),Jm(a)||oz(a)?this._onresponse(a):rE(a)?this._onrequest(a,o):az(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=ue.fromError(xe.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(n)}_onerror(e){this.onerror?.(e)}_onnotification(e){let n=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,n){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,a=e.params?._meta?.[Vo]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:xe.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=nz(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,l={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{let d={relatedRequestId:e.id};a&&(d.relatedTask={taskId:a}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{let m={...p,relatedRequestId:e.id};a&&!m.relatedTask&&(m.relatedTask={taskId:a});let f=m.relatedTask?.taskId??a;return f&&c&&await c.updateTaskStatus(f,"input_required"),await this.request(u,d,m)},authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo,taskId:a,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,l)).then(async u=>{if(o.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(o.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:xe.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:n,...r}=e.params,i=Number(n),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(c);return}a(r)}_onresponse(e){let n=Number(e.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),Jm(e))r(e);else{let o=new ue(e.error.code,e.error.message,e.error.data);r(o)}return}let i=this._responseHandlers.get(n);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let a=!1;if(Jm(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,n))}}if(a||this._progressHandlers.delete(n),Jm(e))i(e);else{let o=ue.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,n,r){let{task:i}=r??{};if(!i){try{yield{type:"result",result:await this.request(e,n,r)}}catch(o){yield{type:"error",error:o instanceof ue?o:new ue(xe.InternalError,String(o))}}return}let a;try{let o=await this.request(e,mu,r);if(o.task)a=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new ue(xe.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:s},Jo(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)}:s.status==="failed"?yield{type:"error",error:new ue(xe.InternalError,`Task ${a} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new ue(xe.InternalError,`Task ${a} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),r?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof ue?o:new ue(xe.InternalError,String(o))}}}request(e,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:c}=r??{};return new Promise((l,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(b){d(b);return}r?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};r?.onprogress&&(this._progressHandlers.set(p,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Vo]:c}});let f=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(w=>this._onerror(new Error(`Failed to send cancellation: ${w}`)));let _=b instanceof ue?b:new ue(xe.RequestTimeout,String(b));u(_)};this._responseHandlers.set(p,b=>{if(!r?.signal?.aborted){if(b instanceof Error)return u(b);try{let _=Go(n,b.result);_.success?l(_.data):u(_.error)}catch(_){u(_)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let g=r?.timeout??Foe,h=()=>f(ue.fromError(xe.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=_=>{let w=this._responseHandlers.get(p);w?w(_):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(p),u(_)})}else this._transport.send(m,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(b=>{this._cleanupTimeout(p),u(b)})})}async getTask(e,n){return this.request({method:"tasks/get",params:e},W_,n)}async getTaskResult(e,n,r){return this.request({method:"tasks/result",params:e},n,r)}async listTasks(e,n){return this.request({method:"tasks/list",params:e},G_,n)}async cancelTask(e,n){return this.request({method:"tasks/cancel",params:e},lz,n)}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let r=n?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Vo]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Vo]:n.relatedTask}}}),this._transport?.send(s,n).catch(c=>this._onerror(c))});return}let o={...e,jsonrpc:"2.0"};n?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Vo]:n.relatedTask}}}),await this._transport.send(o,n)}setRequestHandler(e,n){let r=RE(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,a)=>{let o=EE(e,i);return Promise.resolve(n(o,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,n){let r=RE(e);this._notificationHandlers.set(r,i=>{let a=EE(e,i);return Promise.resolve(n(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let n=this._taskProgressTokens.get(e);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,n,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,n,r,i)}async _clearTaskQueue(e,n){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,n);for(let i of r)if(i.type==="request"&&rE(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new ue(xe.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,n){let r=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(r=i.pollInterval)}catch{}return new Promise((i,a)=>{if(n.aborted){a(new ue(xe.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,r);n.addEventListener("abort",()=>{clearTimeout(o),a(new ue(xe.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,n){let r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await r.createTask(i,e.id,{method:e.method,params:e.params},n)},getTask:async i=>{let a=await r.getTask(i,n);if(!a)throw new ue(xe.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await r.storeTaskResult(i,a,o,n);let s=await r.getTask(i,n);if(s){let c=ef.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Jo(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>r.getTaskResult(i,n),updateTaskStatus:async(i,a,o)=>{let s=await r.getTask(i,n);if(!s)throw new ue(xe.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Jo(s.status))throw new ue(xe.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(i,a,o,n);let c=await r.getTask(i,n);if(c){let l=ef.parse({method:"notifications/tasks/status",params:c});await this.notification(l),Jo(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>r.listTasks(i,n)}}};function Pz(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Cz(t,e){let n={...t};for(let r in e){let i=r,a=e[i];if(a===void 0)continue;let o=n[i];Pz(o)&&Pz(a)?n[i]={...o,...a}:n[i]=a}return n}var pB=Zt(fT(),1),mB=Zt(dB(),1);function Tpe(){let t=new pB.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,mB.default)(t),t}var qS=class{constructor(e){this._ajv=e??Tpe()}getValidator(e){let n="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return r=>n(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var BS=class{constructor(e){this._server=e}requestStream(e,n,r){return this._server.requestStream(e,n,r)}async getTask(e,n){return this._server.getTask({taskId:e},n)}async getTaskResult(e,n,r){return this._server.getTaskResult({taskId:e},n,r)}async listTasks(e,n){return this._server.listTasks(e?{cursor:e}:void 0,n)}async cancelTask(e,n){return this._server.cancelTask({taskId:e},n)}};function fB(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${n} does not support task creation for tools/call (required for ${e})`);break;default:break}}function gB(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${n} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var VS=class extends aS{constructor(e,n){super(n),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(rf.options.map((r,i)=>[r,i])),this.isMessageIgnored=(r,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new qS,this.setRequestHandler(oE,r=>this._oninitialize(r)),this.setNotificationHandler(sE,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(yE,async(r,i)=>{let a=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=r.params,s=rf.safeParse(o);return s.success&&this._loggingLevels.set(a,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new BS(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Cz(this._capabilities,e)}setRequestHandler(e,n){let i=iS(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let a;if(Eu(i)){let s=i;a=s._zod?.def?.value??s.value}else{let s=i;a=s._def?.value??s.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let s=async(c,l)=>{let u=Go(nf,c);if(!u.success){let f=u.error instanceof Error?u.error.message:String(u.error);throw new ue(xe.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:d}=u.data,p=await Promise.resolve(n(c,l));if(d.task){let f=Go(mu,p);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new ue(xe.InvalidParams,`Invalid task creation result: ${g}`)}return f.data}let m=Go(K_,p);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new ue(xe.InvalidParams,`Invalid tools/call result: ${f}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,n)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){gB(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&fB(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let n=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:QU.includes(n)?n:tE,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},z_)}async createMessage(e,n){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],a=i.some(l=>l.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],c=s.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},bE,n):this.request({method:"sampling/createMessage",params:e},vE,n)}async elicitInput(e,n){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},Y_,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},Y_,n);if(a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new ue(xe.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){throw o instanceof ue?o:new ue(xe.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return a}}}createElicitationCompletionNotifier(e,n){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},n)}async listRoots(e,n){return this.request({method:"roots/list",params:e},_E,n)}async sendLoggingMessage(e,n){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,n))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function Ope(){let t=process.env.WEPPY_ROBLOX_MCP_VERSION?.trim();return t||null}var He=Ope()??"2.17.13";var xT="weppy://ui-studio/guide",wT="weppy://ui-studio/tokens",IT="weppy://ui-studio/functional-rules",hB='# UI Studio Guide\n\n**Audience:** AI agents and developers building Roblox interfaces through UI Studio.\n**Resource:** `weppy://ui-studio/guide`\n**Policy:** Design Check quality findings are advisory. Schema errors, unsupported properties, forbidden paths, destructive-action boundaries, and external upload approval remain enforceable safety rules.\n\n## How to use this guide\n\nBuild from project evidence, not from a built-in game subject or genre preset. The guide has three layers:\n\n1. The advisory usability floor covers observable interaction and readability risks.\n2. The visual vocabulary offers optional directions, not a checklist or score.\n3. The review workflow separates verified functional evidence from visual judgment.\n\nVisual quality is contextual. Do not turn token values, shape counts, image counts, ornament counts, occupancy, or family counts into pass conditions.\n\n### Roblox platform guidance and user scope\n\nRead `platform_guidance` in `weppy://ui-studio/functional-rules` when platform UI or safe-area evidence is relevant. Each entry preserves an ID, revision, `constraint | recommendation`, official source section and check date, application conditions, and limitations. Recommendations are not mandatory design rules. WEPPY Layout Plan defaults are composition suggestions, not Roblox requirements.\n\nKeep three layers distinct in the explanation:\n\n- **Observation:** the measured bounds, state, profile, coordinate space, and limitations in `platform_ui` and finding `evidence`. Preserve `observed | estimated | unavailable`; enabled does not imply visible or open. An intersection alone does not confirm unreadability or blocked input.\n- **Official guidance:** applicable source-owned `platform_guidance` linked by the finding\'s `guidance_refs`. Explain why its conditions apply and retain its revision when referring to saved evidence.\n- **AI interpretation:** context-dependent impact and possible adjustments, with tradeoffs where useful. A proposed adjustment is not the only solution or an official instruction.\n\nReview-only requests end with evidence and conditional recommendations; they do not authorize create/update or changes to default controls. With existing creation or repair authorization, apply appropriate changes within that scope and verify the affected states without asking again for the same permission. Preserve explicit placement choices and do not disable default controls or force a layout merely to remove a finding. `review_required` and `insufficient_evidence` describe evidence/readiness, not a mutation prohibition.\n\nUse declared targets, existing control choices, and relevant states from the request and project. Do not automatically require new device coverage or a Play session for every UI task. Before runtime evidence exists, use official guidance as conditional design context. If a source cannot be refreshed, use its saved check date and limitations honestly; a web lookup on every call is not required.\n\nInset API values have different meanings. `GuiService.TopbarInset` describes available topbar space, while `GetInsetArea` returns a usable rectangle relative to the CoreUISafeInsets area. Neither is automatically a rectangle occupied by a Roblox control. See [GuiService API documentation](https://create.roblox.com/docs/reference/engine/classes/GuiService#GetInsetArea). Compare bounds only after their coordinate spaces are reconciled, and preserve failed API observations as unavailable instead of zero insets or disabled controls.\n\n### Context-first brief gate\n\nFor an ambiguous request, call `manage_ui.design_brief` with an omitted or partial brief. Inspect Studio and project evidence before asking the user for information.\n\n- An empty `StarterGui` proves only that no Edit UI root was observed. For an existing-UI review, return `runtime_not_reviewed` until a Play Client `PlayerGui` observation is available. Treat it as new-interface evidence only when the user explicitly asks to create new UI.\n- Existing `ScreenGui` roots support a redesign or targeted-update interpretation.\n- A selected GUI object is strong target evidence unless the user names a broader scope.\n- Explicit `projectContext` and user choices outrank existing Studio patterns.\n- Existing Studio patterns may inform continuity, but they never create a reusable subject preset.\n- An explicit user placement, grouping, surface, flow, or backdrop choice outranks project evidence, existing UI, and WEPPY fallback in that order.\n\nAsk one focused question at a time. Include a current-state summary, a recommended choice with evidence, useful alternatives, and a free-form escape hatch. Return an exact `brief_patch` for an accepted recommendation.\n\n### Asset recommendation gate\n\nAsset evidence is considered in this order:\n\n1. user-provided `brief.reference_assets`\n2. approved `projectContext.approved_assets`\n3. relevant images already used by the selected project UI\n4. `manage_assets.search` only when `projectContext.asset_search_intent` is explicit and user-approved\n5. an assetless fallback\n\nDo not synthesize a subject search query from names, labels, hierarchy text, or Workspace content. Do not use a recommended asset until the user accepts it. Never invent an `rbxassetid://...` value.\n\n### Calling-agent capability and image generation gate\n\nInspect the calling agent\'s actual callable image capability and local output channel. Do not infer capability from a model or client name, and never record provider credentials.\n\n- Generation and Roblox upload require separate approval.\n- `image_review` means the calling agent can review an output; it does not authorize generation or upload.\n- If generation or local output is unavailable or unknown, continue with approved assets or an assetless fallback.\n\nAfter local generation, show the output for selection. Run upload preflight only after selection, and request separate approval naming the files, count, and destination.\n\n### Project Design Contract gate\n\nPass relevant repository evidence in `projectContext` instead of asking the Studio plugin to guess it:\n\n- `screen_job`, `primary_action`, `content_hierarchy`, recommended `required_states`, and explicitly blocking `required_state_ids`\n- `visual_thesis`, `signature_motif`, and `forbidden_defaults`\n- `presentation_mode` and `focal_region`\n- neutral `surface_roles` and `shape_language`\n- role-specific `layout_preferences` with their decision source\n- `target_profiles` and `platform_distribution`\n- project-owned tokens and approved assets with evidence paths\n\nKeep the returned `design_contract` and `brief_id` together. `create_tree` and `update` require an accepted brief. Candidate directions should differ materially in composition, hierarchy, or interaction behavior; palette swaps alone are not meaningful alternatives.\n\n### Role-based game layout contract\n\nWEPPY supplies style-neutral structure. The calling agent owns visual direction from explicit user intent plus game and project evidence. A WEPPY fallback must not choose the palette, font, imagery treatment, ornament, semantic shape, or numeric opacity for the project.\n\nFor an underspecified `non_modal_overlay`, translate neutral roles into these advisory constraints:\n\n- `persistent_status`: top-left compact individual chrome, growing inward from the edge;\n- `resource_display`: top-right compact chips in a row;\n- `navigation`: side rail or top edge, using individual controls instead of one large shared panel;\n- `slot_action`: bottom-center single-row flow only when the content has real slot semantics;\n- `contextual_action`: transient lower-center or target-relative action, normally one or a few controls;\n- `objective_tracker`: side-edge bounded group that can condense or collapse.\n\nUse a transparent group root for non-modal HUD regions. Opaque paint may remain inside the local bounds of a button, status chip, tracker, or other readable content surface. A contract-backed `modal_overlay`, `fullscreen_navigation`, or `diegetic` presentation may use a backdrop.\n\nFor touch profiles using default controls, consider the applicable platform guidance when placing a semantic slot bar. Treat touch-left, touch-right, and top-inset Layout Plan regions as advisory context unless their geometry is observed. Prefer condense, paginate, collapse, or contextual disclosure over wrapping generic actions into a multi-row bottom-center grid.\n\nEach region can preserve `placement_band`, `flow_axis`, `surface_mode`, `avoid_regions`, `wrap_policy`, `decision_source`, and an optional numeric `max_edge_gap_px`. These are advisory composition constraints, not exact coordinates or a hard tree preset. When the explicit user or approved project evidence requests a different result, preserve it and report only observed functional risk. An explicit user placement without a numeric maximum does not inherit a WEPPY edge-gap limit.\n\n### Design Check coverage gate\n\n`manage_ui.check` reports findings and coverage independently.\n\n- `structural_only` means deterministic Studio checks ran without a calling-agent visual review.\n- `structural_and_visual` means a calling agent reviewed the referenced saved preview and submitted `visualReview` evidence.\n- `visual_status = "not_requested" | "skipped"` must remain visible even when deterministic findings are empty.\n\nUse `visualReview` and its `reviewContext` only for evidence actually reviewed. If interaction states or representative primary-view context are absent, preserve `interaction_states_not_reviewed` or `gameplay_context_unavailable`. WEPPY does not call an external AI service for visual review.\n\nFor UI created only at runtime, run a structured Play session with one client, wait for the UI, and use `snapshot_gui` on `{root:"PlayerGui",segments:[]}`. Pass the saved `{recordId,stepId}` as `runtimeEvidenceRef` and use `observationMode="runtime"` for `manage_ui.check`. The Bridge validates Place, session, client, step status, and PlayerGui origin; never submit a copied tree as runtime evidence. A truncated tree remains partial coverage.\n\nKeep semantic runtime evidence and screenshot evidence separate. Play-mode screenshot capture is unavailable in this build, so a PlayerGui snapshot can complete runtime structure coverage but cannot complete visual review by itself. Preserve `play_screenshot_unsupported`, `background_unverified`, state gaps, and other limitations.\n\n## A. Advisory usability and interaction floor\n\nThese are configurable recommendations. A `priority_high` finding indicates urgency, not a mutation block.\n\n### A.1 Hit, focus, and painted surfaces\n\nEvaluate the resolved `AbsoluteSize` of the interactive hit and focus area. The painted visual surface may be smaller or differently shaped when the larger invisible area does not overlap another action or hide content.\n\nUse target-profile recommendations for touch and focus reachability. Treat them as defaults that projects may adjust with evidence. Always verify that actions remain distinguishable and reachable for every declared input mode.\n\n### A.2 Safe areas and readable text\n\nUse `ScreenInsets`, device simulation, and the declared target profile where available. Review critical actions and information against the actual safe area rather than assuming one global inset.\n\nFor an edge-bound semantic region, compare both the container bounds and the actual painted descendant union with the declared safe boundary. The painted union includes visible background, text, image, and `UIStroke` geometry after `ClipsDescendants`. A transparent parent can therefore be attached while its visible controls remain detached. Report this as one `edge_detached` finding with container, visible, and internal gap evidence. AnchorPoint mismatch alone is diagnostic evidence, not a finding.\n\nEvaluate text against the resolved background, including composable transparency. When an image, gradient, transparent game view, or complex overlay prevents a deterministic background result, return `background_unverified` instead of assuming a dark fallback. Check `TextFits`, `TextBounds`, clipping, long localized strings, and maximum numeric content. Contrast and text-size values are accessibility recommendations, not visual-style quotas. If `TextScaled` is used, constrain it with `UITextSizeConstraint` and verify representative locales.\n\nInspect visible text, images, actions, and painted progress indicators even when semantic metadata is absent. Compare direct siblings and meaningful surfaces across enabled ScreenGui roots. Exclude parent-child paint, progress fill/background composition, hidden roots, and contract-backed intentional overlap. Treat public inset and Core UI state as observed evidence; if expanded chat, player list, or touch-control geometry cannot be observed, report it as estimated or unavailable.\n\n### A.3 Input disclosure and state access\n\nA readable embedded action text can be the visible label when it remains legible across declared targets and locales. Do not duplicate it with a second adjacent label.\n\nUnfamiliar controls need an input-appropriate explanation path:\n\n- pointer and keyboard can use hover or focus labels;\n- gamepad needs a focus-visible action label and current binding;\n- touch needs a persistent label, a labelled disclosure control, or another touch-visible hint.\n\nEvery declared input mode should expose the action meaning and relevant resting, focus, pressed, selected, and disabled states. Pointer hover alone does not establish all-input discoverability.\n\n### A.4 Primary-view protection\n\nFor `non_modal_overlay`, keep the Design Contract focal region visually available. If UI and the primary view compete, consider edge placement, reflow, condensation, collapse, or contextual disclosure. Do not enforce a fixed screen-occupancy ratio.\n\nModal, fullscreen navigation, and diegetic presentation may intentionally use a backdrop when the contract supports it. A full-screen opaque surface is not automatically wrong; its presentation role decides.\n\n### A.5 Supported Roblox UI components\n\nUI Studio tree encoding supports `UIScale`, `UIFlexItem`, `UIShadow`, `UIPageLayout`, `UITableLayout`, `CanvasGroup`, `UIDragDetector`, `UIAspectRatioConstraint`, `UISizeConstraint`, and `UITextSizeConstraint` where listed by the public schema.\n\nNo class is a quality guarantee. Likewise, a `Frame`, `Offset`, sharp edge, or absent image is not a failure by itself. Report observable bounds, text-fit, reachability, focus-path, safe-area, aspect, or interaction evidence.\n\n## B. Visual vocabulary\n\nThis vocabulary is exploratory. Combine, omit, or extend options when project evidence supports the result. Consistency should be explained through roles and relationships, not through rigid family counts.\n\n### B.1 neutral surface roles\n\nAssign visible surfaces a neutral surface role before styling:\n\n- `primary_action`\n- `secondary_action`\n- `navigation`\n- `persistent_status`\n- `transient_status`\n- `resource_display`\n- `contextual_information`\n- `identity`\n- `spatial_information`\n- `slot_action`\n- `contextual_action`\n- `objective_tracker`\n- `decoration`\n\nProjects may add opaque roles. WEPPY must not reuse their subject meaning as another project\'s default.\n\nAn interaction family describes how controls reveal affordance and state. It may be framed, tactile, diegetic, tab-like, ornamented, or an intentional flat control. Gradient, shadow, bevel, rounding, and imagery are optional.\n\n### B.2 Container edge language and semantic shape\n\nPlan container edge language separately from semantic shape.\n\n- Container edge language can be sharp, softly rounded, strongly rounded, cut-corner, asymmetric, organic, or project-defined.\n- Semantic shapes can include a circle, ring, pill, rounded marker, directional wedge, segmented track, organic silhouette, or another project-defined form.\n- A compact status marker may use a ring while a nearby action uses a pill and its containing panel uses a sharp edge language.\n- Mixed semantic shapes supported by role evidence are not a style failure.\n\nUse circles and rings where radial reading, identity, progress, direction, or compact status makes them clearer. Use pills where a short label and bounded interactive state benefit from that silhouette. Use rounded containers when softness or touch affordance supports the thesis. Preserve sharp or cut edges when they better support the project.\n\nDo not require every surface to share one radius. Avoid arbitrary inconsistency, but explain meaningful differences through role, interaction state, hierarchy, or the signature motif.\n\n### B.3 Layout, anchor, and pivot strategy\n\nChoose layout from content hierarchy, parent relationship, focal region, and target profiles.\n\n- Edge placement protects the primary view for persistent non-modal information.\n- Centered hierarchy supports intentionally modal or focused flows.\n- Split, asymmetric, radial, layered, and flow layouts are valid when they clarify relationships.\n- Repeated rectangles are not a default composition. Use bounded panels only where grouping, backdrop, scrolling, or interaction requires them.\n\nTreat `AnchorPoint` as the element\'s positional pivot:\n\n- left/top pivots suit content growing inward from those edges;\n- center pivots suit centered or symmetric relationships;\n- right/bottom pivots suit content growing inward from those edges;\n- project-specific pivots may support a spatial or animated relationship.\n\nWhen using `create_tree`, add optional `layoutMetadata` to meaningful region roots so preview metadata can preserve `surfaceRole`, `placementBand`, `surfaceMode`, and `decisionSource` for review.\n\nScale and Offset are tools, not pass/fail signals. Use Scale for proportional relationships, Offset for stable local dimensions, and combine them deliberately. Add `UIScale`, `UISizeConstraint`, `UIAspectRatioConstraint`, `UITextSizeConstraint`, layout components, Style Query, or project scripts when the target behavior needs them. Verify the resolved result in declared profiles.\n\n### B.4 Imagery strategy\n\nChoose imagery based on explicit role evidence:\n\n- `symbol_set`: consistent compact signs or glyphs\n- `content_thumbnail`: a visual representation of selectable or referenced content\n- `identity_visual`: a visual used primarily for identity or recognition\n- `illustrative_backdrop`: non-interactive atmosphere or framing art\n- `diegetic_surface`: a surface visually integrated with the project world\n- `no_imagery`: an intentional text-and-shape direction\n\nDifferent roles may justify different imagery families on one screen. Coherence comes from treatment, hierarchy, and evidence\u2014not a family quota. If no approved asset exists, use a labelled geometric marker, project-approved glyph, clear placeholder, or `no_imagery`.\n\n### B.5 Depth, ornament, type, colour, and motion\n\nTokens under `weppy://ui-studio/tokens` are examples. They can suggest palette, typography, edge, motion, depth, and composition directions, but they are never mandatory values or quality scores.\n\n- Flatness can be intentional when hierarchy and state remain clear.\n- Depth may use stroke, tonal separation, overlap, shadow, or project imagery.\n- Ornament should reinforce hierarchy or a signature motif rather than fill empty space.\n- Motion should explain state or relationship and respect reduced-motion evidence.\n- Intentional silence\u2014no imagery, no ornament, or no motion\u2014is valid when the contract explains it.\n\n### B.6 Composition and distinctiveness\n\nProtect a clear reading order without forcing a single focal-area percentage. Important relationships may be expressed through scale, placement, colour, typography, motion, negative space, or semantic shape.\n\nBefore applying generic equal-weight rectangles, ask whether the roles call for edge markers, radial indicators, layered surfaces, labelled controls, a bounded content region, or contextual disclosure. If two projects differ only by palette, revisit their evidence and layout plan.\n\n## C. Review workflow\n\n### C.1 Primary visual builder and critic loop\n\nFor authorized creation or refinement, use **Builder \u2192 Preview \u2192 Critic \u2192 Update** as the primary quality loop. For review-only work, inspect the existing UI and stop after the critic explanation:\n\n1. **Builder:** compose from the accepted Design Contract, role relationships, reference evidence, and imagery strategy.\n2. **Preview:** capture the representative primary view after each meaningful create or update pass.\n3. **Critic:** compare the screenshot with the contract and references, then return `recompose`, `refine`, or `approved` with a concise summary and path-backed findings.\n4. **Update:** within the authorized scope, consider recomposition when the layout or presentation model needs adjustment, or refinement when the direction is sound. Recheck meaningful changes. Stop when the requested outcome is met, the user chooses to retain the design, or an unresolved dependency prevents further verification; report remaining findings honestly.\n\nDo not treat schema success or an empty deterministic result as visual approval. `approved` requires representative primary-view evidence, no unresolved `priority_high` functional risk, and a resolved imagery strategy. When required imagery still has only a placeholder or fallback, keep primary visual approval ineligible and propose the separately approved generation or asset path.\n\n### C.2 Visual review\n\nReview qualitative decisions against the Design Contract:\n\n- Is the screen job evident?\n- Does hierarchy match `content_hierarchy`?\n- Are action and information roles distinguishable?\n- Does the container edge language support the visual thesis?\n- Do semantic shapes have role evidence?\n- Is imagery intentional, approved, or intentionally absent?\n- Does the composition protect the focal region?\n- Are required interaction states discoverable for declared inputs?\n\nDo not add visual elements merely to reduce finding counts. Do not issue a failure because a surface is rectangular, circular, sharp, rounded, flat, or image-free.\n\n### C.3 Responsive review\n\nReview the primary target first, then secondary and compatibility targets. User-selected targets and Experience analytics outrank a generic platform default. Excluded targets are recorded but not evaluated as required coverage.\n\nFor each reviewed profile, inspect:\n\n- critical bounds and overlap\n- text fit and localization pressure\n- anchor/pivot behavior during resize and orientation change\n- safe-area placement\n- action reachability and focus path\n- whether reflow, collapse, or contextual disclosure preserves outcomes\n\nIf device simulation is unavailable, report responsive coverage as skipped. Static arithmetic alone does not prove Roblox layout behavior.\n\n### C.4 Coverage language\n\nZero findings means no finding was observed in the checks that ran. It does not mean all quality dimensions passed. Keep structure, visual, interaction, primary-view context, and responsive viewport coverage independent.\n\n## D. Tree encoding\n\n`create_tree` and `update.changes.properties` accept constrained JSON values:\n\n| Roblox type | JSON shape |\n|---|---|\n| `UDim2` | `{xScale, xOffset, yScale, yOffset}` |\n| `UDim` | `{scale, offset}` |\n| `Color3` | `{r, g, b}` |\n| `Vector2` | `{x, y}` |\n| `Vector3` | `{x, y, z}` |\n| `NumberSequence` | `number` or keypoint array |\n| `ColorSequence` | colour keypoint array |\n| `Font` | enum string or `{family, weight, style}` |\n| Enum property | item-name string |\n\nUse a JSON newline escape for multiline text and set `TextWrapped` when appropriate, or use separate `TextLabel` children with a layout component. Do not double-escape a newline into visible backslash text.\n\nKeep `Size` and `Position` in UDim2 object form. Keep colour channel conventions consistent within a tree. Preserve clear instance paths so later updates can target approved placeholders or assets.\n\n---\n\nThis tracked source is embedded into the generated server resource. Run `npm run codegen` after editing it.\n',yB=`{
245
+ `}var Q_=class{constructor(e=hz.stdin,n=hz.stdout){this._stdin=e,this._stdout=n,this._readBuffer=new X_,this._started=!1,this._ondata=r=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=r=>{this.onerror?.(r)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(n=>{let r=gz(e);this._stdout.write(r)?n():this._stdout.once("drain",n)})}};var eS=class{startPromise=null;stopPromise=null;start(e){return this.startPromise??=e(),this.startPromise}stop(e){return this.stopPromise??=(async()=>{this.startPromise&&await this.startPromise.catch(()=>{}),await e()})(),this.stopPromise}};var be;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(be||(be={}));var yz;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(yz||(yz={}));var V=be.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),za=t=>{switch(typeof t){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(t)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":return Array.isArray(t)?V.array:t===null?V.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?V.promise:typeof Map<"u"&&t instanceof Map?V.map:typeof Set<"u"&&t instanceof Set?V.set:typeof Date<"u"&&t instanceof Date?V.date:V.object;default:return V.unknown}};var D=be.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"]);var kr=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let s=r,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(n(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,be.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};kr.create=t=>new kr(t);var ioe=(t,e)=>{let n;switch(t.code){case D.invalid_type:t.received===V.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case D.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,be.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:n=`Unrecognized key(s) in object: ${be.joinValues(t.keys,", ")}`;break;case D.invalid_union:n="Invalid input";break;case D.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${be.joinValues(t.options)}`;break;case D.invalid_enum_value:n=`Invalid enum value. Expected ${be.joinValues(t.options)}, received '${t.received}'`;break;case D.invalid_arguments:n="Invalid function arguments";break;case D.invalid_return_type:n="Invalid function return type";break;case D.invalid_date:n="Invalid date";break;case D.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:be.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case D.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case D.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case D.custom:n="Invalid input";break;case D.invalid_intersection_types:n="Intersection results could not be merged";break;case D.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case D.not_finite:n="Number must be finite";break;default:n=e.defaultError,be.assertNever(t)}return{message:n}},Wo=ioe;var aoe=Wo;function af(){return aoe}var tS=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}};function z(t,e){let n=af(),r=tS({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Wo?void 0:Wo].filter(i=>!!i)});t.common.issues.push(r)}var Rn=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return Q;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let a=await i.key,o=await i.value;r.push({key:a,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return Q;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},Q=Object.freeze({status:"aborted"}),gu=t=>({status:"dirty",value:t}),Fn=t=>({status:"valid",value:t}),SE=t=>t.status==="aborted",xE=t=>t.status==="dirty",cc=t=>t.status==="valid",of=t=>typeof Promise<"u"&&t instanceof Promise;var W;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(W||(W={}));var Gr=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}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}},vz=(t,e)=>{if(cc(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new kr(t.common.issues);return this._error=n,this._error}}};function oe(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??n??s.defaultError}},description:i}}var fe=class{get description(){return this._def.description}_getType(e){return za(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:za(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Rn,ctx:{common:e.parent.common,data:e.data,parsedType:za(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(of(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:za(e)},i=this._parseSync({data:e,path:r.path,parent:r});return vz(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:za(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return cc(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>cc(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:za(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(of(i)?i:Promise.resolve(i));return vz(r,a)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:D.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new vi({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return yi.create(this,this._def)}nullable(){return Ba.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Zo.create(this)}promise(){return lc.create(this,this._def)}or(e){return _u.create([this,e],this._def)}and(e){return Su.create(this,e,this._def)}transform(e){return new vi({...oe(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new Cu({...oe(this._def),innerType:this,defaultValue:n,typeName:J.ZodDefault})}brand(){return new nS({typeName:J.ZodBranded,type:this,...oe(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ku({...oe(this._def),innerType:this,catchValue:n,typeName:J.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return rS.create(this,e)}readonly(){return Ru.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ooe=/^c[^\s-]{8,}$/i,soe=/^[0-9a-z]+$/,coe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,loe=/^[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,uoe=/^[a-z0-9_-]{21}$/i,doe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,poe=/^[-+]?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)?)??$/,moe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,foe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wE,goe=/^(?:(?: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])$/,hoe=/^(?:(?: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])$/,yoe=/^(([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]))$/,voe=/^(([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])$/,boe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_oe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bz="((\\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])))",Soe=new RegExp(`^${bz}$`);function _z(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function xoe(t){return new RegExp(`^${_z(t)}$`)}function woe(t){let e=`${bz}T${_z(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ioe(t,e){return!!((e==="v4"||!e)&&goe.test(t)||(e==="v6"||!e)&&yoe.test(t))}function Poe(t,e){if(!doe.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Coe(t,e){return!!((e==="v4"||!e)&&hoe.test(t)||(e==="v6"||!e)&&voe.test(t))}var yu=class t extends fe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==V.string){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_type,expected:V.string,received:a.parsedType}),Q}let r=new Rn,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?z(i,{code:D.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&z(i,{code:D.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")moe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"email",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")wE||(wE=new RegExp(foe,"u")),wE.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"emoji",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")loe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"uuid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")uoe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"nanoid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")ooe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")soe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cuid2",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")coe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ulid",code:D.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),z(i,{validation:"url",code:D.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"regex",code:D.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?woe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Soe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?xoe(a).test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{code:D.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?poe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"duration",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Ioe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"ip",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Poe(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"jwt",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Coe(e.data,a.version)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"cidr",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?boe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64",code:D.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?_oe.test(e.data)||(i=this._getOrReturnCtx(e,i),z(i,{validation:"base64url",code:D.invalid_string,message:a.message}),r.dirty()):be.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:D.invalid_string,...W.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...W.errToObj(e)})}url(e){return this._addCheck({kind:"url",...W.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...W.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...W.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...W.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...W.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...W.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...W.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...W.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...W.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...W.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...W.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...W.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...W.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...W.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...W.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...W.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...W.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...W.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...W.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...W.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...W.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...W.errToObj(n)})}nonempty(e){return this.min(1,W.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};yu.create=t=>new yu({checks:[],typeName:J.ZodString,coerce:t?.coerce??!1,...oe(t)});function koe(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var sf=class t extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==V.number){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_type,expected:V.number,received:a.parsedType}),Q}let r,i=new Rn;for(let a of this._def.checks)a.kind==="int"?be.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),z(r,{code:D.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?koe(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),z(r,{code:D.not_finite,message:a.message}),i.dirty()):be.assertNever(a);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:W.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:W.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:W.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:W.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:W.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&be.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};sf.create=t=>new sf({checks:[],typeName:J.ZodNumber,coerce:t?.coerce||!1,...oe(t)});var cf=class t extends fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==V.bigint)return this._getInvalidInput(e);let r,i=new Rn;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),z(r,{code:D.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):be.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return z(n,{code:D.invalid_type,expected:V.bigint,received:n.parsedType}),Q}gte(e,n){return this.setLimit("min",e,!0,W.toString(n))}gt(e,n){return this.setLimit("min",e,!1,W.toString(n))}lte(e,n){return this.setLimit("max",e,!0,W.toString(n))}lt(e,n){return this.setLimit("max",e,!1,W.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:W.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:W.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:W.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:W.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:W.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:W.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};cf.create=t=>new cf({checks:[],typeName:J.ZodBigInt,coerce:t?.coerce??!1,...oe(t)});var lf=class extends fe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==V.boolean){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.boolean,received:r.parsedType}),Q}return Fn(e.data)}};lf.create=t=>new lf({typeName:J.ZodBoolean,coerce:t?.coerce||!1,...oe(t)});var uf=class t extends fe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==V.date){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_type,expected:V.date,received:a.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return z(a,{code:D.invalid_date}),Q}let r=new Rn,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),z(i,{code:D.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):be.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:W.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:W.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};uf.create=t=>new uf({checks:[],coerce:t?.coerce||!1,typeName:J.ZodDate,...oe(t)});var df=class extends fe{_parse(e){if(this._getType(e)!==V.symbol){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.symbol,received:r.parsedType}),Q}return Fn(e.data)}};df.create=t=>new df({typeName:J.ZodSymbol,...oe(t)});var vu=class extends fe{_parse(e){if(this._getType(e)!==V.undefined){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.undefined,received:r.parsedType}),Q}return Fn(e.data)}};vu.create=t=>new vu({typeName:J.ZodUndefined,...oe(t)});var bu=class extends fe{_parse(e){if(this._getType(e)!==V.null){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.null,received:r.parsedType}),Q}return Fn(e.data)}};bu.create=t=>new bu({typeName:J.ZodNull,...oe(t)});var pf=class extends fe{constructor(){super(...arguments),this._any=!0}_parse(e){return Fn(e.data)}};pf.create=t=>new pf({typeName:J.ZodAny,...oe(t)});var Ho=class extends fe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Fn(e.data)}};Ho.create=t=>new Ho({typeName:J.ZodUnknown,...oe(t)});var Ki=class extends fe{_parse(e){let n=this._getOrReturnCtx(e);return z(n,{code:D.invalid_type,expected:V.never,received:n.parsedType}),Q}};Ki.create=t=>new Ki({typeName:J.ZodNever,...oe(t)});var mf=class extends fe{_parse(e){if(this._getType(e)!==V.undefined){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.void,received:r.parsedType}),Q}return Fn(e.data)}};mf.create=t=>new mf({typeName:J.ZodVoid,...oe(t)});var Zo=class t extends fe{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==V.array)return z(n,{code:D.invalid_type,expected:V.array,received:n.parsedType}),Q;if(i.exactLength!==null){let o=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(o||s)&&(z(n,{code:o?D.too_big:D.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(z(n,{code:D.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(z(n,{code:D.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,s)=>i.type._parseAsync(new Gr(n,o,n.path,s)))).then(o=>Rn.mergeArray(r,o));let a=[...n.data].map((o,s)=>i.type._parseSync(new Gr(n,o,n.path,s)));return Rn.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:W.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:W.toString(n)}})}nonempty(e){return this.min(1,e)}};Zo.create=(t,e)=>new Zo({type:t,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...oe(e)});function hu(t){if(t instanceof Rr){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=yi.create(hu(r))}return new Rr({...t._def,shape:()=>e})}else return t instanceof Zo?new Zo({...t._def,type:hu(t.element)}):t instanceof yi?yi.create(hu(t.unwrap())):t instanceof Ba?Ba.create(hu(t.unwrap())):t instanceof qa?qa.create(t.items.map(e=>hu(e))):t}var Rr=class t extends fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=be.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==V.object){let l=this._getOrReturnCtx(e);return z(l,{code:D.invalid_type,expected:V.object,received:l.parsedType}),Q}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ki&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||s.push(l);let c=[];for(let l of o){let u=a[l],d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Gr(i,d,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Ki){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(z(i,{code:D.unrecognized_keys,keys:s}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Gr(i,d,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let d=await u.key,p=await u.value;l.push({key:d,value:p,alwaysSet:u.alwaysSet})}return l}).then(l=>Rn.mergeObjectSync(r,l)):Rn.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return W.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:W.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:J.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of be.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of be.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return hu(this)}partial(e){let n={};for(let r of be.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of be.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof yi;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return Sz(be.objectKeys(this.shape))}};Rr.create=(t,e)=>new Rr({shape:()=>t,unknownKeys:"strip",catchall:Ki.create(),typeName:J.ZodObject,...oe(e)});Rr.strictCreate=(t,e)=>new Rr({shape:()=>t,unknownKeys:"strict",catchall:Ki.create(),typeName:J.ZodObject,...oe(e)});Rr.lazycreate=(t,e)=>new Rr({shape:t,unknownKeys:"strip",catchall:Ki.create(),typeName:J.ZodObject,...oe(e)});var _u=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new kr(s.ctx.common.issues));return z(n,{code:D.invalid_union,unionErrors:o}),Q}if(n.common.async)return Promise.all(r.map(async a=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new kr(c));return z(n,{code:D.invalid_union,unionErrors:s}),Q}}get options(){return this._def.options}};_u.create=(t,e)=>new _u({options:t,typeName:J.ZodUnion,...oe(e)});var Fa=t=>t instanceof xu?Fa(t.schema):t instanceof vi?Fa(t.innerType()):t instanceof wu?[t.value]:t instanceof Iu?t.options:t instanceof Pu?be.objectValues(t.enum):t instanceof Cu?Fa(t._def.innerType):t instanceof vu?[void 0]:t instanceof bu?[null]:t instanceof yi?[void 0,...Fa(t.unwrap())]:t instanceof Ba?[null,...Fa(t.unwrap())]:t instanceof nS||t instanceof Ru?Fa(t.unwrap()):t instanceof ku?Fa(t._def.innerType):[],IE=class t extends fe{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==V.object)return z(n,{code:D.invalid_type,expected:V.object,received:n.parsedType}),Q;let r=this.discriminator,i=n.data[r],a=this.optionsMap.get(i);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(z(n,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let a of n){let o=Fa(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:J.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...oe(r)})}};function PE(t,e){let n=za(t),r=za(e);if(t===e)return{valid:!0,data:t};if(n===V.object&&r===V.object){let i=be.objectKeys(e),a=be.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=PE(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(n===V.array&&r===V.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],c=PE(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===V.date&&r===V.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Su=class extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(a,o)=>{if(SE(a)||SE(o))return Q;let s=PE(a.value,o.value);return s.valid?((xE(a)||xE(o))&&n.dirty(),{status:n.value,value:s.data}):(z(r,{code:D.invalid_intersection_types}),Q)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Su.create=(t,e,n)=>new Su({left:t,right:e,typeName:J.ZodIntersection,...oe(n)});var qa=class t extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.array)return z(r,{code:D.invalid_type,expected:V.array,received:r.parsedType}),Q;if(r.data.length<this._def.items.length)return z(r,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&r.data.length>this._def.items.length&&(z(r,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Gr(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>Rn.mergeArray(n,o)):Rn.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};qa.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qa({items:t,typeName:J.ZodTuple,rest:null,...oe(e)})};var CE=class t extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.object)return z(r,{code:D.invalid_type,expected:V.object,received:r.parsedType}),Q;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:a._parse(new Gr(r,s,r.path,s)),value:o._parse(new Gr(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?Rn.mergeObjectAsync(n,i):Rn.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof fe?new t({keyType:e,valueType:n,typeName:J.ZodRecord,...oe(r)}):new t({keyType:yu.create(),valueType:e,typeName:J.ZodRecord,...oe(n)})}},ff=class extends fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.map)return z(r,{code:D.invalid_type,expected:V.map,received:r.parsedType}),Q;let i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([s,c],l)=>({key:i._parse(new Gr(r,s,r.path,[l,"key"])),value:a._parse(new Gr(r,c,r.path,[l,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Q;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Q;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}}}};ff.create=(t,e,n)=>new ff({valueType:e,keyType:t,typeName:J.ZodMap,...oe(n)});var gf=class t extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==V.set)return z(r,{code:D.invalid_type,expected:V.set,received:r.parsedType}),Q;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(z(r,{code:D.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(z(r,{code:D.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return Q;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}let s=[...r.data.values()].map((c,l)=>a._parse(new Gr(r,c,r.path,l)));return r.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,n){return new t({...this._def,minSize:{value:e,message:W.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:W.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};gf.create=(t,e)=>new gf({valueType:t,minSize:null,maxSize:null,typeName:J.ZodSet,...oe(e)});var kE=class t extends fe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==V.function)return z(n,{code:D.invalid_type,expected:V.function,received:n.parsedType}),Q;function r(s,c){return tS({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,af(),Wo].filter(l=>!!l),issueData:{code:D.invalid_arguments,argumentsError:c}})}function i(s,c){return tS({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,af(),Wo].filter(l=>!!l),issueData:{code:D.invalid_return_type,returnTypeError:c}})}let a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof lc){let s=this;return Fn(async function(...c){let l=new kr([]),u=await s._def.args.parseAsync(c,a).catch(m=>{throw l.addIssue(r(c,m)),l}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,a).catch(m=>{throw l.addIssue(i(d,m)),l})})}else{let s=this;return Fn(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new kr([r(c,l.error)]);let u=Reflect.apply(o,this,l.data),d=s._def.returns.safeParse(u,a);if(!d.success)throw new kr([i(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:qa.create(e).rest(Ho.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||qa.create([]).rest(Ho.create()),returns:n||Ho.create(),typeName:J.ZodFunction,...oe(r)})}},xu=class extends fe{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};xu.create=(t,e)=>new xu({getter:t,typeName:J.ZodLazy,...oe(e)});var wu=class extends fe{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return z(n,{received:n.data,code:D.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};wu.create=(t,e)=>new wu({value:t,typeName:J.ZodLiteral,...oe(e)});function Sz(t,e){return new Iu({values:t,typeName:J.ZodEnum,...oe(e)})}var Iu=class t extends fe{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return z(n,{expected:be.joinValues(r),received:n.parsedType,code:D.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return z(n,{received:n.data,code:D.invalid_enum_value,options:r}),Q}return Fn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Iu.create=Sz;var Pu=class extends fe{_parse(e){let n=be.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==V.string&&r.parsedType!==V.number){let i=be.objectValues(n);return z(r,{expected:be.joinValues(i),received:r.parsedType,code:D.invalid_type}),Q}if(this._cache||(this._cache=new Set(be.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=be.objectValues(n);return z(r,{received:r.data,code:D.invalid_enum_value,options:i}),Q}return Fn(e.data)}get enum(){return this._def.values}};Pu.create=(t,e)=>new Pu({values:t,typeName:J.ZodNativeEnum,...oe(e)});var lc=class extends fe{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==V.promise&&n.common.async===!1)return z(n,{code:D.invalid_type,expected:V.promise,received:n.parsedType}),Q;let r=n.parsedType===V.promise?n.data:Promise.resolve(n.data);return Fn(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};lc.create=(t,e)=>new lc({type:t,typeName:J.ZodPromise,...oe(e)});var vi=class extends fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{z(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return Q;let c=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return c.status==="aborted"?Q:c.status==="dirty"?gu(c.value):n.value==="dirty"?gu(c.value):c});{if(n.value==="aborted")return Q;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?Q:s.status==="dirty"?gu(s.value):n.value==="dirty"?gu(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Q:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Q:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!cc(o))return Q;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>cc(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:n.value,value:s})):Q);be.assertNever(i)}};vi.create=(t,e,n)=>new vi({schema:t,typeName:J.ZodEffects,effect:e,...oe(n)});vi.createWithPreprocess=(t,e,n)=>new vi({schema:e,effect:{type:"preprocess",transform:t},typeName:J.ZodEffects,...oe(n)});var yi=class extends fe{_parse(e){return this._getType(e)===V.undefined?Fn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yi.create=(t,e)=>new yi({innerType:t,typeName:J.ZodOptional,...oe(e)});var Ba=class extends fe{_parse(e){return this._getType(e)===V.null?Fn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ba.create=(t,e)=>new Ba({innerType:t,typeName:J.ZodNullable,...oe(e)});var Cu=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===V.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};Cu.create=(t,e)=>new Cu({innerType:t,typeName:J.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});var ku=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return of(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new kr(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new kr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ku.create=(t,e)=>new ku({innerType:t,typeName:J.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});var hf=class extends fe{_parse(e){if(this._getType(e)!==V.nan){let r=this._getOrReturnCtx(e);return z(r,{code:D.invalid_type,expected:V.nan,received:r.parsedType}),Q}return{status:"valid",value:e.data}}};hf.create=t=>new hf({typeName:J.ZodNaN,...oe(t)});var Kqe=Symbol("zod_brand"),nS=class extends fe{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},rS=class t extends fe{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Q:a.status==="dirty"?(n.dirty(),gu(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Q:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:J.ZodPipeline})}},Ru=class extends fe{_parse(e){let n=this._def.innerType._parse(e),r=i=>(cc(i)&&(i.value=Object.freeze(i.value)),i);return of(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};Ru.create=(t,e)=>new Ru({innerType:t,typeName:J.ZodReadonly,...oe(e)});var Yqe={object:Rr.lazycreate},J;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(J||(J={}));var Xqe=yu.create,Qqe=sf.create,eBe=hf.create,tBe=cf.create,nBe=lf.create,rBe=uf.create,iBe=df.create,aBe=vu.create,oBe=bu.create,sBe=pf.create,cBe=Ho.create,lBe=Ki.create,uBe=mf.create,dBe=Zo.create,Roe=Rr.create,pBe=Rr.strictCreate,mBe=_u.create,fBe=IE.create,gBe=Su.create,hBe=qa.create,yBe=CE.create,vBe=ff.create,bBe=gf.create,_Be=kE.create,SBe=xu.create,xBe=wu.create,wBe=Iu.create,IBe=Pu.create,PBe=lc.create,CBe=vi.create,kBe=yi.create,RBe=Ba.create,EBe=vi.createWithPreprocess,ABe=rS.create;function Eu(t){return!!t._zod}function Go(t,e){return Eu(t)?Zs(t,e):t.safeParse(e)}function iS(t){if(!t)return;let e;if(Eu(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Iz(t){if(Eu(t)){let a=t._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let r=t.value;if(r!==void 0)return r}function Jo(t){return t==="completed"||t==="failed"||t==="cancelled"}var $oe=Symbol("Let zodToJsonSchema decide on which parser to use");var U2e=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function RE(t){let n=iS(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let r=Iz(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function EE(t,e){let n=Go(t,e);if(!n.success)throw n.error;return n.data}var Foe=6e4,aS=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(F_,n=>{this._oncancel(n)}),this.setNotificationHandler(B_,n=>{this._onprogress(n)}),this.setRequestHandler(q_,n=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(V_,async(n,r)=>{let i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new ue(xe.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(H_,async(n,r)=>{let i=async()=>{let a=n.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(a,r.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),s.type==="response")u(c);else{let d=c,p=new ue(d.error.code,d.error.message,d.error.data);u(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(s.message,{relatedRequestId:r.requestId})}}let o=await this._taskStore.getTask(a,r.sessionId);if(!o)throw new ue(xe.InvalidParams,`Task not found: ${a}`);if(!Jo(o.status))return await this._waitForTaskUpdate(a,r.signal),await i();if(Jo(o.status)){let s=await this._taskStore.getTaskResult(a,r.sessionId);return this._clearTaskQueue(a),{...s,_meta:{...s._meta,[Vo]:{taskId:a}}}}return await i()};return await i()}),this.setRequestHandler(Z_,async(n,r)=>{try{let{tasks:i,nextCursor:a}=await this._taskStore.listTasks(n.params?.cursor,r.sessionId);return{tasks:i,nextCursor:a,_meta:{}}}catch(i){throw new ue(xe.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(J_,async(n,r)=>{try{let i=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!i)throw new ue(xe.InvalidParams,`Task not found: ${n.params.taskId}`);if(Jo(i.status))throw new ue(xe.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);let a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new ue(xe.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...a}}catch(i){throw i instanceof ue?i:new ue(xe.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,n,r,i,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(i,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:i})}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return!1;let r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),ue.fromError(xe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=a=>{r?.(a),this._onerror(a)};let i=this._transport?.onmessage;this._transport.onmessage=(a,o)=>{i?.(a,o),Jm(a)||oz(a)?this._onresponse(a):rE(a)?this._onrequest(a,o):az(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let n=ue.fromError(xe.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(n)}_onerror(e){this.onerror?.(e)}_onnotification(e){let n=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,n){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,i=this._transport,a=e.params?._meta?.[Vo]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:xe.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:u,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(u).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let s=nz(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,i?.sessionId):void 0,l={signal:o.signal,sessionId:i?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{let d={relatedRequestId:e.id};a&&(d.relatedTask={taskId:a}),await this.notification(u,d)},sendRequest:async(u,d,p)=>{let m={...p,relatedRequestId:e.id};a&&!m.relatedTask&&(m.relatedTask={taskId:a});let f=m.relatedTask?.taskId??a;return f&&c&&await c.updateTaskStatus(f,"input_required"),await this.request(u,d,m)},authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo,taskId:a,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,l)).then(async u=>{if(o.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async u=>{if(o.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:xe.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:n,...r}=e.params,i=Number(n),a=this._progressHandlers.get(i);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&o&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),o(c);return}a(r)}_onresponse(e){let n=Number(e.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),Jm(e))r(e);else{let o=new ue(e.error.code,e.error.message,e.error.data);r(o)}return}let i=this._responseHandlers.get(n);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let a=!1;if(Jm(e)&&e.result&&typeof e.result=="object"){let o=e.result;if(o.task&&typeof o.task=="object"){let s=o.task;typeof s.taskId=="string"&&(a=!0,this._taskProgressTokens.set(s.taskId,n))}}if(a||this._progressHandlers.delete(n),Jm(e))i(e);else{let o=ue.fromError(e.error.code,e.error.message,e.error.data);i(o)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,n,r){let{task:i}=r??{};if(!i){try{yield{type:"result",result:await this.request(e,n,r)}}catch(o){yield{type:"error",error:o instanceof ue?o:new ue(xe.InternalError,String(o))}}return}let a;try{let o=await this.request(e,mu,r);if(o.task)a=o.task.taskId,yield{type:"taskCreated",task:o.task};else throw new ue(xe.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:s},Jo(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)}:s.status==="failed"?yield{type:"error",error:new ue(xe.InternalError,`Task ${a} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new ue(xe.InternalError,`Task ${a} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),r?.signal?.throwIfAborted()}}catch(o){yield{type:"error",error:o instanceof ue?o:new ue(xe.InternalError,String(o))}}}request(e,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,task:s,relatedTask:c}=r??{};return new Promise((l,u)=>{let d=b=>{u(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(b){d(b);return}r?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};r?.onprogress&&(this._progressHandlers.set(p,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Vo]:c}});let f=b=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(b)}},{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(w=>this._onerror(new Error(`Failed to send cancellation: ${w}`)));let _=b instanceof ue?b:new ue(xe.RequestTimeout,String(b));u(_)};this._responseHandlers.set(p,b=>{if(!r?.signal?.aborted){if(b instanceof Error)return u(b);try{let _=Go(n,b.result);_.success?l(_.data):u(_.error)}catch(_){u(_)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let g=r?.timeout??Foe,h=()=>f(ue.fromError(xe.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,r?.maxTotalTimeout,h,r?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=_=>{let w=this._responseHandlers.get(p);w?w(_):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(p),u(_)})}else this._transport.send(m,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(b=>{this._cleanupTimeout(p),u(b)})})}async getTask(e,n){return this.request({method:"tasks/get",params:e},W_,n)}async getTaskResult(e,n,r){return this.request({method:"tasks/result",params:e},n,r)}async listTasks(e,n){return this.request({method:"tasks/list",params:e},G_,n)}async cancelTask(e,n){return this.request({method:"tasks/cancel",params:e},lz,n)}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let r=n?.relatedTask?.taskId;if(r){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Vo]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Vo]:n.relatedTask}}}),this._transport?.send(s,n).catch(c=>this._onerror(c))});return}let o={...e,jsonrpc:"2.0"};n?.relatedTask&&(o={...o,params:{...o.params,_meta:{...o.params?._meta||{},[Vo]:n.relatedTask}}}),await this._transport.send(o,n)}setRequestHandler(e,n){let r=RE(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,a)=>{let o=EE(e,i);return Promise.resolve(n(o,a))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,n){let r=RE(e);this._notificationHandlers.set(r,i=>{let a=EE(e,i);return Promise.resolve(n(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let n=this._taskProgressTokens.get(e);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,n,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,n,r,i)}async _clearTaskQueue(e,n){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,n);for(let i of r)if(i.type==="request"&&rE(i.message)){let a=i.message.id,o=this._requestResolvers.get(a);o?(o(new ue(xe.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,n){let r=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(e);i?.pollInterval&&(r=i.pollInterval)}catch{}return new Promise((i,a)=>{if(n.aborted){a(new ue(xe.InvalidRequest,"Request cancelled"));return}let o=setTimeout(i,r);n.addEventListener("abort",()=>{clearTimeout(o),a(new ue(xe.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,n){let r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async i=>{if(!e)throw new Error("No request provided");return await r.createTask(i,e.id,{method:e.method,params:e.params},n)},getTask:async i=>{let a=await r.getTask(i,n);if(!a)throw new ue(xe.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(i,a,o)=>{await r.storeTaskResult(i,a,o,n);let s=await r.getTask(i,n);if(s){let c=ef.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Jo(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>r.getTaskResult(i,n),updateTaskStatus:async(i,a,o)=>{let s=await r.getTask(i,n);if(!s)throw new ue(xe.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(Jo(s.status))throw new ue(xe.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(i,a,o,n);let c=await r.getTask(i,n);if(c){let l=ef.parse({method:"notifications/tasks/status",params:c});await this.notification(l),Jo(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>r.listTasks(i,n)}}};function Pz(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Cz(t,e){let n={...t};for(let r in e){let i=r,a=e[i];if(a===void 0)continue;let o=n[i];Pz(o)&&Pz(a)?n[i]={...o,...a}:n[i]=a}return n}var pB=Zt(fT(),1),mB=Zt(dB(),1);function Tpe(){let t=new pB.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,mB.default)(t),t}var qS=class{constructor(e){this._ajv=e??Tpe()}getValidator(e){let n="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return r=>n(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var BS=class{constructor(e){this._server=e}requestStream(e,n,r){return this._server.requestStream(e,n,r)}async getTask(e,n){return this._server.getTask({taskId:e},n)}async getTaskResult(e,n,r){return this._server.getTaskResult({taskId:e},n,r)}async listTasks(e,n){return this._server.listTasks(e?{cursor:e}:void 0,n)}async cancelTask(e,n){return this._server.cancelTask({taskId:e},n)}};function fB(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${n} does not support task creation for tools/call (required for ${e})`);break;default:break}}function gB(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${n} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var VS=class extends aS{constructor(e,n){super(n),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(rf.options.map((r,i)=>[r,i])),this.isMessageIgnored=(r,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new qS,this.setRequestHandler(oE,r=>this._oninitialize(r)),this.setNotificationHandler(sE,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(yE,async(r,i)=>{let a=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:o}=r.params,s=rf.safeParse(o);return s.success&&this._loggingLevels.set(a,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new BS(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Cz(this._capabilities,e)}setRequestHandler(e,n){let i=iS(e)?.method;if(!i)throw new Error("Schema is missing a method literal");let a;if(Eu(i)){let s=i;a=s._zod?.def?.value??s.value}else{let s=i;a=s._def?.value??s.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let s=async(c,l)=>{let u=Go(nf,c);if(!u.success){let f=u.error instanceof Error?u.error.message:String(u.error);throw new ue(xe.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:d}=u.data,p=await Promise.resolve(n(c,l));if(d.task){let f=Go(mu,p);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new ue(xe.InvalidParams,`Invalid task creation result: ${g}`)}return f.data}let m=Go(K_,p);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new ue(xe.InvalidParams,`Invalid tools/call result: ${f}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,n)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){gB(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&fB(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let n=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:QU.includes(n)?n:tE,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},z_)}async createMessage(e,n){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],a=i.some(l=>l.type==="tool_result"),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],c=s.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),u=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==u.size||![...l].every(d=>u.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},bE,n):this.request({method:"sampling/createMessage",params:e},vE,n)}async elicitInput(e,n){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=e;return this.request({method:"elicitation/create",params:i},Y_,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},Y_,n);if(a.action==="accept"&&a.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!s.valid)throw new ue(xe.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(o){throw o instanceof ue?o:new ue(xe.InternalError,`Error validating elicitation response: ${o instanceof Error?o.message:String(o)}`)}return a}}}createElicitationCompletionNotifier(e,n){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},n)}async listRoots(e,n){return this.request({method:"roots/list",params:e},_E,n)}async sendLoggingMessage(e,n){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,n))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function Ope(){let t=process.env.WEPPY_ROBLOX_MCP_VERSION?.trim();return t||null}var He=Ope()??"2.17.14";var xT="weppy://ui-studio/guide",wT="weppy://ui-studio/tokens",IT="weppy://ui-studio/functional-rules",hB=`# UI Studio Guide
246
+
247
+ **Audience:** AI agents and developers building Roblox interfaces through UI Studio.
248
+ **Resource:** \`weppy://ui-studio/guide\`
249
+ **Policy:** Design Check quality findings are advisory. Schema errors, unsupported properties, forbidden paths, destructive-action boundaries, and external upload approval remain enforceable safety rules.
250
+
251
+ ## How to use this guide
252
+
253
+ Build from project evidence, not from a built-in game subject or genre preset. The guide has three layers:
254
+
255
+ 1. The advisory usability floor covers observable interaction and readability risks.
256
+ 2. The visual vocabulary offers optional directions, not a checklist or score.
257
+ 3. The review workflow separates verified functional evidence from visual judgment.
258
+
259
+ Visual quality is contextual. Do not turn token values, shape counts, image counts, ornament counts, occupancy, or family counts into pass conditions.
260
+
261
+ ### Roblox platform guidance and user scope
262
+
263
+ Read \`platform_guidance\` in \`weppy://ui-studio/functional-rules\` when platform UI or safe-area evidence is relevant. Each entry preserves an ID, revision, \`constraint | recommendation\`, official source section and check date, application conditions, and limitations. Recommendations are not mandatory design rules. WEPPY Layout Plan defaults are composition suggestions, not Roblox requirements.
264
+
265
+ Keep three layers distinct in the explanation:
266
+
267
+ - **Observation:** the measured bounds, state, profile, coordinate space, and limitations in \`platform_ui\` and finding \`evidence\`. Preserve \`observed | estimated | unavailable\`; enabled does not imply visible or open. An intersection alone does not confirm unreadability or blocked input.
268
+ - **Official guidance:** applicable source-owned \`platform_guidance\` linked by the finding's \`guidance_refs\`. Explain why its conditions apply and retain its revision when referring to saved evidence.
269
+ - **AI interpretation:** context-dependent impact and possible adjustments, with tradeoffs where useful. A proposed adjustment is not the only solution or an official instruction.
270
+
271
+ Review-only requests end with evidence and conditional recommendations; they do not authorize create/update or changes to default controls. With existing creation or repair authorization, apply appropriate changes within that scope and verify the affected states without asking again for the same permission. Preserve explicit placement choices and do not disable default controls or force a layout merely to remove a finding. \`review_required\` and \`insufficient_evidence\` describe evidence/readiness, not a mutation prohibition.
272
+
273
+ Use declared targets, existing control choices, and relevant states from the request and project. Do not automatically require new device coverage or a Play session for every UI task. Before runtime evidence exists, use official guidance as conditional design context. If a source cannot be refreshed, use its saved check date and limitations honestly; a web lookup on every call is not required.
274
+
275
+ Inset API values have different meanings. \`GuiService.TopbarInset\` describes available topbar space, while \`GetInsetArea\` returns a usable rectangle relative to the CoreUISafeInsets area. Neither is automatically a rectangle occupied by a Roblox control. See [GuiService API documentation](https://create.roblox.com/docs/reference/engine/classes/GuiService#GetInsetArea). Compare bounds only after their coordinate spaces are reconciled, and preserve failed API observations as unavailable instead of zero insets or disabled controls.
276
+
277
+ ### Optional context-first brief
278
+
279
+ For an ambiguous request, consider \`manage_ui.design_brief\` with an omitted or partial brief. It is optional: \`create_tree\` and \`update\` accept an omitted \`briefId\`. If a reference is supplied it must resolve; report an invalid reference instead of silently ignoring it. Inspect Studio and project evidence before asking the user for information.
280
+
281
+ - An empty \`StarterGui\` proves only that no Edit UI root was observed. For an existing-UI review, return \`runtime_not_reviewed\` until a Play Client \`PlayerGui\` observation is available. Treat it as new-interface evidence only when the user explicitly asks to create new UI.
282
+ - Existing \`ScreenGui\` roots support a redesign or targeted-update interpretation.
283
+ - A selected GUI object is strong target evidence unless the user names a broader scope.
284
+ - Explicit \`projectContext\` and user choices outrank existing Studio patterns.
285
+ - Existing Studio patterns may inform continuity, but they never create a reusable subject preset.
286
+ - An explicit user placement, grouping, surface, flow, or backdrop choice outranks project evidence, existing UI, and WEPPY fallback in that order.
287
+
288
+ Choose a reasonable, revisable direction within the authorized request. Ask a focused question only when a missing choice materially changes the outcome. Include a current-state summary, a recommended choice with evidence, useful alternatives, and a free-form escape hatch. Return an exact \`brief_patch\` for an accepted recommendation.
289
+
290
+ ### Asset recommendation gate
291
+
292
+ Asset evidence is considered in this order:
293
+
294
+ 1. user-provided \`brief.reference_assets\`
295
+ 2. approved \`projectContext.approved_assets\`
296
+ 3. relevant images already used by the selected project UI
297
+ 4. \`manage_assets.search\` only when \`projectContext.asset_search_intent\` is explicit and user-approved
298
+ 5. an assetless fallback
299
+
300
+ Do not synthesize a subject search query from names, labels, hierarchy text, or Workspace content. Use asset recommendations within existing user authorization; ask only for missing permission for the actual asset operation. A recommendation is not a new design approval step. Never invent an \`rbxassetid://...\` value.
301
+
302
+ ### Calling-agent capability and image generation gate
303
+
304
+ Inspect the calling agent's actual callable image capability and local output channel. Do not infer capability from a model or client name, and never record provider credentials.
305
+
306
+ - Generation and Roblox upload have separate approval scopes; reuse authorization already granted for each operation.
307
+ - \`image_review\` means the calling agent can review an output; it does not authorize generation or upload.
308
+ - If generation or local output is unavailable or unknown, continue with approved assets or an assetless fallback.
309
+
310
+ When local generation is authorized, present the result when useful. Before a remote upload, run its preflight and check whether authorization covers the files, count, and destination; obtain only missing authorization. Missing image capability or a declined imagery recommendation does not prevent an assetless direction.
311
+
312
+ ### Optional project design context
313
+
314
+ Pass relevant repository evidence in \`projectContext\` instead of asking the Studio plugin to guess it:
315
+
316
+ - \`screen_job\`, \`primary_action\`, \`content_hierarchy\`, recommended \`required_states\`, and \`required_state_ids\` explicitly requested for the reported review coverage (not execution permission)
317
+ - \`visual_thesis\`, \`signature_motif\`, and \`forbidden_defaults\`
318
+ - \`presentation_mode\` and \`focal_region\`
319
+ - neutral \`surface_roles\` and \`shape_language\`
320
+ - role-specific \`layout_preferences\` with their decision source
321
+ - \`target_profiles\` and \`platform_distribution\`
322
+ - project-owned tokens and approved assets with evidence paths
323
+
324
+ Keep the returned \`design_contract\` and \`brief_id\` together. \`create_tree\` and \`update\` can use the saved brief or omit it. Saved context is not a new human approval requirement. Candidate directions should differ materially in composition, hierarchy, or interaction behavior; palette swaps alone are not meaningful alternatives.
325
+
326
+ ### Role-based game layout contract
327
+
328
+ WEPPY supplies style-neutral structure. The calling agent owns visual direction from explicit user intent plus game and project evidence. A WEPPY fallback must not choose the palette, font, imagery treatment, ornament, semantic shape, or numeric opacity for the project.
329
+
330
+ For an underspecified \`non_modal_overlay\`, these are possible role relationships, not placement requirements:
331
+
332
+ - \`persistent_status\`: top-left compact individual chrome, growing inward from the edge;
333
+ - \`resource_display\`: top-right compact chips in a row;
334
+ - \`navigation\`: side rail or top edge, using individual controls instead of one large shared panel;
335
+ - \`slot_action\`: bottom-center single-row flow only when the content has real slot semantics;
336
+ - \`contextual_action\`: transient lower-center or target-relative action, normally one or a few controls;
337
+ - \`objective_tracker\`: side-edge bounded group that can condense or collapse.
338
+
339
+ Consider a transparent group root for non-modal HUD regions when it suits the requested view. Opaque paint may remain inside the local bounds of a button, status chip, tracker, or other readable content surface. A contract-backed \`modal_overlay\`, \`fullscreen_navigation\`, or \`diegetic\` presentation may use a backdrop.
340
+
341
+ For touch profiles using default controls, consider the applicable platform guidance when placing a semantic slot bar. Treat touch-left, touch-right, and top-inset Layout Plan regions as advisory context unless their geometry is observed. Prefer condense, paginate, collapse, or contextual disclosure over wrapping generic actions into a multi-row bottom-center grid.
342
+
343
+ Each region can preserve \`placement_band\`, \`flow_axis\`, \`surface_mode\`, \`avoid_regions\`, \`wrap_policy\`, \`decision_source\`, and an optional numeric \`max_edge_gap_px\`. These are advisory composition constraints, not exact coordinates or a hard tree preset. When the explicit user or approved project evidence requests a different result, preserve it and report only observed functional risk. An explicit user placement without a numeric maximum does not inherit a WEPPY edge-gap limit.
344
+
345
+ ### Design Check coverage gate
346
+
347
+ \`manage_ui.check\` reports findings and coverage independently.
348
+
349
+ - \`structural_only\` means deterministic Studio checks ran without a calling-agent visual review.
350
+ - \`structural_and_visual\` means a calling agent reviewed the referenced saved preview and submitted \`visualReview\` evidence.
351
+ - \`visual_status = "not_requested" | "skipped"\` must remain visible even when deterministic findings are empty.
352
+
353
+ Use \`visualReview\` and its \`reviewContext\` only for evidence actually reviewed. If interaction states or representative primary-view context are absent, preserve \`interaction_states_not_reviewed\` or \`gameplay_context_unavailable\`. WEPPY does not call an external AI service for visual review.
354
+
355
+ For UI created only at runtime, run a structured Play session with one client, wait for the UI, and use \`snapshot_gui\` on \`{root:"PlayerGui",segments:[]}\`. Pass the saved \`{recordId,stepId}\` as \`runtimeEvidenceRef\` and use \`observationMode="runtime"\` for \`manage_ui.check\`. The Bridge validates Place, session, client, step status, and PlayerGui origin; never submit a copied tree as runtime evidence. A truncated tree remains partial coverage.
356
+
357
+ Keep semantic runtime evidence and screenshot evidence separate. Play-mode screenshot capture is unavailable in this build, so a PlayerGui snapshot can complete runtime structure coverage but cannot complete visual review by itself. Preserve \`play_screenshot_unsupported\`, \`background_unverified\`, state gaps, and other limitations.
358
+
359
+ ## Game presentation recommendations
360
+
361
+ All design choices and review steps here are recommendations. A user can keep a design or skip review; valid creation, updates, and delivery do not depend on a visual verdict. Existing readiness values describe observed evidence, not permission to work. Do not turn missing coverage into approval or ignore a requested outcome. Technical input, path, execution-mode, and evidence-integrity checks still describe what the tools can execute.
362
+
363
+ For short creation requests, choose a revisable direction from the game and project evidence and explain important assumptions briefly. Avoid asking for permission for each visual detail. For a narrow repair, preserve its scope. The available \`weppy-roblox-game-presentation-guide\` adds optional detail; this resource does not require it to be installed.
364
+
365
+ Useful considerations, only where relevant:
366
+
367
+ - Compose around the player's decision and camera: moment-to-moment status, comparison, equipment, crafting, or a contextual interaction call for different hierarchies. A repeated card layout, flatness, or no imagery is not a defect by itself.
368
+ - Compare icons' painted centers, occupied area, transparent padding, and label baselines, not just identical boxes. Keep an adequate hit area separate from the drawn symbol where helpful.
369
+ - Consider local HUD backplates and separate background opacity from foreground text and gauges. Reading panels can benefit from a quieter, more opaque surface. No opacity or placement is mandatory.
370
+ - If item grades exist, backgrounds, motifs, labels, and emblems can make them legible. Allocate overlapping rarity, selected, equipped, and unavailable states to distinguishable channels rather than letting a single color overwrite them.
371
+ - Derive beneficial or adverse stat color from meaning, not sign: lower cooldown may be better. Show the baseline, unit, delta, and an additional textual or symbolic cue where useful.
372
+ - Distinguish selected, locked, condition-not-met, pending, empty, failed, and complete states when they exist. Consider a touch/focus-visible reason for unavailable actions and preserve selection on return.
373
+ - Native shapes, existing assets, or generated parts can support the intended identity. Consider 9-slice for stretchable frames; preserve illustrations and icons from unintended stretching. Image generation and slicing are optional.
374
+ - A small scene with the intended camera, character, interaction, and UI can reveal scale and contrast issues before expanding. Narrow UI changes need not rebuild the world.
375
+ - Retain useful user corrections at component, screen, or project scope in existing project notes or tokens. Do not generalize one game's preference to others.
376
+
377
+ ## A. Advisory usability and interaction floor
378
+
379
+ These are configurable recommendations. A \`priority_high\` finding indicates urgency, not a mutation block.
380
+
381
+ ### A.1 Hit, focus, and painted surfaces
382
+
383
+ Evaluate the resolved \`AbsoluteSize\` of the interactive hit and focus area. The painted visual surface may be smaller or differently shaped when the larger invisible area does not overlap another action or hide content.
384
+
385
+ Use target-profile recommendations for touch and focus reachability. Treat them as defaults that projects may adjust with evidence. When evaluating input usability, inspect the relevant declared input modes and state which were actually observed.
386
+
387
+ ### A.2 Safe areas and readable text
388
+
389
+ Use \`ScreenInsets\`, device simulation, and the declared target profile where available. Review critical actions and information against the actual safe area rather than assuming one global inset.
390
+
391
+ For an edge-bound semantic region, compare both the container bounds and the actual painted descendant union with the declared safe boundary. The painted union includes visible background, text, image, and \`UIStroke\` geometry after \`ClipsDescendants\`. A transparent parent can therefore be attached while its visible controls remain detached. Report this as one \`edge_detached\` finding with container, visible, and internal gap evidence. AnchorPoint mismatch alone is diagnostic evidence, not a finding.
392
+
393
+ Evaluate text against the resolved background, including composable transparency. When an image, gradient, transparent game view, or complex overlay prevents a deterministic background result, return \`background_unverified\` instead of assuming a dark fallback. Check \`TextFits\`, \`TextBounds\`, clipping, long localized strings, and maximum numeric content. Contrast and text-size values are accessibility recommendations, not visual-style quotas. If \`TextScaled\` is used, constrain it with \`UITextSizeConstraint\` and verify representative locales.
394
+
395
+ Inspect visible text, images, actions, and painted progress indicators even when semantic metadata is absent. Compare direct siblings and meaningful surfaces across enabled ScreenGui roots. Exclude parent-child paint, progress fill/background composition, hidden roots, and contract-backed intentional overlap. Treat public inset and Core UI state as observed evidence; if expanded chat, player list, or touch-control geometry cannot be observed, report it as estimated or unavailable.
396
+
397
+ ### A.3 Input disclosure and state access
398
+
399
+ A readable embedded action text can be the visible label when it remains legible across declared targets and locales. Do not duplicate it with a second adjacent label.
400
+
401
+ Unfamiliar controls need an input-appropriate explanation path:
402
+
403
+ - pointer and keyboard can use hover or focus labels;
404
+ - gamepad needs a focus-visible action label and current binding;
405
+ - touch needs a persistent label, a labelled disclosure control, or another touch-visible hint.
406
+
407
+ Every declared input mode should expose the action meaning and relevant resting, focus, pressed, selected, and disabled states. Pointer hover alone does not establish all-input discoverability.
408
+
409
+ ### A.4 Primary-view protection
410
+
411
+ For \`non_modal_overlay\`, keep the Design Contract focal region visually available. If UI and the primary view compete, consider edge placement, reflow, condensation, collapse, or contextual disclosure. Do not enforce a fixed screen-occupancy ratio.
412
+
413
+ Modal, fullscreen navigation, and diegetic presentation may intentionally use a backdrop when the contract supports it. A full-screen opaque surface is not automatically wrong; its presentation role decides.
414
+
415
+ ### A.5 Supported Roblox UI components
416
+
417
+ UI Studio tree encoding supports \`UIScale\`, \`UIFlexItem\`, \`UIShadow\`, \`UIPageLayout\`, \`UITableLayout\`, \`CanvasGroup\`, \`UIDragDetector\`, \`UIAspectRatioConstraint\`, \`UISizeConstraint\`, and \`UITextSizeConstraint\` where listed by the public schema.
418
+
419
+ No class is a quality guarantee. Likewise, a \`Frame\`, \`Offset\`, sharp edge, or absent image is not a failure by itself. Report observable bounds, text-fit, reachability, focus-path, safe-area, aspect, or interaction evidence.
420
+
421
+ ## B. Visual vocabulary
422
+
423
+ This vocabulary is exploratory. Combine, omit, or extend options when project evidence supports the result. Consistency should be explained through roles and relationships, not through rigid family counts.
424
+
425
+ ### B.1 neutral surface roles
426
+
427
+ Assign visible surfaces a neutral surface role before styling:
428
+
429
+ - \`primary_action\`
430
+ - \`secondary_action\`
431
+ - \`navigation\`
432
+ - \`persistent_status\`
433
+ - \`transient_status\`
434
+ - \`resource_display\`
435
+ - \`contextual_information\`
436
+ - \`identity\`
437
+ - \`spatial_information\`
438
+ - \`slot_action\`
439
+ - \`contextual_action\`
440
+ - \`objective_tracker\`
441
+ - \`decoration\`
442
+
443
+ Projects may add opaque roles. WEPPY must not reuse their subject meaning as another project's default.
444
+
445
+ An interaction family describes how controls reveal affordance and state. It may be framed, tactile, diegetic, tab-like, ornamented, or an intentional flat control. Gradient, shadow, bevel, rounding, and imagery are optional.
446
+
447
+ ### B.2 Container edge language and semantic shape
448
+
449
+ Plan container edge language separately from semantic shape.
450
+
451
+ - Container edge language can be sharp, softly rounded, strongly rounded, cut-corner, asymmetric, organic, or project-defined.
452
+ - Semantic shapes can include a circle, ring, pill, rounded marker, directional wedge, segmented track, organic silhouette, or another project-defined form.
453
+ - A compact status marker may use a ring while a nearby action uses a pill and its containing panel uses a sharp edge language.
454
+ - Mixed semantic shapes supported by role evidence are not a style failure.
455
+
456
+ Use circles and rings where radial reading, identity, progress, direction, or compact status makes them clearer. Use pills where a short label and bounded interactive state benefit from that silhouette. Use rounded containers when softness or touch affordance supports the thesis. Preserve sharp or cut edges when they better support the project.
457
+
458
+ Do not require every surface to share one radius. Avoid arbitrary inconsistency, but explain meaningful differences through role, interaction state, hierarchy, or the signature motif.
459
+
460
+ ### B.3 Layout, anchor, and pivot strategy
461
+
462
+ Choose layout from content hierarchy, parent relationship, focal region, and target profiles.
463
+
464
+ - Edge placement protects the primary view for persistent non-modal information.
465
+ - Centered hierarchy supports intentionally modal or focused flows.
466
+ - Split, asymmetric, radial, layered, and flow layouts are valid when they clarify relationships.
467
+ - Repeated rectangles are not a default composition. Use bounded panels only where grouping, backdrop, scrolling, or interaction requires them.
468
+
469
+ Treat \`AnchorPoint\` as the element's positional pivot:
470
+
471
+ - left/top pivots suit content growing inward from those edges;
472
+ - center pivots suit centered or symmetric relationships;
473
+ - right/bottom pivots suit content growing inward from those edges;
474
+ - project-specific pivots may support a spatial or animated relationship.
475
+
476
+ When using \`create_tree\`, add optional \`layoutMetadata\` to meaningful region roots so preview metadata can preserve \`surfaceRole\`, \`placementBand\`, \`surfaceMode\`, and \`decisionSource\` for review.
477
+
478
+ Scale and Offset are tools, not pass/fail signals. Use Scale for proportional relationships, Offset for stable local dimensions, and combine them deliberately. Add \`UIScale\`, \`UISizeConstraint\`, \`UIAspectRatioConstraint\`, \`UITextSizeConstraint\`, layout components, Style Query, or project scripts when the target behavior needs them. Verify the resolved result in declared profiles.
479
+
480
+ ### B.4 Imagery strategy
481
+
482
+ Choose imagery based on explicit role evidence:
483
+
484
+ - \`symbol_set\`: consistent compact signs or glyphs
485
+ - \`content_thumbnail\`: a visual representation of selectable or referenced content
486
+ - \`identity_visual\`: a visual used primarily for identity or recognition
487
+ - \`illustrative_backdrop\`: non-interactive atmosphere or framing art
488
+ - \`diegetic_surface\`: a surface visually integrated with the project world
489
+ - \`no_imagery\`: an intentional text-and-shape direction
490
+
491
+ Different roles may justify different imagery families on one screen. Coherence comes from treatment, hierarchy, and evidence\u2014not a family quota. If no approved asset exists, use a labelled geometric marker, project-approved glyph, clear placeholder, or \`no_imagery\`.
492
+
493
+ ### B.5 Depth, ornament, type, colour, and motion
494
+
495
+ Tokens under \`weppy://ui-studio/tokens\` are examples. They can suggest palette, typography, edge, motion, depth, and composition directions, but they are never mandatory values or quality scores.
496
+
497
+ - Flatness can be intentional when hierarchy and state remain clear.
498
+ - Depth may use stroke, tonal separation, overlap, shadow, or project imagery.
499
+ - Ornament should reinforce hierarchy or a signature motif rather than fill empty space.
500
+ - Motion should explain state or relationship and respect reduced-motion evidence.
501
+ - Intentional silence\u2014no imagery, no ornament, or no motion\u2014is a valid direction without a justification or approval requirement.
502
+
503
+ ### B.6 Composition and distinctiveness
504
+
505
+ Protect a clear reading order without forcing a single focal-area percentage. Important relationships may be expressed through scale, placement, colour, typography, motion, negative space, or semantic shape.
506
+
507
+ Before applying generic equal-weight rectangles, ask whether the roles call for edge markers, radial indicators, layered surfaces, labelled controls, a bounded content region, or contextual disclosure. During development of this guidance, compare dissimilar requests to detect habitual palette-only variations. This evaluation does not require users to redesign a composition they chose.
508
+
509
+ ## C. Optional review workflow
510
+
511
+ ### C.1 Primary visual builder and critic loop
512
+
513
+ For authorized creation or refinement, consider **Builder \u2192 Preview \u2192 Critic \u2192 Update** when useful. The sequence and repetition are optional. For review-only work, inspect the existing UI and stop after the explanation:
514
+
515
+ 1. **Builder:** compose from the current request and relevant project evidence, optionally using a saved Design Contract.
516
+ 2. **Preview:** when visual inspection helps and capture is available, capture the representative primary view.
517
+ 3. **Critic:** compare the screenshot with the contract and references, then return \`recompose\`, \`refine\`, or \`approved\` with a concise summary and path-backed findings.
518
+ 4. **Update:** within the authorized scope, consider recomposition when the layout or presentation model needs adjustment, or refinement when the direction is sound. Recheck meaningful changes. Stop when the requested outcome is met, the user chooses to retain the design, or an unresolved dependency prevents further verification; report remaining findings honestly.
519
+
520
+ Do not treat schema success or an empty deterministic result as visual approval. \`approved\` requires representative primary-view evidence, no unresolved \`priority_high\` functional risk, and a resolved imagery strategy. When required imagery explicitly requested by the user or project still has only a placeholder, report that unmet outcome. Consider an authorized asset path without turning a WEPPY imagery suggestion into a requirement.
521
+
522
+ ### C.2 Visual review
523
+
524
+ If visual review is chosen, compare qualitative decisions with the current request and any relevant Design Contract:
525
+
526
+ - Is the screen job evident?
527
+ - Does hierarchy match \`content_hierarchy\`?
528
+ - Are action and information roles distinguishable?
529
+ - Does the container edge language support the visual thesis?
530
+ - Do semantic shapes have role evidence?
531
+ - Is imagery intentional, approved, or intentionally absent?
532
+ - Does the composition protect the focal region?
533
+ - Are required interaction states discoverable for declared inputs?
534
+
535
+ Do not add visual elements merely to reduce finding counts. Do not issue a failure because a surface is rectangular, circular, sharp, rounded, flat, or image-free.
536
+
537
+ ### C.3 Responsive review
538
+
539
+ Review the primary target first, then secondary and compatibility targets. User-selected targets and Experience analytics outrank a generic platform default. Excluded targets are recorded but not evaluated as required coverage.
540
+
541
+ For each reviewed profile, inspect:
542
+
543
+ - critical bounds and overlap
544
+ - text fit and localization pressure
545
+ - anchor/pivot behavior during resize and orientation change
546
+ - safe-area placement
547
+ - action reachability and focus path
548
+ - whether reflow, collapse, or contextual disclosure preserves outcomes
549
+
550
+ If device simulation is unavailable, report responsive coverage as skipped. Static arithmetic alone does not prove Roblox layout behavior.
551
+
552
+ ### C.4 Coverage language
553
+
554
+ Zero findings means no finding was observed in the checks that ran. It does not mean all quality dimensions passed. Keep structure, visual, interaction, primary-view context, and responsive viewport coverage independent.
555
+
556
+ ## D. Tree encoding
557
+
558
+ \`create_tree\` and \`update.changes.properties\` accept constrained JSON values:
559
+
560
+ | Roblox type | JSON shape |
561
+ |---|---|
562
+ | \`UDim2\` | \`{xScale, xOffset, yScale, yOffset}\` |
563
+ | \`UDim\` | \`{scale, offset}\` |
564
+ | \`Color3\` | \`{r, g, b}\` |
565
+ | \`Vector2\` | \`{x, y}\` |
566
+ | \`Vector3\` | \`{x, y, z}\` |
567
+ | \`NumberSequence\` | \`number\` or keypoint array |
568
+ | \`ColorSequence\` | colour keypoint array |
569
+ | \`Font\` | enum string or \`{family, weight, style}\` |
570
+ | Enum property | item-name string |
571
+
572
+ Use a JSON newline escape for multiline text and set \`TextWrapped\` when appropriate, or use separate \`TextLabel\` children with a layout component. Do not double-escape a newline into visible backslash text.
573
+
574
+ Keep \`Size\` and \`Position\` in UDim2 object form. Keep colour channel conventions consistent within a tree. Preserve clear instance paths so later updates can target approved placeholders or assets.
575
+
576
+ ---
577
+
578
+ This tracked source is embedded into the generated server resource. Run \`npm run codegen\` after editing it.
579
+ `,yB=`{
246
580
  "$schema": "./design-tokens.schema.json",
247
581
  "version": "2.0.0",
248
582
  "_notes": "palettes is a style-family menu, not a list of recommendations. Each entry carries mood/pairs_with/avoid_for to help match a design_brief. Adding new palettes is encouraged. See ui-studio-guide.md \xA7B.1 and \xA7C.",
@@ -772,8 +1106,8 @@ non_findings:
772
1106
  - AnchorPoint difference by itself without an observed edge-gap failure
773
1107
  - Core UI enabled state without visible/open or occupied geometry evidence
774
1108
  - a platform recommendation not adopted without an observed functional failure
775
- `;function bB(){return[{uri:xT,name:"UI Studio Guide",description:"UI Studio authoring and verification guide. Read on entry to manage_ui for the advisory usability and interaction floor, neutral visual vocabulary, and evidence-based review workflow.",mimeType:"text/markdown"},{uri:wT,name:"UI Studio Tokens",description:"Design tokens \u2014 palette families (with mood / pairs_with / avoid_for metadata), spacing densities, elevation, typography families & modular scales, corner languages, motion families (embedded JSON). Referenced by design_brief.color_palette.tokens_ref.",mimeType:"application/json"},{uri:IT,name:"UI Studio Functional Rules",description:"Machine-readable advisory usability and interaction floor with functional evidence fields and non-finding boundaries.",mimeType:"application/yaml"}]}async function _B(t){if(t===xT)return{contents:[{uri:t,mimeType:"text/markdown",text:hB}]};if(t===wT)return{contents:[{uri:t,mimeType:"application/json",text:yB}]};if(t===IT)return{contents:[{uri:t,mimeType:"application/yaml",text:vB}]};throw new Error(`unknown resource URI: ${t}`)}var PT={name:"query_instances",description:"Query Roblox instances: get, children, find child/descendant, wait for child, class info, search by name/class. [PRO] file_tree, project_structure, descendants, ancestors, search by property/tag.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","children","find_child","find_descendant","wait_for_child","class_info","search_name","search_class","search_property","search_tag","file_tree","project_structure","descendants","ancestors"],description:"Query action to perform. Basic: get, children, find_child, find_descendant, wait_for_child, class_info, search_name, search_class. [PRO]: search_property, search_tag, file_tree, project_structure, descendants, ancestors."},path:{type:"string",description:'Instance path to query (e.g., "game.Workspace.Part"). Used by: get, children, find_child, find_descendant, wait_for_child, descendants, ancestors.'},sessionDebugId:{type:"string",description:"Optional same Studio/plugin session debug identity for resolving duplicate-named path targets. Used by: get, children, descendants, ancestors."},siblingIndex:{type:"number",description:"Optional 1-based same-name sibling index fallback for resolving duplicate-named path targets. Used by: get, children, descendants, ancestors."},childName:{type:"string",description:"Name of the child instance to find. Used by: find_child, wait_for_child."},descendantName:{type:"string",description:"Name of the descendant instance to find. Used by: find_descendant."},className:{type:"string",description:"Roblox class name. Used by: find_child/find_descendant (optional filter), class_info (required), search_class (required)."},recursive:{type:"boolean",description:"If true, returns all descendants instead of just immediate children. Used by: children. Default: false."},maxDepth:{type:"number",description:"Maximum depth for recursive traversal. Used by: children (default: 10), file_tree (default: 5)."},timeout:{type:"number",description:"Maximum time to wait in seconds. Used by: wait_for_child. Default: 5. Maximum: 30."},root:{type:"string",description:'Root path to search/scan from. Used by: search_name, search_class, search_property, search_tag, file_tree, project_structure. Default: "game".'},query:{type:"string",description:"Search pattern for name search (supports * and ? wildcards). Used by: search_name."},propertyName:{type:"string",description:"[PRO] Property name to search by. Used by: search_property."},propertyValue:{description:"[PRO] Property value to match. Used by: search_property."},tag:{type:"string",description:"[PRO] Tag string to search by (case-sensitive). Used by: search_tag."},includeServices:{type:"boolean",description:'[PRO] Include Roblox services when root is "game". Used by: file_tree. Default: true.'},includeSubclasses:{type:"boolean",description:"Include subclasses in class search (e.g., BasePart finds Part, MeshPart). Used by: search_class. Default: true."},caseSensitive:{type:"boolean",description:"Case-sensitive name search. Used by: search_name. Default: false."},maxResults:{type:"number",description:"Maximum results to return. Used by: search_name, search_class, search_property, search_tag, descendants. Default: 100."},depth:{type:"number",description:"[PRO] Maximum depth for project structure traversal. Used by: project_structure. Default: 3."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"get"}}},then:{required:["path"]}},{if:{properties:{action:{const:"children"}}},then:{required:["path"]}},{if:{properties:{action:{const:"find_child"}}},then:{required:["path","childName"]}},{if:{properties:{action:{const:"find_descendant"}}},then:{required:["path","descendantName"]}},{if:{properties:{action:{const:"wait_for_child"}}},then:{required:["path","childName"]}},{if:{properties:{action:{const:"class_info"}}},then:{required:["className"]}},{if:{properties:{action:{const:"search_name"}}},then:{required:["query"]}},{if:{properties:{action:{const:"search_class"}}},then:{required:["className"]}},{if:{properties:{action:{const:"search_property"}}},then:{required:["propertyName"]}},{if:{properties:{action:{const:"search_tag"}}},then:{required:["tag"]}},{if:{properties:{action:{const:"descendants"}}},then:{required:["path"]}},{if:{properties:{action:{const:"ancestors"}}},then:{required:["path"]}}],required:["action"]}};var CT={name:"mutate_instances",description:"Create, delete, clone, move, rename, or pivot instances. [PRO] create_tree, mass_create, mass_delete, mass_duplicate, smart_duplicate, scatter.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["create","create_with_props","delete","clone","move","rename","pivot","create_tree","mass_create","mass_delete","mass_duplicate","smart_duplicate","scatter"],description:"Mutation action. Basic: create, create_with_props, delete, clone, move, rename, pivot. [PRO]: create_tree, mass_create, mass_delete, mass_duplicate, smart_duplicate, scatter."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},className:{type:"string",description:"Roblox class name (e.g., Part, Script, Folder). Used by: create, create_with_props."},parent:{type:"string",description:"Parent path for new instance. Used by: create, create_with_props."},name:{type:"string",description:"Name for the instance. Used by: create (optional), create_with_props (required)."},properties:{type:"object",description:"Properties to set on the instance. Supports Vector3, Color3, CFrame, UDim2, Enum types. Used by: create (optional), create_with_props (required).",additionalProperties:!0},path:{type:"string",description:"Instance path to operate on. Used by: delete, clone (as sourcePath), move, rename, pivot, smart_duplicate."},sessionDebugId:{type:"string",description:"Optional same Studio/plugin session debug identity for verifying a duplicate-named target. Used by: delete, clone, move, rename, pivot, smart_duplicate."},siblingIndex:{type:"number",description:"Optional 1-based same-name sibling index fallback for verifying a duplicate-named target. Used by: delete, clone, move, rename, pivot, smart_duplicate."},sourcePath:{type:"string",description:"Source instance path to clone from. Used by: clone. Alternative to path."},targetParent:{type:"string",description:"Target parent for cloned/duplicated instances. Used by: clone, mass_duplicate, smart_duplicate."},newName:{type:"string",description:"New name for instance. Used by: rename (required), clone (optional)."},newParent:{type:"string",description:"New parent path to move instance to. Used by: move."},position:{type:"object",description:"Target position as Vector3 {x, y, z}. Used by: pivot.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},cframe:{type:"array",description:"Target CFrame as 12-number array [x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22]. Used by: pivot.",minItems:12,maxItems:12,items:{type:"number"}},offset:{type:"object",description:"Relative offset to move by (ignores position/cframe). Used by: pivot, smart_duplicate.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},tree:{type:"object",description:"[PRO] Instance tree specification for hierarchical creation. Used by: create_tree.",additionalProperties:!0},instances:{type:"array",description:"[PRO] Array of instance specifications for batch creation. Used by: mass_create. Each item: {className, name, parentPath, properties?}.",items:{type:"object",required:["className","name","parentPath"],properties:{className:{type:"string"},name:{type:"string"},parentPath:{type:"string"},properties:{type:"object",additionalProperties:!0}}}},paths:{type:"array",description:"[PRO] Array of instance paths. Used by: mass_delete, mass_duplicate.",items:{type:"string"}},count:{type:"number",description:"[PRO] Number of copies to create. Used by: smart_duplicate, scatter."},templatePaths:{type:"array",description:"Template instance paths to clone. Used by: scatter. Multiple templates are picked uniformly at random.",items:{type:"string"}},region:{type:"object",description:"Placement region {min, max} in world studs (XZ used for sampling, Y bounds the ground raycast). Used by: scatter.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},seed:{type:"number",description:"Deterministic placement seed. Used by: scatter."},maxSlope:{type:"number",description:"Maximum ground slope in degrees for placement. Used by: scatter. Default: 30."},avoidWater:{type:"boolean",description:"Skip points whose ground is Water. Used by: scatter. Default: true."},alignToNormal:{type:"boolean",description:"Align instances to the surface normal (yaw jitter always applies). Used by: scatter. Default: false."},scaleJitter:{type:"object",description:"Uniform scale jitter range. Used by: scatter. Default: {min: 0.85, max: 1.25}.",properties:{min:{type:"number"},max:{type:"number"}}},minSpacing:{type:"number",description:"Minimum distance between placements in studs. Used by: scatter."},parentName:{type:"string",description:"Folder name that groups the results. Used by: scatter. Default: WeppyScatter_<seed>."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"create"}}},then:{required:["className","parent"]}},{if:{properties:{action:{const:"create_with_props"}}},then:{required:["className","parent","name","properties"]}},{if:{properties:{action:{const:"delete"}}},then:{required:["path"]}},{if:{properties:{action:{const:"clone"}}},then:{required:["sourcePath"]}},{if:{properties:{action:{const:"move"}}},then:{required:["path","newParent"]}},{if:{properties:{action:{const:"rename"}}},then:{required:["path","newName"]}},{if:{properties:{action:{const:"pivot"}}},then:{required:["path"]}},{if:{properties:{action:{const:"create_tree"}}},then:{required:["parent","tree"]}},{if:{properties:{action:{const:"mass_create"}}},then:{required:["instances"]}},{if:{properties:{action:{const:"mass_delete"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"mass_duplicate"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"smart_duplicate"}}},then:{required:["path","offset"]}},{if:{properties:{action:{const:"scatter"}}},then:{required:["templatePaths","region","count"]}}],required:["action"]}};var kT={name:"manage_properties",description:"Get/set properties, attributes, and tags on instances. [PRO] set_calculated, set_relative, mass_set, mass_get, modify_children.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","set","get_all","set_multiple","get_attr","set_attr","get_all_attrs","delete_attr","add_tag","remove_tag","check_tag","get_tags","get_tagged","set_calculated","set_relative","mass_set","mass_get","modify_children"],description:"Property action. Basic: get, set, get_all, set_multiple, get_attr, set_attr, get_all_attrs, delete_attr, add_tag, remove_tag, check_tag, get_tags, get_tagged. [PRO]: set_calculated, set_relative, mass_set, mass_get, modify_children."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Instance path. Used by: get, set, get_all, set_multiple, get_attr, set_attr, get_all_attrs, delete_attr, add_tag, remove_tag, check_tag, get_tags, set_calculated, set_relative."},property:{type:"string",description:'Property name (e.g., "Size", "Position", "Anchored"). Used by: get, set.'},value:{description:"Value to set. Supports primitives, Vector3 {x,y,z}, Color3 {r,g,b} (0-255), CFrame (12-number array), UDim2 {xScale,xOffset,yScale,yOffset}, Enum strings. Used by: set, set_attr, set_relative."},properties:{type:"object",description:"Dictionary of property names to values. Used by: set_multiple.",additionalProperties:!0},attribute:{type:"string",description:"Attribute name. Used by: get_attr, set_attr, delete_attr."},tag:{type:"string",description:"Tag string (case-sensitive). Used by: add_tag, remove_tag, check_tag."},tagName:{type:"string",description:"Tag to search for. Used by: get_tagged."},root:{type:"string",description:"Root path to filter get_tagged results. Used by: get_tagged."},maxResults:{type:"number",description:"Maximum results for get_tagged. Default: 100."},expression:{type:"string",description:'[PRO] Mathematical expression to evaluate. Used by: set_calculated. Example: "baseValue * multiplier".'},variables:{type:"object",description:'[PRO] Variable name to value/path mapping. Used by: set_calculated. Example: {"baseValue": "workspace.Config.BaseValue", "multiplier": 2}.',additionalProperties:!0},operation:{type:"string",description:"[PRO] Mathematical operation for relative property change. Used by: set_relative.",enum:["add","subtract","multiply","divide"]},amount:{description:"[PRO] Value for relative operation. Can be number, Vector3, etc. Used by: set_relative. Alias for value in set_relative context."},paths:{type:"array",description:"[PRO] Array of instance paths for bulk operations. Used by: mass_set, mass_get.",items:{type:"string"}},parentPath:{type:"string",description:"[PRO] Parent path whose children will be modified. Used by: modify_children."},modifications:{type:"object",description:"[PRO] Properties to set on children. Used by: modify_children. Contains propertyName, propertyValue, filter, recursive.",properties:{propertyName:{type:"string",description:"Property name to set on all children."},propertyValue:{description:"Value to set on all children."},filter:{type:"string",description:"Optional class name filter for children."},recursive:{type:"boolean",description:"If true, modifies all descendants. Default: false."}}},propertyName:{type:"string",description:"[PRO] Property name for mass operations or set_calculated/set_relative. Used by: mass_set, mass_get, set_calculated, set_relative, modify_children."},propertyValue:{description:"[PRO] Property value for mass_set and modify_children."},filter:{type:"string",description:"[PRO] Class name filter for modify_children."},recursive:{type:"boolean",description:"[PRO] Modify all descendants, not just immediate children. Used by: modify_children. Default: false."},includeReadOnly:{type:"boolean",description:"Include read-only properties. Used by: get_all. Default: false."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"get"}}},then:{required:["path","property"]}},{if:{properties:{action:{const:"set"}}},then:{required:["path","property","value"]}},{if:{properties:{action:{const:"get_all"}}},then:{required:["path"]}},{if:{properties:{action:{const:"set_multiple"}}},then:{required:["path","properties"]}},{if:{properties:{action:{const:"get_attr"}}},then:{required:["path","attribute"]}},{if:{properties:{action:{const:"set_attr"}}},then:{required:["path","value","attribute"]}},{if:{properties:{action:{const:"get_all_attrs"}}},then:{required:["path"]}},{if:{properties:{action:{const:"delete_attr"}}},then:{required:["path","attribute"]}},{if:{properties:{action:{const:"add_tag"}}},then:{required:["path","tag"]}},{if:{properties:{action:{const:"remove_tag"}}},then:{required:["path","tag"]}},{if:{properties:{action:{const:"check_tag"}}},then:{required:["path","tag"]}},{if:{properties:{action:{const:"get_tags"}}},then:{required:["path"]}},{if:{properties:{action:{const:"get_tagged"}}},then:{required:["tagName"]}},{if:{properties:{action:{const:"set_calculated"}}},then:{required:["path","expression","propertyName"]}},{if:{properties:{action:{const:"set_relative"}}},then:{required:["path","operation","propertyName"]}},{if:{properties:{action:{const:"mass_set"}}},then:{required:["paths","propertyName","propertyValue"]}},{if:{properties:{action:{const:"mass_get"}}},then:{required:["paths","propertyName"]}},{if:{properties:{action:{const:"modify_children"}}},then:{required:["parentPath"]}}],required:["action"]}};var RT={name:"manage_scripts",description:"Manage script source code: read, write, create, delete, edit lines, search, and validate Luau syntax. [PRO] replace across scripts.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get_source","set_source","create","delete","edit_replace","edit_insert","edit_delete","search","replace","get_dependencies","validate"],description:"Script action. Basic: get_source, set_source, create, delete, edit_replace, edit_insert, edit_delete, search, get_dependencies, validate. [PRO]: replace."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the script instance. Used by: get_source, set_source, delete, edit_replace, edit_insert, edit_delete, search, get_dependencies, replace, validate."},source:{type:"string",description:"Script source code. Used by: set_source (required), create (optional initial source), validate (one of source or path is required)."},validate:{type:"boolean",description:"Requests full validation details when Dashboard script write validation is enabled. Used by: set_source, edit_replace, edit_insert, edit_delete."},scriptType:{type:"string",description:"Type of script to create. Used by: create.",enum:["Script","LocalScript","ModuleScript"]},parent:{type:"string",description:"Parent path for new script. Used by: create."},name:{type:"string",description:"Name for new script. Used by: create."},startLine:{type:"number",description:"Starting line number, 1-based inclusive. Used by: get_source (paired with endLine), edit_replace, edit_delete. get_source requires an integer.",minimum:1},endLine:{type:"number",description:"Ending line number, 1-based inclusive. Used by: get_source (paired with startLine), edit_replace, edit_delete. get_source requires an integer.",minimum:1},newLines:{type:"string",description:"New content to replace specified lines. Used by: edit_replace. Can be multi-line."},lines:{type:"string",description:"Content to insert after afterLine. Used by: edit_insert. Can be multi-line. Alias for content."},afterLine:{type:"number",description:"Line number after which to insert. Used by: edit_insert. Use 0 to insert at beginning."},content:{type:"string",description:"Content to insert. Used by: edit_insert. Can be multi-line."},pattern:{type:"string",description:"Search pattern (plain text or Lua pattern). Used by: search, replace."},replacement:{type:"string",description:"[PRO] Replacement text. Used by: replace."},caseSensitive:{type:"boolean",description:"Case-sensitive search. Used by: search. Default: false."},wholeWord:{type:"boolean",description:"Match whole words only. Used by: search. Default: false."},usePattern:{type:"boolean",description:"Treat pattern as Lua pattern instead of plain text. Used by: search, replace. Default: false."},dryRun:{type:"boolean",description:"[PRO] Show what would be replaced without making changes. Used by: replace. Default: false."},maxResults:{type:"number",description:"Maximum results to return. Used by: search. Default: 100."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"get_source"}}},then:{required:["path"]}},{if:{properties:{action:{const:"set_source"}}},then:{required:["path","source"]}},{if:{properties:{action:{const:"create"}}},then:{required:["scriptType","parent"]}},{if:{properties:{action:{const:"delete"}}},then:{required:["path"]}},{if:{properties:{action:{const:"edit_replace"}}},then:{required:["path","startLine","endLine","newLines"]}},{if:{properties:{action:{const:"edit_insert"}}},then:{required:["path","afterLine","content"]}},{if:{properties:{action:{const:"edit_delete"}}},then:{required:["path","startLine","endLine"]}},{if:{properties:{action:{const:"search"}}},then:{required:["path","pattern"]}},{if:{properties:{action:{const:"replace"}}},then:{required:["path","pattern","replacement"]}},{if:{properties:{action:{const:"get_dependencies"}}},then:{required:["path"]}}],required:["action"]}};var ET={name:"manage_ui",description:"Create / update / verify Roblox in-game UI (ScreenGui / Frame / TextLabel / \u2026). Always start with `design_brief`. For ambiguous input, it inspects Studio context and returns candidate brief patches; Do not dump enum lists at the user. An empty StarterGui does not prove runtime UI absence: for an existing-UI review, follow `runtime_review_required`, collect a structured Play Client PlayerGui snapshot, and pass its saved `runtimeEvidenceRef`. Pass relevant repository evidence in `projectContext`; explicit screen job, visual thesis, forbidden defaults, tokens, and approved assets determine the direction without a built-in subject preset. `design_brief` returns a primary-view-first Design Contract and an advisory Layout Plan with neutral regions, AnchorPoint strategy, and responsive behavior; it is not a hard tree preset or style quota. A calling agent may declare provider-neutral image generation capability through `agentCapabilities`; missing or unavailable capability must use the explicit existing, user-provided, Creator Store, or assetless fallback. Keep the returned `brief_id`, `design_contract`, and `layout_plan` through creation, update, preview, and check. The asset recommendation gate considers user references, project assets, existing UI, and user-approved `manage_assets.search` intent; do not use a recommendation until the user accepts it. After each meaningful create or update, preview the representative primary view and submit a calling-agent critic verdict (`recompose`, `refine`, or `approved`) with `visualReview`. Read `primary_visual_verdict`, `functional_safe`, `responsive_requirement`, `responsive_ready`, `required_dimensions`, and `readiness` separately from mutation success. Responsive evidence blocks readiness only when the Design Contract marks it required. Read `weppy://ui-studio/guide` for the authoring workflow, `weppy://ui-studio/tokens` for optional visual examples, and `weppy://ui-studio/functional-rules` for machine-readable advisory evidence rules. Keep observed `platform_ui` evidence, source-owned `platform_guidance`, and AI interpretations distinct. Follow applicable Roblox recommendations as conditional guidance, not mandatory remedies. Review-only requests authorize inspection and recommendations; create or repair only within existing user authorization, without repeating permission for the same scope. Findings do not authorize disabling default controls or overriding requested placements. Missing platform observations stay unavailable; enabled state or rectangle overlap alone does not establish blocked input. Do not require unrelated Play sessions or new device states. Design Check permits `priority_high` only for observed functional visual failures such as meaningful overlap, unreadable content, invalid geometry, or primary-view occlusion; style-only findings remain medium or low.\n",inputSchema:{type:"object",properties:{action:{type:"string",enum:["design_brief","create_tree","update","delete","preview","check"],description:`UI action. [PRO]: design_brief, create_tree, update, delete, preview, check.
776
- `},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},brief:{type:"object",description:"Complete or partial design_brief object. Used by: design_brief (optional; partial allowed).",properties:{purpose:{type:"string",enum:["button","HUD","menu","modal","toast","card","form"]},platform:{type:"string",enum:["mobile","desktop","console","all"]},tone:{type:"string",enum:["modern","retro","casual","dark","minimalist","playful"]},reference_assets:{type:"array",description:"User-provided reference images or Roblox asset IDs. User references outrank existing UI images and Creator Store search candidates in the asset recommendation gate.",items:{type:"object",required:["type","value"],properties:{type:{type:"string",enum:["rbxassetid","image_url"]},value:{type:"string"}}}},resolution_targets:{type:"object",properties:{primary:{type:"string",enum:["1080p","720p","1440p"]},safezone:{type:"string",enum:["tv90","mobile_notch","none"]}}},color_palette:{type:"object",description:'Use tokens_ref only when source="tokens", and custom only when source="custom". The server accepts the branch selected by source.',properties:{source:{type:"string",enum:["tokens","custom"]},tokens_ref:{type:"string",description:"Key under `palettes` in `weppy://ui-studio/tokens` (e.g. modern_dark, brutalist_concrete, cottagecore_warm). Read tokens for the full menu and each palette's mood / pairs_with / avoid_for metadata before choosing."},custom:{type:"object",additionalProperties:{type:"string"}}}},accessibility:{type:"object",properties:{min_text_size:{type:"number"},contrast_ratio:{type:"number"}}}}},projectContext:{type:"object",description:"Optional project-specific design evidence used by design_brief. Explicit user and experience evidence determines recommendations; WEPPY does not infer a subject preset.",properties:{screen_job:{type:"string"},primary_action:{type:"string"},visual_thesis:{type:"string"},signature_motif:{type:"string"},content_hierarchy:{type:"array",items:{type:"string"}},required_states:{type:"array",items:{type:"string"}},required_state_ids:{type:"array",description:"Project-owned state identifiers that require separate review evidence before readiness.",items:{type:"string"}},forbidden_defaults:{type:"array",items:{type:"string"}},presentation_mode:{type:"string",enum:["non_modal_overlay","modal_overlay","fullscreen_navigation","diegetic"]},focal_region:{type:"string"},responsive_requirement:{type:"string",description:"Whether responsive profile coverage is advisory or required for readiness. Defaults to recommended.",enum:["recommended","required"]},imagery_strategy:{type:"object",description:"Project evidence for required, optional, or intentionally absent imagery.",required:["family","intent","evidence"],properties:{family:{type:"string",enum:["symbol_set","content_thumbnail","identity_visual","illustrative_backdrop","diegetic_surface","no_imagery"]},intent:{type:"string",enum:["required","optional","intentional_none"]},evidence:{type:"array",items:{type:"string"}}}},surface_roles:{type:"array",items:{type:"string",enum:["primary_action","secondary_action","navigation","persistent_status","transient_status","resource_display","contextual_information","identity","spatial_information","slot_action","contextual_action","objective_tracker","decoration"]}},layout_preferences:{type:"array",description:"Optional role-specific layout preferences. Explicit user and project evidence outrank WEPPY fallback values.",items:{type:"object",required:["role"],properties:{role:{type:"string",enum:["primary_action","secondary_action","navigation","persistent_status","transient_status","resource_display","contextual_information","identity","spatial_information","slot_action","contextual_action","objective_tracker","decoration"]},placement_band:{type:"string"},flow_axis:{type:"string",enum:["row","column","radial","single","free"]},surface_mode:{type:"string",enum:["transparent_group","individual_chrome","bounded_group","shared_surface","backdrop"]},avoid_regions:{type:"array",items:{type:"string"}},wrap_policy:{type:"string",enum:["no_wrap","condense","reflow","paginate","collapse"]},decision_source:{type:"string",enum:["explicit_user","project_evidence","existing_ui","weppy_fallback"]},max_edge_gap_px:{type:"number",description:"Optional maximum distance from the declared safe-area edge to painted content.",minimum:0}}}},shape_language:{type:"object",properties:{container_edges:{type:"string"},semantic_shapes:{type:"array",items:{type:"object",required:["role","intent"],properties:{role:{type:"string"},intent:{type:"string"}}}}}},target_profiles:{type:"array",items:{type:"object",required:["id","tier","viewport_class","orientation","input_modes","evidence"],properties:{id:{type:"string"},tier:{type:"string",enum:["primary","secondary","compatibility","excluded"]},viewport_class:{type:"string",enum:["small","medium","large","custom"]},width:{type:"number"},height:{type:"number"},orientation:{type:"string",enum:["portrait","landscape","any"]},input_modes:{type:"array",items:{type:"string",enum:["touch","keyboard_mouse","gamepad","mixed"]}},safe_area_policy:{type:"string"},safe_area_insets_px:{type:"object",required:["top","bottom","left","right"],properties:{top:{type:"number",minimum:0},bottom:{type:"number",minimum:0},left:{type:"number",minimum:0},right:{type:"number",minimum:0}}},evidence:{type:"array",items:{type:"string"}}}}},platform_distribution:{type:"array",items:{type:"object",required:["platform","evidence"],properties:{platform:{type:"string",enum:["computer","phone","tablet","console","vr","unknown"]},share:{type:"number"},evidence:{type:"string"}}}},asset_search_intent:{type:"string",description:"Optional user-approved Creator Store search intent. WEPPY does not synthesize subject queries when omitted."},design_tokens:{type:"object",additionalProperties:!0},approved_assets:{type:"array",items:{type:"object",required:["label","asset_id","review_status"],properties:{label:{type:"string"},asset_id:{type:"string"},asset_type:{type:"string",enum:["image","decal","icon","model","unknown"]},role:{type:"string"},asset_role:{type:"string"},review_status:{type:"string",enum:["approved","reviewed"]},evidence:{type:"string"}}}}}},agentCapabilities:{type:"object",description:"Optional provider-neutral capability declaration from the calling agent after it inspects callable tools and output channels. Do not infer these values from a model or client name. Used by: design_brief.",properties:{image_generation:{type:"string",enum:["available","unavailable","unknown"]},local_image_output:{type:"string",enum:["available","unavailable","unknown"]},image_review:{type:"string",enum:["available","unavailable","unknown"]},evidence:{type:"array",description:"Short non-secret evidence such as callable tool and local output channel names. Never include provider credentials.",items:{type:"string"}}}},briefId:{type:"string",description:"Accepted brief identifier returned by design_brief. Used by: create_tree/update (required), preview/check (optional)."},runtimeEvidenceRef:{type:"object",description:"Reference to one saved structured Playtest snapshot_gui step. The Bridge validates its Place, Studio target, client, and observation identity before use. Used by: design_brief, check.",required:["recordId","stepId"],properties:{recordId:{type:"string"},stepId:{type:"string"}}},observationMode:{type:"string",description:"Selects Edit StarterGui or validated Play Client runtime evidence. runtime requires runtimeEvidenceRef. Used by: check.",enum:["edit","runtime"]},viewportMode:{type:"string",description:"Viewport review mode. selected_profiles uses profileIds from the accepted Design Contract. Used by: preview, check.",enum:["current","selected_profiles"]},profileIds:{type:"array",description:"Selected Design Contract target profile IDs. Used by: preview, check.",items:{type:"string"}},tree:{type:"object",description:`Declarative UI tree JSON. The root must be ScreenGui.
1109
+ `;function bB(){return[{uri:xT,name:"UI Studio Guide",description:"UI Studio authoring and verification guide. Read on entry to manage_ui for the advisory usability and interaction floor, neutral visual vocabulary, and evidence-based review workflow.",mimeType:"text/markdown"},{uri:wT,name:"UI Studio Tokens",description:"Design tokens \u2014 palette families (with mood / pairs_with / avoid_for metadata), spacing densities, elevation, typography families & modular scales, corner languages, motion families (embedded JSON). Referenced by design_brief.color_palette.tokens_ref.",mimeType:"application/json"},{uri:IT,name:"UI Studio Functional Rules",description:"Machine-readable advisory usability and interaction floor with functional evidence fields and non-finding boundaries.",mimeType:"application/yaml"}]}async function _B(t){if(t===xT)return{contents:[{uri:t,mimeType:"text/markdown",text:hB}]};if(t===wT)return{contents:[{uri:t,mimeType:"application/json",text:yB}]};if(t===IT)return{contents:[{uri:t,mimeType:"application/yaml",text:vB}]};throw new Error(`unknown resource URI: ${t}`)}var PT={name:"query_instances",description:"Query Roblox instances: get, children, find child/descendant, wait for child, class info, search by name/class. [PRO] file_tree, project_structure, descendants, ancestors, search by property/tag.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","children","find_child","find_descendant","wait_for_child","class_info","search_name","search_class","search_property","search_tag","file_tree","project_structure","descendants","ancestors"],description:"Query action to perform. Basic: get, children, find_child, find_descendant, wait_for_child, class_info, search_name, search_class. [PRO]: search_property, search_tag, file_tree, project_structure, descendants, ancestors."},path:{type:"string",description:'Instance path to query (e.g., "game.Workspace.Part"). Used by: get, children, find_child, find_descendant, wait_for_child, descendants, ancestors.'},sessionDebugId:{type:"string",description:"Optional same Studio/plugin session debug identity for resolving duplicate-named path targets. Used by: get, children, descendants, ancestors."},siblingIndex:{type:"number",description:"Optional 1-based same-name sibling index fallback for resolving duplicate-named path targets. Used by: get, children, descendants, ancestors."},childName:{type:"string",description:"Name of the child instance to find. Used by: find_child, wait_for_child."},descendantName:{type:"string",description:"Name of the descendant instance to find. Used by: find_descendant."},className:{type:"string",description:"Roblox class name. Used by: find_child/find_descendant (optional filter), class_info (required), search_class (required)."},recursive:{type:"boolean",description:"If true, returns all descendants instead of just immediate children. Used by: children. Default: false."},maxDepth:{type:"number",description:"Maximum depth for recursive traversal. Used by: children (default: 10), file_tree (default: 5)."},timeout:{type:"number",description:"Maximum time to wait in seconds. Used by: wait_for_child. Default: 5. Maximum: 30."},root:{type:"string",description:'Root path to search/scan from. Used by: search_name, search_class, search_property, search_tag, file_tree, project_structure. Default: "game".'},query:{type:"string",description:"Search pattern for name search (supports * and ? wildcards). Used by: search_name."},propertyName:{type:"string",description:"[PRO] Property name to search by. Used by: search_property."},propertyValue:{description:"[PRO] Property value to match. Used by: search_property."},tag:{type:"string",description:"[PRO] Tag string to search by (case-sensitive). Used by: search_tag."},includeServices:{type:"boolean",description:'[PRO] Include Roblox services when root is "game". Used by: file_tree. Default: true.'},includeSubclasses:{type:"boolean",description:"Include subclasses in class search (e.g., BasePart finds Part, MeshPart). Used by: search_class. Default: true."},caseSensitive:{type:"boolean",description:"Case-sensitive name search. Used by: search_name. Default: false."},maxResults:{type:"number",description:"Maximum results to return. Used by: search_name, search_class, search_property, search_tag, descendants. Default: 100."},depth:{type:"number",description:"[PRO] Maximum depth for project structure traversal. Used by: project_structure. Default: 3."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"get"}}},then:{required:["path"]}},{if:{properties:{action:{const:"children"}}},then:{required:["path"]}},{if:{properties:{action:{const:"find_child"}}},then:{required:["path","childName"]}},{if:{properties:{action:{const:"find_descendant"}}},then:{required:["path","descendantName"]}},{if:{properties:{action:{const:"wait_for_child"}}},then:{required:["path","childName"]}},{if:{properties:{action:{const:"class_info"}}},then:{required:["className"]}},{if:{properties:{action:{const:"search_name"}}},then:{required:["query"]}},{if:{properties:{action:{const:"search_class"}}},then:{required:["className"]}},{if:{properties:{action:{const:"search_property"}}},then:{required:["propertyName"]}},{if:{properties:{action:{const:"search_tag"}}},then:{required:["tag"]}},{if:{properties:{action:{const:"descendants"}}},then:{required:["path"]}},{if:{properties:{action:{const:"ancestors"}}},then:{required:["path"]}}],required:["action"]}};var CT={name:"mutate_instances",description:"Create, delete, clone, move, rename, or pivot instances. [PRO] create_tree, mass_create, mass_delete, mass_duplicate, smart_duplicate, scatter.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["create","create_with_props","delete","clone","move","rename","pivot","create_tree","mass_create","mass_delete","mass_duplicate","smart_duplicate","scatter"],description:"Mutation action. Basic: create, create_with_props, delete, clone, move, rename, pivot. [PRO]: create_tree, mass_create, mass_delete, mass_duplicate, smart_duplicate, scatter."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},className:{type:"string",description:"Roblox class name (e.g., Part, Script, Folder). Used by: create, create_with_props."},parent:{type:"string",description:"Parent path for new instance. Used by: create, create_with_props."},name:{type:"string",description:"Name for the instance. Used by: create (optional), create_with_props (required)."},properties:{type:"object",description:"Properties to set on the instance. Supports Vector3, Color3, CFrame, UDim2, Enum types. Used by: create (optional), create_with_props (required).",additionalProperties:!0},path:{type:"string",description:"Instance path to operate on. Used by: delete, clone (as sourcePath), move, rename, pivot, smart_duplicate."},sessionDebugId:{type:"string",description:"Optional same Studio/plugin session debug identity for verifying a duplicate-named target. Used by: delete, clone, move, rename, pivot, smart_duplicate."},siblingIndex:{type:"number",description:"Optional 1-based same-name sibling index fallback for verifying a duplicate-named target. Used by: delete, clone, move, rename, pivot, smart_duplicate."},sourcePath:{type:"string",description:"Source instance path to clone from. Used by: clone. Alternative to path."},targetParent:{type:"string",description:"Target parent for cloned/duplicated instances. Used by: clone, mass_duplicate, smart_duplicate."},newName:{type:"string",description:"New name for instance. Used by: rename (required), clone (optional)."},newParent:{type:"string",description:"New parent path to move instance to. Used by: move."},position:{type:"object",description:"Target position as Vector3 {x, y, z}. Used by: pivot.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},cframe:{type:"array",description:"Target CFrame as 12-number array [x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22]. Used by: pivot.",minItems:12,maxItems:12,items:{type:"number"}},offset:{type:"object",description:"Relative offset to move by (ignores position/cframe). Used by: pivot, smart_duplicate.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},tree:{type:"object",description:"[PRO] Instance tree specification for hierarchical creation. Used by: create_tree.",additionalProperties:!0},instances:{type:"array",description:"[PRO] Array of instance specifications for batch creation. Used by: mass_create. Each item: {className, name, parentPath, properties?}.",items:{type:"object",required:["className","name","parentPath"],properties:{className:{type:"string"},name:{type:"string"},parentPath:{type:"string"},properties:{type:"object",additionalProperties:!0}}}},paths:{type:"array",description:"[PRO] Array of instance paths. Used by: mass_delete, mass_duplicate.",items:{type:"string"}},count:{type:"number",description:"[PRO] Number of copies to create. Used by: smart_duplicate, scatter."},templatePaths:{type:"array",description:"Template instance paths to clone. Used by: scatter. Multiple templates are picked uniformly at random.",items:{type:"string"}},region:{type:"object",description:"Placement region {min, max} in world studs (XZ used for sampling, Y bounds the ground raycast). Used by: scatter.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},seed:{type:"number",description:"Deterministic placement seed. Used by: scatter."},maxSlope:{type:"number",description:"Maximum ground slope in degrees for placement. Used by: scatter. Default: 30."},avoidWater:{type:"boolean",description:"Skip points whose ground is Water. Used by: scatter. Default: true."},alignToNormal:{type:"boolean",description:"Align instances to the surface normal (yaw jitter always applies). Used by: scatter. Default: false."},scaleJitter:{type:"object",description:"Uniform scale jitter range. Used by: scatter. Default: {min: 0.85, max: 1.25}.",properties:{min:{type:"number"},max:{type:"number"}}},minSpacing:{type:"number",description:"Minimum distance between placements in studs. Used by: scatter."},parentName:{type:"string",description:"Folder name that groups the results. Used by: scatter. Default: WeppyScatter_<seed>."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"create"}}},then:{required:["className","parent"]}},{if:{properties:{action:{const:"create_with_props"}}},then:{required:["className","parent","name","properties"]}},{if:{properties:{action:{const:"delete"}}},then:{required:["path"]}},{if:{properties:{action:{const:"clone"}}},then:{required:["sourcePath"]}},{if:{properties:{action:{const:"move"}}},then:{required:["path","newParent"]}},{if:{properties:{action:{const:"rename"}}},then:{required:["path","newName"]}},{if:{properties:{action:{const:"pivot"}}},then:{required:["path"]}},{if:{properties:{action:{const:"create_tree"}}},then:{required:["parent","tree"]}},{if:{properties:{action:{const:"mass_create"}}},then:{required:["instances"]}},{if:{properties:{action:{const:"mass_delete"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"mass_duplicate"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"smart_duplicate"}}},then:{required:["path","offset"]}},{if:{properties:{action:{const:"scatter"}}},then:{required:["templatePaths","region","count"]}}],required:["action"]}};var kT={name:"manage_properties",description:"Get/set properties, attributes, and tags on instances. [PRO] set_calculated, set_relative, mass_set, mass_get, modify_children.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","set","get_all","set_multiple","get_attr","set_attr","get_all_attrs","delete_attr","add_tag","remove_tag","check_tag","get_tags","get_tagged","set_calculated","set_relative","mass_set","mass_get","modify_children"],description:"Property action. Basic: get, set, get_all, set_multiple, get_attr, set_attr, get_all_attrs, delete_attr, add_tag, remove_tag, check_tag, get_tags, get_tagged. [PRO]: set_calculated, set_relative, mass_set, mass_get, modify_children."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Instance path. Used by: get, set, get_all, set_multiple, get_attr, set_attr, get_all_attrs, delete_attr, add_tag, remove_tag, check_tag, get_tags, set_calculated, set_relative."},property:{type:"string",description:'Property name (e.g., "Size", "Position", "Anchored"). Used by: get, set.'},value:{description:"Value to set. Supports primitives, Vector3 {x,y,z}, Color3 {r,g,b} (0-255), CFrame (12-number array), UDim2 {xScale,xOffset,yScale,yOffset}, Enum strings. Used by: set, set_attr, set_relative."},properties:{type:"object",description:"Dictionary of property names to values. Used by: set_multiple.",additionalProperties:!0},attribute:{type:"string",description:"Attribute name. Used by: get_attr, set_attr, delete_attr."},tag:{type:"string",description:"Tag string (case-sensitive). Used by: add_tag, remove_tag, check_tag."},tagName:{type:"string",description:"Tag to search for. Used by: get_tagged."},root:{type:"string",description:"Root path to filter get_tagged results. Used by: get_tagged."},maxResults:{type:"number",description:"Maximum results for get_tagged. Default: 100."},expression:{type:"string",description:'[PRO] Mathematical expression to evaluate. Used by: set_calculated. Example: "baseValue * multiplier".'},variables:{type:"object",description:'[PRO] Variable name to value/path mapping. Used by: set_calculated. Example: {"baseValue": "workspace.Config.BaseValue", "multiplier": 2}.',additionalProperties:!0},operation:{type:"string",description:"[PRO] Mathematical operation for relative property change. Used by: set_relative.",enum:["add","subtract","multiply","divide"]},amount:{description:"[PRO] Value for relative operation. Can be number, Vector3, etc. Used by: set_relative. Alias for value in set_relative context."},paths:{type:"array",description:"[PRO] Array of instance paths for bulk operations. Used by: mass_set, mass_get.",items:{type:"string"}},parentPath:{type:"string",description:"[PRO] Parent path whose children will be modified. Used by: modify_children."},modifications:{type:"object",description:"[PRO] Properties to set on children. Used by: modify_children. Contains propertyName, propertyValue, filter, recursive.",properties:{propertyName:{type:"string",description:"Property name to set on all children."},propertyValue:{description:"Value to set on all children."},filter:{type:"string",description:"Optional class name filter for children."},recursive:{type:"boolean",description:"If true, modifies all descendants. Default: false."}}},propertyName:{type:"string",description:"[PRO] Property name for mass operations or set_calculated/set_relative. Used by: mass_set, mass_get, set_calculated, set_relative, modify_children."},propertyValue:{description:"[PRO] Property value for mass_set and modify_children."},filter:{type:"string",description:"[PRO] Class name filter for modify_children."},recursive:{type:"boolean",description:"[PRO] Modify all descendants, not just immediate children. Used by: modify_children. Default: false."},includeReadOnly:{type:"boolean",description:"Include read-only properties. Used by: get_all. Default: false."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"get"}}},then:{required:["path","property"]}},{if:{properties:{action:{const:"set"}}},then:{required:["path","property","value"]}},{if:{properties:{action:{const:"get_all"}}},then:{required:["path"]}},{if:{properties:{action:{const:"set_multiple"}}},then:{required:["path","properties"]}},{if:{properties:{action:{const:"get_attr"}}},then:{required:["path","attribute"]}},{if:{properties:{action:{const:"set_attr"}}},then:{required:["path","value","attribute"]}},{if:{properties:{action:{const:"get_all_attrs"}}},then:{required:["path"]}},{if:{properties:{action:{const:"delete_attr"}}},then:{required:["path","attribute"]}},{if:{properties:{action:{const:"add_tag"}}},then:{required:["path","tag"]}},{if:{properties:{action:{const:"remove_tag"}}},then:{required:["path","tag"]}},{if:{properties:{action:{const:"check_tag"}}},then:{required:["path","tag"]}},{if:{properties:{action:{const:"get_tags"}}},then:{required:["path"]}},{if:{properties:{action:{const:"get_tagged"}}},then:{required:["tagName"]}},{if:{properties:{action:{const:"set_calculated"}}},then:{required:["path","expression","propertyName"]}},{if:{properties:{action:{const:"set_relative"}}},then:{required:["path","operation","propertyName"]}},{if:{properties:{action:{const:"mass_set"}}},then:{required:["paths","propertyName","propertyValue"]}},{if:{properties:{action:{const:"mass_get"}}},then:{required:["paths","propertyName"]}},{if:{properties:{action:{const:"modify_children"}}},then:{required:["parentPath"]}}],required:["action"]}};var RT={name:"manage_scripts",description:"Manage script source code: read, write, create, delete, edit lines, search, and validate Luau syntax. [PRO] replace across scripts.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get_source","set_source","create","delete","edit_replace","edit_insert","edit_delete","search","replace","get_dependencies","validate"],description:"Script action. Basic: get_source, set_source, create, delete, edit_replace, edit_insert, edit_delete, search, get_dependencies, validate. [PRO]: replace."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the script instance. Used by: get_source, set_source, delete, edit_replace, edit_insert, edit_delete, search, get_dependencies, replace, validate."},source:{type:"string",description:"Script source code. Used by: set_source (required), create (optional initial source), validate (one of source or path is required)."},validate:{type:"boolean",description:"Requests full validation details when Dashboard script write validation is enabled. Used by: set_source, edit_replace, edit_insert, edit_delete."},scriptType:{type:"string",description:"Type of script to create. Used by: create.",enum:["Script","LocalScript","ModuleScript"]},parent:{type:"string",description:"Parent path for new script. Used by: create."},name:{type:"string",description:"Name for new script. Used by: create."},startLine:{type:"number",description:"Starting line number, 1-based inclusive. Used by: get_source (paired with endLine), edit_replace, edit_delete. get_source requires an integer.",minimum:1},endLine:{type:"number",description:"Ending line number, 1-based inclusive. Used by: get_source (paired with startLine), edit_replace, edit_delete. get_source requires an integer.",minimum:1},newLines:{type:"string",description:"New content to replace specified lines. Used by: edit_replace. Can be multi-line."},lines:{type:"string",description:"Content to insert after afterLine. Used by: edit_insert. Can be multi-line. Alias for content."},afterLine:{type:"number",description:"Line number after which to insert. Used by: edit_insert. Use 0 to insert at beginning."},content:{type:"string",description:"Content to insert. Used by: edit_insert. Can be multi-line."},pattern:{type:"string",description:"Search pattern (plain text or Lua pattern). Used by: search, replace."},replacement:{type:"string",description:"[PRO] Replacement text. Used by: replace."},caseSensitive:{type:"boolean",description:"Case-sensitive search. Used by: search. Default: false."},wholeWord:{type:"boolean",description:"Match whole words only. Used by: search. Default: false."},usePattern:{type:"boolean",description:"Treat pattern as Lua pattern instead of plain text. Used by: search, replace. Default: false."},dryRun:{type:"boolean",description:"[PRO] Show what would be replaced without making changes. Used by: replace. Default: false."},maxResults:{type:"number",description:"Maximum results to return. Used by: search. Default: 100."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"get_source"}}},then:{required:["path"]}},{if:{properties:{action:{const:"set_source"}}},then:{required:["path","source"]}},{if:{properties:{action:{const:"create"}}},then:{required:["scriptType","parent"]}},{if:{properties:{action:{const:"delete"}}},then:{required:["path"]}},{if:{properties:{action:{const:"edit_replace"}}},then:{required:["path","startLine","endLine","newLines"]}},{if:{properties:{action:{const:"edit_insert"}}},then:{required:["path","afterLine","content"]}},{if:{properties:{action:{const:"edit_delete"}}},then:{required:["path","startLine","endLine"]}},{if:{properties:{action:{const:"search"}}},then:{required:["path","pattern"]}},{if:{properties:{action:{const:"replace"}}},then:{required:["path","pattern","replacement"]}},{if:{properties:{action:{const:"get_dependencies"}}},then:{required:["path"]}}],required:["action"]}};var ET={name:"manage_ui",description:"Create / update / verify Roblox in-game UI (ScreenGui / Frame / TextLabel / \u2026). `design_brief` is optional design guidance; create_tree and update may omit briefId. An explicitly supplied empty, unknown, expired, or unreadable briefId fails before mutation; resolve it or explicitly omit it rather than silently discarding the reference. For ambiguous input, it inspects Studio context and returns candidate brief patches; Do not dump enum lists at the user. An empty StarterGui does not prove runtime UI absence: for an existing-UI review, follow `runtime_review_required`, collect a structured Play Client PlayerGui snapshot, and pass its saved `runtimeEvidenceRef`. Pass relevant repository evidence in `projectContext`; explicit screen job, visual thesis, forbidden defaults, tokens, and approved assets determine the direction without a built-in subject preset. `design_brief` returns a primary-view-first Design Contract and an advisory Layout Plan with neutral regions, AnchorPoint strategy, and responsive behavior; it is not a hard tree preset or style quota. A calling agent may declare provider-neutral image generation capability through `agentCapabilities`; missing or unavailable capability must use the explicit existing, user-provided, Creator Store, or assetless fallback. When using a saved brief, keep its `brief_id`, `design_contract`, and `layout_plan` as context through relevant operations. Partial brief questions are optional; the calling agent can adopt or adapt recommendations within the authorized request and proceed without a saved brief. The asset recommendation considers user references, project assets, existing UI, and user-approved `manage_assets.search` intent; use recommendations within existing authorization without repeated design approval. When helpful, preview a representative primary view and submit a calling-agent critic verdict (`recompose`, `refine`, or `approved`) with `visualReview`. Brief completion, images, preview, critic approval, and repeated review are not prerequisites for mutation or delivery. Read `primary_visual_verdict`, `functional_safe`, `responsive_requirement`, `responsive_ready`, `required_dimensions`, and `readiness` separately from mutation success. Readiness describes observed evidence, not permission to mutate or deliver. Do not claim visual verification for skipped review. Responsive evidence affects readiness only when the Design Contract marks it required. Read `weppy://ui-studio/guide` for the authoring workflow, `weppy://ui-studio/tokens` for optional visual examples, and `weppy://ui-studio/functional-rules` for machine-readable advisory evidence rules. Keep observed `platform_ui` evidence, source-owned `platform_guidance`, and AI interpretations distinct. Follow applicable Roblox recommendations as conditional guidance, not mandatory remedies. Review-only requests authorize inspection and recommendations; create or repair only within existing user authorization, without repeating permission for the same scope. Findings do not authorize disabling default controls or overriding requested placements. Missing platform observations stay unavailable; enabled state or rectangle overlap alone does not establish blocked input. Do not require unrelated Play sessions or new device states. Design Check permits `priority_high` only for observed functional visual failures such as meaningful overlap, unreadable content, invalid geometry, or primary-view occlusion; style-only findings remain medium or low.\n",inputSchema:{type:"object",properties:{action:{type:"string",enum:["design_brief","create_tree","update","delete","preview","check"],description:`UI action. [PRO]: design_brief, create_tree, update, delete, preview, check.
1110
+ `},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},brief:{type:"object",description:"Complete or partial design_brief object. Used by: design_brief (optional; partial allowed).",properties:{purpose:{type:"string",enum:["button","HUD","menu","modal","toast","card","form"]},platform:{type:"string",enum:["mobile","desktop","console","all"]},tone:{type:"string",enum:["modern","retro","casual","dark","minimalist","playful"]},reference_assets:{type:"array",description:"User-provided reference images or Roblox asset IDs. User references outrank existing UI images and Creator Store search candidates in the asset recommendation gate.",items:{type:"object",required:["type","value"],properties:{type:{type:"string",enum:["rbxassetid","image_url"]},value:{type:"string"}}}},resolution_targets:{type:"object",properties:{primary:{type:"string",enum:["1080p","720p","1440p"]},safezone:{type:"string",enum:["tv90","mobile_notch","none"]}}},color_palette:{type:"object",description:'Use tokens_ref only when source="tokens", and custom only when source="custom". The server accepts the branch selected by source.',properties:{source:{type:"string",enum:["tokens","custom"]},tokens_ref:{type:"string",description:"Key under `palettes` in `weppy://ui-studio/tokens` (e.g. modern_dark, brutalist_concrete, cottagecore_warm). Read tokens for the full menu and each palette's mood / pairs_with / avoid_for metadata before choosing."},custom:{type:"object",additionalProperties:{type:"string"}}}},accessibility:{type:"object",properties:{min_text_size:{type:"number"},contrast_ratio:{type:"number"}}}}},projectContext:{type:"object",description:"Optional project-specific design evidence used by design_brief. Explicit user and experience evidence determines recommendations; WEPPY does not infer a subject preset.",properties:{screen_job:{type:"string"},primary_action:{type:"string"},visual_thesis:{type:"string"},signature_motif:{type:"string"},content_hierarchy:{type:"array",items:{type:"string"}},required_states:{type:"array",items:{type:"string"}},required_state_ids:{type:"array",description:"Project-owned state identifiers that require separate review evidence before readiness.",items:{type:"string"}},forbidden_defaults:{type:"array",items:{type:"string"}},presentation_mode:{type:"string",enum:["non_modal_overlay","modal_overlay","fullscreen_navigation","diegetic"]},focal_region:{type:"string"},responsive_requirement:{type:"string",description:"Whether responsive profile coverage is advisory or required for readiness. Defaults to recommended.",enum:["recommended","required"]},imagery_strategy:{type:"object",description:"Project evidence for required, optional, or intentionally absent imagery.",required:["family","intent","evidence"],properties:{family:{type:"string",enum:["symbol_set","content_thumbnail","identity_visual","illustrative_backdrop","diegetic_surface","no_imagery"]},intent:{type:"string",enum:["required","optional","intentional_none"]},evidence:{type:"array",items:{type:"string"}}}},surface_roles:{type:"array",items:{type:"string",enum:["primary_action","secondary_action","navigation","persistent_status","transient_status","resource_display","contextual_information","identity","spatial_information","slot_action","contextual_action","objective_tracker","decoration"]}},layout_preferences:{type:"array",description:"Optional role-specific layout preferences. Explicit user and project evidence outrank WEPPY fallback values.",items:{type:"object",required:["role"],properties:{role:{type:"string",enum:["primary_action","secondary_action","navigation","persistent_status","transient_status","resource_display","contextual_information","identity","spatial_information","slot_action","contextual_action","objective_tracker","decoration"]},placement_band:{type:"string"},flow_axis:{type:"string",enum:["row","column","radial","single","free"]},surface_mode:{type:"string",enum:["transparent_group","individual_chrome","bounded_group","shared_surface","backdrop"]},avoid_regions:{type:"array",items:{type:"string"}},wrap_policy:{type:"string",enum:["no_wrap","condense","reflow","paginate","collapse"]},decision_source:{type:"string",enum:["explicit_user","project_evidence","existing_ui","weppy_fallback"]},max_edge_gap_px:{type:"number",description:"Optional maximum distance from the declared safe-area edge to painted content.",minimum:0}}}},shape_language:{type:"object",properties:{container_edges:{type:"string"},semantic_shapes:{type:"array",items:{type:"object",required:["role","intent"],properties:{role:{type:"string"},intent:{type:"string"}}}}}},target_profiles:{type:"array",items:{type:"object",required:["id","tier","viewport_class","orientation","input_modes","evidence"],properties:{id:{type:"string"},tier:{type:"string",enum:["primary","secondary","compatibility","excluded"]},viewport_class:{type:"string",enum:["small","medium","large","custom"]},width:{type:"number"},height:{type:"number"},orientation:{type:"string",enum:["portrait","landscape","any"]},input_modes:{type:"array",items:{type:"string",enum:["touch","keyboard_mouse","gamepad","mixed"]}},safe_area_policy:{type:"string"},safe_area_insets_px:{type:"object",required:["top","bottom","left","right"],properties:{top:{type:"number",minimum:0},bottom:{type:"number",minimum:0},left:{type:"number",minimum:0},right:{type:"number",minimum:0}}},evidence:{type:"array",items:{type:"string"}}}}},platform_distribution:{type:"array",items:{type:"object",required:["platform","evidence"],properties:{platform:{type:"string",enum:["computer","phone","tablet","console","vr","unknown"]},share:{type:"number"},evidence:{type:"string"}}}},asset_search_intent:{type:"string",description:"Optional user-approved Creator Store search intent. WEPPY does not synthesize subject queries when omitted."},design_tokens:{type:"object",additionalProperties:!0},approved_assets:{type:"array",items:{type:"object",required:["label","asset_id","review_status"],properties:{label:{type:"string"},asset_id:{type:"string"},asset_type:{type:"string",enum:["image","decal","icon","model","unknown"]},role:{type:"string"},asset_role:{type:"string"},review_status:{type:"string",enum:["approved","reviewed"]},evidence:{type:"string"}}}}}},agentCapabilities:{type:"object",description:"Optional provider-neutral capability declaration from the calling agent after it inspects callable tools and output channels. Do not infer these values from a model or client name. Used by: design_brief.",properties:{image_generation:{type:"string",enum:["available","unavailable","unknown"]},local_image_output:{type:"string",enum:["available","unavailable","unknown"]},image_review:{type:"string",enum:["available","unavailable","unknown"]},evidence:{type:"array",description:"Short non-secret evidence such as callable tool and local output channel names. Never include provider credentials.",items:{type:"string"}}}},briefId:{type:"string",description:"Optional saved brief identifier returned by design_brief. Used by: create_tree/update/preview/check. Omit when unnecessary. For create_tree/update, an explicitly supplied invalid or expired reference fails before mutation; resolve it or explicitly omit it."},runtimeEvidenceRef:{type:"object",description:"Reference to one saved structured Playtest snapshot_gui step. The Bridge validates its Place, Studio target, client, and observation identity before use. Used by: design_brief, check.",required:["recordId","stepId"],properties:{recordId:{type:"string"},stepId:{type:"string"}}},observationMode:{type:"string",description:"Selects Edit StarterGui or validated Play Client runtime evidence. runtime requires runtimeEvidenceRef. Used by: check.",enum:["edit","runtime"]},viewportMode:{type:"string",description:"Viewport review mode. selected_profiles uses profileIds from the accepted Design Contract. Used by: preview, check.",enum:["current","selected_profiles"]},profileIds:{type:"array",description:"Selected Design Contract target profile IDs. Used by: preview, check.",items:{type:"string"}},tree:{type:"object",description:`Declarative UI tree JSON. The root must be ScreenGui.
777
1111
  Schema: {className: string, name?: string, parent?: string, properties?: {...}, layoutMetadata?: {...}, children?: Tree[]}
778
1112
  Omit parent to use StarterGui. className is limited to supported Roblox GUI classes: ScreenGui/Frame/TextLabel/TextButton/ImageLabel/ImageButton/ScrollingFrame/TextBox/UIListLayout/UIGridLayout/UIPadding/UICorner/UIStroke/UIAspectRatioConstraint/UIGradient/UITextSizeConstraint/UISizeConstraint/UIScale/UIFlexItem/UIShadow/UIPageLayout/UITableLayout/CanvasGroup/UIDragDetector.
779
1113
 
@@ -786,11 +1120,11 @@ Property value encoding:
786
1120
  Use {xScale, xOffset, yScale, yOffset} for UDim2, {scale, offset} for UDim, {r, g, b} for Color3, {x,y}/{x,y,z} for Vector2/Vector3, and the item name string for Enum values.
787
1121
  `},targetPath:{type:"string",description:"Path to existing UI instance. Both `StarterGui.MyGui` and `game.StarterGui.MyGui` are accepted. Used by: update, delete (required)."},changes:{type:"object",description:`Partial update specification: {properties?: {...}, addChildren?: Tree[], removeChildren?: [string]}
788
1122
  properties contains key/value pairs compatible with Instance property assignment. Values follow the Property value encoding documented by tree.
789
- `},visualReview:{type:"object",description:"Optional provider-neutral visual review written by the calling agent after it inspects one saved manage_ui.preview screenshot. Findings are advisory only and never block UI changes. Used by: check.",required:["snapshotId","verdict","summary","findings"],properties:{snapshotId:{type:"string",description:"Exact saved manage_ui.preview snapshot_id reviewed by the calling agent."},verdict:{type:"string",description:"Primary visual critic verdict for the reviewed snapshot.",enum:["recompose","refine","approved"]},summary:{type:"string",description:"Non-empty critic rationale grounded in the reviewed snapshot and reference evidence."},findings:{type:"array",description:"Zero or more visual findings. An empty array requires verdict=approved, a non-empty summary, and representative context evidence.",items:{type:"object",required:["rule","path","displayPriority","actual","expected","hint"],properties:{rule:{type:"string",enum:["visual_readability","visual_overlap","visual_geometry","primary_view_occlusion","visual_hierarchy","visual_identity"]},path:{type:"string",description:"Visible GUI path from the reviewed snapshot metadata."},displayPriority:{type:"string",enum:["priority_high","priority_medium","priority_low"]},actual:{type:"string"},expected:{type:"string"},hint:{type:"string"},confidence:{type:"number"}}}},reviewContext:{type:"object",description:"Declares whether the reviewed snapshot covered interaction states and representative gameplay context. Omitting reviewContext treats both contexts as not reviewed.",required:["interactionStatesReviewed","gameplayContextReviewed"],properties:{interactionStatesReviewed:{type:"boolean"},gameplayContextReviewed:{type:"boolean"},responsiveViewportsReviewed:{type:"array",items:{type:"string"}}}}}},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"create_tree"}}},then:{required:["briefId","tree"]}},{if:{properties:{action:{const:"update"}}},then:{required:["briefId","targetPath","changes"]}},{if:{properties:{action:{const:"delete"}}},then:{required:["targetPath"]}}],required:["action"]}};var AT={name:"manage_lighting",description:"[PRO] Configure environment: lighting, atmosphere, sky, terrain properties, time of day.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["lighting","atmosphere","sky","terrain_props","time","mood"],description:"[PRO] Environment action. lighting: set Lighting service properties. atmosphere: set Atmosphere properties. sky: set Sky properties. terrain_props: set Terrain water/visual properties. time: set time of day. mood: apply a full environment mood preset with overrides."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},properties:{type:"object",description:"Dictionary of properties to set. Used by: lighting, atmosphere, sky, terrain_props. Supports Color3 {r,g,b} (0-255), numbers, booleans, Enum strings.",additionalProperties:!0},createIfMissing:{type:"boolean",description:"Create Atmosphere/Sky instance if missing. Used by: atmosphere, sky. Default: true."},time:{type:"string",description:'Time string in "HH:MM:SS" format (e.g., "14:30:00"). Used by: time. Provide this OR clockTime.'},clockTime:{type:"number",description:"Numeric time in 24-hour format (e.g., 14.5 for 2:30 PM). Used by: time. Provide this OR time."},preset:{type:"string",description:"Environment mood preset. Used by: mood. Applies Lighting + Atmosphere + Sky + post effects + Terrain water appearance in one call.",enum:["sunny_day","golden_hour","sunset","dawn","night","moonlit_night","overcast","foggy","stormy","eerie"]},overrides:{type:"object",description:"Per-section property overrides applied on top of the preset. Used by: mood. Sections: lighting, atmosphere, sky, effects, water. Values follow the same conversion rules as the properties param.",properties:{lighting:{type:"object",additionalProperties:!0},atmosphere:{type:"object",additionalProperties:!0},sky:{type:"object",additionalProperties:!0},effects:{type:"object",additionalProperties:!0},water:{type:"object",additionalProperties:!0}}},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"mood"}}},then:{required:["preset"]}}],required:["action"]}};var TT={name:"manage_selection",description:"Get, set, or clear selection. [PRO] context, details, add/remove items, watch changes.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","set","clear","cached","context","details","add","remove","watch"],description:"Selection action. Basic: get (current selection), set (replace selection), clear (deselect all), cached (from cache without round-trip). [PRO]: context (detailed with source/properties), details (hierarchical with ancestors/descendants), add (add to selection), remove (remove from selection), watch (monitor changes)."},paths:{type:"array",description:"Array of instance paths. Used by: set (required), add (required), remove (required).",items:{type:"string"}},maxAge:{type:"number",description:"Maximum age of cached data in milliseconds. Used by: cached. Default: 30000. Set to 0 for any age."},maxDepth:{type:"number",description:"[PRO] Maximum depth for descendant tree traversal. Used by: details. Default: 1."},includeSource:{type:"boolean",description:"[PRO] Include script source code. Used by: context. Default: true."},includeProperties:{type:"boolean",description:"[PRO] Include all readable properties. Used by: context. Default: true."},includeChildren:{type:"boolean",description:"[PRO] Include immediate children. Used by: context. Default: false."},includeAncestors:{type:"boolean",description:"[PRO] Include full ancestor chain. Used by: details. Default: false."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"set"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"add"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"remove"}}},then:{required:["paths"]}}],required:["action"]}};var OT={name:"manage_camera",description:"Camera operations: get info, focus on instance/position, suggest view, capture Edit-mode viewport screenshot (Edit mode only; not usable during playtest).",inputSchema:{type:"object",properties:{action:{type:"string",enum:["info","focus_path","focus_position","suggest","screenshot"],description:'Camera action. info: get current camera position, rotation, FOV, viewport size. focus_path: move camera to focus on instance by path. focus_position: move camera to focus on world position. suggest: get suggested camera view for a target. [PRO] screenshot: **EDIT MODE ONLY \u2014 DO NOT call while a playtest is active.** Captures the current Studio Edit-mode viewport as a PNG image (returns MCP image content). If you are uncertain whether a playtest is running, call manage_studio.play_status first and only proceed when state == "edit"; otherwise the call returns an error. Requires Studio Mesh/Image capability. In Studio, open File \u2192 Experience Settings \u2192 Security and enable "Allow Mesh / Image APIs". Resolution capped by plugin setting screenshotMaxDimension (default 1024px on longest side; kept at full resolution by Claude while reducing token cost ~40% vs 1280). Play-mode capture is not supported in v1 because Roblox platform blocks converting CaptureService temporary contentId into EditableImage from any non-edit-DM context.'},path:{type:"string",description:"Instance path to focus on. Used by: focus_path (if not provided, focuses on selection), suggest (if not provided, uses selection)."},position:{type:"object",description:"World position to focus on as Vector3. Used by: focus_position (required).",required:["x","y","z"],properties:{x:{type:"number",description:"X coordinate"},y:{type:"number",description:"Y coordinate"},z:{type:"number",description:"Z coordinate"}}},distance:{type:"number",description:"Distance from target in studs. Used by: focus_path, focus_position. Auto-calculated if not provided."},duration:{type:"number",description:"Animation duration in seconds. Used by: focus_path, focus_position. Default: 0.5."},offset:{type:"object",description:"Camera offset direction from target (normalized and scaled by distance). Used by: focus_path, focus_position. Default: {x:1, y:0.5, z:1}.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},lookAt:{type:"object",description:"Point for camera to look at. Used by: focus_position.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},respectAutoFocusSetting:{type:"boolean",description:"If true, only focus when plugin Auto Focus setting is enabled. Used by: focus_path, focus_position. Default: false."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"focus_position"}}},then:{required:["position"]}}],required:["action"]}};var DT={name:"manage_tween",description:"[PRO] Tween service: create, play, pause, cancel tweens for smooth animations.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["create","play","pause","cancel"],description:"[PRO] Tween action. create: create a new tween with target properties. play: play a created tween. pause: pause a running tween. cancel: cancel a tween."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Instance path to tween. Used by: create (required)."},tweenInfo:{type:"object",description:"Tween configuration. Used by: create.",properties:{time:{type:"number",description:"Duration in seconds. Default: 1."},easingStyle:{type:"string",description:'Easing style (e.g., "Linear", "Quad", "Cubic", "Sine", "Bounce", "Elastic"). Default: "Quad".'},easingDirection:{type:"string",description:'Easing direction. Default: "Out".',enum:["In","Out","InOut"]},repeatCount:{type:"number",description:"Number of times to repeat. -1 for infinite. Default: 0."},reverses:{type:"boolean",description:"Whether the tween reverses on each repeat. Default: false."},delayTime:{type:"number",description:"Delay before tween starts in seconds. Default: 0."}}},properties:{type:"object",description:"Target property values to tween to. Used by: create. Supports Vector3, Color3, numbers, etc.",additionalProperties:!0},tweenId:{type:"string",description:"Tween identifier returned by create. Used by: play, pause, cancel."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"create"}}},then:{required:["path"]}}],required:["action"]}};var NT={name:"manage_audio",description:"[PRO] Audio management: play, stop, pause, resume sounds. Set audio listener.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["play","stop","pause","resume","set_listener"],description:"[PRO] Audio action. play: play a sound (creates Sound if needed). stop: stop a playing sound. pause: pause a playing sound. resume: resume a paused sound. set_listener: set the audio listener type/target."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the Sound instance or parent to create Sound in. Used by: play, stop, pause, resume."},soundId:{type:"string",description:'Roblox sound asset ID (e.g., "rbxassetid://1234567"). Used by: play (if creating a new Sound).'},volume:{type:"number",description:"Sound volume (0-10). Used by: play. Default: 0.5."},looped:{type:"boolean",description:"Whether the sound loops. Used by: play. Default: false."},playbackSpeed:{type:"number",description:"Playback speed multiplier. Used by: play. Default: 1."},listenerType:{type:"string",description:"Listener type for SoundService. Used by: set_listener.",enum:["Camera","CFrame","ObjectPosition","ObjectCFrame"]},listenerPath:{type:"string",description:"Instance path for ObjectPosition/ObjectCFrame listener type. Used by: set_listener."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var $T={name:"manage_animation",description:"[PRO] Animation: load, play, stop animations. Get animation tracks from humanoid/controller.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["load","play","stop","get_tracks"],description:"[PRO] Animation action. load: load an animation on a Humanoid/AnimationController. play: play a loaded animation track. stop: stop a playing animation. get_tracks: list all loaded animation tracks."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the Humanoid, AnimationController, or Model containing one. Used by: load, play, stop, get_tracks."},animationId:{type:"string",description:'Roblox animation asset ID (e.g., "rbxassetid://1234567"). Used by: load.'},trackId:{type:"string",description:"Animation track identifier returned by load. Used by: play (required), stop (required)."},speed:{type:"number",description:"Playback speed multiplier. Used by: play. Default: 1."},fadeTime:{type:"number",description:"Fade time in seconds when starting/stopping. Used by: play, stop. Default: 0.1."},weight:{type:"number",description:"Animation weight (0-1) for blending. Used by: play. Default: 1."},priority:{type:"string",description:"Animation priority. Used by: play.",enum:["Core","Idle","Movement","Action","Action2","Action3","Action4"]},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"play"}}},then:{required:["trackId"]}},{if:{properties:{action:{const:"stop"}}},then:{required:["trackId"]}}],required:["action"]}};var jT={name:"manage_physics",description:"[PRO] Physics collision groups: register, set collidable between groups, list groups.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["register_group","set_collidable","get_groups"],description:"[PRO] Physics action. register_group: register a new collision group with PhysicsService. set_collidable: set whether two groups can collide. get_groups: list all registered collision groups."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},groupName:{type:"string",description:"Collision group name. Used by: register_group (required)."},group1:{type:"string",description:"First collision group name. Used by: set_collidable (required)."},group2:{type:"string",description:"Second collision group name. Used by: set_collidable (required)."},collidable:{type:"boolean",description:"Whether the two groups can collide. Used by: set_collidable (required)."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"register_group"}}},then:{required:["groupName"]}},{if:{properties:{action:{const:"set_collidable"}}},then:{required:["group1","group2","collidable"]}}],required:["action"]}};var MT={name:"manage_effects",description:"[PRO] Particle effects: emit particles, clear all particles, toggle effect enabled state.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["emit","clear","toggle"],description:"[PRO] Effects action. emit: emit a burst of particles from a ParticleEmitter. clear: clear all particles from a ParticleEmitter or all emitters under an instance. toggle: enable or disable a ParticleEmitter, Beam, Trail, or other effect."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the effect instance (ParticleEmitter, Beam, Trail) or parent containing effects. Used by: emit, clear, toggle."},count:{type:"number",description:"Number of particles to emit in a burst. Used by: emit. Default: 16."},enabled:{type:"boolean",description:"Enable or disable the effect. Used by: toggle."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var LT={name:"manage_terrain",description:"[PRO] Terrain operations: fill shapes, clear regions, replace materials, manage colors, read/write voxels, generate procedural terrain, smooth terrain.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["fill_block","fill_ball","fill_cylinder","fill_wedge","clear_region","clear_bounds","replace_material","colors_get","colors_set","read_voxel","read_voxels","write_voxels","generate","smooth"],description:"[PRO] Terrain action. fill_block/fill_ball/fill_cylinder/fill_wedge: fill shapes with material. clear_region/clear_bounds: clear terrain. replace_material: swap materials in region. colors_get/colors_set: manage material colors. read_voxel: single voxel. read_voxels/write_voxels: bulk voxels. generate: procedural terrain. smooth: smooth terrain."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},material:{type:"string",description:"Terrain material name (e.g., Grass, Rock, Water, Sand, Slate, Concrete). Used by: fill_*, replace_material, colors_get, colors_set."},center:{type:"object",description:"Center position as Vector3. Used by: fill_ball.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},position:{type:"object",description:"Position as Vector3. Used by: read_voxel.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},cframe:{type:"object",description:"Position and rotation for fill shapes. Used by: fill_block, fill_cylinder, fill_wedge.",required:["position"],properties:{position:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},rotation:{type:"object",description:"Optional rotation in degrees.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},size:{type:"object",description:"Size in studs. Used by: fill_block, fill_wedge.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},radius:{type:"number",description:"Radius in studs. Used by: fill_ball, fill_cylinder."},height:{type:"number",description:"Height in studs. Used by: fill_cylinder."},region:{type:"object",description:"Rectangular region with min/max corners. Used by: clear_region, replace_material, read_voxels, write_voxels, generate, smooth.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},min:{type:"object",description:"Minimum corner for bounds-based clear. Used by: clear_bounds.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",description:"Maximum corner for bounds-based clear. Used by: clear_bounds.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},sourceMaterial:{type:"string",description:"Material to replace. Used by: replace_material."},targetMaterial:{type:"string",description:"Replacement material. Used by: replace_material."},color:{type:"object",description:"RGB color (0-255). Used by: colors_set.",required:["r","g","b"],properties:{r:{type:"number",minimum:0,maximum:255},g:{type:"number",minimum:0,maximum:255},b:{type:"number",minimum:0,maximum:255}}},resolution:{type:"number",description:"Voxel resolution (studs per voxel). Used by: read_voxels, write_voxels. Default: 4."},materials:{type:"array",description:"3D array of material names [x][y][z]. Used by: write_voxels.",items:{type:"array",items:{type:"array",items:{type:"string"}}}},occupancy:{type:"array",description:"3D array of occupancy values [x][y][z] (0-1). Used by: write_voxels.",items:{type:"array",items:{type:"array",items:{type:"number",minimum:0,maximum:1}}}},baseHeight:{type:"number",description:"Base terrain height in studs. Used by: generate. Default: 32."},amplitude:{type:"number",description:"Height variation amplitude in studs. Used by: generate. Default: 24."},frequency:{type:"number",description:"Noise frequency (0.001-0.1). Used by: generate. Default: 0.01.",minimum:.001,maximum:.1},seed:{type:"number",description:"Random seed for terrain generation. Used by: generate."},layers:{type:"array",description:"Material layers by height. Used by: generate. Each: {material, maxHeight}.",items:{type:"object",required:["material","maxHeight"],properties:{material:{type:"string"},maxHeight:{type:"number"}}}},intensity:{type:"number",description:"Smoothing intensity (0-1). Used by: smooth. Default: 0.5.",minimum:0,maximum:1},preset:{type:"string",description:"Biome preset for natural terrain. Used by: generate. Explicit parameters override preset values.",enum:["mountains","hills","plains","dunes","islands","canyon"]},octaves:{type:"number",description:"fBm noise octave count (1-8). Used by: generate. Default: 4.",minimum:1,maximum:8},persistence:{type:"number",description:"Amplitude decay between octaves (0-1). Used by: generate. Default: 0.5.",minimum:0,maximum:1},waterLevel:{type:"number",description:"Absolute water surface height in studs. Used by: generate. Empty space below this level is filled with Water."},edgeBlend:{type:"object",description:"Blend generated heights into existing terrain at region borders. Used by: generate.",required:["enabled"],properties:{enabled:{type:"boolean"},width:{type:"number",description:"Blend falloff width in studs. Default: 32."}}},materialPalette:{type:"object",description:"Material palette override {surface, cliff, shore, underwater}. Used by: generate.",properties:{surface:{type:"string"},cliff:{type:"string"},shore:{type:"string"},underwater:{type:"string"}}},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"generate"}}},then:{required:["region"]}}],required:["action"]}};var UT={name:"spatial_query",description:"[PRO] Spatial queries: raycast, find ground, check placement, multi-raycast, scan area, find flat areas, find spawn positions, analyze walkable, spatial map, find empty space, get bounds, snap to grid, check collision.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["raycast","find_ground","check_placement","multi_raycast","scan_area","find_flat","find_spawn","analyze_walkable","spatial_map","find_space","bounds","snap_grid","collision"],description:"[PRO] Spatial action. raycast: single ray. find_ground: ground below point. check_placement: collision-free placement check. multi_raycast: batch rays. scan_area: heightmap generation. find_flat: flat areas for building. find_spawn: spawn positions. analyze_walkable: walkability grid. spatial_map: all BasePart positions. find_space: empty space for object. bounds: bounding box. snap_grid: snap position to grid. collision: AABB collision check."},origin:{type:"object",description:"Ray origin as Vector3. Used by: raycast.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},direction:{type:"object",description:"Ray direction and length as Vector3. Used by: raycast.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},maxDistance:{type:"number",description:"Maximum distance for ground search. Used by: find_ground. Default: 1000."},position:{type:"object",description:"Position as Vector3. Used by: find_ground (cast from here), check_placement (center), collision (hypothetical position).",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},size:{type:"object",description:"Size as Vector3. Used by: check_placement (object size), find_space (required space size), scan_area (area X/Z dimensions).",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},filterType:{type:"string",description:'Raycast filter type. Used by: raycast, multi_raycast. Default: "Exclude".',enum:["Exclude","Include"]},filterList:{type:"array",description:"Instance paths to filter. Used by: raycast, multi_raycast, find_ground, check_placement, scan_area. Alias: filterInstances.",items:{type:"string"}},filterInstances:{type:"array",description:"Instance paths to filter (alias for filterList). Used by: raycast, multi_raycast, find_ground, check_placement, scan_area.",items:{type:"string"}},ignoreWater:{type:"boolean",description:"Ignore terrain water. Used by: raycast, multi_raycast. Default: false."},rays:{type:"array",description:"Array of ray specifications. Used by: multi_raycast. Max 50 rays.",maxItems:50,items:{type:"object",required:["origin","direction"],properties:{origin:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},direction:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}}},center:{type:"object",description:"Center point for area scan. Used by: scan_area.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},area:{type:"object",description:"Bounding box for analysis. Used by: analyze_walkable. Contains min/max.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},searchArea:{type:"object",description:"Bounding box for search. Used by: find_flat, find_spawn, find_space.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},minSize:{type:"object",description:"Minimum flat area size. Used by: find_flat.",required:["x","z"],properties:{x:{type:"number"},z:{type:"number"}}},maxSlope:{type:"number",description:"Maximum slope in degrees. Used by: find_flat (default: 10), analyze_walkable (default: 45)."},resolution:{type:"number",description:"Grid resolution in studs. Used by: scan_area, analyze_walkable. Default: 4."},gridSize:{type:"number",description:"Grid snap size in studs. Used by: snap_grid (default: 4), find_space (default: 4)."},path:{type:"string",description:"Instance path. Used by: bounds (optional), snap_grid (required), collision (required), spatial_map (rootPath alias)."},paths:{type:"array",description:"Multiple instance paths for batch bounds. Used by: bounds.",items:{type:"string"}},tolerance:{type:"number",description:"Height variation tolerance in studs. Used by: find_flat."},gridSnap:{type:"number",description:"Grid snap size. Alias for gridSize."},axes:{type:"array",description:'Axes to snap. Used by: snap_grid. Default: ["x","y","z"]. Use ["x","z"] for horizontal only.',items:{type:"string",enum:["x","y","z"]}},ignorePaths:{type:"array",description:"Instance paths to ignore in collision check. Used by: collision.",items:{type:"string"}},offset:{type:"number",description:"Vertical offset for ground position. Used by: find_ground. Default: 0."},rotation:{type:"object",description:"Rotation in degrees. Used by: check_placement.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},checkGround:{type:"boolean",description:"Verify ground support for placement. Used by: check_placement. Default: true."},spawnSize:{type:"object",description:"Size of spawning entity. Used by: find_spawn. Default: {x:4, y:5, z:4}.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},minSpacing:{type:"number",description:"Minimum distance between spawn positions. Used by: find_spawn. Default: 10."},preferOutdoor:{type:"boolean",description:"Prefer open sky positions. Used by: find_spawn. Default: false."},count:{type:"number",description:"Number of results to find. Used by: find_spawn. Default: 10."},characterHeight:{type:"number",description:"Character height for clearance checks. Used by: analyze_walkable. Default: 5."},maxStepHeight:{type:"number",description:"Maximum step height. Used by: analyze_walkable. Default: 2."},rootPath:{type:"string",description:'Root path for spatial map scan. Used by: spatial_map. Default: "game.Workspace".'},includeModels:{type:"boolean",description:"Include Model bounding boxes. Used by: spatial_map. Default: true."},maxResults:{type:"number",description:"Maximum results. Used by: spatial_map (default: 500), scan_area (default: 500), find_flat (default: 10)."},padding:{type:"number",description:"Minimum distance from other objects. Used by: find_space. Default: 1."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"snap_grid"}}},then:{required:["path"]}},{if:{properties:{action:{const:"collision"}}},then:{required:["path"]}}],required:["action"]}};var zT={name:"manage_assets",description:"[PRO] Asset management: insert models by ID, get asset info, search creator store, insert free models/packages, export selection JSON, generate/review Roblox models, round-trip .rbxm files through Asset Library, and generate local thumbnails.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["insert","info","search","search_insert","insert_free","insert_package","export_selection_json","export_selection_rbxm","export_path_rbxm","review_model","generate_model","upload_asset","import_rbxm","generate_thumbnail"],description:"[PRO] Asset action. insert: insert model by asset ID. info: get asset metadata. search: search Creator Store. search_insert: search and insert first match. insert_free: insert free model. insert_package: insert package. export_selection_json: JSON snapshot of current selection. export_selection_rbxm/export_path_rbxm: save Studio content to Asset Library .rbxm. review_model: QA a selected/path model and optionally register it in Asset Library. generate_model: generate a Roblox model in Studio via GenerationService only. upload_asset: upload the selected Studio asset through Studio-local AssetService with automatic Model/Mesh/Image type selection. import_rbxm: import Asset Library .rbxm into Studio. generate_thumbnail: create or replace thumbnail.png for an Asset Library .rbxm."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},assetId:{type:"number",description:"Roblox asset ID. Used by: insert (required), info (required), insert_free (required), insert_package (required)."},parent:{type:"string",description:'Parent path for inserted asset. Used by: insert, search_insert, insert_free, insert_package. Default: "game.Workspace".'},name:{type:"string",description:"Optional name for inserted instance."},position:{type:"object",description:"Position to place the model. Used by: insert, insert_free.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},query:{type:"string",description:'Search keyword. Used by: search (required), search_insert (required). E.g., "monster", "tree", "car".'},maxResults:{type:"number",description:"Maximum search results. Used by: search. Default: 10."},category:{type:"string",description:"Asset category filter. Used by: search, export_selection_rbxm, export_path_rbxm, review_model, generate_model, import_rbxm, generate_thumbnail. upload_asset may omit this and use assetType/selection auto-detection."},sortType:{type:"string",description:"Sort order for search results. Used by: search."},format:{type:"string",description:"Export format. Used by: export_selection_json."},includeProperties:{type:"boolean",description:"Include all properties in export. Used by: export_selection_json. Default: false."},includeChildren:{type:"boolean",description:"Include children in export. Used by: export_selection_json. Default: false."},maxDepth:{type:"number",description:"Maximum depth for recursive child export. Used by: export_selection_json. Default: 5."},scope:{type:"string",description:"Asset Library scope. Used by: export_selection_rbxm, export_path_rbxm, review_model, import_rbxm, generate_thumbnail. Default: place.",enum:["place","shared"]},placeId:{type:"number",description:"Place ID for place-scoped Asset Library .rbxm round-trip operations. For other manage_assets Studio/plugin actions, this also acts as an optional Studio target selector."},assetLibraryAssetId:{type:"string",description:"Asset Library asset ID. Used by: import_rbxm, generate_thumbnail."},targetParent:{type:"string",description:"Studio parent path for imported/generated instances. Used by: import_rbxm, generate_model. Default: game.Workspace."},sourcePath:{type:"string",description:"Studio instance path to export, review, or upload. Used by: export_path_rbxm, review_model, upload_asset."},displayName:{type:"string",description:"Asset Library display name or Studio upload display name. Used by: export_selection_rbxm, export_path_rbxm, review_model, generate_model, upload_asset."},description:{type:"string",description:"Asset Library description or Studio upload description. Used by: export_selection_rbxm, export_path_rbxm, review_model, upload_asset."},assetType:{type:"string",description:"Roblox Studio-local upload asset type. Used by: upload_asset. Default: auto, which selects Model/Mesh/Image from the selected Studio object.",enum:["auto","model","mesh","image"]},thumbnailMode:{type:"string",description:"Thumbnail capture mode. Used by: export_selection_rbxm, export_path_rbxm, review_model. Default: none.",enum:["none","auto"]},uploadMode:{type:"string",description:"Studio-local upload behavior for .rbxm registration actions. auto uploads the selected object as a Roblox Model asset first, model requires that path, embeddedResources uploads only generated Mesh/Image resources, and localOnly skips Roblox upload. Used by: export_selection_rbxm, export_path_rbxm, review_model. Default: localOnly.",enum:["auto","model","embeddedResources","localOnly"]},uploadTemporaryAssets:{type:"boolean",description:"Explicit user approval for Studio-local CreateAssetAsync uploads before .rbxm registration. Used by: export_selection_rbxm, export_path_rbxm, review_model. Default: false; set true only after user approval."},creatorType:{type:"string",description:"Optional Roblox creator type for Studio-local temporary asset upload. Used with uploadTemporaryAssets by .rbxm registration actions. Omit to use the logged-in Studio user.",enum:["user","group"]},creatorId:{type:"string",description:"Optional Roblox user or group ID for Studio-local temporary asset upload. Used with uploadTemporaryAssets by .rbxm registration actions."},prompt:{type:"string",description:"Text prompt for Roblox GenerationService model generation. Used by: generate_model."},schemaMode:{type:"string",description:"Generation schema mode. Used by: generate_model. Default: predefined.",enum:["predefined","custom"]},predefinedSchema:{type:"string",description:"Roblox predefined model schema. Used by: generate_model when schemaMode=predefined. Default: Body1.",enum:["Body1","Car5"]},schemaGroups:{type:"array",description:"Custom schema group names for generated model segmentation. Used by: generate_model when schemaMode=custom.",items:{type:"string"}},size:{type:"object",description:"Requested approximate generated model bounds in studs. Used by: generate_model.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},maxTriangles:{type:"number",description:"Maximum triangle budget requested from Roblox GenerationService. Used by: generate_model."},generateTextures:{type:"boolean",description:"Whether Roblox GenerationService should generate textures. Used by: generate_model. Default: true."},review:{type:"boolean",description:"Whether to run post-generation/review QA. Used by: generate_model. Default: true."},exportToLibrary:{type:"boolean",description:"Whether to register the reviewed model as an Asset Library .rbxm asset. Used by: review_model. Default: false."},expectedUse:{type:"string",description:"Expected model use for QA heuristics. Used by: review_model, generate_model. Default: unknown.",enum:["decorative","interactive","vehicle","character","unknown"]},expectedGroups:{type:"array",description:"Expected child/group names for generated or reviewed model QA. Used by: review_model, generate_model.",items:{type:"string"}},maxDescendants:{type:"number",description:"Maximum descendants to inspect during model QA. Used by: review_model, generate_model. Default: 500."},readiness:{type:"string",description:"Optional readiness gate for Asset Library registration decisions. Used by: review_model, generate_model.",enum:["ready","review","blocked"]},anchorMode:{type:"string",description:"How to anchor generated BaseParts before review/export. Used by: generate_model. Default: all.",enum:["none","all"]},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"insert"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"info"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"search"}}},then:{required:["query"]}},{if:{properties:{action:{const:"search_insert"}}},then:{required:["query"]}},{if:{properties:{action:{const:"insert_free"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"insert_package"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"export_selection_rbxm"}}},then:{required:["category"]}},{if:{properties:{action:{const:"export_path_rbxm"}}},then:{required:["category","sourcePath"]}},{if:{properties:{action:{const:"review_model"}}},then:{required:["category"]}},{if:{properties:{action:{const:"generate_model"}}},then:{required:["prompt"]}},{if:{properties:{action:{const:"import_rbxm"}}},then:{required:["category","assetLibraryAssetId"]}},{if:{properties:{action:{const:"generate_thumbnail"}}},then:{required:["category","assetLibraryAssetId"]}}],required:["action"]}};var FT={name:"manage_open_cloud_assets",description:"[PRO] Roblox Open Cloud asset upload: preflight diagnostics, credential status, category capabilities, Asset Library-backed upload, existing asset linking, updates, metadata reads, and operation polling. Does not expose delete/archive/restore actions.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["preflight","credential_status","capabilities","upload","link","update","info","operation_status"],description:"[PRO] Open Cloud asset action. preflight: diagnose credential, Assets permissions, Creator target, category, and local file readiness without uploading. credential_status: check local API key status. capabilities: list supported upload categories. upload: create a Roblox asset and register it in the Asset Library. link: connect an existing non-Decal Roblox asset ID to a local file without uploading again. update: update an existing asset. info: read asset metadata. operation_status: check upload/update processing."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},assetId:{type:"string",description:"Roblox asset ID. Used by: link (required), update (required), info (required)."},operationId:{type:"string",description:"Roblox Open Cloud operation ID or operations/{id} path. Used by: operation_status."},filePath:{type:"string",description:"Local file path on the MCP server machine. Used by: upload, link, update."},category:{type:"string",description:"WEPPY asset category. Used by: upload, link, update. The link action does not support decal because it requires the backing Image asset ID.",enum:["image","decal","audio","mesh","model","video","animation"]},scope:{type:"string",description:"Asset Library scope. Used by: upload, link. Defaults to place.",enum:["place","shared"]},placeId:{type:"number",description:"Asset Library Place ID. Used by: upload, link when scope is place. Defaults to the current runtime Place ID."},displayName:{type:"string",description:"Roblox asset display name. Used by: upload, link, update."},description:{type:"string",description:"Roblox asset description. Used by: upload, link, update."},creatorType:{type:"string",description:"Asset creator owner type. Used by: upload, update. Defaults to saved credential metadata when available.",enum:["user","group"]},creatorId:{type:"string",description:"User ID or group ID for the asset creator. Used by: upload, update. Defaults to saved credential metadata when available."},expectedPrice:{type:"number",description:"Expected upload fee in Robux. Used by: upload, update when Roblox requires an expected price."},readMask:{type:"array",description:"Asset metadata fields to retrieve. Used by: info.",items:{type:"string"}},updateMask:{type:"array",description:"Metadata fields to update. Used by: update.",items:{type:"string"}},waitForOperation:{type:"boolean",description:"When true, poll the returned Open Cloud operation until done or timeout. Used by: upload, update."},operationPollTimeoutMs:{type:"number",description:"Maximum operation polling time in milliseconds. Used by: upload, update when waitForOperation is true."},operationPollIntervalMs:{type:"number",description:"Operation polling interval in milliseconds. Used by: upload, update when waitForOperation is true."}},allOf:[{if:{properties:{action:{const:"upload"}}},then:{required:["filePath","category","displayName"]}},{if:{properties:{action:{const:"link"}}},then:{required:["assetId","filePath","category"]}},{if:{properties:{action:{const:"update"}}},then:{required:["assetId","category"]}},{if:{properties:{action:{const:"info"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"operation_status"}}},then:{required:["operationId"]}}],required:["action"]}};var qT={name:"manage_sync",description:"[PRO] Project sync management: status, history, effective policy, and synced file access.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["status_current_place","history","policy","read_file","write_file","progress"],description:"[PRO] Sync action. status_current_place: get sync status for the current connected place. history: get change history. policy: get the effective version 2 policy and capabilities. read_file: read a synced file. write_file: write to a synced file. progress: get real-time sync progress and bandwidth."},placeId:{type:"number",description:"Place ID for sync operations. Used by: history, policy, read_file, write_file."},instancePath:{type:"string",description:"Instance path for file read/write. Used by: read_file, write_file."},content:{type:"string",description:"File content to write. Used by: write_file."},query:{type:"object",description:"Query parameters for history. Used by: history.",properties:{limit:{type:"number",description:"Maximum entries to return."},offset:{type:"number",description:"Number of entries to skip."}}}},allOf:[{if:{properties:{action:{const:"read_file"}}},then:{required:["placeId","instancePath"]}},{if:{properties:{action:{const:"write_file"}}},then:{required:["placeId","instancePath","content"]}}],required:["action"]}};var BT={name:"workspace_state",description:"[PRO] Workspace state: full sync, snapshot, recent changes, viewport info, clear history, metadata, scripts, selection info, clear cache.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["sync","snapshot","changes","viewport","clear_history","metadata","scripts","selection_info","clear_cache"],description:"[PRO] State action. sync: fetch current Workspace state (hierarchy, history, stats). snapshot: get full instance tree structure. changes: get recent changes (added/removed/modified). viewport: get camera position, FOV, viewport size, selection bounds. clear_history: clear change history. metadata: get workspace metadata. scripts: get script list. selection_info: get selection info. clear_cache: clear state cache."},includeMetadata:{type:"boolean",description:"Include metadata (instance counts, timestamps). Used by: sync. Default: true."},limit:{type:"number",description:"Maximum number of changes to return. Used by: changes. Default: 20."},includeCameraInfo:{type:"boolean",description:"Include camera position and settings. Used by: viewport. Default: true."},includeSelectionBounds:{type:"boolean",description:"Include current selection bounds info. Used by: viewport. Default: true."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var VT={name:"manage_logs",description:"Output logs: get filtered logs, poll incrementally with sinceSeq cursor, clear buffer, get recent errors.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","clear","errors"],description:"Log action. get: retrieve logs with optional level/limit/since/sinceSeq filters. clear: clear internal log buffer without resetting seq. errors: quick access to recent errors only."},level:{type:"string",description:'Log level filter. Used by: get. Default: "all".',enum:["all","error","warning","info"]},limit:{type:"number",description:"Maximum entries to return. Used by: get (default: 100, max: 500), errors (default: 20, max: 100)."},pattern:{type:"string",description:"Text pattern to filter log messages. Used by: get."},since:{type:"number",description:"Unix timestamp in milliseconds. Only logs after this time. Used by: get."},sinceSeq:{type:"number",description:"Return only logs after this sequence number. Cursor mode returns logs oldest-to-newest and includes lastSeq/oldestSeq/hasMore/cursorStatus. Used by: get."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var WT={name:"manage_settings",description:"WEPPY settings management. Read or change whether Dashboard opens automatically when the MCP Server starts.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get_dashboard_auto_open","set_dashboard_auto_open"],description:"Settings action. get_dashboard_auto_open: read the saved Dashboard auto-open preference. set_dashboard_auto_open: enable or disable Dashboard auto-open from the next MCP Server start."},enabled:{type:"boolean",description:"Whether Dashboard should open automatically when WEPPY MCP Server starts. Used by: set_dashboard_auto_open."}},allOf:[{if:{properties:{action:{const:"set_dashboard_auto_open"}}},then:{required:["enabled"]}}],required:["action"]}};var HT={name:"system_info",description:"System info: ping, connection status, usage tier, and read-only Studio preflight diagnostics. [PRO] place info and services list.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["ping","connection","usage","place_info","services","preflight"],description:"System action. Basic: ping (test connection, returns pong), connection (server/plugin connection info with session IDs), usage (current tier: basic/pro), preflight (structured Studio readiness checks without changing Studio or DataStore state). [PRO]: place_info (place ID, name, game ID, creator), services (list all Roblox services)."},message:{type:"string",description:"Optional message to echo back. Used by: ping."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var ZT={name:"manage_studio",description:`Prepare Playtest values on Basic, and control Roblox Studio playtest lifecycle, automated test runs, runtime values, and editor view/rendering QA workflows on Pro.
1123
+ `},visualReview:{type:"object",description:"Optional provider-neutral visual review written by the calling agent after it inspects one saved manage_ui.preview screenshot. Findings are advisory only and never block UI changes. Used by: check.",required:["snapshotId","verdict","summary","findings"],properties:{snapshotId:{type:"string",description:"Exact saved manage_ui.preview snapshot_id reviewed by the calling agent."},verdict:{type:"string",description:"Primary visual critic verdict for the reviewed snapshot.",enum:["recompose","refine","approved"]},summary:{type:"string",description:"Non-empty critic rationale grounded in the reviewed snapshot and reference evidence."},findings:{type:"array",description:"Zero or more visual findings. An empty array requires verdict=approved, a non-empty summary, and representative context evidence.",items:{type:"object",required:["rule","path","displayPriority","actual","expected","hint"],properties:{rule:{type:"string",enum:["visual_readability","visual_overlap","visual_geometry","primary_view_occlusion","visual_hierarchy","visual_identity"]},path:{type:"string",description:"Visible GUI path from the reviewed snapshot metadata."},displayPriority:{type:"string",enum:["priority_high","priority_medium","priority_low"]},actual:{type:"string"},expected:{type:"string"},hint:{type:"string"},confidence:{type:"number"}}}},reviewContext:{type:"object",description:"Declares whether the reviewed snapshot covered interaction states and representative gameplay context. Omitting reviewContext treats both contexts as not reviewed.",required:["interactionStatesReviewed","gameplayContextReviewed"],properties:{interactionStatesReviewed:{type:"boolean"},gameplayContextReviewed:{type:"boolean"},responsiveViewportsReviewed:{type:"array",items:{type:"string"}}}}}},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"create_tree"}}},then:{required:["tree"]}},{if:{properties:{action:{const:"update"}}},then:{required:["targetPath","changes"]}},{if:{properties:{action:{const:"delete"}}},then:{required:["targetPath"]}}],required:["action"]}};var AT={name:"manage_lighting",description:"[PRO] Configure environment: lighting, atmosphere, sky, terrain properties, time of day.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["lighting","atmosphere","sky","terrain_props","time","mood"],description:"[PRO] Environment action. lighting: set Lighting service properties. atmosphere: set Atmosphere properties. sky: set Sky properties. terrain_props: set Terrain water/visual properties. time: set time of day. mood: apply a full environment mood preset with overrides."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},properties:{type:"object",description:"Dictionary of properties to set. Used by: lighting, atmosphere, sky, terrain_props. Supports Color3 {r,g,b} (0-255), numbers, booleans, Enum strings.",additionalProperties:!0},createIfMissing:{type:"boolean",description:"Create Atmosphere/Sky instance if missing. Used by: atmosphere, sky. Default: true."},time:{type:"string",description:'Time string in "HH:MM:SS" format (e.g., "14:30:00"). Used by: time. Provide this OR clockTime.'},clockTime:{type:"number",description:"Numeric time in 24-hour format (e.g., 14.5 for 2:30 PM). Used by: time. Provide this OR time."},preset:{type:"string",description:"Environment mood preset. Used by: mood. Applies Lighting + Atmosphere + Sky + post effects + Terrain water appearance in one call.",enum:["sunny_day","golden_hour","sunset","dawn","night","moonlit_night","overcast","foggy","stormy","eerie"]},overrides:{type:"object",description:"Per-section property overrides applied on top of the preset. Used by: mood. Sections: lighting, atmosphere, sky, effects, water. Values follow the same conversion rules as the properties param.",properties:{lighting:{type:"object",additionalProperties:!0},atmosphere:{type:"object",additionalProperties:!0},sky:{type:"object",additionalProperties:!0},effects:{type:"object",additionalProperties:!0},water:{type:"object",additionalProperties:!0}}},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"mood"}}},then:{required:["preset"]}}],required:["action"]}};var TT={name:"manage_selection",description:"Get, set, or clear selection. [PRO] context, details, add/remove items, watch changes.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","set","clear","cached","context","details","add","remove","watch"],description:"Selection action. Basic: get (current selection), set (replace selection), clear (deselect all), cached (from cache without round-trip). [PRO]: context (detailed with source/properties), details (hierarchical with ancestors/descendants), add (add to selection), remove (remove from selection), watch (monitor changes)."},paths:{type:"array",description:"Array of instance paths. Used by: set (required), add (required), remove (required).",items:{type:"string"}},maxAge:{type:"number",description:"Maximum age of cached data in milliseconds. Used by: cached. Default: 30000. Set to 0 for any age."},maxDepth:{type:"number",description:"[PRO] Maximum depth for descendant tree traversal. Used by: details. Default: 1."},includeSource:{type:"boolean",description:"[PRO] Include script source code. Used by: context. Default: true."},includeProperties:{type:"boolean",description:"[PRO] Include all readable properties. Used by: context. Default: true."},includeChildren:{type:"boolean",description:"[PRO] Include immediate children. Used by: context. Default: false."},includeAncestors:{type:"boolean",description:"[PRO] Include full ancestor chain. Used by: details. Default: false."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"set"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"add"}}},then:{required:["paths"]}},{if:{properties:{action:{const:"remove"}}},then:{required:["paths"]}}],required:["action"]}};var OT={name:"manage_camera",description:"Camera operations: get info, focus on instance/position, suggest view, capture Edit-mode viewport screenshot (Edit mode only; not usable during playtest).",inputSchema:{type:"object",properties:{action:{type:"string",enum:["info","focus_path","focus_position","suggest","screenshot"],description:'Camera action. info: get current camera position, rotation, FOV, viewport size. focus_path: move camera to focus on instance by path. focus_position: move camera to focus on world position. suggest: get suggested camera view for a target. [PRO] screenshot: **EDIT MODE ONLY \u2014 DO NOT call while a playtest is active.** Captures the current Studio Edit-mode viewport as a PNG image (returns MCP image content). If you are uncertain whether a playtest is running, call manage_studio.play_status first and only proceed when state == "edit"; otherwise the call returns an error. Requires Studio Mesh/Image capability. In Studio, open File \u2192 Experience Settings \u2192 Security and enable "Allow Mesh / Image APIs". Resolution capped by plugin setting screenshotMaxDimension (default 1024px on longest side; kept at full resolution by Claude while reducing token cost ~40% vs 1280). Play-mode capture is not supported in v1 because Roblox platform blocks converting CaptureService temporary contentId into EditableImage from any non-edit-DM context.'},path:{type:"string",description:"Instance path to focus on. Used by: focus_path (if not provided, focuses on selection), suggest (if not provided, uses selection)."},position:{type:"object",description:"World position to focus on as Vector3. Used by: focus_position (required).",required:["x","y","z"],properties:{x:{type:"number",description:"X coordinate"},y:{type:"number",description:"Y coordinate"},z:{type:"number",description:"Z coordinate"}}},distance:{type:"number",description:"Distance from target in studs. Used by: focus_path, focus_position. Auto-calculated if not provided."},duration:{type:"number",description:"Animation duration in seconds. Used by: focus_path, focus_position. Default: 0.5."},offset:{type:"object",description:"Camera offset direction from target (normalized and scaled by distance). Used by: focus_path, focus_position. Default: {x:1, y:0.5, z:1}.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},lookAt:{type:"object",description:"Point for camera to look at. Used by: focus_position.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},respectAutoFocusSetting:{type:"boolean",description:"If true, only focus when plugin Auto Focus setting is enabled. Used by: focus_path, focus_position. Default: false."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"focus_position"}}},then:{required:["position"]}}],required:["action"]}};var DT={name:"manage_tween",description:"[PRO] Tween service: create, play, pause, cancel tweens for smooth animations.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["create","play","pause","cancel"],description:"[PRO] Tween action. create: create a new tween with target properties. play: play a created tween. pause: pause a running tween. cancel: cancel a tween."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Instance path to tween. Used by: create (required)."},tweenInfo:{type:"object",description:"Tween configuration. Used by: create.",properties:{time:{type:"number",description:"Duration in seconds. Default: 1."},easingStyle:{type:"string",description:'Easing style (e.g., "Linear", "Quad", "Cubic", "Sine", "Bounce", "Elastic"). Default: "Quad".'},easingDirection:{type:"string",description:'Easing direction. Default: "Out".',enum:["In","Out","InOut"]},repeatCount:{type:"number",description:"Number of times to repeat. -1 for infinite. Default: 0."},reverses:{type:"boolean",description:"Whether the tween reverses on each repeat. Default: false."},delayTime:{type:"number",description:"Delay before tween starts in seconds. Default: 0."}}},properties:{type:"object",description:"Target property values to tween to. Used by: create. Supports Vector3, Color3, numbers, etc.",additionalProperties:!0},tweenId:{type:"string",description:"Tween identifier returned by create. Used by: play, pause, cancel."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"create"}}},then:{required:["path"]}}],required:["action"]}};var NT={name:"manage_audio",description:"[PRO] Audio management: play, stop, pause, resume sounds. Set audio listener.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["play","stop","pause","resume","set_listener"],description:"[PRO] Audio action. play: play a sound (creates Sound if needed). stop: stop a playing sound. pause: pause a playing sound. resume: resume a paused sound. set_listener: set the audio listener type/target."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the Sound instance or parent to create Sound in. Used by: play, stop, pause, resume."},soundId:{type:"string",description:'Roblox sound asset ID (e.g., "rbxassetid://1234567"). Used by: play (if creating a new Sound).'},volume:{type:"number",description:"Sound volume (0-10). Used by: play. Default: 0.5."},looped:{type:"boolean",description:"Whether the sound loops. Used by: play. Default: false."},playbackSpeed:{type:"number",description:"Playback speed multiplier. Used by: play. Default: 1."},listenerType:{type:"string",description:"Listener type for SoundService. Used by: set_listener.",enum:["Camera","CFrame","ObjectPosition","ObjectCFrame"]},listenerPath:{type:"string",description:"Instance path for ObjectPosition/ObjectCFrame listener type. Used by: set_listener."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var $T={name:"manage_animation",description:"[PRO] Animation: load, play, stop animations. Get animation tracks from humanoid/controller.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["load","play","stop","get_tracks"],description:"[PRO] Animation action. load: load an animation on a Humanoid/AnimationController. play: play a loaded animation track. stop: stop a playing animation. get_tracks: list all loaded animation tracks."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the Humanoid, AnimationController, or Model containing one. Used by: load, play, stop, get_tracks."},animationId:{type:"string",description:'Roblox animation asset ID (e.g., "rbxassetid://1234567"). Used by: load.'},trackId:{type:"string",description:"Animation track identifier returned by load. Used by: play (required), stop (required)."},speed:{type:"number",description:"Playback speed multiplier. Used by: play. Default: 1."},fadeTime:{type:"number",description:"Fade time in seconds when starting/stopping. Used by: play, stop. Default: 0.1."},weight:{type:"number",description:"Animation weight (0-1) for blending. Used by: play. Default: 1."},priority:{type:"string",description:"Animation priority. Used by: play.",enum:["Core","Idle","Movement","Action","Action2","Action3","Action4"]},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"play"}}},then:{required:["trackId"]}},{if:{properties:{action:{const:"stop"}}},then:{required:["trackId"]}}],required:["action"]}};var jT={name:"manage_physics",description:"[PRO] Physics collision groups: register, set collidable between groups, list groups.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["register_group","set_collidable","get_groups"],description:"[PRO] Physics action. register_group: register a new collision group with PhysicsService. set_collidable: set whether two groups can collide. get_groups: list all registered collision groups."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},groupName:{type:"string",description:"Collision group name. Used by: register_group (required)."},group1:{type:"string",description:"First collision group name. Used by: set_collidable (required)."},group2:{type:"string",description:"Second collision group name. Used by: set_collidable (required)."},collidable:{type:"boolean",description:"Whether the two groups can collide. Used by: set_collidable (required)."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"register_group"}}},then:{required:["groupName"]}},{if:{properties:{action:{const:"set_collidable"}}},then:{required:["group1","group2","collidable"]}}],required:["action"]}};var MT={name:"manage_effects",description:"[PRO] Particle effects: emit particles, clear all particles, toggle effect enabled state.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["emit","clear","toggle"],description:"[PRO] Effects action. emit: emit a burst of particles from a ParticleEmitter. clear: clear all particles from a ParticleEmitter or all emitters under an instance. toggle: enable or disable a ParticleEmitter, Beam, Trail, or other effect."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},path:{type:"string",description:"Path to the effect instance (ParticleEmitter, Beam, Trail) or parent containing effects. Used by: emit, clear, toggle."},count:{type:"number",description:"Number of particles to emit in a burst. Used by: emit. Default: 16."},enabled:{type:"boolean",description:"Enable or disable the effect. Used by: toggle."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var LT={name:"manage_terrain",description:"[PRO] Terrain operations: fill shapes, clear regions, replace materials, manage colors, read/write voxels, generate procedural terrain, smooth terrain.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["fill_block","fill_ball","fill_cylinder","fill_wedge","clear_region","clear_bounds","replace_material","colors_get","colors_set","read_voxel","read_voxels","write_voxels","generate","smooth"],description:"[PRO] Terrain action. fill_block/fill_ball/fill_cylinder/fill_wedge: fill shapes with material. clear_region/clear_bounds: clear terrain. replace_material: swap materials in region. colors_get/colors_set: manage material colors. read_voxel: single voxel. read_voxels/write_voxels: bulk voxels. generate: procedural terrain. smooth: smooth terrain."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},material:{type:"string",description:"Terrain material name (e.g., Grass, Rock, Water, Sand, Slate, Concrete). Used by: fill_*, replace_material, colors_get, colors_set."},center:{type:"object",description:"Center position as Vector3. Used by: fill_ball.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},position:{type:"object",description:"Position as Vector3. Used by: read_voxel.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},cframe:{type:"object",description:"Position and rotation for fill shapes. Used by: fill_block, fill_cylinder, fill_wedge.",required:["position"],properties:{position:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},rotation:{type:"object",description:"Optional rotation in degrees.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},size:{type:"object",description:"Size in studs. Used by: fill_block, fill_wedge.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},radius:{type:"number",description:"Radius in studs. Used by: fill_ball, fill_cylinder."},height:{type:"number",description:"Height in studs. Used by: fill_cylinder."},region:{type:"object",description:"Rectangular region with min/max corners. Used by: clear_region, replace_material, read_voxels, write_voxels, generate, smooth.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},min:{type:"object",description:"Minimum corner for bounds-based clear. Used by: clear_bounds.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",description:"Maximum corner for bounds-based clear. Used by: clear_bounds.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},sourceMaterial:{type:"string",description:"Material to replace. Used by: replace_material."},targetMaterial:{type:"string",description:"Replacement material. Used by: replace_material."},color:{type:"object",description:"RGB color (0-255). Used by: colors_set.",required:["r","g","b"],properties:{r:{type:"number",minimum:0,maximum:255},g:{type:"number",minimum:0,maximum:255},b:{type:"number",minimum:0,maximum:255}}},resolution:{type:"number",description:"Voxel resolution (studs per voxel). Used by: read_voxels, write_voxels. Default: 4."},materials:{type:"array",description:"3D array of material names [x][y][z]. Used by: write_voxels.",items:{type:"array",items:{type:"array",items:{type:"string"}}}},occupancy:{type:"array",description:"3D array of occupancy values [x][y][z] (0-1). Used by: write_voxels.",items:{type:"array",items:{type:"array",items:{type:"number",minimum:0,maximum:1}}}},baseHeight:{type:"number",description:"Base terrain height in studs. Used by: generate. Default: 32."},amplitude:{type:"number",description:"Height variation amplitude in studs. Used by: generate. Default: 24."},frequency:{type:"number",description:"Noise frequency (0.001-0.1). Used by: generate. Default: 0.01.",minimum:.001,maximum:.1},seed:{type:"number",description:"Random seed for terrain generation. Used by: generate."},layers:{type:"array",description:"Material layers by height. Used by: generate. Each: {material, maxHeight}.",items:{type:"object",required:["material","maxHeight"],properties:{material:{type:"string"},maxHeight:{type:"number"}}}},intensity:{type:"number",description:"Smoothing intensity (0-1). Used by: smooth. Default: 0.5.",minimum:0,maximum:1},preset:{type:"string",description:"Biome preset for natural terrain. Used by: generate. Explicit parameters override preset values.",enum:["mountains","hills","plains","dunes","islands","canyon"]},octaves:{type:"number",description:"fBm noise octave count (1-8). Used by: generate. Default: 4.",minimum:1,maximum:8},persistence:{type:"number",description:"Amplitude decay between octaves (0-1). Used by: generate. Default: 0.5.",minimum:0,maximum:1},waterLevel:{type:"number",description:"Absolute water surface height in studs. Used by: generate. Empty space below this level is filled with Water."},edgeBlend:{type:"object",description:"Blend generated heights into existing terrain at region borders. Used by: generate.",required:["enabled"],properties:{enabled:{type:"boolean"},width:{type:"number",description:"Blend falloff width in studs. Default: 32."}}},materialPalette:{type:"object",description:"Material palette override {surface, cliff, shore, underwater}. Used by: generate.",properties:{surface:{type:"string"},cliff:{type:"string"},shore:{type:"string"},underwater:{type:"string"}}},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"generate"}}},then:{required:["region"]}}],required:["action"]}};var UT={name:"spatial_query",description:"[PRO] Spatial queries: raycast, find ground, check placement, multi-raycast, scan area, find flat areas, find spawn positions, analyze walkable, spatial map, find empty space, get bounds, snap to grid, check collision.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["raycast","find_ground","check_placement","multi_raycast","scan_area","find_flat","find_spawn","analyze_walkable","spatial_map","find_space","bounds","snap_grid","collision"],description:"[PRO] Spatial action. raycast: single ray. find_ground: ground below point. check_placement: collision-free placement check. multi_raycast: batch rays. scan_area: heightmap generation. find_flat: flat areas for building. find_spawn: spawn positions. analyze_walkable: walkability grid. spatial_map: all BasePart positions. find_space: empty space for object. bounds: bounding box. snap_grid: snap position to grid. collision: AABB collision check."},origin:{type:"object",description:"Ray origin as Vector3. Used by: raycast.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},direction:{type:"object",description:"Ray direction and length as Vector3. Used by: raycast.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},maxDistance:{type:"number",description:"Maximum distance for ground search. Used by: find_ground. Default: 1000."},position:{type:"object",description:"Position as Vector3. Used by: find_ground (cast from here), check_placement (center), collision (hypothetical position).",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},size:{type:"object",description:"Size as Vector3. Used by: check_placement (object size), find_space (required space size), scan_area (area X/Z dimensions).",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},filterType:{type:"string",description:'Raycast filter type. Used by: raycast, multi_raycast. Default: "Exclude".',enum:["Exclude","Include"]},filterList:{type:"array",description:"Instance paths to filter. Used by: raycast, multi_raycast, find_ground, check_placement, scan_area. Alias: filterInstances.",items:{type:"string"}},filterInstances:{type:"array",description:"Instance paths to filter (alias for filterList). Used by: raycast, multi_raycast, find_ground, check_placement, scan_area.",items:{type:"string"}},ignoreWater:{type:"boolean",description:"Ignore terrain water. Used by: raycast, multi_raycast. Default: false."},rays:{type:"array",description:"Array of ray specifications. Used by: multi_raycast. Max 50 rays.",maxItems:50,items:{type:"object",required:["origin","direction"],properties:{origin:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},direction:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}}},center:{type:"object",description:"Center point for area scan. Used by: scan_area.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},area:{type:"object",description:"Bounding box for analysis. Used by: analyze_walkable. Contains min/max.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},searchArea:{type:"object",description:"Bounding box for search. Used by: find_flat, find_spawn, find_space.",required:["min","max"],properties:{min:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},max:{type:"object",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}}}},minSize:{type:"object",description:"Minimum flat area size. Used by: find_flat.",required:["x","z"],properties:{x:{type:"number"},z:{type:"number"}}},maxSlope:{type:"number",description:"Maximum slope in degrees. Used by: find_flat (default: 10), analyze_walkable (default: 45)."},resolution:{type:"number",description:"Grid resolution in studs. Used by: scan_area, analyze_walkable. Default: 4."},gridSize:{type:"number",description:"Grid snap size in studs. Used by: snap_grid (default: 4), find_space (default: 4)."},path:{type:"string",description:"Instance path. Used by: bounds (optional), snap_grid (required), collision (required), spatial_map (rootPath alias)."},paths:{type:"array",description:"Multiple instance paths for batch bounds. Used by: bounds.",items:{type:"string"}},tolerance:{type:"number",description:"Height variation tolerance in studs. Used by: find_flat."},gridSnap:{type:"number",description:"Grid snap size. Alias for gridSize."},axes:{type:"array",description:'Axes to snap. Used by: snap_grid. Default: ["x","y","z"]. Use ["x","z"] for horizontal only.',items:{type:"string",enum:["x","y","z"]}},ignorePaths:{type:"array",description:"Instance paths to ignore in collision check. Used by: collision.",items:{type:"string"}},offset:{type:"number",description:"Vertical offset for ground position. Used by: find_ground. Default: 0."},rotation:{type:"object",description:"Rotation in degrees. Used by: check_placement.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},checkGround:{type:"boolean",description:"Verify ground support for placement. Used by: check_placement. Default: true."},spawnSize:{type:"object",description:"Size of spawning entity. Used by: find_spawn. Default: {x:4, y:5, z:4}.",properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},minSpacing:{type:"number",description:"Minimum distance between spawn positions. Used by: find_spawn. Default: 10."},preferOutdoor:{type:"boolean",description:"Prefer open sky positions. Used by: find_spawn. Default: false."},count:{type:"number",description:"Number of results to find. Used by: find_spawn. Default: 10."},characterHeight:{type:"number",description:"Character height for clearance checks. Used by: analyze_walkable. Default: 5."},maxStepHeight:{type:"number",description:"Maximum step height. Used by: analyze_walkable. Default: 2."},rootPath:{type:"string",description:'Root path for spatial map scan. Used by: spatial_map. Default: "game.Workspace".'},includeModels:{type:"boolean",description:"Include Model bounding boxes. Used by: spatial_map. Default: true."},maxResults:{type:"number",description:"Maximum results. Used by: spatial_map (default: 500), scan_area (default: 500), find_flat (default: 10)."},padding:{type:"number",description:"Minimum distance from other objects. Used by: find_space. Default: 1."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"snap_grid"}}},then:{required:["path"]}},{if:{properties:{action:{const:"collision"}}},then:{required:["path"]}}],required:["action"]}};var zT={name:"manage_assets",description:"[PRO] Asset management: insert models by ID, get asset info, search creator store, insert free models/packages, export selection JSON, generate/review Roblox models, round-trip .rbxm files through Asset Library, and generate local thumbnails.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["insert","info","search","search_insert","insert_free","insert_package","export_selection_json","export_selection_rbxm","export_path_rbxm","review_model","generate_model","upload_asset","import_rbxm","generate_thumbnail"],description:"[PRO] Asset action. insert: insert model by asset ID. info: get asset metadata. search: search Creator Store. search_insert: search and insert first match. insert_free: insert free model. insert_package: insert package. export_selection_json: JSON snapshot of current selection. export_selection_rbxm/export_path_rbxm: save Studio content to Asset Library .rbxm. review_model: QA a selected/path model and optionally register it in Asset Library. generate_model: generate a Roblox model in Studio via GenerationService only. upload_asset: upload the selected Studio asset through Studio-local AssetService with automatic Model/Mesh/Image type selection. import_rbxm: import Asset Library .rbxm into Studio. generate_thumbnail: create or replace thumbnail.png for an Asset Library .rbxm."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},assetId:{type:"number",description:"Roblox asset ID. Used by: insert (required), info (required), insert_free (required), insert_package (required)."},parent:{type:"string",description:'Parent path for inserted asset. Used by: insert, search_insert, insert_free, insert_package. Default: "game.Workspace".'},name:{type:"string",description:"Optional name for inserted instance."},position:{type:"object",description:"Position to place the model. Used by: insert, insert_free.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},query:{type:"string",description:'Search keyword. Used by: search (required), search_insert (required). E.g., "monster", "tree", "car".'},maxResults:{type:"number",description:"Maximum search results. Used by: search. Default: 10."},category:{type:"string",description:"Asset category filter. Used by: search, export_selection_rbxm, export_path_rbxm, review_model, generate_model, import_rbxm, generate_thumbnail. upload_asset may omit this and use assetType/selection auto-detection."},sortType:{type:"string",description:"Sort order for search results. Used by: search."},format:{type:"string",description:"Export format. Used by: export_selection_json."},includeProperties:{type:"boolean",description:"Include all properties in export. Used by: export_selection_json. Default: false."},includeChildren:{type:"boolean",description:"Include children in export. Used by: export_selection_json. Default: false."},maxDepth:{type:"number",description:"Maximum depth for recursive child export. Used by: export_selection_json. Default: 5."},scope:{type:"string",description:"Asset Library scope. Used by: export_selection_rbxm, export_path_rbxm, review_model, import_rbxm, generate_thumbnail. Default: place.",enum:["place","shared"]},placeId:{type:"number",description:"Place ID for place-scoped Asset Library .rbxm round-trip operations. For other manage_assets Studio/plugin actions, this also acts as an optional Studio target selector."},assetLibraryAssetId:{type:"string",description:"Asset Library asset ID. Used by: import_rbxm, generate_thumbnail."},targetParent:{type:"string",description:"Studio parent path for imported/generated instances. Used by: import_rbxm, generate_model. Default: game.Workspace."},sourcePath:{type:"string",description:"Studio instance path to export, review, or upload. Used by: export_path_rbxm, review_model, upload_asset."},displayName:{type:"string",description:"Asset Library display name or Studio upload display name. Used by: export_selection_rbxm, export_path_rbxm, review_model, generate_model, upload_asset."},description:{type:"string",description:"Asset Library description or Studio upload description. Used by: export_selection_rbxm, export_path_rbxm, review_model, upload_asset."},assetType:{type:"string",description:"Roblox Studio-local upload asset type. Used by: upload_asset. Default: auto, which selects Model/Mesh/Image from the selected Studio object.",enum:["auto","model","mesh","image"]},thumbnailMode:{type:"string",description:"Thumbnail capture mode. Used by: export_selection_rbxm, export_path_rbxm, review_model. Default: none.",enum:["none","auto"]},uploadMode:{type:"string",description:"Studio-local upload behavior for .rbxm registration actions. auto uploads the selected object as a Roblox Model asset first, model requires that path, embeddedResources uploads only generated Mesh/Image resources, and localOnly skips Roblox upload. Used by: export_selection_rbxm, export_path_rbxm, review_model. Default: localOnly.",enum:["auto","model","embeddedResources","localOnly"]},uploadTemporaryAssets:{type:"boolean",description:"Explicit user approval for Studio-local CreateAssetAsync uploads before .rbxm registration. Used by: export_selection_rbxm, export_path_rbxm, review_model. Default: false; set true only after user approval."},creatorType:{type:"string",description:"Optional Roblox creator type for Studio-local temporary asset upload. Used with uploadTemporaryAssets by .rbxm registration actions. Omit to use the logged-in Studio user.",enum:["user","group"]},creatorId:{type:"string",description:"Optional Roblox user or group ID for Studio-local temporary asset upload. Used with uploadTemporaryAssets by .rbxm registration actions."},prompt:{type:"string",description:"Text prompt for Roblox GenerationService model generation. Used by: generate_model."},schemaMode:{type:"string",description:"Generation schema mode. Used by: generate_model. Default: predefined.",enum:["predefined","custom"]},predefinedSchema:{type:"string",description:"Roblox predefined model schema. Used by: generate_model when schemaMode=predefined. Default: Body1.",enum:["Body1","Car5"]},schemaGroups:{type:"array",description:"Custom schema group names for generated model segmentation. Used by: generate_model when schemaMode=custom.",items:{type:"string"}},size:{type:"object",description:"Requested approximate generated model bounds in studs. Used by: generate_model.",required:["x","y","z"],properties:{x:{type:"number"},y:{type:"number"},z:{type:"number"}}},maxTriangles:{type:"number",description:"Maximum triangle budget requested from Roblox GenerationService. Used by: generate_model."},generateTextures:{type:"boolean",description:"Whether Roblox GenerationService should generate textures. Used by: generate_model. Default: true."},review:{type:"boolean",description:"Whether to run post-generation/review QA. Used by: generate_model. Default: true."},exportToLibrary:{type:"boolean",description:"Whether to register the reviewed model as an Asset Library .rbxm asset. Used by: review_model. Default: false."},expectedUse:{type:"string",description:"Expected model use for QA heuristics. Used by: review_model, generate_model. Default: unknown.",enum:["decorative","interactive","vehicle","character","unknown"]},expectedGroups:{type:"array",description:"Expected child/group names for generated or reviewed model QA. Used by: review_model, generate_model.",items:{type:"string"}},maxDescendants:{type:"number",description:"Maximum descendants to inspect during model QA. Used by: review_model, generate_model. Default: 500."},readiness:{type:"string",description:"Optional readiness gate for Asset Library registration decisions. Used by: review_model, generate_model.",enum:["ready","review","blocked"]},anchorMode:{type:"string",description:"How to anchor generated BaseParts before review/export. Used by: generate_model. Default: all.",enum:["none","all"]},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"insert"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"info"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"search"}}},then:{required:["query"]}},{if:{properties:{action:{const:"search_insert"}}},then:{required:["query"]}},{if:{properties:{action:{const:"insert_free"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"insert_package"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"export_selection_rbxm"}}},then:{required:["category"]}},{if:{properties:{action:{const:"export_path_rbxm"}}},then:{required:["category","sourcePath"]}},{if:{properties:{action:{const:"review_model"}}},then:{required:["category"]}},{if:{properties:{action:{const:"generate_model"}}},then:{required:["prompt"]}},{if:{properties:{action:{const:"import_rbxm"}}},then:{required:["category","assetLibraryAssetId"]}},{if:{properties:{action:{const:"generate_thumbnail"}}},then:{required:["category","assetLibraryAssetId"]}}],required:["action"]}};var FT={name:"manage_open_cloud_assets",description:"[PRO] Roblox Open Cloud asset upload: preflight diagnostics, credential status, category capabilities, Asset Library-backed upload, existing asset linking, updates, metadata reads, and operation polling. Does not expose delete/archive/restore actions.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["preflight","credential_status","capabilities","upload","link","update","info","operation_status"],description:"[PRO] Open Cloud asset action. preflight: diagnose credential, Assets permissions, Creator target, category, and local file readiness without uploading. credential_status: check local API key status. capabilities: list supported upload categories. upload: create a Roblox asset and register it in the Asset Library. link: connect an existing non-Decal Roblox asset ID to a local file without uploading again. update: update an existing asset. info: read asset metadata. operation_status: check upload/update processing."},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},assetId:{type:"string",description:"Roblox asset ID. Used by: link (required), update (required), info (required)."},operationId:{type:"string",description:"Roblox Open Cloud operation ID or operations/{id} path. Used by: operation_status."},filePath:{type:"string",description:"Local file path on the MCP server machine. Used by: upload, link, update."},category:{type:"string",description:"WEPPY asset category. Used by: upload, link, update. The link action does not support decal because it requires the backing Image asset ID.",enum:["image","decal","audio","mesh","model","video","animation"]},scope:{type:"string",description:"Asset Library scope. Used by: upload, link. Defaults to place.",enum:["place","shared"]},placeId:{type:"number",description:"Asset Library Place ID. Used by: upload, link when scope is place. Defaults to the current runtime Place ID."},displayName:{type:"string",description:"Roblox asset display name. Used by: upload, link, update."},description:{type:"string",description:"Roblox asset description. Used by: upload, link, update."},creatorType:{type:"string",description:"Asset creator owner type. Used by: upload, update. Defaults to saved credential metadata when available.",enum:["user","group"]},creatorId:{type:"string",description:"User ID or group ID for the asset creator. Used by: upload, update. Defaults to saved credential metadata when available."},expectedPrice:{type:"number",description:"Expected upload fee in Robux. Used by: upload, update when Roblox requires an expected price."},readMask:{type:"array",description:"Asset metadata fields to retrieve. Used by: info.",items:{type:"string"}},updateMask:{type:"array",description:"Metadata fields to update. Used by: update.",items:{type:"string"}},waitForOperation:{type:"boolean",description:"When true, poll the returned Open Cloud operation until done or timeout. Used by: upload, update."},operationPollTimeoutMs:{type:"number",description:"Maximum operation polling time in milliseconds. Used by: upload, update when waitForOperation is true."},operationPollIntervalMs:{type:"number",description:"Operation polling interval in milliseconds. Used by: upload, update when waitForOperation is true."}},allOf:[{if:{properties:{action:{const:"upload"}}},then:{required:["filePath","category","displayName"]}},{if:{properties:{action:{const:"link"}}},then:{required:["assetId","filePath","category"]}},{if:{properties:{action:{const:"update"}}},then:{required:["assetId","category"]}},{if:{properties:{action:{const:"info"}}},then:{required:["assetId"]}},{if:{properties:{action:{const:"operation_status"}}},then:{required:["operationId"]}}],required:["action"]}};var qT={name:"manage_sync",description:"[PRO] Project sync management: status, history, effective policy, and synced file access.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["status_current_place","history","policy","read_file","write_file","progress"],description:"[PRO] Sync action. status_current_place: get sync status for the current connected place. history: get change history. policy: get the effective version 2 policy and capabilities. read_file: read a synced file. write_file: write to a synced file. progress: get real-time sync progress and bandwidth."},placeId:{type:"number",description:"Place ID for sync operations. Used by: history, policy, read_file, write_file."},instancePath:{type:"string",description:"Instance path for file read/write. Used by: read_file, write_file."},content:{type:"string",description:"File content to write. Used by: write_file."},query:{type:"object",description:"Query parameters for history. Used by: history.",properties:{limit:{type:"number",description:"Maximum entries to return."},offset:{type:"number",description:"Number of entries to skip."}}}},allOf:[{if:{properties:{action:{const:"read_file"}}},then:{required:["placeId","instancePath"]}},{if:{properties:{action:{const:"write_file"}}},then:{required:["placeId","instancePath","content"]}}],required:["action"]}};var BT={name:"workspace_state",description:"[PRO] Workspace state: full sync, snapshot, recent changes, viewport info, clear history, metadata, scripts, selection info, clear cache.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["sync","snapshot","changes","viewport","clear_history","metadata","scripts","selection_info","clear_cache"],description:"[PRO] State action. sync: fetch current Workspace state (hierarchy, history, stats). snapshot: get full instance tree structure. changes: get recent changes (added/removed/modified). viewport: get camera position, FOV, viewport size, selection bounds. clear_history: clear change history. metadata: get workspace metadata. scripts: get script list. selection_info: get selection info. clear_cache: clear state cache."},includeMetadata:{type:"boolean",description:"Include metadata (instance counts, timestamps). Used by: sync. Default: true."},limit:{type:"number",description:"Maximum number of changes to return. Used by: changes. Default: 20."},includeCameraInfo:{type:"boolean",description:"Include camera position and settings. Used by: viewport. Default: true."},includeSelectionBounds:{type:"boolean",description:"Include current selection bounds info. Used by: viewport. Default: true."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var VT={name:"manage_logs",description:"Output logs: get filtered logs, poll incrementally with sinceSeq cursor, clear buffer, get recent errors.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get","clear","errors"],description:"Log action. get: retrieve logs with optional level/limit/since/sinceSeq filters. clear: clear internal log buffer without resetting seq. errors: quick access to recent errors only."},level:{type:"string",description:'Log level filter. Used by: get. Default: "all".',enum:["all","error","warning","info"]},limit:{type:"number",description:"Maximum entries to return. Used by: get (default: 100, max: 500), errors (default: 20, max: 100)."},pattern:{type:"string",description:"Text pattern to filter log messages. Used by: get."},since:{type:"number",description:"Unix timestamp in milliseconds. Only logs after this time. Used by: get."},sinceSeq:{type:"number",description:"Return only logs after this sequence number. Cursor mode returns logs oldest-to-newest and includes lastSeq/oldestSeq/hasMore/cursorStatus. Used by: get."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var WT={name:"manage_settings",description:"WEPPY settings management. Read or change whether Dashboard opens automatically when the MCP Server starts.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["get_dashboard_auto_open","set_dashboard_auto_open"],description:"Settings action. get_dashboard_auto_open: read the saved Dashboard auto-open preference. set_dashboard_auto_open: enable or disable Dashboard auto-open from the next MCP Server start."},enabled:{type:"boolean",description:"Whether Dashboard should open automatically when WEPPY MCP Server starts. Used by: set_dashboard_auto_open."}},allOf:[{if:{properties:{action:{const:"set_dashboard_auto_open"}}},then:{required:["enabled"]}}],required:["action"]}};var HT={name:"system_info",description:"System info: ping, connection status, usage tier, and read-only Studio preflight diagnostics. [PRO] place info and services list.",inputSchema:{type:"object",properties:{action:{type:"string",enum:["ping","connection","usage","place_info","services","preflight"],description:"System action. Basic: ping (test connection, returns pong), connection (server/plugin connection info with session IDs), usage (current tier: basic/pro), preflight (structured Studio readiness checks without changing Studio or DataStore state). [PRO]: place_info (place ID, name, game ID, creator), services (list all Roblox services)."},message:{type:"string",description:"Optional message to echo back. Used by: ping."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["action"]}};var ZT={name:"manage_studio",description:`Prepare Playtest values on Basic, and control Roblox Studio playtest lifecycle, automated test runs, runtime values, and editor view/rendering QA workflows on Pro.
790
1124
  `,inputSchema:{type:"object",properties:{action:{type:"string",enum:["toggle_ui_preview","test_profile_get","test_profile_set","test_profile_reset","experience_language_get","experience_language_set","play_start","play_stop","play_pause","play_resume","play_status","test_session_start","playtest_control_get","playtest_prepare","playtest_binding_candidates","playtest_profile_save","playtest_adapter_plan","playtest_adapter_apply","playtest_source_open","playtest_control_apply","playtest_control_reset","playtest_action_execute","test_session_status","test_session_stop","run_test"],description:`Studio editor action. [BASIC]: playtest_prepare (read Place-scoped readiness, profiles, and last verified catalog), playtest_binding_candidates (read actual Edit selection or Play runtime value candidates), playtest_profile_save (create, update, delete, or copy a local Playtest value profile). [PRO]: playtest_adapter_plan/apply (review and apply owned Test Adapter source), playtest_action_execute (run one validated profile Action), toggle_ui_preview, test_profile_get/set/reset, experience_language_get/set, play_start/stop/pause/resume/status, test_session_start/status/stop, playtest_control_get/apply/reset, run_test.
791
1125
  `},contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},enabled:{type:"boolean",description:`Boolean value to set. Omit to toggle the current value.
792
1126
  Used by: toggle_ui_preview (optional).
793
- `},mode:{type:"string",description:'Playtest mode. "play" = Play mode (F5, default), "run" = Run mode (F8). Used by: play_start, run_test.',enum:["play","run"]},script:{type:"string",description:'Luau test body for the explicit legacy opt-in executionKind="raw_luau" path. It is injected into ServerScriptService.__MCP_TestRunner. Used by: run_test only.'},test_name:{type:"string",description:"Optional report display name for the automated playtest run. Used by: run_test."},timeout:{type:"number",description:"Timeout in seconds for the automated playtest run. Default: 60. Maximum: 300. Used by: run_test."},testProfile:{type:"object",properties:{enabled:{type:"boolean"},locale:{type:"string",minLength:2,maxLength:35},region:{type:"string",minLength:2,maxLength:2},pseudolocalize:{type:"boolean"},elongation:{type:"number",minimum:0,maximum:1}},additionalProperties:!1,description:"Optional Player Emulator test profile patch. Used by: test_profile_set, play_start, test_session_start, run_test."},restoreAfterTest:{type:"boolean",description:"Restore the profile snapshot after the play session or automated test finishes. Defaults to true when testProfile is provided. Used by: play_start, test_session_start, run_test."},scenario:{type:"object",required:["protocolVersion","name","steps"],properties:{protocolVersion:{type:"integer",enum:[1]},name:{type:"string",minLength:1,maxLength:4096},mode:{type:"string",enum:["play","run"]},clients:{type:"integer",minimum:1,maximum:1},timeoutSeconds:{type:"number",minimum:.1,maximum:300},requiredEvidence:{type:"object",properties:{server:{type:"boolean"},clientUi:{type:"boolean"},interaction:{type:"boolean"},visual:{type:"boolean"}},additionalProperties:!1},steps:{type:"array",maxItems:100,items:{type:"object",required:["id","target","action","args"],properties:{id:{type:"string",minLength:1,maxLength:4096},target:{type:"object",required:["role"],properties:{role:{type:"string",enum:["server","client"]},clientId:{type:"string",enum:["client-1"]}},additionalProperties:!1},action:{type:"string",enum:["wait_for_instance","query_instance","assert_property","assert_attribute","assert_count","wait_for_player","observation_start","observation_assert","observation_stop","call_test_adapter","wait_for_gui","snapshot_gui","input_click"]},args:{type:"object",additionalProperties:!0},timeoutSeconds:{type:"number",minimum:.1,maximum:300},required:{type:"boolean"}},additionalProperties:!1}}},additionalProperties:!1,description:"Structured protocol v1 scenario. Mode defaults to play and clients defaults to one. Used by: test_session_start."},idempotencyKey:{type:"string",description:"Optional idempotency key scoped to the pinned Studio target and normalized scenario. Used by: test_session_start.",minLength:1,maxLength:4096},sessionId:{type:"string",description:"Structured test session identifier returned by test_session_start. Used by: test_session_status, test_session_stop.",minLength:1,maxLength:4096},controlProfileId:{type:"string",description:"Place-scoped Playtest Control Profile ID. Used by: play_start, test_session_start, playtest_prepare, playtest_profile_save, playtest_control_get.",minLength:1,maxLength:128},controlProfile:{type:"object",required:["schemaVersion","id","name","controls","watches"],properties:{schemaVersion:{type:"integer",enum:[1,2,3,4]},id:{type:"string",minLength:1,maxLength:128},name:{type:"string",minLength:1,maxLength:512},controls:{type:"array",maxItems:128,items:{type:"object",additionalProperties:!0}},watches:{type:"array",maxItems:128,items:{type:"object",additionalProperties:!0}},actions:{type:"array",maxItems:128,items:{type:"object",additionalProperties:!0}},presentation:{type:"object",additionalProperties:{type:"object",additionalProperties:!0}}},additionalProperties:!1,description:"Validated local Playtest value profile draft. New v3 controls use applyOnStart=false without a placeholder value until the user explicitly saves one. Used by: playtest_profile_save."},profileOperation:{type:"string",description:"Local profile operation. create/update use controlProfile, delete uses controlProfileId, and copy uses source/destination fields. Used by: playtest_profile_save.",enum:["create","update","delete","copy"]},sourceProfileId:{type:"string",description:"Source profile ID for an explicit copy. Used by: playtest_profile_save.",minLength:1,maxLength:128},sourceRevision:{type:"integer",description:"Expected source profile revision for an explicit copy. Used by: playtest_profile_save.",minimum:1},sourcePlaceId:{type:"number",description:"Published source Place ID for an explicit profile copy. Used by: playtest_profile_save."},sourcePlaceName:{type:"string",description:"Unpublished source Place name in the current project for an explicit profile copy. Used by: playtest_profile_save.",minLength:1,maxLength:512},destinationProfileId:{type:"string",description:"New destination profile ID for an explicit copy. Used by: playtest_profile_save.",minLength:1,maxLength:128},destinationProfileName:{type:"string",description:"New destination profile name for an explicit copy. Used by: playtest_profile_save.",minLength:1,maxLength:512},candidateSource:{type:"string",description:"Read candidates from the current Edit selection or a bounded Play runtime path. Used by: playtest_binding_candidates.",enum:["selection","runtime"]},candidateTarget:{type:"object",required:["role"],properties:{role:{type:"string",enum:["server","client"]},clientId:{type:"string",enum:["client-1"]}},additionalProperties:!1,description:"Server or client runtime role for a Play-only candidate query. Used by: playtest_binding_candidates."},candidatePath:{type:"object",required:["root","segments"],properties:{root:{type:"string",enum:["PlayerGui","Character","Workspace","ReplicatedStorage","ServerStorage","ServerScriptService","Players"]},segments:{type:"array",maxItems:64,items:{type:"string",minLength:1,maxLength:4096}}},additionalProperties:!1,description:"Bounded Play runtime path to inspect. Used by: playtest_binding_candidates."},maxResults:{type:"integer",description:"Maximum candidate fields to return. Used by: playtest_binding_candidates.",minimum:1,maximum:100},adapterOperation:{type:"string",description:"Reviewed managed adapter operation. Used by: playtest_adapter_plan.",enum:["create","update","remove_entry","remove_adapter"]},adapterId:{type:"string",description:"Stable managed Test Adapter ID and ModuleScript name. Used by: playtest_adapter_plan."},adapterRegistrationId:{type:"string",description:"Stable Dashboard entry ID. Used by create, update, and remove_entry adapter plans."},adapterRegistrationLabel:{type:"string",description:"User-facing adapter value label. Used by create and update adapter plans.",minLength:1,maxLength:512},adapterRegistrationGroup:{type:"string",description:"Dashboard group for the adapter value. Used by create and update adapter plans.",minLength:1,maxLength:512},adapterRegistrationKind:{type:"string",description:"Observation or reversible control intent. Used by create and update adapter plans.",enum:["watch","control"]},adapterValueType:{type:"string",description:"JSON-compatible adapter value type. Used by create and update adapter plans.",enum:["string","number","boolean","enum"]},adapterModulePath:{type:"object",required:["root","segments"],properties:{root:{type:"string",enum:["PlayerGui","Character","Workspace","ReplicatedStorage","ServerStorage","ServerScriptService","Players"]},segments:{type:"array",maxItems:64,items:{type:"string",minLength:1,maxLength:4096}}},additionalProperties:!1,description:"Existing server-visible ModuleScript that owns the internal value. Used by create and update adapter plans."},adapterReadMethod:{type:"string",description:"Existing module getter name. Used by create and update adapter plans."},adapterWriteMethod:{type:"string",description:"Existing module setter name for a reversible control. Used by create and update adapter plans."},adapterMethodStyle:{type:"string",description:"Explicit dot or colon calling convention for the existing module API. Used by create and update adapter plans.",enum:["dot","colon"]},adapterStudioOnly:{type:"boolean",description:"Keep the managed Test Adapter unavailable outside Roblox Studio. Defaults to true and may be false only when the user explicitly asks to omit the RunService:IsStudio() check. Used by create and update adapter plans."},adapterConstraints:{type:"object",description:"Optional numeric editor constraints. Used by create and update adapter plans.",properties:{minimum:{type:"number"},maximum:{type:"number"},step:{type:"number"}},additionalProperties:!1},adapterEnumValues:{type:"array",description:"Allowed enum values. Used by create and update adapter plans.",minItems:1,maxItems:100,items:{}},productionExclusionStrategy:{type:"string",description:"Optional artifact-hygiene strategy for excluding the adapter source even when studioOnly protection is enabled. Used by: playtest_adapter_plan.",enum:["rojo","private_test_place"]},productionExclusionReference:{type:"string",description:"Optional production project file or configured test Place reference for the exclusion strategy. Used by: playtest_adapter_plan.",minLength:1,maxLength:4096},planToken:{type:"string",description:"Unexpired reviewed adapter plan token. Used by: playtest_adapter_apply.",minLength:1,maxLength:4096},expectedSourceHash:{type:"string",description:"Reviewed current source SHA-256 or absent sentinel. Used by: playtest_adapter_apply.",minLength:6,maxLength:64},leaseId:{type:"string",description:"Active runtime control lease ID. Used by: playtest_control_get, playtest_control_apply, playtest_control_reset.",minLength:1,maxLength:4096},expectedRevision:{type:"integer",description:"Optimistic revision. For playtest_profile_save update/delete, pass the current stored profile revision. For playtest_control_apply, pass the active runtime lease revision.",minimum:0},controlValues:{type:"object",description:"Binding ID to JSON-compatible requested value. Used by: playtest_control_apply.",additionalProperties:!0},actionId:{type:"string",description:"Stable Action ID from the active Playtest profile. Used by: playtest_action_execute.",minLength:1,maxLength:128},actionArguments:{type:"object",description:"Complete JSON-compatible arguments for this execution, including values from fixed Profile inputs. The Test Agent validates the actual method schema without injecting Profile defaults or comparing fixed values. Used by: playtest_action_execute.",additionalProperties:!0},expectedProfileRevision:{type:"integer",description:"Expected stored profile revision. Used by: playtest_action_execute.",minimum:1},requestId:{type:"string",description:"Semantic idempotency identity for one Action click. Reusing it with the same input returns the same result; different input is rejected. Used by: playtest_action_execute.",minLength:1,maxLength:4096},stepCursor:{type:"string",description:"Optional opaque cursor returned by a previous status page. Used by: test_session_status.",minLength:1,maxLength:4096},stepLimit:{type:"integer",description:"Maximum step evidence entries in one status page. Defaults to 20 and cannot exceed 50. Used by: test_session_status.",minimum:1,maximum:50},locale:{type:"string",description:"Normalized locale identifier requested for the active Experience Language. Used by: experience_language_set.",minLength:2,maxLength:35},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"test_profile_set"}}},then:{required:["testProfile"]}},{if:{properties:{action:{const:"experience_language_set"}}},then:{required:["locale"]}},{if:{properties:{action:{const:"test_session_start"}}},then:{required:["scenario"]}},{if:{properties:{action:{const:"playtest_binding_candidates"}}},then:{required:["candidateSource"]}},{if:{properties:{action:{const:"playtest_profile_save"}}},then:{required:["profileOperation"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"create"}},required:["action","profileOperation"]},then:{required:["controlProfile"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"update"}},required:["action","profileOperation"]},then:{required:["controlProfile","expectedRevision"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"delete"}},required:["action","profileOperation"]},then:{required:["controlProfileId","expectedRevision"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"copy"}},required:["action","profileOperation"]},then:{required:["sourceProfileId","sourceRevision","destinationProfileId","destinationProfileName"]}},{if:{properties:{action:{const:"playtest_adapter_plan"}}},then:{required:["adapterOperation","adapterId"]}},{if:{properties:{action:{const:"playtest_adapter_apply"}}},then:{required:["planToken","expectedSourceHash"]}},{if:{properties:{action:{const:"playtest_source_open"}}},then:{required:["adapterId","adapterRegistrationId"]}},{if:{properties:{action:{const:"playtest_control_apply"}}},then:{required:["leaseId","expectedRevision","controlValues"]}},{if:{properties:{action:{const:"playtest_control_reset"}}},then:{required:["leaseId"]}},{if:{properties:{action:{const:"playtest_action_execute"}}},then:{required:["leaseId","controlProfileId","actionId","actionArguments","expectedProfileRevision","expectedRevision","requestId"]}},{if:{properties:{action:{const:"test_session_status"}}},then:{required:["sessionId"]}},{if:{properties:{action:{const:"test_session_stop"}}},then:{required:["sessionId"]}},{if:{properties:{action:{const:"run_test"}}},then:{required:["script"]}}],required:["action"]}};var GT={name:"batch_execute",description:'[PRO] Execute multiple commands in a single batch. Each command is an object with "tool" name and "args". Commands execute sequentially; optionally continue on error.',inputSchema:{type:"object",properties:{commands:{type:"array",description:"Array of commands to execute sequentially. Each command specifies a tool name and its arguments.",items:{type:"object",required:["tool","args"],properties:{tool:{type:"string",description:'Tool name to invoke (e.g., "mutate_instances", "manage_properties").'},args:{type:"object",description:"Arguments to pass to the tool, including action and other parameters.",additionalProperties:!0}}}},stopOnError:{type:"boolean",description:"If true, stop executing remaining commands when one fails. Default: true."},placeId:{type:"number",description:"Optional Studio target selector for the entire batch. Per-item selectors inside commands[].args are rejected."},clientId:{type:"string",description:"Optional Studio target selector for the entire batch. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["commands"]}};var JT={name:"execute_luau",description:"[PRO] Execute arbitrary Luau code in Roblox Studio sandbox. Blocked services: HttpService, DataStoreService, MessagingService. Cannot access CoreGui/CorePackages.",inputSchema:{type:"object",properties:{contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},source:{type:"string",description:"Luau source code to execute. The code runs in a sandboxed environment with access to game services (except blocked ones). Return values are serialized and sent back as the tool result."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this Luau execution to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["source"]}};var SB=[PT,CT,kT,RT,ET,AT,TT,OT,DT,NT,$T,jT,MT,LT,UT,zT,FT,qT,BT,VT,WT,HT,ZT,GT,JT];var Dpe=["oneOf","allOf","anyOf"];function _c(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Npe(t,e){if(!Array.isArray(t.allOf))return;let n=new Map;for(let a of t.allOf){let o=_c(a),s=_c(_c(o?.if)?.properties),c=_c(o?.then)?.required;if(!s||!Array.isArray(c))continue;let l=c.filter(u=>typeof u=="string");if(l.length!==0)for(let[u,d]of Object.entries(s)){if(u==="action")continue;let p=_c(d)?.const;if(typeof p!="string"&&typeof p!="number"&&typeof p!="boolean")continue;let m=`${JSON.stringify(p)} requires ${l.map(f=>`\`${f}\``).join(", ")}`;n.set(u,[...n.get(u)??[],m])}}if(n.size===0)return;let r=_c(e.properties);if(!r)return;let i={...r};for(let[a,o]of n){let s=_c(i[a]);if(!s)continue;let c=typeof s.description=="string"?s.description.trim():"",l=`Conditional requirements: ${o.join("; ")}.`;i[a]={...s,description:c?`${c} ${l}`:l}}e.properties=i}function xB(){return SB.map(t=>{let e=t.inputSchema;if(!e||typeof e!="object"||Array.isArray(e))return t;let n={...e};Npe(e,n);for(let r of Dpe)delete n[r];return{...t,inputSchema:n}})}var WS=class{server;connected=!1;constructor(e,n){this.server=new VS({name:"weppy-roblox-mcp",version:He},{capabilities:{tools:{},resources:{}},instructions:"Roblox MCP. UI \uC791\uC5C5\uC740 manage_ui \uB3C4\uAD6C\uB85C \uC2DC\uC791 (design_brief action \uD544\uC218). \uB514\uC790\uC778 \uC9C0\uCE68\uC740 resource 'weppy://ui-studio/guide' \uCC38\uC870."}),this.server.setRequestHandler(hE,async()=>({tools:xB()})),this.server.setRequestHandler(lE,async()=>({resources:await bB()})),this.server.setRequestHandler(dE,async r=>await _B(r.params.uri)),this.server.setRequestHandler(nf,async r=>await e(r.params.name,r.params.arguments??{})),this.server.oninitialized=()=>{let r=this.server.getClientVersion();r?.name&&n?.({name:r.name,...r.version?{version:r.version}:{}})}}async connect(e){await this.server.connect(e),this.connected=!0}async close(){this.connected&&(await this.server.close(),this.connected=!1)}};import{randomUUID as qpe}from"node:crypto";ZS();import{join as Hu}from"node:path";var is={query_instances:{discriminator:"action",validActions:new Set(["get","children","find_child","find_descendant","wait_for_child","class_info","search_name","search_class","search_property","search_tag","file_tree","project_structure","descendants","ancestors"]),allowedParams:{query_instances_get:new Set(["path","sessionDebugId","siblingIndex","placeId","clientId","targetAlias"]),query_instances_children:new Set(["path","sessionDebugId","siblingIndex","recursive","maxDepth","placeId","clientId","targetAlias"]),query_instances_find_child:new Set(["path","childName","placeId","clientId","targetAlias"]),query_instances_find_descendant:new Set(["path","descendantName","placeId","clientId","targetAlias"]),query_instances_wait_for_child:new Set(["path","childName","timeout","placeId","clientId","targetAlias"]),query_instances_class_info:new Set(["className","placeId","clientId","targetAlias"]),query_instances_search_name:new Set(["root","query","caseSensitive","maxResults","placeId","clientId","targetAlias"]),query_instances_search_class:new Set(["className","root","includeSubclasses","maxResults","placeId","clientId","targetAlias"]),query_instances_search_property:new Set(["root","propertyName","propertyValue","maxResults","placeId","clientId","targetAlias"]),query_instances_search_tag:new Set(["root","tag","maxResults","placeId","clientId","targetAlias"]),query_instances_file_tree:new Set(["maxDepth","root","includeServices","placeId","clientId","targetAlias"]),query_instances_project_structure:new Set(["root","depth","placeId","clientId","targetAlias"]),query_instances_descendants:new Set(["path","sessionDebugId","siblingIndex","maxResults","placeId","clientId","targetAlias"]),query_instances_ancestors:new Set(["path","sessionDebugId","siblingIndex","placeId","clientId","targetAlias"])},requiredParams:{query_instances_get:new Set(["path"]),query_instances_children:new Set(["path"]),query_instances_find_child:new Set(["path","childName"]),query_instances_find_descendant:new Set(["path","descendantName"]),query_instances_wait_for_child:new Set(["path","childName"]),query_instances_class_info:new Set(["className"]),query_instances_search_name:new Set(["query"]),query_instances_search_class:new Set(["className"]),query_instances_search_property:new Set(["propertyName"]),query_instances_search_tag:new Set(["tag"]),query_instances_file_tree:new Set([]),query_instances_project_structure:new Set([]),query_instances_descendants:new Set(["path"]),query_instances_ancestors:new Set(["path"])},paramAliases:{query_instances_search_name:{query:"pattern"},query_instances_search_property:{root:"rootPath"},query_instances_search_tag:{root:"rootPath"},query_instances_project_structure:{root:"rootPath"}}},mutate_instances:{discriminator:"action",validActions:new Set(["create","create_with_props","delete","clone","move","rename","pivot","create_tree","mass_create","mass_delete","mass_duplicate","smart_duplicate","scatter"]),allowedParams:{mutate_instances_create:new Set(["className","parent","name","properties","placeId","clientId","targetAlias"]),mutate_instances_create_with_props:new Set(["className","parent","name","properties","placeId","clientId","targetAlias"]),mutate_instances_delete:new Set(["path","sessionDebugId","siblingIndex","placeId","clientId","targetAlias"]),mutate_instances_clone:new Set(["path","sourcePath","sessionDebugId","siblingIndex","targetParent","newName","placeId","clientId","targetAlias"]),mutate_instances_move:new Set(["path","sessionDebugId","siblingIndex","newParent","placeId","clientId","targetAlias"]),mutate_instances_rename:new Set(["path","sessionDebugId","siblingIndex","newName","placeId","clientId","targetAlias"]),mutate_instances_pivot:new Set(["path","sessionDebugId","siblingIndex","position","cframe","offset","placeId","clientId","targetAlias"]),mutate_instances_create_tree:new Set(["parent","tree","placeId","clientId","targetAlias"]),mutate_instances_mass_create:new Set(["instances","placeId","clientId","targetAlias"]),mutate_instances_mass_delete:new Set(["paths","placeId","clientId","targetAlias"]),mutate_instances_mass_duplicate:new Set(["targetParent","paths","placeId","clientId","targetAlias"]),mutate_instances_smart_duplicate:new Set(["path","sessionDebugId","siblingIndex","targetParent","offset","count","placeId","clientId","targetAlias"]),mutate_instances_scatter:new Set(["templatePaths","region","count","seed","maxSlope","avoidWater","alignToNormal","scaleJitter","minSpacing","parentName","placeId","clientId","targetAlias"])},requiredParams:{mutate_instances_create:new Set(["className","parent"]),mutate_instances_create_with_props:new Set(["className","parent","name","properties"]),mutate_instances_delete:new Set(["path"]),mutate_instances_clone:new Set(["sourcePath"]),mutate_instances_move:new Set(["path","newParent"]),mutate_instances_rename:new Set(["path","newName"]),mutate_instances_pivot:new Set(["path"]),mutate_instances_create_tree:new Set(["parent","tree"]),mutate_instances_mass_create:new Set(["instances"]),mutate_instances_mass_delete:new Set(["paths"]),mutate_instances_mass_duplicate:new Set(["paths"]),mutate_instances_smart_duplicate:new Set(["path","offset"]),mutate_instances_scatter:new Set(["templatePaths","region","count"])},paramAliases:{mutate_instances_clone:{path:"sourcePath"},mutate_instances_smart_duplicate:{spacing:"offset"}}},manage_properties:{discriminator:"action",validActions:new Set(["get","set","get_all","set_multiple","get_attr","set_attr","get_all_attrs","delete_attr","add_tag","remove_tag","check_tag","get_tags","get_tagged","set_calculated","set_relative","mass_set","mass_get","modify_children"]),allowedParams:{manage_properties_get:new Set(["path","property","placeId","clientId","targetAlias"]),manage_properties_set:new Set(["path","property","value","placeId","clientId","targetAlias"]),manage_properties_get_all:new Set(["path","includeReadOnly","placeId","clientId","targetAlias"]),manage_properties_set_multiple:new Set(["path","properties","placeId","clientId","targetAlias"]),manage_properties_get_attr:new Set(["path","attribute","placeId","clientId","targetAlias"]),manage_properties_set_attr:new Set(["path","value","attribute","placeId","clientId","targetAlias"]),manage_properties_get_all_attrs:new Set(["path","placeId","clientId","targetAlias"]),manage_properties_delete_attr:new Set(["path","attribute","placeId","clientId","targetAlias"]),manage_properties_add_tag:new Set(["path","tag","placeId","clientId","targetAlias"]),manage_properties_remove_tag:new Set(["path","tag","placeId","clientId","targetAlias"]),manage_properties_check_tag:new Set(["path","tag","placeId","clientId","targetAlias"]),manage_properties_get_tags:new Set(["path","placeId","clientId","targetAlias"]),manage_properties_get_tagged:new Set(["tagName","root","maxResults","placeId","clientId","targetAlias"]),manage_properties_set_calculated:new Set(["path","expression","variables","propertyName","placeId","clientId","targetAlias"]),manage_properties_set_relative:new Set(["path","value","operation","amount","propertyName","placeId","clientId","targetAlias"]),manage_properties_mass_set:new Set(["paths","propertyName","propertyValue","placeId","clientId","targetAlias"]),manage_properties_mass_get:new Set(["paths","propertyName","placeId","clientId","targetAlias"]),manage_properties_modify_children:new Set(["parentPath","modifications","propertyName","propertyValue","filter","recursive","placeId","clientId","targetAlias"])},requiredParams:{manage_properties_get:new Set(["path","property"]),manage_properties_set:new Set(["path","property","value"]),manage_properties_get_all:new Set(["path"]),manage_properties_set_multiple:new Set(["path","properties"]),manage_properties_get_attr:new Set(["path","attribute"]),manage_properties_set_attr:new Set(["path","value","attribute"]),manage_properties_get_all_attrs:new Set(["path"]),manage_properties_delete_attr:new Set(["path","attribute"]),manage_properties_add_tag:new Set(["path","tag"]),manage_properties_remove_tag:new Set(["path","tag"]),manage_properties_check_tag:new Set(["path","tag"]),manage_properties_get_tags:new Set(["path"]),manage_properties_get_tagged:new Set(["tagName"]),manage_properties_set_calculated:new Set(["path","expression","propertyName"]),manage_properties_set_relative:new Set(["path","operation","propertyName"]),manage_properties_mass_set:new Set(["paths","propertyName","propertyValue"]),manage_properties_mass_get:new Set(["paths","propertyName"]),manage_properties_modify_children:new Set(["parentPath"])},paramAliases:{manage_properties_get_tagged:{tagName:"tag",root:"rootPath"},manage_properties_set_relative:{amount:"value"}}},manage_scripts:{discriminator:"action",validActions:new Set(["get_source","set_source","create","delete","edit_replace","edit_insert","edit_delete","search","replace","get_dependencies","validate"]),allowedParams:{manage_scripts_get_source:new Set(["path","startLine","endLine","placeId","clientId","targetAlias"]),manage_scripts_set_source:new Set(["path","source","validate","placeId","clientId","targetAlias"]),manage_scripts_create:new Set(["source","scriptType","parent","name","placeId","clientId","targetAlias"]),manage_scripts_delete:new Set(["path","placeId","clientId","targetAlias"]),manage_scripts_edit_replace:new Set(["path","startLine","endLine","newLines","validate","placeId","clientId","targetAlias"]),manage_scripts_edit_insert:new Set(["path","lines","afterLine","content","validate","placeId","clientId","targetAlias"]),manage_scripts_edit_delete:new Set(["path","startLine","endLine","validate","placeId","clientId","targetAlias"]),manage_scripts_search:new Set(["path","pattern","caseSensitive","wholeWord","usePattern","maxResults","placeId","clientId","targetAlias"]),manage_scripts_replace:new Set(["path","pattern","replacement","usePattern","dryRun","placeId","clientId","targetAlias"]),manage_scripts_get_dependencies:new Set(["path","placeId","clientId","targetAlias"]),manage_scripts_validate:new Set(["source","path","placeId","clientId","targetAlias"])},requiredParams:{manage_scripts_get_source:new Set(["path"]),manage_scripts_set_source:new Set(["path","source"]),manage_scripts_create:new Set(["scriptType","parent"]),manage_scripts_delete:new Set(["path"]),manage_scripts_edit_replace:new Set(["path","startLine","endLine","newLines"]),manage_scripts_edit_insert:new Set(["path","afterLine","content"]),manage_scripts_edit_delete:new Set(["path","startLine","endLine"]),manage_scripts_search:new Set(["path","pattern"]),manage_scripts_replace:new Set(["path","pattern","replacement"]),manage_scripts_get_dependencies:new Set(["path"]),manage_scripts_validate:new Set([])},paramAliases:{manage_scripts_edit_replace:{newLines:"newContent"},manage_scripts_edit_insert:{lines:"content"},manage_scripts_replace:{pattern:"searchPattern"}}},manage_ui:{discriminator:"action",validActions:new Set(["design_brief","create_tree","update","delete","preview","check"]),allowedParams:{manage_ui_design_brief:new Set(["brief","projectContext","agentCapabilities","runtimeEvidenceRef","placeId","clientId","targetAlias"]),manage_ui_create_tree:new Set(["briefId","tree","placeId","clientId","targetAlias"]),manage_ui_update:new Set(["targetPath","changes","briefId","placeId","clientId","targetAlias"]),manage_ui_delete:new Set(["targetPath","placeId","clientId","targetAlias"]),manage_ui_preview:new Set(["targetPath","briefId","viewportMode","profileIds","placeId","clientId","targetAlias"]),manage_ui_check:new Set(["targetPath","briefId","visualReview","viewportMode","profileIds","observationMode","runtimeEvidenceRef","placeId","clientId","targetAlias"])},requiredParams:{manage_ui_design_brief:new Set([]),manage_ui_create_tree:new Set(["briefId","tree"]),manage_ui_update:new Set(["briefId","targetPath","changes"]),manage_ui_delete:new Set(["targetPath"]),manage_ui_preview:new Set([]),manage_ui_check:new Set([])}},manage_lighting:{discriminator:"action",validActions:new Set(["lighting","atmosphere","sky","terrain_props","time","mood"]),allowedParams:{manage_lighting_lighting:new Set(["properties","placeId","clientId","targetAlias"]),manage_lighting_atmosphere:new Set(["properties","createIfMissing","placeId","clientId","targetAlias"]),manage_lighting_sky:new Set(["properties","createIfMissing","placeId","clientId","targetAlias"]),manage_lighting_terrain_props:new Set(["properties","placeId","clientId","targetAlias"]),manage_lighting_time:new Set(["time","clockTime","placeId","clientId","targetAlias"]),manage_lighting_mood:new Set(["preset","overrides","placeId","clientId","targetAlias"])},requiredParams:{manage_lighting_lighting:new Set([]),manage_lighting_atmosphere:new Set([]),manage_lighting_sky:new Set([]),manage_lighting_terrain_props:new Set([]),manage_lighting_time:new Set([]),manage_lighting_mood:new Set(["preset"])}},manage_selection:{discriminator:"action",validActions:new Set(["get","set","clear","cached","context","details","add","remove","watch"]),allowedParams:{manage_selection_get:new Set(["placeId","clientId","targetAlias"]),manage_selection_set:new Set(["paths","placeId","clientId","targetAlias"]),manage_selection_clear:new Set(["placeId","clientId","targetAlias"]),manage_selection_cached:new Set(["maxAge"]),manage_selection_context:new Set(["includeSource","includeProperties","includeChildren","placeId","clientId","targetAlias"]),manage_selection_details:new Set(["maxDepth","includeAncestors","placeId","clientId","targetAlias"]),manage_selection_add:new Set(["paths","placeId","clientId","targetAlias"]),manage_selection_remove:new Set(["paths","placeId","clientId","targetAlias"]),manage_selection_watch:new Set(["placeId","clientId","targetAlias"])},requiredParams:{manage_selection_get:new Set([]),manage_selection_set:new Set(["paths"]),manage_selection_clear:new Set([]),manage_selection_cached:new Set([]),manage_selection_context:new Set([]),manage_selection_details:new Set([]),manage_selection_add:new Set(["paths"]),manage_selection_remove:new Set(["paths"]),manage_selection_watch:new Set([])}},manage_camera:{discriminator:"action",validActions:new Set(["info","focus_path","focus_position","suggest","screenshot"]),allowedParams:{manage_camera_info:new Set(["placeId","clientId","targetAlias"]),manage_camera_focus_path:new Set(["path","distance","duration","offset","respectAutoFocusSetting","placeId","clientId","targetAlias"]),manage_camera_focus_position:new Set(["position","distance","duration","offset","lookAt","respectAutoFocusSetting","placeId","clientId","targetAlias"]),manage_camera_suggest:new Set(["path","placeId","clientId","targetAlias"]),manage_camera_screenshot:new Set(["placeId","clientId","targetAlias"])},requiredParams:{manage_camera_info:new Set([]),manage_camera_focus_path:new Set([]),manage_camera_focus_position:new Set(["position"]),manage_camera_suggest:new Set([]),manage_camera_screenshot:new Set([])},paramAliases:{manage_camera_suggest:{path:"targetPath"}}},manage_tween:{discriminator:"action",validActions:new Set(["create","play","pause","cancel"]),allowedParams:{manage_tween_create:new Set(["path","tweenInfo","properties","placeId","clientId","targetAlias"]),manage_tween_play:new Set(["tweenId","placeId","clientId","targetAlias"]),manage_tween_pause:new Set(["tweenId","placeId","clientId","targetAlias"]),manage_tween_cancel:new Set(["tweenId","placeId","clientId","targetAlias"])},requiredParams:{manage_tween_create:new Set(["path"]),manage_tween_play:new Set([]),manage_tween_pause:new Set([]),manage_tween_cancel:new Set([])}},manage_audio:{discriminator:"action",validActions:new Set(["play","stop","pause","resume","set_listener"]),allowedParams:{manage_audio_play:new Set(["path","soundId","volume","looped","playbackSpeed","placeId","clientId","targetAlias"]),manage_audio_stop:new Set(["path","placeId","clientId","targetAlias"]),manage_audio_pause:new Set(["path","placeId","clientId","targetAlias"]),manage_audio_resume:new Set(["path","placeId","clientId","targetAlias"]),manage_audio_set_listener:new Set(["listenerType","listenerPath","placeId","clientId","targetAlias"])},requiredParams:{manage_audio_play:new Set([]),manage_audio_stop:new Set([]),manage_audio_pause:new Set([]),manage_audio_resume:new Set([]),manage_audio_set_listener:new Set([])}},manage_animation:{discriminator:"action",validActions:new Set(["load","play","stop","get_tracks"]),allowedParams:{manage_animation_load:new Set(["path","animationId","placeId","clientId","targetAlias"]),manage_animation_play:new Set(["path","trackId","speed","fadeTime","weight","priority","placeId","clientId","targetAlias"]),manage_animation_stop:new Set(["path","trackId","fadeTime","placeId","clientId","targetAlias"]),manage_animation_get_tracks:new Set(["path","placeId","clientId","targetAlias"])},requiredParams:{manage_animation_load:new Set([]),manage_animation_play:new Set(["trackId"]),manage_animation_stop:new Set(["trackId"]),manage_animation_get_tracks:new Set([])}},manage_physics:{discriminator:"action",validActions:new Set(["register_group","set_collidable","get_groups"]),allowedParams:{manage_physics_register_group:new Set(["groupName","placeId","clientId","targetAlias"]),manage_physics_set_collidable:new Set(["group1","group2","collidable","placeId","clientId","targetAlias"]),manage_physics_get_groups:new Set(["placeId","clientId","targetAlias"])},requiredParams:{manage_physics_register_group:new Set(["groupName"]),manage_physics_set_collidable:new Set(["group1","group2","collidable"]),manage_physics_get_groups:new Set([])}},manage_effects:{discriminator:"action",validActions:new Set(["emit","clear","toggle"]),allowedParams:{manage_effects_emit:new Set(["path","count","placeId","clientId","targetAlias"]),manage_effects_clear:new Set(["path","placeId","clientId","targetAlias"]),manage_effects_toggle:new Set(["path","enabled","placeId","clientId","targetAlias"])},requiredParams:{manage_effects_emit:new Set([]),manage_effects_clear:new Set([]),manage_effects_toggle:new Set([])}},manage_terrain:{discriminator:"action",validActions:new Set(["fill_block","fill_ball","fill_cylinder","fill_wedge","clear_region","clear_bounds","replace_material","colors_get","colors_set","read_voxel","read_voxels","write_voxels","generate","smooth"]),allowedParams:{manage_terrain_fill_block:new Set(["cframe","size","material","placeId","clientId","targetAlias"]),manage_terrain_fill_ball:new Set(["center","radius","material","placeId","clientId","targetAlias"]),manage_terrain_fill_cylinder:new Set(["cframe","radius","height","material","placeId","clientId","targetAlias"]),manage_terrain_fill_wedge:new Set(["cframe","size","material","placeId","clientId","targetAlias"]),manage_terrain_clear_region:new Set(["region","placeId","clientId","targetAlias"]),manage_terrain_clear_bounds:new Set(["min","max","placeId","clientId","targetAlias"]),manage_terrain_replace_material:new Set(["material","region","sourceMaterial","targetMaterial","placeId","clientId","targetAlias"]),manage_terrain_colors_get:new Set(["material","placeId","clientId","targetAlias"]),manage_terrain_colors_set:new Set(["material","color","placeId","clientId","targetAlias"]),manage_terrain_read_voxel:new Set(["position","placeId","clientId","targetAlias"]),manage_terrain_read_voxels:new Set(["region","resolution","placeId","clientId","targetAlias"]),manage_terrain_write_voxels:new Set(["region","resolution","materials","occupancy","placeId","clientId","targetAlias"]),manage_terrain_generate:new Set(["region","preset","seed","baseHeight","amplitude","frequency","octaves","persistence","waterLevel","edgeBlend","materialPalette","layers","placeId","clientId","targetAlias"]),manage_terrain_smooth:new Set(["region","intensity","placeId","clientId","targetAlias"])},requiredParams:{manage_terrain_fill_block:new Set([]),manage_terrain_fill_ball:new Set([]),manage_terrain_fill_cylinder:new Set([]),manage_terrain_fill_wedge:new Set([]),manage_terrain_clear_region:new Set([]),manage_terrain_clear_bounds:new Set([]),manage_terrain_replace_material:new Set([]),manage_terrain_colors_get:new Set([]),manage_terrain_colors_set:new Set([]),manage_terrain_read_voxel:new Set([]),manage_terrain_read_voxels:new Set([]),manage_terrain_write_voxels:new Set([]),manage_terrain_generate:new Set(["region"]),manage_terrain_smooth:new Set([])}},spatial_query:{discriminator:"action",validActions:new Set(["raycast","find_ground","check_placement","multi_raycast","scan_area","find_flat","find_spawn","analyze_walkable","spatial_map","find_space","bounds","snap_grid","collision"]),allowedParams:{spatial_query_raycast:new Set(["origin","direction","filterType","filterList","filterInstances","ignoreWater","placeId","clientId","targetAlias"]),spatial_query_find_ground:new Set(["maxDistance","position","filterList","filterInstances","offset","placeId","clientId","targetAlias"]),spatial_query_check_placement:new Set(["position","size","filterList","filterInstances","rotation","checkGround","placeId","clientId","targetAlias"]),spatial_query_multi_raycast:new Set(["filterType","filterList","filterInstances","ignoreWater","rays","placeId","clientId","targetAlias"]),spatial_query_scan_area:new Set(["size","filterList","filterInstances","center","resolution","maxResults","placeId","clientId","targetAlias"]),spatial_query_find_flat:new Set(["searchArea","minSize","maxSlope","tolerance","maxResults","placeId","clientId","targetAlias"]),spatial_query_find_spawn:new Set(["searchArea","spawnSize","minSpacing","preferOutdoor","count","placeId","clientId","targetAlias"]),spatial_query_analyze_walkable:new Set(["area","maxSlope","resolution","characterHeight","maxStepHeight","placeId","clientId","targetAlias"]),spatial_query_spatial_map:new Set(["path","rootPath","includeModels","maxResults","placeId","clientId","targetAlias"]),spatial_query_find_space:new Set(["size","searchArea","gridSize","gridSnap","padding","placeId","clientId","targetAlias"]),spatial_query_bounds:new Set(["path","paths","placeId","clientId","targetAlias"]),spatial_query_snap_grid:new Set(["gridSize","path","gridSnap","axes","placeId","clientId","targetAlias"]),spatial_query_collision:new Set(["position","path","ignorePaths","placeId","clientId","targetAlias"])},requiredParams:{spatial_query_raycast:new Set([]),spatial_query_find_ground:new Set([]),spatial_query_check_placement:new Set([]),spatial_query_multi_raycast:new Set([]),spatial_query_scan_area:new Set([]),spatial_query_find_flat:new Set([]),spatial_query_find_spawn:new Set([]),spatial_query_analyze_walkable:new Set([]),spatial_query_spatial_map:new Set([]),spatial_query_find_space:new Set([]),spatial_query_bounds:new Set([]),spatial_query_snap_grid:new Set(["path"]),spatial_query_collision:new Set(["path"])},paramAliases:{spatial_query_spatial_map:{path:"rootPath"}}},manage_assets:{discriminator:"action",validActions:new Set(["insert","info","search","search_insert","insert_free","insert_package","export_selection_json","export_selection_rbxm","export_path_rbxm","review_model","generate_model","upload_asset","import_rbxm","generate_thumbnail"]),allowedParams:{manage_assets_insert:new Set(["assetId","parent","name","position","placeId","clientId","targetAlias"]),manage_assets_info:new Set(["assetId","placeId","clientId","targetAlias"]),manage_assets_search:new Set(["query","maxResults","category","sortType","placeId","clientId","targetAlias"]),manage_assets_search_insert:new Set(["parent","name","query","placeId","clientId","targetAlias"]),manage_assets_insert_free:new Set(["assetId","parent","name","position","placeId","clientId","targetAlias"]),manage_assets_insert_package:new Set(["assetId","parent","name","placeId","clientId","targetAlias"]),manage_assets_export_selection_json:new Set(["format","includeProperties","includeChildren","maxDepth","placeId","clientId","targetAlias"]),manage_assets_export_selection_rbxm:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","displayName","description","thumbnailMode","uploadMode","uploadTemporaryAssets","creatorType","creatorId","clientId","targetAlias"]),manage_assets_export_path_rbxm:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","sourcePath","displayName","description","thumbnailMode","uploadMode","uploadTemporaryAssets","creatorType","creatorId","clientId","targetAlias"]),manage_assets_review_model:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","sourcePath","displayName","description","thumbnailMode","uploadMode","uploadTemporaryAssets","creatorType","creatorId","exportToLibrary","expectedUse","expectedGroups","maxDescendants","maxDepth","readiness","clientId","targetAlias"]),manage_assets_generate_model:new Set(["contextId","contextSummary","replayMetadata","placeId","category","prompt","schemaMode","predefinedSchema","schemaGroups","size","maxTriangles","generateTextures","review","targetParent","name","displayName","expectedUse","expectedGroups","maxDescendants","maxDepth","readiness","anchorMode","clientId","targetAlias"]),manage_assets_upload_asset:new Set(["contextId","contextSummary","replayMetadata","placeId","category","assetType","sourcePath","displayName","description","creatorType","creatorId","clientId","targetAlias"]),manage_assets_import_rbxm:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","assetLibraryAssetId","targetParent","name","clientId","targetAlias"]),manage_assets_generate_thumbnail:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","assetLibraryAssetId","clientId","targetAlias"])},requiredParams:{manage_assets_insert:new Set(["assetId"]),manage_assets_info:new Set(["assetId"]),manage_assets_search:new Set(["query"]),manage_assets_search_insert:new Set(["query"]),manage_assets_insert_free:new Set(["assetId"]),manage_assets_insert_package:new Set(["assetId"]),manage_assets_export_selection_json:new Set([]),manage_assets_export_selection_rbxm:new Set(["category"]),manage_assets_export_path_rbxm:new Set(["category","sourcePath"]),manage_assets_review_model:new Set(["category"]),manage_assets_generate_model:new Set(["prompt"]),manage_assets_upload_asset:new Set([]),manage_assets_import_rbxm:new Set(["category","assetLibraryAssetId"]),manage_assets_generate_thumbnail:new Set(["category","assetLibraryAssetId"])},paramAliases:{manage_assets_search:{maxResults:"limit"}}},manage_open_cloud_assets:{discriminator:"action",validActions:new Set(["preflight","credential_status","capabilities","upload","link","update","info","operation_status"]),allowedParams:{manage_open_cloud_assets_preflight:new Set(["filePath","category","creatorType","creatorId"]),manage_open_cloud_assets_credential_status:new Set([]),manage_open_cloud_assets_capabilities:new Set([]),manage_open_cloud_assets_upload:new Set(["contextId","contextSummary","replayMetadata","filePath","category","scope","placeId","displayName","description","creatorType","creatorId","expectedPrice","waitForOperation","operationPollTimeoutMs","operationPollIntervalMs"]),manage_open_cloud_assets_link:new Set(["contextId","contextSummary","replayMetadata","assetId","filePath","category","scope","placeId","displayName","description"]),manage_open_cloud_assets_update:new Set(["contextId","contextSummary","replayMetadata","assetId","filePath","category","displayName","description","creatorType","creatorId","expectedPrice","updateMask","waitForOperation","operationPollTimeoutMs","operationPollIntervalMs"]),manage_open_cloud_assets_info:new Set(["assetId","readMask"]),manage_open_cloud_assets_operation_status:new Set(["operationId"])},requiredParams:{manage_open_cloud_assets_preflight:new Set([]),manage_open_cloud_assets_credential_status:new Set([]),manage_open_cloud_assets_capabilities:new Set([]),manage_open_cloud_assets_upload:new Set(["filePath","category","displayName"]),manage_open_cloud_assets_link:new Set(["assetId","filePath","category"]),manage_open_cloud_assets_update:new Set(["assetId","category"]),manage_open_cloud_assets_info:new Set(["assetId"]),manage_open_cloud_assets_operation_status:new Set(["operationId"])}},manage_sync:{discriminator:"action",validActions:new Set(["status_current_place","history","policy","read_file","write_file","progress"]),allowedParams:{manage_sync_status_current_place:new Set([]),manage_sync_history:new Set(["placeId","query"]),manage_sync_policy:new Set(["placeId"]),manage_sync_read_file:new Set(["placeId","instancePath"]),manage_sync_write_file:new Set(["placeId","instancePath","content"]),manage_sync_progress:new Set([])},requiredParams:{manage_sync_status_current_place:new Set([]),manage_sync_history:new Set([]),manage_sync_policy:new Set([]),manage_sync_read_file:new Set(["placeId","instancePath"]),manage_sync_write_file:new Set(["placeId","instancePath","content"]),manage_sync_progress:new Set([])}},workspace_state:{discriminator:"action",validActions:new Set(["sync","snapshot","changes","viewport","clear_history","metadata","scripts","selection_info","clear_cache"]),allowedParams:{workspace_state_sync:new Set(["includeMetadata","placeId","clientId","targetAlias"]),workspace_state_snapshot:new Set(["placeId","clientId","targetAlias"]),workspace_state_changes:new Set(["limit","placeId","clientId","targetAlias"]),workspace_state_viewport:new Set(["includeCameraInfo","includeSelectionBounds","placeId","clientId","targetAlias"]),workspace_state_clear_history:new Set(["placeId","clientId","targetAlias"]),workspace_state_metadata:new Set(["placeId","clientId","targetAlias"]),workspace_state_scripts:new Set(["placeId","clientId","targetAlias"]),workspace_state_selection_info:new Set(["placeId","clientId","targetAlias"]),workspace_state_clear_cache:new Set(["placeId","clientId","targetAlias"])},requiredParams:{workspace_state_sync:new Set([]),workspace_state_snapshot:new Set([]),workspace_state_changes:new Set([]),workspace_state_viewport:new Set([]),workspace_state_clear_history:new Set([]),workspace_state_metadata:new Set([]),workspace_state_scripts:new Set([]),workspace_state_selection_info:new Set([]),workspace_state_clear_cache:new Set([])}},manage_logs:{discriminator:"action",validActions:new Set(["get","clear","errors"]),allowedParams:{manage_logs_get:new Set(["level","limit","pattern","since","sinceSeq","placeId","clientId","targetAlias"]),manage_logs_clear:new Set(["placeId","clientId","targetAlias"]),manage_logs_errors:new Set(["limit","placeId","clientId","targetAlias"])},requiredParams:{manage_logs_get:new Set([]),manage_logs_clear:new Set([]),manage_logs_errors:new Set([])},paramAliases:{manage_logs_get:{level:"type"}}},manage_settings:{discriminator:"action",validActions:new Set(["get_dashboard_auto_open","set_dashboard_auto_open"]),allowedParams:{manage_settings_get_dashboard_auto_open:new Set([]),manage_settings_set_dashboard_auto_open:new Set(["enabled"])},requiredParams:{manage_settings_get_dashboard_auto_open:new Set([]),manage_settings_set_dashboard_auto_open:new Set(["enabled"])}},system_info:{discriminator:"action",validActions:new Set(["ping","connection","usage","place_info","services","preflight"]),allowedParams:{system_info_ping:new Set(["message","placeId","clientId","targetAlias"]),system_info_connection:new Set([]),system_info_usage:new Set(["placeId","clientId","targetAlias"]),system_info_place_info:new Set(["placeId","clientId","targetAlias"]),system_info_services:new Set(["placeId","clientId","targetAlias"]),system_info_preflight:new Set(["placeId","clientId","targetAlias"])},requiredParams:{system_info_ping:new Set([]),system_info_connection:new Set([]),system_info_usage:new Set([]),system_info_place_info:new Set([]),system_info_services:new Set([]),system_info_preflight:new Set([])}},manage_studio:{discriminator:"action",validActions:new Set(["toggle_ui_preview","test_profile_get","test_profile_set","test_profile_reset","experience_language_get","experience_language_set","play_start","play_stop","play_pause","play_resume","play_status","test_session_start","playtest_control_get","playtest_prepare","playtest_binding_candidates","playtest_profile_save","playtest_adapter_plan","playtest_adapter_apply","playtest_source_open","playtest_control_apply","playtest_control_reset","playtest_action_execute","test_session_status","test_session_stop","run_test"]),allowedParams:{manage_studio_toggle_ui_preview:new Set(["enabled","placeId","clientId","targetAlias"]),manage_studio_test_profile_get:new Set(["placeId","clientId","targetAlias"]),manage_studio_test_profile_set:new Set(["testProfile","placeId","clientId","targetAlias"]),manage_studio_test_profile_reset:new Set(["placeId","clientId","targetAlias"]),manage_studio_experience_language_get:new Set(["placeId","clientId","targetAlias"]),manage_studio_experience_language_set:new Set(["locale","placeId","clientId","targetAlias"]),manage_studio_play_start:new Set(["mode","testProfile","restoreAfterTest","controlProfileId","placeId","clientId","targetAlias"]),manage_studio_play_stop:new Set(["placeId","clientId","targetAlias"]),manage_studio_play_pause:new Set(["placeId","clientId","targetAlias"]),manage_studio_play_resume:new Set(["placeId","clientId","targetAlias"]),manage_studio_play_status:new Set(["placeId","clientId","targetAlias"]),manage_studio_test_session_start:new Set(["scenario","idempotencyKey","testProfile","restoreAfterTest","controlProfileId","placeId","clientId","targetAlias","contextId","contextSummary","replayMetadata"]),manage_studio_playtest_control_get:new Set(["controlProfileId","leaseId","placeId","clientId","targetAlias"]),manage_studio_playtest_prepare:new Set(["controlProfileId","placeId","clientId","targetAlias"]),manage_studio_playtest_binding_candidates:new Set(["candidateSource","candidateTarget","candidatePath","maxResults","placeId","clientId","targetAlias"]),manage_studio_playtest_profile_save:new Set(["profileOperation","controlProfileId","controlProfile","expectedRevision","sourceProfileId","sourceRevision","sourcePlaceId","sourcePlaceName","destinationProfileId","destinationProfileName","placeId","clientId","targetAlias"]),manage_studio_playtest_adapter_plan:new Set(["adapterOperation","adapterId","adapterRegistrationId","adapterRegistrationLabel","adapterRegistrationGroup","adapterRegistrationKind","adapterValueType","adapterModulePath","adapterReadMethod","adapterWriteMethod","adapterMethodStyle","adapterStudioOnly","adapterConstraints","adapterEnumValues","productionExclusionStrategy","productionExclusionReference","placeId","clientId","targetAlias"]),manage_studio_playtest_adapter_apply:new Set(["planToken","expectedSourceHash"]),manage_studio_playtest_source_open:new Set(["adapterId","adapterRegistrationId","placeId","clientId","targetAlias"]),manage_studio_playtest_control_apply:new Set(["leaseId","expectedRevision","controlValues","placeId","clientId","targetAlias"]),manage_studio_playtest_control_reset:new Set(["leaseId","placeId","clientId","targetAlias"]),manage_studio_playtest_action_execute:new Set(["leaseId","controlProfileId","actionId","actionArguments","expectedProfileRevision","expectedRevision","requestId","placeId","clientId","targetAlias"]),manage_studio_test_session_status:new Set(["sessionId","stepCursor","stepLimit","placeId","clientId","targetAlias"]),manage_studio_test_session_stop:new Set(["sessionId","placeId","clientId","targetAlias"]),manage_studio_run_test:new Set(["mode","script","test_name","timeout","testProfile","restoreAfterTest","placeId","clientId","targetAlias","contextId","contextSummary","replayMetadata"])},requiredParams:{manage_studio_toggle_ui_preview:new Set([]),manage_studio_test_profile_get:new Set([]),manage_studio_test_profile_set:new Set(["testProfile"]),manage_studio_test_profile_reset:new Set([]),manage_studio_experience_language_get:new Set([]),manage_studio_experience_language_set:new Set(["locale"]),manage_studio_play_start:new Set([]),manage_studio_play_stop:new Set([]),manage_studio_play_pause:new Set([]),manage_studio_play_resume:new Set([]),manage_studio_play_status:new Set([]),manage_studio_test_session_start:new Set(["scenario"]),manage_studio_playtest_control_get:new Set([]),manage_studio_playtest_prepare:new Set([]),manage_studio_playtest_binding_candidates:new Set(["candidateSource"]),manage_studio_playtest_profile_save:new Set(["profileOperation"]),manage_studio_playtest_adapter_plan:new Set(["adapterOperation","adapterId"]),manage_studio_playtest_adapter_apply:new Set(["planToken","expectedSourceHash"]),manage_studio_playtest_source_open:new Set(["adapterId","adapterRegistrationId"]),manage_studio_playtest_control_apply:new Set(["leaseId","expectedRevision","controlValues"]),manage_studio_playtest_control_reset:new Set(["leaseId"]),manage_studio_playtest_action_execute:new Set(["leaseId","controlProfileId","actionId","actionArguments","expectedProfileRevision","expectedRevision","requestId"]),manage_studio_test_session_status:new Set(["sessionId"]),manage_studio_test_session_stop:new Set(["sessionId"]),manage_studio_run_test:new Set(["script"])}}},KT={batch_execute:new Set(["commands"]),execute_luau:new Set(["source"])};var wB=new Set(["execute_luau","batch_execute"]),jpe=["placeId","clientId","targetAlias"],Mpe=new Set(["action","placeId","clientId","targetAlias","contextId","contextSummary","replayMetadata"]);function IB(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Lpe(t){return t instanceof Error?t.message:String(t)}var GS=Object.entries(is).reduce((t,[e,n])=>{for(let r of n.validActions)t[`${e}_${r}`]=e;return t},{});function Upe(t,e){let n=e.map(r=>`'${r}'`).join(", ");return e.length===1?`Parameter ${n} is not used by action '${t}'.`:`Parameters ${n} are not used by action '${t}'.`}function YT(t,e){let n=is[t];if(!n)return[];let r=e[n.discriminator];if(typeof r!="string"||r===""||!n.validActions.has(r))return[];let i=`${t}_${r}`,a=new Set(n.allowedParams[i]||[]);a.add(n.discriminator);for(let c of Mpe)a.add(c);let o=n.paramAliases?.[i];if(o)for(let[c,l]of Object.entries(o))a.add(c),a.add(l);let s=Object.keys(e).filter(c=>e[c]!==void 0&&!a.has(c)).sort();return s.length===0?[]:[Upe(r,s)]}function as(t,e){let n=is[t];if(!n){if(t==="batch_execute"&&Array.isArray(e.commands)){let l=e.commands.map((u,d)=>{let p=`batch_execute.commands[${d}]`;if(!IB(u))throw new Error(`${p} must be an object`);let m=u.tool;if(typeof m!="string"||m.trim()==="")throw new Error(`${p}.tool is required and must be a non-empty string`);if(!IB(u.args))throw new Error(`${p}.args is required and must be an object`);for(let g of jpe)if(g in u.args)throw new Error(`${p}.args.${g} is not supported. Pass ${g} at the top level of batch_execute so the whole batch targets one Studio client.`);if(wB.has(m))throw new Error(`Tool "${m}" is not allowed inside batch_execute. Denied tools: ${[...wB].join(", ")}`);let f;try{f=as(m,u.args)}catch(g){let h=Lpe(g);throw/^Missing or non-string/.test(h)?new Error(`${p}.args.action is required and must be a non-empty string`):new Error(`${p}: ${h}`)}return{command:f.command,params:f.params,...f.warnings?{warnings:f.warnings}:{}}});return{tool:t,command:t,params:{...e,commands:l}}}return{tool:t,command:t,params:{...e}}}let r=e[n.discriminator];if(typeof r!="string"||r==="")throw new Error(`Missing or non-string ${n.discriminator} for tool "${t}"`);if(!n.validActions.has(r)){let l=[...n.validActions].join(", ");throw new Error(`Invalid ${n.discriminator} "${r}" for tool "${t}". Valid values: ${l}`)}let i=`${t}_${r}`,a=YT(t,e),{[n.discriminator]:o,...s}=e;t==="manage_sync"&&r==="status_current_place"&&delete s.placeId;let c=n.paramAliases?.[i];if(c)for(let[l,u]of Object.entries(c))l in s&&!(u in s)&&(s[u]=s[l],delete s[l]);return{tool:t,action:r,command:i,params:s,...a.length>0?{warnings:a}:{}}}function Zf(t){return GS[t]||t}function JS(t){let e=GS[t];if(e)return t.slice(e.length+1)}function KS(t){let e=GS[t];if(e)return is[e]?.paramAliases?.[t]}function YS(t){let e=GS[t];return e?[...is[e]?.requiredParams[t]??[]]:[...KT[t]??[]]}function Gf(t){return t in is||t in KT}function XS(){return{...is}}var QS=1,Jf=1,Zu=1e4,ex=2e3,On={identity:"/internal/adapter/identity",register:"/internal/adapter/register",heartbeat:"/internal/adapter/heartbeat",unregister:"/internal/adapter/unregister",execute:"/internal/adapter/execute",adapters:"/internal/adapter/sessions",shutdown:"/internal/adapter/shutdown"};function Kf(t){if(!t||typeof t!="object")return!1;let e=t;return e.schemaVersion!==Jf||typeof e.lockId!="string"||e.lockId.length===0||!Number.isInteger(e.pid)?!1:e.phase==="starting"?typeof e.adapterId=="string"&&typeof e.createdAt=="number"&&typeof e.deadlineAt=="number":e.phase==="ready"?typeof e.instanceId=="string"&&typeof e.claimedAt=="number":!1}function PB(t){let{token:e,...n}=t;return n}function tx(t){let e=Hu(t,"runtime");return{runtimeDir:e,stateFile:Hu(e,"bridge-state.json"),stateMutation:Hu(e,"bridge-state.json.mutation"),startupLock:Hu(e,"bridge-startup.lock"),startupLockMutation:Hu(e,"bridge-startup.lock.mutation"),logFile:Hu(e,"bridge.log")}}function CB(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Fpe(t,e,n){let r=t;return e&&(r=CB(r)?{...r,routing:e}:r===void 0?{routing:e}:{value:r,routing:e}),n.length>0&&(r=CB(r)?{...r,warnings:[...n]}:r===void 0?{warnings:[...n]}:{value:r,warnings:[...n]}),r}function kB(t,e=[]){let n=[...new Set([...e,...t.warnings??[]])];if(!t.success){let a={success:!1,...t.error?{error:t.error}:{},...t.errorCode?{errorCode:t.errorCode}:{},...t.data!==void 0?{data:t.data}:{},...t.routing?{routing:t.routing}:{},...n.length>0?{warnings:n}:{},...t.indeterminate?{indeterminate:!0}:{}};return{content:[{type:"text",text:JSON.stringify(a,null,2)}],isError:!0}}let r=(t.content??[]).map(a=>a.kind==="image"?{type:"image",data:a.data,mimeType:a.mimeType}:{type:"text",text:a.text}),i=Fpe(t.data,t.routing,n);return i!==void 0&&r.push({type:"text",text:JSON.stringify(i,null,2)}),r.length===0&&r.push({type:"text",text:JSON.stringify({success:!0,message:"Command executed"})}),{content:r,isError:!1}}function RB(t){return async(e,n)=>{let r=[];try{await t.ensureBridgeSession();let i=as(e,n);r=i.warnings??[];let a={requestId:t.requestIdFactory?.()??qpe(),adapterId:t.adapterId,tool:i.tool,command:i.command,params:i.params,executionMode:HS(i.command),timeoutMs:t.requestTimeoutMs};return kB(await t.execute(a),r)}catch(i){let a=i instanceof Error?i.message:String(i);return{content:[{type:"text",text:r.length>0?JSON.stringify({success:!1,error:a,warnings:r},null,2):`Error: ${a}`}],isError:!0}}}}var nx=class{constructor(e){this.options=e;this.adapterId=e.adapterId??Bpe(),this.aiClientName=e.aiClientName,this.aiClientVersion=e.aiClientVersion,this.aiClientSource=e.aiClientSource,this.mcpServer=new WS(RB({adapterId:this.adapterId,requestTimeoutMs:e.requestTimeoutMs,execute:async n=>await e.bridgeClient.execute(n),ensureBridgeSession:async()=>await this.ensureBridgeSession()}),n=>{this.updateClientInfo(n)})}lifecycle=new eS;adapterId;mcpServer;bridgeReadyPromise=null;bridgeRetryTimer=null;heartbeatTimer=null;registered=!1;stopping=!1;aiClientName;aiClientVersion;aiClientSource;async start(){return this.lifecycle.start(async()=>{await this.mcpServer.connect(this.options.transport??new Q_),this.stopping=!1,this.startEagerBridgeSession()})}async stop(){return this.lifecycle.stop(async()=>{this.stopping=!0,this.bridgeRetryTimer&&(clearTimeout(this.bridgeRetryTimer),this.bridgeRetryTimer=null),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),await this.bridgeReadyPromise?.catch(()=>{}),this.registered&&(await this.options.bridgeClient.unregister().catch(()=>{}),this.registered=!1),await this.options.bridgeClient.close(),await this.mcpServer.close()})}async ensureBridgeSession(){this.registered||await this.getOrStartBridgeSession()}startEagerBridgeSession(){this.stopping||this.registered||this.bridgeRetryTimer||this.getOrStartBridgeSession().catch(()=>{if(this.stopping||this.registered||this.bridgeRetryTimer)return;let e=this.options.bridgeRetryDelayMs??1e3;this.bridgeRetryTimer=setTimeout(()=>{this.bridgeRetryTimer=null,this.startEagerBridgeSession()},e),this.bridgeRetryTimer.unref()})}getOrStartBridgeSession(){if(this.bridgeReadyPromise)return this.bridgeReadyPromise;let e=this.openBridgeSession();return this.bridgeReadyPromise=e,e.then(()=>{this.bridgeReadyPromise===e&&(this.bridgeReadyPromise=null)},()=>{this.bridgeReadyPromise===e&&(this.bridgeReadyPromise=null)}),e}async openBridgeSession(){await this.options.bridgeClient.ensureReady();let e=this.createRegistration();await this.options.bridgeClient.register(e),this.registered=!0;let n=this.createRegistration();(e.aiClientName!==n.aiClientName||e.aiClientVersion!==n.aiClientVersion||e.aiClientSource!==n.aiClientSource)&&await this.options.bridgeClient.register(n);let r=this.options.heartbeatIntervalMs??5e3;this.heartbeatTimer=setInterval(()=>{this.options.bridgeClient.heartbeat().catch(()=>{})},r),this.heartbeatTimer.unref()}createRegistration(){return{adapterId:this.adapterId,pid:this.options.pid??process.pid,mcpVersion:He,cwd:this.options.cwd??process.cwd(),projectRoot:this.options.projectRoot,...this.aiClientName?{aiClientName:this.aiClientName}:{},...this.aiClientVersion?{aiClientVersion:this.aiClientVersion}:{},...this.aiClientSource?{aiClientSource:this.aiClientSource}:{}}}async updateClientInfo(e){let n=e.version||void 0;this.aiClientName===e.name&&this.aiClientVersion===n&&this.aiClientSource==="mcp"||(this.aiClientName=e.name,this.aiClientVersion=n,this.aiClientSource="mcp",this.registered&&await this.options.bridgeClient.register(this.createRegistration()).catch(()=>{}))}};var Ee=class extends Error{code;status;constructor(e,n,r={}){super(n),this.name="BridgeClientError",this.code=e,r.status!==void 0&&(this.status=r.status)}},Vpe=new Set(["bridge_unavailable","bridge_identity_mismatch","bridge_protocol_mismatch","bridge_port_ownership_conflict","bridge_request_duplicate","bridge_request_indeterminate","bridge_readiness_timeout"]);function XT(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Wpe(t){let e=XT(t);if(!e)return null;let n=e.errorCode??e.error;return typeof n!="string"||!Vpe.has(n)?null:n}function Hpe(t){let e=XT(t);return e!==null&&typeof e.requestId=="string"&&typeof e.success=="boolean"}function Zpe(t){let e=XT(t);return!e||"token"in e?!1:Number.isInteger(e.pid)&&typeof e.instanceId=="string"&&Number.isInteger(e.protocolVersion)&&typeof e.mcpVersion=="string"&&e.host==="127.0.0.1"&&Number.isInteger(e.port)&&(e.status==="starting"||e.status==="ready"||e.status==="stopping")&&typeof e.startedAt=="number"}var rx=class{state;adapterId;fetchImpl;baseUrl;controlRequestTimeoutMs;constructor(e){this.state={...e.state},this.adapterId=e.adapterId,this.fetchImpl=e.fetchImpl??globalThis.fetch,this.baseUrl=`http://${this.state.host}:${this.state.port}`,this.controlRequestTimeoutMs=e.controlRequestTimeoutMs??5e3}async ensureReady(){await this.identity()}async identity(){let e=await this.requestJson("GET",On.identity);if(!Zpe(e))throw new Ee("bridge_identity_mismatch","Bridge identity response is invalid");if(e.protocolVersion!==this.state.protocolVersion||e.mcpVersion!==this.state.mcpVersion)throw new Ee("bridge_protocol_mismatch","Bridge protocol or MCP version does not match verified state");if(e.pid!==this.state.pid||(e.runtimeEnvironment??"release")!==(this.state.runtimeEnvironment??"release")||e.instanceId!==this.state.instanceId||e.host!==this.state.host||e.port!==this.state.port||e.startedAt!==this.state.startedAt)throw new Ee("bridge_identity_mismatch","Bridge identity does not match verified state");if(this.state.status!=="ready"||e.status!=="ready")throw new Ee("bridge_unavailable","Bridge is not ready");return e}async register(e){if(e.adapterId!==this.adapterId)throw new Ee("bridge_protocol_mismatch","Bridge registration Adapter identity does not match this client");await this.requestJson("POST",On.register,e)}async heartbeat(){await this.requestJson("POST",On.heartbeat,{adapterId:this.adapterId})}async execute(e){if(e.adapterId!==this.adapterId)throw new Ee("bridge_protocol_mismatch","Bridge execute request Adapter identity does not match this client");let n=await this.requestJson("POST",On.execute,e,e.timeoutMs);if(!Hpe(n))throw new Ee("bridge_protocol_mismatch","Bridge execute response is invalid");if(n.requestId!==e.requestId)throw new Ee("bridge_protocol_mismatch","Bridge execute response request identity does not match");return n}async unregister(){await this.requestJson("POST",On.unregister,{adapterId:this.adapterId})}close(){}async requestJson(e,n,r,i=this.controlRequestTimeoutMs){let a=new AbortController,o=setTimeout(()=>a.abort(),i);o.unref();let s;try{s=await this.fetchImpl(`${this.baseUrl}${n}`,{method:e,signal:a.signal,headers:{Accept:"application/json",Authorization:`Bearer ${this.state.token}`,...r!==void 0?{"Content-Type":"application/json"}:{}},...r!==void 0?{body:JSON.stringify(r)}:{}})}catch{throw clearTimeout(o),new Ee("bridge_unavailable",`Bridge ${e} ${n} transport failed`)}let c;try{c=await s.text()}catch{throw new Ee("bridge_unavailable",`Bridge ${e} ${n} response transport failed`,{status:s.status})}finally{clearTimeout(o)}let l;try{l=JSON.parse(c)}catch{throw s.ok?new Ee("bridge_protocol_mismatch",`Bridge ${e} ${n} returned invalid JSON`,{status:s.status}):new Ee("bridge_unavailable",`Bridge ${e} ${n} returned HTTP ${s.status}`,{status:s.status})}if(!s.ok)throw new Ee(Wpe(l)??"bridge_unavailable",`Bridge ${e} ${n} returned HTTP ${s.status}`,{status:s.status});return l}};import{createConnection as Kpe}from"node:net";import{readFile as Gpe}from"node:fs/promises";function Jpe(t){if(!t||typeof t!="object")return!1;let e=t;return Number.isInteger(e.pid)&&(e.pid??0)>0&&typeof e.instanceId=="string"&&e.instanceId.length>0&&Number.isInteger(e.protocolVersion)&&typeof e.mcpVersion=="string"&&e.mcpVersion.length>0&&e.host==="127.0.0.1"&&Number.isInteger(e.port)&&(e.port??0)>0&&(e.port??0)<=65535&&(e.status==="starting"||e.status==="ready"||e.status==="stopping")&&typeof e.token=="string"&&e.token.length>=32&&typeof e.startedAt=="number"}async function EB(t){let e;try{e=await Gpe(t.stateFile,"utf8")}catch(n){if(n.code==="ENOENT")return{kind:"absent"};throw n}try{let n=JSON.parse(e);return Jpe(n)?{kind:"state",state:n}:{kind:"invalid",reason:"bridge state fields are invalid"}}catch{return{kind:"invalid",reason:"bridge state is not valid JSON"}}}var Ype="2.14.6";function AB(t){return t.startsWith("0.0.")}function QT(t){let e=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(t);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Xpe(t,e){let n=QT(t),r=QT(e);if(!n||!r)return!1;let[i,a,o]=n,[s,c,l]=r;return i!==s?i>s:a!==c?a>c:o>=l}function Qpe(t,e){return AB(t)?!0:QT(t)?Xpe(e,Ype):!1}async function TB(t){let e=await EB(t.paths);if(e.kind!=="state"||e.state.status!=="ready")return null;if(t.expectedPort!==void 0&&e.state.port!==t.expectedPort||t.runtimeEnvironment!==void 0&&(e.state.runtimeEnvironment??"release")!==t.runtimeEnvironment)throw new Ee("bridge_identity_mismatch","Bridge environment or port does not match configured runtime");if(t.runtimeEnvironment==="development"&&(e.state.port===3002||!AB(e.state.mcpVersion)))throw new Ee("bridge_identity_mismatch","Development Adapter cannot reuse a release Bridge");let n=new rx({state:e.state,adapterId:t.adapterId,...t.fetchImpl?{fetchImpl:t.fetchImpl}:{}});await n.ensureReady();let r=t.expectedMcpVersion??He;if(e.state.protocolVersion!==QS||!Qpe(r,e.state.mcpVersion))throw new Ee("bridge_protocol_mismatch","Running Bridge protocol or MCP version is incompatible");return{state:e.state,client:n}}async function eO(t,e=250){return await new Promise(n=>{let r=Kpe({host:"127.0.0.1",port:t}),i=!1,a=o=>{i||(i=!0,r.destroy(),n(o))};r.once("connect",()=>a(!0)),r.once("error",o=>{a(o.code!=="ECONNREFUSED"&&o.code!=="EHOSTUNREACH")}),r.setTimeout(e,()=>a(!0))})}var eme=async t=>{await new Promise(e=>setTimeout(e,t))};async function tO(t){let e=t.now??Date.now,n=t.sleep??eme,r=t.deadlineAt??e()+Zu,i=t.pollIntervalMs??100,a;for(;e()<r;){try{let o=await t.discover();if(o)return o}catch(o){if(!(o instanceof Ee)||o.code!=="bridge_unavailable")throw o;a=o}await n(Math.min(i,Math.max(1,r-e())))}throw new Ee("bridge_readiness_timeout",a?"Bridge did not become ready after a transport failure":"Bridge did not become ready before the startup deadline")}import{randomUUID as pme}from"node:crypto";import{chmod as mme,mkdir as fme,open as BB,unlink as rO}from"node:fs/promises";import{randomUUID as ix}from"node:crypto";import{link as NB,mkdir as OB,open as $B,readdir as tme,rename as ax,rmdir as Yf,stat as jB,unlink as ra}from"node:fs/promises";import{dirname as nme,join as Xf}from"node:path";var MB=1,rme=[10,25,50],ime=new Set(["EACCES","EBUSY","EEXIST","EINVAL","EISDIR","ENOTDIR","ENOTEMPTY","EPERM"]),ame=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function DB(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function ome(t){if(!t||typeof t!="object")return!1;let e=t;return e.schemaVersion===MB&&typeof e.mutationId=="string"&&ame.test(e.mutationId)&&Number.isInteger(e.pid)&&(e.pid??0)>0&&typeof e.ownerId=="string"&&e.ownerId.length>0&&e.resource==="bridge-startup-lock"&&typeof e.operation=="string"&&e.operation.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)}function LB(t,e){return`${t}.owner-${e}`}function UB(t){return`owner-${t}`}async function Qf(t){let e;try{e=await $B(t,"r")}catch(n){if(n.code==="ENOENT")return;throw n}try{let n=await e.stat({bigint:!0}),r=await e.readFile({encoding:"utf8"}),i;try{i=JSON.parse(r)}catch{i=void 0}return{...ome(i)?{record:i}:{},device:n.dev,inode:n.ino,mtimeMs:Number(n.mtimeMs)}}finally{await e.close()}}async function nO(t){let e;try{e=await jB(t,{bigint:!0})}catch(a){if(a.code==="ENOENT")return{kind:"absent"};throw a}if(!e.isDirectory()){let a=await Qf(t);return a?{kind:"malformed",pathIsDirectory:!1,directoryDevice:a.device,directoryInode:a.inode,mtimeMs:a.mtimeMs,marker:a}:{kind:"absent"}}let n;try{n=await tme(t,{withFileTypes:!0})}catch(a){if(a.code==="ENOENT")return{kind:"absent"};throw a}if(n.length!==1||!n[0]?.isFile())return{kind:"malformed",pathIsDirectory:!0,directoryDevice:e.dev,directoryInode:e.ino,mtimeMs:Number(e.mtimeMs)};let r=n[0].name,i=await Qf(Xf(t,r));return i?!i.record||r!==UB(i.record.mutationId)?{kind:"malformed",pathIsDirectory:!0,directoryDevice:e.dev,directoryInode:e.ino,mtimeMs:Number(e.mtimeMs),markerName:r,marker:i}:{kind:"record",directoryDevice:e.dev,directoryInode:e.ino,markerName:r,marker:{...i,record:i.record}}:nO(t)}function sme(t){try{return process.kill(t,0),!0}catch(e){return e.code!=="ESRCH"}}async function zB(t,e){if(e.kind==="malformed"&&!e.pathIsDirectory)return!1;try{let n=await jB(t,{bigint:!0});return n.isDirectory()&&n.dev===e.directoryDevice&&n.ino===e.directoryInode}catch(n){if(n.code==="ENOENT")return!1;throw n}}async function Sc(t,e){let n=await Qf(t);return n!==void 0&&n.device===e.device&&n.inode===e.inode&&n.record?.mutationId===e.record?.mutationId}async function FB(t,e){try{await NB(t,e)}catch(n){if(n.code!=="EEXIST")throw n}finally{await ra(t).catch(()=>{})}}async function cme(t,e){if(sme(e.marker.record.pid)||!await zB(t,e))return!1;let n=Xf(t,e.markerName);if(!await Sc(n,e.marker))return!1;let r=`${t}.recovery-${ix()}`;try{await ax(n,r)}catch(a){if(!await Sc(n,e.marker))return!1;let o=a.code;if(o==="EACCES"||o==="EBUSY"||o==="EPERM")return!1;throw a}try{await Yf(t)}catch(a){await FB(r,n).catch(()=>{});let o=a.code;if(o==="ENOENT"||o==="ENOTEMPTY")return!1;throw a}let i=LB(t,e.marker.record.mutationId);return await Sc(i,e.marker)&&await ra(i).catch(()=>{}),await ra(r).catch(()=>{}),!0}async function lme(t,e,n,r){if(n-e.mtimeMs<r)return!1;if(!e.pathIsDirectory){if(!e.marker||!await Sc(t,e.marker))return!1;let o=`${t}.recovery-${ix()}`;try{await ax(t,o)}catch(s){if(!await Sc(t,e.marker))return!1;let c=s.code;if(c==="EACCES"||c==="EBUSY"||c==="EPERM")return!1;throw s}return await ra(o).catch(()=>{}),!0}if(!await zB(t,e))return!1;if(!e.markerName||!e.marker)try{return await Yf(t),!0}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTEMPTY")return!1;throw o}let i=Xf(t,e.markerName);if(!await Sc(i,e.marker))return!1;let a=`${t}.recovery-${ix()}`;try{await ax(i,a)}catch(o){if(!await Sc(i,e.marker))return!1;let s=o.code;if(s==="EACCES"||s==="EBUSY"||s==="EPERM")return!1;throw o}try{return await Yf(t),await ra(a).catch(()=>{}),!0}catch(o){await FB(a,i).catch(()=>{});let s=o.code;if(s==="ENOENT"||s==="ENOTEMPTY")return!1;throw o}}async function ume(t,e){let n;try{n=await $B(t,"wx",384),await n.writeFile(`${JSON.stringify(e)}
1127
+ `},mode:{type:"string",description:'Playtest mode. "play" = Play mode (F5, default), "run" = Run mode (F8). Used by: play_start, run_test.',enum:["play","run"]},script:{type:"string",description:'Luau test body for the explicit legacy opt-in executionKind="raw_luau" path. It is injected into ServerScriptService.__MCP_TestRunner. Used by: run_test only.'},test_name:{type:"string",description:"Optional report display name for the automated playtest run. Used by: run_test."},timeout:{type:"number",description:"Timeout in seconds for the automated playtest run. Default: 60. Maximum: 300. Used by: run_test."},testProfile:{type:"object",properties:{enabled:{type:"boolean"},locale:{type:"string",minLength:2,maxLength:35},region:{type:"string",minLength:2,maxLength:2},pseudolocalize:{type:"boolean"},elongation:{type:"number",minimum:0,maximum:1}},additionalProperties:!1,description:"Optional Player Emulator test profile patch. Used by: test_profile_set, play_start, test_session_start, run_test."},restoreAfterTest:{type:"boolean",description:"Restore the profile snapshot after the play session or automated test finishes. Defaults to true when testProfile is provided. Used by: play_start, test_session_start, run_test."},scenario:{type:"object",required:["protocolVersion","name","steps"],properties:{protocolVersion:{type:"integer",enum:[1]},name:{type:"string",minLength:1,maxLength:4096},mode:{type:"string",enum:["play","run"]},clients:{type:"integer",minimum:1,maximum:1},timeoutSeconds:{type:"number",minimum:.1,maximum:300},requiredEvidence:{type:"object",properties:{server:{type:"boolean"},clientUi:{type:"boolean"},interaction:{type:"boolean"},visual:{type:"boolean"}},additionalProperties:!1},steps:{type:"array",maxItems:100,items:{type:"object",required:["id","target","action","args"],properties:{id:{type:"string",minLength:1,maxLength:4096},target:{type:"object",required:["role"],properties:{role:{type:"string",enum:["server","client"]},clientId:{type:"string",enum:["client-1"]}},additionalProperties:!1},action:{type:"string",enum:["wait_for_instance","query_instance","assert_property","assert_attribute","assert_count","wait_for_player","observation_start","observation_assert","observation_stop","call_test_adapter","wait_for_gui","snapshot_gui","input_click"]},args:{type:"object",additionalProperties:!0},timeoutSeconds:{type:"number",minimum:.1,maximum:300},required:{type:"boolean"}},additionalProperties:!1}}},additionalProperties:!1,description:"Structured protocol v1 scenario. Mode defaults to play and clients defaults to one. Used by: test_session_start."},idempotencyKey:{type:"string",description:"Optional idempotency key scoped to the pinned Studio target and normalized scenario. Used by: test_session_start.",minLength:1,maxLength:4096},sessionId:{type:"string",description:"Structured test session identifier returned by test_session_start. Used by: test_session_status, test_session_stop.",minLength:1,maxLength:4096},controlProfileId:{type:"string",description:"Place-scoped Playtest Control Profile ID. Used by: play_start, test_session_start, playtest_prepare, playtest_profile_save, playtest_control_get.",minLength:1,maxLength:128},controlProfile:{type:"object",required:["schemaVersion","id","name","controls","watches"],properties:{schemaVersion:{type:"integer",enum:[1,2,3,4]},id:{type:"string",minLength:1,maxLength:128},name:{type:"string",minLength:1,maxLength:512},controls:{type:"array",maxItems:128,items:{type:"object",additionalProperties:!0}},watches:{type:"array",maxItems:128,items:{type:"object",additionalProperties:!0}},actions:{type:"array",maxItems:128,items:{type:"object",additionalProperties:!0}},presentation:{type:"object",additionalProperties:{type:"object",additionalProperties:!0}}},additionalProperties:!1,description:"Validated local Playtest value profile draft. New v3 controls use applyOnStart=false without a placeholder value until the user explicitly saves one. Used by: playtest_profile_save."},profileOperation:{type:"string",description:"Local profile operation. create/update use controlProfile, delete uses controlProfileId, and copy uses source/destination fields. Used by: playtest_profile_save.",enum:["create","update","delete","copy"]},sourceProfileId:{type:"string",description:"Source profile ID for an explicit copy. Used by: playtest_profile_save.",minLength:1,maxLength:128},sourceRevision:{type:"integer",description:"Expected source profile revision for an explicit copy. Used by: playtest_profile_save.",minimum:1},sourcePlaceId:{type:"number",description:"Published source Place ID for an explicit profile copy. Used by: playtest_profile_save."},sourcePlaceName:{type:"string",description:"Unpublished source Place name in the current project for an explicit profile copy. Used by: playtest_profile_save.",minLength:1,maxLength:512},destinationProfileId:{type:"string",description:"New destination profile ID for an explicit copy. Used by: playtest_profile_save.",minLength:1,maxLength:128},destinationProfileName:{type:"string",description:"New destination profile name for an explicit copy. Used by: playtest_profile_save.",minLength:1,maxLength:512},candidateSource:{type:"string",description:"Read candidates from the current Edit selection or a bounded Play runtime path. Used by: playtest_binding_candidates.",enum:["selection","runtime"]},candidateTarget:{type:"object",required:["role"],properties:{role:{type:"string",enum:["server","client"]},clientId:{type:"string",enum:["client-1"]}},additionalProperties:!1,description:"Server or client runtime role for a Play-only candidate query. Used by: playtest_binding_candidates."},candidatePath:{type:"object",required:["root","segments"],properties:{root:{type:"string",enum:["PlayerGui","Character","Workspace","ReplicatedStorage","ServerStorage","ServerScriptService","Players"]},segments:{type:"array",maxItems:64,items:{type:"string",minLength:1,maxLength:4096}}},additionalProperties:!1,description:"Bounded Play runtime path to inspect. Used by: playtest_binding_candidates."},maxResults:{type:"integer",description:"Maximum candidate fields to return. Used by: playtest_binding_candidates.",minimum:1,maximum:100},adapterOperation:{type:"string",description:"Reviewed managed adapter operation. Used by: playtest_adapter_plan.",enum:["create","update","remove_entry","remove_adapter"]},adapterId:{type:"string",description:"Stable managed Test Adapter ID and ModuleScript name. Used by: playtest_adapter_plan."},adapterRegistrationId:{type:"string",description:"Stable Dashboard entry ID. Used by create, update, and remove_entry adapter plans."},adapterRegistrationLabel:{type:"string",description:"User-facing adapter value label. Used by create and update adapter plans.",minLength:1,maxLength:512},adapterRegistrationGroup:{type:"string",description:"Dashboard group for the adapter value. Used by create and update adapter plans.",minLength:1,maxLength:512},adapterRegistrationKind:{type:"string",description:"Observation or reversible control intent. Used by create and update adapter plans.",enum:["watch","control"]},adapterValueType:{type:"string",description:"JSON-compatible adapter value type. Used by create and update adapter plans.",enum:["string","number","boolean","enum"]},adapterModulePath:{type:"object",required:["root","segments"],properties:{root:{type:"string",enum:["PlayerGui","Character","Workspace","ReplicatedStorage","ServerStorage","ServerScriptService","Players"]},segments:{type:"array",maxItems:64,items:{type:"string",minLength:1,maxLength:4096}}},additionalProperties:!1,description:"Existing server-visible ModuleScript that owns the internal value. Used by create and update adapter plans."},adapterReadMethod:{type:"string",description:"Existing module getter name. Used by create and update adapter plans."},adapterWriteMethod:{type:"string",description:"Existing module setter name for a reversible control. Used by create and update adapter plans."},adapterMethodStyle:{type:"string",description:"Explicit dot or colon calling convention for the existing module API. Used by create and update adapter plans.",enum:["dot","colon"]},adapterStudioOnly:{type:"boolean",description:"Keep the managed Test Adapter unavailable outside Roblox Studio. Defaults to true and may be false only when the user explicitly asks to omit the RunService:IsStudio() check. Used by create and update adapter plans."},adapterConstraints:{type:"object",description:"Optional numeric editor constraints. Used by create and update adapter plans.",properties:{minimum:{type:"number"},maximum:{type:"number"},step:{type:"number"}},additionalProperties:!1},adapterEnumValues:{type:"array",description:"Allowed enum values. Used by create and update adapter plans.",minItems:1,maxItems:100,items:{}},productionExclusionStrategy:{type:"string",description:"Optional artifact-hygiene strategy for excluding the adapter source even when studioOnly protection is enabled. Used by: playtest_adapter_plan.",enum:["rojo","private_test_place"]},productionExclusionReference:{type:"string",description:"Optional production project file or configured test Place reference for the exclusion strategy. Used by: playtest_adapter_plan.",minLength:1,maxLength:4096},planToken:{type:"string",description:"Unexpired reviewed adapter plan token. Used by: playtest_adapter_apply.",minLength:1,maxLength:4096},expectedSourceHash:{type:"string",description:"Reviewed current source SHA-256 or absent sentinel. Used by: playtest_adapter_apply.",minLength:6,maxLength:64},leaseId:{type:"string",description:"Active runtime control lease ID. Used by: playtest_control_get, playtest_control_apply, playtest_control_reset.",minLength:1,maxLength:4096},expectedRevision:{type:"integer",description:"Optimistic revision. For playtest_profile_save update/delete, pass the current stored profile revision. For playtest_control_apply, pass the active runtime lease revision.",minimum:0},controlValues:{type:"object",description:"Binding ID to JSON-compatible requested value. Used by: playtest_control_apply.",additionalProperties:!0},actionId:{type:"string",description:"Stable Action ID from the active Playtest profile. Used by: playtest_action_execute.",minLength:1,maxLength:128},actionArguments:{type:"object",description:"Complete JSON-compatible arguments for this execution, including values from fixed Profile inputs. The Test Agent validates the actual method schema without injecting Profile defaults or comparing fixed values. Used by: playtest_action_execute.",additionalProperties:!0},expectedProfileRevision:{type:"integer",description:"Expected stored profile revision. Used by: playtest_action_execute.",minimum:1},requestId:{type:"string",description:"Semantic idempotency identity for one Action click. Reusing it with the same input returns the same result; different input is rejected. Used by: playtest_action_execute.",minLength:1,maxLength:4096},stepCursor:{type:"string",description:"Optional opaque cursor returned by a previous status page. Used by: test_session_status.",minLength:1,maxLength:4096},stepLimit:{type:"integer",description:"Maximum step evidence entries in one status page. Defaults to 20 and cannot exceed 50. Used by: test_session_status.",minimum:1,maximum:50},locale:{type:"string",description:"Normalized locale identifier requested for the active Experience Language. Used by: experience_language_set.",minLength:2,maxLength:35},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this call to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},allOf:[{if:{properties:{action:{const:"test_profile_set"}}},then:{required:["testProfile"]}},{if:{properties:{action:{const:"experience_language_set"}}},then:{required:["locale"]}},{if:{properties:{action:{const:"test_session_start"}}},then:{required:["scenario"]}},{if:{properties:{action:{const:"playtest_binding_candidates"}}},then:{required:["candidateSource"]}},{if:{properties:{action:{const:"playtest_profile_save"}}},then:{required:["profileOperation"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"create"}},required:["action","profileOperation"]},then:{required:["controlProfile"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"update"}},required:["action","profileOperation"]},then:{required:["controlProfile","expectedRevision"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"delete"}},required:["action","profileOperation"]},then:{required:["controlProfileId","expectedRevision"]}},{if:{properties:{action:{const:"playtest_profile_save"},profileOperation:{const:"copy"}},required:["action","profileOperation"]},then:{required:["sourceProfileId","sourceRevision","destinationProfileId","destinationProfileName"]}},{if:{properties:{action:{const:"playtest_adapter_plan"}}},then:{required:["adapterOperation","adapterId"]}},{if:{properties:{action:{const:"playtest_adapter_apply"}}},then:{required:["planToken","expectedSourceHash"]}},{if:{properties:{action:{const:"playtest_source_open"}}},then:{required:["adapterId","adapterRegistrationId"]}},{if:{properties:{action:{const:"playtest_control_apply"}}},then:{required:["leaseId","expectedRevision","controlValues"]}},{if:{properties:{action:{const:"playtest_control_reset"}}},then:{required:["leaseId"]}},{if:{properties:{action:{const:"playtest_action_execute"}}},then:{required:["leaseId","controlProfileId","actionId","actionArguments","expectedProfileRevision","expectedRevision","requestId"]}},{if:{properties:{action:{const:"test_session_status"}}},then:{required:["sessionId"]}},{if:{properties:{action:{const:"test_session_stop"}}},then:{required:["sessionId"]}},{if:{properties:{action:{const:"run_test"}}},then:{required:["script"]}}],required:["action"]}};var GT={name:"batch_execute",description:'[PRO] Execute multiple commands in a single batch. Each command is an object with "tool" name and "args". Commands execute sequentially; optionally continue on error.',inputSchema:{type:"object",properties:{commands:{type:"array",description:"Array of commands to execute sequentially. Each command specifies a tool name and its arguments.",items:{type:"object",required:["tool","args"],properties:{tool:{type:"string",description:'Tool name to invoke (e.g., "mutate_instances", "manage_properties").'},args:{type:"object",description:"Arguments to pass to the tool, including action and other parameters.",additionalProperties:!0}}}},stopOnError:{type:"boolean",description:"If true, stop executing remaining commands when one fails. Default: true."},placeId:{type:"number",description:"Optional Studio target selector for the entire batch. Per-item selectors inside commands[].args are rejected."},clientId:{type:"string",description:"Optional Studio target selector for the entire batch. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["commands"]}};var JT={name:"execute_luau",description:"[PRO] Execute arbitrary Luau code in Roblox Studio sandbox. Blocked services: HttpService, DataStoreService, MessagingService. Cannot access CoreGui/CorePackages.",inputSchema:{type:"object",properties:{contextId:{type:"string",description:"Optional execution context identifier. Used to continue an existing context for mutating actions."},contextSummary:{type:"object",properties:{intent:{type:"string"},affectedAreas:{type:"array",items:{type:"object",required:["kind","target","label"],properties:{kind:{type:"string",enum:["script","instance","property","system","gameplay","ui","terrain","lighting","asset","other"]},target:{type:"string"},label:{type:"string"}}}},testScenario:{type:"string"},expectedBehavior:{type:"string"},observedBehavior:{type:"string"}},description:"Optional structured execution context attached to this tool call."},replayMetadata:{type:"object",properties:{mode:{type:"string"},timeout:{type:"number"},seed:{type:"number"},inputRefs:{type:"array",items:{type:"string"}},setupRefs:{type:"array",items:{type:"string"}},assertionRefs:{type:"array",items:{type:"string"}},artifactRefs:{type:"array",items:{type:"string"}}},description:"Optional replay-ready metadata attached to this tool call."},source:{type:"string",description:"Luau source code to execute. The code runs in a sandboxed environment with access to game services (except blocked ones). Return values are serialized and sent back as the tool result."},placeId:{type:"number",description:"Optional Studio target selector. When multiple Studio clients are connected, route this Luau execution to the active client for this Roblox placeId. If no matching active client exists, the call fails instead of falling back to another Place."},clientId:{type:"string",description:"Optional Studio target selector. Routes this call to the exact connected WEPPY Plugin client. Takes precedence over targetAlias and placeId."},targetAlias:{type:"string",description:"Optional Studio target selector. Routes this call to the connected WEPPY Studio target alias shown in Dashboard/Plugin, such as studio-1. Takes precedence over placeId."}},required:["source"]}};var SB=[PT,CT,kT,RT,ET,AT,TT,OT,DT,NT,$T,jT,MT,LT,UT,zT,FT,qT,BT,VT,WT,HT,ZT,GT,JT];var Dpe=["oneOf","allOf","anyOf"];function _c(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Npe(t,e){if(!Array.isArray(t.allOf))return;let n=new Map;for(let a of t.allOf){let o=_c(a),s=_c(_c(o?.if)?.properties),c=_c(o?.then)?.required;if(!s||!Array.isArray(c))continue;let l=c.filter(u=>typeof u=="string");if(l.length!==0)for(let[u,d]of Object.entries(s)){if(u==="action")continue;let p=_c(d)?.const;if(typeof p!="string"&&typeof p!="number"&&typeof p!="boolean")continue;let m=`${JSON.stringify(p)} requires ${l.map(f=>`\`${f}\``).join(", ")}`;n.set(u,[...n.get(u)??[],m])}}if(n.size===0)return;let r=_c(e.properties);if(!r)return;let i={...r};for(let[a,o]of n){let s=_c(i[a]);if(!s)continue;let c=typeof s.description=="string"?s.description.trim():"",l=`Conditional requirements: ${o.join("; ")}.`;i[a]={...s,description:c?`${c} ${l}`:l}}e.properties=i}function xB(){return SB.map(t=>{let e=t.inputSchema;if(!e||typeof e!="object"||Array.isArray(e))return t;let n={...e};Npe(e,n);for(let r of Dpe)delete n[r];return{...t,inputSchema:n}})}var WS=class{server;connected=!1;constructor(e,n){this.server=new VS({name:"weppy-roblox-mcp",version:He},{capabilities:{tools:{},resources:{}},instructions:"Roblox MCP. UI \uC791\uC5C5\uC740 manage_ui \uB3C4\uAD6C\uB97C \uD65C\uC6A9. design_brief\uC640 \uC2DC\uAC01 \uAC80\uC218\uB294 \uC120\uD0DD\uC801 \uAD8C\uC7A5\uC774\uBA70 \uC0DD\uC131\xB7\uC218\uC815\xB7\uACB0\uACFC \uC804\uB2EC\uC758 \uC870\uAC74\uC774 \uC544\uB2D8. \uBBF8\uD655\uC778 \uD488\uC9C8\uC740 \uAC80\uC99D\uB410\uB2E4\uACE0 \uD45C\uC2DC\uD558\uC9C0 \uC54A\uC74C. \uB514\uC790\uC778 \uC9C0\uCE68\uC740 resource 'weppy://ui-studio/guide' \uCC38\uC870."}),this.server.setRequestHandler(hE,async()=>({tools:xB()})),this.server.setRequestHandler(lE,async()=>({resources:await bB()})),this.server.setRequestHandler(dE,async r=>await _B(r.params.uri)),this.server.setRequestHandler(nf,async r=>await e(r.params.name,r.params.arguments??{})),this.server.oninitialized=()=>{let r=this.server.getClientVersion();r?.name&&n?.({name:r.name,...r.version?{version:r.version}:{}})}}async connect(e){await this.server.connect(e),this.connected=!0}async close(){this.connected&&(await this.server.close(),this.connected=!1)}};import{randomUUID as qpe}from"node:crypto";ZS();import{join as Hu}from"node:path";var is={query_instances:{discriminator:"action",validActions:new Set(["get","children","find_child","find_descendant","wait_for_child","class_info","search_name","search_class","search_property","search_tag","file_tree","project_structure","descendants","ancestors"]),allowedParams:{query_instances_get:new Set(["path","sessionDebugId","siblingIndex","placeId","clientId","targetAlias"]),query_instances_children:new Set(["path","sessionDebugId","siblingIndex","recursive","maxDepth","placeId","clientId","targetAlias"]),query_instances_find_child:new Set(["path","childName","placeId","clientId","targetAlias"]),query_instances_find_descendant:new Set(["path","descendantName","placeId","clientId","targetAlias"]),query_instances_wait_for_child:new Set(["path","childName","timeout","placeId","clientId","targetAlias"]),query_instances_class_info:new Set(["className","placeId","clientId","targetAlias"]),query_instances_search_name:new Set(["root","query","caseSensitive","maxResults","placeId","clientId","targetAlias"]),query_instances_search_class:new Set(["className","root","includeSubclasses","maxResults","placeId","clientId","targetAlias"]),query_instances_search_property:new Set(["root","propertyName","propertyValue","maxResults","placeId","clientId","targetAlias"]),query_instances_search_tag:new Set(["root","tag","maxResults","placeId","clientId","targetAlias"]),query_instances_file_tree:new Set(["maxDepth","root","includeServices","placeId","clientId","targetAlias"]),query_instances_project_structure:new Set(["root","depth","placeId","clientId","targetAlias"]),query_instances_descendants:new Set(["path","sessionDebugId","siblingIndex","maxResults","placeId","clientId","targetAlias"]),query_instances_ancestors:new Set(["path","sessionDebugId","siblingIndex","placeId","clientId","targetAlias"])},requiredParams:{query_instances_get:new Set(["path"]),query_instances_children:new Set(["path"]),query_instances_find_child:new Set(["path","childName"]),query_instances_find_descendant:new Set(["path","descendantName"]),query_instances_wait_for_child:new Set(["path","childName"]),query_instances_class_info:new Set(["className"]),query_instances_search_name:new Set(["query"]),query_instances_search_class:new Set(["className"]),query_instances_search_property:new Set(["propertyName"]),query_instances_search_tag:new Set(["tag"]),query_instances_file_tree:new Set([]),query_instances_project_structure:new Set([]),query_instances_descendants:new Set(["path"]),query_instances_ancestors:new Set(["path"])},paramAliases:{query_instances_search_name:{query:"pattern"},query_instances_search_property:{root:"rootPath"},query_instances_search_tag:{root:"rootPath"},query_instances_project_structure:{root:"rootPath"}}},mutate_instances:{discriminator:"action",validActions:new Set(["create","create_with_props","delete","clone","move","rename","pivot","create_tree","mass_create","mass_delete","mass_duplicate","smart_duplicate","scatter"]),allowedParams:{mutate_instances_create:new Set(["className","parent","name","properties","placeId","clientId","targetAlias"]),mutate_instances_create_with_props:new Set(["className","parent","name","properties","placeId","clientId","targetAlias"]),mutate_instances_delete:new Set(["path","sessionDebugId","siblingIndex","placeId","clientId","targetAlias"]),mutate_instances_clone:new Set(["path","sourcePath","sessionDebugId","siblingIndex","targetParent","newName","placeId","clientId","targetAlias"]),mutate_instances_move:new Set(["path","sessionDebugId","siblingIndex","newParent","placeId","clientId","targetAlias"]),mutate_instances_rename:new Set(["path","sessionDebugId","siblingIndex","newName","placeId","clientId","targetAlias"]),mutate_instances_pivot:new Set(["path","sessionDebugId","siblingIndex","position","cframe","offset","placeId","clientId","targetAlias"]),mutate_instances_create_tree:new Set(["parent","tree","placeId","clientId","targetAlias"]),mutate_instances_mass_create:new Set(["instances","placeId","clientId","targetAlias"]),mutate_instances_mass_delete:new Set(["paths","placeId","clientId","targetAlias"]),mutate_instances_mass_duplicate:new Set(["targetParent","paths","placeId","clientId","targetAlias"]),mutate_instances_smart_duplicate:new Set(["path","sessionDebugId","siblingIndex","targetParent","offset","count","placeId","clientId","targetAlias"]),mutate_instances_scatter:new Set(["templatePaths","region","count","seed","maxSlope","avoidWater","alignToNormal","scaleJitter","minSpacing","parentName","placeId","clientId","targetAlias"])},requiredParams:{mutate_instances_create:new Set(["className","parent"]),mutate_instances_create_with_props:new Set(["className","parent","name","properties"]),mutate_instances_delete:new Set(["path"]),mutate_instances_clone:new Set(["sourcePath"]),mutate_instances_move:new Set(["path","newParent"]),mutate_instances_rename:new Set(["path","newName"]),mutate_instances_pivot:new Set(["path"]),mutate_instances_create_tree:new Set(["parent","tree"]),mutate_instances_mass_create:new Set(["instances"]),mutate_instances_mass_delete:new Set(["paths"]),mutate_instances_mass_duplicate:new Set(["paths"]),mutate_instances_smart_duplicate:new Set(["path","offset"]),mutate_instances_scatter:new Set(["templatePaths","region","count"])},paramAliases:{mutate_instances_clone:{path:"sourcePath"},mutate_instances_smart_duplicate:{spacing:"offset"}}},manage_properties:{discriminator:"action",validActions:new Set(["get","set","get_all","set_multiple","get_attr","set_attr","get_all_attrs","delete_attr","add_tag","remove_tag","check_tag","get_tags","get_tagged","set_calculated","set_relative","mass_set","mass_get","modify_children"]),allowedParams:{manage_properties_get:new Set(["path","property","placeId","clientId","targetAlias"]),manage_properties_set:new Set(["path","property","value","placeId","clientId","targetAlias"]),manage_properties_get_all:new Set(["path","includeReadOnly","placeId","clientId","targetAlias"]),manage_properties_set_multiple:new Set(["path","properties","placeId","clientId","targetAlias"]),manage_properties_get_attr:new Set(["path","attribute","placeId","clientId","targetAlias"]),manage_properties_set_attr:new Set(["path","value","attribute","placeId","clientId","targetAlias"]),manage_properties_get_all_attrs:new Set(["path","placeId","clientId","targetAlias"]),manage_properties_delete_attr:new Set(["path","attribute","placeId","clientId","targetAlias"]),manage_properties_add_tag:new Set(["path","tag","placeId","clientId","targetAlias"]),manage_properties_remove_tag:new Set(["path","tag","placeId","clientId","targetAlias"]),manage_properties_check_tag:new Set(["path","tag","placeId","clientId","targetAlias"]),manage_properties_get_tags:new Set(["path","placeId","clientId","targetAlias"]),manage_properties_get_tagged:new Set(["tagName","root","maxResults","placeId","clientId","targetAlias"]),manage_properties_set_calculated:new Set(["path","expression","variables","propertyName","placeId","clientId","targetAlias"]),manage_properties_set_relative:new Set(["path","value","operation","amount","propertyName","placeId","clientId","targetAlias"]),manage_properties_mass_set:new Set(["paths","propertyName","propertyValue","placeId","clientId","targetAlias"]),manage_properties_mass_get:new Set(["paths","propertyName","placeId","clientId","targetAlias"]),manage_properties_modify_children:new Set(["parentPath","modifications","propertyName","propertyValue","filter","recursive","placeId","clientId","targetAlias"])},requiredParams:{manage_properties_get:new Set(["path","property"]),manage_properties_set:new Set(["path","property","value"]),manage_properties_get_all:new Set(["path"]),manage_properties_set_multiple:new Set(["path","properties"]),manage_properties_get_attr:new Set(["path","attribute"]),manage_properties_set_attr:new Set(["path","value","attribute"]),manage_properties_get_all_attrs:new Set(["path"]),manage_properties_delete_attr:new Set(["path","attribute"]),manage_properties_add_tag:new Set(["path","tag"]),manage_properties_remove_tag:new Set(["path","tag"]),manage_properties_check_tag:new Set(["path","tag"]),manage_properties_get_tags:new Set(["path"]),manage_properties_get_tagged:new Set(["tagName"]),manage_properties_set_calculated:new Set(["path","expression","propertyName"]),manage_properties_set_relative:new Set(["path","operation","propertyName"]),manage_properties_mass_set:new Set(["paths","propertyName","propertyValue"]),manage_properties_mass_get:new Set(["paths","propertyName"]),manage_properties_modify_children:new Set(["parentPath"])},paramAliases:{manage_properties_get_tagged:{tagName:"tag",root:"rootPath"},manage_properties_set_relative:{amount:"value"}}},manage_scripts:{discriminator:"action",validActions:new Set(["get_source","set_source","create","delete","edit_replace","edit_insert","edit_delete","search","replace","get_dependencies","validate"]),allowedParams:{manage_scripts_get_source:new Set(["path","startLine","endLine","placeId","clientId","targetAlias"]),manage_scripts_set_source:new Set(["path","source","validate","placeId","clientId","targetAlias"]),manage_scripts_create:new Set(["source","scriptType","parent","name","placeId","clientId","targetAlias"]),manage_scripts_delete:new Set(["path","placeId","clientId","targetAlias"]),manage_scripts_edit_replace:new Set(["path","startLine","endLine","newLines","validate","placeId","clientId","targetAlias"]),manage_scripts_edit_insert:new Set(["path","lines","afterLine","content","validate","placeId","clientId","targetAlias"]),manage_scripts_edit_delete:new Set(["path","startLine","endLine","validate","placeId","clientId","targetAlias"]),manage_scripts_search:new Set(["path","pattern","caseSensitive","wholeWord","usePattern","maxResults","placeId","clientId","targetAlias"]),manage_scripts_replace:new Set(["path","pattern","replacement","usePattern","dryRun","placeId","clientId","targetAlias"]),manage_scripts_get_dependencies:new Set(["path","placeId","clientId","targetAlias"]),manage_scripts_validate:new Set(["source","path","placeId","clientId","targetAlias"])},requiredParams:{manage_scripts_get_source:new Set(["path"]),manage_scripts_set_source:new Set(["path","source"]),manage_scripts_create:new Set(["scriptType","parent"]),manage_scripts_delete:new Set(["path"]),manage_scripts_edit_replace:new Set(["path","startLine","endLine","newLines"]),manage_scripts_edit_insert:new Set(["path","afterLine","content"]),manage_scripts_edit_delete:new Set(["path","startLine","endLine"]),manage_scripts_search:new Set(["path","pattern"]),manage_scripts_replace:new Set(["path","pattern","replacement"]),manage_scripts_get_dependencies:new Set(["path"]),manage_scripts_validate:new Set([])},paramAliases:{manage_scripts_edit_replace:{newLines:"newContent"},manage_scripts_edit_insert:{lines:"content"},manage_scripts_replace:{pattern:"searchPattern"}}},manage_ui:{discriminator:"action",validActions:new Set(["design_brief","create_tree","update","delete","preview","check"]),allowedParams:{manage_ui_design_brief:new Set(["brief","projectContext","agentCapabilities","runtimeEvidenceRef","placeId","clientId","targetAlias"]),manage_ui_create_tree:new Set(["briefId","tree","placeId","clientId","targetAlias"]),manage_ui_update:new Set(["targetPath","changes","briefId","placeId","clientId","targetAlias"]),manage_ui_delete:new Set(["targetPath","placeId","clientId","targetAlias"]),manage_ui_preview:new Set(["targetPath","briefId","viewportMode","profileIds","placeId","clientId","targetAlias"]),manage_ui_check:new Set(["targetPath","briefId","visualReview","viewportMode","profileIds","observationMode","runtimeEvidenceRef","placeId","clientId","targetAlias"])},requiredParams:{manage_ui_design_brief:new Set([]),manage_ui_create_tree:new Set(["tree"]),manage_ui_update:new Set(["targetPath","changes"]),manage_ui_delete:new Set(["targetPath"]),manage_ui_preview:new Set([]),manage_ui_check:new Set([])}},manage_lighting:{discriminator:"action",validActions:new Set(["lighting","atmosphere","sky","terrain_props","time","mood"]),allowedParams:{manage_lighting_lighting:new Set(["properties","placeId","clientId","targetAlias"]),manage_lighting_atmosphere:new Set(["properties","createIfMissing","placeId","clientId","targetAlias"]),manage_lighting_sky:new Set(["properties","createIfMissing","placeId","clientId","targetAlias"]),manage_lighting_terrain_props:new Set(["properties","placeId","clientId","targetAlias"]),manage_lighting_time:new Set(["time","clockTime","placeId","clientId","targetAlias"]),manage_lighting_mood:new Set(["preset","overrides","placeId","clientId","targetAlias"])},requiredParams:{manage_lighting_lighting:new Set([]),manage_lighting_atmosphere:new Set([]),manage_lighting_sky:new Set([]),manage_lighting_terrain_props:new Set([]),manage_lighting_time:new Set([]),manage_lighting_mood:new Set(["preset"])}},manage_selection:{discriminator:"action",validActions:new Set(["get","set","clear","cached","context","details","add","remove","watch"]),allowedParams:{manage_selection_get:new Set(["placeId","clientId","targetAlias"]),manage_selection_set:new Set(["paths","placeId","clientId","targetAlias"]),manage_selection_clear:new Set(["placeId","clientId","targetAlias"]),manage_selection_cached:new Set(["maxAge"]),manage_selection_context:new Set(["includeSource","includeProperties","includeChildren","placeId","clientId","targetAlias"]),manage_selection_details:new Set(["maxDepth","includeAncestors","placeId","clientId","targetAlias"]),manage_selection_add:new Set(["paths","placeId","clientId","targetAlias"]),manage_selection_remove:new Set(["paths","placeId","clientId","targetAlias"]),manage_selection_watch:new Set(["placeId","clientId","targetAlias"])},requiredParams:{manage_selection_get:new Set([]),manage_selection_set:new Set(["paths"]),manage_selection_clear:new Set([]),manage_selection_cached:new Set([]),manage_selection_context:new Set([]),manage_selection_details:new Set([]),manage_selection_add:new Set(["paths"]),manage_selection_remove:new Set(["paths"]),manage_selection_watch:new Set([])}},manage_camera:{discriminator:"action",validActions:new Set(["info","focus_path","focus_position","suggest","screenshot"]),allowedParams:{manage_camera_info:new Set(["placeId","clientId","targetAlias"]),manage_camera_focus_path:new Set(["path","distance","duration","offset","respectAutoFocusSetting","placeId","clientId","targetAlias"]),manage_camera_focus_position:new Set(["position","distance","duration","offset","lookAt","respectAutoFocusSetting","placeId","clientId","targetAlias"]),manage_camera_suggest:new Set(["path","placeId","clientId","targetAlias"]),manage_camera_screenshot:new Set(["placeId","clientId","targetAlias"])},requiredParams:{manage_camera_info:new Set([]),manage_camera_focus_path:new Set([]),manage_camera_focus_position:new Set(["position"]),manage_camera_suggest:new Set([]),manage_camera_screenshot:new Set([])},paramAliases:{manage_camera_suggest:{path:"targetPath"}}},manage_tween:{discriminator:"action",validActions:new Set(["create","play","pause","cancel"]),allowedParams:{manage_tween_create:new Set(["path","tweenInfo","properties","placeId","clientId","targetAlias"]),manage_tween_play:new Set(["tweenId","placeId","clientId","targetAlias"]),manage_tween_pause:new Set(["tweenId","placeId","clientId","targetAlias"]),manage_tween_cancel:new Set(["tweenId","placeId","clientId","targetAlias"])},requiredParams:{manage_tween_create:new Set(["path"]),manage_tween_play:new Set([]),manage_tween_pause:new Set([]),manage_tween_cancel:new Set([])}},manage_audio:{discriminator:"action",validActions:new Set(["play","stop","pause","resume","set_listener"]),allowedParams:{manage_audio_play:new Set(["path","soundId","volume","looped","playbackSpeed","placeId","clientId","targetAlias"]),manage_audio_stop:new Set(["path","placeId","clientId","targetAlias"]),manage_audio_pause:new Set(["path","placeId","clientId","targetAlias"]),manage_audio_resume:new Set(["path","placeId","clientId","targetAlias"]),manage_audio_set_listener:new Set(["listenerType","listenerPath","placeId","clientId","targetAlias"])},requiredParams:{manage_audio_play:new Set([]),manage_audio_stop:new Set([]),manage_audio_pause:new Set([]),manage_audio_resume:new Set([]),manage_audio_set_listener:new Set([])}},manage_animation:{discriminator:"action",validActions:new Set(["load","play","stop","get_tracks"]),allowedParams:{manage_animation_load:new Set(["path","animationId","placeId","clientId","targetAlias"]),manage_animation_play:new Set(["path","trackId","speed","fadeTime","weight","priority","placeId","clientId","targetAlias"]),manage_animation_stop:new Set(["path","trackId","fadeTime","placeId","clientId","targetAlias"]),manage_animation_get_tracks:new Set(["path","placeId","clientId","targetAlias"])},requiredParams:{manage_animation_load:new Set([]),manage_animation_play:new Set(["trackId"]),manage_animation_stop:new Set(["trackId"]),manage_animation_get_tracks:new Set([])}},manage_physics:{discriminator:"action",validActions:new Set(["register_group","set_collidable","get_groups"]),allowedParams:{manage_physics_register_group:new Set(["groupName","placeId","clientId","targetAlias"]),manage_physics_set_collidable:new Set(["group1","group2","collidable","placeId","clientId","targetAlias"]),manage_physics_get_groups:new Set(["placeId","clientId","targetAlias"])},requiredParams:{manage_physics_register_group:new Set(["groupName"]),manage_physics_set_collidable:new Set(["group1","group2","collidable"]),manage_physics_get_groups:new Set([])}},manage_effects:{discriminator:"action",validActions:new Set(["emit","clear","toggle"]),allowedParams:{manage_effects_emit:new Set(["path","count","placeId","clientId","targetAlias"]),manage_effects_clear:new Set(["path","placeId","clientId","targetAlias"]),manage_effects_toggle:new Set(["path","enabled","placeId","clientId","targetAlias"])},requiredParams:{manage_effects_emit:new Set([]),manage_effects_clear:new Set([]),manage_effects_toggle:new Set([])}},manage_terrain:{discriminator:"action",validActions:new Set(["fill_block","fill_ball","fill_cylinder","fill_wedge","clear_region","clear_bounds","replace_material","colors_get","colors_set","read_voxel","read_voxels","write_voxels","generate","smooth"]),allowedParams:{manage_terrain_fill_block:new Set(["cframe","size","material","placeId","clientId","targetAlias"]),manage_terrain_fill_ball:new Set(["center","radius","material","placeId","clientId","targetAlias"]),manage_terrain_fill_cylinder:new Set(["cframe","radius","height","material","placeId","clientId","targetAlias"]),manage_terrain_fill_wedge:new Set(["cframe","size","material","placeId","clientId","targetAlias"]),manage_terrain_clear_region:new Set(["region","placeId","clientId","targetAlias"]),manage_terrain_clear_bounds:new Set(["min","max","placeId","clientId","targetAlias"]),manage_terrain_replace_material:new Set(["material","region","sourceMaterial","targetMaterial","placeId","clientId","targetAlias"]),manage_terrain_colors_get:new Set(["material","placeId","clientId","targetAlias"]),manage_terrain_colors_set:new Set(["material","color","placeId","clientId","targetAlias"]),manage_terrain_read_voxel:new Set(["position","placeId","clientId","targetAlias"]),manage_terrain_read_voxels:new Set(["region","resolution","placeId","clientId","targetAlias"]),manage_terrain_write_voxels:new Set(["region","resolution","materials","occupancy","placeId","clientId","targetAlias"]),manage_terrain_generate:new Set(["region","preset","seed","baseHeight","amplitude","frequency","octaves","persistence","waterLevel","edgeBlend","materialPalette","layers","placeId","clientId","targetAlias"]),manage_terrain_smooth:new Set(["region","intensity","placeId","clientId","targetAlias"])},requiredParams:{manage_terrain_fill_block:new Set([]),manage_terrain_fill_ball:new Set([]),manage_terrain_fill_cylinder:new Set([]),manage_terrain_fill_wedge:new Set([]),manage_terrain_clear_region:new Set([]),manage_terrain_clear_bounds:new Set([]),manage_terrain_replace_material:new Set([]),manage_terrain_colors_get:new Set([]),manage_terrain_colors_set:new Set([]),manage_terrain_read_voxel:new Set([]),manage_terrain_read_voxels:new Set([]),manage_terrain_write_voxels:new Set([]),manage_terrain_generate:new Set(["region"]),manage_terrain_smooth:new Set([])}},spatial_query:{discriminator:"action",validActions:new Set(["raycast","find_ground","check_placement","multi_raycast","scan_area","find_flat","find_spawn","analyze_walkable","spatial_map","find_space","bounds","snap_grid","collision"]),allowedParams:{spatial_query_raycast:new Set(["origin","direction","filterType","filterList","filterInstances","ignoreWater","placeId","clientId","targetAlias"]),spatial_query_find_ground:new Set(["maxDistance","position","filterList","filterInstances","offset","placeId","clientId","targetAlias"]),spatial_query_check_placement:new Set(["position","size","filterList","filterInstances","rotation","checkGround","placeId","clientId","targetAlias"]),spatial_query_multi_raycast:new Set(["filterType","filterList","filterInstances","ignoreWater","rays","placeId","clientId","targetAlias"]),spatial_query_scan_area:new Set(["size","filterList","filterInstances","center","resolution","maxResults","placeId","clientId","targetAlias"]),spatial_query_find_flat:new Set(["searchArea","minSize","maxSlope","tolerance","maxResults","placeId","clientId","targetAlias"]),spatial_query_find_spawn:new Set(["searchArea","spawnSize","minSpacing","preferOutdoor","count","placeId","clientId","targetAlias"]),spatial_query_analyze_walkable:new Set(["area","maxSlope","resolution","characterHeight","maxStepHeight","placeId","clientId","targetAlias"]),spatial_query_spatial_map:new Set(["path","rootPath","includeModels","maxResults","placeId","clientId","targetAlias"]),spatial_query_find_space:new Set(["size","searchArea","gridSize","gridSnap","padding","placeId","clientId","targetAlias"]),spatial_query_bounds:new Set(["path","paths","placeId","clientId","targetAlias"]),spatial_query_snap_grid:new Set(["gridSize","path","gridSnap","axes","placeId","clientId","targetAlias"]),spatial_query_collision:new Set(["position","path","ignorePaths","placeId","clientId","targetAlias"])},requiredParams:{spatial_query_raycast:new Set([]),spatial_query_find_ground:new Set([]),spatial_query_check_placement:new Set([]),spatial_query_multi_raycast:new Set([]),spatial_query_scan_area:new Set([]),spatial_query_find_flat:new Set([]),spatial_query_find_spawn:new Set([]),spatial_query_analyze_walkable:new Set([]),spatial_query_spatial_map:new Set([]),spatial_query_find_space:new Set([]),spatial_query_bounds:new Set([]),spatial_query_snap_grid:new Set(["path"]),spatial_query_collision:new Set(["path"])},paramAliases:{spatial_query_spatial_map:{path:"rootPath"}}},manage_assets:{discriminator:"action",validActions:new Set(["insert","info","search","search_insert","insert_free","insert_package","export_selection_json","export_selection_rbxm","export_path_rbxm","review_model","generate_model","upload_asset","import_rbxm","generate_thumbnail"]),allowedParams:{manage_assets_insert:new Set(["assetId","parent","name","position","placeId","clientId","targetAlias"]),manage_assets_info:new Set(["assetId","placeId","clientId","targetAlias"]),manage_assets_search:new Set(["query","maxResults","category","sortType","placeId","clientId","targetAlias"]),manage_assets_search_insert:new Set(["parent","name","query","placeId","clientId","targetAlias"]),manage_assets_insert_free:new Set(["assetId","parent","name","position","placeId","clientId","targetAlias"]),manage_assets_insert_package:new Set(["assetId","parent","name","placeId","clientId","targetAlias"]),manage_assets_export_selection_json:new Set(["format","includeProperties","includeChildren","maxDepth","placeId","clientId","targetAlias"]),manage_assets_export_selection_rbxm:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","displayName","description","thumbnailMode","uploadMode","uploadTemporaryAssets","creatorType","creatorId","clientId","targetAlias"]),manage_assets_export_path_rbxm:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","sourcePath","displayName","description","thumbnailMode","uploadMode","uploadTemporaryAssets","creatorType","creatorId","clientId","targetAlias"]),manage_assets_review_model:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","sourcePath","displayName","description","thumbnailMode","uploadMode","uploadTemporaryAssets","creatorType","creatorId","exportToLibrary","expectedUse","expectedGroups","maxDescendants","maxDepth","readiness","clientId","targetAlias"]),manage_assets_generate_model:new Set(["contextId","contextSummary","replayMetadata","placeId","category","prompt","schemaMode","predefinedSchema","schemaGroups","size","maxTriangles","generateTextures","review","targetParent","name","displayName","expectedUse","expectedGroups","maxDescendants","maxDepth","readiness","anchorMode","clientId","targetAlias"]),manage_assets_upload_asset:new Set(["contextId","contextSummary","replayMetadata","placeId","category","assetType","sourcePath","displayName","description","creatorType","creatorId","clientId","targetAlias"]),manage_assets_import_rbxm:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","assetLibraryAssetId","targetParent","name","clientId","targetAlias"]),manage_assets_generate_thumbnail:new Set(["contextId","contextSummary","replayMetadata","scope","placeId","category","assetLibraryAssetId","clientId","targetAlias"])},requiredParams:{manage_assets_insert:new Set(["assetId"]),manage_assets_info:new Set(["assetId"]),manage_assets_search:new Set(["query"]),manage_assets_search_insert:new Set(["query"]),manage_assets_insert_free:new Set(["assetId"]),manage_assets_insert_package:new Set(["assetId"]),manage_assets_export_selection_json:new Set([]),manage_assets_export_selection_rbxm:new Set(["category"]),manage_assets_export_path_rbxm:new Set(["category","sourcePath"]),manage_assets_review_model:new Set(["category"]),manage_assets_generate_model:new Set(["prompt"]),manage_assets_upload_asset:new Set([]),manage_assets_import_rbxm:new Set(["category","assetLibraryAssetId"]),manage_assets_generate_thumbnail:new Set(["category","assetLibraryAssetId"])},paramAliases:{manage_assets_search:{maxResults:"limit"}}},manage_open_cloud_assets:{discriminator:"action",validActions:new Set(["preflight","credential_status","capabilities","upload","link","update","info","operation_status"]),allowedParams:{manage_open_cloud_assets_preflight:new Set(["filePath","category","creatorType","creatorId"]),manage_open_cloud_assets_credential_status:new Set([]),manage_open_cloud_assets_capabilities:new Set([]),manage_open_cloud_assets_upload:new Set(["contextId","contextSummary","replayMetadata","filePath","category","scope","placeId","displayName","description","creatorType","creatorId","expectedPrice","waitForOperation","operationPollTimeoutMs","operationPollIntervalMs"]),manage_open_cloud_assets_link:new Set(["contextId","contextSummary","replayMetadata","assetId","filePath","category","scope","placeId","displayName","description"]),manage_open_cloud_assets_update:new Set(["contextId","contextSummary","replayMetadata","assetId","filePath","category","displayName","description","creatorType","creatorId","expectedPrice","updateMask","waitForOperation","operationPollTimeoutMs","operationPollIntervalMs"]),manage_open_cloud_assets_info:new Set(["assetId","readMask"]),manage_open_cloud_assets_operation_status:new Set(["operationId"])},requiredParams:{manage_open_cloud_assets_preflight:new Set([]),manage_open_cloud_assets_credential_status:new Set([]),manage_open_cloud_assets_capabilities:new Set([]),manage_open_cloud_assets_upload:new Set(["filePath","category","displayName"]),manage_open_cloud_assets_link:new Set(["assetId","filePath","category"]),manage_open_cloud_assets_update:new Set(["assetId","category"]),manage_open_cloud_assets_info:new Set(["assetId"]),manage_open_cloud_assets_operation_status:new Set(["operationId"])}},manage_sync:{discriminator:"action",validActions:new Set(["status_current_place","history","policy","read_file","write_file","progress"]),allowedParams:{manage_sync_status_current_place:new Set([]),manage_sync_history:new Set(["placeId","query"]),manage_sync_policy:new Set(["placeId"]),manage_sync_read_file:new Set(["placeId","instancePath"]),manage_sync_write_file:new Set(["placeId","instancePath","content"]),manage_sync_progress:new Set([])},requiredParams:{manage_sync_status_current_place:new Set([]),manage_sync_history:new Set([]),manage_sync_policy:new Set([]),manage_sync_read_file:new Set(["placeId","instancePath"]),manage_sync_write_file:new Set(["placeId","instancePath","content"]),manage_sync_progress:new Set([])}},workspace_state:{discriminator:"action",validActions:new Set(["sync","snapshot","changes","viewport","clear_history","metadata","scripts","selection_info","clear_cache"]),allowedParams:{workspace_state_sync:new Set(["includeMetadata","placeId","clientId","targetAlias"]),workspace_state_snapshot:new Set(["placeId","clientId","targetAlias"]),workspace_state_changes:new Set(["limit","placeId","clientId","targetAlias"]),workspace_state_viewport:new Set(["includeCameraInfo","includeSelectionBounds","placeId","clientId","targetAlias"]),workspace_state_clear_history:new Set(["placeId","clientId","targetAlias"]),workspace_state_metadata:new Set(["placeId","clientId","targetAlias"]),workspace_state_scripts:new Set(["placeId","clientId","targetAlias"]),workspace_state_selection_info:new Set(["placeId","clientId","targetAlias"]),workspace_state_clear_cache:new Set(["placeId","clientId","targetAlias"])},requiredParams:{workspace_state_sync:new Set([]),workspace_state_snapshot:new Set([]),workspace_state_changes:new Set([]),workspace_state_viewport:new Set([]),workspace_state_clear_history:new Set([]),workspace_state_metadata:new Set([]),workspace_state_scripts:new Set([]),workspace_state_selection_info:new Set([]),workspace_state_clear_cache:new Set([])}},manage_logs:{discriminator:"action",validActions:new Set(["get","clear","errors"]),allowedParams:{manage_logs_get:new Set(["level","limit","pattern","since","sinceSeq","placeId","clientId","targetAlias"]),manage_logs_clear:new Set(["placeId","clientId","targetAlias"]),manage_logs_errors:new Set(["limit","placeId","clientId","targetAlias"])},requiredParams:{manage_logs_get:new Set([]),manage_logs_clear:new Set([]),manage_logs_errors:new Set([])},paramAliases:{manage_logs_get:{level:"type"}}},manage_settings:{discriminator:"action",validActions:new Set(["get_dashboard_auto_open","set_dashboard_auto_open"]),allowedParams:{manage_settings_get_dashboard_auto_open:new Set([]),manage_settings_set_dashboard_auto_open:new Set(["enabled"])},requiredParams:{manage_settings_get_dashboard_auto_open:new Set([]),manage_settings_set_dashboard_auto_open:new Set(["enabled"])}},system_info:{discriminator:"action",validActions:new Set(["ping","connection","usage","place_info","services","preflight"]),allowedParams:{system_info_ping:new Set(["message","placeId","clientId","targetAlias"]),system_info_connection:new Set([]),system_info_usage:new Set(["placeId","clientId","targetAlias"]),system_info_place_info:new Set(["placeId","clientId","targetAlias"]),system_info_services:new Set(["placeId","clientId","targetAlias"]),system_info_preflight:new Set(["placeId","clientId","targetAlias"])},requiredParams:{system_info_ping:new Set([]),system_info_connection:new Set([]),system_info_usage:new Set([]),system_info_place_info:new Set([]),system_info_services:new Set([]),system_info_preflight:new Set([])}},manage_studio:{discriminator:"action",validActions:new Set(["toggle_ui_preview","test_profile_get","test_profile_set","test_profile_reset","experience_language_get","experience_language_set","play_start","play_stop","play_pause","play_resume","play_status","test_session_start","playtest_control_get","playtest_prepare","playtest_binding_candidates","playtest_profile_save","playtest_adapter_plan","playtest_adapter_apply","playtest_source_open","playtest_control_apply","playtest_control_reset","playtest_action_execute","test_session_status","test_session_stop","run_test"]),allowedParams:{manage_studio_toggle_ui_preview:new Set(["enabled","placeId","clientId","targetAlias"]),manage_studio_test_profile_get:new Set(["placeId","clientId","targetAlias"]),manage_studio_test_profile_set:new Set(["testProfile","placeId","clientId","targetAlias"]),manage_studio_test_profile_reset:new Set(["placeId","clientId","targetAlias"]),manage_studio_experience_language_get:new Set(["placeId","clientId","targetAlias"]),manage_studio_experience_language_set:new Set(["locale","placeId","clientId","targetAlias"]),manage_studio_play_start:new Set(["mode","testProfile","restoreAfterTest","controlProfileId","placeId","clientId","targetAlias"]),manage_studio_play_stop:new Set(["placeId","clientId","targetAlias"]),manage_studio_play_pause:new Set(["placeId","clientId","targetAlias"]),manage_studio_play_resume:new Set(["placeId","clientId","targetAlias"]),manage_studio_play_status:new Set(["placeId","clientId","targetAlias"]),manage_studio_test_session_start:new Set(["scenario","idempotencyKey","testProfile","restoreAfterTest","controlProfileId","placeId","clientId","targetAlias","contextId","contextSummary","replayMetadata"]),manage_studio_playtest_control_get:new Set(["controlProfileId","leaseId","placeId","clientId","targetAlias"]),manage_studio_playtest_prepare:new Set(["controlProfileId","placeId","clientId","targetAlias"]),manage_studio_playtest_binding_candidates:new Set(["candidateSource","candidateTarget","candidatePath","maxResults","placeId","clientId","targetAlias"]),manage_studio_playtest_profile_save:new Set(["profileOperation","controlProfileId","controlProfile","expectedRevision","sourceProfileId","sourceRevision","sourcePlaceId","sourcePlaceName","destinationProfileId","destinationProfileName","placeId","clientId","targetAlias"]),manage_studio_playtest_adapter_plan:new Set(["adapterOperation","adapterId","adapterRegistrationId","adapterRegistrationLabel","adapterRegistrationGroup","adapterRegistrationKind","adapterValueType","adapterModulePath","adapterReadMethod","adapterWriteMethod","adapterMethodStyle","adapterStudioOnly","adapterConstraints","adapterEnumValues","productionExclusionStrategy","productionExclusionReference","placeId","clientId","targetAlias"]),manage_studio_playtest_adapter_apply:new Set(["planToken","expectedSourceHash"]),manage_studio_playtest_source_open:new Set(["adapterId","adapterRegistrationId","placeId","clientId","targetAlias"]),manage_studio_playtest_control_apply:new Set(["leaseId","expectedRevision","controlValues","placeId","clientId","targetAlias"]),manage_studio_playtest_control_reset:new Set(["leaseId","placeId","clientId","targetAlias"]),manage_studio_playtest_action_execute:new Set(["leaseId","controlProfileId","actionId","actionArguments","expectedProfileRevision","expectedRevision","requestId","placeId","clientId","targetAlias"]),manage_studio_test_session_status:new Set(["sessionId","stepCursor","stepLimit","placeId","clientId","targetAlias"]),manage_studio_test_session_stop:new Set(["sessionId","placeId","clientId","targetAlias"]),manage_studio_run_test:new Set(["mode","script","test_name","timeout","testProfile","restoreAfterTest","placeId","clientId","targetAlias","contextId","contextSummary","replayMetadata"])},requiredParams:{manage_studio_toggle_ui_preview:new Set([]),manage_studio_test_profile_get:new Set([]),manage_studio_test_profile_set:new Set(["testProfile"]),manage_studio_test_profile_reset:new Set([]),manage_studio_experience_language_get:new Set([]),manage_studio_experience_language_set:new Set(["locale"]),manage_studio_play_start:new Set([]),manage_studio_play_stop:new Set([]),manage_studio_play_pause:new Set([]),manage_studio_play_resume:new Set([]),manage_studio_play_status:new Set([]),manage_studio_test_session_start:new Set(["scenario"]),manage_studio_playtest_control_get:new Set([]),manage_studio_playtest_prepare:new Set([]),manage_studio_playtest_binding_candidates:new Set(["candidateSource"]),manage_studio_playtest_profile_save:new Set(["profileOperation"]),manage_studio_playtest_adapter_plan:new Set(["adapterOperation","adapterId"]),manage_studio_playtest_adapter_apply:new Set(["planToken","expectedSourceHash"]),manage_studio_playtest_source_open:new Set(["adapterId","adapterRegistrationId"]),manage_studio_playtest_control_apply:new Set(["leaseId","expectedRevision","controlValues"]),manage_studio_playtest_control_reset:new Set(["leaseId"]),manage_studio_playtest_action_execute:new Set(["leaseId","controlProfileId","actionId","actionArguments","expectedProfileRevision","expectedRevision","requestId"]),manage_studio_test_session_status:new Set(["sessionId"]),manage_studio_test_session_stop:new Set(["sessionId"]),manage_studio_run_test:new Set(["script"])}}},KT={batch_execute:new Set(["commands"]),execute_luau:new Set(["source"])};var wB=new Set(["execute_luau","batch_execute"]),jpe=["placeId","clientId","targetAlias"],Mpe=new Set(["action","placeId","clientId","targetAlias","contextId","contextSummary","replayMetadata"]);function IB(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Lpe(t){return t instanceof Error?t.message:String(t)}var GS=Object.entries(is).reduce((t,[e,n])=>{for(let r of n.validActions)t[`${e}_${r}`]=e;return t},{});function Upe(t,e){let n=e.map(r=>`'${r}'`).join(", ");return e.length===1?`Parameter ${n} is not used by action '${t}'.`:`Parameters ${n} are not used by action '${t}'.`}function YT(t,e){let n=is[t];if(!n)return[];let r=e[n.discriminator];if(typeof r!="string"||r===""||!n.validActions.has(r))return[];let i=`${t}_${r}`,a=new Set(n.allowedParams[i]||[]);a.add(n.discriminator);for(let c of Mpe)a.add(c);let o=n.paramAliases?.[i];if(o)for(let[c,l]of Object.entries(o))a.add(c),a.add(l);let s=Object.keys(e).filter(c=>e[c]!==void 0&&!a.has(c)).sort();return s.length===0?[]:[Upe(r,s)]}function as(t,e){let n=is[t];if(!n){if(t==="batch_execute"&&Array.isArray(e.commands)){let l=e.commands.map((u,d)=>{let p=`batch_execute.commands[${d}]`;if(!IB(u))throw new Error(`${p} must be an object`);let m=u.tool;if(typeof m!="string"||m.trim()==="")throw new Error(`${p}.tool is required and must be a non-empty string`);if(!IB(u.args))throw new Error(`${p}.args is required and must be an object`);for(let g of jpe)if(g in u.args)throw new Error(`${p}.args.${g} is not supported. Pass ${g} at the top level of batch_execute so the whole batch targets one Studio client.`);if(wB.has(m))throw new Error(`Tool "${m}" is not allowed inside batch_execute. Denied tools: ${[...wB].join(", ")}`);let f;try{f=as(m,u.args)}catch(g){let h=Lpe(g);throw/^Missing or non-string/.test(h)?new Error(`${p}.args.action is required and must be a non-empty string`):new Error(`${p}: ${h}`)}return{command:f.command,params:f.params,...f.warnings?{warnings:f.warnings}:{}}});return{tool:t,command:t,params:{...e,commands:l}}}return{tool:t,command:t,params:{...e}}}let r=e[n.discriminator];if(typeof r!="string"||r==="")throw new Error(`Missing or non-string ${n.discriminator} for tool "${t}"`);if(!n.validActions.has(r)){let l=[...n.validActions].join(", ");throw new Error(`Invalid ${n.discriminator} "${r}" for tool "${t}". Valid values: ${l}`)}let i=`${t}_${r}`,a=YT(t,e),{[n.discriminator]:o,...s}=e;t==="manage_sync"&&r==="status_current_place"&&delete s.placeId;let c=n.paramAliases?.[i];if(c)for(let[l,u]of Object.entries(c))l in s&&!(u in s)&&(s[u]=s[l],delete s[l]);return{tool:t,action:r,command:i,params:s,...a.length>0?{warnings:a}:{}}}function Zf(t){return GS[t]||t}function JS(t){let e=GS[t];if(e)return t.slice(e.length+1)}function KS(t){let e=GS[t];if(e)return is[e]?.paramAliases?.[t]}function YS(t){let e=GS[t];return e?[...is[e]?.requiredParams[t]??[]]:[...KT[t]??[]]}function Gf(t){return t in is||t in KT}function XS(){return{...is}}var QS=1,Jf=1,Zu=1e4,ex=2e3,On={identity:"/internal/adapter/identity",register:"/internal/adapter/register",heartbeat:"/internal/adapter/heartbeat",unregister:"/internal/adapter/unregister",execute:"/internal/adapter/execute",adapters:"/internal/adapter/sessions",shutdown:"/internal/adapter/shutdown"};function Kf(t){if(!t||typeof t!="object")return!1;let e=t;return e.schemaVersion!==Jf||typeof e.lockId!="string"||e.lockId.length===0||!Number.isInteger(e.pid)?!1:e.phase==="starting"?typeof e.adapterId=="string"&&typeof e.createdAt=="number"&&typeof e.deadlineAt=="number":e.phase==="ready"?typeof e.instanceId=="string"&&typeof e.claimedAt=="number":!1}function PB(t){let{token:e,...n}=t;return n}function tx(t){let e=Hu(t,"runtime");return{runtimeDir:e,stateFile:Hu(e,"bridge-state.json"),stateMutation:Hu(e,"bridge-state.json.mutation"),startupLock:Hu(e,"bridge-startup.lock"),startupLockMutation:Hu(e,"bridge-startup.lock.mutation"),logFile:Hu(e,"bridge.log")}}function CB(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Fpe(t,e,n){let r=t;return e&&(r=CB(r)?{...r,routing:e}:r===void 0?{routing:e}:{value:r,routing:e}),n.length>0&&(r=CB(r)?{...r,warnings:[...n]}:r===void 0?{warnings:[...n]}:{value:r,warnings:[...n]}),r}function kB(t,e=[]){let n=[...new Set([...e,...t.warnings??[]])];if(!t.success){let a={success:!1,...t.error?{error:t.error}:{},...t.errorCode?{errorCode:t.errorCode}:{},...t.data!==void 0?{data:t.data}:{},...t.routing?{routing:t.routing}:{},...n.length>0?{warnings:n}:{},...t.indeterminate?{indeterminate:!0}:{}};return{content:[{type:"text",text:JSON.stringify(a,null,2)}],isError:!0}}let r=(t.content??[]).map(a=>a.kind==="image"?{type:"image",data:a.data,mimeType:a.mimeType}:{type:"text",text:a.text}),i=Fpe(t.data,t.routing,n);return i!==void 0&&r.push({type:"text",text:JSON.stringify(i,null,2)}),r.length===0&&r.push({type:"text",text:JSON.stringify({success:!0,message:"Command executed"})}),{content:r,isError:!1}}function RB(t){return async(e,n)=>{let r=[];try{await t.ensureBridgeSession();let i=as(e,n);r=i.warnings??[];let a={requestId:t.requestIdFactory?.()??qpe(),adapterId:t.adapterId,tool:i.tool,command:i.command,params:i.params,executionMode:HS(i.command),timeoutMs:t.requestTimeoutMs};return kB(await t.execute(a),r)}catch(i){let a=i instanceof Error?i.message:String(i);return{content:[{type:"text",text:r.length>0?JSON.stringify({success:!1,error:a,warnings:r},null,2):`Error: ${a}`}],isError:!0}}}}var nx=class{constructor(e){this.options=e;this.adapterId=e.adapterId??Bpe(),this.aiClientName=e.aiClientName,this.aiClientVersion=e.aiClientVersion,this.aiClientSource=e.aiClientSource,this.mcpServer=new WS(RB({adapterId:this.adapterId,requestTimeoutMs:e.requestTimeoutMs,execute:async n=>await e.bridgeClient.execute(n),ensureBridgeSession:async()=>await this.ensureBridgeSession()}),n=>{this.updateClientInfo(n)})}lifecycle=new eS;adapterId;mcpServer;bridgeReadyPromise=null;bridgeRetryTimer=null;heartbeatTimer=null;registered=!1;stopping=!1;aiClientName;aiClientVersion;aiClientSource;async start(){return this.lifecycle.start(async()=>{await this.mcpServer.connect(this.options.transport??new Q_),this.stopping=!1,this.startEagerBridgeSession()})}async stop(){return this.lifecycle.stop(async()=>{this.stopping=!0,this.bridgeRetryTimer&&(clearTimeout(this.bridgeRetryTimer),this.bridgeRetryTimer=null),this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),await this.bridgeReadyPromise?.catch(()=>{}),this.registered&&(await this.options.bridgeClient.unregister().catch(()=>{}),this.registered=!1),await this.options.bridgeClient.close(),await this.mcpServer.close()})}async ensureBridgeSession(){this.registered||await this.getOrStartBridgeSession()}startEagerBridgeSession(){this.stopping||this.registered||this.bridgeRetryTimer||this.getOrStartBridgeSession().catch(()=>{if(this.stopping||this.registered||this.bridgeRetryTimer)return;let e=this.options.bridgeRetryDelayMs??1e3;this.bridgeRetryTimer=setTimeout(()=>{this.bridgeRetryTimer=null,this.startEagerBridgeSession()},e),this.bridgeRetryTimer.unref()})}getOrStartBridgeSession(){if(this.bridgeReadyPromise)return this.bridgeReadyPromise;let e=this.openBridgeSession();return this.bridgeReadyPromise=e,e.then(()=>{this.bridgeReadyPromise===e&&(this.bridgeReadyPromise=null)},()=>{this.bridgeReadyPromise===e&&(this.bridgeReadyPromise=null)}),e}async openBridgeSession(){await this.options.bridgeClient.ensureReady();let e=this.createRegistration();await this.options.bridgeClient.register(e),this.registered=!0;let n=this.createRegistration();(e.aiClientName!==n.aiClientName||e.aiClientVersion!==n.aiClientVersion||e.aiClientSource!==n.aiClientSource)&&await this.options.bridgeClient.register(n);let r=this.options.heartbeatIntervalMs??5e3;this.heartbeatTimer=setInterval(()=>{this.options.bridgeClient.heartbeat().catch(()=>{})},r),this.heartbeatTimer.unref()}createRegistration(){return{adapterId:this.adapterId,pid:this.options.pid??process.pid,mcpVersion:He,cwd:this.options.cwd??process.cwd(),projectRoot:this.options.projectRoot,...this.aiClientName?{aiClientName:this.aiClientName}:{},...this.aiClientVersion?{aiClientVersion:this.aiClientVersion}:{},...this.aiClientSource?{aiClientSource:this.aiClientSource}:{}}}async updateClientInfo(e){let n=e.version||void 0;this.aiClientName===e.name&&this.aiClientVersion===n&&this.aiClientSource==="mcp"||(this.aiClientName=e.name,this.aiClientVersion=n,this.aiClientSource="mcp",this.registered&&await this.options.bridgeClient.register(this.createRegistration()).catch(()=>{}))}};var Ee=class extends Error{code;status;constructor(e,n,r={}){super(n),this.name="BridgeClientError",this.code=e,r.status!==void 0&&(this.status=r.status)}},Vpe=new Set(["bridge_unavailable","bridge_identity_mismatch","bridge_protocol_mismatch","bridge_port_ownership_conflict","bridge_request_duplicate","bridge_request_indeterminate","bridge_readiness_timeout"]);function XT(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Wpe(t){let e=XT(t);if(!e)return null;let n=e.errorCode??e.error;return typeof n!="string"||!Vpe.has(n)?null:n}function Hpe(t){let e=XT(t);return e!==null&&typeof e.requestId=="string"&&typeof e.success=="boolean"}function Zpe(t){let e=XT(t);return!e||"token"in e?!1:Number.isInteger(e.pid)&&typeof e.instanceId=="string"&&Number.isInteger(e.protocolVersion)&&typeof e.mcpVersion=="string"&&e.host==="127.0.0.1"&&Number.isInteger(e.port)&&(e.status==="starting"||e.status==="ready"||e.status==="stopping")&&typeof e.startedAt=="number"}var rx=class{state;adapterId;fetchImpl;baseUrl;controlRequestTimeoutMs;constructor(e){this.state={...e.state},this.adapterId=e.adapterId,this.fetchImpl=e.fetchImpl??globalThis.fetch,this.baseUrl=`http://${this.state.host}:${this.state.port}`,this.controlRequestTimeoutMs=e.controlRequestTimeoutMs??5e3}async ensureReady(){await this.identity()}async identity(){let e=await this.requestJson("GET",On.identity);if(!Zpe(e))throw new Ee("bridge_identity_mismatch","Bridge identity response is invalid");if(e.protocolVersion!==this.state.protocolVersion||e.mcpVersion!==this.state.mcpVersion)throw new Ee("bridge_protocol_mismatch","Bridge protocol or MCP version does not match verified state");if(e.pid!==this.state.pid||(e.runtimeEnvironment??"release")!==(this.state.runtimeEnvironment??"release")||e.instanceId!==this.state.instanceId||e.host!==this.state.host||e.port!==this.state.port||e.startedAt!==this.state.startedAt)throw new Ee("bridge_identity_mismatch","Bridge identity does not match verified state");if(this.state.status!=="ready"||e.status!=="ready")throw new Ee("bridge_unavailable","Bridge is not ready");return e}async register(e){if(e.adapterId!==this.adapterId)throw new Ee("bridge_protocol_mismatch","Bridge registration Adapter identity does not match this client");await this.requestJson("POST",On.register,e)}async heartbeat(){await this.requestJson("POST",On.heartbeat,{adapterId:this.adapterId})}async execute(e){if(e.adapterId!==this.adapterId)throw new Ee("bridge_protocol_mismatch","Bridge execute request Adapter identity does not match this client");let n=await this.requestJson("POST",On.execute,e,e.timeoutMs);if(!Hpe(n))throw new Ee("bridge_protocol_mismatch","Bridge execute response is invalid");if(n.requestId!==e.requestId)throw new Ee("bridge_protocol_mismatch","Bridge execute response request identity does not match");return n}async unregister(){await this.requestJson("POST",On.unregister,{adapterId:this.adapterId})}close(){}async requestJson(e,n,r,i=this.controlRequestTimeoutMs){let a=new AbortController,o=setTimeout(()=>a.abort(),i);o.unref();let s;try{s=await this.fetchImpl(`${this.baseUrl}${n}`,{method:e,signal:a.signal,headers:{Accept:"application/json",Authorization:`Bearer ${this.state.token}`,...r!==void 0?{"Content-Type":"application/json"}:{}},...r!==void 0?{body:JSON.stringify(r)}:{}})}catch{throw clearTimeout(o),new Ee("bridge_unavailable",`Bridge ${e} ${n} transport failed`)}let c;try{c=await s.text()}catch{throw new Ee("bridge_unavailable",`Bridge ${e} ${n} response transport failed`,{status:s.status})}finally{clearTimeout(o)}let l;try{l=JSON.parse(c)}catch{throw s.ok?new Ee("bridge_protocol_mismatch",`Bridge ${e} ${n} returned invalid JSON`,{status:s.status}):new Ee("bridge_unavailable",`Bridge ${e} ${n} returned HTTP ${s.status}`,{status:s.status})}if(!s.ok)throw new Ee(Wpe(l)??"bridge_unavailable",`Bridge ${e} ${n} returned HTTP ${s.status}`,{status:s.status});return l}};import{createConnection as Kpe}from"node:net";import{readFile as Gpe}from"node:fs/promises";function Jpe(t){if(!t||typeof t!="object")return!1;let e=t;return Number.isInteger(e.pid)&&(e.pid??0)>0&&typeof e.instanceId=="string"&&e.instanceId.length>0&&Number.isInteger(e.protocolVersion)&&typeof e.mcpVersion=="string"&&e.mcpVersion.length>0&&e.host==="127.0.0.1"&&Number.isInteger(e.port)&&(e.port??0)>0&&(e.port??0)<=65535&&(e.status==="starting"||e.status==="ready"||e.status==="stopping")&&typeof e.token=="string"&&e.token.length>=32&&typeof e.startedAt=="number"}async function EB(t){let e;try{e=await Gpe(t.stateFile,"utf8")}catch(n){if(n.code==="ENOENT")return{kind:"absent"};throw n}try{let n=JSON.parse(e);return Jpe(n)?{kind:"state",state:n}:{kind:"invalid",reason:"bridge state fields are invalid"}}catch{return{kind:"invalid",reason:"bridge state is not valid JSON"}}}var Ype="2.14.6";function AB(t){return t.startsWith("0.0.")}function QT(t){let e=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(t);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function Xpe(t,e){let n=QT(t),r=QT(e);if(!n||!r)return!1;let[i,a,o]=n,[s,c,l]=r;return i!==s?i>s:a!==c?a>c:o>=l}function Qpe(t,e){return AB(t)?!0:QT(t)?Xpe(e,Ype):!1}async function TB(t){let e=await EB(t.paths);if(e.kind!=="state"||e.state.status!=="ready")return null;if(t.expectedPort!==void 0&&e.state.port!==t.expectedPort||t.runtimeEnvironment!==void 0&&(e.state.runtimeEnvironment??"release")!==t.runtimeEnvironment)throw new Ee("bridge_identity_mismatch","Bridge environment or port does not match configured runtime");if(t.runtimeEnvironment==="development"&&(e.state.port===3002||!AB(e.state.mcpVersion)))throw new Ee("bridge_identity_mismatch","Development Adapter cannot reuse a release Bridge");let n=new rx({state:e.state,adapterId:t.adapterId,...t.fetchImpl?{fetchImpl:t.fetchImpl}:{}});await n.ensureReady();let r=t.expectedMcpVersion??He;if(e.state.protocolVersion!==QS||!Qpe(r,e.state.mcpVersion))throw new Ee("bridge_protocol_mismatch","Running Bridge protocol or MCP version is incompatible");return{state:e.state,client:n}}async function eO(t,e=250){return await new Promise(n=>{let r=Kpe({host:"127.0.0.1",port:t}),i=!1,a=o=>{i||(i=!0,r.destroy(),n(o))};r.once("connect",()=>a(!0)),r.once("error",o=>{a(o.code!=="ECONNREFUSED"&&o.code!=="EHOSTUNREACH")}),r.setTimeout(e,()=>a(!0))})}var eme=async t=>{await new Promise(e=>setTimeout(e,t))};async function tO(t){let e=t.now??Date.now,n=t.sleep??eme,r=t.deadlineAt??e()+Zu,i=t.pollIntervalMs??100,a;for(;e()<r;){try{let o=await t.discover();if(o)return o}catch(o){if(!(o instanceof Ee)||o.code!=="bridge_unavailable")throw o;a=o}await n(Math.min(i,Math.max(1,r-e())))}throw new Ee("bridge_readiness_timeout",a?"Bridge did not become ready after a transport failure":"Bridge did not become ready before the startup deadline")}import{randomUUID as pme}from"node:crypto";import{chmod as mme,mkdir as fme,open as BB,unlink as rO}from"node:fs/promises";import{randomUUID as ix}from"node:crypto";import{link as NB,mkdir as OB,open as $B,readdir as tme,rename as ax,rmdir as Yf,stat as jB,unlink as ra}from"node:fs/promises";import{dirname as nme,join as Xf}from"node:path";var MB=1,rme=[10,25,50],ime=new Set(["EACCES","EBUSY","EEXIST","EINVAL","EISDIR","ENOTDIR","ENOTEMPTY","EPERM"]),ame=/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function DB(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function ome(t){if(!t||typeof t!="object")return!1;let e=t;return e.schemaVersion===MB&&typeof e.mutationId=="string"&&ame.test(e.mutationId)&&Number.isInteger(e.pid)&&(e.pid??0)>0&&typeof e.ownerId=="string"&&e.ownerId.length>0&&e.resource==="bridge-startup-lock"&&typeof e.operation=="string"&&e.operation.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)}function LB(t,e){return`${t}.owner-${e}`}function UB(t){return`owner-${t}`}async function Qf(t){let e;try{e=await $B(t,"r")}catch(n){if(n.code==="ENOENT")return;throw n}try{let n=await e.stat({bigint:!0}),r=await e.readFile({encoding:"utf8"}),i;try{i=JSON.parse(r)}catch{i=void 0}return{...ome(i)?{record:i}:{},device:n.dev,inode:n.ino,mtimeMs:Number(n.mtimeMs)}}finally{await e.close()}}async function nO(t){let e;try{e=await jB(t,{bigint:!0})}catch(a){if(a.code==="ENOENT")return{kind:"absent"};throw a}if(!e.isDirectory()){let a=await Qf(t);return a?{kind:"malformed",pathIsDirectory:!1,directoryDevice:a.device,directoryInode:a.inode,mtimeMs:a.mtimeMs,marker:a}:{kind:"absent"}}let n;try{n=await tme(t,{withFileTypes:!0})}catch(a){if(a.code==="ENOENT")return{kind:"absent"};throw a}if(n.length!==1||!n[0]?.isFile())return{kind:"malformed",pathIsDirectory:!0,directoryDevice:e.dev,directoryInode:e.ino,mtimeMs:Number(e.mtimeMs)};let r=n[0].name,i=await Qf(Xf(t,r));return i?!i.record||r!==UB(i.record.mutationId)?{kind:"malformed",pathIsDirectory:!0,directoryDevice:e.dev,directoryInode:e.ino,mtimeMs:Number(e.mtimeMs),markerName:r,marker:i}:{kind:"record",directoryDevice:e.dev,directoryInode:e.ino,markerName:r,marker:{...i,record:i.record}}:nO(t)}function sme(t){try{return process.kill(t,0),!0}catch(e){return e.code!=="ESRCH"}}async function zB(t,e){if(e.kind==="malformed"&&!e.pathIsDirectory)return!1;try{let n=await jB(t,{bigint:!0});return n.isDirectory()&&n.dev===e.directoryDevice&&n.ino===e.directoryInode}catch(n){if(n.code==="ENOENT")return!1;throw n}}async function Sc(t,e){let n=await Qf(t);return n!==void 0&&n.device===e.device&&n.inode===e.inode&&n.record?.mutationId===e.record?.mutationId}async function FB(t,e){try{await NB(t,e)}catch(n){if(n.code!=="EEXIST")throw n}finally{await ra(t).catch(()=>{})}}async function cme(t,e){if(sme(e.marker.record.pid)||!await zB(t,e))return!1;let n=Xf(t,e.markerName);if(!await Sc(n,e.marker))return!1;let r=`${t}.recovery-${ix()}`;try{await ax(n,r)}catch(a){if(!await Sc(n,e.marker))return!1;let o=a.code;if(o==="EACCES"||o==="EBUSY"||o==="EPERM")return!1;throw a}try{await Yf(t)}catch(a){await FB(r,n).catch(()=>{});let o=a.code;if(o==="ENOENT"||o==="ENOTEMPTY")return!1;throw a}let i=LB(t,e.marker.record.mutationId);return await Sc(i,e.marker)&&await ra(i).catch(()=>{}),await ra(r).catch(()=>{}),!0}async function lme(t,e,n,r){if(n-e.mtimeMs<r)return!1;if(!e.pathIsDirectory){if(!e.marker||!await Sc(t,e.marker))return!1;let o=`${t}.recovery-${ix()}`;try{await ax(t,o)}catch(s){if(!await Sc(t,e.marker))return!1;let c=s.code;if(c==="EACCES"||c==="EBUSY"||c==="EPERM")return!1;throw s}return await ra(o).catch(()=>{}),!0}if(!await zB(t,e))return!1;if(!e.markerName||!e.marker)try{return await Yf(t),!0}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTEMPTY")return!1;throw o}let i=Xf(t,e.markerName);if(!await Sc(i,e.marker))return!1;let a=`${t}.recovery-${ix()}`;try{await ax(i,a)}catch(o){if(!await Sc(i,e.marker))return!1;let s=o.code;if(s==="EACCES"||s==="EBUSY"||s==="EPERM")return!1;throw o}try{return await Yf(t),await ra(a).catch(()=>{}),!0}catch(o){await FB(a,i).catch(()=>{});let s=o.code;if(s==="ENOENT"||s==="ENOTEMPTY")return!1;throw o}}async function ume(t,e){let n;try{n=await $B(t,"wx",384),await n.writeFile(`${JSON.stringify(e)}
794
1128
  `,"utf8"),await n.sync(),await n.close(),n=void 0}catch(r){throw await n?.close().catch(()=>{}),await ra(t).catch(()=>{}),r}}async function dme(t,e,n,r){try{let[i,a]=await Promise.all([Qf(n),Qf(e)]);if(!(i!==void 0&&a!==void 0&&i.device===a.device&&i.inode===a.inode&&i.record?.mutationId===r&&a.record?.mutationId===r))return!1;try{await ra(n)}catch(s){if(s.code==="ENOENT")return!1;throw s}try{return await Yf(t),!0}catch(s){let c=s.code;if(c==="ENOENT"||c==="ENOTEMPTY"||c==="EACCES"||c==="EBUSY"||c==="EPERM")return!1;throw s}}finally{await ra(e).catch(i=>{if(i.code!=="ENOENT")throw i})}}async function ox(t){let e=ix(),n=LB(t.mutationPath,e),r=`${t.mutationPath}.publish-${e}`,i=UB(e),a=Xf(t.mutationPath,i),o=Xf(r,i),s=t.now??Date.now(),c={schemaVersion:MB,mutationId:e,pid:t.pid??process.pid,ownerId:t.ownerId,resource:"bridge-startup-lock",operation:t.operation??"mutate",createdAt:s},l=t.retryDelaysMs??rme,u=t.malformedGraceMs??ex;await OB(nme(t.mutationPath),{recursive:!0,mode:448}),await ume(n,c),await OB(r,{mode:448}),await NB(n,o);let d=!1;try{for(let p=0;p<=l.length+1;p+=1){let m=await nO(t.mutationPath);if(m.kind==="absent")try{return await ax(r,t.mutationPath),d=!0,{kind:"acquired",record:c,ownerPath:n,markerPath:a,release:()=>dme(t.mutationPath,n,a,e)}}catch(g){if(m=await nO(t.mutationPath),m.kind==="absent"){let h=g.code;if(!h||!ime.has(h)||p>=l.length)throw g;await DB(l[p]??0);continue}}if(!(m.kind==="record"?await cme(t.mutationPath,m):await lme(t.mutationPath,m,s,u))){if(p>=l.length)return{kind:"contended",...m.kind==="record"?{owner:m.marker.record}:{},malformed:m.kind==="malformed"};await DB(l[p]??0)}}throw new Error("Startup mutation lock retry exhausted unexpectedly")}finally{d||(await ra(o).catch(()=>{}),await Yf(r).catch(()=>{}),await ra(n).catch(()=>{}))}}async function Gu(t){let e,n,r;try{e=await BB(t.startupLock,"r"),n=await e.stat(),r=await e.readFile("utf8")}catch(i){if(i.code==="ENOENT")return{kind:"absent"};throw i}finally{await e?.close().catch(()=>{})}try{let i=JSON.parse(r);return Kf(i)?{kind:"record",record:i,mtimeMs:n.mtimeMs}:{kind:"invalid",mtimeMs:n.mtimeMs}}catch{return{kind:"invalid",mtimeMs:n.mtimeMs}}}function qB(t){return t.kind==="record"?t.record:{phase:"malformed",mtimeMs:t.kind==="invalid"?t.mtimeMs:Date.now()}}async function gme(t,e,n){let r=await ox({mutationPath:t.startupLockMutation,ownerId:n,operation:"release-starting"});if(r.kind==="acquired")try{let i=await Gu(t);i.kind==="record"&&i.record.phase==="starting"&&i.record.lockId===e&&i.record.adapterId===n&&await rO(t.startupLock).catch(a=>{if(a.code!=="ENOENT")throw a})}finally{await r.release()}}async function VB(t,e,n=Date.now()){await fme(t.runtimeDir,{recursive:!0,mode:448}),process.platform!=="win32"&&await mme(t.runtimeDir,448);let r=await ox({mutationPath:t.startupLockMutation,ownerId:e.adapterId,operation:"elect",pid:process.pid,now:n});if(r.kind!=="acquired")return{kind:"contended",owner:qB(await Gu(t))};let i;try{try{i=await BB(t.startupLock,"wx",384)}catch(s){if(s.code==="EEXIST")return{kind:"contended",owner:qB(await Gu(t))};throw s}let a=pme(),o={schemaVersion:Jf,phase:"starting",lockId:a,pid:e.pid,adapterId:e.adapterId,createdAt:n,deadlineAt:n+Zu};try{await i.writeFile(`${JSON.stringify(o)}
795
1129
  `,"utf8"),await i.sync(),await i.close(),i=void 0}catch(s){throw await i?.close().catch(()=>{}),await rO(t.startupLock).catch(()=>{}),s}return{kind:"acquired",lockId:a,release:()=>gme(t,a,e.adapterId)}}finally{await i?.close().catch(()=>{}),await r.release()}}function hme(t){try{return process.kill(t,0),!0}catch(e){return e.code!=="ESRCH"}}async function WB(t,e={}){let n=e.now??Date.now(),r=await ox({mutationPath:t.startupLockMutation,ownerId:`recovery-${process.pid}`,operation:"recover-stale"});if(r.kind!=="acquired")return!1;try{let i=await Gu(t);if(i.kind==="absent")return!1;let a=i.kind==="invalid"?n-i.mtimeMs>=ex:i.record.phase==="starting"?n>=i.record.deadlineAt:!1;if(i.kind==="record"&&i.record.phase==="ready"){let o=e.probeReadyIdentity;if(!o)return!1;a=!(e.isProcessAlive??hme)(i.record.pid)&&!await o(i.record)}return a?(await rO(t.startupLock).catch(o=>{if(o.code!=="ENOENT")throw o}),!0):!1}finally{await r.release()}}function HB(t){let e=null,n=t.now??Date.now,r=t.discover??(()=>TB({paths:t.paths,adapterId:t.adapterId,expectedPort:t.port,runtimeEnvironment:t.runtimeEnvironment??"release",...t.fetchImpl?{fetchImpl:t.fetchImpl}:{}})),i=s=>{if(s instanceof Ee&&s.code==="bridge_unavailable")return null;throw s instanceof Ee&&s.code==="bridge_identity_mismatch"?new Ee("bridge_port_ownership_conflict",`Configured Bridge port 127.0.0.1:${t.port} failed identity verification; inspect the existing listener`):s},a=async()=>await r().catch(i),o=async()=>{let s=n()+(t.readinessTimeoutMs??Zu),c=await a();if(c)return c;await(t.recoverStaleLock??(()=>WB(t.paths,{probeReadyIdentity:async()=>await r().catch(()=>null)!==null})))();let l=await(t.acquireLock??(()=>VB(t.paths,{pid:t.pid??process.pid,adapterId:t.adapterId})))();if(l.kind==="acquired"){let u=!1;try{let d=await a();if(d)return d;if(await(t.isPortOccupied??eO)(t.port))throw new Ee("bridge_port_ownership_conflict",`Configured Bridge port 127.0.0.1:${t.port} is occupied before authenticated identity verification; inspect the existing listener`);await t.spawnBridge(l.lockId);let m=await tO({discover:a,deadlineAt:s,now:n,...t.sleep?{sleep:t.sleep}:{}});return u=!0,m}finally{u||await l.release()}}try{return await tO({discover:a,deadlineAt:s,now:n,...t.sleep?{sleep:t.sleep}:{}})}catch(u){if(u instanceof Ee&&u.code==="bridge_readiness_timeout"&&l.owner.phase==="ready"){let{lockId:d,instanceId:p}=l.owner;if(await Gu(t.paths).then(f=>f.kind==="record"&&f.record.phase==="ready"&&f.record.lockId===d&&f.record.instanceId===p,()=>!1)&&await(t.isPortOccupied??eO)(t.port))throw new Ee("bridge_port_ownership_conflict",`Configured Bridge port 127.0.0.1:${t.port} is occupied but failed identity verification; inspect the existing listener`)}throw u}};return()=>(e??=o().finally(()=>{e=null}),e)}import{spawn as yme}from"node:child_process";import{chmod as vme,mkdir as bme,open as _me}from"node:fs/promises";import{dirname as Sme}from"node:path";var xme="WEPPY_BRIDGE_STARTUP_LOCK_ID";function wme(t,e,n){let r=t.endsWith(".ts")?process.execArgv:[],i=yme(process.execPath,[...r,t,"--bridge-runtime"],{detached:!0,windowsHide:!0,shell:!1,stdio:["ignore",e,e],env:n});return i.unref(),i}async function ZB(t){await bme(Sme(t.logFile),{recursive:!0,mode:448});let e=await _me(t.logFile,"a",384);process.platform!=="win32"&&await vme(t.logFile,384);try{let n=wme(t.entryPath,e.fd,{...t.env,[xme]:t.lockId});return await new Promise((r,i)=>{let a=()=>{n.off("error",o),r()},o=s=>{n.off("spawn",a),i(s)};n.once("spawn",a),n.once("error",o)}),n}finally{await e.close()}}var sx=class{constructor(e){this.options=e}current=null;registration=null;recoveryPromise=null;closed=!1;async ensureReady(){await this.recover()}async register(e){let n=await this.recover();try{await n.client.register(e),this.registration={...e}}catch(r){if(!this.isRecoverable(r))throw r;this.registration={...e},await this.startRecovery()}}async heartbeat(){try{await(await this.requireCurrent()).client.heartbeat()}catch(e){throw this.isRecoverable(e)&&this.startRecovery().catch(()=>{}),e}}async execute(e){let n=this.options.now??Date.now,r=n();try{return await(await this.requireCurrent()).client.execute(e)}catch(i){if(!this.isRecoverable(i))throw i;let a=this.startRecovery();if(e.executionMode==="mutating")return a.catch(()=>{}),{requestId:e.requestId,success:!1,error:"Bridge connection ended before mutation completion was confirmed",errorCode:"bridge_request_indeterminate",indeterminate:!0};let o=e.timeoutMs-(n()-r);if(o<=0)return this.readinessTimeoutResult(e.requestId);let s=await this.waitForRecovery(a,o);if(!s)return this.readinessTimeoutResult(e.requestId);let c=e.timeoutMs-(n()-r);return c<=0?this.readinessTimeoutResult(e.requestId):await s.client.execute({...e,timeoutMs:c})}}async unregister(){this.current&&(await this.current.client.unregister(),this.registration=null)}close(){this.closed=!0,this.current?.client.close(),this.current=null}async requireCurrent(){if(this.closed)throw new Ee("bridge_unavailable","Bridge recovery coordinator is closed");return this.current??await this.recover()}recover(){return this.current?Promise.resolve(this.current):this.recoveryPromise??this.startRecovery()}startRecovery(){return this.current=null,this.recoveryPromise??=(async()=>{let e=await this.options.ensureBridge();if(this.closed)throw e.client.close(),new Ee("bridge_unavailable","Bridge recovery coordinator is closed");return this.registration&&await e.client.register(this.registration),this.current=e,e})().finally(()=>{this.recoveryPromise=null}),this.recoveryPromise}isRecoverable(e){return e instanceof Ee&&e.code==="bridge_unavailable"}async waitForRecovery(e,n){let r;try{return await Promise.race([e,new Promise(i=>{r=setTimeout(()=>i(null),n),r.unref()})])}finally{r&&clearTimeout(r)}}readinessTimeoutResult(e){return{requestId:e,success:!1,error:"Bridge recovery exceeded the request timeout",errorCode:"bridge_readiness_timeout"}}};function GB(){return process.env.CLAUDECODE||process.env.CLAUDE_CODE_ENTRYPOINT?{name:"Claude Code",version:""}:process.env.CURSOR_EDITOR?{name:"Cursor",version:""}:process.env.WINDSURF_EDITOR?{name:"Windsurf",version:""}:process.env.CONTINUE_GLOBAL_DIR?{name:"Continue",version:""}:process.env.CLINE_CONTEXT?{name:"Cline",version:""}:null}It();It();function cx(t){return{...t}}var lx=class{constructor(e){this.leaseDurationMs=e;if(!Number.isFinite(e)||e<=0)throw new Error("Adapter lease duration must be positive")}leases=new Map;register(e,n=Date.now()){let r=this.leases.get(e.adapterId),i={...e,registeredAt:r?.registeredAt??n,lastSeen:n,leaseExpiresAt:n+this.leaseDurationMs,...r?.lastCommandAt!==void 0?{lastCommandAt:r.lastCommandAt}:{}};return this.leases.set(e.adapterId,i),cx(i)}heartbeat(e,n=Date.now()){let r=this.getActiveLease(e,n);return r?(r.lastSeen=n,r.leaseExpiresAt=n+this.leaseDurationMs,cx(r)):null}unregister(e){return this.leases.delete(e)}pruneExpired(e=Date.now()){let n=[];for(let[r,i]of this.leases)i.leaseExpiresAt>e||(this.leases.delete(r),n.push(r));return n}listActive(e=Date.now()){return this.pruneExpired(e),[...this.leases.values()].sort((n,r)=>n.registeredAt-r.registeredAt||n.adapterId.localeCompare(r.adapterId)).map(cx)}countActive(e=Date.now()){return this.listActive(e).length}getActive(e,n=Date.now()){let r=this.getActiveLease(e,n);return r?cx(r):null}getActiveLease(e,n){let r=this.leases.get(e);return r?r.leaseExpiresAt<=n?(this.leases.delete(e),null):r:null}noteCommand(e,n=Date.now()){let r=this.getActiveLease(e,n);r&&(r.lastCommandAt=n,r.lastSeen=n,r.leaseExpiresAt=n+this.leaseDurationMs)}resolveSyncOwner(e=Date.now()){let n=this.listActive(e);return n.sort((r,i)=>{let a=r.lastCommandAt??r.registeredAt;return(i.lastCommandAt??i.registeredAt)-a||r.adapterId.localeCompare(i.adapterId)}),n[0]??null}};Ka();import*as Sy from"path";import*as $ee from"os";import{randomUUID as wLe}from"crypto";import{fileURLToPath as ILe}from"url";var Rj=Zt(Qa(),1);Ka();pe();eo();import*as XP from"path";import{fileURLToPath as oNe}from"url";import{randomUUID as sNe}from"crypto";import{createServer as cNe}from"http";pe();function bn(t,e,n,r){let i=typeof t=="string"?parseInt(t,10):NaN,a=Number.isFinite(i)?i:e;return n!==void 0&&(a=Math.max(a,n)),r!==void 0&&(a=Math.min(a,r)),a}eo();en();en();mr();import*as iI from"fs";import*as Qc from"path";function Xc(t){let e=mPe(t);return e===null?null:e===".gitignore"||e==="sourcemap.json"||/^place_[^/]+\/sourcemap\.json$/.test(e)?"generated":/(^|\/)(?:\.sync-index|\.sync-meta|\.project-meta|\.sync-config)\.json$/.test(e)||/(^|\/)observability(?:\/|$)/.test(e)||/(^|\/)\.sync-migration-(?:backups|stage)(?:\/|$)/.test(e)?"runtime":/^place_[^/]+\/explorer\/.+\.(?:server|client|module)\.luau$/.test(e)?"user_source":/^place_[^/]+\/explorer\/.+(?:_tree|\.props|\.value)\.json$/.test(e)?"canonical_mirror":null}function mPe(t){let e=t.replaceAll("\\","/").replace(/^\.\/+/,"");return e.length===0||e.startsWith("/")||/^[A-Za-z]:\//.test(e)||e.split("/").includes("..")?null:e}var pH=5*60*1e3,fPe=2*60*1e3,gPe=-1;function fH(t){let e=[];for(let n of t.split(`
796
1130
  `)){let r=n.trim();if(!(!r||r.startsWith("#")))try{e.push(JSON.parse(r))}catch{}}return e}function gH(t){for(let e of t.split(`