- **Isolation Rule**: If the main working directory contains uncommitted changes or another branch is actively being edited, NEVER switch branches or stash in the shared repository. Instead, use an isolated worktree for release operations:
```bash
git worktree add -b codex/release-vX.Y.Z /tmp/seal-use-release main
import{createRequireasLy0}from"node:module";varIy0=Object.create;var{getPrototypeOf:Ky0,defineProperty:oT,getOwnPropertyNames:Gy0}=Object;varHy0=Object.prototype.hasOwnProperty;functionWy0($){returnthis[$]}varXy0,Zy0,J6=($,Y,U)=>{varz=$!=null&&typeof$==="object";if(z){varQ=Y?Xy0??=newWeakMap:Zy0??=newWeakMap,J=Q.get($);if(J)returnJ}U=$!=null?Iy0(Ky0($)):{};letI=Y||!$||!$.__esModule?oT(U,"default",{value:$,enumerable:!0}):U;for(letKofGy0($))if(!Hy0.call(I,K))oT(I,K,{get:Wy0.bind($,K),enumerable:!0});if(z)Q.set($,I);returnI};varE=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varqy0=($)=>$;functionVy0($,Y){this[$]=qy0.bind(null,Y)}varx8=($,Y)=>{for(varUinY)oT($,U,{get:Y[U],enumerable:!0,configurable:!0,set:Vy0.bind(Y,U)})};varm=($,Y)=>()=>($&&(Y=$($=0)),Y);varI0=Ly0(import.meta.url);varFy0,cq,wy0,My0,Oy0,Ny0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),uo=($,Y)=>{letU={};for(varzin$)cq(U,z,{get:$[z],enumerable:!0});if(Y)cq(U,Symbol.toStringTag,{value:"Module"});returnU},Dy0=($,Y,U,z)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varQ=My0(Y),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Ny0.call($,K)&&K!==U)cq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(z=wy0(Y,K))||z.enumerable})}return$},nq=($,Y,U)=>(U=$!=null?Fy0(Oy0($)):{},Dy0(Y||!$||!$.__esModule?cq(U,"default",{value:$,enumerable:!0}):U,$));varrT=m(()=>{Fy0=Object.create,cq=Object.defineProperty,wy0=Object.getOwnPropertyDescriptor,My0=Object.getOwnPropertyNames,Oy0=Object.getPrototypeOf,Ny0=Object.prototype.hasOwnProperty});functionio($){returntypeof$==="string"&&bo.has($.replace(/#$/,""))}functionco($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letU=$.$schema.replace(/#$/,"");if(Ay0.has(U))return"2020-12";if(bo.has(U))return"2019-09";if(By0.has(U)||Py0.has(U))return"draft-7";throwError(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}varAy0,bo,By0,Py0;varsT=m(()=>{Ay0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),bo=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),By0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Py0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionH0($,Y,U){functionz(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:I,traits:newSet},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);letH=I.prototype,W=Object.keys(H);for(letX=0;X<W.length;X++){letZ=W[X];if(!(ZinK))K[Z]=H[Z].bind(K)}}letQ=U?.Parent??Object;classJextendsQ{}Object.defineProperty(J,"name",{value:$});functionI(K){varG;letH=U?.Parent?newJ:this;z(H,K),(G=H._zod).deferred??(G.deferred=[]);for(letWofH._zod.deferred)W();returnH}returnObject.defineProperty(I,"init",{value:z}),Object.defineProperty(I,Symbol.hasInstance,{value:(K)=>{if(U?.Parent&&KinstanceofU.Parent)return!0;returnK?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}functiona4($){if($)Object.assign(AY,$);returnAY}varno,oK,aT,u5,BY,AY;varPY=m(()=>{oK=Object.freeze({status:"aborted"});aT=Symbol("zod_brand");u5=classu5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};BY=classBYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(no=globalThis).__zod_globalConfig??(no.__zod_globalConfig={});AY=globalThis.__zod_globalConfig});vary0={};x8(y0,{unwrapMessage:()=>rK,uint8ArrayToHex:()=>ry0,uint8ArrayToBase64url:()=>ly0,uint8ArrayToBase64:()=>lo,stringifyPrimitive:()=>v0,slugify:()=>$j,shallowClone:()=>Uj,safeExtend:()=>iy0,required:()=>py0,randomString:()=>gy0,propertyKeyTypes:()=>tK,promiseAllObject:()=>Sy0,primitiveTypes:()=>zj,prefixIssues:()=>f8,pick:()=>fy0,partial:()=>ny0,parsedType:()=>S0,optionalKeys:()=>Qj,omit:()=>uy0,objectClone:()=>_y0,numKeys:()=>yy0,nullish:()=>I7,normalizeParams:()=>x0,mergeDefs:()=>c9,merge:()=>cy0,jsonStringifyReplacer:()=>iz,joinValues:()=>O0,issue:()=>nz,isPlainObject:()=>G7,isObject:()=>TY,hexToUint8Array:()=>oy0,getSizableOrigin:()=>eK,getParsedType:()=>ky0,getLengthableOrigin:()=>$G,getEnumValues:()=>sK,getElementAtPath:()=>hy0,floatSafeRemainder:()=>eT,finalizeIssue:()=>A8,extend:()=>by0,explicitlyAborted:()=>Kj,escapeRegex:()=>N$,esc:()=>pq,defineLazy:()=>E1,createTransparentProxy:()=>xy0,cloneDef:()=>vy0,clone:()=>D8,cleanRegex:()=>aK,cleanEnum:()=>dy0,captureStackTrace:()=>dq,cached:()=>cz,base64urlToUint8Array:()=>my0,base64ToUint8Array:()=>mo,assignProp:()=>K7,assertNotEqual:()=>jy0,assertNever:()=>Cy0,assertIs:()=>Ey0,assertEqual:()=>Ty0,assert:()=>Ry0,allowsEval:()=>Yj,aborted:()=>H7,NUMBER_FORMAT_RANGES:()=>Jj,Class:()=>ooLine truncated
`)}var ro=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,iz,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},YG,u8;var Wj=m(()=>{PY();$1();YG=H0("$ZodError",ro),u8=H0("$ZodError",ro,{Parent:Error})});var pz=($)=>(Y,U,z,Q)=>{let J=z?{...z,async:!1}:{async:!1},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)throw new u5;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},mq,dz=($)=>async(Y,U,z,Q)=>{let J=z?{...z,async:!0}:{async:!0},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)I=await I;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},lq,mz=($)=>(Y,U,z)=>{let Q=z?{...z,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new u5;return J.issues.length?{success:!1,error:new($??YG)(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Xj,lz=($)=>async(Y,U,z)=>{let Q=z?{...z,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Zj,oq=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return pz($)(Y,U,Q)},ay0,rq=($)=>(Y,U,z)=>{return pz($)(Y,U,z)},ty0,sq=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return dz($)(Y,U,Q)},ey0,aq=($)=>async(Y,U,z)=>{return dz($)(Y,U,z)},$k0,tq=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return mz($)(Y,U,Q)},Yk0,eq=($)=>(Y,U,z)=>{return mz($)(Y,U,z)},Uk0,$V=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return lz($)(Y,U,Q)},zk0,YV=($)=>async(Y,U,z)=>{return lz($)(Y,U,z)},Qk0;var qj=m(()=>{PY();Wj();$1();mq=pz(u8),lq=dz(u8),Xj=mz(u8),Zj=lz(u8),ay0=oq(u8),ty0=rq(u8),ey0=sq(u8),$k0=aq(u8),Yk0=tq(u8),Uk0=eq(u8),zk0=$V(u8),Qk0=YV(u8)});var Y$={};x8(Y$,{xid:()=>wj,uuid7:()=>Gk0,uuid6:()=>Kk0,uuid4:()=>Ik0,uuid:()=>jY,uppercase:()=>cj,unicodeEmail:()=>ao,undefined:()=>bj,ulid:()=>Fj,time:()=>Sj,string:()=>yj,sha512_hex:()=>Rk0,sha512_base64url:()=>vk0,sha512_base64:()=>_k0,sha384_hex:()=>jk0,sha384_base64url:()=>Ck0,sha384_base64:()=>Ek0,sha256_hex:()=>Bk0,sha256_base64url:()=>Tk0,sha256_base64:()=>Pk0,sha1_hex:()=>Nk0,sha1_base64url:()=>Ak0,sha1_base64:()=>Dk0,rfc5322Email:()=>Wk0,number:()=>QG,null:()=>uj,nanoid:()=>Oj,md5_hex:()=>wk0,md5_base64url:()=>Ok0,md5_base64:()=>Mk0,mac:()=>jj,lowercase:()=>ij,ksuid:()=>Mj,ipv6:()=>Tj,ipv4:()=>Pj,integer:()=>xj,idnEmail:()=>Xk0,httpProtocol:()=>_j,html5Email:()=>Hk0,hostname:()=>Vk0,hex:()=>Fk0,guid:()=>Dj,extendedDuration:()=>Jk0,emoji:()=>Bj,email:()=>Aj,e164:()=>vj,duration:()=>Nj,domain:()=>Lk0,datetime:()=>gj,date:()=>hj,cuid2:()=>Lj,cuid:()=>Vj,cidrv6:()=>Cj,cidrv4:()=>Ej,browserEmail:()=>Zk0,boolean:()=>fj,bigint:()=>kj,base64url:()=>UV,base64:()=>Rj});function Bj(){return new RegExp(qk0,"u")}function eo($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Sj($){return new RegExp(`^${eo($)}$`)}function gj($){let Y=eo({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let z=`${Y}(?:${U.join("|")})`;return new RegExp(`^${to}T(?:${z})$`)}function JG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function IG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Vj,Lj,Fj,wj,Mj,Oj,Nj,Jk0,Dj,jY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;returnnewRegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Ik0,Kk0,Gk0,Aj,Hk0,Wk0,ao,Xk0,Zk0,qk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pj,Tj,jj=($)=>{letY=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Ej,Cj,Rj,UV,Vk0,Lk0,_j,vj,to="(?:(?:\\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])))",hj,yj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},kj,xj,QG,fj,uj,bj,ij,cj,Fk0,wk0,Mk0,Ok0,Nk0,Dk0,Ak0,Bk0,Pk0,Tk0,jk0,Ek0,Ck0,Rk0,_k0,vk0;varzV=m(()=>{$1();Vj=/^[cC][0-9a-z]{6,}$/,Lj=/^[0-9a-z]+$/,Fj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wj=/^[0-9a-vA-V]{20}$/,Mj=/^[A-Za-z0-9]{27}$/,Oj=/^[a-zA-Z0-9_-]{21}$/,Nj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),z=Math.min(...U.map((J)=>J.length-J.trimStart().length)),Q=U.map((J)=>J.slice(z)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,Y=this?.args,z=[...(this?.content??[""]).map((Q)=>`${Q}`)];return new $(...Y,z.join(`
`))}}var KE;var GE=m(()=>{KE={major:4,minor:4,patch:3}});function _E($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function wr($){if(!UV.test($))return!1;let Y=$.replace(/[-_]/g,(z)=>z==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return _E(U)}function Mr($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[z]=U;if(!z)return!1;let Q=JSON.parse(atob(z));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function zr($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function XV($,Y,U,z,Q,J){let I=U in z;if($.issues.length){if(Q&&J&&!I)return;Y.issues.push(...f8(U,$.issues))}if(!I&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(I)Y.value[U]=void 0}else Y.value[U]=$.value}function Or($){let Y=Object.keys($.shape);for(let z of Y)if(!$.shape?.[z]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${z}":expectedaZodschema`);let U=Qj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Nr($,Y,U,z,Q,J){let I=[],K=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(K.has(Z))continue;if(H==="never"){I.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},z);if(q instanceof Promise)$.push(q.then((V)=>XV(V,U,Z,Y,W,X)));else XV(q,U,Z,Y,W,X)}if(I.length)U.issues.push({code:"unrecognized_keys",keys:I,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function Qr($,Y,U,z){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!H7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))}),Y}function Jr($,Y,U,z){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function HE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(G7($)&&G7(Y)){let U=Object.keys(Y),z=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of z){let I=HE($[J],Y[J]);if(!I.valid)return{valid:!1,mergeErrorPath:[J,...I.mergeErrorPath]};Q[J]=I.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let z=0;z<$.length;z++){let Q=$[z],J=Y[z],I=HE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[z,...I.mergeErrorPath]};U.push(I.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Ir($,Y,U){let z=new Map,Q;for(let K of Y.issues)if(K.code==="unrecognized_keys"){Q??(Q=K);for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).l=!0}}else $.issues.push(K);for(let K of U.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).r=!0}else $.issues.push(K);let J=[...z].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Q)$.issues.push({...Q,keys:J});if(H7($))return $;let I=HE(Y.value,U.value);if(!I.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function Kr($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Gr($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function Hr($,Y,U,z,Q){for(let J=0;J<U.length;J++){let I=$[J],K=J<z.length;if(I.issues.length){if(!K&&J>=Q){Y.value.length=J;break}Y.issues.push(...f8(J,I.issues))}Y.value[J]=I.value}for(let J=Y.value.length-1;J>=z.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Wr($,Y,U,z,Q,J,I){if($.issues.length)if(tK.has(typeof z))U.issues.push(...f8(z,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>A8(K,I,a4()))});if(Y.issues.length)if(tK.has(typeof z))U.issues.push(...f8(z,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:z,issues:Y.issues.map((K)=>A8(K,I,a4()))});U.value.set($.value,Y.value)}function Xr($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Zr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function qr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Vr($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function GV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
import{createRequireasFy0}from"node:module";varKy0=Object.create;var{getPrototypeOf:Gy0,defineProperty:sT,getOwnPropertyNames:Wy0}=Object;varHy0=Object.prototype.hasOwnProperty;functionXy0($){returnthis[$]}varZy0,qy0,J6=($,Y,z)=>{varU=$!=null&&typeof$==="object";if(U){varQ=Y?Zy0??=newWeakMap:qy0??=newWeakMap,J=Q.get($);if(J)returnJ}z=$!=null?Ky0(Gy0($)):{};letI=Y||!$||!$.__esModule?sT(z,"default",{value:$,enumerable:!0}):z;for(letKofWy0($))if(!Hy0.call(I,K))sT(I,K,{get:Xy0.bind($,K),enumerable:!0});if(U)Q.set($,I);returnI};varE=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varVy0=($)=>$;functionLy0($,Y){this[$]=Vy0.bind(null,Y)}varx8=($,Y)=>{for(varzinY)sT($,z,{get:Y[z],enumerable:!0,configurable:!0,set:Ly0.bind(Y,z)})};varm=($,Y)=>()=>($&&(Y=$($=0)),Y);varI0=Fy0(import.meta.url);varwy0,nq,My0,Oy0,Ny0,Dy0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),bo=($,Y)=>{letz={};for(varUin$)nq(z,U,{get:$[U],enumerable:!0});if(Y)nq(z,Symbol.toStringTag,{value:"Module"});returnz},Ay0=($,Y,z,U)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varQ=Oy0(Y),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Dy0.call($,K)&&K!==z)nq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(U=My0(Y,K))||U.enumerable})}return$},pq=($,Y,z)=>(z=$!=null?wy0(Ny0($)):{},Ay0(Y||!$||!$.__esModule?nq(z,"default",{value:$,enumerable:!0}):z,$));varaT=m(()=>{wy0=Object.create,nq=Object.defineProperty,My0=Object.getOwnPropertyDescriptor,Oy0=Object.getOwnPropertyNames,Ny0=Object.getPrototypeOf,Dy0=Object.prototype.hasOwnProperty});functionco($){returntypeof$==="string"&&io.has($.replace(/#$/,""))}functionno($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letz=$.$schema.replace(/#$/,"");if(By0.has(z))return"2020-12";if(io.has(z))return"2019-09";if(Py0.has(z)||Ty0.has(z))return"draft-7";throwError(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}varBy0,io,Py0,Ty0;vartT=m(()=>{By0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),io=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Py0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Ty0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionW0($,Y,z){functionU(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:I,traits:newSet},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);letW=I.prototype,H=Object.keys(W);for(letX=0;X<H.length;X++){letZ=H[X];if(!(ZinK))K[Z]=W[Z].bind(K)}}letQ=z?.Parent??Object;classJextendsQ{}Object.defineProperty(J,"name",{value:$});functionI(K){varG;letW=z?.Parent?newJ:this;U(W,K),(G=W._zod).deferred??(G.deferred=[]);for(letHofW._zod.deferred)H();returnW}returnObject.defineProperty(I,"init",{value:U}),Object.defineProperty(I,Symbol.hasInstance,{value:(K)=>{if(z?.Parent&&Kinstanceofz.Parent)return!0;returnK?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}functiona4($){if($)Object.assign(TY,$);returnTY}varpo,oK,eT,u5,jY,TY;varEY=m(()=>{oK=Object.freeze({status:"aborted"});eT=Symbol("zod_brand");u5=classu5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};jY=classjYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(po=globalThis).__zod_globalConfig??(po.__zod_globalConfig={});TY=globalThis.__zod_globalConfig});vary0={};x8(y0,{unwrapMessage:()=>rK,uint8ArrayToHex:()=>sy0,uint8ArrayToBase64url:()=>oy0,uint8ArrayToBase64:()=>oo,stringifyPrimitive:()=>v0,slugify:()=>zj,shallowClone:()=>Qj,safeExtend:()=>cy0,required:()=>dy0,randomString:()=>yy0,propertyKeyTypes:()=>tK,promiseAllObject:()=>gy0,primitiveTypes:()=>Jj,prefixIssues:()=>f8,pick:()=>uy0,partial:()=>py0,parsedType:()=>S0,optionalKeys:()=>Ij,omit:()=>by0,objectClone:()=>vy0,numKeys:()=>ky0,nullish:()=>W7,normalizeParams:()=>x0,mergeDefs:()=>n9,merge:()=>ny0,jsonStringifyReplacer:()=>nU,joinValues:()=>O0,issue:()=>dU,isPlainObject:()=>X7,isObject:()=>CY,hexToUint8Array:()=>ry0,getSizableOrigin:()=>eK,getParsedType:()=>xy0,getLengthableOrigin:()=>$G,getEnumValues:()=>sK,getElementAtPath:()=>Sy0,floatSafeRemainder:()=>Yj,finalizeIssue:()=>A8,extend:()=>iy0,explicitlyAborted:()=>Wj,escapeRegex:()=>N$,esc:()=>dq,defineLazy:()=>E1,createTransparentProxy:()=>fy0,cloneDef:()=>hy0,clone:()=>D8,cleanRegex:()=>aK,cleanEnum:()=>my0,captureStackTrace:()=>mq,cached:()=>pU,base64urlToUint8Array:()=>ly0,base64ToUint8Array:()=>lo,assignProp:()=>H7,assertNotEqual:()=>Ey0,assertNever:()=>Ry0,assertIs:()=>Cy0,assertEqual:()=>jy0,assert:()=>_y0,allowsEval:()=>Uj,aborted:()=>Z7,NUMBER_FORMAT_RANGES:()=>Kj,Class:()=>roLine truncated
`)}var so=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,nU,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},YG,u8;var Zj=m(()=>{EY();$1();YG=W0("$ZodError",so),u8=W0("$ZodError",so,{Parent:Error})});var mU=($)=>(Y,z,U,Q)=>{let J=U?{...U,async:!1}:{async:!1},I=Y._zod.run({value:z,issues:[]},J);if(I instanceof Promise)throw new u5;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw mq(K,Q?.callee),K}return I.value},lq,lU=($)=>async(Y,z,U,Q)=>{let J=U?{...U,async:!0}:{async:!0},I=Y._zod.run({value:z,issues:[]},J);if(I instanceof Promise)I=await I;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw mq(K,Q?.callee),K}return I.value},oq,oU=($)=>(Y,z,U)=>{let Q=U?{...U,async:!1}:{async:!1},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)throw new u5;return J.issues.length?{success:!1,error:new($??YG)(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},qj,rU=($)=>async(Y,z,U)=>{let Q=U?{...U,async:!0}:{async:!0},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Vj,rq=($)=>(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return mU($)(Y,z,Q)},ty0,sq=($)=>(Y,z,U)=>{return mU($)(Y,z,U)},ey0,aq=($)=>async(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return lU($)(Y,z,Q)},$k0,tq=($)=>async(Y,z,U)=>{return lU($)(Y,z,U)},Yk0,eq=($)=>(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return oU($)(Y,z,Q)},zk0,$V=($)=>(Y,z,U)=>{return oU($)(Y,z,U)},Uk0,YV=($)=>async(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return rU($)(Y,z,Q)},Qk0,zV=($)=>async(Y,z,U)=>{return rU($)(Y,z,U)},Jk0;var Lj=m(()=>{EY();Zj();$1();lq=mU(u8),oq=lU(u8),qj=oU(u8),Vj=rU(u8),ty0=rq(u8),ey0=sq(u8),$k0=aq(u8),Yk0=tq(u8),zk0=eq(u8),Uk0=$V(u8),Qk0=YV(u8),Jk0=zV(u8)});var Y$={};x8(Y$,{xid:()=>Oj,uuid7:()=>Wk0,uuid6:()=>Gk0,uuid4:()=>Kk0,uuid:()=>RY,uppercase:()=>pj,unicodeEmail:()=>to,undefined:()=>cj,ulid:()=>Mj,time:()=>yj,string:()=>xj,sha512_hex:()=>_k0,sha512_base64url:()=>hk0,sha512_base64:()=>vk0,sha384_hex:()=>Ek0,sha384_base64url:()=>Rk0,sha384_base64:()=>Ck0,sha256_hex:()=>Pk0,sha256_base64url:()=>jk0,sha256_base64:()=>Tk0,sha1_hex:()=>Dk0,sha1_base64url:()=>Bk0,sha1_base64:()=>Ak0,rfc5322Email:()=>Xk0,number:()=>QG,null:()=>ij,nanoid:()=>Dj,md5_hex:()=>Mk0,md5_base64url:()=>Nk0,md5_base64:()=>Ok0,mac:()=>Cj,lowercase:()=>nj,ksuid:()=>Nj,ipv6:()=>Ej,ipv4:()=>jj,integer:()=>uj,idnEmail:()=>Zk0,httpProtocol:()=>hj,html5Email:()=>Hk0,hostname:()=>Lk0,hex:()=>wk0,guid:()=>Bj,extendedDuration:()=>Ik0,emoji:()=>Tj,email:()=>Pj,e164:()=>Sj,duration:()=>Aj,domain:()=>Fk0,datetime:()=>kj,date:()=>gj,cuid2:()=>wj,cuid:()=>Fj,cidrv6:()=>_j,cidrv4:()=>Rj,browserEmail:()=>qk0,boolean:()=>bj,bigint:()=>fj,base64url:()=>UV,base64:()=>vj});function Tj(){return new RegExp(Vk0,"u")}function $r($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function yj($){return new RegExp(`^${$r($)}$`)}function kj($){let Y=$r({precision:$.precision}),z=["Z"];if($.local)z.push("");if($.offset)z.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let U=`${Y}(?:${z.join("|")})`;return new RegExp(`^${eo}T(?:${U})$`)}function JG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function IG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Fj,wj,Mj,Oj,Nj,Dj,Aj,Ik0,Bj,RY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;returnnewRegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Kk0,Gk0,Wk0,Pj,Hk0,Xk0,to,Zk0,qk0,Vk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",jj,Ej,Cj=($)=>{letY=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Rj,_j,vj,UV,Lk0,Fk0,hj,Sj,eo="(?:(?:\\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])))",gj,xj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},fj,uj,QG,bj,ij,cj,nj,pj,wk0,Mk0,Ok0,Nk0,Dk0,Ak0,Bk0,Pk0,Tk0,jk0,Ek0,Ck0,Rk0,_k0,vk0,hk0;varQV=m(()=>{$1();Fj=/^[cC][0-9a-z]{6,}$/,wj=/^[0-9a-z]+$/,Mj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Oj=/^[0-9a-vA-V]{20}$/,Nj=/^[A-Za-z0-9]{27}$/,Dj=/^[a-zA-Z0-9_-]{21}$/,Aj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),U=Math.min(...z.map((J)=>J.length-J.trimStart().length)),Q=z.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,Y=this?.args,U=[...(this?.content??[""]).map((Q)=>`${Q}`)];return new $(...Y,U.join(`
`))}}var WE;var HE=m(()=>{WE={major:4,minor:4,patch:3}});function hE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Mr($){if(!UV.test($))return!1;let Y=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),z=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return hE(z)}function Or($,Y=null){try{let z=$.split(".");if(z.length!==3)return!1;let[U]=z;if(!U)return!1;let Q=JSON.parse(atob(U));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function Qr($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function ZV($,Y,z,U,Q,J){let I=z in U;if($.issues.length){if(Q&&J&&!I)return;Y.issues.push(...f8(z,$.issues))}if(!I&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[z]});return}if($.value===void 0){if(I)Y.value[z]=void 0}else Y.value[z]=$.value}function Nr($){let Y=Object.keys($.shape);for(let U of Y)if(!$.shape?.[U]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${U}":expectedaZodschema`);let z=Ij($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(z)}}function Dr($,Y,z,U,Q,J){let I=[],K=Q.keySet,G=Q.catchall._zod,W=G.def.type,H=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(K.has(Z))continue;if(W==="never"){I.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},U);if(q instanceof Promise)$.push(q.then((V)=>ZV(V,z,Z,Y,H,X)));else ZV(q,z,Z,Y,H,X)}if(I.length)z.issues.push({code:"unrecognized_keys",keys:I,input:Y,inst:J});if(!$.length)return z;return Promise.all($).then(()=>{return z})}function Jr($,Y,z,U){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!Z7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:$.map((J)=>J.issues.map((I)=>A8(I,U,a4())))}),Y}function Ir($,Y,z,U){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:$.map((J)=>J.issues.map((I)=>A8(I,U,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:[],inclusive:!1});return Y}function XE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(X7($)&&X7(Y)){let z=Object.keys(Y),U=Object.keys($).filter((J)=>z.indexOf(J)!==-1),Q={...$,...Y};for(let J of U){let I=XE($[J],Y[J]);if(!I.valid)return{valid:!1,mergeErrorPath:[J,...I.mergeErrorPath]};Q[J]=I.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let z=[];for(let U=0;U<$.length;U++){let Q=$[U],J=Y[U],I=XE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[U,...I.mergeErrorPath]};z.push(I.data)}return{valid:!0,data:z}}return{valid:!1,mergeErrorPath:[]}}function Kr($,Y,z){let U=new Map,Q;for(let K of Y.issues)if(K.code==="unrecognized_keys"){Q??(Q=K);for(let G of K.keys){if(!U.has(G))U.set(G,{});U.get(G).l=!0}}else $.issues.push(K);for(let K of z.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!U.has(G))U.set(G,{});U.get(G).r=!0}else $.issues.push(K);let J=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Q)$.issues.push({...Q,keys:J});if(Z7($))return $;let I=XE(Y.value,z.value);if(!I.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function Gr($,Y){for(let z=$.length-1;z>=0;z--)if($[z]._zod[Y]!=="optional")return z+1;return 0}function Wr($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function Hr($,Y,z,U,Q){for(let J=0;J<z.length;J++){let I=$[J],K=J<U.length;if(I.issues.length){if(!K&&J>=Q){Y.value.length=J;break}Y.issues.push(...f8(J,I.issues))}Y.value[J]=I.value}for(let J=Y.value.length-1;J>=U.length;J--)if(z[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Xr($,Y,z,U,Q,J,I){if($.issues.length)if(tK.has(typeof U))z.issues.push(...f8(U,$.issues));else z.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>A8(K,I,a4()))});if(Y.issues.length)if(tK.has(typeof U))z.issues.push(...f8(U,Y.issues));else z.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:U,issues:Y.issues.map((K)=>A8(K,I,a4()))});z.value.set($.value,Y.value)}function Zr($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function qr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Vr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Lr($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function WV($,Y,z){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
@@ -60,94 +60,94 @@ import{createRequire as Ly0}from"node:module";var Iy0=Object.create;var{getProto
newResult[${P}]=${D}.value;
}
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,I=TY,K=!AY.jitless,H=K&&Yj.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=z.value);let V=Z.value;if(!I(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return Nr([],V,Z,q,X,$)}return U(Z,q)}});GG=H0("$ZodUnion",($,Y)=>{q1.init($,Y),E1($._zod,"optin",()=>Y.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),E1($._zod,"optout",()=>Y.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),E1($._zod,"values",()=>{if(Y.options.every((z)=>z._zod.values))return new Set(Y.options.flatMap((z)=>Array.from(z._zod.values)));return}),E1($._zod,"pattern",()=>{if(Y.options.every((z)=>z._zod.pattern)){let z=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${z.map((Q)=>aK(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else{if(G.issues.length===0)return G;I.push(G)}}if(!J)return Qr(I,z,$,Q);return Promise.all(I).then((K)=>{return Qr(K,z,$,Q)})}});oE=H0("$ZodXor",($,Y)=>{GG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else I.push(G)}if(!J)return Jr(I,z,$,Q);return Promise.all(I).then((K)=>{return Jr(K,z,$,Q)})}}),rE=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,GG.init($,Y);let U=$._zod.parse;E1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(J)}"`);for(let[K,G]of Object.entries(I)){if(!Q[K])Q[K]=new Set;for(let H of G)Q[K].add(H)}}return Q});let z=cz(()=>{let Q=Y.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(I)}"`);for(let G of K){if(J.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);J.set(G,I)}}return J});$._zod.parse=(Q,J)=>{let I=Q.value;if(!TY(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=z.value.get(I?.[Y.discriminator]);if(K)return K._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return U(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(z.value.keys()),input:I,path:[Y.discriminator],inst:$}),Q}}),sE=H0("$ZodIntersection",($,Y)=>{q1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},z),I=Y.right._zod.run({value:Q,issues:[]},z);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,H])=>{return Ir(U,G,H)});return Ir(U,J,I)}});VV=H0("$ZodTuple",($,Y)=>{q1.init($,Y);let U=Y.items;$._zod.parse=(z,Q)=>{let J=z.value;if(!Array.isArray(J))return z.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),z;z.value=[];let I=[],K=Kr(U,"optin"),G=Kr(U,"optout");if(!Y.rest){if(J.length<K)return z.issues.push({code:"too_small",minimum:K,inclusive:!0,input:J,inst:$,origin:"array"}),z;if(J.length>U.length)z.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)I.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)I.push(q.then((V)=>Gr(V,z,W)));else Gr(q,z,W)}}if(I.length)return Promise.all(I).then(()=>Hr(H,z,U,J,G));return Hr(H,z,U,J,G)}});aE=H0("$ZodRecord",($,Y)=>{q1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value;if(!G7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],I=Y.keyType._zod.values;if(I){U.value={};let K=new Set;for(let H of I)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},z);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>A8(q,z,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},z);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...f8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...f8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!K.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec
Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,I=CY,K=!TY.jitless,W=K&&Uj.value,H=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=U.value);let V=Z.value;if(!I(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&W&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!H)return Z;return Dr([],V,Z,q,X,$)}return z(Z,q)}});GG=W0("$ZodUnion",($,Y)=>{V1.init($,Y),E1($._zod,"optin",()=>Y.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),E1($._zod,"optout",()=>Y.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),E1($._zod,"values",()=>{if(Y.options.every((U)=>U._zod.values))return new Set(Y.options.flatMap((U)=>Array.from(U._zod.values)));return}),E1($._zod,"pattern",()=>{if(Y.options.every((U)=>U._zod.pattern)){let U=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${U.map((Q)=>aK(Q.source)).join("|")})$`)}return});let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,Q)=>{if(z)return z(U,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else{if(G.issues.length===0)return G;I.push(G)}}if(!J)return Jr(I,U,$,Q);return Promise.all(I).then((K)=>{return Jr(K,U,$,Q)})}});sE=W0("$ZodXor",($,Y)=>{GG.init($,Y),Y.inclusive=!1;let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,Q)=>{if(z)return z(U,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else I.push(G)}if(!J)return Ir(I,U,$,Q);return Promise.all(I).then((K)=>{return Ir(K,U,$,Q)})}}),aE=W0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,GG.init($,Y);let z=$._zod.parse;E1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(J)}"`);for(let[K,G]of Object.entries(I)){if(!Q[K])Q[K]=new Set;for(let W of G)Q[K].add(W)}}return Q});let U=pU(()=>{let Q=Y.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(I)}"`);for(let G of K){if(J.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);J.set(G,I)}}return J});$._zod.parse=(Q,J)=>{let I=Q.value;if(!CY(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=U.value.get(I?.[Y.discriminator]);if(K)return K._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return z(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(U.value.keys()),input:I,path:[Y.discriminator],inst:$}),Q}}),tE=W0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(z,U)=>{let Q=z.value,J=Y.left._zod.run({value:Q,issues:[]},U),I=Y.right._zod.run({value:Q,issues:[]},U);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,W])=>{return Kr(z,G,W)});return Kr(z,J,I)}});LV=W0("$ZodTuple",($,Y)=>{V1.init($,Y);let z=Y.items;$._zod.parse=(U,Q)=>{let J=U.value;if(!Array.isArray(J))return U.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),U;U.value=[];let I=[],K=Gr(z,"optin"),G=Gr(z,"optout");if(!Y.rest){if(J.length<K)return U.issues.push({code:"too_small",minimum:K,inclusive:!0,input:J,inst:$,origin:"array"}),U;if(J.length>z.length)U.issues.push({code:"too_big",maximum:z.length,inclusive:!0,input:J,inst:$,origin:"array"})}let W=Array(z.length);for(let H=0;H<z.length;H++){let X=z[H]._zod.run({value:J[H],issues:[]},Q);if(X instanceof Promise)I.push(X.then((Z)=>{W[H]=Z}));else W[H]=X}if(Y.rest){let H=z.length-1,X=J.slice(z.length);for(let Z of X){H++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)I.push(q.then((V)=>Wr(V,U,H)));else Wr(q,U,H)}}if(I.length)return Promise.all(I).then(()=>Hr(W,U,z,J,G));return Hr(W,U,z,J,G)}});eE=W0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(z,U)=>{let Q=z.value;if(!X7(Q))return z.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),z;let J=[],I=Y.keyType._zod.values;if(I){z.value={};let K=new Set;for(let W of I)if(typeof W==="string"||typeof W==="number"||typeof W==="symbol"){K.add(typeof W==="number"?W.toString():W);let H=Y.keyType._zod.run({value:W,issues:[]},U);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length){z.issues.push({code:"invalid_key",origin:"record",issues:H.issues.map((q)=>A8(q,U,a4())),input:W,path:[W],inst:$});continue}let X=H.value,Z=Y.valueType._zod.run({value:Q[W],issues:[]},U);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)z.issues.push(...f8(W,q.issues));z.value[X]=q.value}));else{if(Z.issues.length)z.issues.push(...f8(W,Z.issues));z.value[X]=Z.value}}let G;for(let W in Q)if(!K.has(W))G=G??[],G.push(W);if(G&&G.length>0)z.issues.push({code:"unrec
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letIof$.seen.entries()){letK=I[1];if(Y===I[0]){J(I);continue}if($.external){letH=$.external.registry.get(I[0])?.id;if(Y!==I[0]&&H){J(I);continue}}if($.metadataRegistry.get(I[0])?.id){J(I);continue}if(K.cycle){J(I);continue}if(K.count>1){if($.reused==="ref"){J(I);continue}}}}functionV7($,Y){letU=$.seen.get(Y);if(!U)throwError("Unprocessed schema. This is a bug in Zod.");letz=(K)=>{letG=$.seen.get(K);if(G.ref===null)return;letH=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){z(X);letq=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);elseObject.assign(H,V);if(Object.assign(H,W),K._zod.parent===X)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(!(MinW))deleteH[M]}if(V.$ref&&q.def)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(Minq.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))deleteH[M]}}letZ=K._zod.parent;if(Z&&Z!==X){z(Z);letq=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(letVinH){if(V==="$ref"||V==="allOf")continue;if(Vinq.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))deleteH[V]}}}$.override({zodSchema:K,jsonSchema:H,path:G.path??[]})};for(letKof[...$.seen.entries()].reverse())z(K[0]);letQ={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letK=$.external.registry.get(Y)?.id;if(!K)throwError("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,U.def??U.schema);letJ=$.metadataRegistry.get(Y)?.id;if(J!==void0&&Q.id===J)deleteQ.id;letI=$.external?.defs??{};for(letKof$.seen.entries()){letG=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;I[G.defId]=G.def}}if($.external);elseif(Object.keys(I).length>0)if($.target==="draft-2020-12")Q.$defs=I;elseQ.definitions=I;try{letK=JSON.parse(JSON.stringify(Q));returnObject.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:HQ(Y,"input",$.processors),output:HQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionP8($,Y){letU=Y??{seen:newSet};if(U.seen.has($))return!1;U.seen.add($);letz=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")returnP8(z.element,U);if(z.type==="set")returnP8(z.valueType,U);if(z.type==="lazy")returnP8(z.getter(),U);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")returnP8(z.innerType,U);if(z.type==="intersection")returnP8(z.left,U)||P8(z.right,U);if(z.type==="record"||z.type==="map")returnP8(z.keyType,U)||P8(z.valueType,U);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnP8(z.in,U)||P8(z.out,U)}if(z.type==="object"){for(letQinz.shape)if(P8(z.shape[Q],U))return!0;return!1}if(z.type==="union"){for(letQofz.options)if(P8(Q,U))return!0;return!1}if(z.type==="tuple"){for(letQofz.items)if(P8(Q,U))return!0;if(z.rest&&P8(z.rest,U))return!0;return!1}return!1}varK_=($,Y={})=>(U)=>{letz=Z7({...U,processors:Y});returnI4($,z),q7(z,$),V7(z,$)},HQ=($,Y,U={})=>(z)=>{let{libraryOptions:Q,target:J}=z??{},I=Z7({...Q??{},target:J,io:Y,processors:U});returnI4($,I),q7(I,$),V7(I,$)};varMG=m(()=>{LG()});functionvY($,Y){if("_idmap"in$){letz=$,Q=Z7({...Y,processors:nV}),J={};for(letGofz._idmap.entries()){let[H,W]=G;I4(W,Q)}letI={},K={registry:z,uri:Y?.uri,defs:J};Q.external=K;for(letGofz._idmap.entries()){let[H,W]=G;q7(Q,W),I[H]=V7(Q,W)}if(Object.keys(J).length>0){letG=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}letU=Z7({...Y,processors:nV});returnI4($,U),q7(U,$),V7(U,$)}varex0,G_=($,Y,U,z)=>{letQ=U;Q.type="string";let{minimum:J,maximum:I,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofJ==="number")Q.minLength=J;if(typeofI==="number")Q.maxLength=I;if(K){if(Q.format=ex0[K]??K,Q.format==="")deleteQ.format;if(K==="time")deleteQ.format}if(H)Q.contentEncoding=H;if(G&&G.size>0){letW=[...G];if(W.length===1)Q.pattern=W[0].source;elseif(W.length>1)Q.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},H_=($,Y,U,z)=>{letQ=U,{minimum:J,maximum:I,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Q.type="integer";elseQ.type="number";letX=typeofW==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeofH==="number"&&H<=(I??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;elseQ.exclusiveMinimuLine truncated
`}function Su0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(current:${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!hu0.test($)){let U=[...$].filter((z)=>!/[A-Za-z0-9._-]/.test(z)).filter((z,Q,J)=>J.indexOf(z)===Q);return Y.push(`Toolnamecontainsinvalidcharacters:${U.map((z)=>`"${z}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function gu0($,Y){if(Y.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let U of Y)console.warn(`-${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function QS($){let Y=Su0($);return gu0($,Y.warnings),Y.isValid}function yu0($){return typeof $==="object"&&$!==null&&"_zod"in $}function ku0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function xu0($){if(typeof $!=="object"||$===null)return!1;if(hQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>yu0(U))}function Rw($){if($===void 0)return;if(xu0($))return U0($);if(typeof $==="object"&&$!==null&&!hQ($)&&Object.values($).some((Y)=>ku0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!hQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var hh,Lf0,A1,V1,Ff0,Vt="2026-07-28",E7,wt,Of0,Nf0,Df0,Nt,Dt,Bf0,qw,Yu1,Uu1,Ut,bh,Rf0,_f0,_Q,n0,J1,Aw,Pt,gQ,Bw,Sf0=0,gf0="private",yf0,nf0,Lw,ph,Et,zu1,Qu1,rf0,sf0,dh,Fw,qH="2026-07-28",_t,ef0,D$=($)=>uG.safeParse($).success,C7=($)=>bG.safeParse($).success,XH=($)=>OQ.safeParse($).success,Ew=($)=>NQ.safeParse($).success,s9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Kt="x-mcp-header",$u0,Yu0,Uu0,zu0,Ow=-32020,Ju1,Qu0,Gt=!1,gh="draft-2020-12",Ku0,Zu0,qu0,Ht,Vu0,Nu0,St=250,Du0,Au0,xt,ft,Bu0,Pu0,bt=60000,ju0,Eu0,Cu0,it,$S,vu0,Iu1,ct=10485760,US=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??ct}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBufferexceededmaximumsizeof${this._maxBufferSize}bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return nt(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},hu0;var _w=m(()=>{rT();sT();ea();av();hh=Symbol.for("mcp.sdk.errorBrands");Lf0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return vQ(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return vQ(this,Y)}constructor(Y,U,z){super(U);this.code=Y,this.errorUri=z,this.name="OAuthError",kh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},A1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),V1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return vQ(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return vQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",kh(this,new.target)}},Ff0=class extends V1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};E7=[Vt];wt=["task","inputRequests","requestState"];Nf0=new Set(["const","enum","default","examples"]),Df0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Nt={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Dt={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Bf0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Yu1=Object.keys(Nt),Uu1=Object.keys(Dt);Ut={ok:!1,reason:"not-in-era"};bh={era:"2025-11-25",hasRequestMethod:At,hasNotificationMethod:Bt,validateRequest:($,Y)=>Vw(jf0($),Y),validateResult:($,Y)=>Vw(Tf0($),Y),validateNotification:($,Y)=>Vw(Ef0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ut,validateInputResponse:()=>Ut,samplingResultVariant:($,Y)=>{let U=Mt();return Vw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=Ft($),z=U.structuredContent;if(z===void 0)return U;let Q=typeof z!=="object"||z===null||Array.isArray(z),J=Y!==void 0&&Ot(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:z}}},decodeResult($,Y){if(Sh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:Qt(U)}}return{kind:"complete",result:Qt(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letIof$.seen.entries()){letK=I[1];if(Y===I[0]){J(I);continue}if($.external){letW=$.external.registry.get(I[0])?.id;if(Y!==I[0]&&W){J(I);continue}}if($.metadataRegistry.get(I[0])?.id){J(I);continue}if(K.cycle){J(I);continue}if(K.count>1){if($.reused==="ref"){J(I);continue}}}}functionw7($,Y){letz=$.seen.get(Y);if(!z)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letG=$.seen.get(K);if(G.ref===null)return;letW=G.def??G.schema,H={...W},X=G.ref;if(G.ref=null,X){U(X);letq=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))W.allOf=W.allOf??[],W.allOf.push(V);elseObject.assign(W,V);if(Object.assign(W,H),K._zod.parent===X)for(letMinW){if(M==="$ref"||M==="allOf")continue;if(!(MinH))deleteW[M]}if(V.$ref&&q.def)for(letMinW){if(M==="$ref"||M==="allOf")continue;if(Minq.def&&JSON.stringify(W[M])===JSON.stringify(q.def[M]))deleteW[M]}}letZ=K._zod.parent;if(Z&&Z!==X){U(Z);letq=$.seen.get(Z);if(q?.schema.$ref){if(W.$ref=q.schema.$ref,q.def)for(letVinW){if(V==="$ref"||V==="allOf")continue;if(Vinq.def&&JSON.stringify(W[V])===JSON.stringify(q.def[V]))deleteW[V]}}}$.override({zodSchema:K,jsonSchema:W,path:G.path??[]})};for(letKof[...$.seen.entries()].reverse())U(K[0]);letQ={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letK=$.external.registry.get(Y)?.id;if(!K)throwError("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,z.def??z.schema);letJ=$.metadataRegistry.get(Y)?.id;if(J!==void0&&Q.id===J)deleteQ.id;letI=$.external?.defs??{};for(letKof$.seen.entries()){letG=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;I[G.defId]=G.def}}if($.external);elseif(Object.keys(I).length>0)if($.target==="draft-2020-12")Q.$defs=I;elseQ.definitions=I;try{letK=JSON.parse(JSON.stringify(Q));returnObject.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:XQ(Y,"input",$.processors),output:XQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionP8($,Y){letz=Y??{seen:newSet};if(z.seen.has($))return!1;z.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnP8(U.element,z);if(U.type==="set")returnP8(U.valueType,z);if(U.type==="lazy")returnP8(U.getter(),z);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnP8(U.innerType,z);if(U.type==="intersection")returnP8(U.left,z)||P8(U.right,z);if(U.type==="record"||U.type==="map")returnP8(U.keyType,z)||P8(U.valueType,z);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnP8(U.in,z)||P8(U.out,z)}if(U.type==="object"){for(letQinU.shape)if(P8(U.shape[Q],z))return!0;return!1}if(U.type==="union"){for(letQofU.options)if(P8(Q,z))return!0;return!1}if(U.type==="tuple"){for(letQofU.items)if(P8(Q,z))return!0;if(U.rest&&P8(U.rest,z))return!0;return!1}return!1}varW_=($,Y={})=>(z)=>{letU=L7({...z,processors:Y});returnI4($,U),F7(U,$),w7(U,$)},XQ=($,Y,z={})=>(U)=>{let{libraryOptions:Q,target:J}=U??{},I=L7({...Q??{},target:J,io:Y,processors:z});returnI4($,I),F7(I,$),w7(I,$)};varMG=m(()=>{LG()});functiongY($,Y){if("_idmap"in$){letU=$,Q=L7({...Y,processors:pV}),J={};for(letGofU._idmap.entries()){let[W,H]=G;I4(H,Q)}letI={},K={registry:U,uri:Y?.uri,defs:J};Q.external=K;for(letGofU._idmap.entries()){let[W,H]=G;F7(Q,H),I[W]=w7(Q,H)}if(Object.keys(J).length>0){letG=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}letz=L7({...Y,processors:pV});returnI4($,z),F7(z,$),w7(z,$)}var$f0,H_=($,Y,z,U)=>{letQ=z;Q.type="string";let{minimum:J,maximum:I,format:K,patterns:G,contentEncoding:W}=$._zod.bag;if(typeofJ==="number")Q.minLength=J;if(typeofI==="number")Q.maxLength=I;if(K){if(Q.format=$f0[K]??K,Q.format==="")deleteQ.format;if(K==="time")deleteQ.format}if(W)Q.contentEncoding=W;if(G&&G.size>0){letH=[...G];if(H.length===1)Q.pattern=H[0].source;elseif(H.length>1)Q.allOf=[...H.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},X_=($,Y,z,U)=>{letQ=z,{minimum:J,maximum:I,format:K,multipleOf:G,exclusiveMaximum:W,exclusiveMinimum:H}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Q.type="integer";elseQ.type="number";letX=typeofH==="number"&&H>=(J??Number.NEGATIVE_INFINITY),Z=typeofW==="number"&&W<=(I??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=H,Q.exclusiveMinimum=!0;elseQ.exclusiveMinimuLine truncated
`}function gu0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(current:${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!Su0.test($)){let z=[...$].filter((U)=>!/[A-Za-z0-9._-]/.test(U)).filter((U,Q,J)=>J.indexOf(U)===Q);return Y.push(`Toolnamecontainsinvalidcharacters:${z.map((U)=>`"${U}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function yu0($,Y){if(Y.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let z of Y)console.warn(`-${z}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function IS($){let Y=gu0($);return yu0($,Y.warnings),Y.isValid}function ku0($){return typeof $==="object"&&$!==null&&"_zod"in $}function xu0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function fu0($){if(typeof $!=="object"||$===null)return!1;if(gQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((z)=>ku0(z))}function _w($){if($===void 0)return;if(fu0($))return z0($);if(typeof $==="object"&&$!==null&&!gQ($)&&Object.values($).some((Y)=>xu0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!gQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var gh,Ff0,B1,L1,wf0,Lt="2026-07-28",_7,Mt,Nf0,Df0,Af0,Dt,At,Pf0,Vw,Ku1,Gu1,Ut,ch,_f0,vf0,hQ,n0,J1,Bw,Tt,kQ,Pw,gf0=0,yf0="private",kf0,pf0,Fw,mh,Ct,Wu1,Hu1,sf0,af0,lh,ww,qW="2026-07-28",vt,$u0,D$=($)=>uG.safeParse($).success,v7=($)=>bG.safeParse($).success,XW=($)=>DQ.safeParse($).success,Cw=($)=>AQ.safeParse($).success,a9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Gt="x-mcp-header",Yu0,zu0,Uu0,Qu0,Nw=-32020,Xu1,Ju0,Wt=!1,kh="draft-2020-12",Gu0,qu0,Vu0,Ht,Lu0,Du0,gt=250,Au0,Bu0,ft,ut,Pu0,Tu0,it=60000,Eu0,Cu0,Ru0,ct,zS,hu0,Zu1,nt=10485760,QS=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??nt}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBufferexceededmaximumsizeof${this._maxBufferSize}bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return pt(Y)}catch(z){if(z instanceof SyntaxError)continue;throw z}}return null}clear(){this._buffer=void 0}},Su0;var vw=m(()=>{aT();tT();$t();ev();gh=Symbol.for("mcp.sdk.errorBrands");Ff0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return SQ(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return SQ(this,Y)}constructor(Y,z,U){super(z);this.code=Y,this.errorUri=U,this.name="OAuthError",fh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},B1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),L1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return SQ(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return SQ(this,$)}constructor($,Y,z){super(Y);this.code=$,this.data=z,this.name="SdkError",fh(this,new.target)}},wf0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,z){super($,Y,z);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};_7=[Lt];Mt=["task","inputRequests","requestState"];Df0=new Set(["const","enum","default","examples"]),Af0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Dt={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},At={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Pf0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Ku1=Object.keys(Dt),Gu1=Object.keys(At);Ut={ok:!1,reason:"not-in-era"};ch={era:"2025-11-25",hasRequestMethod:Bt,hasNotificationMethod:Pt,validateRequest:($,Y)=>Lw(Ef0($),Y),validateResult:($,Y)=>Lw(jf0($),Y),validateNotification:($,Y)=>Lw(Cf0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ut,validateInputResponse:()=>Ut,samplingResultVariant:($,Y)=>{let z=Ot();return Lw($?z.CreateMessageResultWithToolsSchema:z.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let z=wt($),U=z.structuredContent;if(U===void 0)return z;let Q=typeof U!=="object"||U===null||Array.isArray(U),J=Y!==void 0&&Nt(Y);if(!Q&&!J)return z;return{...z,structuredContent:{result:U}}},decodeResult($,Y){if(yh(Y)&&"resultType"in Y){let z={...Y};return delete z.resultType,{kind:"complete",result:Jt(z)}}return{kind:"complete",result:Jt(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
*content-type
*Copyright(c)2015DouglasChristopherWilson
*MITLicensed
*/vu0=R0(($)=>{var Y=/;*([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/\\([\u000b\u0020-\u00ff])/g,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=Q;function Q(K){if(!K)throw TypeError("argument string is required");var G=typeof K==="object"?J(K):K;if(typeof G!=="string")throw TypeError("argument string is required to be a string");var H=G.indexOf(";"),W=H!==-1?G.slice(0,H).trim():G.trim();if(!z.test(W))throw TypeError("invalid media type");var X=new I(W.toLowerCase());if(H!==-1){var Z,q,V;Y.lastIndex=H;while(q=Y.exec(G)){if(q.index!==H)throw TypeError("invalid parameter format");if(H+=q[0].length,Z=q[1].toLowerCase(),V=q[2],V.charCodeAt(0)===34){if(V=V.slice(1,-1),V.indexOf("\\")!==-1)V=V.replace(U,"$1")}X.parameters[Z]=V}if(H!==G.length)throw TypeError("invalid parameter format")}return X}function J(K){var G;if(typeof K.getHeader==="function")G=K.getHeader("content-type");else if(typeof K.headers==="object")G=K.headers&&K.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function I(K){this.parameters=Object.create(null),this.type=K}}),Iu1=nq(vu0(),1);hu0=/^[A-Za-z0-9._-]{1,128}$/});function JS($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return eb0(Y),Y}var vw,pt,L1,v1,z5,Sw,fu0,dt,mt,hw,uu0,Q5,bu0,iu0,lt,cu0,gw,yQ,LH,kQ,yw,nu0,ot,pu0,du0,mu0,IS,lu0,KS,rt,ou0,ru0,su0,au0,tu0,eu0,$b0,Yb0,GS,Ub0,zb0,Qb0,st,at,tt,Jb0,Ib0,Kb0,HS,Gb0,et,Hb0,Wb0,Xb0,Zb0,qb0,Vb0,Lb0,Fb0,$e,wb0,Ye,Ue,ze,Mb0,WS,Ob0,Qe,Je,Ie,Nb0,Db0,Ke,Ab0,Bb0,Pb0,Ge,Tb0,jb0,He,Eb0,Cb0,Rb0,_b0,vb0,hb0,Sb0,gb0,yb0,kb0,xb0,fb0,ub0,bb0,ib0,cb0,nb0,pb0,db0,mb0,lb0,ob0,rb0,We,sb0,ab0,tb0,eb0,kw=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=JS(ab0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=co($,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(Y==="2020-12")return this.ajv;if(Y==="2019-09")return this._ajv2019??=JS(sb0.Ajv2019);return this._ajvDraft7??=JS(We.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(z)=>{return U(z)?{valid:!0,data:z,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},Mu1;var Xe=m(()=>{rT();sT();vw=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.regexpCode=$.getEsmExportName=$.getProperty=$.safeStringify=$.stringify=$.strConcat=$.addCodeArg=$.str=$._=$.nil=$._Code=$.Name=$.IDENTIFIER=$._CodeOrName=void 0;var Y=class{};$._CodeOrName=Y,$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var U=class extends Y{constructor(w){super();if(!$.IDENTIFIER.test(w))throw Error("CodeGen: name must be a valid identifier");this.str=w}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var z=class extends Y{constructor(w){super();this._items=typeof w==="string"?[w]:w}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let w=this._items[0];return w===""||w==='""'}get str(){var w;return(w=this._str)!==null&&w!==void 0?w:this._str=this._items.reduce((N,O)=>`${N}${O}`,"")}get names(){var w;return(w=this._names)!==null&&w!==void 0?w:this._names=this._items.reduce((N,O)=>{if(O instanceof U)N[O.str]=(N[O.str]||0)+1;return N},{})}};$._Code=z,$.nil=new z("");function Q(w,...N){let O=[w[0]],D=0;while(D<N.length)K(O,N[D]),O.push(w[++D]);return new z(O)}$._=Q;let J=new z("+");function I(w,...N){let O=[q(w[0])],D=0;while(D<N.length)O.push(J),K(O,N[D]),O.push(J,q(w[++D]));return G(O),new z(O)}$.str=I;function K(w,N){if(N instanceof z)w.push(...N._items);else if(N instanceof U)w.push(N);else w.push(X(N))}$.addCodeArg=K;function G(w){let N=1;while(N<w.length-1){if(w[N]===J){let O=H(w[N-1],w[N+1]);if(O!==void 0){w.splice(N-1,3,O);continue}w[N++]="+"}N++}}function H(w,N){if(N==='""')return w;if(w==='""')return N;if(typeof w=="string"){if(N instanceof U||w[w.length-1]!=='"')return;if(typeof N!="string")return`${w.slice(0,-1)}${N}"`;if(N[0]==='"')return w.slice(0,-1)+N.slice(1);return}if(typeof N=="string"&&N[0]==='"'&&!(w instanceof U))return`"${w}${N.slice(1)}`}function W(w,N){return N.emptyStr()?w:w.emptyStr()?N:I`${w}${N}`}$.strConcat=W;function X(w){return typeof w=="number"||typeof w=="boolean"||w===null?w:q(Array.isArray(w)?w.join(","):w)}function Z(w){return new z(q(w))}$.stringify=Z;function q(w){return JSON.stringify(w).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(w){return typeof w=="string"&&$.IDENTIFIER.test(w)?new z(`.${w}`):Q`[${w}]`}$.getProperty=V;function F(w){if(typeof w=="string"&&$.IDENTIFIER.test(w))returnnewz(`${w}`);throwError(`CodeGen: invalid export name: ${w}, use explicit $id name mapping`)}$.getEsmExportName=F;functionM(w){returnnewz(w.toStringLine truncated
deps:${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);I(G,H),K(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function I(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let F=H[V];if(F.length===0)continue;let M=(0,z.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(M,()=>{for(let w of F)(0,z.checkReportMissingProp)(G,w)});else W.if(Y._`${M}&&(${(0,z.checkMissingProp)(G,F,q)})`),(0,z.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=I;function K(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let F in H){if((0,U.alwaysValidSchema)(q,H[F]))continue;W.if((0,z.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),Gb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L1(),U=v1(),z={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName:${Q.propertyName}}`},code(Q){let{gen:J,schema:I,data:K,it:G}=Q;if((0,U.alwaysValidSchema)(G,I))return;let H=J.name("valid");J.forIn("key",K,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=z}),et=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),U=L1(),z=z5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:I})=>U._`{additionalProperty:${I.additionalProperty}}`},code(I){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=I;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let F=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);w(),I.ok(U._`${X}===${z.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!M.length)D(T);else K.if(N(T),()=>D(T))})}function N(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");A=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)A=(0,U.or)(...F.map((j)=>U._`${T}===${j}`));else A=U.nil;if(M.length)A=(0,U.or)(A,...M.map((j)=>U._`${(0,Y.usePattern)(I,j)}.test(${T})`));return(0,U.not)(A)}function O(T){K.code(U._`delete${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(I.setParams({additionalProperty:T}),I.error(),!q)K.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),K.if((0,U.not)(A),()=>{I.reset(),O(T)});else if(P(T,A),!q)K.if((0,U.not)(A),()=>K.break())}}function P(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(C,A)}}};$.default=J}),Hb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=yQ(),U=Q5(),z=v1(),Q=et(),J={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=I;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=z.mergeEvaluated.props(K,(0,z.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,z.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))M(w);else{if(K.if((0,U.propertyInData)(K,W,w,X.opts.ownProperties)),M(w),!X.allErrors)K.else().var(V,!0);K.endIf()}I.it.definedProperties.add(w),I.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){I.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Wb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),U=L1(),z=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=I,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,z.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=K.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:w}=X;N();function N(){for(let P of q){if(F)O(P);if(X.allErrors)
Line truncated
`)}openNode($,Y){let U=this.tos,z=this._xml;if(U&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),Bk(z,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)k30(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Bk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(y30.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}Pk.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};x30.exports=Pk});var Tk=E((Ft0)=>{var f30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Lt0($){if(typeof $==="string")return $;if(f30)return f30.decode($);return $.toString()}Ft0.bufferToString=Lt0});var n30=E((b30)=>{Object.defineProperty(b30,"__esModule",{value:!0});b30.CHAR=`
`,$=this.i;break;case ke0:{let{entityReturnState:U}=this,z=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(z==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(z),this.entity="";if(U!==C8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vW($))this.state=ve0,this.unget(),this.xmlDeclPossible=!1;else switch($){case lO:this.state=ge0,this.xmlDeclPossible=!1;break;case Z70:this.state=De0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=je0;break;default:this.fail("disallowed character in tag name"),this.state=C8,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=yk,this.openWakaBang="";break;case"--":this.state=gk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=vk,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(mO))this.state=Ae0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===mO)this.state=Be0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=gk}sCommentEnded(){let $=this.getCodeNorm();if($!==P6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=gk;else this.state=C8}sCData(){if(this.captureToChar(EJ))this.state=Pe0}sCDataEnding(){let $=this.getCodeNorm();if($===EJ)this.state=Te0;else this.text+=`]${String.fromCodePoint($)}`,this.state=yk}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case P6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case EJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=yk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J70;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?dO:kk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let z=U===o6;if(z||p8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?HU:I70}else this.state=z?dO:kk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=dO;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=dO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===P6){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(Y===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=kk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=HU;return}if($!==k4)this.state=Ee0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(ue0);if($===o6){this.state=HU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===jJ))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===jJ?K70:Ce0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=HU,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==jJ)this.fail("value required.");this.state=K70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=HU,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!oO($))this.fail("value must be quoted."),this.q=X70;else this.q=$;this.state=Re0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=HU,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver
Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(F31.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let z=`${w31.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(z.indexOf(Q.quote)!==-1)return this.quoteField(z.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(z.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(z);return z}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}cJ.FieldFormatter=aI0});var wf=E((tI0)=>{Object.defineProperty(tI0,"__esModule",{value:!0});tI0.isSyncTransform=void 0;tI0.isSyncTransform=($)=>$.length===1});var YK0=E((nJ)=>{var $K0=nJ&&nJ.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(nJ,"__esModule",{value:!0});nJ.RowFormatter=void 0;var O31=$K0(CN()),N31=$K0(cI0()),D31=Ff(),A31=wf();class AU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new D31.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(AU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(A31.isSyncTransform($))return(Y,U)=>{let z=null;try{z=$(Y)}catch(Q){return U(Q)}return U(null,z)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!O31.default($))throw TypeError("The transform should be a function");this._rowTransform=AU.createTransform($)}format($,Y){this.callTransformer($,(U,z)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(z){let{shouldFormatColumns:J,headers:I}=this.checkHeaders(z);if(this.shouldWriteHeaders&&I&&!this.hasWrittenHeaders)Q.push(this.formatColumns(I,!0)),this.hasWrittenHeaders=!0;if(J){let K=this.gatherColumns(z);Q.push(this.formatColumns(K,!1))}}return Y(null,Q)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=AU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!N31.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(AU.isRowHashArray($))return this.headers.map((Y,U)=>{let z=$[U];if(z)return z[1];return""});if(AU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((Q,J)=>this.fieldFormatter.format(Q,J,Y)).join(this.formatterOptions.delimiter),{rowCount:z}=this;if(this.rowCount+=1,z)return[this.formatterOptions.rowDelimiter,U].join("");return U}}nJ.RowFormatter=AU});var UK0=E((iN)=>{Object.defineProperty(iN,"__esModule",{value:!0});iN.FieldFormatter=iN.RowFormatter=void 0;var B31=YK0();Object.defineProperty(iN,"RowFormatter",{enumerable:!0,get:function(){return B31.RowFormatter}});var P31=Ff();Object.defineProperty(iN,"FieldFormatter",{enumerable:!0,get:function(){return P31.FieldFormatter}})});var Mf=E((QK0)=>{Object.defineProperty(QK0,"__esModule",{value:!0});QK0.CsvFormatterStream=void 0;var j31=I0("stream"),E31=UK0();class zK0 extends j31.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new E31.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let z=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return z=!0,U(Q);if(J)J.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return z=!0,U()})}catch(Q){if(z)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((z)=>{this.push(Buffer.from(z,"utf8"))});return $()})}}QK0.CsvFormatterStream=zK0});var KK0=E((s1)=>{var IK0=s1&&s1.__createBinding||(Object.create?function($,Y,U,z){if(z===void 0)z=U;Object.defineProperty($,z,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,z){if(z===void 0)z=U;$[z]=Y[U]}),C31=s1&&s1.__setModuleDefault||(Object.create?function($,Y){O
Line truncated
depsCount:${W},
deps:${H}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[W,H]=J(G);I(G,W),K(G,H)}};function J({schema:G}){let W={},H={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?W:H;Z[X]=G[X]}return[W,H]}function I(G,W=G.schema){let{gen:H,data:X,it:Z}=G;if(Object.keys(W).length===0)return;let q=H.let("missing");for(let V in W){let F=W[V];if(F.length===0)continue;let M=(0,U.propertyInData)(H,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)H.if(M,()=>{for(let w of F)(0,U.checkReportMissingProp)(G,w)});else H.if(Y._`${M}&&(${(0,U.checkMissingProp)(G,F,q)})`),(0,U.reportMissingProp)(G,q),H.else()}}$.validatePropertyDeps=I;function K(G,W=G.schema){let{gen:H,data:X,keyword:Z,it:q}=G,V=H.name("valid");for(let F in W){if((0,z.alwaysValidSchema)(q,W[F]))continue;H.if((0,U.propertyInData)(H,X,F,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(M,V)},()=>H.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),Wb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),z=v1(),U={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName:${Q.propertyName}}`},code(Q){let{gen:J,schema:I,data:K,it:G}=Q;if((0,z.alwaysValidSchema)(G,I))return;let W=J.name("valid");J.forIn("key",K,(H)=>{Q.setParams({propertyName:H}),Q.subschema({keyword:"propertyNames",data:H,dataTypes:["string"],propertyName:H,compositeRule:!0},W),J.if((0,Y.not)(W),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(W)}};$.default=U}),$e=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),z=F1(),U=U5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:I})=>z._`{additionalProperty:${I.additionalProperty}}`},code(I){let{gen:K,schema:G,parentSchema:W,data:H,errsCount:X,it:Z}=I;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let F=(0,Y.allSchemaProperties)(W.properties),M=(0,Y.allSchemaProperties)(W.patternProperties);w(),I.ok(z._`${X}===${U.default.errors}`);function w(){K.forIn("key",H,(T)=>{if(!F.length&&!M.length)D(T);else K.if(N(T),()=>D(T))})}function N(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,W.properties,"properties");A=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)A=(0,z.or)(...F.map((j)=>z._`${T}===${j}`));else A=z.nil;if(M.length)A=(0,z.or)(A,...M.map((j)=>z._`${(0,Y.usePattern)(I,j)}.test(${T})`));return(0,z.not)(A)}function O(T){K.code(z._`delete${H}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(I.setParams({additionalProperty:T}),I.error(),!q)K.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),K.if((0,z.not)(A),()=>{I.reset(),O(T)});else if(P(T,A),!q)K.if((0,z.not)(A),()=>K.break())}}function P(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(C,A)}}};$.default=J}),Hb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=xQ(),z=Q5(),U=v1(),Q=$e(),J={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,parentSchema:W,data:H,it:X}=I;if(X.opts.removeAdditional==="all"&&W.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,z.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=U.mergeEvaluated.props(K,(0,U.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,U.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))M(w);else{if(K.if((0,z.propertyInData)(K,H,w,X.opts.ownProperties)),M(w),!X.allErrors)K.else().var(V,!0);K.endIf()}I.it.definedProperties.add(w),I.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){I.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Xb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),z=F1(),U=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,data:W,parentSchema:H,it:X}=I,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,U.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&H.properties,M=K.name("valid");if(X.props!==!0&&!(X.props instanceof z.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:w}=X;N();function N(){for(let P of q){if(F)O(P);if(X.allErrors)
Line truncated
`)}openNode($,Y){let z=this.tos,U=this._xml;if(z&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),Tk(U,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)x30(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Tk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(k30.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,z){if(this.openNode($,Y),z!==void 0)this.writeText(z);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}jk.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};f30.exports=jk});var Ek=E((wt0)=>{var u30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Ft0($){if(typeof $==="string")return $;if(u30)return u30.decode($);return $.toString()}wt0.bufferToString=Ft0});var p30=E((i30)=>{Object.defineProperty(i30,"__esModule",{value:!0});i30.CHAR=`
`,$=this.i;break;case xe0:{let{entityReturnState:z}=this,U=this.entity+Y.slice($,this.prevI);this.state=z;let Q;if(U==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(U),this.entity="";if(z!==C8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vH($))this.state=he0,this.unget(),this.xmlDeclPossible=!1;else switch($){case oO:this.state=ye0,this.xmlDeclPossible=!1;break;case q70:this.state=Ae0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=Ee0;break;default:this.fail("disallowed character in tag name"),this.state=C8,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=xk,this.openWakaBang="";break;case"--":this.state=kk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Sk,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(lO))this.state=Be0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===lO)this.state=Pe0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=kk}sCommentEnded(){let $=this.getCodeNorm();if($!==P6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=kk;else this.state=C8}sCData(){if(this.captureToChar(RJ))this.state=Te0}sCDataEnding(){let $=this.getCodeNorm();if($===RJ)this.state=je0;else this.text+=`]${String.fromCodePoint($)}`,this.state=xk}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case P6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case RJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=xk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=I70;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?mO:fk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=I70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let z=this.getCodeNorm();if(z===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(z)){this.piTarget+=$.slice(Y,this.prevI);let U=z===o6;if(U||p8(z))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?Zz:K70}else this.state=U?mO:fk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(z);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=mO;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=mO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===P6){let{piTarget:z}=this;if(z.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:z,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(Y===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=fk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=Zz;return}if($!==k4)this.state=Ce0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(be0);if($===o6){this.state=Zz,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===CJ))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===CJ?G70:Re0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=Zz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==CJ)this.fail("value required.");this.state=G70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=Zz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!rO($))this.fail("value must be quoted."),this.q=Z70;else this.q=$;this.state=_e0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=Zz,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let z=Y;if(this.xmlDecl.version=z,!/^1\.[0-9]+$/.test(z))this.fail("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new T6($,Y).found}function T6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+q0[B0-1];break}}}var N1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(N1,!0,B)}}function y(Q0,B){var v=Q0+" is deprecated and will be removed in a future version.";if(B)v+=" Use "+B+" instead.";return s(v)}function s(Q0,B,v){if(!A0.warnings)return;var u=new Q(Q0),r;if(B)v._attachExtraTrace(u);else if(A0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=i0(u);u.stack=X0.message+`
`+q0[B0-1];break}}}var D1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(D1,!0,B)}}function y(Q0,B){var v=Q0+" is deprecated and will be removed in a future version.";if(B)v+=" Use "+B+" instead.";return s(v)}function s(Q0,B,v){if(!A0.warnings)return;var u=new Q(Q0),r;if(B)v._attachExtraTrace(u);else if(A0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=i0(u);u.stack=X0.message+`
`);var M=Object(F).yieldHandler,w=q,N=Error().stack;return function(){var O=V.apply(this,arguments),D=new w(void 0,void 0,M,N),P=D.promise();return D._generator=O,D._promiseFulfilled(void 0),P}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new K("expecting a function but got "+G.classString(V));X.push(V)},$.spawn=function(V){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunctionmustbeafunction
`)},Y=function(){return new S.PromiseInspection(this._target())},U=function(k){return S.reject(new X(k))};function z(){}var Q={},J=F4(),I;if(J.isNode)I=function(){var k=process.domain;if(k===void 0)k=null;return k};else I=function(){return null};J.notEnumerableProp(S,"_getDomain",I);var K=lU(),G=jF0(),H=new G;K.defineProperty(S,"_async",{value:H});var W=j3(),X=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var Z=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var q=function(){},V={},F={},M=vF0()(S,q),w=SF0()(S,q,M,U,z),N=yF0()(S),O=N.create,D=xF0()(S,N),P=D.CapturedTrace,T=uF0()(S,M),A=iF0()(F),j=Gc(),C=J.errorObj,b=J.tryCatch;function x(k,d){if(typeof d!=="function")throw new X("expecting a function but got "+J.classString(d));if(k.constructor!==S)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
`)},Y=function(){return new S.PromiseInspection(this._target())},z=function(k){return S.reject(new X(k))};function U(){}var Q={},J=F4(),I;if(J.isNode)I=function(){var k=process.domain;if(k===void 0)k=null;return k};else I=function(){return null};J.notEnumerableProp(S,"_getDomain",I);var K=sz(),G=EF0(),W=new G;K.defineProperty(S,"_async",{value:W});var H=E3(),X=S.TypeError=H.TypeError;S.RangeError=H.RangeError;var Z=S.CancellationError=H.CancellationError;S.TimeoutError=H.TimeoutError,S.OperationalError=H.OperationalError,S.RejectionError=H.OperationalError,S.AggregateError=H.AggregateError;var q=function(){},V={},F={},M=hF0()(S,q),w=gF0()(S,q,M,z,U),N=kF0()(S),O=N.create,D=fF0()(S,N),P=D.CapturedTrace,T=bF0()(S,M),A=cF0()(F),j=Hc(),C=J.errorObj,b=J.tryCatch;function x(k,d){if(typeof d!=="function")throw new X("expecting a function but got "+J.classString(d));if(k.constructor!==S)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function S(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(k){var d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(J.isObject(p))t[$0++]=p;else return U("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=$0,k=arguments[g],this.then(void 0,A(t,k,this))}return this.then(void 0,k)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(k,d){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)t+=", "+J.classString(d);this._warn(t)}return this._then(k,d,void 0,void 0,void 0)},S.prototype.done=function(k,d){var t=this._then(k,d,void 0,void 0,void 0);t._setIsFinal()},S.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},S.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},S.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},S.getNewLibraryCopy=Wc.exports,S.is=function(k){return k instanceof S},S.fromNode=S.fromCallback=function(k){var d=new S(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(k)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},S.all=function(k){return new w(k).promise()},S.cast=function(k){var d=M(k);if(!(d instanceof S))d=new S(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=k;return d},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(k){var d=new S(q);return d._captureStackTrace(),d._rejectCallback(k,!0),d},S.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},S.prototype._then=function(k,d,t,$0,g){var p=g!==void 0,e=p?g:new S(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var Y0=I();if((s&50397184)!==0){var N0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,N0=k;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,N0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),N0=d;H.invoke(G0,y,{handler:Y0===null?N0:typeof N0==="function"&&J.domainBind(Y0,N0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(k,d,e,$0,Y0);return e},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(k){var d=k===0?this._receiver0:this[k*4-4+3];if(d===Q)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},S.prototype._promiseAt=function(k){return this[k*4-4+2]},S.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},S.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(k){var{_bitField:d,_fulfillmentHandler
Line truncated
`)}function S(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(k){var d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(J.isObject(p))t[$0++]=p;else return z("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=$0,k=arguments[g],this.then(void 0,A(t,k,this))}return this.then(void 0,k)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(k,d){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)t+=", "+J.classString(d);this._warn(t)}return this._then(k,d,void 0,void 0,void 0)},S.prototype.done=function(k,d){var t=this._then(k,d,void 0,void 0,void 0);t._setIsFinal()},S.prototype.spread=function(k){if(typeof k!=="function")return z("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},S.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},S.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},S.getNewLibraryCopy=Zc.exports,S.is=function(k){return k instanceof S},S.fromNode=S.fromCallback=function(k){var d=new S(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(k)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},S.all=function(k){return new w(k).promise()},S.cast=function(k){var d=M(k);if(!(d instanceof S))d=new S(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=k;return d},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(k){var d=new S(q);return d._captureStackTrace(),d._rejectCallback(k,!0),d},S.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return W.setScheduler(k)},S.prototype._then=function(k,d,t,$0,g){var p=g!==void 0,e=p?g:new S(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var Y0=I();if((s&50397184)!==0){var N0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,N0=k;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,N0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),N0=d;W.invoke(G0,y,{handler:Y0===null?N0:typeof N0==="function"&&J.domainBind(Y0,N0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(k,d,e,$0,Y0);return e},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(W.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(k){var d=k===0?this._receiver0:this[k*4-4+3];if(d===Q)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},S.prototype._promiseAt=function(k){return this[k*4-4+2]},S.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},S.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(k){var{_bitField:d,_fulfillmentHandler
Line truncated
`,{mode:384}),Y}function zp($){let Y=WA0();for(let U of Y){if(!V$(U))continue;for(let z of xB(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=D9(U,z);try{let J=uB(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function g3($,Y){let U=zp($);if(!U)throw Error(`Enterpriseconfignotfound:${$}`);let Q={...JSON.parse(uB(U,"utf-8")),...Y};for(let I of Object.keys(Y))if(Y[I]===void 0)delete Q[I];let J=en.parse(Q);return QA0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Yp="SEAL_USE_ENTERPRISES_DIR",JA0="SEAL_HOME_ENTERPRISES_DIR",IA0="SEAL_USE_USER_ENTERPRISES_DIR",KA0="SEAL_HOME_USER_ENTERPRISES_DIR",GA0="SEAL_USE_CONFIG_FILE",HA0="SEAL_HOME_CONFIG_FILE",aI,fB,kB,UA0;var y3=m(()=>{$p();aI=D9(bB(),".config","seal-use","enterprises"),fB=D9(bB(),".config","seal-home","enterprises"),kB=D9(bB(),".config","seal-use","config.json"),UA0=D9(bB(),".config","seal-home","config.json")});function u2($,Y,U=[]){let z=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=z??Q;if(J){let K=$.find((W)=>W.id===J);if(K)return K;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let I=$[0];if(I)return I;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{existsSync as Qp,mkdirSync as bN1,readFileSync as iN1,renameSync as cN1,unlinkSync as nN1,writeFileSync as pN1}from"node:fs";import{homedir as dN1}from"node:os";import{dirname as mN1,join as lN1}from"node:path";function _Z(){let $=process.env[oN1]?.trim();if($)return $;return rN1}function XA0($=new Date){return $.toISOString().slice(0,10)}function ZA0($=Jp,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function qA0($=_Z()){if(!Qp($))return{};try{let Y=iN1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function sN1($,Y){let U={};for(let[z,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},I=!1;for(let[K,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&K>=Y)J[K]=G,I=!0;if(I)U[z]=J}return U}function aN1($,Y=_Z()){let U=mN1(Y);if(!Qp(U))bN1(U,{recursive:!0,mode:448});let z=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{pN1(z,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),cN1(z,Y)}catch(Q){try{if(Qp(z))nN1(z)}catch{}throw Q}}function VA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=_Z(),z=qA0(U),Q=XA0(Y),J=ZA0(Jp,Y),I=sN1(z,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,aN1(I,U)}catch{}}function tN1($,Y=Jp,U=new Date){let z=new Map;try{let Q=qA0(),J=ZA0(Y,U),I=XA0(U),K=$??Object.keys(Q);for(let G of K){let H=Q[G];if(!H){z.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=I&&typeof Z==="number")W+=Z;z.set(G,W)}}catch{if($)for(let Q of $)z.set(Q,0)}return z}function LA0($,Y,U){let z=U??tN1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let I=z.get(Q.id)??0,K=z.get(J.id)??0;if(I!==K)return K-I;let G=Q.name??Q.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return Q.id.localeCompare(J.id)})}var oN1="SEAL_USE_USAGE_FILE",rN1,Jp=7;var iB=m(()=>{rN1=lN1(dN1(),".config","seal-use","usage.json")});function eN1($,Y){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>Y?U:U.toLowerCase())}function $D1($,Y){return Y?$:$.toLowerCase()}function YD1($,Y,U,z){let Q=$D1($,z),J=Y.filter((I)=>Q.includes(I));if(U==="all"&&J.length!==Y.length)return[];return J}function UD1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function zD1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let U=UD1($.value),z=[];return U.forEach((Q,J)=>{let I=YD1(Q,Y.keywords,Y.matchMode,Y.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-Y.contextLines),G=Math.min(U.length,J+Y.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:cB(Q,Y.maxChars),context:{before:Y.snippetOnly?[]:U.slice(K,J).map((W)=>cB(W,Y.maxChars)),line:cB(Q,Y.maxChars),after:Y.snippetOnly?[]:U.slice(J+1,G).map((W)=>cB(W,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)H.context={before:[],line:H.context.line,after:[]};z.push(H)}),z}function cB($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function QD1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function wA0($){return $.rules.flatMap((Y,U)=>{let z=`${$.id}:${Y.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:z,title:`${$.versionName}/${Y.scope}`,field:"h
Line truncated
`,{mode:384}),Y}function Jp($){let Y=XA0();for(let z of Y){if(!V$(z))continue;for(let U of fB(z).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=D9(z,U);try{let J=bB(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function y3($,Y){let z=Jp($);if(!z)throw Error(`Enterpriseconfignotfound:${$}`);let Q={...JSON.parse(bB(z,"utf-8")),...Y};for(let I of Object.keys(Y))if(Y[I]===void 0)delete Q[I];let J=Yp.parse(Q);return JA0(z,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Up="SEAL_USE_ENTERPRISES_DIR",IA0="SEAL_HOME_ENTERPRISES_DIR",KA0="SEAL_USE_USER_ENTERPRISES_DIR",GA0="SEAL_HOME_USER_ENTERPRISES_DIR",WA0="SEAL_USE_CONFIG_FILE",HA0="SEAL_HOME_CONFIG_FILE",eI,uB,xB,UA0;var k3=m(()=>{zp();eI=D9(iB(),".config","seal-use","enterprises"),uB=D9(iB(),".config","seal-home","enterprises"),xB=D9(iB(),".config","seal-use","config.json"),UA0=D9(iB(),".config","seal-home","config.json")});function c2($,Y,z=[]){let U=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=U??Q;if(J){let K=$.find((H)=>H.id===J);if(K)return K;let G=$.find((H)=>H.id.toLowerCase()===J.toLowerCase());if(G)return G;let W=$.find((H)=>H.name.toLowerCase()===J.toLowerCase());if(W)return W;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let I=$[0];if(I)return I;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(z.length?z.join(", "):"the configured enterprise directories"))}import{existsSync as Ip,mkdirSync as iN1,readFileSync as cN1,renameSync as nN1,unlinkSync as pN1,writeFileSync as dN1}from"node:fs";import{homedir as mN1}from"node:os";import{dirname as lN1,join as oN1}from"node:path";function _Z(){let $=process.env[rN1]?.trim();if($)return $;return sN1}function ZA0($=new Date){return $.toISOString().slice(0,10)}function qA0($=Kp,Y=new Date){let z=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(z).toISOString().slice(0,10)}function VA0($=_Z()){if(!Ip($))return{};try{let Y=cN1($,"utf-8"),z=JSON.parse(Y);if(z&&typeof z==="object"&&!Array.isArray(z))return z;return{}}catch{return{}}}function aN1($,Y){let z={};for(let[U,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},I=!1;for(let[K,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&K>=Y)J[K]=G,I=!0;if(I)z[U]=J}return z}function tN1($,Y=_Z()){let z=lN1(Y);if(!Ip(z))iN1(z,{recursive:!0,mode:448});let U=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{dN1(U,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),nN1(U,Y)}catch(Q){try{if(Ip(U))pN1(U)}catch{}throw Q}}function LA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let z=_Z(),U=VA0(z),Q=ZA0(Y),J=qA0(Kp,Y),I=aN1(U,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,tN1(I,z)}catch{}}function eN1($,Y=Kp,z=new Date){let U=new Map;try{let Q=VA0(),J=qA0(Y,z),I=ZA0(z),K=$??Object.keys(Q);for(let G of K){let W=Q[G];if(!W){U.set(G,0);continue}let H=0;for(let[X,Z]of Object.entries(W))if(X>=J&&X<=I&&typeof Z==="number")H+=Z;U.set(G,H)}}catch{if($)for(let Q of $)U.set(Q,0)}return U}function FA0($,Y,z){let U=z??eN1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let I=U.get(Q.id)??0,K=U.get(J.id)??0;if(I!==K)return K-I;let G=Q.name??Q.id,W=J.name??J.id,H=G.localeCompare(W,"zh-CN");if(H!==0)return H;return Q.id.localeCompare(J.id)})}var rN1="SEAL_USE_USAGE_FILE",sN1,Kp=7;var cB=m(()=>{sN1=oN1(mN1(),".config","seal-use","usage.json")});function $D1($,Y){return $.map((z)=>z.trim()).filter(Boolean).map((z)=>Y?z:z.toLowerCase())}function YD1($,Y){return Y?$:$.toLowerCase()}function zD1($,Y,z,U){let Q=YD1($,U),J=Y.filter((I)=>Q.includes(I));if(z==="all"&&J.length!==Y.length)return[];return J}function UD1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function QD1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let z=UD1($.value),U=[];return z.forEach((Q,J)=>{let I=zD1(Q,Y.keywords,Y.matchMode,Y.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-Y.contextLines),G=Math.min(z.length,J+Y.contextLines+1),W={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:nB(Q,Y.maxChars),context:{before:Y.snippetOnly?[]:z.slice(K,J).map((H)=>nB(H,Y.maxChars)),line:nB(Q,Y.maxChars),after:Y.snippetOnly?[]:z.slice(J+1,G).map((H)=>nB(H,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)W.context={before:[],line:W.context.line,after:[]};U.push(W)}),U}function nB($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function JD1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function MA0($){return $.rules.flatMap((Y,z)=>{let U=`${$.id}:${Y.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:z};return[{area:"rules",entityType:"rule",entityId:U,title:`${$.versionName}/${Y.scope}`,field:"h
Line truncated
@@ -876,47 +876,47 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
}
exportdefaultlintRule;
`}});import{existsSync as Wz,mkdirSync as _D1,readFileSync as vD1,readdirSync as RA0,rmSync as hD1,unlinkSync as SD1,writeFileSync as gD1}from"node:fs";import{homedir as yD1}from"node:os";import{isAbsolute as kD1,join as f6,resolve as xD1}from"node:path";import{pathToFileURL as EA0}from"node:url";function _A0($=i$){let Y=[],U=[];try{if(!Wz($))_D1($,{recursive:!0});let z=Object.keys(Zp);for(let[J,I]of Object.entries(Zp)){let K=f6($,J),G=!0;if(Wz(K))try{if(vD1(K,"utf8")===I)G=!1}catch{G=!0}if(G)gD1(K,I,"utf8");Y.push(J)}let Q=RA0($,{withFileTypes:!0});for(let J of Q)if(!z.includes(J.name)){let I=f6($,J.name);try{if(J.isDirectory())hD1(I,{recursive:!0,force:!0});else SD1(I);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function vA0($={syncOfficial:!0}){if($.syncOfficial!==!1)_A0();let Y=[{name:"builtin",type:"builtin",path:f6(i$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:f6(i$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:f6(i$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[b$,mB];for(let z of U)if(Wz(z))try{let Q=RA0(z,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let I=J.name;if(I.endsWith(".ts")||I.endsWith(".js")||I.endsWith(".mjs")){let K=I.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:f6(z,I),description:`用户自定义规则校验器(${I})`})}}}catch{}return Y}function uD1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:f6(i$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(kD1(Y)||Y.startsWith("./")||Y.startsWith("../")){let z=xD1(Y);if(Wz(z))return{path:z};for(let Q of[".ts",".js",".mjs"])if(Wz(`${z}${Q}`))return{path:`${z}${Q}`}}let U=[f6(b$,`${Y}.ts`),f6(b$,`${Y}.js`),f6(b$,`${Y}.mjs`),f6(mB,`${Y}.ts`),f6(mB,`${Y}.js`),f6(mB,`${Y}.mjs`)];for(let z of U)if(Wz(z))return{path:z};return{}}async function Vp($){_A0();let Y=uD1($??"builtin");if(Y.isOfficial){let z=Y.officialKind==="strict"?TA0:Y.officialKind==="hlab"?jA0:eI,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&Wz(J))try{let K=await import(EA0(J).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:CA0(G,z)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:z}}let U=Y.path;if(!U)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:eI};try{let Q=await import(EA0(U).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️[linter]自定义校验器"${U}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:eI};return{name:$??"custom",type:"custom",filePath:U,linter:CA0(J,eI)}}catch(z){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${U}"失败(语法错误或依赖缺失:${z?.message??z}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:eI}}}functionCA0($,Y){returnasync(U,z)=>{try{letQ=await$(U,z);if(Q&&typeofQ==="object"&&typeofQ.score==="number"&&Array.isArray(Q.issues))returnQ;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(U,z)}catch(Q){returnconsole.error("⚠️[linter]自定义校验器执行异常:",Q),Y(U,z)}}}varb$,fD1="official",i$,mB;varLp=m(()=>{Hp();Xp();qp();Wp();b$=f6(yD1(),".config","seal-use","linters"),i$=f6(b$,fD1),mB=f6(process.cwd(),"linters")});asyncfunctionFp($,Y,U){letz=awaitY.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:z.score,passed:z.passed,issues:z.issues,description:$.description}}asyncfunctionhA0($,Y,U,z){letQ=z?.minScore??0,J=z?.level??"all",I=[],K=0;for(letqof$){letV=awaitFp(q,Y,U);K+=V.score;letF=V.issues;if(J==="error")F=V.issues.filter((w)=>w.level==="error");elseif(J==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");letM=F.every((w)=>w.level!=="error");if(z?.summary){if(F.length>0)I.push({...V,passed:M,issues:F})}elseI.push({...V,passed:M,issues:F})}letG=$.length,H=G===0?100:Math.round(K/G),W=I.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`}});import{existsSync as qU,mkdirSync as vD1,readFileSync as hD1,readdirSync as _A0,rmSync as SD1,unlinkSync as gD1,writeFileSync as yD1}from"node:fs";import{homedir as kD1}from"node:os";import{isAbsolute as xD1,join as f6,resolve as fD1}from"node:path";import{pathToFileURL as CA0}from"node:url";function vA0($=i$){let Y=[],z=[];try{if(!qU($))vD1($,{recursive:!0});let U=Object.keys(Vp);for(let[J,I]of Object.entries(Vp)){let K=f6($,J),G=!0;if(qU(K))try{if(hD1(K,"utf8")===I)G=!1}catch{G=!0}if(G)yD1(K,I,"utf8");Y.push(J)}let Q=_A0($,{withFileTypes:!0});for(let J of Q)if(!U.includes(J.name)){let I=f6($,J.name);try{if(J.isDirectory())SD1(I,{recursive:!0,force:!0});else gD1(I);z.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:z}}function hA0($={syncOfficial:!0}){if($.syncOfficial!==!1)vA0();let Y=[{name:"builtin",type:"builtin",path:f6(i$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:f6(i$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:f6(i$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],z=[b$,lB];for(let U of z)if(qU(U))try{let Q=_A0(U,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let I=J.name;if(I.endsWith(".ts")||I.endsWith(".js")||I.endsWith(".mjs")){let K=I.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:f6(U,I),description:`用户自定义规则校验器(${I})`})}}}catch{}return Y}function bD1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:f6(i$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(xD1(Y)||Y.startsWith("./")||Y.startsWith("../")){let U=fD1(Y);if(qU(U))return{path:U};for(let Q of[".ts",".js",".mjs"])if(qU(`${U}${Q}`))return{path:`${U}${Q}`}}let z=[f6(b$,`${Y}.ts`),f6(b$,`${Y}.js`),f6(b$,`${Y}.mjs`),f6(lB,`${Y}.ts`),f6(lB,`${Y}.js`),f6(lB,`${Y}.mjs`)];for(let U of z)if(qU(U))return{path:U};return{}}async function Fp($){vA0();let Y=bD1($??"builtin");if(Y.isOfficial){let U=Y.officialKind==="strict"?jA0:Y.officialKind==="hlab"?EA0:YK,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&qU(J))try{let K=await import(CA0(J).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:RA0(G,U)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:U}}let z=Y.path;if(!z)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:YK};try{let Q=await import(CA0(z).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️[linter]自定义校验器"${z}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:YK};return{name:$??"custom",type:"custom",filePath:z,linter:RA0(J,YK)}}catch(U){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${z}"失败(语法错误或依赖缺失:${U?.message??U}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:YK}}}functionRA0($,Y){returnasync(z,U)=>{try{letQ=await$(z,U);if(Q&&typeofQ==="object"&&typeofQ.score==="number"&&Array.isArray(Q.issues))returnQ;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(z,U)}catch(Q){returnconsole.error("⚠️[linter]自定义校验器执行异常:",Q),Y(z,U)}}}varb$,uD1="official",i$,lB;varwp=m(()=>{Xp();qp();Lp();Zp();b$=f6(kD1(),".config","seal-use","linters"),i$=f6(b$,uD1),lB=f6(process.cwd(),"linters")});asyncfunctionMp($,Y,z){letU=awaitY.linter($,z);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:U.score,passed:U.passed,issues:U.issues,description:$.description}}asyncfunctionSA0($,Y,z,U){letQ=U?.minScore??0,J=U?.level??"all",I=[],K=0;for(letqof$){letV=awaitMp(q,Y,z);K+=V.score;letF=V.issues;if(J==="error")F=V.issues.filter((w)=>w.level==="error");elseif(J==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");letM=F.every((w)=>w.level!=="error");if(U?.summary){if(F.length>0)I.push({...V,passed:M,issues:F})}elseI.push({...V,passed:M,issues:F})}letG=$.length,W=G===0?100:Math.round(K/G),H=I.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`),z=await Promise.all(O.map((D)=>H4($,D.id)))}let Q=new Map,J=0;for(let w of z){let N=w.document,O=w.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??w.documentId??w.id,D=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let A=f2(w,{summary:!1}).attachments,j=new Set;for(let C of A){let b=C.ossSignedUrl??C.url;if(!b)continue;let x=C.fileName??C.fileId??"attachment",S=sn(x),i=S,c=S.lastIndexOf("."),z0=c>0?S.slice(0,c):S,k=c>0?S.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${z0}_${d}${k}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${D}」附件:${x}...
`),U=await Promise.all(O.map((D)=>W4($,D.id)))}let Q=new Map,J=0;for(let w of U){let N=w.document,O=w.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??w.documentId??w.id,D=`${z.docIdPrefix??""}${O}${z.docIdSuffix??""}`,P=[];if(z.includeAttachments!==!1){let A=i2(w,{summary:!1}).attachments,j=new Set;for(let C of A){let b=C.ossSignedUrl??C.url;if(!b)continue;let x=C.fileName??C.fileId??"attachment",S=tn(x),i=S,c=S.lastIndexOf("."),U0=c>0?S.slice(0,c):S,k=c>0?S.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${U0}_${d}${k}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${D}」附件:${x}...
`),await new Promise((w,N)=>{let O=Vh1(V),D=new Gl({zlib:{level:9}});O.on("close",()=>w()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(F),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=Fh1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:z.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var xR0;var Hl=m(()=>{yR0();X6();gB();xR0=J6(EZ(),1)});import{readFileSync as Dh1}from"node:fs";function Ah1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:U[1]}}function Bh1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Ph1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let I=J.fileName.split("/")[0],K=I.indexOf("@");return K>=0?I.slice(0,K):I}).filter((J)=>J!=="信息表.xlsx")),z=[];for(let J of Y){let I=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((G)=>G.length>0)||Object.values(J.personAttachments).some((G)=>G.length>0))&&!U.has(I))z.push(`Excel 会议编号「${I}」声明了附件,但在 ZIP 中找不到对应的根目录「${I}/」或「${I}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!Q.has(J))z.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(z.length)throw new D5(z)}async function fR0($,Y,U){let z=[],Q=$;if(Bh1($,Y)){z=await oB0($),sB0(z,U);let G=z.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Hd($,G)}let J=await zP0(Q);Ph1(z,J);let I=QP0(z,J),K=J.map((G)=>G.document);return{entries:z,parsed:J,plans:I,documents:K,fileBuffer:$}}async function vz($,Y,U){let z=await fR0($,Y,U),Q=z.parsed.map((J,I)=>Ld(J.document,z.plans[I],new Map));return{warnings:[],documents:Q,attachmentPlan:z.plans}}async function zT($,Y,U){let z=await fR0($,Y,U.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Ah1(U.webhookUrl),I=[];for(let K=0;K<z.parsed.length;K+=1){let G=z.parsed[K],H=z.plans[K],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(W.has(F))continue;let M=z.entries.find((T)=>T.fileName===F);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${F}
`),await new Promise((w,N)=>{let O=Lh1(V),D=new Hl({zlib:{level:9}});O.on("close",()=>w()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(F),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=wh1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:U.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var fR0;var Xl=m(()=>{kR0();X6();yB();fR0=J6(EZ(),1)});import{readFileSync as Ah1}from"node:fs";function Bh1($){let Y=new URL($),z=Y.pathname.match(/\/webhook\/([^/]+)/);if(!z)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:z[1]}}function Ph1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Th1($,Y){if(!$.length)return;let z=new Set($.map((J)=>{let I=J.fileName.split("/")[0],K=I.indexOf("@");return K>=0?I.slice(0,K):I}).filter((J)=>J!=="信息表.xlsx")),U=[];for(let J of Y){let I=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((G)=>G.length>0)||Object.values(J.personAttachments).some((G)=>G.length>0))&&!z.has(I))U.push(`Excel 会议编号「${I}」声明了附件,但在 ZIP 中找不到对应的根目录「${I}/」或「${I}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of z)if(!Q.has(J))U.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(U.length)throw new D5(U)}async function uR0($,Y,z){let U=[],Q=$;if(Ph1($,Y)){U=await rB0($),aB0(U,z);let G=U.find((W)=>W.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Xd($,G)}let J=await QP0(Q);Th1(U,J);let I=JP0(U,J),K=J.map((G)=>G.document);return{entries:U,parsed:J,plans:I,documents:K,fileBuffer:$}}async function gU($,Y,z){let U=await uR0($,Y,z),Q=U.parsed.map((J,I)=>wd(J.document,U.plans[I],new Map));return{warnings:[],documents:Q,attachmentPlan:U.plans}}async function QT($,Y,z){let U=await uR0($,Y,z.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Bh1(z.webhookUrl),I=[];for(let K=0;K<U.parsed.length;K+=1){let G=U.parsed[K],W=U.plans[K],H=new Map,X=[...W.categoryFields,...Object.values(W.personAttachments).flat(),...Object.values(W.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(H.has(F))continue;let M=U.entries.find((T)=>T.fileName===F);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${F}
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?I:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:I,documentUrl:I,ssoUrl:V,expiresIn:Z?q:void 0,identity:F,warning:M,hoseDomain:J.type==="hose"?$S1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!I?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y)=>{let U=Y.sn??Y.query;if(!U)throw Error("query or sn is required");let z=await YS1($,{query:U,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),Q=await Promise.all(z.records.map((K)=>H4($,K.id))),J=pR0(Y.fields),I=Q.map((K)=>ah1(K,J));return{query:U,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:z.total,scanned:z.scanned,matched:I.length,records:I,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...Y.includeBridge?{bridge:HT(Q)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let U=Nl(await eS($,Y.batchId),Y.query);return{batchId:Y.batchId,count:U.length,records:U.map(Sz),bridge:HT(U)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let U=Y.mode??"hosecloud",z=Y.signKey;if(U==="hosecloud"&&!z){if(z=(await Yg($)).find((K)=>K.signKey)?.signKey,!z)throw Error("未找到合思集成 signKey, 请通过 signKey 参数提供")}let Q=uh1({mode:U,flowIds:Y.flowIds,rejectNodeName:Y.rejectNodeName,thinkingDepthOverride:Y.thinkingDepthOverride,skipInvoiceGene
Line truncated
`)}function XS1($){let Y=[];if(Y.push(`seal-use${$.area}-${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");for(let U of $.commands)for(let z of U.usage)Y.push(`${z}`);if($.commands.some((U)=>U.name))Y.push(""),Y.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return Y.join(`
`)}function W_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of X_0)for(let U of Y.commands)for(let z of U.usage)$.push(`${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var X_0;var jl=m(()=>{L$();X_0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",commands:[{name:"list",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new version on the test enterprise. Production rules remain safe in draft state."},{name:"replay-test",summary:"Replay approval records from production enterprise to bound test enterprise via Webhook",usage:["seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"],options:[{flag:"<prodCorpId>",des
Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:H?I:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:I,documentUrl:I,ssoUrl:V,expiresIn:Z?q:void 0,identity:F,warning:M,hoseDomain:J.type==="hose"?YS1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!I?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y)=>{let z=Y.sn??Y.query;if(!z)throw Error("query or sn is required");let U=await zS1($,{query:z,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),Q=await Promise.all(U.records.map((K)=>W4($,K.id))),J=dR0(Y.fields),I=Q.map((K)=>th1(K,J));return{query:z,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:U.total,scanned:U.scanned,matched:I.length,records:I,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...Y.includeBridge?{bridge:HT(Q)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let z=Al(await Yg($,Y.batchId),Y.query);return{batchId:Y.batchId,count:z.length,records:z.map(kU),bridge:HT(z)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let z=Y.mode??"hosecloud",U=Y.signKey;if(z==="hosecloud"&&!U){if(U=(await Ug($)).find((K)=>K.signKey)?.signKey,!U)throw Error("未找到合思集成 signKey, 请通过 signKey 参数提供")}let Q=bh1({mode:z,flowIds:Y.flowIds,rejectNodeName:Y.rejectNodeName,thinkingDepthOverride:Y.thinkingDepthOverride,skipInvoiceGene
Line truncated
`)}function ZS1($){let Y=[];if(Y.push(`seal-use${$.area}-${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");for(let z of $.commands)for(let U of z.usage)Y.push(`${U}`);if($.commands.some((z)=>z.name))Y.push(""),Y.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return Y.join(`
`)}function X_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of Z_0)for(let z of Y.commands)for(let U of z.usage)$.push(`${U}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var Z_0;var Cl=m(()=>{L$();Z_0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",commands:[{name:"list",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new version on the test enterprise. Production rules remain safe in draft state."},{name:"replay-test",summary:"Replay approval records from production enterprise to bound test enterprise via Webhook",usage:["seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"],options:[{flag:"<prodCorpId>",des
Line truncated
`);f0({provider:"hose",capability:"privilege-elevation",corpId:U.corpId,corpName:U.corpName??U.corpId,baseUrl:U.baseUrl,staffId:U.staffId,keyCount:U.keys.length,keys:U.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:z?Q.appSecurity:yS(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function nl($,Y){let U=j1($),z=Y.reveal===!0;if(U.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${U.name}」(id:${U.id})为原生Seal(${U.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);f0({provider:"hose",capability:"privilege-elevation",corpId:z.corpId,corpName:z.corpName??z.corpId,baseUrl:z.baseUrl,staffId:z.staffId,keyCount:z.keys.length,keys:z.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:U?Q.appSecurity:xS(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function dl($,Y){let z=j1($),U=Y.reveal===!0;if(z.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${z.name}」(id:${z.id})为原生Seal(${z.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);f0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:Q??"-",appSecurity:J?z?J:yS(J):"-",active:!0})}function Yh0($,Y){let{token:U,sealUrl:z,expiresIn:Q,verify:J,remote:I}=Y,K=Y.custom??ev0($),G=I?.user,H=I?.tenant,W=X4($,"tenantSlug")??s2(H?.tenantSlug),X=X4($,"tenantId")??s2(H?.id),Z=X4($,"tenantName")??s2(H?.name),q=X4($,"id")??W??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=X4($,"staffId")??s2(G?.providerUserId)??s2(G?.id)??"seal",F=X4($,"provider")??s2(G?.provider)??s2(H?.providerConfig?.provider),M=X4($,"corpId")??W??X??q,w={id:q,name:X4($,"name")??Z??q,environment:"production",seal:{url:z,tenantSlug:W,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:z,expiresIn:Q,staffId:V,corpId:M,tenantId:X,tenantSlug:W,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},N=Up();ov0(N,{recursive:!0,mode:448});let O=sv0(N,`${LT(q)}.json`);if(lv0(O)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${O}.Pass"overwrite":truetoreplaceit.`);rv0(O,`${JSON.stringify(w,null,2)}
`,{mode:384}),f0({id:q,name:w.name,tenantId:X,tenantSlug:W,verified:J,path:O})}async function eS1($,Y,U={}){let z=T8($,Y,U),Q=await W8(z);return{user:Q.user??{},tenant:Q.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var pl=m(()=>{t9();jH();i8();y3();uv0();iB();$p();X6();X6();bl();SZ();CT();f4();L$();D4();J4()});async function zh0($,Y){let U=$??h(Y.options.link)??h(Y.options.url);if(!U)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let z=Z0(Y.options.reveal)===!0||Z0(Y.options.r)===!0||Z0(Y.options.plain)===!0,Q=Z0(Y.options.save)===!0||Z0(Y.options.add)===!0;await RT(U,{reveal:z,save:Q,name:h(Y.options.name),overwrite:Z0(Y.options.overwrite)===!0,force:Z0(Y.options.force)===!0,appKey:h(Y.options["app-key"])??h(Y.options.appKey),keyId:h(Y.options["key-id"])??h(Y.options.keyId)})}async function Qh0($,Y,U){if($==="diagnose"){f0(await $g1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source.type==="seal"){let z=await B1(Y),Q=h(U.options.note)??"CLI generated provisional access link",J=await T5("seal_delegation_create",z,Y,{note:Q});if($==="hose-link")console.error(`\uD83D\uDC49提示:企业「${Y.name}」源类型为Seal原生测试环境,已自动为您生成委托免登直达链接。`);f0(J);return}if($==="hose-link"){let z=U.options.expire,Q=z!==void 0?s0(z):7200;if(Q===void 0||Q<=0)throw Error(`Invalid--expire:${String(z)}.Mustbeapositivenumberofseconds(e.g.--expire7200or--expire86400).`);let J=Z0(U.options.force)===!0||Z0(U.options.refresh)===!0||Z0(U.options.f)===!0;f0(await P00(Y,Q,{force:J}));return}if($==="keys"){let z=Z0(U.options.reveal)===!0||Z0(U.options.r)===!0||Z0(U.options.plain)===!0;await nl(Y.id,{reveal:z});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function $g1($){if($.source.type!=="hose"){let F=await B1($),M=await W8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:M.user,tenant:M.tenant}]}}aw($.id);let Y=$.source,U=Y.appKey??Y.key,z=Y.appSecurity??Y.password,Q=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,I=[];if(!U||!z)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=await _T("hose.openapi",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:U,appSecurity:z}),M=l3(F.value),w=b6(M.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(M.corporationId)??b6(l3(M.corporation).id),expireTime:Tq(M.expireTime)}}});I.push(K.public);let G=K.private?.token,H=G?await _T("hose.provisional",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),M=b6(l3(F.value).message);if(!M)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(M).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:J,enterpriseUrl:Nq(M)}}}):dl("hose.provisional");I.push(H.public);let W=A6($.seal),X=H.private?.token,Z=X?await _T("seal.sso",async()=>{let M=await T8(Q,void 0,W).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=l3(M.data),N=b6(M.token)??b6(M.accessToken)??b6(w.token)??b6(w.accessToken);if(!N)throw Error("Seal SSO did not return a bearer token");return{token:N,public:{sealUrl:Q,expiresIn:Tq(M.expiresIn)??Tq(M.expires_in)??Tq(w.expiresIn)??Tq(w.expires_in)}}}):dl("seal.sso");I.push(Z.public);let q=Z.private?.token,V=q?await _T("seal.whoami",async()=>{let M=await T8(Q,q,W).get("api/v1/auth/me").json(),w=l3(M.data),N=l3(w.user??M.user),O=l3(w.tenant??M.tenant);return{public:{user:{id:b6(N.id),name:b6(N.name),isAdmin:Ug1(N.isAdmin),providerUserId:b6(N.providerUserId)},tenant:{id:b6(O.id),name:b6(O.name),tenantSlug:b6(O.tenantSlug),hoseCorpConfig:zg1(O.hoseCorpConfig)}}}}):dl("seal.whoami");return I.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:I.every((F)=>F.ok===!0),stages:I}}async function _T($,Y){try{let U=await Y();return{public:{name:$,ok:!0,...Jh0(U.public)},private:U.token?{token:U.token}:void 0}}catch(U){return{public:{name:$,ok:!1,error:Nq(U instanceof Error?U.message:String(U))}}}}function dl($){return{public:{name:$,ok:!1,skipped:!0}}}async function Uh0($,Y){let U=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});return Yg1(U)}async function Yg1($){let Y=await $.text();if(!$.ok)throw Error(`${$.status} ${Y}`);let U=JSON.par
Line truncated
`);f0({provider:"hose",capability:"privilege-elevation",corpId:z.id,corpName:z.name,domain:z.source.domain,staffId:z.source.staffId,appKey:Q??"-",appSecurity:J?U?J:xS(J):"-",active:!0})}function zh0($,Y){let{token:z,sealUrl:U,expiresIn:Q,verify:J,remote:I}=Y,K=Y.custom??$h0($),G=I?.user,W=I?.tenant,H=X4($,"tenantSlug")??e2(W?.tenantSlug),X=X4($,"tenantId")??e2(W?.id),Z=X4($,"tenantName")??e2(W?.name),q=X4($,"id")??H??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=X4($,"staffId")??e2(G?.providerUserId)??e2(G?.id)??"seal",F=X4($,"provider")??e2(G?.provider)??e2(W?.providerConfig?.provider),M=X4($,"corpId")??H??X??q,w={id:q,name:X4($,"name")??Z??q,environment:"production",seal:{url:U,tenantSlug:H,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:z,sealUrl:U,expiresIn:Q,staffId:V,corpId:M,tenantId:X,tenantSlug:H,tenantName:Z,providerUserId:e2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},N=Qp();rv0(N,{recursive:!0,mode:448});let O=av0(N,`${FT(q)}.json`);if(ov0(O)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${O}.Pass"overwrite":truetoreplaceit.`);sv0(O,`${JSON.stringify(w,null,2)}
`,{mode:384}),f0({id:q,name:w.name,tenantId:X,tenantSlug:H,verified:J,path:O})}async function $g1($,Y,z={}){let U=T8($,Y,z),Q=await H8(U);return{user:Q.user??{},tenant:Q.tenant??{}}}function e2($){return typeof $==="string"&&$?$:void 0}var ml=m(()=>{e9();jW();i8();k3();bv0();cB();zp();X6();X6();cl();SZ();RT();f4();L$();D4();J4()});async function Qh0($,Y){let z=$??h(Y.options.link)??h(Y.options.url);if(!z)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let U=Z0(Y.options.reveal)===!0||Z0(Y.options.r)===!0||Z0(Y.options.plain)===!0,Q=Z0(Y.options.save)===!0||Z0(Y.options.add)===!0;await _T(z,{reveal:U,save:Q,name:h(Y.options.name),overwrite:Z0(Y.options.overwrite)===!0,force:Z0(Y.options.force)===!0,appKey:h(Y.options["app-key"])??h(Y.options.appKey),keyId:h(Y.options["key-id"])??h(Y.options.keyId)})}async function Jh0($,Y,z){if($==="diagnose"){f0(await Yg1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source.type==="seal"){let U=await P1(Y),Q=h(z.options.note)??"CLI generated provisional access link",J=await T5("seal_delegation_create",U,Y,{note:Q});if($==="hose-link")console.error(`\uD83D\uDC49提示:企业「${Y.name}」源类型为Seal原生测试环境,已自动为您生成委托免登直达链接。`);f0(J);return}if($==="hose-link"){let U=z.options.expire,Q=U!==void 0?s0(U):7200;if(Q===void 0||Q<=0)throw Error(`Invalid--expire:${String(U)}.Mustbeapositivenumberofseconds(e.g.--expire7200or--expire86400).`);let J=Z0(z.options.force)===!0||Z0(z.options.refresh)===!0||Z0(z.options.f)===!0;f0(await T00(Y,Q,{force:J}));return}if($==="keys"){let U=Z0(z.options.reveal)===!0||Z0(z.options.r)===!0||Z0(z.options.plain)===!0;await dl(Y.id,{reveal:U});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function Yg1($){if($.source.type!=="hose"){let F=await P1($),M=await H8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:M.user,tenant:M.tenant}]}}tw($.id);let Y=$.source,z=Y.appKey??Y.key,U=Y.appSecurity??Y.password,Q=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,I=[];if(!z||!U)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=await vT("hose.openapi",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:z,appSecurity:U}),M=o3(F.value),w=b6(M.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(M.corporationId)??b6(o3(M.corporation).id),expireTime:Tq(M.expireTime)}}});I.push(K.public);let G=K.private?.token,W=G?await vT("hose.provisional",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),M=b6(o3(F.value).message);if(!M)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(M).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:J,enterpriseUrl:Nq(M)}}}):ll("hose.provisional");I.push(W.public);let H=A6($.seal),X=W.private?.token,Z=X?await vT("seal.sso",async()=>{let M=await T8(Q,void 0,H).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=o3(M.data),N=b6(M.token)??b6(M.accessToken)??b6(w.token)??b6(w.accessToken);if(!N)throw Error("Seal SSO did not return a bearer token");return{token:N,public:{sealUrl:Q,expiresIn:Tq(M.expiresIn)??Tq(M.expires_in)??Tq(w.expiresIn)??Tq(w.expires_in)}}}):ll("seal.sso");I.push(Z.public);let q=Z.private?.token,V=q?await vT("seal.whoami",async()=>{let M=await T8(Q,q,H).get("api/v1/auth/me").json(),w=o3(M.data),N=o3(w.user??M.user),O=o3(w.tenant??M.tenant);return{public:{user:{id:b6(N.id),name:b6(N.name),isAdmin:Ug1(N.isAdmin),providerUserId:b6(N.providerUserId)},tenant:{id:b6(O.id),name:b6(O.name),tenantSlug:b6(O.tenantSlug),hoseCorpConfig:Qg1(O.hoseCorpConfig)}}}}):ll("seal.whoami");return I.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:I.every((F)=>F.ok===!0),stages:I}}async function vT($,Y){try{let z=await Y();return{public:{name:$,ok:!0,...Ih0(z.public)},private:z.token?{token:z.token}:void 0}}catch(z){return{public:{name:$,ok:!1,error:Nq(z instanceof Error?z.message:String(z))}}}}function ll($){return{public:{name:$,ok:!1,skipped:!0}}}async function Uh0($,Y){let z=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});return zg1(z)}async function zg1($){let Y=await $.text();if(!$.ok)throw Error(`${$.status} ${Y}`);let z=JSON.par
Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let Z of X){let q=Z.outboundName??"SealAI 审批",V=Z.signKey,F=Z.apiOrigin??"production";console.error(`•"${q}"(signKey:${V},环境:${F})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${V}--corp${Q.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let F=V.outboundName??"SealAI 审批",M=V.signKey,w=V.apiOrigin??"production";console.error(`•"${F}"(signKey:${M},环境:${w})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${M}--corp${Q.id}
short_description:"Diagnose approval feedback and publish minimal rule fixes"
default_prompt:"Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
`;var jh0=()=>{};var Rh0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--batch<batchId>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest--fieldsrecordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsmetadata\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.fields,result.summary\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsresult.summary,result.decision,result.riskPoints\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runsget<recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-useapproval-runsdocument-summary<recordId>--corp<corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-useapproval-runscited-rules<recordId>--corp<corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rulesget--record-id<recordId>--runtime-idrule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n#查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-useapproval-runsattachments<recordId>--corp<corpId>--summary\n\n#下载全部附件到本地目录(优先使用ossSignedUrl签名直链)\nseal-useapproval-runsattachmentsdownload<recordId>--all--out-dir./downloads--corp<corpId>\n\n#按名称或fileId过滤下载单个附件\nseal-useapproval-runsattachmentsdownload<recordId>--name发票--corp<corpId>\n```\n\nThis should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-useapproval-runsresult<recordId>--corp<corpId>--summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n#默认推荐:生成SealAI审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-useapproval-runslink<recordId>--corp<corpId>\nseal-useapproval-runslink--sn<sourceDocumentSN>--corp<corpId>\n\n#生成合思主系统原始单据页面链接\nseal-useapproval-runslink<recordId>--typehose-document--corp<corpId>\n\n#仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-useapproval-runslink<recordId>--auto-login[--expire7200]--corp<corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\n当向用户返回 `--auto-login` 链接时
Line truncated
`;var Eh0=()=>{};var _h0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--batch<batchId>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest--fieldsrecordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsmetadata\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.fields,result.summary\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsresult.summary,result.decision,result.riskPoints\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runsget<recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-useapproval-runsdocument-summary<recordId>--corp<corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-useapproval-runscited-rules<recordId>--corp<corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rulesget--record-id<recordId>--runtime-idrule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n#查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-useapproval-runsattachments<recordId>--corp<corpId>--summary\n\n#下载全部附件到本地目录(优先使用ossSignedUrl签名直链)\nseal-useapproval-runsattachmentsdownload<recordId>--all--out-dir./downloads--corp<corpId>\n\n#按名称或fileId过滤下载单个附件\nseal-useapproval-runsattachmentsdownload<recordId>--name发票--corp<corpId>\n```\n\nThis should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-useapproval-runsresult<recordId>--corp<corpId>--summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n#默认推荐:生成SealAI审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-useapproval-runslink<recordId>--corp<corpId>\nseal-useapproval-runslink--sn<sourceDocumentSN>--corp<corpId>\n\n#生成合思主系统原始单据页面链接\nseal-useapproval-runslink<recordId>--typehose-document--corp<corpId>\n\n#仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-useapproval-runslink<recordId>--auto-login[--expire7200]--corp<corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\n当向用户返回 `--auto-login` 链接时
Line truncated
|Hose/合思-sourcedSealtenant|Hose\`appKey\` + \`appSecurity\` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and \`corps sync-hosecloud\`. |
|Hose/合思-sourcedSealtenant|Hose\`appKey\` + \`appSecurity\` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and \`deploy hosecloud sync\`. |
|Hose/合思-sourcedSealtenant|Hoseauthorization/assistancelink(\`thirdparty.html\`) | 【两极分化】普通导入→短效;提权→永久 | Temporary session that can be **elevated** to permanent \`appKey\`/\`appSecurity\` with \`extract-keys --save\` or \`add-link --as-hose\`. |
|Hose/合思-sourcedSealtenant|cURLcopiedfromanauthenticated**Hoseadmin**page|【两极分化】普通导入→短效;提权→永久|**Samesessionscopeasanassistancelink.**IftheuserisaHoseadministrator,thiscarriesthesamewebsessioncredentials(\`accesstoken\`, \`corpid\`, cookies) and can equally invoke \`/api/innerapi/v1/key\` to extract permanent \`appKey\`/\`appSecurity\`. |
@@ -1586,7 +1581,7 @@ First distinguish the link by its host, purpose, and identity origin:
-A**Hose/合思authorization/assistancelink**(\`https://<domain>/web/thirdparty.html?...\`) opens an upstream Hose session and may continue through Seal SSO. It is not a Seal delegation link.
-**HoseSubdomainBoundary(合思子域专属提权)**:\`seal-use\` primarily manages Seal tenants. Tenants sourced from the Hose ecosystem have an upstream Hose enterprise backing them. A received Hose assistance link contains only a temporary session \`accessToken\`. If you run standard \`corps add-link\`, it exchanges that temporary token for a short-lived Seal Bearer token—sufficient for basic Seal inspection, but it will expire and cannot call any Hose OpenAPI.
-**PrivilegeElevation(权限等级提升)**:Toelevatefromashort-livedsessiontokentopermanent,durableHoseOpenAPIdevelopercredentials,use\`corps extract-keys <url> --save\` or \`corps add-link <url> --as-hose\`. This leverages Hose's internal key interface (\`GET /api/innerapi/v1/key\`) using the session token to retrieve the enterprise's OpenAPI \`appKey\` and \`appSecurity\`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (e.g. \`corps sync-hosecloud\`).
-**PrivilegeElevation(权限等级提升)**:Toelevatefromashort-livedsessiontokentopermanent,durableHoseOpenAPIdevelopercredentials,use\`corps extract-keys <url> --save\` or \`corps add-link <url> --as-hose\`. This leverages Hose's internal key interface (\`GET /api/innerapi/v1/key\`) using the session token to retrieve the enterprise's OpenAPI \`appKey\` and \`appSecurity\`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (for example, \`deploy hosecloud sync\`).
-**Multi-KeyDisambiguation(多套密钥明确抉择)**:Iftheenterpriseownsmultipleapplicationkeys,theCLI**willnot**guessorsilentlypickthefirstkey.Instead,itterminateswithaninformativecandidatelistandrequirestheusertospecify\`--app-key <key>\` or \`--key-id <id>\`. If only one key exists, it is selected automatically.
-**Non-HoseTenantsBlocked**:Calling\`keys\` on native Seal enterprises (\`corp.source.type !== "hose"\`) is strictly rejected with exit code 2, explaining that this capability belongs exclusively to the Hose ecosystem.
@@ -1672,7 +1667,7 @@ If the captured request contains only cookies or an authentication shape the CLI
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
-**DedicatedCLICommand**:Use\`seal-use auth hose-link --corp <corpId> [--expire <seconds>] [--force]\`. This command directly generates an independent provisional auth link without reading or mutating internal CLI session cache. It supports \`--expire\` (default 7200, e.g. 86400 for 1 day). Note: this link cannot be listed via \`seal-use delegation list\` (the latter only tracks Seal audit platform delegations).
@@ -2153,7 +2150,7 @@ Use current search only when the question is about current draft/current knowled
##OutputDiscipline
Ifarulecommandwouldreturnmanydescriptionsormorethanabout20rules,use\`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var ph0=()=>{};var lh0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled:false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-usedoctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-useconfiglintenable`) when disabled.\n- **Explicit Triggering**: `seal-useruleslint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-useconfiglintenable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-useruleslint--corp<corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n#Lintrulesinpublishedversion16\nseal-useruleslint--version16--corp<corpId>\n\n#Lintaspecificrulebycode(#0038)\nseal-useruleslint--code'#0038'--corp<corpId>\n\n#Summarymode(onlyshowruleswithissues)\nseal-useruleslint--summary--corp<corpId>\n```\n\n### 3. Quality Gate for CI / Release\n\n```bash\n#Ifoverallscoreisbelow85,terminateswithexitcode1\nseal-useruleslint--min-score85--levelerror--corp<corpId>\n```\n\n### 4. Configure Global Linter Settings\n\n```bash\n#Checkstatus\nseal-useconfiglintstatus\n\n#Enableautolintonruleupdates\nseal-useconfiglintenable--linterbuiltin--min-score80\n\n#Disableautolint\nseal-useconfiglintdisable\n```\n\n## Official Linters\n\n| Linter Name | Scope & Purpose | Aliases |\n| :--- | :--- | :--- |\n| `builtin` | Seal 官方标准校验器:拦截过短描述、主观模糊词与悬空例外条款。 | `default`, `official/builtin` |\n| `strict` | Seal 官方严格风控校验器:强校验字数、刚性定量约束、凭证依据与具体审批人角色。 | `official/strict` |\n| `hlab` | 合思实验室 (HLab) 结构化规则校验器:SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判。 | `hlab-sop`, `hlab-rules`, `hlab-standard`, `official/hlab` |\n\n```bash\n#Inspectavailablelinters\nseal-useruleslinters\n\n#LintrulesusingHLabSOPstandard\nseal-useruleslint--linterhlab--corp<corpId>\n\n#LintlocalruleworkspaceofflinewithHLabstandard\nseal-useruleslint--linterhlab--file./rules.local.json\n```\n\n## Built-In Detection Rules (`builtin`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `TOO_SHORT` | `error` | Rule description is under 5 characters. | Add concrete conditions and criteria. |\n| `VAGUE_WORD` | `error` | Contains subjective/fuzziness words (`原则上`, `尽量`, `适当`, `酌情`, `一般情况下`, `合理控制`). | Replace with rigid thresholds, enums, or criteria. |\n| `HANGING_EXCEPTION` | `warning` | Exception trigger found (`除非`, `特殊情况`, `经批准`) without verifiable evidence keyword (`备注`, `附件`, `证明`, `邮件`, `截图`). | Specify exact evidence source in invoice/document. |\n\n## HLab SOP Detection Rules (`hlab`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `MISSING_CHECK_METHOD` | `error` | Missing `**检查方法**` section in rule description. | Add `**检查方法**:` specifying fields, vouchers, and normalization logic. |\n| `MISSING_EVAL_STANDARD` | `error` | Missing `**判定标准**` section in rule description. | Add `**判定标准**:` with standard branches. |\n| `INCOMPLETE_TERNARY_BRANCH` | `error` | Incomplete ternary branch under evaluation criteria (missing `PASS`, `FAIL`, or `证据不足`). | Provide complete ternary closure: `-PASS:`, `-FAIL:`, `-证据不足:`. |\n| `INSUFFICIENT_WITHOUT_MANUAL_REVIEW` | `warning` | `证据不足` branch does not specify escalating to `人工复核`. | Add `转人工复核` at the end of `证据不足` branch. |\n| `DISPOSAL_ACTION_LEAK` | `warning` | Contains whole-bill workflow disposal actions (`驳回单据`, `直接驳回`, `进行提醒`, `退回单据`). | Decouple disposal actions from rule text; rely on rule strictness or platform workflow. |\n| `SCOPE_FALSE_SKIP_PRONE` | `warning` | Scope contains material upload conditions (`若上传了`, `若提供了`, `附件需上传`). | Keep scope pure to business triggers; handle missing materials explicitly in FAIL branch to prevent silent SKIP. |\n| `RISK_SUPPRESSION` | `erroLine truncated
`;var dh0=()=>{};var oh0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled:false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-usedoctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-useconfiglintenable`) when disabled.\n- **Explicit Triggering**: `seal-useruleslint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-useconfiglintenable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-useruleslint--corp<corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n#Lintrulesinpublishedversion16\nseal-useruleslint--version16--corp<corpId>\n\n#Lintaspecificrulebycode(#0038)\nseal-useruleslint--code'#0038'--corp<corpId>\n\n#Summarymode(onlyshowruleswithissues)\nseal-useruleslint--summary--corp<corpId>\n```\n\n### 3. Quality Gate for CI / Release\n\n```bash\n#Ifoverallscoreisbelow85,terminateswithexitcode1\nseal-useruleslint--min-score85--levelerror--corp<corpId>\n```\n\n### 4. Configure Global Linter Settings\n\n```bash\n#Checkstatus\nseal-useconfiglintstatus\n\n#Enableautolintonruleupdates\nseal-useconfiglintenable--linterbuiltin--min-score80\n\n#Disableautolint\nseal-useconfiglintdisable\n```\n\n## Official Linters\n\n| Linter Name | Scope & Purpose | Aliases |\n| :--- | :--- | :--- |\n| `builtin` | Seal 官方标准校验器:拦截过短描述、主观模糊词与悬空例外条款。 | `default`, `official/builtin` |\n| `strict` | Seal 官方严格风控校验器:强校验字数、刚性定量约束、凭证依据与具体审批人角色。 | `official/strict` |\n| `hlab` | 合思实验室 (HLab) 结构化规则校验器:SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判。 | `hlab-sop`, `hlab-rules`, `hlab-standard`, `official/hlab` |\n\n```bash\n#Inspectavailablelinters\nseal-useruleslinters\n\n#LintrulesusingHLabSOPstandard\nseal-useruleslint--linterhlab--corp<corpId>\n\n#LintlocalruleworkspaceofflinewithHLabstandard\nseal-useruleslint--linterhlab--file./rules.local.json\n```\n\n## Built-In Detection Rules (`builtin`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `TOO_SHORT` | `error` | Rule description is under 5 characters. | Add concrete conditions and criteria. |\n| `VAGUE_WORD` | `error` | Contains subjective/fuzziness words (`原则上`, `尽量`, `适当`, `酌情`, `一般情况下`, `合理控制`). | Replace with rigid thresholds, enums, or criteria. |\n| `HANGING_EXCEPTION` | `warning` | Exception trigger found (`除非`, `特殊情况`, `经批准`) without verifiable evidence keyword (`备注`, `附件`, `证明`, `邮件`, `截图`). | Specify exact evidence source in invoice/document. |\n\n## HLab SOP Detection Rules (`hlab`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `MISSING_CHECK_METHOD` | `error` | Missing `**检查方法**` section in rule description. | Add `**检查方法**:` specifying fields, vouchers, and normalization logic. |\n| `MISSING_EVAL_STANDARD` | `error` | Missing `**判定标准**` section in rule description. | Add `**判定标准**:` with standard branches. |\n| `INCOMPLETE_TERNARY_BRANCH` | `error` | Incomplete ternary branch under evaluation criteria (missing `PASS`, `FAIL`, or `证据不足`). | Provide complete ternary closure: `-PASS:`, `-FAIL:`, `-证据不足:`. |\n| `INSUFFICIENT_WITHOUT_MANUAL_REVIEW` | `warning` | `证据不足` branch does not specify escalating to `人工复核`. | Add `转人工复核` at the end of `证据不足` branch. |\n| `DISPOSAL_ACTION_LEAK` | `warning` | Contains whole-bill workflow disposal actions (`驳回单据`, `直接驳回`, `进行提醒`, `退回单据`). | Decouple disposal actions from rule text; rely on rule strictness or platform workflow. |\n| `SCOPE_FALSE_SKIP_PRONE` | `warning` | Scope contains material upload conditions (`若上传了`, `若提供了`, `附件需上传`). | Keep scope pure to business triggers; handle missing materials explicitly in FAIL branch to prevent silent SKIP. |\n| `RISK_SUPPRESSION` | `erroLine truncated
description:"v0.10.33: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.34: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
`;var sh0=()=>{};var Ng1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO
Line truncated
`,"utf8"),{detected:z,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function sl($){let Y=$?.targetSkillsDir??YS0(),U=$?.configFile??US0(),z=zS0(),Q=!1;if(jq(U))try{let J=JSON.parse($S0(U,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((I)=>I?.path===Y)}catch{}return{detected:z,configured:Q,configPath:U,targetDir:Y}}var al=()=>{};import{cpSync as Cg1,existsSync as fK,lstatSync as JS0,mkdirSync as Rg1,realpathSync as a2,rmSync as _g1,symlinkSync as vg1,unlinkSync as QS0}from"node:fs";import{homedir as IS0}from"node:os";import{dirname as KS0,join as t2}from"node:path";function hg1($,Y){let U=Y?.baseHomeDir??IS0(),z=t2(U,$.rootDirName),Q=Y?.sourceSkillDir??t2(U,".agents","skills","seal-use"),J=KS0(Q),I=t2(z,"skills"),K=t2(I,"seal-use");if(!fK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(fK(I)&&fK(J))try{if(a2(I)===a2(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}Rg1(I,{recursive:!0});let G;try{G=JS0(K)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(a2(K)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:K}}catch{}try{QS0(K)}catch{}}else if(G.isDirectory())_g1(K,{recursive:!0,force:!0}),H=!0;else QS0(K);let W=process.platform==="win32"?"junction":"dir";try{return vg1(Q,K,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:K}}catch{try{return Cg1(Q,K,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:K}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:K,error:X?.message||String(X)}}}}function Sg1($,Y){let U=Y?.baseHomeDir??IS0(),z=t2(U,$.rootDirName),Q=Y?.sourceSkillDir??t2(U,".agents","skills","seal-use"),J=KS0(Q),I=t2(z,"skills"),K=t2(I,"seal-use");if(!fK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(fK(I)&&fK(J))try{if(a2(I)===a2(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}let G;try{G=JS0(K)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(a2(K)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:K}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:K}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:K}}function tl($){return GS0.map((Y)=>hg1(Y,$))}function el($){return GS0.map((Y)=>Sg1(Y,$))}var GS0;var $o=m(()=>{GS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Yo=m(()=>{al();$o();al();$o()});import{existsSync as gg1,mkdirSync as Uo,readFileSync as yg1,rmSync as kg1,writeFileSync as HS0}from"node:fs";import{homedir as XS0}from"node:os";import{dirname as WS0,join as Cq}from"node:path";function zo(){return ZS0["SKILL.md"]||""}function qS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function VS0($=Cq(yz(),"SKILL.md")){try{return qS0(yg1($,"utf8"))}catch{return}}function yz(){return Cq(XS0(),".agents","skills","seal-use")}function fg1(){return Cq(XS0(),".agents","skills","seal-home")}function ug1(){let $=fg1();if(gg1($))try{return kg1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function LS0($=yz()){ug1(),Uo($,{recursive:!0});let Y=[];for(let[U,z]of Object.entries(ZS0)){let Q=Cq($,U);Uo(WS0(Q),{recursive:!0}),HS0(Q,z,"utf8"),Y.push(U)}for(let[U,z]of Object.entries(xg1)){let Q=Cq($,U);Uo(WS0(Q),{recursive:!0}),HS0(Q,z),Y.push(U)}return{targetDir:$,files:Y}}var ZS0,xg1,i24;var Rq=m(()=>{ml();ml();Yo();ZS0=th0,xg1=Object.fromEntries(Object.entries(eh0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));i24=qS0(zo())});function FS0(){return`#SealUse系统架构与运行规范白皮书
`;var ah0=()=>{};var Dg1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO
Line truncated
`,"utf8"),{detected:U,configured:!0,configPath:z,targetDir:Y,action:"prepended"}}function tl($){let Y=$?.targetSkillsDir??zS0(),z=$?.configFile??US0(),U=QS0(),Q=!1;if(jq(z))try{let J=JSON.parse(YS0(z,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((I)=>I?.path===Y)}catch{}return{detected:U,configured:Q,configPath:z,targetDir:Y}}var el=()=>{};import{cpSync as Rg1,existsSync as bK,lstatSync as IS0,mkdirSync as _g1,realpathSync as $Y,rmSync as vg1,symlinkSync as hg1,unlinkSync as JS0}from"node:fs";import{homedir as KS0}from"node:os";import{dirname as GS0,join as YY}from"node:path";function Sg1($,Y){let z=Y?.baseHomeDir??KS0(),U=YY(z,$.rootDirName),Q=Y?.sourceSkillDir??YY(z,".agents","skills","seal-use"),J=GS0(Q),I=YY(U,"skills"),K=YY(I,"seal-use");if(!bK(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(bK(I)&&bK(J))try{if($Y(I)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}_g1(I,{recursive:!0});let G;try{G=IS0(K)}catch{G=void 0}let W=!1;if(G)if(G.isSymbolicLink()){try{if($Y(K)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:K}}catch{}try{JS0(K)}catch{}}else if(G.isDirectory())vg1(K,{recursive:!0,force:!0}),W=!0;else JS0(K);let H=process.platform==="win32"?"junction":"dir";try{return hg1(Q,K,H),{id:$.id,name:$.name,detected:!0,configured:!0,mode:W?"replaced_real_dir":"linked",targetPath:K}}catch{try{return Rg1(Q,K,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:K}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:K,error:X?.message||String(X)}}}}function gg1($,Y){let z=Y?.baseHomeDir??KS0(),U=YY(z,$.rootDirName),Q=Y?.sourceSkillDir??YY(z,".agents","skills","seal-use"),J=GS0(Q),I=YY(U,"skills"),K=YY(I,"seal-use");if(!bK(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(bK(I)&&bK(J))try{if($Y(I)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}let G;try{G=IS0(K)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if($Y(K)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:K}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:K}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:K}}function $o($){return WS0.map((Y)=>Sg1(Y,$))}function Yo($){return WS0.map((Y)=>gg1(Y,$))}var WS0;var zo=m(()=>{WS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Uo=m(()=>{el();zo();el();zo()});import{existsSync as yg1,mkdirSync as Qo,readFileSync as kg1,rmSync as xg1,writeFileSync as HS0}from"node:fs";import{homedir as ZS0}from"node:os";import{dirname as XS0,join as Cq}from"node:path";function Jo(){return qS0["SKILL.md"]||""}function VS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function LS0($=Cq(fU(),"SKILL.md")){try{return VS0(kg1($,"utf8"))}catch{return}}function fU(){return Cq(ZS0(),".agents","skills","seal-use")}function ug1(){return Cq(ZS0(),".agents","skills","seal-home")}function bg1(){let $=ug1();if(yg1($))try{return xg1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function FS0($=fU()){bg1(),Qo($,{recursive:!0});let Y=[];for(let[z,U]of Object.entries(qS0)){let Q=Cq($,z);Qo(XS0(Q),{recursive:!0}),HS0(Q,U,"utf8"),Y.push(z)}for(let[z,U]of Object.entries(fg1)){let Q=Cq($,z);Qo(XS0(Q),{recursive:!0}),HS0(Q,U),Y.push(z)}return{targetDir:$,files:Y}}var qS0,fg1,l24;var Rq=m(()=>{ol();ol();Uo();qS0=eh0,fg1=Object.fromEntries(Object.entries($S0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));l24=VS0(Jo())});function wS0(){return`#SealUse系统架构与运行规范白皮书
`)}var BS0=m(()=>{X6()});async function PS0($,Y,U){let z=($??Y??"").toLowerCase();if(z==="guide"||z==="doc"||z==="knowledge"||z==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(FS0());return}if(z==="paths"||z==="dirs"||z==="directories"){let I=Go();f0(I.directories);return}if(z==="tenant"||z==="corp"||z==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (f4(),w_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),_00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),H_0)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (BS0(),AS0)),X=G(U.options.corp)??(Y&&Y!==z?Y:void 0)??(U.command[2]&&U.command[2]!==z?U.command[2]:void 0),Z=I(X),q=await K(Z),V=await H(q,Z);if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(W(V));f0(V);return}let Q=Go();if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(NS0(Q));f0(Q)}var TS0=m(()=>{DS0();Ko();D4();J4()});var ES0;var jS0=m(()=>{ES0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.33",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-usehttp`, or the `seal-useservicestart` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-usehttp`, or the `seal-useservicestart` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local
Line truncated
`)}var PS0=m(()=>{X6()});async function TS0($,Y,z){let U=($??Y??"").toLowerCase();if(U==="guide"||U==="doc"||U==="knowledge"||U==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(wS0());return}if(U==="paths"||U==="dirs"||U==="directories"){let I=Ho();f0(I.directories);return}if(U==="tenant"||U==="corp"||U==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (f4(),M_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),v00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),H_0)),{diagnoseTenantContract:W,formatTenantDoctorDashboard:H}=await Promise.resolve().then(() => (PS0(),BS0)),X=G(z.options.corp)??(Y&&Y!==U?Y:void 0)??(z.command[2]&&z.command[2]!==U?z.command[2]:void 0),Z=I(X),q=await K(Z),V=await W(q,Z);if(!(Z0(z.options.quiet)||Z0(z.options.silent)))console.error(H(V));f0(V);return}let Q=Ho();if(!(Z0(z.options.quiet)||Z0(z.options.silent)))console.error(DS0(Q));f0(Q)}var jS0=m(()=>{AS0();Wo();D4();J4()});var CS0;var ES0=m(()=>{CS0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.34",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-usehttp`, or the `seal-useservicestart` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-usehttp`, or the `seal-useservicestart` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local
Line truncated
toloopback(\`--host 127.0.0.1\`) and do not expose the port to a network or an origin you
donotcontrol.
`}},parameters:{CorpId:{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},t
Line truncated
`}},parameters:{CorpId:{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},t
Line truncated
`);Q(z)})})}var yT=8787,kT="127.0.0.1";var Xo=m(()=>{hS0();e9()});async function SS0($){let Y=s0($.options.port)??s0($.options.p),U=h($.options.host)??h($.options.h),z=await xT({port:Y,host:U}),Q=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var gS0=m(()=>{D4();Xo()});async function yS0($,Y,U,z){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,U,{},C0(z.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,U,{},C0(z.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var kS0=m(()=>{f4();J4()});async function xS0($,Y){if($==="config"||$==="json"){Zo();return}let{startServer:U}=await bS0().then(() => uS0);U()}function Zo(){f0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var fS0=m(()=>{J4()});function iS0($){let Y=hT();f0(Y,{...C0($.options),allowFull:!0})}var cS0=m(()=>{Ho();J4()});async function nS0($,Y,U,z){if($==="available"){await k0("seal_permissions_available_list",Y,U,{},C0(z.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,U,{},C0(z.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var pS0=m(()=>{f4();J4()});import{readFileSync as dS0}from"node:fs";async function mS0($,Y,U,z,Q,J,I){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},C0(I.options));return}if($==="decision"){if(Y==="update"||!Y){let K=h(I.options.input),G=K?JSON.parse(dS0(K,"utf8")):y8(I.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=h(I.options.default)??h(I.options.level)??z;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(Y==="policies"){if(U==="list"||!U){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},C0(I.options));return}if(U==="upsert"){let K=h(I.options.input),G=K?JSON.parse(dS0(K,"utf8")):y8(I.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(U==="remove"||U==="delete"){let K=z??h(I.options.id)??h(I.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var lS0=m(()=>{f4();D4();J4()});async function oS0($={}){let Y=s8(),U=_4(),z=u2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},S3());console.log(`[probe]corp=${z.id}source=${z.source.type}`);let Q=await xK(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await B1(z),I=await OM(J,{documentLimit:20,stylePreferencesEndpoint:z.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:I.rules.rules.length,hasPendingRuleDeletes:I.rules.hasPendingDeletes,documents:I.documents.articles.length,documentsTotal:I.documents.total,stylePreferences:I.stylePreferences.ok?"ok":`error:${I.stylePreferences.error}`},null,2))}var rS0=m(()=>{y3();i8();CT();X6()});async function sS0($,Y,U){let z=Y??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await oS0({corpId:z})}var aS0=m(()=>{rS0();D4()});async function qo($,Y,U,z,Q){if($==="count"){await k0("seal_approval_rules_list",U,z,{countOnly:!0},C0(Q.options));return}if($==="list"){if(Z0(Q.options.count)){await k0("seal_approval_rules_list",U,z,{countOnly:!0},C0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(Z0(Q.options.summary)){await k0("seal_approval_rules_list",U,z,{fields:V_0,limit:J,offset:I},C0(Q.options));return}let K=await T5("seal_approval_rules_list",U,z,{limit:J,offset:I});L_0(K,Z0(Q.options.full)===!0),f0(K);return}if($==="clear"){let J=Z0(Q.options.yes)===!0,I=Z0(Q.options.dryRun)??Z0(Q.options["dry-run"])??!J;if(!J&&!I)throw A9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${z.id}--dry-run`);let K=await T5("seal_approval_rules_clear",U,z,{dryRun:I,recode:Z0(Q.options.recode)});if(!J&&I&&K&&typeof K==="object"){f0({...K,
Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function Uy1($){let Y=iT($),U=Fo($),z=hq($);Ug0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):yT),J=$.host??(process.env.HOST?process.env.HOST:kT);uT(Y,`${process.pid}
`,{mode:384}),uT(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),uK(z,`servicestartingonhttp://${J}:${Q} pid=${process.pid}`);let I=null;try{I=await xT({port:Q,host:J,silent:!0}),uK(z,`service listening pid=${process.pid}`)}catch(G){if(uK(z,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),bT(Y)===process.pid)h9(Y,{force:!0}),h9(U,{force:!0});throw G}let K=()=>{if(I)I.close(),I=null;if(bT(Y)===process.pid)h9(Y,{force:!0}),h9(U,{force:!0});uK(z,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,K(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function eS0($){Ug0($.stateDir);let Y=bK($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...U.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let Q=tg1(U.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=iT($);return uT(J,`${Q.pid}
`,{flag:"a",mode:384})}var wo=m(()=>{Xo()});import{homedir as Qy1}from"node:os";import{join as Jy1}from"node:path";async function Oo($,Y,U){let z=U?s0(U.options.port)??s0(U.options.p):void 0,Q=U?h(U.options.host)??h(U.options.h):void 0,J=U?s0(U.options.lines)??s0(U.options.n):void 0,I=await kz($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Mo,version:P1,launcher:Y.launcher,port:z,host:Q},{maxLines:J});if(I!==void 0)f0(I)}var Mo;var No=m(()=>{e9();wo();J4();D4();Mo=Jy1(Qy1(),".config","seal-use")});import{existsSync as Iy1,readFileSync as zg0}from"node:fs";async function Qg0($,Y,U,z,Q){if($==="batch-records"||$==="records"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",U,z,{batchId:J,query:h(Q.options.query)},C0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=K?JSON.parse(zg0(K,"utf8")):void 0,H=h(Q.options.input),W=H?JSON.parse(zg0(H,"utf8")):y8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=u6(Q.options.packageIds)??u6(Q.options["package-ids"])??(X?[X]:void 0),q=u6(Q.options.flowIds)??u6(Q.options["flow-ids"])??u6(Q.options.documentSn)??u6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),F=Z0(Q.options.noWait)??Z0(Q.options["no-wait"]);await k0("seal_simulation_batch_create",U,z,{mode:I,sourceSystem:I,flowIds:q,documentSn:q,rejectNodeName:h(Q.options.rejectNode)??h(Q.options["reject-node"])??null,thinkingDepthOverride:h(Q.options.thinkingDepth)??h(Q.options["thinking-depth"]),skipInvoiceGeneration:Z0(Q.options.skipInvoiceGeneration)??Z0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:Z0(Q.options.skipExpenseExtraction)??Z0(Q.options["skip-expense-extraction"]),disableAttachmentCache:Z0(Q.options.disableAttachmentCache)??Z0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:u6(Q.options.requestIds)??u6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:u6(Q.options.flowStatusList)?.map(Number)??u6(Q.options["flow-status-list"])?.map(Number),businessCodes:u6(Q.options.businessCodes)??u6(Q.options["business-codes"]),documentType:h(Q.options.documentType)??h(Q.options["document-type"]),startTime:s0(Q.options.startTime)??s0(Q.options["start-time"]),endTime:s0(Q.options.endTime)??s0(Q.options["end-time"]),status:u6(Q.options.status),limit:s0(Q.options.limit),noWait:F,rawParams:W},C0(Q.options));return}if($==="wait"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",U,z,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},C0(Q.options));return}if($==="status"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",U,z,{batchId:J},C0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",U,z,{batchId:J},C0(Q.options));return}if($==="specifications"){let J=Y??h(Q.options.integration)??h(Q.options.signKey)??h(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",U,z,{signKey:J},C0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",U,z,{},C0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",U,z,{limit:s0(Q.options.limit)},C0(Q.options));return}if($==="get"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",U,z,{batchId:J},C0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",U,z,{},C0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",U,z,{},C0(Q.options));return}if($==="package-upload"){let J=Y??h(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Iy1(J))throw Error(`Filenotfound:${J}`);await k0("seal_simulation_material_package_upload",U,z,{filePath:J},C0(Q.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Jg0=m(()=>{f4();D4();J4()});import{existsSync as Ig0}from"node:fs";import{join as cT}from"node:path";function Kg0($,Y,U){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${zoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let z=Z0(U.options.local)||Z0(U.options.workspace),Q=h(U.options.dir)??h(U.options.target)??Y,J=Q?Q:z?cT(process.cwd(),".agents","skills","seal-use"):yz(),I=LS0(J),K=!z&&!Q,G=K?rl():void 0,H=K?tl():void 0;f0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let z=yz(),Q=cT(process.cwd(),".agents","skills","seal-use"),J=sl(),I=el();f0({global:{dir:z,installed:Ig0(cT(z,"SKILL.md"))},local:{dir:Q,installed:Ig0(cT(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Gg0=m(()=>{Yo();Rq();D4();J4()});async function Hg0($,Y){if($==="config"){f0(await xK(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Wg0=m(()=>{CT();J4()});function Do($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function Xg0($){let{sourceCorp:Y,targetCorp:U,sourceClient:z,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new w4(`重放目标企业「${U.name}」(${U.id})的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Y.id}<testCorpId>`);let X=await nY(Q),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*F;if(V<M)throw new w4(`测试企业「${U.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${J}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await i4(z,{limit:J,status:"completed"}),N=Array.isArray(w.records)?w.records:[];if(N.length===0){let d=await i4(z,{limit:J});N=Array.isArray(d.records)?d.records:[]}if(N.length===0)throw new w4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),I){let d=N.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=Do(g),e=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:e,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let O=await Gp(Q,U,$.webhookSelector),D=[];for(let d of N){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=Do(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await H4(z,d.id),y=`${H}${$0}`,s=Ip(e,{snPrefix:H,docIdPrefix:H});await Kp(O.incomingDocumentWebhook.url,O.secret,s,W,A6(U.seal));let Y0=null,N0=Date.now();while(Date.now()-N0<G){await new Promise((W0)=>setTimeout(W0,K));let a=await i4(Q,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let W0=a.records[0];if(W0.status==="completed"||W0.status==="failed"){Y0=W0;break}}}if(!Y0){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-t});continue}let E0=Do(Y0?.result?.decision??Y0.aiDecision??Y0?.decision??(Y0.status==="completed"?"APPROVE":"ERROR")),G0=Y0?.result?.summary??Y0.aiSummary,T0=g===E0,i0=T0?"MATCHED":"FLIPPED",Y1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:Y0.id,testDecision:E0,testSummary:G0,status:i0,durationMs:Date.now()-t};if(!T0)Y1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产:${p.slice(0,60)}...->测试:${G0.slice(0,60)}...`:void 0};D.push(Y1)}catch(e){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:e instanceof Error?e.message:String(e),durationMs:Date.now()-t})}}let P=D.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=D.filter((d)=>d.status==="MATCHED"),A=D.filter((d)=>d.status==="FLIPPED"),j=D.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,x=C+b,S=x>0?C/x:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",z0=!i&&j===0,k;try{let d=await nY(Q),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!i&&j===0,verdict:c,safeToPublish:z0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(S.toFixed(4))},flips:A,records:D}}function Zg0($){let{sourceCorp:Y,targetCorp:U,verdict:z,safeToPublish:Q,metrics:J,quota:I,flips:K,records:G}=$,H=z==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":z==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${U.name}」`,`判定:${H}·准许发布:${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${J.sampleCount}|一致通过:${J.matchCount}|决策翻转:${J.flipCount}|异常失败:${J.failureCount}`,`一致率:${(J.concordanceRate*100).toFixed(1)}%|消耗预估:${I.estimatedRequired}点(余量:${I.balanceBefore}${I.balanceAfter!==void0?` -> ${I.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){W.push(`⚠️决策翻转清单(${K.length}笔单据在新规则下结果改变):`);for(let X of K)if(W.push(`•单据[${X.sn}]:原生产判定「${X.prodDecision}」➔测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)W.push(`理由差异:${X.diff.reasonDiff}`);W.push(" "+"─".repeat(65)),W.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(z==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100
Line truncated
`)}var qg0=m(()=>{L$();X6();SZ()});async function Ao($,Y,U){let z=($??Y??"regression").toLowerCase();if(z==="regression"||z==="regress"||z==="matrix"){let Q=h(U.options.corp)??(Y&&Y!==z?Y:void 0),J=j1(Q),I=J,K=J;if(J.environment==="test"){K=J;let O=h(U.options["prod-corp"])??h(U.options.prod)??J.prodCorpId;if(!O)throw new w4(`测试企业「${J.name}」(${J.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${J.id}`);I=j1(O)}else{I=J;let O=h(U.options["test-corp"])??h(U.options.test)??J.testCorpId;if(!O)throw new w4(`生产企业「${J.name}」(${J.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${J.id}<testCorpId>`);K=j1(O)}let G=await B1(I),H=await B1(K),W=s0(U.options.samples)??s0(U.options.limit)??s0(U.options.n)??10,X=Z0(U.options["dry-run"]),Z=Z0(U.options["fail-on-flips"]),q=s0(U.options["poll-interval"])??2000,V=s0(U.options.timeout)??45000,F=h(U.options["sn-prefix"])??"REG_",M=h(U.options.webhook)??h(U.options.selector),w=await Xg0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z,webhookSelector:M});if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(Zg0(w));if(f0(w),Z&&!w.ok)throw new w4(`回归测试发现${w.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new w4(`未知的test子命令:"${z}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var Vg0=m(()=>{L$();f4();D4();J4();i8();qg0()});async function Lg0($,Y,U,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,U,y8(z.json),C0(z.options))}var Fg0=m(()=>{f4();D4();J4()});function wg0(){f0(Lq.map(($)=>({name:$.name,description:$.description})))}var Mg0=m(()=>{wq();J4()});function nT($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var Og0=m(()=>{Rq()});import{existsSync as Ky1,mkdirSync as Gy1,readFileSync as Hy1,renameSync as Wy1,writeFileSync as Xy1}from"node:fs";import{homedir as Zy1}from"node:os";import{dirname as qy1,join as Vy1}from"node:path";import{spawn as Ly1}from"node:child_process";function Ng0(){let $=process.env[Fy1]?.trim();if($)return $;return My1}function Dg0($=Ng0()){if(!Ky1($))return null;try{let Y=Hy1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return U;return null}catch{return null}}function pT($,Y=Ng0()){try{let U=qy1(Y);Gy1(U,{recursive:!0,mode:448});let z={checkedAt:$.checkedAt??new Date().toISOString(),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Xy1(Q,JSON.stringify(z,null,2),{mode:384}),Wy1(Q,Y)}catch{}}function Ag0($,Y=wy1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Bg0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Ly1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Fy1="SEAL_USE_UPDATE_CACHE_FILE",wy1=86400000,My1;var Bo=m(()=>{My1=Vy1(Zy1(),".config","seal-use","update-cache.json")});import{chmodSync as Oy1,mkdirSync as Ny1,readdirSync as Dy1,renameSync as Po,rmSync as Ay1,unlinkSync as Eg0,writeFileSync as Pg0}from"node:fs";import{basename as By1,dirname as Py1,join as mT}from"node:path";import{spawnSync as iK}from"node:child_process";async function Rg0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Mo,version:P1,launcher:$.launcher},z=Y.repo||process.env[Ty1]?.trim()||process.env[jy1]?.trim()||Cg0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=Sg0(D,P1);if(P<0)if(!uS&&Y.force);else{f0({updated:!1,currentVersion:P1,targetVersion:D,mode:nT()?"binary":"source",message:!uS?`Cannotdowngradeseal-usefromdevbuildv${P1}toreleasev${D}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${P1}toolderversionv${D}.Updatesmustbeforward-only.`});return}if(P===0&&!Y.force){f0({updated:!1,currentVersion:P1,targetVersion:D,mode:nT()?"binary":"source",message:`seal-useisalreadyatversionv${P1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let D=await To(z,Y.limit??10);f0({currentVersion:P1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===P1,isNewer:xz(P.version,P1)}))});return}if(!nT()){if(Y.checkOnly){let P=await To(z,30),T=P[0],A=T?.version??P1,j=P.find((x)=>x.version===P1),C=xz(A,P1),b=P.filter((x)=>xz(x.version,P1));if(T?.version)pT({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;f0({updated:!1,updateAvailable:C,currentVersion:P1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let D=bK(U).running;if(D)await kz("stop",U);try{jg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`gitpullskipped:${PinstanceofError?P.message:String(P)}`)}if(jg0("bun",["install"],{cwd:$.appRoot}),D)await kz("start",U);f0({updated:!0,serviceRestarted:D,version:P1,mode:"source"});return}let I=Cy1(),K=Ry1(),G=await To(z,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await Tg0(z,J):G[0]??await Tg0(z);if(!H){f0({updated:!1,currentVersion:P1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${z}'`});return}let W=H.version,X=G.find((D)=>D.version===P1),Z=xz(W,P1),q=Z||Boolean(Y.force),V=G.filter((D)=>xz(D.version,P1));if(H?.version)pT({latestVersion:H.version,publishedAt:H.publishedAt
Line truncated
`)}catch{}}async function hy1($,Y,U,z){let Q=jo(),J=[],I=U?U.startsWith("v")?U:`v${U}`:void 0,K=z||$.split("/").pop()||"";if(Q!=="github"){if(I&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${I}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${I}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(I&&K){let F=`https://github.com/${Cg0}/releases/download/${I}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);J.push(F)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let F=0;F<G.length;F++){let M=G[F],w=new AbortController,N="",O=(A)=>{N=A;try{w.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),P,T;try{dT(`==> [${F+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:w.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let j=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let c=Buffer.from(await A.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);Pg0(Y,c),dT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],x=0,S=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);O(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),z0,k=new Promise((g,p)=>{z0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,k])}finally{if(z0)clearTimeout(z0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-S>200){S=g;let p=j?Math.round(x/j*100):0,e=(x/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${e} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
`);Q(U)})})}var kT=8787,xT="127.0.0.1";var qo=m(()=>{SS0();$3()});async function gS0($){let Y=s0($.options.port)??s0($.options.p),z=h($.options.host)??h($.options.h),U=await fT({port:Y,host:z}),Q=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var yS0=m(()=>{D4();qo()});async function kS0($,Y,z,U){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,z,{},C0(U.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,z,{},C0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var xS0=m(()=>{f4();J4()});async function fS0($,Y){if($==="config"||$==="json"){Vo();return}let{startServer:z}=await iS0().then(() => bS0);z()}function Vo(){f0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var uS0=m(()=>{J4()});function cS0($){let Y=ST();f0(Y,{...C0($.options),allowFull:!0})}var nS0=m(()=>{Xo();J4()});async function pS0($,Y,z,U){if($==="available"){await k0("seal_permissions_available_list",Y,z,{},C0(U.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,z,{},C0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var dS0=m(()=>{f4();J4()});import{readFileSync as mS0}from"node:fs";async function lS0($,Y,z,U,Q,J,I){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},C0(I.options));return}if($==="decision"){if(Y==="update"||!Y){let K=h(I.options.input),G=K?JSON.parse(mS0(K,"utf8")):y8(I.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=h(I.options.default)??h(I.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(Y==="policies"){if(z==="list"||!z){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},C0(I.options));return}if(z==="upsert"){let K=h(I.options.input),G=K?JSON.parse(mS0(K,"utf8")):y8(I.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(z==="remove"||z==="delete"){let K=U??h(I.options.id)??h(I.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var oS0=m(()=>{f4();D4();J4()});async function rS0($={}){let Y=s8(),z=_4(),U=c2(Y,{stateful:z.stateful,defaultCorpId:z.defaultCorpId,corpId:$.corpId},g3());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Q=await uK(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await P1(U),I=await NM(J,{documentLimit:20,stylePreferencesEndpoint:U.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:I.rules.rules.length,hasPendingRuleDeletes:I.rules.hasPendingDeletes,documents:I.documents.articles.length,documentsTotal:I.documents.total,stylePreferences:I.stylePreferences.ok?"ok":`error:${I.stylePreferences.error}`},null,2))}var sS0=m(()=>{k3();i8();RT();X6()});async function aS0($,Y,z){let U=Y??h(z.options.corp)??($&&$!=="--corp"?$:void 0);await rS0({corpId:U})}var tS0=m(()=>{sS0();D4()});async function Lo($,Y,z,U,Q){if($==="count"){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(Q.options));return}if($==="list"){if(Z0(Q.options.count)){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(Z0(Q.options.summary)){await k0("seal_approval_rules_list",z,U,{fields:L_0,limit:J,offset:I},C0(Q.options));return}let K=await T5("seal_approval_rules_list",z,U,{limit:J,offset:I});F_0(K,Z0(Q.options.full)===!0),f0(K);return}if($==="clear"){let J=Z0(Q.options.yes)===!0,I=Z0(Q.options.dryRun)??Z0(Q.options["dry-run"])??!J;if(!J&&!I)throw A9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${U.id}--dry-run`);let K=await T5("seal_approval_rules_clear",z,U,{dryRun:I,recode:Z0(Q.options.recode)});if(!J&&I&&K&&typeof K==="object"){f0({...K,
Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:z,lines:J,totalLines:Q.length}}async function Uy1($){let Y=cT($),z=Mo($),U=hq($);Ug0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):kT),J=$.host??(process.env.HOST?process.env.HOST:xT);bT(Y,`${process.pid}
`,{mode:384}),bT(z,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),iK(U,`servicestartingonhttp://${J}:${Q} pid=${process.pid}`);let I=null;try{I=await fT({port:Q,host:J,silent:!0}),iK(U,`service listening pid=${process.pid}`)}catch(G){if(iK(U,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),iT(Y)===process.pid)h9(Y,{force:!0}),h9(z,{force:!0});throw G}let K=()=>{if(I)I.close(),I=null;if(iT(Y)===process.pid)h9(Y,{force:!0}),h9(z,{force:!0});iK(U,`stopped pid=${process.pid}`)};await new Promise((G)=>{let W=!1,H=()=>{if(W)return;W=!0,K(),process.off("SIGTERM",H),process.off("SIGINT",H),G()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function $g0($){Ug0($.stateDir);let Y=uU($);if(Y.running)return Y;let z=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...z.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Q=eg1(z.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=cT($);return bT(J,`${Q.pid}
`,{flag:"a",mode:384})}var Oo=m(()=>{qo()});import{homedir as Jy1}from"node:os";import{join as Iy1}from"node:path";async function Do($,Y,z){let U=z?s0(z.options.port)??s0(z.options.p):void 0,Q=z?h(z.options.host)??h(z.options.h):void 0,J=z?s0(z.options.lines)??s0(z.options.n):void 0,I=await r3($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:No,version:Z1,launcher:Y.launcher,port:U,host:Q},{maxLines:J});if(I!==void 0)f0(I)}var No;var Ao=m(()=>{$3();Oo();J4();D4();No=Iy1(Jy1(),".config","seal-use")});import{existsSync as Ky1,readFileSync as Qg0}from"node:fs";async function Jg0($,Y,z,U,Q){if($==="batch-records"||$==="records"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",z,U,{batchId:J,query:h(Q.options.query)},C0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=K?JSON.parse(Qg0(K,"utf8")):void 0,W=h(Q.options.input),H=W?JSON.parse(Qg0(W,"utf8")):y8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=u6(Q.options.packageIds)??u6(Q.options["package-ids"])??(X?[X]:void 0),q=u6(Q.options.flowIds)??u6(Q.options["flow-ids"])??u6(Q.options.documentSn)??u6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),F=Z0(Q.options.noWait)??Z0(Q.options["no-wait"]);await k0("seal_simulation_batch_create",z,U,{mode:I,sourceSystem:I,flowIds:q,documentSn:q,rejectNodeName:h(Q.options.rejectNode)??h(Q.options["reject-node"])??null,thinkingDepthOverride:h(Q.options.thinkingDepth)??h(Q.options["thinking-depth"]),skipInvoiceGeneration:Z0(Q.options.skipInvoiceGeneration)??Z0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:Z0(Q.options.skipExpenseExtraction)??Z0(Q.options["skip-expense-extraction"]),disableAttachmentCache:Z0(Q.options.disableAttachmentCache)??Z0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:u6(Q.options.requestIds)??u6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:u6(Q.options.flowStatusList)?.map(Number)??u6(Q.options["flow-status-list"])?.map(Number),businessCodes:u6(Q.options.businessCodes)??u6(Q.options["business-codes"]),documentType:h(Q.options.documentType)??h(Q.options["document-type"]),startTime:s0(Q.options.startTime)??s0(Q.options["start-time"]),endTime:s0(Q.options.endTime)??s0(Q.options["end-time"]),status:u6(Q.options.status),limit:s0(Q.options.limit),noWait:F,rawParams:H},C0(Q.options));return}if($==="wait"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",z,U,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},C0(Q.options));return}if($==="status"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",z,U,{batchId:J},C0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",z,U,{batchId:J},C0(Q.options));return}if($==="specifications"){let J=Y??h(Q.options.integration)??h(Q.options.signKey)??h(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",z,U,{signKey:J},C0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",z,U,{},C0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",z,U,{limit:s0(Q.options.limit)},C0(Q.options));return}if($==="get"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",z,U,{batchId:J},C0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",z,U,{},C0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",z,U,{},C0(Q.options));return}if($==="package-upload"){let J=Y??h(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Ky1(J))throw Error(`Filenotfound:${J}`);await k0("seal_simulation_material_package_upload",z,U,{filePath:J},C0(Q.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Ig0=m(()=>{f4();D4();J4()});import{existsSync as Kg0}from"node:fs";import{join as nT}from"node:path";function Gg0($,Y,z){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${JoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let U=Z0(z.options.local)||Z0(z.options.workspace),Q=h(z.options.dir)??h(z.options.target)??Y,J=Q?Q:U?nT(process.cwd(),".agents","skills","seal-use"):fU(),I=FS0(J),K=!U&&!Q,G=K?al():void 0,W=K?$o():void 0;f0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...W?{hosts:W}:{}});return}if($==="status"||$==="get"||!$){let U=fU(),Q=nT(process.cwd(),".agents","skills","seal-use"),J=tl(),I=Yo();f0({global:{dir:U,installed:Kg0(nT(U,"SKILL.md"))},local:{dir:Q,installed:Kg0(nT(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Wg0=m(()=>{Uo();Rq();D4();J4()});async function Hg0($,Y){if($==="config"){f0(await uK(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Xg0=m(()=>{RT();J4()});function Bo($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function Zg0($){let{sourceCorp:Y,targetCorp:z,sourceClient:U,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:W="REG_",fetchFn:H=fetch}=$;if(z.environment!=="test")throw new w4(`重放目标企业「${z.name}」(${z.id})的环境为「${z.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Y.id}<testCorpId>`);let X=await mY(Q),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*F;if(V<M)throw new w4(`测试企业「${z.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${J}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${z.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await i4(U,{limit:J,status:"completed"}),N=Array.isArray(w.records)?w.records:[];if(N.length===0){let d=await i4(U,{limit:J});N=Array.isArray(d.records)?d.records:[]}if(N.length===0)throw new w4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),I){let d=N.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=Bo(g),e=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:e,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let O=await Hp(Q,z,$.webhookSelector),D=[];for(let d of N){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=Bo(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await W4(U,d.id),y=`${W}${$0}`,s=Gp(e,{snPrefix:W,docIdPrefix:W});await Wp(O.incomingDocumentWebhook.url,O.secret,s,H,A6(z.seal));let Y0=null,N0=Date.now();while(Date.now()-N0<G){await new Promise((H0)=>setTimeout(H0,K));let a=await i4(Q,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let H0=a.records[0];if(H0.status==="completed"||H0.status==="failed"){Y0=H0;break}}}if(!Y0){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-t});continue}let E0=Bo(Y0?.result?.decision??Y0.aiDecision??Y0?.decision??(Y0.status==="completed"?"APPROVE":"ERROR")),G0=Y0?.result?.summary??Y0.aiSummary,T0=g===E0,i0=T0?"MATCHED":"FLIPPED",Y1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:Y0.id,testDecision:E0,testSummary:G0,status:i0,durationMs:Date.now()-t};if(!T0)Y1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产:${p.slice(0,60)}...->测试:${G0.slice(0,60)}...`:void 0};D.push(Y1)}catch(e){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:e instanceof Error?e.message:String(e),durationMs:Date.now()-t})}}let P=D.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=D.filter((d)=>d.status==="MATCHED"),A=D.filter((d)=>d.status==="FLIPPED"),j=D.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,x=C+b,S=x>0?C/x:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",U0=!i&&j===0,k;try{let d=await mY(Q),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!i&&j===0,verdict:c,safeToPublish:U0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(S.toFixed(4))},flips:A,records:D}}function qg0($){let{sourceCorp:Y,targetCorp:z,verdict:U,safeToPublish:Q,metrics:J,quota:I,flips:K,records:G}=$,W=U==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":U==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",H=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${z.name}」`,`判定:${W}·准许发布:${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${J.sampleCount}|一致通过:${J.matchCount}|决策翻转:${J.flipCount}|异常失败:${J.failureCount}`,`一致率:${(J.concordanceRate*100).toFixed(1)}%|消耗预估:${I.estimatedRequired}点(余量:${I.balanceBefore}${I.balanceAfter!==void0?` -> ${I.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){H.push(`⚠️决策翻转清单(${K.length}笔单据在新规则下结果改变):`);for(let X of K)if(H.push(`•单据[${X.sn}]:原生产判定「${X.prodDecision}」➔测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)H.push(`理由差异:${X.diff.reasonDiff}`);H.push(" "+"─".repeat(65)),H.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(U==="CLEAN")H.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100
Line truncated
`)}var Vg0=m(()=>{L$();X6();SZ()});async function Po($,Y,z){let U=($??Y??"regression").toLowerCase();if(U==="regression"||U==="regress"||U==="matrix"){let Q=h(z.options.corp)??(Y&&Y!==U?Y:void 0),J=j1(Q),I=J,K=J;if(J.environment==="test"){K=J;let O=h(z.options["prod-corp"])??h(z.options.prod)??J.prodCorpId;if(!O)throw new w4(`测试企业「${J.name}」(${J.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${J.id}`);I=j1(O)}else{I=J;let O=h(z.options["test-corp"])??h(z.options.test)??J.testCorpId;if(!O)throw new w4(`生产企业「${J.name}」(${J.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${J.id}<testCorpId>`);K=j1(O)}let G=await P1(I),W=await P1(K),H=s0(z.options.samples)??s0(z.options.limit)??s0(z.options.n)??10,X=Z0(z.options["dry-run"]),Z=Z0(z.options["fail-on-flips"]),q=s0(z.options["poll-interval"])??2000,V=s0(z.options.timeout)??45000,F=h(z.options["sn-prefix"])??"REG_",M=h(z.options.webhook)??h(z.options.selector),w=await Zg0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:W,samples:H,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z,webhookSelector:M});if(!(Z0(z.options.quiet)||Z0(z.options.silent)))console.error(qg0(w));if(f0(w),Z&&!w.ok)throw new w4(`回归测试发现${w.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new w4(`未知的test子命令:"${U}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var Lg0=m(()=>{L$();f4();D4();J4();i8();Vg0()});async function Fg0($,Y,z,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,z,y8(U.json),C0(U.options))}var wg0=m(()=>{f4();D4();J4()});function Mg0(){f0(Lq.map(($)=>({name:$.name,description:$.description})))}var Og0=m(()=>{wq();J4()});function pT($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let z=$.toLowerCase().replace(/\\/g,"/");return!z.endsWith("/bun")&&!z.endsWith("/bun.exe")&&!z.endsWith("/node")&&!z.endsWith("/node.exe")}var Ng0=m(()=>{Rq()});import{existsSync as Gy1,mkdirSync as Wy1,readFileSync as Hy1,renameSync as Xy1,writeFileSync as Zy1}from"node:fs";import{homedir as qy1}from"node:os";import{dirname as Vy1,join as Ly1}from"node:path";import{spawn as Fy1}from"node:child_process";function Dg0(){let $=process.env[wy1]?.trim();if($)return $;return Oy1}function Ag0($=Dg0()){if(!Gy1($))return null;try{let Y=Hy1($,"utf-8"),z=JSON.parse(Y);if(z&&typeof z==="object"&&typeof z.latestVersion==="string"&&typeof z.checkedAt==="string")return z;return null}catch{return null}}function Sq($,Y=Dg0()){try{let z=Vy1(Y);Wy1(z,{recursive:!0,mode:448});let U={checkedAt:$.checkedAt??new Date().toISOString(),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Zy1(Q,JSON.stringify(U,null,2),{mode:384}),Xy1(Q,Y)}catch{}}function Bg0($,Y=My1){if(!$||!$.checkedAt)return!0;let z=new Date($.checkedAt).getTime();if(Number.isNaN(z))return!0;return Date.now()-z>Y}function Pg0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,z=[...$.args??[],"update","check","--bg-save"];return Fy1(Y,z,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var wy1="SEAL_USE_UPDATE_CACHE_FILE",My1=86400000,Oy1;var To=m(()=>{Oy1=Ly1(qy1(),".config","seal-use","update-cache.json")});import{chmodSync as Ny1,mkdirSync as Dy1,readdirSync as Ay1,realpathSync as Tg0,renameSync as jo,rmSync as By1,unlinkSync as Cg0,writeFileSync as jg0}from"node:fs";import{basename as Py1,dirname as Ty1,isAbsolute as jy1,join as lT,relative as Ey1}from"node:path";import{spawnSync as S9}from"node:child_process";async function _g0($,Y={}){let z={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:No,version:Z1,launcher:$.launcher},U=Y.repo||process.env[Cy1]?.trim()||process.env[Ry1]?.trim()||Rg0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=gg0(D,Z1);if(P<0)if(!iS&&Y.force);else{f0({updated:!1,currentVersion:Z1,targetVersion:D,mode:pT()?"binary":"source",message:!iS?`Cannotdowngradeseal-usefromdevbuildv${Z1}toreleasev${D}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${Z1}toolderversionv${D}.Updatesmustbeforward-only.`});return}if(P===0&&!Y.force){f0({updated:!1,currentVersion:Z1,targetVersion:D,mode:pT()?"binary":"source",message:`seal-useisalreadyatversionv${Z1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let D=await mT(U,Y.limit??10);f0({currentVersion:Z1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===Z1,isNewer:s3(P.version,Z1)}))});return}if(!pT()){if(Y.checkOnly){let P=await mT(U,30),T=P[0],A=T?.version??Z1,j=P.find((x)=>x.version===Z1),C=s3(A,Z1),b=P.filter((x)=>s3(x.version,Z1));if(T?.version)Sq({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;f0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=uU(z).running;if(D)await r3("stop",z);try{Eg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️开发版更新同步失败,继续刷新本地依赖:${PinstanceofError?P.message:String(P)}`)}if(Eg0("bun",["install"],{cwd:$.appRoot}),D)await r3("start",z);f0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(gy1())try{await yy1($,Y,z,U,J);return}catch(D){console.error(`⚠️Homebrew自动更新失败,回退至原生二进制更新:${DinstanceofError?D.message:String(D)}`)}let I=vy1(),K=hy1(),G=await mT(U,30),W=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await oT(U,J):G[0]??await oT(U);if(!W){f0({updated:!1,
Line truncated
`)}catch{}}async function fy1($,Y,z,U){let Q=Eo(),J=[],I=z?z.startsWith("v")?z:`v${z}`:void 0,K=U||$.split("/").pop()||"";if(Q!=="github"){if(I&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${I}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${I}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(I&&K){let F=`https://github.com/${Rg0}/releases/download/${I}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);J.push(F)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),W,H=6000,X=6000,Z=307200,q=1e4,V=180000;for(let F=0;F<G.length;F++){let M=G[F],w=new AbortController,N="",O=(A)=>{N=A;try{w.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},H),P,T;try{dT(`==> [${F+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:w.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let j=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let c=Buffer.from(await A.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);jg0(Y,c),dT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],x=0,S=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);O(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),U0,k=new Promise((g,p)=>{U0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,k])}finally{if(U0)clearTimeout(U0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-S>200){S=g;let p=j?Math.round(x/j*100):0,e=(x/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${e} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
"description":"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"
description:"v0.10.33: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.34: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version:0.10.33
short-description:Seal tenant and Hose approval automation (v0.10.33)
version:0.10.34
short-description:Seal tenant and Hose approval automation (v0.10.34)
`seal-use service <start|stop|restart|status|logs>` manages the persistent background service daemon with embedded HTTP server (serving `/docs`, `/openapi.json`, and `POST /api/cli`). `status` returns the PID, version, host, port, active HTTP URL, state directory, PID file, and log file.
`seal-use update`updates the git checkout, runs `bun install`, and restarts the local service if it was running.
`seal-use update`checks and installs the latest official release, preserves the service state when needed, and refreshes the installed Agent Skill. The installation method is handled automatically and should not be exposed in user-facing explanations. `seal-use update --check` only reports available releases, and `seal-use update changelog` reads release history.
System diagnostic & embedded architecture specifications:
@@ -38,7 +38,7 @@ Classify both the enterprise identity origin and how the current credential was
| Enterprise identity origin | Credential material the user may have | 权限等级与时效 | Meaning |
| --- | --- | --- | --- |
| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and `corps sync-hosecloud`. |
| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and `deploy hosecloud sync`. |
| Hose/合思-sourced Seal tenant | Hose authorization/assistance link (`thirdparty.html`) | 【两极分化】普通导入→短效;提权→永久 | Temporary session that can be **elevated** to permanent `appKey`/`appSecurity` with `extract-keys --save` or `add-link --as-hose`. |
| Hose/合思-sourced Seal tenant | cURL copied from an authenticated **Hose admin** page | 【两极分化】普通导入→短效;提权→永久 | **Same session scope as an assistance link.** If the user is a Hose administrator, this carries the same web session credentials (`accesstoken`, `corpid`, cookies) and can equally invoke `/api/innerapi/v1/key` to extract permanent `appKey`/`appSecurity`. |
| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Seal page | 【短效会话快照】 | Snapshot with Seal Bearer token; can set up temporary Seal session access. |
@@ -85,7 +85,7 @@ First distinguish the link by its host, purpose, and identity origin:
- A **Hose/合思 authorization/assistance link** (`https://<domain>/web/thirdparty.html?...`) opens an upstream Hose session and may continue through Seal SSO. It is not a Seal delegation link.
- A **Seal-native assistance/delegation link** grants temporary delegated access on a Seal tenant. It is not a Hose credential and cannot be elevated to Hose OpenAPI credentials.
- **Hose Subdomain Boundary (合思子域专属提权)**: `seal-use` primarily manages Seal tenants. Tenants sourced from the Hose ecosystem have an upstream Hose enterprise backing them. A received Hose assistance link contains only a temporary session `accessToken`. If you run standard `corps add-link`, it exchanges that temporary token for a short-lived Seal Bearer token—sufficient for basic Seal inspection, but it will expire and cannot call any Hose OpenAPI.
- **Privilege Elevation (权限等级提升)**: To elevate from a short-lived session token to permanent, durable Hose OpenAPI developer credentials, use `corps extract-keys <url> --save` or `corps add-link <url> --as-hose`. This leverages Hose's internal key interface (`GET /api/innerapi/v1/key`) using the session token to retrieve the enterprise's OpenAPI `appKey` and `appSecurity`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (e.g. `corps sync-hosecloud`).
- **Privilege Elevation (权限等级提升)**: To elevate from a short-lived session token to permanent, durable Hose OpenAPI developer credentials, use `corps extract-keys <url> --save` or `corps add-link <url> --as-hose`. This leverages Hose's internal key interface (`GET /api/innerapi/v1/key`) using the session token to retrieve the enterprise's OpenAPI `appKey` and `appSecurity`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (for example, `deploy hosecloud sync`).
- **Multi-Key Disambiguation (多套密钥明确抉择)**: If the enterprise owns multiple application keys, the CLI **will not** guess or silently pick the first key. Instead, it terminates with an informative candidate list and requires the user to specify `--app-key <key>` or `--key-id <id>`. If only one key exists, it is selected automatically.
- **Non-Hose Tenants Blocked**: Calling `keys` on native Seal enterprises (`corp.source.type !== "hose"`) is strictly rejected with exit code 2, explaining that this capability belongs exclusively to the Hose ecosystem.
@@ -171,7 +171,7 @@ If the captured request contains only cookies or an authentication shape the CLI
message:"Homebrew-managed installations follow the formula version and do not support selecting a historical release. Use Homebrew directly for version pinning."
});
return;
}
if(options.checkOnly){
printJson({
updated: false,
@@ -378,6 +402,178 @@ function detectArch(): "arm64" | "x64" {
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.