@@ -86,7 +86,7 @@ Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`,
git worktree remove /tmp/seal-use-release
```
- Do not tag or push `main` directly. Create a release branch, commit the version bump, push it, open a PR to `main`, wait for the required CI check, and merge the PR first.
- After the PR is merged, fast-forward the local `main`, then synchronize `home/main` before creating the tag:
- After the PR is merged, fast-forward the local `main`, then create and push the annotated tag to `origin`:
```bash
git switch -c codex/release-vX.Y.Z
git add <release-files>
@@ -97,16 +97,12 @@ Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`,
gh pr merge <pr-number> --merge
git switch main
git pull --ff-only origin main
git push home main
```
- Only after both `origin/main` and `home/main` contain the merged release should you create the annotated tag. Push the tag to `home` first, then to `origin`; pushing the GitHub tag last triggers the Release workflow after the Gitea tag and branch are ready:
```bash
git tag -a vX.Y.Z -m "🚀 Release summary text describing key changes"
git push home refs/tags/vX.Y.Z
git push origin refs/tags/vX.Y.Z
```
- GitHub Actions will automatically extract the tag message, append commit notes via `--generate-notes`, cross-compile all 5 target binaries, and publish GitHub and Gitea releases. Wait for the workflow, then verify that both releases point to the intended tag commit and contain every expected asset exactly once.
- The workflow enforces the merge-before-tag rule rather than trusting the operator: `release.yml` refuses to publish unless the tagged commit is an ancestor of `origin/main`, and the Gitea mirror job runs only after a successful publish. Actions in both workflows are pinned to commit SHAs rather than moving tags for supply-chain integrity.
- GitHub Actions (`release.yml`) is responsible only for cross-compiling all 5 target binaries and publishing the GitHub Release.
- **Gitea & Homebrew Pull-Based Promotion**: Do not manually push branches or tags to `home` (Gitea). On WSL (`wsl-dev`), `seal-use-release-sync.timer` polls the latest GitHub Release every 15 minutes (or can be triggered immediately via `systemctl start seal-use-release-sync.service`), pulls the release and assets from GitHub into Gitea, and updates the Homebrew tap (`ops/README.md`).
- The workflow enforces the merge-before-tag rule rather than trusting the operator: `release.yml` refuses to publish unless the tagged commit is an ancestor of `origin/main`. Actions in both workflows are pinned to commit SHAs rather than moving tags for supply-chain integrity.
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.10.40] - 2026-09-28
### Changed
- Standardize all CLI, MCP, and persisted timestamps (`expiresAt`, `lastCheckedAt`, `publishedAt`, `syncedAt`, `capturedAt`, `exportedAt`, `startedAt`, `timestamp`, `createdAtFormatted`, and local date-time formatters) to Beijing ISO 8601 second precision (`YYYY-MM-DDTHH:mm:ss+08:00`).
- Auto-normalize incoming ISO 8601 timestamps (`Z` or `[+-]HH:mm`, with or without milliseconds) in enterprise configuration validation (`IsoSecondTimestampSchema`) to `YYYY-MM-DDTHH:mm:ss+08:00`.
- Support flexible date/timestamp inputs (`YYYY-MM-DD`, `YYYY-MM-DD HH:mm:ss`, `YYYY-MM-DDTHH:mm:ss+08:00`, `Z`, and 13-digit millisecond timestamps) in `seal_approval_runs_search` and `seal_approval_runs_summary`.
5. Rebuilds OpenAPI spec (`dist/openapi.json`) and MCP plugin bundle (`dist/mcp/server.js`);
6. Prints the exact `git commit` and `git tag` commands ready to execute.
### 2. Tag & Dual-Publish Workflow
### 2. Tag & Publish Workflow
1.Update `CHANGELOG.md` with the new version notes;
2. Run test suite:
1.Run the automated protected-branch release wizard:
```bash
bun test && bun run check
bun run release patch
```
3. Commit and push the annotated tag:
Or manually merge the release PR to `main`, fast-forward local `main`, and push the annotated tag to `origin`:
```bash
git commit -am "Release vX.Y.Z: ..."
git tag -a vX.Y.Z -m "🚀 版本更新文案与主要特性说明"
git push origin main --tags && git push home main --tags
git push origin refs/tags/vX.Y.Z
```
**CI Automation Pipeline:**
- GitHub Actions triggers automatically upon pushing a `v*` tag;
- Cross-compiles standalone binaries for 5 target platforms (macOS Apple Silicon/Intel, Linux x86_64/ARM64, Windows x64) in under 60 seconds;
- Automatically extracts your Git tag annotation message and appends commit changelogs (`--generate-notes`);
- Simultaneously publishes release packages to **[GitHub Releases](https://github.com/yunyingk/seal-use/releases)** and **[Gitea Releases](https://git.ying-qing.cn/gitea/seal-use/releases)** for global and mainland China high-speed downloads.
**CI & Promotion Pipeline:**
- GitHub Actions triggers automatically upon pushing a `v*` tag to `origin`;
- Cross-compiles standalone binaries for 5 target platforms (macOS Apple Silicon/Intel, Linux x86_64/ARM64, Windows x64) and publishes them to **[GitHub Releases](https://github.com/yunyingk/seal-use/releases)**;
- WSL `seal-use-release-sync.timer` polls the latest GitHub Release and promotes all assets to **[Gitea Releases](https://git.ying-qing.cn/gitea/seal-use/releases)** and the Homebrew tap (`ops/README.md`).
import{createRequireasMx0}from"node:module";varHx0=Object.create;var{getPrototypeOf:Wx0,defineProperty:_E,getOwnPropertyNames:Xx0}=Object;varZx0=Object.prototype.hasOwnProperty;functionqx0($){returnthis[$]}varVx0,Lx0,G6=($,Y,U)=>{varI=$!=null&&typeof$==="object";if(I){varQ=Y?Vx0??=newWeakMap:Lx0??=newWeakMap,J=Q.get($);if(J)returnJ}U=$!=null?Hx0(Wx0($)):{};letK=Y||!$||!$.__esModule?_E(U,"default",{value:$,enumerable:!0}):U;for(letzofXx0($))if(!Zx0.call(K,z))_E(K,z,{get:qx0.bind($,z),enumerable:!0});if(I)Q.set($,K);returnK};varj=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varFx0=($)=>$;functionwx0($,Y){this[$]=Fx0.bind(null,Y)}varV8=($,Y)=>{for(varUinY)_E($,U,{get:Y[U],enumerable:!0,configurable:!0,set:wx0.bind(Y,U)})};varm=($,Y)=>()=>($&&(Y=$($=0)),Y);varK0=Mx0(import.meta.url);varOx0,WV,Nx0,Dx0,Bx0,Ax0,C0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),ir=($,Y)=>{letU={};for(varIin$)WV(U,I,{get:$[I],enumerable:!0});if(Y)WV(U,Symbol.toStringTag,{value:"Module"});returnU},Px0=($,Y,U,I)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varQ=Dx0(Y),J=0,K=Q.length,z;J<K;J++)if(z=Q[J],!Ax0.call($,z)&&z!==U)WV($,z,{get:((G)=>Y[G]).bind(null,z),enumerable:!(I=Nx0(Y,z))||I.enumerable})}return$},XV=($,Y,U)=>(U=$!=null?Ox0(Bx0($)):{},Px0(Y||!$||!$.__esModule?WV(U,"default",{value:$,enumerable:!0}):U,$));varvE=m(()=>{Ox0=Object.create,WV=Object.defineProperty,Nx0=Object.getOwnPropertyDescriptor,Dx0=Object.getOwnPropertyNames,Bx0=Object.getPrototypeOf,Ax0=Object.prototype.hasOwnProperty});functionnr($){returntypeof$==="string"&&cr.has($.replace(/#$/,""))}functiondr($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letU=$.$schema.replace(/#$/,"");if(Tx0.has(U))return"2020-12";if(cr.has(U))return"2019-09";if(Ex0.has(U)||jx0.has(U))return"draft-7";throwError(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}varTx0,cr,Ex0,jx0;varSE=m(()=>{Tx0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),cr=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Ex0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),jx0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionH0($,Y,U){functionI(z,G){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:G,constr:K,traits:newSet},enumerable:!1});if(z._zod.traits.has($))return;z._zod.traits.add($),Y(z,G);letH=K.prototype,W=Object.keys(H);for(letX=0;X<W.length;X++){letZ=W[X];if(!(Zinz))z[Z]=H[Z].bind(z)}}letQ=U?.Parent??Object;classJextendsQ{}Object.defineProperty(J,"name",{value:$});functionK(z){varG;letH=U?.Parent?newJ:this;I(H,z),(G=H._zod).deferred??(G.deferred=[]);for(letWofH._zod.deferred)W();returnH}returnObject.defineProperty(K,"init",{value:I}),Object.defineProperty(K,Symbol.hasInstance,{value:(z)=>{if(U?.Parent&&zinstanceofU.Parent)return!0;returnz?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}functiont4($){if($)Object.assign(SY,$);returnSY}varpr,JG,hE,s5,hY,SY;vargY=m(()=>{JG=Object.freeze({status:"aborted"});hE=Symbol("zod_brand");s5=classs5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};hY=classhYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(pr=globalThis).__zod_globalConfig??(pr.__zod_globalConfig={});SY=globalThis.__zod_globalConfig});varx0={};V8(x0,{unwrapMessage:()=>KG,uint8ArrayToHex:()=>tx0,uint8ArrayToBase64url:()=>sx0,uint8ArrayToBase64:()=>or,stringifyPrimitive:()=>h0,slugify:()=>kE,shallowClone:()=>fE,safeExtend:()=>dx0,required:()=>lx0,randomString:()=>xx0,propertyKeyTypes:()=>HG,promiseAllObject:()=>kx0,primitiveTypes:()=>uE,prefixIssues:()=>p8,pick:()=>ix0,partial:()=>mx0,parsedType:()=>y0,optionalKeys:()=>bE,omit:()=>cx0,objectClone:()=>hx0,numKeys:()=>fx0,nullish:()=>F7,normalizeParams:()=>f0,mergeDefs:()=>a9,merge:()=>px0,jsonStringifyReplacer:()=>tI,joinValues:()=>O0,issue:()=>$Q,isPlainObject:()=>M7,isObject:()=>yY,hexToUint8Array:()=>ax0,getSizableOrigin:()=>WG,getParsedType:()=>ux0,getLengthableOrigin:()=>XG,getEnumValues:()=>zG,getElementAtPath:()=>yx0,floatSafeRemainder:()=>yE,finalizeIssue:()=>_8,extend:()=>nx0,explicitlyAborted:()=>nE,escapeRegex:()=>v$,esc:()=>ZV,defineLazy:()=>j1,createTransparentProxy:()=>bx0,cloneDef:()=>gx0,clone:()=>R8,cleanRegex:()=>GG,cleanEnum:()=>ox0,captureStackTrace:()=>qV,cached:()=>eI,base64urlToUint8Array:()=>rx0,base64ToUint8Array:()=>lr,assignProp:()=>w7,assertNotEqual:()=>Rx0,assertNever:()=>vx0,assertIs:()=>_x0,assertEqual:()=>Cx0,assert:()=>Sx0,allowsEval:()=>xE,aborted:()=>O7,NUMBER_FORMAT_RANGES:()=>iE,Class:()=>rrLine truncated
`)}var sr=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,tI,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},ZG,m8;var mE=m(()=>{gY();$1();ZG=H0("$ZodError",sr),m8=H0("$ZodError",sr,{Parent:Error})});var YQ=($)=>(Y,U,I,Q)=>{let J=I?{...I,async:!1}:{async:!1},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)throw new s5;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>_8(G,J,t4())));throw qV(z,Q?.callee),z}return K.value},VV,UQ=($)=>async(Y,U,I,Q)=>{let J=I?{...I,async:!0}:{async:!0},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)K=await K;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>_8(G,J,t4())));throw qV(z,Q?.callee),z}return K.value},LV,IQ=($)=>(Y,U,I)=>{let Q=I?{...I,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new s5;return J.issues.length?{success:!1,error:new($??ZG)(J.issues.map((K)=>_8(K,Q,t4())))}:{success:!0,data:J.value}},lE,QQ=($)=>async(Y,U,I)=>{let Q=I?{...I,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((K)=>_8(K,Q,t4())))}:{success:!0,data:J.value}},oE,FV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return YQ($)(Y,U,Q)},$f0,wV=($)=>(Y,U,I)=>{return YQ($)(Y,U,I)},Yf0,MV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return UQ($)(Y,U,Q)},Uf0,OV=($)=>async(Y,U,I)=>{return UQ($)(Y,U,I)},If0,NV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return IQ($)(Y,U,Q)},Qf0,DV=($)=>(Y,U,I)=>{return IQ($)(Y,U,I)},Jf0,BV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return QQ($)(Y,U,Q)},Kf0,AV=($)=>async(Y,U,I)=>{return QQ($)(Y,U,I)},zf0;var rE=m(()=>{gY();mE();$1();VV=YQ(m8),LV=UQ(m8),lE=IQ(m8),oE=QQ(m8),$f0=FV(m8),Yf0=wV(m8),Uf0=MV(m8),If0=OV(m8),Qf0=NV(m8),Jf0=DV(m8),Kf0=BV(m8),zf0=AV(m8)});var W$={};V8(W$,{xid:()=>eE,uuid7:()=>Xf0,uuid6:()=>Wf0,uuid4:()=>Hf0,uuid:()=>kY,uppercase:()=>Pj,unicodeEmail:()=>tr,undefined:()=>Bj,ulid:()=>tE,time:()=>Lj,string:()=>wj,sha512_hex:()=>Sf0,sha512_base64url:()=>gf0,sha512_base64:()=>hf0,sha384_hex:()=>Rf0,sha384_base64url:()=>vf0,sha384_base64:()=>_f0,sha256_hex:()=>Ef0,sha256_base64url:()=>Cf0,sha256_base64:()=>jf0,sha1_hex:()=>Af0,sha1_base64url:()=>Tf0,sha1_base64:()=>Pf0,rfc5322Email:()=>qf0,number:()=>LG,null:()=>Dj,nanoid:()=>Yj,md5_hex:()=>Nf0,md5_base64url:()=>Bf0,md5_base64:()=>Df0,mac:()=>Gj,lowercase:()=>Aj,ksuid:()=>$j,ipv6:()=>zj,ipv4:()=>Kj,integer:()=>Oj,idnEmail:()=>Vf0,httpProtocol:()=>Zj,html5Email:()=>Zf0,hostname:()=>wf0,hex:()=>Of0,guid:()=>Ij,extendedDuration:()=>Gf0,emoji:()=>Jj,email:()=>Qj,e164:()=>qj,duration:()=>Uj,domain:()=>Mf0,datetime:()=>Fj,date:()=>Vj,cuid2:()=>aE,cuid:()=>sE,cidrv6:()=>Wj,cidrv4:()=>Hj,browserEmail:()=>Lf0,boolean:()=>Nj,bigint:()=>Mj,base64url:()=>PV,base64:()=>Xj});function Jj(){return new RegExp(Ff0,"u")}function $s($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Lj($){return new RegExp(`^${$s($)}$`)}function Fj($){let Y=$s({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let I=`${Y}(?:${U.join("|")})`;return new RegExp(`^${er}T(?:${I})$`)}function FG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function wG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var sE,aE,tE,eE,$j,Yj,Uj,Gf0,Ij,kY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;returnnewRegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Hf0,Wf0,Xf0,Qj,Zf0,qf0,tr,Vf0,Lf0,Ff0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Kj,zj,Gj=($)=>{letY=v$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Hj,Wj,Xj,PV,wf0,Mf0,Zj,qj,er="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Vj,wj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},Mj,Oj,LG,Nj,Dj,Bj,Aj,Pj,Of0,Nf0,Df0,Bf0,Af0,Pf0,Tf0,Ef0,jf0,Cf0,Rf0,_f0,vf0,Sf0,hf0,gf0;varTV=m(()=>{$1();sE=/^[cC][0-9a-z]{6,}$/,aE=/^[0-9a-z]+$/,tE=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,eE=/^[0-9a-vA-V]{20}$/,$j=/^[A-Za-z0-9]{27}$/,Yj=/^[a-zA-Z0-9_-]{21}$/,Uj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
import{createRequireasFx0}from"node:module";varzx0=Object.create;var{getPrototypeOf:Gx0,defineProperty:SE,getOwnPropertyNames:Hx0}=Object;varWx0=Object.prototype.hasOwnProperty;functionXx0($){returnthis[$]}varZx0,qx0,H6=($,Y,U)=>{varI=$!=null&&typeof$==="object";if(I){varQ=Y?Zx0??=newWeakMap:qx0??=newWeakMap,J=Q.get($);if(J)returnJ}U=$!=null?zx0(Gx0($)):{};letK=Y||!$||!$.__esModule?SE(U,"default",{value:$,enumerable:!0}):U;for(letzofHx0($))if(!Wx0.call(K,z))SE(K,z,{get:Xx0.bind($,z),enumerable:!0});if(I)Q.set($,K);returnK};varj=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varVx0=($)=>$;functionLx0($,Y){this[$]=Vx0.bind(null,Y)}varL8=($,Y)=>{for(varUinY)SE($,U,{get:Y[U],enumerable:!0,configurable:!0,set:Lx0.bind(Y,U)})};varo=($,Y)=>()=>($&&(Y=$($=0)),Y);varK0=Fx0(import.meta.url);varwx0,qV,Mx0,Ox0,Nx0,Dx0,_0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),br=($,Y)=>{letU={};for(varIin$)qV(U,I,{get:$[I],enumerable:!0});if(Y)qV(U,Symbol.toStringTag,{value:"Module"});returnU},Ax0=($,Y,U,I)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varQ=Ox0(Y),J=0,K=Q.length,z;J<K;J++)if(z=Q[J],!Dx0.call($,z)&&z!==U)qV($,z,{get:((G)=>Y[G]).bind(null,z),enumerable:!(I=Mx0(Y,z))||I.enumerable})}return$},VV=($,Y,U)=>(U=$!=null?wx0(Nx0($)):{},Ax0(Y||!$||!$.__esModule?qV(U,"default",{value:$,enumerable:!0}):U,$));varhE=o(()=>{wx0=Object.create,qV=Object.defineProperty,Mx0=Object.getOwnPropertyDescriptor,Ox0=Object.getOwnPropertyNames,Nx0=Object.getPrototypeOf,Dx0=Object.prototype.hasOwnProperty});functioncr($){returntypeof$==="string"&&ir.has($.replace(/#$/,""))}functionnr($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letU=$.$schema.replace(/#$/,"");if(Bx0.has(U))return"2020-12";if(ir.has(U))return"2019-09";if(Px0.has(U)||Tx0.has(U))return"draft-7";throwError(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}varBx0,ir,Px0,Tx0;varyE=o(()=>{Bx0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),ir=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Px0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Tx0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionH0($,Y,U){functionI(z,G){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:G,constr:K,traits:newSet},enumerable:!1});if(z._zod.traits.has($))return;z._zod.traits.add($),Y(z,G);letH=K.prototype,W=Object.keys(H);for(letX=0;X<W.length;X++){letZ=W[X];if(!(Zinz))z[Z]=H[Z].bind(z)}}letQ=U?.Parent??Object;classJextendsQ{}Object.defineProperty(J,"name",{value:$});functionK(z){varG;letH=U?.Parent?newJ:this;I(H,z),(G=H._zod).deferred??(G.deferred=[]);for(letWofH._zod.deferred)W();returnH}returnObject.defineProperty(K,"init",{value:I}),Object.defineProperty(K,Symbol.hasInstance,{value:(z)=>{if(U?.Parent&&zinstanceofU.Parent)return!0;returnz?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}functione4($){if($)Object.assign(yY,$);returnyY}vardr,GG,gE,e5,gY,yY;varkY=o(()=>{GG=Object.freeze({status:"aborted"});gE=Symbol("zod_brand");e5=classe5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};gY=classgYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(dr=globalThis).__zod_globalConfig??(dr.__zod_globalConfig={});yY=globalThis.__zod_globalConfig});varx0={};L8(x0,{unwrapMessage:()=>HG,uint8ArrayToHex:()=>sx0,uint8ArrayToBase64url:()=>ox0,uint8ArrayToBase64:()=>lr,stringifyPrimitive:()=>h0,slugify:()=>fE,shallowClone:()=>bE,safeExtend:()=>cx0,required:()=>px0,randomString:()=>gx0,propertyKeyTypes:()=>ZG,promiseAllObject:()=>yx0,primitiveTypes:()=>iE,prefixIssues:()=>l8,pick:()=>ux0,partial:()=>dx0,parsedType:()=>g0,optionalKeys:()=>cE,omit:()=>bx0,objectClone:()=>vx0,numKeys:()=>kx0,nullish:()=>O7,normalizeParams:()=>f0,mergeDefs:()=>$3,merge:()=>nx0,jsonStringifyReplacer:()=>$Q,joinValues:()=>O0,issue:()=>UQ,isPlainObject:()=>D7,isObject:()=>xY,hexToUint8Array:()=>rx0,getSizableOrigin:()=>qG,getParsedType:()=>xx0,getLengthableOrigin:()=>VG,getEnumValues:()=>WG,getElementAtPath:()=>hx0,floatSafeRemainder:()=>xE,finalizeIssue:()=>S8,extend:()=>ix0,explicitlyAborted:()=>pE,escapeRegex:()=>h$,esc:()=>LV,defineLazy:()=>C1,createTransparentProxy:()=>fx0,cloneDef:()=>Sx0,clone:()=>v8,cleanRegex:()=>XG,cleanEnum:()=>mx0,captureStackTrace:()=>FV,cached:()=>YQ,base64urlToUint8Array:()=>lx0,base64ToUint8Array:()=>mr,assignProp:()=>N7,assertNotEqual:()=>jx0,assertNever:()=>Rx0,assertIs:()=>Cx0,assertEqual:()=>Ex0,assert:()=>_x0,allowsEval:()=>uE,aborted:()=>A7,NUMBER_FORMAT_RANGES:()=>nE,Class:()=>orLine truncated
`)}var rr=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,$Q,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},LG,o8;var oE=o(()=>{kY();$1();LG=H0("$ZodError",rr),o8=H0("$ZodError",rr,{Parent:Error})});var IQ=($)=>(Y,U,I,Q)=>{let J=I?{...I,async:!1}:{async:!1},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)throw new e5;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>S8(G,J,e4())));throw FV(z,Q?.callee),z}return K.value},wV,QQ=($)=>async(Y,U,I,Q)=>{let J=I?{...I,async:!0}:{async:!0},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)K=await K;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>S8(G,J,e4())));throw FV(z,Q?.callee),z}return K.value},MV,JQ=($)=>(Y,U,I)=>{let Q=I?{...I,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new e5;return J.issues.length?{success:!1,error:new($??LG)(J.issues.map((K)=>S8(K,Q,e4())))}:{success:!0,data:J.value}},rE,KQ=($)=>async(Y,U,I)=>{let Q=I?{...I,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((K)=>S8(K,Q,e4())))}:{success:!0,data:J.value}},sE,OV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return IQ($)(Y,U,Q)},tx0,NV=($)=>(Y,U,I)=>{return IQ($)(Y,U,I)},ex0,DV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return QQ($)(Y,U,Q)},$f0,AV=($)=>async(Y,U,I)=>{return QQ($)(Y,U,I)},Yf0,BV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return JQ($)(Y,U,Q)},Uf0,PV=($)=>(Y,U,I)=>{return JQ($)(Y,U,I)},If0,TV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return KQ($)(Y,U,Q)},Qf0,EV=($)=>async(Y,U,I)=>{return KQ($)(Y,U,I)},Jf0;var aE=o(()=>{kY();oE();$1();wV=IQ(o8),MV=QQ(o8),rE=JQ(o8),sE=KQ(o8),tx0=OV(o8),ex0=NV(o8),$f0=DV(o8),Yf0=AV(o8),Uf0=BV(o8),If0=PV(o8),Qf0=TV(o8),Jf0=EV(o8)});var Z$={};L8(Z$,{xid:()=>Yj,uuid7:()=>Hf0,uuid6:()=>Gf0,uuid4:()=>zf0,uuid:()=>fY,uppercase:()=>Ej,unicodeEmail:()=>ar,undefined:()=>Pj,ulid:()=>$j,time:()=>wj,string:()=>Oj,sha512_hex:()=>_f0,sha512_base64url:()=>Sf0,sha512_base64:()=>vf0,sha384_hex:()=>jf0,sha384_base64url:()=>Rf0,sha384_base64:()=>Cf0,sha256_hex:()=>Pf0,sha256_base64url:()=>Ef0,sha256_base64:()=>Tf0,sha1_hex:()=>Df0,sha1_base64url:()=>Bf0,sha1_base64:()=>Af0,rfc5322Email:()=>Xf0,number:()=>MG,null:()=>Bj,nanoid:()=>Ij,md5_hex:()=>Mf0,md5_base64url:()=>Nf0,md5_base64:()=>Of0,mac:()=>Wj,lowercase:()=>Tj,ksuid:()=>Uj,ipv6:()=>Hj,ipv4:()=>Gj,integer:()=>Dj,idnEmail:()=>Zf0,httpProtocol:()=>Vj,html5Email:()=>Wf0,hostname:()=>Lf0,hex:()=>wf0,guid:()=>Jj,extendedDuration:()=>Kf0,emoji:()=>zj,email:()=>Kj,e164:()=>Lj,duration:()=>Qj,domain:()=>Ff0,datetime:()=>Mj,date:()=>Fj,cuid2:()=>eE,cuid:()=>tE,cidrv6:()=>Zj,cidrv4:()=>Xj,browserEmail:()=>qf0,boolean:()=>Aj,bigint:()=>Nj,base64url:()=>jV,base64:()=>qj});function zj(){return new RegExp(Vf0,"u")}function er($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function wj($){return new RegExp(`^${er($)}$`)}function Mj($){let Y=er({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let I=`${Y}(?:${U.join("|")})`;return new RegExp(`^${tr}T(?:${I})$`)}function OG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function NG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var tE,eE,$j,Yj,Uj,Ij,Qj,Kf0,Jj,fY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;returnnewRegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},zf0,Gf0,Hf0,Kj,Wf0,Xf0,ar,Zf0,qf0,Vf0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Gj,Hj,Wj=($)=>{letY=h$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Xj,Zj,qj,jV,Lf0,Ff0,Vj,Lj,tr="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Fj,Oj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},Nj,Dj,MG,Aj,Bj,Pj,Tj,Ej,wf0,Mf0,Of0,Nf0,Df0,Af0,Bf0,Pf0,Tf0,Ef0,jf0,Cf0,Rf0,_f0,vf0,Sf0;varCV=o(()=>{$1();tE=/^[cC][0-9a-z]{6,}$/,eE=/^[0-9a-z]+$/,$j=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yj=/^[0-9a-vA-V]{20}$/,Uj=/^[A-Za-z0-9]{27}$/,Ij=/^[a-zA-Z0-9_-]{21}$/,Qj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),I=Math.min(...U.map((J)=>J.length-J.trimStart().length)),Q=U.map((J)=>J.slice(I)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,Y=this?.args,I=[...(this?.content??[""]).map((Q)=>`${Q}`)];return new $(...Y,I.join(`
`))}}var nj;var dj=m(()=>{nj={major:4,minor:4,patch:3}});function ZC($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Ms($){if(!PV.test($))return!1;let Y=$.replace(/[-_]/g,(I)=>I==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return ZC(U)}function Os($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[I]=U;if(!I)return!1;let Q=JSON.parse(atob(I));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function Qs($,Y,U){if($.issues.length)Y.issues.push(...p8(U,$.issues));Y.value[U]=$.value}function hV($,Y,U,I,Q,J){let K=U in I;if($.issues.length){if(Q&&J&&!K)return;Y.issues.push(...p8(U,$.issues))}if(!K&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(K)Y.value[U]=void 0}else Y.value[U]=$.value}function Ns($){let Y=Object.keys($.shape);for(let I of Y)if(!$.shape?.[I]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${I}":expectedaZodschema`);let U=bE($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Ds($,Y,U,I,Q,J){let K=[],z=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(z.has(Z))continue;if(H==="never"){K.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},I);if(q instanceof Promise)$.push(q.then((V)=>hV(V,U,Z,Y,W,X)));else hV(q,U,Z,Y,W,X)}if(K.length)U.issues.push({code:"unrecognized_keys",keys:K,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function Js($,Y,U,I){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!O7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>_8(K,I,t4())))}),Y}function Ks($,Y,U,I){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>_8(K,I,t4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function pj($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(M7($)&&M7(Y)){let U=Object.keys(Y),I=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of I){let K=pj($[J],Y[J]);if(!K.valid)return{valid:!1,mergeErrorPath:[J,...K.mergeErrorPath]};Q[J]=K.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let I=0;I<$.length;I++){let Q=$[I],J=Y[I],K=pj(Q,J);if(!K.valid)return{valid:!1,mergeErrorPath:[I,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function zs($,Y,U){let I=new Map,Q;for(let z of Y.issues)if(z.code==="unrecognized_keys"){Q??(Q=z);for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).l=!0}}else $.issues.push(z);for(let z of U.issues)if(z.code==="unrecognized_keys")for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).r=!0}else $.issues.push(z);let J=[...I].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(J.length&&Q)$.issues.push({...Q,keys:J});if(O7($))return $;let K=pj(Y.value,U.value);if(!K.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}function Gs($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Hs($,Y,U){if($.issues.length)Y.issues.push(...p8(U,$.issues));Y.value[U]=$.value}function Ws($,Y,U,I,Q){for(let J=0;J<U.length;J++){let K=$[J],z=J<I.length;if(K.issues.length){if(!z&&J>=Q){Y.value.length=J;break}Y.issues.push(...p8(J,K.issues))}Y.value[J]=K.value}for(let J=Y.value.length-1;J>=I.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Xs($,Y,U,I,Q,J,K){if($.issues.length)if(HG.has(typeof I))U.issues.push(...p8(I,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((z)=>_8(z,K,t4()))});if(Y.issues.length)if(HG.has(typeof I))U.issues.push(...p8(I,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:I,issues:Y.issues.map((z)=>_8(z,K,t4()))});U.value.set($.value,Y.value)}function Zs($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function qs($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Vs($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Ls($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function _V($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
`))}}var pj;var mj=o(()=>{pj={major:4,minor:4,patch:3}});function VC($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function ws($){if(!jV.test($))return!1;let Y=$.replace(/[-_]/g,(I)=>I==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return VC(U)}function Ms($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[I]=U;if(!I)return!1;let Q=JSON.parse(atob(I));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function Is($,Y,U){if($.issues.length)Y.issues.push(...l8(U,$.issues));Y.value[U]=$.value}function kV($,Y,U,I,Q,J){let K=U in I;if($.issues.length){if(Q&&J&&!K)return;Y.issues.push(...l8(U,$.issues))}if(!K&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(K)Y.value[U]=void 0}else Y.value[U]=$.value}function Os($){let Y=Object.keys($.shape);for(let I of Y)if(!$.shape?.[I]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${I}":expectedaZodschema`);let U=cE($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Ns($,Y,U,I,Q,J){let K=[],z=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(z.has(Z))continue;if(H==="never"){K.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},I);if(q instanceof Promise)$.push(q.then((V)=>kV(V,U,Z,Y,W,X)));else kV(q,U,Z,Y,W,X)}if(K.length)U.issues.push({code:"unrecognized_keys",keys:K,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function Qs($,Y,U,I){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!A7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>S8(K,I,e4())))}),Y}function Js($,Y,U,I){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>S8(K,I,e4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function lj($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(D7($)&&D7(Y)){let U=Object.keys(Y),I=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of I){let K=lj($[J],Y[J]);if(!K.valid)return{valid:!1,mergeErrorPath:[J,...K.mergeErrorPath]};Q[J]=K.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let I=0;I<$.length;I++){let Q=$[I],J=Y[I],K=lj(Q,J);if(!K.valid)return{valid:!1,mergeErrorPath:[I,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Ks($,Y,U){let I=new Map,Q;for(let z of Y.issues)if(z.code==="unrecognized_keys"){Q??(Q=z);for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).l=!0}}else $.issues.push(z);for(let z of U.issues)if(z.code==="unrecognized_keys")for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).r=!0}else $.issues.push(z);let J=[...I].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(J.length&&Q)$.issues.push({...Q,keys:J});if(A7($))return $;let K=lj(Y.value,U.value);if(!K.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}function zs($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Gs($,Y,U){if($.issues.length)Y.issues.push(...l8(U,$.issues));Y.value[U]=$.value}function Hs($,Y,U,I,Q){for(let J=0;J<U.length;J++){let K=$[J],z=J<I.length;if(K.issues.length){if(!z&&J>=Q){Y.value.length=J;break}Y.issues.push(...l8(J,K.issues))}Y.value[J]=K.value}for(let J=Y.value.length-1;J>=I.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Ws($,Y,U,I,Q,J,K){if($.issues.length)if(ZG.has(typeof I))U.issues.push(...l8(I,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((z)=>S8(z,K,e4()))});if(Y.issues.length)if(ZG.has(typeof I))U.issues.push(...l8(I,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:I,issues:Y.issues.map((z)=>S8(z,K,e4()))});U.value.set($.value,Y.value)}function Xs($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Zs($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function qs($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Vs($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function hV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
@@ -60,94 +60,94 @@ import{createRequire as Mx0}from"node:module";var Hx0=Object.create;var{getProto
newResult[${P}]=${D}.value;
}
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,K=yY,z=!SY.jitless,H=z&&xE.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=I.value);let V=Z.value;if(!K(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(z&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return Ds([],V,Z,q,X,$)}return U(Z,q)}});OG=H0("$ZodUnion",($,Y)=>{V1.init($,Y),j1($._zod,"optin",()=>Y.options.some((I)=>I._zod.optin==="optional")?"optional":void 0),j1($._zod,"optout",()=>Y.options.some((I)=>I._zod.optout==="optional")?"optional":void 0),j1($._zod,"values",()=>{if(Y.options.every((I)=>I._zod.values))return new Set(Y.options.flatMap((I)=>Array.from(I._zod.values)));return}),j1($._zod,"pattern",()=>{if(Y.options.every((I)=>I._zod.pattern)){let I=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${I.map((Q)=>GG(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!J)return Js(K,I,$,Q);return Promise.all(K).then((z)=>{return Js(z,I,$,Q)})}});_C=H0("$ZodXor",($,Y)=>{OG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else K.push(G)}if(!J)return Ks(K,I,$,Q);return Promise.all(K).then((z)=>{return Ks(z,I,$,Q)})}}),vC=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,OG.init($,Y);let U=$._zod.parse;j1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let K=J._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(J)}"`);for(let[z,G]of Object.entries(K)){if(!Q[z])Q[z]=new Set;for(let H of G)Q[z].add(H)}}return Q});let I=eI(()=>{let Q=Y.options,J=new Map;for(let K of Q){let z=K._zod.propValues?.[Y.discriminator];if(!z||z.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(K)}"`);for(let G of z){if(J.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);J.set(G,K)}}return J});$._zod.parse=(Q,J)=>{let K=Q.value;if(!yY(K))return Q.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),Q;let z=I.value.get(K?.[Y.discriminator]);if(z)return z._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return U(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(I.value.keys()),input:K,path:[Y.discriminator],inst:$}),Q}}),SC=H0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},I),K=Y.right._zod.run({value:Q,issues:[]},I);if(J instanceof Promise||K instanceof Promise)return Promise.all([J,K]).then(([G,H])=>{return zs(U,G,H)});return zs(U,J,K)}});kV=H0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(I,Q)=>{let J=I.value;if(!Array.isArray(J))return I.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),I;I.value=[];let K=[],z=Gs(U,"optin"),G=Gs(U,"optout");if(!Y.rest){if(J.length<z)return I.issues.push({code:"too_small",minimum:z,inclusive:!0,input:J,inst:$,origin:"array"}),I;if(J.length>U.length)I.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)K.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)K.push(q.then((V)=>Hs(V,I,W)));else Hs(q,I,W)}}if(K.length)return Promise.all(K).then(()=>Ws(H,I,U,J,G));return Ws(H,I,U,J,G)}});hC=H0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value;if(!M7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],K=Y.keyType._zod.values;if(K){U.value={};let z=new Set;for(let H of K)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){z.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},I);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>_8(q,I,t4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},I);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...p8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...p8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!z.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec
Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,K=xY,z=!yY.jitless,H=z&&uE.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=I.value);let V=Z.value;if(!K(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(z&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return Ns([],V,Z,q,X,$)}return U(Z,q)}});AG=H0("$ZodUnion",($,Y)=>{V1.init($,Y),C1($._zod,"optin",()=>Y.options.some((I)=>I._zod.optin==="optional")?"optional":void 0),C1($._zod,"optout",()=>Y.options.some((I)=>I._zod.optout==="optional")?"optional":void 0),C1($._zod,"values",()=>{if(Y.options.every((I)=>I._zod.values))return new Set(Y.options.flatMap((I)=>Array.from(I._zod.values)));return}),C1($._zod,"pattern",()=>{if(Y.options.every((I)=>I._zod.pattern)){let I=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${I.map((Q)=>XG(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!J)return Qs(K,I,$,Q);return Promise.all(K).then((z)=>{return Qs(z,I,$,Q)})}});SC=H0("$ZodXor",($,Y)=>{AG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else K.push(G)}if(!J)return Js(K,I,$,Q);return Promise.all(K).then((z)=>{return Js(z,I,$,Q)})}}),hC=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,AG.init($,Y);let U=$._zod.parse;C1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let K=J._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(J)}"`);for(let[z,G]of Object.entries(K)){if(!Q[z])Q[z]=new Set;for(let H of G)Q[z].add(H)}}return Q});let I=YQ(()=>{let Q=Y.options,J=new Map;for(let K of Q){let z=K._zod.propValues?.[Y.discriminator];if(!z||z.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(K)}"`);for(let G of z){if(J.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);J.set(G,K)}}return J});$._zod.parse=(Q,J)=>{let K=Q.value;if(!xY(K))return Q.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),Q;let z=I.value.get(K?.[Y.discriminator]);if(z)return z._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return U(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(I.value.keys()),input:K,path:[Y.discriminator],inst:$}),Q}}),yC=H0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},I),K=Y.right._zod.run({value:Q,issues:[]},I);if(J instanceof Promise||K instanceof Promise)return Promise.all([J,K]).then(([G,H])=>{return Ks(U,G,H)});return Ks(U,J,K)}});uV=H0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(I,Q)=>{let J=I.value;if(!Array.isArray(J))return I.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),I;I.value=[];let K=[],z=zs(U,"optin"),G=zs(U,"optout");if(!Y.rest){if(J.length<z)return I.issues.push({code:"too_small",minimum:z,inclusive:!0,input:J,inst:$,origin:"array"}),I;if(J.length>U.length)I.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)K.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)K.push(q.then((V)=>Gs(V,I,W)));else Gs(q,I,W)}}if(K.length)return Promise.all(K).then(()=>Hs(H,I,U,J,G));return Hs(H,I,U,J,G)}});gC=H0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value;if(!D7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],K=Y.keyType._zod.values;if(K){U.value={};let z=new Set;for(let H of K)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){z.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},I);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>S8(q,I,e4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},I);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...l8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...l8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!z.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letKof$.seen.entries()){letz=K[1];if(Y===K[0]){J(K);continue}if($.external){letH=$.external.registry.get(K[0])?.id;if(Y!==K[0]&&H){J(K);continue}}if($.metadataRegistry.get(K[0])?.id){J(K);continue}if(z.cycle){J(K);continue}if(z.count>1){if($.reused==="ref"){J(K);continue}}}}functionP7($,Y){letU=$.seen.get(Y);if(!U)throwError("Unprocessed schema. This is a bug in Zod.");letI=(z)=>{letG=$.seen.get(z);if(G.ref===null)return;letH=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){I(X);letq=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);elseObject.assign(H,V);if(Object.assign(H,W),z._zod.parent===X)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(!(MinW))deleteH[M]}if(V.$ref&&q.def)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(Minq.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))deleteH[M]}}letZ=z._zod.parent;if(Z&&Z!==X){I(Z);letq=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(letVinH){if(V==="$ref"||V==="allOf")continue;if(Vinq.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))deleteH[V]}}}$.override({zodSchema:z,jsonSchema:H,path:G.path??[]})};for(letzof[...$.seen.entries()].reverse())I(z[0]);letQ={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letz=$.external.registry.get(Y)?.id;if(!z)throwError("Schema is missing an `id` property");Q.$id=$.external.uri(z)}Object.assign(Q,U.def??U.schema);letJ=$.metadataRegistry.get(Y)?.id;if(J!==void0&&Q.id===J)deleteQ.id;letK=$.external?.defs??{};for(letzof$.seen.entries()){letG=z[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;K[G.defId]=G.def}}if($.external);elseif(Object.keys(K).length>0)if($.target==="draft-2020-12")Q.$defs=K;elseQ.definitions=K;try{letz=JSON.parse(JSON.stringify(Q));returnObject.defineProperty(z,"~standard",{value:{...Y["~standard"],jsonSchema:{input:NQ(Y,"input",$.processors),output:NQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),z}catch(z){throwError("Error converting schema to JSON.")}}functionS8($,Y){letU=Y??{seen:newSet};if(U.seen.has($))return!1;U.seen.add($);letI=$._zod.def;if(I.type==="transform")return!0;if(I.type==="array")returnS8(I.element,U);if(I.type==="set")returnS8(I.valueType,U);if(I.type==="lazy")returnS8(I.getter(),U);if(I.type==="promise"||I.type==="optional"||I.type==="nonoptional"||I.type==="nullable"||I.type==="readonly"||I.type==="default"||I.type==="prefault")returnS8(I.innerType,U);if(I.type==="intersection")returnS8(I.left,U)||S8(I.right,U);if(I.type==="record"||I.type==="map")returnS8(I.keyType,U)||S8(I.valueType,U);if(I.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnS8(I.in,U)||S8(I.out,U)}if(I.type==="object"){for(letQinI.shape)if(S8(I.shape[Q],U))return!0;return!1}if(I.type==="union"){for(letQofI.options)if(S8(Q,U))return!0;return!1}if(I.type==="tuple"){for(letQofI.items)if(S8(Q,U))return!0;if(I.rest&&S8(I.rest,U))return!0;return!1}return!1}varn_=($,Y={})=>(U)=>{letI=B7({...U,processors:Y});returnG4($,I),A7(I,$),P7(I,$)},NQ=($,Y,U={})=>(I)=>{let{libraryOptions:Q,target:J}=I??{},K=B7({...Q??{},target:J,io:Y,processors:U});returnG4($,K),A7(K,$),P7(K,$)};varRG=m(()=>{EG()});functioniY($,Y){if("_idmap"in$){letI=$,Q=B7({...Y,processors:XL}),J={};for(letGofI._idmap.entries()){let[H,W]=G;G4(W,Q)}letK={},z={registry:I,uri:Y?.uri,defs:J};Q.external=z;for(letGofI._idmap.entries()){let[H,W]=G;A7(Q,W),K[H]=P7(Q,W)}if(Object.keys(J).length>0){letG=Q.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[G]:J}}return{schemas:K}}letU=B7({...Y,processors:XL});returnG4($,U),A7(U,$),P7(U,$)}varUb0,d_=($,Y,U,I)=>{letQ=U;Q.type="string";let{minimum:J,maximum:K,format:z,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofJ==="number")Q.minLength=J;if(typeofK==="number")Q.maxLength=K;if(z){if(Q.format=Ub0[z]??z,Q.format==="")deleteQ.format;if(z==="time")deleteQ.format}if(H)Q.contentEncoding=H;if(G&&G.size>0){letW=[...G];if(W.length===1)Q.pattern=W[0].source;elseif(W.length>1)Q.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},p_=($,Y,U,I)=>{letQ=U,{minimum:J,maximum:K,format:z,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofz==="string"&&z.includes("int"))Q.type="integer";elseQ.type="number";letX=typeofW==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeofH==="number"&&H<=(K??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;elseQ.exclusiveMinimuLine truncated
`}function ki0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(current:${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!yi0.test($)){let U=[...$].filter((I)=>!/[A-Za-z0-9._-]/.test(I)).filter((I,Q,J)=>J.indexOf(I)===Q);return Y.push(`Toolnamecontainsinvalidcharacters:${U.map((I)=>`"${I}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function xi0($,Y){if(Y.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let U of Y)console.warn(`-${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function bh($){let Y=ki0($);return xi0($,Y.warnings),Y.isValid}function fi0($){return typeof $==="object"&&$!==null&&"_zod"in $}function ui0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function bi0($){if(typeof $!=="object"||$===null)return!1;if(nQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>fi0(U))}function aw($){if($===void 0)return;if(bi0($))return U0($);if(typeof $==="object"&&$!==null&&!nQ($)&&Object.values($).some((Y)=>ui0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!nQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var Vh,Mb0,T1,L1,Ob0,Le="2026-07-28",x7,Me,Bb0,Ab0,Pb0,De,Be,Eb0,yw,Uc1,Ic1,Ie,Bh,Sb0,hb0,iQ,i0,Q1,dw,Te,pQ,pw,kb0=0,xb0="private",fb0,mb0,xw,Eh,Ce,Qc1,Jc1,tb0,eb0,jh,fw,PH="2026-07-28",ve,Ui0,S$=($)=>sG.safeParse($).success,f7=($)=>aG.safeParse($).success,BH=($)=>_Q.safeParse($).success,rw=($)=>vQ.safeParse($).success,J3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Ge="x-mcp-header",Ii0,Qi0,Ji0,Ki0,iw=-32020,Kc1,zi0,He=!1,Fh="draft-2020-12",Wi0,Li0,Fi0,We,wi0,Ai0,ge=250,Pi0,Ti0,fe,ue,Ei0,ji0,ie=60000,Ri0,_i0,vi0,ce,kh,gi0,zc1,ne=10485760,fh=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??ne}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBufferexceededmaximumsizeof${this._maxBufferSize}bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return de(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},yi0;var tw=m(()=>{vE();SE();$e();hS();Vh=Symbol.for("mcp.sdk.errorBrands");Mb0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return cQ(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return cQ(this,Y)}constructor(Y,U,I){super(U);this.code=Y,this.errorUri=I,this.name="OAuthError",Mh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},T1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),L1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return cQ(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return cQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",Mh(this,new.target)}},Ob0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};x7=[Le];Me=["task","inputRequests","requestState"];Ab0=new Set(["const","enum","default","examples"]),Pb0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);De={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Be={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Eb0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Uc1=Object.keys(De),Ic1=Object.keys(Be);Ie={ok:!1,reason:"not-in-era"};Bh={era:"2025-11-25",hasRequestMethod:Ae,hasNotificationMethod:Pe,validateRequest:($,Y)=>kw(Rb0($),Y),validateResult:($,Y)=>kw(Cb0($),Y),validateNotification:($,Y)=>kw(_b0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ie,validateInputResponse:()=>Ie,samplingResultVariant:($,Y)=>{let U=Oe();return kw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=we($),I=U.structuredContent;if(I===void 0)return U;let Q=typeof I!=="object"||I===null||Array.isArray(I),J=Y!==void 0&&Ne(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:I}}},decodeResult($,Y){if(Lh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:Je(U)}}return{kind:"complete",result:Je(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letKof$.seen.entries()){letz=K[1];if(Y===K[0]){J(K);continue}if($.external){letH=$.external.registry.get(K[0])?.id;if(Y!==K[0]&&H){J(K);continue}}if($.metadataRegistry.get(K[0])?.id){J(K);continue}if(z.cycle){J(K);continue}if(z.count>1){if($.reused==="ref"){J(K);continue}}}}functionj7($,Y){letU=$.seen.get(Y);if(!U)throwError("Unprocessed schema. This is a bug in Zod.");letI=(z)=>{letG=$.seen.get(z);if(G.ref===null)return;letH=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){I(X);letq=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);elseObject.assign(H,V);if(Object.assign(H,W),z._zod.parent===X)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(!(MinW))deleteH[M]}if(V.$ref&&q.def)for(letMinH){if(M==="$ref"||M==="allOf")continue;if(Minq.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))deleteH[M]}}letZ=z._zod.parent;if(Z&&Z!==X){I(Z);letq=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(letVinH){if(V==="$ref"||V==="allOf")continue;if(Vinq.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))deleteH[V]}}}$.override({zodSchema:z,jsonSchema:H,path:G.path??[]})};for(letzof[...$.seen.entries()].reverse())I(z[0]);letQ={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letz=$.external.registry.get(Y)?.id;if(!z)throwError("Schema is missing an `id` property");Q.$id=$.external.uri(z)}Object.assign(Q,U.def??U.schema);letJ=$.metadataRegistry.get(Y)?.id;if(J!==void0&&Q.id===J)deleteQ.id;letK=$.external?.defs??{};for(letzof$.seen.entries()){letG=z[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;K[G.defId]=G.def}}if($.external);elseif(Object.keys(K).length>0)if($.target==="draft-2020-12")Q.$defs=K;elseQ.definitions=K;try{letz=JSON.parse(JSON.stringify(Q));returnObject.defineProperty(z,"~standard",{value:{...Y["~standard"],jsonSchema:{input:AQ(Y,"input",$.processors),output:AQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),z}catch(z){throwError("Error converting schema to JSON.")}}functiony8($,Y){letU=Y??{seen:newSet};if(U.seen.has($))return!1;U.seen.add($);letI=$._zod.def;if(I.type==="transform")return!0;if(I.type==="array")returny8(I.element,U);if(I.type==="set")returny8(I.valueType,U);if(I.type==="lazy")returny8(I.getter(),U);if(I.type==="promise"||I.type==="optional"||I.type==="nonoptional"||I.type==="nullable"||I.type==="readonly"||I.type==="default"||I.type==="prefault")returny8(I.innerType,U);if(I.type==="intersection")returny8(I.left,U)||y8(I.right,U);if(I.type==="record"||I.type==="map")returny8(I.keyType,U)||y8(I.valueType,U);if(I.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returny8(I.in,U)||y8(I.out,U)}if(I.type==="object"){for(letQinI.shape)if(y8(I.shape[Q],U))return!0;return!1}if(I.type==="union"){for(letQofI.options)if(y8(Q,U))return!0;return!1}if(I.type==="tuple"){for(letQofI.items)if(y8(Q,U))return!0;if(I.rest&&y8(I.rest,U))return!0;return!1}return!1}varp_=($,Y={})=>(U)=>{letI=T7({...U,processors:Y});returnH4($,I),E7(I,$),j7(I,$)},AQ=($,Y,U={})=>(I)=>{let{libraryOptions:Q,target:J}=I??{},K=T7({...Q??{},target:J,io:Y,processors:U});returnH4($,K),E7(K,$),j7(K,$)};varSG=o(()=>{RG()});functionnY($,Y){if("_idmap"in$){letI=$,Q=T7({...Y,processors:VL}),J={};for(letGofI._idmap.entries()){let[H,W]=G;H4(W,Q)}letK={},z={registry:I,uri:Y?.uri,defs:J};Q.external=z;for(letGofI._idmap.entries()){let[H,W]=G;E7(Q,W),K[H]=j7(Q,W)}if(Object.keys(J).length>0){letG=Q.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[G]:J}}return{schemas:K}}letU=T7({...Y,processors:VL});returnH4($,U),E7(U,$),j7(U,$)}var$b0,m_=($,Y,U,I)=>{letQ=U;Q.type="string";let{minimum:J,maximum:K,format:z,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofJ==="number")Q.minLength=J;if(typeofK==="number")Q.maxLength=K;if(z){if(Q.format=$b0[z]??z,Q.format==="")deleteQ.format;if(z==="time")deleteQ.format}if(H)Q.contentEncoding=H;if(G&&G.size>0){letW=[...G];if(W.length===1)Q.pattern=W[0].source;elseif(W.length>1)Q.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},l_=($,Y,U,I)=>{letQ=U,{minimum:J,maximum:K,format:z,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofz==="string"&&z.includes("int"))Q.type="integer";elseQ.type="number";letX=typeofW==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeofH==="number"&&H<=(K??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;elseQ.exclusiveMinimuLine truncated
`}function yi0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(current:${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!hi0.test($)){let U=[...$].filter((I)=>!/[A-Za-z0-9._-]/.test(I)).filter((I,Q,J)=>J.indexOf(I)===Q);return Y.push(`Toolnamecontainsinvalidcharacters:${U.map((I)=>`"${I}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function gi0($,Y){if(Y.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let U of Y)console.warn(`-${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function ch($){let Y=yi0($);return gi0($,Y.warnings),Y.isValid}function ki0($){return typeof $==="object"&&$!==null&&"_zod"in $}function xi0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function fi0($){if(typeof $!=="object"||$===null)return!1;if(pQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>ki0(U))}function $M($){if($===void 0)return;if(fi0($))return U0($);if(typeof $==="object"&&$!==null&&!pQ($)&&Object.values($).some((Y)=>xi0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!pQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var Fh,Fb0,E1,L1,wb0,Ve="2026-07-28",b7,we,Nb0,Db0,Ab0,Ne,De,Pb0,fw,Yc1,Uc1,Ue,Ph,_b0,vb0,nQ,i0,Q1,lw,Pe,lQ,ow,yb0=0,gb0="private",kb0,db0,bw,Ch,je,Ic1,Qc1,sb0,ab0,Rh,iw,jH="2026-07-28",_e,$i0,y$=($)=>eG.safeParse($).success,i7=($)=>$H.safeParse($).success,TH=($)=>SQ.safeParse($).success,tw=($)=>hQ.safeParse($).success,G3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",ze="x-mcp-header",Yi0,Ui0,Ii0,Qi0,dw=-32020,Jc1,Ji0,Ge=!1,Mh="draft-2020-12",Gi0,qi0,Vi0,He,Li0,Di0,he=250,Ai0,Bi0,xe,fe,Pi0,Ti0,be=60000,ji0,Ci0,Ri0,ie,fh,Si0,Kc1,ce=10485760,bh=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??ce}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBufferexceededmaximumsizeof${this._maxBufferSize}bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return ne(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},hi0;var YM=o(()=>{hE();yE();et();gS();Fh=Symbol.for("mcp.sdk.errorBrands");Fb0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return dQ(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return dQ(this,Y)}constructor(Y,U,I){super(U);this.code=Y,this.errorUri=I,this.name="OAuthError",Nh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},E1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),L1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return dQ(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v=>SdkError.isInstance(v)`");return dQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",Nh(this,new.target)}},wb0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};b7=[Ve];we=["task","inputRequests","requestState"];Db0=new Set(["const","enum","default","examples"]),Ab0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Ne={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},De={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Pb0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Yc1=Object.keys(Ne),Uc1=Object.keys(De);Ue={ok:!1,reason:"not-in-era"};Ph={era:"2025-11-25",hasRequestMethod:Ae,hasNotificationMethod:Be,validateRequest:($,Y)=>uw(jb0($),Y),validateResult:($,Y)=>uw(Eb0($),Y),validateNotification:($,Y)=>uw(Cb0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ue,validateInputResponse:()=>Ue,samplingResultVariant:($,Y)=>{let U=Me();return uw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=Fe($),I=U.structuredContent;if(I===void 0)return U;let Q=typeof I!=="object"||I===null||Array.isArray(I),J=Y!==void 0&&Oe(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:I}}},decodeResult($,Y){if(wh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:Qe(U)}}return{kind:"complete",result:Qe(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
*content-type
*Copyright(c)2015DouglasChristopherWilson
*MITLicensed
*/gi0=C0(($)=>{var Y=/;*([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/\\([\u000b\u0020-\u00ff])/g,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=Q;function Q(z){if(!z)throw TypeError("argument string is required");var G=typeof z==="object"?J(z):z;if(typeof G!=="string")throw TypeError("argument string is required to be a string");var H=G.indexOf(";"),W=H!==-1?G.slice(0,H).trim():G.trim();if(!I.test(W))throw TypeError("invalid media type");var X=new K(W.toLowerCase());if(H!==-1){var Z,q,V;Y.lastIndex=H;while(q=Y.exec(G)){if(q.index!==H)throw TypeError("invalid parameter format");if(H+=q[0].length,Z=q[1].toLowerCase(),V=q[2],V.charCodeAt(0)===34){if(V=V.slice(1,-1),V.indexOf("\\")!==-1)V=V.replace(U,"$1")}X.parameters[Z]=V}if(H!==G.length)throw TypeError("invalid parameter format")}return X}function J(z){var G;if(typeof z.getHeader==="function")G=z.getHeader("content-type");else if(typeof z.headers==="object")G=z.headers&&z.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function K(z){this.parameters=Object.create(null),this.type=z}}),zc1=XV(gi0(),1);yi0=/^[A-Za-z0-9._-]{1,128}$/});function ih($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Un0(Y),Y}var ew,pe,F1,v1,V5,YM,ii0,me,le,$M,ci0,L5,ni0,di0,oe,pi0,UM,mQ,EH,lQ,IM,mi0,re,li0,oi0,ri0,ch,si0,nh,se,ai0,ti0,ei0,$c0,Yc0,Uc0,Ic0,Qc0,dh,Jc0,Kc0,zc0,ae,te,ee,Gc0,Hc0,Wc0,ph,Xc0,$00,Zc0,qc0,Vc0,Lc0,Fc0,wc0,Mc0,Oc0,Y00,Nc0,U00,I00,Q00,Dc0,mh,Bc0,J00,K00,z00,Ac0,Pc0,G00,Tc0,Ec0,jc0,H00,Cc0,Rc0,W00,_c0,vc0,Sc0,hc0,gc0,yc0,kc0,xc0,fc0,uc0,bc0,ic0,cc0,nc0,dc0,pc0,mc0,lc0,oc0,rc0,sc0,ac0,tc0,X00,ec0,$n0,Yn0,Un0,QM=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=ih($n0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=dr($,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(Y==="2020-12")return this.ajv;if(Y==="2019-09")return this._ajv2019??=ih(ec0.Ajv2019);return this._ajvDraft7??=ih(X00.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(I)=>{return U(I)?{valid:!0,data:I,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},Oc1;var Z00=m(()=>{vE();SE();ew=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.regexpCode=$.getEsmExportName=$.getProperty=$.safeStringify=$.stringify=$.strConcat=$.addCodeArg=$.str=$._=$.nil=$._Code=$.Name=$.IDENTIFIER=$._CodeOrName=void 0;var Y=class{};$._CodeOrName=Y,$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var U=class extends Y{constructor(F){super();if(!$.IDENTIFIER.test(F))throw Error("CodeGen: name must be a valid identifier");this.str=F}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var I=class extends Y{constructor(F){super();this._items=typeof F==="string"?[F]:F}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let F=this._items[0];return F===""||F==='""'}get str(){var F;return(F=this._str)!==null&&F!==void 0?F:this._str=this._items.reduce((N,O)=>`${N}${O}`,"")}get names(){var F;return(F=this._names)!==null&&F!==void 0?F:this._names=this._items.reduce((N,O)=>{if(O instanceof U)N[O.str]=(N[O.str]||0)+1;return N},{})}};$._Code=I,$.nil=new I("");function Q(F,...N){let O=[F[0]],D=0;while(D<N.length)z(O,N[D]),O.push(F[++D]);return new I(O)}$._=Q;let J=new I("+");function K(F,...N){let O=[q(F[0])],D=0;while(D<N.length)O.push(J),z(O,N[D]),O.push(J,q(F[++D]));return G(O),new I(O)}$.str=K;function z(F,N){if(N instanceof I)F.push(...N._items);else if(N instanceof U)F.push(N);else F.push(X(N))}$.addCodeArg=z;function G(F){let N=1;while(N<F.length-1){if(F[N]===J){let O=H(F[N-1],F[N+1]);if(O!==void 0){F.splice(N-1,3,O);continue}F[N++]="+"}N++}}function H(F,N){if(N==='""')return F;if(F==='""')return N;if(typeof F=="string"){if(N instanceof U||F[F.length-1]!=='"')return;if(typeof N!="string")return`${F.slice(0,-1)}${N}"`;if(N[0]==='"')return F.slice(0,-1)+N.slice(1);return}if(typeof N=="string"&&N[0]==='"'&&!(F instanceof U))return`"${F}${N.slice(1)}`}function W(F,N){return N.emptyStr()?F:F.emptyStr()?N:K`${F}${N}`}$.strConcat=W;function X(F){return typeof F=="number"||typeof F=="boolean"||F===null?F:q(Array.isArray(F)?F.join(","):F)}function Z(F){return new I(q(F))}$.stringify=Z;function q(F){return JSON.stringify(F).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(F){return typeof F=="string"&&$.IDENTIFIER.test(F)?new I(`.${F}`):Q`[${F}]`}$.getProperty=V;function w(F){if(typeof F=="string"&&$.IDENTIFIER.test(F))returnnewI(`${F}`);throwError(`CodeGen: invalid export name: ${F}, use explicit $id name mapping`)}$.getEsmExportName=w;functionM(F){returnneLine truncated
deps:${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);K(G,H),z(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function K(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let w=H[V];if(w.length===0)continue;let M=(0,I.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:w.length,deps:w.join(", ")}),Z.allErrors)W.if(M,()=>{for(let F of w)(0,I.checkReportMissingProp)(G,F)});else W.if(Y._`${M}&&(${(0,I.checkMissingProp)(G,w,q)})`),(0,I.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=K;function z(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let w in H){if((0,U.alwaysValidSchema)(q,H[w]))continue;W.if((0,I.propertyInData)(W,X,w,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:w},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=z,$.default=Q}),Xc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),U=v1(),I={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName:${Q.propertyName}}`},code(Q){let{gen:J,schema:K,data:z,it:G}=Q;if((0,U.alwaysValidSchema)(G,K))return;let H=J.name("valid");J.forIn("key",z,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=I}),$00=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L5(),U=F1(),I=V5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:K})=>U._`{additionalProperty:${K.additionalProperty}}`},code(K){let{gen:z,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=K;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let w=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);F(),K.ok(U._`${X}===${I.default.errors}`);function F(){z.forIn("key",W,(T)=>{if(!w.length&&!M.length)D(T);else z.if(N(T),()=>D(T))})}function N(T){let B;if(w.length>8){let E=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");B=(0,Y.isOwnProperty)(z,E,T)}else if(w.length)B=(0,U.or)(...w.map((E)=>U._`${T}===${E}`));else B=U.nil;if(M.length)B=(0,U.or)(B,...M.map((E)=>U._`${(0,Y.usePattern)(K,E)}.test(${T})`));return(0,U.not)(B)}function O(T){z.code(U._`delete${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(K.setParams({additionalProperty:T}),K.error(),!q)z.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let B=z.name("valid");if(V.removeAdditional==="failing")P(T,B,!1),z.if((0,U.not)(B),()=>{K.reset(),O(T)});else if(P(T,B),!q)z.if((0,U.not)(B),()=>z.break())}}function P(T,B,E){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(E===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});K.subschema(C,B)}}};$.default=J}),Zc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=mQ(),U=L5(),I=v1(),Q=$00(),J={keyword:"properties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,parentSchema:H,data:W,it:X}=K;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let F of Z)X.definedProperties.add(F);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=I.mergeEvaluated.props(z,(0,I.toHash)(Z),X.props);let q=Z.filter((F)=>!(0,I.alwaysValidSchema)(X,G[F]));if(q.length===0)return;let V=z.name("valid");for(let F of q){if(w(F))M(F);else{if(z.if((0,U.propertyInData)(z,W,F,X.opts.ownProperties)),M(F),!X.allErrors)z.else().var(V,!0);z.endIf()}K.it.definedProperties.add(F),K.ok(V)}function w(F){return X.opts.useDefaults&&!X.compositeRule&&G[F].default!==void 0}function M(F){K.subschema({keyword:"properties",schemaProp:F,dataProp:F},V)}}};$.default=J}),qc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L5(),U=F1(),I=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,data:H,parentSchema:W,it:X}=K,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,I.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let w=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=z.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(z,X.props);let{props:F}=X;N();function N(){for(let P of q){if(w)O(P);if(X.allError
Line truncated
`)}openNode($,Y){let U=this.tos,I=this._xml;if(U&&this.open)I.push(">");this._stack.push($),I.push("<"),I.push($),Ix(I,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)k70(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Ix(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(y70.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}Qx.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};x70.exports=Qx});var Jx=j((M01)=>{var f70=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function w01($){if(typeof $==="string")return $;if(f70)return f70.decode($);return $.toString()}M01.bufferToString=w01});var n70=j((b70)=>{Object.defineProperty(b70,"__esModule",{value:!0});b70.CHAR=`
`,$=this.i;break;case f11:{let{entityReturnState:U}=this,I=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(I==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(I),this.entity="";if(U!==k8||this.textHandler!==void 0)this.text+=Q;break $}case b4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(cW($))this.state=h11,this.unget(),this.xmlDeclPossible=!1;else switch($){case MN:this.state=k11,this.xmlDeclPossible=!1;break;case Z20:this.state=A11,this.openWakaBang="",this.xmlDeclPossible=!1;break;case $8:this.state=C11;break;default:this.fail("disallowed character in tag name"),this.state=k8,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=Lx,this.openWakaBang="";break;case"--":this.state=Vx,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Xx,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(wN))this.state=P11}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===wN)this.state=T11,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=Vx}sCommentEnded(){let $=this.getCodeNorm();if($!==R6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=Vx;else this.state=k8}sCData(){if(this.captureToChar(fJ))this.state=E11}sCDataEnding(){let $=this.getCodeNorm();if($===fJ)this.state=j11;else this.text+=`]${String.fromCodePoint($)}`,this.state=Lx}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case R6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=k8;break}case fJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=Lx}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J20;else if($===$8||t8($))this.fail("processing instruction without a target."),this.state=$===$8?FN:Fx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J20}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===b4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let I=U===$8;if(I||t8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=I?NU:K20}else this.state=I?FN:Fx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===$8)this.state=FN;else if(!t8($))this.text=String.fromCodePoint($)}else if(this.captureToChar($8))this.state=FN}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===R6){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=k8}else if(Y===$8)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=Fx;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===$8){this.state=NU;return}if($!==b4)this.state=R11,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(i11);if($===$8){this.state=NU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(t8($)||$===xJ))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=$===xJ?z20:_11}sXMLDeclEq(){let $=this.getCodeNorm();if($===$8){this.state=NU,this.fail("XML declaration is incomplete.");return}if(t8($))return;if($!==xJ)this.fail("value required.");this.state=z20}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===$8){this.state=NU,this.fail("XML declaration is incomplete.");return}if(t8($))return;if(!ON($))this.fail("value must be quoted."),this.q=X20;else this.q=$;this.state=v11}sXMLDeclValue(){let $=this.captureTo([this.q,$8]);if($===$8){this.state=NU,this.text="",this.fail("XML declaration is incomplete.");return}if($===b4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver
Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(M21.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let I=`${O21.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(I.indexOf(Q.quote)!==-1)return this.quoteField(I.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(I.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(I);return I}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}eJ.FieldFormatter=az0});var tf=j((tz0)=>{Object.defineProperty(tz0,"__esModule",{value:!0});tz0.isSyncTransform=void 0;tz0.isSyncTransform=($)=>$.length===1});var YG0=j(($K)=>{var $G0=$K&&$K.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty($K,"__esModule",{value:!0});$K.RowFormatter=void 0;var D21=$G0(eN()),B21=$G0(cz0()),A21=af(),P21=tf();class hU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new A21.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(hU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(P21.isSyncTransform($))return(Y,U)=>{let I=null;try{I=$(Y)}catch(Q){return U(Q)}return U(null,I)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!D21.default($))throw TypeError("The transform should be a function");this._rowTransform=hU.createTransform($)}format($,Y){this.callTransformer($,(U,I)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(I){let{shouldFormatColumns:J,headers:K}=this.checkHeaders(I);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)Q.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(J){let z=this.gatherColumns(I);Q.push(this.formatColumns(z,!1))}}return Y(null,Q)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=hU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!B21.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(hU.isRowHashArray($))return this.headers.map((Y,U)=>{let I=$[U];if(I)return I[1];return""});if(hU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((Q,J)=>this.fieldFormatter.format(Q,J,Y)).join(this.formatterOptions.delimiter),{rowCount:I}=this;if(this.rowCount+=1,I)return[this.formatterOptions.rowDelimiter,U].join("");return U}}$K.RowFormatter=hU});var UG0=j((ZD)=>{Object.defineProperty(ZD,"__esModule",{value:!0});ZD.FieldFormatter=ZD.RowFormatter=void 0;var T21=YG0();Object.defineProperty(ZD,"RowFormatter",{enumerable:!0,get:function(){return T21.RowFormatter}});var E21=af();Object.defineProperty(ZD,"FieldFormatter",{enumerable:!0,get:function(){return E21.FieldFormatter}})});var ef=j((QG0)=>{Object.defineProperty(QG0,"__esModule",{value:!0});QG0.CsvFormatterStream=void 0;var C21=K0("stream"),R21=UG0();class IG0 extends C21.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new R21.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let I=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return I=!0,U(Q);if(J)J.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return I=!0,U()})}catch(Q){if(I)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return $()})}}QG0.CsvFormatterStream=IG0});var zG0=j((a1)=>{var KG0=a1&&a1.__createBinding||(Object.create?function($,Y,U,I){if(I===void 0)I=U;Object.defineProperty($,I,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,I){if(I===void 0)I=U;$[I]=Y[U]}),_21=a1&&a1.__setModuleDefault||(Object.create?function($,Y){O
Line truncated
deps:${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);K(G,H),z(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function K(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let w=H[V];if(w.length===0)continue;let M=(0,I.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:w.length,deps:w.join(", ")}),Z.allErrors)W.if(M,()=>{for(let F of w)(0,I.checkReportMissingProp)(G,F)});else W.if(Y._`${M}&&(${(0,I.checkMissingProp)(G,w,q)})`),(0,I.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=K;function z(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let w in H){if((0,U.alwaysValidSchema)(q,H[w]))continue;W.if((0,I.propertyInData)(W,X,w,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:w},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=z,$.default=Q}),Hc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),U=S1(),I={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName:${Q.propertyName}}`},code(Q){let{gen:J,schema:K,data:z,it:G}=Q;if((0,U.alwaysValidSchema)(G,K))return;let H=J.name("valid");J.forIn("key",z,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=I}),ee=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=M5(),U=F1(),I=w5(),Q=S1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:K})=>U._`{additionalProperty:${K.additionalProperty}}`},code(K){let{gen:z,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=K;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let w=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);F(),K.ok(U._`${X}===${I.default.errors}`);function F(){z.forIn("key",W,(T)=>{if(!w.length&&!M.length)D(T);else z.if(N(T),()=>D(T))})}function N(T){let A;if(w.length>8){let E=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");A=(0,Y.isOwnProperty)(z,E,T)}else if(w.length)A=(0,U.or)(...w.map((E)=>U._`${T}===${E}`));else A=U.nil;if(M.length)A=(0,U.or)(A,...M.map((E)=>U._`${(0,Y.usePattern)(K,E)}.test(${T})`));return(0,U.not)(A)}function O(T){z.code(U._`delete${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(K.setParams({additionalProperty:T}),K.error(),!q)z.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=z.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),z.if((0,U.not)(A),()=>{K.reset(),O(T)});else if(P(T,A),!q)z.if((0,U.not)(A),()=>z.break())}}function P(T,A,E){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(E===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});K.subschema(C,A)}}};$.default=J}),Wc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=oQ(),U=M5(),I=S1(),Q=ee(),J={keyword:"properties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,parentSchema:H,data:W,it:X}=K;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let F of Z)X.definedProperties.add(F);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=I.mergeEvaluated.props(z,(0,I.toHash)(Z),X.props);let q=Z.filter((F)=>!(0,I.alwaysValidSchema)(X,G[F]));if(q.length===0)return;let V=z.name("valid");for(let F of q){if(w(F))M(F);else{if(z.if((0,U.propertyInData)(z,W,F,X.opts.ownProperties)),M(F),!X.allErrors)z.else().var(V,!0);z.endIf()}K.it.definedProperties.add(F),K.ok(V)}function w(F){return X.opts.useDefaults&&!X.compositeRule&&G[F].default!==void 0}function M(F){K.subschema({keyword:"properties",schemaProp:F,dataProp:F},V)}}};$.default=J}),Xc0=_0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=M5(),U=F1(),I=S1(),Q=S1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,data:H,parentSchema:W,it:X}=K,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,I.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let w=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=z.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(z,X.props);let{props:F}=X;N();function N(){for(let P of q){if(w)O(P);if(X.allErrors)
Line truncated
`)}openNode($,Y){let U=this.tos,I=this._xml;if(U&&this.open)I.push(">");this._stack.push($),I.push("<"),I.push($),Jx(I,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)g70(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Jx(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(y70.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}Kx.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};k70.exports=Kx});var zx=j((F01)=>{var x70=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function L01($){if(typeof $==="string")return $;if(x70)return x70.decode($);return $.toString()}F01.bufferToString=L01});var c70=j((u70)=>{Object.defineProperty(u70,"__esModule",{value:!0});u70.CHAR=`
`,$=this.i;break;case k11:{let{entityReturnState:U}=this,I=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(I==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(I),this.entity="";if(U!==f8||this.textHandler!==void 0)this.text+=Q;break $}case i4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(pW($))this.state=v11,this.unget(),this.xmlDeclPossible=!1;else switch($){case DN:this.state=y11,this.xmlDeclPossible=!1;break;case X20:this.state=D11,this.openWakaBang="",this.xmlDeclPossible=!1;break;case Y8:this.state=E11;break;default:this.fail("disallowed character in tag name"),this.state=f8,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=wx,this.openWakaBang="";break;case"--":this.state=Fx,this.openWakaBang="";break;case"DOCTYPE":if(this.state=qx,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(NN))this.state=A11}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===NN)this.state=B11,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=Fx}sCommentEnded(){let $=this.getCodeNorm();if($!==_6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=Fx;else this.state=f8}sCData(){if(this.captureToChar(bJ))this.state=P11}sCDataEnding(){let $=this.getCodeNorm();if($===bJ)this.state=T11;else this.text+=`]${String.fromCodePoint($)}`,this.state=wx}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case _6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=f8;break}case bJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=wx}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=Q20;else if($===Y8||$$($))this.fail("processing instruction without a target."),this.state=$===Y8?ON:Mx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=Q20}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===i4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let I=U===Y8;if(I||$$(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=I?AU:J20}else this.state=I?ON:Mx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===Y8)this.state=ON;else if(!$$($))this.text=String.fromCodePoint($)}else if(this.captureToChar(Y8))this.state=ON}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===_6){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=f8}else if(Y===Y8)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=Mx;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===Y8){this.state=AU;return}if($!==i4)this.state=j11,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(u11);if($===Y8){this.state=AU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!($$($)||$===uJ))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=$===uJ?K20:C11}sXMLDeclEq(){let $=this.getCodeNorm();if($===Y8){this.state=AU,this.fail("XML declaration is incomplete.");return}if($$($))return;if($!==uJ)this.fail("value required.");this.state=K20}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===Y8){this.state=AU,this.fail("XML declaration is incomplete.");return}if($$($))return;if(!AN($))this.fail("value must be quoted."),this.q=W20;else this.q=$;this.state=R11}sXMLDeclValue(){let $=this.captureTo([this.q,Y8]);if($===Y8){this.state=AU,this.text="",this.fail("XML declaration is incomplete.");return}if($===i4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new _6($,Y).found}function _6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See:https://github.com/isaacs/node-glob/issues/167`);return new v6($,Y).found}function v6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+Z0[A0-1];break}}}var B1="a promise was created in a "+S+"handler "+W0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(B1,!0,A)}}function h(Q0,A){var S=Q0+" is deprecated and will be removed in a future version.";if(A)S+=" Use "+A+" instead.";return o(S)}function o(Q0,A,S){if(!B0.warnings)return;var u=new Q(Q0),s;if(A)S._attachExtraTrace(u);else if(B0.longStackTraces&&(s=$._peekContext()))s.attachExtraTrace(u);else{var W0=r0(u);u.stack=W0.message+`
`+Z0[B0-1];break}}}var B1="a promise was created in a "+S+"handler "+W0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(B1,!0,B)}}function g(Q0,B){var S=Q0+" is deprecated and will be removed in a future version.";if(B)S+=" Use "+B+" instead.";return c(S)}function c(Q0,B,S){if(!D0.warnings)return;var u=new Q(Q0),s;if(B)S._attachExtraTrace(u);else if(D0.longStackTraces&&(s=$._peekContext()))s.attachExtraTrace(u);else{var W0=r0(u);u.stack=W0.message+`
`);var M=Object(w).yieldHandler,F=q,N=Error().stack;return function(){var O=V.apply(this,arguments),D=new F(void 0,void 0,M,N),P=D.promise();return D._generator=O,D._promiseFulfilled(void 0),P}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new z("expecting a function but got "+G.classString(V));X.push(V)},$.spawn=function(V){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunctionmustbeafunction
`)},Y=function(){return new g.PromiseInspection(this._target())},U=function(k){return g.reject(new X(k))};function I(){}var Q={},J=O4(),K;if(J.isNode)K=function(){var k=process.domain;if(k===void 0)k=null;return k};else K=function(){return null};J.notEnumerableProp(g,"_getDomain",K);var z=QI(),G=Ew0(),H=new G;z.defineProperty(g,"_async",{value:H});var W=y3(),X=g.TypeError=W.TypeError;g.RangeError=W.RangeError;var Z=g.CancellationError=W.CancellationError;g.TimeoutError=W.TimeoutError,g.OperationalError=W.OperationalError,g.RejectionError=W.OperationalError,g.AggregateError=W.AggregateError;var q=function(){},V={},w={},M=vw0()(g,q),F=hw0()(g,q,M,U,I),N=yw0()(g),O=N.create,D=xw0()(g,N),P=D.CapturedTrace,T=uw0()(g,M),B=iw0()(w),E=cc(),C=J.errorObj,i=J.tryCatch;function x(k,p){if(typeof p!=="function")throw new X("expecting a function but got "+J.classString(p));if(k.constructor!==g)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
`)},Y=function(){return new h.PromiseInspection(this._target())},U=function(k){return h.reject(new X(k))};function I(){}var Q={},J=N4(),K;if(J.isNode)K=function(){var k=process.domain;if(k===void 0)k=null;return k};else K=function(){return null};J.notEnumerableProp(h,"_getDomain",K);var z=KI(),G=Tw0(),H=new G;z.defineProperty(h,"_async",{value:H});var W=f3(),X=h.TypeError=W.TypeError;h.RangeError=W.RangeError;var Z=h.CancellationError=W.CancellationError;h.TimeoutError=W.TimeoutError,h.OperationalError=W.OperationalError,h.RejectionError=W.OperationalError,h.AggregateError=W.AggregateError;var q=function(){},V={},w={},M=_w0()(h,q),F=Sw0()(h,q,M,U,I),N=yw0()(h),O=N.create,D=kw0()(h,N),P=D.CapturedTrace,T=fw0()(h,M),A=bw0()(w),E=dc(),C=J.errorObj,i=J.tryCatch;function x(k,m){if(typeof m!=="function")throw new X("expecting a function but got "+J.classString(m));if(k.constructor!==h)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function g(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}g.prototype.toString=function(){return"[object Promise]"},g.prototype.caught=g.prototype.catch=function(k){var p=arguments.length;if(p>1){var a=Array(p-1),$0=0,y;for(y=0;y<p-1;++y){var d=arguments[y];if(J.isObject(d))a[$0++]=d;else return U("expecting an object but got A catch statement predicate "+J.classString(d))}return a.length=$0,k=arguments[y],this.then(void 0,B(a,k,this))}return this.then(void 0,k)},g.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},g.prototype.then=function(k,p){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof p!=="function"){var a=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)a+=", "+J.classString(p);this._warn(a)}return this._then(k,p,void 0,void 0,void 0)},g.prototype.done=function(k,p){var a=this._then(k,p,void 0,void 0,void 0);a._setIsFinal()},g.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},g.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},g.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},g.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},g.getNewLibraryCopy=dc.exports,g.is=function(k){return k instanceof g},g.fromNode=g.fromCallback=function(k){var p=new g(q);p._captureStackTrace();var a=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=i(k)(E(p,a));if($0===C)p._rejectCallback($0.e,!0);if(!p._isFateSealed())p._setAsyncGuaranteed();return p},g.all=function(k){return new F(k).promise()},g.cast=function(k){var p=M(k);if(!(p instanceof g))p=new g(q),p._captureStackTrace(),p._setFulfilled(),p._rejectionHandler0=k;return p},g.resolve=g.fulfilled=g.cast,g.reject=g.rejected=function(k){var p=new g(q);return p._captureStackTrace(),p._rejectCallback(k,!0),p},g.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},g.prototype._then=function(k,p,a,$0,y){var d=y!==void 0,Y0=d?y:new g(q),h=this._target(),o=h._bitField;if(!d){if(Y0._propagateFrom(this,3),Y0._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((o&50397184)!==0)$0=this._boundValue();else $0=h===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,Y0)}var e=K();if((o&50397184)!==0){var w0,N0,_0=h._settlePromiseCtx;if((o&33554432)!==0)N0=h._rejectionHandler0,w0=k;else if((o&16777216)!==0)N0=h._fulfillmentHandler0,w0=p,h._unsetRejectionIsUnhandled();else _0=h._settlePromiseLateCancellationObserver,N0=new Z("late cancellation observer"),h._attachExtraTrace(N0),w0=p;H.invoke(_0,h,{handler:e===null?w0:typeof w0==="function"&&J.domainBind(e,w0),promise:Y0,receiver:$0,value:N0})}else h._addCallbacks(k,p,Y0,$0,e);return Y0},g.prototype._length=function(){return this._bitField&65535},g.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},g.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},g.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},g.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},g.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},g.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},g.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},g.prototype._isFinal=function(){return(this._bitField&4194304)>0},g.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},g.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},g.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},g.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},g.prototype._receiverAt=function(k){var p=k===0?this._receiver0:this[k*4-4+3];if(p===Q)return;else if(p===void 0&&this._isBound())return this._boundValue();return p},g.prototype._promiseAt=function(k){return this[k*4-4+2]},g.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},g.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},g.prototype._boundValue=function(){},g.prototype._migrateCallback0=function(k){var{_bitField:p,_fulfillmentHand
Line truncated
`)}function h(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}h.prototype.toString=function(){return"[object Promise]"},h.prototype.caught=h.prototype.catch=function(k){var m=arguments.length;if(m>1){var t=Array(m-1),$0=0,y;for(y=0;y<m-1;++y){var p=arguments[y];if(J.isObject(p))t[$0++]=p;else return U("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=$0,k=arguments[y],this.then(void 0,A(t,k,this))}return this.then(void 0,k)},h.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},h.prototype.then=function(k,m){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof m!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)t+=", "+J.classString(m);this._warn(t)}return this._then(k,m,void 0,void 0,void 0)},h.prototype.done=function(k,m){var t=this._then(k,m,void 0,void 0,void 0);t._setIsFinal()},h.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},h.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},h.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},h.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},h.getNewLibraryCopy=mc.exports,h.is=function(k){return k instanceof h},h.fromNode=h.fromCallback=function(k){var m=new h(q);m._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=i(k)(E(m,t));if($0===C)m._rejectCallback($0.e,!0);if(!m._isFateSealed())m._setAsyncGuaranteed();return m},h.all=function(k){return new F(k).promise()},h.cast=function(k){var m=M(k);if(!(m instanceof h))m=new h(q),m._captureStackTrace(),m._setFulfilled(),m._rejectionHandler0=k;return m},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(k){var m=new h(q);return m._captureStackTrace(),m._rejectCallback(k,!0),m},h.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},h.prototype._then=function(k,m,t,$0,y){var p=y!==void 0,Y0=p?y:new h(q),g=this._target(),c=g._bitField;if(!p){if(Y0._propagateFrom(this,3),Y0._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((c&50397184)!==0)$0=this._boundValue();else $0=g===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,Y0)}var e=K();if((c&50397184)!==0){var V0,j0,A0=g._settlePromiseCtx;if((c&33554432)!==0)j0=g._rejectionHandler0,V0=k;else if((c&16777216)!==0)j0=g._fulfillmentHandler0,V0=m,g._unsetRejectionIsUnhandled();else A0=g._settlePromiseLateCancellationObserver,j0=new Z("late cancellation observer"),g._attachExtraTrace(j0),V0=m;H.invoke(A0,g,{handler:e===null?V0:typeof V0==="function"&&J.domainBind(e,V0),promise:Y0,receiver:$0,value:j0})}else g._addCallbacks(k,m,Y0,$0,e);return Y0},h.prototype._length=function(){return this._bitField&65535},h.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},h.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},h.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},h.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},h.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},h.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},h.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},h.prototype._isFinal=function(){return(this._bitField&4194304)>0},h.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},h.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},h.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},h.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},h.prototype._receiverAt=function(k){var m=k===0?this._receiver0:this[k*4-4+3];if(m===Q)return;else if(m===void 0&&this._isBound())return this._boundValue();return m},h.prototype._promiseAt=function(k){return this[k*4-4+2]},h.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},h.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},h.prototype._boundValue=function(){},h.prototype._migrateCallback0=function(k){var{_bitField:m,_fulfillmentHand
Line truncated
`,{mode:384}),Y}function gd($){let Y=XA0();for(let U of Y){if(!A$(U))continue;for(let I of GP(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=v9(U,I);try{let J=WP(Q,"utf-8"),K=JSON.parse(J);if(K&&typeof K==="object"&&K.id===$)return Q}catch{}}}return}function S9($,Y){let U=gd($);if(!U)throw Error(`Enterpriseconfignotfound:${$}`);let Q={...JSON.parse(WP(U,"utf-8")),...Y};for(let K of Object.keys(Y))if(Y[K]===void 0)delete Q[K];let J=iZ.parse(Q);return JA0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var hd="SEAL_USE_ENTERPRISES_DIR",KA0="SEAL_HOME_ENTERPRISES_DIR",zA0="SEAL_USE_USER_ENTERPRISES_DIR",GA0="SEAL_HOME_USER_ENTERPRISES_DIR",HA0="SEAL_USE_CONFIG_FILE",WA0="SEAL_HOME_CONFIG_FILE",Gz,HP,zP,IA0;var r$=m(()=>{KP();Gz=v9(XP(),".config","seal-use","enterprises"),HP=v9(XP(),".config","seal-home","enterprises"),zP=v9(XP(),".config","seal-use","config.json"),IA0=v9(XP(),".config","seal-home","config.json")});function l2($,Y,U=[]){let I=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=I??Q;if(J){let z=$.find((W)=>W.id===J);if(z)return z;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-useconfigmodestateful` to enable a default enterprise.");let K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{existsSync as yd,mkdirSync as iB1,readFileSync as cB1,renameSync as nB1,unlinkSync as dB1,writeFileSync as pB1}from"node:fs";import{homedir as mB1}from"node:os";import{dirname as lB1,join as oB1}from"node:path";function nZ(){let $=process.env[rB1]?.trim();if($)return $;return sB1}function qA0($=new Date){return $.toISOString().slice(0,10)}function VA0($=kd,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function LA0($=nZ()){if(!yd($))return{};try{let Y=cB1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function aB1($,Y){let U={};for(let[I,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},K=!1;for(let[z,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&z>=Y)J[z]=G,K=!0;if(K)U[I]=J}return U}function tB1($,Y=nZ()){let U=lB1(Y);if(!yd(U))iB1(U,{recursive:!0,mode:448});let I=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{pB1(I,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),nB1(I,Y)}catch(Q){try{if(yd(I))dB1(I)}catch{}throw Q}}function FA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=nZ(),I=LA0(U),Q=qA0(Y),J=VA0(kd,Y),K=aB1(I,J);K[$]=K[$]||{},K[$][Q]=(K[$][Q]??0)+1,tB1(K,U)}catch{}}function eB1($,Y=kd,U=new Date){let I=new Map;try{let Q=LA0(),J=VA0(Y,U),K=qA0(U),z=$??Object.keys(Q);for(let G of z){let H=Q[G];if(!H){I.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=K&&typeof Z==="number")W+=Z;I.set(G,W)}}catch{if($)for(let Q of $)I.set(Q,0)}return I}function wA0($,Y,U){let I=U??eB1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let K=I.get(Q.id)??0,z=I.get(J.id)??0;if(K!==z)return z-K;let G=Q.name??Q.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return Q.id.localeCompare(J.id)})}var rB1="SEAL_USE_USAGE_FILE",sB1,kd=7;var ZP=m(()=>{sB1=oB1(mB1(),".config","seal-use","usage.json")});var G8={};V8(G8,{withApprovalRunFilters:()=>PA1,toDate:()=>od,timestampOf:()=>ud,summarizeSimulationBatch:()=>zA1,summarizeRunBridge:()=>ZA1,summarizeRuleVersion:()=>qA1,summarizeApprovalRuns:()=>GA1,summarizeApprovalRunResult:()=>wP,summarizeApprovalRunDocument:()=>AA0,summarizeApprovalRunDetail:()=>WA1,summarizeApprovalRun:()=>rZ,stringifyHumanResultValue:()=>ld,stringFromUnknown:()=>Z4,setPath:()=>PA0,scalarIncludes:()=>VP,runtimeRuleIndex:()=>wA1,runtimeRuleIdToCode:()=>CA0,rulesHaveSameContent:()=>NA0,ruleChangedFields:()=>DA0,resolveSealBaseUrl:()=>NA1,resolveRuleVersionSelector:()=>AA1,resolveRuleVersionForLookup:()=>VA1,resolveRuleVersion:()=>bd,resolveManualApprovalStatus:()=>_A0,resolveApprovalRunForUrl:()=>OA1,redactPreviewValue:()=>mZ,redactIntegrationSecrets:()=>QA1,projectApprovalRules:()=>YA1,presentWebhookIntegration:()=>$A1,prepareApprovalRuns:()=>TA1,pickRunFields:()=>BA0,pickRuleFields:()=>OA0,pickApprovalRuns:()=>BA1,pickApprovalRunCandidate:()=>MA1,parseRuleCodeNumber:()=>J$,parseFieldPaths:()=>HA1,parseDurationMs:()=>IA1,objectContainsScalar:()=>LP,numberFromUnknown:()=>TA0,normalizeUrl:()=>DA1,normalizeRuleStrictness:()=>dd,normalizeRuleCode:()=>pZ,mutationPreview:()=>JA1,matchesRunLookup:()=>jA1,localParts:()=>rd,localDateKey:()=>CA1,isHumanResultKey:()=>id,getPath:()=>s$,getConfiguredSealBaseUrl:()=>MA0,formatRuleCode:()=>r2,formatLocalDateTime:()=>nd,flattenDocumentFields:()=>EA0,firstPath:()=>lZ,firstByLabel:()=>dZ,findRuleInVersion:()=>FA1,findRuleInDraft:()=>LA1,findKeywordLines:()=>fd,findHumanResultValue:()=>FP,filterRunsByHumanResult:()=>RA0,filterRuns:()=>md,extractHumanResult:()=>DI,extractCitedRules:()=>XA1,countPathCandidates:()=>xd,countBy:()=>cd,compactObject:()=>o2,collectInvoiceSummary:()=>jA0,collectInvoiceObjects:()=>oZ,collectDocumentFields:()=>qP,buildSimulationBatchParams:()=>KA1,
Line truncated
`)}function oA0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function rA0($,Y){let U=new Map;for(let I of $.rules){let Q=sZ(I),J=Y==="stable-id"?aA0(Q):aZ(Q.code??Q.ruleCode);if(!J)throw Error(`Ruleversion${$.versionNumber}containsarulewithouta${Y==="stable-id"?"stable rule ID":"code"}.`);if(U.has(J))throw Error(`Ruleversion${$.versionNumber}containsduplicate${Y==="stable-id"?"stable rule ID":"code"}:${J}`);U.set(J,Q)}return U}function lA1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean(aA0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean(aZ(sZ(J).code??sZ(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function tA0($,Y,U={}){let I=lA1($,Y,U.identityMode??"auto"),Q=rA0($,I),J=rA0(Y,I),K=[...new Set([...Q.keys(),...J.keys()])],z=[],G={added:0,removed:0,modified:0,unchanged:0},H=oA0($),W=oA0(Y);for(let Z of K){let q=Q.get(Z),V=J.get(Z),w=q?BI(q,I):void 0,M=V?BI(V,I):void 0,F=!q?"added":!V?"removed":JSON.stringify(w)!==JSON.stringify(M)?"modified":"unchanged";if(G[F]+=1,F==="unchanged"&&!U.includeUnchanged)continue;let N=F==="modified"?[...new Set([...Object.keys(w??{}),...Object.keys(M??{})])].filter((O)=>JSON.stringify(w?.[O])!==JSON.stringify(M?.[O])):void 0;z.push({status:F,ruleId:Z,identityMode:I,...q?{before:q}:{},...V?{after:V}:{},...N?.length?{changedFields:N}:{},...F!=="unchanged"?{diff:mA1(Z,H,W,q,V,I)}:{}})}let X={from:H,to:W,identityMode:I,counts:G,changes:z,unifiedDiff:z.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
`)};if(I==="code"){let Z=K.filter((P)=>Q.has(P)&&J.has(P)).length,q=K.filter((P)=>Q.has(P)&&J.has(P)&&JSON.stringify(BI(Q.get(P),"code"))===JSON.stringify(BI(J.get(P),"code"))).length,V=Q.size,w=J.size,M=Math.min(V,w)?Z/Math.min(V,w):1,F=new Map;for(let[P,T]of Q)F.set(JSON.stringify(BI(T,"code")),P);let N=0;for(let[P,T]of J){let B=F.get(JSON.stringify(BI(T,"code")));if(B&&B!==P)N+=1}let D=(Math.min(V,w)?q/Math.min(V,w):1)>=0.5?"high":q>0||N>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:w,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:N,overlapRatio:M,confidence:D,warning:"Published snapshots do not carry stable IDs; code matching can report reorderings as remove/add or modified rules."}}return X}function td($,Y=20000,U=!1){if(U||$.unifiedDiff.length<=Y)return{...$,truncation:{truncated:!1,maxChars:Y,omittedChars:0,hint:"Use --full only when the complete diff is required."}};let I=$.unifiedDiff.length-Y,Q=`
...[difftruncated:${I}charactersomitted;rerunwith--fullforthecompletediff]`,J=$.changes.map(({before:K,after:z,diff:G,...H})=>({...H,...G?{diff:G.length>Y?`${G.slice(0,Y)}${Q}`:G}:{}}));return{...$,changes:J,unifiedDiff:`${$.unifiedDiff.slice(0,Y)}${Q}`,truncation:{truncated:!0,maxChars:Y,omittedChars:I,hint:"Use --full for the complete diff."}}}var sA0,dA1;var eA0=m(()=>{sA0=["id","ruleId","stableId"],dA1=new Set([...sA0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as oA1,mkdirSync as rA1,readFileSync as sA1,renameSync as aA1,writeFileSync as tA1}from"node:fs";import{homedir as eA1}from"node:os";import{join as $P0}from"node:path";function tZ($){if($===void 0||$===null)return;let Y=String($).trim().toLowerCase().replace(/^rule[-_:]?/,"").replace(/^#/,"");if(!Y)return;return/^\d+$/.test(Y)?String(Number(Y)):Y}function DP($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function YP0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||$P0(eA1(),".config","seal-use","rule-version-snapshots")}function $P1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function UP0($,Y){return $P0(YP0(),`${$P1($)}-v${Y}.json`)}function eZ($,Y,U){let I=new Map,Q=new Map;for(let W of U){let X=tZ(W.code);if(X)I.set(X,[...I.get(X)??[],W]);let Z=DP(W);Q.set(Z,[...Q.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=tZ(W.code),Z=X?I.get(X)??[]:[],q=Q.get(DP(W))??[],V=Z.length===1?Z[0]:q.length===1?q[0]:void 0;if(!V)continue;J.push({stableId:V.id,...W.code!==void 0?{code:W.code}:{},description:W.description,scope:W.scope,strictness:W.strictness})}let K={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:new Date().toISOString(),rules:J},z=YP0();rA1(z,{recursive:!0,mode:448});let G=UP0($,Y.versionNumber),H=`${G}.${process.pid}.tmp`;return tA1(H,`${JSON.stringify(K,null,2)}
`,{mode:384}),Y}function gd($){let Y=WB0();for(let U of Y){if(!T$(U))continue;for(let I of XP(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=y9(U,I);try{let J=qP(Q,"utf-8"),K=JSON.parse(J);if(K&&typeof K==="object"&&K.id===$)return Q}catch{}}}return}function g9($,Y){let U=gd($);if(!U)throw Error(`Enterpriseconfignotfound:${$}`);let Q={...JSON.parse(qP(U,"utf-8")),...Y};for(let K of Object.keys(Y))if(Y[K]===void 0)delete Q[K];let J=dZ.parse(Q);return QB0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var yd="SEAL_USE_ENTERPRISES_DIR",JB0="SEAL_HOME_ENTERPRISES_DIR",KB0="SEAL_USE_USER_ENTERPRISES_DIR",zB0="SEAL_HOME_USER_ENTERPRISES_DIR",GB0="SEAL_USE_CONFIG_FILE",HB0="SEAL_HOME_CONFIG_FILE",Xz,ZP,WP,UB0;var t$=o(()=>{HP();Xz=y9(VP(),".config","seal-use","enterprises"),ZP=y9(VP(),".config","seal-home","enterprises"),WP=y9(VP(),".config","seal-use","config.json"),UB0=y9(VP(),".config","seal-home","config.json")});function r2($,Y,U=[]){let I=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=I??Q;if(J){let z=$.find((W)=>W.id===J);if(z)return z;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-useconfigmodestateful` to enable a default enterprise.");let K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{existsSync as kd,mkdirSync as uA1,readFileSync as bA1,renameSync as iA1,unlinkSync as cA1,writeFileSync as nA1}from"node:fs";import{homedir as dA1}from"node:os";import{dirname as pA1,join as mA1}from"node:path";function mZ(){let $=process.env[lA1]?.trim();if($)return $;return oA1}function ZB0($=new Date){return $.toISOString().slice(0,10)}function qB0($=xd,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function VB0($=mZ()){if(!kd($))return{};try{let Y=bA1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function rA1($,Y){let U={};for(let[I,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},K=!1;for(let[z,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&z>=Y)J[z]=G,K=!0;if(K)U[I]=J}return U}function sA1($,Y=mZ()){let U=pA1(Y);if(!kd(U))uA1(U,{recursive:!0,mode:448});let I=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{nA1(I,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),iA1(I,Y)}catch(Q){try{if(kd(I))cA1(I)}catch{}throw Q}}function LB0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=mZ(),I=VB0(U),Q=ZB0(Y),J=qB0(xd,Y),K=rA1(I,J);K[$]=K[$]||{},K[$][Q]=(K[$][Q]??0)+1,sA1(K,U)}catch{}}function aA1($,Y=xd,U=new Date){let I=new Map;try{let Q=VB0(),J=qB0(Y,U),K=ZB0(U),z=$??Object.keys(Q);for(let G of z){let H=Q[G];if(!H){I.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=K&&typeof Z==="number")W+=Z;I.set(G,W)}}catch{if($)for(let Q of $)I.set(Q,0)}return I}function FB0($,Y,U){let I=U??aA1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let K=I.get(Q.id)??0,z=I.get(J.id)??0;if(K!==z)return z-K;let G=Q.name??Q.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return Q.id.localeCompare(J.id)})}var lA1="SEAL_USE_USAGE_FILE",oA1,xd=7;var LP=o(()=>{oA1=mA1(dA1(),".config","seal-use","usage.json")});var H8={};L8(H8,{withApprovalRunFilters:()=>AB1,toDate:()=>rd,timestampOf:()=>bd,summarizeSimulationBatch:()=>JB1,summarizeRunBridge:()=>WB1,summarizeRuleVersion:()=>XB1,summarizeApprovalRuns:()=>KB1,summarizeApprovalRunResult:()=>NP,summarizeApprovalRunDocument:()=>AB0,summarizeApprovalRunDetail:()=>GB1,summarizeApprovalRun:()=>tZ,stringifyHumanResultValue:()=>od,stringFromUnknown:()=>q4,setPath:()=>BB0,scalarIncludes:()=>wP,runtimeRuleIndex:()=>LB1,runtimeRuleIdToCode:()=>jB0,rulesHaveSameContent:()=>OB0,ruleChangedFields:()=>NB0,resolveSealBaseUrl:()=>MB1,resolveRuleVersionSelector:()=>DB1,resolveRuleVersionForLookup:()=>ZB1,resolveRuleVersion:()=>id,resolveManualApprovalStatus:()=>RB0,resolveApprovalRunForUrl:()=>wB1,redactPreviewValue:()=>rZ,redactIntegrationSecrets:()=>UB1,projectApprovalRules:()=>eA1,presentWebhookIntegration:()=>tA1,prepareApprovalRuns:()=>BB1,pickRunFields:()=>DB0,pickRuleFields:()=>MB0,pickApprovalRuns:()=>NB1,pickApprovalRunCandidate:()=>FB1,parseRuleCodeNumber:()=>z$,parseFieldPaths:()=>zB1,parseDurationMs:()=>YB1,objectContainsScalar:()=>MP,numberFromUnknown:()=>PB0,normalizeUrl:()=>OB1,normalizeRuleStrictness:()=>pd,normalizeRuleCode:()=>oZ,mutationPreview:()=>IB1,matchesRunLookup:()=>TB1,localParts:()=>sd,localDateKey:()=>EB1,isHumanResultKey:()=>cd,getPath:()=>e$,getConfiguredSealBaseUrl:()=>wB0,formatRuleCode:()=>a2,formatLocalDateTime:()=>dd,flattenDocumentFields:()=>TB0,firstPath:()=>sZ,firstByLabel:()=>lZ,findRuleInVersion:()=>VB1,findRuleInDraft:()=>qB1,findKeywordLines:()=>ud,findHumanResultValue:()=>OP,filterRunsByHumanResult:()=>CB0,filterRuns:()=>ld,extractHumanResult:()=>BI,extractCitedRules:()=>HB1,countPathCandidates:()=>fd,countBy:()=>nd,compactObject:()=>s2,collectInvoiceSummary:()=>EB0,collectInvoiceObjects:()=>aZ,collectDocumentFields:()=>FP,buildSimulationBatchParams:()=>QB1,
Line truncated
`)}function lB0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function oB0($,Y){let U=new Map;for(let I of $.rules){let Q=eZ(I),J=Y==="stable-id"?sB0(Q):$q(Q.code??Q.ruleCode);if(!J)throw Error(`Ruleversion${$.versionNumber}containsarulewithouta${Y==="stable-id"?"stable rule ID":"code"}.`);if(U.has(J))throw Error(`Ruleversion${$.versionNumber}containsduplicate${Y==="stable-id"?"stable rule ID":"code"}:${J}`);U.set(J,Q)}return U}function mB1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean(sB0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean($q(eZ(J).code??eZ(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function aB0($,Y,U={}){let I=mB1($,Y,U.identityMode??"auto"),Q=oB0($,I),J=oB0(Y,I),K=[...new Set([...Q.keys(),...J.keys()])],z=[],G={added:0,removed:0,modified:0,unchanged:0},H=lB0($),W=lB0(Y);for(let Z of K){let q=Q.get(Z),V=J.get(Z),w=q?PI(q,I):void 0,M=V?PI(V,I):void 0,F=!q?"added":!V?"removed":JSON.stringify(w)!==JSON.stringify(M)?"modified":"unchanged";if(G[F]+=1,F==="unchanged"&&!U.includeUnchanged)continue;let N=F==="modified"?[...new Set([...Object.keys(w??{}),...Object.keys(M??{})])].filter((O)=>JSON.stringify(w?.[O])!==JSON.stringify(M?.[O])):void 0;z.push({status:F,ruleId:Z,identityMode:I,...q?{before:q}:{},...V?{after:V}:{},...N?.length?{changedFields:N}:{},...F!=="unchanged"?{diff:pB1(Z,H,W,q,V,I)}:{}})}let X={from:H,to:W,identityMode:I,counts:G,changes:z,unifiedDiff:z.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
`)};if(I==="code"){let Z=K.filter((P)=>Q.has(P)&&J.has(P)).length,q=K.filter((P)=>Q.has(P)&&J.has(P)&&JSON.stringify(PI(Q.get(P),"code"))===JSON.stringify(PI(J.get(P),"code"))).length,V=Q.size,w=J.size,M=Math.min(V,w)?Z/Math.min(V,w):1,F=new Map;for(let[P,T]of Q)F.set(JSON.stringify(PI(T,"code")),P);let N=0;for(let[P,T]of J){let A=F.get(JSON.stringify(PI(T,"code")));if(A&&A!==P)N+=1}let D=(Math.min(V,w)?q/Math.min(V,w):1)>=0.5?"high":q>0||N>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:w,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:N,overlapRatio:M,confidence:D,warning:"Published snapshots do not carry stable IDs; code matching can report reorderings as remove/add or modified rules."}}return X}function ed($,Y=20000,U=!1){if(U||$.unifiedDiff.length<=Y)return{...$,truncation:{truncated:!1,maxChars:Y,omittedChars:0,hint:"Use --full only when the complete diff is required."}};let I=$.unifiedDiff.length-Y,Q=`
...[difftruncated:${I}charactersomitted;rerunwith--fullforthecompletediff]`,J=$.changes.map(({before:K,after:z,diff:G,...H})=>({...H,...G?{diff:G.length>Y?`${G.slice(0,Y)}${Q}`:G}:{}}));return{...$,changes:J,unifiedDiff:`${$.unifiedDiff.slice(0,Y)}${Q}`,truncation:{truncated:!0,maxChars:Y,omittedChars:I,hint:"Use --full for the complete diff."}}}var rB0,nB1;var tB0=o(()=>{rB0=["id","ruleId","stableId"],nB1=new Set([...rB0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as lB1,mkdirSync as oB1,readFileSync as rB1,renameSync as sB1,writeFileSync as aB1}from"node:fs";import{homedir as tB1}from"node:os";import{join as eB0}from"node:path";function Yq($){if($===void 0||$===null)return;let Y=String($).trim().toLowerCase().replace(/^rule[-_:]?/,"").replace(/^#/,"");if(!Y)return;return/^\d+$/.test(Y)?String(Number(Y)):Y}function PP($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function $P0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||eB0(tB1(),".config","seal-use","rule-version-snapshots")}function eB1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function YP0($,Y){return eB0($P0(),`${eB1($)}-v${Y}.json`)}function Uq($,Y,U){let I=new Map,Q=new Map;for(let W of U){let X=Yq(W.code);if(X)I.set(X,[...I.get(X)??[],W]);let Z=PP(W);Q.set(Z,[...Q.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=Yq(W.code),Z=X?I.get(X)??[]:[],q=Q.get(PP(W))??[],V=Z.length===1?Z[0]:q.length===1?q[0]:void 0;if(!V)continue;J.push({stableId:V.id,...W.code!==void 0?{code:W.code}:{},description:W.description,scope:W.scope,strictness:W.strictness})}let K={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:A1(),rules:J},z=$P0();oB1(z,{recursive:!0,mode:448});let G=YP0($,Y.versionNumber),H=`${G}.${process.pid}.tmp`;return aB1(H,`${JSON.stringify(K,null,2)}
@@ -881,66 +881,66 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
}
exportdefaultlintRule;
`}});import{homedir as FP1}from"node:os";import{join as Jp}from"node:path";var wP1,P$,T$;var Kp=m(()=>{wP1=Jp(FP1(),".config","seal-use"),P$=Jp(wP1,"linters"),T$=Jp(P$,"official")});import{existsSync as AI,mkdirSync as MP1,readFileSync as OP1,readdirSync as HP0,rmSync as NP1,unlinkSync as DP1,writeFileSync as BP1}from"node:fs";import{isAbsolute as AP1,join as P8,resolve as PP1}from"node:path";import{pathToFileURL as zP0}from"node:url";function WP0($=T$){let Y=[],U=[];try{if(!AI($))MP1($,{recursive:!0});let I=Object.keys(Ip);for(let[J,K]of Object.entries(Ip)){let z=P8($,J),G=!0;if(AI(z))try{if(OP1(z,"utf8")===K)G=!1}catch{G=!0}if(G)BP1(z,K,"utf8");Y.push(J)}let Q=HP0($,{withFileTypes:!0});for(let J of Q)if(!I.includes(J.name)){let K=P8($,J.name);try{if(J.isDirectory())NP1(K,{recursive:!0,force:!0});else DP1(K);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function XP0($={syncOfficial:!0}){if($.syncOfficial!==!1)WP0();let Y=[{name:"builtin",type:"builtin",path:P8(T$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:P8(T$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:P8(T$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[P$,AP];for(let I of U)if(AI(I))try{let Q=HP0(I,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let K=J.name;if(K.endsWith(".ts")||K.endsWith(".js")||K.endsWith(".mjs")){let z=K.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===z))Y.push({name:z,type:"custom",path:P8(I,K),description:`用户自定义规则校验器(${K})`})}}}catch{}return Y}function TP1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:P8(T$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:P8(T$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:P8(T$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(AP1(Y)||Y.startsWith("./")||Y.startsWith("../")){let I=PP1(Y);if(AI(I))return{path:I};for(let Q of[".ts",".js",".mjs"])if(AI(`${I}${Q}`))return{path:`${I}${Q}`}}let U=[P8(P$,`${Y}.ts`),P8(P$,`${Y}.js`),P8(P$,`${Y}.mjs`),P8(AP,`${Y}.ts`),P8(AP,`${Y}.js`),P8(AP,`${Y}.mjs`)];for(let I of U)if(AI(I))return{path:I};return{}}async function zp($){WP0();let Y=TP1($??"builtin");if(Y.isOfficial){let I=Y.officialKind==="strict"?JP0:Y.officialKind==="hlab"?KP0:Wz,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&AI(J))try{let z=await import(zP0(J).href),G=z.default??z.lintRule??z.linter??z.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:GP0(G,I)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:I}}let U=Y.path;if(!U)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:Wz};try{let Q=await import(zP0(U).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️[linter]自定义校验器"${U}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:Wz};return{name:$??"custom",type:"custom",filePath:U,linter:GP0(J,Wz)}}catch(I){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${U}"失败(语法错误或依赖缺失:${I?.message??I}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:Wz}}}functionGP0($,Y){returnasync(U,I)=>{try{letQ=await$(U,I);if(Q&&typeofQ==="object"&&typeofQ.score==="number"&&Array.isArray(Q.issues))returnQ;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(U,I)}catch(Q){returnconsole.error("⚠️[linter]自定义校验器执行异常:",Q),Y(U,I)}}}varAP;varZP0=m(()=>{Kp();$p();Up();Qp();Yp();AP=P8(process.cwd(),"linters")});asyncfunctionGp($,Y,U){letI=awaitY.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:I.score,passed:I.passed,issues:I.issues,description:$.description}}asyncfunctionqP0($,Y,U,I){letQ=I?.minScore??0,J=I?.level??"all",K=[],z=0;for(letqof$){letV=awaitGp(q,Y,U);z+=V.score;letw=V.issues;if(J==="error")w=V.issues.filter((F)=>F.level==="error");elseif(J==="warning")w=V.issues.filter((F)=>F.level==="warning"||F.level==="error");letM=w.every((F)=>F.level!=="error");if(I?.summary){if(w.length>0)K.push({...V,passed:M,issues:w})}elseK.push({...V,passed:M,issues:w})}letG=$.length,H=G===Line truncated
`,"utf8"),U}function MP0($){return $.map((Y,U)=>{let I=FP0(Y.code),Q;if(I!==void 0)Q=String(I).padStart(4,"0");else if(typeof Y.code==="string"&&Y.code.trim())Q=Y.code.trim().replace(/^#/,"");else Q=String(U).padStart(4,"0");return{id:Y.id,code:Q,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var OP0=()=>{};var O$4,N$4,NP0,D$4,SP1,B$4,A$4,DP0,P$4,T$4,BP0,E$4,j$4,C$4,R$4,_$4,v$4,S$4,h$4,g$4,y$4,k$4,x$4,f$4,u$4,b$4,i$4,c$4,n$4,d$4,p$4,m$4,l$4,o$4,r$4,s$4,a$4,Xp,hP1,gP1,yP1,d3,Xz,t$4,e$4,PP,$54,Y54,U54,I54,Q54,J54,K54,kP1,Zp,z54,G54,H54,W54,X54,Z54,q54,V54,L54,F54,w54,M54,O54,N54,D54,B54,A54,P54,AP0;var PP0=m(()=>{H6();W4();r$();mA0();eA0();ed();Hp();OP0();a$();({presentWebhookIntegration:O$4,getConfiguredSealBaseUrl:N$4,projectApprovalRules:NP0,pickRuleFields:D$4,buildRulePushPlan:SP1,rulesHaveSameContent:B$4,ruleChangedFields:A$4,normalizeRuleStrictness:DP0,parseDurationMs:P$4,redactIntegrationSecrets:T$4,mutationPreview:BP0,redactPreviewValue:E$4,buildSimulationBatchParams:j$4,summarizeSimulationBatch:C$4,summarizeApprovalRun:R$4,summarizeApprovalRuns:_$4,parseFieldPaths:v$4,pickRunFields:S$4,approvalRunMetadata:h$4,summarizeApprovalRunDetail:g$4,summarizeApprovalRunResult:y$4,summarizeApprovalRunDocument:k$4,extractCitedRules:x$4,firstPath:f$4,countPathCandidates:u$4,getPath:b$4,setPath:i$4,compactObject:c$4,asRecord:n$4,numberFromUnknown:d$4,flattenDocumentFields:p$4,collectDocumentFields:m$4,firstByLabel:l$4,collectInvoiceSummary:o$4,collectInvoiceObjects:r$4,findKeywordLines:s$4,summarizeRunBridge:a$4,summarizeRuleVersion:Xp,resolveRuleVersionForLookup:hP1,findRuleInDraft:gP1,findRuleInVersion:yP1,parseRuleCodeNumber:d3,normalizeRuleCode:Xz,runtimeRuleIndex:t$4,runtimeRuleIdToCode:e$4,formatRuleCode:PP,pickApprovalRunCandidate:$54,resolveApprovalRunForUrl:Y54,resolveSealBaseUrl:U54,normalizeUrl:I54,stringFromUnknown:Q54,pickApprovalRuns:J54,timestampOf:K54,resolveRuleVersion:kP1,resolveRuleVersionSelector:Zp,filterRuns:z54,scalarIncludes:G54,objectContainsScalar:H54,filterRunsByHumanResult:W54,withApprovalRunFilters:X54,resolveManualApprovalStatus:Z54,prepareApprovalRuns:q54,approvalRunAliases:V54,extractHumanResult:L54,findHumanResultValue:F54,isHumanResultKey:w54,stringifyHumanResultValue:M54,matchesRunLookup:O54,countBy:N54,localDateKey:D54,formatLocalDateTime:B54,toDate:A54,localParts:P54}=G8),AP0=[{name:"seal_approval_rules_list",description:"列出 Seal 审批规则(默认当前草稿,传 version='latest' 或版本号则列出对应已发布版本);支持 countOnly、fields、limit",parameters:L.object({version:L.string().optional().describe("可选发布版本号或 'latest';不传则读取当前草稿"),countOnly:L.boolean().optional().describe("只返回规则数量,不返回规则列表"),fields:L.array(L.enum(["id","code","tenantId","status","strictness","scope","createdAt","updatedAt","description"])).optional().describe("只返回指定字段;不传则返回完整规则"),limit:L.number().int().nonnegative().optional().describe("最多返回多少条规则;0 可配合 fields 或 countOnly 只取数量"),offset:L.number().int().nonnegative().optional().describe("跳过前多少条规则")}),handler:async($,Y)=>{if(Y.version){let I=await Zp($,Y.version),Q=(I.rules??[]).map((K)=>({id:K.id??String(K.code),tenantId:K.tenantId??"",code:d3(K.code)??K.code,description:K.description,scope:K.scope,strictness:K.strictness,status:typeof K.status==="string"?K.status:"published",createdAt:K.createdAt??I.publishedAt??I.createdAt??0,updatedAt:K.updatedAt??I.publishedAt??I.createdAt??0}));return{...NP0({rules:Q,hasPendingDeletes:!1},Y),versionNumber:I.versionNumber,versionName:I.versionName??null}}let U=await U6($);return NP0(U,Y)}},{name:"seal_approval_rules_clear",description:"清空 Seal 当前草稿审批规则;用于测试环境导入规则前重置草稿规则集",parameters:L.object({dryRun:L.boolean().optional().describe("只预览将删除的规则数量,不执行删除"),recode:L.boolean().optional().describe("删除后尝试重新编排规则编号;失败会作为 warning 返回")}),handler:async($,Y,U)=>{let I=await U6($);if(Y.dryRun)return{...BP0(U,"api/v1/rules",I.rules,[],I.rules.length),corpId:U.corp.id,corpName:U.corp.name,dryRun:!0,beforeCount:I.rules.length,deleted:0,afterCount:I.rules.length,hasPendingDeletes:I.hasPendingDeletes};let Q=[],J=0;for(let H of I.rules)try{await JJ($,H.id),J+=1}catch(W){Q.push({ruleId:H.id,error:r8(W instanceof Error?W.message:String(W))})}let K=[],z;if(J>0&&Y.recode!==!1){if(z=await yM($),z&&typeof z==="object"&&"ok"in z&&z.ok!==!0)K.push("batch-recode did not complete; current rules were still deleted")}let G=await U6($);return{corpId:U.corp.id,corpName:U.corp.name,dryRun:!1,beforeCount:I.rules.length,deleted:J,failed:Q,afterCount:G.rules.length,hasPendingDeletes:G.hasPendingDeletes,warnings:K,recode:z}}},{name:"seal_approval_rule_create",description:"新建 Seal 草稿审批规则",parameters:L.object({
Line truncated
\uD83D\uDC49Nextaction:若您已直接修改远端草稿、仅需发布正式版本,请执行seal-userulespublish"${q}"--corp${U.corp.id}`)}throw Z}let K=Y.confirm!==!0||Y.dryRun===!0,z=await U6($),G=SP1(z.rules,Q.rules);if(K)return{...BP0(U,"api/v1/rules",z.rules,Q.rules.map((Z)=>({description:Z.description,scope:Z.scope??"ALL",strictness:Z.strictness??"MUST_FOLLOW"})),z.rules.length+Q.rules.length),corpId:U.corp.id,dryRun:!0,localFile:Q.resolvedPath,localRulesCount:Q.rules.length,remoteDraftCount:z.rules.length,changes:G,impactCount:G.created.length+G.updated.length+G.deleted.length,preservedRuleIds:[...G.updated.map((Z)=>Z.id),...G.unchanged.map((Z)=>Z.id)],warning:"Incremental mode preserves matched rule IDs and does not recode the draft rule set.",willPublish:Boolean(Y.publish),message:"Preview mode. Use --yes or confirm=true to apply the listed incremental changes to the remote draft."};for(let Z of G.deleted)await JJ($,Z.id);let H=[];for(let Z of G.created){let q=await dH($,{description:Z.description,scope:Z.scope??"ALL",strictness:DP0(Z.strictness)});H.push({id:q.id,description:q.description,code:q.code})}let W=[];for(let Z of G.updated)await Sg($,Z.id,{description:Z.rule.description,scope:Z.rule.scope??"ALL",strictness:DP0(Z.rule.strictness)}),W.push(Z.id);let X=void 0;if(Y.publish){let Z=new Date().toISOString().slice(0,10).replace(/-/g,""),q=Y.versionName||`v-local-${Z}-${Date.now().toString().slice(-4)}`;X=await pH($,q);try{let V=await U6($);eZ(U.corp.id,X.version,V.rules)}catch{}}return{corpId:U.corp.id,dryRun:!1,localFile:Q.resolvedPath,deletedRules:G.deleted.length,createdRules:H.length,updatedRules:W.length,unchangedRules:G.unchanged.length,preservedRuleIds:[...W,...G.unchanged.map((Z)=>Z.id)],recoded:!1,published:X??!1}}},{name:"seal_approval_documents_list",description:"列出 Seal 审批知识文档",parameters:L.object({scenarios:L.array(L.string()).optional().describe("场景过滤"),offset:L.number().int().nonnegative().optional(),limit:L.number().int().positive().optional()}),handler:async($,Y)=>eY($,Y)},{name:"seal_approval_document_get",description:"获取 Seal 审批知识文档详情",parameters:L.object({documentId:L.string().describe("文档 ID")}),handler:async($,Y)=>N40($,Y.documentId)},{name:"seal_approval_document_create",description:"新建 Seal 审批知识文档",parameters:L.object({title:L.string(),purpose:L.string(),content:L.string().describe("正文,通常为 Markdown"),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>kM($,Y)},{name:"seal_approval_document_update",description:"更新 Seal 审批知识文档",parameters:L.object({documentId:L.string(),title:L.string().optional(),purpose:L.string().optional(),content:L.string().optional(),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>{let{documentId:U,...I}=Y;return xM($,U,I)}},{name:"seal_approval_delete_document",description:"删除 Seal 审批知识文档",parameters:L.object({documentId:L.string().describe("知识文档 ID")}),handler:($,Y)=>fM($,Y.documentId)},{name:"seal_approval_search",description:"按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",parameters:L.object({keywords:L.array(L.string()).min(1).describe("关键词组"),matchMode:L.enum(["any","all"]).optional().describe("any 命中任一关键词,all 要求同一行命中全部关键词"),areas:L.array(L.enum(["rules","documents","preferences"])).optional().describe("检索范围"),caseSensitive:L.boolean().optional().describe("是否大小写敏感"),contextLines:L.number().int().nonnegative().optional().describe("返回命中行前后几行,默认 3"),documentLimit:L.number().int().positive().optional().describe("缓存刷新时最多拉取文档数,默认 100"),maxResults:L.number().int().positive().optional().describe("最多返回命中数,默认 50"),refresh:L.boolean().optional().describe("是否跳过 5 分钟内存缓存并强制刷新"),ruleVersionScope:L.enum(["current","all","version"]).optional().describe("规则检索范围,默认 current;all 会检索所有已发布历史版本"),ruleVersionId:L.string().optional().describe("ruleVersionScope=version 时指定版本 ID"),ruleVersionNumber:L.number().int().positive().optional().describe("ruleVersionScope=version 时指定版本号"),latestRuleVersion:L.boolean().optional().describe("ruleVersionScope=version 时取最新已发布版本"),snippetOnly:L.boolean().optional().describe("只返回命中行,不返回前后文"),maxChars:L.number().int().positive().optional().describe("每个文本片段最多返回字符数"),fields:L.array(L.string()).optional().describe("只搜索指定字段
Line truncated
`}});import{homedir as LP1}from"node:os";import{join as Kp}from"node:path";var FP1,E$,j$;var zp=o(()=>{FP1=Kp(LP1(),".config","seal-use"),E$=Kp(FP1,"linters"),j$=Kp(E$,"official")});import{existsSync as TI,mkdirSync as wP1,readFileSync as MP1,readdirSync as GP0,rmSync as OP1,unlinkSync as NP1,writeFileSync as DP1}from"node:fs";import{isAbsolute as AP1,join as E8,resolve as BP1}from"node:path";import{pathToFileURL as KP0}from"node:url";function HP0($=j$){let Y=[],U=[];try{if(!TI($))wP1($,{recursive:!0});let I=Object.keys(Qp);for(let[J,K]of Object.entries(Qp)){let z=E8($,J),G=!0;if(TI(z))try{if(MP1(z,"utf8")===K)G=!1}catch{G=!0}if(G)DP1(z,K,"utf8");Y.push(J)}let Q=GP0($,{withFileTypes:!0});for(let J of Q)if(!I.includes(J.name)){let K=E8($,J.name);try{if(J.isDirectory())OP1(K,{recursive:!0,force:!0});else NP1(K);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function WP0($={syncOfficial:!0}){if($.syncOfficial!==!1)HP0();let Y=[{name:"builtin",type:"builtin",path:E8(j$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:E8(j$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:E8(j$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[E$,EP];for(let I of U)if(TI(I))try{let Q=GP0(I,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let K=J.name;if(K.endsWith(".ts")||K.endsWith(".js")||K.endsWith(".mjs")){let z=K.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===z))Y.push({name:z,type:"custom",path:E8(I,K),description:`用户自定义规则校验器(${K})`})}}}catch{}return Y}function PP1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:E8(j$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:E8(j$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:E8(j$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(AP1(Y)||Y.startsWith("./")||Y.startsWith("../")){let I=BP1(Y);if(TI(I))return{path:I};for(let Q of[".ts",".js",".mjs"])if(TI(`${I}${Q}`))return{path:`${I}${Q}`}}let U=[E8(E$,`${Y}.ts`),E8(E$,`${Y}.js`),E8(E$,`${Y}.mjs`),E8(EP,`${Y}.ts`),E8(EP,`${Y}.js`),E8(EP,`${Y}.mjs`)];for(let I of U)if(TI(I))return{path:I};return{}}async function Gp($){HP0();let Y=PP1($??"builtin");if(Y.isOfficial){let I=Y.officialKind==="strict"?QP0:Y.officialKind==="hlab"?JP0:qz,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&TI(J))try{let z=await import(KP0(J).href),G=z.default??z.lintRule??z.linter??z.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:zP0(G,I)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:I}}let U=Y.path;if(!U)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:qz};try{let Q=await import(KP0(U).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️[linter]自定义校验器"${U}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:qz};return{name:$??"custom",type:"custom",filePath:U,linter:zP0(J,qz)}}catch(I){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${U}"失败(语法错误或依赖缺失:${I?.message??I}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:qz}}}functionzP0($,Y){returnasync(U,I)=>{try{letQ=await$(U,I);if(Q&&typeofQ==="object"&&typeofQ.score==="number"&&Array.isArray(Q.issues))returnQ;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(U,I)}catch(Q){returnconsole.error("⚠️[linter]自定义校验器执行异常:",Q),Y(U,I)}}}varEP;varXP0=o(()=>{zp();Yp();Ip();Jp();Up();EP=E8(process.cwd(),"linters")});asyncfunctionHp($,Y,U){letI=awaitY.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:I.score,passed:I.passed,issues:I.issues,description:$.description}}asyncfunctionZP0($,Y,U,I){letQ=I?.minScore??0,J=I?.level??"all",K=[],z=0;for(letqof$){letV=awaitHp(q,Y,U);z+=V.score;letw=V.issues;if(J==="error")w=V.issues.filter((F)=>F.level==="error");elseif(J==="warning")w=V.issues.filter((F)=>F.level==="warning"||F.level==="error");letM=w.every((F)=>F.level!=="error");if(I?.summary){if(w.length>0)K.push({...V,passed:M,issues:w})}elseK.push({...V,passed:M,issues:w})}letG=$.length,H=G===Line truncated
`,"utf8"),U}function wP0($){return $.map((Y,U)=>{let I=LP0(Y.code),Q;if(I!==void 0)Q=String(I).padStart(4,"0");else if(typeof Y.code==="string"&&Y.code.trim())Q=Y.code.trim().replace(/^#/,"");else Q=String(U).padStart(4,"0");return{id:Y.id,code:Q,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var MP0=()=>{};var T$4,E$4,OP0,j$4,vP1,C$4,R$4,NP0,_$4,v$4,DP0,S$4,h$4,y$4,g$4,k$4,x$4,f$4,u$4,b$4,i$4,c$4,n$4,d$4,p$4,m$4,l$4,o$4,r$4,s$4,a$4,t$4,e$4,$54,Y54,U54,I54,Zp,SP1,hP1,yP1,l3,Vz,Q54,J54,jP,K54,z54,G54,H54,W54,X54,Z54,gP1,qp,q54,V54,L54,F54,w54,M54,O54,N54,D54,A54,B54,P54,T54,E54,j54,C54,R54,_54,AP0;var BP0=o(()=>{W6();X4();t$();pB0();tB0();$p();Wp();MP0();$5();({presentWebhookIntegration:T$4,getConfiguredSealBaseUrl:E$4,projectApprovalRules:OP0,pickRuleFields:j$4,buildRulePushPlan:vP1,rulesHaveSameContent:C$4,ruleChangedFields:R$4,normalizeRuleStrictness:NP0,parseDurationMs:_$4,redactIntegrationSecrets:v$4,mutationPreview:DP0,redactPreviewValue:S$4,buildSimulationBatchParams:h$4,summarizeSimulationBatch:y$4,summarizeApprovalRun:g$4,summarizeApprovalRuns:k$4,parseFieldPaths:x$4,pickRunFields:f$4,approvalRunMetadata:u$4,summarizeApprovalRunDetail:b$4,summarizeApprovalRunResult:i$4,summarizeApprovalRunDocument:c$4,extractCitedRules:n$4,firstPath:d$4,countPathCandidates:p$4,getPath:m$4,setPath:l$4,compactObject:o$4,asRecord:r$4,numberFromUnknown:s$4,flattenDocumentFields:a$4,collectDocumentFields:t$4,firstByLabel:e$4,collectInvoiceSummary:$54,collectInvoiceObjects:Y54,findKeywordLines:U54,summarizeRunBridge:I54,summarizeRuleVersion:Zp,resolveRuleVersionForLookup:SP1,findRuleInDraft:hP1,findRuleInVersion:yP1,parseRuleCodeNumber:l3,normalizeRuleCode:Vz,runtimeRuleIndex:Q54,runtimeRuleIdToCode:J54,formatRuleCode:jP,pickApprovalRunCandidate:K54,resolveApprovalRunForUrl:z54,resolveSealBaseUrl:G54,normalizeUrl:H54,stringFromUnknown:W54,pickApprovalRuns:X54,timestampOf:Z54,resolveRuleVersion:gP1,resolveRuleVersionSelector:qp,filterRuns:q54,scalarIncludes:V54,objectContainsScalar:L54,filterRunsByHumanResult:F54,withApprovalRunFilters:w54,resolveManualApprovalStatus:M54,prepareApprovalRuns:O54,approvalRunAliases:N54,extractHumanResult:D54,findHumanResultValue:A54,isHumanResultKey:B54,stringifyHumanResultValue:P54,matchesRunLookup:T54,countBy:E54,localDateKey:j54,formatLocalDateTime:C54,toDate:R54,localParts:_54}=H8),AP0=[{name:"seal_approval_rules_list",description:"列出 Seal 审批规则(默认当前草稿,传 version='latest' 或版本号则列出对应已发布版本);支持 countOnly、fields、limit",parameters:L.object({version:L.string().optional().describe("可选发布版本号或 'latest';不传则读取当前草稿"),countOnly:L.boolean().optional().describe("只返回规则数量,不返回规则列表"),fields:L.array(L.enum(["id","code","tenantId","status","strictness","scope","createdAt","updatedAt","description"])).optional().describe("只返回指定字段;不传则返回完整规则"),limit:L.number().int().nonnegative().optional().describe("最多返回多少条规则;0 可配合 fields 或 countOnly 只取数量"),offset:L.number().int().nonnegative().optional().describe("跳过前多少条规则")}),handler:async($,Y)=>{if(Y.version){let I=await qp($,Y.version),Q=(I.rules??[]).map((K)=>({id:K.id??String(K.code),tenantId:K.tenantId??"",code:l3(K.code)??K.code,description:K.description,scope:K.scope,strictness:K.strictness,status:typeof K.status==="string"?K.status:"published",createdAt:K.createdAt??I.publishedAt??I.createdAt??0,updatedAt:K.updatedAt??I.publishedAt??I.createdAt??0}));return{...OP0({rules:Q,hasPendingDeletes:!1},Y),versionNumber:I.versionNumber,versionName:I.versionName??null}}let U=await I6($);return OP0(U,Y)}},{name:"seal_approval_rules_clear",description:"清空 Seal 当前草稿审批规则;用于测试环境导入规则前重置草稿规则集",parameters:L.object({dryRun:L.boolean().optional().describe("只预览将删除的规则数量,不执行删除"),recode:L.boolean().optional().describe("删除后尝试重新编排规则编号;失败会作为 warning 返回")}),handler:async($,Y,U)=>{let I=await I6($);if(Y.dryRun)return{...DP0(U,"api/v1/rules",I.rules,[],I.rules.length),corpId:U.corp.id,corpName:U.corp.name,dryRun:!0,beforeCount:I.rules.length,deleted:0,afterCount:I.rules.length,hasPendingDeletes:I.hasPendingDeletes};let Q=[],J=0;for(let H of I.rules)try{await zJ($,H.id),J+=1}catch(W){Q.push({ruleId:H.id,error:a8(W instanceof Error?W.message:String(W))})}let K=[],z;if(J>0&&Y.recode!==!1){if(z=await fM($),z&&typeof z==="object"&&"ok"in z&&z.ok!==!0)K.push("batch-recode did not complete; current rules were still deleted")}let G=await I6($);return{corpId:U.corp.id,corpName:U.corp.name,dryRun:!1,beforeCount:I.rules.length,deleted:J,failed:Q,afterCount:G.rules.length,hasPendingDeletes:G.hasPendingDeletes,warnings:K,recode:z}}},{name:"seal_approval_rule_create",description:"新建 Seal 草稿审批规则",parameters:L.object({
Line truncated
\uD83D\uDC49Nextaction:若您已直接修改远端草稿、仅需发布正式版本,请执行seal-userulespublish"${q}"--corp${U.corp.id}`)}throw Z}let K=Y.confirm!==!0||Y.dryRun===!0,z=await I6($),G=vP1(z.rules,Q.rules);if(K)return{...DP0(U,"api/v1/rules",z.rules,Q.rules.map((Z)=>({description:Z.description,scope:Z.scope??"ALL",strictness:Z.strictness??"MUST_FOLLOW"})),z.rules.length+Q.rules.length),corpId:U.corp.id,dryRun:!0,localFile:Q.resolvedPath,localRulesCount:Q.rules.length,remoteDraftCount:z.rules.length,changes:G,impactCount:G.created.length+G.updated.length+G.deleted.length,preservedRuleIds:[...G.updated.map((Z)=>Z.id),...G.unchanged.map((Z)=>Z.id)],warning:"Incremental mode preserves matched rule IDs and does not recode the draft rule set.",willPublish:Boolean(Y.publish),message:"Preview mode. Use --yes or confirm=true to apply the listed incremental changes to the remote draft."};for(let Z of G.deleted)await zJ($,Z.id);let H=[];for(let Z of G.created){let q=await lH($,{description:Z.description,scope:Z.scope??"ALL",strictness:NP0(Z.strictness)});H.push({id:q.id,description:q.description,code:q.code})}let W=[];for(let Z of G.updated)await yy($,Z.id,{description:Z.rule.description,scope:Z.rule.scope??"ALL",strictness:NP0(Z.rule.strictness)}),W.push(Z.id);let X=void 0;if(Y.publish){let Z=A1().slice(0,10).replace(/-/g,""),q=Y.versionName||`v-local-${Z}-${Date.now().toString().slice(-4)}`;X=await oH($,q);try{let V=await I6($);Uq(U.corp.id,X.version,V.rules)}catch{}}return{corpId:U.corp.id,dryRun:!1,localFile:Q.resolvedPath,deletedRules:G.deleted.length,createdRules:H.length,updatedRules:W.length,unchangedRules:G.unchanged.length,preservedRuleIds:[...W,...G.unchanged.map((Z)=>Z.id)],recoded:!1,published:X??!1}}},{name:"seal_approval_documents_list",description:"列出 Seal 审批知识文档",parameters:L.object({scenarios:L.array(L.string()).optional().describe("场景过滤"),offset:L.number().int().nonnegative().optional(),limit:L.number().int().positive().optional()}),handler:async($,Y)=>YU($,Y)},{name:"seal_approval_document_get",description:"获取 Seal 审批知识文档详情",parameters:L.object({documentId:L.string().describe("文档 ID")}),handler:async($,Y)=>O40($,Y.documentId)},{name:"seal_approval_document_create",description:"新建 Seal 审批知识文档",parameters:L.object({title:L.string(),purpose:L.string(),content:L.string().describe("正文,通常为 Markdown"),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>uM($,Y)},{name:"seal_approval_document_update",description:"更新 Seal 审批知识文档",parameters:L.object({documentId:L.string(),title:L.string().optional(),purpose:L.string().optional(),content:L.string().optional(),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>{let{documentId:U,...I}=Y;return bM($,U,I)}},{name:"seal_approval_delete_document",description:"删除 Seal 审批知识文档",parameters:L.object({documentId:L.string().describe("知识文档 ID")}),handler:($,Y)=>iM($,Y.documentId)},{name:"seal_approval_search",description:"按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",parameters:L.object({keywords:L.array(L.string()).min(1).describe("关键词组"),matchMode:L.enum(["any","all"]).optional().describe("any 命中任一关键词,all 要求同一行命中全部关键词"),areas:L.array(L.enum(["rules","documents","preferences"])).optional().describe("检索范围"),caseSensitive:L.boolean().optional().describe("是否大小写敏感"),contextLines:L.number().int().nonnegative().optional().describe("返回命中行前后几行,默认 3"),documentLimit:L.number().int().positive().optional().describe("缓存刷新时最多拉取文档数,默认 100"),maxResults:L.number().int().positive().optional().describe("最多返回命中数,默认 50"),refresh:L.boolean().optional().describe("是否跳过 5 分钟内存缓存并强制刷新"),ruleVersionScope:L.enum(["current","all","version"]).optional().describe("规则检索范围,默认 current;all 会检索所有已发布历史版本"),ruleVersionId:L.string().optional().describe("ruleVersionScope=version 时指定版本 ID"),ruleVersionNumber:L.number().int().positive().optional().describe("ruleVersionScope=version 时指定版本号"),latestRuleVersion:L.boolean().optional().describe("ruleVersionScope=version 时取最新已发布版本"),snippetOnly:L.boolean().optional().describe("只返回命中行,不返回前后文"),maxChars:L.number().int().positive().optional().describe("每个文本片段最多返回字符数"),fields:L.array(L.string()).optional().describe("只搜索指定字段,如 history.descrip
Line truncated
`),I=await Promise.all(O.map((D)=>H4($,D.id)))}let Q=new Map,J=0;for(let F of I){let N=F.document,O=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,D=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let B=c3(F,{summary:!1}).attachments,E=new Set;for(let C of B){let i=C.ossSignedUrl??C.url;if(!i)continue;let x=C.fileName??C.fileId??"attachment",g=_d(x),b=g,c=g.lastIndexOf("."),I0=c>0?g.slice(0,c):g,k=c>0?g.slice(c):"",p=1;while(E.has(b.toLowerCase()))b=`${I0}_${p}${k}`,p++;E.add(b.toLowerCase());try{process.stderr.write(`⬇下载单据「${D}」附件:${x}...
`),await new Promise((F,N)=>{let O=Xy1(V),D=new Jo({zlib:{level:9}});O.on("close",()=>F()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(w),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=qy1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:I.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var Ev0;var Ko=m(()=>{Pv0();W4();bZ();Ev0=G6(fZ(),1)});import{readFileSync as My1}from"node:fs";function Oy1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:U[1]}}function Ny1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Dy1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let K=J.fileName.split("/")[0],z=K.indexOf("@");return z>=0?K.slice(0,z):K}).filter((J)=>J!=="信息表.xlsx")),I=[];for(let J of Y){let K=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((G)=>G.length>0)||Object.values(J.personAttachments).some((G)=>G.length>0))&&!U.has(K))I.push(`Excel 会议编号「${K}」声明了附件,但在 ZIP 中找不到对应的根目录「${K}/」或「${K}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!Q.has(J))I.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(I.length)throw new S5(I)}async function jv0($,Y,U){let I=[],Q=$;if(Ny1($,Y)){I=await xT0($),uT0(I,U);let G=I.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Km($,G)}let J=await mT0(Q);Dy1(I,J);let K=lT0(I,J),z=J.map((G)=>G.document);return{entries:I,parsed:J,plans:K,documents:z,fileBuffer:$}}async function dI($,Y,U){let I=await jv0($,Y,U),Q=I.parsed.map((J,K)=>Zm(J.document,I.plans[K],new Map));return{warnings:[],documents:Q,attachmentPlan:I.plans}}async function fT($,Y,U){let I=await jv0($,Y,U.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Oy1(U.webhookUrl),K=[];for(let z=0;z<I.parsed.length;z+=1){let G=I.parsed[z],H=I.plans[z],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let w of V.paths){if(W.has(w))continue;let M=I.entries.find((T)=>T.fileName===w);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${w}
`),I=await Promise.all(O.map((D)=>W4($,D.id)))}let Q=new Map,J=0;for(let F of I){let N=F.document,O=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,D=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let A=p3(F,{summary:!1}).attachments,E=new Set;for(let C of A){let i=C.ossSignedUrl??C.url;if(!i)continue;let x=C.fileName??C.fileId??"attachment",h=vd(x),b=h,n=h.lastIndexOf("."),I0=n>0?h.slice(0,n):h,k=n>0?h.slice(n):"",m=1;while(E.has(b.toLowerCase()))b=`${I0}_${m}${k}`,m++;E.add(b.toLowerCase());try{process.stderr.write(`⬇下载单据「${D}」附件:${x}...
`),await new Promise((F,N)=>{let O=Wg1(V),D=new Ko({zlib:{level:9}});O.on("close",()=>F()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(w),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=Zg1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:I.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:A1(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var Tv0;var zo=o(()=>{Bv0();X4();nZ();Tv0=H6(iZ(),1)});import{readFileSync as wg1}from"node:fs";function Mg1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:U[1]}}function Og1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Ng1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let K=J.fileName.split("/")[0],z=K.indexOf("@");return z>=0?K.slice(0,z):K}).filter((J)=>J!=="信息表.xlsx")),I=[];for(let J of Y){let K=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((G)=>G.length>0)||Object.values(J.personAttachments).some((G)=>G.length>0))&&!U.has(K))I.push(`Excel 会议编号「${K}」声明了附件,但在 ZIP 中找不到对应的根目录「${K}/」或「${K}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!Q.has(J))I.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(I.length)throw new g5(I)}async function Ev0($,Y,U){let I=[],Q=$;if(Og1($,Y)){I=await kT0($),fT0(I,U);let G=I.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await zm($,G)}let J=await pT0(Q);Ng1(I,J);let K=mT0(I,J),z=J.map((G)=>G.document);return{entries:I,parsed:J,plans:K,documents:z,fileBuffer:$}}async function mI($,Y,U){let I=await Ev0($,Y,U),Q=I.parsed.map((J,K)=>qm(J.document,I.plans[K],new Map));return{warnings:[],documents:Q,attachmentPlan:I.plans}}async function iT($,Y,U){let I=await Ev0($,Y,U.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Mg1(U.webhookUrl),K=[];for(let z=0;z<I.parsed.length;z+=1){let G=I.parsed[z],H=I.plans[z],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let w of V.paths){if(W.has(w))continue;let M=I.entries.find((T)=>T.fileName===w);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${w}
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?K:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:K,documentUrl:K,ssoUrl:V,expiresIn:Z?q:void 0,identity:w,warning:M,hoseDomain:J.type==="hose"?hy1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!K?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y,U)=>{let I=Y.sn??Y.query;if(!I)throw Error("query or sn is required");let Q=await yy1($,{query:I,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),J=await Promise.all(Q.records.map((W)=>H4($,W.id))),K=Sv0(Y.fields),z=J.map((W)=>_y1(W,K)),G=J.find((W)=>W.ruleSetVersionNumber!==void 0)?.ruleSetVersionNumber,H=G===void 0?"latest":String(G);return{query:I,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:Q.total,scanned:Q.scanned,matched:z.length,records:z,next:{getSummary:`seal-useapproval-runsget<recordId>--summary--corp${U.corp.id}`,getRuleVersion:`seal-userulesversion${H}--corp${U.corp.id}`,searchRuleVersion:`seal-userulessearch<keyword>--version${H}--corp${U.corp.id}`,getVersionContext:`seal-usecontext--ruleVersion${H}--corp${U.corp.id}`},...Y.includeBridge?{bridge:Wo(J)}:{}}}},{name:"seal_approval_run_langfuse_bridge_get",description:"从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",parameters:L.object({recordId:L.string().optional(),sourceDocumentSN:L.string().optional(),sourceDocumentId:L.string().optional(),simulationBatchId:L.string().optional(),limit:L.number().int().positive().max(100).optional()}),handler:async($,Y)=>{let I=(Y.simulationBatchId?await nM($,Y.simulationBatchId):(await f4($,{limit:Y.limit??50,search:Y.sourceDocumentSN??Y.sourceDocumentId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId})).records).filter((Q)=>by1(Q,{recordId:Y.recordId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId}));return{count:I.length,records:I.map(vv0),bridge:Wo(I)}}},{name:"seal_approval_runs_stats",description:"统计审核记录状态分布、来源系统分布及按单号/ID去重统计",parameters:L.object({since:L.string().optional().describe("时间范围,如 3months, 7days, 24hours"),dedupeBy:L.enum(["sourceDocumentSN","sourceDocumentId","id"]).default("sourceDocumentSN").describe("去重字段"),status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional()}),handler:async($,Y)=>{let U=await f4($,{limit:1000,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode}),I=Y.dedupeBy??"sourceDocumentSN",Q=U.records,J={},K={},z=new Set;for(let H of Q){let W=H.status??"unknown";J[W]=(J[W]??0)+1;let X=H.sourceSystem??"unknown";K[X]=(K[X]??0)+1;let Z=H[I];if(Z)z.add(String(Z))}let G=Math.max(0,Q.length-z.size);return{total:Q.length,dedupeBy:I,unique:z.size,duplicateRuns:G,dedupeNote:G>0?`存在${G}笔重复运行记录(同一单据重跑或修改重推)`:"全部单据唯一,无重复记录",byStatus:J,bySourceSystem:K}}},{name:"seal_approval_runs_count",description:"统计符合条件的审核记录总数",parameters:L.object({status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional(),search:L.string().optional(),startDate:L.string().optional().describe("起始时间戳(毫秒)或日期字符串"),endDate:L.string().optional().describe("结束时间戳(毫秒)或日期字符串")}),handler:async($,Y)=>{let U=await f4($,{limit:1,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode,search:Y.search,startDate:m2(Y.startDate,!1),endDate:m2(Y.endDate,!0)});return{total:U.total??U.records.length}}}]});import{readFileSync as iy1}from"node:fs";var $I4,YI4,UI4,II4,QI4,JI4,KI4,zI4,xv0,GI4,HI4,WI4,cy1,ny1,dy1,XI4,ZI4,qI4,VI4,LI4,FI4,wI4,MI4,OI4,NI4,DI4,BI
Line truncated
`)}function Uk1($){let Y=[];if(Y.push(`seal-use${$.area}-${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");let U=new Map;for(let Q of $.commands){let J=Q.group??"",K=U.get(J)??[];K.push(Q),U.set(J,K)}let I=[...$.groupOrder??[],...[...U.keys()].filter((Q)=>!$.groupOrder?.includes(Q))];for(let Q of I){let J=U.get(Q);if(!J)continue;if(Q)Y.push(""),Y.push(`${Q}:`);for(let K of J)for(let z of K.usage)Y.push(`${z}`)}if($.commands.some((Q)=>Q.name))Y.push(""),Y.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return Y.join(`
`)}function pv0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of mv0)for(let U of Y.commands)for(let I of U.usage)$.push(`${I}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var mv0;var Oo=m(()=>{n8();mv0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",groupOrder:["企业接入","发现与选择","企业配置","测试配对与验证","Hose 专属能力"],commands:[{name:"list",group:"发现与选择",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],group:"发现与选择",summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],group:"发现与选择",summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",group:"发现与选择",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",group:"发现与选择",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",group:"企业配置",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",group:"企业配置",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",group:"测试配对与验证",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",group:"测试配对与验证",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",group:"测试配对与验证",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new versi
Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?K:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:K,documentUrl:K,ssoUrl:V,expiresIn:Z?q:void 0,identity:w,warning:M,hoseDomain:J.type==="hose"?Sg1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!K?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y,U)=>{let I=Y.sn??Y.query;if(!I)throw Error("query or sn is required");let Q=await yg1($,{query:I,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),J=await Promise.all(Q.records.map((W)=>W4($,W.id))),K=vv0(Y.fields),z=J.map((W)=>Rg1(W,K)),G=J.find((W)=>W.ruleSetVersionNumber!==void 0)?.ruleSetVersionNumber,H=G===void 0?"latest":String(G);return{query:I,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:Q.total,scanned:Q.scanned,matched:z.length,records:z,next:{getSummary:`seal-useapproval-runsget<recordId>--summary--corp${U.corp.id}`,getRuleVersion:`seal-userulesversion${H}--corp${U.corp.id}`,searchRuleVersion:`seal-userulessearch<keyword>--version${H}--corp${U.corp.id}`,getVersionContext:`seal-usecontext--ruleVersion${H}--corp${U.corp.id}`},...Y.includeBridge?{bridge:Xo(J)}:{}}}},{name:"seal_approval_run_langfuse_bridge_get",description:"从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",parameters:L.object({recordId:L.string().optional(),sourceDocumentSN:L.string().optional(),sourceDocumentId:L.string().optional(),simulationBatchId:L.string().optional(),limit:L.number().int().positive().max(100).optional()}),handler:async($,Y)=>{let I=(Y.simulationBatchId?await mM($,Y.simulationBatchId):(await u4($,{limit:Y.limit??50,search:Y.sourceDocumentSN??Y.sourceDocumentId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId})).records).filter((Q)=>ug1(Q,{recordId:Y.recordId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId}));return{count:I.length,records:I.map(_v0),bridge:Xo(I)}}},{name:"seal_approval_runs_stats",description:"统计审核记录状态分布、来源系统分布及按单号/ID去重统计",parameters:L.object({since:L.string().optional().describe("时间范围,如 3months, 7days, 24hours"),dedupeBy:L.enum(["sourceDocumentSN","sourceDocumentId","id"]).default("sourceDocumentSN").describe("去重字段"),status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional()}),handler:async($,Y)=>{let U=await u4($,{limit:1000,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode}),I=Y.dedupeBy??"sourceDocumentSN",Q=U.records,J={},K={},z=new Set;for(let H of Q){let W=H.status??"unknown";J[W]=(J[W]??0)+1;let X=H.sourceSystem??"unknown";K[X]=(K[X]??0)+1;let Z=H[I];if(Z)z.add(String(Z))}let G=Math.max(0,Q.length-z.size);return{total:Q.length,dedupeBy:I,unique:z.size,duplicateRuns:G,dedupeNote:G>0?`存在${G}笔重复运行记录(同一单据重跑或修改重推)`:"全部单据唯一,无重复记录",byStatus:J,bySourceSystem:K}}},{name:"seal_approval_runs_count",description:"统计符合条件的审核记录总数",parameters:L.object({status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional(),search:L.string().optional(),startDate:L.string().optional().describe("起始时间戳(毫秒)或日期字符串"),endDate:L.string().optional().describe("结束时间戳(毫秒)或日期字符串")}),handler:async($,Y)=>{let U=await u4($,{limit:1,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode,search:Y.search,startDate:a$(Y.startDate,!1),endDate:a$(Y.endDate,!0)});return{total:U.total??U.records.length}}}]});import{readFileSync as bg1}from"node:fs";var GI4,HI4,WI4,XI4,ZI4,qI4,VI4,LI4,kv0,FI4,wI4,MI4,ig1,cg1,ng1,OI4,NI4,DI4,AI4,BI4,PI4,TI4,EI4,jI4,CI4,RI4,_I
Line truncated
`)}function Yk1($){let Y=[];if(Y.push(`seal-use${$.area}-${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");let U=new Map;for(let Q of $.commands){let J=Q.group??"",K=U.get(J)??[];K.push(Q),U.set(J,K)}let I=[...$.groupOrder??[],...[...U.keys()].filter((Q)=>!$.groupOrder?.includes(Q))];for(let Q of I){let J=U.get(Q);if(!J)continue;if(Q)Y.push(""),Y.push(`${Q}:`);for(let K of J)for(let z of K.usage)Y.push(`${z}`)}if($.commands.some((Q)=>Q.name))Y.push(""),Y.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return Y.join(`
`)}function dv0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of pv0)for(let U of Y.commands)for(let I of U.usage)$.push(`${I}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var pv0;var No=o(()=>{p8();pv0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",groupOrder:["企业接入","发现与选择","企业配置","测试配对与验证","Hose 专属能力"],commands:[{name:"list",group:"发现与选择",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],group:"发现与选择",summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],group:"发现与选择",summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",group:"发现与选择",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",group:"发现与选择",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",group:"企业配置",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",group:"企业配置",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",group:"测试配对与验证",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",group:"测试配对与验证",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",group:"测试配对与验证",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new versi
Line truncated
`;if(Y.outputFile){Ik1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function zk1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>Kk1)throw new Yq(`Outputislarge(${U}bytes).Use--summary,--fields,--count,or--output-file;pass--fullonlywhenyoureallyneedthefullresponse.`)}function sv0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},I=typeof U.count==="number"?U.count:void 0,Q=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),K=I??Q??0;if(K>Qk1||J>Jk1)throw new Yq(`Rulelistislarge(${K}rules,${J}bytes).Use"seal-use rules list --summary","seal-use rules count",or--output-file;pass--fullonlywhenyoureallyneedfulldescriptions.`,"seal-use rules list --summary")}function T0($){return{allowFull:z0($.full)===!0,outputFile:R($.outputFile)??R($["output-file"])}}function av0($=[]){console.log(ov0($))}var Qk1=100,Jk1=120000,rv0,Kk1=200000;var e1=m(()=>{V4();n8();Oo();rv0=["code","status","strictness","scope","updatedAt"]});var Do={};V8(Do,{selectCorp:()=>M1,runToolResult:()=>E$,runTool:()=>R0,globalConfigSummary:()=>QY});function M1($){let Y=Q$(),U=P4(),I=l2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},n3());return FA0(I.id),I}function QY($=P4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:OI()}}async function R0($,Y,U,I,Q={}){j0(await E$($,Y,U,I),Q)}async function E$($,Y,U,I){let Q=Xo.find((z)=>z.name===$);if(!Q)throw Error(`UnknownSealtool:${$}`);let J=Object.fromEntries(Object.entries(I).filter(([,z])=>z!==void 0)),K=Q.handler;return K(Y,J,{corp:U})}var N4=m(()=>{r$();ZP();Zo();e1()});import{existsSync as tv0}from"node:fs";async function ev0($,Y){if(!tv0($))throw Error(`Filenotfound:${$}`);let U=pI($);j0(await dI(U.fileBuffer,U.fileName,Y))}async function pT($,Y,U,I,Q){if($==="ready"||$==="status"){let J=Y??R(Q.options.file)??R(Q.options.input),K=await uT(U,I,{filePath:J,webhook:R(Q.options.webhook)??R(Q.options.selector)});if(console.error(`[webhook-ready]企业环境:${K.corp.name}(${K.corp.id})[${K.stateMode}]`),K.corp.tenant?.name)console.error(`[webhook-ready]租户信息:${K.corp.tenant.name}(${K.corp.tenant.id})`);console.error(`[webhook-ready]凭证状态:${K.authStatus==="ok"?"OK":`异常 (${K.authError})`}`),console.error(`[webhook-ready]Webhook通道:${K.activeWebhooks.length}个可用`);for(let z of K.activeWebhooks){let G=z.isDefault?" [默认通道]":"";console.error(`-${z.name}(${z.id})mode=${z.mode}${G}`)}if(K.materialPack)console.error(`[webhook-ready]材料包预检:${K.materialPack.valid?`通过 (${K.materialPack.documentCount} 单)`:`失败 (${K.materialPack.errors?.join("; ")})`}`);if(K.ready)console.error(`\uD83D\uDFE2${K.statusMessage}`),console.error(`\uD83D\uDC49Nextaction:${K.nextAction}`);else console.error(`\uD83D\uDD34准备阶段未通过:${K.statusMessage}`),console.error(`\uD83D\uDC49Nextaction:${K.nextAction}`);j0(K,T0(Q.options));return}if($==="replay"){let J=Y??R(Q.options.recordId)??R(Q.options["record-id"])??R(Q.options.id),K=R(Q.options.recordIds)??R(Q.options["record-ids"]),z=K?K.split(",").map((c)=>c.trim()).filter(Boolean):void 0,G=R(Q.options.sn)??R(Q.options.documentSn)??R(Q.options["document-sn"]),H=R(Q.options.sns)??R(Q.options["document-sns"]),W=H?H.split(",").map((c)=>c.trim()).filter(Boolean):void 0,X=l0(Q.options.limit),Z=R(Q.options.status),q=R(Q.options.startDate)??R(Q.options["start-date"]),V=R(Q.options.endDate)??R(Q.options["end-date"]);if(!J&&!z&&!G&&!W&&X===void 0)throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let w=R(Q.options.sourceCorp)??R(Q.options["source-corp"])??R(Q.options.prodCorp)??R(Q.options["prod-corp"]),M=R(Q.options.targetCorp)??R(Q.options["target-corp"])??R(Q.options.testCorp)??R(Q.options["test-corp"]),F=z0(Q.options.force)===!0,{sourceCorp:N,targetCorp:O}=jP({sourceCorpId:w,targetCorpId:M,activeCorp:I,force:F},M1),D=N.id===I.id?U:await A1(N),P=O.id===I.id?U:await A1(O),T=R(Q.options.webhook)??R(Q.options.selector),B=R(Q.options.snSuffix)??R(Q.options["sn-suffix"]),E=R(Q.options.snPrefix)??R(Q.options["sn-prefix"]),C=R(Q.options.docIdSuffix)??R(Q.options["doc-id-suffix"]),i=R(Q.options.docIdPrefix)??R(Q.options["doc-id-prefix"]),x=z0(Q.options.dryRun)??z0(Q.options["dry-run"]),b=await qz({query:{recordId:J,recordIds:z,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:O,webhookSelector:T,snPrefix:E,snSuffix:B,docIdPrefix:i,docIdSuffix:C,dryRun:x});if(x){console.error(`[webhook-replay]预Line truncated
or:seal-usecorpsbind-test<testCorpId>--corp<prodCorpId>[--confirm][--force]`);let J=M1(I),K=M1(Q);if(J.id===K.id)throw T4(`Cannotbindenterprise'${J.id}'toitself.`);if(J.prodCorpId&&J.prodCorpId!==K.id)throw T4(`Cannotuse'${J.id}'asaproductionenterprisebecauseitisalreadyregisteredasatestenterprisefor'${J.prodCorpId}'.Multi-tierchainingisnotpermitted.`);if(K.testCorpId&&K.testCorpId!==J.id)throw T4(`Cannotbind'${K.id}'asatestenterprisebecauseitalreadyhasaboundtestenterprise'${K.testCorpId}'.Multi-tierchainingisnotpermitted.`);let z=z0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==J.id){if(!z)throw p6(`Enterprisebindingconflict:productionenterprise'${J.id}'isboundto'${J.testCorpId??"none"}',andtestenterprise'${K.id}'isboundto'${K.prodCorpId??"none"}'.Overwritinganexistingbindingrequires--forceand--confirm.`,`seal-usecorpsbind-test${J.id}${K.id}--confirm--force`)}if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0)){let X=z?" --force":"";throw p6(`Refusingtobindtestenterprise'${K.name}'(${K.id})toproductionenterprise'${J.name}'(${J.id})without--confirm.Enterprisebindingestablishes1-to-1syncpairingandmarks'${K.id}'asatestenvironment.`,`seal-usecorpsbind-test${J.id}${K.id}--confirm${X}`)}if(J.testCorpId&&J.testCorpId!==K.id)try{S9(J.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==J.id)try{S9(K.prodCorpId,{testCorpId:void 0})}catch{}let H=S9(J.id,{environment:"production",testCorpId:K.id}),W=S9(K.id,{environment:"test",prodCorpId:J.id});return j0({success:!0,productionEnterprise:{id:H.id,name:H.name,environment:H.environment,testCorpId:H.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}}),!0}if($==="unbind-test"){let I=Y??R(U.options.corp),Q=M1(I);if(!Q.testCorpId&&!Q.prodCorpId)return j0({unbound:!1,message:`Enterprise'${Q.name}'(${Q.id})doesnothaveanactivetestenterprisebinding.`}),!0;let J=Q.testCorpId?Q.id:Q.prodCorpId,K=Q.testCorpId?Q.testCorpId:Q.id;if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0))throw p6(`Refusingtounbindproductionenterprise'${J}'andtestenterprise'${K}'without--confirm.`,`seal-usecorpsunbind-test${Q.id}--confirm`);S9(J,{testCorpId:void 0});try{S9(K,{prodCorpId:void 0})}catch{}return j0({success:!0,unboundProduction:J,unboundTest:K}),!0}return!1}var JS0=m(()=>{r$();N4();n8();V4();e1()});function mT($){let Y;try{Y=new URL($.trim())}catch{throw Error("Invalid Seal delegate link: expected a valid HTTPS URL")}if(Y.protocol!=="https:")throw Error("Invalid Seal delegate link: expected HTTPS");let U=Y.hostname.toLowerCase();if(!U.endsWith(KS0))throw Error(`InvalidSealdelegatelink:expectedhostendingin${KS0},got${U}`);let I=Y.pathname.replace(/\/+$/,"");if(I!==zS0)throw Error(`InvalidSealdelegatelink:expectedpath${zS0},got${I}`);let Q=Y.searchParams.get("token");if(!Q)throw Error("Invalid Seal delegate link: token query parameter is required");return{sealUrl:Y.origin,delegateToken:Q}}async function GS0($){let Y=typeof $==="string"?mT($):$;return(await j6(Y.sealUrl,void 0).post("api/v1/delegation/preview",{json:{token:Y.delegateToken}}).json()).data}async function HS0($){let Y=typeof $==="string"?mT($):$,U=Y.sealUrl,I=j6(U,void 0),Q=await I.post("api/v1/delegation/consume",{json:{token:Y.delegateToken}}),J=Q.headers.get("set-cookie")??"",K=typeof Q.headers.getSetCookie==="function"?Q.headers.getSetCookie():[J],z="";for(let M of K)if(M&&M.includes("session_token=")){z=(M.split(";")[0]??"").trim();break}let G;try{G=await I.get("api/auth/get-session",{headers:z?{cookie:z}:{}}).json()}catch{}let H=G?.session?.token;if(!H&&z){let M=z.match(/session_token=([^.;]+)/);if(M?.[1])H=decodeURIComponent(M[1])}if(!H)throw Error("Seal delegate exchange did not return a session token");let W=86400;if(G?.session?.expiresAt){let M=new Date(G.session.expiresAt).getTime();if(Number.isFinite(M)){let F=Math.floor((M-Date.now())/1000);if(F>0)W=F}}let Z=await j6(U,H).get("api/v1/auth/me").json(),q=Z.data&&typeof Z.data==="object"?Z.data:Z,V=q.user??G?.user??{},w=q.tenant??{};return{sealUrl:U,token:H,expiresIn:W,user:V,tenant:w}}function lT($){let Y=[],U=0,I="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".ekuaibao.com")||z.endsWith(".hosecloud.com")||z==="ekuaibao.com"||z==="hosecloud.com")U+=40,I="host is Hose domain";if(G==="/web/thirdparty.html")U+=40,I+="; path is /web/thirdparty.html";if(K.searchParams.has("accessToken"))U+=10,I+="; has accessToken";if(K.searchParams.has("ekbCorpId"))U+=10,I+="; has ekbCorpId"}catch{U=0}if(U>0)Y.push({kind:"hose",score:U,reason:I});let Q=0,J="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".sealai.cc"))Q+=40,J="host ends with .sealai.cc";if(G==="/delegate")Q+=40,J+="; path is /delegate";if(
Line truncated
`,{mode:384}),{config:U,path:Q}}var Po=m(()=>{r$();KP()});function To($){return new Date($).toISOString().replace(/\.\d{3}Z$/,"Z")}function oT($){let Y=new Date($);if(Number.isNaN(Y.getTime()))return $;return To(Y.getTime())}function z5($){return typeof $==="string"&&$?$:void 0}function qk1($){return{headers:vd.parse($.headers),cookies:Sd.parse($.cookies)}}async function Vk1($,Y,U={}){let I=await s6(j6($,Y,U));return{user:I.user??{},tenant:I.tenant??{}}}async function WS0($){let Y=$.sealUrl.replace(/\/+$/,""),U=$.expiresIn??2592000,I=$.force===!0||$.verify===!1?!1:!0,Q=qk1($),J=I?await Vk1(Y,$.token,E6(Q)):void 0,K=ZS0($,{token:$.token,sealUrl:Y,expiresIn:U,expiresAt:$.expiresAt,verify:I,remote:J,custom:Q}),z=$.tenantId??z5(J?.tenant.id),G=$.tenantSlug??z5(J?.tenant.tenantSlug);return{...K,verified:I,tenantId:z,tenantSlug:G}}function XS0($){let Y=z5($.session.tenant.tenantSlug),U=z5($.session.tenant.id),I=Y??U??"seal-delegate";return{...ZS0({id:I,corpId:I,name:$.name,provider:"seal",overwrite:$.overwrite},{token:$.session.token,sealUrl:$.session.sealUrl,expiresIn:$.session.expiresIn,verify:!0,remote:{user:$.session.user,tenant:$.session.tenant}}),tenantId:U,tenantSlug:Y}}function ZS0($,Y){let U=Y.remote?.user,I=Y.remote?.tenant,Q=$.tenantSlug??z5(I?.tenantSlug),J=$.tenantId??z5(I?.id),K=$.tenantName??z5(I?.name),z=$.id??Q??J;if(!z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let G=Y.expiresAt?oT(Y.expiresAt):To(Date.now()+Y.expiresIn*1000),H=$.staffId??z5(U?.providerUserId)??z5(U?.id)??"seal",W=$.provider??z5(U?.provider)??z5(I?.providerConfig?.provider),X=$.corpId??Q??J??z,Z={id:z,name:$.name??K??z,environment:"production",seal:{url:Y.sealUrl,tenantSlug:Q,headers:Y.custom?.headers,cookies:Y.custom?.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,expiresAt:G,staffId:H,corpId:X,tenantId:J,tenantSlug:Q,tenantName:K,providerUserId:z5(U?.providerUserId),provider:W},auth:{refreshTtl:300}};return uq(Z,{overwrite:$.overwrite===!0})}var Eo=m(()=>{Po();KP();b6();W4()});async function oz($){let[Y,U]=await Promise.all([j10($),A1($)]),I=await s6(U);return{...Y,tenantId:I.tenant.id,tenantSlug:I.tenant.tenantSlug??Y.tenantSlug,tenantName:I.tenant.name,raw:{...typeof Y.raw==="object"&&Y.raw!==null?Y.raw:{},user:{id:I.user.id,name:I.user.name,isAdmin:I.user.isAdmin,providerUserId:I.user.providerUserId,hosecloudStaff:I.user.hosecloudStaff},tenant:I.tenant}}}var rT=m(()=>{b6();Og();W4()});async function qS0($){let Y=await YJ($.appKey,$.appSecurity,$.domain),U=await TM(Y.domain,Y.openapiToken).catch(()=>[]);return{...Y,roleCount:U.reduce((I,Q)=>I+Q.roleDefs.length,0),roleGroups:U.map((I)=>({id:I.id,name:I.name,roleDefs:I.roleDefs.map((Q)=>({id:Q.id,name:Q.name,sourceType:Q.sourceType}))}))}}async function VS0($){let Y=await YJ($.appKey,$.appSecurity,$.domain),U=$.role??$.roleDefId??"admin",I=await TM(Y.domain,Y.openapiToken),Q,J;for(let G of I){for(let H of G.roleDefs)if(H.id===U||H.id===`${Y.corpId}:${U}`){Q=H.id,J=H.name;break}if(Q)break}if(!Q&&(U==="admin"||U==="主管理员"))for(let G of I){for(let H of G.roleDefs)if(H.id.endsWith(":admin")||H.name==="主管理员"){Q=H.id,J=H.name;break}if(Q)break}if(!Q)for(let G of I){for(let H of G.roleDefs)if(H.name.toLowerCase().includes(U.toLowerCase())){Q=H.id,J=H.name;break}if(Q)break}if(!Q)throw Error(`Rolenotfoundmatchingquery:'${U}'.Run'seal-use corps probe-hose'toviewallavailableroles.`);let K=await Lg(Y.domain,Y.openapiToken,Q),z=await Fg(Y.domain,Y.openapiToken,K.staffs);return{domain:Y.domain,corpId:Y.corpId,corpName:Y.corpName??Y.corpId,roleId:Q,roleName:J,staffs:z}}async function bq($){let Y=$.domain,U=$.staffId??$.proxyStaffBizId,I=$.force===!0,Q=I||$.verify===!1?!1:!0,J=Y,K=$.corpId??$.corporationId,z=$.name,G;if(!J||!K||!U){let V=await YJ($.appKey,$.appSecurity,Y);J=V.domain,K=K??V.corpId,z=z??V.corpName,G=V.openapiToken}let H=U;if(!H&&G&&J){let V=$.role??"admin",w=await TM(J,G).catch(()=>[]),M;for(let F of w){for(let N of F.roleDefs)if(N.id.endsWith(`:${V}`)||N.name===V||N.id===V){M=N.id;break}if(M)break}if(!M)M=w.find((F)=>F.roleDefs.some((N)=>N.id.endsWith(":admin")))?.roleDefs.find((F)=>F.id.endsWith(":admin"))?.id;if(M){let F=await Lg(J,G,M).catch(()=>({staffs:[]})),N=await Fg(J,G,F.staffs).catch(()=>[]);if($.staffName||$.staffPhone){let O=N.filter((D)=>{if($.staffName&&D.name!==$.staffName&&!D.name.includes($.staffName))return!1;if($.staffPhone&&(!D.cellphone||!D.cellphone.includes($.staffPhone)))return!1;return!0});if(O.length===1&&O[0])H=O[0].id;else if(O.length>1)throw Error(`Multiplestaffmembersmatched'${$.staffName??$.staffPhone}':${O.map((D)=>`${D.name}(${D.id})`).join(", ")}.PleasespecifyexactstaffId.`);else throw Error(`Nostaffmemberfoundmatching'${$.staffName??$.staffPhone}'underrole${M}.Run'seal-use corps hose-staffs'toviewcandidates.`)}else if(!I){let O=N.map(
Line truncated
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。",I);if(U.keyId||U.appKey){let Q=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!Q)throw new mI(`指定的合思密钥不存在,请从上述候选列表中选择正确的appKey或keyId。
`;if(Y.outputFile){Uk1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function Kk1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>Jk1)throw new Qq(`Outputislarge(${U}bytes).Use--summary,--fields,--count,or--output-file;pass--fullonlywhenyoureallyneedthefullresponse.`)}function rv0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},I=typeof U.count==="number"?U.count:void 0,Q=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),K=I??Q??0;if(K>Ik1||J>Qk1)throw new Qq(`Rulelistislarge(${K}rules,${J}bytes).Use"seal-use rules list --summary","seal-use rules count",or--output-file;pass--fullonlywhenyoureallyneedfulldescriptions.`,"seal-use rules list --summary")}function T0($){return{allowFull:z0($.full)===!0,outputFile:R($.outputFile)??R($["output-file"])}}function sv0($=[]){console.log(lv0($))}var Ik1=100,Qk1=120000,ov0,Jk1=200000;var $4=o(()=>{L4();p8();No();ov0=["code","status","strictness","scope","updatedAt"]});var Ao={};L8(Ao,{selectCorp:()=>M1,runToolResult:()=>C$,runTool:()=>v0,globalConfigSummary:()=>KY});function M1($){let Y=K$(),U=T4(),I=r2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},m3());return LB0(I.id),I}function KY($=T4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:DI()}}async function v0($,Y,U,I,Q={}){C0(await C$($,Y,U,I),Q)}async function C$($,Y,U,I){let Q=Zo.find((z)=>z.name===$);if(!Q)throw Error(`UnknownSealtool:${$}`);let J=Object.fromEntries(Object.entries(I).filter(([,z])=>z!==void 0)),K=Q.handler;return K(Y,J,{corp:U})}var D4=o(()=>{t$();LP();qo();$4()});import{existsSync as av0}from"node:fs";async function tv0($,Y){if(!av0($))throw Error(`Filenotfound:${$}`);let U=lI($);C0(await mI(U.fileBuffer,U.fileName,Y))}async function oT($,Y,U,I,Q){if($==="ready"||$==="status"){let J=Y??R(Q.options.file)??R(Q.options.input),K=await cT(U,I,{filePath:J,webhook:R(Q.options.webhook)??R(Q.options.selector)});if(console.error(`[webhook-ready]企业环境:${K.corp.name}(${K.corp.id})[${K.stateMode}]`),K.corp.tenant?.name)console.error(`[webhook-ready]租户信息:${K.corp.tenant.name}(${K.corp.tenant.id})`);console.error(`[webhook-ready]凭证状态:${K.authStatus==="ok"?"OK":`异常 (${K.authError})`}`),console.error(`[webhook-ready]Webhook通道:${K.activeWebhooks.length}个可用`);for(let z of K.activeWebhooks){let G=z.isDefault?" [默认通道]":"";console.error(`-${z.name}(${z.id})mode=${z.mode}${G}`)}if(K.materialPack)console.error(`[webhook-ready]材料包预检:${K.materialPack.valid?`通过 (${K.materialPack.documentCount} 单)`:`失败 (${K.materialPack.errors?.join("; ")})`}`);if(K.ready)console.error(`\uD83D\uDFE2${K.statusMessage}`),console.error(`\uD83D\uDC49Nextaction:${K.nextAction}`);else console.error(`\uD83D\uDD34准备阶段未通过:${K.statusMessage}`),console.error(`\uD83D\uDC49Nextaction:${K.nextAction}`);C0(K,T0(Q.options));return}if($==="replay"){let J=Y??R(Q.options.recordId)??R(Q.options["record-id"])??R(Q.options.id),K=R(Q.options.recordIds)??R(Q.options["record-ids"]),z=K?K.split(",").map((n)=>n.trim()).filter(Boolean):void 0,G=R(Q.options.sn)??R(Q.options.documentSn)??R(Q.options["document-sn"]),H=R(Q.options.sns)??R(Q.options["document-sns"]),W=H?H.split(",").map((n)=>n.trim()).filter(Boolean):void 0,X=l0(Q.options.limit),Z=R(Q.options.status),q=R(Q.options.startDate)??R(Q.options["start-date"]),V=R(Q.options.endDate)??R(Q.options["end-date"]);if(!J&&!z&&!G&&!W&&X===void 0)throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let w=R(Q.options.sourceCorp)??R(Q.options["source-corp"])??R(Q.options.prodCorp)??R(Q.options["prod-corp"]),M=R(Q.options.targetCorp)??R(Q.options["target-corp"])??R(Q.options.testCorp)??R(Q.options["test-corp"]),F=z0(Q.options.force)===!0,{sourceCorp:N,targetCorp:O}=_P({sourceCorpId:w,targetCorpId:M,activeCorp:I,force:F},M1),D=N.id===I.id?U:await P1(N),P=O.id===I.id?U:await P1(O),T=R(Q.options.webhook)??R(Q.options.selector),A=R(Q.options.snSuffix)??R(Q.options["sn-suffix"]),E=R(Q.options.snPrefix)??R(Q.options["sn-prefix"]),C=R(Q.options.docIdSuffix)??R(Q.options["doc-id-suffix"]),i=R(Q.options.docIdPrefix)??R(Q.options["doc-id-prefix"]),x=z0(Q.options.dryRun)??z0(Q.options["dry-run"]),b=await Fz({query:{recordId:J,recordIds:z,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:O,webhookSelector:T,snPrefix:E,snSuffix:A,docIdPrefix:i,docIdSuffix:C,dryRun:x});if(x){console.error(`[webhook-replay]预Line truncated
or:seal-usecorpsbind-test<testCorpId>--corp<prodCorpId>[--confirm][--force]`);let J=M1(I),K=M1(Q);if(J.id===K.id)throw E4(`Cannotbindenterprise'${J.id}'toitself.`);if(J.prodCorpId&&J.prodCorpId!==K.id)throw E4(`Cannotuse'${J.id}'asaproductionenterprisebecauseitisalreadyregisteredasatestenterprisefor'${J.prodCorpId}'.Multi-tierchainingisnotpermitted.`);if(K.testCorpId&&K.testCorpId!==J.id)throw E4(`Cannotbind'${K.id}'asatestenterprisebecauseitalreadyhasaboundtestenterprise'${K.testCorpId}'.Multi-tierchainingisnotpermitted.`);let z=z0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==J.id){if(!z)throw m6(`Enterprisebindingconflict:productionenterprise'${J.id}'isboundto'${J.testCorpId??"none"}',andtestenterprise'${K.id}'isboundto'${K.prodCorpId??"none"}'.Overwritinganexistingbindingrequires--forceand--confirm.`,`seal-usecorpsbind-test${J.id}${K.id}--confirm--force`)}if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0)){let X=z?" --force":"";throw m6(`Refusingtobindtestenterprise'${K.name}'(${K.id})toproductionenterprise'${J.name}'(${J.id})without--confirm.Enterprisebindingestablishes1-to-1syncpairingandmarks'${K.id}'asatestenvironment.`,`seal-usecorpsbind-test${J.id}${K.id}--confirm${X}`)}if(J.testCorpId&&J.testCorpId!==K.id)try{g9(J.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==J.id)try{g9(K.prodCorpId,{testCorpId:void 0})}catch{}let H=g9(J.id,{environment:"production",testCorpId:K.id}),W=g9(K.id,{environment:"test",prodCorpId:J.id});return C0({success:!0,productionEnterprise:{id:H.id,name:H.name,environment:H.environment,testCorpId:H.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}}),!0}if($==="unbind-test"){let I=Y??R(U.options.corp),Q=M1(I);if(!Q.testCorpId&&!Q.prodCorpId)return C0({unbound:!1,message:`Enterprise'${Q.name}'(${Q.id})doesnothaveanactivetestenterprisebinding.`}),!0;let J=Q.testCorpId?Q.id:Q.prodCorpId,K=Q.testCorpId?Q.testCorpId:Q.id;if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0))throw m6(`Refusingtounbindproductionenterprise'${J}'andtestenterprise'${K}'without--confirm.`,`seal-usecorpsunbind-test${Q.id}--confirm`);g9(J,{testCorpId:void 0});try{g9(K,{prodCorpId:void 0})}catch{}return C0({success:!0,unboundProduction:J,unboundTest:K}),!0}return!1}var QS0=o(()=>{t$();D4();p8();L4();$4()});function rT($){let Y;try{Y=new URL($.trim())}catch{throw Error("Invalid Seal delegate link: expected a valid HTTPS URL")}if(Y.protocol!=="https:")throw Error("Invalid Seal delegate link: expected HTTPS");let U=Y.hostname.toLowerCase();if(!U.endsWith(JS0))throw Error(`InvalidSealdelegatelink:expectedhostendingin${JS0},got${U}`);let I=Y.pathname.replace(/\/+$/,"");if(I!==KS0)throw Error(`InvalidSealdelegatelink:expectedpath${KS0},got${I}`);let Q=Y.searchParams.get("token");if(!Q)throw Error("Invalid Seal delegate link: token query parameter is required");return{sealUrl:Y.origin,delegateToken:Q}}async function zS0($){let Y=typeof $==="string"?rT($):$;return(await C6(Y.sealUrl,void 0).post("api/v1/delegation/preview",{json:{token:Y.delegateToken}}).json()).data}async function GS0($){let Y=typeof $==="string"?rT($):$,U=Y.sealUrl,I=C6(U,void 0),Q=await I.post("api/v1/delegation/consume",{json:{token:Y.delegateToken}}),J=Q.headers.get("set-cookie")??"",K=typeof Q.headers.getSetCookie==="function"?Q.headers.getSetCookie():[J],z="";for(let M of K)if(M&&M.includes("session_token=")){z=(M.split(";")[0]??"").trim();break}let G;try{G=await I.get("api/auth/get-session",{headers:z?{cookie:z}:{}}).json()}catch{}let H=G?.session?.token;if(!H&&z){let M=z.match(/session_token=([^.;]+)/);if(M?.[1])H=decodeURIComponent(M[1])}if(!H)throw Error("Seal delegate exchange did not return a session token");let W=86400;if(G?.session?.expiresAt){let M=new Date(G.session.expiresAt).getTime();if(Number.isFinite(M)){let F=Math.floor((M-Date.now())/1000);if(F>0)W=F}}let Z=await C6(U,H).get("api/v1/auth/me").json(),q=Z.data&&typeof Z.data==="object"?Z.data:Z,V=q.user??G?.user??{},w=q.tenant??{};return{sealUrl:U,token:H,expiresIn:W,user:V,tenant:w}}function sT($){let Y=[],U=0,I="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".ekuaibao.com")||z.endsWith(".hosecloud.com")||z==="ekuaibao.com"||z==="hosecloud.com")U+=40,I="host is Hose domain";if(G==="/web/thirdparty.html")U+=40,I+="; path is /web/thirdparty.html";if(K.searchParams.has("accessToken"))U+=10,I+="; has accessToken";if(K.searchParams.has("ekbCorpId"))U+=10,I+="; has ekbCorpId"}catch{U=0}if(U>0)Y.push({kind:"hose",score:U,reason:I});let Q=0,J="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".sealai.cc"))Q+=40,J="host ends with .sealai.cc";if(G==="/delegate")Q+=40,J+="; path is /delegate";if(
Line truncated
`,{mode:384}),{config:U,path:Q}}var To=o(()=>{t$();HP()});function W5($){return typeof $==="string"&&$?$:void 0}function Zk1($){return{headers:Sd.parse($.headers),cookies:hd.parse($.cookies)}}async function qk1($,Y,U={}){let I=await a6(C6($,Y,U));return{user:I.user??{},tenant:I.tenant??{}}}async function HS0($){let Y=$.sealUrl.replace(/\/+$/,""),U=$.expiresIn??2592000,I=$.force===!0||$.verify===!1?!1:!0,Q=Zk1($),J=I?await qk1(Y,$.token,j6(Q)):void 0,K=XS0($,{token:$.token,sealUrl:Y,expiresIn:U,expiresAt:$.expiresAt,verify:I,remote:J,custom:Q}),z=$.tenantId??W5(J?.tenant.id),G=$.tenantSlug??W5(J?.tenant.tenantSlug);return{...K,verified:I,tenantId:z,tenantSlug:G}}function WS0($){let Y=W5($.session.tenant.tenantSlug),U=W5($.session.tenant.id),I=Y??U??"seal-delegate";return{...XS0({id:I,corpId:I,name:$.name,provider:"seal",overwrite:$.overwrite},{token:$.session.token,sealUrl:$.session.sealUrl,expiresIn:$.session.expiresIn,verify:!0,remote:{user:$.session.user,tenant:$.session.tenant}}),tenantId:U,tenantSlug:Y}}function XS0($,Y){let U=Y.remote?.user,I=Y.remote?.tenant,Q=$.tenantSlug??W5(I?.tenantSlug),J=$.tenantId??W5(I?.id),K=$.tenantName??W5(I?.name),z=$.id??Q??J;if(!z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let G=Y.expiresAt?T8(Y.expiresAt):A1(Date.now()+Y.expiresIn*1000),H=$.staffId??W5(U?.providerUserId)??W5(U?.id)??"seal",W=$.provider??W5(U?.provider)??W5(I?.providerConfig?.provider),X=$.corpId??Q??J??z,Z={id:z,name:$.name??K??z,environment:"production",seal:{url:Y.sealUrl,tenantSlug:Q,headers:Y.custom?.headers,cookies:Y.custom?.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,expiresAt:G,staffId:H,corpId:X,tenantId:J,tenantSlug:Q,tenantName:K,providerUserId:W5(U?.providerUserId),provider:W},auth:{refreshTtl:300}};return cq(Z,{overwrite:$.overwrite===!0})}var Eo=o(()=>{To();HP();i6();X4()});async function az($){let[Y,U]=await Promise.all([E10($),P1($)]),I=await a6(U);return{...Y,tenantId:I.tenant.id,tenantSlug:I.tenant.tenantSlug??Y.tenantSlug,tenantName:I.tenant.name,raw:{...typeof Y.raw==="object"&&Y.raw!==null?Y.raw:{},user:{id:I.user.id,name:I.user.name,isAdmin:I.user.isAdmin,providerUserId:I.user.providerUserId,hosecloudStaff:I.user.hosecloudStaff},tenant:I.tenant}}}var aT=o(()=>{i6();Dy();X4()});async function ZS0($){let Y=await IJ($.appKey,$.appSecurity,$.domain),U=await CM(Y.domain,Y.openapiToken).catch(()=>[]);return{...Y,roleCount:U.reduce((I,Q)=>I+Q.roleDefs.length,0),roleGroups:U.map((I)=>({id:I.id,name:I.name,roleDefs:I.roleDefs.map((Q)=>({id:Q.id,name:Q.name,sourceType:Q.sourceType}))}))}}async function qS0($){let Y=await IJ($.appKey,$.appSecurity,$.domain),U=$.role??$.roleDefId??"admin",I=await CM(Y.domain,Y.openapiToken),Q,J;for(let G of I){for(let H of G.roleDefs)if(H.id===U||H.id===`${Y.corpId}:${U}`){Q=H.id,J=H.name;break}if(Q)break}if(!Q&&(U==="admin"||U==="主管理员"))for(let G of I){for(let H of G.roleDefs)if(H.id.endsWith(":admin")||H.name==="主管理员"){Q=H.id,J=H.name;break}if(Q)break}if(!Q)for(let G of I){for(let H of G.roleDefs)if(H.name.toLowerCase().includes(U.toLowerCase())){Q=H.id,J=H.name;break}if(Q)break}if(!Q)throw Error(`Rolenotfoundmatchingquery:'${U}'.Run'seal-use corps probe-hose'toviewallavailableroles.`);let K=await wy(Y.domain,Y.openapiToken,Q),z=await My(Y.domain,Y.openapiToken,K.staffs);return{domain:Y.domain,corpId:Y.corpId,corpName:Y.corpName??Y.corpId,roleId:Q,roleName:J,staffs:z}}async function nq($){let Y=$.domain,U=$.staffId??$.proxyStaffBizId,I=$.force===!0,Q=I||$.verify===!1?!1:!0,J=Y,K=$.corpId??$.corporationId,z=$.name,G;if(!J||!K||!U){let V=await IJ($.appKey,$.appSecurity,Y);J=V.domain,K=K??V.corpId,z=z??V.corpName,G=V.openapiToken}let H=U;if(!H&&G&&J){let V=$.role??"admin",w=await CM(J,G).catch(()=>[]),M;for(let F of w){for(let N of F.roleDefs)if(N.id.endsWith(`:${V}`)||N.name===V||N.id===V){M=N.id;break}if(M)break}if(!M)M=w.find((F)=>F.roleDefs.some((N)=>N.id.endsWith(":admin")))?.roleDefs.find((F)=>F.id.endsWith(":admin"))?.id;if(M){let F=await wy(J,G,M).catch(()=>({staffs:[]})),N=await My(J,G,F.staffs).catch(()=>[]);if($.staffName||$.staffPhone){let O=N.filter((D)=>{if($.staffName&&D.name!==$.staffName&&!D.name.includes($.staffName))return!1;if($.staffPhone&&(!D.cellphone||!D.cellphone.includes($.staffPhone)))return!1;return!0});if(O.length===1&&O[0])H=O[0].id;else if(O.length>1)throw Error(`Multiplestaffmembersmatched'${$.staffName??$.staffPhone}':${O.map((D)=>`${D.name}(${D.id})`).join(", ")}.PleasespecifyexactstaffId.`);else throw Error(`Nostaffmemberfoundmatching'${$.staffName??$.staffPhone}'underrole${M}.Run'seal-use corps hose-staffs'toviewcandidates.`)}else if(!I){let O=N.map((D)=>({id:D.id,name:D.name,cellphone:D.cellphone,active:D.active}));throw Error(`Missingrequiredparameter:staffId.Candidates:${JSON.stringify(O)}`)}else H=N.find(
Line truncated
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。",I);if(U.keyId||U.appKey){let Q=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!Q)throw new oI(`指定的合思密钥不存在,请从上述候选列表中选择正确的appKey或keyId。
`);j0({provider:"hose",capability:"privilege-elevation",corpId:I.corpId,corpName:I.corpName??I.corpId,baseUrl:I.baseUrl,staffId:I.staffId,keyCount:I.keys.length,keys:I.keys.map((J)=>NS0(J,Q))})}async function eT($,Y){let U=M1($),I=Y.reveal===!0;if(U.source.type!=="hose")throw new z4(`【合思子域专享能力】当前企业「${U.name}」(id:${U.id})为原生Seal(${U.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);C0({provider:"hose",capability:"privilege-elevation",corpId:I.corpId,corpName:I.corpName??I.corpId,baseUrl:I.baseUrl,staffId:I.staffId,keyCount:I.keys.length,keys:I.keys.map((J)=>OS0(J,Q))})}async function YE($,Y){let U=M1($),I=Y.reveal===!0;if(U.source.type!=="hose")throw new G4(`【合思子域专享能力】当前企业「${U.name}」(id:${U.id})为原生Seal(${U.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let Z of X){let q=Z.outboundName??"SealAI 审批",V=Z.signKey,w=Z.apiOrigin??"production";console.error(`•"${q}"(signKey:${V},环境:${w})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${V}--corp${Q.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let w=V.outboundName??"SealAI 审批",M=V.signKey,F=V.apiOrigin??"production";console.error(`•"${w}"(signKey:${M},环境:${F})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${M}--corp${Q.id}
`);throw new z4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,Z.length===1?`seal-usedeployhosecloudsync${Z[0].signKey}--corp${Q.id}`:void 0)}await R0("seal_deploy_hosecloud_sync",I,Q,{signKey:H},T0(J.options));return}throw Error(`Unknowndeployhosecloudaction:${z??""}.Available:requirements,list,get,status,configure,sync.`)}var Fg0=m(()=>{N4();V4();e1();W4();n8()});var Mg0='---\nname: seal-use\ndescription: "v0.10.39: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."\nmetadata:\n version: 0.10.39\n short-description: Seal tenant and Hose approval automation (v0.10.39)\n---\n\n# Seal Use\n\nCLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志、进度和下一步建议写入 `stderr`。MCP 默认关闭。\n\n## 时间与输出\n\n- 机器字段保留 ISO 8601 UTC,精确到秒,不要添加毫秒,例如 `2026-09-22T04:56:06Z`。\n- 面向用户解释时间时,换算为 `Asia/Shanghai`,明确标注“北京时间”;审计或消歧时同时保留原始 UTC。\n- 不向用户暴露 Bearer、`accessToken`、`closeToken`、`appSecurity`、原始 cURL 或未脱敏手机号。\n- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号(例如 `0038`)和脱敏后的业务信息。\n\n## 企业接入:先识别材料,再选择入口\n\n最终企业来源只有两种:`source.type:"seal"` 和 `source.type:"hose"`。不要把材料格式、认证凭据和最终来源混为一谈。\n\n| 用户材料 | 标准入口 | 最终配置形态 |\n| --- | --- | --- |\n| Hose 开放平台 `appKey+appSecurity` | `corpsadd-hose-persistent` | Hose 持久化凭据 |\n| Seal URL + Bearer,或 Seal 页面 cURL | `corpsadd-seal-bearer` | Seal Bearer 会话 |\n| Seal 原生委托链接 | `corpsadd-link<url>` | Seal 委托会话 |\n| Hose 协助链接 | `corpsadd-link<url>` | Hose Web Session;加 `--elevate-hose` 才提取长期密钥 |\n| Hose 页面 cURL | 先提取密钥;失败时 `corpsadd-hose-web-session` | Hose 持久化或 Hose Web Session |\n| 已规范化的 Hose `corpId+accessToken+baseUrl` | `corpsadd-hose-web-session` | Hose Web Session |\n\n### 凭据边界\n\n- Seal Bearer 只能给 `add-seal-bearer`;Hose `accessToken/accesstoken/closeToken` 不能直接当作 Seal Bearer。\n- Hose Web Session 保存 `closeToken+staffId`,需要调用 Seal 时才通过 SSO 换取运行时 Seal Bearer。\n- Hose 持久化配置保存 `appKey+appSecurity`,适合无人值守、部署和长期同步。\n- 会话有有效期时,Hose source 保存 `expiresIn` 和 UTC 秒级 `expiresAt`。\n- `add-link` 是 URL 混合入口,不接收 cURL:自动识别 Seal 委托链接和 Hose 协助链接。\n- `--elevate-hose` 是唯一明确的 Hose 提权动作。\n\n收到 Hose 管理员 cURL 时,按 Hose 协助链接处理:解析主机、`accesstoken`、企业标识和必要会话信息,优先调用密钥提取路径;无法提取长期密钥时才保存 Web Session。收到 Seal cURL 时,提取 Seal 主机和 `Authorization:Bearer`,走 `add-seal-bearer`。不要盲目执行 cURL,也不要把原文写入文件或日志。\n\n详细来源决策、提权边界和 cURL 处理见 `references/enterprise-onboarding.md`;首次找材料时必须使用 `references/first-time-user.md`。\n\n## 首次接入图文规则\n\n当用户首次接入、询问如何取得材料,或需要用户打开后台找凭据时:\n\n1. 先确认用户手上是 Hose 开放平台凭据、协助链接、Seal 委托链接,还是已登录网页 cURL。\n2. 读取 `references/first-time-user.md`,只渲染与当前路径对应的截图;不能只给纯文字步骤。\n3. 接收材料后由 Agent 自动发现企业、域名和管理员。除非自动发现失败,不要要求用户先填写 `corpId`、`staffId` 或域名。\n\n## `corps` 主线\n\n- 接入:`add-link`、`add-seal-bearer`、`add-hose-persistent`、`add-hose-web-session`\n- 发现:`list`、`search`/`find`、`get`/`show`、`current`、`switch`\n- 维护:`mark`、`rename`\n- 测试闭环:`bind-test`、`unbind-test`、`sync-test`、`replay-test`\n- Hose 专属:`probe-hose`、`hose-staffs`、`hose-extract-keys`、`hose-keys`\n\nHose 专属命令应从命令名或选项中明确可见:`authhose-*`、`approval-runshose-flow`、`deployhosecloud`、`simulation--modehosecloud`。跨来源入口只有在明确使用 `--elevate-hose`、`--with-flow` 或 `--typehose-document` 时才启用对应 Hose 能力。\n\n生产规则变更遵循:生产改草稿 → 同步测试 → 模拟/回归验证 → 用户确认 → 生产发布。`sync-test`、`replay-test`、规则发布和清空等高风险操作优先 `--dry-run`,正式执行必须显式 `--yes` 或 `--coLine truncated
`);throw new G4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,Z.length===1?`seal-usedeployhosecloudsync${Z[0].signKey}--corp${Q.id}`:void 0)}await v0("seal_deploy_hosecloud_sync",I,Q,{signKey:H},T0(J.options));return}throw Error(`Unknowndeployhosecloudaction:${z??""}.Available:requirements,list,get,status,configure,sync.`)}var Ly0=o(()=>{D4();L4();$4();X4();p8()});var wy0='---\nname: seal-use\ndescription: "v0.10.40: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."\nmetadata:\n version: 0.10.40\n short-description: Seal tenant and Hose approval automation (v0.10.40)\n---\n\n# Seal Use\n\nCLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志、进度和下一步建议写入 `stderr`。MCP 默认关闭。\n\n## 时间与输出\n\n- 机器字段统一使用带 `+08:00` 北京时间偏移的 ISO 8601 秒级格式,不带毫秒,例如 `2026-09-28T11:51:09+08:00`。\n- 面向用户解释时间时,直接基于 `Asia/Shanghai`(北京时间)表述,无需再做 `+8` 小时换算。\n- 不向用户暴露 Bearer、`accessToken`、`closeToken`、`appSecurity`、原始 cURL 或未脱敏手机号。\n- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号(例如 `0038`)和脱敏后的业务信息。\n\n## 企业接入:先识别材料,再选择入口\n\n最终企业来源只有两种:`source.type:"seal"` 和 `source.type:"hose"`。不要把材料格式、认证凭据和最终来源混为一谈。\n\n| 用户材料 | 标准入口 | 最终配置形态 |\n| --- | --- | --- |\n| Hose 开放平台 `appKey+appSecurity` | `corpsadd-hose-persistent` | Hose 持久化凭据 |\n| Seal URL + Bearer,或 Seal 页面 cURL | `corpsadd-seal-bearer` | Seal Bearer 会话 |\n| Seal 原生委托链接 | `corpsadd-link<url>` | Seal 委托会话 |\n| Hose 协助链接 | `corpsadd-link<url>` | Hose Web Session;加 `--elevate-hose` 才提取长期密钥 |\n| Hose 页面 cURL | 先提取密钥;失败时 `corpsadd-hose-web-session` | Hose 持久化或 Hose Web Session |\n| 已规范化的 Hose `corpId+accessToken+baseUrl` | `corpsadd-hose-web-session` | Hose Web Session |\n\n### 凭据边界\n\n- Seal Bearer 只能给 `add-seal-bearer`;Hose `accessToken/accesstoken/closeToken` 不能直接当作 Seal Bearer。\n- Hose Web Session 保存 `closeToken+staffId`,需要调用 Seal 时才通过 SSO 换取运行时 Seal Bearer。\n- Hose 持久化配置保存 `appKey+appSecurity`,适合无人值守、部署和长期同步。\n- 会话有有效期时,Hose source 保存 `expiresIn` 和北京时间 ISO 秒级 `expiresAt`(`+08:00`)。\n- `add-link` 是 URL 混合入口,不接收 cURL:自动识别 Seal 委托链接和 Hose 协助链接。\n- `--elevate-hose` 是唯一明确的 Hose 提权动作。\n\n收到 Hose 管理员 cURL 时,按 Hose 协助链接处理:解析主机、`accesstoken`、企业标识和必要会话信息,优先调用密钥提取路径;无法提取长期密钥时才保存 Web Session。收到 Seal cURL 时,提取 Seal 主机和 `Authorization:Bearer`,走 `add-seal-bearer`。不要盲目执行 cURL,也不要把原文写入文件或日志。\n\n详细来源决策、提权边界和 cURL 处理见 `references/enterprise-onboarding.md`;首次找材料时必须使用 `references/first-time-user.md`。\n\n## 首次接入图文规则\n\n当用户首次接入、询问如何取得材料,或需要用户打开后台找凭据时:\n\n1. 先确认用户手上是 Hose 开放平台凭据、协助链接、Seal 委托链接,还是已登录网页 cURL。\n2. 读取 `references/first-time-user.md`,只渲染与当前路径对应的截图;不能只给纯文字步骤。\n3. 接收材料后由 Agent 自动发现企业、域名和管理员。除非自动发现失败,不要要求用户先填写 `corpId`、`staffId` 或域名。\n\n## `corps` 主线\n\n- 接入:`add-link`、`add-seal-bearer`、`add-hose-persistent`、`add-hose-web-session`\n- 发现:`list`、`search`/`find`、`get`/`show`、`current`、`switch`\n- 维护:`mark`、`rename`\n- 测试闭环:`bind-test`、`unbind-test`、`sync-test`、`replay-test`\n- Hose 专属:`probe-hose`、`hose-staffs`、`hose-extract-keys`、`hose-keys`\n\nHose 专属命令应从命令名或选项中明确可见:`authhose-*`、`approval-runshose-flow`、`deployhosecloud`、`simulation--modehosecloud`。跨来源入口只有在明确使用 `--elevate-hose`、`--with-flow` 或 `--typehose-document` 时才启用对应 Hose 能力。\n\n生产规则变更遵循:生产改草稿 → 同步测试 → 模拟/回归验证 → 用户确认 → 生产发布。`sync-test`、`replay-test`、规则发布和清空等高风险操作优先 `--dry-run`Line truncated
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."
`;var Ag0=()=>{};var Eg0="# 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 `code`, `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule from that run's snapshot, use `seal-userulesget<code>--record-id<recordId>--corp<corpId>` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n#查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-useapproval-runsattachments<recordId>--corp<corpId>--summary\n\n#下载全部附件到本地目录(优先使用ossSignedUrl签名直链)\nseal-useapproval-runsattachmentsdownload<recordId>--all--out-dir./downloads--corp<corpId>\n\n#按名称或fileId过滤下载单个附件\nseal-useapproval-runsattachmentsdownload<recordId>--name发票--corp<corpId>\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## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n#默认推荐:生成SealAI审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-useapproval-runslink<recordId>--corp<corpId>\nseal-useapproval-runslink--sn<sourceDocumentSN>--corp<corpId>\n\n#生成合思主系统原始单据页面链接\nseal-useapproval-runslink<recordId>--typehose-document--corp<corpId>\n\n#仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-useapproval-runslink<recordId>--auto-login[--expire7200]--corp<corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\nLine truncated
`;var Ay0=()=>{};var Ty0="# 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 `code`, `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule from that run's snapshot, use `seal-userulesget<code>--record-id<recordId>--corp<corpId>` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n#查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-useapproval-runsattachments<recordId>--corp<corpId>--summary\n\n#下载全部附件到本地目录(优先使用ossSignedUrl签名直链)\nseal-useapproval-runsattachmentsdownload<recordId>--all--out-dir./downloads--corp<corpId>\n\n#按名称或fileId过滤下载单个附件\nseal-useapproval-runsattachmentsdownload<recordId>--name发票--corp<corpId>\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## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n#默认推荐:生成SealAI审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-useapproval-runslink<recordId>--corp<corpId>\nseal-useapproval-runslink--sn<sourceDocumentSN>--corp<corpId>\n\n#生成合思主系统原始单据页面链接\nseal-useapproval-runslink<recordId>--typehose-document--corp<corpId>\n\n#仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-useapproval-runslink<recordId>--auto-login[--expire7200]--corp<corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\nLine truncated
3.BOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
-**DedicatedCLICommand**:Use\`seal-use auth hose-link --corp <corpId> [--expire <seconds>] [--force]\`. This command directly generates an independent provisional auth link without reading or mutating internal CLI session cache. It supports \`--expire\` (default 7200, e.g. 86400 for 1 day).
-**SealAIPlatformDirectLink**:Use\`seal-use auth link --corp <corpId> [--note <note>]\`. This generates a 24-hour provisional delegation link for the Seal AI audit platform (\`https://*.sealai.cc\`).
@@ -2015,7 +2015,7 @@ seal-use corps hose-staffs --json '{
}'
\`\`\`
*直接使用指定ID完成接入并进行连通性验证。
`;var ug0=()=>{};var cg0="# Rule Lightweight Queries\n\nUse this reference when the user wants rule counts, compact rule lists, one rule from draft or a historical version, or approval rule search without dumping hundreds of rule descriptions.\n\n## Draft Default vs. Published Version (`--versionlatest`)\n\nEvery rule has a 4-digit zero-padded `code` (`0000,0001,0025,0038,...`).\n\n- **Default = Current Draft (`草稿`)**: When `--version` is omitted, `rulescount`, `ruleslist`, `rulesget<code>`, `rulessearch`, `ruleslint`, and `rulespull` **all read the current draft**.\n- **Latest Published Version = `--versionlatest` (`最新发布`)**: To inspect the latest published version, **always pass `--versionlatest`** (or `--version<number>` for a specific historical version).\n- Publishing or deleting rules can shift `code` numbers across versions, so a `code` in a historical run must be resolved together with `--version<number>` or `--record-id<recordId>`.\n\n## Count Rules\n\nUse count when only scale or existence matters.\n\n```bash\n#Countcurrentdraftrules(default)\nseal-userulescount--corp<corpId>\n\n#Countrulesinlatestpublishedversion\nseal-userulescount--versionlatest--corp<corpId>\n```\n\nExpected shape:\n\n```json\n{\"count\": 191 }\n```\n\n## List Rule Summaries\n\nUse summaries for navigation and selection.\n\n```bash\n# List current draft rule summaries (default)\nseal-use rules list --summary --corp <corpId>\n\n# List latest published version rule summaries\nseal-use rules list --version latest --summary --corp <corpId>\n```\n\nDefault summary includes `code`, `status`, `strictness`, `scope`, and `updatedAt`. Do not pull full `description` fields across all rules unless the user needs rule text.\n\n## Get One Rule (Draft or Published Version)\n\nRead a single rule from the current draft (default):\n\n```bash\nseal-use rules get 0038 --corp <corpId>\n```\n\nRead a single rule from the latest published version, a specific published version, or the version used by an approval run:\n\n```bash\nseal-use rules get 0038 --version latest --corp <corpId>\nseal-use rules get 0038 --version 16 --corp <corpId>\nseal-use rules get 0205 --record-id <recordId> --corp <corpId>\n```\n\nReturns `id`, `code`, `ruleCode`, `runtimeRuleId`, `description`, `scope`, `strictness`, `status`, and version metadata when reading from a published version.\n\n## Search Rules Compactly\n\n```bash\n# Search current draft rules (default)\nseal-use rules search <keyword> --maxResults 20 --corp <corpId>\n\n# Search latest published version or a specific historical version\nseal-use rules search <keyword> --version latest --maxResults 20 --corp <corpId>\nseal-use rules search <keyword> --version 16 --maxResults 20 --corp <corpId>\n```\n\n## Clear Draft Rules Before Import\n\nUse this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.\n\n```bash\nseal-use rules clear --dry-run --corp <corpId>\nseal-use rules clear --yes --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{\n \"corpId\": \"xiezihao\",\n \"dryRun\": false,\n \"beforeCount\": 49,\n \"deleted\": 49,\n \"afterCount\": 0\n}\n```\n\n## Output Discipline\n\nIf a rule command would return many descriptions or more than about 20 rules, use `rules count`, `rules list --summary`, `rules search`, or `--output-file`. Use `--full` only for deliberate exports.\n";varig0=()=>{};vardg0="#SealApprovalRuleLinter&QualityValidation\n\nUsethisreferencewhenanalyzing,validating,orlintingSealAIapprovalrulestodetectvaguephrasing,missingexceptionevidence,orformattingdefectsbeforepublishing.\n\n##KeyPrinciples\n\n-**DefaultState**:Linteris**disabledbydefault**inglobalconfiguration(`lint.enabled: false`)toavoidunsolicitednoiseduringstandardoperations.\n-**DoctorVisibility**:`seal-use doctor`auditstherulelinterconfigurationstateandactivelinternameinitshealthchecks,andsurfacesaone-clickhint(`seal-use config lint enable`)whendisabled.\n-**ExplicitTriggering**:`seal-use rules lint`alwaysrunsregardlessofglobalconfiguration.\n-**DraftHook**:When`seal-use config lint enable`isset,`seal-use rules update`outputsreal-timediagnosticwarningsto`stderr`withoutmutating`stdout`payloads.\n-**Fault-TolerantFallback**:Ifacustom`.ts`linterfilehassyntaxerrors,runtimeexceptions,orismissing,theenginelogsawarningto`stderr`and**silentlyfallsbacktothebuilt-inheuristiclinterwithoutfailing**.\n\n##CLICommands\n\n###1.LintCurrentDraftRules(Whole-RuleSetScan)\n\n```bash\nseal-use rules lint --corp <corpId>\n```\n\n###2.LintSpecificHistoricalVersionorSingleRule\n\n```bash\n# Lint rules in published version 16\nseal-use rules lint --version 16 --corp <corpId>\n\n# Lint a specific rule by code\nseal-use rules lint --code 0038 --corp <cor
Line truncated
`;var fy0=()=>{};var iy0="# Rule Lightweight Queries\n\nUse this reference when the user wants rule counts, compact rule lists, one rule from draft or a historical version, or approval rule search without dumping hundreds of rule descriptions.\n\n## Draft Default vs. Published Version (`--versionlatest`)\n\nEvery rule has a 4-digit zero-padded `code` (`0000,0001,0025,0038,...`).\n\n- **Default = Current Draft (`草稿`)**: When `--version` is omitted, `rulescount`, `ruleslist`, `rulesget<code>`, `rulessearch`, `ruleslint`, and `rulespull` **all read the current draft**.\n- **Latest Published Version = `--versionlatest` (`最新发布`)**: To inspect the latest published version, **always pass `--versionlatest`** (or `--version<number>` for a specific historical version).\n- Publishing or deleting rules can shift `code` numbers across versions, so a `code` in a historical run must be resolved together with `--version<number>` or `--record-id<recordId>`.\n\n## Count Rules\n\nUse count when only scale or existence matters.\n\n```bash\n#Countcurrentdraftrules(default)\nseal-userulescount--corp<corpId>\n\n#Countrulesinlatestpublishedversion\nseal-userulescount--versionlatest--corp<corpId>\n```\n\nExpected shape:\n\n```json\n{\"count\": 191 }\n```\n\n## List Rule Summaries\n\nUse summaries for navigation and selection.\n\n```bash\n# List current draft rule summaries (default)\nseal-use rules list --summary --corp <corpId>\n\n# List latest published version rule summaries\nseal-use rules list --version latest --summary --corp <corpId>\n```\n\nDefault summary includes `code`, `status`, `strictness`, `scope`, and `updatedAt`. Do not pull full `description` fields across all rules unless the user needs rule text.\n\n## Get One Rule (Draft or Published Version)\n\nRead a single rule from the current draft (default):\n\n```bash\nseal-use rules get 0038 --corp <corpId>\n```\n\nRead a single rule from the latest published version, a specific published version, or the version used by an approval run:\n\n```bash\nseal-use rules get 0038 --version latest --corp <corpId>\nseal-use rules get 0038 --version 16 --corp <corpId>\nseal-use rules get 0205 --record-id <recordId> --corp <corpId>\n```\n\nReturns `id`, `code`, `ruleCode`, `runtimeRuleId`, `description`, `scope`, `strictness`, `status`, and version metadata when reading from a published version.\n\n## Search Rules Compactly\n\n```bash\n# Search current draft rules (default)\nseal-use rules search <keyword> --maxResults 20 --corp <corpId>\n\n# Search latest published version or a specific historical version\nseal-use rules search <keyword> --version latest --maxResults 20 --corp <corpId>\nseal-use rules search <keyword> --version 16 --maxResults 20 --corp <corpId>\n```\n\n## Clear Draft Rules Before Import\n\nUse this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.\n\n```bash\nseal-use rules clear --dry-run --corp <corpId>\nseal-use rules clear --yes --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{\n \"corpId\": \"xiezihao\",\n \"dryRun\": false,\n \"beforeCount\": 49,\n \"deleted\": 49,\n \"afterCount\": 0\n}\n```\n\n## Output Discipline\n\nIf a rule command would return many descriptions or more than about 20 rules, use `rules count`, `rules list --summary`, `rules search`, or `--output-file`. Use `--full` only for deliberate exports.\n";varby0=()=>{};varny0="#SealApprovalRuleLinter&QualityValidation\n\nUsethisreferencewhenanalyzing,validating,orlintingSealAIapprovalrulestodetectvaguephrasing,missingexceptionevidence,orformattingdefectsbeforepublishing.\n\n##KeyPrinciples\n\n-**DefaultState**:Linteris**disabledbydefault**inglobalconfiguration(`lint.enabled: false`)toavoidunsolicitednoiseduringstandardoperations.\n-**DoctorVisibility**:`seal-use doctor`auditstherulelinterconfigurationstateandactivelinternameinitshealthchecks,andsurfacesaone-clickhint(`seal-use config lint enable`)whendisabled.\n-**ExplicitTriggering**:`seal-use rules lint`alwaysrunsregardlessofglobalconfiguration.\n-**DraftHook**:When`seal-use config lint enable`isset,`seal-use rules update`outputsreal-timediagnosticwarningsto`stderr`withoutmutating`stdout`payloads.\n-**Fault-TolerantFallback**:Ifacustom`.ts`linterfilehassyntaxerrors,runtimeexceptions,orismissing,theenginelogsawarningto`stderr`and**silentlyfallsbacktothebuilt-inheuristiclinterwithoutfailing**.\n\n##CLICommands\n\n###1.LintCurrentDraftRules(Whole-RuleSetScan)\n\n```bash\nseal-use rules lint --corp <corpId>\n```\n\n###2.LintSpecificHistoricalVersionorSingleRule\n\n```bash\n# Lint rules in published version 16\nseal-use rules lint --version 16 --corp <corpId>\n\n# Lint a specific rule by code\nseal-use rules lint --code 0038 --corp <cor
Line truncated
A**Webhookresourcepack**(webhook资源包/资源包,CLI:\`resource-pack\`, alias: \`pack\`, legacy alias: \`material-pack\`) is a ZIP file that bundles an Excel information sheet (\`信息表.xlsx\`) with attachments organised by document ID. It is designed for exporting online approval runs and transferring them offline across environments or teams to be replayed via inbound Webhooks.
@@ -2381,10 +2381,10 @@ The direct local \`resource-pack preview\` command uses the default or temporary
|\`附件后缀不在白名单中\` | Attachment extension is not allowed by the Webhook policy | Add the extension with \`--allowed-extensions\` or convert the file |
|\`附件上传失败 <status>\` | Network/server error during file upload | Check webhook URL, secret, and server availability |
`;var lg0=()=>{};var Lx1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO
Line truncated
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function eo($){let Y=$?.targetSkillsDir??tg0(),U=$?.configFile??eg0(),I=$y0(),Q=!1;if(lq(U))try{let J=JSON.parse(ag0(U,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((K)=>K?.path===Y)}catch{}return{detected:I,configured:Q,configPath:U,targetDir:Y}}var $r=()=>{};import{cpSync as Ax1,existsSync as az,lstatSync as Uy0,mkdirSync as Px1,realpathSync as KY,rmSync as Tx1,symlinkSync as Ex1,unlinkSync as Yy0}from"node:fs";import{homedir as Iy0}from"node:os";import{dirname as Qy0,join as zY}from"node:path";function jx1($,Y){let U=Y?.baseHomeDir??Iy0(),I=zY(U,$.rootDirName),Q=Y?.sourceSkillDir??zY(U,".agents","skills","seal-use"),J=Qy0(Q),K=zY(I,"skills"),z=zY(K,"seal-use");if(!az(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(az(K)&&az(J))try{if(KY(K)===KY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}Px1(K,{recursive:!0});let G;try{G=Uy0(z)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(KY(z)===KY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:z}}catch{}try{Yy0(z)}catch{}}else if(G.isDirectory())Tx1(z,{recursive:!0,force:!0}),H=!0;else Yy0(z);let W=process.platform==="win32"?"junction":"dir";try{return Ex1(Q,z,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:z}}catch{try{return Ax1(Q,z,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:z}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:z,error:X?.message||String(X)}}}}function Cx1($,Y){let U=Y?.baseHomeDir??Iy0(),I=zY(U,$.rootDirName),Q=Y?.sourceSkillDir??zY(U,".agents","skills","seal-use"),J=Qy0(Q),K=zY(I,"skills"),z=zY(K,"seal-use");if(!az(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(az(K)&&az(J))try{if(KY(K)===KY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}let G;try{G=Uy0(z)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(KY(z)===KY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:z}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:z}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:z}}function Yr($){return Jy0.map((Y)=>jx1(Y,$))}function Ur($){return Jy0.map((Y)=>Cx1(Y,$))}var Jy0;var Ir=m(()=>{Jy0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Qr=m(()=>{$r();Ir();$r();Ir()});import{existsSync as Rx1,mkdirSync as Jr,readFileSync as _x1,rmSync as vx1,writeFileSync as Ky0}from"node:fs";import{homedir as Gy0}from"node:os";import{dirname as zy0,join as rq}from"node:path";function Kr(){return Hy0["SKILL.md"]||""}function Wy0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function Xy0($=rq(lI(),"SKILL.md")){try{return Wy0(_x1($,"utf8"))}catch{return}}function lI(){return rq(Gy0(),".agents","skills","seal-use")}function hx1(){return rq(Gy0(),".agents","skills","seal-home")}function gx1(){let $=hx1();if(Rx1($))try{return vx1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function Zy0($=lI()){gx1(),Jr($,{recursive:!0});let Y=[];for(let[U,I]of Object.entries(Hy0)){let Q=rq($,U);Jr(zy0(Q),{recursive:!0}),Ky0(Q,I,"utf8"),Y.push(U)}for(let[U,I]of Object.entries(Sx1)){let Q=rq($,U);Jr(zy0(Q),{recursive:!0}),Ky0(Q,I),Y.push(U)}return{targetDir:$,files:Y}}var Hy0,Sx1,eZ4;var sq=m(()=>{ro();ro();Qr();Hy0=rg0,Sx1=Object.fromEntries(Object.entries(sg0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));eZ4=Wy0(Kr())});function qy0(){return`#SealUse系统架构与运行规范白皮书
`;var my0=()=>{};var Vx1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO
Line truncated
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function to($){let Y=$?.targetSkillsDir??ay0(),U=$?.configFile??ty0(),I=ey0(),Q=!1;if(sq(U))try{let J=JSON.parse(sy0(U,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((K)=>K?.path===Y)}catch{}return{detected:I,configured:Q,configPath:U,targetDir:Y}}var eo=()=>{};import{cpSync as Ax1,existsSync as $G,lstatSync as Yg0,mkdirSync as Bx1,realpathSync as GY,rmSync as Px1,symlinkSync as Tx1,unlinkSync as $g0}from"node:fs";import{homedir as Ug0}from"node:os";import{dirname as Ig0,join as HY}from"node:path";function Ex1($,Y){let U=Y?.baseHomeDir??Ug0(),I=HY(U,$.rootDirName),Q=Y?.sourceSkillDir??HY(U,".agents","skills","seal-use"),J=Ig0(Q),K=HY(I,"skills"),z=HY(K,"seal-use");if(!$G(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if($G(K)&&$G(J))try{if(GY(K)===GY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}Bx1(K,{recursive:!0});let G;try{G=Yg0(z)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(GY(z)===GY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:z}}catch{}try{$g0(z)}catch{}}else if(G.isDirectory())Px1(z,{recursive:!0,force:!0}),H=!0;else $g0(z);let W=process.platform==="win32"?"junction":"dir";try{return Tx1(Q,z,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:z}}catch{try{return Ax1(Q,z,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:z}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:z,error:X?.message||String(X)}}}}function jx1($,Y){let U=Y?.baseHomeDir??Ug0(),I=HY(U,$.rootDirName),Q=Y?.sourceSkillDir??HY(U,".agents","skills","seal-use"),J=Ig0(Q),K=HY(I,"skills"),z=HY(K,"seal-use");if(!$G(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if($G(K)&&$G(J))try{if(GY(K)===GY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}let G;try{G=Yg0(z)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(GY(z)===GY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:z}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:z}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:z}}function $r($){return Qg0.map((Y)=>Ex1(Y,$))}function Yr($){return Qg0.map((Y)=>jx1(Y,$))}var Qg0;var Ur=o(()=>{Qg0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Ir=o(()=>{eo();Ur();eo();Ur()});import{existsSync as Cx1,mkdirSync as Qr,readFileSync as Rx1,rmSync as _x1,writeFileSync as Jg0}from"node:fs";import{homedir as zg0}from"node:os";import{dirname as Kg0,join as tq}from"node:path";function Jr(){return Gg0["SKILL.md"]||""}function Hg0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function Wg0($=tq(rI(),"SKILL.md")){try{return Hg0(Rx1($,"utf8"))}catch{return}}function rI(){return tq(zg0(),".agents","skills","seal-use")}function Sx1(){return tq(zg0(),".agents","skills","seal-home")}function hx1(){let $=Sx1();if(Cx1($))try{return _x1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function Xg0($=rI()){hx1(),Qr($,{recursive:!0});let Y=[];for(let[U,I]of Object.entries(Gg0)){let Q=tq($,U);Qr(Kg0(Q),{recursive:!0}),Jg0(Q,I,"utf8"),Y.push(U)}for(let[U,I]of Object.entries(vx1)){let Q=tq($,U);Qr(Kg0(Q),{recursive:!0}),Jg0(Q,I),Y.push(U)}return{targetDir:$,files:Y}}var Gg0,vx1,Xq4;var eq=o(()=>{oo();oo();Ir();Gg0=oy0,vx1=Object.fromEntries(Object.entries(ry0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));Xq4=Hg0(Jr())});function Zg0(){return`#SealUse系统架构与运行规范白皮书
toloopback(\`--host 127.0.0.1\`) and do not expose the port to a network or an origin you
donotcontrol.
`}},parameters:{CorpId:{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."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{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:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{typ
Line truncated
`}},parameters:{CorpId:{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."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{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:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{typ
Line truncated
`);Q(I)})})}var FE=8787,wE="127.0.0.1";var Vr=m(()=>{yy0();z3()});async function ky0($){let Y=l0($.options.port)??l0($.options.p),U=R($.options.host)??R($.options.h),I=await ME({port:Y,host:U}),Q=()=>{I.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var xy0=m(()=>{V4();Vr()});async function fy0($,Y,U,I){if($==="config"||$==="get"){await R0("seal_llm_config_get",Y,U,{},T0(I.options));return}if($==="providers"||$==="list"){await R0("seal_llm_providers_list",Y,U,{},T0(I.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var uy0=m(()=>{N4();e1()});async function by0($,Y){if($==="config"||$==="json"){Lr();return}let{startServer:U}=await ny0().then(() => cy0);U()}function Lr(){j0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var iy0=m(()=>{e1()});function dy0($){let Y=qE();j0(Y,{...T0($.options),allowFull:!0})}var py0=m(()=>{Zr();e1()});async function my0($,Y,U,I){if($==="available"){await R0("seal_permissions_available_list",Y,U,{},T0(I.options));return}if($==="configs"||$==="list"){await R0("seal_permissions_configs_list",Y,U,{},T0(I.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var ly0=m(()=>{N4();e1()});import{readFileSync as oy0}from"node:fs";async function ry0($,Y,U,I,Q,J,K){if(!$||$==="get"){await R0("seal_preference_get",Q,J,{},T0(K.options));return}if($==="decision"){if(Y==="update"||!Y){let z=R(K.options.input),G=z?JSON.parse(oy0(z,"utf8")):L6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await R0("seal_preference_decision_update",Q,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let z=R(K.options.default)??R(K.options.level)??I;if(z!=="medium"&&z!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await R0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(Y==="policies"){if(U==="list"||!U){await R0("seal_preference_thinking_depth_policies_list",Q,J,{},T0(K.options));return}if(U==="upsert"){let z=R(K.options.input),G=z?JSON.parse(oy0(z,"utf8")):L6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await R0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(U==="remove"||U==="delete"){let z=I??R(K.options.id)??R(K.options.policyId);if(!z)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await R0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var sy0=m(()=>{N4();V4();e1()});async function ay0($={}){let Y=Q$(),U=P4(),I=l2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},n3());console.log(`[probe]corp=${I.id}source=${I.source.type}`);let Q=await oz(I);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await A1(I),K=await cM(J,{documentLimit:20,stylePreferencesEndpoint:I.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error:${K.stylePreferences.error}`},null,2))}var ty0=m(()=>{r$();b6();rT();W4()});async function ey0($,Y,U){let I=Y??R(U.options.corp)??($&&$!=="--corp"?$:void 0);await ay0({corpId:I})}var $k0=m(()=>{ty0();V4()});import{readFileSync as mx1}from"node:fs";function Yk0($,Y){let U=R($.options.descriptionFile)??R($.options["description-file"]);if(U)return mx1(U,"utf8").trim();let I=R($.options.description)??R($.options.desc);if(I!==void 0)return I;return typeof Y.description==="string"?Y.description:void 0}function GY($,Y){let U=R($.options.version);if(U!==void 0)return U;if(z0($.options.latest))return"latest";if(Y!==void 0&&!Y.startsWith("-"))return Y;return}async function Fr($,Y,U,I,Q){if(!U&&!($==="lint"||$==="linters"||$==="linter-list"||$==="map"))throw Error(`rules${$??""}requiresanauthenticatedenterprise.Run'seal-use corps list'toselectone.`);if($==="count"){let K=GY(Q);await R0("seal_approval_rules_list",U,I,{version:K,countOnly:!0},T0(Q.options));return}if($==="list"){let K=GY(Q);if(z0(Q.options.count)){await R0("seal_approval_rules_list",U,I,{version:K,countOn
Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function ax1($){let Y=BE($),U=Or($),I=eq($);Kk0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):FE),J=$.host??(process.env.HOST?process.env.HOST:wE);NE(Y,`${process.pid}
`,{mode:384}),NE(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),tz(I,`servicestartingonhttp://${J}:${Q} pid=${process.pid}`);let K=null;try{K=await ME({port:Q,host:J,silent:!0}),tz(I,`service listening pid=${process.pid}`)}catch(G){if(tz(I,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),DE(Y)===process.pid)i9(Y,{force:!0}),i9(U,{force:!0});throw G}let z=()=>{if(K)K.close(),K=null;if(DE(Y)===process.pid)i9(Y,{force:!0}),i9(U,{force:!0});tz(I,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,z(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function Ik0($){Kk0($.stateDir);let Y=oI($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},I=[...U.args??[],"service","run"];if($.port)I.push("--port",String($.port));if($.host)I.push("--host",String($.host));let Q=lx1(U.command,I,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=BE($);return NE(J,`${Q.pid}
`,{flag:"a",mode:384})}var Nr=m(()=>{Vr()});import{homedir as ex1}from"node:os";import{join as $f1}from"node:path";async function Br($,Y,U){let I=U?l0(U.options.port)??l0(U.options.p):void 0,Q=U?R(U.options.host)??R(U.options.h):void 0,J=U?l0(U.options.lines)??l0(U.options.n):void 0,K=await U7($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Dr,version:Z1,launcher:Y.launcher,port:I,host:Q},{maxLines:J});if(K!==void 0)j0(K)}var Dr;var Ar=m(()=>{z3();Nr();e1();V4();Dr=$f1(ex1(),".config","seal-use")});import{existsSync as Yf1,readFileSync as zk0}from"node:fs";async function Gk0($,Y,U,I,Q){if($==="batch-records"||$==="records"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await R0("seal_simulation_batch_records_get",U,I,{batchId:J,query:R(Q.options.query)},T0(Q.options));return}if($==="create"||$==="run"){let J=R(Q.options.mode)??R(Q.options.sourceSystem)??R(Q.options["source-system"])??"hosecloud",K=J==="material-pack"?"material_pack":J,z=R(Q.options.schemaConfig)??R(Q.options["schema-config"]),G=z?JSON.parse(zk0(z,"utf8")):void 0,H=R(Q.options.input),W=H?JSON.parse(zk0(H,"utf8")):L6(Q.json),X=R(Q.options.packageId)??R(Q.options["package-id"]),Z=k4(Q.options.packageIds)??k4(Q.options["package-ids"])??(X?[X]:void 0),q=k4(Q.options.flowIds)??k4(Q.options["flow-ids"])??k4(Q.options.documentSn)??k4(Q.options["document-sn"]),V=R(Q.options.signKey)??R(Q.options["sign-key"])??R(Q.options.integration),w=z0(Q.options.wait)===!0,M=z0(Q.options.noWait)??z0(Q.options["no-wait"])??(w?!1:!0),F=await E$("seal_simulation_batch_create",U,I,{mode:K,sourceSystem:K,flowIds:q,documentSn:q,rejectNodeName:R(Q.options.rejectNode)??R(Q.options["reject-node"])??null,thinkingDepthOverride:R(Q.options.thinkingDepth)??R(Q.options["thinking-depth"]),skipInvoiceGeneration:z0(Q.options.skipInvoiceGeneration)??z0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:z0(Q.options.skipExpenseExtraction)??z0(Q.options["skip-expense-extraction"]),disableAttachmentCache:z0(Q.options.disableAttachmentCache)??z0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:R(Q.options.templateId)??R(Q.options["template-id"]),schemaConfig:G,requestIds:k4(Q.options.requestIds)??k4(Q.options["request-ids"]),workflowTypeId:R(Q.options.workflowTypeId)??R(Q.options["workflow-type-id"]),flowStatusList:k4(Q.options.flowStatusList)?.map(Number)??k4(Q.options["flow-status-list"])?.map(Number),businessCodes:k4(Q.options.businessCodes)??k4(Q.options["business-codes"]),documentType:R(Q.options.documentType)??R(Q.options["document-type"]),startTime:l0(Q.options.startTime)??l0(Q.options["start-time"]),endTime:l0(Q.options.endTime)??l0(Q.options["end-time"]),status:k4(Q.options.status),limit:l0(Q.options.limit),noWait:M,rawParams:W});if(w&&F&&typeof F==="object"&&"batchId"in F&&typeof F.batchId==="string"){await R0("seal_simulation_batch_wait",U,I,{batchId:F.batchId,timeout:R(Q.options.timeout),pollInterval:R(Q.options.pollInterval)??R(Q.options["poll-interval"])},T0(Q.options));return}j0(F,T0(Q.options));return}if($==="wait"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await R0("seal_simulation_batch_wait",U,I,{batchId:J,timeout:R(Q.options.timeout),pollInterval:R(Q.options.pollInterval)??R(Q.options["poll-interval"])},T0(Q.options));return}if($==="status"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await R0("seal_simulation_batch_status",U,I,{batchId:J},T0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await R0("seal_simulation_batch_clean",U,I,{batchId:J},T0(Q.options));return}if($==="specifications"){let J=Y??R(Q.options.integration)??R(Q.options.signKey)??R(Q.options["sign-key"]);await R0("seal_simulation_specifications_list",U,I,{signKey:J},T0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await R0("seal_simulation_feishu_approval_definitions_list",U,I,{},T0(Q.options));return}if($==="list"){await R0("seal_simulation_batches_list",U,I,{limit:l0(Q.options.limit)},T0(Q.options));return}if($==="get"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await R0("seal_simulation_batch_get",U,I,{batchId:J},T0(Q.options));return}if($==="templates"){await R0("seal_simulation_templates_get",U,I,{},T0(Q.options));return}if($==="integrations"){await R0("seal_simulation_integrations_get",U,I,{},T0(Q.options));return}if($==="package-upload"){let J=Y??R(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Yf1(J))throw Error(`Filenotfound:${J}`);await R0("seal_simulation_material_package_upload",U,I,{filePath:J},T0(Q.o
Line truncated
`);return}if($==="install"||$==="init"||$==="sync"){let I=z0(U.options.local)||z0(U.options.workspace),Q=R(U.options.dir)??R(U.options.target)??Y,J=Q?Q:I?AE(process.cwd(),".agents","skills","seal-use"):lI(),K=Zy0(J),z=!I&&!Q,G=z?to():void 0,H=z?Yr():void 0;j0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let I=lI(),Q=AE(process.cwd(),".agents","skills","seal-use"),J=eo(),K=Ur();j0({global:{dir:I,installed:Wk0(AE(I,"SKILL.md"))},local:{dir:Q,installed:Wk0(AE(Q,"SKILL.md"))},antigravity:J,hosts:K});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Zk0=m(()=>{Qr();sq();V4();e1()});async function qk0($,Y){if($==="config"){j0(await oz(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Vk0=m(()=>{rT();e1()});function Pr($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function Lk0($){let{sourceCorp:Y,targetCorp:U,sourceClient:I,targetClient:Q,samples:J=10,dryRun:K=!1,pollIntervalMs:z=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new z4(`重放目标企业「${U.name}」(${U.id})的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Y.id}<testCorpId>`);let X=await $U(Q),q=(Array.isArray(X.features)?X.features:[]).find((p)=>p?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,w=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*w;if(V<M)throw new z4(`测试企业「${U.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${J}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/w))})`);let F=await f4(I,{limit:J,status:"completed"}),N=Array.isArray(F.records)?F.records:[];if(N.length===0){let p=await f4(I,{limit:J});N=Array.isArray(p.records)?p.records:[]}if(N.length===0)throw new z4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),K){let p=N.map((a)=>{let $0=a.sourceDocumentSN??a.id,y=a?.result?.decision??a.aiDecision??a?.decision,d=Pr(y),Y0=a?.result?.summary??a.aiSummary;return{sn:$0,sourceRecordId:a.id,prodDecision:d,prodSummary:Y0,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M},metrics:{sampleCount:p.length,successCount:p.length,failureCount:0,matchCount:p.length,flipCount:0,concordanceRate:1},flips:[],records:p}}let O=await Lp(Q,U,$.webhookSelector),D=[];for(let p of N){let a=Date.now(),$0=p.sourceDocumentSN??p.id,y=Pr(p?.result?.decision??p.aiDecision??p?.decision),d=p?.result?.summary??p.aiSummary;try{let Y0=await H4(I,p.id),h=`${H}${$0}`,o=qp(Y0,{snPrefix:H,docIdPrefix:H});await Vp(O.incomingDocumentWebhook.url,O.secret,o,W,E6(U.seal));let e=null,w0=Date.now();while(Date.now()-w0<G){await new Promise((X0)=>setTimeout(X0,z));let t=await f4(Q,{sourceDocumentSN:h,limit:1});if(t.records&&t.records.length>0){let X0=t.records[0];if(X0.status==="completed"||X0.status==="failed"){e=X0;break}}}if(!e){D.push({sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-a});continue}let N0=Pr(e?.result?.decision??e.aiDecision??e?.decision??(e.status==="completed"?"APPROVE":"ERROR")),_0=e?.result?.summary??e.aiSummary,v0=y===N0,r0=v0?"MATCHED":"FLIPPED",K1={sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,testRecordId:e.id,testDecision:N0,testSummary:_0,status:r0,durationMs:Date.now()-a};if(!v0)K1.diff={from:y,to:N0,reasonDiff:_0&&d&&_0!==d?`生产:${d.slice(0,60)}...->测试:${_0.slice(0,60)}...`:void 0};D.push(K1)}catch(Y0){D.push({sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,status:"FAILED",error:Y0 instanceof Error?Y0.message:String(Y0),durationMs:Date.now()-a})}}let P=D.filter((p)=>p.status==="MATCHED"||p.status==="FLIPPED"),T=D.filter((p)=>p.status==="MATCHED"),B=D.filter((p)=>p.status==="FLIPPED"),E=D.filter((p)=>p.status==="FAILED").length,C=T.length,i=B.length,x=C+i,g=x>0?C/x:0,b=i>0,c=b?"REGRESSIONS_DETECTED":"CLEAN",I0=!b&&E===0,k;try{let p=await $U(Q),$0=(Array.isArray(p.features)?p.features:[]).find((y)=>y?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!b&&E===0,verdict:c,safeToPublish:I0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:E,matchCount:C,flipCount:i,concordanceRate:Number(g.toFixed(4))},flips:B,records:D}}function Fk0($){let{sourceCorp:Y,targetCorp:U,verdict:I,safeToPublish:Q,metrics:J,quota:K,flips:z,records:G}=$,H=I==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":I==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${U.name}」`,`判定:${H}·准许发布:${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${J.sampleCount}|一致通过:${J.matchCount}|决策翻转:${J.flipCount}|异常失败:${J.failureCount}`,`一致率:${(J.concordanceRate*100).toFixed(1)}%|消耗预估:${K.estimatedRequired}点(余量:${K.balanceBefore}${K.balanceAfter!==void0?` -> ${K.balanceAfter}`:""})`," "+"─".repeat(65)];if(z.length>0){W.push(`⚠️决策翻转清单(${z.length}笔单据在新规则下结果改变):`);for(let X of z)if(W.push(`•单据[${X.sn}]:原生产判定「${X.prodDecision}」➔测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)W.push(`理由差异:${X.diff.reasonDiff}`);W.push(" "+"─".repeat(65)),W.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(I==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100%
Line truncated
`)}var wk0=m(()=>{EP();W4();Uq()});async function Tr($,Y,U){let I=($??Y??"regression").toLowerCase();if(I==="regression"||I==="regress"||I==="matrix"){let Q=R(U.options.corp)??(Y&&Y!==I?Y:void 0),J=M1(Q),K=J,z=J;if(J.environment==="test"){z=J;let O=R(U.options["prod-corp"])??R(U.options.prod)??J.prodCorpId;if(!O)throw new z4(`测试企业「${J.name}」(${J.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${J.id}`);K=M1(O)}else{K=J;let O=R(U.options["test-corp"])??R(U.options.test)??J.testCorpId;if(!O)throw new z4(`生产企业「${J.name}」(${J.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${J.id}<testCorpId>`);z=M1(O)}let G=await A1(K),H=await A1(z),W=l0(U.options.samples)??l0(U.options.limit)??l0(U.options.n)??10,X=z0(U.options["dry-run"]),Z=z0(U.options["fail-on-flips"]),q=l0(U.options["poll-interval"])??2000,V=l0(U.options.timeout)??45000,w=R(U.options["sn-prefix"])??"REG_",M=R(U.options.webhook)??R(U.options.selector),F=await Lk0({sourceCorp:K,targetCorp:z,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:w,failOnFlips:Z,webhookSelector:M});if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(Fk0(F));if(j0(F),Z&&!F.ok)throw new z4(`回归测试发现${F.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new z4(`未知的test子命令:"${I}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var Mk0=m(()=>{n8();N4();V4();e1();b6();wk0()});function PE($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var Ok0=m(()=>{sq()});import{existsSync as Uf1,mkdirSync as If1,readFileSync as Qf1,renameSync as Jf1,writeFileSync as Kf1}from"node:fs";import{homedir as zf1}from"node:os";import{dirname as Gf1,join as Hf1}from"node:path";import{spawn as Wf1}from"node:child_process";function Nk0($){return $.replace(/\.\d+Z$/,"Z")}function Dk0(){let $=process.env[Xf1]?.trim();if($)return $;return qf1}function Bk0($=Dk0()){if(!Uf1($))return null;try{let Y=Qf1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return{...U,checkedAt:Nk0(U.checkedAt)};return null}catch{return null}}function $V($,Y=Dk0()){try{let U=Gf1(Y);If1(U,{recursive:!0,mode:448});let I={checkedAt:Nk0($.checkedAt??new Date().toISOString()),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Kf1(Q,JSON.stringify(I,null,2),{mode:384}),Jf1(Q,Y)}catch{}}function Ak0($,Y=Zf1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Pk0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Wf1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Xf1="SEAL_USE_UPDATE_CACHE_FILE",Zf1=86400000,qf1;var Er=m(()=>{qf1=Hf1(zf1(),".config","seal-use","update-cache.json")});import{chmodSync as Vf1,mkdirSync as Lf1,readdirSync as Ff1,realpathSync as Tk0,renameSync as jr,rmSync as wf1,unlinkSync as _k0,writeFileSync as Ek0}from"node:fs";import{basename as Mf1,dirname as Of1,isAbsolute as Nf1,join as jE,relative as Df1}from"node:path";import{spawn as Bf1,spawnSync as I7}from"node:child_process";async function Sk0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Dr,version:Z1,launcher:$.launcher},I=Y.repo||process.env[Af1]?.trim()||process.env[Pf1]?.trim()||vk0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=kk0(D,Z1);if(P<0)if(!Dg&&Y.force);else{j0({updated:!1,currentVersion:Z1,targetVersion:D,mode:PE()?"binary":"source",message:!Dg?`Cannotdowngradeseal-usefromdevbuildv${Z1}toreleasev${D}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${Z1}toolderversionv${D}.Updatesmustbeforward-only.`});return}if(P===0&&!Y.force){j0({updated:!1,currentVersion:Z1,targetVersion:D,mode:PE()?"binary":"source",message:`seal-useisalreadyatversionv${Z1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let D=await EE(I,Y.limit??10);j0({currentVersion:Z1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===Z1,isNewer:f5(P.version,Z1)}))});return}if(!PE()){if(Y.checkOnly){let P=await EE(I,30),T=P[0],B=T?.version??Z1,E=P.find((x)=>x.version===Z1),C=f5(B,Z1),i=P.filter((x)=>f5(x.version,Z1));if(T?.version)$V({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;j0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:E?.publishedAt,latestVersion:B,latestVersionPublishedAt:T?.publishedAt,behindCount:i.length,pendingReleases:i.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=oI(U).running;if(D)await U7("stop",U);try{Rk0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️开发版更新同步失败,继续刷新本地依赖:${PinstanceofError?P.message:String(P)}`)}if(Rk0("bun",["install"],{cwd:$.appRoot}),D)await U7("start",U);j0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(Rf1())try{await _f1($,Y,U,I,J);return}catch(D){console.error(`⚠️Homebrew自动更新失败,回退至原生二进制更新:${DinstanceofError?D.message:String(D)}`)}let K=Ef1(),z=jf1(),G=await EE(I,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await CE(I,J):G[0]??await CE(I);if(!H){j0({updated:!1,currentVersion:Z1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${I}'`});return}let W=H.version,X=G.find((D)=>D.version===Z1),Z=f5(W,Z1),q=Z||Boolean(Y.forc
Line truncated
`)}catch{}}async function hf1($,Y,U,I){let Q=Cr(),J=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,z=I||$.split("/").pop()||"";if(Q!=="github"){if(K&&z)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${z}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${z}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(K&&z){let w=`https://github.com/${vk0}/releases/download/${K}/${z}`;if(!process.env.CI)J.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);J.push(w)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let w=0;w<G.length;w++){let M=G[w],F=new AbortController,N="",O=(B)=>{N=B;try{F.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),P,T;try{TE(`==> [${w+1}/${G.length}] Downloading via: ${M}`);let B=await fetch(M,{signal:F.signal});if(D)clearTimeout(D),D=void 0;if(!B.ok)throw Error(`HTTP ${B.status} ${B.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let E=Number(B.headers.get("content-length"))||0,C=B.body?.getReader();if(!C){let c=Buffer.from(await B.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);Ek0(Y,c),TE(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let i=[],x=0,g=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);O(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),I0,k=new Promise((y,d)=>{I0=setTimeout(()=>{d(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),p;try{p=await Promise.race([c,k])}finally{if(I0)clearTimeout(I0)}let{done:a,value:$0}=p;if(a)break;if($0){if(i.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let y=Date.now();if(y-g>200){g=y;let d=E?Math.round(x/E*100):0,Y0=(x/1048576).toFixed(1),h=E?(E/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${d}% (${Y0} / ${h} MB)...`)}catch{}}}}try{process.stderr.write(`
`);Q(I)})})}var ME=8787,OE="127.0.0.1";var qr=o(()=>{yg0();W3()});async function gg0($){let Y=l0($.options.port)??l0($.options.p),U=R($.options.host)??R($.options.h),I=await NE({port:Y,host:U}),Q=()=>{I.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var kg0=o(()=>{L4();qr()});async function xg0($,Y,U,I){if($==="config"||$==="get"){await v0("seal_llm_config_get",Y,U,{},T0(I.options));return}if($==="providers"||$==="list"){await v0("seal_llm_providers_list",Y,U,{},T0(I.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var fg0=o(()=>{D4();$4()});async function ug0($,Y){if($==="config"||$==="json"){Vr();return}let{startServer:U}=await cg0().then(() => ig0);U()}function Vr(){C0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var bg0=o(()=>{$4()});function ng0($){let Y=LE();C0(Y,{...T0($.options),allowFull:!0})}var dg0=o(()=>{Xr();$4()});async function pg0($,Y,U,I){if($==="available"){await v0("seal_permissions_available_list",Y,U,{},T0(I.options));return}if($==="configs"||$==="list"){await v0("seal_permissions_configs_list",Y,U,{},T0(I.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var mg0=o(()=>{D4();$4()});import{readFileSync as lg0}from"node:fs";async function og0($,Y,U,I,Q,J,K){if(!$||$==="get"){await v0("seal_preference_get",Q,J,{},T0(K.options));return}if($==="decision"){if(Y==="update"||!Y){let z=R(K.options.input),G=z?JSON.parse(lg0(z,"utf8")):F6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await v0("seal_preference_decision_update",Q,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let z=R(K.options.default)??R(K.options.level)??I;if(z!=="medium"&&z!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await v0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(Y==="policies"){if(U==="list"||!U){await v0("seal_preference_thinking_depth_policies_list",Q,J,{},T0(K.options));return}if(U==="upsert"){let z=R(K.options.input),G=z?JSON.parse(lg0(z,"utf8")):F6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await v0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(U==="remove"||U==="delete"){let z=I??R(K.options.id)??R(K.options.policyId);if(!z)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await v0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var rg0=o(()=>{D4();L4();$4()});async function sg0($={}){let Y=K$(),U=T4(),I=r2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},m3());console.log(`[probe]corp=${I.id}source=${I.source.type}`);let Q=await az(I);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await P1(I),K=await pM(J,{documentLimit:20,stylePreferencesEndpoint:I.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error:${K.stylePreferences.error}`},null,2))}var ag0=o(()=>{t$();i6();aT();X4()});async function tg0($,Y,U){let I=Y??R(U.options.corp)??($&&$!=="--corp"?$:void 0);await sg0({corpId:I})}var eg0=o(()=>{ag0();L4()});import{readFileSync as px1}from"node:fs";function $k0($,Y){let U=R($.options.descriptionFile)??R($.options["description-file"]);if(U)return px1(U,"utf8").trim();let I=R($.options.description)??R($.options.desc);if(I!==void 0)return I;return typeof Y.description==="string"?Y.description:void 0}function WY($,Y){let U=R($.options.version);if(U!==void 0)return U;if(z0($.options.latest))return"latest";if(Y!==void 0&&!Y.startsWith("-"))return Y;return}async function Lr($,Y,U,I,Q){if(!U&&!($==="lint"||$==="linters"||$==="linter-list"||$==="map"))throw Error(`rules${$??""}requiresanauthenticatedenterprise.Run'seal-use corps list'toselectone.`);if($==="count"){let K=WY(Q);await v0("seal_approval_rules_list",U,I,{version:K,countOnly:!0},T0(Q.options));return}if($==="list"){let K=WY(Q);if(z0(Q.options.count)){await v0("seal_approval_rules_list",U,I,{version:K,countOn
Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function sx1($){let Y=PE($),U=Mr($),I=UV($);Jk0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):ME),J=$.host??(process.env.HOST?process.env.HOST:OE);AE(Y,`${process.pid}
`,{mode:384}),AE(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:A1()},null,2),{mode:384}),YG(I,`servicestartingonhttp://${J}:${Q} pid=${process.pid}`);let K=null;try{K=await NE({port:Q,host:J,silent:!0}),YG(I,`service listening pid=${process.pid}`)}catch(G){if(YG(I,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),BE(Y)===process.pid)d9(Y,{force:!0}),d9(U,{force:!0});throw G}let z=()=>{if(K)K.close(),K=null;if(BE(Y)===process.pid)d9(Y,{force:!0}),d9(U,{force:!0});YG(I,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,z(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function Uk0($){Jk0($.stateDir);let Y=sI($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},I=[...U.args??[],"service","run"];if($.port)I.push("--port",String($.port));if($.host)I.push("--host",String($.host));let Q=mx1(U.command,I,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=PE($);return AE(J,`${Q.pid}
`,{flag:"a",mode:384})}var Or=o(()=>{qr()});import{homedir as tx1}from"node:os";import{join as ex1}from"node:path";async function Dr($,Y,U){let I=U?l0(U.options.port)??l0(U.options.p):void 0,Q=U?R(U.options.host)??R(U.options.h):void 0,J=U?l0(U.options.lines)??l0(U.options.n):void 0,K=await J7($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Nr,version:Z1,launcher:Y.launcher,port:I,host:Q},{maxLines:J});if(K!==void 0)C0(K)}var Nr;var Ar=o(()=>{W3();Or();$4();L4();Nr=ex1(tx1(),".config","seal-use")});import{existsSync as $f1,readFileSync as Kk0}from"node:fs";async function zk0($,Y,U,I,Q){if($==="batch-records"||$==="records"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await v0("seal_simulation_batch_records_get",U,I,{batchId:J,query:R(Q.options.query)},T0(Q.options));return}if($==="create"||$==="run"){let J=R(Q.options.mode)??R(Q.options.sourceSystem)??R(Q.options["source-system"])??"hosecloud",K=J==="material-pack"?"material_pack":J,z=R(Q.options.schemaConfig)??R(Q.options["schema-config"]),G=z?JSON.parse(Kk0(z,"utf8")):void 0,H=R(Q.options.input),W=H?JSON.parse(Kk0(H,"utf8")):F6(Q.json),X=R(Q.options.packageId)??R(Q.options["package-id"]),Z=x4(Q.options.packageIds)??x4(Q.options["package-ids"])??(X?[X]:void 0),q=x4(Q.options.flowIds)??x4(Q.options["flow-ids"])??x4(Q.options.documentSn)??x4(Q.options["document-sn"]),V=R(Q.options.signKey)??R(Q.options["sign-key"])??R(Q.options.integration),w=z0(Q.options.wait)===!0,M=z0(Q.options.noWait)??z0(Q.options["no-wait"])??(w?!1:!0),F=await C$("seal_simulation_batch_create",U,I,{mode:K,sourceSystem:K,flowIds:q,documentSn:q,rejectNodeName:R(Q.options.rejectNode)??R(Q.options["reject-node"])??null,thinkingDepthOverride:R(Q.options.thinkingDepth)??R(Q.options["thinking-depth"]),skipInvoiceGeneration:z0(Q.options.skipInvoiceGeneration)??z0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:z0(Q.options.skipExpenseExtraction)??z0(Q.options["skip-expense-extraction"]),disableAttachmentCache:z0(Q.options.disableAttachmentCache)??z0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:R(Q.options.templateId)??R(Q.options["template-id"]),schemaConfig:G,requestIds:x4(Q.options.requestIds)??x4(Q.options["request-ids"]),workflowTypeId:R(Q.options.workflowTypeId)??R(Q.options["workflow-type-id"]),flowStatusList:x4(Q.options.flowStatusList)?.map(Number)??x4(Q.options["flow-status-list"])?.map(Number),businessCodes:x4(Q.options.businessCodes)??x4(Q.options["business-codes"]),documentType:R(Q.options.documentType)??R(Q.options["document-type"]),startTime:l0(Q.options.startTime)??l0(Q.options["start-time"]),endTime:l0(Q.options.endTime)??l0(Q.options["end-time"]),status:x4(Q.options.status),limit:l0(Q.options.limit),noWait:M,rawParams:W});if(w&&F&&typeof F==="object"&&"batchId"in F&&typeof F.batchId==="string"){await v0("seal_simulation_batch_wait",U,I,{batchId:F.batchId,timeout:R(Q.options.timeout),pollInterval:R(Q.options.pollInterval)??R(Q.options["poll-interval"])},T0(Q.options));return}C0(F,T0(Q.options));return}if($==="wait"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await v0("seal_simulation_batch_wait",U,I,{batchId:J,timeout:R(Q.options.timeout),pollInterval:R(Q.options.pollInterval)??R(Q.options["poll-interval"])},T0(Q.options));return}if($==="status"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await v0("seal_simulation_batch_status",U,I,{batchId:J},T0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await v0("seal_simulation_batch_clean",U,I,{batchId:J},T0(Q.options));return}if($==="specifications"){let J=Y??R(Q.options.integration)??R(Q.options.signKey)??R(Q.options["sign-key"]);await v0("seal_simulation_specifications_list",U,I,{signKey:J},T0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await v0("seal_simulation_feishu_approval_definitions_list",U,I,{},T0(Q.options));return}if($==="list"){await v0("seal_simulation_batches_list",U,I,{limit:l0(Q.options.limit)},T0(Q.options));return}if($==="get"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await v0("seal_simulation_batch_get",U,I,{batchId:J},T0(Q.options));return}if($==="templates"){await v0("seal_simulation_templates_get",U,I,{},T0(Q.options));return}if($==="integrations"){await v0("seal_simulation_integrations_get",U,I,{},T0(Q.options));return}if($==="package-upload"){let J=Y??R(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!$f1(J))throw Error(`Filenotfound:${J}`);await v0("seal_simulation_material_package_upload",U,I,{filePath:J},T0(Q.o
Line truncated
`);return}if($==="install"||$==="init"||$==="sync"){let I=z0(U.options.local)||z0(U.options.workspace),Q=R(U.options.dir)??R(U.options.target)??Y,J=Q?Q:I?TE(process.cwd(),".agents","skills","seal-use"):rI(),K=Xg0(J),z=!I&&!Q,G=z?ao():void 0,H=z?$r():void 0;C0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let I=rI(),Q=TE(process.cwd(),".agents","skills","seal-use"),J=to(),K=Yr();C0({global:{dir:I,installed:Hk0(TE(I,"SKILL.md"))},local:{dir:Q,installed:Hk0(TE(Q,"SKILL.md"))},antigravity:J,hosts:K});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Xk0=o(()=>{Ir();eq();L4();$4()});async function Zk0($,Y){if($==="config"){C0(await az(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var qk0=o(()=>{aT();$4()});function Br($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function Vk0($){let{sourceCorp:Y,targetCorp:U,sourceClient:I,targetClient:Q,samples:J=10,dryRun:K=!1,pollIntervalMs:z=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new G4(`重放目标企业「${U.name}」(${U.id})的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Y.id}<testCorpId>`);let X=await UU(Q),q=(Array.isArray(X.features)?X.features:[]).find((m)=>m?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,w=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*w;if(V<M)throw new G4(`测试企业「${U.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${J}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/w))})`);let F=await u4(I,{limit:J,status:"completed"}),N=Array.isArray(F.records)?F.records:[];if(N.length===0){let m=await u4(I,{limit:J});N=Array.isArray(m.records)?m.records:[]}if(N.length===0)throw new G4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),K){let m=N.map((t)=>{let $0=t.sourceDocumentSN??t.id,y=t?.result?.decision??t.aiDecision??t?.decision,p=Br(y),Y0=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:Y0,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:A1(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M},metrics:{sampleCount:m.length,successCount:m.length,failureCount:0,matchCount:m.length,flipCount:0,concordanceRate:1},flips:[],records:m}}let O=await Fp(Q,U,$.webhookSelector),D=[];for(let m of N){let t=Date.now(),$0=m.sourceDocumentSN??m.id,y=Br(m?.result?.decision??m.aiDecision??m?.decision),p=m?.result?.summary??m.aiSummary;try{let Y0=await W4(I,m.id),g=`${H}${$0}`,c=Vp(Y0,{snPrefix:H,docIdPrefix:H});await Lp(O.incomingDocumentWebhook.url,O.secret,c,W,j6(U.seal));let e=null,V0=Date.now();while(Date.now()-V0<G){await new Promise((X0)=>setTimeout(X0,z));let a=await u4(Q,{sourceDocumentSN:g,limit:1});if(a.records&&a.records.length>0){let X0=a.records[0];if(X0.status==="completed"||X0.status==="failed"){e=X0;break}}}if(!e){D.push({sn:$0,sourceRecordId:m.id,prodDecision:y,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-t});continue}let j0=Br(e?.result?.decision??e.aiDecision??e?.decision??(e.status==="completed"?"APPROVE":"ERROR")),A0=e?.result?.summary??e.aiSummary,R0=y===j0,r0=R0?"MATCHED":"FLIPPED",X1={sn:$0,sourceRecordId:m.id,prodDecision:y,prodSummary:p,testRecordId:e.id,testDecision:j0,testSummary:A0,status:r0,durationMs:Date.now()-t};if(!R0)X1.diff={from:y,to:j0,reasonDiff:A0&&p&&A0!==p?`生产:${p.slice(0,60)}...->测试:${A0.slice(0,60)}...`:void 0};D.push(X1)}catch(Y0){D.push({sn:$0,sourceRecordId:m.id,prodDecision:y,prodSummary:p,status:"FAILED",error:Y0 instanceof Error?Y0.message:String(Y0),durationMs:Date.now()-t})}}let P=D.filter((m)=>m.status==="MATCHED"||m.status==="FLIPPED"),T=D.filter((m)=>m.status==="MATCHED"),A=D.filter((m)=>m.status==="FLIPPED"),E=D.filter((m)=>m.status==="FAILED").length,C=T.length,i=A.length,x=C+i,h=x>0?C/x:0,b=i>0,n=b?"REGRESSIONS_DETECTED":"CLEAN",I0=!b&&E===0,k;try{let m=await UU(Q),$0=(Array.isArray(m.features)?m.features:[]).find((y)=>y?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!b&&E===0,verdict:n,safeToPublish:I0,timestamp:A1(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:E,matchCount:C,flipCount:i,concordanceRate:Number(h.toFixed(4))},flips:A,records:D}}function Lk0($){let{sourceCorp:Y,targetCorp:U,verdict:I,safeToPublish:Q,metrics:J,quota:K,flips:z,records:G}=$,H=I==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":I==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${U.name}」`,`判定:${H}·准许发布:${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${J.sampleCount}|一致通过:${J.matchCount}|决策翻转:${J.flipCount}|异常失败:${J.failureCount}`,`一致率:${(J.concordanceRate*100).toFixed(1)}%|消耗预估:${K.estimatedRequired}点(余量:${K.balanceBefore}${K.balanceAfter!==void0?` -> ${K.balanceAfter}`:""})`," "+"─".repeat(65)];if(z.length>0){W.push(`⚠️决策翻转清单(${z.length}笔单据在新规则下结果改变):`);for(let X of z)if(W.push(`•单据[${X.sn}]:原生产判定「${X.prodDecision}」➔测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)W.push(`理由差异:${X.diff.reasonDiff}`);W.push(" "+"─".repeat(65)),W.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(I==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% 吻合,无任何意外误杀或漏判
Line truncated
`)}var Fk0=o(()=>{RP();X4();Jq()});async function Pr($,Y,U){let I=($??Y??"regression").toLowerCase();if(I==="regression"||I==="regress"||I==="matrix"){let Q=R(U.options.corp)??(Y&&Y!==I?Y:void 0),J=M1(Q),K=J,z=J;if(J.environment==="test"){z=J;let O=R(U.options["prod-corp"])??R(U.options.prod)??J.prodCorpId;if(!O)throw new G4(`测试企业「${J.name}」(${J.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${J.id}`);K=M1(O)}else{K=J;let O=R(U.options["test-corp"])??R(U.options.test)??J.testCorpId;if(!O)throw new G4(`生产企业「${J.name}」(${J.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${J.id}<testCorpId>`);z=M1(O)}let G=await P1(K),H=await P1(z),W=l0(U.options.samples)??l0(U.options.limit)??l0(U.options.n)??10,X=z0(U.options["dry-run"]),Z=z0(U.options["fail-on-flips"]),q=l0(U.options["poll-interval"])??2000,V=l0(U.options.timeout)??45000,w=R(U.options["sn-prefix"])??"REG_",M=R(U.options.webhook)??R(U.options.selector),F=await Vk0({sourceCorp:K,targetCorp:z,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:w,failOnFlips:Z,webhookSelector:M});if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(Lk0(F));if(C0(F),Z&&!F.ok)throw new G4(`回归测试发现${F.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new G4(`未知的test子命令:"${I}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var wk0=o(()=>{p8();D4();L4();$4();i6();Fk0()});function EE($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var Mk0=o(()=>{eq()});import{existsSync as Yf1,mkdirSync as Uf1,readFileSync as If1,renameSync as Qf1,writeFileSync as Jf1}from"node:fs";import{homedir as Kf1}from"node:os";import{dirname as zf1,join as Gf1}from"node:path";import{spawn as Hf1}from"node:child_process";function Ok0(){let $=process.env[Wf1]?.trim();if($)return $;return Zf1}function Nk0($=Ok0()){if(!Yf1($))return null;try{let Y=If1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return{...U,checkedAt:T8(U.checkedAt),...typeof U.publishedAt==="string"?{publishedAt:T8(U.publishedAt)}:{}};return null}catch{return null}}function IV($,Y=Ok0()){try{let U=zf1(Y);Uf1(U,{recursive:!0,mode:448});let I={checkedAt:$.checkedAt?T8($.checkedAt):A1(),latestVersion:$.latestVersion,publishedAt:$.publishedAt?T8($.publishedAt):void 0,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Jf1(Q,JSON.stringify(I,null,2),{mode:384}),Qf1(Q,Y)}catch{}}function Dk0($,Y=Xf1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Ak0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Hf1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Wf1="SEAL_USE_UPDATE_CACHE_FILE",Xf1=86400000,Zf1;var Tr=o(()=>{Zf1=Gf1(Kf1(),".config","seal-use","update-cache.json")});import{chmodSync as qf1,mkdirSync as Vf1,readdirSync as Lf1,realpathSync as Bk0,renameSync as Er,rmSync as Ff1,unlinkSync as Ck0,writeFileSync as Pk0}from"node:fs";import{basename as wf1,dirname as Mf1,isAbsolute as Of1,join as RE,relative as Nf1}from"node:path";import{spawn as Df1,spawnSync as K7}from"node:child_process";async function _k0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Nr,version:Z1,launcher:$.launcher},I=Y.repo||process.env[Af1]?.trim()||process.env[Bf1]?.trim()||Rk0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=yk0(D,Z1);if(P<0)if(!By&&Y.force);else{C0({updated:!1,currentVersion:Z1,targetVersion:D,mode:EE()?"binary":"source",message:!By?`Cannotdowngradeseal-usefromdevbuildv${Z1}toreleasev${D}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${Z1}toolderversionv${D}.Updatesmustbeforward-only.`});return}if(P===0&&!Y.force){C0({updated:!1,currentVersion:Z1,targetVersion:D,mode:EE()?"binary":"source",message:`seal-useisalreadyatversionv${Z1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let D=await CE(I,Y.limit??10);C0({currentVersion:Z1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===Z1,isNewer:i5(P.version,Z1)}))});return}if(!EE()){if(Y.checkOnly){let P=await CE(I,30),T=P[0],A=T?.version??Z1,E=P.find((x)=>x.version===Z1),C=i5(A,Z1),i=P.filter((x)=>i5(x.version,Z1));if(T?.version)IV({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;C0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:E?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:i.length,pendingReleases:i.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=sI(U).running;if(D)await J7("stop",U);try{jk0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️开发版更新同步失败,继续刷新本地依赖:${PinstanceofError?P.message:String(P)}`)}if(jk0("bun",["install"],{cwd:$.appRoot}),D)await J7("start",U);C0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(Cf1())try{await Rf1($,Y,U,I,J);return}catch(D){console.error(`⚠️Homebrew自动更新失败,回退至原生二进制更新:${DinstanceofError?D.message:String(D)}`)}let K=Tf1(),z=Ef1(),G=await CE(I,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await _E(I,J):G[0]??await _E(I);if(!H){C0({updated:!1,currentVersion:Z1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${I}'`});return}let W=H.version,X=G.find((D)=>D.version=
Line truncated
`)}catch{}}async function Sf1($,Y,U,I){let Q=jr(),J=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,z=I||$.split("/").pop()||"";if(Q!=="github"){if(K&&z)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${z}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${z}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(K&&z){let w=`https://github.com/${Rk0}/releases/download/${K}/${z}`;if(!process.env.CI)J.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);J.push(w)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let w=0;w<G.length;w++){let M=G[w],F=new AbortController,N="",O=(A)=>{N=A;try{F.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),P,T;try{jE(`==> [${w+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:F.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let E=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let n=Buffer.from(await A.arrayBuffer());if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);Pk0(Y,n),jE(`✓ Download succeeded (${(n.length/1024/1024).toFixed(1)} MB)`);return}let i=[],x=0,h=0;T=setTimeout(()=>{if(x<Z){let n=(x/1024).toFixed(1);O(`Initial transfer too slow (${n} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let n=C.read(),I0,k=new Promise((y,p)=>{I0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),m;try{m=await Promise.race([n,k])}finally{if(I0)clearTimeout(I0)}let{done:t,value:$0}=m;if(t)break;if($0){if(i.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let y=Date.now();if(y-h>200){h=y;let p=E?Math.round(x/E*100):0,Y0=(x/1048576).toFixed(1),g=E?(E/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${Y0} / ${g} MB)...`)}catch{}}}}try{process.stderr.write(`
"description":"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"
description:"v0.10.39: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.40: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version:0.10.39
short-description:Seal tenant and Hose approval automation (v0.10.39)
version:0.10.40
short-description:Seal tenant and Hose approval automation (v0.10.40)
@@ -223,7 +223,7 @@ Use the command groups in this order for normal work: **enterprise onboarding**
-`seal-use corps add-hose-web-session --json '{"baseUrl":"https://wx2.ekuaibao.com","corpId":"...","staffId":"...","accessToken":"..."}'` imports a normalized Hose web session (for example, parsed from a Hose admin cURL), saving the Hose `closeToken` and personnel ID. Seal Bearer is exchanged only at runtime; this command does not create or save OpenAPI `appKey/appSecurity` credentials.
-`seal-use corps add-hose-persistent --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"..."}'` registers and persists a Hose enterprise from durable OpenAPI credentials.
Durable Hose configs are identified by `source.type: "hose"` plus `appKey/appSecurity`; Hose Web Session configs use the same source type with `closeToken + staffId`. When the session material includes an expiry, it is recorded as `expiresIn` (TTL seconds) and `expiresAt` (UTC without milliseconds, for example `2026-09-22T05:30:00Z`).
Durable Hose configs are identified by `source.type: "hose"` plus `appKey/appSecurity`; Hose Web Session configs use the same source type with `closeToken + staffId`. When the session material includes an expiry, it is recorded as `expiresIn` (TTL seconds) and `expiresAt` (Beijing ISO 8601 without milliseconds, for example `2026-09-22T13:30:00+08:00`).
-`seal-use corps list [query] [--env <production|test>] [--limit <n>] [--all] [--strict] [--corp <corpId>]` (defaults to displaying the top 10 most frequently used enterprises in the last 7 days; sorting is automatic and query results keep relevance order)
-`seal-use corps search <query> [--env <production|test>] [--strict]` (intelligent soft search by default: case-insensitive, Chinese homophones, front/back nasal vowels, flat/retroflex consonants, initials, typo/missing letter tolerance; pass `--strict` for exact substring match)
-`seal-use corps get <corpId>` (rich enterprise attributes with sensitive secrets safely redacted)
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.