- Replace filename-heuristic attachment matching with explicit [附件] column declaration
- AttachmentGroup replaces MaterialAttachmentEntry: uses paths[] instead of entries[]
- parseMaterialWorkbook now exports DeclaredAttachment and full Parsed type including
documentAttachments, expenseAttachments, personAttachments per row
- buildAttachmentPlans enforces strict bidirectional validation:
1. Every Excel [附件] path must exist in ZIP
2. Every ZIP file must be declared in some [附件] column
- validateDocIdDirectories now strips @annotation suffix when matching documentIds
- injectAttachmentPlan updated to work with new AttachmentGroup.paths API
- pushMaterialPack iterates group.paths for uploads, adding stderr diagnostics
- Key deduplication applied at parse time (deduplicateKeys)
- Tests updated: [附件] column fixtures, bidirectional validation error tests,
@ annotation matching test, preview injection test
- Skill docs updated: Material Pack Workflow section in references/cli.md
- Version bumped to 0.10.12
@@ -5,6 +5,67 @@ 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.11] - 2026-09-07
### Added & Enhanced
- **Standard Approval Runs Excel Export**:
- Added `seal-use approval-runs export` command to export tenant approval records into high-fidelity Excel workbooks with frozen headers, dynamic rule columns, and color-coded status badges.
- Automatically resolves document template names, manual approval statuses (`APPROVED`, `TERMINATED`, `PROCESSING`), and human reviewer reject comments from `manualApprovalRecord`.
- Dynamically fetches tenant active approval rules (`api.listApprovalRules`) and appends rule check results (`PASS`, `FAIL`, `TRIGGERED`) as individual column badges.
- Added `--downloads` flag to conveniently output directly to the user's `~/Downloads` folder.
- Added `seal_approval_runs_export` tool in MCP/agent tools for automated reporting and data inspection.
- Supports `--start`, `--end`, `--limit`, `--status`, `--manual-status`, and `--completed-only` filters with gentle pagination and progress reporting to `stderr`.
## [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{createRequireasqD0}from"node:module";varsL0=Object.create;var{getPrototypeOf:eL0,defineProperty:PO,getOwnPropertyNames:$D0}=Object;varID0=Object.prototype.hasOwnProperty;functionUD0($){returnthis[$]}varYD0,JD0,WI=($,I,U)=>{varY=$!=null&&typeof$==="object";if(Y){varJ=I?YD0??=newWeakMap:JD0??=newWeakMap,Q=J.get($);if(Q)returnQ}U=$!=null?sL0(eL0($)):{};letK=I||!$||!$.__esModule?PO(U,"default",{value:$,enumerable:!0}):U;for(letqof$D0($))if(!ID0.call(K,q))PO(K,q,{get:UD0.bind($,q),enumerable:!0});if(Y)J.set($,K);returnK};varN=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varQD0=($)=>$;functionKD0($,I){this[$]=QD0.bind(null,I)}varm8=($,I)=>{for(varUinI)PO($,U,{get:I[U],enumerable:!0,configurable:!0,set:KD0.bind(I,U)})};varr=qD0(import.meta.url);varvQ=N((Rf)=>{Object.defineProperty(Rf,"__esModule",{value:!0});Rf.regexpCode=Rf.getEsmExportName=Rf.getProperty=Rf.safeStringify=Rf.stringify=Rf.strConcat=Rf.addCodeArg=Rf.str=Rf._=Rf.nil=Rf._Code=Rf.Name=Rf.IDENTIFIER=Rf._CodeOrName=void0;classEW{}Rf._CodeOrName=EW;Rf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classoIextendsEW{constructor($){super();if(!Rf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}Rf.Name=oI;classu$extendsEW{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((I,U)=>`${I}${U}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,U)=>{if(UinstanceofoI)I[U.str]=(I[U.str]||0)+1;returnI},{})}}Rf._Code=u$;Rf.nil=newu$("");functionEf($,...I){letU=[$[0]],Y=0;while(Y<I.length)xP(U,I[Y]),U.push($[++Y]);returnnewu$(U)}Rf._=Ef;varhP=newu$("+");functionBf($,...I){letU=[CQ($[0])],Y=0;while(Y<I.length)U.push(hP),xP(U,I[Y]),U.push(hP,CQ($[++Y]));returnCF0(U),newu$(U)}Rf.str=Bf;functionxP($,I){if(Iinstanceofu$)$.push(...I._items);elseif(IinstanceofoI)$.push(I);else$.push(_F0(I))}Rf.addCodeArg=xP;functionCF0($){letI=1;while(I<$.length-1){if($[I]===hP){letU=vF0($[I-1],$[I+1]);if(U!==void0){$.splice(I-1,3,U);continue}$[I++]="+"}I++}}functionvF0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofoI||$[$.length-1]!=='"')return;if(typeofI!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return$.slice(0,-1)+I.slice(1);return}if(typeofI=="string"&&I[0]==='"'&&!($instanceofoI))return`"${$}${I.slice(1)}`;return}functionjF0($,I){returnI.emptyStr()?$:$.emptyStr()?I:Bf`${$}${I}`}Rf.strConcat=jF0;function_F0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:CQ(Array.isArray($)?$.join(","):$)}functionSF0($){returnnewu$(CQ($))}Rf.stringify=SF0;functionCQ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Rf.safeStringify=CQ;functiongF0($){returntypeof$=="string"&&Rf.IDENTIFIER.test($)?newu$(`.${$}`):Ef`[${$}]`}Rf.getProperty=gF0;functionyF0($){if(typeof$=="string"&&Rf.IDENTIFIER.test($))returnnewu$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Rf.getEsmExportName=yF0;functionhF0($){returnnewu$($.toString())}Rf.regexpCode=hF0});varbP=N((_f)=>{Object.defineProperty(_f,"__esModule",{value:!0});_f.ValueScope=_f.ValueScopeName=_f.Scope=_f.varKinds=_f.UsedValueState=void0;vark6=vQ();classvfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varRW;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(RW||(_f.UsedValueState=RW={}));_f.varKinds={const:newk6.Name("const"),let:newk6.Name("let"),var:newk6.Name("var")};classuP{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofk6.Name?$:this.name($)}name($){returnnewk6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,U;if(((U=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||U===void0?void0:U.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}_f.Scope=uP;classfPextendsk6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:U}){this.value=$,this.scopePath=k6._`.${newk6.Name(I)}[${U}]`}}_f.ValueScopeName=fP;varoF0=k6._`\n`;classjfextendsuP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?oF0:k6.nil}}get(){returnthis._scope}name($){returnnewfP($,this._newName($))}value($,I){varU;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letY=this.toName($),{prefix:J}=Y,Q=(U=I.key)!==null&&U!==void0?U:I.ref,K=this._values[J];if(K){letH=K.get(Q);if(Line truncated
deps:${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
`)}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
]`;this.ESCAPE_REGEXP=new RegExp(I)}set headers($){this._headers=$}shouldQuote($,I){let q=I?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(la0.default(q))return q;if(Array.isArray(q))return q[$];if(this._headers!==null)return q[this._headers[$]];return!1}format($,I,q){let U=`${ma0.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Y}=this;if(Y.quote!==""){if(U.indexOf(Y.quote)!==-1)return this.quoteField(U.replace(this.REPLACE_REGEXP,Y.escapedQuote))}if(U.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(I,q))return this.quoteField(U);return U}quoteField($){let{quote:I}=this.formatterOptions;return`${I}${$}${I}`}}WU.FieldFormatter=_70});var uR=L((h70)=>{Object.defineProperty(h70,"__esModule",{value:!0});h70.isSyncTransform=void 0;h70.isSyncTransform=($)=>$.length===1});var u70=L((ZU)=>{var y70=ZU&&ZU.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(ZU,"__esModule",{value:!0});ZU.RowFormatter=void 0;var ra0=y70(zZ()),ta0=y70(g70()),aa0=yR(),sa0=uR();class L3{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new aa0.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(L3.isRowHashArray($))return $.map((I)=>I[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(sa0.isSyncTransform($))return(I,q)=>{let U=null;try{U=$(I)}catch(Y){return q(Y)}return q(null,U)};return(I,q)=>{$(I,q)}}set rowTransform($){if(!ra0.default($))throw TypeError("The transform should be a function");this._rowTransform=L3.createTransform($)}format($,I){this.callTransformer($,(q,U)=>{if(q)return I(q);if(!$)return I(null);let Y=[];if(U){let{shouldFormatColumns:J,headers:Q}=this.checkHeaders(U);if(this.shouldWriteHeaders&&Q&&!this.hasWrittenHeaders)Y.push(this.formatColumns(Q,!0)),this.hasWrittenHeaders=!0;if(J){let K=this.gatherColumns(U);Y.push(this.formatColumns(K,!1))}}return I(null,Y)})}finish($){let I=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));I.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)I.push(this.formatterOptions.rowDelimiter);return $(null,I)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let I=L3.gatherHeaders($);if(this.headers=I,this.fieldFormatter.headers=I,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!ta0.default(I,$),headers:I}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((I)=>$[I]);if(L3.isRowHashArray($))return this.headers.map((I,q)=>{let U=$[q];if(U)return U[1];return""});if(L3.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((I,q)=>$[q])}callTransformer($,I){if(!this._rowTransform)return I(null,$);return this._rowTransform($,I)}formatColumns($,I){let q=$.map((Y,J)=>this.fieldFormatter.format(Y,J,I)).join(this.formatterOptions.delimiter),{rowCount:U}=this;if(this.rowCount+=1,U)return[this.formatterOptions.rowDelimiter,q].join("");return q}}ZU.RowFormatter=L3});var x70=L((MZ)=>{Object.defineProperty(MZ,"__esModule",{value:!0});MZ.FieldFormatter=MZ.RowFormatter=void 0;var ea0=u70();Object.defineProperty(MZ,"RowFormatter",{enumerable:!0,get:function(){return ea0.RowFormatter}});var $s0=yR();Object.defineProperty(MZ,"FieldFormatter",{enumerable:!0,get:function(){return $s0.FieldFormatter}})});var xR=L((f70)=>{Object.defineProperty(f70,"__esModule",{value:!0});f70.CsvFormatterStream=void 0;var qs0=o("stream"),Us0=x70();class k70 extends qs0.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new Us0.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,I,q){let U=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Y,J)=>{if(Y)return U=!0,q(Y);if(J)J.forEach((Q)=>{this.push(Buffer.from(Q,"utf8"))});return U=!0,q()})}catch(Y){if(U)throw Y;q(Y)}}_flush($){this.rowFormatter.finish((I,q)=>{if(I)return $(I);if(q)q.forEach((U)=>{this.push(Buffer.from(U,"utf8"))});return $()})}}f70.CsvFormatterStream=k70});var i70=L((D1)=>{var b70=D1&&D1.__createBinding||(Object.create?function($,I,q,U){if(U===void 0)U=q;Object.defineProperty($,U,{enumerable:!0,get:function(){return I[q]}})}:function($,I,q,U){if(U===void 0)U=q;$[U]=I[q]}),Ys0=D1&&D1.__setModuleDefault||(Object.create?function($,I){Ob
Line truncated
deps:${U}}`};var IB0={keyword:"dependencies",type:"object",schemaType:"object",error:lp.error,code($){let[I,U]=UB0($);dp($,I),mp($,U)}};function UB0({schema:$}){let I={},U={};for(let Y in $){if(Y==="__proto__")continue;let J=Array.isArray($[Y])?I:U;J[Y]=$[Y]}return[I,U]}function dp($,I=$.schema){let{gen:U,data:Y,it:J}=$;if(Object.keys(I).length===0)return;let Q=U.let("missing");for(let K in I){let q=I[K];if(q.length===0)continue;let G=(0,oQ.propertyInData)(U,Y,K,J.opts.ownProperties);if($.setParams({property:K,depsCount:q.length,deps:q.join(", ")}),J.allErrors)U.if(G,()=>{for(let H of q)(0,oQ.checkReportMissingProp)($,H)});else U.if(TT._`${G}&&(${(0,oQ.checkMissingProp)($,q,Q)})`),(0,oQ.reportMissingProp)($,Q),U.else()}}lp.validatePropertyDeps=dp;function mp($,I=$.schema){let{gen:U,data:Y,keyword:J,it:Q}=$,K=U.name("valid");for(let q in I){if((0,$B0.alwaysValidSchema)(Q,I[q]))continue;U.if((0,oQ.propertyInData)(U,Y,q,Q.opts.ownProperties),()=>{let G=$.subschema({keyword:J,schemaProp:q},K);$.mergeValidEvaluated(G,K)},()=>U.var(K,!0)),$.ok(K)}}lp.validateSchemaDeps=mp;lp.default=IB0});var ep=N((sp)=>{Object.defineProperty(sp,"__esModule",{value:!0});var ap=t0(),QB0=V1(),KB0={message:"property name must be valid",params:({params:$})=>ap._`{propertyName:${$.propertyName}}`},qB0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:KB0,code($){let{gen:I,schema:U,data:Y,it:J}=$;if((0,QB0.alwaysValidSchema)(J,U))return;let Q=I.name("valid");I.forIn("key",Y,(K)=>{$.setParams({propertyName:K}),$.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),I.if((0,ap.not)(Q),()=>{if($.error(!0),!J.allErrors)I.break()})}),$.ok(Q)}};sp.default=qB0});var ET=N(($n)=>{Object.defineProperty($n,"__esModule",{value:!0});var $V=O$(),p$=t0(),HB0=s8(),IV=V1(),WB0={message:"must NOT have additional properties",params:({params:$})=>p$._`{additionalProperty:${$.additionalProperty}}`},VB0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:WB0,code($){let{gen:I,schema:U,parentSchema:Y,data:J,errsCount:Q,it:K}=$;if(!Q)throw Error("ajv implementation error");let{allErrors:q,opts:G}=K;if(K.props=!0,G.removeAdditional!=="all"&&(0,IV.alwaysValidSchema)(K,U))return;let H=(0,$V.allSchemaProperties)(Y.properties),W=(0,$V.allSchemaProperties)(Y.patternProperties);V(),$.ok(p$._`${Q}===${HB0.default.errors}`);function V(){I.forIn("key",J,(O)=>{if(!H.length&&!W.length)D(O);else I.if(X(O),()=>D(O))})}function X(O){let F;if(H.length>8){let E=(0,IV.schemaRefOrVal)(K,Y.properties,"properties");F=(0,$V.isOwnProperty)(I,E,O)}else if(H.length)F=(0,p$.or)(...H.map((E)=>p$._`${O}===${E}`));else F=p$.nil;if(W.length)F=(0,p$.or)(F,...W.map((E)=>p$._`${(0,$V.usePattern)($,E)}.test(${O})`));return(0,p$.not)(F)}function Z(O){I.code(p$._`delete${J}[${O}]`)}function D(O){if(G.removeAdditional==="all"||G.removeAdditional&&U===!1){Z(O);return}if(U===!1){if($.setParams({additionalProperty:O}),$.error(),!q)I.break();return}if(typeof U=="object"&&!(0,IV.alwaysValidSchema)(K,U)){let F=I.name("valid");if(G.removeAdditional==="failing")w(O,F,!1),I.if((0,p$.not)(F),()=>{$.reset(),Z(O)});else if(w(O,F),!q)I.if((0,p$.not)(F),()=>I.break())}}function w(O,F,E){let A={keyword:"additionalProperties",dataProp:O,dataPropType:IV.Type.Str};if(E===!1)Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(A,F)}}};$n.default=VB0});var Jn=N((Yn)=>{Object.defineProperty(Yn,"__esModule",{value:!0});var XB0=xQ(),In=O$(),BT=V1(),Un=ET(),LB0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,parentSchema:Y,data:J,it:Q}=$;if(Q.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)Un.default.code(new XB0.KeywordCxt(Q,Un.default,"additionalProperties"));let K=(0,In.allSchemaProperties)(U);for(let V of K)Q.definedProperties.add(V);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=BT.mergeEvaluated.props(I,(0,BT.toHash)(K),Q.props);let q=K.filter((V)=>!(0,BT.alwaysValidSchema)(Q,U[V]));if(q.length===0)return;let G=I.name("valid");for(let V of q){if(H(V))W(V);else{if(I.if((0,In.propertyInData)(I,J,V,Q.opts.ownProperties)),W(V),!Q.allErrors)I.else().var(G,!0);I.endIf()}$.it.definedProperties.add(V),$.ok(G)}function H(V){return Q.opts.useDefaults&&!Q.compositeRule&&U[V].default!==void 0}function W(V){$.subschema({keyword:"properties",schemaProp:V,dataProp:V},G)}}};Yn.default=LB0});var Hn=N((Gn)=>{Object.defineProperty(Gn,"__esModule",{value:!0});var Qn=O$(),UV=t0(),Kn=V1(),qn=V1(),wB0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,data:Y,parentSchema:J,it:Q}=$,{opts:K}=Q,q=(0,Qn.allSchemaProperties)(U),G=q.filter((w)=>(0,Kn.alwaysValidSchema)(Q,U[w]));if(q.length===0||G.length===q.length&&(!Q.opts.unevaluated||Q.props===!0))return;let H=K.strictSchema&&!K.allowMatchingProperties&&J.properties,W=I.name("valid");if(Q.props!==!0&&!(Q.props instanceo
Line truncated
`)}openNode($,I){let U=this.tos,Y=this._xml;if(U&&this.open)Y.push(">");this._stack.push($),Y.push("<"),Y.push($),iR(Y,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)is(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");iR(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(bs.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,U){if(this.openNode($,I),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}pR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};ps.exports=pR});var nR=N((nu0)=>{var ns=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function pu0($){if(typeof $==="string")return $;if(ns)return ns.decode($);return $.toString()}nu0.bufferToString=pu0});var os=N((ds)=>{Object.defineProperty(ds,"__esModule",{value:!0});ds.CHAR=`
`,$=this.i;break;case Hb0:{let{entityReturnState:U}=this,Y=this.entity+I.slice($,this.prevI);this.state=U;let J;if(Y==="")this.fail("empty entity name."),J="&;";else J=this.parseEntity(Y),this.entity="";if(U!==C6||this.textHandler!==void 0)this.text+=J;break $}case J4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(qK($))this.state=Jb0,this.unget(),this.xmlDeclPossible=!1;else switch($){case IX:this.state=qb0,this.xmlDeclPossible=!1;break;case Oe:this.state=of0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=ef0;break;default:this.fail("disallowed character in tag name"),this.state=C6,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=eR,this.openWakaBang="";break;case"--":this.state=sR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=rR,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar($X))this.state=rf0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===$X)this.state=tf0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=sR}sCommentEnded(){let $=this.getCodeNorm();if($!==g4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=sR;else this.state=C6}sCData(){if(this.captureToChar(lU))this.state=af0}sCDataEnding(){let $=this.getCodeNorm();if($===lU)this.state=sf0;else this.text+=`]${String.fromCodePoint($)}`,this.state=eR}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case g4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C6;break}case lU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=eR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=We;else if($===I6||n6($))this.fail("processing instruction without a target."),this.state=$===I6?eZ:$C;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=We}sPIRest(){let{chunk:$,i:I}=this;while(!0){let U=this.getCodeNorm();if(U===J4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(I,this.prevI);let Y=U===I6;if(Y||n6(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Y?$3:Ve}else this.state=Y?eZ:$C;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===I6)this.state=eZ;else if(!n6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=eZ}sPIEnding(){var $;let I=this.getCodeNorm();if(I===g4){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=C6}else if(I===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=$C;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=$3;return}if($!==J4)this.state=$b0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Zb0);if($===I6){this.state=$3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(n6($)||$===mU))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===mU?Ze:Ib0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=$3,this.fail("XML declaration is incomplete.");return}if(n6($))return;if($!==mU)this.fail("value required.");this.state=Ze}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=$3,this.fail("XML declaration is incomplete.");return}if(n6($))return;if(!UX($))this.fail("value must be quoted."),this.q=we;else this.q=$;this.state=Ub0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=$3,this.text="",this.fail("XML declaration is incomplete.");return}if($===J4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=I;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("version nu
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new 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($,I).found}function y4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+e[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[H0-1];break}}}var J1="a promise was created in a "+z+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;j._warn(J1,!0,M)}}function B0(a,M){var z=a+" is deprecated and will be removed in a future version.";if(M)z+=" Use "+M+" instead.";return D1(z)}function D1(a,M,z){if(!T0.warnings)return;var j=new J(a),x;if(M)z._attachExtraTrace(j);else if(T0.longStackTraces&&(x=$._peekContext()))x.attachExtraTrace(j);else{var s=Q4(j);j.stack=s.message+`
`)));return}}N=N._target();var 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}}F=F._target();var E=F._bitField;if((E&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(D,w){if(typeof D!=="function")throw new q(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var O=Object(D).yieldHandler,N=V,T=Error().stack;return function(){var P=X.apply(this,arguments),g=new N(void 0,void 0,O,T),B=g.promise();return g._generator=P,g._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+z.classString(X));H.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`);var O=Object(w).yieldHandler,F=Z,E=Error().stack;return function(){var A=D.apply(this,arguments),T=new F(void 0,void 0,O,E),C=T.promise();return T._generator=A,T._promiseFulfilled(void 0),C}},$.coroutine.addYieldHandler=function(D){if(typeof D!=="function")throw new q("expecting a function but got "+G.classString(D));V.push(D)},$.spawn=function(D){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof D!=="function")return I(`generatorFunctionmustbeafunction
`)},I=function(){return new C.PromiseInspection(this._target())},q=function(j){return C.reject(new H(j))};function U(){}var Y={},J=n1(),Q;if(J.isNode)Q=function(){var j=process.domain;if(j===void 0)j=null;return j};else Q=function(){return null};J.notEnumerableProp(C,"_getDomain",Q);var K=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
`)},I=function(){return new S.PromiseInspection(this._target())},U=function(B){return S.reject(new V(B))};function Y(){}var J={},Q=b1(),K;if(Q.isNode)K=function(){var B=process.domain;if(B===void 0)B=null;return B};else K=function(){return null};Q.notEnumerableProp(S,"_getDomain",K);var q=g3(),G=j20(),H=new G;q.defineProperty(S,"_async",{value:H});var W=v5(),V=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var X=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var Z=function(){},D={},w={},O=h20()(S,Z),F=k20()(S,Z,O,U,Y),E=f20()(S),A=E.create,T=i20()(S,E),C=T.CapturedTrace,u=n20()(S,O),g=d20()(w),b=Kg(),v=Q.errorObj,n=Q.tryCatch;function p(B,k){if(typeof k!=="function")throw new V("expecting a function but got "+Q.classString(k));if(B.constructor!==S)throw new V(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function C(j){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,j!==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 S(B){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,B!==Z)p(this,B),this._resolveFromExecutor(B);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(B){var k=arguments.length;if(k>1){var d=Array(k-1),t=0,K0;for(K0=0;K0<k-1;++K0){var W0=arguments[K0];if(Q.isObject(W0))d[t++]=W0;else return U("expecting an object but got A catch statement predicate "+Q.classString(W0))}return d.length=t,B=arguments[K0],this.then(void 0,g(d,B,this))}return this.then(void 0,B)},S.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},S.prototype.then=function(B,k){if(T.warnings()&&arguments.length>0&&typeof B!=="function"&&typeof k!=="function"){var d=".then() only accepts functions but was passed: "+Q.classString(B);if(arguments.length>1)d+=", "+Q.classString(k);this._warn(d)}return this._then(B,k,void 0,void 0,void 0)},S.prototype.done=function(B,k){var d=this._then(B,k,void 0,void 0,void 0);d._setIsFinal()},S.prototype.spread=function(B){if(typeof B!=="function")return U("expecting a function but got "+Q.classString(B));return this.all()._then(B,void 0,void 0,D,void 0)},S.prototype.toJSON=function(){var B={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())B.fulfillmentValue=this.value(),B.isFulfilled=!0;else if(this.isRejected())B.rejectionReason=this.reason(),B.isRejected=!0;return B},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},S.prototype.error=function(B){return this.caught(Q.originatesFromRejection,B)},S.getNewLibraryCopy=Gg.exports,S.is=function(B){return B instanceof S},S.fromNode=S.fromCallback=function(B){var k=new S(Z);k._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,t=n(B)(b(k,d));if(t===v)k._rejectCallback(t.e,!0);if(!k._isFateSealed())k._setAsyncGuaranteed();return k},S.all=function(B){return new F(B).promise()},S.cast=function(B){var k=O(B);if(!(k instanceof S))k=new S(Z),k._captureStackTrace(),k._setFulfilled(),k._rejectionHandler0=B;return k},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(B){var k=new S(Z);return k._captureStackTrace(),k._rejectCallback(B,!0),k},S.setScheduler=function(B){if(typeof B!=="function")throw new V("expecting a function but got "+Q.classString(B));return H.setScheduler(B)},S.prototype._then=function(B,k,d,t,K0){var W0=K0!==void 0,z0=W0?K0:new S(Z),B0=this._target(),D1=B0._bitField;if(!W0){if(z0._propagateFrom(this,3),z0._captureStackTrace(),t===void 0&&(this._bitField&2097152)!==0)if((D1&50397184)!==0)t=this._boundValue();else t=B0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,z0)}var f0=K();if((D1&50397184)!==0){var G1,N0,g0=B0._settlePromiseCtx;if((D1&33554432)!==0)N0=B0._rejectionHandler0,G1=B;else if((D1&16777216)!==0)N0=B0._fulfillmentHandler0,G1=k,B0._unsetRejectionIsUnhandled();else g0=B0._settlePromiseLateCancellationObserver,N0=new X("late cancellation observer"),B0._attachExtraTrace(N0),G1=k;H.invoke(g0,B0,{handler:f0===null?G1:typeof G1==="function"&&Q.domainBind(f0,G1),promise:z0,receiver:t,value:N0})}else B0._addCallbacks(B,k,z0,t,f0);return z0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(B){this._bitField=this._bitField&-65536|B&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(B){var k=B===0?this._receiver0:this[B*4-4+3];if(k===J)return;else if(k===void 0&&this._isBound())return this._boundValue();return k},S.prototype._promiseAt=function(B){return this[B*4-4+2]},S.prototype._fulfillmentHandlerAt=function(B){return this[B*4-4+0]},S.prototype._rejectionHandlerAt=function(B){return this[B*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(B){var{_bit
Line truncated
`).filter((J)=>J),U=Math.min(...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((Q)=>Q),Y=Math.min(...U.map((Q)=>Q.length-Q.trimStart().length)),J=U.map((Q)=>Q.slice(Y)).map((Q)=>" ".repeat(this.indent*2)+Q);for(let Q of J)this.content.push(Q)}compile(){let $=Function,I=this?.args,Y=[...(this?.content??[""]).map((J)=>`${J}`)];return new $(...I,Y.join(`
`))}}var _N={major:4,minor:4,patch:3};var i0=o("$ZodType",($,I)=>{var U;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=_N;let Y=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))Y.unshift($);for(let J of Y)for(let Q of J._zod.onattach)Q($);if(Y.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(K,q,G)=>{let H=o5(K),W;for(let V of q){if(V._zod.def.when){if(hO(K))continue;if(!V._zod.def.when(K))continue}else if(H)continue;let X=K.issues.length,Z=V._zod.check(K);if(Z instanceof Promise&&G?.async===!1)throw new Q8;if(W||Z instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Z,K.issues.length===X)return;if(!H)H=o5(K,X)});else{if(K.issues.length===X)continue;if(!H)H=o5(K,X)}}if(W)return W.then(()=>{return K});return K},Q=(K,q,G)=>{if(o5(K))return K.aborted=!0,K;let H=J(q,Y,G);if(H instanceof Promise){if(G.async===!1)throw new Q8;return H.then((W)=>$._zod.parse(W,G))}return $._zod.parse(H,G)};$._zod.run=(K,q)=>{if(q.skipChecks)return $._zod.parse(K,q);if(q.direction==="backward"){let H=$._zod.parse({value:K.value,issues:[]},{...q,skipChecks:!0});if(H instanceof Promise)return H.then((W)=>{return Q(W,K,q)});return Q(H,K,q)}let G=$._zod.parse(K,q);if(G instanceof Promise){if(q.async===!1)throw new Q8;return G.then((H)=>J(H,Y,q))}return J(G,Y,q)}}a0($,"~standard",()=>({validate:(J)=>{try{let Q=OI($,J);return Q.success?{value:Q.data}:{issues:Q.error?.issues}}catch(Q){return pJ($,J).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),z7=o("$ZodString",($,I)=>{i0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??QN($._zod.bag),$._zod.parse=(U,Y)=>{if(I.coerce)try{U.value=String(U.value)}catch(J){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),S1=o("$ZodStringFormat",($,I)=>{FI.init($,I),z7.init($,I)}),gN=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=dO),S1.init($,I)}),yN=o("$ZodUUID",($,I)=>{if(I.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(Y===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=M7(Y))}else I.pattern??(I.pattern=M7());S1.init($,I)}),hN=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=mO),S1.init($,I)}),xN=o("$ZodURL",($,I)=>{S1.init($,I),$._zod.check=(U)=>{try{let Y=U.value.trim();if(!I.normalize&&I.protocol?.source===$N.source){if(!/^https?:\/\//i.test(Y)){U.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:U.value,inst:$,continue:!I.abort});return}}let J=new URL(Y);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(J.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:U.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:U.value,inst:$,continue:!I.abort})}if(I.normalize)U.value=J.href;else U.value=Y;return}catch(Y){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!I.abort})}}}),kN=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=lO()),S1.init($,I)}),uN=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=nO),S1.init($,I)}),fN=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=uO),S1.init($,I)}),bN=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=fO),S1.init($,I)}),iN=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=bO),S1.init($,I)}),pN=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=iO),S1.init($,I)}),nN=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=pO),S1.init($,I)}),cN=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=JN(I)),S1.init($,I)}),dN=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=UN),S1.init($,I)}),mN=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=YN(I)),S1.init($,I)}),lN=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=cO),S1.init($,I)}),oN=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=oO),S1.init($,I),$._zod.bag.format="ipv4"}),rN=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=rO),S1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!I.abort})}}}),tN=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=tO(I.delimiter)),S1.init($,I),$._zod.bag.format="mac"}),aN=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=aO),S1.init($,I)}),sN=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=sO),S1.init($,I),$._zod.check=(U)=>{let Y=U.value.split("/");try{if(Y.length!==2)throw Error();let[J,Q]=Y;if(!Q)throw Error();let K=Number(Q);if(`${K}`!==Q)throw Error();if(K<0||K>128)throw Error();new URL(`http://[${J}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!I.abort})}}});function eN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`)}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
`)}Z.write("payload.value = newResult;"),Z.write("return payload;");let E=Z.compile();return(A,T)=>E(X,A,T)},Q,K=F7,q=!O7.jitless,H=q&&vO.value,W=I.catchall,V;$._zod.parse=(X,Z)=>{V??(V=Y.value);let D=X.value;if(!K(D))return X.issues.push({expected:"object",code:"invalid_type",input:D,inst:$}),X;if(q&&H&&Z?.async===!1&&Z.jitless!==!0){if(!Q)Q=J(I.shape);if(X=Q(X,Z),!W)return X;return kk([],D,X,Z,V,$)}return U(X,Z)}});function zk($,I,U,Y){for(let Q of $)if(Q.issues.length===0)return I.value=Q.value,I;let J=$.filter((Q)=>!o5(Q));if(J.length===1)return I.value=J[0].value,J[0];return I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>A6(K,Y,Z4())))}),I}var lJ=o("$ZodUnion",($,I)=>{i0.init($,I),a0($._zod,"optin",()=>I.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),a0($._zod,"optout",()=>I.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),a0($._zod,"values",()=>{if(I.options.every((Y)=>Y._zod.values))return new Set(I.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),a0($._zod,"pattern",()=>{if(I.options.every((Y)=>Y._zod.pattern)){let Y=I.options.map((J)=>J._zod.pattern);return new RegExp(`^(${Y.map((J)=>gJ(J.source)).join("|")})$`)}return});let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let G=q._zod.run({value:Y.value,issues:[]},J);if(G instanceof Promise)K.push(G),Q=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!Q)return zk(K,Y,$,J);return Promise.all(K).then((q)=>{return zk(q,Y,$,J)})}});function Ak($,I,U,Y){let J=$.filter((Q)=>Q.issues.length===0);if(J.length===1)return I.value=J[0].value,I;if(J.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>A6(K,Y,Z4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:[],inclusive:!1});return I}var OF=o("$ZodXor",($,I)=>{lJ.init($,I),I.inclusive=!1;let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let G=q._zod.run({value:Y.value,issues:[]},J);if(G instanceof Promise)K.push(G),Q=!0;else K.push(G)}if(!Q)return Ak(K,Y,$,J);return Promise.all(K).then((q)=>{return Ak(q,Y,$,J)})}}),NF=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,lJ.init($,I);let U=$._zod.parse;a0($._zod,"propValues",()=>{let J={};for(let Q of I.options){let K=Q._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Q)}"`);for(let[q,G]of Object.entries(K)){if(!J[q])J[q]=new Set;for(let H of G)J[q].add(H)}}return J});let Y=ZI(()=>{let J=I.options,Q=new Map;for(let K of J){let q=K._zod.propValues?.[I.discriminator];if(!q||q.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(K)}"`);for(let G of q){if(Q.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);Q.set(G,K)}}return Q});$._zod.parse=(J,Q)=>{let K=J.value;if(!F7(K))return J.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),J;let q=Y.value.get(K?.[I.discriminator]);if(q)return q._zod.run(J,Q);if(I.unionFallback||Q.direction==="backward")return U(J,Q);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(Y.value.keys()),input:K,path:[I.discriminator],inst:$}),J}}),FF=o("$ZodIntersection",($,I)=>{i0.init($,I),$._zod.parse=(U,Y)=>{let J=U.value,Q=I.left._zod.run({value:J,issues:[]},Y),K=I.right._zod.run({value:J,issues:[]},Y);if(Q instanceof Promise||K instanceof Promise)return Promise.all([Q,K]).then(([G,H])=>{return Pk(U,G,H)});return Pk(U,Q,K)}});function SN($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(l5($)&&l5(I)){let U=Object.keys(I),Y=Object.keys($).filter((Q)=>U.indexOf(Q)!==-1),J={...$,...I};for(let Q of Y){let K=SN($[Q],I[Q]);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};J[Q]=K.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Y=0;Y<$.length;Y++){let J=$[Y],Q=I[Y],K=SN(J,Q);if(!K.valid)return{valid:!1,mergeErrorPath:[Y,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Pk($,I,U){let Y=new Map,J;for(let q of I.issues)if(q.code==="unrecognized_keys"){J??(J=q);for(let G of q.keys){if(!Y.has(G))Y.set(G,{});Y.get(G).l=!0}}else $.issues.push(q);for(let q of U.issues)if(q.code==="unrecognized_keys")for(let G of q.keys){if(!Y.has(G))Y.set(G,{});Y.get(G).r=!0}else $.issues.push(q);let Q=[...Y].filter(([,q])=>q.l&&q.r).map(([q])=>q);if(Q.length&&J)$.issues.push({...J,keys:Q});if(o5($))return $;let K=SN(I.value,U.value);if(!K.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var IH=o("$ZodTuple",($,I)=>{i0.
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letQof$.seen.entries()){letK=Q[1];if(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(letKof$.seen.entries()){letq=K[1];if(I===K[0]){Q(K);continue}if($.external){letH=$.external.registry.get(K[0])?.id;if(I!==K[0]&&H){Q(K);continue}}if($.metadataRegistry.get(K[0])?.id){Q(K);continue}if(q.cycle){Q(K);continue}if(q.count>1){if($.reused==="ref"){Q(K);continue}}}}functione5($,I){letU=$.seen.get(I);if(!U)throwError("Unprocessed schema. This is a bug in Zod.");letY=(q)=>{letG=$.seen.get(q);if(G.ref===null)return;letH=G.def??G.schema,W={...H},V=G.ref;if(G.ref=null,V){Y(V);letZ=$.seen.get(V),D=Z.schema;if(D.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(D);elseObject.assign(H,D);if(Object.assign(H,W),q._zod.parent===V)for(letOinH){if(O==="$ref"||O==="allOf")continue;if(!(OinW))deleteH[O]}if(D.$ref&&Z.def)for(letOinH){if(O==="$ref"||O==="allOf")continue;if(OinZ.def&&JSON.stringify(H[O])===JSON.stringify(Z.def[O]))deleteH[O]}}letX=q._zod.parent;if(X&&X!==V){Y(X);letZ=$.seen.get(X);if(Z?.schema.$ref){if(H.$ref=Z.schema.$ref,Z.def)for(letDinH){if(D==="$ref"||D==="allOf")continue;if(DinZ.def&&JSON.stringify(H[D])===JSON.stringify(Z.def[D]))deleteH[D]}}}$.override({zodSchema:q,jsonSchema:H,path:G.path??[]})};for(letqof[...$.seen.entries()].reverse())Y(q[0]);letJ={};if($.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letq=$.external.registry.get(I)?.id;if(!q)throwError("Schema is missing an `id` property");J.$id=$.external.uri(q)}Object.assign(J,U.def??U.schema);letQ=$.metadataRegistry.get(I)?.id;if(Q!==void0&&J.id===Q)deleteJ.id;letK=$.external?.defs??{};for(letqof$.seen.entries()){letG=q[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;K[G.defId]=G.def}}if($.external);elseif(Object.keys(K).length>0)if($.target==="draft-2020-12")J.$defs=K;elseJ.definitions=K;try{letq=JSON.parse(JSON.stringify(J));returnObject.defineProperty(q,"~standard",{value:{...I["~standard"],jsonSchema:{input:yI(I,"input",$.processors),output:yI(I,"output",$.processors)}},enumerable:!1,writable:!1}),q}catch(q){throwError("Error converting schema to JSON.")}}functionT6($,I){letU=I??{seen:newSet};if(U.seen.has($))return!1;U.seen.add($);letY=$._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")returnT6(Y.element,U);if(Y.type==="set")returnT6(Y.valueType,U);if(Y.type==="lazy")returnT6(Y.getter(),U);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")returnT6(Y.innerType,U);if(Y.type==="intersection")returnT6(Y.left,U)||T6(Y.right,U);if(Y.type==="record"||Y.type==="map")returnT6(Y.keyType,U)||T6(Y.valueType,U);if(Y.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnT6(Y.in,U)||T6(Y.out,U)}if(Y.type==="object"){for(letJinY.shape)if(T6(Y.shape[J],U))return!0;return!1}if(Y.type==="union"){for(letJofY.options)if(T6(J,U))return!0;return!1}if(Y.type==="tuple"){for(letJofY.items)if(T6(J,U))return!0;if(Y.rest&&T6(Y.rest,U))return!0;return!1}return!1}varEz=($,I={})=>(U)=>{letY=a5({...U,processors:I});returnv1($,Y),s5(Y,$),e5(Y,$)},yI=($,I,U={})=>(Y)=>{let{libraryOptions:J,target:Q}=Y??{},K=a5({...J??{},target:Q,io:I,processors:U});returnv1($,K),s5(K,$),e5(K,$)};varCO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bz=($,I,U,Y)=>{letJ=U;J.type="string";let{minimum:Q,maximum:K,format:q,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofQ==="number")J.minLength=Q;if(typeofK==="number")J.maxLength=K;if(q){if(J.format=CO0[q]??q,J.format==="")deleteJ.format;if(q==="time")deleteJ.format}if(H)J.contentEncoding=H;if(G&&G.size>0){letW=[...G];if(W.length===1)J.pattern=W[0].source;elseif(W.length>1)J.allOf=[...W.map((V)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:V.source}))]}},Rz=($,I,U,Y)=>{letJ=U,{minimum:Q,maximum:K,format:q,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofq==="string"&&q.includes("int"))J.type="integer";elseJ.type="number";letV=typeofW==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),X=typeofH==="number"&&H<=(K??Number.POSITIVE_INFINITY),Z=I.target==="draft-04"||I.target==="openapi-3.0";if(V)if(Z)J.minimum=W,J.exclusiveMinimum=!0;elseJ.exclusiveMinimum=W;elseif(typeofQ==="number")J.minimum=Q;if(X)if(Z)J.maximum=H,J.exclusiveMaximum=!0;elseJ.exclusiveMaximum=H;elseif(typeofK==="number")J.maximum=K;if(typeofG==="number")J.multipleOf=G},Cz=($,I,U,Y)=>{U.type="boolean"},vz=($,I,U,Y)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},jz=($,I,U,Y)=>{if(I.unrepresentable==Line truncated
`)}return{warnings:[],results:K}}function II($){return{fileBuffer:aK1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as Iq1}from"node:fs";async function rw($,I,U={}){let J=w4().stateful?"stateful":"stateless",Q="ok",K,q,G;try{let A=await F$($);G={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Q="error",K=A instanceof Error?A.message:String(A)}let H=[];if(Q==="ok")try{H=await Z9($,I.seal.endpoints.approvalStylePreferences)}catch(A){Q="error",K=`读取Webhook配置失败:${AinstanceofError?A.message:String(A)}`}let W=H.length===1,V=H.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...W?{isDefault:!0}:{}})),X=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,Z;if(U.filePath)if(!Iq1(U.filePath))Z={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在:${U.filePath}`]};else try{let A=II(U.filePath),T=await $I(A.fileBuffer,A.fileName);Z={valid:!0,filePath:U.filePath,fileName:A.fileName,documentCount:T.documents.length,warnings:T.warnings}}catch(A){Z={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let D=Z?Z.valid:!0,w=Q==="ok"&&V.length>0&&D,O=J==="stateful"?"":`--corp${I.id}`,F="",E="";if(Q!=="ok")E=`凭证鉴权异常:${K}`,F=`seal-useauthdiagnose${O}`;else if(V.length===0)E="当前企业尚未配置任何 Webhook 集成通道",F=`seal-usewebhookadd--name"默认入站通道"--result-url"https://your-domain.com/callback"${O}`;else if(Z&&!Z.valid)E=`材料包预检失败:${Z.errors?.join("; ")}`,F=`seal-usewebhookmaterial-packpreview${Z.filePath}${O}`;else{E=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到${V.length}个Webhook通道,等待载入`;let A=Z?.filePath??"<材料包.zip>",T=W?"":`--webhook${X?X.id:"<webhookIdOrName>"}`;F=`seal-usewebhookmaterial-packpush${A}${T}${O}`}return{ready:w,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:q,user:G},stateMode:J,authStatus:Q,authError:K,activeWebhooks:V,defaultWebhook:X,materialPack:Z,statusMessage:E,nextAction:F}}var YG=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:L.object({}),handler:async($)=>F$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:L.object({}),handler:async($)=>jd($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:L.object({}),handler:async($)=>$m($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:L.object({note:L.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>XU($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:L.object({tokenId:L.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>Im($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:L.object({name:L.string().describe("用户姓名"),phone:L.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:L.array(L.string()).optional().describe("权限列表,默认为 []"),departmentIds:L.array(L.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>Um($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>ME($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>RV($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:L.object({keyword:L.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>CV($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>Ym($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>zE($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 Seal 用户(按用户ID、手机号或姓名)重置密码登录
Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let 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}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let Z=X.outboundName??"SealAI 审批",D=X.signKey,w=X.apiOrigin??"production";console.error(`•"${Z}"(signKey:${D},环境:${w})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${D}--corp${J.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let D of X){let w=D.outboundName??"SealAI 审批",O=D.signKey,F=D.apiOrigin??"production";console.error(`•"${w}"(signKey:${O},环境:${F})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${O}--corp${J.id}
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2
Line truncated
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2
Line truncated
`);J(Y)})})}async function zX0($){let I=U1($.options.port)??U1($.options.p),U=h($.options.host)??h($.options.h),Y=await HO({port:I,host:U}),J=()=>{Y.close(()=>{process.exit(0)})};process.on("SIGINT",J),process.on("SIGTERM",J),await new Promise(()=>{})}async function AX0($,I,U,Y){if($==="config"||$==="get"){await F0("seal_llm_config_get",I,U,{},O0(Y.options));return}if($==="providers"||$==="list"){await F0("seal_llm_providers_list",I,U,{},O0(Y.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function PX0($,I){if($==="config"||$==="json"){Ix();return}await Ux()}function Ix(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function TX0($){let I=JO();E0(I,{...O0($.options),allowFull:!0})}async function EX0($,I,U,Y){if($==="available"){await F0("seal_permissions_available_list",I,U,{},O0(Y.options));return}if($==="configs"||$==="list"){await F0("seal_permissions_configs_list",I,U,{},O0(Y.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as BX0}from"node:fs";async function RX0($,I,U,Y,J,Q,K){if(!$||$==="get"){await F0("seal_preference_get",J,Q,{},O0(K.options));return}if($==="decision"){if(I==="update"||!I){let q=h(K.options.input),G=q?JSON.parse(BX0(q,"utf8")):t6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await F0("seal_preference_decision_update",J,Q,G,O0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let q=h(K.options.default)??h(K.options.level)??Y;if(q!=="medium"&&q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await F0("seal_preference_thinking_depth_set",J,Q,{defaultLevel:q},O0(K.options));return}if(I==="policies"){if(U==="list"||!U){await F0("seal_preference_thinking_depth_policies_list",J,Q,{},O0(K.options));return}if(U==="upsert"){let q=h(K.options.input),G=q?JSON.parse(BX0(q,"utf8")):t6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await F0("seal_preference_thinking_depth_policies_upsert",J,Q,G,O0(K.options));return}if(U==="remove"||U==="delete"){let q=Y??h(K.options.id)??h(K.options.policyId);if(!q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await F0("seal_preference_thinking_depth_policies_remove",J,Q,{policyId:q},O0(K.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function CX0($={}){let I=b8(),U=w4(),Y=WJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},o3());console.log(`[probe]corp=${Y.id}source=${Y.source.type}`);let J=await zJ(Y);console.log("[probe] seal enterprise"),console.log(JSON.stringify(J,null,2));let Q=await U4(Y),K=await _V(Q,{documentLimit:20,stylePreferencesEndpoint:Y.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error:${K.stylePreferences.error}`},null,2))}async function vX0($,I,U){let Y=I??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await CX0({corpId:Y})}async function Yx($,I,U,Y,J){if($==="count"){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},O0(J.options));return}if($==="list"){if(_0(J.options.count)){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},O0(J.options));return}let Q=U1(J.options.limit),K=U1(J.options.offset);if(_0(J.options.summary)){await F0("seal_approval_rules_list",U,Y,{fields:aZ0,limit:Q,offset:K},O0(J.options));return}let q=await QI("seal_approval_rules_list",U,Y,{limit:Q,offset:K});sZ0(q,_0(J.options.full)===!0),E0(q);return}if($==="clear"){let Q=_0(J.options.yes)===!0,K=_0(J.options.dryRun)??_0(J.options["dry-run"])??!Q;if(!Q&&!K)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let q=await QI("seal_approval_rules_clear",U,Y,{dryRun:K,recode:_0(J.options.recode)});if(!Q&&K&&q&&typeof q==="object"){E0({...q,nextCommand:`seal-userulesclear--corp${Y.id}--yes`},O0(J.options));return}E0(q,O0(J.options));return}if($==="versions"){await F0("seal_approval_rule_versions_list",U,Y,{},O0(J.options));return}if($==="version"){let Q=I??h(J.options.version);if(!Q)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await F0("seal_approval_rule_version_get",U,Y,QG(Q),O0(J.options));return}if($==="get"){await F0("seal_approval_rule_get",U,Y,{...tZ0(h(J.options.version)),code:h(J.options.code),runtimeId:h(J.options.runtimeId)??h(J.options["runtime-id"]),recordId:h(J.options.r
Line truncated
`).filter(Boolean),Q=J.slice(-I);return{logFile:U,lines:Q,totalLines:J.length}}async function eq1($){let I=XO($),U=Kx($),Y=WG($);gX0($.stateDir);let J=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):qO),Q=$.host??(process.env.HOST?process.env.HOST:GO);VO(I,`${process.pid}
`,{mode:384}),VO(U,JSON.stringify({pid:process.pid,port:J,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),AJ(Y,`servicestartingonhttp://${Q}:${J} pid=${process.pid}`);let K=null;try{K=await HO({port:J,host:Q,silent:!0}),AJ(Y,`service listening pid=${process.pid}`)}catch(G){if(AJ(Y,`service failed to bind port ${J}: ${G instanceof Error?G.message:String(G)}`),ZO(I)===process.pid)n8(I,{force:!0}),n8(U,{force:!0});throw G}let q=()=>{if(K)K.close(),K=null;if(ZO(I)===process.pid)n8(I,{force:!0}),n8(U,{force:!0});AJ(Y,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,q(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function jX0($){gX0($.stateDir);let I=PJ($);if(I.running)return I;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Y=[...U.args??[],"service","run"];if($.port)Y.push("--port",String($.port));if($.host)Y.push("--host",String($.host));let J=rq1(U.command,Y,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});J.unref();let Q=XO($);return VO(Q,`${J.pid}
`,{flag:"a",mode:384})}var qx=UG1(IG1(),".config","seal-use");async function Gx($,I,U){let Y=U?U1(U.options.port)??U1(U.options.p):void 0,J=U?h(U.options.host)??h(U.options.h):void 0,Q=U?U1(U.options.lines)??U1(U.options.n):void 0,K=await KI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:qx,version:e0,launcher:I.launcher,port:Y,host:J},{maxLines:Q});if(K!==void 0)E0(K)}import{existsSync as YG1,readFileSync as yX0}from"node:fs";async function hX0($,I,U,Y,J){if($==="batch-records"||$==="records"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await F0("seal_simulation_batch_records_get",U,Y,{batchId:Q,query:h(J.options.query)},O0(J.options));return}if($==="create"||$==="run"){let Q=h(J.options.mode)??h(J.options.sourceSystem)??h(J.options["source-system"])??"hosecloud",K=Q==="material-pack"?"material_pack":Q,q=h(J.options.schemaConfig)??h(J.options["schema-config"]),G=q?JSON.parse(yX0(q,"utf8")):void 0,H=h(J.options.input),W=H?JSON.parse(yX0(H,"utf8")):t6(J.json),V=h(J.options.packageId)??h(J.options["package-id"]),X=M6(J.options.packageIds)??M6(J.options["package-ids"])??(V?[V]:void 0),Z=M6(J.options.flowIds)??M6(J.options["flow-ids"])??M6(J.options.documentSn)??M6(J.options["document-sn"]),D=h(J.options.signKey)??h(J.options["sign-key"])??h(J.options.integration);await F0("seal_simulation_batch_create",U,Y,{mode:K,sourceSystem:K,flowIds:Z,documentSn:Z,rejectNodeName:h(J.options.rejectNode)??h(J.options["reject-node"])??null,thinkingDepthOverride:h(J.options.thinkingDepth)??h(J.options["thinking-depth"]),skipInvoiceGeneration:_0(J.options.skipInvoiceGeneration)??_0(J.options["skip-invoice-generation"]),skipExpenseExtraction:_0(J.options.skipExpenseExtraction)??_0(J.options["skip-expense-extraction"]),disableAttachmentCache:_0(J.options.disableAttachmentCache)??_0(J.options["disable-attachment-cache"]),signKey:D,packageIds:X,packageId:V,templateId:h(J.options.templateId)??h(J.options["template-id"]),schemaConfig:G,requestIds:M6(J.options.requestIds)??M6(J.options["request-ids"]),workflowTypeId:h(J.options.workflowTypeId)??h(J.options["workflow-type-id"]),flowStatusList:M6(J.options.flowStatusList)?.map(Number)??M6(J.options["flow-status-list"])?.map(Number),businessCodes:M6(J.options.businessCodes)??M6(J.options["business-codes"]),documentType:h(J.options.documentType)??h(J.options["document-type"]),startTime:U1(J.options.startTime)??U1(J.options["start-time"]),endTime:U1(J.options.endTime)??U1(J.options["end-time"]),status:M6(J.options.status),limit:U1(J.options.limit),rawParams:W},O0(J.options));return}if($==="wait"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await F0("seal_simulation_batch_wait",U,Y,{batchId:Q,timeout:h(J.options.timeout),pollInterval:h(J.options.pollInterval)??h(J.options["poll-interval"])},O0(J.options));return}if($==="clean"||$==="delete"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await F0("seal_simulation_batch_clean",U,Y,{batchId:Q},O0(J.options));return}if($==="specifications"){let Q=I??h(J.options.integration)??h(J.options.signKey)??h(J.options["sign-key"]);await F0("seal_simulation_specifications_list",U,Y,{signKey:Q},O0(J.options));return}if($==="list"){await F0("seal_simulation_batches_list",U,Y,{limit:U1(J.options.limit)},O0(J.options));return}if($==="get"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await F0("seal_simulation_batch_get",U,Y,{batchId:Q},O0(J.options));return}if($==="templates"){await F0("seal_simulation_templates_get",U,Y,{},O0(J.options));return}if($==="integrations"){await F0("seal_simulation_integrations_get",U,Y,{},O0(J.options));return}if($==="package-upload"){let Q=I??h(J.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!YG1(Q))throw Error(`Filenotfound:${Q}`);await F0("seal_simulation_material_package_upload",U,Y,{filePath:Q},O0(J.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as eX0}from"node:fs";import{join as LO}from"node:path";import{existsSync as Hx,mkdirSync as lX0,rmSync as DG1,writeFileSync as wG1}from"node:fs";import{homedir as oX0}from"node:os";import{dirname as OG1,join as Wx}from"node:path";var xX0=`---
name:seal-use
description:"v0.10.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.12: 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 kX0=`interface:
display_name:"Seal Use"
short_description:"Diagnose approval feedback and publish minimal rule fixes"
default_prompt:"Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
@@ -706,7 +718,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 bX0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises`aremerged.\n-User-levelconfigsoverridesame-IDlocalconfigs.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**(e.g.`👉Nextaction:...`).\n-**`ExitCode`**:`0`onsuccess,non-zero(e.g.`1`)onfailuretotriggerAgenterrorself-remediation.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfigtest-dir[<path>|--clear]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate\nseal-usetoolslist\nseal-usecorpslist[--corp<corpId>]\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useusersreset-password<userId>[--corp<corpId>]\nseal-useusersget<userId>[--corp<corpId>]\nseal-useusersdelete<userId>[--corp<corpId>]\nseal-usellmconfig[--corp<corpId>]\nseal-usellmproviders[--corp<corpId>]\nseal-usepermissionsavailable[--corp<corpId>]\nseal-usepermissionsconfigs[--corp<corpId>]\nseal-usebillingstatus[--corp<corpId>]\nseal-usebillingplans[--corp<corpId>]\nseal-usebillingfeatures[--corp<corpId>]\nseal-usewebhooklist[--query<text>][--show-secret][--corp<corpId>]\nseal-usewebhookget|find<idOrName>[--show-secret][--corp<corpId>]\nseal-usewebhookadd--name<name>--result-url<url>[--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>][--corp<corpId>]\nseal-usewebhookupdate<idOrName>[--name<name>][--result-url<url>][--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>|--rotate-secret][--corp<corpId>]\nseal-usewebhookdelete<idOrName>--yes[--corp<corpId>]\nseal-usedeployhosecloudrequirements[--corp<corpId>]\nseal-usedeployhosecloudlist[--corp<corpId>]\nseal-usedeployhosecloudget[<sign-key>][--corp<corpId>]\nseal-usedeployhosecloudstatus[--corp<corpId>]\nseal-usedeployhosecloudconfigure--json'{...}'[--corp<corpId>]\nseal-usedeployhosecloudsync[<sign-key>][--auto][--corp<corpId>]\nseal-usepreferenceget[--corp<corpId>]\nseal-usepreferencedecisionupdate--json'{\"explicitApprove\":\"...\"}'[--corp<corpId>]\nseal-usepreferencethinking-depthset--default<medium|high>[--corp<corpId>]\nseal-usepreferencethinking-depthpolicieslist[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesupsert--json'{...}'[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesremove<policyId>[--corp<corpId>]\nseal-usesourceconfig[--corp<corpId>]\nseal-usetool<toolName>[--corp<corpId>][--json'{\"key\":\"value\"}']\nseal-useapproval-runssummary--corp<corpId>[--dateYYYY-MM-DD][--timezoneAsia/Shanghai]\nseal-useapproval-runsstats--corp<corpId>[--since3months][--dedupe-bysoLine truncated
@@ -1141,7 +1153,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 cX0="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl-fsSLhttps://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat
Line truncated
-\`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
`);return}if($==="install"||$==="init"||$==="sync"){let U=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 Y=_0(U.options.local)||_0(U.options.workspace),J=h(U.options.dir)??h(U.options.target)??I,Q=J?J:Y?LO(process.cwd(),".agents","skills","seal-use"):VG(),K=Vx(Q);E0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files});return}if($==="status"||$==="get"||!$){let Y=VG(),J=LO(process.cwd(),".agents","skills","seal-use");E0({global:{dir:Y,installed:eX0(LO(Y,"SKILL.md"))},local:{dir:J,installed:eX0(LO(J,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function IL0($,I){if($==="config"){E0(await zJ(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function UL0($,I,U,Y){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await F0($,I,U,t6(Y.json),O0(Y.options))}function YL0(){E0(YG.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as NG1,mkdirSync as FG1,renameSync as Xx,rmSync as MG1,unlinkSync as GL0,writeFileSync as JL0}from"node:fs";import{dirname as zG1,join as QL0}from"node:path";import{spawnSync as qI}from"node:child_process";function DO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var HL0="yunyingk/seal-use",XG="yunyingk/seal-home";var AG1="SEAL_USE_GITHUB_REPO",PG1="SEAL_HOME_GITHUB_REPO";async function WL0($,I={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:qx,version:e0,launcher:$.launcher},Y=I.repo||process.env[AG1]?.trim()||process.env[PG1]?.trim()||HL0,J=I.targetVersion?.trim(),Q=J&&J.toLowerCase()!=="latest"?J:void 0;if(Q){let T=Q.replace(/^v/,""),C=VL0(T,e0);if(C<0){E0({updated:!1,currentVersion:e0,targetVersion:T,mode:DO()?"binary":"source",message:`Cannotdowngradeseal-usefromv${e0}toolderversionv${T}.Updatesmustbeforward-only.`});return}if(C===0&&!I.force){E0({updated:!1,currentVersion:e0,targetVersion:T,mode:DO()?"binary":"source",message:`seal-useisalreadyatversionv${e0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let T=await Lx(Y,I.limit??10);E0({currentVersion:e0,totalQueried:T.length,releases:T.map((C)=>({version:C.version,tagName:C.tagName,publishedAt:C.publishedAt,author:C.author,releaseNotes:C.notes,releaseUrl:C.htmlUrl,isCurrent:C.version===e0,isNewer:ZG(C.version,e0)}))});return}if(!DO()){if(I.checkOnly){let C=await Lx(Y,30),u=C[0],g=u?.version??e0,b=C.find((p)=>p.version===e0),v=ZG(g,e0),n=C.filter((p)=>ZG(p.version,e0));E0({updated:!1,updateAvailable:v,currentVersion:e0,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:u?.publishedAt,behindCount:n.length,pendingReleases:n.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:u?.notes??"",releaseUrl:u?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let T=PJ(U).running;if(T)await KI("stop",U);try{qL0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(C){console.error(`gitpullskipped:${CinstanceofError?C.message:String(C)}`)}if(qL0("bun",["install"],{cwd:$.appRoot}),T)await KI("start",U);E0({updated:!0,serviceRestarted:T,version:e0,mode:"source"});return}let K=TG1(),q=EG1(),G=await Lx(Y,30),H=Q?G.find((T)=>T.version===Q||T.tagName===Q||T.tagName===`v${Q}`)??await KL0(Y,Q):G[0]??await KL0(Y);if(!H){E0({updated:!1,currentVersion:e0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${Y}'`});return}let W=H.version,V=G.find((T)=>T.version===e0),X=ZG(W,e0),Z=X||Boolean(I.force),D=G.filter((T)=>ZG(T.version,e0));if(I.checkOnly){E0({updated:!1,updateAvailable:X,currentVersion:e0,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:D.length,pendingReleases:D.map((T)=>({version:T.version,tagName:T.tagName,publishedAt:T.publishedAt,author:T.author,releaseNotes:T.notes,releaseUrl:T.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!Z){E0({updated:!1,currentVersion:e0,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${e0})`});return}let w=BG1(H.assets,K,q);if(!w)throw Error(`Nocompatiblebinaryfoundfor${K}-${q}inreleasev${W}.Availableassets:${H.assets.map((T)=>T.name).join(", ")}`);let O=PJ(U).running;if(O)await KI("stop",U);let F=process.execPath,E=zG1(F),A=QL0(E,`.tmp-update-${Date.now()}`);FG1(A,{recursive:!0});try{let T=QL0(A,w.name);await RG1(w.downloadUrl,T,H.tagName,w.name);let C=T;if(w.name.endsWith(".tar.gz")||w.name.endsWith(".tgz"))C=CG1(T,A,K);else if(w.name.endsWith(".zip"))C=vG1(T,A,K);if(NG1(C,493),process.platform==="darwin")try{qI("/usr/bin/codesig
Line truncated
`)}catch{}}async function RG1($,I,U,Y){let J=Dx(),Q=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,q=Y||$.split("/").pop()||"";if(J!=="github"){if(K&&q)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${q}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(J!=="gitea")if(K&&q){let w=`https://github.com/${HL0}/releases/download/${K}/${q}`;if(!process.env.CI)Q.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);Q.push(w)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let G=Array.from(new Set(Q)),H,W=6000,V=6000,X=307200,Z=1e4,D=180000;for(let w=0;w<G.length;w++){let O=G[w],F=new AbortController,E="",A=(g)=>{E=g;try{F.abort()}catch{}},T=setTimeout(()=>{A("Connection timed out (no response headers within 6s)")},W),C,u;try{wO(`==> [${w+1}/${G.length}] Downloading via: ${O}`);let g=await fetch(O,{signal:F.signal});if(T)clearTimeout(T),T=void 0;if(!g.ok)throw Error(`HTTP ${g.status} ${g.statusText}`);C=setTimeout(()=>{A("Overall download time exceeded 3 minutes")},D);let b=Number(g.headers.get("content-length"))||0,v=g.body?.getReader();if(!v){let i=Buffer.from(await g.arrayBuffer());if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);JL0(I,i),wO(`✓ Download succeeded (${(i.length/1024/1024).toFixed(1)} MB)`);return}let n=[],p=0,S=0;u=setTimeout(()=>{if(p<X){let i=(p/1024).toFixed(1);A(`Initial transfer too slow (${i} KB < 300 KB in 6s), switching mirror...`)}},V);while(!0){let i=v.read(),Y0,B=new Promise((K0,W0)=>{Y0=setTimeout(()=>{W0(Error("Data transfer stalled (no chunk received for 10s)"))},Z)}),k;try{k=await Promise.race([i,B])}finally{if(Y0)clearTimeout(Y0)}let{done:d,value:t}=k;if(d)break;if(t){if(n.push(t),p+=t.length,u&&p>=X)clearTimeout(u),u=void 0;let K0=Date.now();if(K0-S>200){S=K0;let W0=b?Math.round(p/b*100):0,z0=(p/1048576).toFixed(1),B0=b?(b/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${W0}% (${z0} / ${B0} MB)...`)}catch{}}}}try{process.stderr.write(`
"description":"Planned HTTP contract for the seal-use wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-use is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
description:"v0.10.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.12: 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.12
short-description:Seal tenant and Hose approval automation (v0.10.12)
---
# Seal Use (v0.10.6)
# Seal Use (v0.10.12)
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.
A **material pack** (材料包) is a ZIP file that bundles an Excel information sheet (`信息表.xlsx`) with attachments organised by document ID. It is the primary input to the Webhook-based AI approval ingestion pipeline.
### ZIP structure convention
```
材料包.zip
├── 信息表.xlsx ← must exist at ZIP root
├── BX20260826003/ ← root dir name = documentId (or documentId@annotation)
│ ├── 合同协议/
│ │ └── 采购合同.pdf
│ └── 支付凭证/
│ └── 支付宝交易明细.pdf
└── BX20260826004@重新提交v2/ ← @annotation is stripped when matching documentId
└── 发票/
└── 增值税专用发票.pdf
```
- The root directory name **must equal** the `documentId`**OR** start with `documentId@` (the `@` separates an optional annotation ignored during matching).
-`信息表.xlsx` at the ZIP root is the only file not associated with any document directory.
### Excel column convention
| Column type | Naming | Purpose |
|---|---|---|
| Regular column | Any header (e.g. `会议编号`, `总金额`) | Standard document fields |
| Attachment column | Header starts with `[附件]` (e.g. `[附件]合同协议`) | Declares attached files for this row |
- The `[附件]` prefix is stripped to produce the field `label` sent to Seal.
- The cell value contains full ZIP-relative path(s) to the declared files (multiple paths separated by newline, comma, or semicolon).
- Example: column `[附件]合同协议`, cell value `BX20260826003/合同协议/采购合同.pdf`
Before pushing or previewing, the system enforces:
1.**Excel → ZIP**: Every path declared in an `[附件]` column cell **must** exist as a ZIP entry. Error: `Excel 声明的附件路径在 ZIP 中不存在: <path>`
2.**ZIP → Excel**: Every ZIP file (excluding `信息表.xlsx`) **must** be declared in at least one `[附件]` column. Error: `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>`
3.**documentId ↔ ZIP root**: Every `documentId` in the Excel main sheet must have a matching ZIP root dir (exact match or `documentId@annotation`). Errors: `Excel 会议编号「X」在 ZIP 中找不到对应的根目录...` / `ZIP 根目录对应的编号「X」在信息表中找不到对应的会议编号`
All validation errors are collected and reported together in a single `MaterialPackValidationError`.
### CLI usage
```bash
# Check environment readiness and optionally pre-validate the material pack
# When there is exactly one webhook channel, --webhook can be omitted (auto-locked)
```
### Error messages reference
| Error message | Meaning | Fix |
|---|---|---|
| `Excel 声明的附件路径在 ZIP 中不存在: <path>` | Cell value references a file not in ZIP | Add the file to ZIP at exactly that path |
| `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>` | ZIP contains a file not referenced by any `[附件]` column | Add an `[附件]` column entry or remove the file from ZIP |
| `Excel 会议编号「X」在 ZIP 中找不到对应的根目录` | No ZIP root dir matches documentId `X` | Rename the ZIP folder to match the documentId |
| `ZIP 根目录对应的编号「X」在信息表中找不到` | ZIP folder has no matching documentId in Excel | Remove the folder or add the document to Excel |
| `ZIP 根目录缺少信息表.xlsx` | No `信息表.xlsx` found at ZIP root | Add the Excel file to the ZIP root |
| `附件上传失败 <status>` | Network/server error during file upload | Check webhook URL, secret, and server availability |
## Failure Handling
- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. Use `seal-use service restart` after updates so the optional local service picks up new code.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.