@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.10.31] - 2026-09-20
### Added
- **Top-Level Mandatory Business Vocabulary & Output Contract**: Elevated terminology and presentation rules to Chapter 0 of `SKILL.md` as mandatory red lines across all agent output channels (rules list, rule detail, diff review, doctor tenant, feedback remediation, and conversational dialogue).
- Machine UUID & Internal Fields Redaction: Strictly prohibited exposing raw persistence UUIDs (`01a00f...`, `cly...`) and internal technical names (`boundCorpRole`, `permissions: ["*"]`, `tenantSlug`) to users.
- **Mandatory Image Presentation Contract for First-Time Onboarding**: Hardcoded rule in `SKILL.md` and `first-time-user.md` requiring agents to proactively render step-by-step visual screenshots using Markdown image syntax during onboarding, forbidding text-only descriptions.
- **Clean Administrator Candidate Directory with Privacy Masking**: When multiple candidate administrators exist, the CLI formats a clean, numbered directory with standard Chinese mobile masking (`138****5678`), strips raw internal IDs and technical noise, provides friendly selection guidance (by name keyword, by last 4 digits of phone, or `--force`), and retains all candidates without omission.
- **Automated Enterprise Name Resolution on Onboarding**: `corps add-hose`, `add-link`, and `extract-keys --save` now automatically query the live Seal tenant during verification and persist the human-readable enterprise name, preventing enterprises from being registered with raw machine IDs (e.g. `ID01LG7ksGroB1`).
- **Doctor Tenant Diagnosis Humanization**: Added `boundCorpRoleDescription` and `permissionLevel` to provide clear, business-friendly status summaries without exposing raw internal arrays and enums.
- **Business-Focused Rule Summary Fields**: Refined `RULE_SUMMARY_FIELDS` to prioritize `["code", "status", "strictness", "scope", "updatedAt"]`, eliminating raw UUIDs from default summaries.
import{createRequireasWy0}from"node:module";varYy0=Object.create;var{getPrototypeOf:zy0,defineProperty:mT,getOwnPropertyNames:Uy0}=Object;varIy0=Object.prototype.hasOwnProperty;functionQy0($){returnthis[$]}varJy0,Ky0,Q6=($,Y,z)=>{varU=$!=null&&typeof$==="object";if(U){varI=Y?Jy0??=newWeakMap:Ky0??=newWeakMap,Q=I.get($);if(Q)returnQ}z=$!=null?Yy0(zy0($)):{};letJ=Y||!$||!$.__esModule?mT(z,"default",{value:$,enumerable:!0}):z;for(letKofUy0($))if(!Iy0.call(J,K))mT(J,K,{get:Qy0.bind($,K),enumerable:!0});if(U)I.set($,J);returnJ};varE=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varGy0=($)=>$;functionHy0($,Y){this[$]=Gy0.bind(null,Y)}varx8=($,Y)=>{for(varzinY)mT($,z,{get:Y[z],enumerable:!0,configurable:!0,set:Hy0.bind(Y,z)})};varo=($,Y)=>()=>($&&(Y=$($=0)),Y);varJ0=Wy0(import.meta.url);varXy0,cq,Zy0,qy0,Vy0,Ly0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),xo=($,Y)=>{letz={};for(varUin$)cq(z,U,{get:$[U],enumerable:!0});if(Y)cq(z,Symbol.toStringTag,{value:"Module"});returnz},Fy0=($,Y,z,U)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varI=qy0(Y),Q=0,J=I.length,K;Q<J;Q++)if(K=I[Q],!Ly0.call($,K)&&K!==z)cq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(U=Zy0(Y,K))||U.enumerable})}return$},nq=($,Y,z)=>(z=$!=null?Xy0(Vy0($)):{},Fy0(Y||!$||!$.__esModule?cq(z,"default",{value:$,enumerable:!0}):z,$));varlT=o(()=>{Xy0=Object.create,cq=Object.defineProperty,Zy0=Object.getOwnPropertyDescriptor,qy0=Object.getOwnPropertyNames,Vy0=Object.getPrototypeOf,Ly0=Object.prototype.hasOwnProperty});functionuo($){returntypeof$==="string"&&fo.has($.replace(/#$/,""))}functionbo($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letz=$.$schema.replace(/#$/,"");if(wy0.has(z))return"2020-12";if(fo.has(z))return"2019-09";if(My0.has(z)||Oy0.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}`)}varwy0,fo,My0,Oy0;varoT=o(()=>{wy0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),fo=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),My0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Oy0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionH0($,Y,z){functionU(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:J,traits:newSet},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);letH=J.prototype,W=Object.keys(H);for(letX=0;X<W.length;X++){letZ=W[X];if(!(ZinK))K[Z]=H[Z].bind(K)}}letI=z?.Parent??Object;classQextendsI{}Object.defineProperty(Q,"name",{value:$});functionJ(K){varG;letH=z?.Parent?newQ:this;U(H,K),(G=H._zod).deferred??(G.deferred=[]);for(letWofH._zod.deferred)W();returnH}returnObject.defineProperty(J,"init",{value:U}),Object.defineProperty(J,Symbol.hasInstance,{value:(K)=>{if(z?.Parent&&Kinstanceofz.Parent)return!0;returnK?._zod?.traits?.has($)}}),Object.defineProperty(J,"name",{value:$}),J}functiona4($){if($)Object.assign(AY,$);returnAY}vario,mK,rT,f5,PY,AY;varBY=o(()=>{mK=Object.freeze({status:"aborted"});rT=Symbol("zod_brand");f5=classf5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};PY=classPYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(io=globalThis).__zod_globalConfig??(io.__zod_globalConfig={});AY=globalThis.__zod_globalConfig});vary0={};x8(y0,{unwrapMessage:()=>lK,uint8ArrayToHex:()=>py0,uint8ArrayToBase64url:()=>cy0,uint8ArrayToBase64:()=>po,stringifyPrimitive:()=>v0,slugify:()=>tT,shallowClone:()=>$j,safeExtend:()=>ky0,required:()=>uy0,randomString:()=>Ry0,propertyKeyTypes:()=>sK,promiseAllObject:()=>Cy0,primitiveTypes:()=>Yj,prefixIssues:()=>f8,pick:()=>Sy0,partial:()=>fy0,parsedType:()=>S0,optionalKeys:()=>zj,omit:()=>gy0,objectClone:()=>Ty0,numKeys:()=>_y0,nullish:()=>I7,normalizeParams:()=>x0,mergeDefs:()=>i9,merge:()=>xy0,jsonStringifyReplacer:()=>uU,joinValues:()=>N0,issue:()=>iU,isPlainObject:()=>J7,isObject:()=>TY,hexToUint8Array:()=>ny0,getSizableOrigin:()=>aK,getParsedType:()=>vy0,getLengthableOrigin:()=>tK,getEnumValues:()=>oK,getElementAtPath:()=>Ey0,floatSafeRemainder:()=>aT,finalizeIssue:()=>A8,extend:()=>yy0,explicitlyAborted:()=>Qj,escapeRegex:()=>N$,esc:()=>pq,defineLazy:()=>T1,createTransparentProxy:()=>hy0,cloneDef:()=>jy0,clone:()=>D8,cleanRegex:()=>rK,cleanEnum:()=>by0,captureStackTrace:()=>dq,cached:()=>bU,base64urlToUint8Array:()=>iy0,base64ToUint8Array:()=>no,assignProp:()=>Q7,assertNotEqual:()=>Dy0,assertNever:()=>Py0,assertIs:()=>Ay0,assertEqual:()=>Ny0,assert:()=>By0,allowsEval:()=>eT,aborted:()=>K7,NUMBER_FORMAT_RANGES:()=>Uj,Class:()=>moLine truncated
`)}var lo=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,uU,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},eK,u8;var Gj=o(()=>{BY();$1();eK=H0("$ZodError",lo),u8=H0("$ZodError",lo,{Parent:Error})});var cU=($)=>(Y,z,U,I)=>{let Q=U?{...U,async:!1}:{async:!1},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)throw new f5;if(J.issues.length){let K=new(I?.Err??$)(J.issues.map((G)=>A8(G,Q,a4())));throw dq(K,I?.callee),K}return J.value},mq,nU=($)=>async(Y,z,U,I)=>{let Q=U?{...U,async:!0}:{async:!0},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)J=await J;if(J.issues.length){let K=new(I?.Err??$)(J.issues.map((G)=>A8(G,Q,a4())));throw dq(K,I?.callee),K}return J.value},lq,pU=($)=>(Y,z,U)=>{let I=U?{...U,async:!1}:{async:!1},Q=Y._zod.run({value:z,issues:[]},I);if(Q instanceof Promise)throw new f5;return Q.issues.length?{success:!1,error:new($??eK)(Q.issues.map((J)=>A8(J,I,a4())))}:{success:!0,data:Q.value}},Hj,dU=($)=>async(Y,z,U)=>{let I=U?{...U,async:!0}:{async:!0},Q=Y._zod.run({value:z,issues:[]},I);if(Q instanceof Promise)Q=await Q;return Q.issues.length?{success:!1,error:new $(Q.issues.map((J)=>A8(J,I,a4())))}:{success:!0,data:Q.value}},Wj,oq=($)=>(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return cU($)(Y,z,I)},my0,rq=($)=>(Y,z,U)=>{return cU($)(Y,z,U)},ly0,sq=($)=>async(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return nU($)(Y,z,I)},oy0,aq=($)=>async(Y,z,U)=>{return nU($)(Y,z,U)},ry0,tq=($)=>(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return pU($)(Y,z,I)},sy0,eq=($)=>(Y,z,U)=>{return pU($)(Y,z,U)},ay0,$V=($)=>async(Y,z,U)=>{let I=U?{...U,direction:"backward"}:{direction:"backward"};return dU($)(Y,z,I)},ty0,YV=($)=>async(Y,z,U)=>{return dU($)(Y,z,U)},ey0;var Xj=o(()=>{BY();Gj();$1();mq=cU(u8),lq=nU(u8),Hj=pU(u8),Wj=dU(u8),my0=oq(u8),ly0=rq(u8),oy0=sq(u8),ry0=aq(u8),sy0=tq(u8),ay0=eq(u8),ty0=$V(u8),ey0=YV(u8)});var Y$={};x8(Y$,{xid:()=>Lj,uuid7:()=>Uk0,uuid6:()=>zk0,uuid4:()=>Yk0,uuid:()=>jY,uppercase:()=>bj,unicodeEmail:()=>ro,undefined:()=>fj,ulid:()=>Vj,time:()=>vj,string:()=>Sj,sha512_hex:()=>Bk0,sha512_base64url:()=>jk0,sha512_base64:()=>Tk0,sha384_hex:()=>Dk0,sha384_base64url:()=>Pk0,sha384_base64:()=>Ak0,sha256_hex:()=>Mk0,sha256_base64url:()=>Nk0,sha256_base64:()=>Ok0,sha1_hex:()=>Lk0,sha1_base64url:()=>wk0,sha1_base64:()=>Fk0,rfc5322Email:()=>Qk0,number:()=>zG,null:()=>xj,nanoid:()=>wj,md5_hex:()=>Zk0,md5_base64url:()=>Vk0,md5_base64:()=>qk0,mac:()=>Bj,lowercase:()=>uj,ksuid:()=>Fj,ipv6:()=>Pj,ipv4:()=>Aj,integer:()=>yj,idnEmail:()=>Jk0,httpProtocol:()=>Cj,html5Email:()=>Ik0,hostname:()=>Hk0,hex:()=>Xk0,guid:()=>Oj,extendedDuration:()=>$k0,emoji:()=>Dj,email:()=>Nj,e164:()=>Rj,duration:()=>Mj,domain:()=>Wk0,datetime:()=>hj,date:()=>_j,cuid2:()=>qj,cuid:()=>Zj,cidrv6:()=>jj,cidrv4:()=>Tj,browserEmail:()=>Kk0,boolean:()=>kj,bigint:()=>gj,base64url:()=>zV,base64:()=>Ej});function Dj(){return new RegExp(Gk0,"u")}function ao($){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 vj($){return new RegExp(`^${ao($)}$`)}function hj($){let Y=ao({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(`^${so}T(?:${U})$`)}function UG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function IG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Zj,qj,Vj,Lj,Fj,wj,Mj,$k0,Oj,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})$`)},Yk0,zk0,Uk0,Nj,Ik0,Qk0,ro,Jk0,Kk0,Gk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Aj,Pj,Bj=($)=>{letY=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Tj,jj,Ej,zV,Hk0,Wk0,Cj,Rj,so="(?:(?:\\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])))",_j,Sj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},gj,yj,zG,kj,xj,fj,uj,bj,Xk0,Zk0,qk0,Vk0,Lk0,Fk0,wk0,Mk0,Ok0,Nk0,Dk0,Ak0,Pk0,Bk0,Tk0,jk0;varUV=o(()=>{$1();Zj=/^[cC][0-9a-z]{6,}$/,qj=/^[0-9a-z]+$/,Vj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lj=/^[0-9a-vA-V]{20}$/,Fj=/^[A-Za-z0-9]{27}$/,wj=/^[a-zA-Z0-9_-]{21}$/,Mj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((Q)=>Q),U=Math.min(...z.map((Q)=>Q.length-Q.trimStart().length)),I=z.map((Q)=>Q.slice(U)).map((Q)=>" ".repeat(this.indent*2)+Q);for(let Q of I)this.content.push(Q)}compile(){let $=Function,Y=this?.args,U=[...(this?.content??[""]).map((I)=>`${I}`)];return new $(...Y,U.join(`
`))}}var QE;var JE=o(()=>{QE={major:4,minor:4,patch:3}});function CE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Lr($){if(!zV.test($))return!1;let Y=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),z=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return CE(z)}function Fr($,Y=null){try{let z=$.split(".");if(z.length!==3)return!1;let[U]=z;if(!U)return!1;let I=JSON.parse(atob(U));if("typ"in I&&I?.typ!=="JWT")return!1;if(!I.alg)return!1;if(Y&&(!("alg"in I)||I.alg!==Y))return!1;return!0}catch{return!1}}function Yr($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function XV($,Y,z,U,I,Q){let J=z in U;if($.issues.length){if(I&&Q&&!J)return;Y.issues.push(...f8(z,$.issues))}if(!J&&!I){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[z]});return}if($.value===void 0){if(J)Y.value[z]=void 0}else Y.value[z]=$.value}function wr($){let Y=Object.keys($.shape);for(let U of Y)if(!$.shape?.[U]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${U}":expectedaZodschema`);let z=zj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(z)}}function Mr($,Y,z,U,I,Q){let J=[],K=I.keySet,G=I.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"){J.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},U);if(q instanceof Promise)$.push(q.then((V)=>XV(V,z,Z,Y,W,X)));else XV(q,z,Z,Y,W,X)}if(J.length)z.issues.push({code:"unrecognized_keys",keys:J,input:Y,inst:Q});if(!$.length)return z;return Promise.all($).then(()=>{return z})}function zr($,Y,z,U){for(let Q of $)if(Q.issues.length===0)return Y.value=Q.value,Y;let I=$.filter((Q)=>!K7(Q));if(I.length===1)return Y.value=I[0].value,I[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:$.map((Q)=>Q.issues.map((J)=>A8(J,U,a4())))}),Y}function Ur($,Y,z,U){let I=$.filter((Q)=>Q.issues.length===0);if(I.length===1)return Y.value=I[0].value,Y;if(I.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:$.map((Q)=>Q.issues.map((J)=>A8(J,U,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:[],inclusive:!1});return Y}function KE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(J7($)&&J7(Y)){let z=Object.keys(Y),U=Object.keys($).filter((Q)=>z.indexOf(Q)!==-1),I={...$,...Y};for(let Q of U){let J=KE($[Q],Y[Q]);if(!J.valid)return{valid:!1,mergeErrorPath:[Q,...J.mergeErrorPath]};I[Q]=J.data}return{valid:!0,data:I}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let z=[];for(let U=0;U<$.length;U++){let I=$[U],Q=Y[U],J=KE(I,Q);if(!J.valid)return{valid:!1,mergeErrorPath:[U,...J.mergeErrorPath]};z.push(J.data)}return{valid:!0,data:z}}return{valid:!1,mergeErrorPath:[]}}function Ir($,Y,z){let U=new Map,I;for(let K of Y.issues)if(K.code==="unrecognized_keys"){I??(I=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 Q=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(Q.length&&I)$.issues.push({...I,keys:Q});if(K7($))return $;let J=KE(Y.value,z.value);if(!J.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}function Qr($,Y){for(let z=$.length-1;z>=0;z--)if($[z]._zod[Y]!=="optional")return z+1;return 0}function Jr($,Y,z){if($.issues.length)Y.issues.push(...f8(z,$.issues));Y.value[z]=$.value}function Kr($,Y,z,U,I){for(let Q=0;Q<z.length;Q++){let J=$[Q],K=Q<U.length;if(J.issues.length){if(!K&&Q>=I){Y.value.length=Q;break}Y.issues.push(...f8(Q,J.issues))}Y.value[Q]=J.value}for(let Q=Y.value.length-1;Q>=U.length;Q--)if(z[Q]._zod.optout==="optional"&&Y.value[Q]===void 0)Y.value.length=Q;else break;return Y}function Gr($,Y,z,U,I,Q,J){if($.issues.length)if(sK.has(typeof U))z.issues.push(...f8(U,$.issues));else z.issues.push({code:"invalid_key",origin:"map",input:I,inst:Q,issues:$.issues.map((K)=>A8(K,J,a4()))});if(Y.issues.length)if(sK.has(typeof U))z.issues.push(...f8(U,Y.issues));else z.issues.push({origin:"map",code:"invalid_element",input:I,inst:Q,key:U,issues:Y.issues.map((K)=>A8(K,J,a4()))});z.value.set($.value,Y.value)}function Hr($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Wr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Xr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Zr($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function GV($,Y,z){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
if(${N}.issues.length){
import{createRequireasWy0}from"node:module";varUy0=Object.create;var{getPrototypeOf:Yy0,defineProperty:mT,getOwnPropertyNames:zy0}=Object;varQy0=Object.prototype.hasOwnProperty;functionJy0($){returnthis[$]}varIy0,Ky0,J6=($,U,Y)=>{varz=$!=null&&typeof$==="object";if(z){varQ=U?Iy0??=newWeakMap:Ky0??=newWeakMap,J=Q.get($);if(J)returnJ}Y=$!=null?Uy0(Yy0($)):{};letI=U||!$||!$.__esModule?mT(Y,"default",{value:$,enumerable:!0}):Y;for(letKofzy0($))if(!Qy0.call(I,K))mT(I,K,{get:Jy0.bind($,K),enumerable:!0});if(z)Q.set($,I);returnI};varE=($,U)=>()=>(U||$((U={exports:{}}).exports,U),U.exports);varGy0=($)=>$;functionHy0($,U){this[$]=Gy0.bind(null,U)}varx8=($,U)=>{for(varYinU)mT($,Y,{get:U[Y],enumerable:!0,configurable:!0,set:Hy0.bind(U,Y)})};varo=($,U)=>()=>($&&(U=$($=0)),U);varI0=Wy0(import.meta.url);varXy0,cq,Zy0,qy0,Vy0,Ly0,R0=($,U)=>()=>(U||$((U={exports:{}}).exports,U),U.exports),xo=($,U)=>{letY={};for(varzin$)cq(Y,z,{get:$[z],enumerable:!0});if(U)cq(Y,Symbol.toStringTag,{value:"Module"});returnY},Fy0=($,U,Y,z)=>{if(U&&typeofU==="object"||typeofU==="function"){for(varQ=qy0(U),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Ly0.call($,K)&&K!==Y)cq($,K,{get:((G)=>U[G]).bind(null,K),enumerable:!(z=Zy0(U,K))||z.enumerable})}return$},nq=($,U,Y)=>(Y=$!=null?Xy0(Vy0($)):{},Fy0(U||!$||!$.__esModule?cq(Y,"default",{value:$,enumerable:!0}):Y,$));varlT=o(()=>{Xy0=Object.create,cq=Object.defineProperty,Zy0=Object.getOwnPropertyDescriptor,qy0=Object.getOwnPropertyNames,Vy0=Object.getPrototypeOf,Ly0=Object.prototype.hasOwnProperty});functionuo($){returntypeof$==="string"&&fo.has($.replace(/#$/,""))}functionbo($,U){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letY=$.$schema.replace(/#$/,"");if(wy0.has(Y))return"2020-12";if(fo.has(Y))return"2019-09";if(Oy0.has(Y)||My0.has(Y))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; ${U}`)}varwy0,fo,Oy0,My0;varoT=o(()=>{wy0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),fo=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Oy0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),My0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionH0($,U,Y){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($),U(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=Y?.Parent??Object;classJextendsQ{}Object.defineProperty(J,"name",{value:$});functionI(K){varG;letH=Y?.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(Y?.Parent&&KinstanceofY.Parent)return!0;returnK?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}functiona4($){if($)Object.assign(AU,$);returnAU}vario,mK,rT,f5,PU,AU;varBU=o(()=>{mK=Object.freeze({status:"aborted"});rT=Symbol("zod_brand");f5=classf5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};PU=classPUextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(io=globalThis).__zod_globalConfig??(io.__zod_globalConfig={});AU=globalThis.__zod_globalConfig});vary0={};x8(y0,{unwrapMessage:()=>lK,uint8ArrayToHex:()=>py0,uint8ArrayToBase64url:()=>cy0,uint8ArrayToBase64:()=>po,stringifyPrimitive:()=>v0,slugify:()=>tT,shallowClone:()=>$j,safeExtend:()=>ky0,required:()=>uy0,randomString:()=>Ry0,propertyKeyTypes:()=>sK,promiseAllObject:()=>Cy0,primitiveTypes:()=>Uj,prefixIssues:()=>f8,pick:()=>Sy0,partial:()=>fy0,parsedType:()=>S0,optionalKeys:()=>Yj,omit:()=>gy0,objectClone:()=>Ty0,numKeys:()=>_y0,nullish:()=>Q7,normalizeParams:()=>x0,mergeDefs:()=>i9,merge:()=>xy0,jsonStringifyReplacer:()=>uz,joinValues:()=>N0,issue:()=>iz,isPlainObject:()=>I7,isObject:()=>TU,hexToUint8Array:()=>ny0,getSizableOrigin:()=>aK,getParsedType:()=>vy0,getLengthableOrigin:()=>tK,getEnumValues:()=>oK,getElementAtPath:()=>Ey0,floatSafeRemainder:()=>aT,finalizeIssue:()=>A8,extend:()=>yy0,explicitlyAborted:()=>Jj,escapeRegex:()=>N$,esc:()=>pq,defineLazy:()=>T1,createTransparentProxy:()=>hy0,cloneDef:()=>jy0,clone:()=>D8,cleanRegex:()=>rK,cleanEnum:()=>by0,captureStackTrace:()=>dq,cached:()=>bz,base64urlToUint8Array:()=>iy0,base64ToUint8Array:()=>no,assignProp:()=>J7,assertNotEqual:()=>Dy0,assertNever:()=>Py0,assertIs:()=>Ay0,assertEqual:()=>Ny0,assert:()=>By0,allowsEval:()=>eT,aborted:()=>K7,NUMBER_FORMAT_RANGES:()=>zj,Class:()=>moLine truncated
`)}var lo=($,U)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:U,enumerable:!1}),$.message=JSON.stringify(U,uz,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},eK,u8;var Gj=o(()=>{BU();$1();eK=H0("$ZodError",lo),u8=H0("$ZodError",lo,{Parent:Error})});var cz=($)=>(U,Y,z,Q)=>{let J=z?{...z,async:!1}:{async:!1},I=U._zod.run({value:Y,issues:[]},J);if(I instanceof Promise)throw new f5;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,nz=($)=>async(U,Y,z,Q)=>{let J=z?{...z,async:!0}:{async:!0},I=U._zod.run({value:Y,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,pz=($)=>(U,Y,z)=>{let Q=z?{...z,async:!1}:{async:!1},J=U._zod.run({value:Y,issues:[]},Q);if(J instanceof Promise)throw new f5;return J.issues.length?{success:!1,error:new($??eK)(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Hj,dz=($)=>async(U,Y,z)=>{let Q=z?{...z,async:!0}:{async:!0},J=U._zod.run({value:Y,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}},Wj,oq=($)=>(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return cz($)(U,Y,Q)},my0,rq=($)=>(U,Y,z)=>{return cz($)(U,Y,z)},ly0,sq=($)=>async(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return nz($)(U,Y,Q)},oy0,aq=($)=>async(U,Y,z)=>{return nz($)(U,Y,z)},ry0,tq=($)=>(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return pz($)(U,Y,Q)},sy0,eq=($)=>(U,Y,z)=>{return pz($)(U,Y,z)},ay0,$V=($)=>async(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return dz($)(U,Y,Q)},ty0,UV=($)=>async(U,Y,z)=>{return dz($)(U,Y,z)},ey0;var Xj=o(()=>{BU();Gj();$1();mq=cz(u8),lq=nz(u8),Hj=pz(u8),Wj=dz(u8),my0=oq(u8),ly0=rq(u8),oy0=sq(u8),ry0=aq(u8),sy0=tq(u8),ay0=eq(u8),ty0=$V(u8),ey0=UV(u8)});var U$={};x8(U$,{xid:()=>Lj,uuid7:()=>zk0,uuid6:()=>Yk0,uuid4:()=>Uk0,uuid:()=>jU,uppercase:()=>bj,unicodeEmail:()=>ro,undefined:()=>fj,ulid:()=>Vj,time:()=>vj,string:()=>Sj,sha512_hex:()=>Bk0,sha512_base64url:()=>jk0,sha512_base64:()=>Tk0,sha384_hex:()=>Dk0,sha384_base64url:()=>Pk0,sha384_base64:()=>Ak0,sha256_hex:()=>Ok0,sha256_base64url:()=>Nk0,sha256_base64:()=>Mk0,sha1_hex:()=>Lk0,sha1_base64url:()=>wk0,sha1_base64:()=>Fk0,rfc5322Email:()=>Jk0,number:()=>YG,null:()=>xj,nanoid:()=>wj,md5_hex:()=>Zk0,md5_base64url:()=>Vk0,md5_base64:()=>qk0,mac:()=>Bj,lowercase:()=>uj,ksuid:()=>Fj,ipv6:()=>Pj,ipv4:()=>Aj,integer:()=>yj,idnEmail:()=>Ik0,httpProtocol:()=>Cj,html5Email:()=>Qk0,hostname:()=>Hk0,hex:()=>Xk0,guid:()=>Mj,extendedDuration:()=>$k0,emoji:()=>Dj,email:()=>Nj,e164:()=>Rj,duration:()=>Oj,domain:()=>Wk0,datetime:()=>hj,date:()=>_j,cuid2:()=>qj,cuid:()=>Zj,cidrv6:()=>jj,cidrv4:()=>Tj,browserEmail:()=>Kk0,boolean:()=>kj,bigint:()=>gj,base64url:()=>YV,base64:()=>Ej});function Dj(){return new RegExp(Gk0,"u")}function ao($){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 vj($){return new RegExp(`^${ao($)}$`)}function hj($){let U=ao({precision:$.precision}),Y=["Z"];if($.local)Y.push("");if($.offset)Y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let z=`${U}(?:${Y.join("|")})`;return new RegExp(`^${so}T(?:${z})$`)}function zG($,U){return new RegExp(`^[A-Za-z0-9+/]{${$}}${U}$`)}function QG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Zj,qj,Vj,Lj,Fj,wj,Oj,$k0,Mj,jU=($)=>{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})$`)},Uk0,Yk0,zk0,Nj,Qk0,Jk0,ro,Ik0,Kk0,Gk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Aj,Pj,Bj=($)=>{letU=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${U}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${U}){5}[0-9a-f]{2}$`)},Tj,jj,Ej,YV,Hk0,Wk0,Cj,Rj,so="(?:(?:\\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])))",_j,Sj=($)=>{letU=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${U}$`)},gj,yj,YG,kj,xj,fj,uj,bj,Xk0,Zk0,qk0,Vk0,Lk0,Fk0,wk0,Ok0,Mk0,Nk0,Dk0,Ak0,Pk0,Bk0,Tk0,jk0;varzV=o(()=>{$1();Zj=/^[cC][0-9a-z]{6,}$/,qj=/^[0-9a-z]+$/,Vj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lj=/^[0-9a-vA-V]{20}$/,Fj=/^[A-Za-z0-9]{27}$/,wj=/^[a-zA-Z0-9_-]{21}$/,Oj=/^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(...Y.map((J)=>J.length-J.trimStart().length)),Q=Y.map((J)=>J.slice(z)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,U=this?.args,z=[...(this?.content??[""]).map((Q)=>`${Q}`)];return new $(...U,z.join(`
`))}}var JE;var IE=o(()=>{JE={major:4,minor:4,patch:3}});function CE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Lr($){if(!YV.test($))return!1;let U=$.replace(/[-_]/g,(z)=>z==="-"?"+":"/"),Y=U.padEnd(Math.ceil(U.length/4)*4,"=");return CE(Y)}function Fr($,U=null){try{let Y=$.split(".");if(Y.length!==3)return!1;let[z]=Y;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(U&&(!("alg"in Q)||Q.alg!==U))return!1;return!0}catch{return!1}}function Ur($,U,Y){if($.issues.length)U.issues.push(...f8(Y,$.issues));U.value[Y]=$.value}function XV($,U,Y,z,Q,J){let I=Y in z;if($.issues.length){if(Q&&J&&!I)return;U.issues.push(...f8(Y,$.issues))}if(!I&&!Q){if(!$.issues.length)U.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Y]});return}if($.value===void 0){if(I)U.value[Y]=void 0}else U.value[Y]=$.value}function wr($){let U=Object.keys($.shape);for(let z of U)if(!$.shape?.[z]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${z}":expectedaZodschema`);let Y=Yj($.shape);return{...$,keys:U,keySet:new Set(U),numKeys:U.length,optionalKeys:new Set(Y)}}function Or($,U,Y,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 U){if(Z==="__proto__")continue;if(K.has(Z))continue;if(H==="never"){I.push(Z);continue}let q=G.run({value:U[Z],issues:[]},z);if(q instanceof Promise)$.push(q.then((V)=>XV(V,Y,Z,U,W,X)));else XV(q,Y,Z,U,W,X)}if(I.length)Y.issues.push({code:"unrecognized_keys",keys:I,input:U,inst:J});if(!$.length)return Y;return Promise.all($).then(()=>{return Y})}function Yr($,U,Y,z){for(let J of $)if(J.issues.length===0)return U.value=J.value,U;let Q=$.filter((J)=>!K7(J));if(Q.length===1)return U.value=Q[0].value,Q[0];return U.issues.push({code:"invalid_union",input:U.value,inst:Y,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))}),U}function zr($,U,Y,z){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return U.value=Q[0].value,U;if(Q.length===0)U.issues.push({code:"invalid_union",input:U.value,inst:Y,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))});else U.issues.push({code:"invalid_union",input:U.value,inst:Y,errors:[],inclusive:!1});return U}function KE($,U){if($===U)return{valid:!0,data:$};if($ instanceof Date&&U instanceof Date&&+$===+U)return{valid:!0,data:$};if(I7($)&&I7(U)){let Y=Object.keys(U),z=Object.keys($).filter((J)=>Y.indexOf(J)!==-1),Q={...$,...U};for(let J of z){let I=KE($[J],U[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(U)){if($.length!==U.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let z=0;z<$.length;z++){let Q=$[z],J=U[z],I=KE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[z,...I.mergeErrorPath]};Y.push(I.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function Qr($,U,Y){let z=new Map,Q;for(let K of U.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 Y.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(K7($))return $;let I=KE(U.value,Y.value);if(!I.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function Jr($,U){for(let Y=$.length-1;Y>=0;Y--)if($[Y]._zod[U]!=="optional")return Y+1;return 0}function Ir($,U,Y){if($.issues.length)U.issues.push(...f8(Y,$.issues));U.value[Y]=$.value}function Kr($,U,Y,z,Q){for(let J=0;J<Y.length;J++){let I=$[J],K=J<z.length;if(I.issues.length){if(!K&&J>=Q){U.value.length=J;break}U.issues.push(...f8(J,I.issues))}U.value[J]=I.value}for(let J=U.value.length-1;J>=z.length;J--)if(Y[J]._zod.optout==="optional"&&U.value[J]===void 0)U.value.length=J;else break;return U}function Gr($,U,Y,z,Q,J,I){if($.issues.length)if(sK.has(typeof z))Y.issues.push(...f8(z,$.issues));else Y.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>A8(K,I,a4()))});if(U.issues.length)if(sK.has(typeof z))Y.issues.push(...f8(z,U.issues));else Y.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:z,issues:U.issues.map((K)=>A8(K,I,a4()))});Y.value.set($.value,U.value)}function Hr($,U){if($.issues.length)U.issues.push(...$.issues);U.value.add($.value)}function Wr($,U){if(U===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Xr($,U){if($.value===void 0)$.value=U.defaultValue;return $}function Zr($,U){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:U});return $}function GV($,U,Y){if($.issues.length)return $.aborted=!0,$;return U._zod.run({value:$.value,issues:$.issues,fa
Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let O=q.compile();return(D,N)=>O(Z,D,N)},Q,J=TY,K=!AY.jitless,H=K&&eT.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=U.value);let V=Z.value;if(!J(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!Q)Q=I(Y.shape);if(Z=Q(Z,q),!W)return Z;return Mr([],V,Z,q,X,$)}return z(Z,q)}});JG=H0("$ZodUnion",($,Y)=>{q1.init($,Y),T1($._zod,"optin",()=>Y.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),T1($._zod,"optout",()=>Y.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),T1($._zod,"values",()=>{if(Y.options.every((U)=>U._zod.values))return new Set(Y.options.flatMap((U)=>Array.from(U._zod.values)));return}),T1($._zod,"pattern",()=>{if(Y.options.every((U)=>U._zod.pattern)){let U=Y.options.map((I)=>I._zod.pattern);return new RegExp(`^(${U.map((I)=>rK(I.source)).join("|")})$`)}return});let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,I)=>{if(z)return z(U,I);let Q=!1,J=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},I);if(G instanceof Promise)J.push(G),Q=!0;else{if(G.issues.length===0)return G;J.push(G)}}if(!Q)return zr(J,U,$,I);return Promise.all(J).then((K)=>{return zr(K,U,$,I)})}});mE=H0("$ZodXor",($,Y)=>{JG.init($,Y),Y.inclusive=!1;let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,I)=>{if(z)return z(U,I);let Q=!1,J=[];for(let K of Y.options){let G=K._zod.run({value:U.value,issues:[]},I);if(G instanceof Promise)J.push(G),Q=!0;else J.push(G)}if(!Q)return Ur(J,U,$,I);return Promise.all(J).then((K)=>{return Ur(K,U,$,I)})}}),lE=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,JG.init($,Y);let z=$._zod.parse;T1($._zod,"propValues",()=>{let I={};for(let Q of Y.options){let J=Q._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(Q)}"`);for(let[K,G]of Object.entries(J)){if(!I[K])I[K]=new Set;for(let H of G)I[K].add(H)}}return I});let U=bU(()=>{let I=Y.options,Q=new Map;for(let J of I){let K=J._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(J)}"`);for(let G of K){if(Q.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);Q.set(G,J)}}return Q});$._zod.parse=(I,Q)=>{let J=I.value;if(!TY(J))return I.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),I;let K=U.value.get(J?.[Y.discriminator]);if(K)return K._zod.run(I,Q);if(Y.unionFallback||Q.direction==="backward")return z(I,Q);return I.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(U.value.keys()),input:J,path:[Y.discriminator],inst:$}),I}}),oE=H0("$ZodIntersection",($,Y)=>{q1.init($,Y),$._zod.parse=(z,U)=>{let I=z.value,Q=Y.left._zod.run({value:I,issues:[]},U),J=Y.right._zod.run({value:I,issues:[]},U);if(Q instanceof Promise||J instanceof Promise)return Promise.all([Q,J]).then(([G,H])=>{return Ir(z,G,H)});return Ir(z,Q,J)}});VV=H0("$ZodTuple",($,Y)=>{q1.init($,Y);let z=Y.items;$._zod.parse=(U,I)=>{let Q=U.value;if(!Array.isArray(Q))return U.issues.push({input:Q,inst:$,expected:"tuple",code:"invalid_type"}),U;U.value=[];let J=[],K=Qr(z,"optin"),G=Qr(z,"optout");if(!Y.rest){if(Q.length<K)return U.issues.push({code:"too_small",minimum:K,inclusive:!0,input:Q,inst:$,origin:"array"}),U;if(Q.length>z.length)U.issues.push({code:"too_big",maximum:z.length,inclusive:!0,input:Q,inst:$,origin:"array"})}let H=Array(z.length);for(let W=0;W<z.length;W++){let X=z[W]._zod.run({value:Q[W],issues:[]},I);if(X instanceof Promise)J.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=z.length-1,X=Q.slice(z.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},I);if(q instanceof Promise)J.push(q.then((V)=>Jr(V,U,W)));else Jr(q,U,W)}}if(J.length)return Promise.all(J).then(()=>Kr(H,U,z,Q,G));return Kr(H,U,z,Q,G)}});rE=H0("$ZodRecord",($,Y)=>{q1.init($,Y),$._zod.parse=(z,U)=>{let I=z.value;if(!J7(I))return z.issues.push({expected:"record",code:"invalid_type",input:I,inst:$}),z;let Q=[],J=Y.keyType._zod.values;if(J){z.value={};let K=new Set;for(let H of J)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:[]},U);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){z.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>A8(q,U,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:I[H],issues:[]},U);if(Z instanceof Promise)Q.push(Z.then((q)=>{if(q.issues.length)z.issues.push(...f8(H,q.issues));z.value[X]=q.value}));else{if(Z.issues.length)z.issues.push(...f8(H,Z.issues));z.value[X]=Z.value}}let G;for(let H in I)if(!K.has(H))G=G??[],G.push(H);if(G&&G.length>0)z.issues.push({code:"unrec
Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let M=q.compile();return(N,D)=>M(Z,N,D)},J,I=TU,K=!AU.jitless,H=K&&eT.value,W=U.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(U.shape);if(Z=J(Z,q),!W)return Z;return Or([],V,Z,q,X,$)}return Y(Z,q)}});IG=H0("$ZodUnion",($,U)=>{q1.init($,U),T1($._zod,"optin",()=>U.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),T1($._zod,"optout",()=>U.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),T1($._zod,"values",()=>{if(U.options.every((z)=>z._zod.values))return new Set(U.options.flatMap((z)=>Array.from(z._zod.values)));return}),T1($._zod,"pattern",()=>{if(U.options.every((z)=>z._zod.pattern)){let z=U.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${z.map((Q)=>rK(Q.source)).join("|")})$`)}return});let Y=U.options.length===1?U.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(Y)return Y(z,Q);let J=!1,I=[];for(let K of U.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 Yr(I,z,$,Q);return Promise.all(I).then((K)=>{return Yr(K,z,$,Q)})}});mE=H0("$ZodXor",($,U)=>{IG.init($,U),U.inclusive=!1;let Y=U.options.length===1?U.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(Y)return Y(z,Q);let J=!1,I=[];for(let K of U.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 zr(I,z,$,Q);return Promise.all(I).then((K)=>{return zr(K,z,$,Q)})}}),lE=H0("$ZodDiscriminatedUnion",($,U)=>{U.inclusive=!1,IG.init($,U);let Y=$._zod.parse;T1($._zod,"propValues",()=>{let Q={};for(let J of U.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${U.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=bz(()=>{let Q=U.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[U.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${U.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(!TU(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=z.value.get(I?.[U.discriminator]);if(K)return K._zod.run(Q,J);if(U.unionFallback||J.direction==="backward")return Y(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:U.discriminator,options:Array.from(z.value.keys()),input:I,path:[U.discriminator],inst:$}),Q}}),oE=H0("$ZodIntersection",($,U)=>{q1.init($,U),$._zod.parse=(Y,z)=>{let Q=Y.value,J=U.left._zod.run({value:Q,issues:[]},z),I=U.right._zod.run({value:Q,issues:[]},z);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,H])=>{return Qr(Y,G,H)});return Qr(Y,J,I)}});VV=H0("$ZodTuple",($,U)=>{q1.init($,U);let Y=U.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=Jr(Y,"optin"),G=Jr(Y,"optout");if(!U.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>Y.length)z.issues.push({code:"too_big",maximum:Y.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(Y.length);for(let W=0;W<Y.length;W++){let X=Y[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(U.rest){let W=Y.length-1,X=J.slice(Y.length);for(let Z of X){W++;let q=U.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)I.push(q.then((V)=>Ir(V,z,W)));else Ir(q,z,W)}}if(I.length)return Promise.all(I).then(()=>Kr(H,z,Y,J,G));return Kr(H,z,Y,J,G)}});rE=H0("$ZodRecord",($,U)=>{q1.init($,U),$._zod.parse=(Y,z)=>{let Q=Y.value;if(!I7(Q))return Y.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),Y;let J=[],I=U.keyType._zod.values;if(I){Y.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=U.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){Y.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=U.valueType._zod.run({value:Q[H],issues:[]},z);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)Y.issues.push(...f8(H,q.issues));Y.value[X]=q.value}));else{if(Z.issues.length)Y.issues.push(...f8(H,Z.issues));Y.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)Y.issues.push({code:"unrec
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letJof$.seen.entries()){letK=J[1];if(Y===J[0]){Q(J);continue}if($.external){letH=$.external.registry.get(J[0])?.id;if(Y!==J[0]&&H){Q(J);continue}}if($.metadataRegistry.get(J[0])?.id){Q(J);continue}if(K.cycle){Q(J);continue}if(K.count>1){if($.reused==="ref"){Q(J);continue}}}}functionZ7($,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;letH=G.def??G.schema,W={...H},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"))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){U(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())U(K[0]);letI={};if($.target==="draft-2020-12")I.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")I.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")I.$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");I.$id=$.external.uri(K)}Object.assign(I,z.def??z.schema);letQ=$.metadataRegistry.get(Y)?.id;if(Q!==void0&&I.id===Q)deleteI.id;letJ=$.external?.defs??{};for(letKof$.seen.entries()){letG=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;J[G.defId]=G.def}}if($.external);elseif(Object.keys(J).length>0)if($.target==="draft-2020-12")I.$defs=J;elseI.definitions=J;try{letK=JSON.parse(JSON.stringify(I));returnObject.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:KI(Y,"input",$.processors),output:KI(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionB8($,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")returnB8(U.element,z);if(U.type==="set")returnB8(U.valueType,z);if(U.type==="lazy")returnB8(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")returnB8(U.innerType,z);if(U.type==="intersection")returnB8(U.left,z)||B8(U.right,z);if(U.type==="record"||U.type==="map")returnB8(U.keyType,z)||B8(U.valueType,z);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnB8(U.in,z)||B8(U.out,z)}if(U.type==="object"){for(letIinU.shape)if(B8(U.shape[I],z))return!0;return!1}if(U.type==="union"){for(letIofU.options)if(B8(I,z))return!0;return!1}if(U.type==="tuple"){for(letIofU.items)if(B8(I,z))return!0;if(U.rest&&B8(U.rest,z))return!0;return!1}return!1}varQ_=($,Y={})=>(z)=>{letU=W7({...z,processors:Y});returnJ4($,U),X7(U,$),Z7(U,$)},KI=($,Y,z={})=>(U)=>{let{libraryOptions:I,target:Q}=U??{},J=W7({...I??{},target:Q,io:Y,processors:z});returnJ4($,J),X7(J,$),Z7(J,$)};varFG=o(()=>{qG()});functionvY($,Y){if("_idmap"in$){letU=$,I=W7({...Y,processors:nV}),Q={};for(letGofU._idmap.entries()){let[H,W]=G;J4(W,I)}letJ={},K={registry:U,uri:Y?.uri,defs:Q};I.external=K;for(letGofU._idmap.entries()){let[H,W]=G;X7(I,W),J[H]=Z7(I,W)}if(Object.keys(Q).length>0){letG=I.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[G]:Q}}return{schemas:J}}letz=W7({...Y,processors:nV});returnJ4($,z),X7(z,$),Z7(z,$)}varox0,J_=($,Y,z,U)=>{letI=z;I.type="string";let{minimum:Q,maximum:J,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofQ==="number")I.minLength=Q;if(typeofJ==="number")I.maxLength=J;if(K){if(I.format=ox0[K]??K,I.format==="")deleteI.format;if(K==="time")deleteI.format}if(H)I.contentEncoding=H;if(G&&G.size>0){letW=[...G];if(W.length===1)I.pattern=W[0].source;elseif(W.length>1)I.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},K_=($,Y,z,U)=>{letI=z,{minimum:Q,maximum:J,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))I.type="integer";elseI.type="number";letX=typeofW==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),Z=typeofH==="number"&&H<=(J??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)I.minimum=W,I.exclusiveMinimum=!0;elseI.exclusiveMinimuLine truncated
`}function Cu0($){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(!Eu0.test($)){let z=[...$].filter((U)=>!/[A-Za-z0-9._-]/.test(U)).filter((U,I,Q)=>Q.indexOf(U)===I);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 Ru0($,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 zS($){let Y=Cu0($);return Ru0($,Y.warnings),Y.isValid}function _u0($){return typeof $==="object"&&$!==null&&"_zod"in $}function vu0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function hu0($){if(typeof $!=="object"||$===null)return!1;if(_I($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((z)=>_u0(z))}function Rw($){if($===void 0)return;if(hu0($))return z0($);if(typeof $==="object"&&$!==null&&!_I($)&&Object.values($).some((Y)=>vu0(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(!_I($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var _h,Wf0,A1,V1,Xf0,Zt="2026-07-28",T7,Lt,Vf0,Lf0,Ff0,Mt,Ot,Mf0,qw,kf1,xf1,$t,fh,Bf0,Tf0,CI,n0,Q1,Aw,At,hI,Pw,Cf0=0,Rf0="private",_f0,ff0,Lw,ch,Tt,ff1,uf1,pf0,df0,nh,Fw,XH="2026-07-28",Ct,of0,D$=($)=>xG.safeParse($).success,j7=($)=>fG.safeParse($).success,HH=($)=>wI.safeParse($).success,Ew=($)=>MI.safeParse($).success,r9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Qt="x-mcp-header",rf0,sf0,af0,tf0,Ow=-32020,bf1,ef0,Jt=!1,hh="draft-2020-12",zu0,Ku0,Gu0,Kt,Hu0,Lu0,vt=250,Fu0,wu0,yt,kt,Mu0,Ou0,ft=60000,Du0,Au0,Pu0,ut,th,ju0,if1,bt=10485760,$S=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??bt}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 it(Y)}catch(z){if(z instanceof SyntaxError)continue;throw z}}return null}clear(){this._buffer=void 0}},Eu0;var _w=o(()=>{lT();oT();aa();rv();_h=Symbol.for("mcp.sdk.errorBrands");Wf0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return RI(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 RI(this,Y)}constructor(Y,z,U){super(z);this.code=Y,this.errorUri=U,this.name="OAuthError",gh(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 RI(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 RI(this,$)}constructor($,Y,z){super(Y);this.code=$,this.data=z,this.name="SdkError",gh(this,new.target)}},Xf0=class extends V1{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}};T7=[Zt];Lt=["task","inputRequests","requestState"];Lf0=new Set(["const","enum","default","examples"]),Ff0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Mt={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},Ot={"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},Mf0={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};kf1=Object.keys(Mt),xf1=Object.keys(Ot);$t={ok:!1,reason:"not-in-era"};fh={era:"2025-11-25",hasRequestMethod:Nt,hasNotificationMethod:Dt,validateRequest:($,Y)=>Vw(Df0($),Y),validateResult:($,Y)=>Vw(Nf0($),Y),validateNotification:($,Y)=>Vw(Af0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>$t,validateInputResponse:()=>$t,samplingResultVariant:($,Y)=>{let z=Ft();return Vw($?z.CreateMessageResultWithToolsSchema:z.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let z=Vt($),U=z.structuredContent;if(U===void 0)return z;let I=typeof U!=="object"||U===null||Array.isArray(U),Q=Y!==void 0&&wt(Y);if(!I&&!Q)return z;return{...z,structuredContent:{result:U}}},decodeResult($,Y){if(vh(Y)&&"resultType"in Y){let z={...Y};return delete z.resultType,{kind:"complete",result:zt(z)}}return{kind:"complete",result:zt(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(U===I[0]){J(I);continue}if($.external){letH=$.external.registry.get(I[0])?.id;if(U!==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}}}}functionZ7($,U){letY=$.seen.get(U);if(!Y)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(letOinH){if(O==="$ref"||O==="allOf")continue;if(!(OinW))deleteH[O]}if(V.$ref&&q.def)for(letOinH){if(O==="$ref"||O==="allOf")continue;if(Oinq.def&&JSON.stringify(H[O])===JSON.stringify(q.def[O]))deleteH[O]}}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(U)?.id;if(!K)throwError("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,Y.def??Y.schema);letJ=$.metadataRegistry.get(U)?.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:{...U["~standard"],jsonSchema:{input:KQ(U,"input",$.processors),output:KQ(U,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionB8($,U){letY=U??{seen:newSet};if(Y.seen.has($))return!1;Y.seen.add($);letz=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")returnB8(z.element,Y);if(z.type==="set")returnB8(z.valueType,Y);if(z.type==="lazy")returnB8(z.getter(),Y);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")returnB8(z.innerType,Y);if(z.type==="intersection")returnB8(z.left,Y)||B8(z.right,Y);if(z.type==="record"||z.type==="map")returnB8(z.keyType,Y)||B8(z.valueType,Y);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnB8(z.in,Y)||B8(z.out,Y)}if(z.type==="object"){for(letQinz.shape)if(B8(z.shape[Q],Y))return!0;return!1}if(z.type==="union"){for(letQofz.options)if(B8(Q,Y))return!0;return!1}if(z.type==="tuple"){for(letQofz.items)if(B8(Q,Y))return!0;if(z.rest&&B8(z.rest,Y))return!0;return!1}return!1}varJ_=($,U={})=>(Y)=>{letz=W7({...Y,processors:U});returnI4($,z),X7(z,$),Z7(z,$)},KQ=($,U,Y={})=>(z)=>{let{libraryOptions:Q,target:J}=z??{},I=W7({...Q??{},target:J,io:U,processors:Y});returnI4($,I),X7(I,$),Z7(I,$)};varFG=o(()=>{qG()});functionvU($,U){if("_idmap"in$){letz=$,Q=W7({...U,processors:nV}),J={};for(letGofz._idmap.entries()){let[H,W]=G;I4(W,Q)}letI={},K={registry:z,uri:U?.uri,defs:J};Q.external=K;for(letGofz._idmap.entries()){let[H,W]=G;X7(Q,W),I[H]=Z7(Q,W)}if(Object.keys(J).length>0){letG=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}letY=W7({...U,processors:nV});returnI4($,Y),X7(Y,$),Z7(Y,$)}varox0,I_=($,U,Y,z)=>{letQ=Y;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=ox0[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)=>({...U.target==="draft-07"||U.target==="draft-04"||U.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},K_=($,U,Y,z)=>{letQ=Y,{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=U.target==="draft-04"||U.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;elseQ.exclusiveMinimuLine truncated
`}function Cu0($){let U=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(current:${$.length})`]};if($.includes(" "))U.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))U.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))U.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))U.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!Eu0.test($)){let Y=[...$].filter((z)=>!/[A-Za-z0-9._-]/.test(z)).filter((z,Q,J)=>J.indexOf(z)===Q);return U.push(`Toolnamecontainsinvalidcharacters:${Y.map((z)=>`"${z}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:U}}return{isValid:!0,warnings:U}}function Ru0($,U){if(U.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let Y of U)console.warn(`-${Y}`);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 YS($){let U=Cu0($);return Ru0($,U.warnings),U.isValid}function _u0($){return typeof $==="object"&&$!==null&&"_zod"in $}function vu0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function hu0($){if(typeof $!=="object"||$===null)return!1;if(_Q($))return!1;let U=Object.getPrototypeOf($);if(U!==Object.prototype&&U!==null)return!1;return Object.values($).every((Y)=>_u0(Y))}function Rw($){if($===void 0)return;if(hu0($))return Y0($);if(typeof $==="object"&&$!==null&&!_Q($)&&Object.values($).some((U)=>vu0(U)))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(!_Q($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var _h,Wf0,A1,V1,Xf0,Zt="2026-07-28",T7,Lt,Vf0,Lf0,Ff0,Ot,Mt,Of0,qw,xf1,ff1,$t,fh,Bf0,Tf0,CQ,n0,J1,Aw,At,hQ,Pw,Cf0=0,Rf0="private",_f0,ff0,Lw,ch,Tt,uf1,bf1,pf0,df0,nh,Fw,XH="2026-07-28",Ct,of0,D$=($)=>xG.safeParse($).success,j7=($)=>fG.safeParse($).success,HH=($)=>wQ.safeParse($).success,Ew=($)=>OQ.safeParse($).success,r9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Jt="x-mcp-header",rf0,sf0,af0,tf0,Mw=-32020,if1,ef0,It=!1,hh="draft-2020-12",Yu0,Ku0,Gu0,Kt,Hu0,Lu0,vt=250,Fu0,wu0,yt,kt,Ou0,Mu0,ft=60000,Du0,Au0,Pu0,ut,th,ju0,cf1,bt=10485760,$S=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??bt}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 U=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return it(U)}catch(Y){if(Y instanceof SyntaxError)continue;throw Y}}return null}clear(){this._buffer=void 0}},Eu0;var _w=o(()=>{lT();oT();aa();rv();_h=Symbol.for("mcp.sdk.errorBrands");Wf0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](U){return RQ(this,U)}static isInstance(U){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 RQ(this,U)}constructor(U,Y,z){super(Y);this.code=U,this.errorUri=z,this.name="OAuthError",gh(this,new.target)}toResponseObject(){let U={error:this.code,error_description:this.message};if(this.errorUri)U.error_uri=this.errorUri;return U}static fromResponse(U){return new $(U.error,U.error_description??U.error,U.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 RQ(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 RQ(this,$)}constructor($,U,Y){super(U);this.code=$,this.data=Y,this.name="SdkError",gh(this,new.target)}},Xf0=class extends V1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,U,Y){super($,U,Y);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};T7=[Zt];Lt=["task","inputRequests","requestState"];Lf0=new Set(["const","enum","default","examples"]),Ff0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Ot={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},Mt={"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},Of0={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};xf1=Object.keys(Ot),ff1=Object.keys(Mt);$t={ok:!1,reason:"not-in-era"};fh={era:"2025-11-25",hasRequestMethod:Nt,hasNotificationMethod:Dt,validateRequest:($,U)=>Vw(Df0($),U),validateResult:($,U)=>Vw(Nf0($),U),validateNotification:($,U)=>Vw(Af0($),U),hasInputRequestMethod:()=>!1,validateInputRequest:()=>$t,validateInputResponse:()=>$t,samplingResultVariant:($,U)=>{let Y=Ft();return Vw($?Y.CreateMessageResultWithToolsSchema:Y.CreateMessageResultSchema,U)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,U){let Y=Vt($),z=Y.structuredContent;if(z===void 0)return Y;let Q=typeof z!=="object"||z===null||Array.isArray(z),J=U!==void 0&&wt(U);if(!Q&&!J)return Y;return{...Y,structuredContent:{result:z}}},decodeResult($,U){if(vh(U)&&"resultType"in U){let Y={...U};return delete Y.resultType,{kind:"complete",result:Yt(Y)}}return{kind:"complete",result:Yt(U)}},encodeResult($,U){if($!=="tools/list")return U;l
Line truncated
*content-type
*Copyright(c)2015DouglasChristopherWilson
*MITLicensed
*/ju0=R0(($)=>{var Y=/;*([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,z=/\\([\u000b\u0020-\u00ff])/g,U=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=I;function I(K){if(!K)throw TypeError("argument string is required");var G=typeof K==="object"?Q(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(!U.test(W))throw TypeError("invalid media type");var X=new J(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(z,"$1")}X.parameters[Z]=V}if(H!==G.length)throw TypeError("invalid parameter format")}return X}function Q(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 J(K){this.parameters=Object.create(null),this.type=K}}),if1=nq(ju0(),1);Eu0=/^[A-Za-z0-9._-]{1,128}$/});function US($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ob0(Y),Y}var vw,ct,L1,v1,U5,Sw,Su0,nt,pt,hw,gu0,I5,yu0,ku0,dt,xu0,gw,SI,qH,gI,yw,fu0,mt,uu0,bu0,iu0,IS,cu0,QS,lt,nu0,pu0,du0,mu0,lu0,ou0,ru0,su0,JS,au0,tu0,eu0,ot,rt,st,$b0,Yb0,zb0,KS,Ub0,at,Ib0,Qb0,Jb0,Kb0,Gb0,Hb0,Wb0,Xb0,tt,Zb0,et,$e,Ye,qb0,GS,Vb0,ze,Ue,Ie,Lb0,Fb0,Qe,wb0,Mb0,Ob0,Je,Nb0,Db0,Ke,Ab0,Pb0,Bb0,Tb0,jb0,Eb0,Cb0,Rb0,_b0,vb0,hb0,Sb0,gb0,yb0,kb0,xb0,fb0,ub0,bb0,ib0,cb0,nb0,pb0,Ge,db0,mb0,lb0,ob0,kw=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=US(mb0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=bo($,"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??=US(db0.Ajv2019);return this._ajvDraft7??=US(Ge.Ajv)}getValidator($){let Y=this._engineFor($),z="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(U)=>{return z(U)?{valid:!0,data:U,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(z.errors)}}}},ef1;var He=o(()=>{lT();oT();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 z=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=z;var U=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((O,D)=>`${O}${D}`,"")}get names(){var w;return(w=this._names)!==null&&w!==void 0?w:this._names=this._items.reduce((O,D)=>{if(D instanceof z)O[D.str]=(O[D.str]||0)+1;return O},{})}};$._Code=U,$.nil=new U("");function I(w,...O){let D=[w[0]],N=0;while(N<O.length)K(D,O[N]),D.push(w[++N]);return new U(D)}$._=I;let Q=new U("+");function J(w,...O){let D=[q(w[0])],N=0;while(N<O.length)D.push(Q),K(D,O[N]),D.push(Q,q(w[++N]));return G(D),new U(D)}$.str=J;function K(w,O){if(O instanceof U)w.push(...O._items);else if(O instanceof z)w.push(O);else w.push(X(O))}$.addCodeArg=K;function G(w){let O=1;while(O<w.length-1){if(w[O]===Q){let D=H(w[O-1],w[O+1]);if(D!==void 0){w.splice(O-1,3,D);continue}w[O++]="+"}O++}}function H(w,O){if(O==='""')return w;if(w==='""')return O;if(typeof w=="string"){if(O instanceof z||w[w.length-1]!=='"')return;if(typeof O!="string")return`${w.slice(0,-1)}${O}"`;if(O[0]==='"')return w.slice(0,-1)+O.slice(1);return}if(typeof O=="string"&&O[0]==='"'&&!(w instanceof z))return`"${w}${O.slice(1)}`}function W(w,O){return O.emptyStr()?w:w.emptyStr()?O:J`${w}${O}`}$.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 U(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 U(`.${w}`):I`[${w}]`}$.getProperty=V;function F(w){if(typeof w=="string"&&$.IDENTIFIER.test(w))returnnewU(`${w}`);throwError(`CodeGen: invalid export name: ${w}, use explicit $id name mapping`)}$.getEsmExportName=F;functionM(w){returnnewU(w.toStringLine truncated
deps:${W}}`};let I={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=Q(G);J(G,H),K(G,W)}};function Q({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 J(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,U.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,U.checkReportMissingProp)(G,w)});else W.if(Y._`${M}&&(${(0,U.checkMissingProp)(G,F,q)})`),(0,U.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=J;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,z.alwaysValidSchema)(q,H[F]))continue;W.if((0,U.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=I}),Ub0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L1(),z=v1(),U={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:I})=>Y._`{propertyName:${I.propertyName}}`},code(I){let{gen:Q,schema:J,data:K,it:G}=I;if((0,z.alwaysValidSchema)(G,J))return;let H=Q.name("valid");Q.forIn("key",K,(W)=>{I.setParams({propertyName:W}),I.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),Q.if((0,Y.not)(H),()=>{if(I.error(!0),!G.allErrors)Q.break()})}),I.ok(H)}};$.default=U}),at=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=I5(),z=L1(),U=U5(),I=v1(),Q={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:J})=>z._`{additionalProperty:${J.additionalProperty}}`},code(J){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=J;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,I.alwaysValidSchema)(Z,G))return;let F=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);w(),J.ok(z._`${X}===${U.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!M.length)N(T);else K.if(O(T),()=>N(T))})}function O(T){let A;if(F.length>8){let j=(0,I.schemaRefOrVal)(Z,H.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)(J,j)}.test(${T})`));return(0,z.not)(A)}function D(T){K.code(z._`delete${W}[${T}]`)}function N(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){D(T);return}if(G===!1){if(J.setParams({additionalProperty:T}),J.error(),!q)K.break();return}if(typeof G=="object"&&!(0,I.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")B(T,A,!1),K.if((0,z.not)(A),()=>{J.reset(),D(T)});else if(B(T,A),!q)K.if((0,z.not)(A),()=>K.break())}}function B(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:I.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});J.subschema(C,A)}}};$.default=Q}),Ib0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=SI(),z=I5(),U=v1(),I=at(),Q={keyword:"properties",type:"object",schemaType:"object",code(J){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=J;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)I.default.code(new Y.KeywordCxt(X,I.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,W,w,X.opts.ownProperties)),M(w),!X.allErrors)K.else().var(V,!0);K.endIf()}J.it.definedProperties.add(w),J.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){J.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=Q}),Qb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=I5(),z=L1(),U=v1(),I=v1(),Q={keyword:"patternProperties",type:"object",schemaType:"object",code(J){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=J,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((B)=>(0,U.alwaysValidSchema)(X,G[B]));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 z.Name))X.props=(0,I.evaluatedPropsToName)(K,X.props);let{props:w}=X;O();function O(){for(let B of q){if(F)D(B);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($),Dk(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)y30(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Dk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(g30.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("")}}Ak.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};k30.exports=Ak});var Pk=E((Xt0)=>{var x30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Wt0($){if(typeof $==="string")return $;if(x30)return x30.decode($);return $.toString()}Xt0.bufferToString=Wt0});var c30=E((u30)=>{Object.defineProperty(u30,"__esModule",{value:!0});u30.CHAR=`
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 O=(0,z.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(O,()=>{for(let w of F)(0,z.checkReportMissingProp)(G,w)});else W.if(U._`${O}&&(${(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,Y.alwaysValidSchema)(q,H[F]))continue;W.if((0,z.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let O=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(O,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),zb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=L1(),Y=v1(),z={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>U._`{propertyName:${Q.propertyName}}`},code(Q){let{gen:J,schema:I,data:K,it:G}=Q;if((0,Y.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,U.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=z}),at=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=Q5(),Y=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})=>Y._`{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,U.allSchemaProperties)(H.properties),O=(0,U.allSchemaProperties)(H.patternProperties);w(),I.ok(Y._`${X}===${z.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!O.length)D(T);else K.if(M(T),()=>D(T))})}function M(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");A=(0,U.isOwnProperty)(K,j,T)}else if(F.length)A=(0,Y.or)(...F.map((j)=>Y._`${T}===${j}`));else A=Y.nil;if(O.length)A=(0,Y.or)(A,...O.map((j)=>Y._`${(0,U.usePattern)(I,j)}.test(${T})`));return(0,Y.not)(A)}function N(T){K.code(Y._`delete${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){N(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")B(T,A,!1),K.if((0,Y.not)(A),()=>{I.reset(),N(T)});else if(B(T,A),!q)K.if((0,Y.not)(A),()=>K.break())}}function B(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}),Qb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=SQ(),Y=Q5(),z=v1(),Q=at(),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 U.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,Y.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))O(w);else{if(K.if((0,Y.propertyInData)(K,W,w,X.opts.ownProperties)),O(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 O(w){I.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Jb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=Q5(),Y=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,U.allSchemaProperties)(G),V=q.filter((B)=>(0,z.alwaysValidSchema)(X,G[B]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,O=K.name("valid");if(X.props!==!0&&!(X.props instanceof Y.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:w}=X;M();function M(){for(let B of q){if(F)N(B);if(X.allErrors)
Line truncated
`)}openNode($,U){let Y=this.tos,z=this._xml;if(Y&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),Dk(z,U),this.leaf=!0,this.open=!0}addAttribute($,U){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(U!==void 0)y30(this._xml,$,U)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Dk(this._xml,$)}writeText($){let U=this._xml;if(this.open)U.push(">"),this.open=!1;this.leaf=!1,U.push(g30.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),U=this._xml;if(this.leaf)U.push("/>");else U.push("</"),U.push($),U.push(">");this.open=!1,this.leaf=!1}leafNode($,U,Y){if(this.openNode($,U),Y!==void 0)this.writeText(Y);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("")}}Ak.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};k30.exports=Ak});var Pk=E((Xt0)=>{var x30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Wt0($){if(typeof $==="string")return $;if(x30)return x30.decode($);return $.toString()}Xt0.bufferToString=Wt0});var c30=E((u30)=>{Object.defineProperty(u30,"__esModule",{value:!0});u30.CHAR=`
`,$=this.i;break;case ve0:{let{entityReturnState:z}=this,U=this.entity+Y.slice($,this.prevI);this.state=z;let I;if(U==="")this.fail("empty entity name."),I="&;";else I=this.parseEntity(U),this.entity="";if(z!==C8||this.textHandler!==void 0)this.text+=I;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vW($))this.state=je0,this.unget(),this.xmlDeclPossible=!1;else switch($){case mO:this.state=Re0,this.xmlDeclPossible=!1;break;case X70:this.state=Fe0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=De0;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=Sk,this.openWakaBang="";break;case"--":this.state=hk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Rk,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(dO))this.state=we0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===dO)this.state=Me0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=hk}sCommentEnded(){let $=this.getCodeNorm();if($!==B6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=hk;else this.state=C8}sCData(){if(this.captureToChar(TQ))this.state=Oe0}sCDataEnding(){let $=this.getCodeNorm();if($===TQ)this.state=Ne0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Sk}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case B6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case TQ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=Sk}}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?pO:gk;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?Gz:Q70}else this.state=U?pO:gk;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=pO;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=pO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===B6){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=gk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=Gz;return}if($!==k4)this.state=Ae0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(ge0);if($===o6){this.state=Gz,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===BQ))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=$===BQ?J70:Pe0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=Gz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==BQ)this.fail("value required.");this.state=J70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=Gz,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!lO($))this.fail("value must be quoted."),this.q=W70;else this.q=$;this.state=Be0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=Gz,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
`,$=this.i;break;case ve0:{let{entityReturnState:Y}=this,z=this.entity+U.slice($,this.prevI);this.state=Y;let Q;if(z==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(z),this.entity="";if(Y!==C8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=U.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vW($))this.state=je0,this.unget(),this.xmlDeclPossible=!1;else switch($){case mM:this.state=Re0,this.xmlDeclPossible=!1;break;case X70:this.state=Fe0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=De0;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=Sk,this.openWakaBang="";break;case"--":this.state=hk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Rk,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(dM))this.state=we0}sCommentEnding(){var $;let U=this.getCodeNorm();if(U===dM)this.state=Oe0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(U)}`,this.state=hk}sCommentEnded(){let $=this.getCodeNorm();if($!==B6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=hk;else this.state=C8}sCData(){if(this.captureToChar(TJ))this.state=Me0}sCDataEnding(){let $=this.getCodeNorm();if($===TJ)this.state=Ne0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Sk}sCDataEnding2(){var $;let U=this.getCodeNorm();switch(U){case B6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case TJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(U)}`,this.state=Sk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=Q70;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?pM:gk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=Q70}sPIRest(){let{chunk:$,i:U}=this;while(!0){let Y=this.getCodeNorm();if(Y===k4){this.piTarget+=$.slice(U);return}if(!this.nameCheck(Y)){this.piTarget+=$.slice(U,this.prevI);let z=Y===o6;if(z||p8(Y))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?GY:J70}else this.state=z?pM:gk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(Y);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=pM;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=pM}sPIEnding(){var $;let U=this.getCodeNorm();if(U===B6){let{piTarget:Y}=this;if(Y.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:Y,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(U===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(U)}`,this.state=gk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=GY;return}if($!==k4)this.state=Ae0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(ge0);if($===o6){this.state=GY,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===BJ))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=$===BJ?I70:Pe0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=GY,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==BJ)this.fail("value required.");this.state=I70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=GY,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!lM($))this.fail("value must be quoted."),this.q=W70;else this.q=$;this.state=Be0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=GY,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let U=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let Y=U;if(this.xmlDecl.version=Y,!/^1\.[0-9]+$/.test(Y))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
See:https://github.com/isaacs/node-glob/issues/167`);return new T6($,U).found}function T6($,U){if(!$)throw Error("must provide pattern");if(typeof U==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+Z0[P0-1];break}}}var N1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+Q0;u._warn(N1,!0,P)}}function y(I0,P){var v=I0+" is deprecated and will be removed in a future version.";if(P)v+=" Use "+P+" instead.";return s(v)}function s(I0,P,v){if(!A0.warnings)return;var u=new I(I0),r;if(P)v._attachExtraTrace(u);else if(A0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=b0(u);u.stack=X0.message+`
`+Z0[P0-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,P)}}function y(Q0,P){var v=Q0+" is deprecated and will be removed in a future version.";if(P)v+=" Use "+P+" instead.";return s(v)}function s(Q0,P,v){if(!A0.warnings)return;var u=new Q(Q0),r;if(P)v._attachExtraTrace(u);else if(A0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=b0(u);u.stack=X0.message+`
`)));return}}w=w._target();var O=w._bitField;if((O&50397184)===0)this._yieldedPromise=w,w._proxy(this,null);else if((O&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,w._value());else if((O&16777216)!==0)$._async.invoke(this._promiseRejected,this,w._reason());else this._promiseCancelled()}},$.coroutine=function(V,F){if(typeof V!=="function")throw new K(`generatorFunctionmustbeafunction
`)));return}}w=w._target();var M=w._bitField;if((M&50397184)===0)this._yieldedPromise=w,w._proxy(this,null);else if((M&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,w._value());else if((M&16777216)!==0)$._async.invoke(this._promiseRejected,this,w._reason());else this._promiseCancelled()}},$.coroutine=function(V,F){if(typeof V!=="function")throw new K(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var M=Object(F).yieldHandler,w=q,O=Error().stack;return function(){var D=V.apply(this,arguments),N=new w(void 0,void 0,M,O),B=N.promise();return N._generator=D,N._promiseFulfilled(void 0),B}},$.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(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunctionmustbeafunction
`);var O=Object(F).yieldHandler,w=q,M=Error().stack;return function(){var N=V.apply(this,arguments),D=new w(void 0,void 0,O,M),B=D.promise();return D._generator=N,D._promiseFulfilled(void 0),B}},$.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 U(`generatorFunctionmustbeafunction
`)},Y=function(){return new h.PromiseInspection(this._target())},z=function(x){return h.reject(new X(x))};function U(){}var I={},Q=F4(),J;if(Q.isNode)J=function(){var x=process.domain;if(x===void 0)x=null;return x};else J=function(){return null};Q.notEnumerableProp(h,"_getDomain",J);var K=mz(),G=TF0(),H=new G;K.defineProperty(h,"_async",{value:H});var W=T3(),X=h.TypeError=W.TypeError;h.RangeError=W.RangeError;var Z=h.CancellationError=W.CancellationError;h.TimeoutError=W.TimeoutError,h.OperationalError=W.OperationalError,h.RejectionError=W.OperationalError,h.AggregateError=W.AggregateError;var q=function(){},V={},F={},M=_F0()(h,q),w=hF0()(h,q,M,z,U),O=gF0()(h),D=O.create,N=kF0()(h,O),B=N.CapturedTrace,T=fF0()(h,M),A=bF0()(F),j=Jc(),C=Q.errorObj,b=Q.tryCatch;function k(x,d){if(typeof d!=="function")throw new X("expecting a function but got "+Q.classString(d));if(x.constructor!==h)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
`)},U=function(){return new h.PromiseInspection(this._target())},Y=function(k){return h.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(h,"_getDomain",I);var K=mY(),G=TF0(),H=new G;K.defineProperty(h,"_async",{value:H});var W=T3(),X=h.TypeError=W.TypeError;h.RangeError=W.RangeError;var Z=h.CancellationError=W.CancellationError;h.TimeoutError=W.TimeoutError,h.OperationalError=W.OperationalError,h.RejectionError=W.OperationalError,h.AggregateError=W.AggregateError;var q=function(){},V={},F={},O=_F0()(h,q),w=hF0()(h,q,O,Y,z),M=gF0()(h),N=M.create,D=kF0()(h,M),B=D.CapturedTrace,T=fF0()(h,O),A=bF0()(F),j=Ic(),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!==h)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function h(x){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,x!==q)k(this,x),this._resolveFromExecutor(x);this._promiseCreated(),this._fireEvent("promiseCreated",this)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.prototype.catch=function(x){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(Q.isObject(p))t[$0++]=p;else return z("expecting an object but got A catch statement predicate "+Q.classString(p))}return t.length=$0,x=arguments[g],this.then(void 0,A(t,x,this))}return this.then(void 0,x)},h.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},h.prototype.then=function(x,d){if(N.warnings()&&arguments.length>0&&typeof x!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+Q.classString(x);if(arguments.length>1)t+=", "+Q.classString(d);this._warn(t)}return this._then(x,d,void 0,void 0,void 0)},h.prototype.done=function(x,d){var t=this._then(x,d,void 0,void 0,void 0);t._setIsFinal()},h.prototype.spread=function(x){if(typeof x!=="function")return z("expecting a function but got "+Q.classString(x));return this.all()._then(x,void 0,void 0,V,void 0)},h.prototype.toJSON=function(){var x={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())x.fulfillmentValue=this.value(),x.isFulfilled=!0;else if(this.isRejected())x.rejectionReason=this.reason(),x.isRejected=!0;return x},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},h.prototype.error=function(x){return this.caught(Q.originatesFromRejection,x)},h.getNewLibraryCopy=Gc.exports,h.is=function(x){return x instanceof h},h.fromNode=h.fromCallback=function(x){var d=new h(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(x)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},h.all=function(x){return new w(x).promise()},h.cast=function(x){var d=M(x);if(!(d instanceof h))d=new h(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=x;return d},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(x){var d=new h(q);return d._captureStackTrace(),d._rejectCallback(x,!0),d},h.setScheduler=function(x){if(typeof x!=="function")throw new X("expecting a function but got "+Q.classString(x));return H.setScheduler(x)},h.prototype._then=function(x,d,t,$0,g){var p=g!==void 0,e=p?g:new h(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=J();if((s&50397184)!==0){var M0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,M0=x;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,M0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),M0=d;H.invoke(G0,y,{handler:Y0===null?M0:typeof M0==="function"&&Q.domainBind(Y0,M0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(x,d,e,$0,Y0);return e},h.prototype._length=function(){return this._bitField&65535},h.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},h.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},h.prototype._setLength=function(x){this._bitField=this._bitField&-65536|x&65535},h.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},h.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},h.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},h.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},h.prototype._isFinal=function(){return(this._bitField&4194304)>0},h.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},h.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},h.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},h.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},h.prototype._receiverAt=function(x){var d=x===0?this._receiver0:this[x*4-4+3];if(d===I)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},h.prototype._promiseAt=function(x){return this[x*4-4+2]},h.prototype._fulfillmentHandlerAt=function(x){return this[x*4-4+0]},h.prototype._rejectionHandlerAt=function(x){return this[x*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(x){var{_bitField:d,_fulfillmentHandler
Line truncated
`)}function h(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)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.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 Y("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)},h.prototype.reflect=function(){return this._then(U,U,void 0,this,void 0)},h.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)},h.prototype.done=function(k,d){var t=this._then(k,d,void 0,void 0,void 0);t._setIsFinal()},h.prototype.spread=function(k){if(typeof k!=="function")return Y("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},h.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},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},h.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},h.getNewLibraryCopy=Gc.exports,h.is=function(k){return k instanceof h},h.fromNode=h.fromCallback=function(k){var d=new h(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},h.all=function(k){return new w(k).promise()},h.cast=function(k){var d=O(k);if(!(d instanceof h))d=new h(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=k;return d},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(k){var d=new h(q);return d._captureStackTrace(),d._rejectCallback(k,!0),d},h.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},h.prototype._then=function(k,d,t,$0,g){var p=g!==void 0,e=p?g:new h(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 U0=I();if((s&50397184)!==0){var O0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,O0=k;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,O0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),O0=d;H.invoke(G0,y,{handler:U0===null?O0:typeof O0==="function"&&J.domainBind(U0,O0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(k,d,e,$0,U0);return e},h.prototype._length=function(){return this._bitField&65535},h.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},h.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},h.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},h.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},h.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},h.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},h.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},h.prototype._isFinal=function(){return(this._bitField&4194304)>0},h.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},h.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},h.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},h.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},h.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},h.prototype._promiseAt=function(k){return this[k*4-4+2]},h.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},h.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(k){var{_bitField:d,_fulfillmentHandler
Line truncated
`,{mode:384}),Y}function Yp($){let Y=HA0();for(let z of Y){if(!V$(z))continue;for(let U of kP(z).filter((I)=>I.endsWith(".json")).filter((I)=>!I.startsWith("example."))){let I=N9(z,U);try{let Q=fP(I,"utf-8"),J=JSON.parse(Q);if(J&&typeof J==="object"&&J.id===$)return I}catch{}}}return}function x2($,Y){let z=Yp($);if(!z)throw Error(`Enterpriseconfignotfound:${$}`);let I={...JSON.parse(fP(z,"utf-8")),...Y};for(let J of Object.keys(Y))if(Y[J]===void 0)delete I[J];let Q=an.parse(I);return UA0(z,`${JSON.stringify(Q,null,2)}
`,"utf-8"),Q}var en="SEAL_USE_ENTERPRISES_DIR",IA0="SEAL_HOME_ENTERPRISES_DIR",QA0="SEAL_USE_USER_ENTERPRISES_DIR",JA0="SEAL_HOME_USER_ENTERPRISES_DIR",KA0="SEAL_USE_CONFIG_FILE",GA0="SEAL_HOME_CONFIG_FILE",rJ,xP,yP,YA0;var S3=o(()=>{tn();rJ=N9(uP(),".config","seal-use","enterprises"),xP=N9(uP(),".config","seal-home","enterprises"),yP=N9(uP(),".config","seal-use","config.json"),YA0=N9(uP(),".config","seal-home","config.json")});function f2($,Y,z=[]){let U=Y.corpId?.trim()||void 0,I=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,Q=U??I;if(Q){let K=$.find((W)=>W.id===Q);if(K)return K;let G=$.find((W)=>W.id.toLowerCase()===Q.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===Q.toLowerCase());if(H)return H;throw Error(`Noenterpriseconfigfoundfor${Q}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let J=$[0];if(J)return J;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 zp,mkdirSync as gN1,readFileSync as yN1,renameSync as kN1,unlinkSync as xN1,writeFileSync as fN1}from"node:fs";import{homedir as uN1}from"node:os";import{dirname as bN1,join as iN1}from"node:path";function _Z(){let $=process.env[cN1]?.trim();if($)return $;return nN1}function WA0($=new Date){return $.toISOString().slice(0,10)}function XA0($=Up,Y=new Date){let z=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(z).toISOString().slice(0,10)}function ZA0($=_Z()){if(!zp($))return{};try{let Y=yN1($,"utf-8"),z=JSON.parse(Y);if(z&&typeof z==="object"&&!Array.isArray(z))return z;return{}}catch{return{}}}function pN1($,Y){let z={};for(let[U,I]of Object.entries($)){if(!I||typeof I!=="object")continue;let Q={},J=!1;for(let[K,G]of Object.entries(I))if(typeof G==="number"&&G>0&&K>=Y)Q[K]=G,J=!0;if(J)z[U]=Q}return z}function dN1($,Y=_Z()){let z=bN1(Y);if(!zp(z))gN1(z,{recursive:!0,mode:448});let U=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{fN1(U,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),kN1(U,Y)}catch(I){try{if(zp(U))xN1(U)}catch{}throw I}}function qA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let z=_Z(),U=ZA0(z),I=WA0(Y),Q=XA0(Up,Y),J=pN1(U,Q);J[$]=J[$]||{},J[$][I]=(J[$][I]??0)+1,dN1(J,z)}catch{}}function mN1($,Y=Up,z=new Date){let U=new Map;try{let I=ZA0(),Q=XA0(Y,z),J=WA0(z),K=$??Object.keys(I);for(let G of K){let H=I[G];if(!H){U.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=Q&&X<=J&&typeof Z==="number")W+=Z;U.set(G,W)}}catch{if($)for(let I of $)U.set(I,0)}return U}function VA0($,Y,z){let U=z??mN1($.map((I)=>I.id));return[...$].sort((I,Q)=>{if(Y){if(I.id===Y&&Q.id!==Y)return-1;if(Q.id===Y&&I.id!==Y)return 1}let J=U.get(I.id)??0,K=U.get(Q.id)??0;if(J!==K)return K-J;let G=I.name??I.id,H=Q.name??Q.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return I.id.localeCompare(Q.id)})}var cN1="SEAL_USE_USAGE_FILE",nN1,Up=7;var bP=o(()=>{nN1=iN1(uN1(),".config","seal-use","usage.json")});function lN1($,Y){return $.map((z)=>z.trim()).filter(Boolean).map((z)=>Y?z:z.toLowerCase())}function oN1($,Y){return Y?$:$.toLowerCase()}function rN1($,Y,z,U){let I=oN1($,U),Q=Y.filter((J)=>I.includes(J));if(z==="all"&&Q.length!==Y.length)return[];return Q}function sN1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function aN1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let z=sN1($.value),U=[];return z.forEach((I,Q)=>{let J=rN1(I,Y.keywords,Y.matchMode,Y.caseSensitive);if(J.length===0)return;let K=Math.max(0,Q-Y.contextLines),G=Math.min(z.length,Q+Y.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:Q+1,matchedKeywords:J,matchedText:iP(I,Y.maxChars),context:{before:Y.snippetOnly?[]:z.slice(K,Q).map((W)=>iP(W,Y.maxChars)),line:iP(I,Y.maxChars),after:Y.snippetOnly?[]:z.slice(Q+1,G).map((W)=>iP(W,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)H.context={before:[],line:H.context.line,after:[]};U.push(H)}),U}function iP($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function tN1($){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 FA0($){return $.rules.flatMap((Y,z)=>{let U=`${$.id}:${Y.description.slice(0,32)}`,I={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
`,{mode:384}),U}function Up($){let U=HA0();for(let Y of U){if(!V$(Y))continue;for(let z of kP(Y).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=N9(Y,z);try{let J=fP(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function x2($,U){let Y=Up($);if(!Y)throw Error(`Enterpriseconfignotfound:${$}`);let Q={...JSON.parse(fP(Y,"utf-8")),...U};for(let I of Object.keys(U))if(U[I]===void 0)delete Q[I];let J=an.parse(Q);return zA0(Y,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var en="SEAL_USE_ENTERPRISES_DIR",QA0="SEAL_HOME_ENTERPRISES_DIR",JA0="SEAL_USE_USER_ENTERPRISES_DIR",IA0="SEAL_HOME_USER_ENTERPRISES_DIR",KA0="SEAL_USE_CONFIG_FILE",GA0="SEAL_HOME_CONFIG_FILE",rI,xP,yP,UA0;var S3=o(()=>{tn();rI=N9(uP(),".config","seal-use","enterprises"),xP=N9(uP(),".config","seal-home","enterprises"),yP=N9(uP(),".config","seal-use","config.json"),UA0=N9(uP(),".config","seal-home","config.json")});function f2($,U,Y=[]){let z=U.corpId?.trim()||void 0,Q=U.stateful?U.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(!U.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: "+(Y.length?Y.join(", "):"the configured enterprise directories"))}import{existsSync as Yp,mkdirSync as gN1,readFileSync as yN1,renameSync as kN1,unlinkSync as xN1,writeFileSync as fN1}from"node:fs";import{homedir as uN1}from"node:os";import{dirname as bN1,join as iN1}from"node:path";function _Z(){let $=process.env[cN1]?.trim();if($)return $;return nN1}function WA0($=new Date){return $.toISOString().slice(0,10)}function XA0($=zp,U=new Date){let Y=U.getTime()-Math.max(0,$-1)*86400000;return new Date(Y).toISOString().slice(0,10)}function ZA0($=_Z()){if(!Yp($))return{};try{let U=yN1($,"utf-8"),Y=JSON.parse(U);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function pN1($,U){let Y={};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>=U)J[K]=G,I=!0;if(I)Y[z]=J}return Y}function dN1($,U=_Z()){let Y=bN1(U);if(!Yp(Y))gN1(Y,{recursive:!0,mode:448});let z=`${U}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{fN1(z,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),kN1(z,U)}catch(Q){try{if(Yp(z))xN1(z)}catch{}throw Q}}function qA0($,U=new Date){if(!$||typeof $!=="string")return;try{let Y=_Z(),z=ZA0(Y),Q=WA0(U),J=XA0(zp,U),I=pN1(z,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,dN1(I,Y)}catch{}}function mN1($,U=zp,Y=new Date){let z=new Map;try{let Q=ZA0(),J=XA0(U,Y),I=WA0(Y),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 VA0($,U,Y){let z=Y??mN1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(U){if(Q.id===U&&J.id!==U)return-1;if(J.id===U&&Q.id!==U)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 cN1="SEAL_USE_USAGE_FILE",nN1,zp=7;var bP=o(()=>{nN1=iN1(uN1(),".config","seal-use","usage.json")});function lN1($,U){return $.map((Y)=>Y.trim()).filter(Boolean).map((Y)=>U?Y:Y.toLowerCase())}function oN1($,U){return U?$:$.toLowerCase()}function rN1($,U,Y,z){let Q=oN1($,z),J=U.filter((I)=>Q.includes(I));if(Y==="all"&&J.length!==U.length)return[];return J}function sN1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function aN1($,U){if(U.fields&&!U.fields.has($.field))return[];let Y=sN1($.value),z=[];return Y.forEach((Q,J)=>{let I=rN1(Q,U.keywords,U.matchMode,U.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-U.contextLines),G=Math.min(Y.length,J+U.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:iP(Q,U.maxChars),context:{before:U.snippetOnly?[]:Y.slice(K,J).map((W)=>iP(W,U.maxChars)),line:iP(Q,U.maxChars),after:U.snippetOnly?[]:Y.slice(J+1,G).map((W)=>iP(W,U.maxChars))},metadata:$.metadata};if(U.snippetOnly)H.context={before:[],line:H.context.line,after:[]};z.push(H)}),z}function iP($,U){if(!U||$.length<=U)return $;return`${$.slice(0,Math.max(0,U))}...`}function tN1($){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 FA0($){return $.rules.flatMap((U,Y)=>{let z=`${$.id}:${U.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:U.scope,strictness:U.strictness,code:"code"in U?U.code:void 0,index:Y};return[{area:"rules",entityType:"rule",entityId:z,title:`${$.versionName}/${U.scope}`,field:"h
Line truncated
@@ -876,62 +876,67 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
}
exportdefaultlintRule;
`}});import{existsSync as HU,mkdirSync as BD1,readFileSync as TD1,readdirSync as CA0,rmSync as jD1,unlinkSync as ED1,writeFileSync as CD1}from"node:fs";import{homedir as RD1}from"node:os";import{isAbsolute as _D1,join as f6,resolve as vD1}from"node:path";import{pathToFileURL as jA0}from"node:url";function RA0($=i$){let Y=[],z=[];try{if(!HU($))BD1($,{recursive:!0});let U=Object.keys(Wp);for(let[Q,J]of Object.entries(Wp)){let K=f6($,Q),G=!0;if(HU(K))try{if(TD1(K,"utf8")===J)G=!1}catch{G=!0}if(G)CD1(K,J,"utf8");Y.push(Q)}let I=CA0($,{withFileTypes:!0});for(let Q of I)if(!U.includes(Q.name)){let J=f6($,Q.name);try{if(Q.isDirectory())jD1(J,{recursive:!0,force:!0});else ED1(J);z.push(Q.name)}catch{}}}catch{}return{synced:Y,pruned:z}}function _A0($={syncOfficial:!0}){if($.syncOfficial!==!1)RA0();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$,dP];for(let U of z)if(HU(U))try{let I=CA0(U,{withFileTypes:!0});for(let Q of I){if(Q.isDirectory())continue;let J=Q.name;if(J.endsWith(".ts")||J.endsWith(".js")||J.endsWith(".mjs")){let K=J.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:f6(U,J),description:`用户自定义规则校验器(${J})`})}}}catch{}return Y}function SD1($){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(_D1(Y)||Y.startsWith("./")||Y.startsWith("../")){let U=vD1(Y);if(HU(U))return{path:U};for(let I of[".ts",".js",".mjs"])if(HU(`${U}${I}`))return{path:`${U}${I}`}}let z=[f6(b$,`${Y}.ts`),f6(b$,`${Y}.js`),f6(b$,`${Y}.mjs`),f6(dP,`${Y}.ts`),f6(dP,`${Y}.js`),f6(dP,`${Y}.mjs`)];for(let U of z)if(HU(U))return{path:U};return{}}async function Zp($){RA0();let Y=SD1($??"builtin");if(Y.isOfficial){let U=Y.officialKind==="strict"?BA0:Y.officialKind==="hlab"?TA0:aJ,I=Y.officialKind==="builtin"?"builtin":"official",Q=Y.path;if(Q&&HU(Q))try{let K=await import(jA0(Q).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:I,filePath:Q,linter:EA0(G,U)}}catch{}return{name:Y.officialKind??"builtin",type:I,filePath:Q,linter:U}}let z=Y.path;if(!z)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aJ};try{let I=await import(jA0(z).href),Q=I.default??I.lintRule??I.linter??I.lint;if(typeof Q!=="function")return console.error(`⚠️[linter]自定义校验器"${z}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aJ};return{name:$??"custom",type:"custom",filePath:z,linter:EA0(Q,aJ)}}catch(U){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${z}"失败(语法错误或依赖缺失:${U?.message??U}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aJ}}}functionEA0($,Y){returnasync(z,U)=>{try{letI=await$(z,U);if(I&&typeofI==="object"&&typeofI.score==="number"&&Array.isArray(I.issues))returnI;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(z,U)}catch(I){returnconsole.error("⚠️[linter]自定义校验器执行异常:",I),Y(z,U)}}}varb$,hD1="official",i$,dP;varqp=o(()=>{Kp();Hp();Xp();Gp();b$=f6(RD1(),".config","seal-use","linters"),i$=f6(b$,hD1),dP=f6(process.cwd(),"linters")});asyncfunctionVp($,Y,z){letU=awaitY.linter($,z);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:U.score,passed:U.passed,issues:U.issues,description:$.description}}asyncfunctionvA0($,Y,z,U){letI=U?.minScore??0,Q=U?.level??"all",J=[],K=0;for(letqof$){letV=awaitVp(q,Y,z);K+=V.score;letF=V.issues;if(Q==="error")F=V.issues.filter((w)=>w.level==="error");elseif(Q==="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)J.push({...V,passed:M,issues:F})}elseJ.push({...V,passed:M,issues:F})}letG=$.length,H=G===0?100:Math.round(K/G),W=J.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`}});import{existsSync as Hz,mkdirSync as BD1,readFileSync as TD1,readdirSync as CA0,rmSync as jD1,unlinkSync as ED1,writeFileSync as CD1}from"node:fs";import{homedir as RD1}from"node:os";import{isAbsolute as _D1,join as f6,resolve as vD1}from"node:path";import{pathToFileURL as jA0}from"node:url";function RA0($=i$){let U=[],Y=[];try{if(!Hz($))BD1($,{recursive:!0});let z=Object.keys(Wp);for(let[J,I]of Object.entries(Wp)){let K=f6($,J),G=!0;if(Hz(K))try{if(TD1(K,"utf8")===I)G=!1}catch{G=!0}if(G)CD1(K,I,"utf8");U.push(J)}let Q=CA0($,{withFileTypes:!0});for(let J of Q)if(!z.includes(J.name)){let I=f6($,J.name);try{if(J.isDirectory())jD1(I,{recursive:!0,force:!0});else ED1(I);Y.push(J.name)}catch{}}}catch{}return{synced:U,pruned:Y}}function _A0($={syncOfficial:!0}){if($.syncOfficial!==!1)RA0();let U=[{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 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],Y=[b$,dP];for(let z of Y)if(Hz(z))try{let Q=CA0(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(!U.some((G)=>G.name===K))U.push({name:K,type:"custom",path:f6(z,I),description:`用户自定义规则校验器(${I})`})}}}catch{}return U}function SD1($){let U=($||"").trim();if(!U||U==="builtin"||U==="default"||U==="official/builtin"||U==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(U==="strict"||U==="official/strict"||U==="official/strict.ts")return{path:f6(i$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(U==="hlab"||U==="hlab-sop"||U==="hlab-rules"||U==="hlab-standard"||U==="official/hlab"||U==="official/hlab.ts")return{path:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(_D1(U)||U.startsWith("./")||U.startsWith("../")){let z=vD1(U);if(Hz(z))return{path:z};for(let Q of[".ts",".js",".mjs"])if(Hz(`${z}${Q}`))return{path:`${z}${Q}`}}let Y=[f6(b$,`${U}.ts`),f6(b$,`${U}.js`),f6(b$,`${U}.mjs`),f6(dP,`${U}.ts`),f6(dP,`${U}.js`),f6(dP,`${U}.mjs`)];for(let z of Y)if(Hz(z))return{path:z};return{}}async function Zp($){RA0();let U=SD1($??"builtin");if(U.isOfficial){let z=U.officialKind==="strict"?BA0:U.officialKind==="hlab"?TA0:aI,Q=U.officialKind==="builtin"?"builtin":"official",J=U.path;if(J&&Hz(J))try{let K=await import(jA0(J).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:U.officialKind??"builtin",type:Q,filePath:J,linter:EA0(G,z)}}catch{}return{name:U.officialKind??"builtin",type:Q,filePath:J,linter:z}}let Y=U.path;if(!Y)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aI};try{let Q=await import(jA0(Y).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️[linter]自定义校验器"${Y}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aI};return{name:$??"custom",type:"custom",filePath:Y,linter:EA0(J,aI)}}catch(z){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${Y}"失败(语法错误或依赖缺失:${z?.message??z}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aI}}}functionEA0($,U){returnasync(Y,z)=>{try{letQ=await$(Y,z);if(Q&&typeofQ==="object"&&typeofQ.score==="number"&&Array.isArray(Q.issues))returnQ;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),U(Y,z)}catch(Q){returnconsole.error("⚠️[linter]自定义校验器执行异常:",Q),U(Y,z)}}}varb$,hD1="official",i$,dP;varqp=o(()=>{Kp();Hp();Xp();Gp();b$=f6(RD1(),".config","seal-use","linters"),i$=f6(b$,hD1),dP=f6(process.cwd(),"linters")});asyncfunctionVp($,U,Y){letz=awaitU.linter($,Y);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:z.score,passed:z.passed,issues:z.issues,description:$.description}}asyncfunctionvA0($,U,Y,z){letQ=z?.minScore??0,J=z?.level??"all",I=[],K=0;for(letqof$){letV=awaitVp(q,U,Y);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");letO=F.every((w)=>w.level!=="error");if(z?.summary){if(F.length>0)I.push({...V,passed:O,issues:F})}elseI.push({...V,passed:O,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
`),U=await Promise.all(D.map((N)=>H4($,N.id)))}let I=new Map,Q=0;for(let w of U){let O=w.document,D=w.sourceDocumentId??(typeof O?.id==="string"?O.id:void 0)??(typeof O?.sourceDocumentId==="string"?O.sourceDocumentId:void 0)??w.documentId??w.id,N=`${z.docIdPrefix??""}${D}${z.docIdSuffix??""}`,B=[];if(z.includeAttachments!==!1){let A=k2(w,{summary:!1}).attachments,j=new Set;for(let C of A){let b=C.ossSignedUrl??C.url;if(!b)continue;let k=C.fileName??C.fileId??"attachment",h=on(k),i=h,c=h.lastIndexOf("."),U0=c>0?h.slice(0,c):h,x=c>0?h.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${U0}_${d}${x}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${N}」附件:${k}...
`),await new Promise((w,O)=>{let D=Gh1(V),N=new Jl({zlib:{level:9}});D.on("close",()=>w()),N.on("error",(B)=>O(B)),N.pipe(D),N.append(Buffer.from(F),{name:"信息表.xlsx"});for(let B of I.values())for(let T of B)N.append(T.buffer,{name:T.zipPath});N.finalize()});let M=Wh1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:U.length,attachmentCount:Q,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var kR0;var Kl=o(()=>{gR0();X6();SP();kR0=Q6(EZ(),1)});import{readFileSync as Lh1}from"node:fs";function Fh1($){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 wh1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Mh1($,Y){if(!$.length)return;let z=new Set($.map((Q)=>{let J=Q.fileName.split("/")[0],K=J.indexOf("@");return K>=0?J.slice(0,K):J}).filter((Q)=>Q!=="信息表.xlsx")),U=[];for(let Q of Y){let J=Q.document.documentId;if((Q.documentAttachments.length>0||Object.values(Q.expenseAttachments).some((G)=>G.length>0)||Object.values(Q.personAttachments).some((G)=>G.length>0))&&!z.has(J))U.push(`Excel 会议编号「${J}」声明了附件,但在 ZIP 中找不到对应的根目录「${J}/」或「${J}@.../」。`)}let I=new Set(Y.map((Q)=>Q.document.documentId));for(let Q of z)if(!I.has(Q))U.push(`ZIP 根目录对应的编号「${Q}」在信息表中找不到对应的会议编号。`);if(U.length)throw new D5(U)}async function xR0($,Y,z){let U=[],I=$;if(wh1($,Y)){U=await lP0($),rP0(U,z);let G=U.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");I=await Kd($,G)}let Q=await zB0(I);Mh1(U,Q);let J=UB0(U,Q),K=Q.map((G)=>G.document);return{entries:U,parsed:Q,plans:J,documents:K,fileBuffer:$}}async function _U($,Y,z){let U=await xR0($,Y,z),I=U.parsed.map((Q,J)=>qd(Q.document,U.plans[J],new Map));return{warnings:[],documents:I,attachmentPlan:U.plans}}async function zT($,Y,z){let U=await xR0($,Y,z.materialPackFilePolicy),{baseUrl:I,webhookId:Q}=Fh1(z.webhookUrl),J=[];for(let K=0;K<U.parsed.length;K+=1){let G=U.parsed[K],H=U.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=U.entries.find((T)=>T.fileName===F);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${F}
`),z=await Promise.all(N.map((D)=>H4($,D.id)))}let Q=new Map,J=0;for(let w of z){let M=w.document,N=w.sourceDocumentId??(typeof M?.id==="string"?M.id:void 0)??(typeof M?.sourceDocumentId==="string"?M.sourceDocumentId:void 0)??w.documentId??w.id,D=`${Y.docIdPrefix??""}${N}${Y.docIdSuffix??""}`,B=[];if(Y.includeAttachments!==!1){let A=k2(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",h=on(x),i=h,c=h.lastIndexOf("."),z0=c>0?h.slice(0,c):h,k=c>0?h.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${z0}_${d}${k}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${D}」附件:${x}...
`),await new Promise((w,M)=>{let N=Gh1(V),D=new Il({zlib:{level:9}});N.on("close",()=>w()),D.on("error",(B)=>M(B)),D.pipe(N),D.append(Buffer.from(F),{name:"信息表.xlsx"});for(let B of Q.values())for(let T of B)D.append(T.buffer,{name:T.zipPath});D.finalize()});let O=Wh1(V);return{filePath:V,corpId:U.id,corpName:U.name,recordCount:z.length,attachmentCount:J,fileSizeBytes:O.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var kR0;var Kl=o(()=>{gR0();X6();SP();kR0=J6(EZ(),1)});import{readFileSync as Lh1}from"node:fs";function Fh1($){let U=new URL($),Y=U.pathname.match(/\/webhook\/([^/]+)/);if(!Y)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${U.protocol}//${U.host}`,webhookId:Y[1]}}function wh1($,U){return U.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!U.toLowerCase().endsWith(".xlsx")}function Oh1($,U){if(!$.length)return;let Y=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 U){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))&&!Y.has(I))z.push(`Excel 会议编号「${I}」声明了附件,但在 ZIP 中找不到对应的根目录「${I}/」或「${I}@.../」。`)}let Q=new Set(U.map((J)=>J.document.documentId));for(let J of Y)if(!Q.has(J))z.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(z.length)throw new D5(z)}async function xR0($,U,Y){let z=[],Q=$;if(wh1($,U)){z=await lP0($),rP0(z,Y);let G=z.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Kd($,G)}let J=await YB0(Q);Oh1(z,J);let I=zB0(z,J),K=J.map((G)=>G.document);return{entries:z,parsed:J,plans:I,documents:K,fileBuffer:$}}async function _z($,U,Y){let z=await xR0($,U,Y),Q=z.parsed.map((J,I)=>qd(J.document,z.plans[I],new Map));return{warnings:[],documents:Q,attachmentPlan:z.plans}}async function YT($,U,Y){let z=await xR0($,U,Y.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Fh1(Y.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 O=z.entries.find((T)=>T.fileName===F);if(!O)continue;process.stderr.write(`⬆ 上传附件: ${F}
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:Y.sso?W:H,sealResultUrl:H,ssoUrl:W,type:Y.sso?"sso_link":"deep_link",expiresIn:Y.sso?q:void 0,identity:X,warning:Z,enterpriseAssistUrl:J,enterpriseUrl:J,hoseDomain:Q.type==="hose"?oh1(Q.domain):void 0,documentUrl:K,recordId:I?.id,sourceDocumentSN:I?.sourceDocumentSN,sourceDocumentId:I?.sourceDocumentId,sourceSystem:I?.sourceSystem,missing:{enterpriseAssistUrl:J?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:U&&!K?"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 rh1($,{query:z,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),I=await Promise.all(U.records.map((K)=>H4($,K.id))),Q=nR0(Y.fields),J=I.map((K)=>dh1(K,Q));return{query:z,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:U.total,scanned:U.scanned,matched:J.length,records:J,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:GT(I)}:{}}}},{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=Ol(await aS($,Y.batchId),Y.query);return{batchId:Y.batchId,count:z.length,records:z.map(hU),bridge:GT(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 eS($)).find((K)=>K.signKey)?.signKey,!U)throw Error("未找到合思集成 signKey, 请通过 signKey
Line truncated
`)}function QS1($){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 H_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of W_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 W_0;var Tl=o(()=>{L$();W_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:"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>",description:"Production enterprise ID (default: active enterprise)"},{flag:"--record-id <id>",description:"Replay a specific approval run ID"},{flag:"--sn <sn>",description:"Replay a specific document SN"},{flag:"--limit <n>",description:"Batch replay latest N records from production (default: 1)"},{flag:"--status <status>",descripti
Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:U.sso?W:H,sealResultUrl:H,ssoUrl:W,type:U.sso?"sso_link":"deep_link",expiresIn:U.sso?q:void 0,identity:X,warning:Z,enterpriseAssistUrl:I,enterpriseUrl:I,hoseDomain:J.type==="hose"?oh1(J.domain):void 0,documentUrl:K,recordId:Q?.id,sourceDocumentSN:Q?.sourceDocumentSN,sourceDocumentId:Q?.sourceDocumentId,sourceSystem:Q?.sourceSystem,missing:{enterpriseAssistUrl:I?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:z&&!K?"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($,U)=>{let Y=U.sn??U.query;if(!Y)throw Error("query or sn is required");let z=await rh1($,{query:Y,sn:U.sn,batchId:U.batchId,latest:U.latest,limit:U.latest?1:U.limit??20,maxScan:U.maxScan??1000}),Q=await Promise.all(z.records.map((K)=>H4($,K.id))),J=nR0(U.fields),I=Q.map((K)=>dh1(K,J));return{query:Y,sourceDocumentSN:U.sn,simulationBatchId:U.batchId,latest:U.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}'`},...U.includeBridge?{bridge:GT(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($,U)=>{let Y=Ml(await aS($,U.batchId),U.query);return{batchId:U.batchId,count:Y.length,records:Y.map(hz),bridge:GT(Y)}}},{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($,U)=>{let Y=U.mode??"hosecloud",z=U.signKey;if(Y==="hosecloud"&&!z){if(z=(await eS($)).find((K)=>K.signKey)?.signKey,!z)throw Error("未找到合思集成 signKey, 请通过 signKey
Line truncated
`)}function JS1($){let U=[];if(U.push(`seal-use${$.area}-${$.title}`),$.description)U.push($.description);U.push(""),U.push("Usage:");for(let Y of $.commands)for(let z of Y.usage)U.push(`${z}`);if($.commands.some((Y)=>Y.name))U.push(""),U.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return U.join(`
`)}function H_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let U of W_0)for(let Y of U.commands)for(let z of Y.usage)$.push(`${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var W_0;var Tl=o(()=>{L$();W_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:"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>",description:"Production enterprise ID (default: active enterprise)"},{flag:"--record-id <id>",description:"Replay a specific approval run ID"},{flag:"--sn <sn>",description:"Replay a specific document SN"},{flag:"--limit <n>",description:"Batch replay latest N records from production (default: 1)"},{flag:"--status <status>",descripti
Line truncated
`);c0({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((I)=>({id:I.id,name:I.name||"-",appKey:I.appKey,appSecurity:U?I.appSecurity:SS(I.appSecurity),active:I.active,createTime:I.createTime,updateTime:I.updateTime}))})}async function cl($,Y){let z=E1($),U=Y.reveal===!0;if(z.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${z.name}」(id:${z.id})为原生Seal(${z.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);c0({provider:"hose",capability:"privilege-elevation",corpId:Y.corpId,corpName:Y.corpName??Y.corpId,baseUrl:Y.baseUrl,staffId:Y.staffId,keyCount:Y.keys.length,keys:Y.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:z?Q.appSecurity:SS(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function cl($,U){let Y=E1($),z=U.reveal===!0;if(Y.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${Y.name}」(id:${Y.id})为原生Seal(${Y.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);c0({provider:"hose",capability:"privilege-elevation",corpId:z.id,corpName:z.name,domain:z.source.domain,staffId:z.source.staffId,appKey:I??"-",appSecurity:Q?U?Q:SS(Q):"-",active:!0})}function $h0($,Y){let{token:z,sealUrl:U,expiresIn:I,verify:Q,remote:J}=Y,K=Y.custom??tv0($),G=J?.user,H=J?.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:U,tenantSlug:W,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:z,sealUrl:U,expiresIn:I,staffId:V,corpId:M,tenantId:X,tenantSlug:W,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},O=$p();lv0(O,{recursive:!0,mode:448});let D=rv0(O,`${VT(q)}.json`);if(mv0(D)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${D}.Pass"overwrite":truetoreplaceit.`);ov0(D,`${JSON.stringify(w,null,2)}
`,{mode:384}),c0({id:q,name:w.name,tenantId:X,tenantSlug:W,verified:Q,path:D})}async function mS1($,Y,z={}){let U=T8($,Y,z),I=await W8(U);return{user:I.user??{},tenant:I.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var nl=o(()=>{a9();BH();i8();S3();fv0();bP();tn();X6();X6();ul();SZ();ET();o4();L$();D4();Q4()});async function zh0($,Y){let z=$??S(Y.options.link)??S(Y.options.url);if(!z)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let U=V0(Y.options.reveal)===!0||V0(Y.options.r)===!0||V0(Y.options.plain)===!0,I=V0(Y.options.save)===!0||V0(Y.options.add)===!0;await CT(z,{reveal:U,save:I,name:S(Y.options.name),overwrite:V0(Y.options.overwrite)===!0,force:V0(Y.options.force)===!0,appKey:S(Y.options["app-key"])??S(Y.options.appKey),keyId:S(Y.options["key-id"])??S(Y.options.keyId)})}async function Uh0($,Y,z){if($==="diagnose"){c0(await lS1(Y));return}if($==="hose-link"){let U=z.options.expire,I=U!==void 0?s0(U):7200;if(I===void 0||I<=0)throw Error(`Invalid--expire:${String(U)}.Mustbeapositivenumberofseconds(e.g.--expire7200or--expire86400).`);let Q=V0(z.options.force)===!0||V0(z.options.refresh)===!0||V0(z.options.f)===!0;c0(await P00(Y,I,{force:Q}));return}if($==="keys"){let U=V0(z.options.reveal)===!0||V0(z.options.r)===!0||V0(z.options.plain)===!0;await cl(Y.id,{reveal:U});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function lS1($){if($.source.type!=="hose"){let F=await j1($),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,z=Y.appKey??Y.key,U=Y.appSecurity??Y.password,I=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),Q=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,J=[];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 RT("hose.openapi",async()=>{let F=await Yh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:z,appSecurity:U}),M=d3(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(d3(M.corporation).id),expireTime:Bq(M.expireTime)}}});J.push(K.public);let G=K.private?.token,H=G?await RT("hose.provisional",async()=>{let F=await Yh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:Q,pageType:"home",expireDate:7200}),M=b6(d3(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:Q,enterpriseUrl:Oq(M)}}}):pl("hose.provisional");J.push(H.public);let W=A6($.seal),X=H.private?.token,Z=X?await RT("seal.sso",async()=>{let M=await T8(I,void 0,W).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=d3(M.data),O=b6(M.token)??b6(M.accessToken)??b6(w.token)??b6(w.accessToken);if(!O)throw Error("Seal SSO did not return a bearer token");return{token:O,public:{sealUrl:I,expiresIn:Bq(M.expiresIn)??Bq(M.expires_in)??Bq(w.expiresIn)??Bq(w.expires_in)}}}):pl("seal.sso");J.push(Z.public);let q=Z.private?.token,V=q?await RT("seal.whoami",async()=>{let M=await T8(I,q,W).get("api/v1/auth/me").json(),w=d3(M.data),O=d3(w.user??M.user),D=d3(w.tenant??M.tenant);return{public:{user:{id:b6(O.id),name:b6(O.name),isAdmin:rS1(O.isAdmin),providerUserId:b6(O.providerUserId)},tenant:{id:b6(D.id),name:b6(D.name),tenantSlug:b6(D.tenantSlug),hoseCorpConfig:sS1(D.hoseCorpConfig)}}}}):pl("seal.whoami");return J.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:J.every((F)=>F.ok===!0),stages:J}}async function RT($,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:Oq(z instanceof Error?z.message:String(z))}}}}function pl($){return{public:{name:$,ok:!1,skipped:!0}}}async function Yh0($,Y){let z=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});return oS1(z)}async function oS1($){let Y=await $.text();if(!$.ok)throw Error(`${$.status} ${Y}`);let z=JSON.parse(Y);return d3(z)}function d3($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function b6($){return typeof $==="string"&&$?$:void 0}function Bq($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function rS1($){return typeof $==="boolean"?$:void 0}function sS1($){let Y=d3($);return Ih0({corporationId:b6(Y.corporationId),corporationName:b6(Y.corporationName)})}f
Line truncated
`);c0({provider:"hose",capability:"privilege-elevation",corpId:Y.id,corpName:Y.name,domain:Y.source.domain,staffId:Y.source.staffId,appKey:Q??"-",appSecurity:J?z?J:SS(J):"-",active:!0})}function $h0($,U){let{token:Y,sealUrl:z,expiresIn:Q,verify:J,remote:I}=U,K=U.custom??tv0($),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),O=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:Y,sealUrl:z,expiresIn:Q,staffId:V,corpId:O,tenantId:X,tenantSlug:W,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},M=$p();lv0(M,{recursive:!0,mode:448});let N=rv0(M,`${VT(q)}.json`);if(mv0(N)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${N}.Pass"overwrite":truetoreplaceit.`);ov0(N,`${JSON.stringify(w,null,2)}
`,{mode:384}),c0({id:q,name:w.name,tenantId:X,tenantSlug:W,verified:J,path:N})}async function lS1($,U,Y={}){let z=T8($,U,Y),Q=await W8(z);return{user:Q.user??{},tenant:Q.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var nl=o(()=>{a9();BH();i8();S3();fv0();bP();tn();X6();X6();ul();SZ();ET();o4();L$();D4();J4()});async function Yh0($,U){let Y=$??S(U.options.link)??S(U.options.url);if(!Y)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let z=V0(U.options.reveal)===!0||V0(U.options.r)===!0||V0(U.options.plain)===!0,Q=V0(U.options.save)===!0||V0(U.options.add)===!0;await CT(Y,{reveal:z,save:Q,name:S(U.options.name),overwrite:V0(U.options.overwrite)===!0,force:V0(U.options.force)===!0,appKey:S(U.options["app-key"])??S(U.options.appKey),keyId:S(U.options["key-id"])??S(U.options.keyId)})}async function zh0($,U,Y){if($==="diagnose"){c0(await oS1(U));return}if($==="hose-link"){let z=Y.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=V0(Y.options.force)===!0||V0(Y.options.refresh)===!0||V0(Y.options.f)===!0;c0(await P00(U,Q,{force:J}));return}if($==="keys"){let z=V0(Y.options.reveal)===!0||V0(Y.options.r)===!0||V0(Y.options.plain)===!0;await cl(U.id,{reveal:z});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function oS1($){if($.source.type!=="hose"){let F=await j1($),O=await W8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:O.user,tenant:O.tenant}]}}aw($.id);let U=$.source,Y=U.appKey??U.key,z=U.appSecurity??U.password,Q=($.seal.url??U.sealUrl??`https://${U.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=U.staffId.includes(":")?U.staffId:`${U.corpId}:${U.staffId}`,I=[];if(!Y||!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 RT("hose.openapi",async()=>{let F=await Uh0(`${U.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:Y,appSecurity:z}),O=d3(F.value),w=b6(O.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(O.corporationId)??b6(d3(O.corporation).id),expireTime:Bq(O.expireTime)}}});I.push(K.public);let G=K.private?.token,H=G?await RT("hose.provisional",async()=>{let F=await Uh0(`${U.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),O=b6(d3(F.value).message);if(!O)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(O).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:J,enterpriseUrl:Mq(O)}}}):pl("hose.provisional");I.push(H.public);let W=A6($.seal),X=H.private?.token,Z=X?await RT("seal.sso",async()=>{let O=await T8(Q,void 0,W).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=d3(O.data),M=b6(O.token)??b6(O.accessToken)??b6(w.token)??b6(w.accessToken);if(!M)throw Error("Seal SSO did not return a bearer token");return{token:M,public:{sealUrl:Q,expiresIn:Bq(O.expiresIn)??Bq(O.expires_in)??Bq(w.expiresIn)??Bq(w.expires_in)}}}):pl("seal.sso");I.push(Z.public);let q=Z.private?.token,V=q?await RT("seal.whoami",async()=>{let O=await T8(Q,q,W).get("api/v1/auth/me").json(),w=d3(O.data),M=d3(w.user??O.user),N=d3(w.tenant??O.tenant);return{public:{user:{id:b6(M.id),name:b6(M.name),isAdmin:sS1(M.isAdmin),providerUserId:b6(M.providerUserId)},tenant:{id:b6(N.id),name:b6(N.name),tenantSlug:b6(N.tenantSlug),hoseCorpConfig:aS1(N.hoseCorpConfig)}}}}):pl("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 RT($,U){try{let Y=await U();return{public:{name:$,ok:!0,...Qh0(Y.public)},private:Y.token?{token:Y.token}:void 0}}catch(Y){return{public:{name:$,ok:!1,error:Mq(Y instanceof Error?Y.message:String(Y))}}}}function pl($){return{public:{name:$,ok:!1,skipped:!0}}}async function Uh0($,U){let Y=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(U)});return rS1(Y)}async function rS1($){let U=await $.text();if(!$.ok)throw Error(`${$.status} ${U}`);let Y=JSON.parse(U);return d3(Y)}function d3($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function b6($){return typeof $==="string"&&$?$:void 0}function Bq($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function sS1($){return typeof $==="boolean"?$:void 0}function aS1($){let U=d3($);return Qh0({corporationId:b6(U.corporationId),corporationName:b6(U.corporationName)})}f
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${I.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${I.id}
`),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 审批",O=V.signKey,w=V.apiOrigin??"production";console.error(`•"${F}"(signKey:${O},环境:${w})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${O}--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."
@@ -1496,7 +1501,9 @@ Do not automatically rerun or resubmit the customer's production document. Run a
description:"v0.10.30: 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.31: 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."
**TheCLIistheprimarypath;theMCPserverisanoptionalextrathatisoffbydefault.**Prefertheglobal\`seal-use\` CLI, and only use MCP when it is actually available in the current session. If no \`seal_cli*\` tool is present, that is the normal default — do not try to enable it or treat it as a fault; just use the CLI. Enabling it is the user's choice in the plugin settings (插件配置中的「启用 MCP 服务」,默认关闭,打开后需重连该插件的 MCP 服务).
-\`seal_cli\` — **read-only only.** Reads tenant state without changing it. It is annotated \`readOnlyHint: true\`, so clients may auto-approve it.
-\`seal_cli_write\` — everything that mutates tenant state, publishes configuration, mints credentials, self-updates or starts a server. Annotated \`destructiveHint: true\`; **confirm the exact command with the user before calling it.**
Theboundaryisenforced,notmerelyadvertised:\`seal_cli\` refuses any command that is not on its read-only allow-list, and unclassified commands fail closed. A refusal names \`seal_cli_write\` as the follow-up. \`seal-use tool <name>\` is allowed through \`seal_cli\` only for tools the registry classifies as read-only (\`SEAL_READ_ONLY_TOOLS\`); the rest need \`seal_cli_write\`.
-关键字智能搜索(支持同音字/拼音/简拼/容错):\`seal-use corps search <keyword>\`
-常用企业列表(默认展示7天使用频次最高的10家):\`seal-use corps list\`
-查看企业详情(富属性安全脱敏查看):\`seal-use corps get <corpId>\`
-TreatCLI/MCPastheAgent's execution channel, not the user'sinterface.Translatenatural-languageintentintocommandsyourself;neverasktheusertocomposeCLIsyntax,JSONpayloads,placeholdervalues,orinternalIDs.
-Beforeaskingforenterpriseparameters,resolvethetargetenterprise:whenanenterpriseisnamed,hinted,orkeyword-identifiable,ALWAYSrun\`seal-use corps search <keyword>\` (or \`seal-use corps get <corpId>\` if an exact ID is known) — DO NOT dump the entire enterprise catalog with \`seal-use corps list\` when the target is already known. Only run \`seal-use corps list\` (or \`corps list --env <test|production>\`) for initial discovery when zero enterprise context is known. Resolve its human name to the returned \`id\` and pass that value as \`--corp\`; do not ask the user to know \`corpId\`. Use \`seal-use corps get <corpId>\` to inspect rich enterprise attributes (URLs, tenant slugs, staff IDs, environment relations, and config file locations) with sensitive secrets safely redacted.
-Ifnoenterpriseisconfigured,theuserisinstallingforthefirsttime,ortheuserprovidescredentials,anassistancelink,orabrowser-copiedcURL,read\`references/first-time-user.md\` for the plain-language, screenshot-based path first, then read \`references/enterprise-onboarding.md\` before asking questions or running setup commands.
-WhentheuserprovidesaHose/合思\`thirdparty.html\` assistance link, use \`seal-use corps add-link <url> [--name ...]\` for temporary session access, or elevate privileges to permanent developer credentials using \`seal-use corps extract-keys <url> --save\` (or \`seal-use corps add-link <url> --as-hose\`). This Hose-exclusive capability extracts \`appKey\`/\`appSecurity\`. If the enterprise has multiple keys, specify \`--app-key <key>\` or \`--key-id <id>\`.
-**同等凭据原则(EqualCredentialScopePrinciple)**:AHoseassistancelinkandacURLcopiedfromanauthenticated**Hoseadmin**pagearebothHosewebfrontendsessions—structurallydifferentinformatonly,carryingthesame\`accesstoken\`/\`corpid\` web session credentials. **When a Hose administrator provides a browser cURL, do NOT silently downgrade it to a plain short-lived session import.** Attempt privilege elevation first by extracting \`accesstoken\`+\`corpid\`+\`baseUrl\` from the cURL and invoking the Hose key interface (\`/api/innerapi/v1/key\`) to retrieve permanent \`appKey\`/\`appSecurity\`. Only fall back to temporary session import if the user is not a Hose administrator or the key interface returns no keys.
-Keepenterpriseidentityoriginseparatefromcredentialacquisition.AHose/合思-sourcedSealtenantcanbeaccessedwithstandardHoseappcredentials,anassistancelink,oracapturedwebsession;receivingaSealBearertokendoesnotbyitselfprovethetenantisSeal-native.Callingkeyextractionor\`keys\` on native Seal enterprises is strictly blocked.
-Neveraskanormaluserfor\`corpId\`, \`staffId\`, \`proxyStaffBizId\`, \`tenantId\`, or another discoverable internal ID. Discover it first. If discovery fails, explain what the field means, why it could not be discovered, and exactly where the user can find it.
-Prefercompactcommandsfirst:\`pick\`, \`--summary\`, \`--fields\`, \`attachments --summary\`, \`rules count\`, and \`rules list --summary\`.
-ParseJSONstdout.Donotscrapehumantext.
-Donothand-editenterpriseconfigsfornormalsetup.Use\`seal-use corps ...\`.
-Beforewriteoperationsonrules,documents,stylepreferences,orpublishing,fetchcurrentstateandconfirmtheintendedmutationwiththeuser.Forsupportedconfigurationwrites,prefertheuniversal\`--dry-run\` preview first (rules clear/push, \`corps sync-test\`, preference updates, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use \`--yes\` only after reviewing its redacted \`changesDiff\`.
-Knowledgedocumentcreationanddeletionarenowsupported.Validate\`contentType\` and \`scenarios\` before creating; use \`enabled: false\` when the document should be withdrawn without deletion. For an explicit deletion, re-read the document and obtain confirmation before using the low-level \`seal_approval_delete_document\` tool.
-Forcustomer-feedbackruleremediation,showanexactfield-leveldiffandobtainexplicitapprovalbeforeupdating.Defaulttochangingonlythenarrowestnecessarypartof\`description\`; preserve \`scope\`, \`strictness\`, and unrelated clauses unless the user explicitly approves otherwise. Always follow the Presentation & Report Contract in \`references/customer-feedback-rule-remediation.md\`: hide internal UUIDs, use standard business terms (适用场景, 遵守程度), present unmodified fields cleanly without colloquial fluff, format description changes as standard Git Diff, and avoid repeating full report text in chat context once structured HTML/PDF artifacts are delivered (guide users to external browsers/viewers instead).
-Resolveandlockthetargetenterprise\`corpId\` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
-Ifoutputmaybelarge,use\`--summary\`, \`--fields\`, \`--count\`, or \`--output-file\`; use \`--full\` only when the user really needs full payloads.
-WhenreturningANYauthorization,login,ordelegationlinks(e.g.合思授权链接,Seal授权链接/委托链接),ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
-Fordelegationlinks,alwaysprefer\`seal-use delegation create\` over \`users delegation\` for link generation to ensure persistent token tracking.
-Alwaysdefaulttoreturningthecleandeeplink(\`type: 'deep_link'\`), which contains no credentials and requires no sensitive access. Users in their authorized browsers open it directly with zero token leakage risk.
-ONLYprovideanSSOlink(\`--sso\`) when the user explicitly requests an unauthenticated/cross-browser/no-login/免密 link and acknowledges risks.
2.ProvideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) and a clickable hyperlink.
-Inthedefaultstatelessmode,everyenterprisecommandrequires\`--corp <corpId>\`. In stateful mode, omitting \`--corp\` uses the configured default enterprise and is unsafe for an explicitly named enterprise.
-Foranexplicitlynamedenterprise,resolveitdirectlywith\`seal-use corps search <name>\` (or \`seal-use corps get <corpId>\` if given an exact ID) rather than dumping all enterprises with \`seal-use corps list\`. Then pass its exact \`corpId\` to every command. After creation, verify the returned URL host matches that enterprise's Seal tenant; if the host is the current/default tenant or cannot be verified, do not present the link as the target enterprise's link.
-生产规则安全演进、搭配配置与测试模拟闭环:read\`references/staging-simulation-workflow.md\`. 适用于:用户提出规则变更需求/客诉修复、生产与测试企业搭配接入与 1 对 1 绑定、生产环境仅改草稿隔离风险、\`seal-use corps sync-test\` 一键同步测试环境(含合思集成免配同步)、测试靶场运行自动化规则回归测试矩阵(\`test regression\`)或真实单据模拟验证、验证通过后才在生产正式发布的完整安全生命周期。
-Firstinstall/zeroconfiguration/“howdoIconnectmyenterprise?”/usersuppliesappcredentials,anassistancelink,orF12/NetworkcURL:read\`references/first-time-user.md\` and \`references/enterprise-onboarding.md\`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
-User-facingSealtenantassistancelink(Seal协助/Seal授权/委托):resolvethenamedenterprisefirst,thenrun\`seal-use delegation create --corp <corpId> --note '<enterprise>'\`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (\`\`\`\`text ... \`\`\`\`) AND a hyperlink.
-Packagedcustomerfeedback→approval-ruleremediation:read\`references/customer-feedback-rule-remediation.md\`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
-自动化规则回归测试矩阵(AutomatedRuleRegressionTestMatrix):\`seal-use test regression [--corp <corpId>] [--samples <N>] [--dry-run] [--fail-on-flips] [--prod-corp <id>] [--test-corp <id>]\` (快捷别名 \`seal-use corps regression\`)。采样生产企业历史已完成单据,通过出站 HTTPS 轮询重放到配对测试靶场执行 AI 审核并对比双端决策,计算一致率(Concordance Rate),识别决策翻转(Decision Flips),给出 \`safeToPublish\` 综合判定。硬性红线:目标环境必须为测试企业且测试点数余额充足,严禁在纯生产环境发起。
-User-facing合思authorizationlink(合思/易快报授权):\`seal-use auth hose-link --corp <corpId> [--expire <seconds>] [--force]\`; read \`references/hose-enterprise-auth.md\`. Never use this route when the user says Seal 协助. 凭证独立生成且不污染本地会话。Always provide BOTH a code block (\`\`\`\`text ... \`\`\`\`) AND a hyperlink.
-Delegationlinksmanagement(【Seal审核后台】委托授权链接):\`seal-use delegation list --corp <corpId>\`, \`create [--note ...] --corp <corpId>\`, \`create --from-link <url> [--note ...]\`, \`revoke <tokenId> --corp <corpId>\`. 注意:此处管理 Seal AI 智能审核后台的委托令牌,不包含合思主站免密链接(后者走 \`auth hose-link\`,不可在 \`delegation list\` 中查询)。
Rule,document,stylepreference,andpublishactionsmutateSealconfiguration.Makethetargetenterpriseexplicit,showtheintendedpayload,andverifyafterthewrite.Neversendreal\`enterprises/*.json\` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
`;var rh0=()=>{};var qg1="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 rl($){let Y=$?.targetSkillsDir??$S0(),z=$?.configFile??YS0(),U=zS0(),I=!1;if(Tq(z))try{let Q=JSON.parse(eh0(z,"utf8"));if(Array.isArray(Q?.entries))I=Q.entries.some((J)=>J?.path===Y)}catch{}return{detected:U,configured:I,configPath:z,targetDir:Y}}var sl=()=>{};import{cpSync as Dg1,existsSync as kK,lstatSync as IS0,mkdirSync as Ag1,realpathSync as a2,rmSync as Pg1,symlinkSync as Bg1,unlinkSync as US0}from"node:fs";import{homedir as QS0}from"node:os";import{dirname as JS0,join as t2}from"node:path";function Tg1($,Y){let z=Y?.baseHomeDir??QS0(),U=t2(z,$.rootDirName),I=Y?.sourceSkillDir??t2(z,".agents","skills","seal-use"),Q=JS0(I),J=t2(U,"skills"),K=t2(J,"seal-use");if(!kK(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(kK(J)&&kK(Q))try{if(a2(J)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:J}}catch{}Ag1(J,{recursive:!0});let G;try{G=IS0(K)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(a2(K)===a2(I))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:K}}catch{}try{US0(K)}catch{}}else if(G.isDirectory())Pg1(K,{recursive:!0,force:!0}),H=!0;else US0(K);let W=process.platform==="win32"?"junction":"dir";try{return Bg1(I,K,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:K}}catch{try{return Dg1(I,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 jg1($,Y){let z=Y?.baseHomeDir??QS0(),U=t2(z,$.rootDirName),I=Y?.sourceSkillDir??t2(z,".agents","skills","seal-use"),Q=JS0(I),J=t2(U,"skills"),K=t2(J,"seal-use");if(!kK(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(kK(J)&&kK(Q))try{if(a2(J)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:J}}catch{}let G;try{G=IS0(K)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(a2(K)===a2(I))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 al($){return KS0.map((Y)=>Tg1(Y,$))}function tl($){return KS0.map((Y)=>jg1(Y,$))}var KS0;var el=o(()=>{KS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var $o=o(()=>{sl();el();sl();el()});import{existsSync as Eg1,mkdirSync as Yo,readFileSync as Cg1,rmSync as Rg1,writeFileSync as GS0}from"node:fs";import{homedir as WS0}from"node:os";import{dirname as HS0,join as Eq}from"node:path";function zo(){return XS0["SKILL.md"]||""}function ZS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function qS0($=Eq(gU(),"SKILL.md")){try{return ZS0(Cg1($,"utf8"))}catch{return}}function gU(){return Eq(WS0(),".agents","skills","seal-use")}function vg1(){return Eq(WS0(),".agents","skills","seal-home")}function hg1(){let $=vg1();if(Eg1($))try{return Rg1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function VS0($=gU()){hg1(),Yo($,{recursive:!0});let Y=[];for(let[z,U]of Object.entries(XS0)){let I=Eq($,z);Yo(HS0(I),{recursive:!0}),GS0(I,U,"utf8"),Y.push(z)}for(let[z,U]of Object.entries(_g1)){let I=Eq($,z);Yo(HS0(I),{recursive:!0}),GS0(I,U),Y.push(z)}return{targetDir:$,files:Y}}var XS0,_g1,D24;var Cq=o(()=>{dl();dl();$o();XS0=ah0,_g1=Object.fromEntries(Object.entries(th0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));D24=ZS0(zo())});function LS0(){return`#SealUse系统架构与运行规范白皮书
`;var rh0=()=>{};var Vg1="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:Y,targetDir:U,action:"prepended"}}function rl($){let U=$?.targetSkillsDir??$S0(),Y=$?.configFile??US0(),z=YS0(),Q=!1;if(Tq(Y))try{let J=JSON.parse(eh0(Y,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((I)=>I?.path===U)}catch{}return{detected:z,configured:Q,configPath:Y,targetDir:U}}var sl=()=>{};import{cpSync as Ag1,existsSync as kK,lstatSync as QS0,mkdirSync as Pg1,realpathSync as a2,rmSync as Bg1,symlinkSync as Tg1,unlinkSync as zS0}from"node:fs";import{homedir as JS0}from"node:os";import{dirname as IS0,join as t2}from"node:path";function jg1($,U){let Y=U?.baseHomeDir??JS0(),z=t2(Y,$.rootDirName),Q=U?.sourceSkillDir??t2(Y,".agents","skills","seal-use"),J=IS0(Q),I=t2(z,"skills"),K=t2(I,"seal-use");if(!kK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(kK(I)&&kK(J))try{if(a2(I)===a2(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}Pg1(I,{recursive:!0});let G;try{G=QS0(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{zS0(K)}catch{}}else if(G.isDirectory())Bg1(K,{recursive:!0,force:!0}),H=!0;else zS0(K);let W=process.platform==="win32"?"junction":"dir";try{return Tg1(Q,K,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:K}}catch{try{return Ag1(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 Eg1($,U){let Y=U?.baseHomeDir??JS0(),z=t2(Y,$.rootDirName),Q=U?.sourceSkillDir??t2(Y,".agents","skills","seal-use"),J=IS0(Q),I=t2(z,"skills"),K=t2(I,"seal-use");if(!kK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(kK(I)&&kK(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=QS0(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 al($){return KS0.map((U)=>jg1(U,$))}function tl($){return KS0.map((U)=>Eg1(U,$))}var KS0;var el=o(()=>{KS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var $o=o(()=>{sl();el();sl();el()});import{existsSync as Cg1,mkdirSync as Uo,readFileSync as Rg1,rmSync as _g1,writeFileSync as GS0}from"node:fs";import{homedir as WS0}from"node:os";import{dirname as HS0,join as Eq}from"node:path";function Yo(){return XS0["SKILL.md"]||""}function ZS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function qS0($=Eq(gz(),"SKILL.md")){try{return ZS0(Rg1($,"utf8"))}catch{return}}function gz(){return Eq(WS0(),".agents","skills","seal-use")}function hg1(){return Eq(WS0(),".agents","skills","seal-home")}function Sg1(){let $=hg1();if(Cg1($))try{return _g1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function VS0($=gz()){Sg1(),Uo($,{recursive:!0});let U=[];for(let[Y,z]of Object.entries(XS0)){let Q=Eq($,Y);Uo(HS0(Q),{recursive:!0}),GS0(Q,z,"utf8"),U.push(Y)}for(let[Y,z]of Object.entries(vg1)){let Q=Eq($,Y);Uo(HS0(Q),{recursive:!0}),GS0(Q,z),U.push(Y)}return{targetDir:$,files:U}}var XS0,vg1,A24;var Cq=o(()=>{dl();dl();$o();XS0=ah0,vg1=Object.fromEntries(Object.entries(th0).map(([$,U])=>[$,Buffer.from(U,"base64")]));A24=ZS0(Yo())});function LS0(){return`#SealUse系统架构与运行规范白皮书
`)}var AS0=o(()=>{X6()});async function PS0($,Y,z){let U=($??Y??"").toLowerCase();if(U==="guide"||U==="doc"||U==="knowledge"||U==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(LS0());return}if(U==="paths"||U==="dirs"||U==="directories"){let J=Ko();c0(J.directories);return}if(U==="tenant"||U==="corp"||U==="enterprise"){let{selectCorp:J}=await Promise.resolve().then(() => (o4(),F_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),R00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),G_0)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (AS0(),DS0)),X=G(z.options.corp)??(Y&&Y!==U?Y:void 0)??(z.command[2]&&z.command[2]!==U?z.command[2]:void 0),Z=J(X),q=await K(Z),V=await H(q,Z);if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(W(V));c0(V);return}let I=Ko();if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(OS0(I));c0(I)}var BS0=o(()=>{NS0();Jo();D4();Q4()});var jS0;var TS0=o(()=>{jS0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.30",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 AS0=o(()=>{X6()});async function PS0($,U,Y){let z=($??U??"").toLowerCase();if(z==="guide"||z==="doc"||z==="knowledge"||z==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(LS0());return}if(z==="paths"||z==="dirs"||z==="directories"){let I=Ko();c0(I.directories);return}if(z==="tenant"||z==="corp"||z==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (o4(),F_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),R00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),G_0)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (AS0(),DS0)),X=G(Y.options.corp)??(U&&U!==z?U:void 0)??(Y.command[2]&&Y.command[2]!==z?Y.command[2]:void 0),Z=I(X),q=await K(Z),V=await H(q,Z);if(!(V0(Y.options.quiet)||V0(Y.options.silent)))console.error(W(V));c0(V);return}let Q=Ko();if(!(V0(Y.options.quiet)||V0(Y.options.silent)))console.error(MS0(Q));c0(Q)}var BS0=o(()=>{NS0();Io();D4();J4()});var jS0;var TS0=o(()=>{jS0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.31",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
`);I(U)})})}var gT=8787,yT="127.0.0.1";var Wo=o(()=>{vS0();t9()});async function hS0($){let Y=s0($.options.port)??s0($.options.p),z=S($.options.host)??S($.options.h),U=await kT({port:Y,host:z}),I=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",I),process.on("SIGTERM",I),await new Promise(()=>{})}var SS0=o(()=>{D4();Wo()});async function gS0($,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 yS0=o(()=>{o4();Q4()});async function kS0($,Y){if($==="config"||$==="json"){Xo();return}let{startServer:z}=await uS0().then(() => fS0);z()}function Xo(){c0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var xS0=o(()=>{Q4()});function bS0($){let Y=vT();c0(Y,{...C0($.options),allowFull:!0})}var iS0=o(()=>{Go();Q4()});async function cS0($,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 nS0=o(()=>{o4();Q4()});import{readFileSync as pS0}from"node:fs";async function dS0($,Y,z,U,I,Q,J){if(!$||$==="get"){await k0("seal_preference_get",I,Q,{},C0(J.options));return}if($==="decision"){if(Y==="update"||!Y){let K=S(J.options.input),G=K?JSON.parse(pS0(K,"utf8")):y8(J.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",I,Q,{...G,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=S(J.options.default)??S(J.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",I,Q,{defaultLevel:K,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}if(Y==="policies"){if(z==="list"||!z){await k0("seal_preference_thinking_depth_policies_list",I,Q,{},C0(J.options));return}if(z==="upsert"){let K=S(J.options.input),G=K?JSON.parse(pS0(K,"utf8")):y8(J.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",I,Q,{...G,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}if(z==="remove"||z==="delete"){let K=U??S(J.options.id)??S(J.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",I,Q,{policyId:K,dryRun:V0(J.options.dryRun)??V0(J.options["dry-run"])},C0(J.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var mS0=o(()=>{o4();D4();Q4()});async function lS0($={}){let Y=s8(),z=_4(),U=f2(Y,{stateful:z.stateful,defaultCorpId:z.defaultCorpId,corpId:$.corpId},h3());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let I=await yK(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(I,null,2));let Q=await j1(U),J=await MM(Q,{documentLimit:20,stylePreferencesEndpoint:U.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:J.rules.rules.length,hasPendingRuleDeletes:J.rules.hasPendingDeletes,documents:J.documents.articles.length,documentsTotal:J.documents.total,stylePreferences:J.stylePreferences.ok?"ok":`error:${J.stylePreferences.error}`},null,2))}var oS0=o(()=>{S3();i8();ET();X6()});async function rS0($,Y,z){let U=Y??S(z.options.corp)??($&&$!=="--corp"?$:void 0);await lS0({corpId:U})}var sS0=o(()=>{oS0();D4()});async function Zo($,Y,z,U,I){if($==="count"){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(I.options));return}if($==="list"){if(V0(I.options.count)){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(I.options));return}let Q=s0(I.options.limit),J=s0(I.options.offset);if(V0(I.options.summary)){await k0("seal_approval_rules_list",z,U,{fields:q_0,limit:Q,offset:J},C0(I.options));return}let K=await o2("seal_approval_rules_list",z,U,{limit:Q,offset:J});V_0(K,V0(I.options.full)===!0),c0(K);return}if($==="clear"){let Q=V0(I.options.yes)===!0,J=V0(I.options.dryRun)??V0(I.options["dry-run"])??!Q;if(!Q&&!J)throw D9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${U.id}--dry-run`);let K=await o2("seal_approval_rules_clear",z,U,{dryRun:J,recode:V0(I.options.recode)});if(!Q&&J&&K&&typeof K==="object"){c0({...K,
Line truncated
`).filter(Boolean),Q=I.slice(-Y);return{logFile:z,lines:Q,totalLines:I.length}}async function rg1($){let Y=bT($),z=Lo($),U=vq($);Yg0($.stateDir);let I=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):gT),Q=$.host??(process.env.HOST?process.env.HOST:yT);fT(Y,`${process.pid}
`,{mode:384}),fT(z,JSON.stringify({pid:process.pid,port:I,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),xK(U,`servicestartingonhttp://${Q}:${I} pid=${process.pid}`);let J=null;try{J=await kT({port:I,host:Q,silent:!0}),xK(U,`service listening pid=${process.pid}`)}catch(G){if(xK(U,`service failed to bind port ${I}: ${G instanceof Error?G.message:String(G)}`),uT(Y)===process.pid)v9(Y,{force:!0}),v9(z,{force:!0});throw G}let K=()=>{if(J)J.close(),J=null;if(uT(Y)===process.pid)v9(Y,{force:!0}),v9(z,{force:!0});xK(U,`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 tS0($){Yg0($.stateDir);let Y=fK($);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 I=dg1(z.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});I.unref();let Q=bT($);return fT(Q,`${I.pid}
`,{flag:"a",mode:384})}var Fo=o(()=>{Wo()});import{homedir as ag1}from"node:os";import{join as tg1}from"node:path";async function Mo($,Y,z){let U=z?s0(z.options.port)??s0(z.options.p):void 0,I=z?S(z.options.host)??S(z.options.h):void 0,Q=z?s0(z.options.lines)??s0(z.options.n):void 0,J=await yU($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:wo,version:P1,launcher:Y.launcher,port:U,host:I},{maxLines:Q});if(J!==void 0)c0(J)}var wo;var Oo=o(()=>{t9();Fo();Q4();D4();wo=tg1(ag1(),".config","seal-use")});import{existsSync as eg1,readFileSync as zg0}from"node:fs";async function Ug0($,Y,z,U,I){if($==="batch-records"||$==="records"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",z,U,{batchId:Q,query:S(I.options.query)},C0(I.options));return}if($==="create"||$==="run"){let Q=S(I.options.mode)??S(I.options.sourceSystem)??S(I.options["source-system"])??"hosecloud",J=Q==="material-pack"?"material_pack":Q,K=S(I.options.schemaConfig)??S(I.options["schema-config"]),G=K?JSON.parse(zg0(K,"utf8")):void 0,H=S(I.options.input),W=H?JSON.parse(zg0(H,"utf8")):y8(I.json),X=S(I.options.packageId)??S(I.options["package-id"]),Z=u6(I.options.packageIds)??u6(I.options["package-ids"])??(X?[X]:void 0),q=u6(I.options.flowIds)??u6(I.options["flow-ids"])??u6(I.options.documentSn)??u6(I.options["document-sn"]),V=S(I.options.signKey)??S(I.options["sign-key"])??S(I.options.integration),F=V0(I.options.noWait)??V0(I.options["no-wait"]);await k0("seal_simulation_batch_create",z,U,{mode:J,sourceSystem:J,flowIds:q,documentSn:q,rejectNodeName:S(I.options.rejectNode)??S(I.options["reject-node"])??null,thinkingDepthOverride:S(I.options.thinkingDepth)??S(I.options["thinking-depth"]),skipInvoiceGeneration:V0(I.options.skipInvoiceGeneration)??V0(I.options["skip-invoice-generation"]),skipExpenseExtraction:V0(I.options.skipExpenseExtraction)??V0(I.options["skip-expense-extraction"]),disableAttachmentCache:V0(I.options.disableAttachmentCache)??V0(I.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:S(I.options.templateId)??S(I.options["template-id"]),schemaConfig:G,requestIds:u6(I.options.requestIds)??u6(I.options["request-ids"]),workflowTypeId:S(I.options.workflowTypeId)??S(I.options["workflow-type-id"]),flowStatusList:u6(I.options.flowStatusList)?.map(Number)??u6(I.options["flow-status-list"])?.map(Number),businessCodes:u6(I.options.businessCodes)??u6(I.options["business-codes"]),documentType:S(I.options.documentType)??S(I.options["document-type"]),startTime:s0(I.options.startTime)??s0(I.options["start-time"]),endTime:s0(I.options.endTime)??s0(I.options["end-time"]),status:u6(I.options.status),limit:s0(I.options.limit),noWait:F,rawParams:W},C0(I.options));return}if($==="wait"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",z,U,{batchId:Q,timeout:S(I.options.timeout),pollInterval:S(I.options.pollInterval)??S(I.options["poll-interval"])},C0(I.options));return}if($==="status"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",z,U,{batchId:Q},C0(I.options));return}if($==="clean"||$==="delete"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",z,U,{batchId:Q},C0(I.options));return}if($==="specifications"){let Q=Y??S(I.options.integration)??S(I.options.signKey)??S(I.options["sign-key"]);await k0("seal_simulation_specifications_list",z,U,{signKey:Q},C0(I.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",z,U,{},C0(I.options));return}if($==="list"){await k0("seal_simulation_batches_list",z,U,{limit:s0(I.options.limit)},C0(I.options));return}if($==="get"){let Q=Y??S(I.options.batchId)??S(I.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",z,U,{batchId:Q},C0(I.options));return}if($==="templates"){await k0("seal_simulation_templates_get",z,U,{},C0(I.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",z,U,{},C0(I.options));return}if($==="package-upload"){let Q=Y??S(I.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!eg1(Q))throw Error(`Filenotfound:${Q}`);await k0("seal_simulation_material_package_upload",z,U,{filePath:Q},C0(I.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Ig0=o(()=>{o4();D4();Q4()});import{existsSync as Qg0}from"node:fs";import{join as iT}from"node:path";function Jg0($,Y,z){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${zoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let U=V0(z.options.local)||V0(z.options.workspace),I=S(z.options.dir)??S(z.options.target)??Y,Q=I?I:U?iT(process.cwd(),".agents","skills","seal-use"):gU(),J=VS0(Q),K=!U&&!I,G=K?ol():void 0,H=K?al():void 0;c0({installed:!0,targetDir:J.targetDir,fileCount:J.files.length,files:J.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let U=gU(),I=iT(process.cwd(),".agents","skills","seal-use"),Q=rl(),J=tl();c0({global:{dir:U,installed:Qg0(iT(U,"SKILL.md"))},local:{dir:I,installed:Qg0(iT(I,"SKILL.md"))},antigravity:Q,hosts:J});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Kg0=o(()=>{$o();Cq();D4();Q4()});async function Gg0($,Y){if($==="config"){c0(await yK(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Hg0=o(()=>{ET();Q4()});function No($){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 Wg0($){let{sourceCorp:Y,targetCorp:z,sourceClient:U,targetClient:I,samples:Q=10,dryRun:J=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=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 cY(I),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=Q*F;if(V<M)throw new w4(`测试企业「${z.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${Q}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${z.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await b4(U,{limit:Q,status:"completed"}),O=Array.isArray(w.records)?w.records:[];if(O.length===0){let d=await b4(U,{limit:Q});O=Array.isArray(d.records)?d.records:[]}if(O.length===0)throw new w4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(O=O.slice(0,Q),J){let d=O.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=No(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 D=await Jp(I,z),N=[];for(let d of O){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=No(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await H4(U,d.id),y=`${H}${$0}`,s=Ip(e,{snPrefix:H,docIdPrefix:H});await Qp(D.incomingDocumentWebhook.url,D.secret,s,W,A6(z.seal));let Y0=null,M0=Date.now();while(Date.now()-M0<G){await new Promise((W0)=>setTimeout(W0,K));let a=await b4(I,{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){N.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=No(Y0?.result?.decision??Y0.aiDecision??Y0?.decision??(Y0.status==="completed"?"APPROVE":"ERROR")),G0=Y0?.result?.summary??Y0.aiSummary,T0=g===E0,b0=T0?"MATCHED":"FLIPPED",Y1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:Y0.id,testDecision:E0,testSummary:G0,status:b0,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};N.push(Y1)}catch(e){N.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 B=N.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=N.filter((d)=>d.status==="MATCHED"),A=N.filter((d)=>d.status==="FLIPPED"),j=N.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,k=C+b,h=k>0?C/k:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",U0=!i&&j===0,x;try{let d=await cY(I),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")x=$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:x},metrics:{sampleCount:N.length,successCount:B.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(h.toFixed(4))},flips:A,records:N}}function Xg0($){let{sourceCorp:Y,targetCorp:z,verdict:U,safeToPublish:I,metrics:Q,quota:J,flips:K,records:G}=$,H=U==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":U==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${z.name}」`,`判定:${H}·准许发布:${I?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${Q.sampleCount}|一致通过:${Q.matchCount}|决策翻转:${Q.flipCount}|异常失败:${Q.failureCount}`,`一致率:${(Q.concordanceRate*100).toFixed(1)}%|消耗预估:${J.estimatedRequired}点(余量:${J.balanceBefore}${J.balanceAfter!==void0?` -> ${J.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(U==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% 吻合,无任
Line truncated
`)}var Zg0=o(()=>{L$();X6();SZ()});async function Do($,Y,z){let U=($??Y??"regression").toLowerCase();if(U==="regression"||U==="regress"||U==="matrix"){let I=S(z.options.corp)??(Y&&Y!==U?Y:void 0),Q=E1(I),J=Q,K=Q;if(Q.environment==="test"){K=Q;let O=S(z.options["prod-corp"])??S(z.options.prod)??Q.prodCorpId;if(!O)throw new w4(`测试企业「${Q.name}」(${Q.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${Q.id}`);J=E1(O)}else{J=Q;let O=S(z.options["test-corp"])??S(z.options.test)??Q.testCorpId;if(!O)throw new w4(`生产企业「${Q.name}」(${Q.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Q.id}<testCorpId>`);K=E1(O)}let G=await j1(J),H=await j1(K),W=s0(z.options.samples)??s0(z.options.limit)??s0(z.options.n)??10,X=V0(z.options["dry-run"]),Z=V0(z.options["fail-on-flips"]),q=s0(z.options["poll-interval"])??2000,V=s0(z.options.timeout)??45000,F=S(z.options["sn-prefix"])??"REG_",M=await Wg0({sourceCorp:J,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z});if(!(V0(z.options.quiet)||V0(z.options.silent)))console.error(Xg0(M));if(c0(M),Z&&!M.ok)throw new w4(`回归测试发现${M.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 qg0=o(()=>{L$();o4();D4();Q4();i8();Zg0()});async function Vg0($,Y,z,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,z,y8(U.json),C0(U.options))}var Lg0=o(()=>{o4();D4();Q4()});function Fg0(){c0(Vq.map(($)=>({name:$.name,description:$.description})))}var wg0=o(()=>{Fq();Q4()});function cT($=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 Mg0=o(()=>{Cq()});import{chmodSync as $y1,mkdirSync as Yy1,readdirSync as zy1,renameSync as Ao,rmSync as Uy1,unlinkSync as Ag0,writeFileSync as Og0}from"node:fs";import{basename as Iy1,dirname as Qy1,join as pT}from"node:path";import{spawnSync as uK}from"node:child_process";async function Bg0($,Y={}){let z={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:wo,version:P1,launcher:$.launcher},U=Y.repo||process.env[Jy1]?.trim()||process.env[Ky1]?.trim()||Pg0,I=Y.targetVersion?.trim(),Q=I&&I.toLowerCase()!=="latest"?I:void 0;if(Q){let N=Q.replace(/^v/,""),B=Cg0(N,P1);if(B<0)if(!xS&&Y.force);else{c0({updated:!1,currentVersion:P1,targetVersion:N,mode:cT()?"binary":"source",message:!xS?`Cannotdowngradeseal-usefromdevbuildv${P1}toreleasev${N}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${P1}toolderversionv${N}.Updatesmustbeforward-only.`});return}if(B===0&&!Y.force){c0({updated:!1,currentVersion:P1,targetVersion:N,mode:cT()?"binary":"source",message:`seal-useisalreadyatversionv${P1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let N=await Po(U,Y.limit??10);c0({currentVersion:P1,totalQueried:N.length,releases:N.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===P1,isNewer:hq(B.version,P1)}))});return}if(!cT()){if(Y.checkOnly){let B=await Po(U,30),T=B[0],A=T?.version??P1,j=B.find((k)=>k.version===P1),C=hq(A,P1),b=B.filter((k)=>hq(k.version,P1));c0({updated:!1,updateAvailable:C,currentVersion:P1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((k)=>({version:k.version,tagName:k.tagName,publishedAt:k.publishedAt,author:k.author,releaseNotes:k.notes,releaseUrl:k.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 N=fK(z).running;if(N)await yU("stop",z);try{Dg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(Dg0("bun",["install"],{cwd:$.appRoot}),N)await yU("start",z);c0({updated:!0,serviceRestarted:N,version:P1,mode:"source"});return}let J=Hy1(),K=Wy1(),G=await Po(U,30),H=Q?G.find((N)=>N.version===Q||N.tagName===Q||N.tagName===`v${Q}`)??await Ng0(U,Q):G[0]??await Ng0(U);if(!H){c0({updated:!1,currentVersion:P1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let W=H.version,X=G.find((N)=>N.version===P1),Z=hq(W,P1),q=Z||Boolean(Y.force),V=G.filter((N)=>hq(N.version,P1));if(Y.checkOnly){c0({updated:!1,updateAvailable:Z,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:V.length,pendingReleases:V.map((N)=>({version:N.version,tagName:N.tagName,publishedAt:N.publishedAt,author:N.author,releaseNotes:N.notes,releaseUrl:N.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!q){c0({updated:!1,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${P1})`});return}let F=Zy1(H.assets,J,K);if(!F)throw Error(`Nocompatiblebinaryfoundfor${J}-${K}inreleasev${W}.Availableassets:${H.assets.map((N)=>N.name).join(", ")}`);let M=fK(z).running;if(M)await yU("stop",z);let w=process.execPath,O=Qy1(w),D=pT(O,`.tmp-update-${Date.now()}`);Yy1(D,{recursive:!0});try{let N=pT(D,F.name);await qy1(F.downloadUrl,N,H.tagName,F.name);let B=N;if(F.name.endsWith(".tar.gz")||F.name.endsWith(".tgz"))B=Vy1(N,D,J);else if(F.name.endsWith(".zip"))B=Ly1(N,D,J);if($y1(B,493),process.platform==="darwin")try{uK("/usr/bin/codesign",["--remove-signature",B],{stdio:"ignore"}),uK("/usr/bin/codesign",["--force","--sign","-",B],{stdio:"ignore"})}catch{}if(process.platform==="win32"){let A=`${w}.old.${Date.now()}`;try{Ao(w,A)}catch{}Ao(B,w)}else Ao(B,w);if(M)await yU("start",z);let T=Gy1(w,W);c0({updated:!0,fromVersion:P1,toVersion:W,serviceRestarted:M,skillSynced:T.targetDir??!1,skillVersion:T.version??!1,mode:"binary"})}finally{try{Uy1(D,{recursive:!0,force:!0})}catch{}}}function
Line truncated
`)}catch{}}async function qy1($,Y,z,U){let I=Bo(),Q=[],J=z?z.startsWith("v")?z:`v${z}`:void 0,K=U||$.split("/").pop()||"";if(I!=="github"){if(J&&K)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${J}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${J}/${K}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(I!=="gitea")if(J&&K){let F=`https://github.com/${Pg0}/releases/download/${J}/${K}`;if(!process.env.CI)Q.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);Q.push(F)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let G=Array.from(new Set(Q)),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,O="",D=(A)=>{O=A;try{w.abort()}catch{}},N=setTimeout(()=>{D("Connection timed out (no response headers within 6s)")},W),B,T;try{nT(`==> [${F+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:w.signal});if(N)clearTimeout(N),N=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);B=setTimeout(()=>{D("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)`);Og0(Y,c),nT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],k=0,h=0;T=setTimeout(()=>{if(k<Z){let c=(k/1024).toFixed(1);D(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),U0,x=new Promise((g,p)=>{U0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,x])}finally{if(U0)clearTimeout(U0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),k+=$0.length,T&&k>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-h>200){h=g;let p=j?Math.round(k/j*100):0,e=(k/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(z)})})}var gT=8787,yT="127.0.0.1";var Wo=o(()=>{vS0();t9()});async function hS0($){let U=s0($.options.port)??s0($.options.p),Y=S($.options.host)??S($.options.h),z=await kT({port:U,host:Y}),Q=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var SS0=o(()=>{D4();Wo()});async function gS0($,U,Y,z){if($==="config"||$==="get"){await k0("seal_llm_config_get",U,Y,{},C0(z.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",U,Y,{},C0(z.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var yS0=o(()=>{o4();J4()});async function kS0($,U){if($==="config"||$==="json"){Xo();return}let{startServer:Y}=await uS0().then(() => fS0);Y()}function Xo(){c0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var xS0=o(()=>{J4()});function bS0($){let U=vT();c0(U,{...C0($.options),allowFull:!0})}var iS0=o(()=>{Go();J4()});async function cS0($,U,Y,z){if($==="available"){await k0("seal_permissions_available_list",U,Y,{},C0(z.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",U,Y,{},C0(z.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var nS0=o(()=>{o4();J4()});import{readFileSync as pS0}from"node:fs";async function dS0($,U,Y,z,Q,J,I){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},C0(I.options));return}if($==="decision"){if(U==="update"||!U){let K=S(I.options.input),G=K?JSON.parse(pS0(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:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(U==="set"){let K=S(I.options.default)??S(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:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}if(U==="policies"){if(Y==="list"||!Y){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},C0(I.options));return}if(Y==="upsert"){let K=S(I.options.input),G=K?JSON.parse(pS0(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:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}if(Y==="remove"||Y==="delete"){let K=z??S(I.options.id)??S(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:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var mS0=o(()=>{o4();D4();J4()});async function lS0($={}){let U=s8(),Y=_4(),z=f2(U,{stateful:Y.stateful,defaultCorpId:Y.defaultCorpId,corpId:$.corpId},h3());console.log(`[probe]corp=${z.id}source=${z.source.type}`);let Q=await yK(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await j1(z),I=await OO(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 oS0=o(()=>{S3();i8();ET();X6()});async function rS0($,U,Y){let z=U??S(Y.options.corp)??($&&$!=="--corp"?$:void 0);await lS0({corpId:z})}var sS0=o(()=>{oS0();D4()});async function Zo($,U,Y,z,Q){if($==="count"){await k0("seal_approval_rules_list",Y,z,{countOnly:!0},C0(Q.options));return}if($==="list"){if(V0(Q.options.count)){await k0("seal_approval_rules_list",Y,z,{countOnly:!0},C0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(V0(Q.options.summary)){await k0("seal_approval_rules_list",Y,z,{fields:q_0,limit:J,offset:I},C0(Q.options));return}let K=await o2("seal_approval_rules_list",Y,z,{limit:J,offset:I});V_0(K,V0(Q.options.full)===!0),c0(K);return}if($==="clear"){let J=V0(Q.options.yes)===!0,I=V0(Q.options.dryRun)??V0(Q.options["dry-run"])??!J;if(!J&&!I)throw D9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${z.id}--dry-run`);let K=await o2("seal_approval_rules_clear",Y,z,{dryRun:I,recode:V0(Q.options.recode)});if(!J&&I&&K&&typeof K==="object"){c0({...K,
Line truncated
`).filter(Boolean),J=Q.slice(-U);return{logFile:Y,lines:J,totalLines:Q.length}}async function sg1($){let U=bT($),Y=Lo($),z=vq($);Ug0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):gT),J=$.host??(process.env.HOST?process.env.HOST:yT);fT(U,`${process.pid}
`,{mode:384}),fT(Y,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),xK(z,`servicestartingonhttp://${J}:${Q} pid=${process.pid}`);let I=null;try{I=await kT({port:Q,host:J,silent:!0}),xK(z,`service listening pid=${process.pid}`)}catch(G){if(xK(z,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),uT(U)===process.pid)v9(U,{force:!0}),v9(Y,{force:!0});throw G}let K=()=>{if(I)I.close(),I=null;if(uT(U)===process.pid)v9(U,{force:!0}),v9(Y,{force:!0});xK(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 tS0($){Ug0($.stateDir);let U=fK($);if(U.running)return U;let Y=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...Y.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let Q=mg1(Y.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=bT($);return fT(J,`${Q.pid}
`,{flag:"a",mode:384})}var Fo=o(()=>{Wo()});import{homedir as tg1}from"node:os";import{join as eg1}from"node:path";async function Oo($,U,Y){let z=Y?s0(Y.options.port)??s0(Y.options.p):void 0,Q=Y?S(Y.options.host)??S(Y.options.h):void 0,J=Y?s0(Y.options.lines)??s0(Y.options.n):void 0,I=await yz($,{appRoot:U.appRoot,entryFile:U.entryFile,stateDir:wo,version:P1,launcher:U.launcher,port:z,host:Q},{maxLines:J});if(I!==void 0)c0(I)}var wo;var Mo=o(()=>{t9();Fo();J4();D4();wo=eg1(tg1(),".config","seal-use")});import{existsSync as $y1,readFileSync as Yg0}from"node:fs";async function zg0($,U,Y,z,Q){if($==="batch-records"||$==="records"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",Y,z,{batchId:J,query:S(Q.options.query)},C0(Q.options));return}if($==="create"||$==="run"){let J=S(Q.options.mode)??S(Q.options.sourceSystem)??S(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=S(Q.options.schemaConfig)??S(Q.options["schema-config"]),G=K?JSON.parse(Yg0(K,"utf8")):void 0,H=S(Q.options.input),W=H?JSON.parse(Yg0(H,"utf8")):y8(Q.json),X=S(Q.options.packageId)??S(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=S(Q.options.signKey)??S(Q.options["sign-key"])??S(Q.options.integration),F=V0(Q.options.noWait)??V0(Q.options["no-wait"]);await k0("seal_simulation_batch_create",Y,z,{mode:I,sourceSystem:I,flowIds:q,documentSn:q,rejectNodeName:S(Q.options.rejectNode)??S(Q.options["reject-node"])??null,thinkingDepthOverride:S(Q.options.thinkingDepth)??S(Q.options["thinking-depth"]),skipInvoiceGeneration:V0(Q.options.skipInvoiceGeneration)??V0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:V0(Q.options.skipExpenseExtraction)??V0(Q.options["skip-expense-extraction"]),disableAttachmentCache:V0(Q.options.disableAttachmentCache)??V0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:S(Q.options.templateId)??S(Q.options["template-id"]),schemaConfig:G,requestIds:u6(Q.options.requestIds)??u6(Q.options["request-ids"]),workflowTypeId:S(Q.options.workflowTypeId)??S(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:S(Q.options.documentType)??S(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=U??S(Q.options.batchId)??S(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",Y,z,{batchId:J,timeout:S(Q.options.timeout),pollInterval:S(Q.options.pollInterval)??S(Q.options["poll-interval"])},C0(Q.options));return}if($==="status"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",Y,z,{batchId:J},C0(Q.options));return}if($==="clean"||$==="delete"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",Y,z,{batchId:J},C0(Q.options));return}if($==="specifications"){let J=U??S(Q.options.integration)??S(Q.options.signKey)??S(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",Y,z,{signKey:J},C0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",Y,z,{},C0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",Y,z,{limit:s0(Q.options.limit)},C0(Q.options));return}if($==="get"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",Y,z,{batchId:J},C0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",Y,z,{},C0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",Y,z,{},C0(Q.options));return}if($==="package-upload"){let J=U??S(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!$y1(J))throw Error(`Filenotfound:${J}`);await k0("seal_simulation_material_package_upload",Y,z,{filePath:J},C0(Q.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Qg0=o(()=>{o4();D4();J4()});import{existsSync as Jg0}from"node:fs";import{join as iT}from"node:path";function Ig0($,U,Y){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${YoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let z=V0(Y.options.local)||V0(Y.options.workspace),Q=S(Y.options.dir)??S(Y.options.target)??U,J=Q?Q:z?iT(process.cwd(),".agents","skills","seal-use"):gz(),I=VS0(J),K=!z&&!Q,G=K?ol():void 0,H=K?al():void 0;c0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let z=gz(),Q=iT(process.cwd(),".agents","skills","seal-use"),J=rl(),I=tl();c0({global:{dir:z,installed:Jg0(iT(z,"SKILL.md"))},local:{dir:Q,installed:Jg0(iT(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Kg0=o(()=>{$o();Cq();D4();J4()});async function Gg0($,U){if($==="config"){c0(await yK(U));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Hg0=o(()=>{ET();J4()});function No($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let U=$.toUpperCase().trim();if(U==="APPROVE"||U==="PASS")return"APPROVE";if(U==="REJECT"||U==="DENIED")return"REJECT";if(U==="MANUAL"||U==="ASSISTED")return"MANUAL";if(U==="ERROR"||U==="FAILED")return"ERROR";return U}async function Wg0($){let{sourceCorp:U,targetCorp:Y,sourceClient:z,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(Y.environment!=="test")throw new w4(`重放目标企业「${Y.name}」(${Y.id})的环境为「${Y.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${U.id}<testCorpId>`);let X=await cU(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,O=J*F;if(V<O)throw new w4(`测试企业「${Y.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${J}笔需要约${O}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${Y.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await b4(z,{limit:J,status:"completed"}),M=Array.isArray(w.records)?w.records:[];if(M.length===0){let d=await b4(z,{limit:J});M=Array.isArray(d.records)?d.records:[]}if(M.length===0)throw new w4(`在母企业「${U.name}」(${U.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(M=M.slice(0,J),I){let d=M.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=No(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:U.id,name:U.name,environment:U.environment??"production"},targetCorp:{id:Y.id,name:Y.name,environment:Y.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:O},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let N=await Ip(Q,Y),D=[];for(let d of M){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=No(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=Qp(e,{snPrefix:H,docIdPrefix:H});await Jp(N.incomingDocumentWebhook.url,N.secret,s,W,A6(Y.seal));let U0=null,O0=Date.now();while(Date.now()-O0<G){await new Promise((W0)=>setTimeout(W0,K));let a=await b4(Q,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let W0=a.records[0];if(W0.status==="completed"||W0.status==="failed"){U0=W0;break}}}if(!U0){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=No(U0?.result?.decision??U0.aiDecision??U0?.decision??(U0.status==="completed"?"APPROVE":"ERROR")),G0=U0?.result?.summary??U0.aiSummary,T0=g===E0,b0=T0?"MATCHED":"FLIPPED",U1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:U0.id,testDecision:E0,testSummary:G0,status:b0,durationMs:Date.now()-t};if(!T0)U1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产:${p.slice(0,60)}...->测试:${G0.slice(0,60)}...`:void 0};D.push(U1)}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 B=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,h=x>0?C/x:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",z0=!i&&j===0,k;try{let d=await cU(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:U.id,name:U.name,environment:U.environment??"production"},targetCorp:{id:Y.id,name:Y.name,environment:Y.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:O,balanceAfter:k},metrics:{sampleCount:D.length,successCount:B.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(h.toFixed(4))},flips:A,records:D}}function Xg0($){let{sourceCorp:U,targetCorp:Y,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]规则回归测试矩阵:生产「${U.name}」->测试靶场「${Y.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 Zg0=o(()=>{L$();X6();SZ()});async function Do($,U,Y){let z=($??U??"regression").toLowerCase();if(z==="regression"||z==="regress"||z==="matrix"){let Q=S(Y.options.corp)??(U&&U!==z?U:void 0),J=E1(Q),I=J,K=J;if(J.environment==="test"){K=J;let M=S(Y.options["prod-corp"])??S(Y.options.prod)??J.prodCorpId;if(!M)throw new w4(`测试企业「${J.name}」(${J.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${J.id}`);I=E1(M)}else{I=J;let M=S(Y.options["test-corp"])??S(Y.options.test)??J.testCorpId;if(!M)throw new w4(`生产企业「${J.name}」(${J.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${J.id}<testCorpId>`);K=E1(M)}let G=await j1(I),H=await j1(K),W=s0(Y.options.samples)??s0(Y.options.limit)??s0(Y.options.n)??10,X=V0(Y.options["dry-run"]),Z=V0(Y.options["fail-on-flips"]),q=s0(Y.options["poll-interval"])??2000,V=s0(Y.options.timeout)??45000,F=S(Y.options["sn-prefix"])??"REG_",O=await Wg0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z});if(!(V0(Y.options.quiet)||V0(Y.options.silent)))console.error(Xg0(O));if(c0(O),Z&&!O.ok)throw new w4(`回归测试发现${O.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 qg0=o(()=>{L$();o4();D4();J4();i8();Zg0()});async function Vg0($,U,Y,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,U,Y,y8(z.json),C0(z.options))}var Lg0=o(()=>{o4();D4();J4()});function Fg0(){c0(Vq.map(($)=>({name:$.name,description:$.description})))}var wg0=o(()=>{Fq();J4()});function cT($=process.execPath,U=import.meta.url){if(U.includes("/$bunfs/")||U.includes("\\$bunfs\\"))return!0;let Y=$.toLowerCase().replace(/\\/g,"/");return!Y.endsWith("/bun")&&!Y.endsWith("/bun.exe")&&!Y.endsWith("/node")&&!Y.endsWith("/node.exe")}var Og0=o(()=>{Cq()});import{chmodSync as Uy1,mkdirSync as Yy1,readdirSync as zy1,renameSync as Ao,rmSync as Qy1,unlinkSync as Ag0,writeFileSync as Mg0}from"node:fs";import{basename as Jy1,dirname as Iy1,join as pT}from"node:path";import{spawnSync as uK}from"node:child_process";async function Bg0($,U={}){let Y={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:wo,version:P1,launcher:$.launcher},z=U.repo||process.env[Ky1]?.trim()||process.env[Gy1]?.trim()||Pg0,Q=U.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),B=Cg0(D,P1);if(B<0)if(!xS&&U.force);else{c0({updated:!1,currentVersion:P1,targetVersion:D,mode:cT()?"binary":"source",message:!xS?`Cannotdowngradeseal-usefromdevbuildv${P1}toreleasev${D}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${P1}toolderversionv${D}.Updatesmustbeforward-only.`});return}if(B===0&&!U.force){c0({updated:!1,currentVersion:P1,targetVersion:D,mode:cT()?"binary":"source",message:`seal-useisalreadyatversionv${P1}.Use--forcetoreinstall.`});return}}if(U.changelogOnly){let D=await Po(z,U.limit??10);c0({currentVersion:P1,totalQueried:D.length,releases:D.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===P1,isNewer:hq(B.version,P1)}))});return}if(!cT()){if(U.checkOnly){let B=await Po(z,30),T=B[0],A=T?.version??P1,j=B.find((x)=>x.version===P1),C=hq(A,P1),b=B.filter((x)=>hq(x.version,P1));c0({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=fK(Y).running;if(D)await yz("stop",Y);try{Dg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(Dg0("bun",["install"],{cwd:$.appRoot}),D)await yz("start",Y);c0({updated:!0,serviceRestarted:D,version:P1,mode:"source"});return}let I=Wy1(),K=Xy1(),G=await Po(z,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await Ng0(z,J):G[0]??await Ng0(z);if(!H){c0({updated:!1,currentVersion:P1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${z}'`});return}let W=H.version,X=G.find((D)=>D.version===P1),Z=hq(W,P1),q=Z||Boolean(U.force),V=G.filter((D)=>hq(D.version,P1));if(U.checkOnly){c0({updated:!1,updateAvailable:Z,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:V.length,pendingReleases:V.map((D)=>({version:D.version,tagName:D.tagName,publishedAt:D.publishedAt,author:D.author,releaseNotes:D.notes,releaseUrl:D.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!q){c0({updated:!1,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${P1})`});return}let F=qy1(H.assets,I,K);if(!F)throw Error(`Nocompatiblebinaryfoundfor${I}-${K}inreleasev${W}.Availableassets:${H.assets.map((D)=>D.name).join(", ")}`);let O=fK(Y).running;if(O)await yz("stop",Y);let w=process.execPath,M=Iy1(w),N=pT(M,`.tmp-update-${Date.now()}`);Yy1(N,{recursive:!0});try{let D=pT(N,F.name);await Vy1(F.downloadUrl,D,H.tagName,F.name);let B=D;if(F.name.endsWith(".tar.gz")||F.name.endsWith(".tgz"))B=Ly1(D,N,I);else if(F.name.endsWith(".zip"))B=Fy1(D,N,I);if(Uy1(B,493),process.platform==="darwin")try{uK("/usr/bin/codesign",["--remove-signature",B],{stdio:"ignore"}),uK("/usr/bin/codesign",["--force","--sign","-",B],{stdio:"ignore"})}catch{}if(process.platform==="win32"){let A=`${w}.old.${Date.now()}`;try{Ao(w,A)}catch{}Ao(B,w)}else Ao(B,w);if(O)await yz("start",Y);let T=Hy1(w,W);c0({updated:!0,fromVersion:P1,toVersion:W,serviceRestarted:O,skillSynced:T.targetDir??!1,skillVersion:T.version??!1,mode:"binary"})}finally{try{Qy1(N,{recursive:!0,force:!0})}catch{}}}function
Line truncated
`)}catch{}}async function Vy1($,U,Y,z){let Q=Bo(),J=[],I=Y?Y.startsWith("v")?Y:`v${Y}`: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/${Pg0}/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 O=G[F],w=new AbortController,M="",N=(A)=>{M=A;try{w.abort()}catch{}},D=setTimeout(()=>{N("Connection timed out (no response headers within 6s)")},W),B,T;try{nT(`==> [${F+1}/${G.length}] Downloading via: ${O}`);let A=await fetch(O,{signal:w.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);B=setTimeout(()=>{N("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)`);Mg0(U,c),nT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],x=0,h=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);N(`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-h>200){h=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.30: 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.31: 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.30
short-description:Seal tenant and Hose approval automation (v0.10.30)
version:0.10.31
short-description:Seal tenant and Hose approval automation (v0.10.31)
---
# Seal Use (v0.10.30)
# Seal Use (v0.10.31)
**The CLI is the primary path; the MCP server is an optional extra that is off by default.** Prefer the global `seal-use` CLI, and only use MCP when it is actually available in the current session. If no `seal_cli*` tool is present, that is the normal default — do not try to enable it or treat it as a fault; just use the CLI. Enabling it is the user's choice in the plugin settings (插件配置中的「启用 MCP 服务」,默认关闭,打开后需重连该插件的 MCP 服务).
-`seal_cli` — **read-only only.** Reads tenant state without changing it. It is annotated `readOnlyHint: true`, so clients may auto-approve it.
-`seal_cli_write` — everything that mutates tenant state, publishes configuration, mints credentials, self-updates or starts a server. Annotated `destructiveHint: true`; **confirm the exact command with the user before calling it.**
The boundary is enforced, not merely advertised: `seal_cli` refuses any command that is not on its read-only allow-list, and unclassified commands fail closed. A refusal names `seal_cli_write` as the follow-up. `seal-use tool <name>` is allowed through `seal_cli` only for tools the registry classifies as read-only (`SEAL_READ_ONLY_TOOLS`); the rest need `seal_cli_write`.
This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
- 关键字智能搜索(支持同音字/拼音/简拼/容错):`seal-use corps search <keyword>`
- 常用企业列表(默认展示 7 天使用频次最高的 10 家):`seal-use corps list`
- 查看企业详情(富属性安全脱敏查看):`seal-use corps get <corpId>`
- Treat CLI/MCP as the Agent's execution channel, not the user's interface. Translate natural-language intent into commands yourself; never ask the user to compose CLI syntax, JSON payloads, placeholder values, or internal IDs.
-Before asking for enterprise parameters, resolve the target enterprise: when an enterprise is named, hinted, or keyword-identifiable, ALWAYS run `seal-use corps search <keyword>` (or `seal-use corps get <corpId>` if an exact ID is known) — DO NOT dump the entire enterprise catalog with `seal-use corps list` when the target is already known. Only run `seal-use corps list` (or `corps list --env <test|production>`) for initial discovery when zero enterprise context is known. Resolve its human name to the returned `id` and pass that value as `--corp`; do not ask the user to know `corpId`. Use `seal-use corps get <corpId>` to inspect rich enterprise attributes (URLs, tenant slugs, staff IDs, environment relations, and config file locations) with sensitive secrets safely redacted.
-If no enterprise is configured, the user is installing for the first time, or the user provides credentials, an assistance link, or a browser-copied cURL, read `references/first-time-user.md` for the plain-language, screenshot-based path first, then read `references/enterprise-onboarding.md` before asking questions or running setup commands.
-When the user provides a Hose/合思 `thirdparty.html` assistance link, use `seal-use corps add-link <url> [--name ...]` for temporary session access, or elevate privileges to permanent developer credentials using `seal-use corps extract-keys <url> --save` (or `seal-use corps add-link <url> --as-hose`). This Hose-exclusive capability extracts `appKey`/`appSecurity`. If the enterprise has multiple keys, specify `--app-key <key>` or `--key-id <id>`.
- **同等凭据原则(Equal Credential Scope Principle)**: A Hose assistance link and a cURL copied from an authenticated **Hose admin** page are both Hose web frontend sessions — structurally different in format only, carrying the same `accesstoken`/`corpid` web session credentials. **When a Hose administrator provides a browser cURL, do NOT silently downgrade it to a plain short-lived session import.** Attempt privilege elevation first by extracting `accesstoken`+`corpid`+`baseUrl` from the cURL and invoking the Hose key interface (`/api/innerapi/v1/key`) to retrieve permanent `appKey`/`appSecurity`. Only fall back to temporary session import if the user is not a Hose administrator or the key interface returns no keys.
- Keep enterprise identity origin separate from credential acquisition. A Hose/合思-sourced Seal tenant can be accessed with standard Hose app credentials, an assistance link, or a captured web session; receiving a Seal Bearer token does not by itself prove the tenant is Seal-native. Calling key extraction or `keys` on native Seal enterprises is strictly blocked.
- Never ask a normal user for `corpId`, `staffId`, `proxyStaffBizId`, `tenantId`, or another discoverable internal ID. Discover it first. If discovery fails, explain what the field means, why it could not be discovered, and exactly where the user can find it.
- Prefer compact commands first: `pick`, `--summary`, `--fields`, `attachments --summary`, `rules count`, and `rules list --summary`.
- Parse JSON stdout. Do not scrape human text.
- Do not hand-edit enterprise configs for normal setup. Use `seal-use corps ...`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal `--dry-run` preview first (rules clear/push, `corps sync-test`, preference updates, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use `--yes` only after reviewing its redacted `changesDiff`.
- Knowledge document creation and deletion are now supported. Validate `contentType` and `scenarios` before creating; use `enabled: false` when the document should be withdrawn without deletion. For an explicit deletion, re-read the document and obtain confirmation before using the low-level `seal_approval_delete_document` tool.
- For customer-feedback rule remediation, show an exact field-level diff and obtain explicit approval before updating. Default to changing only the narrowest necessary part of `description`; preserve `scope`, `strictness`, and unrelated clauses unless the user explicitly approves otherwise. Always follow the Presentation & Report Contract in `references/customer-feedback-rule-remediation.md`: hide internal UUIDs, use standard business terms (适用场景, 遵守程度), present unmodified fields cleanly without colloquial fluff, format description changes as standard Git Diff, and avoid repeating full report text in chat context once structured HTML/PDF artifacts are delivered (guide users to external browsers/viewers instead).
- Resolve and lock the target enterprise `corpId` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
- For date questions, use explicit dates and `--timezone Asia/Shanghai`.
- If output may be large, use `--summary`, `--fields`, `--count`, or `--output-file`; use `--full` only when the user really needs full payloads.
- When returning ANY authorization, login, or delegation links (e.g. 合思授权链接, Seal授权链接/委托链接), ALWAYS provide BOTH a code block (` ```text ... ``` `) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
- For delegation links, always prefer `seal-use delegation create` over `users delegation` for link generation to ensure persistent token tracking.
- Never treat “Seal 协助/Seal 授权/委托” as a 合思授权入口. They are different links and must use different commands.
- For approval run links (`seal-use approval-runs url <recordId> [--corp <corpId>]`):
- Always default to returning the clean deep link (`type: 'deep_link'`), which contains no credentials and requires no sensitive access. Users in their authorized browsers open it directly with zero token leakage risk.
- ONLY provide an SSO link (`--sso`) when the user explicitly requests an unauthenticated/cross-browser/no-login/免密 link and acknowledges risks.
- When returning an `--sso` link, the Agent MUST:
1. Declare the 4 mandatory security disclosures:
- 身份主体(Identity attribution: name and admin status)
- 权限范围(Full Seal AI operation permissions under this user)
- 时效性(2-hour provisional ticket TTL, 30-day session after opening)
- 安全与防扩散边界(No Hose main system access, strictly internal, never share to public/external groups)
2. Provide BOTH a code block (` ```text ... ``` `) and a clickable hyperlink.
- In the default stateless mode, every enterprise command requires `--corp <corpId>`. In stateful mode, omitting `--corp` uses the configured default enterprise and is unsafe for an explicitly named enterprise.
- For an explicitly named enterprise, resolve it directly with `seal-use corps search <name>` (or `seal-use corps get <corpId>` if given an exact ID) rather than dumping all enterprises with `seal-use corps list`. Then pass its exact `corpId` to every command. After creation, verify the returned URL host matches that enterprise's Seal tenant; if the host is the current/default tenant or cannot be verified, do not present the link as the target enterprise's link.
-First install / zero configuration / “how do I connect my enterprise?” / user supplies app credentials, an assistance link, or F12/Network cURL: read `references/first-time-user.md` and `references/enterprise-onboarding.md`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
-User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run `seal-use delegation create --corp <corpId> --note '<enterprise>'`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
- Packaged customer feedback → approval-rule remediation: read `references/customer-feedback-rule-remediation.md`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
- 自动化规则回归测试矩阵 (Automated Rule Regression Test Matrix): `seal-use test regression [--corp <corpId>] [--samples <N>] [--dry-run] [--fail-on-flips] [--prod-corp <id>] [--test-corp <id>]` (快捷别名 `seal-use corps regression`)。采样生产企业历史已完成单据,通过出站 HTTPS 轮询重放到配对测试靶场执行 AI 审核并对比双端决策,计算一致率(Concordance Rate),识别决策翻转(Decision Flips),给出 `safeToPublish` 综合判定。硬性红线:目标环境必须为测试企业且测试点数余额充足,严禁在纯生产环境发起。
- User-facing 合思 authorization link (合思/易快报授权): `seal-use auth hose-link --corp <corpId> [--expire <seconds>] [--force]`; read `references/hose-enterprise-auth.md`. Never use this route when the user says Seal 协助. 凭证独立生成且不污染本地会话。Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
Rule, document, style preference, and publish actions mutate Seal configuration. Make the target enterprise explicit, show the intended payload, and verify after the write. Never send real `enterprises/*.json` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
Read this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.
@@ -356,7 +366,8 @@ export async function diagnoseTenantContract(
environment,
sourceType: corp.source?.type??"native",
boundCorpId,
boundCorpRole
boundCorpRole,
boundCorpRoleDescription
},
summary:{
totalChecks: checks.length,
Reference in new issue
Block a user
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.