- 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.
@@ -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{createRequireassN}from"node:module";varZN=Object.create;var{getPrototypeOf:MN,defineProperty:O$,getOwnPropertyNames:zN}=Object;varCN=Object.prototype.hasOwnProperty;functionRN(n){returnthis[n]}varhN,mN,$4=(n,i,r)=>{varo=n!=null&&typeofn==="object";if(o){vart=i?hN??=newWeakMap:mN??=newWeakMap,u=t.get(n);if(u)returnu}r=n!=null?ZN(MN(n)):{};lete=i||!n||!n.__esModule?O$(r,"default",{value:n,enumerable:!0}):r;for(letlofzN(n))if(!CN.call(e,l))O$(e,l,{get:RN.bind(n,l),enumerable:!0});if(o)t.set(n,e);returne};varH=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);varxN=(n)=>n;functionaN(n,i){this[n]=xN.bind(null,i)}varFi=(n,i)=>{for(varrini)O$(n,r,{get:i[r],enumerable:!0,configurable:!0,set:aN.bind(i,r)})};varI4=sN(import.meta.url);varru=H((ED)=>{Object.defineProperty(ED,"__esModule",{value:!0});ED.regexpCode=ED.getEsmExportName=ED.getProperty=ED.safeStringify=ED.stringify=ED.strConcat=ED.addCodeArg=ED.str=ED._=ED.nil=ED._Code=ED.Name=ED.IDENTIFIER=ED._CodeOrName=void0;classZl{}ED._CodeOrName=Zl;ED.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classJrextendsZl{constructor(n){super();if(!ED.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}}}ED.Name=Jr;classwiextendsZl{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},{})}}ED._Code=wi;ED.nil=newwi("");functionPD(n,...i){letr=[n[0]],o=0;while(o<i.length)Kc(r,i[o]),r.push(n[++o]);returnnewwi(r)}ED._=PD;varFc=newwi("+");functionBD(n,...i){letr=[tu(n[0])],o=0;while(o<i.length)r.push(Fc),Kc(r,i[o]),r.push(Fc,tu(n[++o]));returndJ(r),newwi(r)}ED.str=BD;functionKc(n,i){if(iinstanceofwi)n.push(...i._items);elseif(iinstanceofJr)n.push(i);elsen.push(yJ(i))}ED.addCodeArg=Kc;functiondJ(n){leti=1;while(i<n.length-1){if(n[i]===Fc){letr=kJ(n[i-1],n[i+1]);if(r!==void0){n.splice(i-1,3,r);continue}n[i++]="+"}i++}}functionkJ(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}functionOJ(n,i){returni.emptyStr()?n:n.emptyStr()?i:BD`${n}${i}`}ED.strConcat=OJ;functionyJ(n){returntypeofn=="number"||typeofn=="boolean"||n===null?n:tu(Array.isArray(n)?n.join(","):n)}functionLJ(n){returnnewwi(tu(n))}ED.stringify=LJ;functiontu(n){returnJSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ED.safeStringify=tu;functionNJ(n){returntypeofn=="string"&&ED.IDENTIFIER.test(n)?newwi(`.${n}`):PD`[${n}]`}ED.getProperty=NJ;functionGJ(n){if(typeofn=="string"&&ED.IDENTIFIER.test(n))returnnewwi(`${n}`);throwError(`CodeGen: invalid export name: ${n}, use explicit $id name mapping`)}ED.getEsmExportName=GJ;functionWJ(n){returnnewwi(n.toString())}ED.regexpCode=WJ});varTc=H((qD)=>{Object.defineProperty(qD,"__esModule",{value:!0});qD.ValueScope=qD.ValueScopeName=qD.Scope=qD.varKinds=qD.UsedValueState=void0;varsn=ru();classVDextendsError{constructor(n){super(`CodeGen: "code" for ${n} not defined`);this.value=n.value}}varzl;(function(n){n[n.Started=0]="Started",n[n.Completed=1]="Completed"})(zl||(qD.UsedValueState=zl={}));qD.varKinds={const:newsn.Name("const"),let:newsn.Name("let"),var:newsn.Name("var")};classBc{constructor({prefixes:n,parent:i}={}){this._names={},this._prefixes=n,this._parent=i}toName(n){returnninstanceofsn.Name?n:this.name(n)}name(n){returnnewsn.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}}}qD.Scope=Bc;classEcextendssn.Name{constructor(n,i){super(i);this.prefix=n}setValue(n,{property:i,itemIndex:r}){this.value=n,this.scopePath=sn._`.${newsn.Name(i)}[${r}]`}}qD.ValueScopeName=Ec;varTJ=sn._`\n`;class_DextendsBc{constructor(n){super(n);this._values={},this._scope=n.scope,this.opts={...n,_n:n.lines?TJ:sn.nil}}get(){returnthis._scope}name(n){returnnewEc(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 xD]}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 MD(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 qc(n,i,r))}add(n,i){return this._leafNode(new zD(n,ni.operators.ADD,i))}code(n){if(typeof n=="function")n();else if(n!==s.nil)this._leafNode(new mD(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 ou)}endIf(){return this._endBlockNode(Ti,ou)}_for(n,i){if(this._blockNode(n),i)this.code(i).endFor();return this}for(n,i){return this._for(new aD(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 sD(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 Vc("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 Vc("in",o,t,i),()=>r(t))}endFor(){return this._endBlockNode(Xr)}label(n){return this._leafNode(new CD(n))}break(n){return this._leafNode(new RD(n))}return(n){let i=new Rl;if(this._blockNode(i),this.code(n),i.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Rl)}try(n,i,r){if(!i&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new n1;if(this._blockNode(o),this.code(n),i){let t=this.name("e");this._currNode=o.catch=new hl(t),i(t)}if(r)this._currNode=o.finally=new ml,this.code(r);return this._endBlockNode(hl,ml)}throw(n){return this._leafNode(new hD(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 Cl(n,i,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(Cl)}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}}ni.CodeGen=i1;function Yt(n,i){for(let r in i)n[r]=(n[r]||0)+(i[r]||0);return n}function xl(n,i){return i instanceof s._CodeOrName?Yt(n,i.names):n}function Hr(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 ZJ(n,i){for(let r in i)n[r]=(n[r]||0)-(i[r]||0)}function t1(n){return typeof n=="boolean"||typeof n=="number"||n===null?!n:s._`!${_c(n)}`}ni.not=t1;var MJ=r1(ni.operators.AND);function zJ(...n){return n.reduce(MJ)}ni.and=zJ;var CJ=r1(ni.operators.OR);function RJ(...n){return n.reduce(CJ)}ni.or=RJ;function r1(n){return(i,r)=>i===s.nil?r:r===s.nil?i:s._`${_c(i)}${n}${_c(r)}`}function _c(n){return n instanceof s.Name?n:s._`(${n})`}});var tn=H((b1)=>{Object
Line truncated
deps:${r}}`};var C5={keyword:"dependencies",type:"object",schemaType:"object",error:od.error,code(n){let[i,r]=R5(n);td(n,i),rd(n,r)}};function R5({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 td(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,Ou.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,Ou.checkReportMissingProp)(n,I)});else r.if(L6._`${$}&&(${(0,Ou.checkMissingProp)(n,l,u)})`),(0,Ou.reportMissingProp)(n,u),r.else()}}od.validatePropertyDeps=td;function rd(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,z5.alwaysValidSchema)(u,i[l]))continue;r.if((0,Ou.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)}}od.validateSchemaDeps=rd;od.default=C5});var Id=H(($d)=>{Object.defineProperty($d,"__esModule",{value:!0});var vd=R(),x5=tn(),a5={message:"property name must be valid",params:({params:n})=>vd._`{propertyName:${n.propertyName}}`},s5={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:a5,code(n){let{gen:i,schema:r,data:o,it:t}=n;if((0,x5.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,vd.not)(u),()=>{if(n.error(!0),!t.allErrors)i.break()})}),n.ok(u)}};$d.default=s5});var N6=H((gd)=>{Object.defineProperty(gd,"__esModule",{value:!0});var Av=gi(),Si=R(),i7=Vi(),dv=tn(),t7={message:"must NOT have additional properties",params:({params:n})=>Si._`{additionalProperty:${n.additionalProperty}}`},r7={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:t7,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,dv.alwaysValidSchema)(e,r))return;let I=(0,Av.allSchemaProperties)(o.properties),g=(0,Av.allSchemaProperties)(o.patternProperties);b(),n.ok(Si._`${u}===${i7.default.errors}`);function b(){i.forIn("key",t,(k)=>{if(!I.length&&!g.length)c(k);else i.if(f(k),()=>c(k))})}function f(k){let O;if(I.length>8){let F=(0,dv.schemaRefOrVal)(e,o.properties,"properties");O=(0,Av.isOwnProperty)(i,F,k)}else if(I.length)O=(0,Si.or)(...I.map((F)=>Si._`${k}===${F}`));else O=Si.nil;if(g.length)O=(0,Si.or)(O,...g.map((F)=>Si._`${(0,Av.usePattern)(n,F)}.test(${k})`));return(0,Si.not)(O)}function w(k){i.code(Si._`delete${t}[${k}]`)}function c(k){if($.removeAdditional==="all"||$.removeAdditional&&r===!1){w(k);return}if(r===!1){if(n.setParams({additionalProperty:k}),n.error(),!l)i.break();return}if(typeof r=="object"&&!(0,dv.alwaysValidSchema)(e,r)){let O=i.name("valid");if($.removeAdditional==="failing")S(k,O,!1),i.if((0,Si.not)(O),()=>{n.reset(),w(k)});else if(S(k,O),!l)i.if((0,Si.not)(O),()=>i.break())}}function S(k,O,F){let Q={keyword:"additionalProperties",dataProp:k,dataPropType:dv.Type.Str};if(F===!1)Object.assign(Q,{compositeRule:!0,createErrors:!1,allErrors:!1});n.subschema(Q,O)}}};gd.default=r7});var cd=H((wd)=>{Object.defineProperty(wd,"__esModule",{value:!0});var u7=Iu(),bd=gi(),G6=tn(),fd=N6(),e7={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)fd.default.code(new u7.KeywordCxt(u,fd.default,"additionalProperties"));let e=(0,bd.allSchemaProperties)(r);for(let b of e)u.definedProperties.add(b);if(u.opts.unevaluated&&e.length&&u.props!==!0)u.props=G6.mergeEvaluated.props(i,(0,G6.toHash)(e),u.props);let l=e.filter((b)=>!(0,G6.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,bd.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},$)}}};wd.default=e7});var dd=H((Ad)=>{Object.defineProperty(Ad,"__esModule",{value:!0});var Ud=gi(),kv=R(),Dd=tn(),Sd=tn(),v7={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,Ud.allSchemaProperties)(r),$=l.filter((S)=>(0,Dd.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 kv.Name))u.props=(0,Sd.
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 T=D("$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(Q$(e))continue;if(!b._zod.def.when(e))continue}else if(I)continue;let f=e.issues.length,w=b._zod.check(e);if(w instanceof Promise&&$?.async===!1)throw new Li;if(g||w instanceof Promise)g=(g??Promise.resolve()).then(async()=>{if(await w,e.issues.length===f)return;if(!I)I=ai(e,f)});else{if(e.issues.length===f)continue;if(!I)I=ai(e,f)}}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=st(n,t);return u.success?{value:u.data}:{issues:u.error?.issues}}catch(u){return co(n,t).then((e)=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),pt=D("$ZodString",(n,i)=>{T.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??oI(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=D("$ZodStringFormat",(n,i)=>{ir.init(n,i),pt.init(n,i)}),HI=D("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=Z$),$n.init(n,i)}),YI=D("$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=Wt(o))}else i.pattern??(i.pattern=Wt());$n.init(n,i)}),QI=D("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=M$),$n.init(n,i)}),FI=D("$ZodURL",(n,i)=>{$n.init(n,i),n._zod.check=(r)=>{try{let o=r.value.trim();if(!i.normalize&&i.protocol?.source===s$.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})}}}),KI=D("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=z$()),$n.init(n,i)}),PI=D("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=_$),$n.init(n,i)}),BI=D("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=P$),$n.init(n,i)}),EI=D("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=B$),$n.init(n,i)}),TI=D("$ZodULID",(n,i)=>{i.pattern??(i.pattern=E$),$n.init(n,i)}),VI=D("$ZodXID",(n,i)=>{i.pattern??(i.pattern=T$),$n.init(n,i)}),_I=D("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=V$),$n.init(n,i)}),qI=D("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=rI(i)),$n.init(n,i)}),ZI=D("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=iI),$n.init(n,i)}),MI=D("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=tI(i)),$n.init(n,i)}),zI=D("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=q$),$n.init(n,i)}),CI=D("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=C$),$n.init(n,i),n._zod.bag.format="ipv4"}),RI=D("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=R$),$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})}}}),hI=D("$ZodMAC",(n,i)=>{i.pattern??(i.pattern=h$(i.delimiter)),$n.init(n,i),n._zod.bag.format="mac"}),mI=D("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=m$),$n.init(n,i)}),xI=D("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=x$),$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 aI(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{createRequireasWL0}from"node:module";varYL0=Object.create;var{getPrototypeOf:JL0,defineProperty:SD,getOwnPropertyNames:QL0}=Object;varKL0=Object.prototype.hasOwnProperty;functionzL0($){returnthis[$]}varwL0,GL0,CY=($,q,I)=>{varU=$!=null&&typeof$==="object";if(U){varY=q?wL0??=newWeakMap:GL0??=newWeakMap,J=Y.get($);if(J)returnJ}I=$!=null?YL0(JL0($)):{};letQ=q||!$||!$.__esModule?SD(I,"default",{value:$,enumerable:!0}):I;for(letKofQL0($))if(!KL0.call(Q,K))SD(Q,K,{get:zL0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varO=($,q)=>()=>(q||$((q={exports:{}}).exports,q),q.exports);varHL0=($)=>$;functionVL0($,q){this[$]=HL0.bind(null,q)}varl8=($,q)=>{for(varIinq)SD($,I,{get:q[I],enumerable:!0,configurable:!0,set:VL0.bind(q,I)})};varo=WL0(import.meta.url);varvJ=O((cf)=>{Object.defineProperty(cf,"__esModule",{value:!0});cf.regexpCode=cf.getEsmExportName=cf.getProperty=cf.safeStringify=cf.stringify=cf.strConcat=cf.addCodeArg=cf.str=cf._=cf.nil=cf._Code=cf.Name=cf.IDENTIFIER=cf._CodeOrName=void0;classhG{}cf._CodeOrName=hG;cf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classpqextendshG{constructor($){super();if(!cf.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}cf.Name=pq;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(Iinstanceofpq)q[I.str]=(q[I.str]||0)+1;returnq},{})}}cf._Code=x$;cf.nil=newx$("");functionbf($,...q){letI=[$[0]],U=0;while(U<q.length)mP(I,q[U]),I.push($[++U]);returnnewx$(I)}cf._=bf;varlP=newx$("+");functionpf($,...q){letI=[RJ($[0])],U=0;while(U<q.length)I.push(lP),mP(I,q[U]),I.push(lP,RJ($[++U]));returnSF0(I),newx$(I)}cf.str=pf;functionmP($,q){if(qinstanceofx$)$.push(...q._items);elseif(qinstanceofpq)$.push(q);else$.push(xF0(q))}cf.addCodeArg=mP;functionSF0($){letq=1;while(q<$.length-1){if($[q]===lP){letI=yF0($[q-1],$[q+1]);if(I!==void0){$.splice(q-1,3,I);continue}$[q++]="+"}q++}}functionyF0($,q){if(q==='""')return$;if($==='""')returnq;if(typeof$=="string"){if(qinstanceofpq||$[$.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]==='"'&&!($instanceofpq))return`"${$}${q.slice(1)}`;return}functionuF0($,q){returnq.emptyStr()?$:$.emptyStr()?q:pf`${$}${q}`}cf.strConcat=uF0;functionxF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:RJ(Array.isArray($)?$.join(","):$)}functionkF0($){returnnewx$(RJ($))}cf.stringify=kF0;functionRJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}cf.safeStringify=RJ;functionfF0($){returntypeof$=="string"&&cf.IDENTIFIER.test($)?newx$(`.${$}`):bf`[${$}]`}cf.getProperty=fF0;functionnF0($){if(typeof$=="string"&&cf.IDENTIFIER.test($))returnnewx$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}cf.getEsmExportName=nF0;functionbF0($){returnnewx$($.toString())}cf.regexpCode=bF0});varaP=O((of)=>{Object.defineProperty(of,"__esModule",{value:!0});of.ValueScope=of.ValueScopeName=of.Scope=of.varKinds=of.UsedValueState=void0;vark6=vJ();classlfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varyG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(yG||(of.UsedValueState=yG={}));of.varKinds={const: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}}}of.Scope=rP;classtPextendsk6.Name{constructor($,q){super(q);this.prefix=$}setValue($,{property:q,itemIndex:I}){this.value=$,this.scopePath=k6._`.${newk6.Name(q)}[${I}]`}}of.ValueScopeName=tP;var$M0=k6._`\n`;classmfextendsrP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?$M0: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 Kj0={keyword:"dependencies",type:"object",schemaType:"object",error:Gp.error,code($){let[q,I]=zj0($);zp($,q),wp($,I)}};function zj0({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 zp($,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,rJ.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,rJ.checkReportMissingProp)($,w)});else I.if(yT._`${z}&&(${(0,rJ.checkMissingProp)($,K,J)})`),(0,rJ.reportMissingProp)($,J),I.else()}}Gp.validatePropertyDeps=zp;function wp($,q=$.schema){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");for(let K in q){if((0,Qj0.alwaysValidSchema)(J,q[K]))continue;I.if((0,rJ.propertyInData)(I,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>I.var(Q,!0)),$.ok(Q)}}Gp.validateSchemaDeps=wp;Gp.default=Kj0});var Lp=O((Xp)=>{Object.defineProperty(Xp,"__esModule",{value:!0});var Zp=m0(),Hj0=z1(),Vj0={message:"property name must be valid",params:({params:$})=>Zp._`{propertyName:${$.propertyName}}`},Wj0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Vj0,code($){let{gen:q,schema:I,data:U,it:Y}=$;if((0,Hj0.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,Zp.not)(J),()=>{if($.error(!0),!Y.allErrors)q.break()})}),$.ok(J)}};Xp.default=Wj0});var uT=O((Dp)=>{Object.defineProperty(Dp,"__esModule",{value:!0});var zH=O$(),b$=m0(),Xj0=s8(),wH=z1(),Lj0={message:"must NOT have additional properties",params:({params:$})=>b$._`{additionalProperty:${$.additionalProperty}}`},Dj0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Lj0,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}===${Xj0.default.errors}`);function H(){q.forIn("key",Y,(D)=>{if(!w.length&&!G.length)X(D);else q.if(V(D),()=>X(D))})}function V(D){let N;if(w.length>8){let E=(0,wH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,zH.isOwnProperty)(q,E,D)}else if(w.length)N=(0,b$.or)(...w.map((E)=>b$._`${D}===${E}`));else N=b$.nil;if(G.length)N=(0,b$.or)(N,...G.map((E)=>b$._`${(0,zH.usePattern)($,E)}.test(${D})`));return(0,b$.not)(N)}function W(D){q.code(b$._`delete${Y}[${D}]`)}function X(D){if(z.removeAdditional==="all"||z.removeAdditional&&I===!1){W(D);return}if(I===!1){if($.setParams({additionalProperty:D}),$.error(),!K)q.break();return}if(typeof I=="object"&&!(0,wH.alwaysValidSchema)(Q,I)){let N=q.name("valid");if(z.removeAdditional==="failing")L(D,N,!1),q.if((0,b$.not)(N),()=>{$.reset(),W(D)});else if(L(D,N),!K)q.if((0,b$.not)(N),()=>q.break())}}function L(D,N,E){let T={keyword:"additionalProperties",dataProp:D,dataPropType:wH.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,N)}}};Dp.default=Dj0});var Mp=O((Fp)=>{Object.defineProperty(Fp,"__esModule",{value:!0});var Nj0=xJ(),Op=O$(),xT=z1(),Np=uT(),Fj0={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)Np.default.code(new Nj0.KeywordCxt(J,Np.default,"additionalProperties"));let Q=(0,Op.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,Op.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)}}};Fp.default=Fj0});var gp=O((Ep)=>{Object.defineProperty(Ep,"__esModule",{value:!0});var Ap=O$(),GH=m0(),Pp=z1(),Tp=z1(),Aj0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:q,schema:I,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Ap.allSchemaProperties)(I),z=K.filter((L)=>(0,Pp.alwaysValidSchema)(J,I[L]));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($),IR(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)x00(this._xml,$,q)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");IR(this._xml,$)}writeText($){let q=this._xml;if(this.open)q.push(">"),this.open=!1;this.leaf=!1,q.push(u00.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("")}}UR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};k00.exports=UR});var YR=O((Di0)=>{var f00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Li0($){if(typeof $==="string")return $;if(f00)return f00.decode($);return $.toString()}Di0.bufferToString=Li0});var c00=O((b00)=>{Object.defineProperty(b00,"__esModule",{value:!0});b00.CHAR=`
`,$=this.i;break;case xp0:{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(D2($))this.state=_p0,this.unget(),this.xmlDeclPossible=!1;else switch($){case SW:this.state=yp0,this.xmlDeclPossible=!1;break;case W10:this.state=Ap0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case q6:this.state=jp0;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=ZR,this.openWakaBang="";break;case"--":this.state=WR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=GR,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=Pp0}sCommentEnding(){var $;let q=this.getCodeNorm();if(q===hW)this.state=Tp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(q)}`,this.state=WR}sCommentEnded(){let $=this.getCodeNorm();if($!==h4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=WR;else this.state=v6}sCData(){if(this.captureToChar(qU))this.state=Ep0}sCDataEnding(){let $=this.getCodeNorm();if($===qU)this.state=gp0;else this.text+=`]${String.fromCodePoint($)}`,this.state=ZR}sCDataEnding2(){var $;let q=this.getCodeNorm();switch(q){case h4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=v6;break}case qU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(q)}`,this.state=ZR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=Q10;else if($===q6||d6($))this.fail("processing instruction without a target."),this.state=$===q6?_W:XR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=Q10}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===q6;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?Q3:K10}else this.state=U?_W:XR;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($===q6)this.state=_W;else if(!d6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(q6))this.state=_W}sPIEnding(){var $;let q=this.getCodeNorm();if(q===h4){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===q6)this.text+="?";else this.text+=`?${String.fromCodePoint(q)}`,this.state=XR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===q6){this.state=Q3;return}if($!==Y4)this.state=Bp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(np0);if($===q6){this.state=Q3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(d6($)||$===$U))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=$===$U?z10:Rp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===q6){this.state=Q3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if($!==$U)this.fail("value required.");this.state=z10}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===q6){this.state=Q3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if(!yW($))this.fail("value must be quoted."),this.q=V10;else this.q=$;this.state=vp0}sXMLDeclValue(){let $=this.captureTo([this.q,q6]);if($===q6){this.state=Q3,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 S4($,q).found}function S4($,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,L){if(typeof X!=="function")throw new K(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var D=Object(L).yieldHandler,N=W,E=Error().stack;return function(){var T=X.apply(this,arguments),P=new N(void 0,void 0,D,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=f3(),z=gK0(),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={},L={},D=CK0()(C,W),N=hK0()(C,W,D,I,U),E=yK0()(C),T=E.create,P=xK0()(C,E),B=P.CapturedTrace,k=fK0()(C,D),h=bK0()(L),f=MS(),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=PS.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=D(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(lD(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=Vq($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return pY($,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()??LO($._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)=>{Zq.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=rD),_1.init($,q)}),aO=m("$ZodCUID2",($,q)=>{q.pattern??(q.pattern=tD),_1.init($,q)}),sO=m("$ZodULID",($,q)=>{q.pattern??(q.pattern=aD),_1.init($,q)}),eO=m("$ZodXID",($,q)=>{q.pattern??(q.pattern=sD),_1.init($,q)}),$N=m("$ZodKSUID",($,q)=>{q.pattern??(q.pattern=eD),_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
`)}w.write("payload.value = newResult;"),w.write("return payload;");let F=w.compile();return(Q,W)=>F(f,Q,W)},u,e=Gt,l=!Lt.jitless,I=l&&p$.value,g=i.catchall,b;n._zod.parse=(f,w)=>{b??(b=o.value);let c=f.value;if(!e(c))return f.issues.push({expected:"object",code:"invalid_type",input:c,inst:n}),f;if(l&&I&&w?.async===!1&&w.jitless!==!0){if(!u)u=t(i.shape);if(f=u(f,w),!g)return f;return h4([],c,f,w,b,n)}return r(f,w)}});function Y4(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)=>Zn(e,o,On())))}),i}var ko=D("$ZodUnion",(n,i)=>{T.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)=>eo(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 Y4(e,o,n,t);return Promise.all(e).then((l)=>{return Y4(l,o,n,t)})}});function Q4(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)=>Zn(e,o,On())))});else i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:[],inclusive:!1});return i}var Ug=D("$ZodXor",(n,i)=>{ko.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 Q4(e,o,n,t);return Promise.all(e).then((l)=>{return Q4(l,o,n,t)})}}),Dg=D("$ZodDiscriminatedUnion",(n,i)=>{i.inclusive=!1,ko.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=Rt(()=>{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(!Gt(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}}),Sg=D("$ZodIntersection",(n,i)=>{T.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 F4(r,$,I)});return F4(r,u,e)}});function XI(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=XI(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=XI(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 F4(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=XI(i.value,r.value);if(!e.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(e.mergeErrorPath)}`);return n.value=e.data,n}var de=D("$ZodTuple",(n,i)=>{T.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&&nD.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 ex([],X,V,W,H,$)}return I(V,W)}});function xx($,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 oY=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)=>SY(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 xx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return xx(K,U,$,Y)})}});function kx($,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)=>{oY.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 kx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return kx(K,U,$,Y)})}}),RN=m("$ZodDiscriminatedUnion",($,q)=>{q.inclusive=!1,oY.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=Kq(()=>{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 fx(I,z,w)});return fx(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 fx($,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);letw=n.seen.get(b),c=w.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(letkinI){if(k==="$ref"||k==="allOf")continue;if(!(king))deleteI[k]}if(c.$ref&&w.def)for(letkinI){if(k==="$ref"||k==="allOf")continue;if(kinw.def&&JSON.stringify(I[k])===JSON.stringify(w.def[k]))deleteI[k]}}letf=l._zod.parent;if(f&&f!==b){o(f);letw=n.seen.get(f);if(w?.schema.$ref){if(I.$ref=w.schema.$ref,w.def)for(letcinI){if(c==="$ref"||c==="allOf")continue;if(cinw.def&&JSON.stringify(I[c])===JSON.stringify(w.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:Ur(i,"input",n.processors),output:Ur(i,"output",n.processors)}},enumerable:!1,writable:!1}),l}catch(l){throwError("Error converting schema to JSON.")}}functionzn(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")returnzn(o.element,r);if(o.type==="set")returnzn(o.valueType,r);if(o.type==="lazy")returnzn(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")returnzn(o.innerType,r);if(o.type==="intersection")returnzn(o.left,r)||zn(o.right,r);if(o.type==="record"||o.type==="map")returnzn(o.keyType,r)||zn(o.valueType,r);if(o.type==="pipe"){if(n._zod.traits.has("$ZodCodec"))return!0;returnzn(o.in,r)||zn(o.out,r)}if(o.type==="object"){for(lettino.shape)if(zn(o.shape[t],r))return!0;return!1}if(o.type==="union"){for(lettofo.options)if(zn(t,r))return!0;return!1}if(o.type==="tuple"){for(lettofo.items)if(zn(t,r))return!0;if(o.rest&&zn(o.rest,r))return!0;return!1}return!1}varNf=(n,i={})=>(r)=>{leto=it({...r,processors:i});returnln(n,o),tt(o,n),rt(o,n)},Ur=(n,i,r={})=>(o)=>{let{libraryOptions:t,target:u}=o??{},e=it({...t??{},target:u,io:i,processors:r});returnln(n,e),tt(e,n),rt(e,n)};vardp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gf=(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=dp[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}))]}},Wf=(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),f=typeofI==="number"&&I<=(e??Number.POSITIVE_INFINITY),w=i.target==="draft-04"||i.target==="openapi-3.0";if(b)if(w)t.minimum=g,t.exclusiveMinimum=!0;elset.exclusiveMinimum=g;elseif(typeofu==="number")t.minimum=u;if(f)if(w)t.maximum=I,t.exclusiveMaximum=!0;elset.exclusiveMaximum=I;elseif(typeofe==="number")t.maximum=e;if(typeof$==="number")t.multipleOf=$},pf=(n,i,r,o)=>{r.type="boolean"},jf=(n,i,r,o)=>{if(i.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},Jf=(n,i,r,o)=>{if(i.unrepresentable==="Line truncated
`}class q6{constructor(n=yk.stdin,i=yk.stdout){this._stdin=n,this._stdout=i,this._readBuffer=new _6,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=Ok(n);if(this._stdout.write(r))i();else this._stdout.once("drain",i)})}}import{dirname as e4,join as IB}from"node:path";import{fileURLToPath as gB}from"node:url";class Zi extends Error{name="KyError";get isKyError(){return!0}}class ri 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 Nu extends Zi{name="NetworkError";request;constructor(n,i){super(`Requestfailedduetoanetworkerror:${n.method}${n.url}`,i);this.request=n}}class Gu 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 qr extends Zi{name="ForceRetryError";customDelay;code;customRequest;constructor(n){let i=n?.cause?n.cause instanceof Error?n.cause:new Gu(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 Z6 extends Error{name="SchemaValidationError";issues;constructor(n){super("Response schema validation failed");this.issues=n}}class di extends Zi{name="TimeoutError";request;constructor(n){super(`Requesttimedout:${n.method}${n.url}`);this.request=n}}var M6=(()=>{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})(),Lk=typeof globalThis.AbortController==="function",Gv=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Nk=typeof globalThis.ReadableStream==="function",Gk=typeof globalThis.FormData==="function",Wv=["get","post","put","patch","head","delete"],qQ=()=>{return};qQ();var Wk={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Zr=2147483647,pk=40,pv=Symbol("stop");class jv{options;constructor(n){this.options=n}}var jk=(n)=>new jv(n),Jk={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},Xk={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 Jv=new TextEncoder,ZQ=(n)=>{if(!n)return 0;if(n instanceof FormData){let i=0;for(let[r,o]of n)i+=pk,i+=Jv.encode(`Content-Disposition:form-data;name="${r}"`).byteLength,i+=typeof o==="string"?Jv.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 Jv.encode(n).byteLength;if(n instanceof URLSearchParams)return Jv.encode(n.toString()).byteLength;return 0},Hk=(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)}}))},Yk=(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(Hk(n.body,o,i),r)},Qk=(n,i,r)=>{if(!n.body)return n;let o=ZQ(r??n.body);return new Request(n,{duplex:"half",body:Hk(n.body,o,i)})};var Xi=(n)=>n!==null&&typeof n==="object";var MQ=Symbol("replaceOption"),z6=(n)=>Xi(n)&&n[MQ]===!0?{isReplace:!0,value:n.value}:{isReplace:!1,value:n};var pu=(...n)=>{for(let i of n)if((!Xi(i)|
Line truncated
`,{mode:384}),i}function xr(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 JK}from"node:fs";import{randomBytes as XK}from"node:crypto";import{randomBytes as CO}from"node:crypto";var TF=v.object({staffId:v.string(),name:v.string().optional(),code:v.string().default(""),bindTime:v.number().optional()}),VF=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:TF.optional()}),_F=v.object({apiKey:v.string().optional(),corporationId:v.string().optional(),corporationName:v.string().optional()}),qF=v.object({id:v.string(),name:v.string(),tenantSlug:v.string().optional(),isDemo:v.boolean().default(!1),logoUrl:v.string().nullable().optional(),hoseCorpConfig:_F.optional()}),NO=v.object({user:VF,tenant:qF}),ZF=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(),MF=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(),GO=v.object({user:ZF,session:MF}),zv=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()}),WO=v.object({rules:v.array(zv),hasPendingDeletes:v.boolean().default(!1)}),zF=v.object({code:v.string().optional(),description:v.string(),scope:v.string(),strictness:v.string()}),Cv=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(zF).default([]),publishedAt:v.number().optional(),createdAt:v.number().optional()}),pO=v.object({version:Cv,rulesCount:v.number()}),Ku=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)}),jO=v.object({articles:v.array(Ku),total:v.number().optional()}),CF=v.object({explicitApprove:v.string().default(""),explicitReject:v.string().default(""),exemptApprove:v.string().default(""),review:v.string().default("")}).passthrough(),RF=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(),hF=v.enum(["assisted","semi_automatic","fully_automatic"]),LO=v.object({id:v.string(),url:v.string().url()}).passthrough(),Pu=v.object({type:v.literal("webhook"),id:v.string(),name:v.string(),mode:hF,incomingDocumentWebhook:LO,outgoingResultWebhook:v.string().url(),incomingManualResultWebhook:LO,secret:v.string().min(1),autoApprovalRate:v.number().int().min(0).max(100).optional()}).passthrough(),I0=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(letDinw){if(D==="$ref"||D==="allOf")continue;if(!(DinG))deletew[D]}if(X.$ref&&W.def)for(letDinw){if(D==="$ref"||D==="allOf")continue;if(DinW.def&&JSON.stringify(w[D])===JSON.stringify(W.def[D]))deletew[D]}}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:Rq(q,"input",$.processors),output:Rq(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,$)},Rq=($,q,I={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=s5({...Y??{},target:J,io:q,processors:I});returnj1($,Q),e5(Q,$),$9(Q,$)};varSO0={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=SO0[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 f of b){let w=f.outboundName??"SealAI 审批",c=f.signKey,S=f.apiOrigin??"production";console.error(`•"${w}"(signKey:${c},环境:${S})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${c}--corp${t.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let w of f){let c=w.outboundName??"SealAI 审批",S=w.signKey,k=w.apiOrigin??"production";console.error(`•"${c}"(signKey:${S},环境:${k})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${S}--corp${t.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of H){let W=V.outboundName??"SealAI 审批",X=V.signKey,L=V.apiOrigin??"production";console.error(`•"${W}"(signKey:${X},环境:${L})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${Y.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let L=X.outboundName??"SealAI 审批",D=X.signKey,N=X.apiOrigin??"production";console.error(`•"${L}"(signKey:${D},环境:${N})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${D}--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 jZ0($){let q=e0($.options.port)??e0($.options.p),I=x($.options.host)??x($.options.h),U=await FD({port:q,host:I}),Y=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Y),process.on("SIGTERM",Y),await new Promise(()=>{})}async function BZ0($,q,I,U){if($==="config"||$==="get"){await O0("seal_llm_config_get",q,I,{},D0(U.options));return}if($==="providers"||$==="list"){await O0("seal_llm_providers_list",q,I,{},D0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function RZ0($,q){if($==="config"||$==="json"){Du();return}await Ou()}function Du(){B0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function vZ0($){let q=XD();B0(q,{...D0($.options),allowFull:!0})}async function CZ0($,q,I,U){if($==="available"){await O0("seal_permissions_available_list",q,I,{},D0(U.options));return}if($==="configs"||$==="list"){await O0("seal_permissions_configs_list",q,I,{},D0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as _Z0}from"node:fs";async function hZ0($,q,I,U,Y,J,Q){if(!$||$==="get"){await O0("seal_preference_get",Y,J,{},D0(Q.options));return}if($==="decision"){if(q==="update"||!q){let K=x(Q.options.input),z=K?JSON.parse(_Z0(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,D0(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},D0(Q.options));return}if(q==="policies"){if(I==="list"||!I){await O0("seal_preference_thinking_depth_policies_list",Y,J,{},D0(Q.options));return}if(I==="upsert"){let K=x(Q.options.input),z=K?JSON.parse(_Z0(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,D0(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},D0(Q.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function SZ0($={}){let q=X8(),I=W6(),U=ZI(q,{stateful:I.stateful,defaultCorpId:I.defaultCorpId,corpId:$.corpId},u7());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Y=await MY(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 yZ0($,q,I){let U=q??x(I.options.corp)??($&&$!=="--corp"?$:void 0);await SZ0({corpId:U})}async function Nu($,q,I,U,Y){if($==="count"){await O0("seal_approval_rules_list",I,U,{countOnly:!0},D0(Y.options));return}if($==="list"){if(C0(Y.options.count)){await O0("seal_approval_rules_list",I,U,{countOnly:!0},D0(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:UZ0,limit:J,offset:Q},D0(Y.options));return}let K=await qq("seal_approval_rules_list",I,U,{limit:J,offset:Q});YZ0(K,C0(Y.options.full)===!0),B0(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 qq("seal_approval_rules_clear",I,U,{dryRun:Q,recode:C0(Y.options.recode)});if(!J&&Q&&K&&typeof K==="object"){B0({...K,nextCommand:`seal-userulesclear--corp${U.id}--yes`},D0(Y.options));return}B0(K,D0(Y.options));return}if($==="versions"){await O0("seal_approval_rule_versions_list",I,U,{},D0(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,Vz(J),D0(Y.options));return}if($==="get"){await O0("seal_approval_rule_get",I,U,{...IZ0(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 Kw1($){let q=TD($),I=Au($),U=Oz($);fZ0($.stateDir);let Y=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):OD),J=$.host??(process.env.HOST?process.env.HOST:ND);AD(q,`${process.pid}
`,{mode:384}),AD(I,JSON.stringify({pid:process.pid,port:Y,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),AY(U,`servicestartingonhttp://${J}:${Y} pid=${process.pid}`);let Q=null;try{Q=await FD({port:Y,host:J,silent:!0}),AY(U,`service listening pid=${process.pid}`)}catch(z){if(AY(U,`service failed to bind port ${Y}: ${z instanceof Error?z.message:String(z)}`),PD(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});throw z}let K=()=>{if(Q)Q.close(),Q=null;if(PD(q)===process.pid)p8(q,{force:!0}),p8(I,{force:!0});AY(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 uZ0($){fZ0($.stateDir);let q=PY($);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=Uw1(I.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Y.unref();let J=TD($);return AD(J,`${Y.pid}
`,{flag:"a",mode:384})}var Pu=Gw1(ww1(),".config","seal-use");async function Tu($,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 Iq($,{appRoot:q.appRoot,entryFile:q.entryFile,stateDir:Pu,version:t0,launcher:q.launcher,port:U,host:Y},{maxLines:J});if(Q!==void 0)B0(Q)}import{existsSync as Hw1,readFileSync as nZ0}from"node:fs";async function bZ0($,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)},D0(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(nZ0(K,"utf8")):void 0,w=x(Y.options.input),G=w?JSON.parse(nZ0(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},D0(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"])},D0(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},D0(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},D0(Y.options));return}if($==="list"){await O0("seal_simulation_batches_list",I,U,{limit:e0(Y.options.limit)},D0(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},D0(Y.options));return}if($==="templates"){await O0("seal_simulation_templates_get",I,U,{},D0(Y.options));return}if($==="integrations"){await O0("seal_simulation_integrations_get",I,U,{},D0(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(!Hw1(J))throw Error(`Filenotfound:${J}`);await O0("seal_simulation_material_package_upload",I,U,{filePath:J},D0(Y.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as JX0}from"node:fs";import{join as ED}from"node:path";import{existsSync as Eu,mkdirSync as eZ0,rmSync as Pw1,writeFileSync as Tw1}from"node:fs";import{homedir as $X0}from"node:os";import{dirname as Ew1,join as gu}from"node:path";var iZ0=`---
name:seal-use
description:"v0.10.5: 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.9: 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.
@@ -299,6 +540,7 @@ 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 uN=`interface:
`;var pZ0=`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."
@@ -467,7 +709,7 @@ Use current search only when the question is about current draft/current knowled
##OutputDiscipline
Ifarulecommandwouldreturnmanydescriptionsormorethanabout20rules,use\`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var vN="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises`aremerged.\n-User-levelconfigsoverridesame-IDlocalconfigs.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**(e.g.`👉Nextaction:...`).\n-**`ExitCode`**:`0`onsuccess,non-zero(e.g.`1`)onfailuretotriggerAgenterrorself-remediation.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-useruleslint[--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-useservice<start|stop|restart|status>\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate\nseal-usetoolslist\nseal-usecorpslist[--corp<corpId>]\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useusersreset-password<userId>[--corp<corpId>]\nseal-useusersget<userId>[--corp<corpId>]\nseal-useusersdelete<userId>[--corp<corpId>]\nseal-usellmconfig[--corp<corpId>]\nseal-usellmproviders[--corp<corpId>]\nseal-usepermissionsavailable[--corp<corpId>]\nseal-usepermissionsconfigs[--corp<corpId>]\nseal-usebillingstatus[--corp<corpId>]\nseal-usebillingplans[--corp<corpId>]\nseal-usebillingfeatures[--corp<corpId>]\nseal-usewebhooklist[--query<text>][--show-secret][--corp<corpId>]\nseal-usewebhookget|find<idOrName>[--show-secret][--corp<corpId>]\nseal-usewebhookadd--name<name>--result-url<url>[--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>][--corp<corpId>]\nseal-usewebhookupdate<idOrName>[--name<name>][--result-url<url>][--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>|--rotate-secret][--corp<corpId>]\nseal-usewebhookdelete<idOrName>--yes[--corp<corpId>]\nseal-usedeployhosecloudrequirements[--corp<corpId>]\nseal-usedeployhosecloudlist[--corp<corpId>]\nseal-usedeployhosecloudget[<sign-key>][--corp<corpId>]\nseal-usedeployhosecloudstatus[--corp<corpId>]\nseal-usedeployhosecloudconfigure--json'{...}'[--corp<corpId>]\nseal-usedeployhosecloudsync[<sign-key>][--auto][--corp<corpId>]\nseal-usepreferenceget[--corp<corpId>]\nseal-usepreferencedecisionupdate--json'{\"explicitApprove\":\"...\"}'[--corp<corpId>]\nseal-usepreferencethinking-depthset--default<medium|high>[--corp<corpId>]\nseal-usepreferencethinking-depthpolicieslist[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesupsert--json'{...}'[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesremove<policyId>[--corp<corpId>]\nseal-usesourceconfig[--corp<corpId>]\nseal-usetool<toolName>[--corp<corpId>][--json'{\"key\":\"value\"}']\nseal-useapproval-runssummary--corp<corpId>[--dateYYYY-MM-DD][--timezoneAsia/Shanghai]\nseal-useapproval-runsstats--corp<corpId>[--since3months][--dedupe-bysourceDocumentSN|sourceDocumentId|id]\nseal-useapproval-runscount--corp<corpId>[--statusAPPROVED]\nseal-useapproval-runssearch--corp<corpId>[--querytext][--limit20][--includeBridgetrue]\nseal-useapproval-runsget<recordId>--corp<corpId>[--fieldsmetadata|document.fields,result.summaLine truncated
`;var lZ0="# 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
@@ -902,7 +1144,7 @@ Return a compact report containing:
-Newversionnumberandversionname,ifpublished
-Verificationresult
-Whetheraregressionrerunwasperformed
`;var bN="# 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 tZ0="# 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=E(r.options.local)||E(r.options.workspace),t=U(r.options.dir)??U(r.options.target)??i,u=t?t:o?c$(process.cwd(),".agents","skills","seal-use"):mu(),e=i4(u);B({installed:!0,targetDir:e.targetDir,fileCount:e.files.length,files:e.files});return}if(n==="status"||n==="get"||!n){let o=mu(),t=c$(process.cwd(),".agents","skills","seal-use");B({global:{dir:o,installed:kN(c$(o,"SKILL.md"))},local:{dir:t,installed:kN(c$(t,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${n}.Run'seal-use help'foravailablecommands.`)}async function yN(n,i){if(n==="config"){B(await io(i));return}throw Error(`Unknownsourcecommand:${n??""}.Run'seal-use help'foravailablecommands.`)}async function LN(n,i,r,o){if(!n)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await J(n,i,r,oi(o.json),j(o.options))}function NN(){B(qu.map((n)=>({name:n.name,description:n.description})))}import{chmodSync as aP,mkdirSync as sP,renameSync as r4,rmSync as nB,unlinkSync as JN,writeFileSync as GN}from"node:fs";import{dirname as iB,join as WN}from"node:path";import{spawnSync as zt}from"node:child_process";function U$(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 XN="yunyingk/seal-use",au="yunyingk/seal-home";var tB="SEAL_USE_GITHUB_REPO",rB="SEAL_HOME_GITHUB_REPO";async function HN(n,i={}){let r={appRoot:n.appRoot,entryFile:n.entryFile,stateDir:a0,version:x,launcher:n.launcher},o=i.repo||process.env[tB]?.trim()||process.env[rB]?.trim()||XN,t=i.targetVersion?.trim(),u=t&&t.toLowerCase()!=="latest"?t:void 0;if(u){let W=u.replace(/^v/,""),y=YN(W,x);if(y<0){B({updated:!1,currentVersion:x,targetVersion:W,mode:U$()?"binary":"source",message:`Cannotdowngradeseal-usefromv${x}toolderversionv${W}.Updatesmustbeforward-only.`});return}if(y===0&&!i.force){B({updated:!1,currentVersion:x,targetVersion:W,mode:U$()?"binary":"source",message:`seal-useisalreadyatversionv${x}.Use--forcetoreinstall.`});return}}if(i.changelogOnly){let W=await o4(o,i.limit??10);B({currentVersion:x,totalQueried:W.length,releases:W.map((y)=>({version:y.version,tagName:y.tagName,publishedAt:y.publishedAt,author:y.author,releaseNotes:y.notes,releaseUrl:y.htmlUrl,isCurrent:y.version===x,isNewer:xu(y.version,x)}))});return}if(!U$()){if(i.checkOnly){let y=await o4(o,30),M=y[0],q=M?.version??x,An=y.find((nn)=>nn.version===x),Wn=xu(q,x),pn=y.filter((nn)=>xu(nn.version,x));B({updated:!1,updateAvailable:Wn,currentVersion:x,currentVersionPublishedAt:An?.publishedAt,latestVersion:q,latestVersionPublishedAt:M?.publishedAt,behindCount:pn.length,pendingReleases:pn.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=to(r).running;if(W)await Mt("stop",r);try{jN("git",["-C",n.appRoot,"pull","--ff-only"])}catch(y){console.error(`gitpullskipped:${yinstanceofError?y.message:String(y)}`)}if(jN("bun",["install"],{cwd:n.appRoot}),W)await Mt("start",r);B({updated:!0,serviceRestarted:W,version:x,mode:"source"});return}let e=oB(),l=uB(),$=await o4(o,30),I=u?$.find((W)=>W.version===u||W.tagName===u||W.tagName===`v${u}`)??await pN(o,u):$[0]??await pN(o);if(!I){B({updated:!1,currentVersion:x,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${o}'`});return}let g=I.version,b=$.find((W)=>W.version===x),f=xu(g,x),w=f||Boolean(i.force),c=$.filter((W)=>xu(W.version,x));if(i.checkOnly){B({updated:!1,updateAvailable:f,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(!w){B({updated:!1,currentVersion:x,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${x})`});return}let S=eB(I.assets,e,l);if(!S)throw Error(`Nocompatiblebinaryfoundfor${e}-${l}inreleasev${g}.Availableassets:${I.assets.map((W)=>W.name).join(", ")}`);let k=to(r).running;if(k)await Mt("stop",r);let O=process.execPath,F=iB(O),Q=WN(F,`.tmp-update-${Date.now()}`);sP(Q,{recursive:!0});try{let W=WN(Q,S.name);await lB(S.downloadUrl,W,I.tagName,S.name);let y=W;if(S.name.endsWith(".tar.gz")||S.name.endsWith(".tgz"))y=vB(W,Q,e);else if(S.name.endsWith(".zip"))y=$B(W,Q,e);if(aP(y,493),process.platform==="darwin")try{zt("/usr/bin/codesign",["--remove-signature",y],{stdio:"ignore"}),zt("/usr/
Line truncated
`)}catch{}}async function lB(n,i,r,o){let t=u4(),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/${XN}/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,f=307200,w=1e4,c=180000;for(let S=0;S<$.length;S++){let k=$[S],O=new AbortController,F="",Q=(q)=>{F=q;try{O.abort()}catch{}},W=setTimeout(()=>{Q("Connection timed out (no response headers within 6s)")},g),y,M;try{D$(`==> [${S+1}/${$.length}] Downloading via: ${k}`);let q=await fetch(k,{signal:O.signal});if(W)clearTimeout(W),W=void 0;if(!q.ok)throw Error(`HTTP ${q.status} ${q.statusText}`);y=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 yi=Buffer.from(await q.arrayBuffer());if(yi.length<1000)throw Error(`Downloaded content is suspiciously small (${yi.length} bytes)`);GN(i,yi),D$(`✓ Download succeeded (${(yi.length/1024/1024).toFixed(1)} MB)`);return}let pn=[],nn=0,ro=0;M=setTimeout(()=>{if(nn<f){let yi=(nn/1024).toFixed(1);Q(`Initial transfer too slow (${yi} KB < 300 KB in 6s), switching mirror...`)}},b);while(!0){let yi=Wn.read(),S$,TN=new Promise((d$,k$)=>{S$=setTimeout(()=>{k$(Error("Data transfer stalled (no chunk received for 10s)"))},w)}),v4;try{v4=await Promise.race([yi,TN])}finally{if(S$)clearTimeout(S$)}let{done:VN,value:A$}=v4;if(VN)break;if(A$){if(pn.push(A$),nn+=A$.length,M&&nn>=f)clearTimeout(M),M=void 0;let d$=Date.now();if(d$-ro>200){ro=d$;let k$=An?Math.round(nn/An*100):0,_N=(nn/1048576).toFixed(1),qN=An?(An/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${k$}% (${_N} / ${qN} 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?ED(process.cwd(),".agents","skills","seal-use"):Nz(),Q=ju(J);B0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Nz(),Y=ED(process.cwd(),".agents","skills","seal-use");B0({global:{dir:U,installed:JX0(ED(U,"SKILL.md"))},local:{dir:Y,installed:JX0(ED(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function KX0($,q){if($==="config"){B0(await MY(q));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function zX0($,q,I,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await O0($,q,I,a6(U.json),D0(U.options))}function wX0(){B0(Gz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as gw1,mkdirSync as jw1,renameSync as Ru,rmSync as Bw1,unlinkSync as ZX0,writeFileSync as GX0}from"node:fs";import{dirname as Rw1,join as HX0}from"node:path";import{spawnSync as Uq}from"node:child_process";function gD($=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 XX0="yunyingk/seal-use",Mz="yunyingk/seal-home";var vw1="SEAL_USE_GITHUB_REPO",Cw1="SEAL_HOME_GITHUB_REPO";async function LX0($,q={}){let I={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Pu,version:t0,launcher:$.launcher},U=q.repo||process.env[vw1]?.trim()||process.env[Cw1]?.trim()||XX0,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){B0({updated:!1,currentVersion:t0,targetVersion:P,mode:gD()?"binary":"source",message:`Cannotdowngradeseal-usefromv${t0}toolderversionv${P}.Updatesmustbeforward-only.`});return}if(B===0&&!q.force){B0({updated:!1,currentVersion:t0,targetVersion:P,mode:gD()?"binary":"source",message:`seal-useisalreadyatversionv${t0}.Use--forcetoreinstall.`});return}}if(q.changelogOnly){let P=await vu(U,q.limit??10);B0({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(!gD()){if(q.checkOnly){let B=await vu(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));B0({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=PY(I).running;if(P)await Iq("stop",I);try{WX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(WX0("bun",["install"],{cwd:$.appRoot}),P)await Iq("start",I);B0({updated:!0,serviceRestarted:P,version:t0,mode:"source"});return}let Q=_w1(),K=hw1(),z=await vu(U,30),w=J?z.find((P)=>P.version===J||P.tagName===J||P.tagName===`v${J}`)??await VX0(U,J):z[0]??await VX0(U);if(!w){B0({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){B0({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){B0({updated:!1,currentVersion:t0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${t0})`});return}let L=Sw1(w.assets,Q,K);if(!L)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${G}.Availableassets:${w.assets.map((P)=>P.name).join(", ")}`);let D=PY(I).running;if(D)await Iq("stop",I);let N=process.execPath,E=Rw1(N),T=HX0(E,`.tmp-update-${Date.now()}`);jw1(T,{recursive:!0});try{let P=HX0(T,L.name);await yw1(L.downloadUrl,P,w.tagName,L.name);let B=P;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))B=uw1(P,T,Q);else if(L.name.endsWith(".zip"))B=xw1(P,T,Q);if(gw1(B,493),process.platform==="darwin")try{Uq("/usr/bin/codesig
Line truncated
`)}catch{}}async function yw1($,q,I,U){let Y=Cu(),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 L=`https://github.com/${XX0}/releases/download/${Q}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);J.push(L)}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 L=0;L<z.length;L++){let D=z[L],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{jD(`==> [${L+1}/${z.length}] Downloading via: ${D}`);let h=await fetch(D,{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)`);GX0(q,b),jD(`✓ 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.5: 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.9: 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.5
short-description:Seal tenant and Hose approval automation (v0.10.5)
version:0.10.9
short-description:Seal tenant and Hose approval automation (v0.10.9)
---
# Seal Use (v0.10.5)
# Seal Use (v0.10.9)
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,6 +66,7 @@ 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.
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.