@@ -5,6 +5,56 @@ 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.10] - 2026-09-07
### Changed & Fixed
- **Enterprise Config Resolution Isolation**:
- Removed default loading of `./enterprises` from the current working directory (`cwd`), ensuring local repo files never unintentionally leak or override user enterprise configs.
- Candidate enterprise directories now strictly default to user global configuration directories (`~/.config/seal-use/enterprises`, `~/.config/seal-home/enterprises`) unless an explicit environment variable or test directory is configured.
- **Global Test Enterprises Directory Configuration**:
- Added `testEnterprisesDir` field to `GlobalConfigSchema`.
- Added `seal-use config test-dir [<path>|--clear]` command to safely configure or clear a dedicated test enterprise directory without impacting normal user operations.
- Included `testEnterprisesDir` in global configuration summaries and candidate directory listings.
- Removed mistakenly registered `seal_approval_run_attachments_download` tool definition and aliases from `tools.ts`.
- Decoupled `seal-use approval-runs attachments` (inspection & download) CLI commands to invoke pure domain functions in `src/domains/seal/attachments.ts` directly, bypassing the legacy tool runner.
- Purged obsolete "Fine-Grained Tools" lists from `README.md` and `skills/seal-use/references/cli.md`, reinforcing the CLI-First contract where agents execute `seal-use <command>` directly or via the single `seal_cli` MCP tool.
- **Repository-Wide Dead Code & Unused Export Cleanup**:
- Eliminated duplicate enterprise directory export aliases in `src/core/config/loader.ts`.
- Converted internal helpers in `src/core/embedded-skill.ts`, `src/cli/printer.ts`, `src/cli/commands/auth.ts`, `src/domains/seal/linter/loader.ts`, `src/domains/seal/material-pack/validate.ts`, and `src/core/auth/seal.ts` to private module functions.
## [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.
- 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.
- Added `seal-use rules pull` (`seal_approval_rules_pull`) to export remote draft or published version rules to a local JSON file (defaults to `./rules.local.json`), eliminating unwanted mutations to remote drafts.
- Added `seal-use rules lint --file <path>` to execute rule quality and execution checks completely offline with zero network requests and zero dirty version records in the remote backend. Supports quality score gates (`--min-score`) and operates seamlessly even without configured enterprise credentials.
- Added `seal-use rules push` (`seal_approval_rules_push`) to apply refined local rules to the remote draft with preview (`--dry-run`), confirmation (`--yes`), and optional single-step formal release publishing (`--publish`).
- **Persistent HTTP Companion Daemon in Background Service**:
- Embedded the HTTP API server into `seal-use service run`, allowing `seal-use service start` to run as a detached background daemon with persistent HTTP service (serving `/docs`, `/openapi.json`, and `POST /api/cli`).
- Added `seal-use service logs` (`--lines <N>`) to easily inspect service background activity.
- Enhanced `seal-use service status` to track active host, port, and URL via daemon metadata state.
- Optimized `parseJsonBody` and CLI runner concurrency with standing command bypasses to prevent process queue blocks.
- Added top-level `seal-use stop` command, intuitive service aliases (`seal-use service kill|down|shutdown`), and `POST /shutdown` HTTP endpoint to gracefully terminate the background daemon from any terminal or script.
@@ -257,29 +257,20 @@ The MCP server advertises exactly one tool, `seal_cli`:
It runs the same CLI dispatcher as the global binary, so read operations, write operations, `config`, `service`, and `update` remain available. Write-operation confirmations and explicit enterprise-ID rules continue to be defined by this skill.
## CLI Tools
## CLI-First Architecture
These tools remain available to the CLI:
All Agent and automation capabilities are accessed through standard `seal-use <command>` CLI invocations (or through the single `seal_cli` MCP tool passing the command string). Internal domain services output pure, parseable JSON on `stdout`, with human diagnostics and suggestions routed to `stderr`.
-`seal_source_config`: resolve current Seal enterprise config from the configured source.
-`seal_approval_runs_search`: search approval run history and optional bridge rows.
-`seal_session_get`: current Seal Bearer session and expiration.
-`seal_approval_rules_list`: current draft approval rules. Use `{"countOnly":true}` or `{"fields":["id"],"limit":0}` to return only `{"count":...}`; use `fields` for lightweight projections when rule descriptions are not needed.
-`seal_approval_rule_versions_list`, `seal_approval_rule_version_publish`: read and publish rule versions.
-`seal_approval_rule_get`: fetch one rule from a published version by `versionNumber` plus `code` such as `#0038`, or by `recordId` plus `runtimeId` such as `rule-205`.
-`seal_approval_style_preferences_get`, `seal_approval_style_preferences_update`: read and update approval style preferences.
-`seal_approval_runs_summary`: summarize approval runs by local date and timezone. Use this for daily questions such as "what approval records did Tawen have today"; it returns status/task-mode counts and compact records.
-`seal_approval_run_get`: fetch one approval run. Pass `summary:true` or `fields` such as `"metadata"` or `"document.fields,result.summary"` to avoid returning full document, pipeline, and AI output payloads.
-`seal_approval_run_pick`: locate likely approval run records by document number, batch, latest flag, and optional field projection.
-`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_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`.
-`seal_approval_run_langfuse_bridge_get`: resolve approval run records to Langfuse lookup hints. It prefers `sourceExtendData._langfuseTraceId`; if that is missing, it returns `hosecloud-{sourceDocumentSN}` as the session fallback.
Key CLI command groups:
-**`seal-use corps ...`**: enterprise tenant management, onboarding, switching, and assistance link intake.
-**`seal-use auth ...`**: authentication diagnostics and Hose provisional authorization links.
-**`seal-use rules ...`**: rule listing, workspace pull/push, offline linting, version publishing, and clearing.
-**`seal-use approval-runs ...`**: run history search, summary by date, detail extraction, attachment inspection & download, cited rules, and Langfuse trace bridge.
-**`seal-use simulation ...`**: test simulation batch creation, polling wait, specifications, and cleanup.
-**`seal-use deploy ...`**: HoseCloud review node requirement inspection, status check, configuration, and sync.
-**`seal-use preference ...`**: decision preferences and thinking depth policies.
-**`seal-use webhook ...`**: webhook integration CRUD and material pack testing.
-**`seal-use service ...`**: persistent daemon service management with embedded HTTP server.
For rule list commands, prefer `seal-use rules count --corp <corpId>` or `seal-use rules list --corp <corpId> --summary` before requesting full rule descriptions. `seal-use rules list` protects large outputs and asks for `--summary`, `--count`, or explicit `--full` when the response would be too large.
import{createRequireas$D0}from"node:module";vardX0=Object.create;var{getPrototypeOf:lX0,defineProperty:PO,getOwnPropertyNames:mX0}=Object;varoX0=Object.prototype.hasOwnProperty;functionrX0($){returnthis[$]}vartX0,aX0,BY=($,I,q)=>{varU=$!=null&&typeof$==="object";if(U){varY=I?tX0??=newWeakMap:aX0??=newWeakMap,J=Y.get($);if(J)returnJ}q=$!=null?dX0(lX0($)):{};letQ=I||!$||!$.__esModule?PO(q,"default",{value:$,enumerable:!0}):q;for(letKofmX0($))if(!oX0.call(Q,K))PO(Q,K,{get:rX0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varL=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varsX0=($)=>$;functioneX0($,I){this[$]=sX0.bind(null,I)}varp8=($,I)=>{for(varqinI)PO($,q,{get:I[q],enumerable:!0,configurable:!0,set:eX0.bind(I,q)})};varo=$D0(import.meta.url);varEJ=L((Ef)=>{Object.defineProperty(Ef,"__esModule",{value:!0});Ef.regexpCode=Ef.getEsmExportName=Ef.getProperty=Ef.safeStringify=Ef.stringify=Ef.strConcat=Ef.addCodeArg=Ef.str=Ef._=Ef.nil=Ef._Code=Ef.Name=Ef.IDENTIFIER=Ef._CodeOrName=void0;classvG{}Ef._CodeOrName=vG;Ef.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classbIextendsvG{constructor($){super();if(!Ef.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}Ef.Name=bI;classy$extendsvG{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(qinstanceofbI)I[q.str]=(I[q.str]||0)+1;returnI},{})}}Ef._Code=y$;Ef.nil=newy$("");functionTf($,...I){letq=[$[0]],U=0;while(U<I.length)xg(q,I[U]),q.push($[++U]);returnnewy$(q)}Ef._=Tf;varug=newy$("+");functionjf($,...I){letq=[jJ($[0])],U=0;while(U<I.length)q.push(ug),xg(q,I[U]),q.push(ug,jJ($[++U]));returnMF0(q),newy$(q)}Ef.str=jf;functionxg($,I){if(Iinstanceofy$)$.push(...I._items);elseif(IinstanceofbI)$.push(I);else$.push(PF0(I))}Ef.addCodeArg=xg;functionMF0($){letI=1;while(I<$.length-1){if($[I]===ug){letq=AF0($[I-1],$[I+1]);if(q!==void0){$.splice(I-1,3,q);continue}$[I++]="+"}I++}}functionAF0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofbI||$[$.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]==='"'&&!($instanceofbI))return`"${$}${I.slice(1)}`;return}functiongF0($,I){returnI.emptyStr()?$:$.emptyStr()?I:jf`${$}${I}`}Ef.strConcat=gF0;functionPF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:jJ(Array.isArray($)?$.join(","):$)}functionTF0($){returnnewy$(jJ($))}Ef.stringify=TF0;functionjJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ef.safeStringify=jJ;functionjF0($){returntypeof$=="string"&&Ef.IDENTIFIER.test($)?newy$(`.${$}`):Tf`[${$}]`}Ef.getProperty=jF0;functionEF0($){if(typeof$=="string"&&Ef.IDENTIFIER.test($))returnnewy$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Ef.getEsmExportName=EF0;functionBF0($){returnnewy$($.toString())}Ef.regexpCode=BF0});varbg=L((Cf)=>{Object.defineProperty(Cf,"__esModule",{value:!0});Cf.ValueScope=Cf.ValueScopeName=Cf.Scope=Cf.varKinds=Cf.UsedValueState=void0;varu6=EJ();classvfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varCG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(CG||(Cf.UsedValueState=CG={}));Cf.varKinds={const:newu6.Name("const"),let:newu6.Name("let"),var:newu6.Name("var")};classfg{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}}}Cf.Scope=fg;classngextendsu6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:q}){this.value=$,this.scopePath=u6._`.${newu6.Name(I)}[${q}]`}}Cf.ValueScopeName=ng;varbF0=u6._`\n`;classRfextendsfg{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?bF0:u6.nil}}get(){returnthis._scope}name($){returnnewng($,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{createRequireasVD0}from"node:module";varUD0=Object.create;var{getPrototypeOf:YD0,defineProperty:SL,getOwnPropertyNames:JD0}=Object;varQD0=Object.prototype.hasOwnProperty;functionKD0($){returnthis[$]}varzD0,wD0,hY=($,q,I)=>{varU=$!=null&&typeof$==="object";if(U){varY=q?zD0??=newWeakMap:wD0??=newWeakMap,J=Y.get($);if(J)returnJ}I=$!=null?UD0(YD0($)):{};letQ=q||!$||!$.__esModule?SL(I,"default",{value:$,enumerable:!0}):I;for(letKofJD0($))if(!QD0.call(Q,K))SL(Q,K,{get:KD0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varO=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);varGD0=($)=>$;functionHD0($,q){this[$]=GD0.bind(null,q)}varl8=($,q)=>{for(varIinq)SL($,I,{get:q[I],enumerable:!0,configurable:!0,set:HD0.bind(q,I)})};varo=VD0(import.meta.url);var_J=O((pf)=>{Object.defineProperty(pf,"__esModule",{value:!0});pf.regexpCode=pf.getEsmExportName=pf.getProperty=pf.safeStringify=pf.stringify=pf.strConcat=pf.addCodeArg=pf.str=pf._=pf.nil=pf._Code=pf.Name=pf.IDENTIFIER=pf._CodeOrName=void0;classhG{}pf._CodeOrName=hG;pf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classmqextendshG{constructor($){super();if(!pf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}pf.Name=mq;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((q,I)=>`${q}${I}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((q,I)=>{if(Iinstanceofmq)q[I.str]=(q[I.str]||0)+1;returnq},{})}}pf._Code=x$;pf.nil=newx$("");functionnf($,...q){letI=[$[0]],U=0;while(U<q.length)mP(I,q[U]),I.push($[++U]);returnnewx$(I)}pf._=nf;varlP=newx$("+");functionbf($,...q){letI=[CJ($[0])],U=0;while(U<q.length)I.push(lP),mP(I,q[U]),I.push(lP,CJ($[++U]));returnhF0(I),newx$(I)}pf.str=bf;functionmP($,q){if(qinstanceofx$)$.push(...q._items);elseif(qinstanceofmq)$.push(q);else$.push(uF0(q))}pf.addCodeArg=mP;functionhF0($){letq=1;while(q<$.length-1){if($[q]===lP){letI=SF0($[q-1],$[q+1]);if(I!==void0){$.splice(q-1,3,I);continue}$[q++]="+"}q++}}functionSF0($,q){if(q==='""')return$;if($==='""')returnq;if(typeof$=="string"){if(qinstanceofmq||$[$.length-1]!=='"')return;if(typeofq!="string")return`${$.slice(0,-1)}${q}"`;if(q[0]==='"')return$.slice(0,-1)+q.slice(1);return}if(typeofq=="string"&&q[0]==='"'&&!($instanceofmq))return`"${$}${q.slice(1)}`;return}functionyF0($,q){returnq.emptyStr()?$:$.emptyStr()?q:bf`${$}${q}`}pf.strConcat=yF0;functionuF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:CJ(Array.isArray($)?$.join(","):$)}functionxF0($){returnnewx$(CJ($))}pf.stringify=xF0;functionCJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}pf.safeStringify=CJ;functionkF0($){returntypeof$=="string"&&pf.IDENTIFIER.test($)?newx$(`.${$}`):nf`[${$}]`}pf.getProperty=kF0;functionfF0($){if(typeof$=="string"&&pf.IDENTIFIER.test($))returnnewx$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}pf.getEsmExportName=fF0;functionnF0($){returnnewx$($.toString())}pf.regexpCode=nF0});varaP=O((mf)=>{Object.defineProperty(mf,"__esModule",{value:!0});mf.ValueScope=mf.ValueScopeName=mf.Scope=mf.varKinds=mf.UsedValueState=void0;vark6=_J();classdfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varyG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(yG||(mf.UsedValueState=yG={}));mf.varKinds={const:newk6.Name("const"),let:newk6.Name("let"),var:newk6.Name("var")};classrP{constructor({prefixes:$,parent:q}={}){this._names={},this._prefixes=$,this._parent=q}toName($){return$instanceofk6.Name?$:this.name($)}name($){returnnewk6.Name(this._newName($))}_newName($){letq=this._names[$]||this._nameGroup($);return`${$}${q.index++}`}_nameGroup($){varq,I;if(((I=(q=this._parent)===null||q===void0?void0:q._prefixes)===null||I===void0?void0:I.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}mf.Scope=rP;classtPextendsk6.Name{constructor($,q){super(q);this.prefix=$}setValue($,{property:q,itemIndex:I}){this.value=$,this.scopePath=k6._`.${newk6.Name(q)}[${I}]`}}mf.ValueScopeName=tP;vareF0=k6._`\n`;classlfextendsrP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?eF0:k6.nil}}get(){returnthis._scope}name($){returnnewtP($,this._newName($))}value($,q){varI;if(q.ref===void0)throwError("CodeGen: ref must be passed in value");letU=this.toName($),{prefix:Y}=U,J=(I=q.key)!==null&&I!==void0?I:q.ref,Q=this._values[Y];if(Q){letw=Q.get(J);if(Line truncated
deps:${q}}`};var oj0={keyword:"dependencies",type:"object",schemaType:"object",error:oi.error,code($){let[I,q]=rj0($);li($,I),mi($,q)}};function rj0({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 li($,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,lJ.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,lJ.checkReportMissingProp)($,w)});else q.if(TP._`${z}&&(${(0,lJ.checkMissingProp)($,K,J)})`),(0,lJ.reportMissingProp)($,J),q.else()}}oi.validatePropertyDeps=li;function mi($,I=$.schema){let{gen:q,data:U,keyword:Y,it:J}=$,Q=q.name("valid");for(let K in I){if((0,mj0.alwaysValidSchema)(J,I[K]))continue;q.if((0,lJ.propertyInData)(q,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>q.var(Q,!0)),$.ok(Q)}}oi.validateSchemaDeps=mi;oi.default=oj0});var $p=L((ei)=>{Object.defineProperty(ei,"__esModule",{value:!0});var si=o0(),sj0=z1(),ej0={message:"property name must be valid",params:({params:$})=>si._`{propertyName:${$.propertyName}}`},$E0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ej0,code($){let{gen:I,schema:q,data:U,it:Y}=$;if((0,sj0.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,si.not)(J),()=>{if($.error(!0),!Y.allErrors)I.break()})}),$.ok(J)}};ei.default=$E0});var jP=L((Ip)=>{Object.defineProperty(Ip,"__esModule",{value:!0});var YH=D$(),f$=o0(),qE0=r8(),JH=z1(),UE0={message:"must NOT have additional properties",params:({params:$})=>f$._`{additionalProperty:${$.additionalProperty}}`},YE0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:UE0,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,JH.alwaysValidSchema)(Q,q))return;let w=(0,YH.allSchemaProperties)(U.properties),G=(0,YH.allSchemaProperties)(U.patternProperties);H(),$.ok(f$._`${J}===${qE0.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,JH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,YH.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,YH.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,JH.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:JH.Type.Str};if(T===!1)Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(P,N)}}};Ip.default=YE0});var Jp=L((Yp)=>{Object.defineProperty(Yp,"__esModule",{value:!0});var QE0=SJ(),qp=D$(),EP=z1(),Up=jP(),KE0={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)Up.default.code(new QE0.KeywordCxt(J,Up.default,"additionalProperties"));let Q=(0,qp.allSchemaProperties)(q);for(let H of Q)J.definedProperties.add(H);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=EP.mergeEvaluated.props(I,(0,EP.toHash)(Q),J.props);let K=Q.filter((H)=>!(0,EP.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,qp.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)}}};Yp.default=KE0});var Gp=L((wp)=>{Object.defineProperty(wp,"__esModule",{value:!0});var Qp=D$(),QH=o0(),Kp=z1(),zp=z1(),wE0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Qp.allSchemaProperties)(q),z=K.filter((D)=>(0,Kp.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
depsCount:${q},
deps:${I}}`};var Qj0={keyword:"dependencies",type:"object",schemaType:"object",error:wp.error,code($){let[q,I]=Kj0($);Kp($,q),zp($,I)}};function Kj0({schema:$}){let q={},I={};for(let U in $){if(U==="__proto__")continue;let Y=Array.isArray($[U])?q:I;Y[U]=$[U]}return[q,I]}function Kp($,q=$.schema){let{gen:I,data:U,it:Y}=$;if(Object.keys(q).length===0)return;let J=I.let("missing");for(let Q in q){let K=q[Q];if(K.length===0)continue;let z=(0,aJ.propertyInData)(I,U,Q,Y.opts.ownProperties);if($.setParams({property:Q,depsCount:K.length,deps:K.join(", ")}),Y.allErrors)I.if(z,()=>{for(let w of K)(0,aJ.checkReportMissingProp)($,w)});else I.if(yT._`${z}&&(${(0,aJ.checkMissingProp)($,K,J)})`),(0,aJ.reportMissingProp)($,J),I.else()}}wp.validatePropertyDeps=Kp;function zp($,q=$.schema){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");for(let K in q){if((0,Jj0.alwaysValidSchema)(J,q[K]))continue;I.if((0,aJ.propertyInData)(I,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>I.var(Q,!0)),$.ok(Q)}}wp.validateSchemaDeps=zp;wp.default=Qj0});var Xp=O((Zp)=>{Object.defineProperty(Zp,"__esModule",{value:!0});var Wp=m0(),Gj0=z1(),Hj0={message:"property name must be valid",params:({params:$})=>Wp._`{propertyName:${$.propertyName}}`},Vj0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Hj0,code($){let{gen:q,schema:I,data:U,it:Y}=$;if((0,Gj0.alwaysValidSchema)(Y,I))return;let J=q.name("valid");q.forIn("key",U,(Q)=>{$.setParams({propertyName:Q}),$.subschema({keyword:"propertyNames",data:Q,dataTypes:["string"],propertyName:Q,compositeRule:!0},J),q.if((0,Wp.not)(J),()=>{if($.error(!0),!Y.allErrors)q.break()})}),$.ok(J)}};Zp.default=Vj0});var uT=O((Dp)=>{Object.defineProperty(Dp,"__esModule",{value:!0});var zH=O$(),b$=m0(),Zj0=s8(),wH=z1(),Xj0={message:"must NOT have additional properties",params:({params:$})=>b$._`{additionalProperty:${$.additionalProperty}}`},Dj0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Xj0,code($){let{gen:q,schema:I,parentSchema:U,data:Y,errsCount:J,it:Q}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:z}=Q;if(Q.props=!0,z.removeAdditional!=="all"&&(0,wH.alwaysValidSchema)(Q,I))return;let w=(0,zH.allSchemaProperties)(U.properties),G=(0,zH.allSchemaProperties)(U.patternProperties);H(),$.ok(b$._`${J}===${Zj0.default.errors}`);function H(){q.forIn("key",Y,(L)=>{if(!w.length&&!G.length)X(L);else q.if(V(L),()=>X(L))})}function V(L){let N;if(w.length>8){let E=(0,wH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,zH.isOwnProperty)(q,E,L)}else if(w.length)N=(0,b$.or)(...w.map((E)=>b$._`${L}===${E}`));else N=b$.nil;if(G.length)N=(0,b$.or)(N,...G.map((E)=>b$._`${(0,zH.usePattern)($,E)}.test(${L})`));return(0,b$.not)(N)}function W(L){q.code(b$._`delete${Y}[${L}]`)}function X(L){if(z.removeAdditional==="all"||z.removeAdditional&&I===!1){W(L);return}if(I===!1){if($.setParams({additionalProperty:L}),$.error(),!K)q.break();return}if(typeof I=="object"&&!(0,wH.alwaysValidSchema)(Q,I)){let N=q.name("valid");if(z.removeAdditional==="failing")D(L,N,!1),q.if((0,b$.not)(N),()=>{$.reset(),W(L)});else if(D(L,N),!K)q.if((0,b$.not)(N),()=>q.break())}}function D(L,N,E){let T={keyword:"additionalProperties",dataProp:L,dataPropType:wH.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,N)}}};Dp.default=Dj0});var Fp=O((Np)=>{Object.defineProperty(Np,"__esModule",{value:!0});var Oj0=fJ(),Lp=O$(),xT=z1(),Op=uT(),Nj0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,parentSchema:U,data:Y,it:J}=$;if(J.opts.removeAdditional==="all"&&U.additionalProperties===void 0)Op.default.code(new Oj0.KeywordCxt(J,Op.default,"additionalProperties"));let Q=(0,Lp.allSchemaProperties)(I);for(let H of Q)J.definedProperties.add(H);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=xT.mergeEvaluated.props(q,(0,xT.toHash)(Q),J.props);let K=Q.filter((H)=>!(0,xT.alwaysValidSchema)(J,I[H]));if(K.length===0)return;let z=q.name("valid");for(let H of K){if(w(H))G(H);else{if(q.if((0,Lp.propertyInData)(q,Y,H,J.opts.ownProperties)),G(H),!J.allErrors)q.else().var(z,!0);q.endIf()}$.it.definedProperties.add(H),$.ok(z)}function w(H){return J.opts.useDefaults&&!J.compositeRule&&I[H].default!==void 0}function G(H){$.subschema({keyword:"properties",schemaProp:H,dataProp:H},z)}}};Np.default=Nj0});var Ep=O((Tp)=>{Object.defineProperty(Tp,"__esModule",{value:!0});var Mp=O$(),GH=m0(),Ap=z1(),Pp=z1(),Mj0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Mp.allSchemaProperties)(I),z=K.filter((D)=>(0,Ap.alwaysValidSchema)(J,I[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=q.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($),iB(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)O00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");iB(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(D00.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("")}}pB.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};L00.exports=pB});var cB=L((lb0)=>{var N00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function db0($){if(typeof $==="string")return $;if(N00)return N00.decode($);return $.toString()}lb0.bufferToString=db0});var P00=L((M00)=>{Object.defineProperty(M00,"__esModule",{value:!0});M00.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(Z2($))this.state=Kp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case EW:this.state=Gp0,this.xmlDeclPossible=!1;break;case m00:this.state=ai0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case $6:this.state=qp0;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=$v,this.openWakaBang="";break;case"--":this.state=eB,this.openWakaBang="";break;case"DOCTYPE":if(this.state=tB,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(jW))this.state=si0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===jW)this.state=ei0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=eB}sCommentEnded(){let $=this.getCodeNorm();if($!==_4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=eB;else this.state=B6}sCData(){if(this.captureToChar(sq))this.state=$p0}sCDataEnding(){let $=this.getCodeNorm();if($===sq)this.state=Ip0;else this.text+=`]${String.fromCodePoint($)}`,this.state=$v}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 sq:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=$v}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=n00;else if($===$6||p6($))this.fail("processing instruction without a target."),this.state=$===$6?TW:Iv;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=n00}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?J3:b00}else this.state=U?TW:Iv;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=TW;else if(!p6($))this.text=String.fromCodePoint($)}else if(this.captureToChar($6))this.state=TW}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=Iv;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===$6){this.state=J3;return}if($!==U4)this.state=Up0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Xp0);if($===$6){this.state=J3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p6($)||$===aq))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=$===aq?i00:Yp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===$6){this.state=J3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if($!==aq)this.fail("value required.");this.state=i00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===$6){this.state=J3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if(!BW($))this.fail("value must be quoted."),this.q=l00;else this.q=$;this.state=Jp0}sXMLDeclValue(){let $=this.captureTo([this.q,$6]);if($===$6){this.state=J3,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($,q){let I=this.tos,U=this._xml;if(I&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),qR(U,q),this.leaf=!0,this.open=!0}addAttribute($,q){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(q!==void 0)u00(this._xml,$,q)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");qR(this._xml,$)}writeText($){let q=this._xml;if(this.open)q.push(">"),this.open=!1;this.leaf=!1,q.push(y00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),q=this._xml;if(this.leaf)q.push("/>");else q.push("</"),q.push($),q.push(">");this.open=!1,this.leaf=!1}leafNode($,q,I){if(this.openNode($,q),I!==void 0)this.writeText(I);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}IR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};x00.exports=IR});var UR=O((Di0)=>{var k00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Xi0($){if(typeof $==="string")return $;if(k00)return k00.decode($);return $.toString()}Di0.bufferToString=Xi0});var p00=O((n00)=>{Object.defineProperty(n00,"__esModule",{value:!0});n00.CHAR=`
`,$=this.i;break;case up0:{let{entityReturnState:I}=this,U=this.entity+q.slice($,this.prevI);this.state=I;let Y;if(U==="")this.fail("empty entity name."),Y="&;";else Y=this.parseEntity(U),this.entity="";if(I!==v6||this.textHandler!==void 0)this.text+=Y;break $}case Y4:this.entity+=q.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(O2($))this.state=Cp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case SW:this.state=Sp0,this.xmlDeclPossible=!1;break;case V10:this.state=Mp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=gp0;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=WR,this.openWakaBang="";break;case"--":this.state=VR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=wR,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(hW))this.state=Ap0}sCommentEnding(){var $;let q=this.getCodeNorm();if(q===hW)this.state=Pp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(q)}`,this.state=VR}sCommentEnded(){let $=this.getCodeNorm();if($!==S4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=VR;else this.state=v6}sCData(){if(this.captureToChar(UU))this.state=Tp0}sCDataEnding(){let $=this.getCodeNorm();if($===UU)this.state=Ep0;else this.text+=`]${String.fromCodePoint($)}`,this.state=WR}sCDataEnding2(){var $;let q=this.getCodeNorm();switch(q){case S4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=v6;break}case UU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(q)}`,this.state=WR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J10;else if($===I6||d6($))this.fail("processing instruction without a target."),this.state=$===I6?_W:ZR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J10}sPIRest(){let{chunk:$,i:q}=this;while(!0){let I=this.getCodeNorm();if(I===Y4){this.piTarget+=$.slice(q);return}if(!this.nameCheck(I)){this.piTarget+=$.slice(q,this.prevI);let U=I===I6;if(U||d6(I))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?w3:Q10}else this.state=U?_W:ZR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(I);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===I6)this.state=_W;else if(!d6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=_W}sPIEnding(){var $;let q=this.getCodeNorm();if(q===S4){let{piTarget:I}=this;if(I.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:I,body:this.text}),this.piTarget=this.text="",this.state=v6}else if(q===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(q)}`,this.state=ZR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=w3;return}if($!==Y4)this.state=jp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(fp0);if($===I6){this.state=w3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(d6($)||$===IU))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=$===IU?K10:Bp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=w3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if($!==IU)this.fail("value required.");this.state=K10}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=w3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if(!yW($))this.fail("value must be quoted."),this.q=H10;else this.q=$;this.state=Rp0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=w3,this.text="",this.fail("XML declaration is incomplete.");return}if($===Y4)return;let q=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let I=q;if(this.xmlDecl.version=I,!/^1\.[0-9]+$/.test(I))this.fail("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 y4($,q).found}function y4($,q){if(!$)throw Error("must provide pattern");if(typeof q==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+e[w0-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 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[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;R._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 R1(M)}function R1(r,F,M){if(!P0.warnings)return;var R=new Y(r),y;if(F)M._attachExtraTrace(R);else if(P0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(R);else{var s=J4(R);R.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
`)));return}}N=N._target();var E=N._bitField;if((E&50397184)===0)this._yieldedPromise=N,N._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,N._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,N._reason());else this._promiseCancelled()}},$.coroutine=function(X,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 L=Object(D).yieldHandler,N=W,E=Error().stack;return function(){var T=X.apply(this,arguments),P=new N(void 0,void 0,L,E),B=P.promise();return P._generator=T,P._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+z.classString(X));H.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return q(`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=k3(),z=QK0(),w=new z;K.defineProperty(C,"_async",{value:w});var G=v5(),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=HK0()(C,V),N=WK0()(C,V,O,q,U),T=XK0()(C),P=T.create,g=OK0()(C,T),B=g.CapturedTrace,x=NK0()(C,O),h=MK0()(D),f=KS(),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
`)},q=function(){return new C.PromiseInspection(this._target())},I=function(g){return C.reject(new H(g))};function U(){}var Y={},J=n1(),Q;if(J.isNode)Q=function(){var g=process.domain;if(g===void 0)g=null;return g};else Q=function(){return null};J.notEnumerableProp(C,"_getDomain",Q);var K=i3(),z=EK0(),w=new z;K.defineProperty(C,"_async",{value:w});var G=h5(),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={},L=vK0()(C,W),N=_K0()(C,W,L,I,U),E=SK0()(C),T=E.create,P=uK0()(C,E),B=P.CapturedTrace,k=kK0()(C,L),h=nK0()(D),f=FS(),S=J.errorObj,t=J.tryCatch;function p(g,u){if(typeof u!=="function")throw new H("expecting a function but got "+J.classString(u));if(g.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=wS.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)(f(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,J1=v0._settlePromiseCtx;if((v1&33554432)!==0)F1=v0._rejectionHandler0,N1=j;else if((v1&16777216)!==0)F1=v0._fulfillmentHandler0,N1=u,v0._unsetRejectionIsUnhandled();else J1=v0._settlePromiseLateCancellationObserver,F1=new W("late cancellation observer"),v0._attachExtraTrace(F1),N1=u;w.invoke(J1,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(g){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,g!==W)p(this,g),this._resolveFromExecutor(g);this._promiseCreated(),this._fireEvent("promiseCreated",this)}C.prototype.toString=function(){return"[object Promise]"},C.prototype.caught=C.prototype.catch=function(g){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 I("expecting an object but got A catch statement predicate "+J.classString(G0))}return d.length=a,g=arguments[K0],this.then(void 0,h(d,g,this))}return this.then(void 0,g)},C.prototype.reflect=function(){return this._then(q,q,void 0,this,void 0)},C.prototype.then=function(g,u){if(P.warnings()&&arguments.length>0&&typeof g!=="function"&&typeof u!=="function"){var d=".then() only accepts functions but was passed: "+J.classString(g);if(arguments.length>1)d+=", "+J.classString(u);this._warn(d)}return this._then(g,u,void 0,void 0,void 0)},C.prototype.done=function(g,u){var d=this._then(g,u,void 0,void 0,void 0);d._setIsFinal()},C.prototype.spread=function(g){if(typeof g!=="function")return I("expecting a function but got "+J.classString(g));return this.all()._then(g,void 0,void 0,X,void 0)},C.prototype.toJSON=function(){var g={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())g.fulfillmentValue=this.value(),g.isFulfilled=!0;else if(this.isRejected())g.rejectionReason=this.reason(),g.isRejected=!0;return g},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(g){return this.caught(J.originatesFromRejection,g)},C.getNewLibraryCopy=AS.exports,C.is=function(g){return g instanceof C},C.fromNode=C.fromCallback=function(g){var u=new C(W);u._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,a=t(g)(f(u,d));if(a===S)u._rejectCallback(a.e,!0);if(!u._isFateSealed())u._setAsyncGuaranteed();return u},C.all=function(g){return new N(g).promise()},C.cast=function(g){var u=L(g);if(!(u instanceof C))u=new C(W),u._captureStackTrace(),u._setFulfilled(),u._rejectionHandler0=g;return u},C.resolve=C.fulfilled=C.cast,C.reject=C.rejected=function(g){var u=new C(W);return u._captureStackTrace(),u._rejectCallback(g,!0),u},C.setScheduler=function(g){if(typeof g!=="function")throw new H("expecting a function but got "+J.classString(g));return w.setScheduler(g)},C.prototype._then=function(g,u,d,a,K0){var G0=K0!==void 0,M0=G0?K0:new C(W),v0=this._target(),R1=v0._bitField;if(!G0){if(M0._propagateFrom(this,3),M0._captureStackTrace(),a===void 0&&(this._bitField&2097152)!==0)if((R1&50397184)!==0)a=this._boundValue();else a=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,M0)}var l0=Q();if((R1&50397184)!==0){var O1,N1,J1=v0._settlePromiseCtx;if((R1&33554432)!==0)N1=v0._rejectionHandler0,O1=g;else if((R1&16777216)!==0)N1=v0._fulfillmentHandler0,O1=u,v0._unsetRejectionIsUnhandled();else J1=v0._settlePromiseLateCancellationObserver,N1=new V("late cancellation observer"),v0._attachExtraTrace(N1),O1=u;w.invoke(J1,v0,{handler:l0===null?O1:typeof O1==="function"&&J.domainBind(l0,O1),promise:M0,receiver:a,value:N1})}else v0._addCallbacks(g,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(g){this._bitField=this._bitField&-65536|g&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(g){var u=g===0?this._receiver0:this[g*4-4+3];if(u===Y)return;else if(u===void 0&&this._isBound())return this._boundValue();return u},C.prototype._promiseAt=function(g){return this[g*4-4+2]},C.prototype._fulfillmentHandlerAt=function(g){return this[g*4-4+0]},C.prototype._rejectionHandlerAt=function(g){return this[g*4-4+1]},C.prototype._boundValue=function(){},C.prototype._migrateCallback0=function(g){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 _L={major:4,minor:4,patch:3};var k0=m("$ZodType",($,I)=>{var q;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=_L;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=d5(Q),G;for(let H of K){if(H._zod.def.when){if(uO(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=d5(Q,W)});else{if(Q.issues.length===W)continue;if(!w)w=d5(Q,W)}}if(G)return G.then(()=>{return Q});return Q},J=(Q,K,z)=>{if(d5(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=GI($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return nY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),A7=m("$ZodString",($,I)=>{k0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??QL($._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)=>{VI.init($,I),A7.init($,I)}),SL=m("$ZodGUID",($,I)=>{I.pattern??(I.pattern=lO),_1.init($,I)}),yL=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=M7(U))}else I.pattern??(I.pattern=M7());_1.init($,I)}),uL=m("$ZodEmail",($,I)=>{I.pattern??(I.pattern=mO),_1.init($,I)}),xL=m("$ZodURL",($,I)=>{_1.init($,I),$._zod.check=(q)=>{try{let U=q.value.trim();if(!I.normalize&&I.protocol?.source===IL.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})}}}),kL=m("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=oO()),_1.init($,I)}),fL=m("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=cO),_1.init($,I)}),nL=m("$ZodCUID",($,I)=>{I.pattern??(I.pattern=fO),_1.init($,I)}),bL=m("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=nO),_1.init($,I)}),iL=m("$ZodULID",($,I)=>{I.pattern??(I.pattern=bO),_1.init($,I)}),pL=m("$ZodXID",($,I)=>{I.pattern??(I.pattern=iO),_1.init($,I)}),cL=m("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=pO),_1.init($,I)}),dL=m("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=JL(I)),_1.init($,I)}),lL=m("$ZodISODate",($,I)=>{I.pattern??(I.pattern=UL),_1.init($,I)}),mL=m("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=YL(I)),_1.init($,I)}),oL=m("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=dO),_1.init($,I)}),rL=m("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=rO),_1.init($,I),$._zod.bag.format="ipv4"}),tL=m("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=tO),_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})}}}),aL=m("$ZodMAC",($,I)=>{I.pattern??(I.pattern=aO(I.delimiter)),_1.init($,I),$._zod.bag.format="mac"}),sL=m("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=sO),_1.init($,I)}),eL=m("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=eO),_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 $N($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`).filter((J)=>J),U=Math.min(...I.map((J)=>J.length-J.trimStart().length)),Y=I.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Y)this.content.push(J)}compile(){let $=Function,q=this?.args,U=[...(this?.content??[""]).map((Y)=>`${Y}`)];return new $(...q,U.join(`
`))}}var iO={major:4,minor:4,patch:3};var k0=m("$ZodType",($,q)=>{var I;$??($={}),$._zod.def=q,$._zod.bag=$._zod.bag||{},$._zod.version=iO;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let Y of U)for(let J of Y._zod.onattach)J($);if(U.length===0)(I=$._zod).deferred??(I.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let Y=(Q,K,z)=>{let w=r5(Q),G;for(let H of K){if(H._zod.def.when){if(lL(Q))continue;if(!H._zod.def.when(Q))continue}else if(w)continue;let V=Q.issues.length,W=H._zod.check(Q);if(W instanceof Promise&&z?.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(!w)w=r5(Q,V)});else{if(Q.issues.length===V)continue;if(!w)w=r5(Q,V)}}if(G)return G.then(()=>{return Q});return Q},J=(Q,K,z)=>{if(r5(Q))return Q.aborted=!0,Q;let w=Y(K,U,z);if(w instanceof Promise){if(z.async===!1)throw new Y8;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 Y8;return z.then((w)=>Y(w,U,K))}return Y(z,U,K)}}o0($,"~standard",()=>({validate:(Y)=>{try{let J=Dq($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return dY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),P7=m("$ZodString",($,q)=>{k0.init($,q),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??DO($._zod.bag),$._zod.parse=(I,U)=>{if(q.coerce)try{I.value=String(I.value)}catch(Y){}if(typeof I.value==="string")return I;return I.issues.push({expected:"string",code:"invalid_type",input:I.value,inst:$}),I}}),_1=m("$ZodStringFormat",($,q)=>{Oq.init($,q),P7.init($,q)}),cO=m("$ZodGUID",($,q)=>{q.pattern??(q.pattern=IO),_1.init($,q)}),dO=m("$ZodUUID",($,q)=>{if(q.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[q.version];if(U===void 0)throw Error(`InvalidUUIDversion:"${q.version}"`);q.pattern??(q.pattern=A7(U))}else q.pattern??(q.pattern=A7());_1.init($,q)}),lO=m("$ZodEmail",($,q)=>{q.pattern??(q.pattern=UO),_1.init($,q)}),mO=m("$ZodURL",($,q)=>{_1.init($,q),$._zod.check=(I)=>{try{let U=I.value.trim();if(!q.normalize&&q.protocol?.source===HO.source){if(!/^https?:\/\//i.test(U)){I.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:I.value,inst:$,continue:!q.abort});return}}let Y=new URL(U);if(q.hostname){if(q.hostname.lastIndex=0,!q.hostname.test(Y.hostname))I.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:q.hostname.source,input:I.value,inst:$,continue:!q.abort})}if(q.protocol){if(q.protocol.lastIndex=0,!q.protocol.test(Y.protocol.endsWith(":")?Y.protocol.slice(0,-1):Y.protocol))I.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:q.protocol.source,input:I.value,inst:$,continue:!q.abort})}if(q.normalize)I.value=Y.href;else I.value=U;return}catch(U){I.issues.push({code:"invalid_format",format:"url",input:I.value,inst:$,continue:!q.abort})}}}),oO=m("$ZodEmoji",($,q)=>{q.pattern??(q.pattern=YO()),_1.init($,q)}),rO=m("$ZodNanoID",($,q)=>{q.pattern??(q.pattern=$O),_1.init($,q)}),tO=m("$ZodCUID",($,q)=>{q.pattern??(q.pattern=rL),_1.init($,q)}),aO=m("$ZodCUID2",($,q)=>{q.pattern??(q.pattern=tL),_1.init($,q)}),sO=m("$ZodULID",($,q)=>{q.pattern??(q.pattern=aL),_1.init($,q)}),eO=m("$ZodXID",($,q)=>{q.pattern??(q.pattern=sL),_1.init($,q)}),$N=m("$ZodKSUID",($,q)=>{q.pattern??(q.pattern=eL),_1.init($,q)}),qN=m("$ZodISODateTime",($,q)=>{q.pattern??(q.pattern=XO(q)),_1.init($,q)}),IN=m("$ZodISODate",($,q)=>{q.pattern??(q.pattern=WO),_1.init($,q)}),UN=m("$ZodISOTime",($,q)=>{q.pattern??(q.pattern=ZO(q)),_1.init($,q)}),YN=m("$ZodISODuration",($,q)=>{q.pattern??(q.pattern=qO),_1.init($,q)}),JN=m("$ZodIPv4",($,q)=>{q.pattern??(q.pattern=JO),_1.init($,q),$._zod.bag.format="ipv4"}),QN=m("$ZodIPv6",($,q)=>{q.pattern??(q.pattern=QO),_1.init($,q),$._zod.bag.format="ipv6",$._zod.check=(I)=>{try{new URL(`http://[${I.value}]`)}catch{I.issues.push({code:"invalid_format",format:"ipv6",input:I.value,inst:$,continue:!q.abort})}}}),KN=m("$ZodMAC",($,q)=>{q.pattern??(q.pattern=KO(q.delimiter)),_1.init($,q),$._zod.bag.format="mac"}),zN=m("$ZodCIDRv4",($,q)=>{q.pattern??(q.pattern=zO),_1.init($,q)}),wN=m("$ZodCIDRv6",($,q)=>{q.pattern??(q.pattern=wO),_1.init($,q),$._zod.check=(I)=>{let U=I.value.split("/");try{if(U.length!==2)throw Error();let[Y,J]=U;if(!J)throw Error();let Q=Number(J);if(`${Q}`!==J)throw Error();if(Q<0||Q>128)throw Error();new URL(`http://[${Y}]`)}catch{I.issues.push({code:"invalid_format",format:"cidrv6",input:I.value,inst:$,continue:!q.abort})}}});function GN($){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=F7,K=!L7.jitless,w=K&&RO.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 xx([],X,W,V,H,$)}return q(W,V)}});function Mx($,I,q,U){for(let J of $)if(J.issues.length===0)return I.value=J.value,I;let Y=$.filter((J)=>!d5(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 dY=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)=>CY(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 Mx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return Mx(K,U,$,Y)})}});function Ax($,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 LN=m("$ZodXor",($,I)=>{dY.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 Ax(Q,U,$,Y);return Promise.all(Q).then((K)=>{return Ax(K,U,$,Y)})}}),NN=m("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,dY.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=JI(()=>{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(!F7(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}}),FN=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 gx(q,z,w)});return gx(q,J,Q)}});function hL($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(c5($)&&c5(I)){let q=Object.keys(I),U=Object.keys($).filter((J)=>q.indexOf(J)!==-1),Y={...$,...I};for(let J of U){let Q=hL($[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=hL(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 gx($,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(d5($))return $;let Q=hL(I.value,q.value);if(!Q.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var Jw=m("$ZodTuple",($,I)=>{k0.
Line truncated
`)}W.write("payload.value = newResult;"),W.write("return payload;");let E=W.compile();return(T,P)=>E(V,T,P)},J,Q=M7,K=!N7.jitless,w=K&&nL.value,G=q.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&&w&&W?.async===!1&&W.jitless!==!0){if(!J)J=Y(q.shape);if(V=J(V,W),!G)return V;return sx([],X,V,W,H,$)}return I(V,W)}});function ux($,q,I,U){for(let J of $)if(J.issues.length===0)return q.value=J.value,q;let Y=$.filter((J)=>!r5(J));if(Y.length===1)return q.value=Y[0].value,Y[0];return q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))}),q}var tY=m("$ZodUnion",($,q)=>{k0.init($,q),o0($._zod,"optin",()=>q.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),o0($._zod,"optout",()=>q.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),o0($._zod,"values",()=>{if(q.options.every((U)=>U._zod.values))return new Set(q.options.flatMap((U)=>Array.from(U._zod.values)));return}),o0($._zod,"pattern",()=>{if(q.options.every((U)=>U._zod.pattern)){let U=q.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${U.map((Y)=>uY(Y.source)).join("|")})$`)}return});let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else{if(z.issues.length===0)return z;Q.push(z)}}if(!J)return ux(Q,U,$,Y);return Promise.all(Q).then((K)=>{return ux(K,U,$,Y)})}});function xx($,q,I,U){let Y=$.filter((J)=>J.issues.length===0);if(Y.length===1)return q.value=Y[0].value,q;if(Y.length===0)q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))});else q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:[],inclusive:!1});return q}var BN=m("$ZodXor",($,q)=>{tY.init($,q),q.inclusive=!1;let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else Q.push(z)}if(!J)return xx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return xx(K,U,$,Y)})}}),RN=m("$ZodDiscriminatedUnion",($,q)=>{q.inclusive=!1,tY.init($,q);let I=$._zod.parse;o0($._zod,"propValues",()=>{let Y={};for(let J of q.options){let Q=J._zod.propValues;if(!Q||Object.keys(Q).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${q.options.indexOf(J)}"`);for(let[K,z]of Object.entries(Q)){if(!Y[K])Y[K]=new Set;for(let w of z)Y[K].add(w)}}return Y});let U=Hq(()=>{let Y=q.options,J=new Map;for(let Q of Y){let K=Q._zod.propValues?.[q.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${q.options.indexOf(Q)}"`);for(let z of K){if(J.has(z))throw Error(`Duplicatediscriminatorvalue"${String(z)}"`);J.set(z,Q)}}return J});$._zod.parse=(Y,J)=>{let Q=Y.value;if(!M7(Q))return Y.issues.push({code:"invalid_type",expected:"object",input:Q,inst:$}),Y;let K=U.value.get(Q?.[q.discriminator]);if(K)return K._zod.run(Y,J);if(q.unionFallback||J.direction==="backward")return I(Y,J);return Y.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:q.discriminator,options:Array.from(U.value.keys()),input:Q,path:[q.discriminator],inst:$}),Y}}),vN=m("$ZodIntersection",($,q)=>{k0.init($,q),$._zod.parse=(I,U)=>{let Y=I.value,J=q.left._zod.run({value:Y,issues:[]},U),Q=q.right._zod.run({value:Y,issues:[]},U);if(J instanceof Promise||Q instanceof Promise)return Promise.all([J,Q]).then(([z,w])=>{return kx(I,z,w)});return kx(I,J,Q)}});function pO($,q){if($===q)return{valid:!0,data:$};if($ instanceof Date&&q instanceof Date&&+$===+q)return{valid:!0,data:$};if(o5($)&&o5(q)){let I=Object.keys(q),U=Object.keys($).filter((J)=>I.indexOf(J)!==-1),Y={...$,...q};for(let J of U){let Q=pO($[J],q[J]);if(!Q.valid)return{valid:!1,mergeErrorPath:[J,...Q.mergeErrorPath]};Y[J]=Q.data}return{valid:!0,data:Y}}if(Array.isArray($)&&Array.isArray(q)){if($.length!==q.length)return{valid:!1,mergeErrorPath:[]};let I=[];for(let U=0;U<$.length;U++){let Y=$[U],J=q[U],Q=pO(Y,J);if(!Q.valid)return{valid:!1,mergeErrorPath:[U,...Q.mergeErrorPath]};I.push(Q.data)}return{valid:!0,data:I}}return{valid:!1,mergeErrorPath:[]}}function kx($,q,I){let U=new Map,Y;for(let K of q.issues)if(K.code==="unrecognized_keys"){Y??(Y=K);for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).l=!0}}else $.issues.push(K);for(let K of I.issues)if(K.code==="unrecognized_keys")for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).r=!0}else $.issues.push(K);let J=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Y)$.issues.push({...Y,keys:J});if(r5($))return $;let Q=pO(q.value,I.value);if(!Q.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var ww=m("$ZodTuple",($,q)=>{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}}}}functiont5($,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:EI(I,"input",$.processors),output:EI(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}varjM=($,I={})=>(q)=>{letU=o5({...q,processors:I});returnE1($,U),r5(U,$),t5(U,$)},EI=($,I,q={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=o5({...Y??{},target:J,io:I,processors:q});returnE1($,Q),r5(Q,$),t5(Q,$)};varML0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},EM=($,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=ML0[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}))]}},BM=($,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},vM=($,I,q,U)=>{q.type="boolean"},RM=($,I,q,U)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},CM=($,I,q,U)=>{if(I.unrepresentable==Line truncated
`}class cP{constructor($=Wc.stdin,I=Wc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new pP,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=Vc($);if(this._stdout.write(q))I();else this._stdout.once("drain",I)})}}import{dirname as Du,join as Nw1}from"node:path";import{fileURLToPath as Fw1}from"node:url";class s8 extends Error{name="KyError";get isKyError(){return!0}}class n6 extends s8{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 rJ extends s8{name="NetworkError";request;constructor($,I){super(`Requestfailedduetoanetworkerror:${$.method}${$.url}`,I);this.request=$}}class tJ 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 $q extends s8{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new tJ($.cause):void 0;super($?.code?`Forcedretry:${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class dP extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class b$ extends s8{name="TimeoutError";request;constructor($){super(`Requesttimedout:${$.method}${$.url}`);this.request=$}}var lP=(()=>{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})(),Zc=typeof globalThis.AbortController==="function",HH=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Xc=typeof globalThis.ReadableStream==="function",Dc=typeof globalThis.FormData==="function",VH=["get","post","put","patch","head","delete"],cB0=()=>{return};cB0();var Oc={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Iq=2147483647,Lc=40,WH=Symbol("stop");class ZH{options;constructor($){this.options=$}}var Nc=($)=>new ZH($),Fc={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},Mc={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 XH=new TextEncoder,dB0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[q,U]of $)I+=Lc,I+=XH.encode(`Content-Disposition:form-data;name="${q}"`).byteLength,I+=typeof U==="string"?XH.encode(U).byteLength:U.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return XH.encode($).byteLength;if($ instanceof URLSearchParams)return XH.encode($.toString()).byteLength;return 0},Ac=($,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)}}))},gc=($,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(Ac($.body,U,I),q)},Pc=($,I,q)=>{if(!$.body)return $;let U=dB0(q??$.body);return new Request($,{duplex:"half",body:Ac($.body,U,I)})};var G8=($)=>$!==null&&typeof $==="object";var lB0=Symbol("replaceOption"),mP=($)=>G8($)&&$[lB0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var sJ=(...$)=>{for(let I of $)if(
Line truncated
`,{mode:384}),I}function zq($,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 fK1}from"node:fs";import{randomBytes as nK1}from"node:crypto";import{randomBytes as xd}from"node:crypto";var bv0=Z.object({staffId:Z.string(),name:Z.string().optional(),code:Z.string().default(""),bindTime:Z.number().optional()}),iv0=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:bv0.optional()}),pv0=Z.object({apiKey:Z.string().optional(),corporationId:Z.string().optional(),corporationName:Z.string().optional()}),cv0=Z.object({id:Z.string(),name:Z.string(),tenantSlug:Z.string().optional(),isDemo:Z.boolean().default(!1),logoUrl:Z.string().nullable().optional(),hoseCorpConfig:pv0.optional()}),Xd=Z.object({user:iv0,tenant:cv0}),dv0=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(),lv0=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(),Dd=Z.object({user:dv0,session:lv0}),CH=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()}),Od=Z.object({rules:Z.array(CH),hasPendingDeletes:Z.boolean().default(!1)}),mv0=Z.object({code:Z.string().optional(),description:Z.string(),scope:Z.string(),strictness:Z.string()}),_H=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(mv0).default([]),publishedAt:Z.number().optional(),createdAt:Z.number().optional()}),Ld=Z.object({version:_H,rulesCount:Z.number()}),QQ=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)}),Nd=Z.object({articles:Z.array(QQ),total:Z.number().optional()}),ov0=Z.object({explicitApprove:Z.string().default(""),explicitReject:Z.string().default(""),exemptApprove:Z.string().default(""),review:Z.string().default("")}).passthrough(),rv0=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(),tv0=Z.enum(["assisted","semi_automatic","fully_automatic"]),Zd=Z.object({id:Z.string(),url:Z.string().url()}).passthrough(),KQ=Z.object({type:Z.literal("webhook"),id:Z.string(),name:Z.string(),mode:tv0,incomingDocumentWebhook:Zd,outgoingResultWebhook:Z.string().url(),incomingManualResultWebhook:Zd,secret:Z.string().min(1),autoApprovalRate:Z.number().int().min(0).max(100).optional()}).passthrough(),HT=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(q===Q[0]){J(Q);continue}if($.external){letw=$.external.registry.get(Q[0])?.id;if(q!==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}}}}function$9($,q){letI=$.seen.get(q);if(!I)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letz=$.seen.get(K);if(z.ref===null)return;letw=z.def??z.schema,G={...w},H=z.ref;if(z.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"))w.allOf=w.allOf??[],w.allOf.push(X);elseObject.assign(w,X);if(Object.assign(w,G),K._zod.parent===H)for(letLinw){if(L==="$ref"||L==="allOf")continue;if(!(LinG))deletew[L]}if(X.$ref&&W.def)for(letLinw){if(L==="$ref"||L==="allOf")continue;if(LinW.def&&JSON.stringify(w[L])===JSON.stringify(W.def[L]))deletew[L]}}letV=K._zod.parent;if(V&&V!==H){U(V);letW=$.seen.get(V);if(W?.schema.$ref){if(w.$ref=W.schema.$ref,W.def)for(letXinw){if(X==="$ref"||X==="allOf")continue;if(XinW.def&&JSON.stringify(w[X])===JSON.stringify(W.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(q)?.id;if(!K)throwError("Schema is missing an `id` property");Y.$id=$.external.uri(K)}Object.assign(Y,I.def??I.schema);letJ=$.metadataRegistry.get(q)?.id;if(J!==void0&&Y.id===J)deleteY.id;letQ=$.external?.defs??{};for(letKof$.seen.entries()){letz=K[1];if(z.def&&z.defId){if(z.def.id===z.defId)deletez.def.id;Q[z.defId]=z.def}}if($.external);elseif(Object.keys(Q).length>0)if($.target==="draft-2020-12")Y.$defs=Q;elseY.definitions=Q;try{letK=JSON.parse(JSON.stringify(Y));returnObject.defineProperty(K,"~standard",{value:{...q["~standard"],jsonSchema:{input:hq(q,"input",$.processors),output:hq(q,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionE6($,q){letI=q??{seen:newSet};if(I.seen.has($))return!1;I.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnE6(U.element,I);if(U.type==="set")returnE6(U.valueType,I);if(U.type==="lazy")returnE6(U.getter(),I);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnE6(U.innerType,I);if(U.type==="intersection")returnE6(U.left,I)||E6(U.right,I);if(U.type==="record"||U.type==="map")returnE6(U.keyType,I)||E6(U.valueType,I);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnE6(U.in,I)||E6(U.out,I)}if(U.type==="object"){for(letYinU.shape)if(E6(U.shape[Y],I))return!0;return!1}if(U.type==="union"){for(letYofU.options)if(E6(Y,I))return!0;return!1}if(U.type==="tuple"){for(letYofU.items)if(E6(Y,I))return!0;if(U.rest&&E6(U.rest,I))return!0;return!1}return!1}varuM=($,q={})=>(I)=>{letU=s5({...I,processors:q});returnj1($,U),e5(U,$),$9(U,$)},hq=($,q,I={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=s5({...Y??{},target:J,io:q,processors:I});returnj1($,Q),e5(Q,$),$9(Q,$)};varhO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xM=($,q,I,U)=>{letY=I;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=hO0[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)=>({...q.target==="draft-07"||q.target==="draft-04"||q.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},kM=($,q,I,U)=>{letY=I,{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),V=typeofw==="number"&&w<=(Q??Number.POSITIVE_INFINITY),W=q.target==="draft-04"||q.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=w,Y.exclusiveMaximum=!0;elseY.exclusiveMaximum=w;elseif(typeofQ==="number")Y.maximum=Q;if(typeofz==="number")Y.multipleOf=z},fM=($,q,I,U)=>{I.type="boolean"},nM=($,q,I,U)=>{if(q.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},bM=($,q,I,U)=>{if(q.unrepresentable==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 uz1}from"node:http";import{URL as hz1}from"node:url";var zZ0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.6",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 审批",L=X.signKey,N=X.apiOrigin??"production";console.error(`•"${D}"(signKey:${L},环境:${N})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${L}--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 gZ0($){let q=e0($.options.port)??e0($.options.p),I=x($.options.host)??x($.options.h),U=await FL({port:q,host:I}),Y=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Y),process.on("SIGTERM",Y),await new Promise(()=>{})}async function jZ0($,q,I,U){if($==="config"||$==="get"){await O0("seal_llm_config_get",q,I,{},L0(U.options));return}if($==="providers"||$==="list"){await O0("seal_llm_providers_list",q,I,{},L0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function BZ0($,q){if($==="config"||$==="json"){Du();return}await Lu()}function Du(){T0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function RZ0($){let q=XL();T0(q,{...L0($.options),allowFull:!0})}async function vZ0($,q,I,U){if($==="available"){await O0("seal_permissions_available_list",q,I,{},L0(U.options));return}if($==="configs"||$==="list"){await O0("seal_permissions_configs_list",q,I,{},L0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as CZ0}from"node:fs";async function _Z0($,q,I,U,Y,J,Q){if(!$||$==="get"){await O0("seal_preference_get",Y,J,{},L0(Q.options));return}if($==="decision"){if(q==="update"||!q){let K=x(Q.options.input),z=K?JSON.parse(CZ0(K,"utf8")):a6(Q.json);if(!z||Object.keys(z).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await O0("seal_preference_decision_update",Y,J,z,L0(Q.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(q==="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 O0("seal_preference_thinking_depth_set",Y,J,{defaultLevel:K},L0(Q.options));return}if(q==="policies"){if(I==="list"||!I){await O0("seal_preference_thinking_depth_policies_list",Y,J,{},L0(Q.options));return}if(I==="upsert"){let K=x(Q.options.input),z=K?JSON.parse(CZ0(K,"utf8")):a6(Q.json);if(!z||!z.id||!z.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await O0("seal_preference_thinking_depth_policies_upsert",Y,J,z,L0(Q.options));return}if(I==="remove"||I==="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 O0("seal_preference_thinking_depth_policies_remove",Y,J,{policyId:K},L0(Q.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function hZ0($={}){let q=X8(),I=P4(),U=DI(q,{stateful:I.stateful,defaultCorpId:I.defaultCorpId,corpId:$.corpId},x7());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Y=await PY(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Y,null,2));let J=await I4(U),Q=await fH(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 SZ0($,q,I){let U=q??x(I.options.corp)??($&&$!=="--corp"?$:void 0);await hZ0({corpId:U})}async function Ou($,q,I,U,Y){if($==="count"){await O0("seal_approval_rules_list",I,U,{countOnly:!0},L0(Y.options));return}if($==="list"){if(C0(Y.options.count)){await O0("seal_approval_rules_list",I,U,{countOnly:!0},L0(Y.options));return}let J=e0(Y.options.limit),Q=e0(Y.options.offset);if(C0(Y.options.summary)){await O0("seal_approval_rules_list",I,U,{fields:IZ0,limit:J,offset:Q},L0(Y.options));return}let K=await Jq("seal_approval_rules_list",I,U,{limit:J,offset:Q});UZ0(K,C0(Y.options.full)===!0),T0(K);return}if($==="clear"){let J=C0(Y.options.yes)===!0,Q=C0(Y.options.dryRun)??C0(Y.options["dry-run"])??!J;if(!J&&!Q)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let K=await Jq("seal_approval_rules_clear",I,U,{dryRun:Q,recode:C0(Y.options.recode)});if(!J&&Q&&K&&typeof K==="object"){T0({...K,nextCommand:`seal-userulesclear--corp${U.id}--yes`},L0(Y.options));return}T0(K,L0(Y.options));return}if($==="versions"){await O0("seal_approval_rule_versions_list",I,U,{},L0(Y.options));return}if($==="version"){let J=q??x(Y.options.version);if(!J)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await O0("seal_approval_rule_version_get",I,U,Wz(J),L0(Y.options));return}if($==="get"){await O0("seal_approval_rule_get",I,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(-q);return{logFile:I,lines:J,totalLines:Y.length}}async function Qw1($){let q=TL($),I=Mu($),U=Oz($);kZ0($.stateDir);let Y=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):OL),J=$.host??(process.env.HOST?process.env.HOST:NL);AL(q,`${process.pid}
`,{mode:384}),AL(I,JSON.stringify({pid:process.pid,port:Y,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),TY(U,`servicestartingonhttp://${J}:${Y} pid=${process.pid}`);let Q=null;try{Q=await FL({port:Y,host:J,silent:!0}),TY(U,`service listening pid=${process.pid}`)}catch(z){if(TY(U,`service failed to bind port ${Y}: ${z instanceof Error?z.message:String(z)}`),PL(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});throw z}let K=()=>{if(Q)Q.close(),Q=null;if(PL(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});TY(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 yZ0($){kZ0($.stateDir);let q=EY($);if(q.running)return q;let I=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...I.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Y=Iw1(I.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Y.unref();let J=TL($);return AL(J,`${Y.pid}
`,{flag:"a",mode:384})}var Au=ww1(zw1(),".config","seal-use");async function Pu($,q,I){let U=I?e0(I.options.port)??e0(I.options.p):void 0,Y=I?x(I.options.host)??x(I.options.h):void 0,J=I?e0(I.options.lines)??e0(I.options.n):void 0,Q=await Qq($,{appRoot:q.appRoot,entryFile:q.entryFile,stateDir:Au,version:t0,launcher:q.launcher,port:U,host:Y},{maxLines:J});if(Q!==void 0)T0(Q)}import{existsSync as Gw1,readFileSync as fZ0}from"node:fs";async function nZ0($,q,I,U,Y){if($==="batch-records"||$==="records"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await O0("seal_simulation_batch_records_get",I,U,{batchId:J,query:x(Y.options.query)},L0(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"]),z=K?JSON.parse(fZ0(K,"utf8")):void 0,w=x(Y.options.input),G=w?JSON.parse(fZ0(w,"utf8")):a6(Y.json),H=x(Y.options.packageId)??x(Y.options["package-id"]),V=M6(Y.options.packageIds)??M6(Y.options["package-ids"])??(H?[H]:void 0),W=M6(Y.options.flowIds)??M6(Y.options["flow-ids"])??M6(Y.options.documentSn)??M6(Y.options["document-sn"]),X=x(Y.options.signKey)??x(Y.options["sign-key"])??x(Y.options.integration);await O0("seal_simulation_batch_create",I,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:z,requestIds:M6(Y.options.requestIds)??M6(Y.options["request-ids"]),workflowTypeId:x(Y.options.workflowTypeId)??x(Y.options["workflow-type-id"]),flowStatusList:M6(Y.options.flowStatusList)?.map(Number)??M6(Y.options["flow-status-list"])?.map(Number),businessCodes:M6(Y.options.businessCodes)??M6(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:M6(Y.options.status),limit:e0(Y.options.limit),rawParams:G},L0(Y.options));return}if($==="wait"){let J=q??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 O0("seal_simulation_batch_wait",I,U,{batchId:J,timeout:x(Y.options.timeout),pollInterval:x(Y.options.pollInterval)??x(Y.options["poll-interval"])},L0(Y.options));return}if($==="clean"||$==="delete"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await O0("seal_simulation_batch_clean",I,U,{batchId:J},L0(Y.options));return}if($==="specifications"){let J=q??x(Y.options.integration)??x(Y.options.signKey)??x(Y.options["sign-key"]);await O0("seal_simulation_specifications_list",I,U,{signKey:J},L0(Y.options));return}if($==="list"){await O0("seal_simulation_batches_list",I,U,{limit:e0(Y.options.limit)},L0(Y.options));return}if($==="get"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await O0("seal_simulation_batch_get",I,U,{batchId:J},L0(Y.options));return}if($==="templates"){await O0("seal_simulation_templates_get",I,U,{},L0(Y.options));return}if($==="integrations"){await O0("seal_simulation_integrations_get",I,U,{},L0(Y.options));return}if($==="package-upload"){let J=q??x(Y.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Gw1(J))throw Error(`Filenotfound:${J}`);await O0("seal_simulation_material_package_upload",I,U,{filePath:J},L0(Y.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as YX0}from"node:fs";import{join as EL}from"node:path";import{existsSync as Tu,mkdirSync as sZ0,rmSync as Aw1,writeFileSync as Pw1}from"node:fs";import{homedir as eZ0}from"node:os";import{dirname as Tw1,join as Eu}from"node:path";var bZ0=`---
name:seal-use
description:"v0.10.6: 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.10: 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 CZ0=`interface:
`;var iZ0=`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."
@@ -706,7 +711,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 SZ0="# 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-useruleslint[--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-useservice<start|stop|restart|status>\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-useapproval-runscount--corp<corpId>[--statusAPPROVED]\nseal-useapproval-runssearch--corp<corpId>[--querytext][--limit20][--includeBridgetrue]\nseal-useapproval-runsget<recordId>--corp<corpId>[--fieldsmetadata|document.fields,result.summLine truncated
`;var dZ0="# 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
@@ -1141,7 +1146,7 @@ Return a compact report containing:
-Newversionnumberandversionname,ifpublished
-Verificationresult
-Whetheraregressionrerunwasperformed
`;var kZ0="# 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 rZ0="# 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=x0(q.options.local)||x0(q.options.workspace),Y=b(q.options.dir)??b(q.options.target)??I,J=Y?Y:U?XO(process.cwd(),".agents","skills","seal-use"):Xz(),Q=Hu(J);R0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Xz(),Y=XO(process.cwd(),".agents","skills","seal-use");R0({global:{dir:U,installed:mZ0(XO(U,"SKILL.md"))},local:{dir:Y,installed:mZ0(XO(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function rZ0($,I){if($==="config"){R0(await NY(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function tZ0($,I,q,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await L0($,I,q,r6(U.json),O0(U.options))}function aZ0(){R0(zz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as Kw1,mkdirSync as zw1,renameSync as Wu,rmSync as ww1,unlinkSync as qX0,writeFileSync as sZ0}from"node:fs";import{dirname as Gw1,join as eZ0}from"node:path";import{spawnSync as II}from"node:child_process";function DO($=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 UX0="yunyingk/seal-use",Oz="yunyingk/seal-home";var Hw1="SEAL_USE_GITHUB_REPO",Vw1="SEAL_HOME_GITHUB_REPO";async function YX0($,I={}){let q={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:zu,version:a0,launcher:$.launcher},U=I.repo||process.env[Hw1]?.trim()||process.env[Vw1]?.trim()||UX0,Y=I.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let g=J.replace(/^v/,""),B=JX0(g,a0);if(B<0){R0({updated:!1,currentVersion:a0,targetVersion:g,mode:DO()?"binary":"source",message:`Cannotdowngradeseal-usefromv${a0}toolderversionv${g}.Updatesmustbeforward-only.`});return}if(B===0&&!I.force){R0({updated:!1,currentVersion:a0,targetVersion:g,mode:DO()?"binary":"source",message:`seal-useisalreadyatversionv${a0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let g=await Zu(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:Dz(B.version,a0)}))});return}if(!DO()){if(I.checkOnly){let B=await Zu(U,30),x=B[0],h=x?.version??a0,f=B.find((p)=>p.version===a0),S=Dz(h,a0),t=B.filter((p)=>Dz(p.version,a0));R0({updated:!1,updateAvailable:S,currentVersion:a0,currentVersionPublishedAt:f?.publishedAt,latestVersion:h,latestVersionPublishedAt:x?.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:x?.notes??"",releaseUrl:x?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let g=FY(q).running;if(g)await $I("stop",q);try{IX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(IX0("bun",["install"],{cwd:$.appRoot}),g)await $I("start",q);R0({updated:!0,serviceRestarted:g,version:a0,mode:"source"});return}let Q=Ww1(),K=Zw1(),z=await Zu(U,30),w=J?z.find((g)=>g.version===J||g.tagName===J||g.tagName===`v${J}`)??await $X0(U,J):z[0]??await $X0(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=Dz(G,a0),V=W||Boolean(I.force),X=z.filter((g)=>Dz(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=Xw1(w.assets,Q,K);if(!D)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${G}.Availableassets:${w.assets.map((g)=>g.name).join(", ")}`);let O=FY(q).running;if(O)await $I("stop",q);let N=process.execPath,T=Gw1(N),P=eZ0(T,`.tmp-update-${Date.now()}`);zw1(P,{recursive:!0});try{let g=eZ0(P,D.name);await Dw1(D.downloadUrl,g,w.tagName,D.name);let B=g;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))B=Ow1(g,P,Q);else if(D.name.endsWith(".zip"))B=Lw1(g,P,Q);if(Kw1(B,493),process.platform==="darwin")try{II("/usr/bin/codesig
Line truncated
`)}catch{}}async function Dw1($,I,q,U){let Y=Xu(),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/${UX0}/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,x;try{OO(`==> [${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 f=Number(h.headers.get("content-length"))||0,S=h.body?.getReader();if(!S){let n=Buffer.from(await h.arrayBuffer());if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);sZ0(I,n),OO(`✓ Download succeeded (${(n.length/1024/1024).toFixed(1)} MB)`);return}let t=[],p=0,C=0;x=setTimeout(()=>{if(p<W){let n=(p/1024).toFixed(1);P(`Initial transfer too slow (${n} KB < 300 KB in 6s), switching mirror...`)}},H);while(!0){let n=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([n,j])}finally{if(J0)clearTimeout(J0)}let{done:d,value:a}=u;if(d)break;if(a){if(t.push(a),p+=a.length,x&&p>=W)clearTimeout(x),x=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),v0=f?(f/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(I.options.local)||C0(I.options.workspace),Y=x(I.options.dir)??x(I.options.target)??q,J=Y?Y:U?EL(process.cwd(),".agents","skills","seal-use"):Nz(),Q=gu(J);T0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Nz(),Y=EL(process.cwd(),".agents","skills","seal-use");T0({global:{dir:U,installed:YX0(EL(U,"SKILL.md"))},local:{dir:Y,installed:YX0(EL(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function QX0($,q){if($==="config"){T0(await PY(q));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function KX0($,q,I,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await O0($,q,I,a6(U.json),L0(U.options))}function zX0(){T0(Hz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as Ew1,mkdirSync as gw1,renameSync as Bu,rmSync as jw1,unlinkSync as WX0,writeFileSync as wX0}from"node:fs";import{dirname as Bw1,join as GX0}from"node:path";import{spawnSync as Kq}from"node:child_process";function gL($=process.execPath,q=import.meta.url){if(q.includes("/$bunfs/")||q.includes("\\$bunfs\\"))return!0;let I=$.toLowerCase().replace(/\\/g,"/");return!I.endsWith("/bun")&&!I.endsWith("/bun.exe")&&!I.endsWith("/node")&&!I.endsWith("/node.exe")}var ZX0="yunyingk/seal-use",Mz="yunyingk/seal-home";var Rw1="SEAL_USE_GITHUB_REPO",vw1="SEAL_HOME_GITHUB_REPO";async function XX0($,q={}){let I={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Au,version:t0,launcher:$.launcher},U=q.repo||process.env[Rw1]?.trim()||process.env[vw1]?.trim()||ZX0,Y=q.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let P=J.replace(/^v/,""),B=DX0(P,t0);if(B<0){T0({updated:!1,currentVersion:t0,targetVersion:P,mode:gL()?"binary":"source",message:`Cannotdowngradeseal-usefromv${t0}toolderversionv${P}.Updatesmustbeforward-only.`});return}if(B===0&&!q.force){T0({updated:!1,currentVersion:t0,targetVersion:P,mode:gL()?"binary":"source",message:`seal-useisalreadyatversionv${t0}.Use--forcetoreinstall.`});return}}if(q.changelogOnly){let P=await Ru(U,q.limit??10);T0({currentVersion:t0,totalQueried:P.length,releases:P.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===t0,isNewer:Fz(B.version,t0)}))});return}if(!gL()){if(q.checkOnly){let B=await Ru(U,30),k=B[0],h=k?.version??t0,f=B.find((p)=>p.version===t0),S=Fz(h,t0),t=B.filter((p)=>Fz(p.version,t0));T0({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 P=EY(I).running;if(P)await Qq("stop",I);try{VX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(VX0("bun",["install"],{cwd:$.appRoot}),P)await Qq("start",I);T0({updated:!0,serviceRestarted:P,version:t0,mode:"source"});return}let Q=Cw1(),K=_w1(),z=await Ru(U,30),w=J?z.find((P)=>P.version===J||P.tagName===J||P.tagName===`v${J}`)??await HX0(U,J):z[0]??await HX0(U);if(!w){T0({updated:!1,currentVersion:t0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let G=w.version,H=z.find((P)=>P.version===t0),V=Fz(G,t0),W=V||Boolean(q.force),X=z.filter((P)=>Fz(P.version,t0));if(q.checkOnly){T0({updated:!1,updateAvailable:V,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,behindCount:X.length,pendingReleases:X.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl})),releaseNotes:w.notes,releaseUrl:w.htmlUrl,mode:"binary"});return}if(!W){T0({updated:!1,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${t0})`});return}let D=hw1(w.assets,Q,K);if(!D)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${G}.Availableassets:${w.assets.map((P)=>P.name).join(", ")}`);let L=EY(I).running;if(L)await Qq("stop",I);let N=process.execPath,E=Bw1(N),T=GX0(E,`.tmp-update-${Date.now()}`);gw1(T,{recursive:!0});try{let P=GX0(T,D.name);await Sw1(D.downloadUrl,P,w.tagName,D.name);let B=P;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))B=yw1(P,T,Q);else if(D.name.endsWith(".zip"))B=uw1(P,T,Q);if(Ew1(B,493),process.platform==="darwin")try{Kq("/usr/bin/codesig
Line truncated
`)}catch{}}async function Sw1($,q,I,U){let Y=vu(),J=[],Q=I?I.startsWith("v")?I:`v${I}`:void 0,K=U||$.split("/").pop()||"";if(Y!=="github"){if(Q&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${Q}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${Q}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Y!=="gitea")if(Q&&K){let D=`https://github.com/${ZX0}/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,V=307200,W=1e4,X=180000;for(let D=0;D<z.length;D++){let L=z[D],N=new AbortController,E="",T=(h)=>{E=h;try{N.abort()}catch{}},P=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},G),B,k;try{jL(`==> [${D+1}/${z.length}] Downloading via: ${L}`);let h=await fetch(L,{signal:N.signal});if(P)clearTimeout(P),P=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);B=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let f=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)`);wX0(q,b),jL(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let t=[],p=0,C=0;k=setTimeout(()=>{if(p<V){let b=(p/1024).toFixed(1);T(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},H);while(!0){let b=S.read(),J0,g=new Promise((K0,G0)=>{J0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},W)}),u;try{u=await Promise.race([b,g])}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),v0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${M0} / ${v0} 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.6: 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.10: 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.6
short-description:Seal tenant and Hose approval automation (v0.10.6)
version:0.10.10
short-description:Seal tenant and Hose approval automation (v0.10.10)
---
# Seal Use (v0.10.6)
# Seal Use (v0.10.10)
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`.
`seal-use service status` returns the PID, version, state directory, PID file, and log file for the optional local background process.
`seal-use service <start|stop|restart|status|logs>` manages the persistent background service daemon with embedded HTTP server (serving `/docs`, `/openapi.json`, and `POST /api/cli`). `status` returns the PID, version, host, port, active HTTP URL, state directory, PID file, and log file.
`seal-use update` updates the git checkout, runs `bun install`, and restarts the local service if it was running.
Identity and session:
-`seal-use auth diagnose --corp <corpId>`
-`seal_whoami`
-`seal_session_get`
-`seal-use corps list`
-`seal-use corps current`
Approval rule maintenance:
-`seal-use rules count [--corp <corpId>]`
-`seal-use rules list --summary [--corp <corpId>]`
Webhook writes read the current AI approval config and POST the merged full config back to `api/v1/agent/ai-approval/config`, preserving non-Webhook integrations. List/get mask `secret` by default; add returns the generated secret once.
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.