Some Seal tenants sit behind a gateway that only forwards requests
carrying its own session cookie. Corp configs can now set
seal.headers/seal.cookies, which the client merges into every request;
cookies are rendered into one Cookie header and the session bearer
token still wins over any configured Authorization.
corps add-seal accepts both fields and applies them when verifying the
tenant, so a gated enterprise can be registered in one step.
- 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
- Enforced per-document directory scope isolation: all attachments declared for a document must strictly reside in its own folder (`<documentId>/` or `<documentId>@annotation/`), preventing cross-document file borrowing or path confusion.
- Enforced global declaration uniqueness: identical attachment file paths can no longer be declared more than once across the entire material pack (even within the same document or different line-items). Multiple uses require placing distinct physical files in independent paths.
- Added comprehensive unit tests covering cross-document directory violations, intra-document duplicate paths, and multi-document path collisions.
- Updated documentation in `cli.md` detailing the strict scope isolation and declaration uniqueness rules.
## [0.10.12] - 2026-09-07
### Added & Refactored
- **Material Pack Pure Path Declaration & Validation Refactor**:
- Replaced ambiguous filename heuristics with explicit `[附件]` Excel column headers and full ZIP-relative file paths.
- Added `@` annotation suffix support for ZIP root directories (`<documentId>@annotation/`) to bypass document idempotency blocks safely.
- Enforced bidirectional validation between Excel declarations and ZIP entries without fail-fast, collecting all errors together.
- 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{createRequireasYL0}from"node:module";varoz0=Object.create;var{getPrototypeOf:rz0,defineProperty:uD,getOwnPropertyNames:tz0}=Object;varaz0=Object.prototype.hasOwnProperty;functionsz0($){returnthis[$]}varez0,$L0,XI=($,I,U)=>{varY=$!=null&&typeof$==="object";if(Y){varJ=I?ez0??=newWeakMap:$L0??=newWeakMap,Q=J.get($);if(Q)returnQ}U=$!=null?oz0(rz0($)):{};letK=I||!$||!$.__esModule?uD(U,"default",{value:$,enumerable:!0}):U;for(letqoftz0($))if(!az0.call(K,q))uD(K,q,{get:sz0.bind($,q),enumerable:!0});if(Y)J.set($,K);returnK};varO=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varIL0=($)=>$;functionUL0($,I){this[$]=IL0.bind(null,I)}varo8=($,I)=>{for(varUinI)uD($,U,{get:I[U],enumerable:!0,configurable:!0,set:UL0.bind(I,U)})};varr=YL0(import.meta.url);vargQ=O((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;class_W{}rf._CodeOrName=_W;rf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classsIextends_W{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=sI;classb$extends_W{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(UinstanceofsI)I[U.str]=(I[U.str]||0)+1;returnI},{})}}rf._Code=b$;rf.nil=newb$("");functionlf($,...I){letU=[$[0]],Y=0;while(Y<I.length)aP(U,I[Y]),U.push($[++Y]);returnnewb$(U)}rf._=lf;vartP=newb$("+");functionof($,...I){letU=[SQ($[0])],Y=0;while(Y<I.length)U.push(tP),aP(U,I[Y]),U.push(tP,SQ($[++Y]));returnTN0(U),newb$(U)}rf.str=of;functionaP($,I){if(Iinstanceofb$)$.push(...I._items);elseif(IinstanceofsI)$.push(I);else$.push(vN0(I))}rf.addCodeArg=aP;functionTN0($){letI=1;while(I<$.length-1){if($[I]===tP){letU=EN0($[I-1],$[I+1]);if(U!==void0){$.splice(I-1,3,U);continue}$[I++]="+"}I++}}functionEN0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofsI||$[$.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]==='"'&&!($instanceofsI))return`"${$}${I.slice(1)}`;return}functionBN0($,I){returnI.emptyStr()?$:$.emptyStr()?I:of`${$}${I}`}rf.strConcat=BN0;functionvN0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:SQ(Array.isArray($)?$.join(","):$)}functionRN0($){returnnewb$(SQ($))}rf.stringify=RN0;functionSQ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}rf.safeStringify=SQ;functionCN0($){returntypeof$=="string"&&rf.IDENTIFIER.test($)?newb$(`.${$}`):lf`[${$}]`}rf.getProperty=CN0;functionjN0($){if(typeof$=="string"&&rf.IDENTIFIER.test($))returnnewb$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}rf.getEsmExportName=jN0;function_N0($){returnnewb$($.toString())}rf.regexpCode=_N0});varIT=O((ef)=>{Object.defineProperty(ef,"__esModule",{value:!0});ef.ValueScope=ef.ValueScopeName=ef.Scope=ef.varKinds=ef.UsedValueState=void0;varu6=gQ();classafextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}vargW;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(gW||(ef.UsedValueState=gW={}));ef.varKinds={const:newu6.Name("const"),let:newu6.Name("let"),var:newu6.Name("var")};classeP{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,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}}}ef.Scope=eP;class$Textendsu6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:U}){this.value=$,this.scopePath=u6._`.${newu6.Name(I)}[${U}]`}}ef.ValueScopeName=$T;varcN0=u6._`\n`;classsfextendseP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?cN0:u6.nil}}get(){returnthis._scope}name($){returnnew$T($,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 aB0={keyword:"dependencies",type:"object",schemaType:"object",error:zp.error,code($){let[I,U]=sB0($);Zp($,I),Xp($,U)}};function sB0({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 Zp($,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,sQ.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,sQ.checkReportMissingProp)($,H)});else U.if(fT._`${G}&&(${(0,sQ.checkMissingProp)($,q,Q)})`),(0,sQ.reportMissingProp)($,Q),U.else()}}zp.validatePropertyDeps=Zp;function Xp($,I=$.schema){let{gen:U,data:Y,keyword:J,it:Q}=$,K=U.name("valid");for(let q in I){if((0,tB0.alwaysValidSchema)(Q,I[q]))continue;U.if((0,sQ.propertyInData)(U,Y,q,Q.opts.ownProperties),()=>{let G=$.subschema({keyword:J,schemaProp:q},K);$.mergeValidEvaluated(G,K)},()=>U.var(K,!0)),$.ok(K)}}zp.validateSchemaDeps=Xp;zp.default=aB0});var Mp=O((Np)=>{Object.defineProperty(Np,"__esModule",{value:!0});var Fp=s0(),Iv0=w1(),Uv0={message:"property name must be valid",params:({params:$})=>Fp._`{propertyName:${$.propertyName}}`},Yv0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Uv0,code($){let{gen:I,schema:U,data:Y,it:J}=$;if((0,Iv0.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,Fp.not)(Q),()=>{if($.error(!0),!J.allErrors)I.break()})}),$.ok(Q)}};Np.default=Yv0});var bT=O((Ap)=>{Object.defineProperty(Ap,"__esModule",{value:!0});var KV=O$(),c$=s0(),Qv0=$5(),qV=w1(),Kv0={message:"must NOT have additional properties",params:({params:$})=>c$._`{additionalProperty:${$.additionalProperty}}`},qv0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Kv0,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,qV.alwaysValidSchema)(K,U))return;let H=(0,KV.allSchemaProperties)(Y.properties),W=(0,KV.allSchemaProperties)(Y.patternProperties);V(),$.ok(c$._`${Q}===${Qv0.default.errors}`);function V(){I.forIn("key",J,(D)=>{if(!H.length&&!W.length)z(D);else I.if(w(D),()=>z(D))})}function w(D){let F;if(H.length>8){let E=(0,qV.schemaRefOrVal)(K,Y.properties,"properties");F=(0,KV.isOwnProperty)(I,E,D)}else if(H.length)F=(0,c$.or)(...H.map((E)=>c$._`${D}===${E}`));else F=c$.nil;if(W.length)F=(0,c$.or)(F,...W.map((E)=>c$._`${(0,KV.usePattern)($,E)}.test(${D})`));return(0,c$.not)(F)}function Z(D){I.code(c$._`delete${J}[${D}]`)}function z(D){if(G.removeAdditional==="all"||G.removeAdditional&&U===!1){Z(D);return}if(U===!1){if($.setParams({additionalProperty:D}),$.error(),!q)I.break();return}if(typeof U=="object"&&!(0,qV.alwaysValidSchema)(K,U)){let F=I.name("valid");if(G.removeAdditional==="failing")L(D,F,!1),I.if((0,c$.not)(F),()=>{$.reset(),Z(D)});else if(L(D,F),!q)I.if((0,c$.not)(F),()=>I.break())}}function L(D,F,E){let T={keyword:"additionalProperties",dataProp:D,dataPropType:qV.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,F)}}};Ap.default=qv0});var Bp=O((Ep)=>{Object.defineProperty(Ep,"__esModule",{value:!0});var Hv0=bQ(),Pp=O$(),iT=w1(),Tp=bT(),Wv0={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)Tp.default.code(new Hv0.KeywordCxt(Q,Tp.default,"additionalProperties"));let K=(0,Pp.allSchemaProperties)(U);for(let V of K)Q.definedProperties.add(V);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=iT.mergeEvaluated.props(I,(0,iT.toHash)(K),Q.props);let q=K.filter((V)=>!(0,iT.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,Pp.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)}}};Ep.default=Wv0});var _p=O((jp)=>{Object.defineProperty(jp,"__esModule",{value:!0});var vp=O$(),GV=s0(),Rp=w1(),Cp=w1(),wv0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,data:Y,parentSchema:J,it:Q}=$,{opts:K}=Q,q=(0,vp.allSchemaProperties)(U),G=q.filter((L)=>(0,Rp.alwaysValidSchema)(Q,U[L]));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($),KR(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)_e(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");KR(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(je.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("")}}qR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};Se.exports=qR});var GR=O((pf0)=>{var ge=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function nf0($){if(typeof $==="string")return $;if(ge)return ge.decode($);return $.toString()}pf0.bufferToString=nf0});var ue=O((he)=>{Object.defineProperty(he,"__esModule",{value:!0});he.CHAR=`
`,$=this.i;break;case Hi0:{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 Q4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(wK($))this.state=Ji0,this.unget(),this.xmlDeclPossible=!1;else switch($){case VZ:this.state=qi0,this.xmlDeclPossible=!1;break;case q00:this.state=ob0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=eb0;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=OR,this.openWakaBang="";break;case"--":this.state=DR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=XR,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(WZ))this.state=rb0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===WZ)this.state=tb0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=DR}sCommentEnded(){let $=this.getCodeNorm();if($!==g4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=DR;else this.state=C6}sCData(){if(this.captureToChar(aU))this.state=ab0}sCDataEnding(){let $=this.getCodeNorm();if($===aU)this.state=sb0;else this.text+=`]${String.fromCodePoint($)}`,this.state=OR}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 aU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=OR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=$00;else if($===I6||p6($))this.fail("processing instruction without a target."),this.state=$===I6?HZ:FR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=$00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let U=this.getCodeNorm();if(U===Q4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(I,this.prevI);let Y=U===I6;if(Y||p6(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Y?J3:I00}else this.state=Y?HZ:FR;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=HZ;else if(!p6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=HZ}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=FR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=J3;return}if($!==Q4)this.state=$i0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(wi0);if($===I6){this.state=J3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p6($)||$===tU))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=$===tU?U00:Ii0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=J3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if($!==tU)this.fail("value required.");this.state=U00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=J3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if(!wZ($))this.fail("value must be quoted."),this.q=K00;else this.q=$;this.state=Ui0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=J3,this.text="",this.fail("XML declaration is incomplete.");return}if($===Q4)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("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new h4($,I).found}function h4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See:https://github.com/isaacs/node-glob/issues/167`);return new y4($,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 Q1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;j._warn(Q1,!0,N)}}function v0(a,N){var M=a+" is deprecated and will be removed in a future version.";if(N)M+=" Use "+N+" instead.";return L1(M)}function L1(a,N,M){if(!E0.warnings)return;var j=new J(a),x;if(N)M._attachExtraTrace(j);else if(E0.longStackTraces&&(x=$._peekContext()))x.attachExtraTrace(j);else{var s=K4(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(z,L){if(typeof z!=="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 D=Object(L).yieldHandler,F=Z,E=Error().stack;return function(){var T=z.apply(this,arguments),A=new F(void 0,void 0,D,E),R=A.promise();return A._generator=T,A._promiseFulfilled(void 0),R}},$.coroutine.addYieldHandler=function(z){if(typeof z!=="function")throw new q("expecting a function but got "+G.classString(z));V.push(z)},$.spawn=function(z){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof z!=="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=k3(),G=NK0(),H=new G;q.defineProperty(S,"_async",{value:H});var W=_5(),V=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var w=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var Z=function(){},z={},L={},D=EK0()(S,Z),F=vK0()(S,Z,D,U,Y),E=CK0()(S),T=E.create,A=_K0()(S,E),R=A.CapturedTrace,u=gK0()(S,D),g=hK0()(L),b=Eg(),C=Q.errorObj,p=Q.tryCatch;function n(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)n(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(A.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,z,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=vg.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=p(B)(b(k,d));if(t===C)k._rejectCallback(t.e,!0);if(!k._isFateSealed())k._setAsyncGuaranteed();return k},S.all=function(B){return new F(B).promise()},S.cast=function(B){var k=D(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,A0=W0?K0:new S(Z),v0=this._target(),L1=v0._bitField;if(!W0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),t===void 0&&(this._bitField&2097152)!==0)if((L1&50397184)!==0)t=this._boundValue();else t=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var f0=K();if((L1&50397184)!==0){var H1,F0,g0=v0._settlePromiseCtx;if((L1&33554432)!==0)F0=v0._rejectionHandler0,H1=B;else if((L1&16777216)!==0)F0=v0._fulfillmentHandler0,H1=k,v0._unsetRejectionIsUnhandled();else g0=v0._settlePromiseLateCancellationObserver,F0=new w("late cancellation observer"),v0._attachExtraTrace(F0),H1=k;H.invoke(g0,v0,{handler:f0===null?H1:typeof H1==="function"&&Q.domainBind(f0,H1),promise:A0,receiver:t,value:F0})}else v0._addCallbacks(B,k,A0,t,f0);return A0},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 mO={major:4,minor:4,patch:3};var i0=o("$ZodType",($,I)=>{var U;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=mO;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=a5(K),W;for(let V of q){if(V._zod.def.when){if(tD(K))continue;if(!V._zod.def.when(K))continue}else if(H)continue;let w=K.issues.length,Z=V._zod.check(K);if(Z instanceof Promise&&G?.async===!1)throw new K8;if(W||Z instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Z,K.issues.length===w)return;if(!H)H=a5(K,w)});else{if(K.issues.length===w)continue;if(!H)H=a5(K,w)}}if(W)return W.then(()=>{return K});return K},Q=(K,q,G)=>{if(a5(K))return K.aborted=!0,K;let H=J(q,Y,G);if(H instanceof Promise){if(G.async===!1)throw new K8;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 K8;return G.then((H)=>J(H,Y,q))}return J(G,Y,q)}}e0($,"~standard",()=>({validate:(J)=>{try{let Q=MI($,J);return Q.success?{value:Q.data}:{issues:Q.error?.issues}}catch(Q){return mJ($,J).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),E7=o("$ZodString",($,I)=>{i0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??NO($._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)=>{PI.init($,I),E7.init($,I)}),oO=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=KO),S1.init($,I)}),rO=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=T7(Y))}else I.pattern??(I.pattern=T7());S1.init($,I)}),tO=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=qO),S1.init($,I)}),aO=o("$ZodURL",($,I)=>{S1.init($,I),$._zod.check=(U)=>{try{let Y=U.value.trim();if(!I.normalize&&I.protocol?.source===zO.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})}}}),sO=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=GO()),S1.init($,I)}),eO=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=JO),S1.init($,I)}),$F=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=eD),S1.init($,I)}),IF=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=$O),S1.init($,I)}),UF=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=IO),S1.init($,I)}),YF=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=UO),S1.init($,I)}),JF=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=YO),S1.init($,I)}),QF=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=FO(I)),S1.init($,I)}),KF=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=DO),S1.init($,I)}),qF=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=OO(I)),S1.init($,I)}),GF=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=QO),S1.init($,I)}),HF=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=HO),S1.init($,I),$._zod.bag.format="ipv4"}),WF=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=WO),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})}}}),VF=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=VO(I.delimiter)),S1.init($,I),$._zod.bag.format="mac"}),wF=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=wO),S1.init($,I)}),ZF=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=ZO),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 XF($){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(T,A)=>E(w,T,A)},Q,K=P7,q=!M7.jitless,H=q&&cD.value,W=I.catchall,V;$._zod.parse=(w,Z)=>{V??(V=Y.value);let z=w.value;if(!K(z))return w.issues.push({expected:"object",code:"invalid_type",input:z,inst:$}),w;if(q&&H&&Z?.async===!1&&Z.jitless!==!0){if(!Q)Q=J(I.shape);if(w=Q(w,Z),!W)return w;return Ju([],z,w,Z,V,$)}return U(w,Z)}});function nk($,I,U,Y){for(let Q of $)if(Q.issues.length===0)return I.value=Q.value,I;let J=$.filter((Q)=>!a5(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,w4())))}),I}var aJ=o("$ZodUnion",($,I)=>{i0.init($,I),e0($._zod,"optin",()=>I.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),e0($._zod,"optout",()=>I.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),e0($._zod,"values",()=>{if(I.options.every((Y)=>Y._zod.values))return new Set(I.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),e0($._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)=>kJ(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 nk(K,Y,$,J);return Promise.all(K).then((q)=>{return nk(q,Y,$,J)})}});function pk($,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,w4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:[],inclusive:!1});return I}var SF=o("$ZodXor",($,I)=>{aJ.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 pk(K,Y,$,J);return Promise.all(K).then((q)=>{return pk(q,Y,$,J)})}}),gF=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,aJ.init($,I);let U=$._zod.parse;e0($._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=LI(()=>{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(!P7(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}}),yF=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 ck(U,G,H)});return ck(U,Q,K)}});function lO($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(t5($)&&t5(I)){let U=Object.keys(I),Y=Object.keys($).filter((Q)=>U.indexOf(Q)!==-1),J={...$,...I};for(let Q of Y){let K=lO($[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=lO(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 ck($,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(a5($))return $;let K=lO(I.value,U.value);if(!K.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var qH=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}}}}functionU9($,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),z=Z.schema;if(z.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(z);elseObject.assign(H,z);if(Object.assign(H,W),q._zod.parent===V)for(letDinH){if(D==="$ref"||D==="allOf")continue;if(!(DinW))deleteH[D]}if(z.$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]}}letw=q._zod.parent;if(w&&w!==V){Y(w);letZ=$.seen.get(w);if(Z?.schema.$ref){if(H.$ref=Z.schema.$ref,Z.def)for(letzinH){if(z==="$ref"||z==="allOf")continue;if(zinZ.def&&JSON.stringify(H[z])===JSON.stringify(Z.def[z]))deleteH[z]}}}$.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:uI(I,"input",$.processors),output:uI(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}varbM=($,I={})=>(U)=>{letY=$9({...U,processors:I});returnC1($,Y),I9(Y,$),U9(Y,$)},uI=($,I,U={})=>(Y)=>{let{libraryOptions:J,target:Q}=Y??{},K=$9({...J??{},target:Q,io:I,processors:U});returnC1($,K),I9(K,$),U9(K,$)};varTO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},iM=($,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=TO0[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}))]}},nM=($,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),w=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(w)if(Z)J.maximum=H,J.exclusiveMaximum=!0;elseJ.exclusiveMaximum=H;elseif(typeofK==="number")J.maximum=K;if(typeofG==="number")J.multipleOf=G},pM=($,I,U,Y)=>{U.type="boolean"},cM=($,I,U,Y)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},dM=($,I,U,Y)=>{if(I.unrepresentable==Line truncated
`)}return{warnings:[],results:K}}function QI($){return{fileBuffer:eq1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as YG1}from"node:fs";async function QD($,I,U={}){let J=L4().stateful?"stateful":"stateless",Q="ok",K,q,G;try{let A=await N$($);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}:{}})),w=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,Z=U.webhook?L9(H,U.webhook):W?H[0]:void 0,z;if(U.filePath)if(!YG1(U.filePath))z={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在:${U.filePath}`]};else try{let A=QI(U.filePath),R=await JI(A.fileBuffer,A.fileName,Z?.materialPackFilePolicy);z={valid:!0,filePath:U.filePath,fileName:A.fileName,documentCount:R.documents.length,warnings:R.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 L=z?z.valid:!0,D=Q==="ok"&&V.length>0&&L,F=J==="stateful"?"":`--corp${I.id}`,E="",T="";if(Q!=="ok")T=`凭证鉴权异常:${K}`,E=`seal-useauthdiagnose${F}`;else if(V.length===0)T="当前企业尚未配置任何 Webhook 集成通道",E=`seal-usewebhookadd--name"默认入站通道"--result-url"https://your-domain.com/callback"${F}`;else if(z&&!z.valid)T=`材料包预检失败:${z.errors?.join("; ")}`,E=`seal-usewebhookmaterial-packpreview${z.filePath}${F}`;else{T=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到${V.length}个Webhook通道,等待载入`;let A=z?.filePath??"<材料包.zip>",R=W?"":`--webhook${w?w.id:"<webhookIdOrName>"}`;E=`seal-usewebhookmaterial-packpush${A}${R}${F}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:q,user:G},stateMode:J,authStatus:Q,authError:K,activeWebhooks:V,defaultWebhook:w,materialPack:z,statusMessage:T,nextAction:E}}var GG=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:X.object({}),handler:async($)=>N$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:X.object({}),handler:async($)=>Gm($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:X.object({}),handler:async($)=>ym($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:X.object({note:X.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>OU($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:X.object({tokenId:X.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>hm($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:X.object({name:X.string().describe("用户姓名"),phone:X.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:X.array(X.string()).optional().describe("权限列表,默认为 []"),departmentIds:X.array(X.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>xm($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:X.object({userId:X.string().describe("用户 ID (_id)")}),handler:async($,I)=>fE($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:X.object({userId:X.string().describe("用户 ID (_id)")}),handler:async($,I)=>yV($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:X.object({keyword:X.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>hV($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:X.object({userId:X.string().describe("用户 ID (_id)")}),handler:async($,I)=>lm($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:X.object({userId:X.string().describe("用户 ID (_id)")}),handler:async($,I)=>bE($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S
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 w of V){let Z=w.outboundName??"SealAI 审批",z=w.signKey,L=w.apiOrigin??"production";console.error(`•"${Z}"(signKey:${z},环境:${L})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${z}--corp${J.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let z of w){let L=z.outboundName??"SealAI 审批",D=z.signKey,F=z.apiOrigin??"production";console.error(`•"${L}"(signKey:${D},环境:${F})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${D}--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 DX0($){let I=d0($.options.port)??d0($.options.p),U=h($.options.host)??h($.options.h),Y=await TD({port:I,host:U}),J=()=>{Y.close(()=>{process.exit(0)})};process.on("SIGINT",J),process.on("SIGTERM",J),await new Promise(()=>{})}async function OX0($,I,U,Y){if($==="config"||$==="get"){await D0("seal_llm_config_get",I,U,{},V0(Y.options));return}if($==="providers"||$==="list"){await D0("seal_llm_providers_list",I,U,{},V0(Y.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function FX0($,I){if($==="config"||$==="json"){Ax();return}await Px()}function Ax(){B0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function NX0($){let I=FD();B0(I,{...V0($.options),allowFull:!0})}async function MX0($,I,U,Y){if($==="available"){await D0("seal_permissions_available_list",I,U,{},V0(Y.options));return}if($==="configs"||$==="list"){await D0("seal_permissions_configs_list",I,U,{},V0(Y.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as AX0}from"node:fs";async function PX0($,I,U,Y,J,Q,K){if(!$||$==="get"){await D0("seal_preference_get",J,Q,{},V0(K.options));return}if($==="decision"){if(I==="update"||!I){let q=h(K.options.input),G=q?JSON.parse(AX0(q,"utf8")):t6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await D0("seal_preference_decision_update",J,Q,{...G,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(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 D0("seal_preference_thinking_depth_set",J,Q,{defaultLevel:q,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(K.options));return}if(I==="policies"){if(U==="list"||!U){await D0("seal_preference_thinking_depth_policies_list",J,Q,{},V0(K.options));return}if(U==="upsert"){let q=h(K.options.input),G=q?JSON.parse(AX0(q,"utf8")):t6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await D0("seal_preference_thinking_depth_policies_upsert",J,Q,{...G,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(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 D0("seal_preference_thinking_depth_policies_remove",J,Q,{policyId:q,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(K.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function TX0($={}){let I=b8(),U=L4(),Y=XJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},s3());console.log(`[probe]corp=${Y.id}source=${Y.source.type}`);let J=await EJ(Y);console.log("[probe] seal enterprise"),console.log(JSON.stringify(J,null,2));let Q=await Y4(Y),K=await bV(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 EX0($,I,U){let Y=I??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await TX0({corpId:Y})}async function Tx($,I,U,Y,J){if($==="count"){await D0("seal_approval_rules_list",U,Y,{countOnly:!0},V0(J.options));return}if($==="list"){if(N0(J.options.count)){await D0("seal_approval_rules_list",U,Y,{countOnly:!0},V0(J.options));return}let Q=d0(J.options.limit),K=d0(J.options.offset);if(N0(J.options.summary)){await D0("seal_approval_rules_list",U,Y,{fields:pZ0,limit:Q,offset:K},V0(J.options));return}let q=await HI("seal_approval_rules_list",U,Y,{limit:Q,offset:K});cZ0(q,N0(J.options.full)===!0),B0(q);return}if($==="clear"){let Q=N0(J.options.yes)===!0,K=N0(J.options.dryRun)??N0(J.options["dry-run"])??!Q;if(!Q&&!K)throw zD("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${Y.id}--dry-run`);let q=await HI("seal_approval_rules_clear",U,Y,{dryRun:K,recode:N0(J.options.recode)});if(!Q&&K&&q&&typeof q==="object"){B0({...q,nextCommand:`seal-userulesclear--corp${Y.id}--yes`},V0(J.options));return}B0(q,V0(J.options));return}if($==="versions"){await D0("seal_approval_rule_versions_list",U,Y,{},V0(J.options));return}if($==="version"){let Q=I??h(J.options.version);if(!Q)throw Error("Usage: seal-use rules version <versionId|versionNumber|l
Line truncated
`).filter(Boolean),Q=J.slice(-I);return{logFile:U,lines:Q,totalLines:J.length}}async function JH1($){let I=RD($),U=vx($),Y=LG($);CX0($.stateDir);let J=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):AD),Q=$.host??(process.env.HOST?process.env.HOST:PD);BD(I,`${process.pid}
`,{mode:384}),BD(U,JSON.stringify({pid:process.pid,port:J,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),BJ(Y,`servicestartingonhttp://${Q}:${J} pid=${process.pid}`);let K=null;try{K=await TD({port:J,host:Q,silent:!0}),BJ(Y,`service listening pid=${process.pid}`)}catch(G){if(BJ(Y,`service failed to bind port ${J}: ${G instanceof Error?G.message:String(G)}`),vD(I)===process.pid)d8(I,{force:!0}),d8(U,{force:!0});throw G}let q=()=>{if(K)K.close(),K=null;if(vD(I)===process.pid)d8(I,{force:!0}),d8(U,{force:!0});BJ(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 BX0($){CX0($.stateDir);let I=vJ($);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=$H1(U.command,Y,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});J.unref();let Q=RD($);return BD(Q,`${J.pid}
`,{flag:"a",mode:384})}var Rx=qH1(KH1(),".config","seal-use");async function Cx($,I,U){let Y=U?d0(U.options.port)??d0(U.options.p):void 0,J=U?h(U.options.host)??h(U.options.h):void 0,Q=U?d0(U.options.lines)??d0(U.options.n):void 0,K=await WI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:Rx,version:I1,launcher:I.launcher,port:Y,host:J},{maxLines:Q});if(K!==void 0)B0(K)}import{existsSync as GH1,readFileSync as jX0}from"node:fs";async function _X0($,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 D0("seal_simulation_batch_records_get",U,Y,{batchId:Q,query:h(J.options.query)},V0(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(jX0(q,"utf8")):void 0,H=h(J.options.input),W=H?JSON.parse(jX0(H,"utf8")):t6(J.json),V=h(J.options.packageId)??h(J.options["package-id"]),w=W6(J.options.packageIds)??W6(J.options["package-ids"])??(V?[V]:void 0),Z=W6(J.options.flowIds)??W6(J.options["flow-ids"])??W6(J.options.documentSn)??W6(J.options["document-sn"]),z=h(J.options.signKey)??h(J.options["sign-key"])??h(J.options.integration),L=N0(J.options.noWait)??N0(J.options["no-wait"]);await D0("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:N0(J.options.skipInvoiceGeneration)??N0(J.options["skip-invoice-generation"]),skipExpenseExtraction:N0(J.options.skipExpenseExtraction)??N0(J.options["skip-expense-extraction"]),disableAttachmentCache:N0(J.options.disableAttachmentCache)??N0(J.options["disable-attachment-cache"]),signKey:z,packageIds:w,packageId:V,templateId:h(J.options.templateId)??h(J.options["template-id"]),schemaConfig:G,requestIds:W6(J.options.requestIds)??W6(J.options["request-ids"]),workflowTypeId:h(J.options.workflowTypeId)??h(J.options["workflow-type-id"]),flowStatusList:W6(J.options.flowStatusList)?.map(Number)??W6(J.options["flow-status-list"])?.map(Number),businessCodes:W6(J.options.businessCodes)??W6(J.options["business-codes"]),documentType:h(J.options.documentType)??h(J.options["document-type"]),startTime:d0(J.options.startTime)??d0(J.options["start-time"]),endTime:d0(J.options.endTime)??d0(J.options["end-time"]),status:W6(J.options.status),limit:d0(J.options.limit),noWait:L,rawParams:W},V0(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 D0("seal_simulation_batch_wait",U,Y,{batchId:Q,timeout:h(J.options.timeout),pollInterval:h(J.options.pollInterval)??h(J.options["poll-interval"])},V0(J.options));return}if($==="status"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation status <batchId>");await D0("seal_simulation_batch_status",U,Y,{batchId:Q},V0(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 D0("seal_simulation_batch_clean",U,Y,{batchId:Q},V0(J.options));return}if($==="specifications"){let Q=I??h(J.options.integration)??h(J.options.signKey)??h(J.options["sign-key"]);await D0("seal_simulation_specifications_list",U,Y,{signKey:Q},V0(J.options));return}if($==="approval-definitions"||$==="definitions"){await D0("seal_simulation_feishu_approval_definitions_list",U,Y,{},V0(J.options));return}if($==="list"){await D0("seal_simulation_batches_list",U,Y,{limit:d0(J.options.limit)},V0(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 D0("seal_simulation_batch_get",U,Y,{batchId:Q},V0(J.options));return}if($==="templates"){await D0("seal_simulation_templates_get",U,Y,{},V0(J.options));return}if($==="integrations"){await D0("seal_simulation_integrations_get",U,Y,{},V0(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(!GH1(Q))throw Error(`Filenotfound:${Q}`);await D0("seal_simulation_material_package_upload",U,Y,{filePath:Q},V0(J.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as rX0}from"node:fs";import{join as CD}from"node:path";import{existsSync as jx,mkdirSync as pX0,rmSync as NH1,writeFileSync as MH1}from"node:fs";import{homedir as cX0}from"node:os";import{dirname as AH1,join as _x}from"node:path";var SX0=`---
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.14: 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.
@@ -510,7 +532,8 @@ seal-use corps list
-Prefercompactcommandsfirst:\`pick\`, \`--summary\`, \`--fields\`, \`attachments --summary\`, \`rules count\`, and \`rules list --summary\`.
-ParseJSONstdout.Donotscrapehumantext.
-Donothand-editenterpriseconfigsfornormalsetup.Use\`seal-use corps ...\`.
-Beforewriteoperationsonrules,documents,stylepreferences,orpublishing,fetchcurrentstateandconfirmtheintendedmutationwiththeuser.Forrepeattest-environmentruleresets,prefer\`rules clear --dry-run\` followed by \`rules clear --yes\`.
-Beforewriteoperationsonrules,documents,stylepreferences,orpublishing,fetchcurrentstateandconfirmtheintendedmutationwiththeuser.Forsupportedconfigurationwrites,prefertheuniversal\`--dry-run\` preview first (rules clear/push, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use \`--yes\` only after reviewing its redacted \`changesDiff\`.
-Knowledgedocumentcreationiscurrentlyirreversible:theupstreamAPIexposesnodeleteoperation.Validate\`contentType\` and \`scenarios\` before creating, and use \`enabled: false\` when the document should be withdrawn.
-Forcustomer-feedbackruleremediation,showanexactfield-leveldiffandobtainexplicitapprovalbeforeupdating.Defaulttochangingonlythenarrowestnecessarypartof\`description\`; preserve \`scope\`, \`strictness\`, and unrelated clauses unless the user explicitly approves otherwise.
-Resolveandlockthetargetenterprise\`corpId\` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
-Firstinstall/zeroconfiguration/“howdoIconnectmyenterprise?”/usersuppliesappcredentials,anassistancelink,orF12/NetworkcURL:read\`references/enterprise-onboarding.md\`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
-User-facingSealtenantassistancelink(Seal协助/Seal授权/委托):resolvethenamedenterprisefirst,thenrun\`seal-use delegation create --corp <corpId> --note '<enterprise>'\`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (\`\`\`\`text ... \`\`\`\`) AND a hyperlink.
-Packagedcustomerfeedback→approval-ruleremediation:read\`references/customer-feedback-rule-remediation.md\`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
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 gX0=`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."
\`rules list\` and \`rules pull\` operate on the current draft and therefore return draft \`code\` values. A published version stores a separate snapshot and may recode the same rules; publishing, deleting, or reordering rules can make those published codes differ or drift again. A code such as \`#0038\` is only meaningful together with its version context.
Usethedraft\`id\` for current edits and use the approval run's recorded version plus rule text or runtime rule ID for historical investigations. Do not copy a draft code into a report or command that will be interpreted against a published version.
##CountRules
Usecountwhenonlyscaleorexistencematters.
@@ -706,7 +751,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 xX0="# 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**withthestableprefix`👉Nextaction:seal-use...`.\n-**`ExitCode`**:`0`onsuccess;`1`runtime/upstreamfailure,`2`usage/argumenterror,`10`explicitdestructive-operationconfirmationrequired,`11`missing/invalidauthentication,and`12`outputprotectionrequiringacompact/file/queryalternative.\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-usecontactsdepartments[<departmentId>][--corp<corpId>]\nseal-usecontactschildren<departmentId>[--corp<corpId>]\nseal-usecontactsusers<departmentId>[--corp<corpId>]\nseal-usecontactssync-time[--corp<corpId>]\nseal-usedataexpenses--corp<corpId>[--search<text>][--start-date<ISO|ms>][--end-date<ISO|ms>][--offset<n>][--limit<n>]\nseal-usedatainvoices--corp<corpId>[--search<text>][--start-date<ISO|ms>][--end-date<ISO|ms>][--offset<n>][--limit<n>]\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>][--min-file-size<bytes>][--max-file-size<bytes>][--allowed-extensions<.pdf,.xlsx,...>][--dry-run][--corp<corpId>]\nseal-usewebhookupdate<idOrName>[--name<name>][--result-url<url>][--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>|--rotate-secret][--min-file-size<bytes>][--max-file-size<bytes>][--allowed-extensions<.pdf,.xlsx,...>][--clear-max-file-size][--dry-run][--corp<corpId>]\nseal-usewebhookdelete<idOrName>[--yes|--dry-run][--corp<corpId>]\nseal-usedeployhosecloudrequirements[--corp<corpId>]\nseal-usedeployhosecloudlist[--corp<corpId>]\nseal-usedeployhosecloudget[<sign-key>][--corp<corpId>]\nseal-usedeployhosLine truncated
Donotsend\`scope\` or \`strictness\` when they are unchanged. Fetch the draft again and verify the exact description, scope, strictness, and draft status before publishing.
Foracompletelocalrule-setsync,\`rules push\` is incremental: it matches pulled rules by stable \`id\`, updates only changed fields, creates new entries, and removes entries omitted from the local file. It preserves matched rule IDs and does not recode the whole draft. Preview it with \`rules push --dry-run\` before applying.
##9.Publishandverify
Publishonlywhenexplicitlyauthorized:
@@ -1141,7 +1188,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 bX0="# 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=N0(U.options.local)||N0(U.options.workspace),J=h(U.options.dir)??h(U.options.target)??I,Q=J?J:Y?CD(process.cwd(),".agents","skills","seal-use"):DG(),K=Sx(Q);B0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files});return}if($==="status"||$==="get"||!$){let Y=DG(),J=CD(process.cwd(),".agents","skills","seal-use");B0({global:{dir:Y,installed:rX0(CD(Y,"SKILL.md"))},local:{dir:J,installed:rX0(CD(J,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function aX0($,I){if($==="config"){B0(await EJ(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function sX0($,I,U,Y){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await D0($,I,U,t6(Y.json),V0(Y.options))}function eX0(){B0(GG.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as PH1,mkdirSync as TH1,renameSync as yx,rmSync as EH1,unlinkSync as Jz0,writeFileSync as $z0}from"node:fs";import{dirname as BH1,join as Iz0}from"node:path";import{spawnSync as VI}from"node:child_process";function jD($=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 Qz0="yunyingk/seal-use",FG="yunyingk/seal-home";var vH1="SEAL_USE_GITHUB_REPO",RH1="SEAL_HOME_GITHUB_REPO";async function Kz0($,I={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Rx,version:I1,launcher:$.launcher},Y=I.repo||process.env[vH1]?.trim()||process.env[RH1]?.trim()||Qz0,J=I.targetVersion?.trim(),Q=J&&J.toLowerCase()!=="latest"?J:void 0;if(Q){let A=Q.replace(/^v/,""),R=qz0(A,I1);if(R<0){B0({updated:!1,currentVersion:I1,targetVersion:A,mode:jD()?"binary":"source",message:`Cannotdowngradeseal-usefromv${I1}toolderversionv${A}.Updatesmustbeforward-only.`});return}if(R===0&&!I.force){B0({updated:!1,currentVersion:I1,targetVersion:A,mode:jD()?"binary":"source",message:`seal-useisalreadyatversionv${I1}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let A=await hx(Y,I.limit??10);B0({currentVersion:I1,totalQueried:A.length,releases:A.map((R)=>({version:R.version,tagName:R.tagName,publishedAt:R.publishedAt,author:R.author,releaseNotes:R.notes,releaseUrl:R.htmlUrl,isCurrent:R.version===I1,isNewer:OG(R.version,I1)}))});return}if(!jD()){if(I.checkOnly){let R=await hx(Y,30),u=R[0],g=u?.version??I1,b=R.find((n)=>n.version===I1),C=OG(g,I1),p=R.filter((n)=>OG(n.version,I1));B0({updated:!1,updateAvailable:C,currentVersion:I1,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:u?.publishedAt,behindCount:p.length,pendingReleases:p.map((n)=>({version:n.version,tagName:n.tagName,publishedAt:n.publishedAt,author:n.author,releaseNotes:n.notes,releaseUrl:n.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 A=vJ(U).running;if(A)await WI("stop",U);try{Yz0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(R){console.error(`gitpullskipped:${RinstanceofError?R.message:String(R)}`)}if(Yz0("bun",["install"],{cwd:$.appRoot}),A)await WI("start",U);B0({updated:!0,serviceRestarted:A,version:I1,mode:"source"});return}let K=CH1(),q=jH1(),G=await hx(Y,30),H=Q?G.find((A)=>A.version===Q||A.tagName===Q||A.tagName===`v${Q}`)??await Uz0(Y,Q):G[0]??await Uz0(Y);if(!H){B0({updated:!1,currentVersion:I1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${Y}'`});return}let W=H.version,V=G.find((A)=>A.version===I1),w=OG(W,I1),Z=w||Boolean(I.force),z=G.filter((A)=>OG(A.version,I1));if(I.checkOnly){B0({updated:!1,updateAvailable:w,currentVersion:I1,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:z.length,pendingReleases:z.map((A)=>({version:A.version,tagName:A.tagName,publishedAt:A.publishedAt,author:A.author,releaseNotes:A.notes,releaseUrl:A.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!Z){B0({updated:!1,currentVersion:I1,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${I1})`});return}let L=_H1(H.assets,K,q);if(!L)throw Error(`Nocompatiblebinaryfoundfor${K}-${q}inreleasev${W}.Availableassets:${H.assets.map((A)=>A.name).join(", ")}`);let D=vJ(U).running;if(D)await WI("stop",U);let F=process.execPath,E=BH1(F),T=Iz0(E,`.tmp-update-${Date.now()}`);TH1(T,{recursive:!0});try{let A=Iz0(T,L.name);await SH1(L.downloadUrl,A,H.tagName,L.name);let R=A;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))R=gH1(A,T,K);else if(L.name.endsWith(".zip"))R=yH1(A,T,K);if(PH1(R,493),process.platform==="darwin")try{VI("/usr/bin/codesig
Line truncated
`)}catch{}}async function SH1($,I,U,Y){let J=xx(),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 L=`https://github.com/${Qz0}/releases/download/${K}/${q}`;if(!process.env.CI)Q.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Q.push(L)}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,w=307200,Z=1e4,z=180000;for(let L=0;L<G.length;L++){let D=G[L],F=new AbortController,E="",T=(g)=>{E=g;try{F.abort()}catch{}},A=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},W),R,u;try{_D(`==> [${L+1}/${G.length}] Downloading via: ${D}`);let g=await fetch(D,{signal:F.signal});if(A)clearTimeout(A),A=void 0;if(!g.ok)throw Error(`HTTP ${g.status} ${g.statusText}`);R=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},z);let b=Number(g.headers.get("content-length"))||0,C=g.body?.getReader();if(!C){let i=Buffer.from(await g.arrayBuffer());if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);$z0(I,i),_D(`✓ Download succeeded (${(i.length/1024/1024).toFixed(1)} MB)`);return}let p=[],n=0,S=0;u=setTimeout(()=>{if(n<w){let i=(n/1024).toFixed(1);T(`Initial transfer too slow (${i} KB < 300 KB in 6s), switching mirror...`)}},V);while(!0){let i=C.read(),Y0,B=new Promise((K0,W0)=>{Y0=setTimeout(()=>{W0(Error("Data transfer stalled (no chunk received for 10s)"))},Z)}),k;try{k=await Promise.race([i,B])}finally{if(Y0)clearTimeout(Y0)}let{done:d,value:t}=k;if(d)break;if(t){if(p.push(t),n+=t.length,u&&n>=w)clearTimeout(u),u=void 0;let K0=Date.now();if(K0-S>200){S=K0;let W0=b?Math.round(n/b*100):0,A0=(n/1048576).toFixed(1),v0=b?(b/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${W0}% (${A0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
"description":"Planned HTTP contract for the seal-use wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-use is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
description:"v0.10.6: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.14: 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.14
short-description:Seal tenant and Hose approval automation (v0.10.14)
---
# Seal Use (v0.10.6)
# Seal Use (v0.10.14)
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.
@@ -39,7 +39,8 @@ seal-use corps list
- Prefer compact commands first: `pick`, `--summary`, `--fields`, `attachments --summary`, `rules count`, and `rules list --summary`.
- Parse JSON stdout. Do not scrape human text.
- Do not hand-edit enterprise configs for normal setup. Use `seal-use corps ...`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For repeat test-environment rule resets, prefer `rules clear --dry-run` followed by `rules clear --yes`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal `--dry-run` preview first (rules clear/push, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use `--yes` only after reviewing its redacted `changesDiff`.
- Knowledge document creation is currently irreversible: the upstream API exposes no delete operation. Validate `contentType` and `scenarios` before creating, and use `enabled: false` when the document should be withdrawn.
- For customer-feedback rule remediation, show an exact field-level diff and obtain explicit approval before updating. Default to changing only the narrowest necessary part of `description`; preserve `scope`, `strictness`, and unrelated clauses unless the user explicitly approves otherwise.
- Resolve and lock the target enterprise `corpId` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
- For date questions, use explicit dates and `--timezone Asia/Shanghai`.
@@ -55,7 +56,7 @@ seal-use corps list
- First install / zero configuration / “how do I connect my enterprise?” / user supplies app credentials, an assistance link, or F12/Network cURL: read `references/enterprise-onboarding.md`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
- User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run `seal-use delegation create --corp <corpId> --note '<enterprise>'`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
- Packaged customer feedback → approval-rule remediation: read `references/customer-feedback-rule-remediation.md`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
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>]`
-`seal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]` incrementally applies the local file: matched IDs are updated, missing local IDs are created, and remote IDs absent from the file are deleted. It does not clear/recreate the whole draft or recode it. Run `--dry-run` first; a local file exported with `rules pull` is preferred.
-`rules list` and `rules pull` read the current **draft** rule set. Their `code` values belong to the draft code space.
-A published version has its own snapshot and code space. Publishing can recode rules, so a published `code` may differ from the draft `code`, and codes can shift again after later edits and publishes.
-Do not use a draft `#NN` as a cross-version identifier. For current draft work, prefer the stable rule `id`; for historical behavior, select the published `version` and locate the rule by its text/context or runtime rule ID from the approval run.
-`rules get --version ... --code ...` interprets `code` inside that selected published version, while `rules get --record-id ... --runtime-id ...` resolves the version recorded on the run.
Approval run lightweight queries:
@@ -155,61 +170,44 @@ Approval run lightweight queries:
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.
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. Each Webhook can also store a mutable `materialPackFilePolicy` with `minFileSizeBytes`, optional `maxFileSizeBytes`, and `allowedExtensions`. Update is a patch: omitted policy fields are retained; `allowedExtensions` replaces the complete list; `--clear-max-file-size` removes the upper bound.
All supported configuration writes accept `--dry-run`: rules clear/push, preference updates, thinking-depth policy changes, HoseCloud configure, and Webhook add/update/delete. Preview mode performs read-only discovery and returns JSON with `preview: true`, the exact `targetUrl`, a redacted `changesDiff` (`before`/`after`), and `impactCount`. It never sends the mutation request and does not require `--yes`; use the same command with `--yes` only after reviewing the preview.
-`seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>` returns immediately with an `asyncTicket` (creation is non-blocking by default for compatibility).
-`seal-use simulation status <batchId> --corp <corpId>` performs one non-blocking status check and returns `QUEUED`/`RUNNING`/`COMPLETED`/`FAILED`-style state plus counters.
知识文档创建后当前 API 没有删除接口,创建操作不可逆;请在写入前确认标题、正文、内容类型和能力场景。需要撤下内容时,优先使用更新操作并设置 `enabled: false`(如果上游支持该字段),不要通过试探性创建来验证参数。规则支持删除,但知识文档与规则的生命周期能力并不对称。
Update a document:
```json
@@ -367,6 +369,150 @@ Update style preferences:
}
```
## Material Pack Workflow
A **material pack** (材料包) is a ZIP file that bundles an Excel information sheet (`信息表.xlsx`) with attachments organised by document ID. It is the primary input to the Webhook-based AI approval ingestion pipeline.
### ZIP structure convention
```
材料包.zip
├── 信息表.xlsx ← must exist at ZIP root
├── BX20260826003/ ← root dir name = documentId (or documentId@annotation)
│ ├── 合同协议/
│ │ └── 采购合同.pdf
│ └── 支付凭证/
│ └── 支付宝交易明细.pdf
└── BX20260826004@重新提交v2/ ← @annotation is stripped when matching documentId
└── 发票/
└── 增值税专用发票.pdf
```
- The root directory name **must equal** the `documentId`**OR** start with `documentId@` (the `@` separates an optional annotation ignored during matching).
-`信息表.xlsx` at the ZIP root is the only file not associated with any document directory.
### Excel column convention
| Column type | Naming | Purpose |
|---|---|---|
| Regular column | Any header (e.g. `会议编号`, `总金额`) | Standard document fields |
| Attachment column | Header starts with `[附件]` (e.g. `[附件]合同协议`) | Declares attached files for this row |
- The `[附件]` prefix is stripped to produce the field `label` sent to Seal.
- The cell value contains full ZIP-relative path(s) to the declared files (multiple paths separated by newline, comma, or semicolon).
- Example: column `[附件]合同协议`, cell value `BX20260826003/合同协议/采购合同.pdf`
Before pushing or previewing, the system enforces:
1.**Excel → ZIP**: Every path declared in an `[附件]` column cell **must** exist as a ZIP entry. Error: `Excel 声明的附件路径在 ZIP 中不存在: <path>`
2.**ZIP → Excel**: Every ZIP file (excluding `信息表.xlsx`) **must** be declared in exactly one `[附件]` column. Error: `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>`
3.**Document Directory Scope Isolation**: All attachments declared for a document `DOC_X`**must** reside in its own root directory (`DOC_X/` or `DOC_X@annotation/`). Cross-document references are strictly forbidden. Error: `单据「X」声明了跨单据或非本单据目录的附件路径: <path>。附件必须位于该单据自己的根目录...`
4.**Strict Declaration Uniqueness**: A given ZIP file path **cannot** be declared more than once across the entire material pack (even within the same document across multiple rows or fields). If the same logical document is needed in multiple places, separate files must be placed in distinct paths. Error: `附件路径「<path>」被重复声明了 N 次...`
5.**Attachment file policy**: Every attachment except the root `信息表.xlsx` must satisfy the selected Webhook's minimum size, optional maximum size, and extension whitelist. The default minimum is 500 bytes; the default maximum is unlimited; the default whitelist includes common PDF, Office, text, email, and image formats. Error: `附件文件过小...` / `附件文件过大...` / `附件后缀不在白名单中...`
6.**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)
```
### Attachment file policy configuration
The policy is stored per inbound Webhook integration and is applied before any attachment upload or document push. A failed check stops the entire material-pack flow. The policy is intentionally mutable: after an authorized configuration change, retrying the same push reads the saved policy again.
`null` or an omitted `maxFileSizeBytes` means no per-file upper bound. Values are bytes; a file smaller than the minimum or larger than the maximum fails. Extensions are normalized case-insensitively and may be written with or without the leading dot. The root `信息表.xlsx` remains exempt from attachment policy checks.
```bash
# New Webhook: use the default 500-byte minimum and default extension whitelist
The saved configuration is returned by `webhook get`/`webhook list` under `materialPackFilePolicy`. The root `信息表.xlsx` is always allowed as the material-pack manifest and is not subject to the attachment policy.
### Failure recovery loop
When a push fails because of the attachment policy, the error is actionable and should be handled as a two-channel recovery loop:
1. Error channel: read `附件文件过小`, `附件文件过大`, or `附件后缀不在白名单中`, including the attachment path and the configured boundary.
2. Resolution channel: ask whether the user wants to replace/compress the file or explicitly allow the format/size by changing the target Webhook policy.
3. If configuration change is authorized, read the current policy with `webhook get`/`webhook list`, update only the necessary fields, and verify the returned configuration.
4. Retry the original `material-pack push`; it will load the latest saved policy before any upload begins.
The same loop is available through MCP: read with `seal_webhook_get`/`seal_webhook_list`, update with `seal_webhook_update` and its `materialPackFilePolicy` patch, then retry `seal_webhook_material_pack` in `push` mode. For MCP, set `maxFileSizeBytes` to `null` to clear the upper bound. `allowedExtensions` is a complete replacement list, so include existing allowed suffixes when adding one.
If the assistant lacks permission to update the Webhook or the user does not authorize relaxing the rule, report the block rather than bypassing validation. Since validation happens before the upload loop, a failed attempt does not leave a partially pushed material pack.
The direct local `material-pack preview` command and MCP preview use the default or temporary policy. They do not automatically read a selected Webhook's persisted policy. Use `webhook ready --file --webhook <idOrName>` or the actual push path when validating against the saved inbound policy.
### Error messages reference
| Error message | Meaning | Fix |
|---|---|---|
| `Excel 声明的附件路径在 ZIP 中不存在: <path>` | Cell value references a file not in ZIP | Add the file to ZIP at exactly that path |
| `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>` | ZIP contains a file not referenced by any `[附件]` column | Add an `[附件]` column entry or remove the file from ZIP |
| `单据「X」声明了跨单据或非本单据目录的附件路径: <path>` | Document X declared a path inside another document's folder | Move file into Document X's own folder and update Excel |
| `附件路径「<path>」被重复声明了 N 次` | The same file path was declared in multiple columns/rows/documents | Each declaration must point to a unique file path; duplicate file if needed |
| `Excel 会议编号「X」在 ZIP 中找不到对应的根目录` | No ZIP root dir matches documentId `X` | Rename the ZIP folder to match the documentId |
| `ZIP 根目录对应的编号「X」在信息表中找不到` | ZIP folder has no matching documentId in Excel | Remove the folder or add the document to Excel |
| `ZIP 根目录缺少信息表.xlsx` | No `信息表.xlsx` found at ZIP root | Add the Excel file to the ZIP root |
| `附件文件过小` | Attachment is below the configured minimum byte size | Replace the empty/truncated file or lower `--min-file-size` |
| `附件文件过大` | Attachment exceeds the configured maximum byte size | Replace/compress the file or raise `--max-file-size` |
| `附件后缀不在白名单中` | Attachment extension is not allowed by the Webhook policy | Add the extension with `--allowed-extensions` or convert the file |
| `附件上传失败 <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.
Do not send `scope` or `strictness` when they are unchanged. Fetch the draft again and verify the exact description, scope, strictness, and draft status before publishing.
For a complete local rule-set sync, `rules push` is incremental: it matches pulled rules by stable `id`, updates only changed fields, creates new entries, and removes entries omitted from the local file. It preserves matched rule IDs and does not recode the whole draft. Preview it with `rules push --dry-run` before applying.
Use this reference when the user wants rule counts, compact rule lists, one rule from a historical version, or approval knowledge search without dumping hundreds of rule descriptions.
## Draft and Published Rule Codes
`rules list` and `rules pull` operate on the current draft and therefore return draft `code` values. A published version stores a separate snapshot and may recode the same rules; publishing, deleting, or reordering rules can make those published codes differ or drift again. A code such as `#0038` is only meaningful together with its version context.
Use the draft `id` for current edits and use the approval run's recorded version plus rule text or runtime rule ID for historical investigations. Do not copy a draft code into a report or command that will be interpreted against a published version.
`Rule list is large (${effectiveCount} rules, ${bodyBytes} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`
thrownewPayloadTooLargeError(
`Rule list is large (${effectiveCount} rules, ${bodyBytes} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`,
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.