@@ -26,7 +26,16 @@ Tests are colocated as `*.test.ts` files in `src/`. OpenAPI source YAML lives in
Use TypeScript ES modules with explicit `.js` import extensions for local files. Validate external data with Zod or narrow types before use. Follow existing style: two-space indentation, double quotes, omitted trailing semicolons, `camelCase` variables/functions, `PascalCase` classes/types, and lowercase hyphenated filenames such as `token-store.ts`.
Prefer small domain functions over broad utility modules. Keep CLI output JSON on stdout and diagnostics/errors on stderr.
Prefer small domain functions over broad utility modules.
## CLI & Agent Harness Protocol Guidelines
- **Machine Channel (`stdout`)**: CLI commands MUST output clean, parseable JSON on `stdout`. Never dump human prose, raw logs, or progress banners into `stdout`. The Agent Harness parses `stdout` directly into typed payloads.
- **Guidance & Diagnostic Channel (`stderr`)**: Use `stderr` for runtime logs, network probing status, self-healing notifications, and explicit **Next-Step Command Suggestions** (e.g. `👉 Next action: seal-use deploy hosecloud sync <signKey>`).
- **Exit Code Contract**:
- Successful executions MUST terminate with exit code `0`.
- Any parameter validation failure, upstream API error, or business block MUST result in a non-zero exit code (e.g. `1`), allowing the Agent Harness to reliably detect failures and trigger automated error remediation.
- Never call `process.exit()` deep in domain functions; throw structured errors and let `src/cli/runner.ts` handle stream routing and exit code assignment.
@@ -5,6 +5,39 @@ All notable changes to `seal-use` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.10.6] - 2026-09-03
### Added & Enhanced
- **Inbound Webhook Material Pack Import (Issue #27)**: Added local preview and push workflows for SealAI material packs, including strict ZIP/XLSX validation, normalized approval-document parsing, attachment upload, and HMAC-signed Webhook delivery.
- **CLI and MCP Support**: Added `seal-use webhook material-pack preview|push` and the `seal_webhook_material_pack` tool, while keeping the existing simulation `material_pack` flow separate.
- **Test-Enterprise Verification**: Verified the new push path against the configured test enterprise with official sample materials; customer enterprise data was not used.
## [0.10.5] - 2026-09-03
### Added & Enhanced
- **Intelligent HoseCloud Sync Discovery & Actionable Guidance (Issue #26)**: In `seal-use deploy hosecloud sync` and `deploy hosecloud get`, when `<sign-key>` is omitted, the CLI dynamically discovers all active HoseCloud integration configs for the tenant and renders structured cards on `stderr` with 1-click copy commands (e.g. `👉 同步命令: seal-use deploy hosecloud sync <signKey> --corp <corpId>`).
- **Single-Config Fast Track (`--auto`)**: Added `--auto` (and `--yes`) flag to `deploy hosecloud sync`. When a tenant has exactly one configured HoseCloud integration, `--auto` automatically locks and syncs without requiring manual `signKey` extraction.
- **Enhanced Empty State & Diagnostic Hints**: If a tenant has zero HoseCloud integrations configured, clearly prompts the user with next-step configuration command `seal-use deploy hosecloud configure ...`.
- **Updated Reference Documentation**: Updated `skills/seal-use/references/hose-enterprise-deploy.md` and CLI references with `--auto` and dynamic discovery patterns.
## [0.10.4] - 2026-09-03
### Added & Enhanced
- **Built-in Approval Rule Linter & Quality Validation Engine**: Introduced a pure TypeScript/heuristic rule quality validator (`seal-use rules lint` & `seal_approval_rules_lint`). Detects subjective fuzzy words (`原则上`, `尽量`, `适当`, `酌情`), hanging exception clauses lacking evidence keywords (`除非/特殊情况` 未指明 `备注/附件/截图` 凭证来源), and short invalid descriptions.
- **Fault-Tolerant Automatic Fallback (Anti-Crash Guarantee)**: If a user's custom `.ts` linter file contains syntax errors, throws runtime exceptions, or is missing, the engine automatically catches errors, logs diagnostic warnings to `stderr`, and seamlessly falls back to the built-in heuristic linter without failing or blocking CLI execution.
- **Global Config & Default-Disabled Policy**: Added `lint: { enabled: false, activeLinter: "builtin", minScore: 0 }` to global configuration (`~/.config/seal-use/config.json`). Linter is **disabled by default** to avoid unsolicited noise; can be enabled via `seal-use config lint enable`.
- **Real-time Diagnostic Hook on Rule Updates**: When linting is enabled, `seal_approval_rule_update` automatically inspects modified descriptions and outputs structured warnings on `stderr` while keeping clean machine JSON on `stdout`.
- **Comprehensive Scenarios & Gatekeeping**: `seal-use rules lint` supports full draft scanning, historical version review (`--version <num>`), rule filtering (`--code <code>`), summary mode (`--summary`), and quality gate scoring (`--min-score <score>`) with non-zero exit codes.
- **Dedicated Reference Documentation**: Added `skills/seal-use/references/rule-lint.md` and updated SKILL router.
## [0.10.3] - 2026-09-02
### Added & Enhanced
- **Auto Platform Probing for HoseCloud Deployment**: In `deploy hosecloud configure` (`seal_deploy_hosecloud_configure`), automatically probes 6 standard Hose SaaS platform domains (Standard, DingTalk, WeChat Work, Feishu, CloudHub, DingTalk Enterprise) using `probeHoseDomain` when `customApiUrl` is omitted. Eliminates manual platform guessing and prevents authentication failures (`请检查 API 平台和凭证配置是否正确`).
- **Standardized Business Terminology**: Aligned all CLI and tool descriptions with Seal AI product semantics: `Seal AI 智能审核发布到合思费控` (replacing raw backend jargon like "合思出站消息").
- **Dedicated Reference Documentation**: Added `skills/seal-use/references/hose-enterprise-deploy.md` covering end-to-end deployment, auto platform detection, 3-step publishing, and EBot node integration.
import{createRequireas_y}from"node:module";varPy=Object.create;var{getPrototypeOf:Qy,defineProperty:O$,getOwnPropertyNames:Fy}=Object;varKy=Object.prototype.hasOwnProperty;functionBy(n){returnthis[n]}varTy,Vy,t0=(n,i,r)=>{varo=n!=null&&typeofn==="object";if(o){vart=i?Ty??=newWeakMap:Vy??=newWeakMap,u=t.get(n);if(u)returnu}r=n!=null?Py(Qy(n)):{};lete=i||!n||!n.__esModule?O$(r,"default",{value:n,enumerable:!0}):r;for(letlofFy(n))if(!Ky.call(e,l))O$(e,l,{get:By.bind(n,l),enumerable:!0});if(o)t.set(n,e);returne};varY=(n,i)=>()=>(i||n((i={exports:{}}).exports,i),i.exports);varqy=(n)=>n;functionEy(n,i){this[n]=qy.bind(null,i)}varQi=(n,i)=>{for(varrini)O$(n,r,{get:i[r],enumerable:!0,configurable:!0,set:Ey.bind(i,r)})};varr0=_y(import.meta.url);varso=Y((YD)=>{Object.defineProperty(YD,"__esModule",{value:!0});YD.regexpCode=YD.getEsmExportName=YD.getProperty=YD.safeStringify=YD.stringify=YD.strConcat=YD.addCodeArg=YD.str=YD._=YD.nil=YD._Code=YD.Name=YD.IDENTIFIER=YD._CodeOrName=void0;classTl{}YD._CodeOrName=Tl;YD.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classWrextendsTl{constructor(n){super();if(!YD.IDENTIFIER.test(n))throwError("CodeGen: name must be a valid identifier");this.str=n}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}YD.Name=Wr;classfiextendsTl{constructor(n){super();this._items=typeofn==="string"?[n]:n}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;letn=this._items[0];returnn===""||n==='""'}getstr(){varn;return(n=this._str)!==null&&n!==void0?n:this._str=this._items.reduce((i,r)=>`${i}${r}`,"")}getnames(){varn;return(n=this._names)!==null&&n!==void0?n:this._names=this._items.reduce((i,r)=>{if(rinstanceofWr)i[r.str]=(i[r.str]||0)+1;returni},{})}}YD._Code=fi;YD.nil=newfi("");functionXD(n,...i){letr=[n[0]],o=0;while(o<i.length)Pc(r,i[o]),r.push(n[++o]);returnnewfi(r)}YD._=XD;varpc=newfi("+");functionHD(n,...i){letr=[ao(n[0])],o=0;while(o<i.length)r.push(pc),Pc(r,i[o]),r.push(pc,ao(n[++o]));returnIX(r),newfi(r)}YD.str=HD;functionPc(n,i){if(iinstanceoffi)n.push(...i._items);elseif(iinstanceofWr)n.push(i);elsen.push(wX(i))}YD.addCodeArg=Pc;functionIX(n){leti=1;while(i<n.length-1){if(n[i]===pc){letr=gX(n[i-1],n[i+1]);if(r!==void0){n.splice(i-1,3,r);continue}n[i++]="+"}i++}}functiongX(n,i){if(i==='""')returnn;if(n==='""')returni;if(typeofn=="string"){if(iinstanceofWr||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]==='"'&&!(ninstanceofWr))return`"${n}${i.slice(1)}`;return}functionbX(n,i){returni.emptyStr()?n:n.emptyStr()?i:HD`${n}${i}`}YD.strConcat=bX;functionwX(n){returntypeofn=="number"||typeofn=="boolean"||n===null?n:ao(Array.isArray(n)?n.join(","):n)}functionfX(n){returnnewfi(ao(n))}YD.stringify=fX;functionao(n){returnJSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}YD.safeStringify=ao;functioncX(n){returntypeofn=="string"&&YD.IDENTIFIER.test(n)?newfi(`.${n}`):XD`[${n}]`}YD.getProperty=cX;functionUX(n){if(typeofn=="string"&&YD.IDENTIFIER.test(n))returnnewfi(`${n}`);throwError(`CodeGen: invalid export name: ${n}, use explicit $id name mapping`)}YD.getEsmExportName=UX;functionDX(n){returnnewfi(n.toString())}YD.regexpCode=DX});varBc=Y((FD)=>{Object.defineProperty(FD,"__esModule",{value:!0});FD.ValueScope=FD.ValueScopeName=FD.Scope=FD.varKinds=FD.UsedValueState=void0;varan=so();classPDextendsError{constructor(n){super(`CodeGen: "code" for ${n} not defined`);this.value=n.value}}varql;(function(n){n[n.Started=0]="Started",n[n.Completed=1]="Completed"})(ql||(FD.UsedValueState=ql={}));FD.varKinds={const:newan.Name("const"),let:newan.Name("let"),var:newan.Name("var")};classFc{constructor({prefixes:n,parent:i}={}){this._names={},this._prefixes=n,this._parent=i}toName(n){returnninstanceofan.Name?n:this.name(n)}name(n){returnnewan.Name(this._newName(n))}_newName(n){leti=this._names[n]||this._nameGroup(n);return`${n}${i.index++}`}_nameGroup(n){vari,r;if(((r=(i=this._parent)===null||i===void0?void0:i._prefixes)===null||r===void0?void0:r.has(n))||this._prefixes&&!this._prefixes.has(n))throwError(`CodeGen: prefix "${n}" is not allowed in this scope`);returnthis._names[n]={prefix:n,index:0}}}FD.Scope=Fc;classKcextendsan.Name{constructor(n,i){super(i);this.prefix=n}setValue(n,{property:i,itemIndex:r}){this.value=n,this.scopePath=an._`.${newan.Name(i)}[${r}]`}}FD.ValueScopeName=Kc;varXX=an._`\n`;classQDextendsFc{constructor(n){super(n);this._values={},this._scope=n.scope,this.opts={...n,_n:n.lines?XX:an.nil}}get(){returnthis._scope}name(n){returnnewKc(n,this._newName(n))}value(n,i){varr;if(i.ref===void0)throwError("CodeGen: ref must be passed in value");leto=this.toName(n),{prefix:t}=o,u=(r=i.key)!==null&&r!==void0?r:i.ref,e=this._values[t];if(e){letI=e.get(u);if(I)returnI}elsee=this._values[t]=newLine truncated
`:""},this._extScope=n,this._scope=new ci.Scope({parent:n}),this._nodes=[new ZD]}toString(){return this._root.render(this.opts)}name(n){return this._scope.name(n)}scopeName(n){return this._extScope.name(n)}scopeValue(n,i){let r=this._extScope.value(n,i);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(n,i){return this._extScope.getValue(n,i)}scopeRefs(n){return this._extScope.scopeRefs(n,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(n,i,r,o){let t=this._scope.toName(i);if(r!==void 0&&o)this._constants[t.str]=r;return this._leafNode(new BD(n,t,r)),t}const(n,i,r){return this._def(ci.varKinds.const,n,i,r)}let(n,i,r){return this._def(ci.varKinds.let,n,i,r)}var(n,i,r){return this._def(ci.varKinds.var,n,i,r)}assign(n,i,r){return this._leafNode(new qc(n,i,r))}add(n,i){return this._leafNode(new TD(n,sn.operators.ADD,i))}code(n){if(typeof n=="function")n();else if(n!==s.nil)this._leafNode(new _D(n));return this}object(...n){let i=["{"];for(let[r,o]of n){if(i.length>1)i.push(",");if(i.push(r),r!==o||this.opts.es5)i.push(":"),(0,s.addCodeArg)(i,o)}return i.push("}"),new s._Code(i)}if(n,i,r){if(this._blockNode(new Vi(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 Vi(n))}else(){return this._elseNode(new nu)}endIf(){return this._endBlockNode(Vi,nu)}_for(n,i){if(this._blockNode(n),i)this.code(i).endFor();return this}for(n,i){return this._for(new MD(n),i)}forRange(n,i,r,o,t=this.opts.es5?ci.varKinds.var:ci.varKinds.let){let u=this._scope.toName(n);return this._for(new zD(t,u,i,r),()=>o(u))}forOf(n,i,r,o=ci.varKinds.const){let t=this._scope.toName(n);if(this.opts.es5){let u=i instanceof s.Name?i:this.var("_arr",i);return this.forRange("_i",0,s._`${u}.length`,(e)=>{this.var(t,s._`${u}[${e}]`),r(t)})}return this._for(new Tc("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 Tc("in",o,t,i),()=>r(t))}endFor(){return this._endBlockNode(Jr)}label(n){return this._leafNode(new VD(n))}break(n){return this._leafNode(new qD(n))}return(n){let i=new _l;if(this._blockNode(i),this.code(n),i.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(_l)}try(n,i,r){if(!i&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new CD;if(this._blockNode(o),this.code(n),i){let t=this.name("e");this._currNode=o.catch=new Zl(t),i(t)}if(r)this._currNode=o.finally=new Ml,this.code(r);return this._endBlockNode(Zl,Ml)}throw(n){return this._leafNode(new ED(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 El(n,i,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(El)}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 Vi))throw Error('CodeGen: "else" without "if"');return this._currNode=i.else=n,this}get _root(){return this._nodes[0]}get _currNode(){let n=this._nodes;return n[n.length-1]}set _currNode(n){let i=this._nodes;i[i.length-1]=n}}sn.CodeGen=RD;function Xt(n,i){for(let r in i)n[r]=(n[r]||0)+(i[r]||0);return n}function zl(n,i){return i instanceof s._CodeOrName?Xt(n,i.names):n}function Xr(n,i,r){if(n instanceof s.Name)return o(n);if(!t(n))return n;return new s._Code(n._items.reduce((u,e)=>{if(e instanceof s.Name)e=o(e);if(e instanceof s._Code)u.push(...e._items);else u.push(e);return u},[]));function o(u){let e=r[u.str];if(e===void 0||i[u.str]!==1)return u;return delete i[u.str],e}function t(u){return u instanceof s._Code&&u._items.some((e)=>e instanceof s.Name&&i[e.str]===1&&r[e.str]!==void 0)}}function PX(n,i){for(let r in i)n[r]=(n[r]||0)-(i[r]||0)}function hD(n){return typeof n=="boolean"||typeof n=="number"||n===null?!n:s._`!${Vc(n)}`}sn.not=hD;var QX=mD(sn.operators.AND);function FX(...n){return n.reduce(QX)}sn.and=FX;var KX=mD(sn.operators.OR);function BX(...n){return n.reduce(KX)}sn.or=BX;function mD(n){return(i,r)=>i===s.nil?r:r===s.nil?i:s._`${Vc(i)}${n}${Vc(r)}`}function Vc(n){return n instanceof s.Name?n:s._`(${n})`}});var tn=Y((u1)=>{Object
Line truncated
deps:${r}}`};var Kp={keyword:"dependencies",type:"object",schemaType:"object",error:xA.error,code(n){let[i,r]=Bp(n);hA(n,i),mA(n,r)}};function Bp({schema:n}){let i={},r={};for(let o in n){if(o==="__proto__")continue;let t=Array.isArray(n[o])?i:r;t[o]=n[o]}return[i,r]}function hA(n,i=n.schema){let{gen:r,data:o,it:t}=n;if(Object.keys(i).length===0)return;let u=r.let("missing");for(let e in i){let l=i[e];if(l.length===0)continue;let $=(0,Su.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,Su.checkReportMissingProp)(n,I)});else r.if(d6._`${$}&&(${(0,Su.checkMissingProp)(n,l,u)})`),(0,Su.reportMissingProp)(n,u),r.else()}}xA.validatePropertyDeps=hA;function mA(n,i=n.schema){let{gen:r,data:o,keyword:t,it:u}=n,e=r.name("valid");for(let l in i){if((0,Fp.alwaysValidSchema)(u,i[l]))continue;r.if((0,Su.propertyInData)(r,o,l,u.opts.ownProperties),()=>{let $=n.subschema({keyword:t,schemaProp:l},e);n.mergeValidEvaluated($,e)},()=>r.var(e,!0)),n.ok(e)}}xA.validateSchemaDeps=mA;xA.default=Kp});var rO=Y((tO)=>{Object.defineProperty(tO,"__esModule",{value:!0});var iO=R(),qp=tn(),Ep={message:"property name must be valid",params:({params:n})=>iO._`{propertyName:${n.propertyName}}`},_p={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Ep,code(n){let{gen:i,schema:r,data:o,it:t}=n;if((0,qp.alwaysValidSchema)(t,r))return;let u=i.name("valid");i.forIn("key",o,(e)=>{n.setParams({propertyName:e}),n.subschema({keyword:"propertyNames",data:e,dataTypes:["string"],propertyName:e,compositeRule:!0},u),i.if((0,iO.not)(u),()=>{if(n.error(!0),!t.allErrors)i.break()})}),n.ok(u)}};tO.default=_p});var N6=Y((oO)=>{Object.defineProperty(oO,"__esModule",{value:!0});var fv=Ii(),Si=R(),Mp=qi(),cv=tn(),zp={message:"must NOT have additional properties",params:({params:n})=>Si._`{additionalProperty:${n.additionalProperty}}`},Cp={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:zp,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,cv.alwaysValidSchema)(e,r))return;let I=(0,fv.allSchemaProperties)(o.properties),g=(0,fv.allSchemaProperties)(o.patternProperties);b(),n.ok(Si._`${u}===${Mp.default.errors}`);function b(){i.forIn("key",t,(k)=>{if(!I.length&&!g.length)c(k);else i.if(w(k),()=>c(k))})}function w(k){let d;if(I.length>8){let Q=(0,cv.schemaRefOrVal)(e,o.properties,"properties");d=(0,fv.isOwnProperty)(i,Q,k)}else if(I.length)d=(0,Si.or)(...I.map((Q)=>Si._`${k}===${Q}`));else d=Si.nil;if(g.length)d=(0,Si.or)(d,...g.map((Q)=>Si._`${(0,fv.usePattern)(n,Q)}.test(${k})`));return(0,Si.not)(d)}function f(k){i.code(Si._`delete${t}[${k}]`)}function c(k){if($.removeAdditional==="all"||$.removeAdditional&&r===!1){f(k);return}if(r===!1){if(n.setParams({additionalProperty:k}),n.error(),!l)i.break();return}if(typeof r=="object"&&!(0,cv.alwaysValidSchema)(e,r)){let d=i.name("valid");if($.removeAdditional==="failing")S(k,d,!1),i.if((0,Si.not)(d),()=>{n.reset(),f(k)});else if(S(k,d),!l)i.if((0,Si.not)(d),()=>i.break())}}function S(k,d,Q){let P={keyword:"additionalProperties",dataProp:k,dataPropType:cv.Type.Str};if(Q===!1)Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1});n.subschema(P,d)}}};oO.default=Cp});var vO=Y((lO)=>{Object.defineProperty(lO,"__esModule",{value:!0});var hp=eu(),uO=Ii(),L6=tn(),eO=N6(),mp={keyword:"properties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,parentSchema:o,data:t,it:u}=n;if(u.opts.removeAdditional==="all"&&o.additionalProperties===void 0)eO.default.code(new hp.KeywordCxt(u,eO.default,"additionalProperties"));let e=(0,uO.allSchemaProperties)(r);for(let b of e)u.definedProperties.add(b);if(u.opts.unevaluated&&e.length&&u.props!==!0)u.props=L6.mergeEvaluated.props(i,(0,L6.toHash)(e),u.props);let l=e.filter((b)=>!(0,L6.alwaysValidSchema)(u,r[b]));if(l.length===0)return;let $=i.name("valid");for(let b of l){if(I(b))g(b);else{if(i.if((0,uO.propertyInData)(i,t,b,u.opts.ownProperties)),g(b),!u.allErrors)i.else().var($,!0);i.endIf()}n.it.definedProperties.add(b),n.ok($)}function I(b){return u.opts.useDefaults&&!u.compositeRule&&r[b].default!==void 0}function g(b){n.subschema({keyword:"properties",schemaProp:b,dataProp:b},$)}}};lO.default=mp});var wO=Y((bO)=>{Object.defineProperty(bO,"__esModule",{value:!0});var $O=Ii(),Uv=R(),IO=tn(),gO=tn(),ap={keyword:"patternProperties",type:"object",schemaType:"object",code(n){let{gen:i,schema:r,data:o,parentSchema:t,it:u}=n,{opts:e}=u,l=(0,$O.allSchemaProperties)(r),$=l.filter((S)=>(0,IO.alwaysValidSchema)(u,r[S]));if(l.length===0||$.length===l.length&&(!u.opts.unevaluated||u.props===!0))return;let I=e.strictSchema&&!e.allowMatchingProperties&&t.properties,g=i.name("valid");if(u.props!==!0&&!(u.props instanceof Uv.Name))u.props=(0,gO.
Line truncated
`).filter((u)=>u),o=Math.min(...r.map((u)=>u.length-u.trimStart().length)),t=r.map((u)=>u.slice(o)).map((u)=>" ".repeat(this.indent*2)+u);for(let u of t)this.content.push(u)}compile(){let n=Function,i=this?.args,o=[...(this?.content??[""]).map((t)=>`${t}`)];return new n(...i,o.join(`
`))}}var WI={major:4,minor:4,patch:3};var T=U("$ZodType",(n,i)=>{var r;n??(n={}),n._zod.def=i,n._zod.bag=n._zod.bag||{},n._zod.version=WI;let o=[...n._zod.def.checks??[]];if(n._zod.traits.has("$ZodCheck"))o.unshift(n);for(let t of o)for(let u of t._zod.onattach)u(n);if(o.length===0)(r=n._zod).deferred??(r.deferred=[]),n._zod.deferred?.push(()=>{n._zod.run=n._zod.parse});else{let t=(e,l,$)=>{let I=ai(e),g;for(let b of l){if(b._zod.def.when){if(Y$(e))continue;if(!b._zod.def.when(e))continue}else if(I)continue;let w=e.issues.length,f=b._zod.check(e);if(f instanceof Promise&&$?.async===!1)throw new Li;if(g||f instanceof Promise)g=(g??Promise.resolve()).then(async()=>{if(await f,e.issues.length===w)return;if(!I)I=ai(e,w)});else{if(e.issues.length===w)continue;if(!I)I=ai(e,w)}}if(g)return g.then(()=>{return e});return e},u=(e,l,$)=>{if(ai(e))return e.aborted=!0,e;let I=t(l,o,$);if(I instanceof Promise){if($.async===!1)throw new Li;return I.then((g)=>n._zod.parse(g,$))}return n._zod.parse(I,$)};n._zod.run=(e,l)=>{if(l.skipChecks)return n._zod.parse(e,l);if(l.direction==="backward"){let I=n._zod.parse({value:e.value,issues:[]},{...l,skipChecks:!0});if(I instanceof Promise)return I.then((g)=>{return u(g,e,l)});return u(I,e,l)}let $=n._zod.parse(e,l);if($ instanceof Promise){if(l.async===!1)throw new Li;return $.then((I)=>t(I,o,l))}return t($,o,l)}}h(n,"~standard",()=>({validate:(t)=>{try{let u=xt(n,t);return u.success?{value:u.data}:{issues:u.error?.issues}}catch(u){return go(n,t).then((e)=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),yt=U("$ZodString",(n,i)=>{T.init(n,i),n._zod.pattern=[...n?._zod.bag?.patterns??[]].pop()??tI(n._zod.bag),n._zod.parse=(r,o)=>{if(i.coerce)try{r.value=String(r.value)}catch(t){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:n}),r}}),$n=U("$ZodStringFormat",(n,i)=>{st.init(n,i),yt.init(n,i)}),XI=U("$ZodGUID",(n,i)=>{i.pattern??(i.pattern=E$),$n.init(n,i)}),HI=U("$ZodUUID",(n,i)=>{if(i.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if(o===void 0)throw Error(`InvalidUUIDversion:"${i.version}"`);i.pattern??(i.pattern=Lt(o))}else i.pattern??(i.pattern=Lt());$n.init(n,i)}),YI=U("$ZodEmail",(n,i)=>{i.pattern??(i.pattern=_$),$n.init(n,i)}),pI=U("$ZodURL",(n,i)=>{$n.init(n,i),n._zod.check=(r)=>{try{let o=r.value.trim();if(!i.normalize&&i.protocol?.source===x$.source){if(!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:n,continue:!i.abort});return}}let t=new URL(o);if(i.hostname){if(i.hostname.lastIndex=0,!i.hostname.test(t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:r.value,inst:n,continue:!i.abort})}if(i.protocol){if(i.protocol.lastIndex=0,!i.protocol.test(t.protocol.endsWith(":")?t.protocol.slice(0,-1):t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:r.value,inst:n,continue:!i.abort})}if(i.normalize)r.value=t.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:n,continue:!i.abort})}}}),PI=U("$ZodEmoji",(n,i)=>{i.pattern??(i.pattern=Z$()),$n.init(n,i)}),QI=U("$ZodNanoID",(n,i)=>{i.pattern??(i.pattern=V$),$n.init(n,i)}),FI=U("$ZodCUID",(n,i)=>{i.pattern??(i.pattern=Q$),$n.init(n,i)}),KI=U("$ZodCUID2",(n,i)=>{i.pattern??(i.pattern=F$),$n.init(n,i)}),BI=U("$ZodULID",(n,i)=>{i.pattern??(i.pattern=K$),$n.init(n,i)}),TI=U("$ZodXID",(n,i)=>{i.pattern??(i.pattern=B$),$n.init(n,i)}),VI=U("$ZodKSUID",(n,i)=>{i.pattern??(i.pattern=T$),$n.init(n,i)}),qI=U("$ZodISODateTime",(n,i)=>{i.pattern??(i.pattern=iI(i)),$n.init(n,i)}),EI=U("$ZodISODate",(n,i)=>{i.pattern??(i.pattern=s$),$n.init(n,i)}),_I=U("$ZodISOTime",(n,i)=>{i.pattern??(i.pattern=nI(i)),$n.init(n,i)}),ZI=U("$ZodISODuration",(n,i)=>{i.pattern??(i.pattern=q$),$n.init(n,i)}),MI=U("$ZodIPv4",(n,i)=>{i.pattern??(i.pattern=M$),$n.init(n,i),n._zod.bag.format="ipv4"}),zI=U("$ZodIPv6",(n,i)=>{i.pattern??(i.pattern=z$),$n.init(n,i),n._zod.bag.format="ipv6",n._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:n,continue:!i.abort})}}}),CI=U("$ZodMAC",(n,i)=>{i.pattern??(i.pattern=C$(i.delimiter)),$n.init(n,i),n._zod.bag.format="mac"}),RI=U("$ZodCIDRv4",(n,i)=>{i.pattern??(i.pattern=R$),$n.init(n,i)}),hI=U("$ZodCIDRv6",(n,i)=>{i.pattern??(i.pattern=h$),$n.init(n,i),n._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[t,u]=o;if(!u)throw Error();let e=Number(u);if(`${e}`!==u)throw Error();if(e<0||e>128)throw Error();new URL(`http://[${t}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:n,continue:!i.abort})}}});function mI(n){if(n==="")return!0;if(/\s/.test(n))return!1;if(n.length%4!==0)return!1;try{return atob(n),!0}catch{return!1}}var
Line truncated
import{createRequireas$D0}from"node:module";vardX0=Object.create;var{getPrototypeOf:lX0,defineProperty:PO,getOwnPropertyNames:mX0}=Object;varoX0=Object.prototype.hasOwnProperty;functionrX0($){returnthis[$]}vartX0,aX0,BY=($,I,q)=>{varU=$!=null&&typeof$==="object";if(U){varY=I?tX0??=newWeakMap:aX0??=newWeakMap,J=Y.get($);if(J)returnJ}q=$!=null?dX0(lX0($)):{};letQ=I||!$||!$.__esModule?PO(q,"default",{value:$,enumerable:!0}):q;for(letKofmX0($))if(!oX0.call(Q,K))PO(Q,K,{get:rX0.bind($,K),enumerable:!0});if(U)Y.set($,Q);returnQ};varL=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varsX0=($)=>$;functioneX0($,I){this[$]=sX0.bind(null,I)}varp8=($,I)=>{for(varqinI)PO($,q,{get:I[q],enumerable:!0,configurable:!0,set:eX0.bind(I,q)})};varo=$D0(import.meta.url);varEJ=L((Ef)=>{Object.defineProperty(Ef,"__esModule",{value:!0});Ef.regexpCode=Ef.getEsmExportName=Ef.getProperty=Ef.safeStringify=Ef.stringify=Ef.strConcat=Ef.addCodeArg=Ef.str=Ef._=Ef.nil=Ef._Code=Ef.Name=Ef.IDENTIFIER=Ef._CodeOrName=void0;classvG{}Ef._CodeOrName=vG;Ef.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classbIextendsvG{constructor($){super();if(!Ef.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}Ef.Name=bI;classy$extendsvG{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((I,q)=>`${I}${q}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,q)=>{if(qinstanceofbI)I[q.str]=(I[q.str]||0)+1;returnI},{})}}Ef._Code=y$;Ef.nil=newy$("");functionTf($,...I){letq=[$[0]],U=0;while(U<I.length)xg(q,I[U]),q.push($[++U]);returnnewy$(q)}Ef._=Tf;varug=newy$("+");functionjf($,...I){letq=[jJ($[0])],U=0;while(U<I.length)q.push(ug),xg(q,I[U]),q.push(ug,jJ($[++U]));returnMF0(q),newy$(q)}Ef.str=jf;functionxg($,I){if(Iinstanceofy$)$.push(...I._items);elseif(IinstanceofbI)$.push(I);else$.push(PF0(I))}Ef.addCodeArg=xg;functionMF0($){letI=1;while(I<$.length-1){if($[I]===ug){letq=AF0($[I-1],$[I+1]);if(q!==void0){$.splice(I-1,3,q);continue}$[I++]="+"}I++}}functionAF0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofbI||$[$.length-1]!=='"')return;if(typeofI!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return$.slice(0,-1)+I.slice(1);return}if(typeofI=="string"&&I[0]==='"'&&!($instanceofbI))return`"${$}${I.slice(1)}`;return}functiongF0($,I){returnI.emptyStr()?$:$.emptyStr()?I:jf`${$}${I}`}Ef.strConcat=gF0;functionPF0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:jJ(Array.isArray($)?$.join(","):$)}functionTF0($){returnnewy$(jJ($))}Ef.stringify=TF0;functionjJ($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ef.safeStringify=jJ;functionjF0($){returntypeof$=="string"&&Ef.IDENTIFIER.test($)?newy$(`.${$}`):Tf`[${$}]`}Ef.getProperty=jF0;functionEF0($){if(typeof$=="string"&&Ef.IDENTIFIER.test($))returnnewy$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Ef.getEsmExportName=EF0;functionBF0($){returnnewy$($.toString())}Ef.regexpCode=BF0});varbg=L((Cf)=>{Object.defineProperty(Cf,"__esModule",{value:!0});Cf.ValueScope=Cf.ValueScopeName=Cf.Scope=Cf.varKinds=Cf.UsedValueState=void0;varu6=EJ();classvfextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varCG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(CG||(Cf.UsedValueState=CG={}));Cf.varKinds={const:newu6.Name("const"),let:newu6.Name("let"),var:newu6.Name("var")};classfg{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofu6.Name?$:this.name($)}name($){returnnewu6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,q;if(((q=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||q===void0?void0:q.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}Cf.Scope=fg;classngextendsu6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:q}){this.value=$,this.scopePath=u6._`.${newu6.Name(I)}[${q}]`}}Cf.ValueScopeName=ng;varbF0=u6._`\n`;classRfextendsfg{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?bF0:u6.nil}}get(){returnthis._scope}name($){returnnewng($,this._newName($))}value($,I){varq;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letU=this.toName($),{prefix:Y}=U,J=(q=I.key)!==null&&q!==void0?q:I.ref,Q=this._values[Y];if(Q){letw=Q.get(J);if(Line truncated
deps:${q}}`};var oj0={keyword:"dependencies",type:"object",schemaType:"object",error:oi.error,code($){let[I,q]=rj0($);li($,I),mi($,q)}};function rj0({schema:$}){let I={},q={};for(let U in $){if(U==="__proto__")continue;let Y=Array.isArray($[U])?I:q;Y[U]=$[U]}return[I,q]}function li($,I=$.schema){let{gen:q,data:U,it:Y}=$;if(Object.keys(I).length===0)return;let J=q.let("missing");for(let Q in I){let K=I[Q];if(K.length===0)continue;let z=(0,lJ.propertyInData)(q,U,Q,Y.opts.ownProperties);if($.setParams({property:Q,depsCount:K.length,deps:K.join(", ")}),Y.allErrors)q.if(z,()=>{for(let w of K)(0,lJ.checkReportMissingProp)($,w)});else q.if(TP._`${z}&&(${(0,lJ.checkMissingProp)($,K,J)})`),(0,lJ.reportMissingProp)($,J),q.else()}}oi.validatePropertyDeps=li;function mi($,I=$.schema){let{gen:q,data:U,keyword:Y,it:J}=$,Q=q.name("valid");for(let K in I){if((0,mj0.alwaysValidSchema)(J,I[K]))continue;q.if((0,lJ.propertyInData)(q,U,K,J.opts.ownProperties),()=>{let z=$.subschema({keyword:Y,schemaProp:K},Q);$.mergeValidEvaluated(z,Q)},()=>q.var(Q,!0)),$.ok(Q)}}oi.validateSchemaDeps=mi;oi.default=oj0});var $p=L((ei)=>{Object.defineProperty(ei,"__esModule",{value:!0});var si=o0(),sj0=z1(),ej0={message:"property name must be valid",params:({params:$})=>si._`{propertyName:${$.propertyName}}`},$E0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ej0,code($){let{gen:I,schema:q,data:U,it:Y}=$;if((0,sj0.alwaysValidSchema)(Y,q))return;let J=I.name("valid");I.forIn("key",U,(Q)=>{$.setParams({propertyName:Q}),$.subschema({keyword:"propertyNames",data:Q,dataTypes:["string"],propertyName:Q,compositeRule:!0},J),I.if((0,si.not)(J),()=>{if($.error(!0),!Y.allErrors)I.break()})}),$.ok(J)}};ei.default=$E0});var jP=L((Ip)=>{Object.defineProperty(Ip,"__esModule",{value:!0});var YH=D$(),f$=o0(),qE0=r8(),JH=z1(),UE0={message:"must NOT have additional properties",params:({params:$})=>f$._`{additionalProperty:${$.additionalProperty}}`},YE0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:UE0,code($){let{gen:I,schema:q,parentSchema:U,data:Y,errsCount:J,it:Q}=$;if(!J)throw Error("ajv implementation error");let{allErrors:K,opts:z}=Q;if(Q.props=!0,z.removeAdditional!=="all"&&(0,JH.alwaysValidSchema)(Q,q))return;let w=(0,YH.allSchemaProperties)(U.properties),G=(0,YH.allSchemaProperties)(U.patternProperties);H(),$.ok(f$._`${J}===${qE0.default.errors}`);function H(){I.forIn("key",Y,(O)=>{if(!w.length&&!G.length)X(O);else I.if(W(O),()=>X(O))})}function W(O){let N;if(w.length>8){let T=(0,JH.schemaRefOrVal)(Q,U.properties,"properties");N=(0,YH.isOwnProperty)(I,T,O)}else if(w.length)N=(0,f$.or)(...w.map((T)=>f$._`${O}===${T}`));else N=f$.nil;if(G.length)N=(0,f$.or)(N,...G.map((T)=>f$._`${(0,YH.usePattern)($,T)}.test(${O})`));return(0,f$.not)(N)}function V(O){I.code(f$._`delete${Y}[${O}]`)}function X(O){if(z.removeAdditional==="all"||z.removeAdditional&&q===!1){V(O);return}if(q===!1){if($.setParams({additionalProperty:O}),$.error(),!K)I.break();return}if(typeof q=="object"&&!(0,JH.alwaysValidSchema)(Q,q)){let N=I.name("valid");if(z.removeAdditional==="failing")D(O,N,!1),I.if((0,f$.not)(N),()=>{$.reset(),V(O)});else if(D(O,N),!K)I.if((0,f$.not)(N),()=>I.break())}}function D(O,N,T){let P={keyword:"additionalProperties",dataProp:O,dataPropType:JH.Type.Str};if(T===!1)Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(P,N)}}};Ip.default=YE0});var Jp=L((Yp)=>{Object.defineProperty(Yp,"__esModule",{value:!0});var QE0=SJ(),qp=D$(),EP=z1(),Up=jP(),KE0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,parentSchema:U,data:Y,it:J}=$;if(J.opts.removeAdditional==="all"&&U.additionalProperties===void 0)Up.default.code(new QE0.KeywordCxt(J,Up.default,"additionalProperties"));let Q=(0,qp.allSchemaProperties)(q);for(let H of Q)J.definedProperties.add(H);if(J.opts.unevaluated&&Q.length&&J.props!==!0)J.props=EP.mergeEvaluated.props(I,(0,EP.toHash)(Q),J.props);let K=Q.filter((H)=>!(0,EP.alwaysValidSchema)(J,q[H]));if(K.length===0)return;let z=I.name("valid");for(let H of K){if(w(H))G(H);else{if(I.if((0,qp.propertyInData)(I,Y,H,J.opts.ownProperties)),G(H),!J.allErrors)I.else().var(z,!0);I.endIf()}$.it.definedProperties.add(H),$.ok(z)}function w(H){return J.opts.useDefaults&&!J.compositeRule&&q[H].default!==void 0}function G(H){$.subschema({keyword:"properties",schemaProp:H,dataProp:H},z)}}};Yp.default=KE0});var Gp=L((wp)=>{Object.defineProperty(wp,"__esModule",{value:!0});var Qp=D$(),QH=o0(),Kp=z1(),zp=z1(),wE0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:q,data:U,parentSchema:Y,it:J}=$,{opts:Q}=J,K=(0,Qp.allSchemaProperties)(q),z=K.filter((D)=>(0,Kp.alwaysValidSchema)(J,q[D]));if(K.length===0||z.length===K.length&&(!J.opts.unevaluated||J.props===!0))return;let w=Q.strictSchema&&!Q.allowMatchingProperties&&Y.properties,G=I.name("valid");if(J.props!==!0&&!(J.props instanceo
Line truncated
`)}openNode($,I){let q=this.tos,U=this._xml;if(q&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),iB(U,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)O00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");iB(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(D00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,q){if(this.openNode($,I),q!==void 0)this.writeText(q);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}pB.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};L00.exports=pB});var cB=L((lb0)=>{var N00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function db0($){if(typeof $==="string")return $;if(N00)return N00.decode($);return $.toString()}lb0.bufferToString=db0});var P00=L((M00)=>{Object.defineProperty(M00,"__esModule",{value:!0});M00.CHAR=`
`,$=this.i;break;case Vp0:{let{entityReturnState:q}=this,U=this.entity+I.slice($,this.prevI);this.state=q;let Y;if(U==="")this.fail("empty entity name."),Y="&;";else Y=this.parseEntity(U),this.entity="";if(q!==B6||this.textHandler!==void 0)this.text+=Y;break $}case U4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(Z2($))this.state=Kp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case EW:this.state=Gp0,this.xmlDeclPossible=!1;break;case m00:this.state=ai0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case $6:this.state=qp0;break;default:this.fail("disallowed character in tag name"),this.state=B6,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=$v,this.openWakaBang="";break;case"--":this.state=eB,this.openWakaBang="";break;case"DOCTYPE":if(this.state=tB,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(jW))this.state=si0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===jW)this.state=ei0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=eB}sCommentEnded(){let $=this.getCodeNorm();if($!==_4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=eB;else this.state=B6}sCData(){if(this.captureToChar(sq))this.state=$p0}sCDataEnding(){let $=this.getCodeNorm();if($===sq)this.state=Ip0;else this.text+=`]${String.fromCodePoint($)}`,this.state=$v}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case _4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=B6;break}case sq:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=$v}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=n00;else if($===$6||p6($))this.fail("processing instruction without a target."),this.state=$===$6?TW:Iv;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=n00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let q=this.getCodeNorm();if(q===U4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(q)){this.piTarget+=$.slice(I,this.prevI);let U=q===$6;if(U||p6(q))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?J3:b00}else this.state=U?TW:Iv;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(q);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===$6)this.state=TW;else if(!p6($))this.text=String.fromCodePoint($)}else if(this.captureToChar($6))this.state=TW}sPIEnding(){var $;let I=this.getCodeNorm();if(I===_4){let{piTarget:q}=this;if(q.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:q,body:this.text}),this.piTarget=this.text="",this.state=B6}else if(I===$6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=Iv;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===$6){this.state=J3;return}if($!==U4)this.state=Up0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Xp0);if($===$6){this.state=J3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p6($)||$===aq))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===aq?i00:Yp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===$6){this.state=J3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if($!==aq)this.fail("value required.");this.state=i00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===$6){this.state=J3,this.fail("XML declaration is incomplete.");return}if(p6($))return;if(!BW($))this.fail("value must be quoted."),this.q=l00;else this.q=$;this.state=Jp0}sXMLDeclValue(){let $=this.captureTo([this.q,$6]);if($===$6){this.state=J3,this.text="",this.fail("XML declaration is incomplete.");return}if($===U4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let q=I;if(this.xmlDecl.version=q,!/^1\.[0-9]+$/.test(q))this.fail("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new h4($,I).found}function h4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+e[w0-1];break}}}var I1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+c;v._warn(I1,!0,F)}}function v0(r,F){var M=r+" is deprecated and will be removed in a future version.";if(F)M+=" Use "+F+" instead.";return v1(M)}function v1(r,F,M){if(!g0.warnings)return;var v=new Y(r),y;if(F)M._attachExtraTrace(v);else if(g0.longStackTraces&&(y=$._peekContext()))y.attachExtraTrace(v);else{var s=Y4(v);v.stack=s.message+`
`)));return}}N=N._target();var T=N._bitField;if((T&50397184)===0)this._yieldedPromise=N,N._proxy(this,null);else if((T&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,N._value());else if((T&16777216)!==0)$._async.invoke(this._promiseRejected,this,N._reason());else this._promiseCancelled()}},$.coroutine=function(X,D){if(typeof X!=="function")throw new K(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var O=Object(D).yieldHandler,N=V,T=Error().stack;return function(){var P=X.apply(this,arguments),g=new N(void 0,void 0,O,T),B=g.promise();return g._generator=P,g._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new K("expecting a function but got "+z.classString(X));H.push(X)},$.spawn=function(X){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`)},I=function(){return new C.PromiseInspection(this._target())},q=function(j){return C.reject(new H(j))};function U(){}var Y={},J=n1(),Q;if(J.isNode)Q=function(){var j=process.domain;if(j===void 0)j=null;return j};else Q=function(){return null};J.notEnumerableProp(C,"_getDomain",Q);var K=k3(),z=QK0(),w=new z;K.defineProperty(C,"_async",{value:w});var G=v5(),H=C.TypeError=G.TypeError;C.RangeError=G.RangeError;var W=C.CancellationError=G.CancellationError;C.TimeoutError=G.TimeoutError,C.OperationalError=G.OperationalError,C.RejectionError=G.OperationalError,C.AggregateError=G.AggregateError;var V=function(){},X={},D={},O=HK0()(C,V),N=WK0()(C,V,O,q,U),T=XK0()(C),P=T.create,g=OK0()(C,T),B=g.CapturedTrace,x=NK0()(C,O),h=MK0()(D),f=KS(),S=J.errorObj,t=J.tryCatch;function p(j,u){if(typeof u!=="function")throw new H("expecting a function but got "+J.classString(u));if(j.constructor!==C)throw new H(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function C(j){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,j!==V)p(this,j),this._resolveFromExecutor(j);this._promiseCreated(),this._fireEvent("promiseCreated",this)}C.prototype.toString=function(){return"[object Promise]"},C.prototype.caught=C.prototype.catch=function(j){var u=arguments.length;if(u>1){var d=Array(u-1),a=0,K0;for(K0=0;K0<u-1;++K0){var G0=arguments[K0];if(J.isObject(G0))d[a++]=G0;else return q("expecting an object but got A catch statement predicate "+J.classString(G0))}return d.length=a,j=arguments[K0],this.then(void 0,h(d,j,this))}return this.then(void 0,j)},C.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},C.prototype.then=function(j,u){if(g.warnings()&&arguments.length>0&&typeof j!=="function"&&typeof u!=="function"){var d=".then() only accepts functions but was passed: "+J.classString(j);if(arguments.length>1)d+=", "+J.classString(u);this._warn(d)}return this._then(j,u,void 0,void 0,void 0)},C.prototype.done=function(j,u){var d=this._then(j,u,void 0,void 0,void 0);d._setIsFinal()},C.prototype.spread=function(j){if(typeof j!=="function")return q("expecting a function but got "+J.classString(j));return this.all()._then(j,void 0,void 0,X,void 0)},C.prototype.toJSON=function(){var j={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())j.fulfillmentValue=this.value(),j.isFulfilled=!0;else if(this.isRejected())j.rejectionReason=this.reason(),j.isRejected=!0;return j},C.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new N(this).promise()},C.prototype.error=function(j){return this.caught(J.originatesFromRejection,j)},C.getNewLibraryCopy=wS.exports,C.is=function(j){return j instanceof C},C.fromNode=C.fromCallback=function(j){var u=new C(V);u._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,a=t(j)(f(u,d));if(a===S)u._rejectCallback(a.e,!0);if(!u._isFateSealed())u._setAsyncGuaranteed();return u},C.all=function(j){return new N(j).promise()},C.cast=function(j){var u=O(j);if(!(u instanceof C))u=new C(V),u._captureStackTrace(),u._setFulfilled(),u._rejectionHandler0=j;return u},C.resolve=C.fulfilled=C.cast,C.reject=C.rejected=function(j){var u=new C(V);return u._captureStackTrace(),u._rejectCallback(j,!0),u},C.setScheduler=function(j){if(typeof j!=="function")throw new H("expecting a function but got "+J.classString(j));return w.setScheduler(j)},C.prototype._then=function(j,u,d,a,K0){var G0=K0!==void 0,M0=G0?K0:new C(V),v0=this._target(),v1=v0._bitField;if(!G0){if(M0._propagateFrom(this,3),M0._captureStackTrace(),a===void 0&&(this._bitField&2097152)!==0)if((v1&50397184)!==0)a=this._boundValue();else a=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,M0)}var m0=Q();if((v1&50397184)!==0){var N1,F1,J1=v0._settlePromiseCtx;if((v1&33554432)!==0)F1=v0._rejectionHandler0,N1=j;else if((v1&16777216)!==0)F1=v0._fulfillmentHandler0,N1=u,v0._unsetRejectionIsUnhandled();else J1=v0._settlePromiseLateCancellationObserver,F1=new W("late cancellation observer"),v0._attachExtraTrace(F1),N1=u;w.invoke(J1,v0,{handler:m0===null?N1:typeof N1==="function"&&J.domainBind(m0,N1),promise:M0,receiver:a,value:F1})}else v0._addCallbacks(j,u,M0,a,m0);return M0},C.prototype._length=function(){return this._bitField&65535},C.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},C.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},C.prototype._setLength=function(j){this._bitField=this._bitField&-65536|j&65535},C.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},C.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},C.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},C.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},C.prototype._isFinal=function(){return(this._bitField&4194304)>0},C.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},C.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},C.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},C.prototype._setAsyncGuaranteed=function(){if(w.hasCustomScheduler())return;this._bitField=this._bitField|134217728},C.prototype._receiverAt=function(j){var u=j===0?this._receiver0:this[j*4-4+3];if(u===Y)return;else if(u===void 0&&this._isBound())return this._boundValue();return u},C.prototype._promiseAt=function(j){return this[j*4-4+2]},C.prototype._fulfillmentHandlerAt=function(j){return this[j*4-4+0]},C.prototype._rejectionHandlerAt=function(j){return this[j*4-4+1]},C.prototype._boundValue=function(){},C.prototype._migrateCallback0=function(j){var{_bit
Line truncated
`).filter((J)=>J),U=Math.min(...q.map((J)=>J.length-J.trimStart().length)),Y=q.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Y)this.content.push(J)}compile(){let $=Function,I=this?.args,U=[...(this?.content??[""]).map((Y)=>`${Y}`)];return new $(...I,U.join(`
`))}}var _L={major:4,minor:4,patch:3};var k0=m("$ZodType",($,I)=>{var q;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=_L;let U=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))U.unshift($);for(let Y of U)for(let J of Y._zod.onattach)J($);if(U.length===0)(q=$._zod).deferred??(q.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let Y=(Q,K,z)=>{let w=d5(Q),G;for(let H of K){if(H._zod.def.when){if(uO(Q))continue;if(!H._zod.def.when(Q))continue}else if(w)continue;let W=Q.issues.length,V=H._zod.check(Q);if(V instanceof Promise&&z?.async===!1)throw new U8;if(G||V instanceof Promise)G=(G??Promise.resolve()).then(async()=>{if(await V,Q.issues.length===W)return;if(!w)w=d5(Q,W)});else{if(Q.issues.length===W)continue;if(!w)w=d5(Q,W)}}if(G)return G.then(()=>{return Q});return Q},J=(Q,K,z)=>{if(d5(Q))return Q.aborted=!0,Q;let w=Y(K,U,z);if(w instanceof Promise){if(z.async===!1)throw new U8;return w.then((G)=>$._zod.parse(G,z))}return $._zod.parse(w,z)};$._zod.run=(Q,K)=>{if(K.skipChecks)return $._zod.parse(Q,K);if(K.direction==="backward"){let w=$._zod.parse({value:Q.value,issues:[]},{...K,skipChecks:!0});if(w instanceof Promise)return w.then((G)=>{return J(G,Q,K)});return J(w,Q,K)}let z=$._zod.parse(Q,K);if(z instanceof Promise){if(K.async===!1)throw new U8;return z.then((w)=>Y(w,U,K))}return Y(z,U,K)}}r0($,"~standard",()=>({validate:(Y)=>{try{let J=GI($,Y);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return nY($,Y).then((Q)=>Q.success?{value:Q.data}:{issues:Q.error?.issues})}},vendor:"zod",version:1}))}),A7=m("$ZodString",($,I)=>{k0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??QL($._zod.bag),$._zod.parse=(q,U)=>{if(I.coerce)try{q.value=String(q.value)}catch(Y){}if(typeof q.value==="string")return q;return q.issues.push({expected:"string",code:"invalid_type",input:q.value,inst:$}),q}}),_1=m("$ZodStringFormat",($,I)=>{VI.init($,I),A7.init($,I)}),SL=m("$ZodGUID",($,I)=>{I.pattern??(I.pattern=lO),_1.init($,I)}),yL=m("$ZodUUID",($,I)=>{if(I.version){let U={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(U===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=M7(U))}else I.pattern??(I.pattern=M7());_1.init($,I)}),uL=m("$ZodEmail",($,I)=>{I.pattern??(I.pattern=mO),_1.init($,I)}),xL=m("$ZodURL",($,I)=>{_1.init($,I),$._zod.check=(q)=>{try{let U=q.value.trim();if(!I.normalize&&I.protocol?.source===IL.source){if(!/^https?:\/\//i.test(U)){q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:q.value,inst:$,continue:!I.abort});return}}let Y=new URL(U);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(Y.hostname))q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:q.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(Y.protocol.endsWith(":")?Y.protocol.slice(0,-1):Y.protocol))q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:q.value,inst:$,continue:!I.abort})}if(I.normalize)q.value=Y.href;else q.value=U;return}catch(U){q.issues.push({code:"invalid_format",format:"url",input:q.value,inst:$,continue:!I.abort})}}}),kL=m("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=oO()),_1.init($,I)}),fL=m("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=cO),_1.init($,I)}),nL=m("$ZodCUID",($,I)=>{I.pattern??(I.pattern=fO),_1.init($,I)}),bL=m("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=nO),_1.init($,I)}),iL=m("$ZodULID",($,I)=>{I.pattern??(I.pattern=bO),_1.init($,I)}),pL=m("$ZodXID",($,I)=>{I.pattern??(I.pattern=iO),_1.init($,I)}),cL=m("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=pO),_1.init($,I)}),dL=m("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=JL(I)),_1.init($,I)}),lL=m("$ZodISODate",($,I)=>{I.pattern??(I.pattern=UL),_1.init($,I)}),mL=m("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=YL(I)),_1.init($,I)}),oL=m("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=dO),_1.init($,I)}),rL=m("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=rO),_1.init($,I),$._zod.bag.format="ipv4"}),tL=m("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=tO),_1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(q)=>{try{new URL(`http://[${q.value}]`)}catch{q.issues.push({code:"invalid_format",format:"ipv6",input:q.value,inst:$,continue:!I.abort})}}}),aL=m("$ZodMAC",($,I)=>{I.pattern??(I.pattern=aO(I.delimiter)),_1.init($,I),$._zod.bag.format="mac"}),sL=m("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=sO),_1.init($,I)}),eL=m("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=eO),_1.init($,I),$._zod.check=(q)=>{let U=q.value.split("/");try{if(U.length!==2)throw Error();let[Y,J]=U;if(!J)throw Error();let Q=Number(J);if(`${Q}`!==J)throw Error();if(Q<0||Q>128)throw Error();new URL(`http://[${Y}]`)}catch{q.issues.push({code:"invalid_format",format:"cidrv6",input:q.value,inst:$,continue:!I.abort})}}});function $N($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`)}f.write("payload.value = newResult;"),f.write("return payload;");let Q=f.compile();return(P,j)=>Q(w,P,j)},u,e=Nt,l=!kt.jitless,I=l&&G$.value,g=i.catchall,b;n._zod.parse=(w,f)=>{b??(b=o.value);let c=w.value;if(!e(c))return w.issues.push({expected:"object",code:"invalid_type",input:c,inst:n}),w;if(l&&I&&f?.async===!1&&f.jitless!==!0){if(!u)u=t(i.shape);if(w=u(w,f),!g)return w;return E0([],c,w,f,b,n)}return r(w,f)}});function G0(n,i,r,o){for(let u of n)if(u.issues.length===0)return i.value=u.value,i;let t=n.filter((u)=>!ai(u));if(t.length===1)return i.value=t[0].value,t[0];return i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((u)=>u.issues.map((e)=>_n(e,o,kn())))}),i}var Uo=U("$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)=>to(t.source)).join("|")})$`)}return});let r=i.options.length===1?i.options[0]._zod.run:null;n._zod.parse=(o,t)=>{if(r)return r(o,t);let u=!1,e=[];for(let l of i.options){let $=l._zod.run({value:o.value,issues:[]},t);if($ instanceof Promise)e.push($),u=!0;else{if($.issues.length===0)return $;e.push($)}}if(!u)return G0(e,o,n,t);return Promise.all(e).then((l)=>{return G0(l,o,n,t)})}});function j0(n,i,r,o){let t=n.filter((u)=>u.issues.length===0);if(t.length===1)return i.value=t[0].value,i;if(t.length===0)i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:n.map((u)=>u.issues.map((e)=>_n(e,o,kn())))});else i.issues.push({code:"invalid_union",input:i.value,inst:r,errors:[],inclusive:!1});return i}var fg=U("$ZodXor",(n,i)=>{Uo.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 j0(e,o,n,t);return Promise.all(e).then((l)=>{return j0(l,o,n,t)})}}),cg=U("$ZodDiscriminatedUnion",(n,i)=>{i.inclusive=!1,Uo.init(n,i);let r=n._zod.parse;h(n._zod,"propValues",()=>{let t={};for(let u of i.options){let e=u._zod.propValues;if(!e||Object.keys(e).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${i.options.indexOf(u)}"`);for(let[l,$]of Object.entries(e)){if(!t[l])t[l]=new Set;for(let I of $)t[l].add(I)}}return t});let o=zt(()=>{let t=i.options,u=new Map;for(let e of t){let l=e._zod.propValues?.[i.discriminator];if(!l||l.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${i.options.indexOf(e)}"`);for(let $ of l){if(u.has($))throw Error(`Duplicatediscriminatorvalue"${String($)}"`);u.set($,e)}}return u});n._zod.parse=(t,u)=>{let e=t.value;if(!Nt(e))return t.issues.push({code:"invalid_type",expected:"object",input:e,inst:n}),t;let l=o.value.get(e?.[i.discriminator]);if(l)return l._zod.run(t,u);if(i.unionFallback||u.direction==="backward")return r(t,u);return t.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:i.discriminator,options:Array.from(o.value.keys()),input:e,path:[i.discriminator],inst:n}),t}}),Ug=U("$ZodIntersection",(n,i)=>{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 W0(r,$,I)});return W0(r,u,e)}});function JI(n,i){if(n===i)return{valid:!0,data:n};if(n instanceof Date&&i instanceof Date&&+n===+i)return{valid:!0,data:n};if(xi(n)&&xi(i)){let r=Object.keys(i),o=Object.keys(n).filter((u)=>r.indexOf(u)!==-1),t={...n,...i};for(let u of o){let e=JI(n[u],i[u]);if(!e.valid)return{valid:!1,mergeErrorPath:[u,...e.mergeErrorPath]};t[u]=e.data}return{valid:!0,data:t}}if(Array.isArray(n)&&Array.isArray(i)){if(n.length!==i.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<n.length;o++){let t=n[o],u=i[o],e=JI(t,u);if(!e.valid)return{valid:!1,mergeErrorPath:[o,...e.mergeErrorPath]};r.push(e.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function W0(n,i,r){let o=new Map,t;for(let l of i.issues)if(l.code==="unrecognized_keys"){t??(t=l);for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).l=!0}}else n.issues.push(l);for(let l of r.issues)if(l.code==="unrecognized_keys")for(let $ of l.keys){if(!o.has($))o.set($,{});o.get($).r=!0}else n.issues.push(l);let u=[...o].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(u.length&&t)n.issues.push({...t,keys:u});if(ai(n))return n;let e=JI(i.value,r.value);if(!e.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(e.mergeErrorPath)}`);return n.value=e.data,n}var ce=U("$ZodTuple",(n,i)=>{T.init(n,i
Line truncated
`)}V.write("payload.value = newResult;"),V.write("return payload;");let T=V.compile();return(P,g)=>T(W,P,g)},J,Q=F7,K=!L7.jitless,w=K&&RO.value,G=I.catchall,H;$._zod.parse=(W,V)=>{H??(H=U.value);let X=W.value;if(!Q(X))return W.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),W;if(K&&w&&V?.async===!1&&V.jitless!==!0){if(!J)J=Y(I.shape);if(W=J(W,V),!G)return W;return xx([],X,W,V,H,$)}return q(W,V)}});function Mx($,I,q,U){for(let J of $)if(J.issues.length===0)return I.value=J.value,I;let Y=$.filter((J)=>!d5(J));if(Y.length===1)return I.value=Y[0].value,Y[0];return I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((J)=>J.issues.map((Q)=>M6(Q,U,V4())))}),I}var dY=m("$ZodUnion",($,I)=>{k0.init($,I),r0($._zod,"optin",()=>I.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),r0($._zod,"optout",()=>I.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),r0($._zod,"values",()=>{if(I.options.every((U)=>U._zod.values))return new Set(I.options.flatMap((U)=>Array.from(U._zod.values)));return}),r0($._zod,"pattern",()=>{if(I.options.every((U)=>U._zod.pattern)){let U=I.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${U.map((Y)=>CY(Y.source)).join("|")})$`)}return});let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(q)return q(U,Y);let J=!1,Q=[];for(let K of I.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else{if(z.issues.length===0)return z;Q.push(z)}}if(!J)return Mx(Q,U,$,Y);return Promise.all(Q).then((K)=>{return Mx(K,U,$,Y)})}});function Ax($,I,q,U){let Y=$.filter((J)=>J.issues.length===0);if(Y.length===1)return I.value=Y[0].value,I;if(Y.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:$.map((J)=>J.issues.map((Q)=>M6(Q,U,V4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:q,errors:[],inclusive:!1});return I}var LN=m("$ZodXor",($,I)=>{dY.init($,I),I.inclusive=!1;let q=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(U,Y)=>{if(q)return q(U,Y);let J=!1,Q=[];for(let K of I.options){let z=K._zod.run({value:U.value,issues:[]},Y);if(z instanceof Promise)Q.push(z),J=!0;else Q.push(z)}if(!J)return Ax(Q,U,$,Y);return Promise.all(Q).then((K)=>{return Ax(K,U,$,Y)})}}),NN=m("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,dY.init($,I);let q=$._zod.parse;r0($._zod,"propValues",()=>{let Y={};for(let J of I.options){let Q=J._zod.propValues;if(!Q||Object.keys(Q).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(J)}"`);for(let[K,z]of Object.entries(Q)){if(!Y[K])Y[K]=new Set;for(let w of z)Y[K].add(w)}}return Y});let U=JI(()=>{let Y=I.options,J=new Map;for(let Q of Y){let K=Q._zod.propValues?.[I.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Q)}"`);for(let z of K){if(J.has(z))throw Error(`Duplicatediscriminatorvalue"${String(z)}"`);J.set(z,Q)}}return J});$._zod.parse=(Y,J)=>{let Q=Y.value;if(!F7(Q))return Y.issues.push({code:"invalid_type",expected:"object",input:Q,inst:$}),Y;let K=U.value.get(Q?.[I.discriminator]);if(K)return K._zod.run(Y,J);if(I.unionFallback||J.direction==="backward")return q(Y,J);return Y.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(U.value.keys()),input:Q,path:[I.discriminator],inst:$}),Y}}),FN=m("$ZodIntersection",($,I)=>{k0.init($,I),$._zod.parse=(q,U)=>{let Y=q.value,J=I.left._zod.run({value:Y,issues:[]},U),Q=I.right._zod.run({value:Y,issues:[]},U);if(J instanceof Promise||Q instanceof Promise)return Promise.all([J,Q]).then(([z,w])=>{return gx(q,z,w)});return gx(q,J,Q)}});function hL($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(c5($)&&c5(I)){let q=Object.keys(I),U=Object.keys($).filter((J)=>q.indexOf(J)!==-1),Y={...$,...I};for(let J of U){let Q=hL($[J],I[J]);if(!Q.valid)return{valid:!1,mergeErrorPath:[J,...Q.mergeErrorPath]};Y[J]=Q.data}return{valid:!0,data:Y}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let q=[];for(let U=0;U<$.length;U++){let Y=$[U],J=I[U],Q=hL(Y,J);if(!Q.valid)return{valid:!1,mergeErrorPath:[U,...Q.mergeErrorPath]};q.push(Q.data)}return{valid:!0,data:q}}return{valid:!1,mergeErrorPath:[]}}function gx($,I,q){let U=new Map,Y;for(let K of I.issues)if(K.code==="unrecognized_keys"){Y??(Y=K);for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).l=!0}}else $.issues.push(K);for(let K of q.issues)if(K.code==="unrecognized_keys")for(let z of K.keys){if(!U.has(z))U.set(z,{});U.get(z).r=!0}else $.issues.push(K);let J=[...U].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Y)$.issues.push({...Y,keys:J});if(d5($))return $;let Q=hL(I.value,q.value);if(!Q.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(Q.mergeErrorPath)}`);return $.value=Q.data,$}var Jw=m("$ZodTuple",($,I)=>{k0.
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(leteofn.seen.entries()){letl=e[1];if(i===e[0]){u(e);continue}if(n.external){letI=n.external.registry.get(e[0])?.id;if(i!==e[0]&&I){u(e);continue}}if(n.metadataRegistry.get(e[0])?.id){u(e);continue}if(l.cycle){u(e);continue}if(l.count>1){if(n.reused==="ref"){u(e);continue}}}}functionrt(n,i){letr=n.seen.get(i);if(!r)throwError("Unprocessed schema. This is a bug in Zod.");leto=(l)=>{let$=n.seen.get(l);if($.ref===null)return;letI=$.def??$.schema,g={...I},b=$.ref;if($.ref=null,b){o(b);letf=n.seen.get(b),c=f.schema;if(c.$ref&&(n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"))I.allOf=I.allOf??[],I.allOf.push(c);elseObject.assign(I,c);if(Object.assign(I,g),l._zod.parent===b)for(letkinI){if(k==="$ref"||k==="allOf")continue;if(!(king))deleteI[k]}if(c.$ref&&f.def)for(letkinI){if(k==="$ref"||k==="allOf")continue;if(kinf.def&&JSON.stringify(I[k])===JSON.stringify(f.def[k]))deleteI[k]}}letw=l._zod.parent;if(w&&w!==b){o(w);letf=n.seen.get(w);if(f?.schema.$ref){if(I.$ref=f.schema.$ref,f.def)for(letcinI){if(c==="$ref"||c==="allOf")continue;if(cinf.def&&JSON.stringify(I[c])===JSON.stringify(f.def[c]))deleteI[c]}}}n.override({zodSchema:l,jsonSchema:I,path:$.path??[]})};for(letlof[...n.seen.entries()].reverse())o(l[0]);lett={};if(n.target==="draft-2020-12")t.$schema="https://json-schema.org/draft/2020-12/schema";elseif(n.target==="draft-07")t.$schema="http://json-schema.org/draft-07/schema#";elseif(n.target==="draft-04")t.$schema="http://json-schema.org/draft-04/schema#";elseif(n.target==="openapi-3.0");if(n.external?.uri){letl=n.external.registry.get(i)?.id;if(!l)throwError("Schema is missing an `id` property");t.$id=n.external.uri(l)}Object.assign(t,r.def??r.schema);letu=n.metadataRegistry.get(i)?.id;if(u!==void0&&t.id===u)deletet.id;lete=n.external?.defs??{};for(letlofn.seen.entries()){let$=l[1];if($.def&&$.defId){if($.def.id===$.defId)delete$.def.id;e[$.defId]=$.def}}if(n.external);elseif(Object.keys(e).length>0)if(n.target==="draft-2020-12")t.$defs=e;elset.definitions=e;try{letl=JSON.parse(JSON.stringify(t));returnObject.defineProperty(l,"~standard",{value:{...i["~standard"],jsonSchema:{input:fr(i,"input",n.processors),output:fr(i,"output",n.processors)}},enumerable:!1,writable:!1}),l}catch(l){throwError("Error converting schema to JSON.")}}functionMn(n,i){letr=i??{seen:newSet};if(r.seen.has(n))return!1;r.seen.add(n);leto=n._zod.def;if(o.type==="transform")return!0;if(o.type==="array")returnMn(o.element,r);if(o.type==="set")returnMn(o.valueType,r);if(o.type==="lazy")returnMn(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")returnMn(o.innerType,r);if(o.type==="intersection")returnMn(o.left,r)||Mn(o.right,r);if(o.type==="record"||o.type==="map")returnMn(o.keyType,r)||Mn(o.valueType,r);if(o.type==="pipe"){if(n._zod.traits.has("$ZodCodec"))return!0;returnMn(o.in,r)||Mn(o.out,r)}if(o.type==="object"){for(lettino.shape)if(Mn(o.shape[t],r))return!0;return!1}if(o.type==="union"){for(lettofo.options)if(Mn(t,r))return!0;return!1}if(o.type==="tuple"){for(lettofo.items)if(Mn(t,r))return!0;if(o.rest&&Mn(o.rest,r))return!0;return!1}return!1}vardw=(n,i={})=>(r)=>{leto=it({...r,processors:i});returnen(n,o),tt(o,n),rt(o,n)},fr=(n,i,r={})=>(o)=>{let{libraryOptions:t,target:u}=o??{},e=it({...t??{},target:u,io:i,processors:r});returnen(n,e),tt(e,n),rt(e,n)};varIW={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Nw=(n,i,r,o)=>{lett=r;t.type="string";let{minimum:u,maximum:e,format:l,patterns:$,contentEncoding:I}=n._zod.bag;if(typeofu==="number")t.minLength=u;if(typeofe==="number")t.maxLength=e;if(l){if(t.format=IW[l]??l,t.format==="")deletet.format;if(l==="time")deletet.format}if(I)t.contentEncoding=I;if($&&$.size>0){letg=[...$];if(g.length===1)t.pattern=g[0].source;elseif(g.length>1)t.allOf=[...g.map((b)=>({...i.target==="draft-07"||i.target==="draft-04"||i.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))]}},Lw=(n,i,r,o)=>{lett=r,{minimum:u,maximum:e,format:l,multipleOf:$,exclusiveMaximum:I,exclusiveMinimum:g}=n._zod.bag;if(typeofl==="string"&&l.includes("int"))t.type="integer";elset.type="number";letb=typeofg==="number"&&g>=(u??Number.NEGATIVE_INFINITY),w=typeofI==="number"&&I<=(e??Number.POSITIVE_INFINITY),f=i.target==="draft-04"||i.target==="openapi-3.0";if(b)if(f)t.minimum=g,t.exclusiveMinimum=!0;elset.exclusiveMinimum=g;elseif(typeofu==="number")t.minimum=u;if(w)if(f)t.maximum=I,t.exclusiveMaximum=!0;elset.exclusiveMaximum=I;elseif(typeofe==="number")t.maximum=e;if(typeof$==="number")t.multipleOf=$},yw=(n,i,r,o)=>{r.type="boolean"},Gw=(n,i,r,o)=>{if(i.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},jw=(n,i,r,o)=>{if(i.unrepresentable==="Line truncated
`}class q6{constructor(n=Uk.stdin,i=Uk.stdout){this._stdin=n,this._stdout=i,this._readBuffer=new V6,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=ck(n);if(this._stdout.write(r))i();else this._stdout.once("drain",i)})}}import{dirname as s4,join as MK}from"node:path";import{fileURLToPath as zK}from"node:url";class Zi extends Error{name="KyError";get isKyError(){return!0}}class ti extends Zi{name="HTTPError";response;request;options;data;constructor(n,i,r){let o=n.status||n.status===0?n.status:"",t=n.statusText??"",u=`${o}${t}`.trim(),e=u?`statuscode${u}`:"an unknown error";super(`Requestfailedwith${e}:${i.method}${i.url}`);this.response=n,this.request=i,this.options=r}}class ku extends Zi{name="NetworkError";request;constructor(n,i){super(`Requestfailedduetoanetworkerror:${n.method}${n.url}`,i);this.request=n}}class du 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 du(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 E6 extends Error{name="SchemaValidationError";issues;constructor(n){super("Response schema validation failed");this.issues=n}}class Oi extends Zi{name="TimeoutError";request;constructor(n){super(`Requesttimedout:${n.method}${n.url}`);this.request=n}}var _6=(()=>{let n=!1,i=!1,r=typeof globalThis.ReadableStream==="function",o=typeof globalThis.Request==="function";if(r&&o)try{i=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type")}catch(t){if(t instanceof Error&&t.message==="unsupported BodyInit type")return!1;throw t}return n&&!i})(),Dk=typeof globalThis.AbortController==="function",kv=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Sk=typeof globalThis.ReadableStream==="function",Ak=typeof globalThis.FormData==="function",dv=["get","post","put","patch","head","delete"],p5=()=>{return};p5();var Ok={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Er=2147483647,kk=40,Nv=Symbol("stop");class Lv{options;constructor(n){this.options=n}}var dk=(n)=>new Lv(n),Nk={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},Lk={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 yv=new TextEncoder,P5=(n)=>{if(!n)return 0;if(n instanceof FormData){let i=0;for(let[r,o]of n)i+=kk,i+=yv.encode(`Content-Disposition:form-data;name="${r}"`).byteLength,i+=typeof o==="string"?yv.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 yv.encode(n).byteLength;if(n instanceof URLSearchParams)return yv.encode(n.toString()).byteLength;return 0},yk=(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)}}))},Gk=(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(yk(n.body,o,i),r)},jk=(n,i,r)=>{if(!n.body)return n;let o=P5(r??n.body);return new Request(n,{duplex:"half",body:yk(n.body,o,i)})};var Hi=(n)=>n!==null&&typeof n==="object";var Q5=Symbol("replaceOption"),Z6=(n)=>Hi(n)&&n[Q5]===!0?{isReplace:!0,value:n.value}:{isReplace:!1,value:n};var Lu=(...n)=>{for(let i of n)if((!Hi(i)|
Line truncated
`,{mode:384}),i}function Cr(n,i,r=[]){let o=i.corpId?.trim()||void 0,t=i.stateful?i.defaultCorpId?.trim()||void 0:void 0,u=o??t;if(u){let l=n.find(($)=>$.id===u);if(l)return l;throw Error(`Noenterpriseconfigfoundfor${u}`)}if(!i.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let e=n[0];if(e)return e;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(r.length?r.join(", "):"the configured enterprise directories"))}import{readFileSync as gF}from"node:fs";import{randomBytes as bF}from"node:crypto";import{randomBytes as Vd}from"node:crypto";var JQ=v.object({staffId:v.string(),name:v.string().optional(),code:v.string().default(""),bindTime:v.number().optional()}),XQ=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:JQ.optional()}),HQ=v.object({apiKey:v.string().optional(),corporationId:v.string().optional(),corporationName:v.string().optional()}),YQ=v.object({id:v.string(),name:v.string(),tenantSlug:v.string().optional(),isDemo:v.boolean().default(!1),logoUrl:v.string().nullable().optional(),hoseCorpConfig:HQ.optional()}),Sd=v.object({user:XQ,tenant:YQ}),pQ=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(),PQ=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(),Ad=v.object({user:pQ,session:PQ}),_v=v.object({id:v.string(),tenantId:v.string().optional(),code:v.number().optional(),description:v.string(),scope:v.string(),strictness:v.string(),status:v.string().optional(),createdAt:v.number().optional(),updatedAt:v.number().optional()}),Od=v.object({rules:v.array(_v),hasPendingDeletes:v.boolean().default(!1)}),QQ=v.object({code:v.string().optional(),description:v.string(),scope:v.string(),strictness:v.string()}),Zv=v.object({id:v.string(),tenantId:v.string().optional(),versionNumber:v.number(),versionName:v.string().nullable().optional(),publishedBy:v.string().nullable().optional(),publishedByName:v.string().nullable().optional(),rules:v.array(QQ).default([]),publishedAt:v.number().optional(),createdAt:v.number().optional()}),kd=v.object({version:Zv,rulesCount:v.number()}),Yu=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)}),dd=v.object({articles:v.array(Yu),total:v.number().optional()}),FQ=v.object({explicitApprove:v.string().default(""),explicitReject:v.string().default(""),exemptApprove:v.string().default(""),review:v.string().default("")}).passthrough(),KQ=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(),BQ=v.enum(["assisted","semi_automatic","fully_automatic"]),Dd=v.object({id:v.string(),url:v.string().url()}).passthrough(),pu=v.object({type:v.literal("webhook"),id:v.string(),name:v.string(),mode:BQ,incomingDocumentWebhook:Dd,outgoingResultWebhook:v.string().url(),incomingManualResultWebhook:Dd,secret:v.string().min(1),autoApprovalRate:v.number().int().min(0).max(100).optional()}).passthrough(),v4=v.object({id:v.string().optional(),tenantId:v.string().optional(),tone:v.string().optional(),language:v.string().optional(),detailLevel:v.string().optional(),outputFormat:v.string().optional(),examples:v.array(v.string()).default([]),prohibitedPhrases:v.array(v.string()).default([]),cus
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letQof$.seen.entries()){letK=Q[1];if(I===Q[0]){J(Q);continue}if($.external){letw=$.external.registry.get(Q[0])?.id;if(I!==Q[0]&&w){J(Q);continue}}if($.metadataRegistry.get(Q[0])?.id){J(Q);continue}if(K.cycle){J(Q);continue}if(K.count>1){if($.reused==="ref"){J(Q);continue}}}}functiont5($,I){letq=$.seen.get(I);if(!q)throwError("Unprocessed schema. This is a bug in Zod.");letU=(K)=>{letz=$.seen.get(K);if(z.ref===null)return;letw=z.def??z.schema,G={...w},H=z.ref;if(z.ref=null,H){U(H);letV=$.seen.get(H),X=V.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))w.allOf=w.allOf??[],w.allOf.push(X);elseObject.assign(w,X);if(Object.assign(w,G),K._zod.parent===H)for(letOinw){if(O==="$ref"||O==="allOf")continue;if(!(OinG))deletew[O]}if(X.$ref&&V.def)for(letOinw){if(O==="$ref"||O==="allOf")continue;if(OinV.def&&JSON.stringify(w[O])===JSON.stringify(V.def[O]))deletew[O]}}letW=K._zod.parent;if(W&&W!==H){U(W);letV=$.seen.get(W);if(V?.schema.$ref){if(w.$ref=V.schema.$ref,V.def)for(letXinw){if(X==="$ref"||X==="allOf")continue;if(XinV.def&&JSON.stringify(w[X])===JSON.stringify(V.def[X]))deletew[X]}}}$.override({zodSchema:K,jsonSchema:w,path:z.path??[]})};for(letKof[...$.seen.entries()].reverse())U(K[0]);letY={};if($.target==="draft-2020-12")Y.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")Y.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")Y.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letK=$.external.registry.get(I)?.id;if(!K)throwError("Schema is missing an `id` property");Y.$id=$.external.uri(K)}Object.assign(Y,q.def??q.schema);letJ=$.metadataRegistry.get(I)?.id;if(J!==void0&&Y.id===J)deleteY.id;letQ=$.external?.defs??{};for(letKof$.seen.entries()){letz=K[1];if(z.def&&z.defId){if(z.def.id===z.defId)deletez.def.id;Q[z.defId]=z.def}}if($.external);elseif(Object.keys(Q).length>0)if($.target==="draft-2020-12")Y.$defs=Q;elseY.definitions=Q;try{letK=JSON.parse(JSON.stringify(Y));returnObject.defineProperty(K,"~standard",{value:{...I["~standard"],jsonSchema:{input:EI(I,"input",$.processors),output:EI(I,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functiong6($,I){letq=I??{seen:newSet};if(q.seen.has($))return!1;q.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returng6(U.element,q);if(U.type==="set")returng6(U.valueType,q);if(U.type==="lazy")returng6(U.getter(),q);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returng6(U.innerType,q);if(U.type==="intersection")returng6(U.left,q)||g6(U.right,q);if(U.type==="record"||U.type==="map")returng6(U.keyType,q)||g6(U.valueType,q);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returng6(U.in,q)||g6(U.out,q)}if(U.type==="object"){for(letYinU.shape)if(g6(U.shape[Y],q))return!0;return!1}if(U.type==="union"){for(letYofU.options)if(g6(Y,q))return!0;return!1}if(U.type==="tuple"){for(letYofU.items)if(g6(Y,q))return!0;if(U.rest&&g6(U.rest,q))return!0;return!1}return!1}varjM=($,I={})=>(q)=>{letU=o5({...q,processors:I});returnE1($,U),r5(U,$),t5(U,$)},EI=($,I,q={})=>(U)=>{let{libraryOptions:Y,target:J}=U??{},Q=o5({...Y??{},target:J,io:I,processors:q});returnE1($,Q),r5(Q,$),t5(Q,$)};varML0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},EM=($,I,q,U)=>{letY=q;Y.type="string";let{minimum:J,maximum:Q,format:K,patterns:z,contentEncoding:w}=$._zod.bag;if(typeofJ==="number")Y.minLength=J;if(typeofQ==="number")Y.maxLength=Q;if(K){if(Y.format=ML0[K]??K,Y.format==="")deleteY.format;if(K==="time")deleteY.format}if(w)Y.contentEncoding=w;if(z&&z.size>0){letG=[...z];if(G.length===1)Y.pattern=G[0].source;elseif(G.length>1)Y.allOf=[...G.map((H)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},BM=($,I,q,U)=>{letY=q,{minimum:J,maximum:Q,format:K,multipleOf:z,exclusiveMaximum:w,exclusiveMinimum:G}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Y.type="integer";elseY.type="number";letH=typeofG==="number"&&G>=(J??Number.NEGATIVE_INFINITY),W=typeofw==="number"&&w<=(Q??Number.POSITIVE_INFINITY),V=I.target==="draft-04"||I.target==="openapi-3.0";if(H)if(V)Y.minimum=G,Y.exclusiveMinimum=!0;elseY.exclusiveMinimum=G;elseif(typeofJ==="number")Y.minimum=J;if(W)if(V)Y.maximum=w,Y.exclusiveMaximum=!0;elseY.exclusiveMaximum=w;elseif(typeofQ==="number")Y.maximum=Q;if(typeofz==="number")Y.multipleOf=z},vM=($,I,q,U)=>{q.type="boolean"},RM=($,I,q,U)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},CM=($,I,q,U)=>{if(I.unrepresentable==Line truncated
`}class cP{constructor($=Wc.stdin,I=Wc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new pP,this._started=!1,this._ondata=(q)=>{this._readBuffer.append(q),this.processReadBuffer()},this._onerror=(q)=>{this.onerror?.(q)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let $=this._readBuffer.readMessage();if($===null)break;this.onmessage?.($)}catch($){this.onerror?.($)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send($){return new Promise((I)=>{let q=Vc($);if(this._stdout.write(q))I();else this._stdout.once("drain",I)})}}import{dirname as Du,join as Nw1}from"node:path";import{fileURLToPath as Fw1}from"node:url";class s8 extends Error{name="KyError";get isKyError(){return!0}}class n6 extends s8{name="HTTPError";response;request;options;data;constructor($,I,q){let U=$.status||$.status===0?$.status:"",Y=$.statusText??"",J=`${U}${Y}`.trim(),Q=J?`statuscode${J}`:"an unknown error";super(`Requestfailedwith${Q}:${I.method}${I.url}`);this.response=$,this.request=I,this.options=q}}class rJ extends s8{name="NetworkError";request;constructor($,I){super(`Requestfailedduetoanetworkerror:${$.method}${$.url}`,I);this.request=$}}class tJ extends Error{name="NonError";value;constructor($){let I="Non-error value was thrown";try{if(typeof $==="string")I=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")I=$.message}catch{}super(I);this.value=$}}class $q extends s8{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new tJ($.cause):void 0;super($?.code?`Forcedretry:${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class dP extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class b$ extends s8{name="TimeoutError";request;constructor($){super(`Requesttimedout:${$.method}${$.url}`);this.request=$}}var lP=(()=>{let $=!1,I=!1,q=typeof globalThis.ReadableStream==="function",U=typeof globalThis.Request==="function";if(q&&U)try{I=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(Y){if(Y instanceof Error&&Y.message==="unsupported BodyInit type")return!1;throw Y}return $&&!I})(),Zc=typeof globalThis.AbortController==="function",HH=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Xc=typeof globalThis.ReadableStream==="function",Dc=typeof globalThis.FormData==="function",VH=["get","post","put","patch","head","delete"],cB0=()=>{return};cB0();var Oc={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Iq=2147483647,Lc=40,WH=Symbol("stop");class ZH{options;constructor($){this.options=$}}var Nc=($)=>new ZH($),Fc={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Mc={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var XH=new TextEncoder,dB0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[q,U]of $)I+=Lc,I+=XH.encode(`Content-Disposition:form-data;name="${q}"`).byteLength,I+=typeof U==="string"?XH.encode(U).byteLength:U.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return XH.encode($).byteLength;if($ instanceof URLSearchParams)return XH.encode($.toString()).byteLength;return 0},Ac=($,I,q)=>{let U,Y=0;return $.pipeThrough(new TransformStream({transform(J,Q){if(Q.enqueue(J),U){Y+=U.byteLength;let K=I===0?0:Y/I;if(K>=1)K=1-Number.EPSILON;q?.({percent:K,totalBytes:Math.max(I,Y),transferredBytes:Y},U)}U=J},flush(){if(U)Y+=U.byteLength,q?.({percent:1,totalBytes:Math.max(I,Y),transferredBytes:Y},U)}}))},gc=($,I)=>{if(!$.body)return $;let q={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,q);let U=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(Ac($.body,U,I),q)},Pc=($,I,q)=>{if(!$.body)return $;let U=dB0(q??$.body);return new Request($,{duplex:"half",body:Ac($.body,U,I)})};var G8=($)=>$!==null&&typeof $==="object";var lB0=Symbol("replaceOption"),mP=($)=>G8($)&&$[lB0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var sJ=(...$)=>{for(let I of $)if(
Line truncated
`,{mode:384}),I}function zq($,I,q=[]){let U=I.corpId?.trim()||void 0,Y=I.stateful?I.defaultCorpId?.trim()||void 0:void 0,J=U??Y;if(J){let K=$.find((z)=>z.id===J);if(K)return K;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!I.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let Q=$[0];if(Q)return Q;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(q.length?q.join(", "):"the configured enterprise directories"))}import{readFileSync as fK1}from"node:fs";import{randomBytes as nK1}from"node:crypto";import{randomBytes as xd}from"node:crypto";var bv0=Z.object({staffId:Z.string(),name:Z.string().optional(),code:Z.string().default(""),bindTime:Z.number().optional()}),iv0=Z.object({id:Z.string(),tenantId:Z.string(),name:Z.string(),isAdmin:Z.boolean().default(!1),permissions:Z.array(Z.string()).default([]),providerUserId:Z.string().optional(),hosecloudStaff:bv0.optional()}),pv0=Z.object({apiKey:Z.string().optional(),corporationId:Z.string().optional(),corporationName:Z.string().optional()}),cv0=Z.object({id:Z.string(),name:Z.string(),tenantSlug:Z.string().optional(),isDemo:Z.boolean().default(!1),logoUrl:Z.string().nullable().optional(),hoseCorpConfig:pv0.optional()}),Xd=Z.object({user:iv0,tenant:cv0}),dv0=Z.object({id:Z.string(),name:Z.string(),email:Z.string().nullable().optional(),emailVerified:Z.boolean().optional(),image:Z.string().nullable().optional(),tenantId:Z.string().optional(),provider:Z.string().optional(),providerUserId:Z.string().optional(),mobile:Z.string().nullable().optional(),status:Z.string().optional(),permissions:Z.array(Z.string()).default([]),isAdmin:Z.boolean().default(!1),hosecloudStaff:Z.unknown().optional()}).passthrough(),lv0=Z.object({id:Z.string(),token:Z.string().optional(),expiresAt:Z.string(),createdAt:Z.string().optional(),updatedAt:Z.string().optional(),ipAddress:Z.string().optional(),userAgent:Z.string().optional(),userId:Z.string(),delegationId:Z.string().nullable().optional()}).passthrough(),Dd=Z.object({user:dv0,session:lv0}),CH=Z.object({id:Z.string(),tenantId:Z.string().optional(),code:Z.number().optional(),description:Z.string(),scope:Z.string(),strictness:Z.string(),status:Z.string().optional(),createdAt:Z.number().optional(),updatedAt:Z.number().optional()}),Od=Z.object({rules:Z.array(CH),hasPendingDeletes:Z.boolean().default(!1)}),mv0=Z.object({code:Z.string().optional(),description:Z.string(),scope:Z.string(),strictness:Z.string()}),_H=Z.object({id:Z.string(),tenantId:Z.string().optional(),versionNumber:Z.number(),versionName:Z.string().nullable().optional(),publishedBy:Z.string().nullable().optional(),publishedByName:Z.string().nullable().optional(),rules:Z.array(mv0).default([]),publishedAt:Z.number().optional(),createdAt:Z.number().optional()}),Ld=Z.object({version:_H,rulesCount:Z.number()}),QQ=Z.object({id:Z.string(),tenantId:Z.string().optional(),title:Z.string(),purpose:Z.string().default(""),contentType:Z.string().default("policy"),content:Z.string(),status:Z.string().default("published"),enabled:Z.boolean().default(!0),scenarios:Z.array(Z.string()).default([]),tags:Z.array(Z.string()).default([]),category:Z.string().nullable().optional(),categoryTags:Z.array(Z.string()).default([]),createdBy:Z.string().nullable().optional(),createdByName:Z.string().nullable().optional(),createdAt:Z.number().optional(),updatedAt:Z.number().optional(),updatedBy:Z.string().nullable().optional(),updatedByName:Z.string().nullable().optional(),isDeleted:Z.boolean().default(!1)}),Nd=Z.object({articles:Z.array(QQ),total:Z.number().optional()}),ov0=Z.object({explicitApprove:Z.string().default(""),explicitReject:Z.string().default(""),exemptApprove:Z.string().default(""),review:Z.string().default("")}).passthrough(),rv0=Z.object({type:Z.string(),signKey:Z.string().optional(),outboundName:Z.string().optional(),mode:Z.string().optional(),autoApprovalRate:Z.number().optional(),apiKey:Z.string().optional(),apiSecret:Z.string().optional(),apiOrigin:Z.string().optional(),corporationId:Z.string().optional(),ebotSignKey:Z.string().optional(),completionSignKey:Z.string().optional(),outboundMessageId:Z.string().optional(),completionMessageId:Z.string().optional()}).passthrough(),tv0=Z.enum(["assisted","semi_automatic","fully_automatic"]),Zd=Z.object({id:Z.string(),url:Z.string().url()}).passthrough(),KQ=Z.object({type:Z.literal("webhook"),id:Z.string(),name:Z.string(),mode:tv0,incomingDocumentWebhook:Zd,outgoingResultWebhook:Z.string().url(),incomingManualResultWebhook:Zd,secret:Z.string().min(1),autoApprovalRate:Z.number().int().min(0).max(100).optional()}).passthrough(),HT=Z.object({id:Z.string().optional(),tenantId:Z.string().optional(),tone:Z.string().optional(),language:Z.string().optional(),detailLevel:Z.string().optional(),outputFormat:Z.string().optional(),examples:Z.array(Z.string()).default([]),prohibitedPhrases:Z.array(Z.strin
Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let W of H){let V=W.outboundName??"SealAI 审批",X=W.signKey,D=W.apiOrigin??"production";console.error(`•"${V}"(signKey:${X},环境:${D})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${Y.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of W){let D=X.outboundName??"SealAI 审批",O=X.signKey,N=X.apiOrigin??"production";console.error(`•"${D}"(signKey:${O},环境:${N})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${O}--corp${Y.id}
`},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
`,{flag:"a",mode:384})}var zu=dz1(cz1(),".config","seal-use");async function EZ0($,I){let q=await $I($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:zu,version:a0,launcher:I.launcher});if(q!==void 0)R0(q)}import{existsSync as lz1,readFileSync as BZ0}from"node:fs";async function vZ0($,I,q,U,Y){if($==="batch-records"||$==="records"){let J=I??b(Y.options.batchId)??b(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await L0("seal_simulation_batch_records_get",q,U,{batchId:J,query:b(Y.options.query)},O0(Y.options));return}if($==="create"||$==="run"){let J=b(Y.options.mode)??b(Y.options.sourceSystem)??b(Y.options["source-system"])??"hosecloud",Q=J==="material-pack"?"material_pack":J,K=b(Y.options.schemaConfig)??b(Y.options["schema-config"]),z=K?JSON.parse(BZ0(K,"utf8")):void 0,w=b(Y.options.input),G=w?JSON.parse(BZ0(w,"utf8")):r6(Y.json),H=b(Y.options.packageId)??b(Y.options["package-id"]),W=N6(Y.options.packageIds)??N6(Y.options["package-ids"])??(H?[H]:void 0),V=N6(Y.options.flowIds)??N6(Y.options["flow-ids"])??N6(Y.options.documentSn)??N6(Y.options["document-sn"]),X=b(Y.options.signKey)??b(Y.options["sign-key"])??b(Y.options.integration);await L0("seal_simulation_batch_create",q,U,{mode:Q,sourceSystem:Q,flowIds:V,documentSn:V,rejectNodeName:b(Y.options.rejectNode)??b(Y.options["reject-node"])??null,thinkingDepthOverride:b(Y.options.thinkingDepth)??b(Y.options["thinking-depth"]),skipInvoiceGeneration:x0(Y.options.skipInvoiceGeneration)??x0(Y.options["skip-invoice-generation"]),skipExpenseExtraction:x0(Y.options.skipExpenseExtraction)??x0(Y.options["skip-expense-extraction"]),disableAttachmentCache:x0(Y.options.disableAttachmentCache)??x0(Y.options["disable-attachment-cache"]),signKey:X,packageIds:W,packageId:H,templateId:b(Y.options.templateId)??b(Y.options["template-id"]),schemaConfig:z,requestIds:N6(Y.options.requestIds)??N6(Y.options["request-ids"]),workflowTypeId:b(Y.options.workflowTypeId)??b(Y.options["workflow-type-id"]),flowStatusList:N6(Y.options.flowStatusList)?.map(Number)??N6(Y.options["flow-status-list"])?.map(Number),businessCodes:N6(Y.options.businessCodes)??N6(Y.options["business-codes"]),documentType:b(Y.options.documentType)??b(Y.options["document-type"]),startTime:L1(Y.options.startTime)??L1(Y.options["start-time"]),endTime:L1(Y.options.endTime)??L1(Y.options["end-time"]),status:N6(Y.options.status),limit:L1(Y.options.limit),rawParams:G},O0(Y.options));return}if($==="wait"){let J=I??b(Y.options.batchId)??b(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await L0("seal_simulation_batch_wait",q,U,{batchId:J,timeout:b(Y.options.timeout),pollInterval:b(Y.options.pollInterval)??b(Y.options["poll-interval"])},O0(Y.options));return}if($==="clean"||$==="delete"){let J=I??b(Y.options.batchId)??b(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await L0("seal_simulation_batch_clean",q,U,{batchId:J},O0(Y.options));return}if($==="specifications"){let J=I??b(Y.options.integration)??b(Y.options.signKey)??b(Y.options["sign-key"]);await L0("seal_simulation_specifications_list",q,U,{signKey:J},O0(Y.options));return}if($==="list"){await L0("seal_simulation_batches_list",q,U,{limit:L1(Y.options.limit)},O0(Y.options));return}if($==="get"){let J=I??b(Y.options.batchId)??b(Y.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await L0("seal_simulation_batch_get",q,U,{batchId:J},O0(Y.options));return}if($==="templates"){await L0("seal_simulation_templates_get",q,U,{},O0(Y.options));return}if($==="integrations"){await L0("seal_simulation_integrations_get",q,U,{},O0(Y.options));return}if($==="package-upload"){let J=I??b(Y.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!lz1(J))throw Error(`Filenotfound:${J}`);await L0("seal_simulation_material_package_upload",q,U,{filePath:J},O0(Y.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as mZ0}from"node:fs";import{join as XO}from"node:path";import{existsSync as wu,mkdirSync as bZ0,rmSync as Yw1,writeFileSync as Jw1}from"node:fs";import{homedir as iZ0}from"node:os";import{dirname as Qw1,join as Gu}from"node:path";var RZ0=`---
name:seal-use
description:"v0.10.2: 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.6: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
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.
@@ -274,7 +527,7 @@ seal-use corps list
-User-facingSealtenantassistancelink(Seal协助/Seal授权/委托):resolvethenamedenterprisefirst,thenrun\`seal-use delegation create --corp <corpId> --note '<enterprise>'\`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (\`\`\`\`text ... \`\`\`\`) AND a hyperlink.
-Packagedcustomerfeedback→approval-ruleremediation:read\`references/customer-feedback-rule-remediation.md\`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
-User-facing合思authorizationlink(合思/易快报授权):\`seal-use auth hose-link --corp <corpId> --expire 7200\`; read \`references/hose-enterprise-auth.md\`. Never use this route when the user says Seal 协助. Always provide BOTH a code block (\`\`\`\`text ... \`\`\`\`) AND a hyperlink.
@@ -284,7 +537,9 @@ seal-use corps list
-SystemPermissionsConfig:\`seal-use permissions available --corp <corpId>\`, \`seal-use permissions configs --corp <corpId>\`.
-Billing&FeatureQuotas:\`seal-use billing status --corp <corpId>\`, \`seal-use billing plans --corp <corpId>\`, \`seal-use billing features --corp <corpId>\`.
Rule,document,stylepreference,andpublishactionsmutateSealconfiguration.Makethetargetenterpriseexplicit,showtheintendedpayload,andverifyafterthewrite.Neversendreal\`enterprises/*.json\` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
`;var hL=`interface:
`;var CZ0=`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."
@@ -448,7 +706,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.
-CLIcommandsareshort-livedprocesses.In-memoryauth/searchcachesonlyliveforthatsingleprocess.Use\`seal-use service restart\` after updates so the optional local service picks up new code.
-Ifnorunisfoundby\`sourceDocumentSN\`, retry with \`sourceDocumentId\` or a broader \`query\`.
-Ifdate-basedsummarieslookwrong,pass\`--timezone Asia/Shanghai\` and an explicit \`--date\`.
-If\`langfuseTraceId\` is missing, use \`langfuseSessionFallback\`.
`;var sL="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--batch<batchId>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest--fieldsrecordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsmetadata\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.fields,result.summary\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsresult.summary,result.decision,result.riskPoints\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runsget<recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-useapproval-runsdocument-summary<recordId>--corp<corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-useapproval-runscited-rules<recordId>--corp<corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rulesget--record-id<recordId>--runtime-idrule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\nseal-useapproval-runsattachments<recordId>--corp<corpId>--summary\n```\n\nThis 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`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-useapproval-runsresult<recordId>--corp<corpId>--summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Output Discipline\n\nIf a command warns that output is large, do not retry with `--full` reflexively. Narrow with `--summary`, `--fields`, or `--output-file` first.\n";var ny=`#ApprovalAttachmentTraceInvestigation
`;var SZ0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises`aremerged.\n-User-levelconfigsoverridesame-IDlocalconfigs.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**(e.g.`👉Nextaction:...`).\n-**`ExitCode`**:`0`onsuccess,non-zero(e.g.`1`)onfailuretotriggerAgenterrorself-remediation.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-useruleslint[--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-useservice<start|stop|restart|status>\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate\nseal-usetoolslist\nseal-usecorpslist[--corp<corpId>]\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useusersreset-password<userId>[--corp<corpId>]\nseal-useusersget<userId>[--corp<corpId>]\nseal-useusersdelete<userId>[--corp<corpId>]\nseal-usellmconfig[--corp<corpId>]\nseal-usellmproviders[--corp<corpId>]\nseal-usepermissionsavailable[--corp<corpId>]\nseal-usepermissionsconfigs[--corp<corpId>]\nseal-usebillingstatus[--corp<corpId>]\nseal-usebillingplans[--corp<corpId>]\nseal-usebillingfeatures[--corp<corpId>]\nseal-usewebhooklist[--query<text>][--show-secret][--corp<corpId>]\nseal-usewebhookget|find<idOrName>[--show-secret][--corp<corpId>]\nseal-usewebhookadd--name<name>--result-url<url>[--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>][--corp<corpId>]\nseal-usewebhookupdate<idOrName>[--name<name>][--result-url<url>][--modeassisted|semi_automatic|fully_automatic][--auto-approval-rate60][--secret<secret>|--rotate-secret][--corp<corpId>]\nseal-usewebhookdelete<idOrName>--yes[--corp<corpId>]\nseal-usedeployhosecloudrequirements[--corp<corpId>]\nseal-usedeployhosecloudlist[--corp<corpId>]\nseal-usedeployhosecloudget[<sign-key>][--corp<corpId>]\nseal-usedeployhosecloudstatus[--corp<corpId>]\nseal-usedeployhosecloudconfigure--json'{...}'[--corp<corpId>]\nseal-usedeployhosecloudsync[<sign-key>][--auto][--corp<corpId>]\nseal-usepreferenceget[--corp<corpId>]\nseal-usepreferencedecisionupdate--json'{\"explicitApprove\":\"...\"}'[--corp<corpId>]\nseal-usepreferencethinking-depthset--default<medium|high>[--corp<corpId>]\nseal-usepreferencethinking-depthpolicieslist[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesupsert--json'{...}'[--corp<corpId>]\nseal-usepreferencethinking-depthpoliciesremove<policyId>[--corp<corpId>]\nseal-usesourceconfig[--corp<corpId>]\nseal-usetool<toolName>[--corp<corpId>][--json'{\"key\":\"value\"}']\nseal-useapproval-runssummary--corp<corpId>[--dateYYYY-MM-DD][--timezoneAsia/Shanghai]\nseal-useapproval-runsstats--corp<corpId>[--since3months][--dedupe-bysourceDocumentSN|sourceDocumentId|id]\nseal-useapproval-runscount--corp<corpId>[--statusAPPROVED]\nseal-useapproval-runssearch--corp<corpId>[--querytext][--limit20][--includeBridgetrue]\nseal-useapproval-runsget<recordId>--corp<corpId>[--fieldsmetadata|document.fields,result.summLine truncated
@@ -1247,7 +1141,7 @@ Return a compact report containing:
-Newversionnumberandversionname,ifpublished
-Verificationresult
-Whetheraregressionrerunwasperformed
`;var ty="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl-fsSLhttps://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generate
Line truncated
`;var kZ0="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl-fsSLhttps://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat
Line truncated
-\`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
`);return}if(n==="install"||n==="init"||n==="sync"){let o=_(r.options.local)||_(r.options.workspace),t=D(r.options.dir)??D(r.options.target)??i,u=t?t:o?w$(process.cwd(),".agents","skills","seal-use"):Mu(),e=R4(u);B({installed:!0,targetDir:e.targetDir,fileCount:e.files.length,files:e.files});return}if(n==="status"||n==="get"||!n){let o=Mu(),t=w$(process.cwd(),".agents","skills","seal-use");B({global:{dir:o,installed:gy(w$(o,"SKILL.md"))},local:{dir:t,installed:gy(w$(t,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${n}.Run'seal-use help'foravailablecommands.`)}async function wy(n,i){if(n==="config"){B(await xr(i));return}throw Error(`Unknownsourcecommand:${n??""}.Run'seal-use help'foravailablecommands.`)}async function fy(n,i,r,o){if(!n)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await X(n,i,r,ri(o.json),J(o.options))}function cy(){B(Tu.map((n)=>({name:n.name,description:n.description})))}import{chmodSync as pK,mkdirSync as PK,renameSync as m4,rmSync as QK,unlinkSync as Oy,writeFileSync as Uy}from"node:fs";import{dirname as FK,join as Dy}from"node:path";import{spawnSync as Zt}from"node:child_process";function f$(n=process.execPath,i=import.meta.url){if(i.includes("/$bunfs/")||i.includes("\\$bunfs\\"))return!0;let r=n.toLowerCase().replace(/\\/g,"/");return!r.endsWith("/bun")&&!r.endsWith("/bun.exe")&&!r.endsWith("/node")&&!r.endsWith("/node.exe")}var ky="yunyingk/seal-use",Cu="yunyingk/seal-home";var KK="SEAL_USE_GITHUB_REPO",BK="SEAL_HOME_GITHUB_REPO";async function dy(n,i={}){let r={appRoot:n.appRoot,entryFile:n.entryFile,stateDir:M4,version:x,launcher:n.launcher},o=i.repo||process.env[KK]?.trim()||process.env[BK]?.trim()||ky,t=i.targetVersion?.trim(),u=t&&t.toLowerCase()!=="latest"?t:void 0;if(u){let j=u.replace(/^v/,""),N=Ny(j,x);if(N<0){B({updated:!1,currentVersion:x,targetVersion:j,mode:f$()?"binary":"source",message:`Cannotdowngradeseal-usefromv${x}toolderversionv${j}.Updatesmustbeforward-only.`});return}if(N===0&&!i.force){B({updated:!1,currentVersion:x,targetVersion:j,mode:f$()?"binary":"source",message:`seal-useisalreadyatversionv${x}.Use--forcetoreinstall.`});return}}if(i.changelogOnly){let j=await x4(o,i.limit??10);B({currentVersion:x,totalQueried:j.length,releases:j.map((N)=>({version:N.version,tagName:N.tagName,publishedAt:N.publishedAt,author:N.author,releaseNotes:N.notes,releaseUrl:N.htmlUrl,isCurrent:N.version===x,isNewer:zu(N.version,x)}))});return}if(!f$()){if(i.checkOnly){let N=await x4(o,30),M=N[0],E=M?.version??x,An=N.find((nn)=>nn.version===x),jn=zu(E,x),Wn=N.filter((nn)=>zu(nn.version,x));B({updated:!1,updateAvailable:jn,currentVersion:x,currentVersionPublishedAt:An?.publishedAt,latestVersion:E,latestVersionPublishedAt:M?.publishedAt,behindCount:Wn.length,pendingReleases:Wn.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 j=ar(r).running;if(j)await _t("stop",r);try{Ay("git",["-C",n.appRoot,"pull","--ff-only"])}catch(N){console.error(`gitpullskipped:${NinstanceofError?N.message:String(N)}`)}if(Ay("bun",["install"],{cwd:n.appRoot}),j)await _t("start",r);B({updated:!0,serviceRestarted:j,version:x,mode:"source"});return}let e=TK(),l=VK(),$=await x4(o,30),I=u?$.find((j)=>j.version===u||j.tagName===u||j.tagName===`v${u}`)??await Sy(o,u):$[0]??await Sy(o);if(!I){B({updated:!1,currentVersion:x,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${o}'`});return}let g=I.version,b=$.find((j)=>j.version===x),w=zu(g,x),f=w||Boolean(i.force),c=$.filter((j)=>zu(j.version,x));if(i.checkOnly){B({updated:!1,updateAvailable:w,currentVersion:x,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,behindCount:c.length,pendingReleases:c.map((j)=>({version:j.version,tagName:j.tagName,publishedAt:j.publishedAt,author:j.author,releaseNotes:j.notes,releaseUrl:j.htmlUrl})),releaseNotes:I.notes,releaseUrl:I.htmlUrl,mode:"binary"});return}if(!f){B({updated:!1,currentVersion:x,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:I.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${x})`});return}let S=qK(I.assets,e,l);if(!S)throw Error(`Nocompatiblebinaryfoundfor${e}-${l}inreleasev${g}.Availableassets:${I.assets.map((j)=>j.name).join(", ")}`);let k=ar(r).running;if(k)await _t("stop",r);let d=process.execPath,Q=FK(d),P=Dy(Q,`.tmp-update-${Date.now()}`);PK(P,{recursive:!0});try{let j=Dy(P,S.name);await EK(S.downloadUrl,j,I.tagName,S.name);let N=j;if(S.name.endsWith(".tar.gz")||S.name.endsWith(".tgz"))N=_K(j,P,e);else if(S.name.endsWith(".zip"))N=ZK(j,P,e);if(pK(N,493),process.platform==="darwin")try{Zt("/usr/bin/codesign",["--remove-signature",N],{stdio:"ignore"}),Zt("/usr/
Line truncated
`)}catch{}}async function EK(n,i,r,o){let t=a4(),u=[],e=r?r.startsWith("v")?r:`v${r}`:void 0,l=o||n.split("/").pop()||"";if(t!=="github"){if(e&&l)u.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${e}/${l}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${e}/${l}`);if(n.startsWith("https://git.ying-qing.cn"))u.push(n)}if(t!=="gitea")if(e&&l){let S=`https://github.com/${ky}/releases/download/${e}/${l}`;if(!process.env.CI)u.push(`https://ghfast.top/${S}`,`https://gh.ddlc.top/${S}`);u.push(S)}else if(n.includes("github.com")){if(!process.env.CI)u.push(`https://ghfast.top/${n}`,`https://gh.ddlc.top/${n}`);u.push(n)}else u.push(n);let $=Array.from(new Set(u)),I,g=6000,b=6000,w=307200,f=1e4,c=180000;for(let S=0;S<$.length;S++){let k=$[S],d=new AbortController,Q="",P=(E)=>{Q=E;try{d.abort()}catch{}},j=setTimeout(()=>{P("Connection timed out (no response headers within 6s)")},g),N,M;try{c$(`==> [${S+1}/${$.length}] Downloading via: ${k}`);let E=await fetch(k,{signal:d.signal});if(j)clearTimeout(j),j=void 0;if(!E.ok)throw Error(`HTTP ${E.status} ${E.statusText}`);N=setTimeout(()=>{P("Overall download time exceeded 3 minutes")},c);let An=Number(E.headers.get("content-length"))||0,jn=E.body?.getReader();if(!jn){let Ni=Buffer.from(await E.arrayBuffer());if(Ni.length<1000)throw Error(`Downloaded content is suspiciously small (${Ni.length} bytes)`);Uy(i,Ni),c$(`✓ Download succeeded (${(Ni.length/1024/1024).toFixed(1)} MB)`);return}let Wn=[],nn=0,sr=0;M=setTimeout(()=>{if(nn<w){let Ni=(nn/1024).toFixed(1);P(`Initial transfer too slow (${Ni} KB < 300 KB in 6s), switching mirror...`)}},b);while(!0){let Ni=jn.read(),U$,Xy=new Promise((S$,A$)=>{U$=setTimeout(()=>{A$(Error("Data transfer stalled (no chunk received for 10s)"))},f)}),i0;try{i0=await Promise.race([Ni,Xy])}finally{if(U$)clearTimeout(U$)}let{done:Hy,value:D$}=i0;if(Hy)break;if(D$){if(Wn.push(D$),nn+=D$.length,M&&nn>=w)clearTimeout(M),M=void 0;let S$=Date.now();if(S$-sr>200){sr=S$;let A$=An?Math.round(nn/An*100):0,Yy=(nn/1048576).toFixed(1),py=An?(An/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${A$}% (${Yy} / ${py} MB)...`)}catch{}}}}try{process.stderr.write(`
`);return}if($==="install"||$==="init"||$==="sync"){let U=x0(q.options.local)||x0(q.options.workspace),Y=b(q.options.dir)??b(q.options.target)??I,J=Y?Y:U?XO(process.cwd(),".agents","skills","seal-use"):Xz(),Q=Hu(J);R0({installed:!0,targetDir:Q.targetDir,fileCount:Q.files.length,files:Q.files});return}if($==="status"||$==="get"||!$){let U=Xz(),Y=XO(process.cwd(),".agents","skills","seal-use");R0({global:{dir:U,installed:mZ0(XO(U,"SKILL.md"))},local:{dir:Y,installed:mZ0(XO(Y,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function rZ0($,I){if($==="config"){R0(await NY(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function tZ0($,I,q,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await L0($,I,q,r6(U.json),O0(U.options))}function aZ0(){R0(zz.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as Kw1,mkdirSync as zw1,renameSync as Wu,rmSync as ww1,unlinkSync as qX0,writeFileSync as sZ0}from"node:fs";import{dirname as Gw1,join as eZ0}from"node:path";import{spawnSync as II}from"node:child_process";function DO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let q=$.toLowerCase().replace(/\\/g,"/");return!q.endsWith("/bun")&&!q.endsWith("/bun.exe")&&!q.endsWith("/node")&&!q.endsWith("/node.exe")}var UX0="yunyingk/seal-use",Oz="yunyingk/seal-home";var Hw1="SEAL_USE_GITHUB_REPO",Vw1="SEAL_HOME_GITHUB_REPO";async function YX0($,I={}){let q={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:zu,version:a0,launcher:$.launcher},U=I.repo||process.env[Hw1]?.trim()||process.env[Vw1]?.trim()||UX0,Y=I.targetVersion?.trim(),J=Y&&Y.toLowerCase()!=="latest"?Y:void 0;if(J){let g=J.replace(/^v/,""),B=JX0(g,a0);if(B<0){R0({updated:!1,currentVersion:a0,targetVersion:g,mode:DO()?"binary":"source",message:`Cannotdowngradeseal-usefromv${a0}toolderversionv${g}.Updatesmustbeforward-only.`});return}if(B===0&&!I.force){R0({updated:!1,currentVersion:a0,targetVersion:g,mode:DO()?"binary":"source",message:`seal-useisalreadyatversionv${a0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let g=await Zu(U,I.limit??10);R0({currentVersion:a0,totalQueried:g.length,releases:g.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===a0,isNewer:Dz(B.version,a0)}))});return}if(!DO()){if(I.checkOnly){let B=await Zu(U,30),x=B[0],h=x?.version??a0,f=B.find((p)=>p.version===a0),S=Dz(h,a0),t=B.filter((p)=>Dz(p.version,a0));R0({updated:!1,updateAvailable:S,currentVersion:a0,currentVersionPublishedAt:f?.publishedAt,latestVersion:h,latestVersionPublishedAt:x?.publishedAt,behindCount:t.length,pendingReleases:t.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:x?.notes??"",releaseUrl:x?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let g=FY(q).running;if(g)await $I("stop",q);try{IX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(IX0("bun",["install"],{cwd:$.appRoot}),g)await $I("start",q);R0({updated:!0,serviceRestarted:g,version:a0,mode:"source"});return}let Q=Ww1(),K=Zw1(),z=await Zu(U,30),w=J?z.find((g)=>g.version===J||g.tagName===J||g.tagName===`v${J}`)??await $X0(U,J):z[0]??await $X0(U);if(!w){R0({updated:!1,currentVersion:a0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${U}'`});return}let G=w.version,H=z.find((g)=>g.version===a0),W=Dz(G,a0),V=W||Boolean(I.force),X=z.filter((g)=>Dz(g.version,a0));if(I.checkOnly){R0({updated:!1,updateAvailable:W,currentVersion:a0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,behindCount:X.length,pendingReleases:X.map((g)=>({version:g.version,tagName:g.tagName,publishedAt:g.publishedAt,author:g.author,releaseNotes:g.notes,releaseUrl:g.htmlUrl})),releaseNotes:w.notes,releaseUrl:w.htmlUrl,mode:"binary"});return}if(!V){R0({updated:!1,currentVersion:a0,currentVersionPublishedAt:H?.publishedAt,latestVersion:G,latestVersionPublishedAt:w.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${a0})`});return}let D=Xw1(w.assets,Q,K);if(!D)throw Error(`Nocompatiblebinaryfoundfor${Q}-${K}inreleasev${G}.Availableassets:${w.assets.map((g)=>g.name).join(", ")}`);let O=FY(q).running;if(O)await $I("stop",q);let N=process.execPath,T=Gw1(N),P=eZ0(T,`.tmp-update-${Date.now()}`);zw1(P,{recursive:!0});try{let g=eZ0(P,D.name);await Dw1(D.downloadUrl,g,w.tagName,D.name);let B=g;if(D.name.endsWith(".tar.gz")||D.name.endsWith(".tgz"))B=Ow1(g,P,Q);else if(D.name.endsWith(".zip"))B=Lw1(g,P,Q);if(Kw1(B,493),process.platform==="darwin")try{II("/usr/bin/codesig
Line truncated
`)}catch{}}async function Dw1($,I,q,U){let Y=Xu(),J=[],Q=q?q.startsWith("v")?q:`v${q}`:void 0,K=U||$.split("/").pop()||"";if(Y!=="github"){if(Q&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${Q}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${Q}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Y!=="gitea")if(Q&&K){let D=`https://github.com/${UX0}/releases/download/${Q}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${D}`,`https://gh.ddlc.top/${D}`);J.push(D)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let z=Array.from(new Set(J)),w,G=6000,H=6000,W=307200,V=1e4,X=180000;for(let D=0;D<z.length;D++){let O=z[D],N=new AbortController,T="",P=(h)=>{T=h;try{N.abort()}catch{}},g=setTimeout(()=>{P("Connection timed out (no response headers within 6s)")},G),B,x;try{OO(`==> [${D+1}/${z.length}] Downloading via: ${O}`);let h=await fetch(O,{signal:N.signal});if(g)clearTimeout(g),g=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);B=setTimeout(()=>{P("Overall download time exceeded 3 minutes")},X);let f=Number(h.headers.get("content-length"))||0,S=h.body?.getReader();if(!S){let n=Buffer.from(await h.arrayBuffer());if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);sZ0(I,n),OO(`✓ Download succeeded (${(n.length/1024/1024).toFixed(1)} MB)`);return}let t=[],p=0,C=0;x=setTimeout(()=>{if(p<W){let n=(p/1024).toFixed(1);P(`Initial transfer too slow (${n} KB < 300 KB in 6s), switching mirror...`)}},H);while(!0){let n=S.read(),J0,j=new Promise((K0,G0)=>{J0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},V)}),u;try{u=await Promise.race([n,j])}finally{if(J0)clearTimeout(J0)}let{done:d,value:a}=u;if(d)break;if(a){if(t.push(a),p+=a.length,x&&p>=W)clearTimeout(x),x=void 0;let K0=Date.now();if(K0-C>200){C=K0;let G0=f?Math.round(p/f*100):0,M0=(p/1048576).toFixed(1),v0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${M0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
"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.2: 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.6: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version:0.10.2
short-description:Seal tenant and Hose approval automation (v0.10.2)
version:0.10.6
short-description:Seal tenant and Hose approval automation (v0.10.6)
---
# Seal Use (v0.10.2)
# Seal Use (v0.10.6)
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.
@@ -56,7 +56,7 @@ seal-use corps list
- User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run `seal-use delegation create --corp <corpId> --note '<enterprise>'`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
- Packaged customer feedback → approval-rule remediation: read `references/customer-feedback-rule-remediation.md`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
- User-facing 合思 authorization link (合思/易快报授权): `seal-use auth hose-link --corp <corpId> --expire 7200`; read `references/hose-enterprise-auth.md`. Never use this route when the user says Seal 协助. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
@@ -66,7 +66,9 @@ seal-use corps list
- System Permissions Config: `seal-use permissions available --corp <corpId>`, `seal-use permissions configs --corp <corpId>`.
- Billing & Feature Quotas: `seal-use billing status --corp <corpId>`, `seal-use billing plans --corp <corpId>`, `seal-use billing features --corp <corpId>`.
Use this reference when configuring, deploying, or troubleshooting Seal AI smart approval integrations with Hose/合思费控 (界面路径:【智能审核】 $\to$ 【发布】 $\to$ 【合思费控】).
Use this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.
## Key Principles
- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled: false`) to avoid unsolicited noise during standard operations.
- **Explicit Triggering**: `seal-use rules lint` always runs regardless of global configuration.
- **Draft Hook**: When `seal-use config lint enable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.
- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.
## CLI Commands
### 1. Lint Current Draft Rules (Whole-RuleSet Scan)
```bash
seal-use rules lint --corp <corpId>
```
### 2. Lint Specific Historical Version or Single Rule
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.