@aaac/runtime 0.2.10 → 0.3.0

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.
@@ -1046,7 +1046,7 @@ Common options for all commands:
1046
1046
 
1047
1047
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let s=o[1];if(t===o[0]){a(o);continue}if(e.external){let l=e.external.registry.get(o[0])?.id;if(t!==o[0]&&l){a(o);continue}}if(e.metadataRegistry.get(o[0])?.id){a(o);continue}if(s.cycle){a(o);continue}if(s.count>1&&e.reused==="ref"){a(o);continue}}}function To(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=s=>{let u=e.seen.get(s);if(u.ref===null)return;let l=u.def??u.schema,c={...l},d=u.ref;if(u.ref=null,d){i(d);let f=e.seen.get(d),m=f.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):Object.assign(l,m),Object.assign(l,c),s._zod.parent===d)for(let v in l)v==="$ref"||v==="allOf"||v in c||delete l[v];if(m.$ref&&f.def)for(let v in l)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(l[v])===JSON.stringify(f.def[v])&&delete l[v]}let p=s._zod.parent;if(p&&p!==d){i(p);let f=e.seen.get(p);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let m in l)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(l[m])===JSON.stringify(f.def[m])&&delete l[m]}e.override({zodSchema:s,jsonSchema:l,path:u.path??[]})};for(let s of[...e.seen.entries()].reverse())i(s[0]);let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(s)}Object.assign(r,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&r.id===a&&delete r.id;let o=e.external?.defs??{};for(let s of e.seen.entries()){let u=s[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,o[u.defId]=u.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?r.$defs=o:r.definitions=o);try{let s=JSON.parse(JSON.stringify(r));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yu(t,"input",e.processors),output:Yu(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Vn(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Vn(i.element,n);if(i.type==="set")return Vn(i.valueType,n);if(i.type==="lazy")return Vn(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Vn(i.innerType,n);if(i.type==="intersection")return Vn(i.left,n)||Vn(i.right,n);if(i.type==="record"||i.type==="map")return Vn(i.keyType,n)||Vn(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Vn(i.in,n)||Vn(i.out,n);if(i.type==="object"){for(let r in i.shape)if(Vn(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(Vn(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(Vn(r,n))return!0;return!!(i.rest&&Vn(i.rest,n))}return!1}var R3=(e,t={})=>n=>{let i=Bo({...n,processors:t});return Er(e,i),No(i,e),To(i,e)},Yu=(e,t,n={})=>i=>{let{libraryOptions:r,target:a}=i??{},o=Bo({...r??{},target:a,io:t,processors:n});return Er(e,o),No(o,e),To(o,e)};var Zee={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},z3=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:a,maximum:o,format:s,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof a=="number"&&(r.minLength=a),typeof o=="number"&&(r.maxLength=o),s&&(r.format=Zee[s]??s,r.format===""&&delete r.format,s==="time"&&delete r.format),l&&(r.contentEncoding=l),u&&u.size>0){let c=[...u];c.length===1?r.pattern=c[0].source:c.length>1&&(r.allOf=[...c.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},L3=(e,t,n,i)=>{let r=n,{minimum:a,maximum:o,format:s,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;typeof s=="string"&&s.includes("int")?r.type="integer":r.type="number";let d=typeof c=="number"&&c>=(a??Number.NEGATIVE_INFINITY),p=typeof l=="number"&&l<=(o??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";d?f?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c:typeof a=="number"&&(r.minimum=a),p?f?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:typeof o=="number"&&(r.maximum=o),typeof u=="number"&&(r.multipleOf=u)},M3=(e,t,n,i)=>{n.type="boolean"},U3=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},q3=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},V3=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Z3=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},K3=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},G3=(e,t,n,i)=>{n.not={}},J3=(e,t,n,i)=>{},W3=(e,t,n,i)=>{},H3=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Y3=(e,t,n,i)=>{let r=e._zod.def,a=Cc(r.entries);a.every(o=>typeof o=="number")&&(n.type="number"),a.every(o=>typeof o=="string")&&(n.type="string"),n.enum=a},X3=(e,t,n,i)=>{let r=e._zod.def,a=[];for(let o of r.values)if(o===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(t.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,t.target==="draft-04"||t.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},Q3=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},e2=(e,t,n,i)=>{let r=n,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=a.source},t2=(e,t,n,i)=>{let r=n,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:u}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),u?u.length===1?(a.contentMediaType=u[0],Object.assign(r,a)):(Object.assign(r,a),r.anyOf=u.map(l=>({contentMediaType:l}))):Object.assign(r,a)},r2=(e,t,n,i)=>{n.type="boolean"},n2=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},i2=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},a2=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},o2=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},s2=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},u2=(e,t,n,i)=>{let r=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o=="number"&&(r.minItems=o),typeof s=="number"&&(r.maxItems=s),r.type="array",r.items=Er(a.element,t,{...i,path:[...i.path,"items"]})},l2=(e,t,n,i)=>{let r=n,a=e._zod.def;r.type="object",r.properties={};let o=a.shape;for(let l in o)r.properties[l]=Er(o[l],t,{...i,path:[...i.path,"properties",l]});let s=new Set(Object.keys(o)),u=new Set([...s].filter(l=>{let c=a.shape[l]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));u.size>0&&(r.required=Array.from(u)),a.catchall?._zod.def.type==="never"?r.additionalProperties=!1:a.catchall?a.catchall&&(r.additionalProperties=Er(a.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},em=(e,t,n,i)=>{let r=e._zod.def,a=r.inclusive===!1,o=r.options.map((s,u)=>Er(s,t,{...i,path:[...i.path,a?"oneOf":"anyOf",u]}));a?n.oneOf=o:n.anyOf=o},c2=(e,t,n,i)=>{let r=e._zod.def,a=Er(r.left,t,{...i,path:[...i.path,"allOf",0]}),o=Er(r.right,t,{...i,path:[...i.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,u=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=u},d2=(e,t,n,i)=>{let r=n,a=e._zod.def;r.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=a.items.map((p,f)=>Er(p,t,{...i,path:[...i.path,o,f]})),l=a.rest?Er(a.rest,t,{...i,path:[...i.path,s,...t.target==="openapi-3.0"?[a.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=u,l&&(r.items=l)):t.target==="openapi-3.0"?(r.items={anyOf:u},l&&r.items.anyOf.push(l),r.minItems=u.length,l||(r.maxItems=u.length)):(r.items=u,l&&(r.additionalItems=l));let{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(r.minItems=c),typeof d=="number"&&(r.maxItems=d)},p2=(e,t,n,i)=>{let r=n,a=e._zod.def;r.type="object";let o=a.keyType,u=o._zod.bag?.patterns;if(a.mode==="loose"&&u&&u.size>0){let c=Er(a.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let d of u)r.patternProperties[d.source]=c}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=Er(a.keyType,t,{...i,path:[...i.path,"propertyNames"]})),r.additionalProperties=Er(a.valueType,t,{...i,path:[...i.path,"additionalProperties"]});let l=o._zod.values;if(l){let c=[...l].filter(d=>typeof d=="string"||typeof d=="number");c.length>0&&(r.required=c)}},f2=(e,t,n,i)=>{let r=e._zod.def,a=Er(r.innerType,t,i),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=r.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},m2=(e,t,n,i)=>{let r=e._zod.def;Er(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType},h2=(e,t,n,i)=>{let r=e._zod.def;Er(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},g2=(e,t,n,i)=>{let r=e._zod.def;Er(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},v2=(e,t,n,i)=>{let r=e._zod.def;Er(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType;let o;try{o=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o},y2=(e,t,n,i)=>{let r=e._zod.def,a=r.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?a?r.out:r.in:r.out;Er(o,t,i);let s=t.seen.get(e);s.ref=o},_2=(e,t,n,i)=>{let r=e._zod.def;Er(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType,n.readOnly=!0},b2=(e,t,n,i)=>{let r=e._zod.def;Er(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType},tm=(e,t,n,i)=>{let r=e._zod.def;Er(r.innerType,t,i);let a=t.seen.get(e);a.ref=r.innerType},w2=(e,t,n,i)=>{let r=e._zod.innerType;Er(r,t,i);let a=t.seen.get(e);a.ref=r},Q0={string:z3,number:L3,boolean:M3,bigint:U3,symbol:q3,null:V3,undefined:Z3,void:K3,never:G3,any:J3,unknown:W3,date:H3,enum:Y3,literal:X3,nan:Q3,template_literal:e2,file:t2,success:r2,custom:n2,function:i2,transform:a2,map:o2,set:s2,array:u2,object:l2,union:em,intersection:c2,tuple:d2,record:p2,nullable:f2,nonoptional:m2,default:h2,prefault:g2,catch:v2,pipe:y2,readonly:_2,promise:b2,optional:tm,lazy:w2};function rm(e,t){if("_idmap"in e){let i=e,r=Bo({...t,processors:Q0}),a={};for(let u of i._idmap.entries()){let[l,c]=u;Er(c,r)}let o={},s={registry:i,uri:t?.uri,defs:a};r.external=s;for(let u of i._idmap.entries()){let[l,c]=u;No(r,c),o[l]=To(r,c)}if(Object.keys(a).length>0){let u=r.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[u]:a}}return{schemas:o}}let n=Bo({...t,processors:Q0});return Er(e,n),No(n,e),To(n,e)}var nm=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(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Bo({processors:Q0,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return Er(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),No(this.ctx,t);let i=To(this.ctx,t),{"~standard":r,...a}=i;return a}};var gC={};var Vc={};ga(Vc,{ZodAny:()=>Z2,ZodArray:()=>W2,ZodBase64:()=>Sm,ZodBase64URL:()=>Am,ZodBigInt:()=>al,ZodBigIntFormat:()=>Dm,ZodBoolean:()=>il,ZodCIDRv4:()=>Em,ZodCIDRv6:()=>$m,ZodCUID:()=>hm,ZodCUID2:()=>gm,ZodCatch:()=>v_,ZodCodec:()=>rd,ZodCustom:()=>nd,ZodCustomStringFormat:()=>rl,ZodDate:()=>Yc,ZodDefault:()=>d_,ZodDiscriminatedUnion:()=>Y2,ZodE164:()=>Cm,ZodEmail:()=>pm,ZodEmoji:()=>fm,ZodEnum:()=>el,ZodExactOptional:()=>u_,ZodFile:()=>o_,ZodFunction:()=>k_,ZodGUID:()=>Kc,ZodIPv4:()=>bm,ZodIPv6:()=>wm,ZodIntersection:()=>X2,ZodJWT:()=>km,ZodKSUID:()=>_m,ZodLazy:()=>S_,ZodLiteral:()=>a_,ZodMAC:()=>R2,ZodMap:()=>n_,ZodNaN:()=>__,ZodNanoID:()=>mm,ZodNever:()=>G2,ZodNonOptional:()=>Bm,ZodNull:()=>q2,ZodNullable:()=>c_,ZodNumber:()=>nl,ZodNumberFormat:()=>Os,ZodObject:()=>Qc,ZodOptional:()=>jm,ZodPipe:()=>td,ZodPrefault:()=>f_,ZodPreprocess:()=>b_,ZodPromise:()=>C_,ZodReadonly:()=>w_,ZodRecord:()=>Qu,ZodSet:()=>i_,ZodString:()=>tl,ZodStringFormat:()=>Or,ZodSuccess:()=>g_,ZodSymbol:()=>M2,ZodTemplateLiteral:()=>$_,ZodTransform:()=>s_,ZodTuple:()=>e_,ZodType:()=>tr,ZodULID:()=>vm,ZodURL:()=>Hc,ZodUUID:()=>ba,ZodUndefined:()=>U2,ZodUnion:()=>ed,ZodUnknown:()=>K2,ZodVoid:()=>J2,ZodXID:()=>ym,ZodXor:()=>H2,_ZodString:()=>dm,_default:()=>p_,_function:()=>Ak,any:()=>rk,array:()=>Xc,base64:()=>zC,base64url:()=>LC,bigint:()=>YC,boolean:()=>L2,catch:()=>y_,check:()=>Ck,cidrv4:()=>FC,cidrv6:()=>RC,codec:()=>wk,cuid:()=>xC,cuid2:()=>OC,custom:()=>kk,date:()=>ik,describe:()=>Dk,discriminatedUnion:()=>ck,e164:()=>MC,email:()=>_C,emoji:()=>kC,enum:()=>Im,exactOptional:()=>l_,file:()=>vk,float32:()=>GC,float64:()=>JC,function:()=>Ak,guid:()=>bC,hash:()=>KC,hex:()=>ZC,hostname:()=>VC,httpUrl:()=>CC,instanceof:()=>Ok,int:()=>lm,int32:()=>WC,int64:()=>XC,intersection:()=>Q2,invertCodec:()=>Ek,ipv4:()=>BC,ipv6:()=>TC,json:()=>Pk,jwt:()=>UC,keyof:()=>ak,ksuid:()=>jC,lazy:()=>A_,literal:()=>gk,looseObject:()=>uk,looseRecord:()=>pk,mac:()=>NC,map:()=>fk,meta:()=>xk,nan:()=>bk,nanoid:()=>DC,nativeEnum:()=>hk,never:()=>xm,nonoptional:()=>h_,null:()=>V2,nullable:()=>Jc,nullish:()=>yk,number:()=>z2,object:()=>ok,optional:()=>Gc,partialRecord:()=>dk,pipe:()=>cm,prefault:()=>m_,preprocess:()=>jk,promise:()=>Sk,readonly:()=>E_,record:()=>r_,refine:()=>D_,set:()=>mk,strictObject:()=>sk,string:()=>Zc,stringFormat:()=>qC,stringbool:()=>Ik,success:()=>_k,superRefine:()=>x_,symbol:()=>ek,templateLiteral:()=>$k,transform:()=>Pm,tuple:()=>t_,uint32:()=>HC,uint64:()=>QC,ulid:()=>IC,undefined:()=>tk,union:()=>Om,unknown:()=>xs,url:()=>AC,uuid:()=>wC,uuidv4:()=>EC,uuidv6:()=>$C,uuidv7:()=>SC,void:()=>nk,xid:()=>PC,xor:()=>lk});var im={};ga(im,{endsWith:()=>qu,gt:()=>ya,gte:()=>qn,includes:()=>Mu,length:()=>Ds,lowercase:()=>zu,lt:()=>va,lte:()=>wi,maxLength:()=>ks,maxSize:()=>jo,mime:()=>Vu,minLength:()=>Ka,minSize:()=>_a,multipleOf:()=>Po,negative:()=>W0,nonnegative:()=>Y0,nonpositive:()=>H0,normalize:()=>Zu,overwrite:()=>ra,positive:()=>J0,property:()=>X0,regex:()=>Ru,size:()=>Cs,slugify:()=>Wu,startsWith:()=>Uu,toLowerCase:()=>Gu,toUpperCase:()=>Ju,trim:()=>Ku,uppercase:()=>Lu});var Xu={};ga(Xu,{ZodISODate:()=>om,ZodISODateTime:()=>am,ZodISODuration:()=>um,ZodISOTime:()=>sm,date:()=>$2,datetime:()=>E2,duration:()=>A2,time:()=>S2});var am=Ne("ZodISODateTime",(e,t)=>{Q6.init(e,t),Or.init(e,t)});function E2(e){return n3(am,e)}var om=Ne("ZodISODate",(e,t)=>{ey.init(e,t),Or.init(e,t)});function $2(e){return i3(om,e)}var sm=Ne("ZodISOTime",(e,t)=>{ty.init(e,t),Or.init(e,t)});function S2(e){return a3(sm,e)}var um=Ne("ZodISODuration",(e,t)=>{ry.init(e,t),Or.init(e,t)});function A2(e){return o3(um,e)}var vC=(e,t)=>{Ic.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>jc(e,n)},flatten:{value:n=>Pc(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,xu,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,xu,2)}},isEmpty:{get(){return e.issues.length===0}}})},Gee=Ne("ZodError",vC),ri=Ne("ZodError",vC,{Parent:Error});var C2=Pu(ri),k2=ju(ri),D2=Bu(ri),x2=Nu(ri),O2=r0(ri),I2=n0(ri),P2=i0(ri),j2=a0(ri),B2=o0(ri),N2=s0(ri),T2=u0(ri),F2=l0(ri);var yC=new WeakMap;function Wc(e,t,n){let i=Object.getPrototypeOf(e),r=yC.get(i);if(r||(r=new Set,yC.set(i,r)),!r.has(t)){r.add(t);for(let a in n){let o=n[a];Object.defineProperty(i,a,{configurable:!0,enumerable:!1,get(){let s=o.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}}var tr=Ne("ZodType",(e,t)=>(Wt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yu(e,"input"),output:Yu(e,"output")}}),e.toJSONSchema=R3(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>C2(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>D2(e,n,i),e.parseAsync=async(n,i)=>k2(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>x2(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>O2(e,n,i),e.decode=(n,i)=>I2(e,n,i),e.encodeAsync=async(n,i)=>P2(e,n,i),e.decodeAsync=async(n,i)=>j2(e,n,i),e.safeEncode=(n,i)=>B2(e,n,i),e.safeDecode=(n,i)=>N2(e,n,i),e.safeEncodeAsync=async(n,i)=>T2(e,n,i),e.safeDecodeAsync=async(n,i)=>F2(e,n,i),Wc(e,"ZodType",{check(...n){let i=this.def;return this.clone(ct.mergeDefs(i,{checks:[...i.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return Mn(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(D_(n,i))},superRefine(n,i){return this.check(x_(n,i))},overwrite(n){return this.check(ra(n))},optional(){return Gc(this)},exactOptional(){return l_(this)},nullable(){return Jc(this)},nullish(){return Gc(Jc(this))},nonoptional(n){return h_(this,n)},array(){return Xc(this)},or(n){return Om([this,n])},and(n){return Q2(this,n)},transform(n){return cm(this,Pm(n))},default(n){return p_(this,n)},prefault(n){return m_(this,n)},catch(n){return y_(this,n)},pipe(n){return cm(this,n)},readonly(){return E_(this)},describe(n){let i=this.clone();return $n.add(i,{description:n}),i},meta(...n){if(n.length===0)return $n.get(this);let i=this.clone();return $n.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return $n.get(e)?.description},configurable:!0}),e)),dm=Ne("_ZodString",(e,t)=>{As.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(i,r,a)=>z3(e,i,r,a);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Wc(e,"_ZodString",{regex(...i){return this.check(Ru(...i))},includes(...i){return this.check(Mu(...i))},startsWith(...i){return this.check(Uu(...i))},endsWith(...i){return this.check(qu(...i))},min(...i){return this.check(Ka(...i))},max(...i){return this.check(ks(...i))},length(...i){return this.check(Ds(...i))},nonempty(...i){return this.check(Ka(1,...i))},lowercase(i){return this.check(zu(i))},uppercase(i){return this.check(Lu(i))},trim(){return this.check(Ku())},normalize(...i){return this.check(Zu(...i))},toLowerCase(){return this.check(Gu())},toUpperCase(){return this.check(Ju())},slugify(){return this.check(Wu())}})}),tl=Ne("ZodString",(e,t)=>{As.init(e,t),dm.init(e,t),e.email=n=>e.check(D0(pm,n)),e.url=n=>e.check(qc(Hc,n)),e.jwt=n=>e.check(G0(km,n)),e.emoji=n=>e.check(j0(fm,n)),e.guid=n=>e.check(Uc(Kc,n)),e.uuid=n=>e.check(x0(ba,n)),e.uuidv4=n=>e.check(O0(ba,n)),e.uuidv6=n=>e.check(I0(ba,n)),e.uuidv7=n=>e.check(P0(ba,n)),e.nanoid=n=>e.check(B0(mm,n)),e.guid=n=>e.check(Uc(Kc,n)),e.cuid=n=>e.check(N0(hm,n)),e.cuid2=n=>e.check(T0(gm,n)),e.ulid=n=>e.check(F0(vm,n)),e.base64=n=>e.check(V0(Sm,n)),e.base64url=n=>e.check(Z0(Am,n)),e.xid=n=>e.check(R0(ym,n)),e.ksuid=n=>e.check(z0(_m,n)),e.ipv4=n=>e.check(L0(bm,n)),e.ipv6=n=>e.check(M0(wm,n)),e.cidrv4=n=>e.check(U0(Em,n)),e.cidrv6=n=>e.check(q0($m,n)),e.e164=n=>e.check(K0(Cm,n)),e.datetime=n=>e.check(E2(n)),e.date=n=>e.check($2(n)),e.time=n=>e.check(S2(n)),e.duration=n=>e.check(A2(n))});function Zc(e){return Qy(tl,e)}var Or=Ne("ZodStringFormat",(e,t)=>{xr.init(e,t),dm.init(e,t)}),pm=Ne("ZodEmail",(e,t)=>{V6.init(e,t),Or.init(e,t)});function _C(e){return D0(pm,e)}var Kc=Ne("ZodGUID",(e,t)=>{U6.init(e,t),Or.init(e,t)});function bC(e){return Uc(Kc,e)}var ba=Ne("ZodUUID",(e,t)=>{q6.init(e,t),Or.init(e,t)});function wC(e){return x0(ba,e)}function EC(e){return O0(ba,e)}function $C(e){return I0(ba,e)}function SC(e){return P0(ba,e)}var Hc=Ne("ZodURL",(e,t)=>{Z6.init(e,t),Or.init(e,t)});function AC(e){return qc(Hc,e)}function CC(e){return qc(Hc,{protocol:bi.httpProtocol,hostname:bi.domain,...ct.normalizeParams(e)})}var fm=Ne("ZodEmoji",(e,t)=>{K6.init(e,t),Or.init(e,t)});function kC(e){return j0(fm,e)}var mm=Ne("ZodNanoID",(e,t)=>{G6.init(e,t),Or.init(e,t)});function DC(e){return B0(mm,e)}var hm=Ne("ZodCUID",(e,t)=>{J6.init(e,t),Or.init(e,t)});function xC(e){return N0(hm,e)}var gm=Ne("ZodCUID2",(e,t)=>{W6.init(e,t),Or.init(e,t)});function OC(e){return T0(gm,e)}var vm=Ne("ZodULID",(e,t)=>{H6.init(e,t),Or.init(e,t)});function IC(e){return F0(vm,e)}var ym=Ne("ZodXID",(e,t)=>{Y6.init(e,t),Or.init(e,t)});function PC(e){return R0(ym,e)}var _m=Ne("ZodKSUID",(e,t)=>{X6.init(e,t),Or.init(e,t)});function jC(e){return z0(_m,e)}var bm=Ne("ZodIPv4",(e,t)=>{ny.init(e,t),Or.init(e,t)});function BC(e){return L0(bm,e)}var R2=Ne("ZodMAC",(e,t)=>{ay.init(e,t),Or.init(e,t)});function NC(e){return t3(R2,e)}var wm=Ne("ZodIPv6",(e,t)=>{iy.init(e,t),Or.init(e,t)});function TC(e){return M0(wm,e)}var Em=Ne("ZodCIDRv4",(e,t)=>{oy.init(e,t),Or.init(e,t)});function FC(e){return U0(Em,e)}var $m=Ne("ZodCIDRv6",(e,t)=>{sy.init(e,t),Or.init(e,t)});function RC(e){return q0($m,e)}var Sm=Ne("ZodBase64",(e,t)=>{ly.init(e,t),Or.init(e,t)});function zC(e){return V0(Sm,e)}var Am=Ne("ZodBase64URL",(e,t)=>{cy.init(e,t),Or.init(e,t)});function LC(e){return Z0(Am,e)}var Cm=Ne("ZodE164",(e,t)=>{dy.init(e,t),Or.init(e,t)});function MC(e){return K0(Cm,e)}var km=Ne("ZodJWT",(e,t)=>{py.init(e,t),Or.init(e,t)});function UC(e){return G0(km,e)}var rl=Ne("ZodCustomStringFormat",(e,t)=>{fy.init(e,t),Or.init(e,t)});function qC(e,t,n={}){return Hu(rl,e,t,n)}function VC(e){return Hu(rl,"hostname",bi.hostname,e)}function ZC(e){return Hu(rl,"hex",bi.hex,e)}function KC(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=bi[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return Hu(rl,i,r,t)}var nl=Ne("ZodNumber",(e,t)=>{y0.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(i,r,a)=>L3(e,i,r,a),Wc(e,"ZodNumber",{gt(i,r){return this.check(ya(i,r))},gte(i,r){return this.check(qn(i,r))},min(i,r){return this.check(qn(i,r))},lt(i,r){return this.check(va(i,r))},lte(i,r){return this.check(wi(i,r))},max(i,r){return this.check(wi(i,r))},int(i){return this.check(lm(i))},safe(i){return this.check(lm(i))},positive(i){return this.check(ya(0,i))},nonnegative(i){return this.check(qn(0,i))},negative(i){return this.check(va(0,i))},nonpositive(i){return this.check(wi(0,i))},multipleOf(i,r){return this.check(Po(i,r))},step(i,r){return this.check(Po(i,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function z2(e){return s3(nl,e)}var Os=Ne("ZodNumberFormat",(e,t)=>{my.init(e,t),nl.init(e,t)});function lm(e){return l3(Os,e)}function GC(e){return c3(Os,e)}function JC(e){return d3(Os,e)}function WC(e){return p3(Os,e)}function HC(e){return f3(Os,e)}var il=Ne("ZodBoolean",(e,t)=>{Fc.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>M3(e,n,i,r)});function L2(e){return m3(il,e)}var al=Ne("ZodBigInt",(e,t)=>{_0.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(i,r,a)=>U3(e,i,r,a),e.gte=(i,r)=>e.check(qn(i,r)),e.min=(i,r)=>e.check(qn(i,r)),e.gt=(i,r)=>e.check(ya(i,r)),e.gte=(i,r)=>e.check(qn(i,r)),e.min=(i,r)=>e.check(qn(i,r)),e.lt=(i,r)=>e.check(va(i,r)),e.lte=(i,r)=>e.check(wi(i,r)),e.max=(i,r)=>e.check(wi(i,r)),e.positive=i=>e.check(ya(BigInt(0),i)),e.negative=i=>e.check(va(BigInt(0),i)),e.nonpositive=i=>e.check(wi(BigInt(0),i)),e.nonnegative=i=>e.check(qn(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(Po(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function YC(e){return g3(al,e)}var Dm=Ne("ZodBigIntFormat",(e,t)=>{hy.init(e,t),al.init(e,t)});function XC(e){return y3(Dm,e)}function QC(e){return _3(Dm,e)}var M2=Ne("ZodSymbol",(e,t)=>{gy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>q3(e,n,i,r)});function ek(e){return b3(M2,e)}var U2=Ne("ZodUndefined",(e,t)=>{vy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Z3(e,n,i,r)});function tk(e){return w3(U2,e)}var q2=Ne("ZodNull",(e,t)=>{yy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>V3(e,n,i,r)});function V2(e){return E3(q2,e)}var Z2=Ne("ZodAny",(e,t)=>{_y.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>J3(e,n,i,r)});function rk(){return $3(Z2)}var K2=Ne("ZodUnknown",(e,t)=>{by.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>W3(e,n,i,r)});function xs(){return S3(K2)}var G2=Ne("ZodNever",(e,t)=>{wy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>G3(e,n,i,r)});function xm(e){return A3(G2,e)}var J2=Ne("ZodVoid",(e,t)=>{Ey.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>K3(e,n,i,r)});function nk(e){return C3(J2,e)}var Yc=Ne("ZodDate",(e,t)=>{$y.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(i,r,a)=>H3(e,i,r,a),e.min=(i,r)=>e.check(qn(i,r)),e.max=(i,r)=>e.check(wi(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function ik(e){return k3(Yc,e)}var W2=Ne("ZodArray",(e,t)=>{Sy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>u2(e,n,i,r),e.element=t.element,Wc(e,"ZodArray",{min(n,i){return this.check(Ka(n,i))},nonempty(n){return this.check(Ka(1,n))},max(n,i){return this.check(ks(n,i))},length(n,i){return this.check(Ds(n,i))},unwrap(){return this.element}})});function Xc(e,t){return O3(W2,e,t)}function ak(e){let t=e._zod.def.shape;return Im(Object.keys(t))}var Qc=Ne("ZodObject",(e,t)=>{Ay.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>l2(e,n,i,r),ct.defineLazy(e,"shape",()=>t.shape),Wc(e,"ZodObject",{keyof(){return Im(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:xs()})},loose(){return this.clone({...this._zod.def,catchall:xs()})},strict(){return this.clone({...this._zod.def,catchall:xm()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return ct.extend(this,n)},safeExtend(n){return ct.safeExtend(this,n)},merge(n){return ct.merge(this,n)},pick(n){return ct.pick(this,n)},omit(n){return ct.omit(this,n)},partial(...n){return ct.partial(jm,this,n[0])},required(...n){return ct.required(Bm,this,n[0])}})});function ok(e,t){let n={type:"object",shape:e??{},...ct.normalizeParams(t)};return new Qc(n)}function sk(e,t){return new Qc({type:"object",shape:e,catchall:xm(),...ct.normalizeParams(t)})}function uk(e,t){return new Qc({type:"object",shape:e,catchall:xs(),...ct.normalizeParams(t)})}var ed=Ne("ZodUnion",(e,t)=>{Rc.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>em(e,n,i,r),e.options=t.options});function Om(e,t){return new ed({type:"union",options:e,...ct.normalizeParams(t)})}var H2=Ne("ZodXor",(e,t)=>{ed.init(e,t),Cy.init(e,t),e._zod.processJSONSchema=(n,i,r)=>em(e,n,i,r),e.options=t.options});function lk(e,t){return new H2({type:"union",options:e,inclusive:!1,...ct.normalizeParams(t)})}var Y2=Ne("ZodDiscriminatedUnion",(e,t)=>{ed.init(e,t),ky.init(e,t)});function ck(e,t,n){return new Y2({type:"union",options:t,discriminator:e,...ct.normalizeParams(n)})}var X2=Ne("ZodIntersection",(e,t)=>{Dy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>c2(e,n,i,r)});function Q2(e,t){return new X2({type:"intersection",left:e,right:t})}var e_=Ne("ZodTuple",(e,t)=>{b0.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>d2(e,n,i,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function t_(e,t,n){let i=t instanceof Wt,r=i?n:t,a=i?t:null;return new e_({type:"tuple",items:e,rest:a,...ct.normalizeParams(r)})}var Qu=Ne("ZodRecord",(e,t)=>{xy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>p2(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function r_(e,t,n){return!t||!t._zod?new Qu({type:"record",keyType:Zc(),valueType:e,...ct.normalizeParams(t)}):new Qu({type:"record",keyType:e,valueType:t,...ct.normalizeParams(n)})}function dk(e,t,n){let i=Mn(e);return i._zod.values=void 0,new Qu({type:"record",keyType:i,valueType:t,...ct.normalizeParams(n)})}function pk(e,t,n){return new Qu({type:"record",keyType:e,valueType:t,mode:"loose",...ct.normalizeParams(n)})}var n_=Ne("ZodMap",(e,t)=>{Oy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>o2(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(_a(...n)),e.nonempty=n=>e.check(_a(1,n)),e.max=(...n)=>e.check(jo(...n)),e.size=(...n)=>e.check(Cs(...n))});function fk(e,t,n){return new n_({type:"map",keyType:e,valueType:t,...ct.normalizeParams(n)})}var i_=Ne("ZodSet",(e,t)=>{Iy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>s2(e,n,i,r),e.min=(...n)=>e.check(_a(...n)),e.nonempty=n=>e.check(_a(1,n)),e.max=(...n)=>e.check(jo(...n)),e.size=(...n)=>e.check(Cs(...n))});function mk(e,t){return new i_({type:"set",valueType:e,...ct.normalizeParams(t)})}var el=Ne("ZodEnum",(e,t)=>{Py.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(i,r,a)=>Y3(e,i,r,a),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let a={};for(let o of i)if(n.has(o))a[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new el({...t,checks:[],...ct.normalizeParams(r),entries:a})},e.exclude=(i,r)=>{let a={...t.entries};for(let o of i)if(n.has(o))delete a[o];else throw new Error(`Key ${o} not found in enum`);return new el({...t,checks:[],...ct.normalizeParams(r),entries:a})}});function Im(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new el({type:"enum",entries:n,...ct.normalizeParams(t)})}function hk(e,t){return new el({type:"enum",entries:e,...ct.normalizeParams(t)})}var a_=Ne("ZodLiteral",(e,t)=>{jy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>X3(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function gk(e,t){return new a_({type:"literal",values:Array.isArray(e)?e:[e],...ct.normalizeParams(t)})}var o_=Ne("ZodFile",(e,t)=>{By.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>t2(e,n,i,r),e.min=(n,i)=>e.check(_a(n,i)),e.max=(n,i)=>e.check(jo(n,i)),e.mime=(n,i)=>e.check(Vu(Array.isArray(n)?n:[n],i))});function vk(e){return I3(o_,e)}var s_=Ne("ZodTransform",(e,t)=>{Ny.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>a2(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new ko(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(ct.issue(a,n.value,t));else{let o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),n.issues.push(ct.issue(o))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(a=>(n.value=a,n.fallback=!0,n)):(n.value=r,n.fallback=!0,n)}});function Pm(e){return new s_({type:"transform",transform:e})}var jm=Ne("ZodOptional",(e,t)=>{w0.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tm(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new jm({type:"optional",innerType:e})}var u_=Ne("ZodExactOptional",(e,t)=>{Ty.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>tm(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function l_(e){return new u_({type:"optional",innerType:e})}var c_=Ne("ZodNullable",(e,t)=>{Fy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>f2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Jc(e){return new c_({type:"nullable",innerType:e})}function yk(e){return Gc(Jc(e))}var d_=Ne("ZodDefault",(e,t)=>{Ry.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>h2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function p_(e,t){return new d_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ct.shallowClone(t)}})}var f_=Ne("ZodPrefault",(e,t)=>{zy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>g2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function m_(e,t){return new f_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ct.shallowClone(t)}})}var Bm=Ne("ZodNonOptional",(e,t)=>{Ly.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>m2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function h_(e,t){return new Bm({type:"nonoptional",innerType:e,...ct.normalizeParams(t)})}var g_=Ne("ZodSuccess",(e,t)=>{My.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>r2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function _k(e){return new g_({type:"success",innerType:e})}var v_=Ne("ZodCatch",(e,t)=>{Uy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>v2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function y_(e,t){return new v_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var __=Ne("ZodNaN",(e,t)=>{qy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Q3(e,n,i,r)});function bk(e){return x3(__,e)}var td=Ne("ZodPipe",(e,t)=>{E0.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>y2(e,n,i,r),e.in=t.in,e.out=t.out});function cm(e,t){return new td({type:"pipe",in:e,out:t})}var rd=Ne("ZodCodec",(e,t)=>{td.init(e,t),zc.init(e,t)});function wk(e,t,n){return new rd({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function Ek(e){let t=e._zod.def;return new rd({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var b_=Ne("ZodPreprocess",(e,t)=>{td.init(e,t),Vy.init(e,t)}),w_=Ne("ZodReadonly",(e,t)=>{Zy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>_2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function E_(e){return new w_({type:"readonly",innerType:e})}var $_=Ne("ZodTemplateLiteral",(e,t)=>{Ky.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>e2(e,n,i,r)});function $k(e,t){return new $_({type:"template_literal",parts:e,...ct.normalizeParams(t)})}var S_=Ne("ZodLazy",(e,t)=>{Wy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>w2(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function A_(e){return new S_({type:"lazy",getter:e})}var C_=Ne("ZodPromise",(e,t)=>{Jy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>b2(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Sk(e){return new C_({type:"promise",innerType:e})}var k_=Ne("ZodFunction",(e,t)=>{Gy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>i2(e,n,i,r)});function Ak(e){return new k_({type:"function",input:Array.isArray(e?.input)?t_(e?.input):e?.input??Xc(xs()),output:e?.output??xs()})}var nd=Ne("ZodCustom",(e,t)=>{Hy.init(e,t),tr.init(e,t),e._zod.processJSONSchema=(n,i,r)=>n2(e,n,i,r)});function Ck(e){let t=new Pr({check:"custom"});return t._zod.check=e,t}function kk(e,t){return P3(nd,e??(()=>!0),t)}function D_(e,t={}){return j3(nd,e,t)}function x_(e,t){return B3(e,t)}var Dk=N3,xk=T3;function Ok(e,t={}){let n=new nd({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,...ct.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var Ik=(...e)=>F3({Codec:rd,Boolean:il,String:tl},...e);function Pk(e){let t=A_(()=>Om([Zc(e),z2(),L2(),V2(),Xc(t),r_(Zc(),t)]));return t}function jk(e,t){return new b_({type:"pipe",in:Pm(e),out:t})}var Wee={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 Hee(e){Jr({customError:e})}function Yee(){return Jr().customError}var O_;O_||(O_={});var bt={...Vc,...im,iso:Xu},Xee=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 Qee(e,t){let n=e.$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":t??"draft-2020-12"}function ete(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function Bk(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return bt.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return bt.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let a=ete(r,t),o=Pn(a,t);return t.refs.set(r,o),t.processing.delete(r),o}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return bt.null();if(r.length===0)return bt.never();if(r.length===1)return bt.literal(r[0]);if(r.every(o=>typeof o=="string"))return bt.enum(r);let a=r.map(o=>bt.literal(o));return a.length<2?a[0]:bt.union([a[0],a[1],...a.slice(2)])}if(e.const!==void 0)return bt.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(a=>{let o={...e,type:a};return Bk(o,t)});return r.length===0?bt.never():r.length===1?r[0]:bt.union(r)}if(!n)return bt.any();let i;switch(n){case"string":{let r=bt.string();if(e.format){let a=e.format;a==="email"?r=r.check(bt.email()):a==="uri"||a==="uri-reference"?r=r.check(bt.url()):a==="uuid"||a==="guid"?r=r.check(bt.uuid()):a==="date-time"?r=r.check(bt.iso.datetime()):a==="date"?r=r.check(bt.iso.date()):a==="time"?r=r.check(bt.iso.time()):a==="duration"?r=r.check(bt.iso.duration()):a==="ipv4"?r=r.check(bt.ipv4()):a==="ipv6"?r=r.check(bt.ipv6()):a==="mac"?r=r.check(bt.mac()):a==="cidr"?r=r.check(bt.cidrv4()):a==="cidr-v6"?r=r.check(bt.cidrv6()):a==="base64"?r=r.check(bt.base64()):a==="base64url"?r=r.check(bt.base64url()):a==="e164"?r=r.check(bt.e164()):a==="jwt"?r=r.check(bt.jwt()):a==="emoji"?r=r.check(bt.emoji()):a==="nanoid"?r=r.check(bt.nanoid()):a==="cuid"?r=r.check(bt.cuid()):a==="cuid2"?r=r.check(bt.cuid2()):a==="ulid"?r=r.check(bt.ulid()):a==="xid"?r=r.check(bt.xid()):a==="ksuid"&&(r=r.check(bt.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?bt.number().int():bt.number();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=bt.boolean();break}case"null":{i=bt.null();break}case"object":{let r={},a=e.properties||{},o=new Set(e.required||[]);for(let[u,l]of Object.entries(a)){let c=Pn(l,t);r[u]=o.has(u)?c:c.optional()}if(e.propertyNames){let u=Pn(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?Pn(e.additionalProperties,t):bt.any();if(Object.keys(r).length===0){i=bt.record(u,l);break}let c=bt.object(r).passthrough(),d=bt.looseRecord(u,l);i=bt.intersection(c,d);break}if(e.patternProperties){let u=e.patternProperties,l=Object.keys(u),c=[];for(let p of l){let f=Pn(u[p],t),m=bt.string().regex(new RegExp(p));c.push(bt.looseRecord(m,f))}let d=[];if(Object.keys(r).length>0&&d.push(bt.object(r).passthrough()),d.push(...c),d.length===0)i=bt.object({}).passthrough();else if(d.length===1)i=d[0];else{let p=bt.intersection(d[0],d[1]);for(let f=2;f<d.length;f++)p=bt.intersection(p,d[f]);i=p}break}let s=bt.object(r);e.additionalProperties===!1?i=s.strict():typeof e.additionalProperties=="object"?i=s.catchall(Pn(e.additionalProperties,t)):i=s.passthrough();break}case"array":{let r=e.prefixItems,a=e.items;if(r&&Array.isArray(r)){let o=r.map(u=>Pn(u,t)),s=a&&typeof a=="object"&&!Array.isArray(a)?Pn(a,t):void 0;s?i=bt.tuple(o).rest(s):i=bt.tuple(o),typeof e.minItems=="number"&&(i=i.check(bt.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(bt.maxLength(e.maxItems)))}else if(Array.isArray(a)){let o=a.map(u=>Pn(u,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?Pn(e.additionalItems,t):void 0;s?i=bt.tuple(o).rest(s):i=bt.tuple(o),typeof e.minItems=="number"&&(i=i.check(bt.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(bt.maxLength(e.maxItems)))}else if(a!==void 0){let o=Pn(a,t),s=bt.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),i=s}else i=bt.array(bt.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function Pn(e,t){if(typeof e=="boolean")return e?bt.any():bt.never();let n=Bk(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(l=>Pn(l,t)),u=bt.union(s);n=i?bt.intersection(n,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(l=>Pn(l,t)),u=bt.xor(s);n=i?bt.intersection(n,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:bt.any();else{let s=i?n:Pn(e.allOf[0],t),u=i?0:1;for(let l=u;l<e.allOf.length;l++)s=bt.intersection(s,Pn(e.allOf[l],t));n=s}e.nullable===!0&&t.version==="openapi-3.0"&&(n=bt.nullable(n)),e.readOnly===!0&&(n=bt.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},a=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of a)s in e&&(r[s]=e[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in e&&(r[s]=e[s]);for(let s of Object.keys(e))Xee.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function Nk(e,t){if(typeof e=="boolean")return e?bt.any():bt.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=Qee(n,t?.defaultTarget),r=n.$defs||n.definitions||{},a={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??$n};return Pn(n,a)}var I_={};ga(I_,{bigint:()=>ite,boolean:()=>nte,date:()=>ate,number:()=>rte,string:()=>tte});function tte(e){return e3(tl,e)}function rte(e){return u3(nl,e)}function nte(e){return h3(il,e)}function ite(e){return v3(al,e)}function ate(e){return D3(Yc,e)}Jr($0());function ote(e,t){let n=e;return typeof t.minLength=="number"&&(n=n.min(t.minLength)),typeof t.maxLength=="number"&&(n=n.max(t.maxLength)),typeof t.pattern=="string"&&(n=n.regex(new RegExp(t.pattern))),n}function Tk(e,t,n){let i=e;return n&&(i=i.int()),typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),i}function ste(e,t){let n=e;return typeof t.minItems=="number"&&(n=n.min(t.minItems)),typeof t.maxItems=="number"&&(n=n.max(t.maxItems)),n}function id(e){if(!e||typeof e!="object")return Re.unknown();if(e.enum){let n=e.enum;return n.length===0?Re.unknown():Re.enum(n)}if(e.const!==void 0){let n=e.const;return typeof n=="string"||typeof n=="number"||typeof n=="boolean"?Re.literal(n):Re.unknown()}let t=e.type;if(t==="string")return ote(Re.string(),e);if(t==="integer")return Tk(Re.number(),e,!0);if(t==="number")return Tk(Re.number(),e,!1);if(t==="boolean")return Re.boolean();if(t==="array"){let n=e.items,i=n?id(n):Re.unknown();return ste(Re.array(i),e)}if(t==="object"){let n=e.properties;if(!n)return Re.record(Re.string(),Re.unknown());let i=new Set(e.required??[]),r={};for(let[a,o]of Object.entries(n)){let s=id(o);r[a]=i.has(a)?s:s.optional()}return Re.object(r).passthrough()}if(e.allOf){let n=e.allOf.map(id);if(n.length===0)return Re.unknown();if(n.length===1)return n[0];let i=n[0];for(let r=1;r<n.length;r++){let a=n[r];i instanceof Re.ZodObject&&a instanceof Re.ZodObject&&(i=i.merge(a))}return i}return Re.unknown()}import{realpathSync as ute}from"fs";import{basename as lte,dirname as cte,isAbsolute as dte,join as pte,relative as fte,resolve as mte,sep as Fk}from"path";import{readFileSync as hte,statSync as gte}from"fs";import{resolve as vte}from"path";var yte=/(?:^|\s)(?:--body-file|--notes-file|--file|-F)(?:=|\s+)(?:'([^']*)'|"([^"]*)"|([^\s;|&]+))/g;function _te(e,t){let n=[];for(let i of e.matchAll(yte)){let r=i[1]??i[2]??i[3];if(!r||r==="-")continue;let a=vte(t??process.cwd(),r);try{if(!gte(a).isFile())continue;n.push(hte(a,"utf8"))}catch{continue}}return n.length===0?e:[e,...n].join(`
1048
1048
  `)}var bte=["block","warn","shadow","info","unresolved"],j_="unresolved";function P_(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.guardrail_id=="string"&&typeof t.pattern=="string"&&bte.includes(t.action)&&typeof t.message=="string"&&(t.file_glob===void 0||typeof t.file_glob=="string")&&(t.exclude_glob===void 0||typeof t.exclude_glob=="string")}function Uk(e){if(typeof e!="object"||e===null)return!1;let t=e;return Array.isArray(t.commandRules)&&t.commandRules.every(P_)&&Array.isArray(t.fileRules)&&t.fileRules.every(P_)&&Array.isArray(t.contentRules)&&t.contentRules.every(P_)}function wte(e){let t="";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":".+^$|()[]\\".includes(n)?t+="\\"+n:t+=n;return t}function Ete(e){return e.endsWith("/")?`${e}**`:e}function ol(e,t){let n=Ete(e),i="",r=0;for(;r<n.length;)if(n[r]==="*"&&n[r+1]==="*"&&n[r+2]==="/")i+="(?:.+/)?",r+=3;else if(n[r]==="*"&&n[r+1]==="*")i+=".*",r+=2;else if(n[r]==="*")i+="[^/]*",r+=1;else if(n[r]==="?")i+="[^/]",r+=1;else if(n[r]==="{"){let a=n.indexOf("}",r);if(a!==-1){let o=n.slice(r+1,a).split(",").map(wte);i+="(?:"+o.join("|")+")",r=a+1}else i+="\\{",r+=1}else".+^$|()[]\\".includes(n[r])?(i+="\\"+n[r],r+=1):(i+=n[r],r+=1);return new RegExp("^"+i+"$").test(t)}function $te(e){return e==="path"||e==="file"||e==="filename"||e.endsWith("_path")}function Ste(e){return e==="content"||e.startsWith("new_")}function qk(e,t){if(!e)return"";for(let n of Object.keys(e).sort()){if(!t(n))continue;let i=e[n];if(typeof i=="string"&&i)return i}return""}function Ate(e){return qk(e,$te)}var Cte=new Set(["Read","Glob","Grep","LSP","Task","Agent","Skill","WebFetch","WebSearch","TodoWrite","AskUserQuestion","ToolSearch","EnterPlanMode","ExitPlanMode"]);function Rk(e){let t=[],n=e;for(;;)try{return pte(ute(n),...t)}catch{let i=cte(n);if(i===n)return e;t.unshift(lte(n)),n=i}}function kte(e,t){let n=mte(t,e),i=fte(Rk(t),Rk(n));return i===""||dte(i)||i.split(Fk)[0]===".."?n:i.split(Fk).join("/")}function B_(e,t,n){if(Cte.has(e??""))return"";let i=Ate(t);return i&&kte(i,n??process.cwd())}function N_(e){return qk(e,Ste)}function Dte(e){return e==="block"||e===j_}function zk(e){return e.filter(t=>!t.passed&&Dte(t.action))}function xte(e){return e.filter(t=>!t.passed&&t.action==="warn")}function Vk(e){return e.map(t=>`[${t.guardrail_id}] ${t.message}`).join(`
1049
- `)}function Lk(e){let t=Vk(e);return{permission:"deny",user_message:t,agent_message:t}}function Ote(...e){function t(s){let u=[];if(s.command)for(let l of e)u.push(...l.checkCommand(s.command));if(s.filePath)for(let l of e)u.push(...l.checkFilePath(s.filePath));if(s.filePath&&s.content)for(let l of e)u.push(...l.checkContent(s.filePath,s.content));return u}function n(s){let u=s.command??"";return u?t({command:_te(u,s.cwd)}):[]}function i(s){let u=n(s);if(u.length===0)return{};let l=zk(u),c=xte(u);return l.length>0?Lk(l):c.length>0?{additionalContext:Vk(c)}:{}}function r(s,u){if(!s)return{};let l=zk(t({filePath:s,content:u}));return l.length>0?Lk(l):{}}function a(s){return r(B_(s.tool_name,s.tool_input,s.root),N_(s.tool_input))}function o(s){return r(s.file_path??"",s.content??"")}return{beforeShellExecution:i,checkShellCommand:n,preToolUse:a,afterFileEdit:o,runChecks:t}}function Mk(e){return e.startsWith("(?i)")?new RegExp(e.slice(4),"i"):new RegExp(e)}function T_(e,...t){let n=e.commandRules.map(a=>({guardrail_id:a.guardrail_id,pattern:Mk(a.pattern),action:a.action,message:a.message})),i=e.fileRules,r=e.contentRules.map(a=>({guardrail_id:a.guardrail_id,pattern:Mk(a.pattern),action:a.action,message:a.message,file_glob:a.file_glob,exclude_glob:a.exclude_glob}));return Ote({checkCommand(a){let o=[];for(let s of n){let u=!s.pattern.test(a);o.push({guardrail_id:s.guardrail_id,passed:u,action:s.action,message:u?"":s.message})}return o},checkFilePath(a){let o=[];for(let s of i){if(s.exclude_glob&&ol(s.exclude_glob,a))continue;let u=ol(s.pattern,a);o.push({guardrail_id:s.guardrail_id,passed:!u,action:s.action,message:u?s.message:""})}return o},checkContent(a,o){let s=[];for(let u of r){if(u.file_glob&&!ol(u.file_glob,a)||u.exclude_glob&&ol(u.exclude_glob,a))continue;let l=u.pattern.test(o);s.push({guardrail_id:u.guardrail_id,passed:!l,action:u.action,message:l?u.message:""})}return s}},...t)}import{readFileSync as Aoe}from"fs";import{resolve as Go,dirname as Coe,join as k$e,relative as D$e,sep as x$e}from"path";var ZO=Va($a(),1);var ooe=Va($a(),1);var soe=Va($a(),1);var uoe=Va($a(),1);var loe=Va($a(),1);var coe=Va($a(),1);var jO=/^aaac\/\d+\.\d+$/,j1=Re.union([Re.object({schema:Re.record(Re.string(),Re.unknown())}).strict(),Re.object({$ref:Re.string()}).strict()]),BO=Re.object({name:Re.string().min(1),schema:Re.record(Re.string(),Re.unknown()),required:Re.boolean().optional(),description:Re.string().optional()}).strict(),NO=Re.union([Re.string(),Re.object({artifact:Re.string(),direction:Re.enum(["read","write","readwrite"])}).strict()]),TO=Re.object({description:Re.string().min(1),agentWorkflow:Re.string().optional(),agentTask:Re.string().optional(),handler:Re.string().optional(),options:Re.array(BO).optional(),input:j1.optional(),output:Re.object({success:j1,failed:j1.optional()}).strict(),artifactSlots:Re.record(Re.string(),NO).optional(),riskLevel:Re.enum(["low","medium","high"]).optional(),idempotent:Re.boolean().optional(),requiresConfirmation:Re.boolean().optional(),execution:Re.object({timeoutMs:Re.number().optional(),costCeilingUsd:Re.number().optional()}).strict().optional(),memoryRef:Re.object({input:Re.boolean().optional(),output:Re.boolean().optional()}).strict().optional()}).strict().superRefine((e,t)=>{let n=[e.agentWorkflow,e.agentTask,e.handler].filter(i=>i!==void 0).length;n===0?t.addIssue({code:"custom",message:"Exactly one of agentWorkflow, agentTask, or handler must be specified",path:["agentWorkflow"]}):n>1&&t.addIssue({code:"custom",message:"Only one of agentWorkflow, agentTask, or handler may be specified",path:["agentWorkflow"]})}),ioe=Re.object({guardrails:Re.boolean().optional(),observability:Re.boolean().optional()}).strict().optional(),FO=Re.object({package:Re.string().min(1),command:Re.string().optional(),config:Re.record(Re.string(),Re.unknown()).default({})}).strict(),aoe=Re.object({schema:Re.string().regex(jO,'schema must match pattern "aaac/x.y"'),info:Re.object({id:Re.string().min(1),version:Re.string().min(1),description:Re.string().optional()}).strict(),implementation:Re.string().optional(),embedded_dsl_dir:Re.string().optional(),projections:Re.array(Re.enum(["library","cli","claude","openai"])),governance:ioe,bindings:Re.record(Re.string(),FO).optional(),operations:Re.record(Re.string(),TO)}).strict().superRefine((e,t)=>{Object.values(e.operations).some(i=>i.agentWorkflow!==void 0||i.agentTask!==void 0)&&!e.implementation&&t.addIssue({code:"custom",message:"implementation is required when any operation uses agentWorkflow or agentTask",path:["implementation"]})});var y5=".agent-logs/config",AEe=`${y5}/event-mapping.json`,CEe=`${y5}/artifact-lookup.json`,kEe=`${y5}/task-patterns.json`;var DEe=Re.object({artifacts:Re.record(Re.string(),Re.object({path_patterns:Re.array(Re.string()).optional()}).passthrough()).optional()});var B1=Re.object({git:Re.object({hooks:Re.array(Re.string()).optional()}).strict().optional(),cursor:Re.object({hooks_json:Re.string().optional()}).strict().optional()}).strict(),N1=Re.object({guardrail:Re.array(Re.string()).optional(),hooks:Re.array(Re.string()).optional(),observability:Re.object({event_mapping:Re.string().optional(),recorder:Re.string().optional(),enabled:Re.boolean().optional(),db_path:Re.string().optional(),otel:Re.object({endpoint:Re.string()}).strict().optional()}).strict().optional(),claude:Re.object({emit:Re.object({workflows:Re.boolean().optional(),commands:Re.boolean().optional(),agents:Re.boolean().optional(),harness:Re.boolean().optional()}).strict().optional(),sync_command:Re.string().optional(),check_command:Re.string().optional()}).strict().optional()}).strict(),T1=Re.string(),v5=Re.object({adapter:Re.string(),model:Re.string().optional()}).strict(),Nd=Re.object({fast:v5.optional(),standard:v5.optional(),thinking:v5.optional()}).strict(),xEe=Re.object({model_mapping:Nd.optional()});var OEe=Re.object({environments:B1.optional(),bindings:N1.optional(),artifacts:T1.optional()});var doe=Re.object({command:Re.string(),description:Re.string().optional()}),IEe=Re.object({hooks:Re.record(Re.string(),Re.array(doe)).optional()});import{readFileSync as foe}from"fs";import{dirname as RO,join as moe,parse as hoe}from"path";import{fileURLToPath as goe}from"url";function voe(e){let t=["| Agent | Role | Mode |","|-------|------|------|"];for(let[n,i]of Object.entries(e))t.push(`| ${n} | ${i.role_name??n} | ${i.mode??"\u2014"} |`);return t.join(`
1049
+ `)}function Lk(e){let t=Vk(e);return{permission:"deny",user_message:t,agent_message:t}}function Ote(...e){function t(s){let u=[];if(s.command)for(let l of e)u.push(...l.checkCommand(s.command));if(s.filePath)for(let l of e)u.push(...l.checkFilePath(s.filePath));if(s.filePath&&s.content)for(let l of e)u.push(...l.checkContent(s.filePath,s.content));return u}function n(s){let u=s.command??"";return u?t({command:_te(u,s.cwd)}):[]}function i(s){let u=n(s);if(u.length===0)return{};let l=zk(u),c=xte(u);return l.length>0?Lk(l):c.length>0?{additionalContext:Vk(c)}:{}}function r(s,u){if(!s)return{};let l=zk(t({filePath:s,content:u}));return l.length>0?Lk(l):{}}function a(s){return r(B_(s.tool_name,s.tool_input,s.root),N_(s.tool_input))}function o(s){return r(s.file_path??"",s.content??"")}return{beforeShellExecution:i,checkShellCommand:n,preToolUse:a,afterFileEdit:o,runChecks:t}}function Mk(e){return e.startsWith("(?i)")?new RegExp(e.slice(4),"i"):new RegExp(e)}function T_(e,...t){let n=e.commandRules.map(a=>({guardrail_id:a.guardrail_id,pattern:Mk(a.pattern),action:a.action,message:a.message})),i=e.fileRules,r=e.contentRules.map(a=>({guardrail_id:a.guardrail_id,pattern:Mk(a.pattern),action:a.action,message:a.message,file_glob:a.file_glob,exclude_glob:a.exclude_glob}));return Ote({checkCommand(a){let o=[];for(let s of n){let u=!s.pattern.test(a);o.push({guardrail_id:s.guardrail_id,passed:u,action:s.action,message:u?"":s.message})}return o},checkFilePath(a){let o=[];for(let s of i){if(s.exclude_glob&&ol(s.exclude_glob,a))continue;let u=ol(s.pattern,a);o.push({guardrail_id:s.guardrail_id,passed:!u,action:s.action,message:u?s.message:""})}return o},checkContent(a,o){let s=[];for(let u of r){if(u.file_glob&&!ol(u.file_glob,a)||u.exclude_glob&&ol(u.exclude_glob,a))continue;let l=u.pattern.test(o);s.push({guardrail_id:u.guardrail_id,passed:!l,action:u.action,message:l?u.message:""})}return s}},...t)}import{readFileSync as Aoe}from"fs";import{resolve as Go,dirname as Coe,join as k$e,relative as D$e,sep as x$e}from"path";var ZO=Va($a(),1);var ooe=Va($a(),1);var soe=Va($a(),1);var uoe=Va($a(),1);var loe=Va($a(),1);var coe=Va($a(),1);var jO=/^aaac\/\d+\.\d+$/,j1=Re.union([Re.object({schema:Re.record(Re.string(),Re.unknown())}).strict(),Re.object({$ref:Re.string()}).strict()]),BO=Re.object({name:Re.string().min(1),schema:Re.record(Re.string(),Re.unknown()),required:Re.boolean().optional(),description:Re.string().optional()}).strict(),NO=Re.union([Re.string(),Re.object({artifact:Re.string(),direction:Re.enum(["read","write","readwrite"])}).strict()]),TO=Re.object({description:Re.string().min(1),agentWorkflow:Re.string().optional(),agentTask:Re.string().optional(),handler:Re.string().optional(),options:Re.array(BO).optional(),input:j1.optional(),output:Re.object({success:j1,failed:j1.optional()}).strict(),artifactSlots:Re.record(Re.string(),NO).optional(),riskLevel:Re.enum(["low","medium","high"]).optional(),idempotent:Re.boolean().optional(),requiresConfirmation:Re.boolean().optional(),execution:Re.object({timeoutMs:Re.number().optional(),costCeilingUsd:Re.number().optional()}).strict().optional(),memoryRef:Re.object({input:Re.boolean().optional(),output:Re.boolean().optional()}).strict().optional()}).strict().superRefine((e,t)=>{let n=[e.agentWorkflow,e.agentTask,e.handler].filter(i=>i!==void 0).length;n===0?t.addIssue({code:"custom",message:"Exactly one of agentWorkflow, agentTask, or handler must be specified",path:["agentWorkflow"]}):n>1&&t.addIssue({code:"custom",message:"Only one of agentWorkflow, agentTask, or handler may be specified",path:["agentWorkflow"]})}),ioe=Re.object({guardrails:Re.boolean().optional(),observability:Re.boolean().optional()}).strict().optional(),FO=Re.object({package:Re.string().min(1),command:Re.string().optional(),config:Re.record(Re.string(),Re.unknown()).default({})}).strict(),aoe=Re.object({schema:Re.string().regex(jO,'schema must match pattern "aaac/x.y"'),info:Re.object({id:Re.string().min(1),version:Re.string().min(1),description:Re.string().optional()}).strict(),implementation:Re.string().optional(),embedded_dsl_dir:Re.string().optional(),projections:Re.array(Re.enum(["library","cli","claude","openai"])),governance:ioe,bindings:Re.record(Re.string(),FO).optional(),operations:Re.record(Re.string(),TO)}).strict().superRefine((e,t)=>{Object.values(e.operations).some(i=>i.agentWorkflow!==void 0||i.agentTask!==void 0)&&!e.implementation&&t.addIssue({code:"custom",message:"implementation is required when any operation uses agentWorkflow or agentTask",path:["implementation"]})});var y5=".agent-logs/config",AEe=`${y5}/event-mapping.json`,CEe=`${y5}/artifact-lookup.json`,kEe=`${y5}/task-patterns.json`;var DEe=Re.object({artifacts:Re.record(Re.string(),Re.object({path_patterns:Re.array(Re.string()).optional()}).passthrough()).optional()});var B1=Re.object({git:Re.object({hooks:Re.array(Re.string()).optional()}).strict().optional(),cursor:Re.object({hooks_json:Re.string().optional()}).strict().optional()}).strict(),N1=Re.object({guardrail:Re.array(Re.string()).optional(),hooks:Re.array(Re.string()).optional(),observability:Re.object({event_mapping:Re.string().optional(),recorder:Re.string().optional(),enabled:Re.boolean().optional(),db_path:Re.string().optional(),otel:Re.object({endpoint:Re.string()}).strict().optional()}).strict().optional(),claude:Re.object({emit:Re.object({workflows:Re.boolean().optional(),commands:Re.boolean().optional(),agents:Re.boolean().optional(),harness:Re.boolean().optional()}).strict().optional(),sync_command:Re.string().optional(),check_command:Re.string().optional(),local_hook_install:Re.boolean().optional()}).strict().optional()}).strict(),T1=Re.string(),v5=Re.object({adapter:Re.string(),model:Re.string().optional()}).strict(),Nd=Re.object({fast:v5.optional(),standard:v5.optional(),thinking:v5.optional()}).strict(),xEe=Re.object({model_mapping:Nd.optional()});var OEe=Re.object({environments:B1.optional(),bindings:N1.optional(),artifacts:T1.optional()});var doe=Re.object({command:Re.string(),description:Re.string().optional()}),IEe=Re.object({hooks:Re.record(Re.string(),Re.array(doe)).optional()});import{readFileSync as foe}from"fs";import{dirname as RO,join as moe,parse as hoe}from"path";import{fileURLToPath as goe}from"url";function voe(e){let t=["| Agent | Role | Mode |","|-------|------|------|"];for(let[n,i]of Object.entries(e))t.push(`| ${n} | ${i.role_name??n} | ${i.mode??"\u2014"} |`);return t.join(`
1050
1050
  `)}function yoe(e){let t=[];for(let[n,i]of Object.entries(e))t.push(`- **${n}**${i.description?` \u2014 ${i.description}`:""}`);return t.join(`
1051
1051
  `)}function zO(e,t){let n=e.title??"";if(e.content)return{title:n,content:e.content.trimEnd()};if(e.list==="agents"){let i=t.agents??{};return{title:n,content:voe(i)}}if(e.list==="workflow"||e.list==="workflows"){let i=t.workflow??t.workflows??{};return{title:n,content:yoe(i)}}}var _oe={agent:["x-authority","x-audit-checklist","x-cursor-exclude","x-description"],workflow_step:["x-optional","x-instruction","x-receives"],system:["x-role-selection"]};function LO(e){if(!e.startsWith("x-"))return[];let t=e.slice(2),n=t.replace(/-/g,"_");return n===t?[t]:[n,t]}function Fs(e,t){let n=e[t];if(n!==void 0)return n;for(let i of LO(t)){let r=e[i];if(r!==void 0)return r}}function boe(e,t,n,i){return{path:`${e}.${t}`,key:t,canonical:n,node:i,message:`"${t}" is this project's DSL extension "${n}" written without its prefix. agent-contracts does not declare the field on a ${i.replace(/_/g," ")}, so the "x-" prefix is what tells its validator a deliberate extension apart from a misspelled schema field \u2014 without it the key is a blocking "unknown-property" and the document fails its own validation. The value IS read either way, so nothing is dropped; rename the key to "${n}".`}}function MO(e){let t=[],n=(r,a,o)=>{if(r!==void 0)for(let s of _oe[o])for(let u of LO(s))u in r&&t.push(boe(a,u,s,o))},i=r=>typeof r=="object"&&r!==null&&!Array.isArray(r)?r:void 0;for(let[r,a]of Object.entries(i(e.agents)??{}))n(i(a),`agents.${r}`,"agent");for(let[r,a]of Object.entries(i(e.workflow)??{})){let o=i(a)?.steps;Array.isArray(o)&&o.forEach((s,u)=>{n(i(s),`workflow.${r}.steps[${u}]`,"workflow_step")})}return n(i(e.system),"system","system"),t}function woe(){let e=RO(goe(import.meta.url)),t=hoe(e).root;for(;;){try{let n=JSON.parse(foe(moe(e,"package.json"),"utf8"));if(typeof n=="object"&&n!==null){let i=n;if(i.name==="@aaac/contracts"&&typeof i.version=="string")return i.version}}catch{}if(e===t)break;e=RO(e)}return"bundled"}var E$e=woe();var Eoe="critical",_5="project.yaml";function $oe(e,t){return e?typeof e.action!="string"?{resolved:!1,reason:e.action===void 0?`its rule in active_guardrail_policy "${t}" declares no action`:`its rule in active_guardrail_policy "${t}" declares a conditional action, which this runtime does not resolve to a single enforcement level`}:typeof e.severity!="string"?{resolved:!1,reason:`its rule in active_guardrail_policy "${t}" declares no severity`}:{resolved:!0,severity:e.severity,action:e.action}:{resolved:!1,reason:`active_guardrail_policy "${t}" has no rule for it`}}function UO(e){let t=Object.keys(e);return t.length>0?t.join(", "):"(none declared)"}function Soe(e,t){let n=e.guardrail_policies??{},i=[],r=e.system?.active_guardrail_policy;if(typeof r=="string"&&i.push({path:"system.active_guardrail_policy",severity:"error",message:`\`active_guardrail_policy\` has no effect under the agent-contracts \`system:\` section \u2014 it is read from the project manifest. Move \`active_guardrail_policy: ${r}\` to ${_5}.`}),t===void 0)return i.push({path:"active_guardrail_policy",severity:"error",message:`${_5} declares no \`active_guardrail_policy\`, so no enforcement action is known for the guardrails implemented by \`bindings.guardrail\`. Declared policies: ${UO(n)}.`}),{unresolvedReason:`${_5} declares no \`active_guardrail_policy\``,diagnostics:i};let a=n[t];return a?{policy:{name:t,rules:a.rules??[]},diagnostics:i}:(i.push({path:"active_guardrail_policy",severity:"error",message:`active_guardrail_policy "${t}" is not declared in \`guardrail_policies\`. Declared policies: ${UO(n)}.`}),{unresolvedReason:`active_guardrail_policy "${t}" is not a declared guardrail policy`,diagnostics:i})}function VO(e,t,n){let i={commandChecks:[],fileChecks:[],contentChecks:[],allChecks:[],hasGuardrails:!1,diagnostics:[]};if(!t?.guardrail_impl)return i;let r=e.guardrails??{},a=Soe(e,n),o=a.diagnostics,s=[];for(let[u,l]of Object.entries(t.guardrail_impl)){let d=r[u]?.description??u,p;a.policy?(p=$oe(a.policy.rules.find(h=>h.guardrail===u),a.policy.name),p.resolved||o.push({path:`guardrail_policies.${a.policy.name}`,severity:"error",message:`Guardrail "${u}" has a \`guardrail_impl\` matcher but ${p.reason}, so its enforcement level is unknown.`})):p={resolved:!1,reason:a.unresolvedReason};let f=p.resolved?p.severity:Eoe,m=p.resolved?p.action:j_;for(let h of l.checks){let v=h.matcher;if(!v)continue;let y=h.message??d;s.push({guardrail_id:u,description:d,severity:f,action:m,matcher_type:v.type,pattern:v.pattern,message:p.resolved?y:`${y} (refused because this guardrail's enforcement action is unresolved: ${p.reason} \u2014 fix the guardrail policy configuration)`,file_glob:v.file_glob,exclude_glob:v.exclude_glob})}}return{commandChecks:s.filter(u=>u.matcher_type==="command_regex"),fileChecks:s.filter(u=>u.matcher_type==="file_glob"),contentChecks:s.filter(u=>u.matcher_type==="content_regex"),allChecks:s,hasGuardrails:s.length>0,diagnostics:o}}var KO="project.yaml",GO=Re.object({max_follow_ups:Re.number().int().min(0).default(2),max_retries:Re.number().int().min(0).default(0)}).strict().default(()=>({max_follow_ups:2,max_retries:0})),koe=Re.object({destination:Re.enum(["stderr","file","both","none"]).default("stderr"),file:Re.string().optional(),naming:Re.enum(["single","per-invocation","daily"]).default("single")}).strict().default(()=>({destination:"stderr",naming:"single"})).refine(e=>!((e.destination==="file"||e.destination==="both")&&!e.file),{message:"logging.progress_log.file is required when destination is 'file' or 'both'"}),JO=Re.object({progress_log:koe}).strict().default(()=>({progress_log:{destination:"stderr",naming:"single"}})),Doe=Re.object({dsl:Re.string().default("./agent-contracts.yaml"),bindings:Re.array(Re.string()).default([]),active_guardrail_policy:Re.string().optional(),plugins:Re.array(Re.string()).default([]),recovery:GO,model_mapping:Nd.default({}),logging:JO}),xoe=Re.object({path:Re.string()}).strict(),Ooe=Re.object({glob:Re.string()}).strict(),Ioe=Re.union([xoe,Ooe]),qO=8,Poe=Re.object({max_depth:Re.number().int().min(0).default(qO)}).strict().default(()=>({max_depth:qO})),joe=Re.object({resolve_from:Re.string().optional()}).strict(),Boe=Re.object({members:Re.array(Ioe),runtime:joe.optional(),discovery:Poe}).strict(),Noe=Re.object({schema:Re.string().optional(),agents:Re.string().optional(),dsl:Re.string().optional(),bindings:N1.optional(),active_guardrail_policy:Re.string().optional(),plugins:Re.array(Re.string()).optional(),recovery:GO,model_mapping:Nd.default({}),logging:JO,artifacts:T1.optional(),toolchains:Re.string().optional(),environments:B1.optional(),workspace:Boe.optional()}).strict();function Toe(e){let t=WO(e);return Foe(Aoe(t,"utf8"))}function Foe(e){return Noe.parse(ZO.default.parse(e))}function WO(e){return Go(e)}function Roe(e,t,n,i){return{...e,dslPath:Go(t,e.dsl),dslDeclared:n,bindingPaths:e.bindings.map(r=>Go(t,r)),logging:e.logging.progress_log.file?{...e.logging,progress_log:{...e.logging.progress_log,file:Go(t,e.logging.progress_log.file)}}:e.logging,observability:i?.observability?{eventMappingPath:i.observability.event_mapping?Go(t,i.observability.event_mapping):void 0,recorder:i.observability.recorder,enabled:i.observability.enabled,dbPath:i.observability.db_path?Go(t,i.observability.db_path):void 0,otel:i.observability.otel}:void 0,artifactsPath:i?.artifacts?Go(t,i.artifacts):void 0,toolchainsPath:i?.toolchains?Go(t,i.toolchains):void 0}}function zoe(e){return{dsl:e.agents??e.dsl,bindings:e.bindings?.guardrail??[],active_guardrail_policy:e.active_guardrail_policy,plugins:e.plugins,recovery:e.recovery,model_mapping:e.model_mapping,logging:e.logging}}async function HO(e){let t=WO(e),n=Toe(t),i=zoe(n),r=i.dsl!==void 0,a=Doe.parse(i),o=Coe(t);return Roe(a,o,r,{artifacts:n.artifacts,toolchains:n.toolchains,observability:n.bindings?.observability})}var XV=Va($a(),1),QV=Va($a(),1);import{readFile as K9e}from"fs/promises";import{readFile as W9e}from"fs/promises";import{readFile as s5e}from"fs/promises";var eZ=Va($a(),1);import{existsSync as HV}from"fs";import{resolve as YV}from"path";async function G9e(e){let t;try{t=await K9e(e,"utf8")}catch{throw new Error(`Failed to read artifact registry: ${e} (declared by the project manifest's \`artifacts:\`).`)}let n;try{n=XV.default.parse(t)}catch(a){throw new Error(`Invalid YAML in artifact registry ${e}: ${a.message}`)}let r=(typeof n=="object"&&n!==null&&!Array.isArray(n)?n:void 0)?.artifacts;return r&&typeof r=="object"&&!Array.isArray(r)?r:{}}async function J9e(e){if(!e.artifactBinding)return{dsl:e.dsl,diagnostics:[]};let{resolveArtifactBinding:t}=await Promise.resolve().then(()=>(ac(),ic)),n=await G9e(e.artifactBinding.source),i=e.dsl.artifacts??{},r=e.artifactBinding.mappings,a=new Set(Object.keys(i).map(u=>r?.[u]??u)),o=Object.keys(n).filter(u=>!a.has(u)&&!(u in i)),s=t({...Object.fromEntries(o.map(u=>[u,{}])),...i},{artifacts:n},r,e.paths);return{dsl:{...e.dsl,artifacts:s.artifacts},diagnostics:s.diagnostics.map(u=>({path:u.rule,message:u.message,severity:u.severity}))}}var H9e=class extends Error{missing;constructor(e){super(`Required entities missing after DSL merge:
1052
1052
  `+e.map(t=>` - ${t}`).join(`
@@ -1,3 +1,3 @@
1
- export { c as GuardrailCheckEntry, G as GuardrailContext, a as GuardrailDiagnostic, d as ProjectConfig, e as ProjectConfigSchema, R as ResolvedConfig, f as buildGuardrailContext, l as loadProjectConfig, p as parseProjectManifest, r as readProjectManifest } from '../index-BHlvPqIp.js';
1
+ export { c as GuardrailCheckEntry, G as GuardrailContext, a as GuardrailDiagnostic, d as ProjectConfig, e as ProjectConfigSchema, R as ResolvedConfig, f as buildGuardrailContext, l as loadProjectConfig, p as parseProjectManifest, r as readProjectManifest } from '../index-DeZsmlij.js';
2
2
  import 'zod';
3
3
  import '../guardrail-hooks-BgHe8PrP.js';
@@ -114,6 +114,7 @@ declare const ProjectConfigSchema: z.ZodObject<{
114
114
  }, z.core.$strict>>;
115
115
  sync_command: z.ZodOptional<z.ZodString>;
116
116
  check_command: z.ZodOptional<z.ZodString>;
117
+ local_hook_install: z.ZodOptional<z.ZodBoolean>;
117
118
  }, z.core.$strict>>;
118
119
  }, z.core.$strict>>;
119
120
  active_guardrail_policy: z.ZodOptional<z.ZodString>;
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export { ModelClass } from '@aaac/contracts';
5
5
  import { z } from 'zod';
6
6
  import { b as GuardrailCheckFunctions, a as GuardrailRuleData, G as GuardrailHooks, H as HookResponse, c as GuardrailCheckResult } from './guardrail-hooks-BgHe8PrP.js';
7
7
  export { d as GuardrailAction, e as GuardrailRule, f as HookContext, U as UNRESOLVED_GUARDRAIL_ACTION, g as createGuardrailHooks, h as createGuardrailHooksFromRules, i as getBlockingViolations, j as getWarnings, k as hasBlockingViolation } from './guardrail-hooks-BgHe8PrP.js';
8
- import { G as GuardrailContext, P as ProgressLogConfig, R as ResolvedConfig, a as GuardrailDiagnostic } from './index-BHlvPqIp.js';
9
- export { b as PROJECT_CONFIG_FILENAME } from './index-BHlvPqIp.js';
8
+ import { G as GuardrailContext, P as ProgressLogConfig, R as ResolvedConfig, a as GuardrailDiagnostic } from './index-DeZsmlij.js';
9
+ export { b as PROJECT_CONFIG_FILENAME } from './index-DeZsmlij.js';
10
10
  import { OtelEmitter } from '@aaac/observability';
11
11
  export { ExecutionEnvelope } from '@aaac/observability';
12
12
  export { a as NavigationContext, N as NavigationContextOptions, b as buildNavigationContext } from './navigation-context-DJjCkrcj.js';
@@ -1566,6 +1566,7 @@ declare const ClaudeConfigSchema: z.ZodObject<{
1566
1566
  guard_command: z.ZodOptional<z.ZodString>;
1567
1567
  sync_command: z.ZodOptional<z.ZodString>;
1568
1568
  check_command: z.ZodOptional<z.ZodString>;
1569
+ local_hook_install: z.ZodDefault<z.ZodBoolean>;
1569
1570
  component_id: z.ZodOptional<z.ZodString>;
1570
1571
  }, z.core.$strip>;
1571
1572
  type ClaudeConfig = z.infer<typeof ClaudeConfigSchema>;
@@ -1608,6 +1609,11 @@ interface CheckResult {
1608
1609
  path: string;
1609
1610
  reason: "missing" | "changed" | "orphaned";
1610
1611
  }>;
1612
+ /**
1613
+ * Rendered files this check did not compare: the hook-install files absent
1614
+ * from disk in a project that declares `local_hook_install`. Empty otherwise.
1615
+ */
1616
+ skipped: string[];
1611
1617
  }
1612
1618
  /**
1613
1619
  * Materialize `.claude/*` and the CLAUDE.md integration block from the embedded DSL.
@@ -1620,6 +1626,11 @@ declare function syncClaude(opts: SyncOptions): Promise<SyncResult>;
1620
1626
  * Read-only drift gate. Reports files whose on-disk content differs from a
1621
1627
  * fresh render. For CLAUDE.md, drift means the aaac:claude-native block is
1622
1628
  * missing or stale (content outside the block is ignored).
1629
+ *
1630
+ * A project that keeps the hook install out of version control
1631
+ * (`local_hook_install`) has none of it in a fresh clone, so an install file
1632
+ * absent from disk is listed in `skipped` rather than compared. One that is
1633
+ * present is compared like any other, and the CLAUDE.md block is never skipped.
1623
1634
  */
1624
1635
  declare function checkClaude(opts: SyncOptions): Promise<CheckResult>;
1625
1636
 
package/dist/index.js CHANGED
@@ -9462,6 +9462,28 @@ var ClaudeConfigSchema = z3.object({
9462
9462
  * manifest's `bindings.claude.check_command` wins over it.
9463
9463
  */
9464
9464
  check_command: z3.string().optional(),
9465
+ /**
9466
+ * Whether the project keeps the hook install out of version control. The
9467
+ * hook install is every file `syncClaude` renders for the navigation-index
9468
+ * hooks — `<output_dir>/settings.json`, `hooks/`, `bin/` and `cache/` — and
9469
+ * not the CLAUDE.md block. Default `false`: the install is committed, and
9470
+ * `checkClaude` reports any part of it that is absent as `missing`.
9471
+ *
9472
+ * When `true`, `checkClaude` lists an absent install file in `skipped`
9473
+ * instead of `drift`, so a fresh clone or a CI checkout gates the committed
9474
+ * artifacts (`agents`, `workflows`, `commands`, the CLAUDE.md block) and
9475
+ * nothing else. An install file that is present is compared as usual, and
9476
+ * a missing or stale CLAUDE.md block is drift either way. `syncClaude`
9477
+ * writes the same set of files whatever the value.
9478
+ *
9479
+ * A clone of such a project has no working hooks until it creates the
9480
+ * install: run the declared `sync_command` once after cloning. When
9481
+ * `settings.json` is one of the files kept out, Claude Code registers none of
9482
+ * these hooks before that sync, so the PreToolUse edit guard refuses no edit;
9483
+ * the CLAUDE.md block says so, naming the sync command.
9484
+ * The project manifest's `bindings.claude.local_hook_install` wins over it.
9485
+ */
9486
+ local_hook_install: z3.boolean().default(false),
9465
9487
  /** Override component id; defaults to `dsl.system.id`. */
9466
9488
  component_id: z3.string().optional()
9467
9489
  }).strip();
@@ -9484,7 +9506,8 @@ function applyProjectBinding(config, project) {
9484
9506
  ...config,
9485
9507
  emit,
9486
9508
  sync_command: project.sync_command ?? config.sync_command,
9487
- check_command: project.check_command ?? config.check_command
9509
+ check_command: project.check_command ?? config.check_command,
9510
+ local_hook_install: project.local_hook_install ?? config.local_hook_install
9488
9511
  };
9489
9512
  }
9490
9513
 
@@ -10680,7 +10703,9 @@ async function renderFiles(root, dsl, config, entryAgentPrompt, protectsArtifact
10680
10703
  entryAgentPrompt,
10681
10704
  harnessCommands,
10682
10705
  // Whether the block may say the edit guard protects anything.
10683
- protectsArtifacts
10706
+ protectsArtifacts,
10707
+ // Whether the block must say a clone runs no hook until it is synced.
10708
+ localHookInstall: config.local_hook_install
10684
10709
  }),
10685
10710
  harnessCommands
10686
10711
  );
@@ -10718,8 +10743,11 @@ function actionForOverwriteTrue(existing, next) {
10718
10743
  function isSettingsJson(file) {
10719
10744
  return file.path === "settings.json" && file.targetDir === ".claude";
10720
10745
  }
10746
+ function isClaudeMdBlock(file) {
10747
+ return file.path === "CLAUDE.md" && file.targetDir === "." && !file.overwrite;
10748
+ }
10721
10749
  function resolveContent(file, existing) {
10722
- if (file.path === "CLAUDE.md" && file.targetDir === "." && !file.overwrite) {
10750
+ if (isClaudeMdBlock(file)) {
10723
10751
  return mergeClaudeMdBlock(existing, file.content);
10724
10752
  }
10725
10753
  if (isSettingsJson(file)) {
@@ -10739,7 +10767,7 @@ function resolveContent(file, existing) {
10739
10767
  return { content: file.content, action };
10740
10768
  }
10741
10769
  function checkContent(file, existing) {
10742
- if (file.path === "CLAUDE.md" && file.targetDir === "." && !file.overwrite) {
10770
+ if (isClaudeMdBlock(file)) {
10743
10771
  if (existing === void 0) return "missing";
10744
10772
  const expected = expectedClaudeMdContent(existing, file.content);
10745
10773
  return existing === expected ? null : "changed";
@@ -10962,6 +10990,7 @@ async function checkClaude(opts) {
10962
10990
  const root = resolve6(opts.projectRoot);
10963
10991
  const { config, modelMapping } = effectiveClaudeInputs(root, opts.config);
10964
10992
  const drift = [];
10993
+ const skipped = [];
10965
10994
  const sources = await resolveDslSources(root, opts.dsl, config);
10966
10995
  const rendered = await renderFiles(
10967
10996
  root,
@@ -10974,6 +11003,10 @@ async function checkClaude(opts) {
10974
11003
  const rel = generatedFileRelPath(file);
10975
11004
  const abs = absPath(root, file);
10976
11005
  const existing = await readIfExists(abs);
11006
+ if (existing === void 0 && config.local_hook_install && !isClaudeMdBlock(file)) {
11007
+ skipped.push(rel);
11008
+ continue;
11009
+ }
10977
11010
  const contentReason = isHookBin(file.targetDir, file.path) ? checkHookBin(file, existing) : checkContent(file, existing);
10978
11011
  const modeDrift = contentReason === null && file.executable === true && existing !== void 0 && await execBitMissing(abs);
10979
11012
  const reason = contentReason ?? (modeDrift ? "changed" : null);
@@ -10996,7 +11029,7 @@ async function checkClaude(opts) {
10996
11029
  for (const path of await orphanFiles(root, config, rendered, workflows, commands, agents)) {
10997
11030
  drift.push({ path, reason: "orphaned" });
10998
11031
  }
10999
- return { inSync: drift.length === 0, drift };
11032
+ return { inSync: drift.length === 0, drift, skipped };
11000
11033
  }
11001
11034
 
11002
11035
  // src/lib/prompt-executor.ts