@@ -5,6 +5,82 @@ All notable changes to `seal-use` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.10] - 2026-09-07
### Changed & Fixed
- **Enterprise Config Resolution Isolation**:
- Removed default loading of `./enterprises` from the current working directory (`cwd`), ensuring local repo files never unintentionally leak or override user enterprise configs.
- Candidate enterprise directories now strictly default to user global configuration directories (`~/.config/seal-use/enterprises`, `~/.config/seal-home/enterprises`) unless an explicit environment variable or test directory is configured.
- **Global Test Enterprises Directory Configuration**:
- Added `testEnterprisesDir` field to `GlobalConfigSchema`.
- Added `seal-use config test-dir [<path>|--clear]` command to safely configure or clear a dedicated test enterprise directory without impacting normal user operations.
- Included `testEnterprisesDir` in global configuration summaries and candidate directory listings.
- Removed mistakenly registered `seal_approval_run_attachments_download` tool definition and aliases from `tools.ts`.
- Decoupled `seal-use approval-runs attachments` (inspection & download) CLI commands to invoke pure domain functions in `src/domains/seal/attachments.ts` directly, bypassing the legacy tool runner.
- Purged obsolete "Fine-Grained Tools" lists from `README.md` and `skills/seal-use/references/cli.md`, reinforcing the CLI-First contract where agents execute `seal-use <command>` directly or via the single `seal_cli` MCP tool.
- **Repository-Wide Dead Code & Unused Export Cleanup**:
- Eliminated duplicate enterprise directory export aliases in `src/core/config/loader.ts`.
- Converted internal helpers in `src/core/embedded-skill.ts`, `src/cli/printer.ts`, `src/cli/commands/auth.ts`, `src/domains/seal/linter/loader.ts`, `src/domains/seal/material-pack/validate.ts`, and `src/core/auth/seal.ts` to private module functions.
## [0.10.8] - 2026-09-04
### Added & Enhanced
- **Approval Run Attachments Extraction Compatibility (Issue #35)**:
- Generalized `extractApprovalRunAttachments` to inspect `document.fields[].type === "ATTACHMENT"` arrays with nested `value[]` collections, properly recognizing HoseCloud/Seal 2026 flattened attachment fields that previously resolved to `count: 0`.
- Extracted comprehensive metadata including `ossSignedUrl`, `token` (automatically parsing embedded `fileId` and object `key`), `ossFileSize`, `mimeType`, and preserved parent field labels as `sourceField`.
- Added `hasSignedUrl` and `ossFileSize` to compact summary outputs without exposing raw signed URLs.
- Prioritizes direct `ossSignedUrl` links from the run record and verifies downloaded file size against `ossFileSize`.
- Automatically sanitizes sensitive temporary signatures in CLI logging (`?[MASKED]`) to prevent credential leakage in build/agent transcripts.
- Implemented graceful error recovery for expired temporary URLs (HTTP 403) or missing links, reporting diagnostics for failed items while allowing valid attachments to complete without interruption.
- Added `seal-use rules pull` (`seal_approval_rules_pull`) to export remote draft or published version rules to a local JSON file (defaults to `./rules.local.json`), eliminating unwanted mutations to remote drafts.
- Added `seal-use rules lint --file <path>` to execute rule quality and execution checks completely offline with zero network requests and zero dirty version records in the remote backend. Supports quality score gates (`--min-score`) and operates seamlessly even without configured enterprise credentials.
- Added `seal-use rules push` (`seal_approval_rules_push`) to apply refined local rules to the remote draft with preview (`--dry-run`), confirmation (`--yes`), and optional single-step formal release publishing (`--publish`).
- **Persistent HTTP Companion Daemon in Background Service**:
- Embedded the HTTP API server into `seal-use service run`, allowing `seal-use service start` to run as a detached background daemon with persistent HTTP service (serving `/docs`, `/openapi.json`, and `POST /api/cli`).
- Added `seal-use service logs` (`--lines <N>`) to easily inspect service background activity.
- Enhanced `seal-use service status` to track active host, port, and URL via daemon metadata state.
- Optimized `parseJsonBody` and CLI runner concurrency with standing command bypasses to prevent process queue blocks.
- Added top-level `seal-use stop` command, intuitive service aliases (`seal-use service kill|down|shutdown`), and `POST /shutdown` HTTP endpoint to gracefully terminate the background daemon from any terminal or script.
## [0.10.6] - 2026-09-03
### Added & Enhanced
- **Inbound Webhook Material Pack Import (Issue #27)**: Added local preview and push workflows for SealAI material packs, including strict ZIP/XLSX validation, normalized approval-document parsing, attachment upload, and HMAC-signed Webhook delivery.
- **CLI and MCP Support**: Added `seal-use webhook material-pack preview|push` and the `seal_webhook_material_pack` tool, while keeping the existing simulation `material_pack` flow separate.
- **Test-Enterprise Verification**: Verified the new push path against the configured test enterprise with official sample materials; customer enterprise data was not used.
## [0.10.5] - 2026-09-03
### Added & Enhanced
- **Intelligent HoseCloud Sync Discovery & Actionable Guidance (Issue #26)**: In `seal-use deploy hosecloud sync` and `deploy hosecloud get`, when `<sign-key>` is omitted, the CLI dynamically discovers all active HoseCloud integration configs for the tenant and renders structured cards on `stderr` with 1-click copy commands (e.g. `👉 同步命令: seal-use deploy hosecloud sync <signKey> --corp <corpId>`).
- **Single-Config Fast Track (`--auto`)**: Added `--auto` (and `--yes`) flag to `deploy hosecloud sync`. When a tenant has exactly one configured HoseCloud integration, `--auto` automatically locks and syncs without requiring manual `signKey` extraction.
- **Enhanced Empty State & Diagnostic Hints**: If a tenant has zero HoseCloud integrations configured, clearly prompts the user with next-step configuration command `seal-use deploy hosecloud configure ...`.
- **Updated Reference Documentation**: Updated `skills/seal-use/references/hose-enterprise-deploy.md` and CLI references with `--auto` and dynamic discovery patterns.
## [0.10.4] - 2026-09-03
### Added & Enhanced
- **Built-in Approval Rule Linter & Quality Validation Engine**: Introduced a pure TypeScript/heuristic rule quality validator (`seal-use rules lint` & `seal_approval_rules_lint`). Detects subjective fuzzy words (`原则上`, `尽量`, `适当`, `酌情`), hanging exception clauses lacking evidence keywords (`除非/特殊情况` 未指明 `备注/附件/截图` 凭证来源), and short invalid descriptions.
- **Fault-Tolerant Automatic Fallback (Anti-Crash Guarantee)**: If a user's custom `.ts` linter file contains syntax errors, throws runtime exceptions, or is missing, the engine automatically catches errors, logs diagnostic warnings to `stderr`, and seamlessly falls back to the built-in heuristic linter without failing or blocking CLI execution.
- **Global Config & Default-Disabled Policy**: Added `lint: { enabled: false, activeLinter: "builtin", minScore: 0 }` to global configuration (`~/.config/seal-use/config.json`). Linter is **disabled by default** to avoid unsolicited noise; can be enabled via `seal-use config lint enable`.
- **Real-time Diagnostic Hook on Rule Updates**: When linting is enabled, `seal_approval_rule_update` automatically inspects modified descriptions and outputs structured warnings on `stderr` while keeping clean machine JSON on `stdout`.
- **Comprehensive Scenarios & Gatekeeping**: `seal-use rules lint` supports full draft scanning, historical version review (`--version <num>`), rule filtering (`--code <code>`), summary mode (`--summary`), and quality gate scoring (`--min-score <score>`) with non-zero exit codes.
- **Dedicated Reference Documentation**: Added `skills/seal-use/references/rule-lint.md` and updated SKILL router.
@@ -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_y}from"node:module";varQy=Object.create;var{getPrototypeOf:Py,defineProperty:O$,getOwnPropertyNames:Fy}=Object;varKy=Object.prototype.hasOwnProperty;functionBy(n){returnthis[n]}varEy,Ty,t0=(n,i,r)=>{varo=n!=null&&typeofn==="object";if(o){vart=i?Ey??=newWeakMap:Ty??=newWeakMap,u=t.get(n);if(u)returnu}r=n!=null?Qy(Py(n)):{};lete=i||!n||!n.__esModule?O$(r,"default",{value:n,enumerable:!0}):r;for(letlofFy(n))if(!Ky.call(e,l))O$(e,l,{get:By.bind(n,l),enumerable:!0});if(o)t.set(n,e);returne};varY=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);varVy=(n)=>n;functionqy(n,i){this[n]=Vy.bind(null,i)}varPi=(n,i)=>{for(varrini)O$(n,r,{get:i[r],enumerable:!0,configurable:!0,set:qy.bind(i,r)})};varr0=_y(import.meta.url);varnu=Y((YD)=>{Object.defineProperty(YD,"__esModule",{value:!0});YD.regexpCode=YD.getEsmExportName=YD.getProperty=YD.safeStringify=YD.stringify=YD.strConcat=YD.addCodeArg=YD.str=YD._=YD.nil=YD._Code=YD.Name=YD.IDENTIFIER=YD._CodeOrName=void0;classTl{}YD._CodeOrName=Tl;YD.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classjrextendsTl{constructor(n){super();if(!YD.IDENTIFIER.test(n))throwError("CodeGen: name must be a valid identifier");this.str=n}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}YD.Name=jr;classfiextendsTl{constructor(n){super();this._items=typeofn==="string"?[n]:n}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;letn=this._items[0];returnn===""||n==='""'}getstr(){varn;return(n=this._str)!==null&&n!==void0?n:this._str=this._items.reduce((i,r)=>`${i}${r}`,"")}getnames(){varn;return(n=this._names)!==null&&n!==void0?n:this._names=this._items.reduce((i,r)=>{if(rinstanceofjr)i[r.str]=(i[r.str]||0)+1;returni},{})}}YD._Code=fi;YD.nil=newfi("");functionXD(n,...i){letr=[n[0]],o=0;while(o<i.length)Qc(r,i[o]),r.push(n[++o]);returnnewfi(r)}YD._=XD;varpc=newfi("+");functionHD(n,...i){letr=[so(n[0])],o=0;while(o<i.length)r.push(pc),Qc(r,i[o]),r.push(pc,so(n[++o]));returnIX(r),newfi(r)}YD.str=HD;functionQc(n,i){if(iinstanceoffi)n.push(...i._items);elseif(iinstanceofjr)n.push(i);elsen.push(wX(i))}YD.addCodeArg=Qc;functionIX(n){leti=1;while(i<n.length-1){if(n[i]===pc){letr=gX(n[i-1],n[i+1]);if(r!==void0){n.splice(i-1,3,r);continue}n[i++]="+"}i++}}functiongX(n,i){if(i==='""')returnn;if(n==='""')returni;if(typeofn=="string"){if(iinstanceofjr||n[n.length-1]!=='"')return;if(typeofi!="string")return`${n.slice(0,-1)}${i}"`;if(i[0]==='"')returnn.slice(0,-1)+i.slice(1);return}if(typeofi=="string"&&i[0]==='"'&&!(ninstanceofjr))return`"${n}${i.slice(1)}`;return}functionbX(n,i){returni.emptyStr()?n:n.emptyStr()?i:HD`${n}${i}`}YD.strConcat=bX;functionwX(n){returntypeofn=="number"||typeofn=="boolean"||n===null?n:so(Array.isArray(n)?n.join(","):n)}functionfX(n){returnnewfi(so(n))}YD.stringify=fX;functionso(n){returnJSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}YD.safeStringify=so;functioncX(n){returntypeofn=="string"&&YD.IDENTIFIER.test(n)?newfi(`.${n}`):XD`[${n}]`}YD.getProperty=cX;functionUX(n){if(typeofn=="string"&&YD.IDENTIFIER.test(n))returnnewfi(`${n}`);throwError(`CodeGen: invalid export name: ${n}, use explicit $id name mapping`)}YD.getEsmExportName=UX;functionDX(n){returnnewfi(n.toString())}YD.regexpCode=DX});varBc=Y((FD)=>{Object.defineProperty(FD,"__esModule",{value:!0});FD.ValueScope=FD.ValueScopeName=FD.Scope=FD.varKinds=FD.UsedValueState=void0;varan=nu();classQDextendsError{constructor(n){super(`CodeGen: "code" for ${n} not defined`);this.value=n.value}}varql;(function(n){n[n.Started=0]="Started",n[n.Completed=1]="Completed"})(ql||(FD.UsedValueState=ql={}));FD.varKinds={const:newan.Name("const"),let:newan.Name("let"),var:newan.Name("var")};classFc{constructor({prefixes:n,parent:i}={}){this._names={},this._prefixes=n,this._parent=i}toName(n){returnninstanceofan.Name?n:this.name(n)}name(n){returnnewan.Name(this._newName(n))}_newName(n){leti=this._names[n]||this._nameGroup(n);return`${n}${i.index++}`}_nameGroup(n){vari,r;if(((r=(i=this._parent)===null||i===void0?void0:i._prefixes)===null||r===void0?void0:r.has(n))||this._prefixes&&!this._prefixes.has(n))throwError(`CodeGen: prefix "${n}" is not allowed in this scope`);returnthis._names[n]={prefix:n,index:0}}}FD.Scope=Fc;classKcextendsan.Name{constructor(n,i){super(i);this.prefix=n}setValue(n,{property:i,itemIndex:r}){this.value=n,this.scopePath=an._`.${newan.Name(i)}[${r}]`}}FD.ValueScopeName=Kc;varXX=an._`\n`;classPDextendsFc{constructor(n){super(n);this._values={},this._scope=n.scope,this.opts={...n,_n:n.lines?XX:an.nil}}get(){returnthis._scope}name(n){returnnewKc(n,this._newName(n))}value(n,i){varr;if(i.ref===void0)throwError("CodeGen: ref must be passed in value");leto=this.toName(n),{prefix:t}=o,u=(r=i.key)!==null&&r!==void0?r:i.ref,e=this._values[t];if(e){letI=e.get(u);if(I)returnI}elsee=this._values[t]=newLine truncated
`:""},this._extScope=n,this._scope=new ci.Scope({parent:n}),this._nodes=[new ZD]}toString(){return this._root.render(this.opts)}name(n){return this._scope.name(n)}scopeName(n){return this._extScope.name(n)}scopeValue(n,i){let r=this._extScope.value(n,i);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(n,i){return this._extScope.getValue(n,i)}scopeRefs(n){return this._extScope.scopeRefs(n,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(n,i,r,o){let t=this._scope.toName(i);if(r!==void 0&&o)this._constants[t.str]=r;return this._leafNode(new BD(n,t,r)),t}const(n,i,r){return this._def(ci.varKinds.const,n,i,r)}let(n,i,r){return this._def(ci.varKinds.let,n,i,r)}var(n,i,r){return this._def(ci.varKinds.var,n,i,r)}assign(n,i,r){return this._leafNode(new Vc(n,i,r))}add(n,i){return this._leafNode(new ED(n,sn.operators.ADD,i))}code(n){if(typeof n=="function")n();else if(n!==s.nil)this._leafNode(new _D(n));return this}object(...n){let i=["{"];for(let[r,o]of n){if(i.length>1)i.push(",");if(i.push(r),r!==o||this.opts.es5)i.push(":"),(0,s.addCodeArg)(i,o)}return i.push("}"),new s._Code(i)}if(n,i,r){if(this._blockNode(new Ti(n)),i&&r)this.code(i).else().code(r).endIf();else if(i)this.code(i).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(n){return this._elseNode(new Ti(n))}else(){return this._elseNode(new iu)}endIf(){return this._endBlockNode(Ti,iu)}_for(n,i){if(this._blockNode(n),i)this.code(i).endFor();return this}for(n,i){return this._for(new MD(n),i)}forRange(n,i,r,o,t=this.opts.es5?ci.varKinds.var:ci.varKinds.let){let u=this._scope.toName(n);return this._for(new zD(t,u,i,r),()=>o(u))}forOf(n,i,r,o=ci.varKinds.const){let t=this._scope.toName(n);if(this.opts.es5){let u=i instanceof s.Name?i:this.var("_arr",i);return this.forRange("_i",0,s._`${u}.length`,(e)=>{this.var(t,s._`${u}[${e}]`),r(t)})}return this._for(new Ec("of",o,t,i),()=>r(t))}forIn(n,i,r,o=this.opts.es5?ci.varKinds.var:ci.varKinds.const){if(this.opts.ownProperties)return this.forOf(n,s._`Object.keys(${i})`,r);let t=this._scope.toName(n);return this._for(new Ec("in",o,t,i),()=>r(t))}endFor(){return this._endBlockNode(Jr)}label(n){return this._leafNode(new TD(n))}break(n){return this._leafNode(new VD(n))}return(n){let i=new Zl;if(this._blockNode(i),this.code(n),i.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Zl)}try(n,i,r){if(!i&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new CD;if(this._blockNode(o),this.code(n),i){let t=this.name("e");this._currNode=o.catch=new Ml(t),i(t)}if(r)this._currNode=o.finally=new zl,this.code(r);return this._endBlockNode(Ml,zl)}throw(n){return this._leafNode(new qD(n))}block(n,i){if(this._blockStarts.push(this._nodes.length),n)this.code(n).endBlock(i);return this}endBlock(n){let i=this._blockStarts.pop();if(i===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-i;if(r<0||n!==void 0&&r!==n)throw Error(`CodeGen:wrongnumberofnodes:${r}vs${n}expected`);return this._nodes.length=i,this}func(n,i=s.nil,r,o){if(this._blockNode(new _l(n,i,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(_l)}optimize(n=1){while(n-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(n){return this._currNode.nodes.push(n),this}_blockNode(n){this._currNode.nodes.push(n),this._nodes.push(n)}_endBlockNode(n,i){let r=this._currNode;if(r instanceof n||i&&r instanceof i)return this._nodes.pop(),this;throw Error(`CodeGen:notinblock"${i?`${n.kind}/${i.kind}`:n.kind}"`)}_elseNode(n){let i=this._currNode;if(!(i instanceof Ti))throw Error('CodeGen: "else" without "if"');return this._currNode=i.else=n,this}get _root(){return this._nodes[0]}get _currNode(){let n=this._nodes;return n[n.length-1]}set _currNode(n){let i=this._nodes;i[i.length-1]=n}}sn.CodeGen=RD;function Xt(n,i){for(let r in i)n[r]=(n[r]||0)+(i[r]||0);return n}function Cl(n,i){return i instanceof s._CodeOrName?Xt(n,i.names):n}function Xr(n,i,r){if(n instanceof s.Name)return o(n);if(!t(n))return n;return new s._Code(n._items.reduce((u,e)=>{if(e instanceof s.Name)e=o(e);if(e instanceof s._Code)u.push(...e._items);else u.push(e);return u},[]));function o(u){let e=r[u.str];if(e===void 0||i[u.str]!==1)return u;return delete i[u.str],e}function t(u){return u instanceof s._Code&&u._items.some((e)=>e instanceof s.Name&&i[e.str]===1&&r[e.str]!==void 0)}}function QX(n,i){for(let r in i)n[r]=(n[r]||0)-(i[r]||0)}function hD(n){return typeof n=="boolean"||typeof n=="number"||n===null?!n:s._`!${Tc(n)}`}sn.not=hD;var PX=mD(sn.operators.AND);function FX(...n){return n.reduce(PX)}sn.and=FX;var KX=mD(sn.operators.OR);function BX(...n){return n.reduce(KX)}sn.or=BX;function mD(n){return(i,r)=>i===s.nil?r:r===s.nil?i:s._`${Tc(i)}${n}${Tc(r)}`}function Tc(n){return n instanceof s.Name?n:s._`(${n})`}});var tn=Y((u1)=>{Object
Line truncated
deps:${r}}`};var K7={keyword:"dependencies",type:"object",schemaType:"object",error:xA.error,code(n){let[i,r]=B7(n);hA(n,i),mA(n,r)}};function B7({schema:n}){let i={},r={};for(let o in n){if(o==="__proto__")continue;let t=Array.isArray(n[o])?i:r;t[o]=n[o]}return[i,r]}function hA(n,i=n.schema){let{gen:r,data:o,it:t}=n;if(Object.keys(i).length===0)return;let u=r.let("missing");for(let e in i){let l=i[e];if(l.length===0)continue;let $=(0,Au.propertyInData)(r,o,e,t.opts.ownProperties);if(n.setParams({property:e,depsCount:l.length,deps:l.join(", ")}),t.allErrors)r.if($,()=>{for(let I of l)(0,Au.checkReportMissingProp)(n,I)});else r.if(k6._`${$}&&(${(0,Au.checkMissingProp)(n,l,u)})`),(0,Au.reportMissingProp)(n,u),r.else()}}xA.validatePropertyDeps=hA;function mA(n,i=n.schema){let{gen:r,data:o,keyword:t,it:u}=n,e=r.name("valid");for(let l in i){if((0,F7.alwaysValidSchema)(u,i[l]))continue;r.if((0,Au.propertyInData)(r,o,l,u.opts.ownProperties),()=>{let $=n.subschema({keyword:t,schemaProp:l},e);n.mergeValidEvaluated($,e)},()=>r.var(e,!0)),n.ok(e)}}xA.validateSchemaDeps=mA;xA.default=K7});var rO=Y((tO)=>{Object.defineProperty(tO,"__esModule",{value:!0});var iO=R(),V7=tn(),q7={message:"property name must be valid",params:({params:n})=>iO._`{propertyName:${n.propertyName}}`},_7={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:q7,code(n){let{gen:i,schema:r,data:o,it:t}=n;if((0,V7.alwaysValidSchema)(t,r))return;let u=i.name("valid");i.forIn("key",o,(e)=>{n.setParams({propertyName:e}),n.subschema({keyword:"propertyNames",data:e,dataTypes:["string"],propertyName:e,compositeRule:!0},u),i.if((0,iO.not)(u),()=>{if(n.error(!0),!t.allErrors)i.break()})}),n.ok(u)}};tO.default=_7});var N6=Y((oO)=>{Object.defineProperty(oO,"__esModule",{value:!0});var cv=Ii(),Si=R(),M7=Vi(),Uv=tn(),z7={message:"must NOT have additional properties",params:({params:n})=>Si._`{additionalProperty:${n.additionalProperty}}`},C7={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:z7,code(n){let{gen:i,schema:r,parentSchema:o,data:t,errsCount:u,it:e}=n;if(!u)throw Error("ajv implementation error");let{allErrors:l,opts:$}=e;if(e.props=!0,$.removeAdditional!=="all"&&(0,Uv.alwaysValidSchema)(e,r))return;let I=(0,cv.allSchemaProperties)(o.properties),g=(0,cv.allSchemaProperties)(o.patternProperties);b(),n.ok(Si._`${u}===${M7.default.errors}`);function b(){i.forIn("key",t,(d)=>{if(!I.length&&!g.length)c(d);else i.if(w(d),()=>c(d))})}function w(d){let k;if(I.length>8){let P=(0,Uv.schemaRefOrVal)(e,o.properties,"properties");k=(0,cv.isOwnProperty)(i,P,d)}else if(I.length)k=(0,Si.or)(...I.map((P)=>Si._`${d}===${P}`));else k=Si.nil;if(g.length)k=(0,Si.or)(k,...g.map((P)=>Si._`${(0,cv.usePattern)(n,P)}.test(${d})`));return(0,Si.not)(k)}function f(d){i.code(Si._`delete${t}[${d}]`)}function c(d){if($.removeAdditional==="all"||$.removeAdditional&&r===!1){f(d);return}if(r===!1){if(n.setParams({additionalProperty:d}),n.error(),!l)i.break();return}if(typeof r=="object"&&!(0,Uv.alwaysValidSchema)(e,r)){let k=i.name("valid");if($.removeAdditional==="failing")S(d,k,!1),i.if((0,Si.not)(k),()=>{n.reset(),f(d)});else if(S(d,k),!l)i.if((0,Si.not)(k),()=>i.break())}}function S(d,k,P){let Q={keyword:"additionalProperties",dataProp:d,dataPropType:Uv.Type.Str};if(P===!1)Object.assign(Q,{compositeRule:!0,createErrors:!1,allErrors:!1});n.subschema(Q,k)}}};oO.default=C7});var vO=Y((lO)=>{Object.defineProperty(lO,"__esModule",{value:!0});var h7=lu(),uO=Ii(),L6=tn(),eO=N6(),m7={keyword:"properties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,parentSchema:o,data:t,it:u}=n;if(u.opts.removeAdditional==="all"&&o.additionalProperties===void 0)eO.default.code(new h7.KeywordCxt(u,eO.default,"additionalProperties"));let e=(0,uO.allSchemaProperties)(r);for(let b of e)u.definedProperties.add(b);if(u.opts.unevaluated&&e.length&&u.props!==!0)u.props=L6.mergeEvaluated.props(i,(0,L6.toHash)(e),u.props);let l=e.filter((b)=>!(0,L6.alwaysValidSchema)(u,r[b]));if(l.length===0)return;let $=i.name("valid");for(let b of l){if(I(b))g(b);else{if(i.if((0,uO.propertyInData)(i,t,b,u.opts.ownProperties)),g(b),!u.allErrors)i.else().var($,!0);i.endIf()}n.it.definedProperties.add(b),n.ok($)}function I(b){return u.opts.useDefaults&&!u.compositeRule&&r[b].default!==void 0}function g(b){n.subschema({keyword:"properties",schemaProp:b,dataProp:b},$)}}};lO.default=m7});var wO=Y((bO)=>{Object.defineProperty(bO,"__esModule",{value:!0});var $O=Ii(),Dv=R(),IO=tn(),gO=tn(),a7={keyword:"patternProperties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,data:o,parentSchema:t,it:u}=n,{opts:e}=u,l=(0,$O.allSchemaProperties)(r),$=l.filter((S)=>(0,IO.alwaysValidSchema)(u,r[S]));if(l.length===0||$.length===l.length&&(!u.opts.unevaluated||u.props===!0))return;let I=e.strictSchema&&!e.allowMatchingProperties&&t.properties,g=i.name("valid");if(u.props!==!0&&!(u.props instanceof Dv.Name))u.props=(0,gO.
Line truncated
`).filter((u)=>u),o=Math.min(...r.map((u)=>u.length-u.trimStart().length)),t=r.map((u)=>u.slice(o)).map((u)=>" ".repeat(this.indent*2)+u);for(let u of t)this.content.push(u)}compile(){let n=Function,i=this?.args,o=[...(this?.content??[""]).map((t)=>`${t}`)];return new n(...i,o.join(`
`))}}var jI={major:4,minor:4,patch:3};var E=U("$ZodType",(n,i)=>{var r;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=jI;let o=[...n._zod.def.checks??[]];if(n._zod.traits.has("$ZodCheck"))o.unshift(n);for(let t of o)for(let u of t._zod.onattach)u(n);if(o.length===0)(r=n._zod).deferred??(r.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let t=(e,l,$)=>{let I=ai(e),g;for(let b of l){if(b._zod.def.when){if(Y$(e))continue;if(!b._zod.def.when(e))continue}else if(I)continue;let w=e.issues.length,f=b._zod.check(e);if(f instanceof Promise&&$?.async===!1)throw new Li;if(g||f instanceof Promise)g=(g??Promise.resolve()).then(async()=>{if(await f,e.issues.length===w)return;if(!I)I=ai(e,w)});else{if(e.issues.length===w)continue;if(!I)I=ai(e,w)}}if(g)return g.then(()=>{return e});return e},u=(e,l,$)=>{if(ai(e))return e.aborted=!0,e;let I=t(l,o,$);if(I instanceof Promise){if($.async===!1)throw new Li;return I.then((g)=>n._zod.parse(g,$))}return n._zod.parse(I,$)};n._zod.run=(e,l)=>{if(l.skipChecks)return n._zod.parse(e,l);if(l.direction==="backward"){let I=n._zod.parse({value:e.value,issues:[]},{...l,skipChecks:!0});if(I instanceof Promise)return I.then((g)=>{return u(g,e,l)});return u(I,e,l)}let $=n._zod.parse(e,l);if($ instanceof Promise){if(l.async===!1)throw new Li;return $.then((I)=>t(I,o,l))}return t($,o,l)}}h(n,"~standard",()=>({validate:(t)=>{try{let u=xt(n,t);return u.success?{value:u.data}:{issues:u.error?.issues}}catch(u){return bo(n,t).then((e)=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),yt=U("$ZodString",(n,i)=>{E.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??tI(n._zod.bag),n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=String(r.value)}catch(t){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),$n=U("$ZodStringFormat",(n,i)=>{st.init(n,i),yt.init(n,i)}),XI=U("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=q$),$n.init(n,i)}),HI=U("$ZodUUID",(n,i)=>{if(i.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(o===void 0)throw Error(`InvalidUUIDversion:"${i.version}"`);i.pattern??(i.pattern=Lt(o))}else i.pattern??(i.pattern=Lt());$n.init(n,i)}),YI=U("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=_$),$n.init(n,i)}),pI=U("$ZodURL",(n,i)=>{$n.init(n,i),n._zod.check=(r)=>{try{let o=r.value.trim();if(!i.normalize&&i.protocol?.source===x$.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:n,continue:!i.abort});return}}let t=new URL(o);if(i.hostname){if(i.hostname.lastIndex=0,!i.hostname.test(t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:r.value,inst:n,continue:!i.abort})}if(i.protocol){if(i.protocol.lastIndex=0,!i.protocol.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:r.value,inst:n,continue:!i.abort})}if(i.normalize)r.value=t.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:n,continue:!i.abort})}}}),QI=U("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=Z$()),$n.init(n,i)}),PI=U("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=T$),$n.init(n,i)}),FI=U("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=P$),$n.init(n,i)}),KI=U("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=F$),$n.init(n,i)}),BI=U("$ZodULID",(n,i)=>{i.pattern??(i.pattern=K$),$n.init(n,i)}),EI=U("$ZodXID",(n,i)=>{i.pattern??(i.pattern=B$),$n.init(n,i)}),TI=U("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=E$),$n.init(n,i)}),VI=U("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=iI(i)),$n.init(n,i)}),qI=U("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=s$),$n.init(n,i)}),_I=U("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=nI(i)),$n.init(n,i)}),ZI=U("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=V$),$n.init(n,i)}),MI=U("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=M$),$n.init(n,i),n._zod.bag.format="ipv4"}),zI=U("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=z$),$n.init(n,i),n._zod.bag.format="ipv6",n._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:n,continue:!i.abort})}}}),CI=U("$ZodMAC",(n,i)=>{i.pattern??(i.pattern=C$(i.delimiter)),$n.init(n,i),n._zod.bag.format="mac"}),RI=U("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=R$),$n.init(n,i)}),hI=U("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=h$),$n.init(n,i),n._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[t,u]=o;if(!u)throw Error();let e=Number(u);if(`${e}`!==u)throw Error();if(e<0||e>128)throw Error();new URL(`http://[${t}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:n,continue:!i.abort})}}});function mI(n){if(n==="")return!0;if(/\s/.test(n))return!1;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}var
Line truncated
import{createRequireasVD0}from"node:module";varUD0=Object.create;var{getPrototypeOf:YD0,defineProperty:SL,getOwnPropertyNames:JD0}=Object;varQD0=Object.prototype.hasOwnProperty;functionKD0($){returnthis[$]}varzD0,wD0,hY=($,q,I)=>{varU=$!=null&&typeof$==="object";if(U){varY=q?zD0??=newWeakMap:wD0??=newWeakMap,J=Y.get($);if(J)returnJ}I=$!=null?UD0(YD0($)):{};letQ=q||!$||!$.__esModule?SL(I,"default",{value:$,enumerable:!0}):I;for(letKofJD0($))if(!QD0.call(Q,K))SL(Q,K,{get:KD0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varO=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);varGD0=($)=>$;functionHD0($,q){this[$]=GD0.bind(null,q)}varl8=($,q)=>{for(varIinq)SL($,I,{get:q[I],enumerable:!0,configurable:!0,set:HD0.bind(q,I)})};varo=VD0(import.meta.url);var_J=O((pf)=>{Object.defineProperty(pf,"__esModule",{value:!0});pf.regexpCode=pf.getEsmExportName=pf.getProperty=pf.safeStringify=pf.stringify=pf.strConcat=pf.addCodeArg=pf.str=pf._=pf.nil=pf._Code=pf.Name=pf.IDENTIFIER=pf._CodeOrName=void0;classhG{}pf._CodeOrName=hG;pf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classmqextendshG{constructor($){super();if(!pf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}pf.Name=mq;classx$extendshG{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((q,I)=>`${q}${I}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((q,I)=>{if(Iinstanceofmq)q[I.str]=(q[I.str]||0)+1;returnq},{})}}pf._Code=x$;pf.nil=newx$("");functionnf($,...q){letI=[$[0]],U=0;while(U<q.length)mP(I,q[U]),I.push($[++U]);returnnewx$(I)}pf._=nf;varlP=newx$("+");functionbf($,...q){letI=[CJ($[0])],U=0;while(U<q.length)I.push(lP),mP(I,q[U]),I.push(lP,CJ($[++U]));returnhF0(I),newx$(I)}pf.str=bf;functionmP($,q){if(qinstanceofx$)$.push(...q._items);elseif(qinstanceofmq)$.push(q);else$.push(uF0(q))}pf.addCodeArg=mP;functionhF0($){letq=1;while(q<$.length-1){if($[q]===lP){letI=SF0($[q-1],$[q+1]);if(I!==void0){$.splice(q-1,3,I);continue}$[q++]="+"}q++}}functionSF0($,q){if(q==='""')return$;if($==='""')returnq;if(typeof$=="string"){if(qinstanceofmq||$[$.length-1]!=='"')return;if(typeofq!="string")return`${$.slice(0,-1)}${q}"`;if(q[0]==='"')return$.slice(0,-1)+q.slice(1);return}if(typeofq=="string"&&q[0]==='"'&&!($instanceofmq))return`"${$}${q.slice(1)}`;return}functionyF0($,q){returnq.emptyStr()?$:$.emptyStr()?q:bf`${$}${q}`}pf.strConcat=yF0;functionuF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:CJ(Array.isArray($)?$.join(","):$)}functionxF0($){returnnewx$(CJ($))}pf.stringify=xF0;functionCJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}pf.safeStringify=CJ;functionkF0($){returntypeof$=="string"&&pf.IDENTIFIER.test($)?newx$(`.${$}`):nf`[${$}]`}pf.getProperty=kF0;functionfF0($){if(typeof$=="string"&&pf.IDENTIFIER.test($))returnnewx$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}pf.getEsmExportName=fF0;functionnF0($){returnnewx$($.toString())}pf.regexpCode=nF0});varaP=O((mf)=>{Object.defineProperty(mf,"__esModule",{value:!0});mf.ValueScope=mf.ValueScopeName=mf.Scope=mf.varKinds=mf.UsedValueState=void0;vark6=_J();classdfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varyG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(yG||(mf.UsedValueState=yG={}));mf.varKinds={const:newk6.Name("const"),let:newk6.Name("let"),var:newk6.Name("var")};classrP{constructor({prefixes:$,parent:q}={}){this._names={},this._prefixes=$,this._parent=q}toName($){return$instanceofk6.Name?$:this.name($)}name($){returnnewk6.Name(this._newName($))}_newName($){letq=this._names[$]||this._nameGroup($);return`${$}${q.index++}`}_nameGroup($){varq,I;if(((I=(q=this._parent)===null||q===void0?void0:q._prefixes)===null||I===void0?void0:I.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}mf.Scope=rP;classtPextendsk6.Name{constructor($,q){super(q);this.prefix=$}setValue($,{property:q,itemIndex:I}){this.value=$,this.scopePath=k6._`.${newk6.Name(q)}[${I}]`}}mf.ValueScopeName=tP;vareF0=k6._`\n`;classlfextendsrP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?eF0:k6.nil}}get(){returnthis._scope}name($){returnnewtP($,this._newName($))}value($,q){varI;if(q.ref===void0)throwError("CodeGen: ref must be passed in value");letU=this.toName($),{prefix:Y}=U,J=(I=q.key)!==null&&I!==void0?I:q.ref,Q=this._values[Y];if(Q){letw=Q.get(J);if(Line truncated
deps:${I}}`};var Qj0={keyword:"dependencies",type:"object",schemaType:"object",error:wp.error,code($){let[q,I]=Kj0($);Kp($,q),zp($,I)}};function Kj0({schema:$}){let q={},I={};for(let U in $){if(U==="__proto__")continue;let Y=Array.isArray($[U])?q:I;Y[U]=$[U]}return[q,I]}function Kp($,q=$.schema){let{gen:I,data:U,it:Y}=$;if(Object.keys(q).length===0)return;let J=I.let("missing");for(let Q in q){let K=q[Q];if(K.length===0)continue;let z=(0,aJ.propertyInData)(I,U,Q,Y.opts.ownProperties);if($.setParams({property:Q,depsCount:K.length,deps:K.join(", ")}),Y.allErrors)I.if(z,()=>{for(let w of K)(0,aJ.checkReportMissingProp)($,w)});else I.if(yT._`${z}&&(${(0,aJ.checkMissingProp)($,K,J)})`),(0,aJ.reportMissingProp)($,J),I.else()}}wp.validatePropertyDeps=Kp;function zp($,q=$.schema){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");for(let K in q){if((0,Jj0.alwaysValidSchema)(J,q[K]))continue;I.if((0,aJ.propertyInData)(I,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>I.var(Q,!0)),$.ok(Q)}}wp.validateSchemaDeps=zp;wp.default=Qj0});var Xp=O((Zp)=>{Object.defineProperty(Zp,"__esModule",{value:!0});var Wp=m0(),Gj0=z1(),Hj0={message:"property name must be valid",params:({params:$})=>Wp._`{propertyName:${$.propertyName}}`},Vj0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Hj0,code($){let{gen:q,schema:I,data:U,it:Y}=$;if((0,Gj0.alwaysValidSchema)(Y,I))return;let J=q.name("valid");q.forIn("key",U,(Q)=>{$.setParams({propertyName:Q}),$.subschema({keyword:"propertyNames",data:Q,dataTypes:["string"],propertyName:Q,compositeRule:!0},J),q.if((0,Wp.not)(J),()=>{if($.error(!0),!Y.allErrors)q.break()})}),$.ok(J)}};Zp.default=Vj0});var uT=O((Dp)=>{Object.defineProperty(Dp,"__esModule",{value:!0});var zH=O$(),b$=m0(),Zj0=s8(),wH=z1(),Xj0={message:"must NOT have additional properties",params:({params:$})=>b$._`{additionalProperty:${$.additionalProperty}}`},Dj0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Xj0,code($){let{gen:q,schema:I,parentSchema:U,data:Y,errsCount:J,it:Q}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:z}=Q;if(Q.props=!0,z.removeAdditional!=="all"&&(0,wH.alwaysValidSchema)(Q,I))return;let w=(0,zH.allSchemaProperties)(U.properties),G=(0,zH.allSchemaProperties)(U.patternProperties);H(),$.ok(b$._`${J}===${Zj0.default.errors}`);function H(){q.forIn("key",Y,(L)=>{if(!w.length&&!G.length)X(L);else q.if(V(L),()=>X(L))})}function V(L){let N;if(w.length>8){let E=(0,wH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,zH.isOwnProperty)(q,E,L)}else if(w.length)N=(0,b$.or)(...w.map((E)=>b$._`${L}===${E}`));else N=b$.nil;if(G.length)N=(0,b$.or)(N,...G.map((E)=>b$._`${(0,zH.usePattern)($,E)}.test(${L})`));return(0,b$.not)(N)}function W(L){q.code(b$._`delete${Y}[${L}]`)}function X(L){if(z.removeAdditional==="all"||z.removeAdditional&&I===!1){W(L);return}if(I===!1){if($.setParams({additionalProperty:L}),$.error(),!K)q.break();return}if(typeof I=="object"&&!(0,wH.alwaysValidSchema)(Q,I)){let N=q.name("valid");if(z.removeAdditional==="failing")D(L,N,!1),q.if((0,b$.not)(N),()=>{$.reset(),W(L)});else if(D(L,N),!K)q.if((0,b$.not)(N),()=>q.break())}}function D(L,N,E){let T={keyword:"additionalProperties",dataProp:L,dataPropType:wH.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,N)}}};Dp.default=Dj0});var Fp=O((Np)=>{Object.defineProperty(Np,"__esModule",{value:!0});var Oj0=fJ(),Lp=O$(),xT=z1(),Op=uT(),Nj0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,parentSchema:U,data:Y,it:J}=$;if(J.opts.removeAdditional==="all"&&U.additionalProperties===void 0)Op.default.code(new Oj0.KeywordCxt(J,Op.default,"additionalProperties"));let Q=(0,Lp.allSchemaProperties)(I);for(let H of Q)J.definedProperties.add(H);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=xT.mergeEvaluated.props(q,(0,xT.toHash)(Q),J.props);let K=Q.filter((H)=>!(0,xT.alwaysValidSchema)(J,I[H]));if(K.length===0)return;let z=q.name("valid");for(let H of K){if(w(H))G(H);else{if(q.if((0,Lp.propertyInData)(q,Y,H,J.opts.ownProperties)),G(H),!J.allErrors)q.else().var(z,!0);q.endIf()}$.it.definedProperties.add(H),$.ok(z)}function w(H){return J.opts.useDefaults&&!J.compositeRule&&I[H].default!==void 0}function G(H){$.subschema({keyword:"properties",schemaProp:H,dataProp:H},z)}}};Np.default=Nj0});var Ep=O((Tp)=>{Object.defineProperty(Tp,"__esModule",{value:!0});var Mp=O$(),GH=m0(),Ap=z1(),Pp=z1(),Mj0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Mp.allSchemaProperties)(I),z=K.filter((D)=>(0,Ap.alwaysValidSchema)(J,I[D]));if(K.length===0||z.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let w=Q.strictSchema&&!Q.allowMatchingProperties&&Y.properties,G=q.name("valid");if(J.props!==!0&&!(J.props instanceo
Line truncated
`)}openNode($,q){let I=this.tos,U=this._xml;if(I&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),qR(U,q),this.leaf=!0,this.open=!0}addAttribute($,q){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(q!==void 0)u00(this._xml,$,q)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");qR(this._xml,$)}writeText($){let q=this._xml;if(this.open)q.push(">"),this.open=!1;this.leaf=!1,q.push(y00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),q=this._xml;if(this.leaf)q.push("/>");else q.push("</"),q.push($),q.push(">");this.open=!1,this.leaf=!1}leafNode($,q,I){if(this.openNode($,q),I!==void 0)this.writeText(I);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}IR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};x00.exports=IR});var UR=O((Di0)=>{var k00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Xi0($){if(typeof $==="string")return $;if(k00)return k00.decode($);return $.toString()}Di0.bufferToString=Xi0});var p00=O((n00)=>{Object.defineProperty(n00,"__esModule",{value:!0});n00.CHAR=`
`,$=this.i;break;case up0:{let{entityReturnState:I}=this,U=this.entity+q.slice($,this.prevI);this.state=I;let Y;if(U==="")this.fail("empty entity name."),Y="&;";else Y=this.parseEntity(U),this.entity="";if(I!==v6||this.textHandler!==void 0)this.text+=Y;break $}case Y4:this.entity+=q.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(O2($))this.state=Cp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case SW:this.state=Sp0,this.xmlDeclPossible=!1;break;case V10:this.state=Mp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=gp0;break;default:this.fail("disallowed character in tag name"),this.state=v6,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=WR,this.openWakaBang="";break;case"--":this.state=VR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=wR,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(hW))this.state=Ap0}sCommentEnding(){var $;let q=this.getCodeNorm();if(q===hW)this.state=Pp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(q)}`,this.state=VR}sCommentEnded(){let $=this.getCodeNorm();if($!==S4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=VR;else this.state=v6}sCData(){if(this.captureToChar(UU))this.state=Tp0}sCDataEnding(){let $=this.getCodeNorm();if($===UU)this.state=Ep0;else this.text+=`]${String.fromCodePoint($)}`,this.state=WR}sCDataEnding2(){var $;let q=this.getCodeNorm();switch(q){case S4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=v6;break}case UU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(q)}`,this.state=WR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J10;else if($===I6||d6($))this.fail("processing instruction without a target."),this.state=$===I6?_W:ZR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J10}sPIRest(){let{chunk:$,i:q}=this;while(!0){let I=this.getCodeNorm();if(I===Y4){this.piTarget+=$.slice(q);return}if(!this.nameCheck(I)){this.piTarget+=$.slice(q,this.prevI);let U=I===I6;if(U||d6(I))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?w3:Q10}else this.state=U?_W:ZR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(I);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===I6)this.state=_W;else if(!d6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=_W}sPIEnding(){var $;let q=this.getCodeNorm();if(q===S4){let{piTarget:I}=this;if(I.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:I,body:this.text}),this.piTarget=this.text="",this.state=v6}else if(q===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(q)}`,this.state=ZR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=w3;return}if($!==Y4)this.state=jp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(fp0);if($===I6){this.state=w3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(d6($)||$===IU))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===IU?K10:Bp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=w3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if($!==IU)this.fail("value required.");this.state=K10}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=w3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if(!yW($))this.fail("value must be quoted."),this.q=H10;else this.q=$;this.state=Rp0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=w3,this.text="",this.fail("XML declaration is incomplete.");return}if($===Y4)return;let q=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let I=q;if(this.xmlDecl.version=I,!/^1\.[0-9]+$/.test(I))this.fail("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new y4($,q).found}function y4($,q){if(!$)throw Error("must provide pattern");if(typeof q==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+e[w0-1];break}}}var q1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+c;R._warn(q1,!0,F)}}function v0(r,F){var M=r+" is deprecated and will be removed in a future version.";if(F)M+=" Use "+F+" instead.";return R1(M)}function R1(r,F,M){if(!P0.warnings)return;var R=new Y(r),y;if(F)M._attachExtraTrace(R);else if(P0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(R);else{var s=J4(R);R.stack=s.message+`
`)));return}}N=N._target();var E=N._bitField;if((E&50397184)===0)this._yieldedPromise=N,N._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,N._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,N._reason());else this._promiseCancelled()}},$.coroutine=function(X,D){if(typeof X!=="function")throw new K(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var L=Object(D).yieldHandler,N=W,E=Error().stack;return function(){var T=X.apply(this,arguments),P=new N(void 0,void 0,L,E),B=P.promise();return P._generator=T,P._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+z.classString(X));H.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return q(`generatorFunctionmustbeafunction
`)},q=function(){return new C.PromiseInspection(this._target())},I=function(g){return C.reject(new H(g))};function U(){}var Y={},J=n1(),Q;if(J.isNode)Q=function(){var g=process.domain;if(g===void 0)g=null;return g};else Q=function(){return null};J.notEnumerableProp(C,"_getDomain",Q);var K=i3(),z=EK0(),w=new z;K.defineProperty(C,"_async",{value:w});var G=h5(),H=C.TypeError=G.TypeError;C.RangeError=G.RangeError;var V=C.CancellationError=G.CancellationError;C.TimeoutError=G.TimeoutError,C.OperationalError=G.OperationalError,C.RejectionError=G.OperationalError,C.AggregateError=G.AggregateError;var W=function(){},X={},D={},L=vK0()(C,W),N=_K0()(C,W,L,I,U),E=SK0()(C),T=E.create,P=uK0()(C,E),B=P.CapturedTrace,k=kK0()(C,L),h=nK0()(D),f=FS(),S=J.errorObj,t=J.tryCatch;function p(g,u){if(typeof u!=="function")throw new H("expecting a function but got "+J.classString(u));if(g.constructor!==C)throw new H(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function C(g){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,g!==W)p(this,g),this._resolveFromExecutor(g);this._promiseCreated(),this._fireEvent("promiseCreated",this)}C.prototype.toString=function(){return"[object Promise]"},C.prototype.caught=C.prototype.catch=function(g){var u=arguments.length;if(u>1){var d=Array(u-1),a=0,K0;for(K0=0;K0<u-1;++K0){var G0=arguments[K0];if(J.isObject(G0))d[a++]=G0;else return I("expecting an object but got A catch statement predicate "+J.classString(G0))}return d.length=a,g=arguments[K0],this.then(void 0,h(d,g,this))}return this.then(void 0,g)},C.prototype.reflect=function(){return this._then(q,q,void 0,this,void 0)},C.prototype.then=function(g,u){if(P.warnings()&&arguments.length>0&&typeof g!=="function"&&typeof u!=="function"){var d=".then() only accepts functions but was passed: "+J.classString(g);if(arguments.length>1)d+=", "+J.classString(u);this._warn(d)}return this._then(g,u,void 0,void 0,void 0)},C.prototype.done=function(g,u){var d=this._then(g,u,void 0,void 0,void 0);d._setIsFinal()},C.prototype.spread=function(g){if(typeof g!=="function")return I("expecting a function but got "+J.classString(g));return this.all()._then(g,void 0,void 0,X,void 0)},C.prototype.toJSON=function(){var g={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())g.fulfillmentValue=this.value(),g.isFulfilled=!0;else if(this.isRejected())g.rejectionReason=this.reason(),g.isRejected=!0;return g},C.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new N(this).promise()},C.prototype.error=function(g){return this.caught(J.originatesFromRejection,g)},C.getNewLibraryCopy=AS.exports,C.is=function(g){return g instanceof C},C.fromNode=C.fromCallback=function(g){var u=new C(W);u._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,a=t(g)(f(u,d));if(a===S)u._rejectCallback(a.e,!0);if(!u._isFateSealed())u._setAsyncGuaranteed();return u},C.all=function(g){return new N(g).promise()},C.cast=function(g){var u=L(g);if(!(u instanceof C))u=new C(W),u._captureStackTrace(),u._setFulfilled(),u._rejectionHandler0=g;return u},C.resolve=C.fulfilled=C.cast,C.reject=C.rejected=function(g){var u=new C(W);return u._captureStackTrace(),u._rejectCallback(g,!0),u},C.setScheduler=function(g){if(typeof g!=="function")throw new H("expecting a function but got "+J.classString(g));return w.setScheduler(g)},C.prototype._then=function(g,u,d,a,K0){var G0=K0!==void 0,M0=G0?K0:new C(W),v0=this._target(),R1=v0._bitField;if(!G0){if(M0._propagateFrom(this,3),M0._captureStackTrace(),a===void 0&&(this._bitField&2097152)!==0)if((R1&50397184)!==0)a=this._boundValue();else a=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,M0)}var l0=Q();if((R1&50397184)!==0){var O1,N1,J1=v0._settlePromiseCtx;if((R1&33554432)!==0)N1=v0._rejectionHandler0,O1=g;else if((R1&16777216)!==0)N1=v0._fulfillmentHandler0,O1=u,v0._unsetRejectionIsUnhandled();else J1=v0._settlePromiseLateCancellationObserver,N1=new V("late cancellation observer"),v0._attachExtraTrace(N1),O1=u;w.invoke(J1,v0,{handler:l0===null?O1:typeof O1==="function"&&J.domainBind(l0,O1),promise:M0,receiver:a,value:N1})}else v0._addCallbacks(g,u,M0,a,l0);return M0},C.prototype._length=function(){return this._bitField&65535},C.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},C.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},C.prototype._setLength=function(g){this._bitField=this._bitField&-65536|g&65535},C.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},C.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},C.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},C.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},C.prototype._isFinal=function(){return(this._bitField&4194304)>0},C.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},C.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},C.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},C.prototype._setAsyncGuaranteed=function(){if(w.hasCustomScheduler())return;this._bitField=this._bitField|134217728},C.prototype._receiverAt=function(g){var u=g===0?this._receiver0:this[g*4-4+3];if(u===Y)return;else if(u===void 0&&this._isBound())return this._boundValue();return u},C.prototype._promiseAt=function(g){return this[g*4-4+2]},C.prototype._fulfillmentHandlerAt=function(g){return this[g*4-4+0]},C.prototype._rejectionHandlerAt=function(g){return this[g*4-4+1]},C.prototype._boundValue=function(){},C.prototype._migrateCallback0=function(g){var{_bit
Line truncated
`).filter((J)=>J),U=Math.min(...I.map((J)=>J.length-J.trimStart().length)),Y=I.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Y)this.content.push(J)}compile(){let $=Function,q=this?.args,U=[...(this?.content??[""]).map((Y)=>`${Y}`)];return new $(...q,U.join(`
`))}}var iO={major:4,minor:4,patch:3};var k0=m("$ZodType",($,q)=>{var I;$??($={}),$._zod.def=q,$._zod.bag=$._zod.bag||{},$._zod.version=iO;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let Y of U)for(let J of Y._zod.onattach)J($);if(U.length===0)(I=$._zod).deferred??(I.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let Y=(Q,K,z)=>{let w=r5(Q),G;for(let H of K){if(H._zod.def.when){if(lL(Q))continue;if(!H._zod.def.when(Q))continue}else if(w)continue;let V=Q.issues.length,W=H._zod.check(Q);if(W instanceof Promise&&z?.async===!1)throw new Y8;if(G||W instanceof Promise)G=(G??Promise.resolve()).then(async()=>{if(await W,Q.issues.length===V)return;if(!w)w=r5(Q,V)});else{if(Q.issues.length===V)continue;if(!w)w=r5(Q,V)}}if(G)return G.then(()=>{return Q});return Q},J=(Q,K,z)=>{if(r5(Q))return Q.aborted=!0,Q;let w=Y(K,U,z);if(w instanceof Promise){if(z.async===!1)throw new Y8;return w.then((G)=>$._zod.parse(G,z))}return $._zod.parse(w,z)};$._zod.run=(Q,K)=>{if(K.skipChecks)return $._zod.parse(Q,K);if(K.direction==="backward"){let w=$._zod.parse({value:Q.value,issues:[]},{...K,skipChecks:!0});if(w instanceof Promise)return w.then((G)=>{return J(G,Q,K)});return J(w,Q,K)}let z=$._zod.parse(Q,K);if(z instanceof Promise){if(K.async===!1)throw new Y8;return z.then((w)=>Y(w,U,K))}return Y(z,U,K)}}o0($,"~standard",()=>({validate:(Y)=>{try{let J=Dq($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return dY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),P7=m("$ZodString",($,q)=>{k0.init($,q),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??DO($._zod.bag),$._zod.parse=(I,U)=>{if(q.coerce)try{I.value=String(I.value)}catch(Y){}if(typeof I.value==="string")return I;return I.issues.push({expected:"string",code:"invalid_type",input:I.value,inst:$}),I}}),_1=m("$ZodStringFormat",($,q)=>{Oq.init($,q),P7.init($,q)}),cO=m("$ZodGUID",($,q)=>{q.pattern??(q.pattern=IO),_1.init($,q)}),dO=m("$ZodUUID",($,q)=>{if(q.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[q.version];if(U===void 0)throw Error(`InvalidUUIDversion:"${q.version}"`);q.pattern??(q.pattern=A7(U))}else q.pattern??(q.pattern=A7());_1.init($,q)}),lO=m("$ZodEmail",($,q)=>{q.pattern??(q.pattern=UO),_1.init($,q)}),mO=m("$ZodURL",($,q)=>{_1.init($,q),$._zod.check=(I)=>{try{let U=I.value.trim();if(!q.normalize&&q.protocol?.source===HO.source){if(!/^https?:\/\//i.test(U)){I.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:I.value,inst:$,continue:!q.abort});return}}let Y=new URL(U);if(q.hostname){if(q.hostname.lastIndex=0,!q.hostname.test(Y.hostname))I.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:q.hostname.source,input:I.value,inst:$,continue:!q.abort})}if(q.protocol){if(q.protocol.lastIndex=0,!q.protocol.test(Y.protocol.endsWith(":")?Y.protocol.slice(0,-1):Y.protocol))I.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:q.protocol.source,input:I.value,inst:$,continue:!q.abort})}if(q.normalize)I.value=Y.href;else I.value=U;return}catch(U){I.issues.push({code:"invalid_format",format:"url",input:I.value,inst:$,continue:!q.abort})}}}),oO=m("$ZodEmoji",($,q)=>{q.pattern??(q.pattern=YO()),_1.init($,q)}),rO=m("$ZodNanoID",($,q)=>{q.pattern??(q.pattern=$O),_1.init($,q)}),tO=m("$ZodCUID",($,q)=>{q.pattern??(q.pattern=rL),_1.init($,q)}),aO=m("$ZodCUID2",($,q)=>{q.pattern??(q.pattern=tL),_1.init($,q)}),sO=m("$ZodULID",($,q)=>{q.pattern??(q.pattern=aL),_1.init($,q)}),eO=m("$ZodXID",($,q)=>{q.pattern??(q.pattern=sL),_1.init($,q)}),$N=m("$ZodKSUID",($,q)=>{q.pattern??(q.pattern=eL),_1.init($,q)}),qN=m("$ZodISODateTime",($,q)=>{q.pattern??(q.pattern=XO(q)),_1.init($,q)}),IN=m("$ZodISODate",($,q)=>{q.pattern??(q.pattern=WO),_1.init($,q)}),UN=m("$ZodISOTime",($,q)=>{q.pattern??(q.pattern=ZO(q)),_1.init($,q)}),YN=m("$ZodISODuration",($,q)=>{q.pattern??(q.pattern=qO),_1.init($,q)}),JN=m("$ZodIPv4",($,q)=>{q.pattern??(q.pattern=JO),_1.init($,q),$._zod.bag.format="ipv4"}),QN=m("$ZodIPv6",($,q)=>{q.pattern??(q.pattern=QO),_1.init($,q),$._zod.bag.format="ipv6",$._zod.check=(I)=>{try{new URL(`http://[${I.value}]`)}catch{I.issues.push({code:"invalid_format",format:"ipv6",input:I.value,inst:$,continue:!q.abort})}}}),KN=m("$ZodMAC",($,q)=>{q.pattern??(q.pattern=KO(q.delimiter)),_1.init($,q),$._zod.bag.format="mac"}),zN=m("$ZodCIDRv4",($,q)=>{q.pattern??(q.pattern=zO),_1.init($,q)}),wN=m("$ZodCIDRv6",($,q)=>{q.pattern??(q.pattern=wO),_1.init($,q),$._zod.check=(I)=>{let U=I.value.split("/");try{if(U.length!==2)throw Error();let[Y,J]=U;if(!J)throw Error();let Q=Number(J);if(`${Q}`!==J)throw Error();if(Q<0||Q>128)throw Error();new URL(`http://[${Y}]`)}catch{I.issues.push({code:"invalid_format",format:"cidrv6",input:I.value,inst:$,continue:!q.abort})}}});function GN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(Q,W)=>P(w,Q,W)},u,e=Nt,l=!dt.jitless,I=l&&G$.value,g=i.catchall,b;n._zod.parse=(w,f)=>{b??(b=o.value);let c=w.value;if(!e(c))return w.issues.push({expected:"object",code:"invalid_type",input:c,inst:n}),w;if(l&&I&&f?.async===!1&&f.jitless!==!0){if(!u)u=t(i.shape);if(w=u(w,f),!g)return w;return q0([],c,w,f,b,n)}return r(w,f)}});function G0(n,i,r,o){for(let u of n)if(u.issues.length===0)return i.value=u.value,i;let t=n.filter((u)=>!ai(u));if(t.length===1)return i.value=t[0].value,t[0];return i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((u)=>u.issues.map((e)=>_n(e,o,dn())))}),i}var Do=U("$ZodUnion",(n,i)=>{E.init(n,i),h(n._zod,"optin",()=>i.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),h(n._zod,"optout",()=>i.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),h(n._zod,"values",()=>{if(i.options.every((o)=>o._zod.values))return new Set(i.options.flatMap((o)=>Array.from(o._zod.values)));return}),h(n._zod,"pattern",()=>{if(i.options.every((o)=>o._zod.pattern)){let o=i.options.map((t)=>t._zod.pattern);return new RegExp(`^(${o.map((t)=>ro(t.source)).join("|")})$`)}return});let r=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(o,t)=>{if(r)return r(o,t);let u=!1,e=[];for(let l of i.options){let $=l._zod.run({value:o.value,issues:[]},t);if($ instanceof Promise)e.push($),u=!0;else{if($.issues.length===0)return $;e.push($)}}if(!u)return G0(e,o,n,t);return Promise.all(e).then((l)=>{return G0(l,o,n,t)})}});function W0(n,i,r,o){let t=n.filter((u)=>u.issues.length===0);if(t.length===1)return i.value=t[0].value,i;if(t.length===0)i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((u)=>u.issues.map((e)=>_n(e,o,dn())))});else i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:[],inclusive:!1});return i}var fg=U("$ZodXor",(n,i)=>{Do.init(n,i),i.inclusive=!1;let r=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(o,t)=>{if(r)return r(o,t);let u=!1,e=[];for(let l of i.options){let $=l._zod.run({value:o.value,issues:[]},t);if($ instanceof Promise)e.push($),u=!0;else e.push($)}if(!u)return W0(e,o,n,t);return Promise.all(e).then((l)=>{return W0(l,o,n,t)})}}),cg=U("$ZodDiscriminatedUnion",(n,i)=>{i.inclusive=!1,Do.init(n,i);let r=n._zod.parse;h(n._zod,"propValues",()=>{let t={};for(let u of i.options){let e=u._zod.propValues;if(!e||Object.keys(e).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${i.options.indexOf(u)}"`);for(let[l,$]of Object.entries(e)){if(!t[l])t[l]=new Set;for(let I of $)t[l].add(I)}}return t});let o=zt(()=>{let t=i.options,u=new Map;for(let e of t){let l=e._zod.propValues?.[i.discriminator];if(!l||l.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${i.options.indexOf(e)}"`);for(let $ of l){if(u.has($))throw Error(`Duplicatediscriminatorvalue"${String($)}"`);u.set($,e)}}return u});n._zod.parse=(t,u)=>{let e=t.value;if(!Nt(e))return t.issues.push({code:"invalid_type",expected:"object",input:e,inst:n}),t;let l=o.value.get(e?.[i.discriminator]);if(l)return l._zod.run(t,u);if(i.unionFallback||u.direction==="backward")return r(t,u);return t.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:i.discriminator,options:Array.from(o.value.keys()),input:e,path:[i.discriminator],inst:n}),t}}),Ug=U("$ZodIntersection",(n,i)=>{E.init(n,i),n._zod.parse=(r,o)=>{let t=r.value,u=i.left._zod.run({value:t,issues:[]},o),e=i.right._zod.run({value:t,issues:[]},o);if(u instanceof Promise||e instanceof Promise)return Promise.all([u,e]).then(([$,I])=>{return j0(r,$,I)});return j0(r,u,e)}});function JI(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n===+i)return{valid:!0,data:n};if(xi(n)&&xi(i)){let r=Object.keys(i),o=Object.keys(n).filter((u)=>r.indexOf(u)!==-1),t={...n,...i};for(let u of o){let e=JI(n[u],i[u]);if(!e.valid)return{valid:!1,mergeErrorPath:[u,...e.mergeErrorPath]};t[u]=e.data}return{valid:!0,data:t}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<n.length;o++){let t=n[o],u=i[o],e=JI(t,u);if(!e.valid)return{valid:!1,mergeErrorPath:[o,...e.mergeErrorPath]};r.push(e.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function j0(n,i,r){let o=new Map,t;for(let l of i.issues)if(l.code==="unrecognized_keys"){t??(t=l);for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).l=!0}}else n.issues.push(l);for(let l of r.issues)if(l.code==="unrecognized_keys")for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).r=!0}else n.issues.push(l);let u=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(u.length&&t)n.issues.push({...t,keys:u});if(ai(n))return n;let e=JI(i.value,r.value);if(!e.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(e.mergeErrorPath)}`);return n.value=e.data,n}var Ue=U("$ZodTuple",(n,i)=>{E.init(n,i
Line truncated
`)}W.write("payload.value = newResult;"),W.write("return payload;");let E=W.compile();return(T,P)=>E(V,T,P)},J,Q=M7,K=!N7.jitless,w=K&&nL.value,G=q.catchall,H;$._zod.parse=(V,W)=>{H??(H=U.value);let X=V.value;if(!Q(X))return V.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),V;if(K&&w&&W?.async===!1&&W.jitless!==!0){if(!J)J=Y(q.shape);if(V=J(V,W),!G)return V;return sx([],X,V,W,H,$)}return I(V,W)}});function ux($,q,I,U){for(let J of $)if(J.issues.length===0)return q.value=J.value,q;let Y=$.filter((J)=>!r5(J));if(Y.length===1)return q.value=Y[0].value,Y[0];return q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))}),q}var tY=m("$ZodUnion",($,q)=>{k0.init($,q),o0($._zod,"optin",()=>q.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),o0($._zod,"optout",()=>q.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),o0($._zod,"values",()=>{if(q.options.every((U)=>U._zod.values))return new Set(q.options.flatMap((U)=>Array.from(U._zod.values)));return}),o0($._zod,"pattern",()=>{if(q.options.every((U)=>U._zod.pattern)){let U=q.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${U.map((Y)=>uY(Y.source)).join("|")})$`)}return});let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else{if(z.issues.length===0)return z;Q.push(z)}}if(!J)return ux(Q,U,$,Y);return Promise.all(Q).then((K)=>{return ux(K,U,$,Y)})}});function xx($,q,I,U){let Y=$.filter((J)=>J.issues.length===0);if(Y.length===1)return q.value=Y[0].value,q;if(Y.length===0)q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:$.map((J)=>J.issues.map((Q)=>P6(Q,U,W4())))});else q.issues.push({code:"invalid_union",input:q.value,inst:I,errors:[],inclusive:!1});return q}var BN=m("$ZodXor",($,q)=>{tY.init($,q),q.inclusive=!1;let I=q.options.length===1?q.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(I)return I(U,Y);let J=!1,Q=[];for(let K of q.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else Q.push(z)}if(!J)return xx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return xx(K,U,$,Y)})}}),RN=m("$ZodDiscriminatedUnion",($,q)=>{q.inclusive=!1,tY.init($,q);let I=$._zod.parse;o0($._zod,"propValues",()=>{let Y={};for(let J of q.options){let Q=J._zod.propValues;if(!Q||Object.keys(Q).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${q.options.indexOf(J)}"`);for(let[K,z]of Object.entries(Q)){if(!Y[K])Y[K]=new Set;for(let w of z)Y[K].add(w)}}return Y});let U=Hq(()=>{let Y=q.options,J=new Map;for(let Q of Y){let K=Q._zod.propValues?.[q.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${q.options.indexOf(Q)}"`);for(let z of K){if(J.has(z))throw Error(`Duplicatediscriminatorvalue"${String(z)}"`);J.set(z,Q)}}return J});$._zod.parse=(Y,J)=>{let Q=Y.value;if(!M7(Q))return Y.issues.push({code:"invalid_type",expected:"object",input:Q,inst:$}),Y;let K=U.value.get(Q?.[q.discriminator]);if(K)return K._zod.run(Y,J);if(q.unionFallback||J.direction==="backward")return I(Y,J);return Y.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:q.discriminator,options:Array.from(U.value.keys()),input:Q,path:[q.discriminator],inst:$}),Y}}),vN=m("$ZodIntersection",($,q)=>{k0.init($,q),$._zod.parse=(I,U)=>{let Y=I.value,J=q.left._zod.run({value:Y,issues:[]},U),Q=q.right._zod.run({value:Y,issues:[]},U);if(J instanceof Promise||Q instanceof Promise)return Promise.all([J,Q]).then(([z,w])=>{return kx(I,z,w)});return kx(I,J,Q)}});function pO($,q){if($===q)return{valid:!0,data:$};if($ instanceof Date&&q instanceof Date&&+$===+q)return{valid:!0,data:$};if(o5($)&&o5(q)){let I=Object.keys(q),U=Object.keys($).filter((J)=>I.indexOf(J)!==-1),Y={...$,...q};for(let J of U){let Q=pO($[J],q[J]);if(!Q.valid)return{valid:!1,mergeErrorPath:[J,...Q.mergeErrorPath]};Y[J]=Q.data}return{valid:!0,data:Y}}if(Array.isArray($)&&Array.isArray(q)){if($.length!==q.length)return{valid:!1,mergeErrorPath:[]};let I=[];for(let U=0;U<$.length;U++){let Y=$[U],J=q[U],Q=pO(Y,J);if(!Q.valid)return{valid:!1,mergeErrorPath:[U,...Q.mergeErrorPath]};I.push(Q.data)}return{valid:!0,data:I}}return{valid:!1,mergeErrorPath:[]}}function kx($,q,I){let U=new Map,Y;for(let K of q.issues)if(K.code==="unrecognized_keys"){Y??(Y=K);for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).l=!0}}else $.issues.push(K);for(let K of I.issues)if(K.code==="unrecognized_keys")for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).r=!0}else $.issues.push(K);let J=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Y)$.issues.push({...Y,keys:J});if(r5($))return $;let Q=pO(q.value,I.value);if(!Q.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var ww=m("$ZodTuple",($,q)=>{k0.
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(leteofn.seen.entries()){letl=e[1];if(i===e[0]){u(e);continue}if(n.external){letI=n.external.registry.get(e[0])?.id;if(i!==e[0]&&I){u(e);continue}}if(n.metadataRegistry.get(e[0])?.id){u(e);continue}if(l.cycle){u(e);continue}if(l.count>1){if(n.reused==="ref"){u(e);continue}}}}functionrt(n,i){letr=n.seen.get(i);if(!r)throwError("Unprocessed schema. This is a bug in Zod.");leto=(l)=>{let$=n.seen.get(l);if($.ref===null)return;letI=$.def??$.schema,g={...I},b=$.ref;if($.ref=null,b){o(b);letf=n.seen.get(b),c=f.schema;if(c.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"))I.allOf=I.allOf??[],I.allOf.push(c);elseObject.assign(I,c);if(Object.assign(I,g),l._zod.parent===b)for(letdinI){if(d==="$ref"||d==="allOf")continue;if(!(ding))deleteI[d]}if(c.$ref&&f.def)for(letdinI){if(d==="$ref"||d==="allOf")continue;if(dinf.def&&JSON.stringify(I[d])===JSON.stringify(f.def[d]))deleteI[d]}}letw=l._zod.parent;if(w&&w!==b){o(w);letf=n.seen.get(w);if(f?.schema.$ref){if(I.$ref=f.schema.$ref,f.def)for(letcinI){if(c==="$ref"||c==="allOf")continue;if(cinf.def&&JSON.stringify(I[c])===JSON.stringify(f.def[c]))deleteI[c]}}}n.override({zodSchema:l,jsonSchema:I,path:$.path??[]})};for(letlof[...n.seen.entries()].reverse())o(l[0]);lett={};if(n.target==="draft-2020-12")t.$schema="https://json-schema.org/draft/2020-12/schema";elseif(n.target==="draft-07")t.$schema="http://json-schema.org/draft-07/schema#";elseif(n.target==="draft-04")t.$schema="http://json-schema.org/draft-04/schema#";elseif(n.target==="openapi-3.0");if(n.external?.uri){letl=n.external.registry.get(i)?.id;if(!l)throwError("Schema is missing an `id` property");t.$id=n.external.uri(l)}Object.assign(t,r.def??r.schema);letu=n.metadataRegistry.get(i)?.id;if(u!==void0&&t.id===u)deletet.id;lete=n.external?.defs??{};for(letlofn.seen.entries()){let$=l[1];if($.def&&$.defId){if($.def.id===$.defId)delete$.def.id;e[$.defId]=$.def}}if(n.external);elseif(Object.keys(e).length>0)if(n.target==="draft-2020-12")t.$defs=e;elset.definitions=e;try{letl=JSON.parse(JSON.stringify(t));returnObject.defineProperty(l,"~standard",{value:{...i["~standard"],jsonSchema:{input:fr(i,"input",n.processors),output:fr(i,"output",n.processors)}},enumerable:!1,writable:!1}),l}catch(l){throwError("Error converting schema to JSON.")}}functionMn(n,i){letr=i??{seen:newSet};if(r.seen.has(n))return!1;r.seen.add(n);leto=n._zod.def;if(o.type==="transform")return!0;if(o.type==="array")returnMn(o.element,r);if(o.type==="set")returnMn(o.valueType,r);if(o.type==="lazy")returnMn(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")returnMn(o.innerType,r);if(o.type==="intersection")returnMn(o.left,r)||Mn(o.right,r);if(o.type==="record"||o.type==="map")returnMn(o.keyType,r)||Mn(o.valueType,r);if(o.type==="pipe"){if(n._zod.traits.has("$ZodCodec"))return!0;returnMn(o.in,r)||Mn(o.out,r)}if(o.type==="object"){for(lettino.shape)if(Mn(o.shape[t],r))return!0;return!1}if(o.type==="union"){for(lettofo.options)if(Mn(t,r))return!0;return!1}if(o.type==="tuple"){for(lettofo.items)if(Mn(t,r))return!0;if(o.rest&&Mn(o.rest,r))return!0;return!1}return!1}varkw=(n,i={})=>(r)=>{leto=it({...r,processors:i});returnen(n,o),tt(o,n),rt(o,n)},fr=(n,i,r={})=>(o)=>{let{libraryOptions:t,target:u}=o??{},e=it({...t??{},target:u,io:i,processors:r});returnen(n,e),tt(e,n),rt(e,n)};varIj={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Nw=(n,i,r,o)=>{lett=r;t.type="string";let{minimum:u,maximum:e,format:l,patterns:$,contentEncoding:I}=n._zod.bag;if(typeofu==="number")t.minLength=u;if(typeofe==="number")t.maxLength=e;if(l){if(t.format=Ij[l]??l,t.format==="")deletet.format;if(l==="time")deletet.format}if(I)t.contentEncoding=I;if($&&$.size>0){letg=[...$];if(g.length===1)t.pattern=g[0].source;elseif(g.length>1)t.allOf=[...g.map((b)=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))]}},Lw=(n,i,r,o)=>{lett=r,{minimum:u,maximum:e,format:l,multipleOf:$,exclusiveMaximum:I,exclusiveMinimum:g}=n._zod.bag;if(typeofl==="string"&&l.includes("int"))t.type="integer";elset.type="number";letb=typeofg==="number"&&g>=(u??Number.NEGATIVE_INFINITY),w=typeofI==="number"&&I<=(e??Number.POSITIVE_INFINITY),f=i.target==="draft-04"||i.target==="openapi-3.0";if(b)if(f)t.minimum=g,t.exclusiveMinimum=!0;elset.exclusiveMinimum=g;elseif(typeofu==="number")t.minimum=u;if(w)if(f)t.maximum=I,t.exclusiveMaximum=!0;elset.exclusiveMaximum=I;elseif(typeofe==="number")t.maximum=e;if(typeof$==="number")t.multipleOf=$},yw=(n,i,r,o)=>{r.type="boolean"},Gw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},Ww=(n,i,r,o)=>{if(i.unrepresentable==="Line truncated
`}class V6{constructor(n=Ud.stdin,i=Ud.stdout){this._stdin=n,this._stdout=i,this._readBuffer=new T6,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}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 n=this._readBuffer.readMessage();if(n===null)break;this.onmessage?.(n)}catch(n){this.onerror?.(n)}}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(n){return new Promise((i)=>{let r=cd(n);if(this._stdout.write(r))i();else this._stdout.once("drain",i)})}}import{dirname as s4,join as MK}from"node:path";import{fileURLToPath as zK}from"node:url";class Zi extends Error{name="KyError";get isKyError(){return!0}}class ti extends Zi{name="HTTPError";response;request;options;data;constructor(n,i,r){let o=n.status||n.status===0?n.status:"",t=n.statusText??"",u=`${o}${t}`.trim(),e=u?`statuscode${u}`:"an unknown error";super(`Requestfailedwith${e}:${i.method}${i.url}`);this.response=n,this.request=i,this.options=r}}class ku extends Zi{name="NetworkError";request;constructor(n,i){super(`Requestfailedduetoanetworkerror:${n.method}${n.url}`,i);this.request=n}}class Nu extends Error{name="NonError";value;constructor(n){let i="Non-error value was thrown";try{if(typeof n==="string")i=n;else if(n&&typeof n==="object"&&"message"in n&&typeof n.message==="string")i=n.message}catch{}super(i);this.value=n}}class Vr extends Zi{name="ForceRetryError";customDelay;code;customRequest;constructor(n){let i=n?.cause?n.cause instanceof Error?n.cause:new Nu(n.cause):void 0;super(n?.code?`Forcedretry:${n.code}`:"Forced retry",i?{cause:i}:void 0);this.customDelay=n?.delay,this.code=n?.code,this.customRequest=n?.request}}class q6 extends Error{name="SchemaValidationError";issues;constructor(n){super("Response schema validation failed");this.issues=n}}class Oi extends Zi{name="TimeoutError";request;constructor(n){super(`Requesttimedout:${n.method}${n.url}`);this.request=n}}var _6=(()=>{let n=!1,i=!1,r=typeof globalThis.ReadableStream==="function",o=typeof globalThis.Request==="function";if(r&&o)try{i=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type")}catch(t){if(t instanceof Error&&t.message==="unsupported BodyInit type")return!1;throw t}return n&&!i})(),Dd=typeof globalThis.AbortController==="function",kv=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Sd=typeof globalThis.ReadableStream==="function",Ad=typeof globalThis.FormData==="function",Nv=["get","post","put","patch","head","delete"],pQ=()=>{return};pQ();var Od={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},qr=2147483647,dd=40,Lv=Symbol("stop");class yv{options;constructor(n){this.options=n}}var kd=(n)=>new yv(n),Nd={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},Ld={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 Gv=new TextEncoder,QQ=(n)=>{if(!n)return 0;if(n instanceof FormData){let i=0;for(let[r,o]of n)i+=dd,i+=Gv.encode(`Content-Disposition:form-data;name="${r}"`).byteLength,i+=typeof o==="string"?Gv.encode(o).byteLength:o.size;return i}if(n instanceof Blob)return n.size;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n.byteLength;if(typeof n==="string")return Gv.encode(n).byteLength;if(n instanceof URLSearchParams)return Gv.encode(n.toString()).byteLength;return 0},yd=(n,i,r)=>{let o,t=0;return n.pipeThrough(new TransformStream({transform(u,e){if(e.enqueue(u),o){t+=o.byteLength;let l=i===0?0:t/i;if(l>=1)l=1-Number.EPSILON;r?.({percent:l,totalBytes:Math.max(i,t),transferredBytes:t},o)}o=u},flush(){if(o)t+=o.byteLength,r?.({percent:1,totalBytes:Math.max(i,t),transferredBytes:t},o)}}))},Gd=(n,i)=>{if(!n.body)return n;let r={status:n.status,statusText:n.statusText,headers:n.headers};if(n.status===204)return new Response(null,r);let o=Math.max(0,Number(n.headers.get("content-length"))||0);return new Response(yd(n.body,o,i),r)},Wd=(n,i,r)=>{if(!n.body)return n;let o=QQ(r??n.body);return new Request(n,{duplex:"half",body:yd(n.body,o,i)})};var Hi=(n)=>n!==null&&typeof n==="object";var PQ=Symbol("replaceOption"),Z6=(n)=>Hi(n)&&n[PQ]===!0?{isReplace:!0,value:n.value}:{isReplace:!1,value:n};var yu=(...n)=>{for(let i of n)if((!Hi(i)|
Line truncated
`,{mode:384}),i}function Rr(n,i,r=[]){let o=i.corpId?.trim()||void 0,t=i.stateful?i.defaultCorpId?.trim()||void 0:void 0,u=o??t;if(u){let l=n.find(($)=>$.id===u);if(l)return l;throw Error(`Noenterpriseconfigfoundfor${u}`)}if(!i.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let e=n[0];if(e)return e;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(r.length?r.join(", "):"the configured enterprise directories"))}import{readFileSync as gF}from"node:fs";import{randomBytes as bF}from"node:crypto";import{randomBytes as Tk}from"node:crypto";var JP=v.object({staffId:v.string(),name:v.string().optional(),code:v.string().default(""),bindTime:v.number().optional()}),XP=v.object({id:v.string(),tenantId:v.string(),name:v.string(),isAdmin:v.boolean().default(!1),permissions:v.array(v.string()).default([]),providerUserId:v.string().optional(),hosecloudStaff:JP.optional()}),HP=v.object({apiKey:v.string().optional(),corporationId:v.string().optional(),corporationName:v.string().optional()}),YP=v.object({id:v.string(),name:v.string(),tenantSlug:v.string().optional(),isDemo:v.boolean().default(!1),logoUrl:v.string().nullable().optional(),hoseCorpConfig:HP.optional()}),Sk=v.object({user:XP,tenant:YP}),pP=v.object({id:v.string(),name:v.string(),email:v.string().nullable().optional(),emailVerified:v.boolean().optional(),image:v.string().nullable().optional(),tenantId:v.string().optional(),provider:v.string().optional(),providerUserId:v.string().optional(),mobile:v.string().nullable().optional(),status:v.string().optional(),permissions:v.array(v.string()).default([]),isAdmin:v.boolean().default(!1),hosecloudStaff:v.unknown().optional()}).passthrough(),QP=v.object({id:v.string(),token:v.string().optional(),expiresAt:v.string(),createdAt:v.string().optional(),updatedAt:v.string().optional(),ipAddress:v.string().optional(),userAgent:v.string().optional(),userId:v.string(),delegationId:v.string().nullable().optional()}).passthrough(),Ak=v.object({user:pP,session:QP}),_v=v.object({id:v.string(),tenantId:v.string().optional(),code:v.number().optional(),description:v.string(),scope:v.string(),strictness:v.string(),status:v.string().optional(),createdAt:v.number().optional(),updatedAt:v.number().optional()}),Ok=v.object({rules:v.array(_v),hasPendingDeletes:v.boolean().default(!1)}),PP=v.object({code:v.string().optional(),description:v.string(),scope:v.string(),strictness:v.string()}),Zv=v.object({id:v.string(),tenantId:v.string().optional(),versionNumber:v.number(),versionName:v.string().nullable().optional(),publishedBy:v.string().nullable().optional(),publishedByName:v.string().nullable().optional(),rules:v.array(PP).default([]),publishedAt:v.number().optional(),createdAt:v.number().optional()}),dk=v.object({version:Zv,rulesCount:v.number()}),pu=v.object({id:v.string(),tenantId:v.string().optional(),title:v.string(),purpose:v.string().default(""),contentType:v.string().default("policy"),content:v.string(),status:v.string().default("published"),enabled:v.boolean().default(!0),scenarios:v.array(v.string()).default([]),tags:v.array(v.string()).default([]),category:v.string().nullable().optional(),categoryTags:v.array(v.string()).default([]),createdBy:v.string().nullable().optional(),createdByName:v.string().nullable().optional(),createdAt:v.number().optional(),updatedAt:v.number().optional(),updatedBy:v.string().nullable().optional(),updatedByName:v.string().nullable().optional(),isDeleted:v.boolean().default(!1)}),kk=v.object({articles:v.array(pu),total:v.number().optional()}),FP=v.object({explicitApprove:v.string().default(""),explicitReject:v.string().default(""),exemptApprove:v.string().default(""),review:v.string().default("")}).passthrough(),KP=v.object({type:v.string(),signKey:v.string().optional(),outboundName:v.string().optional(),mode:v.string().optional(),autoApprovalRate:v.number().optional(),apiKey:v.string().optional(),apiSecret:v.string().optional(),apiOrigin:v.string().optional(),corporationId:v.string().optional(),ebotSignKey:v.string().optional(),completionSignKey:v.string().optional(),outboundMessageId:v.string().optional(),completionMessageId:v.string().optional()}).passthrough(),BP=v.enum(["assisted","semi_automatic","fully_automatic"]),Dk=v.object({id:v.string(),url:v.string().url()}).passthrough(),Qu=v.object({type:v.literal("webhook"),id:v.string(),name:v.string(),mode:BP,incomingDocumentWebhook:Dk,outgoingResultWebhook:v.string().url(),incomingManualResultWebhook:Dk,secret:v.string().min(1),autoApprovalRate:v.number().int().min(0).max(100).optional()}).passthrough(),v4=v.object({id:v.string().optional(),tenantId:v.string().optional(),tone:v.string().optional(),language:v.string().optional(),detailLevel:v.string().optional(),outputFormat:v.string().optional(),examples:v.array(v.string()).default([]),prohibitedPhrases:v.array(v.string()).default([]),cus
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letQof$.seen.entries()){letK=Q[1];if(q===Q[0]){J(Q);continue}if($.external){letw=$.external.registry.get(Q[0])?.id;if(q!==Q[0]&&w){J(Q);continue}}if($.metadataRegistry.get(Q[0])?.id){J(Q);continue}if(K.cycle){J(Q);continue}if(K.count>1){if($.reused==="ref"){J(Q);continue}}}}function$9($,q){letI=$.seen.get(q);if(!I)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letz=$.seen.get(K);if(z.ref===null)return;letw=z.def??z.schema,G={...w},H=z.ref;if(z.ref=null,H){U(H);letW=$.seen.get(H),X=W.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))w.allOf=w.allOf??[],w.allOf.push(X);elseObject.assign(w,X);if(Object.assign(w,G),K._zod.parent===H)for(letLinw){if(L==="$ref"||L==="allOf")continue;if(!(LinG))deletew[L]}if(X.$ref&&W.def)for(letLinw){if(L==="$ref"||L==="allOf")continue;if(LinW.def&&JSON.stringify(w[L])===JSON.stringify(W.def[L]))deletew[L]}}letV=K._zod.parent;if(V&&V!==H){U(V);letW=$.seen.get(V);if(W?.schema.$ref){if(w.$ref=W.schema.$ref,W.def)for(letXinw){if(X==="$ref"||X==="allOf")continue;if(XinW.def&&JSON.stringify(w[X])===JSON.stringify(W.def[X]))deletew[X]}}}$.override({zodSchema:K,jsonSchema:w,path:z.path??[]})};for(letKof[...$.seen.entries()].reverse())U(K[0]);letY={};if($.target==="draft-2020-12")Y.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")Y.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")Y.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letK=$.external.registry.get(q)?.id;if(!K)throwError("Schema is missing an `id` property");Y.$id=$.external.uri(K)}Object.assign(Y,I.def??I.schema);letJ=$.metadataRegistry.get(q)?.id;if(J!==void0&&Y.id===J)deleteY.id;letQ=$.external?.defs??{};for(letKof$.seen.entries()){letz=K[1];if(z.def&&z.defId){if(z.def.id===z.defId)deletez.def.id;Q[z.defId]=z.def}}if($.external);elseif(Object.keys(Q).length>0)if($.target==="draft-2020-12")Y.$defs=Q;elseY.definitions=Q;try{letK=JSON.parse(JSON.stringify(Y));returnObject.defineProperty(K,"~standard",{value:{...q["~standard"],jsonSchema:{input:hq(q,"input",$.processors),output:hq(q,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionE6($,q){letI=q??{seen:newSet};if(I.seen.has($))return!1;I.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnE6(U.element,I);if(U.type==="set")returnE6(U.valueType,I);if(U.type==="lazy")returnE6(U.getter(),I);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnE6(U.innerType,I);if(U.type==="intersection")returnE6(U.left,I)||E6(U.right,I);if(U.type==="record"||U.type==="map")returnE6(U.keyType,I)||E6(U.valueType,I);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnE6(U.in,I)||E6(U.out,I)}if(U.type==="object"){for(letYinU.shape)if(E6(U.shape[Y],I))return!0;return!1}if(U.type==="union"){for(letYofU.options)if(E6(Y,I))return!0;return!1}if(U.type==="tuple"){for(letYofU.items)if(E6(Y,I))return!0;if(U.rest&&E6(U.rest,I))return!0;return!1}return!1}varuM=($,q={})=>(I)=>{letU=s5({...I,processors:q});returnj1($,U),e5(U,$),$9(U,$)},hq=($,q,I={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=s5({...Y??{},target:J,io:q,processors:I});returnj1($,Q),e5(Q,$),$9(Q,$)};varhO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xM=($,q,I,U)=>{letY=I;Y.type="string";let{minimum:J,maximum:Q,format:K,patterns:z,contentEncoding:w}=$._zod.bag;if(typeofJ==="number")Y.minLength=J;if(typeofQ==="number")Y.maxLength=Q;if(K){if(Y.format=hO0[K]??K,Y.format==="")deleteY.format;if(K==="time")deleteY.format}if(w)Y.contentEncoding=w;if(z&&z.size>0){letG=[...z];if(G.length===1)Y.pattern=G[0].source;elseif(G.length>1)Y.allOf=[...G.map((H)=>({...q.target==="draft-07"||q.target==="draft-04"||q.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},kM=($,q,I,U)=>{letY=I,{minimum:J,maximum:Q,format:K,multipleOf:z,exclusiveMaximum:w,exclusiveMinimum:G}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Y.type="integer";elseY.type="number";letH=typeofG==="number"&&G>=(J??Number.NEGATIVE_INFINITY),V=typeofw==="number"&&w<=(Q??Number.POSITIVE_INFINITY),W=q.target==="draft-04"||q.target==="openapi-3.0";if(H)if(W)Y.minimum=G,Y.exclusiveMinimum=!0;elseY.exclusiveMinimum=G;elseif(typeofJ==="number")Y.minimum=J;if(V)if(W)Y.maximum=w,Y.exclusiveMaximum=!0;elseY.exclusiveMaximum=w;elseif(typeofQ==="number")Y.maximum=Q;if(typeofz==="number")Y.multipleOf=z},fM=($,q,I,U)=>{I.type="boolean"},nM=($,q,I,U)=>{if(q.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},bM=($,q,I,U)=>{if(q.unrepresentable==Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of H){let W=V.outboundName??"SealAI 审批",X=V.signKey,D=V.apiOrigin??"production";console.error(`•"${W}"(signKey:${X},环境:${D})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${Y.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let D=X.outboundName??"SealAI 审批",L=X.signKey,N=X.apiOrigin??"production";console.error(`•"${D}"(signKey:${L},环境:${N})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${L}--corp${Y.id}
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2
Line truncated
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2
Line truncated
`);Y(U)})})}async function gZ0($){let q=e0($.options.port)??e0($.options.p),I=x($.options.host)??x($.options.h),U=await FL({port:q,host:I}),Y=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Y),process.on("SIGTERM",Y),await new Promise(()=>{})}async function jZ0($,q,I,U){if($==="config"||$==="get"){await O0("seal_llm_config_get",q,I,{},L0(U.options));return}if($==="providers"||$==="list"){await O0("seal_llm_providers_list",q,I,{},L0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function BZ0($,q){if($==="config"||$==="json"){Du();return}await Lu()}function Du(){T0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function RZ0($){let q=XL();T0(q,{...L0($.options),allowFull:!0})}async function vZ0($,q,I,U){if($==="available"){await O0("seal_permissions_available_list",q,I,{},L0(U.options));return}if($==="configs"||$==="list"){await O0("seal_permissions_configs_list",q,I,{},L0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as CZ0}from"node:fs";async function _Z0($,q,I,U,Y,J,Q){if(!$||$==="get"){await O0("seal_preference_get",Y,J,{},L0(Q.options));return}if($==="decision"){if(q==="update"||!q){let K=x(Q.options.input),z=K?JSON.parse(CZ0(K,"utf8")):a6(Q.json);if(!z||Object.keys(z).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await O0("seal_preference_decision_update",Y,J,z,L0(Q.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(q==="set"){let K=x(Q.options.default)??x(Q.options.level)??U;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await O0("seal_preference_thinking_depth_set",Y,J,{defaultLevel:K},L0(Q.options));return}if(q==="policies"){if(I==="list"||!I){await O0("seal_preference_thinking_depth_policies_list",Y,J,{},L0(Q.options));return}if(I==="upsert"){let K=x(Q.options.input),z=K?JSON.parse(CZ0(K,"utf8")):a6(Q.json);if(!z||!z.id||!z.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await O0("seal_preference_thinking_depth_policies_upsert",Y,J,z,L0(Q.options));return}if(I==="remove"||I==="delete"){let K=U??x(Q.options.id)??x(Q.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await O0("seal_preference_thinking_depth_policies_remove",Y,J,{policyId:K},L0(Q.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function hZ0($={}){let q=X8(),I=P4(),U=DI(q,{stateful:I.stateful,defaultCorpId:I.defaultCorpId,corpId:$.corpId},x7());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Y=await PY(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Y,null,2));let J=await I4(U),Q=await fH(J,{documentLimit:20,stylePreferencesEndpoint:U.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:Q.rules.rules.length,hasPendingRuleDeletes:Q.rules.hasPendingDeletes,documents:Q.documents.articles.length,documentsTotal:Q.documents.total,stylePreferences:Q.stylePreferences.ok?"ok":`error:${Q.stylePreferences.error}`},null,2))}async function SZ0($,q,I){let U=q??x(I.options.corp)??($&&$!=="--corp"?$:void 0);await hZ0({corpId:U})}async function Ou($,q,I,U,Y){if($==="count"){await O0("seal_approval_rules_list",I,U,{countOnly:!0},L0(Y.options));return}if($==="list"){if(C0(Y.options.count)){await O0("seal_approval_rules_list",I,U,{countOnly:!0},L0(Y.options));return}let J=e0(Y.options.limit),Q=e0(Y.options.offset);if(C0(Y.options.summary)){await O0("seal_approval_rules_list",I,U,{fields:IZ0,limit:J,offset:Q},L0(Y.options));return}let K=await Jq("seal_approval_rules_list",I,U,{limit:J,offset:Q});UZ0(K,C0(Y.options.full)===!0),T0(K);return}if($==="clear"){let J=C0(Y.options.yes)===!0,Q=C0(Y.options.dryRun)??C0(Y.options["dry-run"])??!J;if(!J&&!Q)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let K=await Jq("seal_approval_rules_clear",I,U,{dryRun:Q,recode:C0(Y.options.recode)});if(!J&&Q&&K&&typeof K==="object"){T0({...K,nextCommand:`seal-userulesclear--corp${U.id}--yes`},L0(Y.options));return}T0(K,L0(Y.options));return}if($==="versions"){await O0("seal_approval_rule_versions_list",I,U,{},L0(Y.options));return}if($==="version"){let J=q??x(Y.options.version);if(!J)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await O0("seal_approval_rule_version_get",I,U,Wz(J),L0(Y.options));return}if($==="get"){await O0("seal_approval_rule_get",I,U,{...qZ0(x(Y.options.version)),code:x(Y.options.code),runtimeId:x(Y.options.runtimeId)??x(Y.options["runtime-id"]),recordId:x(Y.options.r
Line truncated
`).filter(Boolean),J=Y.slice(-q);return{logFile:I,lines:J,totalLines:Y.length}}async function Qw1($){let q=TL($),I=Mu($),U=Oz($);kZ0($.stateDir);let Y=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):OL),J=$.host??(process.env.HOST?process.env.HOST:NL);AL(q,`${process.pid}
`,{mode:384}),AL(I,JSON.stringify({pid:process.pid,port:Y,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),TY(U,`servicestartingonhttp://${J}:${Y} pid=${process.pid}`);let Q=null;try{Q=await FL({port:Y,host:J,silent:!0}),TY(U,`service listening pid=${process.pid}`)}catch(z){if(TY(U,`service failed to bind port ${Y}: ${z instanceof Error?z.message:String(z)}`),PL(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});throw z}let K=()=>{if(Q)Q.close(),Q=null;if(PL(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});TY(U,`stopped pid=${process.pid}`)};await new Promise((z)=>{let w=!1,G=()=>{if(w)return;w=!0,K(),process.off("SIGTERM",G),process.off("SIGINT",G),z()};process.once("SIGTERM",G),process.once("SIGINT",G)})}function yZ0($){kZ0($.stateDir);let q=EY($);if(q.running)return q;let I=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...I.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Y=Iw1(I.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Y.unref();let J=TL($);return AL(J,`${Y.pid}
`,{flag:"a",mode:384})}var Au=ww1(zw1(),".config","seal-use");async function Pu($,q,I){let U=I?e0(I.options.port)??e0(I.options.p):void 0,Y=I?x(I.options.host)??x(I.options.h):void 0,J=I?e0(I.options.lines)??e0(I.options.n):void 0,Q=await Qq($,{appRoot:q.appRoot,entryFile:q.entryFile,stateDir:Au,version:t0,launcher:q.launcher,port:U,host:Y},{maxLines:J});if(Q!==void 0)T0(Q)}import{existsSync as Gw1,readFileSync as fZ0}from"node:fs";async function nZ0($,q,I,U,Y){if($==="batch-records"||$==="records"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await O0("seal_simulation_batch_records_get",I,U,{batchId:J,query:x(Y.options.query)},L0(Y.options));return}if($==="create"||$==="run"){let J=x(Y.options.mode)??x(Y.options.sourceSystem)??x(Y.options["source-system"])??"hosecloud",Q=J==="material-pack"?"material_pack":J,K=x(Y.options.schemaConfig)??x(Y.options["schema-config"]),z=K?JSON.parse(fZ0(K,"utf8")):void 0,w=x(Y.options.input),G=w?JSON.parse(fZ0(w,"utf8")):a6(Y.json),H=x(Y.options.packageId)??x(Y.options["package-id"]),V=M6(Y.options.packageIds)??M6(Y.options["package-ids"])??(H?[H]:void 0),W=M6(Y.options.flowIds)??M6(Y.options["flow-ids"])??M6(Y.options.documentSn)??M6(Y.options["document-sn"]),X=x(Y.options.signKey)??x(Y.options["sign-key"])??x(Y.options.integration);await O0("seal_simulation_batch_create",I,U,{mode:Q,sourceSystem:Q,flowIds:W,documentSn:W,rejectNodeName:x(Y.options.rejectNode)??x(Y.options["reject-node"])??null,thinkingDepthOverride:x(Y.options.thinkingDepth)??x(Y.options["thinking-depth"]),skipInvoiceGeneration:C0(Y.options.skipInvoiceGeneration)??C0(Y.options["skip-invoice-generation"]),skipExpenseExtraction:C0(Y.options.skipExpenseExtraction)??C0(Y.options["skip-expense-extraction"]),disableAttachmentCache:C0(Y.options.disableAttachmentCache)??C0(Y.options["disable-attachment-cache"]),signKey:X,packageIds:V,packageId:H,templateId:x(Y.options.templateId)??x(Y.options["template-id"]),schemaConfig:z,requestIds:M6(Y.options.requestIds)??M6(Y.options["request-ids"]),workflowTypeId:x(Y.options.workflowTypeId)??x(Y.options["workflow-type-id"]),flowStatusList:M6(Y.options.flowStatusList)?.map(Number)??M6(Y.options["flow-status-list"])?.map(Number),businessCodes:M6(Y.options.businessCodes)??M6(Y.options["business-codes"]),documentType:x(Y.options.documentType)??x(Y.options["document-type"]),startTime:e0(Y.options.startTime)??e0(Y.options["start-time"]),endTime:e0(Y.options.endTime)??e0(Y.options["end-time"]),status:M6(Y.options.status),limit:e0(Y.options.limit),rawParams:G},L0(Y.options));return}if($==="wait"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await O0("seal_simulation_batch_wait",I,U,{batchId:J,timeout:x(Y.options.timeout),pollInterval:x(Y.options.pollInterval)??x(Y.options["poll-interval"])},L0(Y.options));return}if($==="clean"||$==="delete"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await O0("seal_simulation_batch_clean",I,U,{batchId:J},L0(Y.options));return}if($==="specifications"){let J=q??x(Y.options.integration)??x(Y.options.signKey)??x(Y.options["sign-key"]);await O0("seal_simulation_specifications_list",I,U,{signKey:J},L0(Y.options));return}if($==="list"){await O0("seal_simulation_batches_list",I,U,{limit:e0(Y.options.limit)},L0(Y.options));return}if($==="get"){let J=q??x(Y.options.batchId)??x(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await O0("seal_simulation_batch_get",I,U,{batchId:J},L0(Y.options));return}if($==="templates"){await O0("seal_simulation_templates_get",I,U,{},L0(Y.options));return}if($==="integrations"){await O0("seal_simulation_integrations_get",I,U,{},L0(Y.options));return}if($==="package-upload"){let J=q??x(Y.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Gw1(J))throw Error(`Filenotfound:${J}`);await O0("seal_simulation_material_package_upload",I,U,{filePath:J},L0(Y.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as YX0}from"node:fs";import{join as EL}from"node:path";import{existsSync as Tu,mkdirSync as sZ0,rmSync as Aw1,writeFileSync as Pw1}from"node:fs";import{homedir as eZ0}from"node:os";import{dirname as Tw1,join as Eu}from"node:path";var bZ0=`---
name:seal-use
description:"v0.10.3: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.10: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
Usethe\`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-use\` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -292,7 +542,9 @@ seal-use corps list
-SystemPermissionsConfig:\`seal-use permissions available --corp <corpId>\`, \`seal-use permissions configs --corp <corpId>\`.
-Billing&FeatureQuotas:\`seal-use billing status --corp <corpId>\`, \`seal-use billing plans --corp <corpId>\`, \`seal-use billing features --corp <corpId>\`.
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 hL=`interface:
`;var iZ0=`interface:
display_name:"Seal Use"
short_description:"Diagnose approval feedback and publish minimal rule fixes"
default_prompt:"Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
@@ -457,7 +711,7 @@ Use current search only when the question is about current draft/current knowled
##OutputDiscipline
Ifarulecommandwouldreturnmanydescriptionsormorethanabout20rules,use\`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var aL="# 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-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>[--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.summary][--output-filefile.json]\nseal-useapproval-runsattachments<recordId>--corp<corpId>\nseal-useapproval-runsresult<recordId>--corp<corpId>[--summary]\nseal-useapproval-runsurl--corp<corpId>\nseal-useapproval-runLine truncated
`;var dZ0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises`aremerged.\n-User-levelconfigsoverridesame-IDlocalconfigs.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**(e.g.`👉Nextaction:...`).\n-**`ExitCode`**:`0`onsuccess,non-zero(e.g.`1`)onfailuretotriggerAgenterrorself-remediation.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate\nseal-usetoolslist\nseal-usecorpslist[--corp<corpId>]\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useusersreset-password<userId>[--corp<corpId>]\nseal-useusersget<userId>[--corp<corpId>]\nseal-useusersdelete<userId>[--corp<corpId>]\nseal-usellmconfig[--corp<corpId>]\nseal-usellmproviders[--corp<corpId>]\nseal-usepermissionsavailable[--corp<corpId>]\nseal-usepermissionsconfigs[--corp<corpId>]\nseal-usebillingstatus[--corp<corpId>]\nseal-usebillingplans[--corp<corpId>]\nseal-usebillingfeatures[--corp<corpId>]\nseal-usewebhooklist[--query<text>][--show-secret][--corp<corpId>]\nseal-usewebhookget|find<idOrName>[--show-secret][--corp<corpId>]\nseal-usewebhookadd--name<name>--result-url<url>[--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>][--corp<corpId>]\nseal-usewebhookupdate<idOrName>[--name<name>][--result-url<url>][--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>|--rotate-secret][--corp<corpId>]\nseal-usewebhookdelete<idOrName>--yes[--corp<corpId>]\nseal-usedeployhosecloudrequirements[--corp<corpId>]\nseal-usedeployhosecloudlist[--corp<corpId>]\nseal-usedeployhosecloudget[<sign-key>][--corp<corpId>]\nseal-usedeployhosecloudstatus[--corp<corpId>]\nseal-usedeployhosecloudconfigure--json'{...}'[--corp<corpId>]\nseal-usedeployhosecloudsync[<sign-key>][--auto][--corp<corpId>]\nseal-usepreferenceget[--corp<corpId>]\nseal-usepreferencedecisionupdate--json'{\"explicitApprove\":\"...\"}'[--corp<corpId>]\nseal-usepreferencethinking-depthset--default<medium|high>[--corp<corpId>]\nseal-usepreferencethinking-depthpolicieslist[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesupsert--json'{...}'[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesremove<policyId>[--corp<corpId>]\nseal-usesourceconfig[--corp<corpId>]\nseal-usetool<toolName>[--corp<corpId>][--json'{\"key\":\"value\"}']\nseal-useapproval-runssummary--corp<corpId>[--dateYYYY-MM-DD][--timezoneAsia/Shanghai]\nseal-useapproval-runsstats--corp<corpId>[--since3months][--dedupe-bysourceDocumentSN|sourceDocumentId|id]\nseal-uLine truncated
@@ -892,7 +1146,7 @@ Return a compact report containing:
-Newversionnumberandversionname,ifpublished
-Verificationresult
-Whetheraregressionrerunwasperformed
`;var ty="# 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` generate
Line truncated
`;var rZ0="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl-fsSLhttps://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat
Line truncated
-\`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
`);return}if(n==="install"||n==="init"||n==="sync"){let o=_(r.options.local)||_(r.options.workspace),t=D(r.options.dir)??D(r.options.target)??i,u=t?t:o?w$(process.cwd(),".agents","skills","seal-use"):zu(),e=R4(u);B({installed:!0,targetDir:e.targetDir,fileCount:e.files.length,files:e.files});return}if(n==="status"||n==="get"||!n){let o=zu(),t=w$(process.cwd(),".agents","skills","seal-use");B({global:{dir:o,installed:gy(w$(o,"SKILL.md"))},local:{dir:t,installed:gy(w$(t,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${n}.Run'seal-use help'foravailablecommands.`)}async function wy(n,i){if(n==="config"){B(await ar(i));return}throw Error(`Unknownsourcecommand:${n??""}.Run'seal-use help'foravailablecommands.`)}async function fy(n,i,r,o){if(!n)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await X(n,i,r,ri(o.json),J(o.options))}function cy(){B(Tu.map((n)=>({name:n.name,description:n.description})))}import{chmodSync as pK,mkdirSync as QK,renameSync as m4,rmSync as PK,unlinkSync as Oy,writeFileSync as Uy}from"node:fs";import{dirname as FK,join as Dy}from"node:path";import{spawnSync as Zt}from"node:child_process";function f$(n=process.execPath,i=import.meta.url){if(i.includes("/$bunfs/")||i.includes("\\$bunfs\\"))return!0;let r=n.toLowerCase().replace(/\\/g,"/");return!r.endsWith("/bun")&&!r.endsWith("/bun.exe")&&!r.endsWith("/node")&&!r.endsWith("/node.exe")}var dy="yunyingk/seal-use",Ru="yunyingk/seal-home";var KK="SEAL_USE_GITHUB_REPO",BK="SEAL_HOME_GITHUB_REPO";async function ky(n,i={}){let r={appRoot:n.appRoot,entryFile:n.entryFile,stateDir:M4,version:x,launcher:n.launcher},o=i.repo||process.env[KK]?.trim()||process.env[BK]?.trim()||dy,t=i.targetVersion?.trim(),u=t&&t.toLowerCase()!=="latest"?t:void 0;if(u){let W=u.replace(/^v/,""),N=Ny(W,x);if(N<0){B({updated:!1,currentVersion:x,targetVersion:W,mode:f$()?"binary":"source",message:`Cannotdowngradeseal-usefromv${x}toolderversionv${W}.Updatesmustbeforward-only.`});return}if(N===0&&!i.force){B({updated:!1,currentVersion:x,targetVersion:W,mode:f$()?"binary":"source",message:`seal-useisalreadyatversionv${x}.Use--forcetoreinstall.`});return}}if(i.changelogOnly){let W=await x4(o,i.limit??10);B({currentVersion:x,totalQueried:W.length,releases:W.map((N)=>({version:N.version,tagName:N.tagName,publishedAt:N.publishedAt,author:N.author,releaseNotes:N.notes,releaseUrl:N.htmlUrl,isCurrent:N.version===x,isNewer:Cu(N.version,x)}))});return}if(!f$()){if(i.checkOnly){let N=await x4(o,30),M=N[0],q=M?.version??x,An=N.find((nn)=>nn.version===x),Wn=Cu(q,x),jn=N.filter((nn)=>Cu(nn.version,x));B({updated:!1,updateAvailable:Wn,currentVersion:x,currentVersionPublishedAt:An?.publishedAt,latestVersion:q,latestVersionPublishedAt:M?.publishedAt,behindCount:jn.length,pendingReleases:jn.map((nn)=>({version:nn.version,tagName:nn.tagName,publishedAt:nn.publishedAt,author:nn.author,releaseNotes:nn.notes,releaseUrl:nn.htmlUrl})),releaseNotes:M?.notes??"",releaseUrl:M?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let W=sr(r).running;if(W)await _t("stop",r);try{Ay("git",["-C",n.appRoot,"pull","--ff-only"])}catch(N){console.error(`gitpullskipped:${NinstanceofError?N.message:String(N)}`)}if(Ay("bun",["install"],{cwd:n.appRoot}),W)await _t("start",r);B({updated:!0,serviceRestarted:W,version:x,mode:"source"});return}let e=EK(),l=TK(),$=await x4(o,30),I=u?$.find((W)=>W.version===u||W.tagName===u||W.tagName===`v${u}`)??await Sy(o,u):$[0]??await Sy(o);if(!I){B({updated:!1,currentVersion:x,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${o}'`});return}let g=I.version,b=$.find((W)=>W.version===x),w=Cu(g,x),f=w||Boolean(i.force),c=$.filter((W)=>Cu(W.version,x));if(i.checkOnly){B({updated:!1,updateAvailable:w,currentVersion:x,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,behindCount:c.length,pendingReleases:c.map((W)=>({version:W.version,tagName:W.tagName,publishedAt:W.publishedAt,author:W.author,releaseNotes:W.notes,releaseUrl:W.htmlUrl})),releaseNotes:I.notes,releaseUrl:I.htmlUrl,mode:"binary"});return}if(!f){B({updated:!1,currentVersion:x,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${x})`});return}let S=VK(I.assets,e,l);if(!S)throw Error(`Nocompatiblebinaryfoundfor${e}-${l}inreleasev${g}.Availableassets:${I.assets.map((W)=>W.name).join(", ")}`);let d=sr(r).running;if(d)await _t("stop",r);let k=process.execPath,P=FK(k),Q=Dy(P,`.tmp-update-${Date.now()}`);QK(Q,{recursive:!0});try{let W=Dy(Q,S.name);await qK(S.downloadUrl,W,I.tagName,S.name);let N=W;if(S.name.endsWith(".tar.gz")||S.name.endsWith(".tgz"))N=_K(W,Q,e);else if(S.name.endsWith(".zip"))N=ZK(W,Q,e);if(pK(N,493),process.platform==="darwin")try{Zt("/usr/bin/codesign",["--remove-signature",N],{stdio:"ignore"}),Zt("/usr/
Line truncated
`)}catch{}}async function qK(n,i,r,o){let t=a4(),u=[],e=r?r.startsWith("v")?r:`v${r}`:void 0,l=o||n.split("/").pop()||"";if(t!=="github"){if(e&&l)u.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${e}/${l}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${e}/${l}`);if(n.startsWith("https://git.ying-qing.cn"))u.push(n)}if(t!=="gitea")if(e&&l){let S=`https://github.com/${dy}/releases/download/${e}/${l}`;if(!process.env.CI)u.push(`https://ghfast.top/${S}`,`https://gh.ddlc.top/${S}`);u.push(S)}else if(n.includes("github.com")){if(!process.env.CI)u.push(`https://ghfast.top/${n}`,`https://gh.ddlc.top/${n}`);u.push(n)}else u.push(n);let $=Array.from(new Set(u)),I,g=6000,b=6000,w=307200,f=1e4,c=180000;for(let S=0;S<$.length;S++){let d=$[S],k=new AbortController,P="",Q=(q)=>{P=q;try{k.abort()}catch{}},W=setTimeout(()=>{Q("Connection timed out (no response headers within 6s)")},g),N,M;try{c$(`==> [${S+1}/${$.length}] Downloading via: ${d}`);let q=await fetch(d,{signal:k.signal});if(W)clearTimeout(W),W=void 0;if(!q.ok)throw Error(`HTTP ${q.status} ${q.statusText}`);N=setTimeout(()=>{Q("Overall download time exceeded 3 minutes")},c);let An=Number(q.headers.get("content-length"))||0,Wn=q.body?.getReader();if(!Wn){let Ni=Buffer.from(await q.arrayBuffer());if(Ni.length<1000)throw Error(`Downloaded content is suspiciously small (${Ni.length} bytes)`);Uy(i,Ni),c$(`✓ Download succeeded (${(Ni.length/1024/1024).toFixed(1)} MB)`);return}let jn=[],nn=0,no=0;M=setTimeout(()=>{if(nn<w){let Ni=(nn/1024).toFixed(1);Q(`Initial transfer too slow (${Ni} KB < 300 KB in 6s), switching mirror...`)}},b);while(!0){let Ni=Wn.read(),U$,Xy=new Promise((S$,A$)=>{U$=setTimeout(()=>{A$(Error("Data transfer stalled (no chunk received for 10s)"))},f)}),i0;try{i0=await Promise.race([Ni,Xy])}finally{if(U$)clearTimeout(U$)}let{done:Hy,value:D$}=i0;if(Hy)break;if(D$){if(jn.push(D$),nn+=D$.length,M&&nn>=w)clearTimeout(M),M=void 0;let S$=Date.now();if(S$-no>200){no=S$;let A$=An?Math.round(nn/An*100):0,Yy=(nn/1048576).toFixed(1),py=An?(An/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${A$}% (${Yy} / ${py} MB)...`)}catch{}}}}try{process.stderr.write(`
`);return}if($==="install"||$==="init"||$==="sync"){let U=C0(I.options.local)||C0(I.options.workspace),Y=x(I.options.dir)??x(I.options.target)??q,J=Y?Y:U?EL(process.cwd(),".agents","skills","seal-use"):Nz(),Q=gu(J);T0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Nz(),Y=EL(process.cwd(),".agents","skills","seal-use");T0({global:{dir:U,installed:YX0(EL(U,"SKILL.md"))},local:{dir:Y,installed:YX0(EL(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function QX0($,q){if($==="config"){T0(await PY(q));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function KX0($,q,I,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await O0($,q,I,a6(U.json),L0(U.options))}function zX0(){T0(Hz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as Ew1,mkdirSync as gw1,renameSync as Bu,rmSync as jw1,unlinkSync as WX0,writeFileSync as wX0}from"node:fs";import{dirname as Bw1,join as GX0}from"node:path";import{spawnSync as Kq}from"node:child_process";function gL($=process.execPath,q=import.meta.url){if(q.includes("/$bunfs/")||q.includes("\\$bunfs\\"))return!0;let I=$.toLowerCase().replace(/\\/g,"/");return!I.endsWith("/bun")&&!I.endsWith("/bun.exe")&&!I.endsWith("/node")&&!I.endsWith("/node.exe")}var ZX0="yunyingk/seal-use",Mz="yunyingk/seal-home";var Rw1="SEAL_USE_GITHUB_REPO",vw1="SEAL_HOME_GITHUB_REPO";async function XX0($,q={}){let I={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Au,version:t0,launcher:$.launcher},U=q.repo||process.env[Rw1]?.trim()||process.env[vw1]?.trim()||ZX0,Y=q.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let P=J.replace(/^v/,""),B=DX0(P,t0);if(B<0){T0({updated:!1,currentVersion:t0,targetVersion:P,mode:gL()?"binary":"source",message:`Cannotdowngradeseal-usefromv${t0}toolderversionv${P}.Updatesmustbeforward-only.`});return}if(B===0&&!q.force){T0({updated:!1,currentVersion:t0,targetVersion:P,mode:gL()?"binary":"source",message:`seal-useisalreadyatversionv${t0}.Use--forcetoreinstall.`});return}}if(q.changelogOnly){let P=await Ru(U,q.limit??10);T0({currentVersion:t0,totalQueried:P.length,releases:P.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===t0,isNewer:Fz(B.version,t0)}))});return}if(!gL()){if(q.checkOnly){let B=await Ru(U,30),k=B[0],h=k?.version??t0,f=B.find((p)=>p.version===t0),S=Fz(h,t0),t=B.filter((p)=>Fz(p.version,t0));T0({updated:!1,updateAvailable:S,currentVersion:t0,currentVersionPublishedAt:f?.publishedAt,latestVersion:h,latestVersionPublishedAt:k?.publishedAt,behindCount:t.length,pendingReleases:t.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:k?.notes??"",releaseUrl:k?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let P=EY(I).running;if(P)await Qq("stop",I);try{VX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(VX0("bun",["install"],{cwd:$.appRoot}),P)await Qq("start",I);T0({updated:!0,serviceRestarted:P,version:t0,mode:"source"});return}let Q=Cw1(),K=_w1(),z=await Ru(U,30),w=J?z.find((P)=>P.version===J||P.tagName===J||P.tagName===`v${J}`)??await HX0(U,J):z[0]??await HX0(U);if(!w){T0({updated:!1,currentVersion:t0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let G=w.version,H=z.find((P)=>P.version===t0),V=Fz(G,t0),W=V||Boolean(q.force),X=z.filter((P)=>Fz(P.version,t0));if(q.checkOnly){T0({updated:!1,updateAvailable:V,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,behindCount:X.length,pendingReleases:X.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl})),releaseNotes:w.notes,releaseUrl:w.htmlUrl,mode:"binary"});return}if(!W){T0({updated:!1,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${t0})`});return}let D=hw1(w.assets,Q,K);if(!D)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${G}.Availableassets:${w.assets.map((P)=>P.name).join(", ")}`);let L=EY(I).running;if(L)await Qq("stop",I);let N=process.execPath,E=Bw1(N),T=GX0(E,`.tmp-update-${Date.now()}`);gw1(T,{recursive:!0});try{let P=GX0(T,D.name);await Sw1(D.downloadUrl,P,w.tagName,D.name);let B=P;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))B=yw1(P,T,Q);else if(D.name.endsWith(".zip"))B=uw1(P,T,Q);if(Ew1(B,493),process.platform==="darwin")try{Kq("/usr/bin/codesig
Line truncated
`)}catch{}}async function Sw1($,q,I,U){let Y=vu(),J=[],Q=I?I.startsWith("v")?I:`v${I}`:void 0,K=U||$.split("/").pop()||"";if(Y!=="github"){if(Q&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${Q}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${Q}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Y!=="gitea")if(Q&&K){let D=`https://github.com/${ZX0}/releases/download/${Q}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${D}`,`https://gh.ddlc.top/${D}`);J.push(D)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let z=Array.from(new Set(J)),w,G=6000,H=6000,V=307200,W=1e4,X=180000;for(let D=0;D<z.length;D++){let L=z[D],N=new AbortController,E="",T=(h)=>{E=h;try{N.abort()}catch{}},P=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},G),B,k;try{jL(`==> [${D+1}/${z.length}] Downloading via: ${L}`);let h=await fetch(L,{signal:N.signal});if(P)clearTimeout(P),P=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);B=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let f=Number(h.headers.get("content-length"))||0,S=h.body?.getReader();if(!S){let b=Buffer.from(await h.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);wX0(q,b),jL(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let t=[],p=0,C=0;k=setTimeout(()=>{if(p<V){let b=(p/1024).toFixed(1);T(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},H);while(!0){let b=S.read(),J0,g=new Promise((K0,G0)=>{J0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},W)}),u;try{u=await Promise.race([b,g])}finally{if(J0)clearTimeout(J0)}let{done:d,value:a}=u;if(d)break;if(a){if(t.push(a),p+=a.length,k&&p>=V)clearTimeout(k),k=void 0;let K0=Date.now();if(K0-C>200){C=K0;let G0=f?Math.round(p/f*100):0,M0=(p/1048576).toFixed(1),v0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${M0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
"description":"Planned HTTP contract for the seal-use wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-use is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
description:"v0.10.3: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.10: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version:0.10.3
short-description:Seal tenant and Hose approval automation (v0.10.3)
version:0.10.10
short-description:Seal tenant and Hose approval automation (v0.10.10)
---
# Seal Use (v0.10.3)
# Seal Use (v0.10.10)
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-use` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -66,7 +66,9 @@ seal-use corps list
- System Permissions Config: `seal-use permissions available --corp <corpId>`, `seal-use permissions configs --corp <corpId>`.
- Billing & Feature Quotas: `seal-use billing status --corp <corpId>`, `seal-use billing plans --corp <corpId>`, `seal-use billing features --corp <corpId>`.
This should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.
`seal-use service status` returns the PID, version, state directory, PID file, and log file for the optional local background process.
`seal-use service <start|stop|restart|status|logs>` manages the persistent background service daemon with embedded HTTP server (serving `/docs`, `/openapi.json`, and `POST /api/cli`). `status` returns the PID, version, host, port, active HTTP URL, state directory, PID file, and log file.
`seal-use update` updates the git checkout, runs `bun install`, and restarts the local service if it was running.
Identity and session:
-`seal-use auth diagnose --corp <corpId>`
-`seal_whoami`
-`seal_session_get`
-`seal-use corps list`
-`seal-use corps current`
Approval rule maintenance:
-`seal-use rules count [--corp <corpId>]`
-`seal-use rules list --summary [--corp <corpId>]`
Webhook writes read the current AI approval config and POST the merged full config back to `api/v1/agent/ai-approval/config`, preserving non-Webhook integrations. List/get mask `secret` by default; add returns the generated secret once.
Use this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.
## Key Principles
- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled: false`) to avoid unsolicited noise during standard operations.
- **Explicit Triggering**: `seal-use rules lint` always runs regardless of global configuration.
- **Draft Hook**: When `seal-use config lint enable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.
- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.
## CLI Commands
### 1. Lint Current Draft Rules (Whole-RuleSet Scan)
```bash
seal-use rules lint --corp <corpId>
```
### 2. Lint Specific Historical Version or Single Rule
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.