@@ -5,6 +5,19 @@ All notable changes to `seal-use` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.8] - 2026-09-04
### Added & Enhanced
- **Approval Run Attachments Extraction Compatibility (Issue #35)**:
- Generalized `extractApprovalRunAttachments` to inspect `document.fields[].type === "ATTACHMENT"` arrays with nested `value[]` collections, properly recognizing HoseCloud/Seal 2026 flattened attachment fields that previously resolved to `count: 0`.
- Extracted comprehensive metadata including `ossSignedUrl`, `token` (automatically parsing embedded `fileId` and object `key`), `ossFileSize`, `mimeType`, and preserved parent field labels as `sourceField`.
- Added `hasSignedUrl` and `ossFileSize` to compact summary outputs without exposing raw signed URLs.
- Added `seal-use approval-runs attachments download <recordId> [--name <pattern>] [--all] [--out-dir <path>]` and the corresponding tool `seal_approval_run_attachments_download` (aliased as `runs.attachments.download`).
- Prioritizes direct `ossSignedUrl` links from the run record and verifies downloaded file size against `ossFileSize`.
- Automatically sanitizes sensitive temporary signatures in CLI logging (`?[MASKED]`) to prevent credential leakage in build/agent transcripts.
- Implemented graceful error recovery for expired temporary URLs (HTTP 403) or missing links, reporting diagnostics for failed items while allowing valid attachments to complete without interruption.
@@ -276,6 +276,7 @@ These tools remain available to the CLI:
-`seal_approval_run_cited_rules_get`: extract rules cited or matched by the AI result, including runtime ID/code, version, scope, strictness, analysis, result, and findings when present.
-`seal_approval_run_document_summary_get`: return key document fields, invoice/attachment summary, AI result, and manual result.
-`seal_approval_run_attachments_get`: return attachment and invoice file metadata for one run without the full document or rule result; use `summary:true` for the smallest list.
-`seal_approval_run_attachments_download`: download attachments from an approval run to local disk; supports `--all`, `--name`, and `--out-dir`, prioritizes `ossSignedUrl`, validates `ossFileSize`, and masks credentials in logs.
-`seal_approval_run_result_get`: return one run result, with `{"summary":true}` for decision, summary, risk point count, matched rule count, trace ID, and record ID only.
-`seal_approval_run_url_get`: return the Hose enterprise assist URL, optionally with the original document URL for an approval run by `recordId`, `sourceDocumentSN`, or `sourceDocumentId`.
-`seal_simulation_batch_records_get`: read records from one simulation batch via `api/v1/simulation/batch/{batchId}/records`.
import{createRequireasHD0}from"node:module";varqD0=Object.create;var{getPrototypeOf:UD0,defineProperty:CO,getOwnPropertyNames:YD0}=Object;varJD0=Object.prototype.hasOwnProperty;functionQD0($){returnthis[$]}varKD0,zD0,RY=($,I,q)=>{varU=$!=null&&typeof$==="object";if(U){varY=I?KD0??=newWeakMap:zD0??=newWeakMap,J=Y.get($);if(J)returnJ}q=$!=null?qD0(UD0($)):{};letQ=I||!$||!$.__esModule?CO(q,"default",{value:$,enumerable:!0}):q;for(letKofYD0($))if(!JD0.call(Q,K))CO(Q,K,{get:QD0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varL=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varwD0=($)=>$;functionGD0($,I){this[$]=wD0.bind(null,I)}vard8=($,I)=>{for(varqinI)CO($,q,{get:I[q],enumerable:!0,configurable:!0,set:GD0.bind(I,q)})};varo=HD0(import.meta.url);varvJ=L((nf)=>{Object.defineProperty(nf,"__esModule",{value:!0});nf.regexpCode=nf.getEsmExportName=nf.getProperty=nf.safeStringify=nf.stringify=nf.strConcat=nf.addCodeArg=nf.str=nf._=nf.nil=nf._Code=nf.Name=nf.IDENTIFIER=nf._CodeOrName=void0;class_G{}nf._CodeOrName=_G;nf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classpIextends_G{constructor($){super();if(!nf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}nf.Name=pI;classy$extends_G{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,q)=>`${I}${q}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,q)=>{if(qinstanceofpI)I[q.str]=(I[q.str]||0)+1;returnI},{})}}nf._Code=y$;nf.nil=newy$("");functionkf($,...I){letq=[$[0]],U=0;while(U<I.length)cg(q,I[U]),q.push($[++U]);returnnewy$(q)}nf._=kf;varpg=newy$("+");functionff($,...I){letq=[BJ($[0])],U=0;while(U<I.length)q.push(pg),cg(q,I[U]),q.push(pg,BJ($[++U]));return_F0(q),newy$(q)}nf.str=ff;functioncg($,I){if(Iinstanceofy$)$.push(...I._items);elseif(IinstanceofpI)$.push(I);else$.push(yF0(I))}nf.addCodeArg=cg;function_F0($){letI=1;while(I<$.length-1){if($[I]===pg){letq=hF0($[I-1],$[I+1]);if(q!==void0){$.splice(I-1,3,q);continue}$[I++]="+"}I++}}functionhF0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofpI||$[$.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]==='"'&&!($instanceofpI))return`"${$}${I.slice(1)}`;return}functionSF0($,I){returnI.emptyStr()?$:$.emptyStr()?I:ff`${$}${I}`}nf.strConcat=SF0;functionyF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:BJ(Array.isArray($)?$.join(","):$)}functionuF0($){returnnewy$(BJ($))}nf.stringify=uF0;functionBJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}nf.safeStringify=BJ;functionxF0($){returntypeof$=="string"&&nf.IDENTIFIER.test($)?newy$(`.${$}`):kf`[${$}]`}nf.getProperty=xF0;functionkF0($){if(typeof$=="string"&&nf.IDENTIFIER.test($))returnnewy$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}nf.getEsmExportName=kF0;functionfF0($){returnnewy$($.toString())}nf.regexpCode=fF0});varog=L((df)=>{Object.defineProperty(df,"__esModule",{value:!0});df.ValueScope=df.ValueScopeName=df.Scope=df.varKinds=df.UsedValueState=void0;varu6=vJ();classpfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varSG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(SG||(df.UsedValueState=SG={}));df.varKinds={const:newu6.Name("const"),let:newu6.Name("let"),var:newu6.Name("var")};classlg{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofu6.Name?$:this.name($)}name($){returnnewu6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,q;if(((q=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||q===void0?void0:q.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}df.Scope=lg;classmgextendsu6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:q}){this.value=$,this.scopePath=u6._`.${newu6.Name(I)}[${q}]`}}df.ValueScopeName=mg;varsF0=u6._`\n`;classcfextendslg{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?sF0:u6.nil}}get(){returnthis._scope}name($){returnnewmg($,this._newName($))}value($,I){varq;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letU=this.toName($),{prefix:Y}=U,J=(q=I.key)!==null&&q!==void0?q:I.ref,Q=this._values[Y];if(Q){letw=Q.get(J);if(Line truncated
import{createRequireasOD0}from"node:module";varwD0=Object.create;var{getPrototypeOf:zD0,defineProperty:hO,getOwnPropertyNames:GD0}=Object;varHD0=Object.prototype.hasOwnProperty;functionVD0($){returnthis[$]}varWD0,ZD0,RY=($,I,q)=>{varU=$!=null&&typeof$==="object";if(U){varY=I?WD0??=newWeakMap:ZD0??=newWeakMap,J=Y.get($);if(J)returnJ}q=$!=null?wD0(zD0($)):{};letQ=I||!$||!$.__esModule?hO(q,"default",{value:$,enumerable:!0}):q;for(letKofGD0($))if(!HD0.call(Q,K))hO(Q,K,{get:VD0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varL=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varXD0=($)=>$;functionDD0($,I){this[$]=XD0.bind(null,I)}varm8=($,I)=>{for(varqinI)hO($,q,{get:I[q],enumerable:!0,configurable:!0,set:DD0.bind(I,q)})};varo=OD0(import.meta.url);varvJ=L((cf)=>{Object.defineProperty(cf,"__esModule",{value:!0});cf.regexpCode=cf.getEsmExportName=cf.getProperty=cf.safeStringify=cf.stringify=cf.strConcat=cf.addCodeArg=cf.str=cf._=cf.nil=cf._Code=cf.Name=cf.IDENTIFIER=cf._CodeOrName=void0;classhG{}cf._CodeOrName=hG;cf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classpIextendshG{constructor($){super();if(!cf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}cf.Name=pI;classx$extendshG{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,q)=>`${I}${q}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,q)=>{if(qinstanceofpI)I[q.str]=(I[q.str]||0)+1;returnI},{})}}cf._Code=x$;cf.nil=newx$("");functionbf($,...I){letq=[$[0]],U=0;while(U<I.length)lg(q,I[U]),q.push($[++U]);returnnewx$(q)}cf._=bf;vardg=newx$("+");functionpf($,...I){letq=[BJ($[0])],U=0;while(U<I.length)q.push(dg),lg(q,I[U]),q.push(dg,BJ($[++U]));returnkF0(q),newx$(q)}cf.str=pf;functionlg($,I){if(Iinstanceofx$)$.push(...I._items);elseif(IinstanceofpI)$.push(I);else$.push(iF0(I))}cf.addCodeArg=lg;functionkF0($){letI=1;while(I<$.length-1){if($[I]===dg){letq=fF0($[I-1],$[I+1]);if(q!==void0){$.splice(I-1,3,q);continue}$[I++]="+"}I++}}functionfF0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofpI||$[$.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]==='"'&&!($instanceofpI))return`"${$}${I.slice(1)}`;return}functionnF0($,I){returnI.emptyStr()?$:$.emptyStr()?I:pf`${$}${I}`}cf.strConcat=nF0;functioniF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:BJ(Array.isArray($)?$.join(","):$)}functionbF0($){returnnewx$(BJ($))}cf.stringify=bF0;functionBJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}cf.safeStringify=BJ;functionpF0($){returntypeof$=="string"&&cf.IDENTIFIER.test($)?newx$(`.${$}`):bf`[${$}]`}cf.getProperty=pF0;functioncF0($){if(typeof$=="string"&&cf.IDENTIFIER.test($))returnnewx$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}cf.getEsmExportName=cF0;functiondF0($){returnnewx$($.toString())}cf.regexpCode=dF0});vartg=L((of)=>{Object.defineProperty(of,"__esModule",{value:!0});of.ValueScope=of.ValueScopeName=of.Scope=of.varKinds=of.UsedValueState=void0;varx6=vJ();classlfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varyG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(yG||(of.UsedValueState=yG={}));of.varKinds={const:newx6.Name("const"),let:newx6.Name("let"),var:newx6.Name("var")};classog{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofx6.Name?$:this.name($)}name($){returnnewx6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,q;if(((q=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||q===void0?void0:q.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}of.Scope=og;classrgextendsx6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:q}){this.value=$,this.scopePath=x6._`.${newx6.Name(I)}[${q}]`}}of.ValueScopeName=rg;varYM0=x6._`\n`;classmfextendsog{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?YM0:x6.nil}}get(){returnthis._scope}name($){returnnewrg($,this._newName($))}value($,I){varq;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letU=this.toName($),{prefix:Y}=U,J=(q=I.key)!==null&&q!==void0?q:I.ref,Q=this._values[Y];if(Q){letz=Q.get(J);if(Line truncated
deps:${q}}`};var JE0={keyword:"dependencies",type:"object",schemaType:"object",error:Kp.error,code($){let[I,q]=QE0($);Jp($,I),Qp($,q)}};function QE0({schema:$}){let I={},q={};for(let U in $){if(U==="__proto__")continue;let Y=Array.isArray($[U])?I:q;Y[U]=$[U]}return[I,q]}function Jp($,I=$.schema){let{gen:q,data:U,it:Y}=$;if(Object.keys(I).length===0)return;let J=q.let("missing");for(let Q in I){let K=I[Q];if(K.length===0)continue;let z=(0,oJ.propertyInData)(q,U,Q,Y.opts.ownProperties);if($.setParams({property:Q,depsCount:K.length,deps:K.join(", ")}),Y.allErrors)q.if(z,()=>{for(let w of K)(0,oJ.checkReportMissingProp)($,w)});else q.if(_P._`${z}&&(${(0,oJ.checkMissingProp)($,K,J)})`),(0,oJ.reportMissingProp)($,J),q.else()}}Kp.validatePropertyDeps=Jp;function Qp($,I=$.schema){let{gen:q,data:U,keyword:Y,it:J}=$,Q=q.name("valid");for(let K in I){if((0,YE0.alwaysValidSchema)(J,I[K]))continue;q.if((0,oJ.propertyInData)(q,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>q.var(Q,!0)),$.ok(Q)}}Kp.validateSchemaDeps=Qp;Kp.default=JE0});var Wp=L((Vp)=>{Object.defineProperty(Vp,"__esModule",{value:!0});var Hp=o0(),wE0=w1(),GE0={message:"property name must be valid",params:({params:$})=>Hp._`{propertyName:${$.propertyName}}`},HE0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:GE0,code($){let{gen:I,schema:q,data:U,it:Y}=$;if((0,wE0.alwaysValidSchema)(Y,q))return;let J=I.name("valid");I.forIn("key",U,(Q)=>{$.setParams({propertyName:Q}),$.subschema({keyword:"propertyNames",data:Q,dataTypes:["string"],propertyName:Q,compositeRule:!0},J),I.if((0,Hp.not)(J),()=>{if($.error(!0),!Y.allErrors)I.break()})}),$.ok(J)}};Vp.default=HE0});var hP=L((Zp)=>{Object.defineProperty(Zp,"__esModule",{value:!0});var KH=D$(),f$=o0(),WE0=a8(),zH=w1(),ZE0={message:"must NOT have additional properties",params:({params:$})=>f$._`{additionalProperty:${$.additionalProperty}}`},XE0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ZE0,code($){let{gen:I,schema:q,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,zH.alwaysValidSchema)(Q,q))return;let w=(0,KH.allSchemaProperties)(U.properties),G=(0,KH.allSchemaProperties)(U.patternProperties);H(),$.ok(f$._`${J}===${WE0.default.errors}`);function H(){I.forIn("key",Y,(O)=>{if(!w.length&&!G.length)X(O);else I.if(W(O),()=>X(O))})}function W(O){let N;if(w.length>8){let T=(0,zH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,KH.isOwnProperty)(I,T,O)}else if(w.length)N=(0,f$.or)(...w.map((T)=>f$._`${O}===${T}`));else N=f$.nil;if(G.length)N=(0,f$.or)(N,...G.map((T)=>f$._`${(0,KH.usePattern)($,T)}.test(${O})`));return(0,f$.not)(N)}function V(O){I.code(f$._`delete${Y}[${O}]`)}function X(O){if(z.removeAdditional==="all"||z.removeAdditional&&q===!1){V(O);return}if(q===!1){if($.setParams({additionalProperty:O}),$.error(),!K)I.break();return}if(typeof q=="object"&&!(0,zH.alwaysValidSchema)(Q,q)){let N=I.name("valid");if(z.removeAdditional==="failing")D(O,N,!1),I.if((0,f$.not)(N),()=>{$.reset(),V(O)});else if(D(O,N),!K)I.if((0,f$.not)(N),()=>I.break())}}function D(O,N,T){let P={keyword:"additionalProperties",dataProp:O,dataPropType:zH.Type.Str};if(T===!1)Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(P,N)}}};Zp.default=XE0});var Lp=L((Op)=>{Object.defineProperty(Op,"__esModule",{value:!0});var OE0=uJ(),Xp=D$(),SP=w1(),Dp=hP(),LE0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,parentSchema:U,data:Y,it:J}=$;if(J.opts.removeAdditional==="all"&&U.additionalProperties===void 0)Dp.default.code(new OE0.KeywordCxt(J,Dp.default,"additionalProperties"));let Q=(0,Xp.allSchemaProperties)(q);for(let H of Q)J.definedProperties.add(H);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=SP.mergeEvaluated.props(I,(0,SP.toHash)(Q),J.props);let K=Q.filter((H)=>!(0,SP.alwaysValidSchema)(J,q[H]));if(K.length===0)return;let z=I.name("valid");for(let H of K){if(w(H))G(H);else{if(I.if((0,Xp.propertyInData)(I,Y,H,J.opts.ownProperties)),G(H),!J.allErrors)I.else().var(z,!0);I.endIf()}$.it.definedProperties.add(H),$.ok(z)}function w(H){return J.opts.useDefaults&&!J.compositeRule&&q[H].default!==void 0}function G(H){$.subschema({keyword:"properties",schemaProp:H,dataProp:H},z)}}};Op.default=LE0});var gp=L((Ap)=>{Object.defineProperty(Ap,"__esModule",{value:!0});var Np=D$(),wH=o0(),Fp=w1(),Mp=w1(),FE0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Np.allSchemaProperties)(q),z=K.filter((D)=>(0,Fp.alwaysValidSchema)(J,q[D]));if(K.length===0||z.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let w=Q.strictSchema&&!Q.allowMatchingProperties&&Y.properties,G=I.name("valid");if(J.props!==!0&&!(J.props instanceo
Line truncated
deps:${q}}`};var Hj0={keyword:"dependencies",type:"object",schemaType:"object",error:Gp.error,code($){let[I,q]=Vj0($);wp($,I),zp($,q)}};function Vj0({schema:$}){let I={},q={};for(let U in $){if(U==="__proto__")continue;let Y=Array.isArray($[U])?I:q;Y[U]=$[U]}return[I,q]}function wp($,I=$.schema){let{gen:q,data:U,it:Y}=$;if(Object.keys(I).length===0)return;let J=q.let("missing");for(let Q in I){let K=I[Q];if(K.length===0)continue;let w=(0,oJ.propertyInData)(q,U,Q,Y.opts.ownProperties);if($.setParams({property:Q,depsCount:K.length,deps:K.join(", ")}),Y.allErrors)q.if(w,()=>{for(let z of K)(0,oJ.checkReportMissingProp)($,z)});else q.if(SP._`${w}&&(${(0,oJ.checkMissingProp)($,K,J)})`),(0,oJ.reportMissingProp)($,J),q.else()}}Gp.validatePropertyDeps=wp;function zp($,I=$.schema){let{gen:q,data:U,keyword:Y,it:J}=$,Q=q.name("valid");for(let K in I){if((0,Gj0.alwaysValidSchema)(J,I[K]))continue;q.if((0,oJ.propertyInData)(q,U,K,J.opts.ownProperties),()=>{let w=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(w,Q)},()=>q.var(Q,!0)),$.ok(Q)}}Gp.validateSchemaDeps=zp;Gp.default=Hj0});var Dp=L((Xp)=>{Object.defineProperty(Xp,"__esModule",{value:!0});var Zp=m0(),Xj0=w1(),Dj0={message:"property name must be valid",params:({params:$})=>Zp._`{propertyName:${$.propertyName}}`},Oj0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Dj0,code($){let{gen:I,schema:q,data:U,it:Y}=$;if((0,Xj0.alwaysValidSchema)(Y,q))return;let J=I.name("valid");I.forIn("key",U,(Q)=>{$.setParams({propertyName:Q}),$.subschema({keyword:"propertyNames",data:Q,dataTypes:["string"],propertyName:Q,compositeRule:!0},J),I.if((0,Zp.not)(J),()=>{if($.error(!0),!Y.allErrors)I.break()})}),$.ok(J)}};Xp.default=Oj0});var yP=L((Op)=>{Object.defineProperty(Op,"__esModule",{value:!0});var wH=O$(),i$=m0(),Nj0=e8(),zH=w1(),Fj0={message:"must NOT have additional properties",params:({params:$})=>i$._`{additionalProperty:${$.additionalProperty}}`},Mj0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Fj0,code($){let{gen:I,schema:q,parentSchema:U,data:Y,errsCount:J,it:Q}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:w}=Q;if(Q.props=!0,w.removeAdditional!=="all"&&(0,zH.alwaysValidSchema)(Q,q))return;let z=(0,wH.allSchemaProperties)(U.properties),G=(0,wH.allSchemaProperties)(U.patternProperties);H(),$.ok(i$._`${J}===${Nj0.default.errors}`);function H(){I.forIn("key",Y,(O)=>{if(!z.length&&!G.length)X(O);else I.if(V(O),()=>X(O))})}function V(O){let N;if(z.length>8){let T=(0,zH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,wH.isOwnProperty)(I,T,O)}else if(z.length)N=(0,i$.or)(...z.map((T)=>i$._`${O}===${T}`));else N=i$.nil;if(G.length)N=(0,i$.or)(N,...G.map((T)=>i$._`${(0,wH.usePattern)($,T)}.test(${O})`));return(0,i$.not)(N)}function W(O){I.code(i$._`delete${Y}[${O}]`)}function X(O){if(w.removeAdditional==="all"||w.removeAdditional&&q===!1){W(O);return}if(q===!1){if($.setParams({additionalProperty:O}),$.error(),!K)I.break();return}if(typeof q=="object"&&!(0,zH.alwaysValidSchema)(Q,q)){let N=I.name("valid");if(w.removeAdditional==="failing")D(O,N,!1),I.if((0,i$.not)(N),()=>{$.reset(),W(O)});else if(D(O,N),!K)I.if((0,i$.not)(N),()=>I.break())}}function D(O,N,T){let P={keyword:"additionalProperties",dataProp:O,dataPropType:zH.Type.Str};if(T===!1)Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(P,N)}}};Op.default=Mj0});var Mp=L((Fp)=>{Object.defineProperty(Fp,"__esModule",{value:!0});var gj0=uJ(),Lp=O$(),uP=w1(),Np=yP(),Pj0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,parentSchema:U,data:Y,it:J}=$;if(J.opts.removeAdditional==="all"&&U.additionalProperties===void 0)Np.default.code(new gj0.KeywordCxt(J,Np.default,"additionalProperties"));let Q=(0,Lp.allSchemaProperties)(q);for(let H of Q)J.definedProperties.add(H);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=uP.mergeEvaluated.props(I,(0,uP.toHash)(Q),J.props);let K=Q.filter((H)=>!(0,uP.alwaysValidSchema)(J,q[H]));if(K.length===0)return;let w=I.name("valid");for(let H of K){if(z(H))G(H);else{if(I.if((0,Lp.propertyInData)(I,Y,H,J.opts.ownProperties)),G(H),!J.allErrors)I.else().var(w,!0);I.endIf()}$.it.definedProperties.add(H),$.ok(w)}function z(H){return J.opts.useDefaults&&!J.compositeRule&&q[H].default!==void 0}function G(H){$.subschema({keyword:"properties",schemaProp:H,dataProp:H},w)}}};Fp.default=Pj0});var Ep=L((Tp)=>{Object.defineProperty(Tp,"__esModule",{value:!0});var Ap=O$(),GH=m0(),gp=w1(),Pp=w1(),Ej0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Ap.allSchemaProperties)(q),w=K.filter((D)=>(0,gp.alwaysValidSchema)(J,q[D]));if(K.length===0||w.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let z=Q.strictSchema&&!Q.allowMatchingProperties&&Y.properties,G=I.name("valid");if(J.props!==!0&&!(J.props instanceo
Line truncated
`)}openNode($,I){let q=this.tos,U=this._xml;if(q&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),sB(U,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)C00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");sB(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(R00.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,q){if(this.openNode($,I),q!==void 0)this.writeText(q);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("")}}eB.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};_00.exports=eB});var $v=L((wi0)=>{var h00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function zi0($){if(typeof $==="string")return $;if(h00)return h00.decode($);return $.toString()}wi0.bufferToString=zi0});var k00=L((y00)=>{Object.defineProperty(y00,"__esModule",{value:!0});y00.CHAR=`
`,$=this.i;break;case vp0:{let{entityReturnState:q}=this,U=this.entity+I.slice($,this.prevI);this.state=q;let Y;if(U==="")this.fail("empty entity name."),Y="&;";else Y=this.parseEntity(U),this.entity="";if(q!==B6||this.textHandler!==void 0)this.text+=Y;break $}case U4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(D2($))this.state=Pp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case CW:this.state=Ep0,this.xmlDeclPossible=!1;break;case K10:this.state=Zp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case $6:this.state=Np0;break;default:this.fail("disallowed character in tag name"),this.state=B6,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=Gv,this.openWakaBang="";break;case"--":this.state=wv,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Qv,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(RW))this.state=Xp0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===RW)this.state=Dp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=wv}sCommentEnded(){let $=this.getCodeNorm();if($!==_4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=wv;else this.state=B6}sCData(){if(this.captureToChar($U))this.state=Op0}sCDataEnding(){let $=this.getCodeNorm();if($===$U)this.state=Lp0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Gv}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case _4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=B6;break}case $U:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=Gv}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=$10;else if($===$6||p6($))this.fail("processing instruction without a target."),this.state=$===$6?vW:Hv;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=$10}sPIRest(){let{chunk:$,i:I}=this;while(!0){let q=this.getCodeNorm();if(q===U4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(q)){this.piTarget+=$.slice(I,this.prevI);let U=q===$6;if(U||p6(q))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?Q3:I10}else this.state=U?vW:Hv;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(q);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===$6)this.state=vW;else if(!p6($))this.text=String.fromCodePoint($)}else if(this.captureToChar($6))this.state=vW}sPIEnding(){var $;let I=this.getCodeNorm();if(I===_4){let{piTarget:q}=this;if(q.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:q,body:this.text}),this.piTarget=this.text="",this.state=B6}else if(I===$6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=Hv;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===$6){this.state=Q3;return}if($!==U4)this.state=Fp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(_p0);if($===$6){this.state=Q3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p6($)||$===eq))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=$===eq?q10:Mp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===$6){this.state=Q3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if($!==eq)this.fail("value required.");this.state=q10}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===$6){this.state=Q3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if(!_W($))this.fail("value must be quoted."),this.q=Q10;else this.q=$;this.state=Ap0}sXMLDeclValue(){let $=this.captureTo([this.q,$6]);if($===$6){this.state=Q3,this.text="",this.fail("XML declaration is incomplete.");return}if($===U4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let q=I;if(this.xmlDecl.version=q,!/^1\.[0-9]+$/.test(q))this.fail("ver
Line truncated
`)}openNode($,I){let q=this.tos,U=this._xml;if(q&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),$v(U,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)S00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");$v(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(h00.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,q){if(this.openNode($,I),q!==void 0)this.writeText(q);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("")}}Iv.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};y00.exports=Iv});var qv=L((Xb0)=>{var u00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Zb0($){if(typeof $==="string")return $;if(u00)return u00.decode($);return $.toString()}Xb0.bufferToString=Zb0});var i00=L((k00)=>{Object.defineProperty(k00,"__esModule",{value:!0});k00.CHAR=`
`,$=this.i;break;case yp0:{let{entityReturnState:q}=this,U=this.entity+I.slice($,this.prevI);this.state=q;let Y;if(U==="")this.fail("empty entity name."),Y="&;";else Y=this.parseEntity(U),this.entity="";if(q!==v6||this.textHandler!==void 0)this.text+=Y;break $}case Y4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(D2($))this.state=Rp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case _W:this.state=hp0,this.xmlDeclPossible=!1;break;case G10:this.state=Fp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=Tp0;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=Vv,this.openWakaBang="";break;case"--":this.state=Hv,this.openWakaBang="";break;case"DOCTYPE":if(this.state=wv,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(CW))this.state=Mp0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===CW)this.state=Ap0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=Hv}sCommentEnded(){let $=this.getCodeNorm();if($!==h4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=Hv;else this.state=v6}sCData(){if(this.captureToChar($U))this.state=gp0}sCDataEnding(){let $=this.getCodeNorm();if($===$U)this.state=Pp0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Vv}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case h4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=v6;break}case $U:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=Vv}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=U10;else if($===I6||c6($))this.fail("processing instruction without a target."),this.state=$===I6?RW:Wv;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=U10}sPIRest(){let{chunk:$,i:I}=this;while(!0){let q=this.getCodeNorm();if(q===Y4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(q)){this.piTarget+=$.slice(I,this.prevI);let U=q===I6;if(U||c6(q))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?K3:Y10}else this.state=U?RW:Wv;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(q);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===I6)this.state=RW;else if(!c6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=RW}sPIEnding(){var $;let I=this.getCodeNorm();if(I===h4){let{piTarget:q}=this;if(q.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:q,body:this.text}),this.piTarget=this.text="",this.state=v6}else if(I===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=Wv;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=K3;return}if($!==Y4)this.state=Ep0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(kp0);if($===I6){this.state=K3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(c6($)||$===eq))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=$===eq?J10:jp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=K3,this.fail("XML declaration is incomplete.");return}if(c6($))return;if($!==eq)this.fail("value required.");this.state=J10}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=K3,this.fail("XML declaration is incomplete.");return}if(c6($))return;if(!hW($))this.fail("value must be quoted."),this.q=z10;else this.q=$;this.state=Bp0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=K3,this.text="",this.fail("XML declaration is incomplete.");return}if($===Y4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let q=I;if(this.xmlDecl.version=q,!/^1\.[0-9]+$/.test(q))this.fail("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new h4($,I).found}function h4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See:https://github.com/isaacs/node-glob/issues/167`);return new S4($,I).found}function S4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+e[w0-1];break}}}var q1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+c;v._warn(q1,!0,F)}}function v0(r,F){var M=r+" is deprecated and will be removed in a future version.";if(F)M+=" Use "+F+" instead.";return v1(M)}function v1(r,F,M){if(!g0.warnings)return;var v=new Y(r),y;if(F)M._attachExtraTrace(v);else if(g0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(v);else{var s=Y4(v);v.stack=s.message+`
`+e[z0-1];break}}}var I1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+c;v._warn(I1,!0,F)}}function R0(r,F){var M=r+" is deprecated and will be removed in a future version.";if(F)M+=" Use "+F+" instead.";return v1(M)}function v1(r,F,M){if(!g0.warnings)return;var v=new Y(r),y;if(F)M._attachExtraTrace(v);else if(g0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(v);else{var s=J4(v);v.stack=s.message+`
`)));return}}N=N._target();var T=N._bitField;if((T&50397184)===0)this._yieldedPromise=N,N._proxy(this,null);else if((T&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,N._value());else if((T&16777216)!==0)$._async.invoke(this._promiseRejected,this,N._reason());else this._promiseCancelled()}},$.coroutine=function(X,D){if(typeof X!=="function")throw new K(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var O=Object(D).yieldHandler,N=V,T=Error().stack;return function(){var P=X.apply(this,arguments),g=new N(void 0,void 0,O,T),B=g.promise();return g._generator=P,g._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+z.classString(X));H.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`);var O=Object(D).yieldHandler,N=W,T=Error().stack;return function(){var P=X.apply(this,arguments),g=new N(void 0,void 0,O,T),B=g.promise();return g._generator=P,g._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+w.classString(X));H.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`)},I=function(){return new C.PromiseInspection(this._target())},q=function(j){return C.reject(new H(j))};function U(){}var Y={},J=n1(),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=f3(),z=FK0(),w=new z;K.defineProperty(C,"_async",{value:w});var G=_5(),H=C.TypeError=G.TypeError;C.RangeError=G.RangeError;var W=C.CancellationError=G.CancellationError;C.TimeoutError=G.TimeoutError,C.OperationalError=G.OperationalError,C.RejectionError=G.OperationalError,C.AggregateError=G.AggregateError;var V=function(){},X={},D={},O=TK0()(C,V),N=EK0()(C,V,O,q,U),T=vK0()(C),P=T.create,g=CK0()(C,T),B=g.CapturedTrace,k=hK0()(C,O),h=yK0()(D),n=OS(),S=J.errorObj,t=J.tryCatch;function p(j,u){if(typeof u!=="function")throw new H("expecting a function but got "+J.classString(u));if(j.constructor!==C)throw new H(`thepromiseconstructorcannotbeinvokeddirectly
`)},I=function(){return new C.PromiseInspection(this._target())},q=function(E){return C.reject(new H(E))};function U(){}var Y={},J=n1(),Q;if(J.isNode)Q=function(){var E=process.domain;if(E===void 0)E=null;return E};else Q=function(){return null};J.notEnumerableProp(C,"_getDomain",Q);var K=n3(),w=gK0(),z=new w;K.defineProperty(C,"_async",{value:z});var G=S5(),H=C.TypeError=G.TypeError;C.RangeError=G.RangeError;var V=C.CancellationError=G.CancellationError;C.TimeoutError=G.TimeoutError,C.OperationalError=G.OperationalError,C.RejectionError=G.OperationalError,C.AggregateError=G.AggregateError;var W=function(){},X={},D={},O=BK0()(C,W),N=RK0()(C,W,O,q,U),T=_K0()(C),P=T.create,g=SK0()(C,T),B=g.CapturedTrace,k=uK0()(C,O),h=kK0()(D),f=NS(),S=J.errorObj,t=J.tryCatch;function p(E,u){if(typeof u!=="function")throw new H("expecting a function but got "+J.classString(u));if(E.constructor!==C)throw new H(`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!==V)p(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 u=arguments.length;if(u>1){var d=Array(u-1),a=0,K0;for(K0=0;K0<u-1;++K0){var G0=arguments[K0];if(J.isObject(G0))d[a++]=G0;else return q("expecting an object but got A catch statement predicate "+J.classString(G0))}return d.length=a,j=arguments[K0],this.then(void 0,h(d,j,this))}return this.then(void 0,j)},C.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},C.prototype.then=function(j,u){if(g.warnings()&&arguments.length>0&&typeof j!=="function"&&typeof u!=="function"){var d=".then() only accepts functions but was passed: "+J.classString(j);if(arguments.length>1)d+=", "+J.classString(u);this._warn(d)}return this._then(j,u,void 0,void 0,void 0)},C.prototype.done=function(j,u){var d=this._then(j,u,void 0,void 0,void 0);d._setIsFinal()},C.prototype.spread=function(j){if(typeof j!=="function")return q("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=NS.exports,C.is=function(j){return j instanceof C},C.fromNode=C.fromCallback=function(j){var u=new C(V);u._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,a=t(j)(n(u,d));if(a===S)u._rejectCallback(a.e,!0);if(!u._isFateSealed())u._setAsyncGuaranteed();return u},C.all=function(j){return new N(j).promise()},C.cast=function(j){var u=O(j);if(!(u instanceof C))u=new C(V),u._captureStackTrace(),u._setFulfilled(),u._rejectionHandler0=j;return u},C.resolve=C.fulfilled=C.cast,C.reject=C.rejected=function(j){var u=new C(V);return u._captureStackTrace(),u._rejectCallback(j,!0),u},C.setScheduler=function(j){if(typeof j!=="function")throw new H("expecting a function but got "+J.classString(j));return w.setScheduler(j)},C.prototype._then=function(j,u,d,a,K0){var G0=K0!==void 0,M0=G0?K0:new C(V),v0=this._target(),v1=v0._bitField;if(!G0){if(M0._propagateFrom(this,3),M0._captureStackTrace(),a===void 0&&(this._bitField&2097152)!==0)if((v1&50397184)!==0)a=this._boundValue();else a=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,M0)}var m0=Q();if((v1&50397184)!==0){var N1,F1,Q1=v0._settlePromiseCtx;if((v1&33554432)!==0)F1=v0._rejectionHandler0,N1=j;else if((v1&16777216)!==0)F1=v0._fulfillmentHandler0,N1=u,v0._unsetRejectionIsUnhandled();else Q1=v0._settlePromiseLateCancellationObserver,F1=new W("late cancellation observer"),v0._attachExtraTrace(F1),N1=u;w.invoke(Q1,v0,{handler:m0===null?N1:typeof N1==="function"&&J.domainBind(m0,N1),promise:M0,receiver:a,value:F1})}else v0._addCallbacks(j,u,M0,a,m0);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(w.hasCustomScheduler())return;this._bitField=this._bitField|134217728},C.prototype._receiverAt=function(j){var u=j===0?this._receiver0:this[j*4-4+3];if(u===Y)return;else if(u===void 0&&this._isBound())return this._boundValue();return u},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 C(E){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,E!==W)p(this,E),this._resolveFromExecutor(E);this._promiseCreated(),this._fireEvent("promiseCreated",this)}C.prototype.toString=function(){return"[object Promise]"},C.prototype.caught=C.prototype.catch=function(E){var u=arguments.length;if(u>1){var d=Array(u-1),a=0,K0;for(K0=0;K0<u-1;++K0){var G0=arguments[K0];if(J.isObject(G0))d[a++]=G0;else return q("expecting an object but got A catch statement predicate "+J.classString(G0))}return d.length=a,E=arguments[K0],this.then(void 0,h(d,E,this))}return this.then(void 0,E)},C.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},C.prototype.then=function(E,u){if(g.warnings()&&arguments.length>0&&typeof E!=="function"&&typeof u!=="function"){var d=".then() only accepts functions but was passed: "+J.classString(E);if(arguments.length>1)d+=", "+J.classString(u);this._warn(d)}return this._then(E,u,void 0,void 0,void 0)},C.prototype.done=function(E,u){var d=this._then(E,u,void 0,void 0,void 0);d._setIsFinal()},C.prototype.spread=function(E){if(typeof E!=="function")return q("expecting a function but got "+J.classString(E));return this.all()._then(E,void 0,void 0,X,void 0)},C.prototype.toJSON=function(){var E={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())E.fulfillmentValue=this.value(),E.isFulfilled=!0;else if(this.isRejected())E.rejectionReason=this.reason(),E.isRejected=!0;return E},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(E){return this.caught(J.originatesFromRejection,E)},C.getNewLibraryCopy=MS.exports,C.is=function(E){return E instanceof C},C.fromNode=C.fromCallback=function(E){var u=new C(W);u._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,a=t(E)(f(u,d));if(a===S)u._rejectCallback(a.e,!0);if(!u._isFateSealed())u._setAsyncGuaranteed();return u},C.all=function(E){return new N(E).promise()},C.cast=function(E){var u=O(E);if(!(u instanceof C))u=new C(W),u._captureStackTrace(),u._setFulfilled(),u._rejectionHandler0=E;return u},C.resolve=C.fulfilled=C.cast,C.reject=C.rejected=function(E){var u=new C(W);return u._captureStackTrace(),u._rejectCallback(E,!0),u},C.setScheduler=function(E){if(typeof E!=="function")throw new H("expecting a function but got "+J.classString(E));return z.setScheduler(E)},C.prototype._then=function(E,u,d,a,K0){var G0=K0!==void 0,M0=G0?K0:new C(W),R0=this._target(),v1=R0._bitField;if(!G0){if(M0._propagateFrom(this,3),M0._captureStackTrace(),a===void 0&&(this._bitField&2097152)!==0)if((v1&50397184)!==0)a=this._boundValue();else a=R0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,M0)}var l0=Q();if((v1&50397184)!==0){var L1,N1,J1=R0._settlePromiseCtx;if((v1&33554432)!==0)N1=R0._rejectionHandler0,L1=E;else if((v1&16777216)!==0)N1=R0._fulfillmentHandler0,L1=u,R0._unsetRejectionIsUnhandled();else J1=R0._settlePromiseLateCancellationObserver,N1=new V("late cancellation observer"),R0._attachExtraTrace(N1),L1=u;z.invoke(J1,R0,{handler:l0===null?L1:typeof L1==="function"&&J.domainBind(l0,L1),promise:M0,receiver:a,value:N1})}else R0._addCallbacks(E,u,M0,a,l0);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(E){this._bitField=this._bitField&-65536|E&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(z.hasCustomScheduler())return;this._bitField=this._bitField|134217728},C.prototype._receiverAt=function(E){var u=E===0?this._receiver0:this[E*4-4+3];if(u===Y)return;else if(u===void 0&&this._isBound())return this._boundValue();return u},C.prototype._promiseAt=function(E){return this[E*4-4+2]},C.prototype._fulfillmentHandlerAt=function(E){return this[E*4-4+0]},C.prototype._rejectionHandlerAt=function(E){return this[E*4-4+1]},C.prototype._boundValue=function(){},C.prototype._migrateCallback0=function(E){var{_bit
Line truncated
`).filter((J)=>J),U=Math.min(...q.map((J)=>J.length-J.trimStart().length)),Y=q.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Y)this.content.push(J)}compile(){let $=Function,I=this?.args,U=[...(this?.content??[""]).map((Y)=>`${Y}`)];return new $(...I,U.join(`
`))}}var fL={major:4,minor:4,patch:3};var k0=m("$ZodType",($,I)=>{var q;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=fL;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)(q=$._zod).deferred??(q.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let Y=(Q,K,z)=>{let w=o5(Q),G;for(let H of K){if(H._zod.def.when){if(pO(Q))continue;if(!H._zod.def.when(Q))continue}else if(w)continue;let W=Q.issues.length,V=H._zod.check(Q);if(V instanceof Promise&&z?.async===!1)throw new U8;if(G||V instanceof Promise)G=(G??Promise.resolve()).then(async()=>{if(await V,Q.issues.length===W)return;if(!w)w=o5(Q,W)});else{if(Q.issues.length===W)continue;if(!w)w=o5(Q,W)}}if(G)return G.then(()=>{return Q});return Q},J=(Q,K,z)=>{if(o5(Q))return Q.aborted=!0,Q;let w=Y(K,U,z);if(w instanceof Promise){if(z.async===!1)throw new U8;return w.then((G)=>$._zod.parse(G,z))}return $._zod.parse(w,z)};$._zod.run=(Q,K)=>{if(K.skipChecks)return $._zod.parse(Q,K);if(K.direction==="backward"){let w=$._zod.parse({value:Q.value,issues:[]},{...K,skipChecks:!0});if(w instanceof Promise)return w.then((G)=>{return J(G,Q,K)});return J(w,Q,K)}let z=$._zod.parse(Q,K);if(z instanceof Promise){if(K.async===!1)throw new U8;return z.then((w)=>Y(w,U,K))}return Y(z,U,K)}}r0($,"~standard",()=>({validate:(Y)=>{try{let J=VI($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return iY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),g7=m("$ZodString",($,I)=>{k0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??WL($._zod.bag),$._zod.parse=(q,U)=>{if(I.coerce)try{q.value=String(q.value)}catch(Y){}if(typeof q.value==="string")return q;return q.issues.push({expected:"string",code:"invalid_type",input:q.value,inst:$}),q}}),_1=m("$ZodStringFormat",($,I)=>{ZI.init($,I),g7.init($,I)}),bL=m("$ZodGUID",($,I)=>{I.pattern??(I.pattern=eO),_1.init($,I)}),iL=m("$ZodUUID",($,I)=>{if(I.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(U===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=A7(U))}else I.pattern??(I.pattern=A7());_1.init($,I)}),pL=m("$ZodEmail",($,I)=>{I.pattern??(I.pattern=$L),_1.init($,I)}),cL=m("$ZodURL",($,I)=>{_1.init($,I),$._zod.check=(q)=>{try{let U=q.value.trim();if(!I.normalize&&I.protocol?.source===zL.source){if(!/^https?:\/\//i.test(U)){q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:q.value,inst:$,continue:!I.abort});return}}let Y=new URL(U);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(Y.hostname))q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:q.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(Y.protocol.endsWith(":")?Y.protocol.slice(0,-1):Y.protocol))q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:q.value,inst:$,continue:!I.abort})}if(I.normalize)q.value=Y.href;else q.value=U;return}catch(U){q.issues.push({code:"invalid_format",format:"url",input:q.value,inst:$,continue:!I.abort})}}}),dL=m("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=IL()),_1.init($,I)}),lL=m("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=aO),_1.init($,I)}),mL=m("$ZodCUID",($,I)=>{I.pattern??(I.pattern=lO),_1.init($,I)}),oL=m("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=mO),_1.init($,I)}),rL=m("$ZodULID",($,I)=>{I.pattern??(I.pattern=oO),_1.init($,I)}),tL=m("$ZodXID",($,I)=>{I.pattern??(I.pattern=rO),_1.init($,I)}),aL=m("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=tO),_1.init($,I)}),sL=m("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=VL(I)),_1.init($,I)}),eL=m("$ZodISODate",($,I)=>{I.pattern??(I.pattern=GL),_1.init($,I)}),$N=m("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=HL(I)),_1.init($,I)}),IN=m("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=sO),_1.init($,I)}),qN=m("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=qL),_1.init($,I),$._zod.bag.format="ipv4"}),UN=m("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=UL),_1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(q)=>{try{new URL(`http://[${q.value}]`)}catch{q.issues.push({code:"invalid_format",format:"ipv6",input:q.value,inst:$,continue:!I.abort})}}}),YN=m("$ZodMAC",($,I)=>{I.pattern??(I.pattern=YL(I.delimiter)),_1.init($,I),$._zod.bag.format="mac"}),JN=m("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=JL),_1.init($,I)}),QN=m("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=QL),_1.init($,I),$._zod.check=(q)=>{let U=q.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{q.issues.push({code:"invalid_format",format:"cidrv6",input:q.value,inst:$,continue:!I.abort})}}});function KN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`))}}var iL={major:4,minor:4,patch:3};var k0=m("$ZodType",($,I)=>{var q;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=iL;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)(q=$._zod).deferred??(q.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let Y=(Q,K,w)=>{let z=t5(Q),G;for(let H of K){if(H._zod.def.when){if(dO(Q))continue;if(!H._zod.def.when(Q))continue}else if(z)continue;let V=Q.issues.length,W=H._zod.check(Q);if(W instanceof Promise&&w?.async===!1)throw new Y8;if(G||W instanceof Promise)G=(G??Promise.resolve()).then(async()=>{if(await W,Q.issues.length===V)return;if(!z)z=t5(Q,V)});else{if(Q.issues.length===V)continue;if(!z)z=t5(Q,V)}}if(G)return G.then(()=>{return Q});return Q},J=(Q,K,w)=>{if(t5(Q))return Q.aborted=!0,Q;let z=Y(K,U,w);if(z instanceof Promise){if(w.async===!1)throw new Y8;return z.then((G)=>$._zod.parse(G,w))}return $._zod.parse(z,w)};$._zod.run=(Q,K)=>{if(K.skipChecks)return $._zod.parse(Q,K);if(K.direction==="backward"){let z=$._zod.parse({value:Q.value,issues:[]},{...K,skipChecks:!0});if(z instanceof Promise)return z.then((G)=>{return J(G,Q,K)});return J(z,Q,K)}let w=$._zod.parse(Q,K);if(w instanceof Promise){if(K.async===!1)throw new Y8;return w.then((z)=>Y(z,U,K))}return Y(w,U,K)}}o0($,"~standard",()=>({validate:(Y)=>{try{let J=VI($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return bY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),P7=m("$ZodString",($,I)=>{k0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??XL($._zod.bag),$._zod.parse=(q,U)=>{if(I.coerce)try{q.value=String(q.value)}catch(Y){}if(typeof q.value==="string")return q;return q.issues.push({expected:"string",code:"invalid_type",input:q.value,inst:$}),q}}),_1=m("$ZodStringFormat",($,I)=>{ZI.init($,I),P7.init($,I)}),pL=m("$ZodGUID",($,I)=>{I.pattern??(I.pattern=IL),_1.init($,I)}),cL=m("$ZodUUID",($,I)=>{if(I.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(U===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=g7(U))}else I.pattern??(I.pattern=g7());_1.init($,I)}),dL=m("$ZodEmail",($,I)=>{I.pattern??(I.pattern=qL),_1.init($,I)}),lL=m("$ZodURL",($,I)=>{_1.init($,I),$._zod.check=(q)=>{try{let U=q.value.trim();if(!I.normalize&&I.protocol?.source===GL.source){if(!/^https?:\/\//i.test(U)){q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:q.value,inst:$,continue:!I.abort});return}}let Y=new URL(U);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(Y.hostname))q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:q.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(Y.protocol.endsWith(":")?Y.protocol.slice(0,-1):Y.protocol))q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:q.value,inst:$,continue:!I.abort})}if(I.normalize)q.value=Y.href;else q.value=U;return}catch(U){q.issues.push({code:"invalid_format",format:"url",input:q.value,inst:$,continue:!I.abort})}}}),mL=m("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=UL()),_1.init($,I)}),oL=m("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=eO),_1.init($,I)}),rL=m("$ZodCUID",($,I)=>{I.pattern??(I.pattern=oO),_1.init($,I)}),tL=m("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=rO),_1.init($,I)}),aL=m("$ZodULID",($,I)=>{I.pattern??(I.pattern=tO),_1.init($,I)}),sL=m("$ZodXID",($,I)=>{I.pattern??(I.pattern=aO),_1.init($,I)}),eL=m("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=sO),_1.init($,I)}),$N=m("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=ZL(I)),_1.init($,I)}),IN=m("$ZodISODate",($,I)=>{I.pattern??(I.pattern=VL),_1.init($,I)}),qN=m("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=WL(I)),_1.init($,I)}),UN=m("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=$L),_1.init($,I)}),YN=m("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=YL),_1.init($,I),$._zod.bag.format="ipv4"}),JN=m("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=JL),_1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(q)=>{try{new URL(`http://[${q.value}]`)}catch{q.issues.push({code:"invalid_format",format:"ipv6",input:q.value,inst:$,continue:!I.abort})}}}),QN=m("$ZodMAC",($,I)=>{I.pattern??(I.pattern=QL(I.delimiter)),_1.init($,I),$._zod.bag.format="mac"}),KN=m("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=KL),_1.init($,I)}),wN=m("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=wL),_1.init($,I),$._zod.check=(q)=>{let U=q.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{q.issues.push({code:"invalid_format",format:"cidrv6",input:q.value,inst:$,continue:!I.abort})}}});function zN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`)}V.write("payload.value = newResult;"),V.write("return payload;");let T=V.compile();return(P,g)=>T(W,P,g)},J,Q=M7,K=!N7.jitless,w=K&&xO.value,G=I.catchall,H;$._zod.parse=(W,V)=>{H??(H=U.value);let X=W.value;if(!Q(X))return W.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),W;if(K&&w&&V?.async===!1&&V.jitless!==!0){if(!J)J=Y(I.shape);if(W=J(W,V),!G)return W;return tx([],X,W,V,H,$)}return q(W,V)}});function Sx($,I,q,U){for(let J of $)if(J.issues.length===0)return I.value=J.value,I;let Y=$.filter((J)=>!o5(J));if(Y.length===1)return I.value=Y[0].value,Y[0];return I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((J)=>J.issues.map((Q)=>M6(Q,U,V4())))}),I}var mY=m("$ZodUnion",($,I)=>{k0.init($,I),r0($._zod,"optin",()=>I.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),r0($._zod,"optout",()=>I.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),r0($._zod,"values",()=>{if(I.options.every((U)=>U._zod.values))return new Set(I.options.flatMap((U)=>Array.from(U._zod.values)));return}),r0($._zod,"pattern",()=>{if(I.options.every((U)=>U._zod.pattern)){let U=I.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${U.map((Y)=>hY(Y.source)).join("|")})$`)}return});let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(q)return q(U,Y);let J=!1,Q=[];for(let K of I.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 Sx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return Sx(K,U,$,Y)})}});function yx($,I,q,U){let Y=$.filter((J)=>J.issues.length===0);if(Y.length===1)return I.value=Y[0].value,I;if(Y.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((J)=>J.issues.map((Q)=>M6(Q,U,V4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:[],inclusive:!1});return I}var TN=m("$ZodXor",($,I)=>{mY.init($,I),I.inclusive=!1;let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(q)return q(U,Y);let J=!1,Q=[];for(let K of I.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 yx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return yx(K,U,$,Y)})}}),jN=m("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,mY.init($,I);let q=$._zod.parse;r0($._zod,"propValues",()=>{let Y={};for(let J of I.options){let Q=J._zod.propValues;if(!Q||Object.keys(Q).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(J)}"`);for(let[K,z]of Object.entries(Q)){if(!Y[K])Y[K]=new Set;for(let w of z)Y[K].add(w)}}return Y});let U=KI(()=>{let Y=I.options,J=new Map;for(let Q of Y){let K=Q._zod.propValues?.[I.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.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?.[I.discriminator]);if(K)return K._zod.run(Y,J);if(I.unionFallback||J.direction==="backward")return q(Y,J);return Y.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(U.value.keys()),input:Q,path:[I.discriminator],inst:$}),Y}}),EN=m("$ZodIntersection",($,I)=>{k0.init($,I),$._zod.parse=(q,U)=>{let Y=q.value,J=I.left._zod.run({value:Y,issues:[]},U),Q=I.right._zod.run({value:Y,issues:[]},U);if(J instanceof Promise||Q instanceof Promise)return Promise.all([J,Q]).then(([z,w])=>{return ux(q,z,w)});return ux(q,J,Q)}});function nL($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(m5($)&&m5(I)){let q=Object.keys(I),U=Object.keys($).filter((J)=>q.indexOf(J)!==-1),Y={...$,...I};for(let J of U){let Q=nL($[J],I[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(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let q=[];for(let U=0;U<$.length;U++){let Y=$[U],J=I[U],Q=nL(Y,J);if(!Q.valid)return{valid:!1,mergeErrorPath:[U,...Q.mergeErrorPath]};q.push(Q.data)}return{valid:!0,data:q}}return{valid:!1,mergeErrorPath:[]}}function ux($,I,q){let U=new Map,Y;for(let K of I.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 q.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(o5($))return $;let Q=nL(I.value,q.value);if(!Q.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var zw=m("$ZodTuple",($,I)=>{k0.
Line truncated
`)}W.write("payload.value = newResult;"),W.write("return payload;");let T=W.compile();return(P,g)=>T(V,P,g)},J,Q=A7,K=!F7.jitless,z=K&&fO.value,G=I.catchall,H;$._zod.parse=(V,W)=>{H??(H=U.value);let X=V.value;if(!Q(X))return V.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),V;if(K&&z&&W?.async===!1&&W.jitless!==!0){if(!J)J=Y(I.shape);if(V=J(V,W),!G)return V;return ex([],X,V,W,H,$)}return q(V,W)}});function xx($,I,q,U){for(let J of $)if(J.issues.length===0)return I.value=J.value,I;let Y=$.filter((J)=>!t5(J));if(Y.length===1)return I.value=Y[0].value,Y[0];return I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((J)=>J.issues.map((Q)=>A6(Q,U,W4())))}),I}var mY=m("$ZodUnion",($,I)=>{k0.init($,I),o0($._zod,"optin",()=>I.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),o0($._zod,"optout",()=>I.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),o0($._zod,"values",()=>{if(I.options.every((U)=>U._zod.values))return new Set(I.options.flatMap((U)=>Array.from(U._zod.values)));return}),o0($._zod,"pattern",()=>{if(I.options.every((U)=>U._zod.pattern)){let U=I.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${U.map((Y)=>hY(Y.source)).join("|")})$`)}return});let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(q)return q(U,Y);let J=!1,Q=[];for(let K of I.options){let w=K._zod.run({value:U.value,issues:[]},Y);if(w instanceof Promise)Q.push(w),J=!0;else{if(w.issues.length===0)return w;Q.push(w)}}if(!J)return xx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return xx(K,U,$,Y)})}});function kx($,I,q,U){let Y=$.filter((J)=>J.issues.length===0);if(Y.length===1)return I.value=Y[0].value,I;if(Y.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((J)=>J.issues.map((Q)=>A6(Q,U,W4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:[],inclusive:!1});return I}var jN=m("$ZodXor",($,I)=>{mY.init($,I),I.inclusive=!1;let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(q)return q(U,Y);let J=!1,Q=[];for(let K of I.options){let w=K._zod.run({value:U.value,issues:[]},Y);if(w instanceof Promise)Q.push(w),J=!0;else Q.push(w)}if(!J)return kx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return kx(K,U,$,Y)})}}),BN=m("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,mY.init($,I);let q=$._zod.parse;o0($._zod,"propValues",()=>{let Y={};for(let J of I.options){let Q=J._zod.propValues;if(!Q||Object.keys(Q).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(J)}"`);for(let[K,w]of Object.entries(Q)){if(!Y[K])Y[K]=new Set;for(let z of w)Y[K].add(z)}}return Y});let U=KI(()=>{let Y=I.options,J=new Map;for(let Q of Y){let K=Q._zod.propValues?.[I.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Q)}"`);for(let w of K){if(J.has(w))throw Error(`Duplicatediscriminatorvalue"${String(w)}"`);J.set(w,Q)}}return J});$._zod.parse=(Y,J)=>{let Q=Y.value;if(!A7(Q))return Y.issues.push({code:"invalid_type",expected:"object",input:Q,inst:$}),Y;let K=U.value.get(Q?.[I.discriminator]);if(K)return K._zod.run(Y,J);if(I.unionFallback||J.direction==="backward")return q(Y,J);return Y.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(U.value.keys()),input:Q,path:[I.discriminator],inst:$}),Y}}),vN=m("$ZodIntersection",($,I)=>{k0.init($,I),$._zod.parse=(q,U)=>{let Y=q.value,J=I.left._zod.run({value:Y,issues:[]},U),Q=I.right._zod.run({value:Y,issues:[]},U);if(J instanceof Promise||Q instanceof Promise)return Promise.all([J,Q]).then(([w,z])=>{return fx(q,w,z)});return fx(q,J,Q)}});function bL($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(r5($)&&r5(I)){let q=Object.keys(I),U=Object.keys($).filter((J)=>q.indexOf(J)!==-1),Y={...$,...I};for(let J of U){let Q=bL($[J],I[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(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let q=[];for(let U=0;U<$.length;U++){let Y=$[U],J=I[U],Q=bL(Y,J);if(!Q.valid)return{valid:!1,mergeErrorPath:[U,...Q.mergeErrorPath]};q.push(Q.data)}return{valid:!0,data:q}}return{valid:!1,mergeErrorPath:[]}}function fx($,I,q){let U=new Map,Y;for(let K of I.issues)if(K.code==="unrecognized_keys"){Y??(Y=K);for(let w of K.keys){if(!U.has(w))U.set(w,{});U.get(w).l=!0}}else $.issues.push(K);for(let K of q.issues)if(K.code==="unrecognized_keys")for(let w of K.keys){if(!U.has(w))U.set(w,{});U.get(w).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=bL(I.value,q.value);if(!Q.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var zz=m("$ZodTuple",($,I)=>{k0.
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letQof$.seen.entries()){letK=Q[1];if(I===Q[0]){J(Q);continue}if($.external){letw=$.external.registry.get(Q[0])?.id;if(I!==Q[0]&&w){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}}}}functione5($,I){letq=$.seen.get(I);if(!q)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letz=$.seen.get(K);if(z.ref===null)return;letw=z.def??z.schema,G={...w},H=z.ref;if(z.ref=null,H){U(H);letV=$.seen.get(H),X=V.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))w.allOf=w.allOf??[],w.allOf.push(X);elseObject.assign(w,X);if(Object.assign(w,G),K._zod.parent===H)for(letOinw){if(O==="$ref"||O==="allOf")continue;if(!(OinG))deletew[O]}if(X.$ref&&V.def)for(letOinw){if(O==="$ref"||O==="allOf")continue;if(OinV.def&&JSON.stringify(w[O])===JSON.stringify(V.def[O]))deletew[O]}}letW=K._zod.parent;if(W&&W!==H){U(W);letV=$.seen.get(W);if(V?.schema.$ref){if(w.$ref=V.schema.$ref,V.def)for(letXinw){if(X==="$ref"||X==="allOf")continue;if(XinV.def&&JSON.stringify(w[X])===JSON.stringify(V.def[X]))deletew[X]}}}$.override({zodSchema:K,jsonSchema:w,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(I)?.id;if(!K)throwError("Schema is missing an `id` property");Y.$id=$.external.uri(K)}Object.assign(Y,q.def??q.schema);letJ=$.metadataRegistry.get(I)?.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:{...I["~standard"],jsonSchema:{input:vI(I,"input",$.processors),output:vI(I,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functiong6($,I){letq=I??{seen:newSet};if(q.seen.has($))return!1;q.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returng6(U.element,q);if(U.type==="set")returng6(U.valueType,q);if(U.type==="lazy")returng6(U.getter(),q);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returng6(U.innerType,q);if(U.type==="intersection")returng6(U.left,q)||g6(U.right,q);if(U.type==="record"||U.type==="map")returng6(U.keyType,q)||g6(U.valueType,q);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returng6(U.in,q)||g6(U.out,q)}if(U.type==="object"){for(letYinU.shape)if(g6(U.shape[Y],q))return!0;return!1}if(U.type==="union"){for(letYofU.options)if(g6(Y,q))return!0;return!1}if(U.type==="tuple"){for(letYofU.items)if(g6(Y,q))return!0;if(U.rest&&g6(U.rest,q))return!0;return!1}return!1}varhM=($,I={})=>(q)=>{letU=a5({...q,processors:I});returnE1($,U),s5(U,$),e5(U,$)},vI=($,I,q={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=a5({...Y??{},target:J,io:I,processors:q});returnE1($,Q),s5(Q,$),e5(Q,$)};var_L0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},SM=($,I,q,U)=>{letY=q;Y.type="string";let{minimum:J,maximum:Q,format:K,patterns:z,contentEncoding:w}=$._zod.bag;if(typeofJ==="number")Y.minLength=J;if(typeofQ==="number")Y.maxLength=Q;if(K){if(Y.format=_L0[K]??K,Y.format==="")deleteY.format;if(K==="time")deleteY.format}if(w)Y.contentEncoding=w;if(z&&z.size>0){letG=[...z];if(G.length===1)Y.pattern=G[0].source;elseif(G.length>1)Y.allOf=[...G.map((H)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},yM=($,I,q,U)=>{letY=q,{minimum:J,maximum:Q,format:K,multipleOf:z,exclusiveMaximum:w,exclusiveMinimum:G}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Y.type="integer";elseY.type="number";letH=typeofG==="number"&&G>=(J??Number.NEGATIVE_INFINITY),W=typeofw==="number"&&w<=(Q??Number.POSITIVE_INFINITY),V=I.target==="draft-04"||I.target==="openapi-3.0";if(H)if(V)Y.minimum=G,Y.exclusiveMinimum=!0;elseY.exclusiveMinimum=G;elseif(typeofJ==="number")Y.minimum=J;if(W)if(V)Y.maximum=w,Y.exclusiveMaximum=!0;elseY.exclusiveMaximum=w;elseif(typeofQ==="number")Y.maximum=Q;if(typeofz==="number")Y.multipleOf=z},uM=($,I,q,U)=>{q.type="boolean"},xM=($,I,q,U)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},kM=($,I,q,U)=>{if(I.unrepresentable==Line truncated
`}class aP{constructor($=jc.stdin,I=jc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new tP,this._started=!1,this._ondata=(q)=>{this._readBuffer.append(q),this.processReadBuffer()},this._onerror=(q)=>{this.onerror?.(q)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let $=this._readBuffer.readMessage();if($===null)break;this.onmessage?.($)}catch($){this.onerror?.($)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send($){return new Promise((I)=>{let q=Tc($);if(this._stdout.write(q))I();else this._stdout.once("drain",I)})}}import{dirname as vu,join as yw1}from"node:path";import{fileURLToPath as uw1}from"node:url";class $5 extends Error{name="KyError";get isKyError(){return!0}}class n6 extends $5{name="HTTPError";response;request;options;data;constructor($,I,q){let U=$.status||$.status===0?$.status:"",Y=$.statusText??"",J=`${U}${Y}`.trim(),Q=J?`statuscode${J}`:"an unknown error";super(`Requestfailedwith${Q}:${I.method}${I.url}`);this.response=$,this.request=I,this.options=q}}class aJ extends $5{name="NetworkError";request;constructor($,I){super(`Requestfailedduetoanetworkerror:${$.method}${$.url}`,I);this.request=$}}class sJ extends Error{name="NonError";value;constructor($){let I="Non-error value was thrown";try{if(typeof $==="string")I=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")I=$.message}catch{}super(I);this.value=$}}class qq extends $5{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new sJ($.cause):void 0;super($?.code?`Forcedretry:${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class sP extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class b$ extends $5{name="TimeoutError";request;constructor($){super(`Requesttimedout:${$.method}${$.url}`);this.request=$}}var eP=(()=>{let $=!1,I=!1,q=typeof globalThis.ReadableStream==="function",U=typeof globalThis.Request==="function";if(q&&U)try{I=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(Y){if(Y instanceof Error&&Y.message==="unsupported BodyInit type")return!1;throw Y}return $&&!I})(),Ec=typeof globalThis.AbortController==="function",ZH=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Bc=typeof globalThis.ReadableStream==="function",vc=typeof globalThis.FormData==="function",XH=["get","post","put","patch","head","delete"],Iv0=()=>{return};Iv0();var Rc={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Uq=2147483647,Cc=40,DH=Symbol("stop");class OH{options;constructor($){this.options=$}}var _c=($)=>new OH($),hc={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Sc={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var LH=new TextEncoder,qv0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[q,U]of $)I+=Cc,I+=LH.encode(`Content-Disposition:form-data;name="${q}"`).byteLength,I+=typeof U==="string"?LH.encode(U).byteLength:U.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return LH.encode($).byteLength;if($ instanceof URLSearchParams)return LH.encode($.toString()).byteLength;return 0},yc=($,I,q)=>{let U,Y=0;return $.pipeThrough(new TransformStream({transform(J,Q){if(Q.enqueue(J),U){Y+=U.byteLength;let K=I===0?0:Y/I;if(K>=1)K=1-Number.EPSILON;q?.({percent:K,totalBytes:Math.max(I,Y),transferredBytes:Y},U)}U=J},flush(){if(U)Y+=U.byteLength,q?.({percent:1,totalBytes:Math.max(I,Y),transferredBytes:Y},U)}}))},uc=($,I)=>{if(!$.body)return $;let q={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,q);let U=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(yc($.body,U,I),q)},xc=($,I,q)=>{if(!$.body)return $;let U=qv0(q??$.body);return new Request($,{duplex:"half",body:yc($.body,U,I)})};var G8=($)=>$!==null&&typeof $==="object";var Uv0=Symbol("replaceOption"),$T=($)=>G8($)&&$[Uv0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var $Q=(...$)=>{for(let I of $)if(
Line truncated
`,{mode:384}),I}function Gq($,I,q=[]){let U=I.corpId?.trim()||void 0,Y=I.stateful?I.defaultCorpId?.trim()||void 0:void 0,J=U??Y;if(J){let K=$.find((z)=>z.id===J);if(K)return K;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!I.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let Q=$[0];if(Q)return Q;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(q.length?q.join(", "):"the configured enterprise directories"))}import{readFileSync as qz1}from"node:fs";import{randomBytes as Uz1}from"node:crypto";import{randomBytes as td}from"node:crypto";var sv0=Z.object({staffId:Z.string(),name:Z.string().optional(),code:Z.string().default(""),bindTime:Z.number().optional()}),ev0=Z.object({id:Z.string(),tenantId:Z.string(),name:Z.string(),isAdmin:Z.boolean().default(!1),permissions:Z.array(Z.string()).default([]),providerUserId:Z.string().optional(),hosecloudStaff:sv0.optional()}),$R0=Z.object({apiKey:Z.string().optional(),corporationId:Z.string().optional(),corporationName:Z.string().optional()}),IR0=Z.object({id:Z.string(),name:Z.string(),tenantSlug:Z.string().optional(),isDemo:Z.boolean().default(!1),logoUrl:Z.string().nullable().optional(),hoseCorpConfig:$R0.optional()}),Bd=Z.object({user:ev0,tenant:IR0}),qR0=Z.object({id:Z.string(),name:Z.string(),email:Z.string().nullable().optional(),emailVerified:Z.boolean().optional(),image:Z.string().nullable().optional(),tenantId:Z.string().optional(),provider:Z.string().optional(),providerUserId:Z.string().optional(),mobile:Z.string().nullable().optional(),status:Z.string().optional(),permissions:Z.array(Z.string()).default([]),isAdmin:Z.boolean().default(!1),hosecloudStaff:Z.unknown().optional()}).passthrough(),UR0=Z.object({id:Z.string(),token:Z.string().optional(),expiresAt:Z.string(),createdAt:Z.string().optional(),updatedAt:Z.string().optional(),ipAddress:Z.string().optional(),userAgent:Z.string().optional(),userId:Z.string(),delegationId:Z.string().nullable().optional()}).passthrough(),vd=Z.object({user:qR0,session:UR0}),SH=Z.object({id:Z.string(),tenantId:Z.string().optional(),code:Z.number().optional(),description:Z.string(),scope:Z.string(),strictness:Z.string(),status:Z.string().optional(),createdAt:Z.number().optional(),updatedAt:Z.number().optional()}),Rd=Z.object({rules:Z.array(SH),hasPendingDeletes:Z.boolean().default(!1)}),YR0=Z.object({code:Z.string().optional(),description:Z.string(),scope:Z.string(),strictness:Z.string()}),yH=Z.object({id:Z.string(),tenantId:Z.string().optional(),versionNumber:Z.number(),versionName:Z.string().nullable().optional(),publishedBy:Z.string().nullable().optional(),publishedByName:Z.string().nullable().optional(),rules:Z.array(YR0).default([]),publishedAt:Z.number().optional(),createdAt:Z.number().optional()}),Cd=Z.object({version:yH,rulesCount:Z.number()}),zQ=Z.object({id:Z.string(),tenantId:Z.string().optional(),title:Z.string(),purpose:Z.string().default(""),contentType:Z.string().default("policy"),content:Z.string(),status:Z.string().default("published"),enabled:Z.boolean().default(!0),scenarios:Z.array(Z.string()).default([]),tags:Z.array(Z.string()).default([]),category:Z.string().nullable().optional(),categoryTags:Z.array(Z.string()).default([]),createdBy:Z.string().nullable().optional(),createdByName:Z.string().nullable().optional(),createdAt:Z.number().optional(),updatedAt:Z.number().optional(),updatedBy:Z.string().nullable().optional(),updatedByName:Z.string().nullable().optional(),isDeleted:Z.boolean().default(!1)}),_d=Z.object({articles:Z.array(zQ),total:Z.number().optional()}),JR0=Z.object({explicitApprove:Z.string().default(""),explicitReject:Z.string().default(""),exemptApprove:Z.string().default(""),review:Z.string().default("")}).passthrough(),QR0=Z.object({type:Z.string(),signKey:Z.string().optional(),outboundName:Z.string().optional(),mode:Z.string().optional(),autoApprovalRate:Z.number().optional(),apiKey:Z.string().optional(),apiSecret:Z.string().optional(),apiOrigin:Z.string().optional(),corporationId:Z.string().optional(),ebotSignKey:Z.string().optional(),completionSignKey:Z.string().optional(),outboundMessageId:Z.string().optional(),completionMessageId:Z.string().optional()}).passthrough(),KR0=Z.enum(["assisted","semi_automatic","fully_automatic"]),Ed=Z.object({id:Z.string(),url:Z.string().url()}).passthrough(),wQ=Z.object({type:Z.literal("webhook"),id:Z.string(),name:Z.string(),mode:KR0,incomingDocumentWebhook:Ed,outgoingResultWebhook:Z.string().url(),incomingManualResultWebhook:Ed,secret:Z.string().min(1),autoApprovalRate:Z.number().int().min(0).max(100).optional()}).passthrough(),LT=Z.object({id:Z.string().optional(),tenantId:Z.string().optional(),tone:Z.string().optional(),language:Z.string().optional(),detailLevel:Z.string().optional(),outputFormat:Z.string().optional(),examples:Z.array(Z.string()).default([]),prohibitedPhrases:Z.array(Z.strin
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letQof$.seen.entries()){letK=Q[1];if(I===Q[0]){J(Q);continue}if($.external){letz=$.external.registry.get(Q[0])?.id;if(I!==Q[0]&&z){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}}}}functionI9($,I){letq=$.seen.get(I);if(!q)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letw=$.seen.get(K);if(w.ref===null)return;letz=w.def??w.schema,G={...z},H=w.ref;if(w.ref=null,H){U(H);letW=$.seen.get(H),X=W.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))z.allOf=z.allOf??[],z.allOf.push(X);elseObject.assign(z,X);if(Object.assign(z,G),K._zod.parent===H)for(letOinz){if(O==="$ref"||O==="allOf")continue;if(!(OinG))deletez[O]}if(X.$ref&&W.def)for(letOinz){if(O==="$ref"||O==="allOf")continue;if(OinW.def&&JSON.stringify(z[O])===JSON.stringify(W.def[O]))deletez[O]}}letV=K._zod.parent;if(V&&V!==H){U(V);letW=$.seen.get(V);if(W?.schema.$ref){if(z.$ref=W.schema.$ref,W.def)for(letXinz){if(X==="$ref"||X==="allOf")continue;if(XinW.def&&JSON.stringify(z[X])===JSON.stringify(W.def[X]))deletez[X]}}}$.override({zodSchema:K,jsonSchema:z,path:w.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(I)?.id;if(!K)throwError("Schema is missing an `id` property");Y.$id=$.external.uri(K)}Object.assign(Y,q.def??q.schema);letJ=$.metadataRegistry.get(I)?.id;if(J!==void0&&Y.id===J)deleteY.id;letQ=$.external?.defs??{};for(letKof$.seen.entries()){letw=K[1];if(w.def&&w.defId){if(w.def.id===w.defId)deletew.def.id;Q[w.defId]=w.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:{...I["~standard"],jsonSchema:{input:vI(I,"input",$.processors),output:vI(I,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionP6($,I){letq=I??{seen:newSet};if(q.seen.has($))return!1;q.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnP6(U.element,q);if(U.type==="set")returnP6(U.valueType,q);if(U.type==="lazy")returnP6(U.getter(),q);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnP6(U.innerType,q);if(U.type==="intersection")returnP6(U.left,q)||P6(U.right,q);if(U.type==="record"||U.type==="map")returnP6(U.keyType,q)||P6(U.valueType,q);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnP6(U.in,q)||P6(U.out,q)}if(U.type==="object"){for(letYinU.shape)if(P6(U.shape[Y],q))return!0;return!1}if(U.type==="union"){for(letYofU.options)if(P6(Y,q))return!0;return!1}if(U.type==="tuple"){for(letYofU.items)if(P6(Y,q))return!0;if(U.rest&&P6(U.rest,q))return!0;return!1}return!1}varyM=($,I={})=>(q)=>{letU=e5({...q,processors:I});returnj1($,U),$9(U,$),I9(U,$)},vI=($,I,q={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=e5({...Y??{},target:J,io:I,processors:q});returnj1($,Q),$9(Q,$),I9(Q,$)};varkL0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},uM=($,I,q,U)=>{letY=q;Y.type="string";let{minimum:J,maximum:Q,format:K,patterns:w,contentEncoding:z}=$._zod.bag;if(typeofJ==="number")Y.minLength=J;if(typeofQ==="number")Y.maxLength=Q;if(K){if(Y.format=kL0[K]??K,Y.format==="")deleteY.format;if(K==="time")deleteY.format}if(z)Y.contentEncoding=z;if(w&&w.size>0){letG=[...w];if(G.length===1)Y.pattern=G[0].source;elseif(G.length>1)Y.allOf=[...G.map((H)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},xM=($,I,q,U)=>{letY=q,{minimum:J,maximum:Q,format:K,multipleOf:w,exclusiveMaximum:z,exclusiveMinimum:G}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Y.type="integer";elseY.type="number";letH=typeofG==="number"&&G>=(J??Number.NEGATIVE_INFINITY),V=typeofz==="number"&&z<=(Q??Number.POSITIVE_INFINITY),W=I.target==="draft-04"||I.target==="openapi-3.0";if(H)if(W)Y.minimum=G,Y.exclusiveMinimum=!0;elseY.exclusiveMinimum=G;elseif(typeofJ==="number")Y.minimum=J;if(V)if(W)Y.maximum=z,Y.exclusiveMaximum=!0;elseY.exclusiveMaximum=z;elseif(typeofQ==="number")Y.maximum=Q;if(typeofw==="number")Y.multipleOf=w},kM=($,I,q,U)=>{q.type="boolean"},fM=($,I,q,U)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},nM=($,I,q,U)=>{if(I.unrepresentable==Line truncated
`}class eP{constructor($=vc.stdin,I=vc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new sP,this._started=!1,this._ondata=(q)=>{this._readBuffer.append(q),this.processReadBuffer()},this._onerror=(q)=>{this.onerror?.(q)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let $=this._readBuffer.readMessage();if($===null)break;this.onmessage?.($)}catch($){this.onerror?.($)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send($){return new Promise((I)=>{let q=Bc($);if(this._stdout.write(q))I();else this._stdout.once("drain",I)})}}import{dirname as _u,join as dz1}from"node:path";import{fileURLToPath as lz1}from"node:url";class q5 extends Error{name="KyError";get isKyError(){return!0}}class i6 extends q5{name="HTTPError";response;request;options;data;constructor($,I,q){let U=$.status||$.status===0?$.status:"",Y=$.statusText??"",J=`${U}${Y}`.trim(),Q=J?`statuscode${J}`:"an unknown error";super(`Requestfailedwith${Q}:${I.method}${I.url}`);this.response=$,this.request=I,this.options=q}}class aJ extends q5{name="NetworkError";request;constructor($,I){super(`Requestfailedduetoanetworkerror:${$.method}${$.url}`,I);this.request=$}}class sJ extends Error{name="NonError";value;constructor($){let I="Non-error value was thrown";try{if(typeof $==="string")I=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")I=$.message}catch{}super(I);this.value=$}}class qq extends q5{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new sJ($.cause):void 0;super($?.code?`Forcedretry:${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class $T extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class p$ extends q5{name="TimeoutError";request;constructor($){super(`Requesttimedout:${$.method}${$.url}`);this.request=$}}var IT=(()=>{let $=!1,I=!1,q=typeof globalThis.ReadableStream==="function",U=typeof globalThis.Request==="function";if(q&&U)try{I=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(Y){if(Y instanceof Error&&Y.message==="unsupported BodyInit type")return!1;throw Y}return $&&!I})(),Rc=typeof globalThis.AbortController==="function",XH=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Cc=typeof globalThis.ReadableStream==="function",_c=typeof globalThis.FormData==="function",DH=["get","post","put","patch","head","delete"],Kv0=()=>{return};Kv0();var hc={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Uq=2147483647,Sc=40,OH=Symbol("stop");class LH{options;constructor($){this.options=$}}var yc=($)=>new LH($),uc={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},xc={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var NH=new TextEncoder,wv0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[q,U]of $)I+=Sc,I+=NH.encode(`Content-Disposition:form-data;name="${q}"`).byteLength,I+=typeof U==="string"?NH.encode(U).byteLength:U.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return NH.encode($).byteLength;if($ instanceof URLSearchParams)return NH.encode($.toString()).byteLength;return 0},kc=($,I,q)=>{let U,Y=0;return $.pipeThrough(new TransformStream({transform(J,Q){if(Q.enqueue(J),U){Y+=U.byteLength;let K=I===0?0:Y/I;if(K>=1)K=1-Number.EPSILON;q?.({percent:K,totalBytes:Math.max(I,Y),transferredBytes:Y},U)}U=J},flush(){if(U)Y+=U.byteLength,q?.({percent:1,totalBytes:Math.max(I,Y),transferredBytes:Y},U)}}))},fc=($,I)=>{if(!$.body)return $;let q={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,q);let U=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(kc($.body,U,I),q)},nc=($,I,q)=>{if(!$.body)return $;let U=wv0(q??$.body);return new Request($,{duplex:"half",body:kc($.body,U,I)})};var H8=($)=>$!==null&&typeof $==="object";var zv0=Symbol("replaceOption"),qT=($)=>H8($)&&$[zv0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var $Q=(...$)=>{for(let I of $)if(
Line truncated
`,{mode:384}),I}function Gq($,I,q=[]){let U=I.corpId?.trim()||void 0,Y=I.stateful?I.defaultCorpId?.trim()||void 0:void 0,J=U??Y;if(J){let K=$.find((w)=>w.id===J);if(K)return K;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!I.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let Q=$[0];if(Q)return Q;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(q.length?q.join(", "):"the configured enterprise directories"))}import{readFileSync as Zw1}from"node:fs";import{randomBytes as Xw1}from"node:crypto";import{randomBytes as ed}from"node:crypto";var YR0=Z.object({staffId:Z.string(),name:Z.string().optional(),code:Z.string().default(""),bindTime:Z.number().optional()}),JR0=Z.object({id:Z.string(),tenantId:Z.string(),name:Z.string(),isAdmin:Z.boolean().default(!1),permissions:Z.array(Z.string()).default([]),providerUserId:Z.string().optional(),hosecloudStaff:YR0.optional()}),QR0=Z.object({apiKey:Z.string().optional(),corporationId:Z.string().optional(),corporationName:Z.string().optional()}),KR0=Z.object({id:Z.string(),name:Z.string(),tenantSlug:Z.string().optional(),isDemo:Z.boolean().default(!1),logoUrl:Z.string().nullable().optional(),hoseCorpConfig:QR0.optional()}),Cd=Z.object({user:JR0,tenant:KR0}),wR0=Z.object({id:Z.string(),name:Z.string(),email:Z.string().nullable().optional(),emailVerified:Z.boolean().optional(),image:Z.string().nullable().optional(),tenantId:Z.string().optional(),provider:Z.string().optional(),providerUserId:Z.string().optional(),mobile:Z.string().nullable().optional(),status:Z.string().optional(),permissions:Z.array(Z.string()).default([]),isAdmin:Z.boolean().default(!1),hosecloudStaff:Z.unknown().optional()}).passthrough(),zR0=Z.object({id:Z.string(),token:Z.string().optional(),expiresAt:Z.string(),createdAt:Z.string().optional(),updatedAt:Z.string().optional(),ipAddress:Z.string().optional(),userAgent:Z.string().optional(),userId:Z.string(),delegationId:Z.string().nullable().optional()}).passthrough(),_d=Z.object({user:wR0,session:zR0}),yH=Z.object({id:Z.string(),tenantId:Z.string().optional(),code:Z.number().optional(),description:Z.string(),scope:Z.string(),strictness:Z.string(),status:Z.string().optional(),createdAt:Z.number().optional(),updatedAt:Z.number().optional()}),hd=Z.object({rules:Z.array(yH),hasPendingDeletes:Z.boolean().default(!1)}),GR0=Z.object({code:Z.string().optional(),description:Z.string(),scope:Z.string(),strictness:Z.string()}),uH=Z.object({id:Z.string(),tenantId:Z.string().optional(),versionNumber:Z.number(),versionName:Z.string().nullable().optional(),publishedBy:Z.string().nullable().optional(),publishedByName:Z.string().nullable().optional(),rules:Z.array(GR0).default([]),publishedAt:Z.number().optional(),createdAt:Z.number().optional()}),Sd=Z.object({version:uH,rulesCount:Z.number()}),wQ=Z.object({id:Z.string(),tenantId:Z.string().optional(),title:Z.string(),purpose:Z.string().default(""),contentType:Z.string().default("policy"),content:Z.string(),status:Z.string().default("published"),enabled:Z.boolean().default(!0),scenarios:Z.array(Z.string()).default([]),tags:Z.array(Z.string()).default([]),category:Z.string().nullable().optional(),categoryTags:Z.array(Z.string()).default([]),createdBy:Z.string().nullable().optional(),createdByName:Z.string().nullable().optional(),createdAt:Z.number().optional(),updatedAt:Z.number().optional(),updatedBy:Z.string().nullable().optional(),updatedByName:Z.string().nullable().optional(),isDeleted:Z.boolean().default(!1)}),yd=Z.object({articles:Z.array(wQ),total:Z.number().optional()}),HR0=Z.object({explicitApprove:Z.string().default(""),explicitReject:Z.string().default(""),exemptApprove:Z.string().default(""),review:Z.string().default("")}).passthrough(),VR0=Z.object({type:Z.string(),signKey:Z.string().optional(),outboundName:Z.string().optional(),mode:Z.string().optional(),autoApprovalRate:Z.number().optional(),apiKey:Z.string().optional(),apiSecret:Z.string().optional(),apiOrigin:Z.string().optional(),corporationId:Z.string().optional(),ebotSignKey:Z.string().optional(),completionSignKey:Z.string().optional(),outboundMessageId:Z.string().optional(),completionMessageId:Z.string().optional()}).passthrough(),WR0=Z.enum(["assisted","semi_automatic","fully_automatic"]),Rd=Z.object({id:Z.string(),url:Z.string().url()}).passthrough(),zQ=Z.object({type:Z.literal("webhook"),id:Z.string(),name:Z.string(),mode:WR0,incomingDocumentWebhook:Rd,outgoingResultWebhook:Z.string().url(),incomingManualResultWebhook:Rd,secret:Z.string().min(1),autoApprovalRate:Z.number().int().min(0).max(100).optional()}).passthrough(),FT=Z.object({id:Z.string().optional(),tenantId:Z.string().optional(),tone:Z.string().optional(),language:Z.string().optional(),detailLevel:Z.string().optional(),outputFormat:Z.string().optional(),examples:Z.array(Z.string()).default([]),prohibitedPhrases:Z.array(Z.strin
Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let W of H){let V=W.outboundName??"SealAI 审批",X=W.signKey,D=W.apiOrigin??"production";console.error(`•"${V}"(signKey:${X},环境:${D})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${Y.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of W){let D=X.outboundName??"SealAI 审批",O=X.signKey,N=X.apiOrigin??"production";console.error(`•"${D}"(signKey:${O},环境:${N})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${O}--corp${Y.id}
`);throw Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。")}await L0("seal_deploy_hosecloud_sync",U,Y,{signKey:w},O0(J.options));return}throw Error(`Unknowndeployhosecloudaction:${K??""}.Available:requirements,list,get,status,configure,sync.`)}import{createServer as ez1}from"node:http";import{URL as tz1}from"node:url";var AZ0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.7",description:`PlannedHTTPcontractfortheseal-usewrappedbackendAPI.
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of H){let W=V.outboundName??"SealAI 审批",X=V.signKey,D=V.apiOrigin??"production";console.error(`•"${W}"(signKey:${X},环境:${D})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${Y.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let D=X.outboundName??"SealAI 审批",O=X.signKey,N=X.apiOrigin??"production";console.error(`•"${D}"(signKey:${O},环境:${N})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${O}--corp${Y.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 TZ0($){let I=$1($.options.port)??$1($.options.p),q=x($.options.host)??x($.options.h),U=await OO({port:I,host:q}),Y=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Y),process.on("SIGTERM",Y),await new Promise(()=>{})}async function jZ0($,I,q,U){if($==="config"||$==="get"){await L0("seal_llm_config_get",I,q,{},O0(U.options));return}if($==="providers"||$==="list"){await L0("seal_llm_providers_list",I,q,{},O0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function EZ0($,I){if($==="config"||$==="json"){Zu();return}await Xu()}function Zu(){R0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function BZ0($){let I=VO();R0(I,{...O0($.options),allowFull:!0})}async function vZ0($,I,q,U){if($==="available"){await L0("seal_permissions_available_list",I,q,{},O0(U.options));return}if($==="configs"||$==="list"){await L0("seal_permissions_configs_list",I,q,{},O0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as RZ0}from"node:fs";async function CZ0($,I,q,U,Y,J,Q){if(!$||$==="get"){await L0("seal_preference_get",Y,J,{},O0(Q.options));return}if($==="decision"){if(I==="update"||!I){let K=x(Q.options.input),z=K?JSON.parse(RZ0(K,"utf8")):r6(Q.json);if(!z||Object.keys(z).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await L0("seal_preference_decision_update",Y,J,z,O0(Q.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let K=x(Q.options.default)??x(Q.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await L0("seal_preference_thinking_depth_set",Y,J,{defaultLevel:K},O0(Q.options));return}if(I==="policies"){if(q==="list"||!q){await L0("seal_preference_thinking_depth_policies_list",Y,J,{},O0(Q.options));return}if(q==="upsert"){let K=x(Q.options.input),z=K?JSON.parse(RZ0(K,"utf8")):r6(Q.json);if(!z||!z.id||!z.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await L0("seal_preference_thinking_depth_policies_upsert",Y,J,z,O0(Q.options));return}if(q==="remove"||q==="delete"){let K=U??x(Q.options.id)??x(Q.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await L0("seal_preference_thinking_depth_policies_remove",Y,J,{policyId:K},O0(Q.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function _Z0($={}){let I=H8(),q=H6(),U=Gq(I,{stateful:q.stateful,defaultCorpId:q.defaultCorpId,corpId:$.corpId},y7());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Y=await FY(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Y,null,2));let J=await I4(U),Q=await bH(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 hZ0($,I,q){let U=I??x(q.options.corp)??($&&$!=="--corp"?$:void 0);await _Z0({corpId:U})}async function Du($,I,q,U,Y){if($==="count"){await L0("seal_approval_rules_list",q,U,{countOnly:!0},O0(Y.options));return}if($==="list"){if(S0(Y.options.count)){await L0("seal_approval_rules_list",q,U,{countOnly:!0},O0(Y.options));return}let J=$1(Y.options.limit),Q=$1(Y.options.offset);if(S0(Y.options.summary)){await L0("seal_approval_rules_list",q,U,{fields:IZ0,limit:J,offset:Q},O0(Y.options));return}let K=await II("seal_approval_rules_list",q,U,{limit:J,offset:Q});qZ0(K,S0(Y.options.full)===!0),R0(K);return}if($==="clear"){let J=S0(Y.options.yes)===!0,Q=S0(Y.options.dryRun)??S0(Y.options["dry-run"])??!J;if(!J&&!Q)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let K=await II("seal_approval_rules_clear",q,U,{dryRun:Q,recode:S0(Y.options.recode)});if(!J&&Q&&K&&typeof K==="object"){R0({...K,nextCommand:`seal-userulesclear--corp${U.id}--yes`},O0(Y.options));return}R0(K,O0(Y.options));return}if($==="versions"){await L0("seal_approval_rule_versions_list",q,U,{},O0(Y.options));return}if($==="version"){let J=I??x(Y.options.version);if(!J)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await L0("seal_approval_rule_version_get",q,U,Hz(J),O0(Y.options));return}if($==="get"){await L0("seal_approval_rule_get",q,U,{...$Z0(x(Y.options.version)),code:x(Y.options.code),runtimeId:x(Y.options.runtimeId)??x(Y.options["runtime-id"]),recordId:x(Y.options.r
Line truncated
`).filter(Boolean),J=Y.slice(-I);return{logFile:q,lines:J,totalLines:Y.length}}async function Yw1($){let I=MO($),q=Nu($),U=Oz($);xZ0($.stateDir);let Y=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):XO),J=$.host??(process.env.HOST?process.env.HOST:DO);NO(I,`${process.pid}
`,{mode:384}),NO(q,JSON.stringify({pid:process.pid,port:Y,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),MY(U,`servicestartingonhttp://${J}:${Y} pid=${process.pid}`);let Q=null;try{Q=await OO({port:Y,host:J,silent:!0}),MY(U,`service listening pid=${process.pid}`)}catch(z){if(MY(U,`service failed to bind port ${Y}: ${z instanceof Error?z.message:String(z)}`),FO(I)===process.pid)i8(I,{force:!0}),i8(q,{force:!0});throw z}let K=()=>{if(Q)Q.close(),Q=null;if(FO(I)===process.pid)i8(I,{force:!0}),i8(q,{force:!0});MY(U,`stopped pid=${process.pid}`)};await new Promise((z)=>{let w=!1,G=()=>{if(w)return;w=!0,K(),process.off("SIGTERM",G),process.off("SIGINT",G),z()};process.once("SIGTERM",G),process.once("SIGINT",G)})}function SZ0($){xZ0($.stateDir);let I=AY($);if(I.running)return I;let q=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...q.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Y=$w1(q.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Y.unref();let J=MO($);return NO(J,`${Y.pid}
`);Y(U)})})}async function CZ0($){let I=e0($.options.port)??e0($.options.p),q=x($.options.host)??x($.options.h),U=await NO({port:I,host:q}),Y=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Y),process.on("SIGTERM",Y),await new Promise(()=>{})}async function _Z0($,I,q,U){if($==="config"||$==="get"){await L0("seal_llm_config_get",I,q,{},O0(U.options));return}if($==="providers"||$==="list"){await L0("seal_llm_providers_list",I,q,{},O0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function hZ0($,I){if($==="config"||$==="json"){Ou();return}await Lu()}function Ou(){v0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function SZ0($){let I=ZO();v0(I,{...O0($.options),allowFull:!0})}async function yZ0($,I,q,U){if($==="available"){await L0("seal_permissions_available_list",I,q,{},O0(U.options));return}if($==="configs"||$==="list"){await L0("seal_permissions_configs_list",I,q,{},O0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as uZ0}from"node:fs";async function xZ0($,I,q,U,Y,J,Q){if(!$||$==="get"){await L0("seal_preference_get",Y,J,{},O0(Q.options));return}if($==="decision"){if(I==="update"||!I){let K=x(Q.options.input),w=K?JSON.parse(uZ0(K,"utf8")):t6(Q.json);if(!w||Object.keys(w).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await L0("seal_preference_decision_update",Y,J,w,O0(Q.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let K=x(Q.options.default)??x(Q.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await L0("seal_preference_thinking_depth_set",Y,J,{defaultLevel:K},O0(Q.options));return}if(I==="policies"){if(q==="list"||!q){await L0("seal_preference_thinking_depth_policies_list",Y,J,{},O0(Q.options));return}if(q==="upsert"){let K=x(Q.options.input),w=K?JSON.parse(uZ0(K,"utf8")):t6(Q.json);if(!w||!w.id||!w.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await L0("seal_preference_thinking_depth_policies_upsert",Y,J,w,O0(Q.options));return}if(q==="remove"||q==="delete"){let K=U??x(Q.options.id)??x(Q.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await L0("seal_preference_thinking_depth_policies_remove",Y,J,{policyId:K},O0(Q.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function kZ0($={}){let I=V8(),q=V6(),U=Gq(I,{stateful:q.stateful,defaultCorpId:q.defaultCorpId,corpId:$.corpId},u7());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Y=await FY(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Y,null,2));let J=await q4(U),Q=await bH(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 fZ0($,I,q){let U=I??x(q.options.corp)??($&&$!=="--corp"?$:void 0);await kZ0({corpId:U})}async function Nu($,I,q,U,Y){if($==="count"){await L0("seal_approval_rules_list",q,U,{countOnly:!0},O0(Y.options));return}if($==="list"){if(C0(Y.options.count)){await L0("seal_approval_rules_list",q,U,{countOnly:!0},O0(Y.options));return}let J=e0(Y.options.limit),Q=e0(Y.options.offset);if(C0(Y.options.summary)){await L0("seal_approval_rules_list",q,U,{fields:KZ0,limit:J,offset:Q},O0(Y.options));return}let K=await p8("seal_approval_rules_list",q,U,{limit:J,offset:Q});wZ0(K,C0(Y.options.full)===!0),v0(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 p8("seal_approval_rules_clear",q,U,{dryRun:Q,recode:C0(Y.options.recode)});if(!J&&Q&&K&&typeof K==="object"){v0({...K,nextCommand:`seal-userulesclear--corp${U.id}--yes`},O0(Y.options));return}v0(K,O0(Y.options));return}if($==="versions"){await L0("seal_approval_rule_versions_list",q,U,{},O0(Y.options));return}if($==="version"){let J=I??x(Y.options.version);if(!J)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await L0("seal_approval_rule_version_get",q,U,Vw(J),O0(Y.options));return}if($==="get"){await L0("seal_approval_rule_get",q,U,{...QZ0(x(Y.options.version)),code:x(Y.options.code),runtimeId:x(Y.options.runtimeId)??x(Y.options["runtime-id"]),recordId:x(Y.options.r
Line truncated
`).filter(Boolean),J=Y.slice(-I);return{logFile:q,lines:J,totalLines:Y.length}}async function Zz1($){let I=gO($),q=Au($),U=Lw($);pZ0($.stateDir);let Y=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):OO),J=$.host??(process.env.HOST?process.env.HOST:LO);MO(I,`${process.pid}
`,{mode:384}),MO(q,JSON.stringify({pid:process.pid,port:Y,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),MY(U,`servicestartingonhttp://${J}:${Y} pid=${process.pid}`);let Q=null;try{Q=await NO({port:Y,host:J,silent:!0}),MY(U,`service listening pid=${process.pid}`)}catch(w){if(MY(U,`service failed to bind port ${Y}: ${w instanceof Error?w.message:String(w)}`),AO(I)===process.pid)c8(I,{force:!0}),c8(q,{force:!0});throw w}let K=()=>{if(Q)Q.close(),Q=null;if(AO(I)===process.pid)c8(I,{force:!0}),c8(q,{force:!0});MY(U,`stopped pid=${process.pid}`)};await new Promise((w)=>{let z=!1,G=()=>{if(z)return;z=!0,K(),process.off("SIGTERM",G),process.off("SIGINT",G),w()};process.once("SIGTERM",G),process.once("SIGINT",G)})}function nZ0($){pZ0($.stateDir);let I=AY($);if(I.running)return I;let q=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...q.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Y=Gz1(q.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Y.unref();let J=gO($);return MO(J,`${Y.pid}
`,{flag:"a",mode:384})}var gu=Oz1(Dz1(),".config","seal-use");async function Pu($,I,q){let U=q?e0(q.options.port)??e0(q.options.p):void 0,Y=q?x(q.options.host)??x(q.options.h):void 0,J=q?e0(q.options.lines)??e0(q.options.n):void 0,Q=await qI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:gu,version:t0,launcher:I.launcher,port:U,host:Y},{maxLines:J});if(Q!==void 0)v0(Q)}import{existsSync as Lz1,readFileSync as cZ0}from"node:fs";async function dZ0($,I,q,U,Y){if($==="batch-records"||$==="records"){let J=I??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await L0("seal_simulation_batch_records_get",q,U,{batchId:J,query:x(Y.options.query)},O0(Y.options));return}if($==="create"||$==="run"){let J=x(Y.options.mode)??x(Y.options.sourceSystem)??x(Y.options["source-system"])??"hosecloud",Q=J==="material-pack"?"material_pack":J,K=x(Y.options.schemaConfig)??x(Y.options["schema-config"]),w=K?JSON.parse(cZ0(K,"utf8")):void 0,z=x(Y.options.input),G=z?JSON.parse(cZ0(z,"utf8")):t6(Y.json),H=x(Y.options.packageId)??x(Y.options["package-id"]),V=F6(Y.options.packageIds)??F6(Y.options["package-ids"])??(H?[H]:void 0),W=F6(Y.options.flowIds)??F6(Y.options["flow-ids"])??F6(Y.options.documentSn)??F6(Y.options["document-sn"]),X=x(Y.options.signKey)??x(Y.options["sign-key"])??x(Y.options.integration);await L0("seal_simulation_batch_create",q,U,{mode:Q,sourceSystem:Q,flowIds:W,documentSn:W,rejectNodeName:x(Y.options.rejectNode)??x(Y.options["reject-node"])??null,thinkingDepthOverride:x(Y.options.thinkingDepth)??x(Y.options["thinking-depth"]),skipInvoiceGeneration:C0(Y.options.skipInvoiceGeneration)??C0(Y.options["skip-invoice-generation"]),skipExpenseExtraction:C0(Y.options.skipExpenseExtraction)??C0(Y.options["skip-expense-extraction"]),disableAttachmentCache:C0(Y.options.disableAttachmentCache)??C0(Y.options["disable-attachment-cache"]),signKey:X,packageIds:V,packageId:H,templateId:x(Y.options.templateId)??x(Y.options["template-id"]),schemaConfig:w,requestIds:F6(Y.options.requestIds)??F6(Y.options["request-ids"]),workflowTypeId:x(Y.options.workflowTypeId)??x(Y.options["workflow-type-id"]),flowStatusList:F6(Y.options.flowStatusList)?.map(Number)??F6(Y.options["flow-status-list"])?.map(Number),businessCodes:F6(Y.options.businessCodes)??F6(Y.options["business-codes"]),documentType:x(Y.options.documentType)??x(Y.options["document-type"]),startTime:e0(Y.options.startTime)??e0(Y.options["start-time"]),endTime:e0(Y.options.endTime)??e0(Y.options["end-time"]),status:F6(Y.options.status),limit:e0(Y.options.limit),rawParams:G},O0(Y.options));return}if($==="wait"){let J=I??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await L0("seal_simulation_batch_wait",q,U,{batchId:J,timeout:x(Y.options.timeout),pollInterval:x(Y.options.pollInterval)??x(Y.options["poll-interval"])},O0(Y.options));return}if($==="clean"||$==="delete"){let J=I??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await L0("seal_simulation_batch_clean",q,U,{batchId:J},O0(Y.options));return}if($==="specifications"){let J=I??x(Y.options.integration)??x(Y.options.signKey)??x(Y.options["sign-key"]);await L0("seal_simulation_specifications_list",q,U,{signKey:J},O0(Y.options));return}if($==="list"){await L0("seal_simulation_batches_list",q,U,{limit:e0(Y.options.limit)},O0(Y.options));return}if($==="get"){let J=I??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await L0("seal_simulation_batch_get",q,U,{batchId:J},O0(Y.options));return}if($==="templates"){await L0("seal_simulation_templates_get",q,U,{},O0(Y.options));return}if($==="integrations"){await L0("seal_simulation_integrations_get",q,U,{},O0(Y.options));return}if($==="package-upload"){let J=I??x(Y.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Lz1(J))throw Error(`Filenotfound:${J}`);await L0("seal_simulation_material_package_upload",q,U,{filePath:J},O0(Y.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as zX0}from"node:fs";import{join as PO}from"node:path";import{existsSync as Tu,mkdirSync as UX0,rmSync as Rz1,writeFileSync as Cz1}from"node:fs";import{homedir as YX0}from"node:os";import{dirname as _z1,join as Eu}from"node:path";var lZ0=`---
name:seal-use
description:"v0.10.7: 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.8: 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 bZ0=`interface:
`;var mZ0=`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."
@@ -708,7 +709,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 cZ0="# 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-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-bysourceDocumentSN|sourceDocumentId|id]\nseal-uLine truncated
`;var tZ0="# 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-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-bysourceDocumentSN|sourceDocumentId|id]\nseal-uLine truncated
@@ -1143,7 +1144,7 @@ Return a compact report containing:
-Newversionnumberandversionname,ifpublished
-Verificationresult
-Whetheraregressionrerunwasperformed
`;var oZ0="# 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 $X0="# 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=S0(q.options.local)||S0(q.options.workspace),Y=x(q.options.dir)??x(q.options.target)??I,J=Y?Y:U?AO(process.cwd(),".agents","skills","seal-use"):Lz(),Q=Pu(J);R0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Lz(),Y=AO(process.cwd(),".agents","skills","seal-use");R0({global:{dir:U,installed:UX0(AO(U,"SKILL.md"))},local:{dir:Y,installed:UX0(AO(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function JX0($,I){if($==="config"){R0(await FY(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function QX0($,I,q,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await L0($,I,q,r6(U.json),O0(U.options))}function KX0(){R0(Gz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as gw1,mkdirSync as Pw1,renameSync as ju,rmSync as Tw1,unlinkSync as VX0,writeFileSync as zX0}from"node:fs";import{dirname as jw1,join as wX0}from"node:path";import{spawnSync as UI}from"node:child_process";function gO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let q=$.toLowerCase().replace(/\\/g,"/");return!q.endsWith("/bun")&&!q.endsWith("/bun.exe")&&!q.endsWith("/node")&&!q.endsWith("/node.exe")}var WX0="yunyingk/seal-use",Fz="yunyingk/seal-home";var Ew1="SEAL_USE_GITHUB_REPO",Bw1="SEAL_HOME_GITHUB_REPO";async function ZX0($,I={}){let q={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Fu,version:a0,launcher:$.launcher},U=I.repo||process.env[Ew1]?.trim()||process.env[Bw1]?.trim()||WX0,Y=I.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let g=J.replace(/^v/,""),B=XX0(g,a0);if(B<0){R0({updated:!1,currentVersion:a0,targetVersion:g,mode:gO()?"binary":"source",message:`Cannotdowngradeseal-usefromv${a0}toolderversionv${g}.Updatesmustbeforward-only.`});return}if(B===0&&!I.force){R0({updated:!1,currentVersion:a0,targetVersion:g,mode:gO()?"binary":"source",message:`seal-useisalreadyatversionv${a0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let g=await Eu(U,I.limit??10);R0({currentVersion:a0,totalQueried:g.length,releases:g.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===a0,isNewer:Nz(B.version,a0)}))});return}if(!gO()){if(I.checkOnly){let B=await Eu(U,30),k=B[0],h=k?.version??a0,n=B.find((p)=>p.version===a0),S=Nz(h,a0),t=B.filter((p)=>Nz(p.version,a0));R0({updated:!1,updateAvailable:S,currentVersion:a0,currentVersionPublishedAt:n?.publishedAt,latestVersion:h,latestVersionPublishedAt:k?.publishedAt,behindCount:t.length,pendingReleases:t.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:k?.notes??"",releaseUrl:k?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let g=AY(q).running;if(g)await qI("stop",q);try{HX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(HX0("bun",["install"],{cwd:$.appRoot}),g)await qI("start",q);R0({updated:!0,serviceRestarted:g,version:a0,mode:"source"});return}let Q=vw1(),K=Rw1(),z=await Eu(U,30),w=J?z.find((g)=>g.version===J||g.tagName===J||g.tagName===`v${J}`)??await GX0(U,J):z[0]??await GX0(U);if(!w){R0({updated:!1,currentVersion:a0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let G=w.version,H=z.find((g)=>g.version===a0),W=Nz(G,a0),V=W||Boolean(I.force),X=z.filter((g)=>Nz(g.version,a0));if(I.checkOnly){R0({updated:!1,updateAvailable:W,currentVersion:a0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,behindCount:X.length,pendingReleases:X.map((g)=>({version:g.version,tagName:g.tagName,publishedAt:g.publishedAt,author:g.author,releaseNotes:g.notes,releaseUrl:g.htmlUrl})),releaseNotes:w.notes,releaseUrl:w.htmlUrl,mode:"binary"});return}if(!V){R0({updated:!1,currentVersion:a0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${a0})`});return}let D=Cw1(w.assets,Q,K);if(!D)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${G}.Availableassets:${w.assets.map((g)=>g.name).join(", ")}`);let O=AY(q).running;if(O)await qI("stop",q);let N=process.execPath,T=jw1(N),P=wX0(T,`.tmp-update-${Date.now()}`);Pw1(P,{recursive:!0});try{let g=wX0(P,D.name);await _w1(D.downloadUrl,g,w.tagName,D.name);let B=g;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))B=hw1(g,P,Q);else if(D.name.endsWith(".zip"))B=Sw1(g,P,Q);if(gw1(B,493),process.platform==="darwin")try{UI("/usr/bin/codesig
Line truncated
`)}catch{}}async function _w1($,I,q,U){let Y=Bu(),J=[],Q=q?q.startsWith("v")?q:`v${q}`: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 D=`https://github.com/${WX0}/releases/download/${Q}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${D}`,`https://gh.ddlc.top/${D}`);J.push(D)}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)),w,G=6000,H=6000,W=307200,V=1e4,X=180000;for(let D=0;D<z.length;D++){let O=z[D],N=new AbortController,T="",P=(h)=>{T=h;try{N.abort()}catch{}},g=setTimeout(()=>{P("Connection timed out (no response headers within 6s)")},G),B,k;try{PO(`==> [${D+1}/${z.length}] Downloading via: ${O}`);let h=await fetch(O,{signal:N.signal});if(g)clearTimeout(g),g=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);B=setTimeout(()=>{P("Overall download time exceeded 3 minutes")},X);let n=Number(h.headers.get("content-length"))||0,S=h.body?.getReader();if(!S){let b=Buffer.from(await h.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);zX0(I,b),PO(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let t=[],p=0,C=0;k=setTimeout(()=>{if(p<W){let b=(p/1024).toFixed(1);P(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},H);while(!0){let b=S.read(),J0,j=new Promise((K0,G0)=>{J0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},V)}),u;try{u=await Promise.race([b,j])}finally{if(J0)clearTimeout(J0)}let{done:d,value:a}=u;if(d)break;if(a){if(t.push(a),p+=a.length,k&&p>=W)clearTimeout(k),k=void 0;let K0=Date.now();if(K0-C>200){C=K0;let G0=n?Math.round(p/n*100):0,M0=(p/1048576).toFixed(1),v0=n?(n/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${M0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
`);return}if($==="install"||$==="init"||$==="sync"){let U=C0(q.options.local)||C0(q.options.workspace),Y=x(q.options.dir)??x(q.options.target)??I,J=Y?Y:U?PO(process.cwd(),".agents","skills","seal-use"):Nw(),Q=ju(J);v0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Nw(),Y=PO(process.cwd(),".agents","skills","seal-use");v0({global:{dir:U,installed:zX0(PO(U,"SKILL.md"))},local:{dir:Y,installed:zX0(PO(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function HX0($,I){if($==="config"){v0(await FY(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function VX0($,I,q,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await L0($,I,q,t6(U.json),O0(U.options))}function WX0(){v0(Gw.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as hz1,mkdirSync as Sz1,renameSync as vu,rmSync as yz1,unlinkSync as LX0,writeFileSync as ZX0}from"node:fs";import{dirname as uz1,join as XX0}from"node:path";import{spawnSync as UI}from"node:child_process";function TO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let q=$.toLowerCase().replace(/\\/g,"/");return!q.endsWith("/bun")&&!q.endsWith("/bun.exe")&&!q.endsWith("/node")&&!q.endsWith("/node.exe")}var NX0="yunyingk/seal-use",Mw="yunyingk/seal-home";var xz1="SEAL_USE_GITHUB_REPO",kz1="SEAL_HOME_GITHUB_REPO";async function FX0($,I={}){let q={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:gu,version:t0,launcher:$.launcher},U=I.repo||process.env[xz1]?.trim()||process.env[kz1]?.trim()||NX0,Y=I.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let g=J.replace(/^v/,""),B=MX0(g,t0);if(B<0){v0({updated:!1,currentVersion:t0,targetVersion:g,mode:TO()?"binary":"source",message:`Cannotdowngradeseal-usefromv${t0}toolderversionv${g}.Updatesmustbeforward-only.`});return}if(B===0&&!I.force){v0({updated:!1,currentVersion:t0,targetVersion:g,mode:TO()?"binary":"source",message:`seal-useisalreadyatversionv${t0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let g=await Ru(U,I.limit??10);v0({currentVersion:t0,totalQueried:g.length,releases:g.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===t0,isNewer:Fw(B.version,t0)}))});return}if(!TO()){if(I.checkOnly){let B=await Ru(U,30),k=B[0],h=k?.version??t0,f=B.find((p)=>p.version===t0),S=Fw(h,t0),t=B.filter((p)=>Fw(p.version,t0));v0({updated:!1,updateAvailable:S,currentVersion:t0,currentVersionPublishedAt:f?.publishedAt,latestVersion:h,latestVersionPublishedAt:k?.publishedAt,behindCount:t.length,pendingReleases:t.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:k?.notes??"",releaseUrl:k?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let g=AY(q).running;if(g)await qI("stop",q);try{OX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(OX0("bun",["install"],{cwd:$.appRoot}),g)await qI("start",q);v0({updated:!0,serviceRestarted:g,version:t0,mode:"source"});return}let Q=fz1(),K=nz1(),w=await Ru(U,30),z=J?w.find((g)=>g.version===J||g.tagName===J||g.tagName===`v${J}`)??await DX0(U,J):w[0]??await DX0(U);if(!z){v0({updated:!1,currentVersion:t0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let G=z.version,H=w.find((g)=>g.version===t0),V=Fw(G,t0),W=V||Boolean(I.force),X=w.filter((g)=>Fw(g.version,t0));if(I.checkOnly){v0({updated:!1,updateAvailable:V,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:z.publishedAt,behindCount:X.length,pendingReleases:X.map((g)=>({version:g.version,tagName:g.tagName,publishedAt:g.publishedAt,author:g.author,releaseNotes:g.notes,releaseUrl:g.htmlUrl})),releaseNotes:z.notes,releaseUrl:z.htmlUrl,mode:"binary"});return}if(!W){v0({updated:!1,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:z.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${t0})`});return}let D=iz1(z.assets,Q,K);if(!D)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${G}.Availableassets:${z.assets.map((g)=>g.name).join(", ")}`);let O=AY(q).running;if(O)await qI("stop",q);let N=process.execPath,T=uz1(N),P=XX0(T,`.tmp-update-${Date.now()}`);Sz1(P,{recursive:!0});try{let g=XX0(P,D.name);await bz1(D.downloadUrl,g,z.tagName,D.name);let B=g;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))B=pz1(g,P,Q);else if(D.name.endsWith(".zip"))B=cz1(g,P,Q);if(hz1(B,493),process.platform==="darwin")try{UI("/usr/bin/codesig
Line truncated
`)}catch{}}async function bz1($,I,q,U){let Y=Cu(),J=[],Q=q?q.startsWith("v")?q:`v${q}`: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 D=`https://github.com/${NX0}/releases/download/${Q}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${D}`,`https://gh.ddlc.top/${D}`);J.push(D)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let w=Array.from(new Set(J)),z,G=6000,H=6000,V=307200,W=1e4,X=180000;for(let D=0;D<w.length;D++){let O=w[D],N=new AbortController,T="",P=(h)=>{T=h;try{N.abort()}catch{}},g=setTimeout(()=>{P("Connection timed out (no response headers within 6s)")},G),B,k;try{EO(`==> [${D+1}/${w.length}] Downloading via: ${O}`);let h=await fetch(O,{signal:N.signal});if(g)clearTimeout(g),g=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);B=setTimeout(()=>{P("Overall download time exceeded 3 minutes")},X);let f=Number(h.headers.get("content-length"))||0,S=h.body?.getReader();if(!S){let i=Buffer.from(await h.arrayBuffer());if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);ZX0(I,i),EO(`✓ Download succeeded (${(i.length/1024/1024).toFixed(1)} MB)`);return}let t=[],p=0,C=0;k=setTimeout(()=>{if(p<V){let i=(p/1024).toFixed(1);P(`Initial transfer too slow (${i} KB < 300 KB in 6s), switching mirror...`)}},H);while(!0){let i=S.read(),J0,E=new Promise((K0,G0)=>{J0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},W)}),u;try{u=await Promise.race([i,E])}finally{if(J0)clearTimeout(J0)}let{done:d,value:a}=u;if(d)break;if(a){if(t.push(a),p+=a.length,k&&p>=V)clearTimeout(k),k=void 0;let K0=Date.now();if(K0-C>200){C=K0;let G0=f?Math.round(p/f*100):0,M0=(p/1048576).toFixed(1),R0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${M0} / ${R0} 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.7: 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.8: 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.7
short-description:Seal tenant and Hose approval automation (v0.10.7)
version:0.10.8
short-description:Seal tenant and Hose approval automation (v0.10.8)
---
# Seal Use (v0.10.7)
# Seal Use (v0.10.8)
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.
This should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.
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.