- Replace filename-heuristic attachment matching with explicit [附件] column declaration
- AttachmentGroup replaces MaterialAttachmentEntry: uses paths[] instead of entries[]
- parseMaterialWorkbook now exports DeclaredAttachment and full Parsed type including
documentAttachments, expenseAttachments, personAttachments per row
- buildAttachmentPlans enforces strict bidirectional validation:
1. Every Excel [附件] path must exist in ZIP
2. Every ZIP file must be declared in some [附件] column
- validateDocIdDirectories now strips @annotation suffix when matching documentIds
- injectAttachmentPlan updated to work with new AttachmentGroup.paths API
- pushMaterialPack iterates group.paths for uploads, adding stderr diagnostics
- Key deduplication applied at parse time (deduplicateKeys)
- Tests updated: [附件] column fixtures, bidirectional validation error tests,
@ annotation matching test, preview injection test
- Skill docs updated: Material Pack Workflow section in references/cli.md
- Version bumped to 0.10.12
2026-09-07 18:26:21 +08:00
19 changed files with 1499 additions and 378 deletions
- Enforced per-document directory scope isolation: all attachments declared for a document must strictly reside in its own folder (`<documentId>/` or `<documentId>@annotation/`), preventing cross-document file borrowing or path confusion.
- Enforced global declaration uniqueness: identical attachment file paths can no longer be declared more than once across the entire material pack (even within the same document or different line-items). Multiple uses require placing distinct physical files in independent paths.
- Added comprehensive unit tests covering cross-document directory violations, intra-document duplicate paths, and multi-document path collisions.
- Updated documentation in `cli.md` detailing the strict scope isolation and declaration uniqueness rules.
## [0.10.12] - 2026-09-07
### Added & Refactored
- **Material Pack Pure Path Declaration & Validation Refactor**:
- Replaced ambiguous filename heuristics with explicit `[附件]` Excel column headers and full ZIP-relative file paths.
- Added `@` annotation suffix support for ZIP root directories (`<documentId>@annotation/`) to bypass document idempotency blocks safely.
- Enforced bidirectional validation between Excel declarations and ZIP entries without fail-fast, collecting all errors together.
import{createRequireasOL0}from"node:module";varGL0=Object.create;var{getPrototypeOf:HL0,defineProperty:uD,getOwnPropertyNames:wL0}=Object;varVL0=Object.prototype.hasOwnProperty;functionWL0($){returnthis[$]}varZL0,XL0,Hq=($,q,I)=>{varU=$!=null&&typeof$==="object";if(U){varY=q?ZL0??=newWeakMap:XL0??=newWeakMap,J=Y.get($);if(J)returnJ}I=$!=null?GL0(HL0($)):{};letQ=q||!$||!$.__esModule?uD(I,"default",{value:$,enumerable:!0}):I;for(letKofwL0($))if(!VL0.call(Q,K))uD(Q,K,{get:WL0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varO=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);varLL0=($)=>$;functionDL0($,q){this[$]=LL0.bind(null,q)}varl8=($,q)=>{for(varIinq)uD($,I,{get:q[I],enumerable:!0,configurable:!0,set:DL0.bind(q,I)})};varr=OL0(import.meta.url);var_J=O((mf)=>{Object.defineProperty(mf,"__esModule",{value:!0});mf.regexpCode=mf.getEsmExportName=mf.getProperty=mf.safeStringify=mf.stringify=mf.strConcat=mf.addCodeArg=mf.str=mf._=mf.nil=mf._Code=mf.Name=mf.IDENTIFIER=mf._CodeOrName=void0;classSH{}mf._CodeOrName=SH;mf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classoqextendsSH{constructor($){super();if(!mf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}mf.Name=oq;classk$extendsSH{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((q,I)=>`${q}${I}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((q,I)=>{if(Iinstanceofoq)q[I.str]=(q[I.str]||0)+1;returnq},{})}}mf._Code=k$;mf.nil=newk$("");functioncf($,...q){letI=[$[0]],U=0;while(U<q.length)rP(I,q[U]),I.push($[++U]);returnnewk$(I)}mf._=cf;varoP=newk$("+");functiondf($,...q){letI=[CJ($[0])],U=0;while(U<q.length)I.push(oP),rP(I,q[U]),I.push(oP,CJ($[++U]));returnfF0(I),newk$(I)}mf.str=df;functionrP($,q){if(qinstanceofk$)$.push(...q._items);elseif(qinstanceofoq)$.push(q);else$.push(iF0(q))}mf.addCodeArg=rP;functionfF0($){letq=1;while(q<$.length-1){if($[q]===oP){letI=bF0($[q-1],$[q+1]);if(I!==void0){$.splice(q-1,3,I);continue}$[q++]="+"}q++}}functionbF0($,q){if(q==='""')return$;if($==='""')returnq;if(typeof$=="string"){if(qinstanceofoq||$[$.length-1]!=='"')return;if(typeofq!="string")return`${$.slice(0,-1)}${q}"`;if(q[0]==='"')return$.slice(0,-1)+q.slice(1);return}if(typeofq=="string"&&q[0]==='"'&&!($instanceofoq))return`"${$}${q.slice(1)}`;return}functionnF0($,q){returnq.emptyStr()?$:$.emptyStr()?q:df`${$}${q}`}mf.strConcat=nF0;functioniF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:CJ(Array.isArray($)?$.join(","):$)}functionpF0($){returnnewk$(CJ($))}mf.stringify=pF0;functionCJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}mf.safeStringify=CJ;functioncF0($){returntypeof$=="string"&&mf.IDENTIFIER.test($)?newk$(`.${$}`):cf`[${$}]`}mf.getProperty=cF0;functiondF0($){if(typeof$=="string"&&mf.IDENTIFIER.test($))returnnewk$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}mf.getEsmExportName=dF0;functionmF0($){returnnewk$($.toString())}mf.regexpCode=mF0});vareP=O((tf)=>{Object.defineProperty(tf,"__esModule",{value:!0});tf.ValueScope=tf.ValueScopeName=tf.Scope=tf.varKinds=tf.UsedValueState=void0;vark6=_J();classofextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varuH;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(uH||(tf.UsedValueState=uH={}));tf.varKinds={const:newk6.Name("const"),let:newk6.Name("let"),var:newk6.Name("var")};classaP{constructor({prefixes:$,parent:q}={}){this._names={},this._prefixes=$,this._parent=q}toName($){return$instanceofk6.Name?$:this.name($)}name($){returnnewk6.Name(this._newName($))}_newName($){letq=this._names[$]||this._nameGroup($);return`${$}${q.index++}`}_nameGroup($){varq,I;if(((I=(q=this._parent)===null||q===void0?void0:q._prefixes)===null||I===void0?void0:I.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}tf.Scope=aP;classsPextendsk6.Name{constructor($,q){super(q);this.prefix=$}setValue($,{property:q,itemIndex:I}){this.value=$,this.scopePath=k6._`.${newk6.Name(q)}[${I}]`}}tf.ValueScopeName=sP;varJM0=k6._`\n`;classrfextendsaP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?JM0:k6.nil}}get(){returnthis._scope}name($){returnnewsP($,this._newName($))}value($,q){varI;if(q.ref===void0)throwError("CodeGen: ref must be passed in value");letU=this.toName($),{prefix:Y}=U,J=(I=q.key)!==null&&I!==void0?I:q.ref,Q=this._values[Y];if(Q){letG=Q.get(J);if(Line truncated
deps:${I}}`};var Vg0={keyword:"dependencies",type:"object",schemaType:"object",error:Vp.error,code($){let[q,I]=Wg0($);Hp($,q),wp($,I)}};function Wg0({schema:$}){let q={},I={};for(let U in $){if(U==="__proto__")continue;let Y=Array.isArray($[U])?q:I;Y[U]=$[U]}return[q,I]}function Hp($,q=$.schema){let{gen:I,data:U,it:Y}=$;if(Object.keys(q).length===0)return;let J=I.let("missing");for(let Q in q){let K=q[Q];if(K.length===0)continue;let z=(0,aJ.propertyInData)(I,U,Q,Y.opts.ownProperties);if($.setParams({property:Q,depsCount:K.length,deps:K.join(", ")}),Y.allErrors)I.if(z,()=>{for(let G of K)(0,aJ.checkReportMissingProp)($,G)});else I.if(xT._`${z}&&(${(0,aJ.checkMissingProp)($,K,J)})`),(0,aJ.reportMissingProp)($,J),I.else()}}Vp.validatePropertyDeps=Hp;function wp($,q=$.schema){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");for(let K in q){if((0,wg0.alwaysValidSchema)(J,q[K]))continue;I.if((0,aJ.propertyInData)(I,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>I.var(Q,!0)),$.ok(Q)}}Vp.validateSchemaDeps=wp;Vp.default=Vg0});var Op=O((Dp)=>{Object.defineProperty(Dp,"__esModule",{value:!0});var Lp=t0(),Lg0=w1(),Dg0={message:"property name must be valid",params:({params:$})=>Lp._`{propertyName:${$.propertyName}}`},Og0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Dg0,code($){let{gen:q,schema:I,data:U,it:Y}=$;if((0,Lg0.alwaysValidSchema)(Y,I))return;let J=q.name("valid");q.forIn("key",U,(Q)=>{$.setParams({propertyName:Q}),$.subschema({keyword:"propertyNames",data:Q,dataTypes:["string"],propertyName:Q,compositeRule:!0},J),q.if((0,Lp.not)(J),()=>{if($.error(!0),!Y.allErrors)q.break()})}),$.ok(J)}};Dp.default=Og0});var kT=O((Np)=>{Object.defineProperty(Np,"__esModule",{value:!0});var Gw=O$(),i$=t0(),Fg0=e8(),Hw=w1(),Mg0={message:"must NOT have additional properties",params:({params:$})=>i$._`{additionalProperty:${$.additionalProperty}}`},Ag0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Mg0,code($){let{gen:q,schema:I,parentSchema:U,data:Y,errsCount:J,it:Q}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:z}=Q;if(Q.props=!0,z.removeAdditional!=="all"&&(0,Hw.alwaysValidSchema)(Q,I))return;let G=(0,Gw.allSchemaProperties)(U.properties),H=(0,Gw.allSchemaProperties)(U.patternProperties);w(),$.ok(i$._`${J}===${Fg0.default.errors}`);function w(){q.forIn("key",Y,(D)=>{if(!G.length&&!H.length)X(D);else q.if(V(D),()=>X(D))})}function V(D){let N;if(G.length>8){let E=(0,Hw.schemaRefOrVal)(Q,U.properties,"properties");N=(0,Gw.isOwnProperty)(q,E,D)}else if(G.length)N=(0,i$.or)(...G.map((E)=>i$._`${D}===${E}`));else N=i$.nil;if(H.length)N=(0,i$.or)(N,...H.map((E)=>i$._`${(0,Gw.usePattern)($,E)}.test(${D})`));return(0,i$.not)(N)}function W(D){q.code(i$._`delete${Y}[${D}]`)}function X(D){if(z.removeAdditional==="all"||z.removeAdditional&&I===!1){W(D);return}if(I===!1){if($.setParams({additionalProperty:D}),$.error(),!K)q.break();return}if(typeof I=="object"&&!(0,Hw.alwaysValidSchema)(Q,I)){let N=q.name("valid");if(z.removeAdditional==="failing")L(D,N,!1),q.if((0,i$.not)(N),()=>{$.reset(),W(D)});else if(L(D,N),!K)q.if((0,i$.not)(N),()=>q.break())}}function L(D,N,E){let T={keyword:"additionalProperties",dataProp:D,dataPropType:Hw.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,N)}}};Np.default=Ag0});var Pp=O((Ap)=>{Object.defineProperty(Ap,"__esModule",{value:!0});var Tg0=fJ(),Fp=O$(),fT=w1(),Mp=kT(),Eg0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,parentSchema:U,data:Y,it:J}=$;if(J.opts.removeAdditional==="all"&&U.additionalProperties===void 0)Mp.default.code(new Tg0.KeywordCxt(J,Mp.default,"additionalProperties"));let Q=(0,Fp.allSchemaProperties)(I);for(let w of Q)J.definedProperties.add(w);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=fT.mergeEvaluated.props(q,(0,fT.toHash)(Q),J.props);let K=Q.filter((w)=>!(0,fT.alwaysValidSchema)(J,I[w]));if(K.length===0)return;let z=q.name("valid");for(let w of K){if(G(w))H(w);else{if(q.if((0,Fp.propertyInData)(q,Y,w,J.opts.ownProperties)),H(w),!J.allErrors)q.else().var(z,!0);q.endIf()}$.it.definedProperties.add(w),$.ok(z)}function G(w){return J.opts.useDefaults&&!J.compositeRule&&I[w].default!==void 0}function H(w){$.subschema({keyword:"properties",schemaProp:w,dataProp:w},z)}}};Ap.default=Eg0});var Bp=O((gp)=>{Object.defineProperty(gp,"__esModule",{value:!0});var Tp=O$(),ww=t0(),Ep=w1(),jp=w1(),gg0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Tp.allSchemaProperties)(I),z=K.filter((L)=>(0,Ep.alwaysValidSchema)(J,I[L]));if(K.length===0||z.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let G=Q.strictSchema&&!Q.allowMatchingProperties&&Y.properties,H=q.name("valid");if(J.props!==!0&&!(J.props instanceo
Line truncated
`)}openNode($,q){let I=this.tos,U=this._xml;if(I&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),$B(U,q),this.leaf=!0,this.open=!0}addAttribute($,q){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(q!==void 0)Je(this._xml,$,q)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");$B(this._xml,$)}writeText($){let q=this._xml;if(this.open)q.push(">"),this.open=!1;this.leaf=!1,q.push(Ye.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),q=this._xml;if(this.leaf)q.push("/>");else q.push("</"),q.push($),q.push(">");this.open=!1,this.leaf=!1}leafNode($,q,I){if(this.openNode($,q),I!==void 0)this.writeText(I);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("")}}qB.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};Qe.exports=qB});var IB=O(($b0)=>{var Ke=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ef0($){if(typeof $==="string")return $;if(Ke)return Ke.decode($);return $.toString()}$b0.bufferToString=ef0});var Ve=O((Ge)=>{Object.defineProperty(Ge,"__esModule",{value:!0});Ge.CHAR=`
`,$=this.i;break;case Fn0:{let{entityReturnState:I}=this,U=this.entity+q.slice($,this.prevI);this.state=I;let Y;if(U==="")this.fail("empty entity name."),Y="&;";else Y=this.parseEntity(U),this.entity="";if(I!==R6||this.textHandler!==void 0)this.text+=Y;break $}case Y4:this.entity+=q.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(w2($))this.state=Xn0,this.unget(),this.xmlDeclPossible=!1;else switch($){case HW:this.state=On0,this.xmlDeclPossible=!1;break;case ye:this.state=Jn0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=Hn0;break;default:this.fail("disallowed character in tag name"),this.state=R6,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=VB,this.openWakaBang="";break;case"--":this.state=wB,this.openWakaBang="";break;case"DOCTYPE":if(this.state=zB,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(GW))this.state=Qn0}sCommentEnding(){var $;let q=this.getCodeNorm();if(q===GW)this.state=Kn0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(q)}`,this.state=wB}sCommentEnded(){let $=this.getCodeNorm();if($!==S4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=wB;else this.state=R6}sCData(){if(this.captureToChar(lI))this.state=zn0}sCDataEnding(){let $=this.getCodeNorm();if($===lI)this.state=Gn0;else this.text+=`]${String.fromCodePoint($)}`,this.state=VB}sCDataEnding2(){var $;let q=this.getCodeNorm();switch(q){case S4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=R6;break}case lI:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(q)}`,this.state=VB}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=Be;else if($===I6||c6($))this.fail("processing instruction without a target."),this.state=$===I6?zW:WB;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=Be}sPIRest(){let{chunk:$,i:q}=this;while(!0){let I=this.getCodeNorm();if(I===Y4){this.piTarget+=$.slice(q);return}if(!this.nameCheck(I)){this.piTarget+=$.slice(q,this.prevI);let U=I===I6;if(U||c6(I))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?I3:Re}else this.state=U?zW:WB;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(I);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===I6)this.state=zW;else if(!c6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=zW}sPIEnding(){var $;let q=this.getCodeNorm();if(q===S4){let{piTarget:I}=this;if(I.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:I,body:this.text}),this.piTarget=this.text="",this.state=R6}else if(q===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(q)}`,this.state=WB;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=I3;return}if($!==Y4)this.state=wn0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Pn0);if($===I6){this.state=I3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(c6($)||$===mI))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=$===mI?ve:Vn0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=I3,this.fail("XML declaration is incomplete.");return}if(c6($))return;if($!==mI)this.fail("value required.");this.state=ve}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=I3,this.fail("XML declaration is incomplete.");return}if(c6($))return;if(!wW($))this.fail("value must be quoted."),this.q=Se;else this.q=$;this.state=Wn0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=I3,this.text="",this.fail("XML declaration is incomplete.");return}if($===Y4)return;let q=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let I=q;if(this.xmlDecl.version=I,!/^1\.[0-9]+$/.test(I))this.fail("version nu
Line truncated
import{createRequireasqw0}from"node:module";varsL0=Object.create;var{getPrototypeOf:eL0,defineProperty:PO,getOwnPropertyNames:$w0}=Object;varIw0=Object.prototype.hasOwnProperty;functionUw0($){returnthis[$]}varYw0,Jw0,WI=($,I,U)=>{varY=$!=null&&typeof$==="object";if(Y){varJ=I?Yw0??=newWeakMap:Jw0??=newWeakMap,Q=J.get($);if(Q)returnQ}U=$!=null?sL0(eL0($)):{};letK=I||!$||!$.__esModule?PO(U,"default",{value:$,enumerable:!0}):U;for(letqof$w0($))if(!Iw0.call(K,q))PO(K,q,{get:Uw0.bind($,q),enumerable:!0});if(Y)J.set($,K);returnK};varN=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varQw0=($)=>$;functionKw0($,I){this[$]=Qw0.bind(null,I)}varm8=($,I)=>{for(varUinI)PO($,U,{get:I[U],enumerable:!0,configurable:!0,set:Kw0.bind(I,U)})};varr=qw0(import.meta.url);varCQ=N((Rf)=>{Object.defineProperty(Rf,"__esModule",{value:!0});Rf.regexpCode=Rf.getEsmExportName=Rf.getProperty=Rf.safeStringify=Rf.stringify=Rf.strConcat=Rf.addCodeArg=Rf.str=Rf._=Rf.nil=Rf._Code=Rf.Name=Rf.IDENTIFIER=Rf._CodeOrName=void0;classEW{}Rf._CodeOrName=EW;Rf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classoIextendsEW{constructor($){super();if(!Rf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}Rf.Name=oI;classf$extendsEW{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((I,U)=>`${I}${U}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,U)=>{if(UinstanceofoI)I[U.str]=(I[U.str]||0)+1;returnI},{})}}Rf._Code=f$;Rf.nil=newf$("");functionEf($,...I){letU=[$[0]],Y=0;while(Y<I.length)xP(U,I[Y]),U.push($[++Y]);returnnewf$(U)}Rf._=Ef;varhP=newf$("+");functionBf($,...I){letU=[vQ($[0])],Y=0;while(Y<I.length)U.push(hP),xP(U,I[Y]),U.push(hP,vQ($[++Y]));returnvF0(U),newf$(U)}Rf.str=Bf;functionxP($,I){if(Iinstanceoff$)$.push(...I._items);elseif(IinstanceofoI)$.push(I);else$.push(_F0(I))}Rf.addCodeArg=xP;functionvF0($){letI=1;while(I<$.length-1){if($[I]===hP){letU=CF0($[I-1],$[I+1]);if(U!==void0){$.splice(I-1,3,U);continue}$[I++]="+"}I++}}functionCF0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofoI||$[$.length-1]!=='"')return;if(typeofI!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return$.slice(0,-1)+I.slice(1);return}if(typeofI=="string"&&I[0]==='"'&&!($instanceofoI))return`"${$}${I.slice(1)}`;return}functionjF0($,I){returnI.emptyStr()?$:$.emptyStr()?I:Bf`${$}${I}`}Rf.strConcat=jF0;function_F0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:vQ(Array.isArray($)?$.join(","):$)}functionSF0($){returnnewf$(vQ($))}Rf.stringify=SF0;functionvQ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Rf.safeStringify=vQ;functiongF0($){returntypeof$=="string"&&Rf.IDENTIFIER.test($)?newf$(`.${$}`):Ef`[${$}]`}Rf.getProperty=gF0;functionyF0($){if(typeof$=="string"&&Rf.IDENTIFIER.test($))returnnewf$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Rf.getEsmExportName=yF0;functionhF0($){returnnewf$($.toString())}Rf.regexpCode=hF0});varbP=N((_f)=>{Object.defineProperty(_f,"__esModule",{value:!0});_f.ValueScope=_f.ValueScopeName=_f.Scope=_f.varKinds=_f.UsedValueState=void0;vark6=CQ();classCfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varRW;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(RW||(_f.UsedValueState=RW={}));_f.varKinds={const:newk6.Name("const"),let:newk6.Name("let"),var:newk6.Name("var")};classuP{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofk6.Name?$:this.name($)}name($){returnnewk6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,U;if(((U=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||U===void0?void0:U.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}_f.Scope=uP;classfPextendsk6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:U}){this.value=$,this.scopePath=k6._`.${newk6.Name(I)}[${U}]`}}_f.ValueScopeName=fP;varoF0=k6._`\n`;classjfextendsuP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?oF0:k6.nil}}get(){returnthis._scope}name($){returnnewfP($,this._newName($))}value($,I){varU;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letY=this.toName($),{prefix:J}=Y,Q=(U=I.key)!==null&&U!==void0?U:I.ref,K=this._values[J];if(K){letH=K.get(Q);if(Line truncated
deps:${U}}`};var IB0={keyword:"dependencies",type:"object",schemaType:"object",error:lp.error,code($){let[I,U]=UB0($);dp($,I),mp($,U)}};function UB0({schema:$}){let I={},U={};for(let Y in $){if(Y==="__proto__")continue;let J=Array.isArray($[Y])?I:U;J[Y]=$[Y]}return[I,U]}function dp($,I=$.schema){let{gen:U,data:Y,it:J}=$;if(Object.keys(I).length===0)return;let Q=U.let("missing");for(let K in I){let q=I[K];if(q.length===0)continue;let G=(0,oQ.propertyInData)(U,Y,K,J.opts.ownProperties);if($.setParams({property:K,depsCount:q.length,deps:q.join(", ")}),J.allErrors)U.if(G,()=>{for(let H of q)(0,oQ.checkReportMissingProp)($,H)});else U.if(TT._`${G}&&(${(0,oQ.checkMissingProp)($,q,Q)})`),(0,oQ.reportMissingProp)($,Q),U.else()}}lp.validatePropertyDeps=dp;function mp($,I=$.schema){let{gen:U,data:Y,keyword:J,it:Q}=$,K=U.name("valid");for(let q in I){if((0,$B0.alwaysValidSchema)(Q,I[q]))continue;U.if((0,oQ.propertyInData)(U,Y,q,Q.opts.ownProperties),()=>{let G=$.subschema({keyword:J,schemaProp:q},K);$.mergeValidEvaluated(G,K)},()=>U.var(K,!0)),$.ok(K)}}lp.validateSchemaDeps=mp;lp.default=IB0});var ep=N((sp)=>{Object.defineProperty(sp,"__esModule",{value:!0});var ap=t0(),QB0=V1(),KB0={message:"property name must be valid",params:({params:$})=>ap._`{propertyName:${$.propertyName}}`},qB0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:KB0,code($){let{gen:I,schema:U,data:Y,it:J}=$;if((0,QB0.alwaysValidSchema)(J,U))return;let Q=I.name("valid");I.forIn("key",Y,(K)=>{$.setParams({propertyName:K}),$.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),I.if((0,ap.not)(Q),()=>{if($.error(!0),!J.allErrors)I.break()})}),$.ok(Q)}};sp.default=qB0});var ET=N(($n)=>{Object.defineProperty($n,"__esModule",{value:!0});var $V=O$(),n$=t0(),HB0=s8(),IV=V1(),WB0={message:"must NOT have additional properties",params:({params:$})=>n$._`{additionalProperty:${$.additionalProperty}}`},VB0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:WB0,code($){let{gen:I,schema:U,parentSchema:Y,data:J,errsCount:Q,it:K}=$;if(!Q)throw Error("ajv implementation error");let{allErrors:q,opts:G}=K;if(K.props=!0,G.removeAdditional!=="all"&&(0,IV.alwaysValidSchema)(K,U))return;let H=(0,$V.allSchemaProperties)(Y.properties),W=(0,$V.allSchemaProperties)(Y.patternProperties);V(),$.ok(n$._`${Q}===${HB0.default.errors}`);function V(){I.forIn("key",J,(O)=>{if(!H.length&&!W.length)w(O);else I.if(X(O),()=>w(O))})}function X(O){let F;if(H.length>8){let E=(0,IV.schemaRefOrVal)(K,Y.properties,"properties");F=(0,$V.isOwnProperty)(I,E,O)}else if(H.length)F=(0,n$.or)(...H.map((E)=>n$._`${O}===${E}`));else F=n$.nil;if(W.length)F=(0,n$.or)(F,...W.map((E)=>n$._`${(0,$V.usePattern)($,E)}.test(${O})`));return(0,n$.not)(F)}function Z(O){I.code(n$._`delete${J}[${O}]`)}function w(O){if(G.removeAdditional==="all"||G.removeAdditional&&U===!1){Z(O);return}if(U===!1){if($.setParams({additionalProperty:O}),$.error(),!q)I.break();return}if(typeof U=="object"&&!(0,IV.alwaysValidSchema)(K,U)){let F=I.name("valid");if(G.removeAdditional==="failing")D(O,F,!1),I.if((0,n$.not)(F),()=>{$.reset(),Z(O)});else if(D(O,F),!q)I.if((0,n$.not)(F),()=>I.break())}}function D(O,F,E){let A={keyword:"additionalProperties",dataProp:O,dataPropType:IV.Type.Str};if(E===!1)Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(A,F)}}};$n.default=VB0});var Jn=N((Yn)=>{Object.defineProperty(Yn,"__esModule",{value:!0});var XB0=xQ(),In=O$(),BT=V1(),Un=ET(),LB0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,parentSchema:Y,data:J,it:Q}=$;if(Q.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)Un.default.code(new XB0.KeywordCxt(Q,Un.default,"additionalProperties"));let K=(0,In.allSchemaProperties)(U);for(let V of K)Q.definedProperties.add(V);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=BT.mergeEvaluated.props(I,(0,BT.toHash)(K),Q.props);let q=K.filter((V)=>!(0,BT.alwaysValidSchema)(Q,U[V]));if(q.length===0)return;let G=I.name("valid");for(let V of q){if(H(V))W(V);else{if(I.if((0,In.propertyInData)(I,J,V,Q.opts.ownProperties)),W(V),!Q.allErrors)I.else().var(G,!0);I.endIf()}$.it.definedProperties.add(V),$.ok(G)}function H(V){return Q.opts.useDefaults&&!Q.compositeRule&&U[V].default!==void 0}function W(V){$.subschema({keyword:"properties",schemaProp:V,dataProp:V},G)}}};Yn.default=LB0});var Hn=N((Gn)=>{Object.defineProperty(Gn,"__esModule",{value:!0});var Qn=O$(),UV=t0(),Kn=V1(),qn=V1(),DB0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,data:Y,parentSchema:J,it:Q}=$,{opts:K}=Q,q=(0,Qn.allSchemaProperties)(U),G=q.filter((D)=>(0,Kn.alwaysValidSchema)(Q,U[D]));if(q.length===0||G.length===q.length&&(!Q.opts.unevaluated||Q.props===!0))return;let H=K.strictSchema&&!K.allowMatchingProperties&&J.properties,W=I.name("valid");if(Q.props!==!0&&!(Q.props instanceo
Line truncated
`)}openNode($,I){let U=this.tos,Y=this._xml;if(U&&this.open)Y.push(">");this._stack.push($),Y.push("<"),Y.push($),iR(Y,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)is(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");iR(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(bs.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,U){if(this.openNode($,I),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}pR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};ps.exports=pR});var nR=N((nu0)=>{var ns=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function pu0($){if(typeof $==="string")return $;if(ns)return ns.decode($);return $.toString()}nu0.bufferToString=pu0});var os=N((ds)=>{Object.defineProperty(ds,"__esModule",{value:!0});ds.CHAR=`
`,$=this.i;break;case Hb0:{let{entityReturnState:U}=this,Y=this.entity+I.slice($,this.prevI);this.state=U;let J;if(Y==="")this.fail("empty entity name."),J="&;";else J=this.parseEntity(Y),this.entity="";if(U!==v6||this.textHandler!==void 0)this.text+=J;break $}case J4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(qK($))this.state=Jb0,this.unget(),this.xmlDeclPossible=!1;else switch($){case IX:this.state=qb0,this.xmlDeclPossible=!1;break;case Oe:this.state=of0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=ef0;break;default:this.fail("disallowed character in tag name"),this.state=v6,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=eR,this.openWakaBang="";break;case"--":this.state=sR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=rR,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($X))this.state=rf0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===$X)this.state=tf0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=sR}sCommentEnded(){let $=this.getCodeNorm();if($!==g4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=sR;else this.state=v6}sCData(){if(this.captureToChar(lU))this.state=af0}sCDataEnding(){let $=this.getCodeNorm();if($===lU)this.state=sf0;else this.text+=`]${String.fromCodePoint($)}`,this.state=eR}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case g4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=v6;break}case lU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=eR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=We;else if($===I6||n6($))this.fail("processing instruction without a target."),this.state=$===I6?eZ:$v;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=We}sPIRest(){let{chunk:$,i:I}=this;while(!0){let U=this.getCodeNorm();if(U===J4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(I,this.prevI);let Y=U===I6;if(Y||n6(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Y?$3:Ve}else this.state=Y?eZ:$v;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===I6)this.state=eZ;else if(!n6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=eZ}sPIEnding(){var $;let I=this.getCodeNorm();if(I===g4){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=v6}else if(I===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=$v;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=$3;return}if($!==J4)this.state=$b0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Zb0);if($===I6){this.state=$3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(n6($)||$===mU))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=$===mU?Ze:Ib0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=$3,this.fail("XML declaration is incomplete.");return}if(n6($))return;if($!==mU)this.fail("value required.");this.state=Ze}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=$3,this.fail("XML declaration is incomplete.");return}if(n6($))return;if(!UX($))this.fail("value must be quoted."),this.q=De;else this.q=$;this.state=Ub0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=$3,this.text="",this.fail("XML declaration is incomplete.");return}if($===J4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=I;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("version nu
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new y4($,q).found}function y4($,q){if(!$)throw Error("must provide pattern");if(typeof q==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See:https://github.com/isaacs/node-glob/issues/167`);return new y4($,I).found}function y4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+e[G0-1];break}}}var Y1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;v._warn(Y1,!0,F)}}function j0(a,F){var M=a+" is deprecated and will be removed in a future version.";if(F)M+=" Use "+F+" instead.";return X1(M)}function X1(a,F,M){if(!T0.warnings)return;var v=new Y(a),u;if(F)M._attachExtraTrace(v);else if(T0.longStackTraces&&(u=$._peekContext()))u.attachExtraTrace(v);else{var s=J4(v);v.stack=s.message+`
`+e[H0-1];break}}}var J1="a promise was created in a "+z+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;j._warn(J1,!0,M)}}function B0(a,M){var z=a+" is deprecated and will be removed in a future version.";if(M)z+=" Use "+M+" instead.";return w1(z)}function w1(a,M,z){if(!T0.warnings)return;var j=new J(a),x;if(M)z._attachExtraTrace(j);else if(T0.longStackTraces&&(x=$._peekContext()))x.attachExtraTrace(j);else{var s=Q4(j);j.stack=s.message+`
`)));return}}N=N._target();var E=N._bitField;if((E&50397184)===0)this._yieldedPromise=N,N._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,N._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,N._reason());else this._promiseCancelled()}},$.coroutine=function(X,L){if(typeof X!=="function")throw new K(`generatorFunctionmustbeafunction
`)));return}}F=F._target();var E=F._bitField;if((E&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(w,D){if(typeof w!=="function")throw new q(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var D=Object(L).yieldHandler,N=W,E=Error().stack;return function(){var T=X.apply(this,arguments),P=new N(void 0,void 0,D,E),B=P.promise();return P._generator=T,P._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+z.classString(X));w.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return q(`generatorFunctionmustbeafunction
`);var O=Object(D).yieldHandler,F=Z,E=Error().stack;return function(){var A=w.apply(this,arguments),T=new F(void 0,void 0,O,E),v=T.promise();return T._generator=A,T._promiseFulfilled(void 0),v}},$.coroutine.addYieldHandler=function(w){if(typeof w!=="function")throw new q("expecting a function but got "+G.classString(w));V.push(w)},$.spawn=function(w){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof w!=="function")return I(`generatorFunctionmustbeafunction
`)},q=function(){return new C.PromiseInspection(this._target())},I=function(j){return C.reject(new w(j))};function U(){}var Y={},J=b1(),Q;if(J.isNode)Q=function(){var j=process.domain;if(j===void 0)j=null;return j};else Q=function(){return null};J.notEnumerableProp(C,"_getDomain",Q);var K=y3(),z=oQ0(),G=new z;K.defineProperty(C,"_async",{value:G});var H=v5(),w=C.TypeError=H.TypeError;C.RangeError=H.RangeError;var V=C.CancellationError=H.CancellationError;C.TimeoutError=H.TimeoutError,C.OperationalError=H.OperationalError,C.RejectionError=H.OperationalError,C.AggregateError=H.AggregateError;var W=function(){},X={},L={},D=eQ0()(C,W),N=q20()(C,W,D,I,U),E=U20()(C),T=E.create,P=J20()(C,E),B=P.CapturedTrace,f=K20()(C,D),S=G20()(L),n=Nh(),R=J.errorObj,p=J.tryCatch;function i(j,x){if(typeof x!=="function")throw new w("expecting a function but got "+J.classString(x));if(j.constructor!==C)throw new w(`thepromiseconstructorcannotbeinvokeddirectly
`)},I=function(){return new S.PromiseInspection(this._target())},U=function(B){return S.reject(new V(B))};function Y(){}var J={},Q=b1(),K;if(Q.isNode)K=function(){var B=process.domain;if(B===void 0)B=null;return B};else K=function(){return null};Q.notEnumerableProp(S,"_getDomain",K);var q=g3(),G=j20(),H=new G;q.defineProperty(S,"_async",{value:H});var W=C5(),V=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var X=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var Z=function(){},w={},D={},O=h20()(S,Z),F=k20()(S,Z,O,U,Y),E=f20()(S),A=E.create,T=i20()(S,E),v=T.CapturedTrace,u=n20()(S,O),g=d20()(D),b=Kg(),C=Q.errorObj,n=Q.tryCatch;function p(B,k){if(typeof k!=="function")throw new V("expecting a function but got "+Q.classString(k));if(B.constructor!==S)throw new V(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function C(j){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,j!==W)i(this,j),this._resolveFromExecutor(j);this._promiseCreated(),this._fireEvent("promiseCreated",this)}C.prototype.toString=function(){return"[object Promise]"},C.prototype.caught=C.prototype.catch=function(j){var x=arguments.length;if(x>1){var d=Array(x-1),t=0,Q0;for(Q0=0;Q0<x-1;++Q0){var H0=arguments[Q0];if(J.isObject(H0))d[t++]=H0;else return I("expecting an object but got A catch statement predicate "+J.classString(H0))}return d.length=t,j=arguments[Q0],this.then(void 0,S(d,j,this))}return this.then(void 0,j)},C.prototype.reflect=function(){return this._then(q,q,void 0,this,void 0)},C.prototype.then=function(j,x){if(P.warnings()&&arguments.length>0&&typeof j!=="function"&&typeof x!=="function"){var d=".then() only accepts functions but was passed: "+J.classString(j);if(arguments.length>1)d+=", "+J.classString(x);this._warn(d)}return this._then(j,x,void 0,void 0,void 0)},C.prototype.done=function(j,x){var d=this._then(j,x,void 0,void 0,void 0);d._setIsFinal()},C.prototype.spread=function(j){if(typeof j!=="function")return I("expecting a function but got "+J.classString(j));return this.all()._then(j,void 0,void 0,X,void 0)},C.prototype.toJSON=function(){var j={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())j.fulfillmentValue=this.value(),j.isFulfilled=!0;else if(this.isRejected())j.rejectionReason=this.reason(),j.isRejected=!0;return j},C.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new N(this).promise()},C.prototype.error=function(j){return this.caught(J.originatesFromRejection,j)},C.getNewLibraryCopy=Mh.exports,C.is=function(j){return j instanceof C},C.fromNode=C.fromCallback=function(j){var x=new C(W);x._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,t=p(j)(n(x,d));if(t===R)x._rejectCallback(t.e,!0);if(!x._isFateSealed())x._setAsyncGuaranteed();return x},C.all=function(j){return new N(j).promise()},C.cast=function(j){var x=D(j);if(!(x instanceof C))x=new C(W),x._captureStackTrace(),x._setFulfilled(),x._rejectionHandler0=j;return x},C.resolve=C.fulfilled=C.cast,C.reject=C.rejected=function(j){var x=new C(W);return x._captureStackTrace(),x._rejectCallback(j,!0),x},C.setScheduler=function(j){if(typeof j!=="function")throw new w("expecting a function but got "+J.classString(j));return G.setScheduler(j)},C.prototype._then=function(j,x,d,t,Q0){var H0=Q0!==void 0,M0=H0?Q0:new C(W),j0=this._target(),X1=j0._bitField;if(!H0){if(M0._propagateFrom(this,3),M0._captureStackTrace(),t===void 0&&(this._bitField&2097152)!==0)if((X1&50397184)!==0)t=this._boundValue();else t=j0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,M0)}var f0=Q();if((X1&50397184)!==0){var z1,O0,h0=j0._settlePromiseCtx;if((X1&33554432)!==0)O0=j0._rejectionHandler0,z1=j;else if((X1&16777216)!==0)O0=j0._fulfillmentHandler0,z1=x,j0._unsetRejectionIsUnhandled();else h0=j0._settlePromiseLateCancellationObserver,O0=new V("late cancellation observer"),j0._attachExtraTrace(O0),z1=x;G.invoke(h0,j0,{handler:f0===null?z1:typeof z1==="function"&&J.domainBind(f0,z1),promise:M0,receiver:t,value:O0})}else j0._addCallbacks(j,x,M0,t,f0);return M0},C.prototype._length=function(){return this._bitField&65535},C.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},C.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},C.prototype._setLength=function(j){this._bitField=this._bitField&-65536|j&65535},C.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},C.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},C.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},C.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},C.prototype._isFinal=function(){return(this._bitField&4194304)>0},C.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},C.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},C.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},C.prototype._setAsyncGuaranteed=function(){if(G.hasCustomScheduler())return;this._bitField=this._bitField|134217728},C.prototype._receiverAt=function(j){var x=j===0?this._receiver0:this[j*4-4+3];if(x===Y)return;else if(x===void 0&&this._isBound())return this._boundValue();return x},C.prototype._promiseAt=function(j){return this[j*4-4+2]},C.prototype._fulfillmentHandlerAt=function(j){return this[j*4-4+0]},C.prototype._rejectionHandlerAt=function(j){return this[j*4-4+1]},C.prototype._boundValue=function(){},C.prototype._migrateCallback0=function(j){var{_bit
Line truncated
`)}function S(B){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,B!==Z)p(this,B),this._resolveFromExecutor(B);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(B){var k=arguments.length;if(k>1){var d=Array(k-1),t=0,K0;for(K0=0;K0<k-1;++K0){var W0=arguments[K0];if(Q.isObject(W0))d[t++]=W0;else return U("expecting an object but got A catch statement predicate "+Q.classString(W0))}return d.length=t,B=arguments[K0],this.then(void 0,g(d,B,this))}return this.then(void 0,B)},S.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},S.prototype.then=function(B,k){if(T.warnings()&&arguments.length>0&&typeof B!=="function"&&typeof k!=="function"){var d=".then() only accepts functions but was passed: "+Q.classString(B);if(arguments.length>1)d+=", "+Q.classString(k);this._warn(d)}return this._then(B,k,void 0,void 0,void 0)},S.prototype.done=function(B,k){var d=this._then(B,k,void 0,void 0,void 0);d._setIsFinal()},S.prototype.spread=function(B){if(typeof B!=="function")return U("expecting a function but got "+Q.classString(B));return this.all()._then(B,void 0,void 0,w,void 0)},S.prototype.toJSON=function(){var B={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())B.fulfillmentValue=this.value(),B.isFulfilled=!0;else if(this.isRejected())B.rejectionReason=this.reason(),B.isRejected=!0;return B},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},S.prototype.error=function(B){return this.caught(Q.originatesFromRejection,B)},S.getNewLibraryCopy=Gg.exports,S.is=function(B){return B instanceof S},S.fromNode=S.fromCallback=function(B){var k=new S(Z);k._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,t=n(B)(b(k,d));if(t===C)k._rejectCallback(t.e,!0);if(!k._isFateSealed())k._setAsyncGuaranteed();return k},S.all=function(B){return new F(B).promise()},S.cast=function(B){var k=O(B);if(!(k instanceof S))k=new S(Z),k._captureStackTrace(),k._setFulfilled(),k._rejectionHandler0=B;return k},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(B){var k=new S(Z);return k._captureStackTrace(),k._rejectCallback(B,!0),k},S.setScheduler=function(B){if(typeof B!=="function")throw new V("expecting a function but got "+Q.classString(B));return H.setScheduler(B)},S.prototype._then=function(B,k,d,t,K0){var W0=K0!==void 0,z0=W0?K0:new S(Z),B0=this._target(),w1=B0._bitField;if(!W0){if(z0._propagateFrom(this,3),z0._captureStackTrace(),t===void 0&&(this._bitField&2097152)!==0)if((w1&50397184)!==0)t=this._boundValue();else t=B0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,z0)}var f0=K();if((w1&50397184)!==0){var G1,N0,g0=B0._settlePromiseCtx;if((w1&33554432)!==0)N0=B0._rejectionHandler0,G1=B;else if((w1&16777216)!==0)N0=B0._fulfillmentHandler0,G1=k,B0._unsetRejectionIsUnhandled();else g0=B0._settlePromiseLateCancellationObserver,N0=new X("late cancellation observer"),B0._attachExtraTrace(N0),G1=k;H.invoke(g0,B0,{handler:f0===null?G1:typeof G1==="function"&&Q.domainBind(f0,G1),promise:z0,receiver:t,value:N0})}else B0._addCallbacks(B,k,z0,t,f0);return z0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(B){this._bitField=this._bitField&-65536|B&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(B){var k=B===0?this._receiver0:this[B*4-4+3];if(k===J)return;else if(k===void 0&&this._isBound())return this._boundValue();return k},S.prototype._promiseAt=function(B){return this[B*4-4+2]},S.prototype._fulfillmentHandlerAt=function(B){return this[B*4-4+0]},S.prototype._rejectionHandlerAt=function(B){return this[B*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(B){var{_bit
Line truncated
`).filter((J)=>J),U=Math.min(...I.map((J)=>J.length-J.trimStart().length)),Y=I.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Y)this.content.push(J)}compile(){let $=Function,q=this?.args,U=[...(this?.content??[""]).map((Y)=>`${Y}`)];return new $(...q,U.join(`
`))}}var cO={major:4,minor:4,patch:3};var n0=o("$ZodType",($,q)=>{var I;$??($={}),$._zod.def=q,$._zod.bag=$._zod.bag||{},$._zod.version=cO;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let Y of U)for(let J of Y._zod.onattach)J($);if(U.length===0)(I=$._zod).deferred??(I.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let Y=(Q,K,z)=>{let G=t5(Q),H;for(let w of K){if(w._zod.def.when){if(oD(Q))continue;if(!w._zod.def.when(Q))continue}else if(G)continue;let V=Q.issues.length,W=w._zod.check(Q);if(W instanceof Promise&&z?.async===!1)throw new J8;if(H||W instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await W,Q.issues.length===V)return;if(!G)G=t5(Q,V)});else{if(Q.issues.length===V)continue;if(!G)G=t5(Q,V)}}if(H)return H.then(()=>{return Q});return Q},J=(Q,K,z)=>{if(t5(Q))return Q.aborted=!0,Q;let G=Y(K,U,z);if(G instanceof Promise){if(z.async===!1)throw new J8;return G.then((H)=>$._zod.parse(H,z))}return $._zod.parse(G,z)};$._zod.run=(Q,K)=>{if(K.skipChecks)return $._zod.parse(Q,K);if(K.direction==="backward"){let G=$._zod.parse({value:Q.value,issues:[]},{...K,skipChecks:!0});if(G instanceof Promise)return G.then((H)=>{return J(H,Q,K)});return J(G,Q,K)}let z=$._zod.parse(Q,K);if(z instanceof Promise){if(K.async===!1)throw new J8;return z.then((G)=>Y(G,U,K))}return Y(z,U,K)}}a0($,"~standard",()=>({validate:(Y)=>{try{let J=Dq($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return dY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),P7=o("$ZodString",($,q)=>{n0.init($,q),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??OO($._zod.bag),$._zod.parse=(I,U)=>{if(q.coerce)try{I.value=String(I.value)}catch(Y){}if(typeof I.value==="string")return I;return I.issues.push({expected:"string",code:"invalid_type",input:I.value,inst:$}),I}}),_1=o("$ZodStringFormat",($,q)=>{Nq.init($,q),P7.init($,q)}),mO=o("$ZodGUID",($,q)=>{q.pattern??(q.pattern=YO),_1.init($,q)}),lO=o("$ZodUUID",($,q)=>{if(q.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[q.version];if(U===void 0)throw Error(`InvalidUUIDversion:"${q.version}"`);q.pattern??(q.pattern=A7(U))}else q.pattern??(q.pattern=A7());_1.init($,q)}),oO=o("$ZodEmail",($,q)=>{q.pattern??(q.pattern=JO),_1.init($,q)}),rO=o("$ZodURL",($,q)=>{_1.init($,q),$._zod.check=(I)=>{try{let U=I.value.trim();if(!q.normalize&&q.protocol?.source===WO.source){if(!/^https?:\/\//i.test(U)){I.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:I.value,inst:$,continue:!q.abort});return}}let Y=new URL(U);if(q.hostname){if(q.hostname.lastIndex=0,!q.hostname.test(Y.hostname))I.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:q.hostname.source,input:I.value,inst:$,continue:!q.abort})}if(q.protocol){if(q.protocol.lastIndex=0,!q.protocol.test(Y.protocol.endsWith(":")?Y.protocol.slice(0,-1):Y.protocol))I.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:q.protocol.source,input:I.value,inst:$,continue:!q.abort})}if(q.normalize)I.value=Y.href;else I.value=U;return}catch(U){I.issues.push({code:"invalid_format",format:"url",input:I.value,inst:$,continue:!q.abort})}}}),tO=o("$ZodEmoji",($,q)=>{q.pattern??(q.pattern=QO()),_1.init($,q)}),aO=o("$ZodNanoID",($,q)=>{q.pattern??(q.pattern=IO),_1.init($,q)}),sO=o("$ZodCUID",($,q)=>{q.pattern??(q.pattern=aD),_1.init($,q)}),eO=o("$ZodCUID2",($,q)=>{q.pattern??(q.pattern=sD),_1.init($,q)}),$N=o("$ZodULID",($,q)=>{q.pattern??(q.pattern=eD),_1.init($,q)}),qN=o("$ZodXID",($,q)=>{q.pattern??(q.pattern=$O),_1.init($,q)}),IN=o("$ZodKSUID",($,q)=>{q.pattern??(q.pattern=qO),_1.init($,q)}),UN=o("$ZodISODateTime",($,q)=>{q.pattern??(q.pattern=DO(q)),_1.init($,q)}),YN=o("$ZodISODate",($,q)=>{q.pattern??(q.pattern=XO),_1.init($,q)}),JN=o("$ZodISOTime",($,q)=>{q.pattern??(q.pattern=LO(q)),_1.init($,q)}),QN=o("$ZodISODuration",($,q)=>{q.pattern??(q.pattern=UO),_1.init($,q)}),KN=o("$ZodIPv4",($,q)=>{q.pattern??(q.pattern=KO),_1.init($,q),$._zod.bag.format="ipv4"}),zN=o("$ZodIPv6",($,q)=>{q.pattern??(q.pattern=zO),_1.init($,q),$._zod.bag.format="ipv6",$._zod.check=(I)=>{try{new URL(`http://[${I.value}]`)}catch{I.issues.push({code:"invalid_format",format:"ipv6",input:I.value,inst:$,continue:!q.abort})}}}),GN=o("$ZodMAC",($,q)=>{q.pattern??(q.pattern=GO(q.delimiter)),_1.init($,q),$._zod.bag.format="mac"}),HN=o("$ZodCIDRv4",($,q)=>{q.pattern??(q.pattern=HO),_1.init($,q)}),wN=o("$ZodCIDRv6",($,q)=>{q.pattern??(q.pattern=wO),_1.init($,q),$._zod.check=(I)=>{let U=I.value.split("/");try{if(U.length!==2)throw Error();let[Y,J]=U;if(!J)throw Error();let Q=Number(J);if(`${Q}`!==J)throw Error();if(Q<0||Q>128)throw Error();new URL(`http://[${Y}]`)}catch{I.issues.push({code:"invalid_format",format:"cidrv6",input:I.value,inst:$,continue:!q.abort})}}});function VN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`).filter((Q)=>Q),Y=Math.min(...U.map((Q)=>Q.length-Q.trimStart().length)),J=U.map((Q)=>Q.slice(Y)).map((Q)=>" ".repeat(this.indent*2)+Q);for(let Q of J)this.content.push(Q)}compile(){let $=Function,I=this?.args,Y=[...(this?.content??[""]).map((J)=>`${J}`)];return new $(...I,Y.join(`
`))}}var _N={major:4,minor:4,patch:3};var i0=o("$ZodType",($,I)=>{var U;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=_N;let Y=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))Y.unshift($);for(let J of Y)for(let Q of J._zod.onattach)Q($);if(Y.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(K,q,G)=>{let H=o5(K),W;for(let V of q){if(V._zod.def.when){if(hO(K))continue;if(!V._zod.def.when(K))continue}else if(H)continue;let X=K.issues.length,Z=V._zod.check(K);if(Z instanceof Promise&&G?.async===!1)throw new Q8;if(W||Z instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Z,K.issues.length===X)return;if(!H)H=o5(K,X)});else{if(K.issues.length===X)continue;if(!H)H=o5(K,X)}}if(W)return W.then(()=>{return K});return K},Q=(K,q,G)=>{if(o5(K))return K.aborted=!0,K;let H=J(q,Y,G);if(H instanceof Promise){if(G.async===!1)throw new Q8;return H.then((W)=>$._zod.parse(W,G))}return $._zod.parse(H,G)};$._zod.run=(K,q)=>{if(q.skipChecks)return $._zod.parse(K,q);if(q.direction==="backward"){let H=$._zod.parse({value:K.value,issues:[]},{...q,skipChecks:!0});if(H instanceof Promise)return H.then((W)=>{return Q(W,K,q)});return Q(H,K,q)}let G=$._zod.parse(K,q);if(G instanceof Promise){if(q.async===!1)throw new Q8;return G.then((H)=>J(H,Y,q))}return J(G,Y,q)}}a0($,"~standard",()=>({validate:(J)=>{try{let Q=OI($,J);return Q.success?{value:Q.data}:{issues:Q.error?.issues}}catch(Q){return pJ($,J).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),z7=o("$ZodString",($,I)=>{i0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??QN($._zod.bag),$._zod.parse=(U,Y)=>{if(I.coerce)try{U.value=String(U.value)}catch(J){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),S1=o("$ZodStringFormat",($,I)=>{FI.init($,I),z7.init($,I)}),gN=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=dO),S1.init($,I)}),yN=o("$ZodUUID",($,I)=>{if(I.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(Y===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=M7(Y))}else I.pattern??(I.pattern=M7());S1.init($,I)}),hN=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=mO),S1.init($,I)}),xN=o("$ZodURL",($,I)=>{S1.init($,I),$._zod.check=(U)=>{try{let Y=U.value.trim();if(!I.normalize&&I.protocol?.source===$N.source){if(!/^https?:\/\//i.test(Y)){U.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:U.value,inst:$,continue:!I.abort});return}}let J=new URL(Y);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(J.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:U.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:U.value,inst:$,continue:!I.abort})}if(I.normalize)U.value=J.href;else U.value=Y;return}catch(Y){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!I.abort})}}}),kN=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=lO()),S1.init($,I)}),uN=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=nO),S1.init($,I)}),fN=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=uO),S1.init($,I)}),bN=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=fO),S1.init($,I)}),iN=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=bO),S1.init($,I)}),pN=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=iO),S1.init($,I)}),nN=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=pO),S1.init($,I)}),cN=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=JN(I)),S1.init($,I)}),dN=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=UN),S1.init($,I)}),mN=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=YN(I)),S1.init($,I)}),lN=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=cO),S1.init($,I)}),oN=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=oO),S1.init($,I),$._zod.bag.format="ipv4"}),rN=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=rO),S1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!I.abort})}}}),tN=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=tO(I.delimiter)),S1.init($,I),$._zod.bag.format="mac"}),aN=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=aO),S1.init($,I)}),sN=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=sO),S1.init($,I),$._zod.check=(U)=>{let Y=U.value.split("/");try{if(Y.length!==2)throw Error();let[J,Q]=Y;if(!Q)throw Error();let K=Number(Q);if(`${K}`!==Q)throw Error();if(K<0||K>128)throw Error();new URL(`http://[${J}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!I.abort})}}});function eN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`)}W.write("payload.value = newResult;"),W.write("return payload;");let E=W.compile();return(T,P)=>E(V,T,P)},J,Q=M7,K=!N7.jitless,G=K&&iD.value,H=q.catchall,w;$._zod.parse=(V,W)=>{w??(w=U.value);let X=V.value;if(!Q(X))return V.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),V;if(K&&G&&W?.async===!1&&W.jitless!==!0){if(!J)J=Y(q.shape);if(V=J(V,W),!H)return V;return qk([],X,V,W,w,$)}return I(V,W)}});function fx($,q,I,U){for(let J of $)if(J.issues.length===0)return q.value=J.value,q;let Y=$.filter((J)=>!t5(J));if(Y.length===1)return q.value=Y[0].value,Y[0];return q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))}),q}var tY=o("$ZodUnion",($,q)=>{n0.init($,q),a0($._zod,"optin",()=>q.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),a0($._zod,"optout",()=>q.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),a0($._zod,"values",()=>{if(q.options.every((U)=>U._zod.values))return new Set(q.options.flatMap((U)=>Array.from(U._zod.values)));return}),a0($._zod,"pattern",()=>{if(q.options.every((U)=>U._zod.pattern)){let U=q.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${U.map((Y)=>uY(Y.source)).join("|")})$`)}return});let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else{if(z.issues.length===0)return z;Q.push(z)}}if(!J)return fx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return fx(K,U,$,Y)})}});function bx($,q,I,U){let Y=$.filter((J)=>J.issues.length===0);if(Y.length===1)return q.value=Y[0].value,q;if(Y.length===0)q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))});else q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:[],inclusive:!1});return q}var vN=o("$ZodXor",($,q)=>{tY.init($,q),q.inclusive=!1;let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else Q.push(z)}if(!J)return bx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return bx(K,U,$,Y)})}}),CN=o("$ZodDiscriminatedUnion",($,q)=>{q.inclusive=!1,tY.init($,q);let I=$._zod.parse;a0($._zod,"propValues",()=>{let Y={};for(let J of q.options){let Q=J._zod.propValues;if(!Q||Object.keys(Q).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${q.options.indexOf(J)}"`);for(let[K,z]of Object.entries(Q)){if(!Y[K])Y[K]=new Set;for(let G of z)Y[K].add(G)}}return Y});let U=Vq(()=>{let Y=q.options,J=new Map;for(let Q of Y){let K=Q._zod.propValues?.[q.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${q.options.indexOf(Q)}"`);for(let z of K){if(J.has(z))throw Error(`Duplicatediscriminatorvalue"${String(z)}"`);J.set(z,Q)}}return J});$._zod.parse=(Y,J)=>{let Q=Y.value;if(!M7(Q))return Y.issues.push({code:"invalid_type",expected:"object",input:Q,inst:$}),Y;let K=U.value.get(Q?.[q.discriminator]);if(K)return K._zod.run(Y,J);if(q.unionFallback||J.direction==="backward")return I(Y,J);return Y.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:q.discriminator,options:Array.from(U.value.keys()),input:Q,path:[q.discriminator],inst:$}),Y}}),_N=o("$ZodIntersection",($,q)=>{n0.init($,q),$._zod.parse=(I,U)=>{let Y=I.value,J=q.left._zod.run({value:Y,issues:[]},U),Q=q.right._zod.run({value:Y,issues:[]},U);if(J instanceof Promise||Q instanceof Promise)return Promise.all([J,Q]).then(([z,G])=>{return nx(I,z,G)});return nx(I,J,Q)}});function dO($,q){if($===q)return{valid:!0,data:$};if($ instanceof Date&&q instanceof Date&&+$===+q)return{valid:!0,data:$};if(r5($)&&r5(q)){let I=Object.keys(q),U=Object.keys($).filter((J)=>I.indexOf(J)!==-1),Y={...$,...q};for(let J of U){let Q=dO($[J],q[J]);if(!Q.valid)return{valid:!1,mergeErrorPath:[J,...Q.mergeErrorPath]};Y[J]=Q.data}return{valid:!0,data:Y}}if(Array.isArray($)&&Array.isArray(q)){if($.length!==q.length)return{valid:!1,mergeErrorPath:[]};let I=[];for(let U=0;U<$.length;U++){let Y=$[U],J=q[U],Q=dO(Y,J);if(!Q.valid)return{valid:!1,mergeErrorPath:[U,...Q.mergeErrorPath]};I.push(Q.data)}return{valid:!0,data:I}}return{valid:!1,mergeErrorPath:[]}}function nx($,q,I){let U=new Map,Y;for(let K of q.issues)if(K.code==="unrecognized_keys"){Y??(Y=K);for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).l=!0}}else $.issues.push(K);for(let K of I.issues)if(K.code==="unrecognized_keys")for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).r=!0}else $.issues.push(K);let J=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Y)$.issues.push({...Y,keys:J});if(t5($))return $;let Q=dO(q.value,I.value);if(!Q.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var HG=o("$ZodTuple",($,q)=>{n0.
Line truncated
`)}Z.write("payload.value = newResult;"),Z.write("return payload;");let E=Z.compile();return(A,T)=>E(X,A,T)},Q,K=F7,q=!O7.jitless,H=q&&CO.value,W=I.catchall,V;$._zod.parse=(X,Z)=>{V??(V=Y.value);let w=X.value;if(!K(w))return X.issues.push({expected:"object",code:"invalid_type",input:w,inst:$}),X;if(q&&H&&Z?.async===!1&&Z.jitless!==!0){if(!Q)Q=J(I.shape);if(X=Q(X,Z),!W)return X;return kk([],w,X,Z,V,$)}return U(X,Z)}});function zk($,I,U,Y){for(let Q of $)if(Q.issues.length===0)return I.value=Q.value,I;let J=$.filter((Q)=>!o5(Q));if(J.length===1)return I.value=J[0].value,J[0];return I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>A6(K,Y,Z4())))}),I}var lJ=o("$ZodUnion",($,I)=>{i0.init($,I),a0($._zod,"optin",()=>I.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),a0($._zod,"optout",()=>I.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),a0($._zod,"values",()=>{if(I.options.every((Y)=>Y._zod.values))return new Set(I.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),a0($._zod,"pattern",()=>{if(I.options.every((Y)=>Y._zod.pattern)){let Y=I.options.map((J)=>J._zod.pattern);return new RegExp(`^(${Y.map((J)=>gJ(J.source)).join("|")})$`)}return});let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let G=q._zod.run({value:Y.value,issues:[]},J);if(G instanceof Promise)K.push(G),Q=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!Q)return zk(K,Y,$,J);return Promise.all(K).then((q)=>{return zk(q,Y,$,J)})}});function Ak($,I,U,Y){let J=$.filter((Q)=>Q.issues.length===0);if(J.length===1)return I.value=J[0].value,I;if(J.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>A6(K,Y,Z4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:[],inclusive:!1});return I}var OF=o("$ZodXor",($,I)=>{lJ.init($,I),I.inclusive=!1;let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let G=q._zod.run({value:Y.value,issues:[]},J);if(G instanceof Promise)K.push(G),Q=!0;else K.push(G)}if(!Q)return Ak(K,Y,$,J);return Promise.all(K).then((q)=>{return Ak(q,Y,$,J)})}}),NF=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,lJ.init($,I);let U=$._zod.parse;a0($._zod,"propValues",()=>{let J={};for(let Q of I.options){let K=Q._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Q)}"`);for(let[q,G]of Object.entries(K)){if(!J[q])J[q]=new Set;for(let H of G)J[q].add(H)}}return J});let Y=ZI(()=>{let J=I.options,Q=new Map;for(let K of J){let q=K._zod.propValues?.[I.discriminator];if(!q||q.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(K)}"`);for(let G of q){if(Q.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);Q.set(G,K)}}return Q});$._zod.parse=(J,Q)=>{let K=J.value;if(!F7(K))return J.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),J;let q=Y.value.get(K?.[I.discriminator]);if(q)return q._zod.run(J,Q);if(I.unionFallback||Q.direction==="backward")return U(J,Q);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(Y.value.keys()),input:K,path:[I.discriminator],inst:$}),J}}),FF=o("$ZodIntersection",($,I)=>{i0.init($,I),$._zod.parse=(U,Y)=>{let J=U.value,Q=I.left._zod.run({value:J,issues:[]},Y),K=I.right._zod.run({value:J,issues:[]},Y);if(Q instanceof Promise||K instanceof Promise)return Promise.all([Q,K]).then(([G,H])=>{return Pk(U,G,H)});return Pk(U,Q,K)}});function SN($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(l5($)&&l5(I)){let U=Object.keys(I),Y=Object.keys($).filter((Q)=>U.indexOf(Q)!==-1),J={...$,...I};for(let Q of Y){let K=SN($[Q],I[Q]);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};J[Q]=K.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Y=0;Y<$.length;Y++){let J=$[Y],Q=I[Y],K=SN(J,Q);if(!K.valid)return{valid:!1,mergeErrorPath:[Y,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Pk($,I,U){let Y=new Map,J;for(let q of I.issues)if(q.code==="unrecognized_keys"){J??(J=q);for(let G of q.keys){if(!Y.has(G))Y.set(G,{});Y.get(G).l=!0}}else $.issues.push(q);for(let q of U.issues)if(q.code==="unrecognized_keys")for(let G of q.keys){if(!Y.has(G))Y.set(G,{});Y.get(G).r=!0}else $.issues.push(q);let Q=[...Y].filter(([,q])=>q.l&&q.r).map(([q])=>q);if(Q.length&&J)$.issues.push({...J,keys:Q});if(o5($))return $;let K=SN(I.value,U.value);if(!K.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var IH=o("$ZodTuple",($,I)=>{i0.
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letQof$.seen.entries()){letK=Q[1];if(q===Q[0]){J(Q);continue}if($.external){letG=$.external.registry.get(Q[0])?.id;if(q!==Q[0]&&G){J(Q);continue}}if($.metadataRegistry.get(Q[0])?.id){J(Q);continue}if(K.cycle){J(Q);continue}if(K.count>1){if($.reused==="ref"){J(Q);continue}}}}functionq9($,q){letI=$.seen.get(q);if(!I)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letz=$.seen.get(K);if(z.ref===null)return;letG=z.def??z.schema,H={...G},w=z.ref;if(z.ref=null,w){U(w);letW=$.seen.get(w),X=W.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))G.allOf=G.allOf??[],G.allOf.push(X);elseObject.assign(G,X);if(Object.assign(G,H),K._zod.parent===w)for(letDinG){if(D==="$ref"||D==="allOf")continue;if(!(DinH))deleteG[D]}if(X.$ref&&W.def)for(letDinG){if(D==="$ref"||D==="allOf")continue;if(DinW.def&&JSON.stringify(G[D])===JSON.stringify(W.def[D]))deleteG[D]}}letV=K._zod.parent;if(V&&V!==w){U(V);letW=$.seen.get(V);if(W?.schema.$ref){if(G.$ref=W.schema.$ref,W.def)for(letXinG){if(X==="$ref"||X==="allOf")continue;if(XinW.def&&JSON.stringify(G[X])===JSON.stringify(W.def[X]))deleteG[X]}}}$.override({zodSchema:K,jsonSchema:G,path:z.path??[]})};for(letKof[...$.seen.entries()].reverse())U(K[0]);letY={};if($.target==="draft-2020-12")Y.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")Y.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")Y.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letK=$.external.registry.get(q)?.id;if(!K)throwError("Schema is missing an `id` property");Y.$id=$.external.uri(K)}Object.assign(Y,I.def??I.schema);letJ=$.metadataRegistry.get(q)?.id;if(J!==void0&&Y.id===J)deleteY.id;letQ=$.external?.defs??{};for(letKof$.seen.entries()){letz=K[1];if(z.def&&z.defId){if(z.def.id===z.defId)deletez.def.id;Q[z.defId]=z.def}}if($.external);elseif(Object.keys(Q).length>0)if($.target==="draft-2020-12")Y.$defs=Q;elseY.definitions=Q;try{letK=JSON.parse(JSON.stringify(Y));returnObject.defineProperty(K,"~standard",{value:{...q["~standard"],jsonSchema:{input:Sq(q,"input",$.processors),output:Sq(q,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionE6($,q){letI=q??{seen:newSet};if(I.seen.has($))return!1;I.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnE6(U.element,I);if(U.type==="set")returnE6(U.valueType,I);if(U.type==="lazy")returnE6(U.getter(),I);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnE6(U.innerType,I);if(U.type==="intersection")returnE6(U.left,I)||E6(U.right,I);if(U.type==="record"||U.type==="map")returnE6(U.keyType,I)||E6(U.valueType,I);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnE6(U.in,I)||E6(U.out,I)}if(U.type==="object"){for(letYinU.shape)if(E6(U.shape[Y],I))return!0;return!1}if(U.type==="union"){for(letYofU.options)if(E6(Y,I))return!0;return!1}if(U.type==="tuple"){for(letYofU.items)if(E6(Y,I))return!0;if(U.rest&&E6(U.rest,I))return!0;return!1}return!1}varkM=($,q={})=>(I)=>{letU=e5({...I,processors:q});returnR1($,U),$9(U,$),q9(U,$)},Sq=($,q,I={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=e5({...Y??{},target:J,io:q,processors:I});returnR1($,Q),$9(Q,$),q9(Q,$)};varfO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fM=($,q,I,U)=>{letY=I;Y.type="string";let{minimum:J,maximum:Q,format:K,patterns:z,contentEncoding:G}=$._zod.bag;if(typeofJ==="number")Y.minLength=J;if(typeofQ==="number")Y.maxLength=Q;if(K){if(Y.format=fO0[K]??K,Y.format==="")deleteY.format;if(K==="time")deleteY.format}if(G)Y.contentEncoding=G;if(z&&z.size>0){letH=[...z];if(H.length===1)Y.pattern=H[0].source;elseif(H.length>1)Y.allOf=[...H.map((w)=>({...q.target==="draft-07"||q.target==="draft-04"||q.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))]}},bM=($,q,I,U)=>{letY=I,{minimum:J,maximum:Q,format:K,multipleOf:z,exclusiveMaximum:G,exclusiveMinimum:H}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Y.type="integer";elseY.type="number";letw=typeofH==="number"&&H>=(J??Number.NEGATIVE_INFINITY),V=typeofG==="number"&&G<=(Q??Number.POSITIVE_INFINITY),W=q.target==="draft-04"||q.target==="openapi-3.0";if(w)if(W)Y.minimum=H,Y.exclusiveMinimum=!0;elseY.exclusiveMinimum=H;elseif(typeofJ==="number")Y.minimum=J;if(V)if(W)Y.maximum=G,Y.exclusiveMaximum=!0;elseY.exclusiveMaximum=G;elseif(typeofQ==="number")Y.maximum=Q;if(typeofz==="number")Y.multipleOf=z},nM=($,q,I,U)=>{I.type="boolean"},iM=($,q,I,U)=>{if(q.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},pM=($,q,I,U)=>{if(q.unrepresentable==Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letKof$.seen.entries()){letq=K[1];if(I===K[0]){Q(K);continue}if($.external){letH=$.external.registry.get(K[0])?.id;if(I!==K[0]&&H){Q(K);continue}}if($.metadataRegistry.get(K[0])?.id){Q(K);continue}if(q.cycle){Q(K);continue}if(q.count>1){if($.reused==="ref"){Q(K);continue}}}}functione5($,I){letU=$.seen.get(I);if(!U)throwError("Unprocessed schema. This is a bug in Zod.");letY=(q)=>{letG=$.seen.get(q);if(G.ref===null)return;letH=G.def??G.schema,W={...H},V=G.ref;if(G.ref=null,V){Y(V);letZ=$.seen.get(V),w=Z.schema;if(w.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(w);elseObject.assign(H,w);if(Object.assign(H,W),q._zod.parent===V)for(letOinH){if(O==="$ref"||O==="allOf")continue;if(!(OinW))deleteH[O]}if(w.$ref&&Z.def)for(letOinH){if(O==="$ref"||O==="allOf")continue;if(OinZ.def&&JSON.stringify(H[O])===JSON.stringify(Z.def[O]))deleteH[O]}}letX=q._zod.parent;if(X&&X!==V){Y(X);letZ=$.seen.get(X);if(Z?.schema.$ref){if(H.$ref=Z.schema.$ref,Z.def)for(letwinH){if(w==="$ref"||w==="allOf")continue;if(winZ.def&&JSON.stringify(H[w])===JSON.stringify(Z.def[w]))deleteH[w]}}}$.override({zodSchema:q,jsonSchema:H,path:G.path??[]})};for(letqof[...$.seen.entries()].reverse())Y(q[0]);letJ={};if($.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letq=$.external.registry.get(I)?.id;if(!q)throwError("Schema is missing an `id` property");J.$id=$.external.uri(q)}Object.assign(J,U.def??U.schema);letQ=$.metadataRegistry.get(I)?.id;if(Q!==void0&&J.id===Q)deleteJ.id;letK=$.external?.defs??{};for(letqof$.seen.entries()){letG=q[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;K[G.defId]=G.def}}if($.external);elseif(Object.keys(K).length>0)if($.target==="draft-2020-12")J.$defs=K;elseJ.definitions=K;try{letq=JSON.parse(JSON.stringify(J));returnObject.defineProperty(q,"~standard",{value:{...I["~standard"],jsonSchema:{input:yI(I,"input",$.processors),output:yI(I,"output",$.processors)}},enumerable:!1,writable:!1}),q}catch(q){throwError("Error converting schema to JSON.")}}functionT6($,I){letU=I??{seen:newSet};if(U.seen.has($))return!1;U.seen.add($);letY=$._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")returnT6(Y.element,U);if(Y.type==="set")returnT6(Y.valueType,U);if(Y.type==="lazy")returnT6(Y.getter(),U);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")returnT6(Y.innerType,U);if(Y.type==="intersection")returnT6(Y.left,U)||T6(Y.right,U);if(Y.type==="record"||Y.type==="map")returnT6(Y.keyType,U)||T6(Y.valueType,U);if(Y.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnT6(Y.in,U)||T6(Y.out,U)}if(Y.type==="object"){for(letJinY.shape)if(T6(Y.shape[J],U))return!0;return!1}if(Y.type==="union"){for(letJofY.options)if(T6(J,U))return!0;return!1}if(Y.type==="tuple"){for(letJofY.items)if(T6(J,U))return!0;if(Y.rest&&T6(Y.rest,U))return!0;return!1}return!1}varEz=($,I={})=>(U)=>{letY=a5({...U,processors:I});returnC1($,Y),s5(Y,$),e5(Y,$)},yI=($,I,U={})=>(Y)=>{let{libraryOptions:J,target:Q}=Y??{},K=a5({...J??{},target:Q,io:I,processors:U});returnC1($,K),s5(K,$),e5(K,$)};varvO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bz=($,I,U,Y)=>{letJ=U;J.type="string";let{minimum:Q,maximum:K,format:q,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofQ==="number")J.minLength=Q;if(typeofK==="number")J.maxLength=K;if(q){if(J.format=vO0[q]??q,J.format==="")deleteJ.format;if(q==="time")deleteJ.format}if(H)J.contentEncoding=H;if(G&&G.size>0){letW=[...G];if(W.length===1)J.pattern=W[0].source;elseif(W.length>1)J.allOf=[...W.map((V)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:V.source}))]}},Rz=($,I,U,Y)=>{letJ=U,{minimum:Q,maximum:K,format:q,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofq==="string"&&q.includes("int"))J.type="integer";elseJ.type="number";letV=typeofW==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),X=typeofH==="number"&&H<=(K??Number.POSITIVE_INFINITY),Z=I.target==="draft-04"||I.target==="openapi-3.0";if(V)if(Z)J.minimum=W,J.exclusiveMinimum=!0;elseJ.exclusiveMinimum=W;elseif(typeofQ==="number")J.minimum=Q;if(X)if(Z)J.maximum=H,J.exclusiveMaximum=!0;elseJ.exclusiveMaximum=H;elseif(typeofK==="number")J.maximum=K;if(typeofG==="number")J.multipleOf=G},vz=($,I,U,Y)=>{U.type="boolean"},Cz=($,I,U,Y)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},jz=($,I,U,Y)=>{if(I.unrepresentable==Line truncated
`)}return{warnings:[],results:K}}function II($){return{fileBuffer:aK1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as Iq1}from"node:fs";async function rD($,I,U={}){let J=D4().stateful?"stateful":"stateless",Q="ok",K,q,G;try{let A=await F$($);G={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Q="error",K=A instanceof Error?A.message:String(A)}let H=[];if(Q==="ok")try{H=await Z9($,I.seal.endpoints.approvalStylePreferences)}catch(A){Q="error",K=`读取Webhook配置失败:${AinstanceofError?A.message:String(A)}`}let W=H.length===1,V=H.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...W?{isDefault:!0}:{}})),X=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,Z;if(U.filePath)if(!Iq1(U.filePath))Z={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在:${U.filePath}`]};else try{let A=II(U.filePath),T=await $I(A.fileBuffer,A.fileName);Z={valid:!0,filePath:U.filePath,fileName:A.fileName,documentCount:T.documents.length,warnings:T.warnings}}catch(A){Z={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let w=Z?Z.valid:!0,D=Q==="ok"&&V.length>0&&w,O=J==="stateful"?"":`--corp${I.id}`,F="",E="";if(Q!=="ok")E=`凭证鉴权异常:${K}`,F=`seal-useauthdiagnose${O}`;else if(V.length===0)E="当前企业尚未配置任何 Webhook 集成通道",F=`seal-usewebhookadd--name"默认入站通道"--result-url"https://your-domain.com/callback"${O}`;else if(Z&&!Z.valid)E=`材料包预检失败:${Z.errors?.join("; ")}`,F=`seal-usewebhookmaterial-packpreview${Z.filePath}${O}`;else{E=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到${V.length}个Webhook通道,等待载入`;let A=Z?.filePath??"<材料包.zip>",T=W?"":`--webhook${X?X.id:"<webhookIdOrName>"}`;F=`seal-usewebhookmaterial-packpush${A}${T}${O}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:q,user:G},stateMode:J,authStatus:Q,authError:K,activeWebhooks:V,defaultWebhook:X,materialPack:Z,statusMessage:E,nextAction:F}}var YG=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:L.object({}),handler:async($)=>F$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:L.object({}),handler:async($)=>jd($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:L.object({}),handler:async($)=>$m($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:L.object({note:L.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>XU($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:L.object({tokenId:L.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>Im($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:L.object({name:L.string().describe("用户姓名"),phone:L.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:L.array(L.string()).optional().describe("权限列表,默认为 []"),departmentIds:L.array(L.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>Um($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>ME($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>RV($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:L.object({keyword:L.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>vV($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>Ym($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>zE($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 Seal 用户(按用户ID、手机号或姓名)重置密码登录
Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of w){let W=V.outboundName??"SealAI 审批",X=V.signKey,L=V.apiOrigin??"production";console.error(`•"${W}"(signKey:${X},环境:${L})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${Y.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let L=X.outboundName??"SealAI 审批",D=X.signKey,N=X.apiOrigin??"production";console.error(`•"${L}"(signKey:${D},环境:${N})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${D}--corp${Y.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let Z=X.outboundName??"SealAI 审批",w=X.signKey,D=X.apiOrigin??"production";console.error(`•"${Z}"(signKey:${w},环境:${D})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${w}--corp${J.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let w of X){let D=w.outboundName??"SealAI 审批",O=w.signKey,F=w.apiOrigin??"production";console.error(`•"${D}"(signKey:${O},环境:${F})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${O}--corp${J.id}
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],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",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",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",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",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 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:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",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:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",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:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{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:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",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:{"2
Line truncated
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],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",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",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",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",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 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:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",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:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",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:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{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:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",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:{"2
Line truncated
`);Y(U)})})}async function _Z0($){let q=I1($.options.port)??I1($.options.p),I=y($.options.host)??y($.options.h),U=await AD({port:q,host:I}),Y=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Y),process.on("SIGTERM",Y),await new Promise(()=>{})}async function hZ0($,q,I,U){if($==="config"||$==="get"){await N0("seal_llm_config_get",q,I,{},D0(U.options));return}if($==="providers"||$==="list"){await N0("seal_llm_providers_list",q,I,{},D0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function SZ0($,q){if($==="config"||$==="json"){Nu();return}await Fu()}function Nu(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function yZ0($){let q=DD();E0(q,{...D0($.options),allowFull:!0})}async function uZ0($,q,I,U){if($==="available"){await N0("seal_permissions_available_list",q,I,{},D0(U.options));return}if($==="configs"||$==="list"){await N0("seal_permissions_configs_list",q,I,{},D0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as xZ0}from"node:fs";async function kZ0($,q,I,U,Y,J,Q){if(!$||$==="get"){await N0("seal_preference_get",Y,J,{},D0(Q.options));return}if($==="decision"){if(q==="update"||!q){let K=y(Q.options.input),z=K?JSON.parse(xZ0(K,"utf8")):a6(Q.json);if(!z||Object.keys(z).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await N0("seal_preference_decision_update",Y,J,z,D0(Q.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(q==="set"){let K=y(Q.options.default)??y(Q.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await N0("seal_preference_thinking_depth_set",Y,J,{defaultLevel:K},D0(Q.options));return}if(q==="policies"){if(I==="list"||!I){await N0("seal_preference_thinking_depth_policies_list",Y,J,{},D0(Q.options));return}if(I==="upsert"){let K=y(Q.options.input),z=K?JSON.parse(xZ0(K,"utf8")):a6(Q.json);if(!z||!z.id||!z.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await N0("seal_preference_thinking_depth_policies_upsert",Y,J,z,D0(Q.options));return}if(I==="remove"||I==="delete"){let K=U??y(Q.options.id)??y(Q.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await N0("seal_preference_thinking_depth_policies_remove",Y,J,{policyId:K},D0(Q.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function fZ0($={}){let q=n8(),I=R4(),U=HY(q,{stateful:I.stateful,defaultCorpId:I.defaultCorpId,corpId:$.corpId},t3());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Y=await TY(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Y,null,2));let J=await I4(U),Q=await bw(J,{documentLimit:20,stylePreferencesEndpoint:U.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:Q.rules.rules.length,hasPendingRuleDeletes:Q.rules.hasPendingDeletes,documents:Q.documents.articles.length,documentsTotal:Q.documents.total,stylePreferences:Q.stylePreferences.ok?"ok":`error:${Q.stylePreferences.error}`},null,2))}async function bZ0($,q,I){let U=q??y(I.options.corp)??($&&$!=="--corp"?$:void 0);await fZ0({corpId:U})}async function Mu($,q,I,U,Y){if($==="count"){await N0("seal_approval_rules_list",I,U,{countOnly:!0},D0(Y.options));return}if($==="list"){if(C0(Y.options.count)){await N0("seal_approval_rules_list",I,U,{countOnly:!0},D0(Y.options));return}let J=I1(Y.options.limit),Q=I1(Y.options.offset);if(C0(Y.options.summary)){await N0("seal_approval_rules_list",I,U,{fields:zZ0,limit:J,offset:Q},D0(Y.options));return}let K=await Jq("seal_approval_rules_list",I,U,{limit:J,offset:Q});GZ0(K,C0(Y.options.full)===!0),E0(K);return}if($==="clear"){let J=C0(Y.options.yes)===!0,Q=C0(Y.options.dryRun)??C0(Y.options["dry-run"])??!J;if(!J&&!Q)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let K=await Jq("seal_approval_rules_clear",I,U,{dryRun:Q,recode:C0(Y.options.recode)});if(!J&&Q&&K&&typeof K==="object"){E0({...K,nextCommand:`seal-userulesclear--corp${U.id}--yes`},D0(Y.options));return}E0(K,D0(Y.options));return}if($==="versions"){await N0("seal_approval_rule_versions_list",I,U,{},D0(Y.options));return}if($==="version"){let J=q??y(Y.options.version);if(!J)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await N0("seal_approval_rule_version_get",I,U,Zz(J),D0(Y.options));return}if($==="get"){await N0("seal_approval_rule_get",I,U,{...KZ0(y(Y.options.version)),code:y(Y.options.code),runtimeId:y(Y.options.runtimeId)??y(Y.options["runtime-id"]),recordId:y(Y.options.r
Line truncated
`).filter(Boolean),J=Y.slice(-q);return{logFile:I,lines:J,totalLines:Y.length}}async function OG1($){let q=jD($),I=Tu($),U=Nz($);cZ0($.stateDir);let Y=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):FD),J=$.host??(process.env.HOST?process.env.HOST:MD);TD(q,`${process.pid}
`,{mode:384}),TD(I,JSON.stringify({pid:process.pid,port:Y,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),EY(U,`servicestartingonhttp://${J}:${Y} pid=${process.pid}`);let Q=null;try{Q=await AD({port:Y,host:J,silent:!0}),EY(U,`service listening pid=${process.pid}`)}catch(z){if(EY(U,`service failed to bind port ${Y}: ${z instanceof Error?z.message:String(z)}`),ED(q)===process.pid)c8(q,{force:!0}),c8(I,{force:!0});throw z}let K=()=>{if(Q)Q.close(),Q=null;if(ED(q)===process.pid)c8(q,{force:!0}),c8(I,{force:!0});EY(U,`stopped pid=${process.pid}`)};await new Promise((z)=>{let G=!1,H=()=>{if(G)return;G=!0,K(),process.off("SIGTERM",H),process.off("SIGINT",H),z()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function nZ0($){cZ0($.stateDir);let q=jY($);if(q.running)return q;let I=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...I.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Y=ZG1(I.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Y.unref();let J=jD($);return TD(J,`${Y.pid}
`);J(Y)})})}async function zX0($){let I=U1($.options.port)??U1($.options.p),U=h($.options.host)??h($.options.h),Y=await HO({port:I,host:U}),J=()=>{Y.close(()=>{process.exit(0)})};process.on("SIGINT",J),process.on("SIGTERM",J),await new Promise(()=>{})}async function AX0($,I,U,Y){if($==="config"||$==="get"){await F0("seal_llm_config_get",I,U,{},O0(Y.options));return}if($==="providers"||$==="list"){await F0("seal_llm_providers_list",I,U,{},O0(Y.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function PX0($,I){if($==="config"||$==="json"){Ix();return}await Ux()}function Ix(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function TX0($){let I=JO();E0(I,{...O0($.options),allowFull:!0})}async function EX0($,I,U,Y){if($==="available"){await F0("seal_permissions_available_list",I,U,{},O0(Y.options));return}if($==="configs"||$==="list"){await F0("seal_permissions_configs_list",I,U,{},O0(Y.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as BX0}from"node:fs";async function RX0($,I,U,Y,J,Q,K){if(!$||$==="get"){await F0("seal_preference_get",J,Q,{},O0(K.options));return}if($==="decision"){if(I==="update"||!I){let q=h(K.options.input),G=q?JSON.parse(BX0(q,"utf8")):t6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await F0("seal_preference_decision_update",J,Q,G,O0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let q=h(K.options.default)??h(K.options.level)??Y;if(q!=="medium"&&q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await F0("seal_preference_thinking_depth_set",J,Q,{defaultLevel:q},O0(K.options));return}if(I==="policies"){if(U==="list"||!U){await F0("seal_preference_thinking_depth_policies_list",J,Q,{},O0(K.options));return}if(U==="upsert"){let q=h(K.options.input),G=q?JSON.parse(BX0(q,"utf8")):t6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await F0("seal_preference_thinking_depth_policies_upsert",J,Q,G,O0(K.options));return}if(U==="remove"||U==="delete"){let q=Y??h(K.options.id)??h(K.options.policyId);if(!q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await F0("seal_preference_thinking_depth_policies_remove",J,Q,{policyId:q},O0(K.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function vX0($={}){let I=b8(),U=D4(),Y=WJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},o3());console.log(`[probe]corp=${Y.id}source=${Y.source.type}`);let J=await zJ(Y);console.log("[probe] seal enterprise"),console.log(JSON.stringify(J,null,2));let Q=await U4(Y),K=await _V(Q,{documentLimit:20,stylePreferencesEndpoint:Y.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error:${K.stylePreferences.error}`},null,2))}async function CX0($,I,U){let Y=I??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await vX0({corpId:Y})}async function Yx($,I,U,Y,J){if($==="count"){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},O0(J.options));return}if($==="list"){if(_0(J.options.count)){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},O0(J.options));return}let Q=U1(J.options.limit),K=U1(J.options.offset);if(_0(J.options.summary)){await F0("seal_approval_rules_list",U,Y,{fields:aZ0,limit:Q,offset:K},O0(J.options));return}let q=await QI("seal_approval_rules_list",U,Y,{limit:Q,offset:K});sZ0(q,_0(J.options.full)===!0),E0(q);return}if($==="clear"){let Q=_0(J.options.yes)===!0,K=_0(J.options.dryRun)??_0(J.options["dry-run"])??!Q;if(!Q&&!K)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let q=await QI("seal_approval_rules_clear",U,Y,{dryRun:K,recode:_0(J.options.recode)});if(!Q&&K&&q&&typeof q==="object"){E0({...q,nextCommand:`seal-userulesclear--corp${Y.id}--yes`},O0(J.options));return}E0(q,O0(J.options));return}if($==="versions"){await F0("seal_approval_rule_versions_list",U,Y,{},O0(J.options));return}if($==="version"){let Q=I??h(J.options.version);if(!Q)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await F0("seal_approval_rule_version_get",U,Y,QG(Q),O0(J.options));return}if($==="get"){await F0("seal_approval_rule_get",U,Y,{...tZ0(h(J.options.version)),code:h(J.options.code),runtimeId:h(J.options.runtimeId)??h(J.options["runtime-id"]),recordId:h(J.options.r
Line truncated
`).filter(Boolean),Q=J.slice(-I);return{logFile:U,lines:Q,totalLines:J.length}}async function eq1($){let I=XO($),U=Kx($),Y=WG($);gX0($.stateDir);let J=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):qO),Q=$.host??(process.env.HOST?process.env.HOST:GO);VO(I,`${process.pid}
`,{mode:384}),VO(U,JSON.stringify({pid:process.pid,port:J,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),AJ(Y,`servicestartingonhttp://${Q}:${J} pid=${process.pid}`);let K=null;try{K=await HO({port:J,host:Q,silent:!0}),AJ(Y,`service listening pid=${process.pid}`)}catch(G){if(AJ(Y,`service failed to bind port ${J}: ${G instanceof Error?G.message:String(G)}`),ZO(I)===process.pid)n8(I,{force:!0}),n8(U,{force:!0});throw G}let q=()=>{if(K)K.close(),K=null;if(ZO(I)===process.pid)n8(I,{force:!0}),n8(U,{force:!0});AJ(Y,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,q(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function jX0($){gX0($.stateDir);let I=PJ($);if(I.running)return I;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Y=[...U.args??[],"service","run"];if($.port)Y.push("--port",String($.port));if($.host)Y.push("--host",String($.host));let J=rq1(U.command,Y,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});J.unref();let Q=XO($);return VO(Q,`${J.pid}
`,{flag:"a",mode:384})}var qx=UG1(IG1(),".config","seal-use");async function Gx($,I,U){let Y=U?U1(U.options.port)??U1(U.options.p):void 0,J=U?h(U.options.host)??h(U.options.h):void 0,Q=U?U1(U.options.lines)??U1(U.options.n):void 0,K=await KI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:qx,version:e0,launcher:I.launcher,port:Y,host:J},{maxLines:Q});if(K!==void 0)E0(K)}import{existsSync as YG1,readFileSync as yX0}from"node:fs";async function hX0($,I,U,Y,J){if($==="batch-records"||$==="records"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await F0("seal_simulation_batch_records_get",U,Y,{batchId:Q,query:h(J.options.query)},O0(J.options));return}if($==="create"||$==="run"){let Q=h(J.options.mode)??h(J.options.sourceSystem)??h(J.options["source-system"])??"hosecloud",K=Q==="material-pack"?"material_pack":Q,q=h(J.options.schemaConfig)??h(J.options["schema-config"]),G=q?JSON.parse(yX0(q,"utf8")):void 0,H=h(J.options.input),W=H?JSON.parse(yX0(H,"utf8")):t6(J.json),V=h(J.options.packageId)??h(J.options["package-id"]),X=M6(J.options.packageIds)??M6(J.options["package-ids"])??(V?[V]:void 0),Z=M6(J.options.flowIds)??M6(J.options["flow-ids"])??M6(J.options.documentSn)??M6(J.options["document-sn"]),w=h(J.options.signKey)??h(J.options["sign-key"])??h(J.options.integration);await F0("seal_simulation_batch_create",U,Y,{mode:K,sourceSystem:K,flowIds:Z,documentSn:Z,rejectNodeName:h(J.options.rejectNode)??h(J.options["reject-node"])??null,thinkingDepthOverride:h(J.options.thinkingDepth)??h(J.options["thinking-depth"]),skipInvoiceGeneration:_0(J.options.skipInvoiceGeneration)??_0(J.options["skip-invoice-generation"]),skipExpenseExtraction:_0(J.options.skipExpenseExtraction)??_0(J.options["skip-expense-extraction"]),disableAttachmentCache:_0(J.options.disableAttachmentCache)??_0(J.options["disable-attachment-cache"]),signKey:w,packageIds:X,packageId:V,templateId:h(J.options.templateId)??h(J.options["template-id"]),schemaConfig:G,requestIds:M6(J.options.requestIds)??M6(J.options["request-ids"]),workflowTypeId:h(J.options.workflowTypeId)??h(J.options["workflow-type-id"]),flowStatusList:M6(J.options.flowStatusList)?.map(Number)??M6(J.options["flow-status-list"])?.map(Number),businessCodes:M6(J.options.businessCodes)??M6(J.options["business-codes"]),documentType:h(J.options.documentType)??h(J.options["document-type"]),startTime:U1(J.options.startTime)??U1(J.options["start-time"]),endTime:U1(J.options.endTime)??U1(J.options["end-time"]),status:M6(J.options.status),limit:U1(J.options.limit),rawParams:W},O0(J.options));return}if($==="wait"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await F0("seal_simulation_batch_wait",U,Y,{batchId:Q,timeout:h(J.options.timeout),pollInterval:h(J.options.pollInterval)??h(J.options["poll-interval"])},O0(J.options));return}if($==="clean"||$==="delete"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await F0("seal_simulation_batch_clean",U,Y,{batchId:Q},O0(J.options));return}if($==="specifications"){let Q=I??h(J.options.integration)??h(J.options.signKey)??h(J.options["sign-key"]);await F0("seal_simulation_specifications_list",U,Y,{signKey:Q},O0(J.options));return}if($==="list"){await F0("seal_simulation_batches_list",U,Y,{limit:U1(J.options.limit)},O0(J.options));return}if($==="get"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await F0("seal_simulation_batch_get",U,Y,{batchId:Q},O0(J.options));return}if($==="templates"){await F0("seal_simulation_templates_get",U,Y,{},O0(J.options));return}if($==="integrations"){await F0("seal_simulation_integrations_get",U,Y,{},O0(J.options));return}if($==="package-upload"){let Q=I??h(J.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!YG1(Q))throw Error(`Filenotfound:${Q}`);await F0("seal_simulation_material_package_upload",U,Y,{filePath:Q},O0(J.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as eX0}from"node:fs";import{join as LO}from"node:path";import{existsSync as Hx,mkdirSync as lX0,rmSync as wG1,writeFileSync as DG1}from"node:fs";import{homedir as oX0}from"node:os";import{dirname as OG1,join as Wx}from"node:path";var xX0=`---
name:seal-use
description:"v0.10.11: 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.13: 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."
Usethe\`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-use\` CLI. 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.
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 oZ0=`interface:
`;var kX0=`interface:
display_name:"Seal Use"
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."
@@ -712,7 +719,7 @@ Use current search only when the question is about current draft/current knowled
##OutputDiscipline
Ifarulecommandwouldreturnmanydescriptionsormorethanabout20rules,use\`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var aZ0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises`aremerged.\n-User-levelconfigsoverridesame-IDlocalconfigs.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**(e.g.`👉Nextaction:...`).\n-**`ExitCode`**:`0`onsuccess,non-zero(e.g.`1`)onfailuretotriggerAgenterrorself-remediation.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfigtest-dir[<path>|--clear]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate\nseal-usetoolslist\nseal-usecorpslist[--corp<corpId>]\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useusersreset-password<userId>[--corp<corpId>]\nseal-useusersget<userId>[--corp<corpId>]\nseal-useusersdelete<userId>[--corp<corpId>]\nseal-usellmconfig[--corp<corpId>]\nseal-usellmproviders[--corp<corpId>]\nseal-usepermissionsavailable[--corp<corpId>]\nseal-usepermissionsconfigs[--corp<corpId>]\nseal-usebillingstatus[--corp<corpId>]\nseal-usebillingplans[--corp<corpId>]\nseal-usebillingfeatures[--corp<corpId>]\nseal-usewebhooklist[--query<text>][--show-secret][--corp<corpId>]\nseal-usewebhookget|find<idOrName>[--show-secret][--corp<corpId>]\nseal-usewebhookadd--name<name>--result-url<url>[--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>][--corp<corpId>]\nseal-usewebhookupdate<idOrName>[--name<name>][--result-url<url>][--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>|--rotate-secret][--corp<corpId>]\nseal-usewebhookdelete<idOrName>--yes[--corp<corpId>]\nseal-usedeployhosecloudrequirements[--corp<corpId>]\nseal-usedeployhosecloudlist[--corp<corpId>]\nseal-usedeployhosecloudget[<sign-key>][--corp<corpId>]\nseal-usedeployhosecloudstatus[--corp<corpId>]\nseal-usedeployhosecloudconfigure--json'{...}'[--corp<corpId>]\nseal-usedeployhosecloudsync[<sign-key>][--auto][--corp<corpId>]\nseal-usepreferenceget[--corp<corpId>]\nseal-usepreferencedecisionupdate--json'{\"explicitApprove\":\"...\"}'[--corp<corpId>]\nseal-usepreferencethinking-depthset--default<medium|high>[--corp<corpId>]\nseal-usepreferencethinking-depthpolicieslist[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesupsert--json'{...}'[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesremove<policyId>[--corp<corpId>]\nseal-usesourceconfig[--corp<corpId>]\nseal-usetool<toolName>[--corp<corpId>][--json'{\"key\":\"value\"}']\nseal-useapproval-runssummary--corp<corpId>[--dateYYYY-MM-DD][--timezoneAsia/Shanghai]\nseal-useapproval-runsstats--corp<corpId>[--since3months][--dedupe-bysoLine truncated
`;var bX0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises`aremerged.\n-User-levelconfigsoverridesame-IDlocalconfigs.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**(e.g.`👉Nextaction:...`).\n-**`ExitCode`**:`0`onsuccess,non-zero(e.g.`1`)onfailuretotriggerAgenterrorself-remediation.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfigtest-dir[<path>|--clear]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate\nseal-usetoolslist\nseal-usecorpslist[--corp<corpId>]\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useusersreset-password<userId>[--corp<corpId>]\nseal-useusersget<userId>[--corp<corpId>]\nseal-useusersdelete<userId>[--corp<corpId>]\nseal-usellmconfig[--corp<corpId>]\nseal-usellmproviders[--corp<corpId>]\nseal-usepermissionsavailable[--corp<corpId>]\nseal-usepermissionsconfigs[--corp<corpId>]\nseal-usebillingstatus[--corp<corpId>]\nseal-usebillingplans[--corp<corpId>]\nseal-usebillingfeatures[--corp<corpId>]\nseal-usewebhooklist[--query<text>][--show-secret][--corp<corpId>]\nseal-usewebhookget|find<idOrName>[--show-secret][--corp<corpId>]\nseal-usewebhookadd--name<name>--result-url<url>[--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>][--corp<corpId>]\nseal-usewebhookupdate<idOrName>[--name<name>][--result-url<url>][--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>|--rotate-secret][--corp<corpId>]\nseal-usewebhookdelete<idOrName>--yes[--corp<corpId>]\nseal-usedeployhosecloudrequirements[--corp<corpId>]\nseal-usedeployhosecloudlist[--corp<corpId>]\nseal-usedeployhosecloudget[<sign-key>][--corp<corpId>]\nseal-usedeployhosecloudstatus[--corp<corpId>]\nseal-usedeployhosecloudconfigure--json'{...}'[--corp<corpId>]\nseal-usedeployhosecloudsync[<sign-key>][--auto][--corp<corpId>]\nseal-usepreferenceget[--corp<corpId>]\nseal-usepreferencedecisionupdate--json'{\"explicitApprove\":\"...\"}'[--corp<corpId>]\nseal-usepreferencethinking-depthset--default<medium|high>[--corp<corpId>]\nseal-usepreferencethinking-depthpolicieslist[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesupsert--json'{...}'[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesremove<policyId>[--corp<corpId>]\nseal-usesourceconfig[--corp<corpId>]\nseal-usetool<toolName>[--corp<corpId>][--json'{\"key\":\"value\"}']\nseal-useapproval-runssummary--corp<corpId>[--dateYYYY-MM-DD][--timezoneAsia/Shanghai]\nseal-useapproval-runsstats--corp<corpId>[--since3months][--dedupe-bysoLine truncated
@@ -1147,7 +1154,7 @@ Return a compact report containing:
-Newversionnumberandversionname,ifpublished
-Verificationresult
-Whetheraregressionrerunwasperformed
`;var qX0="# Enterprise Onboarding\n\nRead 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.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl-fsSLhttps://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat
Line truncated
`;var cX0="# Enterprise Onboarding\n\nRead 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.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl-fsSLhttps://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat
Line truncated
-\`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
`);return}if($==="install"||$==="init"||$==="sync"){let U=C0(I.options.local)||C0(I.options.workspace),Y=y(I.options.dir)??y(I.options.target)??q,J=Y?Y:U?gD(process.cwd(),".agents","skills","seal-use"):Fz(),Q=Ru(J);E0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Fz(),Y=gD(process.cwd(),".agents","skills","seal-use");E0({global:{dir:U,installed:HX0(gD(U,"SKILL.md"))},local:{dir:Y,installed:HX0(gD(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function VX0($,q){if($==="config"){E0(await TY(q));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function WX0($,q,I,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await N0($,q,I,a6(U.json),D0(U.options))}function ZX0(){E0(Vz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as xG1,mkdirSync as kG1,renameSync as Cu,rmSync as fG1,unlinkSync as NX0,writeFileSync as XX0}from"node:fs";import{dirname as bG1,join as LX0}from"node:path";import{spawnSync as Kq}from"node:child_process";function BD($=process.execPath,q=import.meta.url){if(q.includes("/$bunfs/")||q.includes("\\$bunfs\\"))return!0;let I=$.toLowerCase().replace(/\\/g,"/");return!I.endsWith("/bun")&&!I.endsWith("/bun.exe")&&!I.endsWith("/node")&&!I.endsWith("/node.exe")}var FX0="yunyingk/seal-use",Az="yunyingk/seal-home";var nG1="SEAL_USE_GITHUB_REPO",iG1="SEAL_HOME_GITHUB_REPO";async function MX0($,q={}){let I={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Eu,version:e0,launcher:$.launcher},U=q.repo||process.env[nG1]?.trim()||process.env[iG1]?.trim()||FX0,Y=q.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let P=J.replace(/^v/,""),B=AX0(P,e0);if(B<0){E0({updated:!1,currentVersion:e0,targetVersion:P,mode:BD()?"binary":"source",message:`Cannotdowngradeseal-usefromv${e0}toolderversionv${P}.Updatesmustbeforward-only.`});return}if(B===0&&!q.force){E0({updated:!1,currentVersion:e0,targetVersion:P,mode:BD()?"binary":"source",message:`seal-useisalreadyatversionv${e0}.Use--forcetoreinstall.`});return}}if(q.changelogOnly){let P=await _u(U,q.limit??10);E0({currentVersion:e0,totalQueried:P.length,releases:P.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===e0,isNewer:Mz(B.version,e0)}))});return}if(!BD()){if(q.checkOnly){let B=await _u(U,30),f=B[0],S=f?.version??e0,n=B.find((i)=>i.version===e0),R=Mz(S,e0),p=B.filter((i)=>Mz(i.version,e0));E0({updated:!1,updateAvailable:R,currentVersion:e0,currentVersionPublishedAt:n?.publishedAt,latestVersion:S,latestVersionPublishedAt:f?.publishedAt,behindCount:p.length,pendingReleases:p.map((i)=>({version:i.version,tagName:i.tagName,publishedAt:i.publishedAt,author:i.author,releaseNotes:i.notes,releaseUrl:i.htmlUrl})),releaseNotes:f?.notes??"",releaseUrl:f?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let P=jY(I).running;if(P)await Qq("stop",I);try{OX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(OX0("bun",["install"],{cwd:$.appRoot}),P)await Qq("start",I);E0({updated:!0,serviceRestarted:P,version:e0,mode:"source"});return}let Q=pG1(),K=cG1(),z=await _u(U,30),G=J?z.find((P)=>P.version===J||P.tagName===J||P.tagName===`v${J}`)??await DX0(U,J):z[0]??await DX0(U);if(!G){E0({updated:!1,currentVersion:e0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let H=G.version,w=z.find((P)=>P.version===e0),V=Mz(H,e0),W=V||Boolean(q.force),X=z.filter((P)=>Mz(P.version,e0));if(q.checkOnly){E0({updated:!1,updateAvailable:V,currentVersion:e0,currentVersionPublishedAt:w?.publishedAt,latestVersion:H,latestVersionPublishedAt:G.publishedAt,behindCount:X.length,pendingReleases:X.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl})),releaseNotes:G.notes,releaseUrl:G.htmlUrl,mode:"binary"});return}if(!W){E0({updated:!1,currentVersion:e0,currentVersionPublishedAt:w?.publishedAt,latestVersion:H,latestVersionPublishedAt:G.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${e0})`});return}let L=dG1(G.assets,Q,K);if(!L)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${H}.Availableassets:${G.assets.map((P)=>P.name).join(", ")}`);let D=jY(I).running;if(D)await Qq("stop",I);let N=process.execPath,E=bG1(N),T=LX0(E,`.tmp-update-${Date.now()}`);kG1(T,{recursive:!0});try{let P=LX0(T,L.name);await mG1(L.downloadUrl,P,G.tagName,L.name);let B=P;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))B=lG1(P,T,Q);else if(L.name.endsWith(".zip"))B=oG1(P,T,Q);if(xG1(B,493),process.platform==="darwin")try{Kq("/usr/bin/codesig
Line truncated
`)}catch{}}async function mG1($,q,I,U){let Y=hu(),J=[],Q=I?I.startsWith("v")?I:`v${I}`:void 0,K=U||$.split("/").pop()||"";if(Y!=="github"){if(Q&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${Q}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${Q}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Y!=="gitea")if(Q&&K){let L=`https://github.com/${FX0}/releases/download/${Q}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);J.push(L)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let z=Array.from(new Set(J)),G,H=6000,w=6000,V=307200,W=1e4,X=180000;for(let L=0;L<z.length;L++){let D=z[L],N=new AbortController,E="",T=(S)=>{E=S;try{N.abort()}catch{}},P=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},H),B,f;try{RD(`==> [${L+1}/${z.length}] Downloading via: ${D}`);let S=await fetch(D,{signal:N.signal});if(P)clearTimeout(P),P=void 0;if(!S.ok)throw Error(`HTTP ${S.status} ${S.statusText}`);B=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let n=Number(S.headers.get("content-length"))||0,R=S.body?.getReader();if(!R){let b=Buffer.from(await S.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);XX0(q,b),RD(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let p=[],i=0,C=0;f=setTimeout(()=>{if(i<V){let b=(i/1024).toFixed(1);T(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},w);while(!0){let b=R.read(),U0,j=new Promise((Q0,H0)=>{U0=setTimeout(()=>{H0(Error("Data transfer stalled (no chunk received for 10s)"))},W)}),x;try{x=await Promise.race([b,j])}finally{if(U0)clearTimeout(U0)}let{done:d,value:t}=x;if(d)break;if(t){if(p.push(t),i+=t.length,f&&i>=V)clearTimeout(f),f=void 0;let Q0=Date.now();if(Q0-C>200){C=Q0;let H0=n?Math.round(i/n*100):0,M0=(i/1048576).toFixed(1),j0=n?(n/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${H0}% (${M0} / ${j0} MB)...`)}catch{}}}}try{process.stderr.write(`
`);return}if($==="install"||$==="init"||$==="sync"){let Y=_0(U.options.local)||_0(U.options.workspace),J=h(U.options.dir)??h(U.options.target)??I,Q=J?J:Y?LO(process.cwd(),".agents","skills","seal-use"):VG(),K=Vx(Q);E0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files});return}if($==="status"||$==="get"||!$){let Y=VG(),J=LO(process.cwd(),".agents","skills","seal-use");E0({global:{dir:Y,installed:eX0(LO(Y,"SKILL.md"))},local:{dir:J,installed:eX0(LO(J,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function IL0($,I){if($==="config"){E0(await zJ(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function UL0($,I,U,Y){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await F0($,I,U,t6(Y.json),O0(Y.options))}function YL0(){E0(YG.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as NG1,mkdirSync as FG1,renameSync as Xx,rmSync as MG1,unlinkSync as GL0,writeFileSync as JL0}from"node:fs";import{dirname as zG1,join as QL0}from"node:path";import{spawnSync as qI}from"node:child_process";function wO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var HL0="yunyingk/seal-use",XG="yunyingk/seal-home";var AG1="SEAL_USE_GITHUB_REPO",PG1="SEAL_HOME_GITHUB_REPO";async function WL0($,I={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:qx,version:e0,launcher:$.launcher},Y=I.repo||process.env[AG1]?.trim()||process.env[PG1]?.trim()||HL0,J=I.targetVersion?.trim(),Q=J&&J.toLowerCase()!=="latest"?J:void 0;if(Q){let T=Q.replace(/^v/,""),v=VL0(T,e0);if(v<0){E0({updated:!1,currentVersion:e0,targetVersion:T,mode:wO()?"binary":"source",message:`Cannotdowngradeseal-usefromv${e0}toolderversionv${T}.Updatesmustbeforward-only.`});return}if(v===0&&!I.force){E0({updated:!1,currentVersion:e0,targetVersion:T,mode:wO()?"binary":"source",message:`seal-useisalreadyatversionv${e0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let T=await Lx(Y,I.limit??10);E0({currentVersion:e0,totalQueried:T.length,releases:T.map((v)=>({version:v.version,tagName:v.tagName,publishedAt:v.publishedAt,author:v.author,releaseNotes:v.notes,releaseUrl:v.htmlUrl,isCurrent:v.version===e0,isNewer:ZG(v.version,e0)}))});return}if(!wO()){if(I.checkOnly){let v=await Lx(Y,30),u=v[0],g=u?.version??e0,b=v.find((p)=>p.version===e0),C=ZG(g,e0),n=v.filter((p)=>ZG(p.version,e0));E0({updated:!1,updateAvailable:C,currentVersion:e0,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:u?.publishedAt,behindCount:n.length,pendingReleases:n.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:u?.notes??"",releaseUrl:u?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let T=PJ(U).running;if(T)await KI("stop",U);try{qL0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(v){console.error(`gitpullskipped:${vinstanceofError?v.message:String(v)}`)}if(qL0("bun",["install"],{cwd:$.appRoot}),T)await KI("start",U);E0({updated:!0,serviceRestarted:T,version:e0,mode:"source"});return}let K=TG1(),q=EG1(),G=await Lx(Y,30),H=Q?G.find((T)=>T.version===Q||T.tagName===Q||T.tagName===`v${Q}`)??await KL0(Y,Q):G[0]??await KL0(Y);if(!H){E0({updated:!1,currentVersion:e0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${Y}'`});return}let W=H.version,V=G.find((T)=>T.version===e0),X=ZG(W,e0),Z=X||Boolean(I.force),w=G.filter((T)=>ZG(T.version,e0));if(I.checkOnly){E0({updated:!1,updateAvailable:X,currentVersion:e0,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:w.length,pendingReleases:w.map((T)=>({version:T.version,tagName:T.tagName,publishedAt:T.publishedAt,author:T.author,releaseNotes:T.notes,releaseUrl:T.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!Z){E0({updated:!1,currentVersion:e0,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${e0})`});return}let D=BG1(H.assets,K,q);if(!D)throw Error(`Nocompatiblebinaryfoundfor${K}-${q}inreleasev${W}.Availableassets:${H.assets.map((T)=>T.name).join(", ")}`);let O=PJ(U).running;if(O)await KI("stop",U);let F=process.execPath,E=zG1(F),A=QL0(E,`.tmp-update-${Date.now()}`);FG1(A,{recursive:!0});try{let T=QL0(A,D.name);await RG1(D.downloadUrl,T,H.tagName,D.name);let v=T;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))v=vG1(T,A,K);else if(D.name.endsWith(".zip"))v=CG1(T,A,K);if(NG1(v,493),process.platform==="darwin")try{qI("/usr/bin/codesig
Line truncated
`)}catch{}}async function RG1($,I,U,Y){let J=wx(),Q=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,q=Y||$.split("/").pop()||"";if(J!=="github"){if(K&&q)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${q}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(J!=="gitea")if(K&&q){let D=`https://github.com/${HL0}/releases/download/${K}/${q}`;if(!process.env.CI)Q.push(`https://ghfast.top/${D}`,`https://gh.ddlc.top/${D}`);Q.push(D)}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,V=6000,X=307200,Z=1e4,w=180000;for(let D=0;D<G.length;D++){let O=G[D],F=new AbortController,E="",A=(g)=>{E=g;try{F.abort()}catch{}},T=setTimeout(()=>{A("Connection timed out (no response headers within 6s)")},W),v,u;try{DO(`==> [${D+1}/${G.length}] Downloading via: ${O}`);let g=await fetch(O,{signal:F.signal});if(T)clearTimeout(T),T=void 0;if(!g.ok)throw Error(`HTTP ${g.status} ${g.statusText}`);v=setTimeout(()=>{A("Overall download time exceeded 3 minutes")},w);let b=Number(g.headers.get("content-length"))||0,C=g.body?.getReader();if(!C){let i=Buffer.from(await g.arrayBuffer());if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);JL0(I,i),DO(`✓ Download succeeded (${(i.length/1024/1024).toFixed(1)} MB)`);return}let n=[],p=0,S=0;u=setTimeout(()=>{if(p<X){let i=(p/1024).toFixed(1);A(`Initial transfer too slow (${i} KB < 300 KB in 6s), switching mirror...`)}},V);while(!0){let i=C.read(),Y0,B=new Promise((K0,W0)=>{Y0=setTimeout(()=>{W0(Error("Data transfer stalled (no chunk received for 10s)"))},Z)}),k;try{k=await Promise.race([i,B])}finally{if(Y0)clearTimeout(Y0)}let{done:d,value:t}=k;if(d)break;if(t){if(n.push(t),p+=t.length,u&&p>=X)clearTimeout(u),u=void 0;let K0=Date.now();if(K0-S>200){S=K0;let W0=b?Math.round(p/b*100):0,z0=(p/1048576).toFixed(1),B0=b?(b/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${W0}% (${z0} / ${B0} MB)...`)}catch{}}}}try{process.stderr.write(`
"description":"Planned HTTP contract for the seal-use wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-use is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
description:"v0.10.11: 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.13: 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.11
short-description:Seal tenant and Hose approval automation (v0.10.11)
version:0.10.13
short-description:Seal tenant and Hose approval automation (v0.10.13)
---
# Seal Use (v0.10.11)
# Seal Use (v0.10.13)
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-use` CLI. 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.
Webhook writes read the current AI approval config and POST the merged full config back to `api/v1/agent/ai-approval/config`, preserving non-Webhook integrations. List/get mask `secret` by default; add returns the generated secret once.
@@ -344,6 +346,86 @@ Update style preferences:
}
```
## Material Pack Workflow
A **material pack** (材料包) is a ZIP file that bundles an Excel information sheet (`信息表.xlsx`) with attachments organised by document ID. It is the primary input to the Webhook-based AI approval ingestion pipeline.
### ZIP structure convention
```
材料包.zip
├── 信息表.xlsx ← must exist at ZIP root
├── BX20260826003/ ← root dir name = documentId (or documentId@annotation)
│ ├── 合同协议/
│ │ └── 采购合同.pdf
│ └── 支付凭证/
│ └── 支付宝交易明细.pdf
└── BX20260826004@重新提交v2/ ← @annotation is stripped when matching documentId
└── 发票/
└── 增值税专用发票.pdf
```
- The root directory name **must equal** the `documentId`**OR** start with `documentId@` (the `@` separates an optional annotation ignored during matching).
-`信息表.xlsx` at the ZIP root is the only file not associated with any document directory.
### Excel column convention
| Column type | Naming | Purpose |
|---|---|---|
| Regular column | Any header (e.g. `会议编号`, `总金额`) | Standard document fields |
| Attachment column | Header starts with `[附件]` (e.g. `[附件]合同协议`) | Declares attached files for this row |
- The `[附件]` prefix is stripped to produce the field `label` sent to Seal.
- The cell value contains full ZIP-relative path(s) to the declared files (multiple paths separated by newline, comma, or semicolon).
- Example: column `[附件]合同协议`, cell value `BX20260826003/合同协议/采购合同.pdf`
Before pushing or previewing, the system enforces:
1.**Excel → ZIP**: Every path declared in an `[附件]` column cell **must** exist as a ZIP entry. Error: `Excel 声明的附件路径在 ZIP 中不存在: <path>`
2.**ZIP → Excel**: Every ZIP file (excluding `信息表.xlsx`) **must** be declared in exactly one `[附件]` column. Error: `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>`
3.**Document Directory Scope Isolation**: All attachments declared for a document `DOC_X`**must** reside in its own root directory (`DOC_X/` or `DOC_X@annotation/`). Cross-document references are strictly forbidden. Error: `单据「X」声明了跨单据或非本单据目录的附件路径: <path>。附件必须位于该单据自己的根目录...`
4.**Strict Declaration Uniqueness**: A given ZIP file path **cannot** be declared more than once across the entire material pack (even within the same document across multiple rows or fields). If the same logical document is needed in multiple places, separate files must be placed in distinct paths. Error: `附件路径「<path>」被重复声明了 N 次...`
5.**documentId ↔ ZIP root**: Every `documentId` in the Excel main sheet must have a matching ZIP root dir (exact match or `documentId@annotation`). Errors: `Excel 会议编号「X」在 ZIP 中找不到对应的根目录...` / `ZIP 根目录对应的编号「X」在信息表中找不到对应的会议编号`
All validation errors are collected and reported together in a single `MaterialPackValidationError`.
### CLI usage
```bash
# Check environment readiness and optionally pre-validate the material pack
# When there is exactly one webhook channel, --webhook can be omitted (auto-locked)
```
### Error messages reference
| Error message | Meaning | Fix |
|---|---|---|
| `Excel 声明的附件路径在 ZIP 中不存在: <path>` | Cell value references a file not in ZIP | Add the file to ZIP at exactly that path |
| `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>` | ZIP contains a file not referenced by any `[附件]` column | Add an `[附件]` column entry or remove the file from ZIP |
| `单据「X」声明了跨单据或非本单据目录的附件路径: <path>` | Document X declared a path inside another document's folder | Move file into Document X's own folder and update Excel |
| `附件路径「<path>」被重复声明了 N 次` | The same file path was declared in multiple columns/rows/documents | Each declaration must point to a unique file path; duplicate file if needed |
| `Excel 会议编号「X」在 ZIP 中找不到对应的根目录` | No ZIP root dir matches documentId `X` | Rename the ZIP folder to match the documentId |
| `ZIP 根目录对应的编号「X」在信息表中找不到` | ZIP folder has no matching documentId in Excel | Remove the folder or add the document to Excel |
| `ZIP 根目录缺少信息表.xlsx` | No `信息表.xlsx` found at ZIP root | Add the Excel file to the ZIP root |
| `附件上传失败 <status>` | Network/server error during file upload | Check webhook URL, secret, and server availability |
## Failure Handling
- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. Use `seal-use service restart` after updates so the optional local service picks up new code.
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.