* Fix enterprise fuzzy search and Seal auth link output
* Refine auth link output with aligned ordered fields and Beijing ISO expiry
* Docs: remove redundant delegation list note from hose-enterprise-auth.md
* Bundle: update dist/mcp/server.js after doc cleanup
* Refactor: eliminate delegation command in favor of auth link suite
* Refactor: standardize auth check command with hidden diagnostic aliases
1.**Token Economy**: If set to `trigger: "always_on"`, every turn of the conversation unconditionally injects all rules into the system prompt (`<user_rules>`), consuming ~800 tokens on every request regardless of task relevance.
1.**Token Economy**: If set to `trigger: "always_on"`, every turn of the conversation unconditionally injects all rules into the system prompt (`<user_rules>`), consuming substantial tokens on every request regardless of task relevance.
2.**On-Demand Activation**: Setting `trigger: "manual"` prevents automatic background injection into the prompt budget. The rules remain available on-demand when explicitly referenced or requested.
3.**Cross-Agent Neutrality**: Non-agy agents (e.g. OpenAI Codex, Claude Code, Cursor, generic LLMs) do not recognize `agy`'s private frontmatter triggers. Storing modular guidelines as plain Markdown with a manual trigger ensures they function as clean, standalone reference docs that any agent can read on demand via standard file reading tools without unexpected prompt pollution.
- **CLI Development**: When adding or refactoring CLI commands under `src/cli/`, read [`rules/cli-protocol.md`](./rules/cli-protocol.md) before writing output streams.
- **Writing Tests**: When creating or modifying tests, read [`rules/testing.md`](./rules/testing.md).
- **TypeScript & Modules**: When adding new TypeScript files or resolving local imports, refer to [`rules/typescript-style.md`](./rules/typescript-style.md).
- **Rule Remediation & Staging**: When modifying approval rules or syncing between production and test enterprises, refer to [`rules/staging-simulation.md`](./rules/staging-simulation.md).
- **Webhook Material Packs**: When exporting, previewing, or validating Webhook attachment bundles, refer to [`rules/material-pack-policy.md`](./rules/material-pack-policy.md).
-**NEVER** output human text, logs, spinners, progress banners, or update notices to `stdout`. The Agent Harness parses `stdout` directly into typed payloads.
- **Documented exceptions**: `seal-use --help` / `seal-use help <area>` (`src/cli/printer.ts`) and `seal-use doctor guide` (`src/cli/commands/doctor.ts`) intentionally output Markdown documents on `stdout` because their output *is* the requested document payload. Never add new stdout-prose commands outside this list.
- **Diagnostics & Guidance Channel (`stderr`)**:
- Use `stderr` for runtime logs, network probing status, self-healing notifications, and human tips.
- Explicit **Next-Step Command Suggestions** MUST follow the format:
```text
👉 Next action: seal-use <command>
```
3.**Exit Code Contract**:
- Successful operations MUST exit with `0`.
- Any validation error, upstream API failure, or block MUST result in non-zero exit code (e.g. `1`).
- DO NOT call `process.exit()` deep in domain functions; throw structured errors and let `src/cli/runner.ts` handle stream routing and exit code assignment.
---
## 2. Performance Contract & SWR Architecture
- **Sub-10ms Local Execution**:
- Read-only discovery commands (e.g. `seal-use version`, `seal-use doctor paths`, `seal-use corps list`) MUST return instantaneously (<10ms).
- Never trigger synchronous external HTTP requests during routine discovery or inspection invocations.
- **Stale-While-Revalidate (SWR) Pattern**:
1. Synchronously read local cache from `~/.config/seal-use/*.json` (<0.2ms).
2. Return the local cached state immediately on `stdout`.
3. If cache is missing or older than TTL (e.g. 24 hours), trigger a background refresh:
| `10` | **Confirmation Required** | Mutating command invoked without `--confirm` or `--yes` |
**Rule**: Never call `process.exit()` deep in domain functions. Throw structured errors and let `src/cli/runner.ts` handle error classification, stream routing, and exit code assignment.
---
## 5. Argument Parsing Conventions
- Use helpers from `src/cli/parser.ts`:
- `booleanOption(args.options.flag)`
- `stringOption(args.options.param)`
- `numberOption(args.options.limit)`
- Support kebab-case and camelCase options gracefully.
- Positional arguments should fall back to option flags when natural (e.g. `corps get <corpId>` and `corps get --corp <corpId>`).
@@ -19,10 +19,11 @@ Tests are colocated as `*.test.ts` files in `src/`. OpenAPI source YAML lives in
-`bun test`: run all colocated Bun tests.
-`bun run bump <version | patch | minor>`: bump version across all manifest/skill/openapi files and bundle.
-`bun run openapi:bundle`: rebuild `dist/openapi.json`.
-`bun run build:binary`: compile the standalone `seal-use` binary to `dist/bin/seal-use` (gitignored).
-`bun run build:plugin`: bundle the MCP server to `dist/mcp/server.js` (tracked, used by `.mcp.json`).
-`bun run dev:override`: compile the host binary with Git dev version metadata, macOS sign, atomically override the Mac global command (`/opt/homebrew/bin/seal-use`), and sync the local Agent Skill.
> **Pre-Push Bundle Gates**: Modifying `src/` files imported by the MCP server requires running `bun run build:plugin` to keep `dist/mcp/server.js` in sync; modifying `openapi/` requires `bun run openapi:bundle` to keep `dist/openapi.json` in sync. CI strictly checks for zero diff on both tracked bundles.
## Coding Style & Naming Conventions
Use TypeScript ES modules with explicit `.js` import extensions for local files. Validate external data with Zod or narrow types before use. Follow existing style: two-space indentation, double quotes, omitted trailing semicolons, `camelCase` variables/functions, `PascalCase` classes/types, and lowercase hyphenated filenames such as `token-store.ts`.
@@ -34,27 +35,45 @@ Prefer small domain functions over broad utility modules.
- **Machine Channel (`stdout`)**: Data commands MUST output clean, parseable JSON on `stdout`. Never dump human prose, raw logs, or progress banners into `stdout`. The Agent Harness parses `stdout` directly into typed payloads.
- **Documented exception — document-output commands**: `seal-use --help` / `seal-use help <area>` (`src/cli/printer.ts`) and `seal-use doctor guide` (`src/cli/commands/doctor.ts`) intentionally write Markdown to `stdout`, because their output *is* the payload the caller redirects or reads (e.g. `seal-use doctor guide > guide.md`). Never add a new prose-on-stdout command outside this list: return structured JSON and put the readable rendering on `stderr` instead. `src/probe.ts` is a local developer probe script rather than a `bin` entry point, so its `[probe] …` lines are outside this contract.
- **Guidance & Diagnostic Channel (`stderr`)**: Use `stderr` for runtime logs, network probing status, self-healing notifications, and explicit **Next-Step Command Suggestions** (e.g. `👉 Next action: seal-use deploy hosecloud sync <signKey>`).
- **Performance Contract & SWR Architecture**: Read-only discovery and version commands (`seal-use version`, `seal-use doctor`, `seal-use corps list`) MUST execute instantaneously (<10ms). Never block on external network I/O during routine invocations. Use the Stale-While-Revalidate (SWR) pattern: read local cache from `~/.config/seal-use/*.json` synchronously (<0.2ms), and refresh stale/missing data via detached, unref'd child processes (`triggerBackgroundUpdateCheck`, `unref()`).
- **Safety Guardrail & Mutation Preview (`--dry-run`)**: All potentially destructive or state-mutating commands (e.g. `rules push/clear`, `corps sync-test`, `preference update`, `webhook add/update`) MUST support `--dry-run` returning structured JSON previews with `preview: true` and a clean diff, without executing mutations. Live execution requires explicit `--yes` or `--confirm`.
- **Exit Code Contract**:
- Successful executions MUST terminate with exit code `0`.
-Any parameter validation failure, upstream API error, or business block MUST result in a non-zero exit code (e.g. `1`), allowing the Agent Harness to reliably detect failures and trigger automated error remediation.
-`0`: Successful execution.
-`1`: Upstream API failure or domain business block.
-`2`: Parameter validation failure, unknown subcommand, or invalid JSON.
-`10`: Safety gate block requiring user confirmation (`--confirm` / `--yes`).
- Never call `process.exit()` deep in domain functions; throw structured errors and let `src/cli/runner.ts` handle stream routing and exit code assignment.
## Testing Guidelines
Use `bun:test` with `describe`, `test`, and `expect`. Place tests next to covered code using `name.test.ts`, for example `src/core/config/loader.test.ts`. Tests that change environment variables or working directories must restore them in `afterEach`.
Use `bun:test` with `describe`, `test`, and `expect`. Place tests next to covered code using `name.test.ts`, for example `src/core/config/loader.test.ts`. Tests that change environment variables or working directories must restore them in `afterEach`. Ensure background tasks are guarded with `SEAL_DISABLE_BG_UPDATE=1` or `NODE_ENV=test` during tests. Detailed test hygiene guidelines are in `.agents/rules/testing.md`.
## Commit & Pull Request Guidelines
Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, such as `Add compact approval rule listing`. Keep subjects under roughly 72 characters. Specific workflows and domain guidelines are maintained in `.agents/rules/`.
Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, such as `Add compact approval rule listing`. Keep subjects under roughly 72 characters. Specific workflows and domain guidelines are maintained in `.agents/rules/`:
- Issue triage & PR workflow (No premature release): `.agents/rules/issue-pr-workflow.md`
- **Isolation Rule**: If the main working directory contains uncommitted changes or another branch is actively being edited, NEVER switch branches or stash in the shared repository. Instead, use an isolated worktree for release operations:
```bash
git worktree add -b codex/release-vX.Y.Z /tmp/seal-use-release main
@@ -7,6 +7,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.10.35] - 2026-09-21
### Added
- Fix: Align auth link output contract, ordered fields, and Beijing ISO expiry (#158)
## [0.10.34] - 2026-09-20
### Added
- Fix Homebrew update detection and skill guidance
- Merge pull request #156 from yunyingk/fix/release-script-null-return
- Fix run() null return in release script
- Merge pull request #155 from yunyingk/feat/release-automation-and-brew-flow
- Add release automation script and Homebrew-aware update dispatch
## [0.10.33] - 2026-09-20
### Added
- **Instantaneous Version Discovery via SWR Update Cache**:
- Implemented zero-network Stale-While-Revalidate caching for `seal-use version` backed by `~/.config/seal-use/update-cache.json`, keeping invocations strictly sub-10ms.
- Automatically dispatches an unref'd, detached background check when cache is older than 24 hours without blocking exit.
- Returns structured `latestVersion`, `updateAvailable: true`, and `lastCheckedAt` in stdout JSON when an upgrade is available, paired with non-blocking guidance on stderr.
- **Actionable Quota Guidance & Webhook Status Clarification in Tenant Health Check**:
- Added direct console recharge auto-login guidance (`seal-use auth link --corp <corpId>`) in `seal-use doctor tenant` when tenant quota is low or exhausted.
- Refined webhook integration audit in `doctor tenant` to return `pass` with clarifying notes when no webhook integrations exist, avoiding alarmism for clients who only use direct form approvals.
- **Transparent Approval Run De-duplication**:
- Added `duplicateRuns` and `dedupeNote` to `seal-use approval-runs stats` to explicitly account for and explain the discrepancy between total runs and unique document runs (e.g. retries and push events).
- Emits an objective diagnostic note on stderr when duplicates are present, while keeping the command strictly non-intrusive.
- Reorganized `.agents/rules/` covering CLI protocol standards, test hygiene, staging simulation red lines, and webhook material pack policies.
### Added
- **Semantic Approval Run Web Links (`approval-runs link`)**:
- Replaced un-semantic `approval-runs url` command with standard `approval-runs link` (preserving `url` as backwards-compatible alias).
- Added `--type <seal-result|hose-document>` parameter (defaulting to `seal-result`) to cleanly distinguish between the Seal AI audit page and the Hose/source original form.
- Standardized `--auto-login` (with aliases `--sso` and `--hose-sso`) for generating temporary auto-login OAuth delegation links with safety warnings.
- Structured return payload into Form 1: `{ url, type, mode, sealResultUrl, hoseDocumentUrl, recordId, sourceDocumentSN, ... }`.
- Added `seal-use auth link` (alias `seal-link`) for Seal AI console auto-login delegation links, clearly decoupled from `auth hose-link` for external Hose workbenches.
- Hardened `approval-runs export` against extension confusion: rejects non-`.xlsx` extensions (such as `.csv`) with explicit error guidance.
- Completely purged vague `ssoUrl` and `documentUrl` fields from skill documentation, CLI `--help`, and OpenAPI schemas in favor of `sealResultUrl` and `hoseDocumentUrl`.
import{createRequireasWy0}from"node:module";varUy0=Object.create;var{getPrototypeOf:Yy0,defineProperty:mT,getOwnPropertyNames:zy0}=Object;varQy0=Object.prototype.hasOwnProperty;functionJy0($){returnthis[$]}varIy0,Ky0,J6=($,U,Y)=>{varz=$!=null&&typeof$==="object";if(z){varQ=U?Iy0??=newWeakMap:Ky0??=newWeakMap,J=Q.get($);if(J)returnJ}Y=$!=null?Uy0(Yy0($)):{};letI=U||!$||!$.__esModule?mT(Y,"default",{value:$,enumerable:!0}):Y;for(letKofzy0($))if(!Qy0.call(I,K))mT(I,K,{get:Jy0.bind($,K),enumerable:!0});if(z)Q.set($,I);returnI};varE=($,U)=>()=>(U||$((U={exports:{}}).exports,U),U.exports);varGy0=($)=>$;functionHy0($,U){this[$]=Gy0.bind(null,U)}varx8=($,U)=>{for(varYinU)mT($,Y,{get:U[Y],enumerable:!0,configurable:!0,set:Hy0.bind(U,Y)})};varo=($,U)=>()=>($&&(U=$($=0)),U);varI0=Wy0(import.meta.url);varXy0,cq,Zy0,qy0,Vy0,Ly0,R0=($,U)=>()=>(U||$((U={exports:{}}).exports,U),U.exports),xo=($,U)=>{letY={};for(varzin$)cq(Y,z,{get:$[z],enumerable:!0});if(U)cq(Y,Symbol.toStringTag,{value:"Module"});returnY},Fy0=($,U,Y,z)=>{if(U&&typeofU==="object"||typeofU==="function"){for(varQ=qy0(U),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Ly0.call($,K)&&K!==Y)cq($,K,{get:((G)=>U[G]).bind(null,K),enumerable:!(z=Zy0(U,K))||z.enumerable})}return$},nq=($,U,Y)=>(Y=$!=null?Xy0(Vy0($)):{},Fy0(U||!$||!$.__esModule?cq(Y,"default",{value:$,enumerable:!0}):Y,$));varlT=o(()=>{Xy0=Object.create,cq=Object.defineProperty,Zy0=Object.getOwnPropertyDescriptor,qy0=Object.getOwnPropertyNames,Vy0=Object.getPrototypeOf,Ly0=Object.prototype.hasOwnProperty});functionuo($){returntypeof$==="string"&&fo.has($.replace(/#$/,""))}functionbo($,U){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letY=$.$schema.replace(/#$/,"");if(wy0.has(Y))return"2020-12";if(fo.has(Y))return"2019-09";if(Oy0.has(Y)||My0.has(Y))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; ${U}`)}varwy0,fo,Oy0,My0;varoT=o(()=>{wy0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),fo=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Oy0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),My0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionH0($,U,Y){functionz(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:I,traits:newSet},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),U(K,G);letH=I.prototype,W=Object.keys(H);for(letX=0;X<W.length;X++){letZ=W[X];if(!(ZinK))K[Z]=H[Z].bind(K)}}letQ=Y?.Parent??Object;classJextendsQ{}Object.defineProperty(J,"name",{value:$});functionI(K){varG;letH=Y?.Parent?newJ:this;z(H,K),(G=H._zod).deferred??(G.deferred=[]);for(letWofH._zod.deferred)W();returnH}returnObject.defineProperty(I,"init",{value:z}),Object.defineProperty(I,Symbol.hasInstance,{value:(K)=>{if(Y?.Parent&&KinstanceofY.Parent)return!0;returnK?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}functiona4($){if($)Object.assign(AU,$);returnAU}vario,mK,rT,f5,PU,AU;varBU=o(()=>{mK=Object.freeze({status:"aborted"});rT=Symbol("zod_brand");f5=classf5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};PU=classPUextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(io=globalThis).__zod_globalConfig??(io.__zod_globalConfig={});AU=globalThis.__zod_globalConfig});vary0={};x8(y0,{unwrapMessage:()=>lK,uint8ArrayToHex:()=>py0,uint8ArrayToBase64url:()=>cy0,uint8ArrayToBase64:()=>po,stringifyPrimitive:()=>v0,slugify:()=>tT,shallowClone:()=>$j,safeExtend:()=>ky0,required:()=>uy0,randomString:()=>Ry0,propertyKeyTypes:()=>sK,promiseAllObject:()=>Cy0,primitiveTypes:()=>Uj,prefixIssues:()=>f8,pick:()=>Sy0,partial:()=>fy0,parsedType:()=>S0,optionalKeys:()=>Yj,omit:()=>gy0,objectClone:()=>Ty0,numKeys:()=>_y0,nullish:()=>Q7,normalizeParams:()=>x0,mergeDefs:()=>i9,merge:()=>xy0,jsonStringifyReplacer:()=>uz,joinValues:()=>N0,issue:()=>iz,isPlainObject:()=>I7,isObject:()=>TU,hexToUint8Array:()=>ny0,getSizableOrigin:()=>aK,getParsedType:()=>vy0,getLengthableOrigin:()=>tK,getEnumValues:()=>oK,getElementAtPath:()=>Ey0,floatSafeRemainder:()=>aT,finalizeIssue:()=>A8,extend:()=>yy0,explicitlyAborted:()=>Jj,escapeRegex:()=>N$,esc:()=>pq,defineLazy:()=>T1,createTransparentProxy:()=>hy0,cloneDef:()=>jy0,clone:()=>D8,cleanRegex:()=>rK,cleanEnum:()=>by0,captureStackTrace:()=>dq,cached:()=>bz,base64urlToUint8Array:()=>iy0,base64ToUint8Array:()=>no,assignProp:()=>J7,assertNotEqual:()=>Dy0,assertNever:()=>Py0,assertIs:()=>Ay0,assertEqual:()=>Ny0,assert:()=>By0,allowsEval:()=>eT,aborted:()=>K7,NUMBER_FORMAT_RANGES:()=>zj,Class:()=>moLine truncated
`)}var lo=($,U)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:U,enumerable:!1}),$.message=JSON.stringify(U,uz,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},eK,u8;var Gj=o(()=>{BU();$1();eK=H0("$ZodError",lo),u8=H0("$ZodError",lo,{Parent:Error})});var cz=($)=>(U,Y,z,Q)=>{let J=z?{...z,async:!1}:{async:!1},I=U._zod.run({value:Y,issues:[]},J);if(I instanceof Promise)throw new f5;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},mq,nz=($)=>async(U,Y,z,Q)=>{let J=z?{...z,async:!0}:{async:!0},I=U._zod.run({value:Y,issues:[]},J);if(I instanceof Promise)I=await I;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},lq,pz=($)=>(U,Y,z)=>{let Q=z?{...z,async:!1}:{async:!1},J=U._zod.run({value:Y,issues:[]},Q);if(J instanceof Promise)throw new f5;return J.issues.length?{success:!1,error:new($??eK)(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Hj,dz=($)=>async(U,Y,z)=>{let Q=z?{...z,async:!0}:{async:!0},J=U._zod.run({value:Y,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Wj,oq=($)=>(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return cz($)(U,Y,Q)},my0,rq=($)=>(U,Y,z)=>{return cz($)(U,Y,z)},ly0,sq=($)=>async(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return nz($)(U,Y,Q)},oy0,aq=($)=>async(U,Y,z)=>{return nz($)(U,Y,z)},ry0,tq=($)=>(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return pz($)(U,Y,Q)},sy0,eq=($)=>(U,Y,z)=>{return pz($)(U,Y,z)},ay0,$V=($)=>async(U,Y,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return dz($)(U,Y,Q)},ty0,UV=($)=>async(U,Y,z)=>{return dz($)(U,Y,z)},ey0;var Xj=o(()=>{BU();Gj();$1();mq=cz(u8),lq=nz(u8),Hj=pz(u8),Wj=dz(u8),my0=oq(u8),ly0=rq(u8),oy0=sq(u8),ry0=aq(u8),sy0=tq(u8),ay0=eq(u8),ty0=$V(u8),ey0=UV(u8)});var U$={};x8(U$,{xid:()=>Lj,uuid7:()=>zk0,uuid6:()=>Yk0,uuid4:()=>Uk0,uuid:()=>jU,uppercase:()=>bj,unicodeEmail:()=>ro,undefined:()=>fj,ulid:()=>Vj,time:()=>vj,string:()=>Sj,sha512_hex:()=>Bk0,sha512_base64url:()=>jk0,sha512_base64:()=>Tk0,sha384_hex:()=>Dk0,sha384_base64url:()=>Pk0,sha384_base64:()=>Ak0,sha256_hex:()=>Ok0,sha256_base64url:()=>Nk0,sha256_base64:()=>Mk0,sha1_hex:()=>Lk0,sha1_base64url:()=>wk0,sha1_base64:()=>Fk0,rfc5322Email:()=>Jk0,number:()=>YG,null:()=>xj,nanoid:()=>wj,md5_hex:()=>Zk0,md5_base64url:()=>Vk0,md5_base64:()=>qk0,mac:()=>Bj,lowercase:()=>uj,ksuid:()=>Fj,ipv6:()=>Pj,ipv4:()=>Aj,integer:()=>yj,idnEmail:()=>Ik0,httpProtocol:()=>Cj,html5Email:()=>Qk0,hostname:()=>Hk0,hex:()=>Xk0,guid:()=>Mj,extendedDuration:()=>$k0,emoji:()=>Dj,email:()=>Nj,e164:()=>Rj,duration:()=>Oj,domain:()=>Wk0,datetime:()=>hj,date:()=>_j,cuid2:()=>qj,cuid:()=>Zj,cidrv6:()=>jj,cidrv4:()=>Tj,browserEmail:()=>Kk0,boolean:()=>kj,bigint:()=>gj,base64url:()=>YV,base64:()=>Ej});function Dj(){return new RegExp(Gk0,"u")}function ao($){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 vj($){return new RegExp(`^${ao($)}$`)}function hj($){let U=ao({precision:$.precision}),Y=["Z"];if($.local)Y.push("");if($.offset)Y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let z=`${U}(?:${Y.join("|")})`;return new RegExp(`^${so}T(?:${z})$`)}function zG($,U){return new RegExp(`^[A-Za-z0-9+/]{${$}}${U}$`)}function QG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Zj,qj,Vj,Lj,Fj,wj,Oj,$k0,Mj,jU=($)=>{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})$`)},Uk0,Yk0,zk0,Nj,Qk0,Jk0,ro,Ik0,Kk0,Gk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Aj,Pj,Bj=($)=>{letU=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${U}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${U}){5}[0-9a-f]{2}$`)},Tj,jj,Ej,YV,Hk0,Wk0,Cj,Rj,so="(?:(?:\\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])))",_j,Sj=($)=>{letU=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${U}$`)},gj,yj,YG,kj,xj,fj,uj,bj,Xk0,Zk0,qk0,Vk0,Lk0,Fk0,wk0,Ok0,Mk0,Nk0,Dk0,Ak0,Pk0,Bk0,Tk0,jk0;varzV=o(()=>{$1();Zj=/^[cC][0-9a-z]{6,}$/,qj=/^[0-9a-z]+$/,Vj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lj=/^[0-9a-vA-V]{20}$/,Fj=/^[A-Za-z0-9]{27}$/,wj=/^[a-zA-Z0-9_-]{21}$/,Oj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),z=Math.min(...Y.map((J)=>J.length-J.trimStart().length)),Q=Y.map((J)=>J.slice(z)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,U=this?.args,z=[...(this?.content??[""]).map((Q)=>`${Q}`)];return new $(...U,z.join(`
`))}}var JE;var IE=o(()=>{JE={major:4,minor:4,patch:3}});function CE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Lr($){if(!YV.test($))return!1;let U=$.replace(/[-_]/g,(z)=>z==="-"?"+":"/"),Y=U.padEnd(Math.ceil(U.length/4)*4,"=");return CE(Y)}function Fr($,U=null){try{let Y=$.split(".");if(Y.length!==3)return!1;let[z]=Y;if(!z)return!1;let Q=JSON.parse(atob(z));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(U&&(!("alg"in Q)||Q.alg!==U))return!1;return!0}catch{return!1}}function Ur($,U,Y){if($.issues.length)U.issues.push(...f8(Y,$.issues));U.value[Y]=$.value}function XV($,U,Y,z,Q,J){let I=Y in z;if($.issues.length){if(Q&&J&&!I)return;U.issues.push(...f8(Y,$.issues))}if(!I&&!Q){if(!$.issues.length)U.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Y]});return}if($.value===void 0){if(I)U.value[Y]=void 0}else U.value[Y]=$.value}function wr($){let U=Object.keys($.shape);for(let z of U)if(!$.shape?.[z]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${z}":expectedaZodschema`);let Y=Yj($.shape);return{...$,keys:U,keySet:new Set(U),numKeys:U.length,optionalKeys:new Set(Y)}}function Or($,U,Y,z,Q,J){let I=[],K=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in U){if(Z==="__proto__")continue;if(K.has(Z))continue;if(H==="never"){I.push(Z);continue}let q=G.run({value:U[Z],issues:[]},z);if(q instanceof Promise)$.push(q.then((V)=>XV(V,Y,Z,U,W,X)));else XV(q,Y,Z,U,W,X)}if(I.length)Y.issues.push({code:"unrecognized_keys",keys:I,input:U,inst:J});if(!$.length)return Y;return Promise.all($).then(()=>{return Y})}function Yr($,U,Y,z){for(let J of $)if(J.issues.length===0)return U.value=J.value,U;let Q=$.filter((J)=>!K7(J));if(Q.length===1)return U.value=Q[0].value,Q[0];return U.issues.push({code:"invalid_union",input:U.value,inst:Y,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))}),U}function zr($,U,Y,z){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return U.value=Q[0].value,U;if(Q.length===0)U.issues.push({code:"invalid_union",input:U.value,inst:Y,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))});else U.issues.push({code:"invalid_union",input:U.value,inst:Y,errors:[],inclusive:!1});return U}function KE($,U){if($===U)return{valid:!0,data:$};if($ instanceof Date&&U instanceof Date&&+$===+U)return{valid:!0,data:$};if(I7($)&&I7(U)){let Y=Object.keys(U),z=Object.keys($).filter((J)=>Y.indexOf(J)!==-1),Q={...$,...U};for(let J of z){let I=KE($[J],U[J]);if(!I.valid)return{valid:!1,mergeErrorPath:[J,...I.mergeErrorPath]};Q[J]=I.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(U)){if($.length!==U.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let z=0;z<$.length;z++){let Q=$[z],J=U[z],I=KE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[z,...I.mergeErrorPath]};Y.push(I.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function Qr($,U,Y){let z=new Map,Q;for(let K of U.issues)if(K.code==="unrecognized_keys"){Q??(Q=K);for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).l=!0}}else $.issues.push(K);for(let K of Y.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).r=!0}else $.issues.push(K);let J=[...z].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Q)$.issues.push({...Q,keys:J});if(K7($))return $;let I=KE(U.value,Y.value);if(!I.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function Jr($,U){for(let Y=$.length-1;Y>=0;Y--)if($[Y]._zod[U]!=="optional")return Y+1;return 0}function Ir($,U,Y){if($.issues.length)U.issues.push(...f8(Y,$.issues));U.value[Y]=$.value}function Kr($,U,Y,z,Q){for(let J=0;J<Y.length;J++){let I=$[J],K=J<z.length;if(I.issues.length){if(!K&&J>=Q){U.value.length=J;break}U.issues.push(...f8(J,I.issues))}U.value[J]=I.value}for(let J=U.value.length-1;J>=z.length;J--)if(Y[J]._zod.optout==="optional"&&U.value[J]===void 0)U.value.length=J;else break;return U}function Gr($,U,Y,z,Q,J,I){if($.issues.length)if(sK.has(typeof z))Y.issues.push(...f8(z,$.issues));else Y.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>A8(K,I,a4()))});if(U.issues.length)if(sK.has(typeof z))Y.issues.push(...f8(z,U.issues));else Y.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:z,issues:U.issues.map((K)=>A8(K,I,a4()))});Y.value.set($.value,U.value)}function Hr($,U){if($.issues.length)U.issues.push(...$.issues);U.value.add($.value)}function Wr($,U){if(U===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Xr($,U){if($.value===void 0)$.value=U.defaultValue;return $}function Zr($,U){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:U});return $}function GV($,U,Y){if($.issues.length)return $.aborted=!0,$;return U._zod.run({value:$.value,issues:$.issues,fa
Line truncated
import{createRequireasFy0}from"node:module";varIy0=Object.create;var{getPrototypeOf:Gy0,defineProperty:aT,getOwnPropertyNames:Wy0}=Object;varHy0=Object.prototype.hasOwnProperty;functionXy0($){returnthis[$]}varZy0,qy0,J6=($,Y,z)=>{varU=$!=null&&typeof$==="object";if(U){varQ=Y?Zy0??=newWeakMap:qy0??=newWeakMap,J=Q.get($);if(J)returnJ}z=$!=null?Iy0(Gy0($)):{};letK=Y||!$||!$.__esModule?aT(z,"default",{value:$,enumerable:!0}):z;for(letIofWy0($))if(!Hy0.call(K,I))aT(K,I,{get:Xy0.bind($,I),enumerable:!0});if(U)Q.set($,K);returnK};varE=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);varVy0=($)=>$;functionLy0($,Y){this[$]=Vy0.bind(null,Y)}varN8=($,Y)=>{for(varzinY)aT($,z,{get:Y[z],enumerable:!0,configurable:!0,set:Ly0.bind(Y,z)})};varo=($,Y)=>()=>($&&(Y=$($=0)),Y);varK0=Fy0(import.meta.url);varwy0,nq,My0,Oy0,Ny0,Dy0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),oo=($,Y)=>{letz={};for(varUin$)nq(z,U,{get:$[U],enumerable:!0});if(Y)nq(z,Symbol.toStringTag,{value:"Module"});returnz},Ay0=($,Y,z,U)=>{if(Y&&typeofY==="object"||typeofY==="function"){for(varQ=Oy0(Y),J=0,K=Q.length,I;J<K;J++)if(I=Q[J],!Dy0.call($,I)&&I!==z)nq($,I,{get:((G)=>Y[G]).bind(null,I),enumerable:!(U=My0(Y,I))||U.enumerable})}return$},pq=($,Y,z)=>(z=$!=null?wy0(Ny0($)):{},Ay0(Y||!$||!$.__esModule?nq(z,"default",{value:$,enumerable:!0}):z,$));vartT=o(()=>{wy0=Object.create,nq=Object.defineProperty,My0=Object.getOwnPropertyDescriptor,Oy0=Object.getOwnPropertyNames,Ny0=Object.getPrototypeOf,Dy0=Object.prototype.hasOwnProperty});functionso($){returntypeof$==="string"&&ro.has($.replace(/#$/,""))}functionao($,Y){if(!("$schema"in$)||typeof$.$schema!=="string")return"2020-12";letz=$.$schema.replace(/#$/,"");if(By0.has(z))return"2020-12";if(ro.has(z))return"2019-09";if(Py0.has(z)||Ty0.has(z))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}`)}varBy0,ro,Py0,Ty0;vareT=o(()=>{By0=newSet(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),ro=newSet(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Py0=newSet(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Ty0=newSet(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});functionW0($,Y,z){functionU(I,G){if(!I._zod)Object.defineProperty(I,"_zod",{value:{def:G,constr:K,traits:newSet},enumerable:!1});if(I._zod.traits.has($))return;I._zod.traits.add($),Y(I,G);letW=K.prototype,H=Object.keys(W);for(letX=0;X<H.length;X++){letZ=H[X];if(!(ZinI))I[Z]=W[Z].bind(I)}}letQ=z?.Parent??Object;classJextendsQ{}Object.defineProperty(J,"name",{value:$});functionK(I){varG;letW=z?.Parent?newJ:this;U(W,I),(G=W._zod).deferred??(G.deferred=[]);for(letHofW._zod.deferred)H();returnW}returnObject.defineProperty(K,"init",{value:U}),Object.defineProperty(K,Symbol.hasInstance,{value:(I)=>{if(z?.Parent&&Iinstanceofz.Parent)return!0;returnI?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}functiona4($){if($)Object.assign(TY,$);returnTY}varto,oI,$j,u5,jY,TY;varEY=o(()=>{oI=Object.freeze({status:"aborted"});$j=Symbol("zod_brand");u5=classu5extendsError{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};jY=classjYextendsError{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(to=globalThis).__zod_globalConfig??(to.__zod_globalConfig={});TY=globalThis.__zod_globalConfig});vary0={};N8(y0,{unwrapMessage:()=>rI,uint8ArrayToHex:()=>sy0,uint8ArrayToBase64url:()=>oy0,uint8ArrayToBase64:()=>Yr,stringifyPrimitive:()=>v0,slugify:()=>Uj,shallowClone:()=>Jj,safeExtend:()=>cy0,required:()=>dy0,randomString:()=>yy0,propertyKeyTypes:()=>tI,promiseAllObject:()=>gy0,primitiveTypes:()=>Kj,prefixIssues:()=>x8,pick:()=>uy0,partial:()=>py0,parsedType:()=>S0,optionalKeys:()=>Ij,omit:()=>by0,objectClone:()=>vy0,numKeys:()=>ky0,nullish:()=>G7,normalizeParams:()=>x0,mergeDefs:()=>n9,merge:()=>ny0,jsonStringifyReplacer:()=>nU,joinValues:()=>O0,issue:()=>dU,isPlainObject:()=>H7,isObject:()=>CY,hexToUint8Array:()=>ry0,getSizableOrigin:()=>eI,getParsedType:()=>xy0,getLengthableOrigin:()=>$G,getEnumValues:()=>sI,getElementAtPath:()=>Sy0,floatSafeRemainder:()=>zj,finalizeIssue:()=>A8,extend:()=>iy0,explicitlyAborted:()=>Hj,escapeRegex:()=>N$,esc:()=>dq,defineLazy:()=>E1,createTransparentProxy:()=>fy0,cloneDef:()=>hy0,clone:()=>D8,cleanRegex:()=>aI,cleanEnum:()=>my0,captureStackTrace:()=>mq,cached:()=>pU,base64urlToUint8Array:()=>ly0,base64ToUint8Array:()=>$r,assignProp:()=>W7,assertNotEqual:()=>Ey0,assertNever:()=>Ry0,assertIs:()=>Cy0,assertEqual:()=>jy0,assert:()=>_y0,allowsEval:()=>Qj,aborted:()=>X7,NUMBER_FORMAT_RANGES:()=>Gj,Class:()=>zrLine truncated
`)}var Ur=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,nU,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},YG,f8;var qj=o(()=>{EY();$1();YG=W0("$ZodError",Ur),f8=W0("$ZodError",Ur,{Parent:Error})});var mU=($)=>(Y,z,U,Q)=>{let J=U?{...U,async:!1}:{async:!1},K=Y._zod.run({value:z,issues:[]},J);if(K instanceof Promise)throw new u5;if(K.issues.length){let I=new(Q?.Err??$)(K.issues.map((G)=>A8(G,J,a4())));throw mq(I,Q?.callee),I}return K.value},lq,lU=($)=>async(Y,z,U,Q)=>{let J=U?{...U,async:!0}:{async:!0},K=Y._zod.run({value:z,issues:[]},J);if(K instanceof Promise)K=await K;if(K.issues.length){let I=new(Q?.Err??$)(K.issues.map((G)=>A8(G,J,a4())));throw mq(I,Q?.callee),I}return K.value},oq,oU=($)=>(Y,z,U)=>{let Q=U?{...U,async:!1}:{async:!1},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)throw new u5;return J.issues.length?{success:!1,error:new($??YG)(J.issues.map((K)=>A8(K,Q,a4())))}:{success:!0,data:J.value}},Vj,rU=($)=>async(Y,z,U)=>{let Q=U?{...U,async:!0}:{async:!0},J=Y._zod.run({value:z,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((K)=>A8(K,Q,a4())))}:{success:!0,data:J.value}},Lj,rq=($)=>(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return mU($)(Y,z,Q)},ty0,sq=($)=>(Y,z,U)=>{return mU($)(Y,z,U)},ey0,aq=($)=>async(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return lU($)(Y,z,Q)},$k0,tq=($)=>async(Y,z,U)=>{return lU($)(Y,z,U)},Yk0,eq=($)=>(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return oU($)(Y,z,Q)},zk0,$V=($)=>(Y,z,U)=>{return oU($)(Y,z,U)},Uk0,YV=($)=>async(Y,z,U)=>{let Q=U?{...U,direction:"backward"}:{direction:"backward"};return rU($)(Y,z,Q)},Qk0,zV=($)=>async(Y,z,U)=>{return rU($)(Y,z,U)},Jk0;var Fj=o(()=>{EY();qj();$1();lq=mU(f8),oq=lU(f8),Vj=oU(f8),Lj=rU(f8),ty0=rq(f8),ey0=sq(f8),$k0=aq(f8),Yk0=tq(f8),zk0=eq(f8),Uk0=$V(f8),Qk0=YV(f8),Jk0=zV(f8)});var $$={};N8($$,{xid:()=>Nj,uuid7:()=>Wk0,uuid6:()=>Gk0,uuid4:()=>Ik0,uuid:()=>RY,uppercase:()=>dj,unicodeEmail:()=>Jr,undefined:()=>nj,ulid:()=>Oj,time:()=>kj,string:()=>fj,sha512_hex:()=>_k0,sha512_base64url:()=>hk0,sha512_base64:()=>vk0,sha384_hex:()=>Ek0,sha384_base64url:()=>Rk0,sha384_base64:()=>Ck0,sha256_hex:()=>Pk0,sha256_base64url:()=>jk0,sha256_base64:()=>Tk0,sha1_hex:()=>Dk0,sha1_base64url:()=>Bk0,sha1_base64:()=>Ak0,rfc5322Email:()=>Xk0,number:()=>QG,null:()=>cj,nanoid:()=>Aj,md5_hex:()=>Mk0,md5_base64url:()=>Nk0,md5_base64:()=>Ok0,mac:()=>Rj,lowercase:()=>pj,ksuid:()=>Dj,ipv6:()=>Cj,ipv4:()=>Ej,integer:()=>bj,idnEmail:()=>Zk0,httpProtocol:()=>Sj,html5Email:()=>Hk0,hostname:()=>Lk0,hex:()=>wk0,guid:()=>Pj,extendedDuration:()=>Kk0,emoji:()=>jj,email:()=>Tj,e164:()=>gj,duration:()=>Bj,domain:()=>Fk0,datetime:()=>xj,date:()=>yj,cuid2:()=>Mj,cuid:()=>wj,cidrv6:()=>vj,cidrv4:()=>_j,browserEmail:()=>qk0,boolean:()=>ij,bigint:()=>uj,base64url:()=>UV,base64:()=>hj});function jj(){return new RegExp(Vk0,"u")}function Ir($){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 kj($){return new RegExp(`^${Ir($)}$`)}function xj($){let Y=Ir({precision:$.precision}),z=["Z"];if($.local)z.push("");if($.offset)z.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let U=`${Y}(?:${z.join("|")})`;return new RegExp(`^${Kr}T(?:${U})$`)}function JG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function KG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var wj,Mj,Oj,Nj,Dj,Aj,Bj,Kk0,Pj,RY=($)=>{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})$`)},Ik0,Gk0,Wk0,Tj,Hk0,Xk0,Jr,Zk0,qk0,Vk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ej,Cj,Rj=($)=>{letY=N$($??":");returnnewRegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},_j,vj,hj,UV,Lk0,Fk0,Sj,gj,Kr="(?:(?:\\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])))",yj,fj=($)=>{letY=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";returnnewRegExp(`^${Y}$`)},uj,bj,QG,ij,cj,nj,pj,dj,wk0,Mk0,Ok0,Nk0,Dk0,Ak0,Bk0,Pk0,Tk0,jk0,Ek0,Ck0,Rk0,_k0,vk0,hk0;varQV=o(()=>{$1();wj=/^[cC][0-9a-z]{6,}$/,Mj=/^[0-9a-z]+$/,Oj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Nj=/^[0-9a-vA-V]{20}$/,Dj=/^[A-Za-z0-9]{27}$/,Aj=/^[a-zA-Z0-9_-]{21}$/,Bj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),U=Math.min(...z.map((J)=>J.length-J.trimStart().length)),Q=z.map((J)=>J.slice(U)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,Y=this?.args,U=[...(this?.content??[""]).map((Q)=>`${Q}`)];return new $(...Y,U.join(`
`))}}var HE;var XE=o(()=>{HE={major:4,minor:4,patch:3}});function SE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Tr($){if(!UV.test($))return!1;let Y=$.replace(/[-_]/g,(U)=>U==="-"?"+":"/"),z=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return SE(z)}function jr($,Y=null){try{let z=$.split(".");if(z.length!==3)return!1;let[U]=z;if(!U)return!1;let Q=JSON.parse(atob(U));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 Xr($,Y,z){if($.issues.length)Y.issues.push(...x8(z,$.issues));Y.value[z]=$.value}function ZV($,Y,z,U,Q,J){let K=z in U;if($.issues.length){if(Q&&J&&!K)return;Y.issues.push(...x8(z,$.issues))}if(!K&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[z]});return}if($.value===void 0){if(K)Y.value[z]=void 0}else Y.value[z]=$.value}function Er($){let Y=Object.keys($.shape);for(let U of Y)if(!$.shape?.[U]?._zod?.traits?.has("$ZodType"))throw Error(`Invalidelementatkey"${U}":expectedaZodschema`);let z=Ij($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(z)}}function Cr($,Y,z,U,Q,J){let K=[],I=Q.keySet,G=Q.catchall._zod,W=G.def.type,H=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(I.has(Z))continue;if(W==="never"){K.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},U);if(q instanceof Promise)$.push(q.then((V)=>ZV(V,z,Z,Y,H,X)));else ZV(q,z,Z,Y,H,X)}if(K.length)z.issues.push({code:"unrecognized_keys",keys:K,input:Y,inst:J});if(!$.length)return z;return Promise.all($).then(()=>{return z})}function Zr($,Y,z,U){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!X7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:$.map((J)=>J.issues.map((K)=>A8(K,U,a4())))}),Y}function qr($,Y,z,U){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:z,errors:$.map((J)=>J.issues.map((K)=>A8(K,U,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:z,errors:[],inclusive:!1});return Y}function ZE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(H7($)&&H7(Y)){let z=Object.keys(Y),U=Object.keys($).filter((J)=>z.indexOf(J)!==-1),Q={...$,...Y};for(let J of U){let K=ZE($[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 z=[];for(let U=0;U<$.length;U++){let Q=$[U],J=Y[U],K=ZE(Q,J);if(!K.valid)return{valid:!1,mergeErrorPath:[U,...K.mergeErrorPath]};z.push(K.data)}return{valid:!0,data:z}}return{valid:!1,mergeErrorPath:[]}}function Vr($,Y,z){let U=new Map,Q;for(let I of Y.issues)if(I.code==="unrecognized_keys"){Q??(Q=I);for(let G of I.keys){if(!U.has(G))U.set(G,{});U.get(G).l=!0}}else $.issues.push(I);for(let I of z.issues)if(I.code==="unrecognized_keys")for(let G of I.keys){if(!U.has(G))U.set(G,{});U.get(G).r=!0}else $.issues.push(I);let J=[...U].filter(([,I])=>I.l&&I.r).map(([I])=>I);if(J.length&&Q)$.issues.push({...Q,keys:J});if(X7($))return $;let K=ZE(Y.value,z.value);if(!K.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}function Lr($,Y){for(let z=$.length-1;z>=0;z--)if($[z]._zod[Y]!=="optional")return z+1;return 0}function Fr($,Y,z){if($.issues.length)Y.issues.push(...x8(z,$.issues));Y.value[z]=$.value}function wr($,Y,z,U,Q){for(let J=0;J<z.length;J++){let K=$[J],I=J<U.length;if(K.issues.length){if(!I&&J>=Q){Y.value.length=J;break}Y.issues.push(...x8(J,K.issues))}Y.value[J]=K.value}for(let J=Y.value.length-1;J>=U.length;J--)if(z[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Mr($,Y,z,U,Q,J,K){if($.issues.length)if(tI.has(typeof U))z.issues.push(...x8(U,$.issues));else z.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((I)=>A8(I,K,a4()))});if(Y.issues.length)if(tI.has(typeof U))z.issues.push(...x8(U,Y.issues));else z.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:U,issues:Y.issues.map((I)=>A8(I,K,a4()))});z.value.set($.value,Y.value)}function Or($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Nr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Dr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Ar($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function WV($,Y,z){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa
Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let M=q.compile();return(N,D)=>M(Z,N,D)},J,I=TU,K=!AU.jitless,H=K&&eT.value,W=U.catchall,X;$._zod.parse=(Z,q)=>{X??(X=z.value);let V=Z.value;if(!I(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(U.shape);if(Z=J(Z,q),!W)return Z;return Or([],V,Z,q,X,$)}return Y(Z,q)}});IG=H0("$ZodUnion",($,U)=>{q1.init($,U),T1($._zod,"optin",()=>U.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),T1($._zod,"optout",()=>U.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),T1($._zod,"values",()=>{if(U.options.every((z)=>z._zod.values))return new Set(U.options.flatMap((z)=>Array.from(z._zod.values)));return}),T1($._zod,"pattern",()=>{if(U.options.every((z)=>z._zod.pattern)){let z=U.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${z.map((Q)=>rK(Q.source)).join("|")})$`)}return});let Y=U.options.length===1?U.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(Y)return Y(z,Q);let J=!1,I=[];for(let K of U.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else{if(G.issues.length===0)return G;I.push(G)}}if(!J)return Yr(I,z,$,Q);return Promise.all(I).then((K)=>{return Yr(K,z,$,Q)})}});mE=H0("$ZodXor",($,U)=>{IG.init($,U),U.inclusive=!1;let Y=U.options.length===1?U.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(Y)return Y(z,Q);let J=!1,I=[];for(let K of U.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else I.push(G)}if(!J)return zr(I,z,$,Q);return Promise.all(I).then((K)=>{return zr(K,z,$,Q)})}}),lE=H0("$ZodDiscriminatedUnion",($,U)=>{U.inclusive=!1,IG.init($,U);let Y=$._zod.parse;T1($._zod,"propValues",()=>{let Q={};for(let J of U.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${U.options.indexOf(J)}"`);for(let[K,G]of Object.entries(I)){if(!Q[K])Q[K]=new Set;for(let H of G)Q[K].add(H)}}return Q});let z=bz(()=>{let Q=U.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[U.discriminator];if(!K||K.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${U.options.indexOf(I)}"`);for(let G of K){if(J.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);J.set(G,I)}}return J});$._zod.parse=(Q,J)=>{let I=Q.value;if(!TU(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=z.value.get(I?.[U.discriminator]);if(K)return K._zod.run(Q,J);if(U.unionFallback||J.direction==="backward")return Y(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:U.discriminator,options:Array.from(z.value.keys()),input:I,path:[U.discriminator],inst:$}),Q}}),oE=H0("$ZodIntersection",($,U)=>{q1.init($,U),$._zod.parse=(Y,z)=>{let Q=Y.value,J=U.left._zod.run({value:Q,issues:[]},z),I=U.right._zod.run({value:Q,issues:[]},z);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,H])=>{return Qr(Y,G,H)});return Qr(Y,J,I)}});VV=H0("$ZodTuple",($,U)=>{q1.init($,U);let Y=U.items;$._zod.parse=(z,Q)=>{let J=z.value;if(!Array.isArray(J))return z.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),z;z.value=[];let I=[],K=Jr(Y,"optin"),G=Jr(Y,"optout");if(!U.rest){if(J.length<K)return z.issues.push({code:"too_small",minimum:K,inclusive:!0,input:J,inst:$,origin:"array"}),z;if(J.length>Y.length)z.issues.push({code:"too_big",maximum:Y.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(Y.length);for(let W=0;W<Y.length;W++){let X=Y[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)I.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(U.rest){let W=Y.length-1,X=J.slice(Y.length);for(let Z of X){W++;let q=U.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)I.push(q.then((V)=>Ir(V,z,W)));else Ir(q,z,W)}}if(I.length)return Promise.all(I).then(()=>Kr(H,z,Y,J,G));return Kr(H,z,Y,J,G)}});rE=H0("$ZodRecord",($,U)=>{q1.init($,U),$._zod.parse=(Y,z)=>{let Q=Y.value;if(!I7(Q))return Y.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),Y;let J=[],I=U.keyType._zod.values;if(I){Y.value={};let K=new Set;for(let H of I)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let W=U.keyType._zod.run({value:H,issues:[]},z);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){Y.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>A8(q,z,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=U.valueType._zod.run({value:Q[H],issues:[]},z);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)Y.issues.push(...f8(H,q.issues));Y.value[X]=q.value}));else{if(Z.issues.length)Y.issues.push(...f8(H,Z.issues));Y.value[X]=Z.value}}let G;for(let H in Q)if(!K.has(H))G=G??[],G.push(H);if(G&&G.length>0)Y.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=CY,I=!TY.jitless,W=I&&Qj.value,H=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=U.value);let V=Z.value;if(!K(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(I&&W&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!H)return Z;return Cr([],V,Z,q,X,$)}return z(Z,q)}});GG=W0("$ZodUnion",($,Y)=>{V1.init($,Y),E1($._zod,"optin",()=>Y.options.some((U)=>U._zod.optin==="optional")?"optional":void 0),E1($._zod,"optout",()=>Y.options.some((U)=>U._zod.optout==="optional")?"optional":void 0),E1($._zod,"values",()=>{if(Y.options.every((U)=>U._zod.values))return new Set(Y.options.flatMap((U)=>Array.from(U._zod.values)));return}),E1($._zod,"pattern",()=>{if(Y.options.every((U)=>U._zod.pattern)){let U=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${U.map((Q)=>aI(Q.source)).join("|")})$`)}return});let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,Q)=>{if(z)return z(U,Q);let J=!1,K=[];for(let I of Y.options){let G=I._zod.run({value:U.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 Zr(K,U,$,Q);return Promise.all(K).then((I)=>{return Zr(I,U,$,Q)})}});aE=W0("$ZodXor",($,Y)=>{GG.init($,Y),Y.inclusive=!1;let z=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(U,Q)=>{if(z)return z(U,Q);let J=!1,K=[];for(let I of Y.options){let G=I._zod.run({value:U.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else K.push(G)}if(!J)return qr(K,U,$,Q);return Promise.all(K).then((I)=>{return qr(I,U,$,Q)})}}),tE=W0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,GG.init($,Y);let z=$._zod.parse;E1($._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[I,G]of Object.entries(K)){if(!Q[I])Q[I]=new Set;for(let W of G)Q[I].add(W)}}return Q});let U=pU(()=>{let Q=Y.options,J=new Map;for(let K of Q){let I=K._zod.propValues?.[Y.discriminator];if(!I||I.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${Y.options.indexOf(K)}"`);for(let G of I){if(J.has(G))throw Error(`Duplicatediscriminatorvalue"${String(G)}"`);J.set(G,K)}}return J});$._zod.parse=(Q,J)=>{let K=Q.value;if(!CY(K))return Q.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),Q;let I=U.value.get(K?.[Y.discriminator]);if(I)return I._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return z(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(U.value.keys()),input:K,path:[Y.discriminator],inst:$}),Q}}),eE=W0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(z,U)=>{let Q=z.value,J=Y.left._zod.run({value:Q,issues:[]},U),K=Y.right._zod.run({value:Q,issues:[]},U);if(J instanceof Promise||K instanceof Promise)return Promise.all([J,K]).then(([G,W])=>{return Vr(z,G,W)});return Vr(z,J,K)}});LV=W0("$ZodTuple",($,Y)=>{V1.init($,Y);let z=Y.items;$._zod.parse=(U,Q)=>{let J=U.value;if(!Array.isArray(J))return U.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),U;U.value=[];let K=[],I=Lr(z,"optin"),G=Lr(z,"optout");if(!Y.rest){if(J.length<I)return U.issues.push({code:"too_small",minimum:I,inclusive:!0,input:J,inst:$,origin:"array"}),U;if(J.length>z.length)U.issues.push({code:"too_big",maximum:z.length,inclusive:!0,input:J,inst:$,origin:"array"})}let W=Array(z.length);for(let H=0;H<z.length;H++){let X=z[H]._zod.run({value:J[H],issues:[]},Q);if(X instanceof Promise)K.push(X.then((Z)=>{W[H]=Z}));else W[H]=X}if(Y.rest){let H=z.length-1,X=J.slice(z.length);for(let Z of X){H++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)K.push(q.then((V)=>Fr(V,U,H)));else Fr(q,U,H)}}if(K.length)return Promise.all(K).then(()=>wr(W,U,z,J,G));return wr(W,U,z,J,G)}});$C=W0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(z,U)=>{let Q=z.value;if(!H7(Q))return z.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),z;let J=[],K=Y.keyType._zod.values;if(K){z.value={};let I=new Set;for(let W of K)if(typeof W==="string"||typeof W==="number"||typeof W==="symbol"){I.add(typeof W==="number"?W.toString():W);let H=Y.keyType._zod.run({value:W,issues:[]},U);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length){z.issues.push({code:"invalid_key",origin:"record",issues:H.issues.map((q)=>A8(q,U,a4())),input:W,path:[W],inst:$});continue}let X=H.value,Z=Y.valueType._zod.run({value:Q[W],issues:[]},U);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)z.issues.push(...x8(W,q.issues));z.value[X]=q.value}));else{if(Z.issues.length)z.issues.push(...x8(W,Z.issues));z.value[X]=Z.value}}let G;for(let W in Q)if(!I.has(W))G=G??[],G.push(W);if(G&&G.length>0)z.issues.push({code:"unrec
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letIof$.seen.entries()){letK=I[1];if(U===I[0]){J(I);continue}if($.external){letH=$.external.registry.get(I[0])?.id;if(U!==I[0]&&H){J(I);continue}}if($.metadataRegistry.get(I[0])?.id){J(I);continue}if(K.cycle){J(I);continue}if(K.count>1){if($.reused==="ref"){J(I);continue}}}}functionZ7($,U){letY=$.seen.get(U);if(!Y)throwError("Unprocessed schema. This is a bug in Zod.");letz=(K)=>{letG=$.seen.get(K);if(G.ref===null)return;letH=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){z(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),K._zod.parent===X)for(letOinH){if(O==="$ref"||O==="allOf")continue;if(!(OinW))deleteH[O]}if(V.$ref&&q.def)for(letOinH){if(O==="$ref"||O==="allOf")continue;if(Oinq.def&&JSON.stringify(H[O])===JSON.stringify(q.def[O]))deleteH[O]}}letZ=K._zod.parent;if(Z&&Z!==X){z(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:K,jsonSchema:H,path:G.path??[]})};for(letKof[...$.seen.entries()].reverse())z(K[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){letK=$.external.registry.get(U)?.id;if(!K)throwError("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,Y.def??Y.schema);letJ=$.metadataRegistry.get(U)?.id;if(J!==void0&&Q.id===J)deleteQ.id;letI=$.external?.defs??{};for(letKof$.seen.entries()){letG=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)deleteG.def.id;I[G.defId]=G.def}}if($.external);elseif(Object.keys(I).length>0)if($.target==="draft-2020-12")Q.$defs=I;elseQ.definitions=I;try{letK=JSON.parse(JSON.stringify(Q));returnObject.defineProperty(K,"~standard",{value:{...U["~standard"],jsonSchema:{input:KQ(U,"input",$.processors),output:KQ(U,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throwError("Error converting schema to JSON.")}}functionB8($,U){letY=U??{seen:newSet};if(Y.seen.has($))return!1;Y.seen.add($);letz=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")returnB8(z.element,Y);if(z.type==="set")returnB8(z.valueType,Y);if(z.type==="lazy")returnB8(z.getter(),Y);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")returnB8(z.innerType,Y);if(z.type==="intersection")returnB8(z.left,Y)||B8(z.right,Y);if(z.type==="record"||z.type==="map")returnB8(z.keyType,Y)||B8(z.valueType,Y);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnB8(z.in,Y)||B8(z.out,Y)}if(z.type==="object"){for(letQinz.shape)if(B8(z.shape[Q],Y))return!0;return!1}if(z.type==="union"){for(letQofz.options)if(B8(Q,Y))return!0;return!1}if(z.type==="tuple"){for(letQofz.items)if(B8(Q,Y))return!0;if(z.rest&&B8(z.rest,Y))return!0;return!1}return!1}varJ_=($,U={})=>(Y)=>{letz=W7({...Y,processors:U});returnI4($,z),X7(z,$),Z7(z,$)},KQ=($,U,Y={})=>(z)=>{let{libraryOptions:Q,target:J}=z??{},I=W7({...Q??{},target:J,io:U,processors:Y});returnI4($,I),X7(I,$),Z7(I,$)};varFG=o(()=>{qG()});functionvU($,U){if("_idmap"in$){letz=$,Q=W7({...U,processors:nV}),J={};for(letGofz._idmap.entries()){let[H,W]=G;I4(W,Q)}letI={},K={registry:z,uri:U?.uri,defs:J};Q.external=K;for(letGofz._idmap.entries()){let[H,W]=G;X7(Q,W),I[H]=Z7(Q,W)}if(Object.keys(J).length>0){letG=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}letY=W7({...U,processors:nV});returnI4($,Y),X7(Y,$),Z7(Y,$)}varox0,I_=($,U,Y,z)=>{letQ=Y;Q.type="string";let{minimum:J,maximum:I,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeofJ==="number")Q.minLength=J;if(typeofI==="number")Q.maxLength=I;if(K){if(Q.format=ox0[K]??K,Q.format==="")deleteQ.format;if(K==="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)=>({...U.target==="draft-07"||U.target==="draft-04"||U.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},K_=($,U,Y,z)=>{letQ=Y,{minimum:J,maximum:I,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeofK==="string"&&K.includes("int"))Q.type="integer";elseQ.type="number";letX=typeofW==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeofH==="number"&&H<=(I??Number.POSITIVE_INFINITY),q=U.target==="draft-04"||U.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;elseQ.exclusiveMinimuLine truncated
`}function Cu0($){let U=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Toolnameexceedsmaximumlengthof128characters(current:${$.length})`]};if($.includes(" "))U.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))U.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))U.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))U.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!Eu0.test($)){let Y=[...$].filter((z)=>!/[A-Za-z0-9._-]/.test(z)).filter((z,Q,J)=>J.indexOf(z)===Q);return U.push(`Toolnamecontainsinvalidcharacters:${Y.map((z)=>`"${z}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:U}}return{isValid:!0,warnings:U}}function Ru0($,U){if(U.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let Y of U)console.warn(`-${Y}`);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 YS($){let U=Cu0($);return Ru0($,U.warnings),U.isValid}function _u0($){return typeof $==="object"&&$!==null&&"_zod"in $}function vu0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function hu0($){if(typeof $!=="object"||$===null)return!1;if(_Q($))return!1;let U=Object.getPrototypeOf($);if(U!==Object.prototype&&U!==null)return!1;return Object.values($).every((Y)=>_u0(Y))}function Rw($){if($===void 0)return;if(hu0($))return Y0($);if(typeof $==="object"&&$!==null&&!_Q($)&&Object.values($).some((U)=>vu0(U)))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(!_Q($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var _h,Wf0,A1,V1,Xf0,Zt="2026-07-28",T7,Lt,Vf0,Lf0,Ff0,Ot,Mt,Of0,qw,xf1,ff1,$t,fh,Bf0,Tf0,CQ,n0,J1,Aw,At,hQ,Pw,Cf0=0,Rf0="private",_f0,ff0,Lw,ch,Tt,uf1,bf1,pf0,df0,nh,Fw,XH="2026-07-28",Ct,of0,D$=($)=>xG.safeParse($).success,j7=($)=>fG.safeParse($).success,HH=($)=>wQ.safeParse($).success,Ew=($)=>OQ.safeParse($).success,r9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Jt="x-mcp-header",rf0,sf0,af0,tf0,Mw=-32020,if1,ef0,It=!1,hh="draft-2020-12",Yu0,Ku0,Gu0,Kt,Hu0,Lu0,vt=250,Fu0,wu0,yt,kt,Ou0,Mu0,ft=60000,Du0,Au0,Pu0,ut,th,ju0,cf1,bt=10485760,$S=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??bt}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 U=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return it(U)}catch(Y){if(Y instanceof SyntaxError)continue;throw Y}}return null}clear(){this._buffer=void 0}},Eu0;var _w=o(()=>{lT();oT();aa();rv();_h=Symbol.for("mcp.sdk.errorBrands");Wf0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](U){return RQ(this,U)}static isInstance(U){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 RQ(this,U)}constructor(U,Y,z){super(Y);this.code=U,this.errorUri=z,this.name="OAuthError",gh(this,new.target)}toResponseObject(){let U={error:this.code,error_description:this.message};if(this.errorUri)U.error_uri=this.errorUri;return U}static fromResponse(U){return new $(U.error,U.error_description??U.error,U.error_uri)}},A1=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",$}({}),V1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return RQ(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 RQ(this,$)}constructor($,U,Y){super(U);this.code=$,this.data=Y,this.name="SdkError",gh(this,new.target)}},Xf0=class extends V1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,U,Y){super($,U,Y);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};T7=[Zt];Lt=["task","inputRequests","requestState"];Lf0=new Set(["const","enum","default","examples"]),Ff0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Ot={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},Mt={"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},Of0={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};xf1=Object.keys(Ot),ff1=Object.keys(Mt);$t={ok:!1,reason:"not-in-era"};fh={era:"2025-11-25",hasRequestMethod:Nt,hasNotificationMethod:Dt,validateRequest:($,U)=>Vw(Df0($),U),validateResult:($,U)=>Vw(Nf0($),U),validateNotification:($,U)=>Vw(Af0($),U),hasInputRequestMethod:()=>!1,validateInputRequest:()=>$t,validateInputResponse:()=>$t,samplingResultVariant:($,U)=>{let Y=Ft();return Vw($?Y.CreateMessageResultWithToolsSchema:Y.CreateMessageResultSchema,U)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,U){let Y=Vt($),z=Y.structuredContent;if(z===void 0)return Y;let Q=typeof z!=="object"||z===null||Array.isArray(z),J=U!==void 0&&wt(U);if(!Q&&!J)return Y;return{...Y,structuredContent:{result:z}}},decodeResult($,U){if(vh(U)&&"resultType"in U){let Y={...U};return delete Y.resultType,{kind:"complete",result:Yt(Y)}}return{kind:"complete",result:Yt(U)}},encodeResult($,U){if($!=="tools/list")return U;l
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letKof$.seen.entries()){letI=K[1];if(Y===K[0]){J(K);continue}if($.external){letW=$.external.registry.get(K[0])?.id;if(Y!==K[0]&&W){J(K);continue}}if($.metadataRegistry.get(K[0])?.id){J(K);continue}if(I.cycle){J(K);continue}if(I.count>1){if($.reused==="ref"){J(K);continue}}}}functionF7($,Y){letz=$.seen.get(Y);if(!z)throwError("Unprocessed schema. This is a bug in Zod.");letU=(I)=>{letG=$.seen.get(I);if(G.ref===null)return;letW=G.def??G.schema,H={...W},X=G.ref;if(G.ref=null,X){U(X);letq=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))W.allOf=W.allOf??[],W.allOf.push(V);elseObject.assign(W,V);if(Object.assign(W,H),I._zod.parent===X)for(letMinW){if(M==="$ref"||M==="allOf")continue;if(!(MinH))deleteW[M]}if(V.$ref&&q.def)for(letMinW){if(M==="$ref"||M==="allOf")continue;if(Minq.def&&JSON.stringify(W[M])===JSON.stringify(q.def[M]))deleteW[M]}}letZ=I._zod.parent;if(Z&&Z!==X){U(Z);letq=$.seen.get(Z);if(q?.schema.$ref){if(W.$ref=q.schema.$ref,q.def)for(letVinW){if(V==="$ref"||V==="allOf")continue;if(Vinq.def&&JSON.stringify(W[V])===JSON.stringify(q.def[V]))deleteW[V]}}}$.override({zodSchema:I,jsonSchema:W,path:G.path??[]})};for(letIof[...$.seen.entries()].reverse())U(I[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){letI=$.external.registry.get(Y)?.id;if(!I)throwError("Schema is missing an `id` property");Q.$id=$.external.uri(I)}Object.assign(Q,z.def??z.schema);letJ=$.metadataRegistry.get(Y)?.id;if(J!==void0&&Q.id===J)deleteQ.id;letK=$.external?.defs??{};for(letIof$.seen.entries()){letG=I[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{letI=JSON.parse(JSON.stringify(Q));returnObject.defineProperty(I,"~standard",{value:{...Y["~standard"],jsonSchema:{input:XQ(Y,"input",$.processors),output:XQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),I}catch(I){throwError("Error converting schema to JSON.")}}functionP8($,Y){letz=Y??{seen:newSet};if(z.seen.has($))return!1;z.seen.add($);letU=$._zod.def;if(U.type==="transform")return!0;if(U.type==="array")returnP8(U.element,z);if(U.type==="set")returnP8(U.valueType,z);if(U.type==="lazy")returnP8(U.getter(),z);if(U.type==="promise"||U.type==="optional"||U.type==="nonoptional"||U.type==="nullable"||U.type==="readonly"||U.type==="default"||U.type==="prefault")returnP8(U.innerType,z);if(U.type==="intersection")returnP8(U.left,z)||P8(U.right,z);if(U.type==="record"||U.type==="map")returnP8(U.keyType,z)||P8(U.valueType,z);if(U.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnP8(U.in,z)||P8(U.out,z)}if(U.type==="object"){for(letQinU.shape)if(P8(U.shape[Q],z))return!0;return!1}if(U.type==="union"){for(letQofU.options)if(P8(Q,z))return!0;return!1}if(U.type==="tuple"){for(letQofU.items)if(P8(Q,z))return!0;if(U.rest&&P8(U.rest,z))return!0;return!1}return!1}varH_=($,Y={})=>(z)=>{letU=V7({...z,processors:Y});returnJ4($,U),L7(U,$),F7(U,$)},XQ=($,Y,z={})=>(U)=>{let{libraryOptions:Q,target:J}=U??{},K=V7({...Q??{},target:J,io:Y,processors:z});returnJ4($,K),L7(K,$),F7(K,$)};varMG=o(()=>{LG()});functiongY($,Y){if("_idmap"in$){letU=$,Q=V7({...Y,processors:pV}),J={};for(letGofU._idmap.entries()){let[W,H]=G;J4(H,Q)}letK={},I={registry:U,uri:Y?.uri,defs:J};Q.external=I;for(letGofU._idmap.entries()){let[W,H]=G;L7(Q,H),K[W]=F7(Q,H)}if(Object.keys(J).length>0){letG=Q.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[G]:J}}return{schemas:K}}letz=V7({...Y,processors:pV});returnJ4($,z),L7(z,$),F7(z,$)}var$f0,X_=($,Y,z,U)=>{letQ=z;Q.type="string";let{minimum:J,maximum:K,format:I,patterns:G,contentEncoding:W}=$._zod.bag;if(typeofJ==="number")Q.minLength=J;if(typeofK==="number")Q.maxLength=K;if(I){if(Q.format=$f0[I]??I,Q.format==="")deleteQ.format;if(I==="time")deleteQ.format}if(W)Q.contentEncoding=W;if(G&&G.size>0){letH=[...G];if(H.length===1)Q.pattern=H[0].source;elseif(H.length>1)Q.allOf=[...H.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},Z_=($,Y,z,U)=>{letQ=z,{minimum:J,maximum:K,format:I,multipleOf:G,exclusiveMaximum:W,exclusiveMinimum:H}=$._zod.bag;if(typeofI==="string"&&I.includes("int"))Q.type="integer";elseQ.type="number";letX=typeofH==="number"&&H>=(J??Number.NEGATIVE_INFINITY),Z=typeofW==="number"&&W<=(K??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=H,Q.exclusiveMinimum=!0;elseQ.exclusiveMinimuLine truncated
`}function gu0($){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(!Su0.test($)){let z=[...$].filter((U)=>!/[A-Za-z0-9._-]/.test(U)).filter((U,Q,J)=>J.indexOf(U)===Q);return Y.push(`Toolnamecontainsinvalidcharacters:${z.map((U)=>`"${U}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function yu0($,Y){if(Y.length>0){console.warn(`Toolnamevalidationwarningfor"${$}":`);for(let z of Y)console.warn(`-${z}`);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 IS($){let Y=gu0($);return yu0($,Y.warnings),Y.isValid}function ku0($){return typeof $==="object"&&$!==null&&"_zod"in $}function xu0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function fu0($){if(typeof $!=="object"||$===null)return!1;if(gQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((z)=>ku0(z))}function _w($){if($===void 0)return;if(fu0($))return z0($);if(typeof $==="object"&&$!==null&&!gQ($)&&Object.values($).some((Y)=>xu0(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(!gQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var yh,Ff0,B1,L1,wf0,At="2026-07-28",R7,Tt,Nf0,Df0,Af0,Ct,Rt,Pf0,Vw,Gu1,Wu1,Ht,nh,_f0,vf0,hQ,n0,J1,Bw,ht,kQ,Pw,gf0=0,yf0="private",kf0,pf0,Fw,lh,yt,Hu1,Xu1,sf0,af0,oh,ww,qW="2026-07-28",ft,$u0,D$=($)=>uG.safeParse($).success,_7=($)=>bG.safeParse($).success,XW=($)=>DQ.safeParse($).success,Cw=($)=>AQ.safeParse($).success,a9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Lt="x-mcp-header",Yu0,zu0,Uu0,Qu0,Nw=-32020,Zu1,Ju0,Ft=!1,xh="draft-2020-12",Gu0,qu0,Vu0,wt,Lu0,Du0,it=250,Au0,Bu0,dt,mt,Pu0,Tu0,ot=60000,Eu0,Cu0,Ru0,rt,US,hu0,qu1,st=10485760,JS=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??st}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 at(Y)}catch(z){if(z instanceof SyntaxError)continue;throw z}}return null}clear(){this._buffer=void 0}},Su0;var vw=o(()=>{tT();eT();It();$h();yh=Symbol.for("mcp.sdk.errorBrands");Ff0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return SQ(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 SQ(this,Y)}constructor(Y,z,U){super(z);this.code=Y,this.errorUri=U,this.name="OAuthError",uh(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)}},B1=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 SQ(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 SQ(this,$)}constructor($,Y,z){super(Y);this.code=$,this.data=z,this.name="SdkError",uh(this,new.target)}},wf0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,z){super($,Y,z);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};R7=[At];Tt=["task","inputRequests","requestState"];Df0=new Set(["const","enum","default","examples"]),Af0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Ct={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},Rt={"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},Pf0={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};Gu1=Object.keys(Ct),Wu1=Object.keys(Rt);Ht={ok:!1,reason:"not-in-era"};nh={era:"2025-11-25",hasRequestMethod:_t,hasNotificationMethod:vt,validateRequest:($,Y)=>Lw(Ef0($),Y),validateResult:($,Y)=>Lw(jf0($),Y),validateNotification:($,Y)=>Lw(Cf0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ht,validateInputResponse:()=>Ht,samplingResultVariant:($,Y)=>{let z=jt();return Lw($?z.CreateMessageResultWithToolsSchema:z.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let z=Pt($),U=z.structuredContent;if(U===void 0)return z;let Q=typeof U!=="object"||U===null||Array.isArray(U),J=Y!==void 0&&Et(Y);if(!Q&&!J)return z;return{...z,structuredContent:{result:U}}},decodeResult($,Y){if(kh(Y)&&"resultType"in Y){let z={...Y};return delete z.resultType,{kind:"complete",result:Zt(z)}}return{kind:"complete",result:Zt(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l
Line truncated
*content-type
*Copyright(c)2015DouglasChristopherWilson
*MITLicensed
*/ju0=R0(($)=>{var U=/;*([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Y=/\\([\u000b\u0020-\u00ff])/g,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=Q;function Q(K){if(!K)throw TypeError("argument string is required");var G=typeof K==="object"?J(K):K;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(!z.test(W))throw TypeError("invalid media type");var X=new I(W.toLowerCase());if(H!==-1){var Z,q,V;U.lastIndex=H;while(q=U.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(Y,"$1")}X.parameters[Z]=V}if(H!==G.length)throw TypeError("invalid parameter format")}return X}function J(K){var G;if(typeof K.getHeader==="function")G=K.getHeader("content-type");else if(typeof K.headers==="object")G=K.headers&&K.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function I(K){this.parameters=Object.create(null),this.type=K}}),cf1=nq(ju0(),1);Eu0=/^[A-Za-z0-9._-]{1,128}$/});function zS($){let U=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ob0(U),U}var vw,ct,L1,v1,z5,Sw,Su0,nt,pt,hw,gu0,Q5,yu0,ku0,dt,xu0,gw,SQ,qH,gQ,yw,fu0,mt,uu0,bu0,iu0,QS,cu0,JS,lt,nu0,pu0,du0,mu0,lu0,ou0,ru0,su0,IS,au0,tu0,eu0,ot,rt,st,$b0,Ub0,Yb0,KS,zb0,at,Qb0,Jb0,Ib0,Kb0,Gb0,Hb0,Wb0,Xb0,tt,Zb0,et,$e,Ue,qb0,GS,Vb0,Ye,ze,Qe,Lb0,Fb0,Je,wb0,Ob0,Mb0,Ie,Nb0,Db0,Ke,Ab0,Pb0,Bb0,Tb0,jb0,Eb0,Cb0,Rb0,_b0,vb0,hb0,Sb0,gb0,yb0,kb0,xb0,fb0,ub0,bb0,ib0,cb0,nb0,pb0,Ge,db0,mb0,lb0,ob0,kw=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=zS(mb0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let U=bo($,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(U==="2020-12")return this.ajv;if(U==="2019-09")return this._ajv2019??=zS(db0.Ajv2019);return this._ajvDraft7??=zS(Ge.Ajv)}getValidator($){let U=this._engineFor($),Y="$id"in $&&typeof $.$id==="string"?U.getSchema($.$id)??U.compile($):U.compile($);return(z)=>{return Y(z)?{valid:!0,data:z,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:U.errorsText(Y.errors)}}}},$u1;var He=o(()=>{lT();oT();vw=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.regexpCode=$.getEsmExportName=$.getProperty=$.safeStringify=$.stringify=$.strConcat=$.addCodeArg=$.str=$._=$.nil=$._Code=$.Name=$.IDENTIFIER=$._CodeOrName=void 0;var U=class{};$._CodeOrName=U,$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Y=class extends U{constructor(w){super();if(!$.IDENTIFIER.test(w))throw Error("CodeGen: name must be a valid identifier");this.str=w}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=Y;var z=class extends U{constructor(w){super();this._items=typeof w==="string"?[w]:w}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let w=this._items[0];return w===""||w==='""'}get str(){var w;return(w=this._str)!==null&&w!==void 0?w:this._str=this._items.reduce((M,N)=>`${M}${N}`,"")}get names(){var w;return(w=this._names)!==null&&w!==void 0?w:this._names=this._items.reduce((M,N)=>{if(N instanceof Y)M[N.str]=(M[N.str]||0)+1;return M},{})}};$._Code=z,$.nil=new z("");function Q(w,...M){let N=[w[0]],D=0;while(D<M.length)K(N,M[D]),N.push(w[++D]);return new z(N)}$._=Q;let J=new z("+");function I(w,...M){let N=[q(w[0])],D=0;while(D<M.length)N.push(J),K(N,M[D]),N.push(J,q(w[++D]));return G(N),new z(N)}$.str=I;function K(w,M){if(M instanceof z)w.push(...M._items);else if(M instanceof Y)w.push(M);else w.push(X(M))}$.addCodeArg=K;function G(w){let M=1;while(M<w.length-1){if(w[M]===J){let N=H(w[M-1],w[M+1]);if(N!==void 0){w.splice(M-1,3,N);continue}w[M++]="+"}M++}}function H(w,M){if(M==='""')return w;if(w==='""')return M;if(typeof w=="string"){if(M instanceof Y||w[w.length-1]!=='"')return;if(typeof M!="string")return`${w.slice(0,-1)}${M}"`;if(M[0]==='"')return w.slice(0,-1)+M.slice(1);return}if(typeof M=="string"&&M[0]==='"'&&!(w instanceof Y))return`"${w}${M.slice(1)}`}function W(w,M){return M.emptyStr()?w:w.emptyStr()?M:I`${w}${M}`}$.strConcat=W;function X(w){return typeof w=="number"||typeof w=="boolean"||w===null?w:q(Array.isArray(w)?w.join(","):w)}function Z(w){return new z(q(w))}$.stringify=Z;function q(w){return JSON.stringify(w).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(w){return typeof w=="string"&&$.IDENTIFIER.test(w)?new z(`.${w}`):Q`[${w}]`}$.getProperty=V;function F(w){if(typeof w=="string"&&$.IDENTIFIER.test(w))returnnewz(`${w}`);throwError(`CodeGen: invalid export name: ${w}, use explicit $id name mapping`)}$.getEsmExportName=F;functionO(w){returnnewz(w.toStringLine truncated
deps:${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);I(G,H),K(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 I(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 F=H[V];if(F.length===0)continue;let O=(0,z.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(O,()=>{for(let w of F)(0,z.checkReportMissingProp)(G,w)});else W.if(U._`${O}&&(${(0,z.checkMissingProp)(G,F,q)})`),(0,z.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=I;function K(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let F in H){if((0,Y.alwaysValidSchema)(q,H[F]))continue;W.if((0,z.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let O=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(O,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),zb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=L1(),Y=v1(),z={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>U._`{propertyName:${Q.propertyName}}`},code(Q){let{gen:J,schema:I,data:K,it:G}=Q;if((0,Y.alwaysValidSchema)(G,I))return;let H=J.name("valid");J.forIn("key",K,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,U.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=z}),at=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=Q5(),Y=L1(),z=z5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:I})=>Y._`{additionalProperty:${I.additionalProperty}}`},code(I){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=I;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 F=(0,U.allSchemaProperties)(H.properties),O=(0,U.allSchemaProperties)(H.patternProperties);w(),I.ok(Y._`${X}===${z.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!O.length)D(T);else K.if(M(T),()=>D(T))})}function M(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");A=(0,U.isOwnProperty)(K,j,T)}else if(F.length)A=(0,Y.or)(...F.map((j)=>Y._`${T}===${j}`));else A=Y.nil;if(O.length)A=(0,Y.or)(A,...O.map((j)=>Y._`${(0,U.usePattern)(I,j)}.test(${T})`));return(0,Y.not)(A)}function N(T){K.code(Y._`delete${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){N(T);return}if(G===!1){if(I.setParams({additionalProperty:T}),I.error(),!q)K.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")B(T,A,!1),K.if((0,Y.not)(A),()=>{I.reset(),N(T)});else if(B(T,A),!q)K.if((0,Y.not)(A),()=>K.break())}}function B(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(C,A)}}};$.default=J}),Qb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=SQ(),Y=Q5(),z=v1(),Q=at(),J={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=I;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new U.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,Y.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=z.mergeEvaluated.props(K,(0,z.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,z.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))O(w);else{if(K.if((0,Y.propertyInData)(K,W,w,X.opts.ownProperties)),O(w),!X.allErrors)K.else().var(V,!0);K.endIf()}I.it.definedProperties.add(w),I.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function O(w){I.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Jb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let U=Q5(),Y=L1(),z=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=I,{opts:Z}=X,q=(0,U.allSchemaProperties)(G),V=q.filter((B)=>(0,z.alwaysValidSchema)(X,G[B]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,O=K.name("valid");if(X.props!==!0&&!(X.props instanceof Y.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:w}=X;M();function M(){for(let B of q){if(F)N(B);if(X.allErrors)
Line truncated
`)}openNode($,U){let Y=this.tos,z=this._xml;if(Y&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),Dk(z,U),this.leaf=!0,this.open=!0}addAttribute($,U){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(U!==void 0)y30(this._xml,$,U)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Dk(this._xml,$)}writeText($){let U=this._xml;if(this.open)U.push(">"),this.open=!1;this.leaf=!1,U.push(g30.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),U=this._xml;if(this.leaf)U.push("/>");else U.push("</"),U.push($),U.push(">");this.open=!1,this.leaf=!1}leafNode($,U,Y){if(this.openNode($,U),Y!==void 0)this.writeText(Y);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("")}}Ak.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};k30.exports=Ak});var Pk=E((Xt0)=>{var x30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Wt0($){if(typeof $==="string")return $;if(x30)return x30.decode($);return $.toString()}Xt0.bufferToString=Wt0});var c30=E((u30)=>{Object.defineProperty(u30,"__esModule",{value:!0});u30.CHAR=`
`,$=this.i;break;case ve0:{let{entityReturnState:Y}=this,z=this.entity+U.slice($,this.prevI);this.state=Y;let Q;if(z==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(z),this.entity="";if(Y!==C8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=U.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vW($))this.state=je0,this.unget(),this.xmlDeclPossible=!1;else switch($){case mM:this.state=Re0,this.xmlDeclPossible=!1;break;case X70:this.state=Fe0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=De0;break;default:this.fail("disallowed character in tag name"),this.state=C8,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=Sk,this.openWakaBang="";break;case"--":this.state=hk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Rk,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(dM))this.state=we0}sCommentEnding(){var $;let U=this.getCodeNorm();if(U===dM)this.state=Oe0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(U)}`,this.state=hk}sCommentEnded(){let $=this.getCodeNorm();if($!==B6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=hk;else this.state=C8}sCData(){if(this.captureToChar(TJ))this.state=Me0}sCDataEnding(){let $=this.getCodeNorm();if($===TJ)this.state=Ne0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Sk}sCDataEnding2(){var $;let U=this.getCodeNorm();switch(U){case B6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case TJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(U)}`,this.state=Sk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=Q70;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?pM:gk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=Q70}sPIRest(){let{chunk:$,i:U}=this;while(!0){let Y=this.getCodeNorm();if(Y===k4){this.piTarget+=$.slice(U);return}if(!this.nameCheck(Y)){this.piTarget+=$.slice(U,this.prevI);let z=Y===o6;if(z||p8(Y))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?GY:J70}else this.state=z?pM:gk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(Y);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=pM;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=pM}sPIEnding(){var $;let U=this.getCodeNorm();if(U===B6){let{piTarget:Y}=this;if(Y.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:Y,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(U===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(U)}`,this.state=gk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=GY;return}if($!==k4)this.state=Ae0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(ge0);if($===o6){this.state=GY,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===BJ))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=$===BJ?I70:Pe0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=GY,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==BJ)this.fail("value required.");this.state=I70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=GY,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!lM($))this.fail("value must be quoted."),this.q=W70;else this.q=$;this.state=Be0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=GY,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let U=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let Y=U;if(this.xmlDecl.version=Y,!/^1\.[0-9]+$/.test(Y))this.fail("ver
Line truncated
deps:${H}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[W,H]=J(G);K(G,W),I(G,H)}};function J({schema:G}){let W={},H={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?W:H;Z[X]=G[X]}return[W,H]}function K(G,W=G.schema){let{gen:H,data:X,it:Z}=G;if(Object.keys(W).length===0)return;let q=H.let("missing");for(let V in W){let F=W[V];if(F.length===0)continue;let M=(0,U.propertyInData)(H,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)H.if(M,()=>{for(let w of F)(0,U.checkReportMissingProp)(G,w)});else H.if(Y._`${M}&&(${(0,U.checkMissingProp)(G,F,q)})`),(0,U.reportMissingProp)(G,q),H.else()}}$.validatePropertyDeps=K;function I(G,W=G.schema){let{gen:H,data:X,keyword:Z,it:q}=G,V=H.name("valid");for(let F in W){if((0,z.alwaysValidSchema)(q,W[F]))continue;H.if((0,U.propertyInData)(H,X,F,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(M,V)},()=>H.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=I,$.default=Q}),Wb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),z=v1(),U={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:I,it:G}=Q;if((0,z.alwaysValidSchema)(G,K))return;let W=J.name("valid");J.forIn("key",I,(H)=>{Q.setParams({propertyName:H}),Q.subschema({keyword:"propertyNames",data:H,dataTypes:["string"],propertyName:H,compositeRule:!0},W),J.if((0,Y.not)(W),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(W)}};$.default=U}),Ie=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),z=F1(),U=U5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:K})=>z._`{additionalProperty:${K.additionalProperty}}`},code(K){let{gen:I,schema:G,parentSchema:W,data:H,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 F=(0,Y.allSchemaProperties)(W.properties),M=(0,Y.allSchemaProperties)(W.patternProperties);w(),K.ok(z._`${X}===${U.default.errors}`);function w(){I.forIn("key",H,(T)=>{if(!F.length&&!M.length)D(T);else I.if(N(T),()=>D(T))})}function N(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,W.properties,"properties");A=(0,Y.isOwnProperty)(I,j,T)}else if(F.length)A=(0,z.or)(...F.map((j)=>z._`${T}===${j}`));else A=z.nil;if(M.length)A=(0,z.or)(A,...M.map((j)=>z._`${(0,Y.usePattern)(K,j)}.test(${T})`));return(0,z.not)(A)}function O(T){I.code(z._`delete${H}[${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)I.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=I.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),I.if((0,z.not)(A),()=>{K.reset(),O(T)});else if(P(T,A),!q)I.if((0,z.not)(A),()=>I.break())}}function P(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});K.subschema(C,A)}}};$.default=J}),Hb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=xQ(),z=Q5(),U=v1(),Q=Ie(),J={keyword:"properties",type:"object",schemaType:"object",code(K){let{gen:I,schema:G,parentSchema:W,data:H,it:X}=K;if(X.opts.removeAdditional==="all"&&W.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,z.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=U.mergeEvaluated.props(I,(0,U.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,U.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=I.name("valid");for(let w of q){if(F(w))M(w);else{if(I.if((0,z.propertyInData)(I,H,w,X.opts.ownProperties)),M(w),!X.allErrors)I.else().var(V,!0);I.endIf()}K.it.definedProperties.add(w),K.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){K.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Xb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),z=F1(),U=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(K){let{gen:I,schema:G,data:W,parentSchema:H,it:X}=K,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,U.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&H.properties,M=I.name("valid");if(X.props!==!0&&!(X.props instanceof z.Name))X.props=(0,Q.evaluatedPropsToName)(I,X.props);let{props:w}=X;N();function N(){for(let P of q){if(F)O(P);if(X.allErrors)
Line truncated
`)}openNode($,Y){let z=this.tos,U=this._xml;if(z&&this.open)U.push(">");this._stack.push($),U.push("<"),U.push($),jk(U,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)p30(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");jk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(n30.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,z){if(this.openNode($,Y),z!==void 0)this.writeText(z);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("")}}Ek.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};d30.exports=Ek});var Ck=E((wt0)=>{var m30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Ft0($){if(typeof $==="string")return $;if(m30)return m30.decode($);return $.toString()}wt0.bufferToString=Ft0});var a30=E((o30)=>{Object.defineProperty(o30,"__esModule",{value:!0});o30.CHAR=`
`,$=this.i;break;case xe0:{let{entityReturnState:z}=this,U=this.entity+Y.slice($,this.prevI);this.state=z;let Q;if(U==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(U),this.entity="";if(z!==C8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vH($))this.state=he0,this.unget(),this.xmlDeclPossible=!1;else switch($){case oO:this.state=ye0,this.xmlDeclPossible=!1;break;case N70:this.state=Ae0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=Ee0;break;default:this.fail("disallowed character in tag name"),this.state=C8,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=fk,this.openWakaBang="";break;case"--":this.state=xk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=gk,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(lO))this.state=Be0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===lO)this.state=Pe0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=xk}sCommentEnded(){let $=this.getCodeNorm();if($!==P6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=xk;else this.state=C8}sCData(){if(this.captureToChar(RJ))this.state=Te0}sCDataEnding(){let $=this.getCodeNorm();if($===RJ)this.state=je0;else this.text+=`]${String.fromCodePoint($)}`,this.state=fk}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case P6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case RJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=fk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=q70;else if($===o6||n8($))this.fail("processing instruction without a target."),this.state=$===o6?mO:uk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=q70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let z=this.getCodeNorm();if(z===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(z)){this.piTarget+=$.slice(Y,this.prevI);let U=z===o6;if(U||n8(z))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=U?Zz:V70}else this.state=U?mO:uk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(z);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=mO;else if(!n8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=mO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===P6){let{piTarget:z}=this;if(z.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:z,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(Y===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=uk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=Zz;return}if($!==k4)this.state=Ce0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(be0);if($===o6){this.state=Zz,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(n8($)||$===CJ))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=$===CJ?L70:Re0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=Zz,this.fail("XML declaration is incomplete.");return}if(n8($))return;if($!==CJ)this.fail("value required.");this.state=L70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=Zz,this.fail("XML declaration is incomplete.");return}if(n8($))return;if(!rO($))this.fail("value must be quoted."),this.q=O70;else this.q=$;this.state=_e0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=Zz,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let z=Y;if(this.xmlDecl.version=z,!/^1\.[0-9]+$/.test(z))this.fail("ver
Line truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new T6($,U).found}function T6($,U){if(!$)throw Error("must provide pattern");if(typeof U==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See:https://github.com/isaacs/node-glob/issues/167`);return new T6($,Y).found}function T6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`+Z0[P0-1];break}}}var N1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(N1,!0,P)}}function y(Q0,P){var v=Q0+" is deprecated and will be removed in a future version.";if(P)v+=" Use "+P+" instead.";return s(v)}function s(Q0,P,v){if(!A0.warnings)return;var u=new Q(Q0),r;if(P)v._attachExtraTrace(u);else if(A0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=b0(u);u.stack=X0.message+`
`+q0[B0-1];break}}}var D1="a promise was created in a "+v+"handler "+X0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(D1,!0,B)}}function y(Q0,B){var v=Q0+" is deprecated and will be removed in a future version.";if(B)v+=" Use "+B+" instead.";return s(v)}function s(Q0,B,v){if(!A0.warnings)return;var u=new Q(Q0),r;if(B)v._attachExtraTrace(u);else if(A0.longStackTraces&&(r=$._peekContext()))r.attachExtraTrace(u);else{var X0=i0(u);u.stack=X0.message+`
`)));return}}w=w._target();var M=w._bitField;if((M&50397184)===0)this._yieldedPromise=w,w._proxy(this,null);else if((M&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,w._value());else if((M&16777216)!==0)$._async.invoke(this._promiseRejected,this,w._reason());else this._promiseCancelled()}},$.coroutine=function(V,F){if(typeof V!=="function")throw new K(`generatorFunctionmustbeafunction
`)));return}}w=w._target();var N=w._bitField;if((N&50397184)===0)this._yieldedPromise=w,w._proxy(this,null);else if((N&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,w._value());else if((N&16777216)!==0)$._async.invoke(this._promiseRejected,this,w._reason());else this._promiseCancelled()}},$.coroutine=function(V,F){if(typeof V!=="function")throw new I(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var O=Object(F).yieldHandler,w=q,M=Error().stack;return function(){var N=V.apply(this,arguments),D=new w(void 0,void 0,O,M),B=D.promise();return D._generator=N,D._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new K("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 U(`generatorFunctionmustbeafunction
`);var M=Object(F).yieldHandler,w=q,N=Error().stack;return function(){var O=V.apply(this,arguments),D=new w(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 I("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
`)},U=function(){return new h.PromiseInspection(this._target())},Y=function(k){return h.reject(new X(k))};function z(){}var Q={},J=F4(),I;if(J.isNode)I=function(){var k=process.domain;if(k===void 0)k=null;return k};else I=function(){return null};J.notEnumerableProp(h,"_getDomain",I);var K=mY(),G=TF0(),H=new G;K.defineProperty(h,"_async",{value:H});var W=T3(),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={},F={},O=_F0()(h,q),w=hF0()(h,q,O,Y,z),M=gF0()(h),N=M.create,D=kF0()(h,M),B=D.CapturedTrace,T=fF0()(h,O),A=bF0()(F),j=Ic(),C=J.errorObj,b=J.tryCatch;function x(k,d){if(typeof d!=="function")throw new X("expecting a function but got "+J.classString(d));if(k.constructor!==h)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
`)},Y=function(){return new S.PromiseInspection(this._target())},z=function(k){return S.reject(new X(k))};function U(){}var Q={},J=F4(),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(S,"_getDomain",K);var I=sz(),G=gF0(),W=new G;I.defineProperty(S,"_async",{value:W});var H=j3(),X=S.TypeError=H.TypeError;S.RangeError=H.RangeError;var Z=S.CancellationError=H.CancellationError;S.TimeoutError=H.TimeoutError,S.OperationalError=H.OperationalError,S.RejectionError=H.OperationalError,S.AggregateError=H.AggregateError;var q=function(){},V={},F={},M=uF0()(S,q),w=iF0()(S,q,M,z,U),N=nF0()(S),O=N.create,D=dF0()(S,N),P=D.CapturedTrace,T=lF0()(S,M),A=rF0()(F),j=Xc(),C=J.errorObj,b=J.tryCatch;function x(k,d){if(typeof d!=="function")throw new X("expecting a function but got "+J.classString(d));if(k.constructor!==S)throw new X(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}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 d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(J.isObject(p))t[$0++]=p;else return Y("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=$0,k=arguments[g],this.then(void 0,A(t,k,this))}return this.then(void 0,k)},h.prototype.reflect=function(){return this._then(U,U,void 0,this,void 0)},h.prototype.then=function(k,d){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)t+=", "+J.classString(d);this._warn(t)}return this._then(k,d,void 0,void 0,void 0)},h.prototype.done=function(k,d){var t=this._then(k,d,void 0,void 0,void 0);t._setIsFinal()},h.prototype.spread=function(k){if(typeof k!=="function")return Y("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 w(this).promise()},h.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},h.getNewLibraryCopy=Gc.exports,h.is=function(k){return k instanceof h},h.fromNode=h.fromCallback=function(k){var d=new h(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(k)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},h.all=function(k){return new w(k).promise()},h.cast=function(k){var d=O(k);if(!(d instanceof h))d=new h(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=k;return d},h.resolve=h.fulfilled=h.cast,h.reject=h.rejected=function(k){var d=new h(q);return d._captureStackTrace(),d._rejectCallback(k,!0),d},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,d,t,$0,g){var p=g!==void 0,e=p?g:new h(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var U0=I();if((s&50397184)!==0){var O0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,O0=k;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,O0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),O0=d;H.invoke(G0,y,{handler:U0===null?O0:typeof O0==="function"&&J.domainBind(U0,O0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(k,d,e,$0,U0);return e},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 d=k===0?this._receiver0:this[k*4-4+3];if(d===Q)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},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:d,_fulfillmentHandler
Line truncated
`)}function S(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)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(k){var d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(J.isObject(p))t[$0++]=p;else return z("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=$0,k=arguments[g],this.then(void 0,A(t,k,this))}return this.then(void 0,k)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(k,d){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)t+=", "+J.classString(d);this._warn(t)}return this._then(k,d,void 0,void 0,void 0)},S.prototype.done=function(k,d){var t=this._then(k,d,void 0,void 0,void 0);t._setIsFinal()},S.prototype.spread=function(k){if(typeof k!=="function")return z("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},S.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},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},S.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},S.getNewLibraryCopy=qc.exports,S.is=function(k){return k instanceof S},S.fromNode=S.fromCallback=function(k){var d=new S(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(k)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},S.all=function(k){return new w(k).promise()},S.cast=function(k){var d=M(k);if(!(d instanceof S))d=new S(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=k;return d},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(k){var d=new S(q);return d._captureStackTrace(),d._rejectCallback(k,!0),d},S.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return W.setScheduler(k)},S.prototype._then=function(k,d,t,$0,g){var p=g!==void 0,e=p?g:new S(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var Y0=K();if((s&50397184)!==0){var N0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,N0=k;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,N0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),N0=d;W.invoke(G0,y,{handler:Y0===null?N0:typeof N0==="function"&&J.domainBind(Y0,N0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(k,d,e,$0,Y0);return e},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(W.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(k){var d=k===0?this._receiver0:this[k*4-4+3];if(d===Q)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},S.prototype._promiseAt=function(k){return this[k*4-4+2]},S.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},S.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(k){var{_bitField:d,_fulfillmentHandler
Line truncated
`,{mode:384}),U}function Up($){let U=HA0();for(let Y of U){if(!V$(Y))continue;for(let z of kP(Y).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=N9(Y,z);try{let J=fP(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function x2($,U){let Y=Up($);if(!Y)throw Error(`Enterpriseconfignotfound:${$}`);let Q={...JSON.parse(fP(Y,"utf-8")),...U};for(let I of Object.keys(U))if(U[I]===void 0)delete Q[I];let J=an.parse(Q);return zA0(Y,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var en="SEAL_USE_ENTERPRISES_DIR",QA0="SEAL_HOME_ENTERPRISES_DIR",JA0="SEAL_USE_USER_ENTERPRISES_DIR",IA0="SEAL_HOME_USER_ENTERPRISES_DIR",KA0="SEAL_USE_CONFIG_FILE",GA0="SEAL_HOME_CONFIG_FILE",rI,xP,yP,UA0;var S3=o(()=>{tn();rI=N9(uP(),".config","seal-use","enterprises"),xP=N9(uP(),".config","seal-home","enterprises"),yP=N9(uP(),".config","seal-use","config.json"),UA0=N9(uP(),".config","seal-home","config.json")});function f2($,U,Y=[]){let z=U.corpId?.trim()||void 0,Q=U.stateful?U.defaultCorpId?.trim()||void 0:void 0,J=z??Q;if(J){let K=$.find((W)=>W.id===J);if(K)return K;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(!U.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` to enable a default enterprise.");let I=$[0];if(I)return I;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(Y.length?Y.join(", "):"the configured enterprise directories"))}import{existsSync as Yp,mkdirSync as gN1,readFileSync as yN1,renameSync as kN1,unlinkSync as xN1,writeFileSync as fN1}from"node:fs";import{homedir as uN1}from"node:os";import{dirname as bN1,join as iN1}from"node:path";function _Z(){let $=process.env[cN1]?.trim();if($)return $;return nN1}function WA0($=new Date){return $.toISOString().slice(0,10)}function XA0($=zp,U=new Date){let Y=U.getTime()-Math.max(0,$-1)*86400000;return new Date(Y).toISOString().slice(0,10)}function ZA0($=_Z()){if(!Yp($))return{};try{let U=yN1($,"utf-8"),Y=JSON.parse(U);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function pN1($,U){let Y={};for(let[z,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},I=!1;for(let[K,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&K>=U)J[K]=G,I=!0;if(I)Y[z]=J}return Y}function dN1($,U=_Z()){let Y=bN1(U);if(!Yp(Y))gN1(Y,{recursive:!0,mode:448});let z=`${U}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{fN1(z,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),kN1(z,U)}catch(Q){try{if(Yp(z))xN1(z)}catch{}throw Q}}function qA0($,U=new Date){if(!$||typeof $!=="string")return;try{let Y=_Z(),z=ZA0(Y),Q=WA0(U),J=XA0(zp,U),I=pN1(z,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,dN1(I,Y)}catch{}}function mN1($,U=zp,Y=new Date){let z=new Map;try{let Q=ZA0(),J=XA0(U,Y),I=WA0(Y),K=$??Object.keys(Q);for(let G of K){let H=Q[G];if(!H){z.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=I&&typeof Z==="number")W+=Z;z.set(G,W)}}catch{if($)for(let Q of $)z.set(Q,0)}return z}function VA0($,U,Y){let z=Y??mN1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(U){if(Q.id===U&&J.id!==U)return-1;if(J.id===U&&Q.id!==U)return 1}let I=z.get(Q.id)??0,K=z.get(J.id)??0;if(I!==K)return K-I;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 cN1="SEAL_USE_USAGE_FILE",nN1,zp=7;var bP=o(()=>{nN1=iN1(uN1(),".config","seal-use","usage.json")});function lN1($,U){return $.map((Y)=>Y.trim()).filter(Boolean).map((Y)=>U?Y:Y.toLowerCase())}function oN1($,U){return U?$:$.toLowerCase()}function rN1($,U,Y,z){let Q=oN1($,z),J=U.filter((I)=>Q.includes(I));if(Y==="all"&&J.length!==U.length)return[];return J}function sN1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function aN1($,U){if(U.fields&&!U.fields.has($.field))return[];let Y=sN1($.value),z=[];return Y.forEach((Q,J)=>{let I=rN1(Q,U.keywords,U.matchMode,U.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-U.contextLines),G=Math.min(Y.length,J+U.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:iP(Q,U.maxChars),context:{before:U.snippetOnly?[]:Y.slice(K,J).map((W)=>iP(W,U.maxChars)),line:iP(Q,U.maxChars),after:U.snippetOnly?[]:Y.slice(J+1,G).map((W)=>iP(W,U.maxChars))},metadata:$.metadata};if(U.snippetOnly)H.context={before:[],line:H.context.line,after:[]};z.push(H)}),z}function iP($,U){if(!U||$.length<=U)return $;return`${$.slice(0,Math.max(0,U))}...`}function tN1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function FA0($){return $.rules.flatMap((U,Y)=>{let z=`${$.id}:${U.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:U.scope,strictness:U.strictness,code:"code"in U?U.code:void 0,index:Y};return[{area:"rules",entityType:"rule",entityId:z,title:`${$.versionName}/${U.scope}`,field:"h
Line truncated
`,{mode:384}),Y}function Kp($){let Y=MA0();for(let z of Y){if(!V$(z))continue;for(let U of fB(z).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=D9(z,U);try{let J=bB(Q,"utf-8"),K=JSON.parse(J);if(K&&typeof K==="object"&&K.id===$)return Q}catch{}}}return}function g3($,Y){let z=Kp($);if(!z)throw Error(`Enterpriseconfignotfound:${$}`);let Q={...JSON.parse(bB(z,"utf-8")),...Y};for(let K of Object.keys(Y))if(Y[K]===void 0)delete Q[K];let J=zp.parse(Q);return ZA0(z,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Qp="SEAL_USE_ENTERPRISES_DIR",qA0="SEAL_HOME_ENTERPRISES_DIR",VA0="SEAL_USE_USER_ENTERPRISES_DIR",LA0="SEAL_HOME_USER_ENTERPRISES_DIR",FA0="SEAL_USE_CONFIG_FILE",wA0="SEAL_HOME_CONFIG_FILE",eK,uB,xB,HA0;var y3=o(()=>{Up();eK=D9(iB(),".config","seal-use","enterprises"),uB=D9(iB(),".config","seal-home","enterprises"),xB=D9(iB(),".config","seal-use","config.json"),HA0=D9(iB(),".config","seal-home","config.json")});function c2($,Y,z=[]){let U=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=U??Q;if(J){let I=$.find((H)=>H.id===J);if(I)return I;let G=$.find((H)=>H.id.toLowerCase()===J.toLowerCase());if(G)return G;let W=$.find((H)=>H.name.toLowerCase()===J.toLowerCase());if(W)return W;throw Error(`Noenterpriseconfigfoundfor${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-homeconfigmodestateful` 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: "+(z.length?z.join(", "):"the configured enterprise directories"))}import{existsSync as Ip,mkdirSync as iN1,readFileSync as cN1,renameSync as nN1,unlinkSync as pN1,writeFileSync as dN1}from"node:fs";import{homedir as mN1}from"node:os";import{dirname as lN1,join as oN1}from"node:path";function _Z(){let $=process.env[rN1]?.trim();if($)return $;return sN1}function OA0($=new Date){return $.toISOString().slice(0,10)}function NA0($=Gp,Y=new Date){let z=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(z).toISOString().slice(0,10)}function DA0($=_Z()){if(!Ip($))return{};try{let Y=cN1($,"utf-8"),z=JSON.parse(Y);if(z&&typeof z==="object"&&!Array.isArray(z))return z;return{}}catch{return{}}}function aN1($,Y){let z={};for(let[U,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},K=!1;for(let[I,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&I>=Y)J[I]=G,K=!0;if(K)z[U]=J}return z}function tN1($,Y=_Z()){let z=lN1(Y);if(!Ip(z))iN1(z,{recursive:!0,mode:448});let U=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{dN1(U,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),nN1(U,Y)}catch(Q){try{if(Ip(U))pN1(U)}catch{}throw Q}}function AA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let z=_Z(),U=DA0(z),Q=OA0(Y),J=NA0(Gp,Y),K=aN1(U,J);K[$]=K[$]||{},K[$][Q]=(K[$][Q]??0)+1,tN1(K,z)}catch{}}function eN1($,Y=Gp,z=new Date){let U=new Map;try{let Q=DA0(),J=NA0(Y,z),K=OA0(z),I=$??Object.keys(Q);for(let G of I){let W=Q[G];if(!W){U.set(G,0);continue}let H=0;for(let[X,Z]of Object.entries(W))if(X>=J&&X<=K&&typeof Z==="number")H+=Z;U.set(G,H)}}catch{if($)for(let Q of $)U.set(Q,0)}return U}function BA0($,Y,z){let U=z??eN1($.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=U.get(Q.id)??0,I=U.get(J.id)??0;if(K!==I)return I-K;let G=Q.name??Q.id,W=J.name??J.id,H=G.localeCompare(W,"zh-CN");if(H!==0)return H;return Q.id.localeCompare(J.id)})}var rN1="SEAL_USE_USAGE_FILE",sN1,Gp=7;var cB=o(()=>{sN1=oN1(mN1(),".config","seal-use","usage.json")});function $D1($,Y){return $.map((z)=>z.trim()).filter(Boolean).map((z)=>Y?z:z.toLowerCase())}function YD1($,Y){return Y?$:$.toLowerCase()}function zD1($,Y,z,U){let Q=YD1($,U),J=Y.filter((K)=>Q.includes(K));if(z==="all"&&J.length!==Y.length)return[];return J}function UD1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function QD1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let z=UD1($.value),U=[];return z.forEach((Q,J)=>{let K=zD1(Q,Y.keywords,Y.matchMode,Y.caseSensitive);if(K.length===0)return;let I=Math.max(0,J-Y.contextLines),G=Math.min(z.length,J+Y.contextLines+1),W={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:K,matchedText:nB(Q,Y.maxChars),context:{before:Y.snippetOnly?[]:z.slice(I,J).map((H)=>nB(H,Y.maxChars)),line:nB(Q,Y.maxChars),after:Y.snippetOnly?[]:z.slice(J+1,G).map((H)=>nB(H,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)W.context={before:[],line:W.context.line,after:[]};U.push(W)}),U}function nB($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function JD1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function TA0($){return $.rules.flatMap((Y,z)=>{let U=`${$.id}:${Y.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:z};return[{area:"rules",entityType:"rule",entityId:U,title:`${$.versionName}/${Y.scope}`,field:"h
Line truncated
@@ -876,47 +876,47 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
}
exportdefaultlintRule;
`}});import{existsSync as Hz,mkdirSync as BD1,readFileSync as TD1,readdirSync as CA0,rmSync as jD1,unlinkSync as ED1,writeFileSync as CD1}from"node:fs";import{homedir as RD1}from"node:os";import{isAbsolute as _D1,join as f6,resolve as vD1}from"node:path";import{pathToFileURL as jA0}from"node:url";function RA0($=i$){let U=[],Y=[];try{if(!Hz($))BD1($,{recursive:!0});let z=Object.keys(Wp);for(let[J,I]of Object.entries(Wp)){let K=f6($,J),G=!0;if(Hz(K))try{if(TD1(K,"utf8")===I)G=!1}catch{G=!0}if(G)CD1(K,I,"utf8");U.push(J)}let Q=CA0($,{withFileTypes:!0});for(let J of Q)if(!z.includes(J.name)){let I=f6($,J.name);try{if(J.isDirectory())jD1(I,{recursive:!0,force:!0});else ED1(I);Y.push(J.name)}catch{}}}catch{}return{synced:U,pruned:Y}}function _A0($={syncOfficial:!0}){if($.syncOfficial!==!1)RA0();let U=[{name:"builtin",type:"builtin",path:f6(i$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:f6(i$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:f6(i$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],Y=[b$,dP];for(let z of Y)if(Hz(z))try{let Q=CA0(z,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let I=J.name;if(I.endsWith(".ts")||I.endsWith(".js")||I.endsWith(".mjs")){let K=I.replace(/\.(ts|js|mjs)$/,"");if(!U.some((G)=>G.name===K))U.push({name:K,type:"custom",path:f6(z,I),description:`用户自定义规则校验器(${I})`})}}}catch{}return U}function SD1($){let U=($||"").trim();if(!U||U==="builtin"||U==="default"||U==="official/builtin"||U==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(U==="strict"||U==="official/strict"||U==="official/strict.ts")return{path:f6(i$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(U==="hlab"||U==="hlab-sop"||U==="hlab-rules"||U==="hlab-standard"||U==="official/hlab"||U==="official/hlab.ts")return{path:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(_D1(U)||U.startsWith("./")||U.startsWith("../")){let z=vD1(U);if(Hz(z))return{path:z};for(let Q of[".ts",".js",".mjs"])if(Hz(`${z}${Q}`))return{path:`${z}${Q}`}}let Y=[f6(b$,`${U}.ts`),f6(b$,`${U}.js`),f6(b$,`${U}.mjs`),f6(dP,`${U}.ts`),f6(dP,`${U}.js`),f6(dP,`${U}.mjs`)];for(let z of Y)if(Hz(z))return{path:z};return{}}async function Zp($){RA0();let U=SD1($??"builtin");if(U.isOfficial){let z=U.officialKind==="strict"?BA0:U.officialKind==="hlab"?TA0:aI,Q=U.officialKind==="builtin"?"builtin":"official",J=U.path;if(J&&Hz(J))try{let K=await import(jA0(J).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:U.officialKind??"builtin",type:Q,filePath:J,linter:EA0(G,z)}}catch{}return{name:U.officialKind??"builtin",type:Q,filePath:J,linter:z}}let Y=U.path;if(!Y)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aI};try{let Q=await import(jA0(Y).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️[linter]自定义校验器"${Y}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aI};return{name:$??"custom",type:"custom",filePath:Y,linter:EA0(J,aI)}}catch(z){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${Y}"失败(语法错误或依赖缺失:${z?.message??z}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:aI}}}functionEA0($,U){returnasync(Y,z)=>{try{letQ=await$(Y,z);if(Q&&typeofQ==="object"&&typeofQ.score==="number"&&Array.isArray(Q.issues))returnQ;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),U(Y,z)}catch(Q){returnconsole.error("⚠️[linter]自定义校验器执行异常:",Q),U(Y,z)}}}varb$,hD1="official",i$,dP;varqp=o(()=>{Kp();Hp();Xp();Gp();b$=f6(RD1(),".config","seal-use","linters"),i$=f6(b$,hD1),dP=f6(process.cwd(),"linters")});asyncfunctionVp($,U,Y){letz=awaitU.linter($,Y);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:z.score,passed:z.passed,issues:z.issues,description:$.description}}asyncfunctionvA0($,U,Y,z){letQ=z?.minScore??0,J=z?.level??"all",I=[],K=0;for(letqof$){letV=awaitVp(q,U,Y);K+=V.score;letF=V.issues;if(J==="error")F=V.issues.filter((w)=>w.level==="error");elseif(J==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");letO=F.every((w)=>w.level!=="error");if(z?.summary){if(F.length>0)I.push({...V,passed:O,issues:F})}elseI.push({...V,passed:O,issues:F})}letG=$.length,H=G===0?100:Math.round(K/G),W=I.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`}});import{existsSync as qU,mkdirSync as vD1,readFileSync as hD1,readdirSync as xA0,rmSync as SD1,unlinkSync as gD1,writeFileSync as yD1}from"node:fs";import{homedir as kD1}from"node:os";import{isAbsolute as xD1,join as f6,resolve as fD1}from"node:path";import{pathToFileURL as yA0}from"node:url";function fA0($=i$){let Y=[],z=[];try{if(!qU($))vD1($,{recursive:!0});let U=Object.keys(Lp);for(let[J,K]of Object.entries(Lp)){let I=f6($,J),G=!0;if(qU(I))try{if(hD1(I,"utf8")===K)G=!1}catch{G=!0}if(G)yD1(I,K,"utf8");Y.push(J)}let Q=xA0($,{withFileTypes:!0});for(let J of Q)if(!U.includes(J.name)){let K=f6($,J.name);try{if(J.isDirectory())SD1(K,{recursive:!0,force:!0});else gD1(K);z.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:z}}function uA0($={syncOfficial:!0}){if($.syncOfficial!==!1)fA0();let Y=[{name:"builtin",type:"builtin",path:f6(i$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:f6(i$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:f6(i$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],z=[b$,lB];for(let U of z)if(qU(U))try{let Q=xA0(U,{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 I=K.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===I))Y.push({name:I,type:"custom",path:f6(U,K),description:`用户自定义规则校验器(${K})`})}}}catch{}return Y}function bD1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:f6(i$,"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:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(xD1(Y)||Y.startsWith("./")||Y.startsWith("../")){let U=fD1(Y);if(qU(U))return{path:U};for(let Q of[".ts",".js",".mjs"])if(qU(`${U}${Q}`))return{path:`${U}${Q}`}}let z=[f6(b$,`${Y}.ts`),f6(b$,`${Y}.js`),f6(b$,`${Y}.mjs`),f6(lB,`${Y}.ts`),f6(lB,`${Y}.js`),f6(lB,`${Y}.mjs`)];for(let U of z)if(qU(U))return{path:U};return{}}async function wp($){fA0();let Y=bD1($??"builtin");if(Y.isOfficial){let U=Y.officialKind==="strict"?SA0:Y.officialKind==="hlab"?gA0:YI,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&qU(J))try{let I=await import(yA0(J).href),G=I.default??I.lintRule??I.linter??I.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:kA0(G,U)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:U}}let z=Y.path;if(!z)return console.error(`⚠️[linter]未找到自定义校验器"${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:YI};try{let Q=await import(yA0(z).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️[linter]自定义校验器"${z}"未导出标准函数(default/lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:YI};return{name:$??"custom",type:"custom",filePath:z,linter:kA0(J,YI)}}catch(U){returnconsole.error(`⚠️[linter]加载自定义校验器脚本"${z}"失败(语法错误或依赖缺失:${U?.message??U}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:YI}}}functionkA0($,Y){returnasync(z,U)=>{try{letQ=await$(z,U);if(Q&&typeofQ==="object"&&typeofQ.score==="number"&&Array.isArray(Q.issues))returnQ;returnconsole.error("⚠️[linter]自定义校验器返回值格式不符合RuleLintResult契约,已回退至内置结果。"),Y(z,U)}catch(Q){returnconsole.error("⚠️[linter]自定义校验器执行异常:",Q),Y(z,U)}}}varb$,uD1="official",i$,lB;varMp=o(()=>{Zp();Vp();Fp();qp();b$=f6(kD1(),".config","seal-use","linters"),i$=f6(b$,uD1),lB=f6(process.cwd(),"linters")});asyncfunctionOp($,Y,z){letU=awaitY.linter($,z);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:U.score,passed:U.passed,issues:U.issues,description:$.description}}asyncfunctionbA0($,Y,z,U){letQ=U?.minScore??0,J=U?.level??"all",K=[],I=0;for(letqof$){letV=awaitOp(q,Y,z);I+=V.score;letF=V.issues;if(J==="error")F=V.issues.filter((w)=>w.level==="error");elseif(J==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");letM=F.every((w)=>w.level!=="error");if(U?.summary){if(F.length>0)K.push({...V,passed:M,issues:F})}elseK.push({...V,passed:M,issues:F})}letG=$.length,W=G===0?100:Math.round(I/G),H=K.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`),z=await Promise.all(N.map((D)=>H4($,D.id)))}let Q=new Map,J=0;for(let w of z){let M=w.document,N=w.sourceDocumentId??(typeof M?.id==="string"?M.id:void 0)??(typeof M?.sourceDocumentId==="string"?M.sourceDocumentId:void 0)??w.documentId??w.id,D=`${Y.docIdPrefix??""}${N}${Y.docIdSuffix??""}`,B=[];if(Y.includeAttachments!==!1){let A=k2(w,{summary:!1}).attachments,j=new Set;for(let C of A){let b=C.ossSignedUrl??C.url;if(!b)continue;let x=C.fileName??C.fileId??"attachment",h=on(x),i=h,c=h.lastIndexOf("."),z0=c>0?h.slice(0,c):h,k=c>0?h.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${z0}_${d}${k}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${D}」附件:${x}...
`),await new Promise((w,M)=>{let N=Gh1(V),D=new Il({zlib:{level:9}});N.on("close",()=>w()),D.on("error",(B)=>M(B)),D.pipe(N),D.append(Buffer.from(F),{name:"信息表.xlsx"});for(let B of Q.values())for(let T of B)D.append(T.buffer,{name:T.zipPath});D.finalize()});let O=Wh1(V);return{filePath:V,corpId:U.id,corpName:U.name,recordCount:z.length,attachmentCount:J,fileSizeBytes:O.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var kR0;var Kl=o(()=>{gR0();X6();SP();kR0=J6(EZ(),1)});import{readFileSync as Lh1}from"node:fs";function Fh1($){let U=new URL($),Y=U.pathname.match(/\/webhook\/([^/]+)/);if(!Y)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${U.protocol}//${U.host}`,webhookId:Y[1]}}function wh1($,U){return U.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!U.toLowerCase().endsWith(".xlsx")}function Oh1($,U){if(!$.length)return;let Y=new Set($.map((J)=>{let I=J.fileName.split("/")[0],K=I.indexOf("@");return K>=0?I.slice(0,K):I}).filter((J)=>J!=="信息表.xlsx")),z=[];for(let J of U){let I=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))&&!Y.has(I))z.push(`Excel 会议编号「${I}」声明了附件,但在 ZIP 中找不到对应的根目录「${I}/」或「${I}@.../」。`)}let Q=new Set(U.map((J)=>J.document.documentId));for(let J of Y)if(!Q.has(J))z.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(z.length)throw new D5(z)}async function xR0($,U,Y){let z=[],Q=$;if(wh1($,U)){z=await lP0($),rP0(z,Y);let G=z.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Kd($,G)}let J=await YB0(Q);Oh1(z,J);let I=zB0(z,J),K=J.map((G)=>G.document);return{entries:z,parsed:J,plans:I,documents:K,fileBuffer:$}}async function _z($,U,Y){let z=await xR0($,U,Y),Q=z.parsed.map((J,I)=>qd(J.document,z.plans[I],new Map));return{warnings:[],documents:Q,attachmentPlan:z.plans}}async function YT($,U,Y){let z=await xR0($,U,Y.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Fh1(Y.webhookUrl),I=[];for(let K=0;K<z.parsed.length;K+=1){let G=z.parsed[K],H=z.plans[K],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(W.has(F))continue;let O=z.entries.find((T)=>T.fileName===F);if(!O)continue;process.stderr.write(`⬆ 上传附件: ${F}
`),U=await Promise.all(O.map((D)=>W4($,D.id)))}let Q=new Map,J=0;for(let w of U){let N=w.document,O=w.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??w.documentId??w.id,D=`${z.docIdPrefix??""}${O}${z.docIdSuffix??""}`,P=[];if(z.includeAttachments!==!1){let A=i2(w,{summary:!1}).attachments,j=new Set;for(let C of A){let b=C.ossSignedUrl??C.url;if(!b)continue;let x=C.fileName??C.fileId??"attachment",S=en(x),i=S,c=S.lastIndexOf("."),U0=c>0?S.slice(0,c):S,k=c>0?S.slice(c):"",d=1;while(j.has(i.toLowerCase()))i=`${U0}_${d}${k}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇下载单据「${D}」附件:${x}...
`),await new Promise((w,N)=>{let O=Lh1(V),D=new Xl({zlib:{level:9}});O.on("close",()=>w()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(F),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=wh1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:U.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-usewebhookresource-packpush${V}--corp<targetCorpId>`}}var dR0;var Zl=o(()=>{nR0();A6();yB();dR0=J6(EZ(),1)});import{readFileSync as Ah1}from"node:fs";function Bh1($){let Y=new URL($),z=Y.pathname.match(/\/webhook\/([^/]+)/);if(!z)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:z[1]}}function Ph1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Th1($,Y){if(!$.length)return;let z=new Set($.map((J)=>{let K=J.fileName.split("/")[0],I=K.indexOf("@");return I>=0?K.slice(0,I):K}).filter((J)=>J!=="信息表.xlsx")),U=[];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))&&!z.has(K))U.push(`Excel 会议编号「${K}」声明了附件,但在 ZIP 中找不到对应的根目录「${K}/」或「${K}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of z)if(!Q.has(J))U.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(U.length)throw new D5(U)}async function mR0($,Y,z){let U=[],Q=$;if(Ph1($,Y)){U=await zP0($),QP0(U,z);let G=U.find((W)=>W.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Zd($,G)}let J=await XP0(Q);Th1(U,J);let K=ZP0(U,J),I=J.map((G)=>G.document);return{entries:U,parsed:J,plans:K,documents:I,fileBuffer:$}}async function gU($,Y,z){let U=await mR0($,Y,z),Q=U.parsed.map((J,K)=>Md(J.document,U.plans[K],new Map));return{warnings:[],documents:Q,attachmentPlan:U.plans}}async function QT($,Y,z){let U=await mR0($,Y,z.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Bh1(z.webhookUrl),K=[];for(let I=0;I<U.parsed.length;I+=1){let G=U.parsed[I],W=U.plans[I],H=new Map,X=[...W.categoryFields,...Object.values(W.personAttachments).flat(),...Object.values(W.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(H.has(F))continue;let M=U.entries.find((T)=>T.fileName===F);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${F}
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:U.sso?W:H,sealResultUrl:H,ssoUrl:W,type:U.sso?"sso_link":"deep_link",expiresIn:U.sso?q:void 0,identity:X,warning:Z,enterpriseAssistUrl:I,enterpriseUrl:I,hoseDomain:J.type==="hose"?oh1(J.domain):void 0,documentUrl:K,recordId:Q?.id,sourceDocumentSN:Q?.sourceDocumentSN,sourceDocumentId:Q?.sourceDocumentId,sourceSystem:Q?.sourceSystem,missing:{enterpriseAssistUrl:I?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:z&&!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($,U)=>{let Y=U.sn??U.query;if(!Y)throw Error("query or sn is required");let z=await rh1($,{query:Y,sn:U.sn,batchId:U.batchId,latest:U.latest,limit:U.latest?1:U.limit??20,maxScan:U.maxScan??1000}),Q=await Promise.all(z.records.map((K)=>H4($,K.id))),J=nR0(U.fields),I=Q.map((K)=>dh1(K,J));return{query:Y,sourceDocumentSN:U.sn,simulationBatchId:U.batchId,latest:U.latest??!1,total:z.total,scanned:z.scanned,matched:I.length,records:I,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...U.includeBridge?{bridge:GT(Q)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,U)=>{let Y=Ml(await aS($,U.batchId),U.query);return{batchId:U.batchId,count:Y.length,records:Y.map(hz),bridge:GT(Y)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,U)=>{let Y=U.mode??"hosecloud",z=U.signKey;if(Y==="hosecloud"&&!z){if(z=(await eS($)).find((K)=>K.signKey)?.signKey,!z)throw Error("未找到合思集成 signKey, 请通过 signKey
Line truncated
`)}function JS1($){let U=[];if(U.push(`seal-use${$.area}-${$.title}`),$.description)U.push($.description);U.push(""),U.push("Usage:");for(let Y of $.commands)for(let z of Y.usage)U.push(`${z}`);if($.commands.some((Y)=>Y.name))U.push(""),U.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return U.join(`
`)}function H_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let U of W_0)for(let Y of U.commands)for(let z of Y.usage)$.push(`${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var W_0;var Tl=o(()=>{L$();W_0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",commands:[{name:"list",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"],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"],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",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",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:"bind-test",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",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",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 version on the test enterprise. Production rules remain safe in draft state."},{name:"replay-test",summary:"Replay approval records from production enterprise to bound test enterprise via Webhook",usage:["seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"],options:[{flag:"<prodCorpId>",description:"Production enterprise ID (default: active enterprise)"},{flag:"--record-id <id>",description:"Replay a specific approval run ID"},{flag:"--sn <sn>",description:"Replay a specific document SN"},{flag:"--limit <n>",description:"Batch replay latest N records from production (default: 1)"},{flag:"--status <status>",descripti
Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:H?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:F,warning:M,hoseDomain:J.type==="hose"?YS1(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)=>{let z=Y.sn??Y.query;if(!z)throw Error("query or sn is required");let U=await zS1($,{query:z,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),Q=await Promise.all(U.records.map((I)=>W4($,I.id))),J=tR0(Y.fields),K=Q.map((I)=>th1(I,J));return{query:z,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:U.total,scanned:U.scanned,matched:K.length,records:K,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...Y.includeBridge?{bridge:HT(Q)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let z=Bl(await zg($,Y.batchId),Y.query);return{batchId:Y.batchId,count:z.length,records:z.map(kU),bridge:HT(z)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let z=Y.mode??"hosecloud",U=Y.signKey;if(z==="hosecloud"&&!U){if(U=(await Qg($)).find((I)=>I.signKey)?.signKey,!U)throw Error("未找到合思集成 signKey, 请通过 signKey 参数提供")}let Q=bh1({mode:z,flowIds:Y.flowIds,rejectNodeName:Y.rejectNodeName,thinkingDepthOverride:Y.thinkingDepthOverride,skipInvoiceGene
Line truncated
`)}function ZS1($){let Y=[];if(Y.push(`seal-use${$.area}-${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");for(let z of $.commands)for(let U of z.usage)Y.push(`${U}`);if($.commands.some((z)=>z.name))Y.push(""),Y.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return Y.join(`
`)}function w_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of M_0)for(let z of Y.commands)for(let U of z.usage)$.push(`${U}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var M_0;var _l=o(()=>{L$();M_0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",commands:[{name:"list",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"],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"],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",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",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",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",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",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",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 version on the test enterprise. Production rules remain safe in draft state."},{name:"replay-test",summary:"Replay approval records from production enterprise to bound test enterprise via Webhook",usage:["seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"],options:[{flag:"<prodCorpId>",des
Line truncated
`);c0({provider:"hose",capability:"privilege-elevation",corpId:Y.corpId,corpName:Y.corpName??Y.corpId,baseUrl:Y.baseUrl,staffId:Y.staffId,keyCount:Y.keys.length,keys:Y.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:z?Q.appSecurity:SS(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function cl($,U){let Y=E1($),z=U.reveal===!0;if(Y.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${Y.name}」(id:${Y.id})为原生Seal(${Y.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);f0({provider:"hose",capability:"privilege-elevation",corpId:z.corpId,corpName:z.corpName??z.corpId,baseUrl:z.baseUrl,staffId:z.staffId,keyCount:z.keys.length,keys:z.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:U?Q.appSecurity:fS(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function rl($,Y){let z=j1($),U=Y.reveal===!0;if(z.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${z.name}」(id:${z.id})为原生Seal(${z.source.type})租户,非合思(Hose/合思云/易快报)渠道企业。
`);c0({provider:"hose",capability:"privilege-elevation",corpId:Y.id,corpName:Y.name,domain:Y.source.domain,staffId:Y.source.staffId,appKey:Q??"-",appSecurity:J?z?J:SS(J):"-",active:!0})}function $h0($,U){let{token:Y,sealUrl:z,expiresIn:Q,verify:J,remote:I}=U,K=U.custom??tv0($),G=I?.user,H=I?.tenant,W=X4($,"tenantSlug")??s2(H?.tenantSlug),X=X4($,"tenantId")??s2(H?.id),Z=X4($,"tenantName")??s2(H?.name),q=X4($,"id")??W??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=X4($,"staffId")??s2(G?.providerUserId)??s2(G?.id)??"seal",F=X4($,"provider")??s2(G?.provider)??s2(H?.providerConfig?.provider),O=X4($,"corpId")??W??X??q,w={id:q,name:X4($,"name")??Z??q,environment:"production",seal:{url:z,tenantSlug:W,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:Y,sealUrl:z,expiresIn:Q,staffId:V,corpId:O,tenantId:X,tenantSlug:W,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},M=$p();lv0(M,{recursive:!0,mode:448});let N=rv0(M,`${VT(q)}.json`);if(mv0(N)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${N}.Pass"overwrite":truetoreplaceit.`);ov0(N,`${JSON.stringify(w,null,2)}
`,{mode:384}),c0({id:q,name:w.name,tenantId:X,tenantSlug:W,verified:J,path:N})}async function lS1($,U,Y={}){let z=T8($,U,Y),Q=await W8(z);return{user:Q.user??{},tenant:Q.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var nl=o(()=>{a9();BH();i8();S3();fv0();bP();tn();X6();X6();ul();SZ();ET();o4();L$();D4();J4()});async function Yh0($,U){let Y=$??S(U.options.link)??S(U.options.url);if(!Y)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let z=V0(U.options.reveal)===!0||V0(U.options.r)===!0||V0(U.options.plain)===!0,Q=V0(U.options.save)===!0||V0(U.options.add)===!0;await CT(Y,{reveal:z,save:Q,name:S(U.options.name),overwrite:V0(U.options.overwrite)===!0,force:V0(U.options.force)===!0,appKey:S(U.options["app-key"])??S(U.options.appKey),keyId:S(U.options["key-id"])??S(U.options.keyId)})}async function zh0($,U,Y){if($==="diagnose"){c0(await oS1(U));return}if($==="hose-link"){let z=Y.options.expire,Q=z!==void 0?s0(z):7200;if(Q===void 0||Q<=0)throw Error(`Invalid--expire:${String(z)}.Mustbeapositivenumberofseconds(e.g.--expire7200or--expire86400).`);let J=V0(Y.options.force)===!0||V0(Y.options.refresh)===!0||V0(Y.options.f)===!0;c0(await P00(U,Q,{force:J}));return}if($==="keys"){let z=V0(Y.options.reveal)===!0||V0(Y.options.r)===!0||V0(Y.options.plain)===!0;await cl(U.id,{reveal:z});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function oS1($){if($.source.type!=="hose"){let F=await j1($),O=await W8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:O.user,tenant:O.tenant}]}}aw($.id);let U=$.source,Y=U.appKey??U.key,z=U.appSecurity??U.password,Q=($.seal.url??U.sealUrl??`https://${U.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=U.staffId.includes(":")?U.staffId:`${U.corpId}:${U.staffId}`,I=[];if(!Y||!z)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=await RT("hose.openapi",async()=>{let F=await Uh0(`${U.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:Y,appSecurity:z}),O=d3(F.value),w=b6(O.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(O.corporationId)??b6(d3(O.corporation).id),expireTime:Bq(O.expireTime)}}});I.push(K.public);let G=K.private?.token,H=G?await RT("hose.provisional",async()=>{let F=await Uh0(`${U.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),O=b6(d3(F.value).message);if(!O)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(O).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:J,enterpriseUrl:Mq(O)}}}):pl("hose.provisional");I.push(H.public);let W=A6($.seal),X=H.private?.token,Z=X?await RT("seal.sso",async()=>{let O=await T8(Q,void 0,W).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=d3(O.data),M=b6(O.token)??b6(O.accessToken)??b6(w.token)??b6(w.accessToken);if(!M)throw Error("Seal SSO did not return a bearer token");return{token:M,public:{sealUrl:Q,expiresIn:Bq(O.expiresIn)??Bq(O.expires_in)??Bq(w.expiresIn)??Bq(w.expires_in)}}}):pl("seal.sso");I.push(Z.public);let q=Z.private?.token,V=q?await RT("seal.whoami",async()=>{let O=await T8(Q,q,W).get("api/v1/auth/me").json(),w=d3(O.data),M=d3(w.user??O.user),N=d3(w.tenant??O.tenant);return{public:{user:{id:b6(M.id),name:b6(M.name),isAdmin:sS1(M.isAdmin),providerUserId:b6(M.providerUserId)},tenant:{id:b6(N.id),name:b6(N.name),tenantSlug:b6(N.tenantSlug),hoseCorpConfig:aS1(N.hoseCorpConfig)}}}}):pl("seal.whoami");return I.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:I.every((F)=>F.ok===!0),stages:I}}async function RT($,U){try{let Y=await U();return{public:{name:$,ok:!0,...Qh0(Y.public)},private:Y.token?{token:Y.token}:void 0}}catch(Y){return{public:{name:$,ok:!1,error:Mq(Y instanceof Error?Y.message:String(Y))}}}}function pl($){return{public:{name:$,ok:!1,skipped:!0}}}async function Uh0($,U){let Y=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(U)});return rS1(Y)}async function rS1($){let U=await $.text();if(!$.ok)throw Error(`${$.status} ${U}`);let Y=JSON.parse(U);return d3(Y)}function d3($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function b6($){return typeof $==="string"&&$?$:void 0}function Bq($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function sS1($){return typeof $==="boolean"?$:void 0}function aS1($){let U=d3($);return Qh0({corporationId:b6(U.corporationId),corporationName:b6(U.corporationName)})}f
Line truncated
`);f0({provider:"hose",capability:"privilege-elevation",corpId:z.id,corpName:z.name,domain:z.source.domain,staffId:z.source.staffId,appKey:Q??"-",appSecurity:J?U?J:fS(J):"-",active:!0})}function Ih0($,Y){let{token:z,sealUrl:U,expiresIn:Q,verify:J,remote:K}=Y,I=Y.custom??Jh0($),G=K?.user,W=K?.tenant,H=X4($,"tenantSlug")??e2(W?.tenantSlug),X=X4($,"tenantId")??e2(W?.id),Z=X4($,"tenantName")??e2(W?.name),q=X4($,"id")??H??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=X4($,"staffId")??e2(G?.providerUserId)??e2(G?.id)??"seal",F=X4($,"provider")??e2(G?.provider)??e2(W?.providerConfig?.provider),M=X4($,"corpId")??H??X??q,w={id:q,name:X4($,"name")??Z??q,environment:"production",seal:{url:U,tenantSlug:H,headers:I.headers,cookies:I.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:z,sealUrl:U,expiresIn:Q,staffId:V,corpId:M,tenantId:X,tenantSlug:H,tenantName:Z,providerUserId:e2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},N=Jp();$h0(N,{recursive:!0,mode:448});let O=zh0(N,`${FT(q)}.json`);if(ev0(O)&&$.overwrite!==!0)throw Error(`Enterpriseconfigalreadyexists:${O}.Pass"overwrite":truetoreplaceit.`);Yh0(O,`${JSON.stringify(w,null,2)}
`,{mode:384}),f0({id:q,name:w.name,tenantId:X,tenantSlug:H,verified:J,path:O})}async function Yg1($,Y,z={}){let U=b8($,Y,z),Q=await T8(U);return{user:Q.user??{},tenant:Q.tenant??{}}}function e2($){return typeof $==="string"&&$?$:void 0}var sl=o(()=>{g7();jW();Q$();y3();dv0();cB();Up();A6();A6();ml();SZ();RT();f4();L$();D4();I4()});var Hh0={};N8(Hh0,{handleAuthExtractKeysCommand:()=>el,handleAuthCommand:()=>hT,formatBeijingIso:()=>tl});async function el($,Y){let z=$??h(Y.options.link)??h(Y.options.url);if(!z)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let U=Z0(Y.options.reveal)===!0||Z0(Y.options.r)===!0||Z0(Y.options.plain)===!0,Q=Z0(Y.options.save)===!0||Z0(Y.options.add)===!0;await _T(z,{reveal:U,save:Q,name:h(Y.options.name),overwrite:Z0(Y.options.overwrite)===!0,force:Z0(Y.options.force)===!0,appKey:h(Y.options["app-key"])??h(Y.options.appKey),keyId:h(Y.options["key-id"])??h(Y.options.keyId)})}async function hT($,Y,z){if($==="check"||$==="diagnose"||$==="status"||$==="test"||$==="doctor"){f0(await zg1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y?.source?.type==="seal"){let U=z.command[2]?.toLowerCase(),Q=h(z.options["from-link"])??(U==="from-link"?z.command[3]:void 0);if(Q){let X=h(z.options.note),Z=await ew(Q),q=b8(Z.sealUrl,Z.token),V=await T8(q);$M(Z.corpId,V.tenant);let F=await rQ(q,{note:X});f0({tenant:{id:V.tenant.id,name:V.tenant.name,tenantSlug:V.tenant.tenantSlug,corpId:Z.corpId},user:{id:V.user.id,name:V.user.name,providerUserId:V.user.providerUserId,isAdmin:V.user.isAdmin},delegation:F,expiresIn:Z.expiresIn});return}let J=await P1(Y);if(U==="list"){await k0("seal_delegation_list",J,Y,{},C0(z.options));return}if(U==="revoke"){let X=z.command[3]??h(z.options.tokenId)??h(z.options.id);if(!X)throw Error("Usage: seal-use auth link revoke <tokenId>");await k0("seal_delegation_revoke",J,Y,{tokenId:X},C0(z.options));return}let K=h(z.options.note)??"CLI generated provisional access link",I=await T5("seal_delegation_create",J,Y,{note:K});if($==="hose-link")console.error(`\uD83D\uDC49提示:企业「${Y.name}」源类型为Seal原生测试环境,已自动为您生成委托免登直达链接。`);let G=I,W="staffName"in Y.source&&typeof Y.source.staffName==="string"?Y.source.staffName:void 0,H=tl(Date.now()+86400000);f0({id:G.id,corpId:Y.source.corpId??Y.id,corpName:Y.name,staffId:Y.source.staffId,...W?{staffName:W}:{},link:G.link,expiresAt:H,token:G.token});return}if($==="hose-link"){let U=z.options.expire,Q=U!==void 0?s0(U):7200;if(Q===void 0||Q<=0)throw Error(`Invalid--expire:${String(U)}.Mustbeapositivenumberofseconds(e.g.--expire7200or--expire86400).`);let J=Z0(z.options.force)===!0||Z0(z.options.refresh)===!0||Z0(z.options.f)===!0,K=await h00(Y,Q,{force:J}),I="staffName"in Y.source&&typeof Y.source.staffName==="string"?Y.source.staffName:void 0,G=tl(Date.now()+Q*1000);f0({corpId:Y.source.corpId??Y.id,corpName:Y.name,staffId:Y.source.staffId,...I?{staffName:I}:{},link:K.url,expiresAt:G,token:K.token});return}if($==="keys"){let U=Z0(z.options.reveal)===!0||Z0(z.options.r)===!0||Z0(z.options.plain)===!0;await rl(Y.id,{reveal:U});return}throw Error(`Unknownauthcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function zg1($){if($.source.type!=="hose"){let F=await P1($),M=await T8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:M.user,tenant:M.tenant}]}}tw($.id);let Y=$.source,z=Y.appKey??Y.key,U=Y.appSecurity??Y.password,Q=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,K=[];if(!z||!U)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let I=await vT("hose.openapi",async()=>{let F=await Gh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:z,appSecurity:U}),M=l3(F.value),w=b6(M.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(M.corporationId)??b6(l3(M.corporation).id),expireTime:Tq(M.expireTime)}}});K.push(I.public);let G=I.private?.token,W=G?await vT("hose.provisional",async()=>{let F=await Gh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),M=b6(l3(F.value).message);if(!M)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(M).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:J,enterpriseUrl:Nq(M)}}}):al("hose.provisional");K.push(W.public);let H=D6($.seal),X=W.private?.token,Z=X?await vT("seal.sso",async()=>{let M=await b8(Q,
Line truncated
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let Z of X){let q=Z.outboundName??"SealAI 审批",V=Z.signKey,F=Z.apiOrigin??"production";console.error(`•"${q}"(signKey:${V},环境:${F})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${V}--corp${Q.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let F=V.outboundName??"SealAI 审批",O=V.signKey,w=V.apiOrigin??"production";console.error(`•"${F}"(signKey:${O},环境:${w})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${O}--corp${Q.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let F=V.outboundName??"SealAI 审批",M=V.signKey,w=V.apiOrigin??"production";console.error(`•"${F}"(signKey:${M},环境:${w})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${M}--corp${Q.id}
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 Th0=()=>{};var Ch0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--batch<batchId>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest--fieldsrecordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsmetadata\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.fields,result.summary\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsresult.summary,result.decision,result.riskPoints\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runsget<recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-useapproval-runsdocument-summary<recordId>--corp<corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-useapproval-runscited-rules<recordId>--corp<corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rulesget--record-id<recordId>--runtime-idrule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\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 & SSO 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#默认推荐:生成干净的深度链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-useapproval-runsurl<recordId>--corp<corpId>\nseal-useapproval-runsurl--sn<sourceDocumentSN>--corp<corpId>\n\n#仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带单次临时票据的SSO直登链接\nseal-useapproval-runsurl<recordId>--sso[--expire7200]--corp<corpId>\n```\n\n### SSO 链接安全与声明规范\n当向用户返回 `--sso` 链接时,Agent **必须**在回答中明确说明以下 4 点:\n1. **身份主体**:该链接代表哪个具体员工身份(如管理员姓名)登录。\n2. **权限范围**:该身份在 Seal AI 平台的全部权限范围(如完全操作权限)。\n3. **时效性**:临时 Ticket 换票时效(默认 2 小时,换票登录后会话有效 30 天)。\n4. **安全与防扩散边界**:该链接仅在 Seal AI 租户内生效,不代表合思主系统权限;严禁在公开或外部群聊中传播。\n\n>
Line truncated
`;var Eh0=()=>{};var _h0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--batch<batchId>--latest\nseal-useapproval-runspick--corp<corpId>--sn<sourceDocumentSN>--latest--fieldsrecordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsmetadata\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.fields,result.summary\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsresult.summary,result.decision,result.riskPoints\nseal-useapproval-runsget<recordId>--corp<corpId>--fieldsdocument.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runsget<recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-useapproval-runsdocument-summary<recordId>--corp<corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-useapproval-runscited-rules<recordId>--corp<corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rulesget--record-id<recordId>--runtime-idrule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\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### 免登链接安全与声明规范\n当向用户返回 `--auto-login` 链接时
Line truncated
|Hose/合思-sourcedSealtenant|Hose\`appKey\` + \`appSecurity\` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and \`corps sync-hosecloud\`. |
|Hose/合思-sourcedSealtenant|Hose\`appKey\` + \`appSecurity\` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and \`deploy hosecloud sync\`. |
|Hose/合思-sourcedSealtenant|Hoseauthorization/assistancelink(\`thirdparty.html\`) | 【两极分化】普通导入→短效;提权→永久 | Temporary session that can be **elevated** to permanent \`appKey\`/\`appSecurity\` with \`extract-keys --save\` or \`add-link --as-hose\`. |
|Hose/合思-sourcedSealtenant|cURLcopiedfromanauthenticated**Hoseadmin**page|【两极分化】普通导入→短效;提权→永久|**Samesessionscopeasanassistancelink.**IftheuserisaHoseadministrator,thiscarriesthesamewebsessioncredentials(\`accesstoken\`, \`corpid\`, cookies) and can equally invoke \`/api/innerapi/v1/key\` to extract permanent \`appKey\`/\`appSecurity\`. |
@@ -1574,7 +1569,7 @@ seal-use corps add-hose --json '{"appKey":"...","appSecurity":"..."}'
TheCLIprobesthestandarddomains,discoversthecorporation,anddiscoversadministratorcandidates.Ifitreturnsmultiplecandidates,showonlyusefulidentifyinginformationandaskwhichpersonshouldbeused;retrywith\`staffName\`, \`staffPhone\`, or the selected \`staffId\` internally. After creation, run:
\`\`\`bash
seal-useauthdiagnose--corp<discovered-id>
seal-useauthcheck--corp<discovered-id>
\`\`\`
Donotaskfor\`domain\`, \`corpId\`, or \`proxyStaffBizId\` up front. For a dedicated/private Hose deployment, add \`domain\` only after standard probing reports that it cannot find the enterprise.
@@ -1586,7 +1581,7 @@ First distinguish the link by its host, purpose, and identity origin:
-A**Hose/合思authorization/assistancelink**(\`https://<domain>/web/thirdparty.html?...\`) opens an upstream Hose session and may continue through Seal SSO. It is not a Seal delegation link.
-**HoseSubdomainBoundary(合思子域专属提权)**:\`seal-use\` primarily manages Seal tenants. Tenants sourced from the Hose ecosystem have an upstream Hose enterprise backing them. A received Hose assistance link contains only a temporary session \`accessToken\`. If you run standard \`corps add-link\`, it exchanges that temporary token for a short-lived Seal Bearer token—sufficient for basic Seal inspection, but it will expire and cannot call any Hose OpenAPI.
-**PrivilegeElevation(权限等级提升)**:Toelevatefromashort-livedsessiontokentopermanent,durableHoseOpenAPIdevelopercredentials,use\`corps extract-keys <url> --save\` or \`corps add-link <url> --as-hose\`. This leverages Hose's internal key interface (\`GET /api/innerapi/v1/key\`) using the session token to retrieve the enterprise's OpenAPI \`appKey\` and \`appSecurity\`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (e.g. \`corps sync-hosecloud\`).
-**PrivilegeElevation(权限等级提升)**:Toelevatefromashort-livedsessiontokentopermanent,durableHoseOpenAPIdevelopercredentials,use\`corps extract-keys <url> --save\` or \`corps add-link <url> --as-hose\`. This leverages Hose's internal key interface (\`GET /api/innerapi/v1/key\`) using the session token to retrieve the enterprise's OpenAPI \`appKey\` and \`appSecurity\`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (for example, \`deploy hosecloud sync\`).
-**Multi-KeyDisambiguation(多套密钥明确抉择)**:Iftheenterpriseownsmultipleapplicationkeys,theCLI**willnot**guessorsilentlypickthefirstkey.Instead,itterminateswithaninformativecandidatelistandrequirestheusertospecify\`--app-key <key>\` or \`--key-id <id>\`. If only one key exists, it is selected automatically.
-**Non-HoseTenantsBlocked**:Calling\`keys\` on native Seal enterprises (\`corp.source.type !== "hose"\`) is strictly rejected with exit code 2, explaining that this capability belongs exclusively to the Hose ecosystem.
@@ -1672,7 +1667,7 @@ If the captured request contains only cookies or an authentication shape the CLI
@@ -1793,10 +1790,10 @@ seal-use corps switch <corpId>
Thecommandverifiesbydefaultandwritestheenterpriseconfig.Iftheusersaysnottooperatebusinesslogic,stopat\`corps\` and auth/config commands; do not run approval, rule, document, simulation, or approval-run commands.
##Diagnoseauthentication
##Checkauthentication
\`\`\`bash
seal-useauthdiagnose--corp<corpId>
seal-useauthcheck--corp<corpId>
\`\`\`
ReadtheJSON\`stages\` in order:
@@ -1834,11 +1831,14 @@ Important:
-DonotreturntheSealtenantURLsuchas\`https://<tenant>.sealai.cc\`; that is not the Hose authorization link.
-Donotmanuallyassemble\`thirdparty.html\` with a global/OpenAPI token.
-\`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
-**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). Note: this link cannot be listed via \`seal-use delegation list\` (the latter only tracks Seal audit platform delegations).
2.TheexactexpirationtimeinBeijingtime(\`expiresAt\`, e.g. \`2026-09-22T11:20:02+08:00\`),
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\`).
@@ -2153,7 +2153,7 @@ Use current search only when the question is about current draft/current knowled
##OutputDiscipline
Ifarulecommandwouldreturnmanydescriptionsormorethanabout20rules,use\`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var nh0=()=>{};var mh0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled:false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-usedoctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-useconfiglintenable`) when disabled.\n- **Explicit Triggering**: `seal-useruleslint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-useconfiglintenable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-useruleslint--corp<corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n#Lintrulesinpublishedversion16\nseal-useruleslint--version16--corp<corpId>\n\n#Lintaspecificrulebycode(#0038)\nseal-useruleslint--code'#0038'--corp<corpId>\n\n#Summarymode(onlyshowruleswithissues)\nseal-useruleslint--summary--corp<corpId>\n```\n\n### 3. Quality Gate for CI / Release\n\n```bash\n#Ifoverallscoreisbelow85,terminateswithexitcode1\nseal-useruleslint--min-score85--levelerror--corp<corpId>\n```\n\n### 4. Configure Global Linter Settings\n\n```bash\n#Checkstatus\nseal-useconfiglintstatus\n\n#Enableautolintonruleupdates\nseal-useconfiglintenable--linterbuiltin--min-score80\n\n#Disableautolint\nseal-useconfiglintdisable\n```\n\n## Official Linters\n\n| Linter Name | Scope & Purpose | Aliases |\n| :--- | :--- | :--- |\n| `builtin` | Seal 官方标准校验器:拦截过短描述、主观模糊词与悬空例外条款。 | `default`, `official/builtin` |\n| `strict` | Seal 官方严格风控校验器:强校验字数、刚性定量约束、凭证依据与具体审批人角色。 | `official/strict` |\n| `hlab` | 合思实验室 (HLab) 结构化规则校验器:SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判。 | `hlab-sop`, `hlab-rules`, `hlab-standard`, `official/hlab` |\n\n```bash\n#Inspectavailablelinters\nseal-useruleslinters\n\n#LintrulesusingHLabSOPstandard\nseal-useruleslint--linterhlab--corp<corpId>\n\n#LintlocalruleworkspaceofflinewithHLabstandard\nseal-useruleslint--linterhlab--file./rules.local.json\n```\n\n## Built-In Detection Rules (`builtin`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `TOO_SHORT` | `error` | Rule description is under 5 characters. | Add concrete conditions and criteria. |\n| `VAGUE_WORD` | `error` | Contains subjective/fuzziness words (`原则上`, `尽量`, `适当`, `酌情`, `一般情况下`, `合理控制`). | Replace with rigid thresholds, enums, or criteria. |\n| `HANGING_EXCEPTION` | `warning` | Exception trigger found (`除非`, `特殊情况`, `经批准`) without verifiable evidence keyword (`备注`, `附件`, `证明`, `邮件`, `截图`). | Specify exact evidence source in invoice/document. |\n\n## HLab SOP Detection Rules (`hlab`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `MISSING_CHECK_METHOD` | `error` | Missing `**检查方法**` section in rule description. | Add `**检查方法**:` specifying fields, vouchers, and normalization logic. |\n| `MISSING_EVAL_STANDARD` | `error` | Missing `**判定标准**` section in rule description. | Add `**判定标准**:` with standard branches. |\n| `INCOMPLETE_TERNARY_BRANCH` | `error` | Incomplete ternary branch under evaluation criteria (missing `PASS`, `FAIL`, or `证据不足`). | Provide complete ternary closure: `-PASS:`, `-FAIL:`, `-证据不足:`. |\n| `INSUFFICIENT_WITHOUT_MANUAL_REVIEW` | `warning` | `证据不足` branch does not specify escalating to `人工复核`. | Add `转人工复核` at the end of `证据不足` branch. |\n| `DISPOSAL_ACTION_LEAK` | `warning` | Contains whole-bill workflow disposal actions (`驳回单据`, `直接驳回`, `进行提醒`, `退回单据`). | Decouple disposal actions from rule text; rely on rule strictness or platform workflow. |\n| `SCOPE_FALSE_SKIP_PRONE` | `warning` | Scope contains material upload conditions (`若上传了`, `若提供了`, `附件需上传`). | Keep scope pure to business triggers; handle missing materials explicitly in FAIL branch to prevent silent SKIP. |\n| `RISK_SUPPRESSION` | `erroLine truncated
`;var dh0=()=>{};var oh0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled:false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-usedoctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-useconfiglintenable`) when disabled.\n- **Explicit Triggering**: `seal-useruleslint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-useconfiglintenable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-useruleslint--corp<corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n#Lintrulesinpublishedversion16\nseal-useruleslint--version16--corp<corpId>\n\n#Lintaspecificrulebycode(#0038)\nseal-useruleslint--code'#0038'--corp<corpId>\n\n#Summarymode(onlyshowruleswithissues)\nseal-useruleslint--summary--corp<corpId>\n```\n\n### 3. Quality Gate for CI / Release\n\n```bash\n#Ifoverallscoreisbelow85,terminateswithexitcode1\nseal-useruleslint--min-score85--levelerror--corp<corpId>\n```\n\n### 4. Configure Global Linter Settings\n\n```bash\n#Checkstatus\nseal-useconfiglintstatus\n\n#Enableautolintonruleupdates\nseal-useconfiglintenable--linterbuiltin--min-score80\n\n#Disableautolint\nseal-useconfiglintdisable\n```\n\n## Official Linters\n\n| Linter Name | Scope & Purpose | Aliases |\n| :--- | :--- | :--- |\n| `builtin` | Seal 官方标准校验器:拦截过短描述、主观模糊词与悬空例外条款。 | `default`, `official/builtin` |\n| `strict` | Seal 官方严格风控校验器:强校验字数、刚性定量约束、凭证依据与具体审批人角色。 | `official/strict` |\n| `hlab` | 合思实验室 (HLab) 结构化规则校验器:SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判。 | `hlab-sop`, `hlab-rules`, `hlab-standard`, `official/hlab` |\n\n```bash\n#Inspectavailablelinters\nseal-useruleslinters\n\n#LintrulesusingHLabSOPstandard\nseal-useruleslint--linterhlab--corp<corpId>\n\n#LintlocalruleworkspaceofflinewithHLabstandard\nseal-useruleslint--linterhlab--file./rules.local.json\n```\n\n## Built-In Detection Rules (`builtin`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `TOO_SHORT` | `error` | Rule description is under 5 characters. | Add concrete conditions and criteria. |\n| `VAGUE_WORD` | `error` | Contains subjective/fuzziness words (`原则上`, `尽量`, `适当`, `酌情`, `一般情况下`, `合理控制`). | Replace with rigid thresholds, enums, or criteria. |\n| `HANGING_EXCEPTION` | `warning` | Exception trigger found (`除非`, `特殊情况`, `经批准`) without verifiable evidence keyword (`备注`, `附件`, `证明`, `邮件`, `截图`). | Specify exact evidence source in invoice/document. |\n\n## HLab SOP Detection Rules (`hlab`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `MISSING_CHECK_METHOD` | `error` | Missing `**检查方法**` section in rule description. | Add `**检查方法**:` specifying fields, vouchers, and normalization logic. |\n| `MISSING_EVAL_STANDARD` | `error` | Missing `**判定标准**` section in rule description. | Add `**判定标准**:` with standard branches. |\n| `INCOMPLETE_TERNARY_BRANCH` | `error` | Incomplete ternary branch under evaluation criteria (missing `PASS`, `FAIL`, or `证据不足`). | Provide complete ternary closure: `-PASS:`, `-FAIL:`, `-证据不足:`. |\n| `INSUFFICIENT_WITHOUT_MANUAL_REVIEW` | `warning` | `证据不足` branch does not specify escalating to `人工复核`. | Add `转人工复核` at the end of `证据不足` branch. |\n| `DISPOSAL_ACTION_LEAK` | `warning` | Contains whole-bill workflow disposal actions (`驳回单据`, `直接驳回`, `进行提醒`, `退回单据`). | Decouple disposal actions from rule text; rely on rule strictness or platform workflow. |\n| `SCOPE_FALSE_SKIP_PRONE` | `warning` | Scope contains material upload conditions (`若上传了`, `若提供了`, `附件需上传`). | Keep scope pure to business triggers; handle missing materials explicitly in FAIL branch to prevent silent SKIP. |\n| `RISK_SUPPRESSION` | `erroLine truncated
description:"v0.10.31: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.35: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
`;var rh0=()=>{};var Vg1="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:z,configured:!0,configPath:Y,targetDir:U,action:"prepended"}}function rl($){let U=$?.targetSkillsDir??$S0(),Y=$?.configFile??US0(),z=YS0(),Q=!1;if(Tq(Y))try{let J=JSON.parse(eh0(Y,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((I)=>I?.path===U)}catch{}return{detected:z,configured:Q,configPath:Y,targetDir:U}}var sl=()=>{};import{cpSync as Ag1,existsSync as kK,lstatSync as QS0,mkdirSync as Pg1,realpathSync as a2,rmSync as Bg1,symlinkSync as Tg1,unlinkSync as zS0}from"node:fs";import{homedir as JS0}from"node:os";import{dirname as IS0,join as t2}from"node:path";function jg1($,U){let Y=U?.baseHomeDir??JS0(),z=t2(Y,$.rootDirName),Q=U?.sourceSkillDir??t2(Y,".agents","skills","seal-use"),J=IS0(Q),I=t2(z,"skills"),K=t2(I,"seal-use");if(!kK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(kK(I)&&kK(J))try{if(a2(I)===a2(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}Pg1(I,{recursive:!0});let G;try{G=QS0(K)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(a2(K)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:K}}catch{}try{zS0(K)}catch{}}else if(G.isDirectory())Bg1(K,{recursive:!0,force:!0}),H=!0;else zS0(K);let W=process.platform==="win32"?"junction":"dir";try{return Tg1(Q,K,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:K}}catch{try{return Ag1(Q,K,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:K}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:K,error:X?.message||String(X)}}}}function Eg1($,U){let Y=U?.baseHomeDir??JS0(),z=t2(Y,$.rootDirName),Q=U?.sourceSkillDir??t2(Y,".agents","skills","seal-use"),J=IS0(Q),I=t2(z,"skills"),K=t2(I,"seal-use");if(!kK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(kK(I)&&kK(J))try{if(a2(I)===a2(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}let G;try{G=QS0(K)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(a2(K)===a2(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:K}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:K}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:K}}function al($){return KS0.map((U)=>jg1(U,$))}function tl($){return KS0.map((U)=>Eg1(U,$))}var KS0;var el=o(()=>{KS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var $o=o(()=>{sl();el();sl();el()});import{existsSync as Cg1,mkdirSync as Uo,readFileSync as Rg1,rmSync as _g1,writeFileSync as GS0}from"node:fs";import{homedir as WS0}from"node:os";import{dirname as HS0,join as Eq}from"node:path";function Yo(){return XS0["SKILL.md"]||""}function ZS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function qS0($=Eq(gz(),"SKILL.md")){try{return ZS0(Rg1($,"utf8"))}catch{return}}function gz(){return Eq(WS0(),".agents","skills","seal-use")}function hg1(){return Eq(WS0(),".agents","skills","seal-home")}function Sg1(){let $=hg1();if(Cg1($))try{return _g1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function VS0($=gz()){Sg1(),Uo($,{recursive:!0});let U=[];for(let[Y,z]of Object.entries(XS0)){let Q=Eq($,Y);Uo(HS0(Q),{recursive:!0}),GS0(Q,z,"utf8"),U.push(Y)}for(let[Y,z]of Object.entries(vg1)){let Q=Eq($,Y);Uo(HS0(Q),{recursive:!0}),GS0(Q,z),U.push(Y)}return{targetDir:$,files:U}}var XS0,vg1,A24;var Cq=o(()=>{dl();dl();$o();XS0=ah0,vg1=Object.fromEntries(Object.entries(th0).map(([$,U])=>[$,Buffer.from(U,"base64")]));A24=ZS0(Yo())});function LS0(){return`#SealUse系统架构与运行规范白皮书
`;var ah0=()=>{};var Ag1="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:U,configured:!0,configPath:z,targetDir:Y,action:"prepended"}}function Jo($){let Y=$?.targetSkillsDir??zS0(),z=$?.configFile??US0(),U=QS0(),Q=!1;if(jq(z))try{let J=JSON.parse(YS0(z,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((K)=>K?.path===Y)}catch{}return{detected:U,configured:Q,configPath:z,targetDir:Y}}var Ko=()=>{};import{cpSync as _g1,existsSync as bI,lstatSync as KS0,mkdirSync as vg1,realpathSync as $Y,rmSync as hg1,symlinkSync as Sg1,unlinkSync as JS0}from"node:fs";import{homedir as IS0}from"node:os";import{dirname as GS0,join as YY}from"node:path";function gg1($,Y){let z=Y?.baseHomeDir??IS0(),U=YY(z,$.rootDirName),Q=Y?.sourceSkillDir??YY(z,".agents","skills","seal-use"),J=GS0(Q),K=YY(U,"skills"),I=YY(K,"seal-use");if(!bI(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(bI(K)&&bI(J))try{if($Y(K)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}vg1(K,{recursive:!0});let G;try{G=KS0(I)}catch{G=void 0}let W=!1;if(G)if(G.isSymbolicLink()){try{if($Y(I)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:I}}catch{}try{JS0(I)}catch{}}else if(G.isDirectory())hg1(I,{recursive:!0,force:!0}),W=!0;else JS0(I);let H=process.platform==="win32"?"junction":"dir";try{return Sg1(Q,I,H),{id:$.id,name:$.name,detected:!0,configured:!0,mode:W?"replaced_real_dir":"linked",targetPath:I}}catch{try{return _g1(Q,I,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:I}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:I,error:X?.message||String(X)}}}}function yg1($,Y){let z=Y?.baseHomeDir??IS0(),U=YY(z,$.rootDirName),Q=Y?.sourceSkillDir??YY(z,".agents","skills","seal-use"),J=GS0(Q),K=YY(U,"skills"),I=YY(K,"seal-use");if(!bI(U))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(bI(K)&&bI(J))try{if($Y(K)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}let G;try{G=KS0(I)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if($Y(I)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:I}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:I}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:I}}function Io($){return WS0.map((Y)=>gg1(Y,$))}function Go($){return WS0.map((Y)=>yg1(Y,$))}var WS0;var Wo=o(()=>{WS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Ho=o(()=>{Ko();Wo();Ko();Wo()});import{existsSync as kg1,mkdirSync as Xo,readFileSync as xg1,rmSync as fg1,writeFileSync as HS0}from"node:fs";import{homedir as ZS0}from"node:os";import{dirname as XS0,join as Cq}from"node:path";function Zo(){return qS0["SKILL.md"]||""}function VS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function LS0($=Cq(fU(),"SKILL.md")){try{return VS0(xg1($,"utf8"))}catch{return}}function fU(){return Cq(ZS0(),".agents","skills","seal-use")}function bg1(){return Cq(ZS0(),".agents","skills","seal-home")}function ig1(){let $=bg1();if(kg1($))try{return fg1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function FS0($=fU()){ig1(),Xo($,{recursive:!0});let Y=[];for(let[z,U]of Object.entries(qS0)){let Q=Cq($,z);Xo(XS0(Q),{recursive:!0}),HS0(Q,U,"utf8"),Y.push(z)}for(let[z,U]of Object.entries(ug1)){let Q=Cq($,z);Xo(XS0(Q),{recursive:!0}),HS0(Q,U),Y.push(z)}return{targetDir:$,files:Y}}var qS0,ug1,b24;var Rq=o(()=>{Yo();Yo();Ho();qS0=eh0,ug1=Object.fromEntries(Object.entries($S0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));b24=VS0(Zo())});function wS0(){return`#SealUse系统架构与运行规范白皮书
`)}var AS0=o(()=>{X6()});async function PS0($,U,Y){let z=($??U??"").toLowerCase();if(z==="guide"||z==="doc"||z==="knowledge"||z==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(LS0());return}if(z==="paths"||z==="dirs"||z==="directories"){let I=Ko();c0(I.directories);return}if(z==="tenant"||z==="corp"||z==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (o4(),F_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),R00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),G_0)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (AS0(),DS0)),X=G(Y.options.corp)??(U&&U!==z?U:void 0)??(Y.command[2]&&Y.command[2]!==z?Y.command[2]:void 0),Z=I(X),q=await K(Z),V=await H(q,Z);if(!(V0(Y.options.quiet)||V0(Y.options.silent)))console.error(W(V));c0(V);return}let Q=Ko();if(!(V0(Y.options.quiet)||V0(Y.options.silent)))console.error(MS0(Q));c0(Q)}var BS0=o(()=>{NS0();Io();D4();J4()});var jS0;var TS0=o(()=>{jS0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.31",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-usehttp`, or the `seal-useservicestart` 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"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-usehttp`, or the `seal-useservicestart` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local
Line truncated
`)}var PS0=o(()=>{A6()});async function TS0($,Y,z){let U=($??Y??"").toLowerCase();if(U==="guide"||U==="doc"||U==="knowledge"||U==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(wS0());return}if(U==="paths"||U==="dirs"||U==="directories"){let K=wo();f0(K.directories);return}if(U==="auth"){let{selectCorp:K}=await Promise.resolve().then(() => (f4(),hl)),{stringOption:I}=await Promise.resolve().then(() => (D4(),Rl)),{handleAuthCommand:G}=await Promise.resolve().then(() => ($o(),Hh0)),W=I(z.options.corp)??(Y&&Y!==U?Y:void 0)??(z.command[2]&&z.command[2]!==U?z.command[2]:void 0),H=K(W);await G("check",H,z);return}if(U==="tenant"||U==="corp"||U==="enterprise"){let{selectCorp:K}=await Promise.resolve().then(() => (f4(),hl)),{createSealClient:I}=await Promise.resolve().then(() => (Q$(),f00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),Rl)),{diagnoseTenantContract:W,formatTenantDoctorDashboard:H}=await Promise.resolve().then(() => (PS0(),BS0)),X=G(z.options.corp)??(Y&&Y!==U?Y:void 0)??(z.command[2]&&z.command[2]!==U?z.command[2]:void 0),Z=K(X),q=await I(Z),V=await W(q,Z);if(!(Z0(z.options.quiet)||Z0(z.options.silent)))console.error(H(V));f0(V);return}let Q=wo();if(!(Z0(z.options.quiet)||Z0(z.options.silent)))console.error(DS0(Q));f0(Q)}var jS0=o(()=>{AS0();Fo();D4();I4()});var CS0;var ES0=o(()=>{CS0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.35",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-usehttp`, or the `seal-useservicestart` 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"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-usehttp`, or the `seal-useservicestart` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is sta
Line truncated
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","direct","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"},t
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","direct","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"},t
Line truncated
`);Q(z)})})}var gT=8787,yT="127.0.0.1";var Wo=o(()=>{vS0();t9()});async function hS0($){let U=s0($.options.port)??s0($.options.p),Y=S($.options.host)??S($.options.h),z=await kT({port:U,host:Y}),Q=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var SS0=o(()=>{D4();Wo()});async function gS0($,U,Y,z){if($==="config"||$==="get"){await k0("seal_llm_config_get",U,Y,{},C0(z.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",U,Y,{},C0(z.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var yS0=o(()=>{o4();J4()});async function kS0($,U){if($==="config"||$==="json"){Xo();return}let{startServer:Y}=await uS0().then(() => fS0);Y()}function Xo(){c0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var xS0=o(()=>{J4()});function bS0($){let U=vT();c0(U,{...C0($.options),allowFull:!0})}var iS0=o(()=>{Go();J4()});async function cS0($,U,Y,z){if($==="available"){await k0("seal_permissions_available_list",U,Y,{},C0(z.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",U,Y,{},C0(z.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var nS0=o(()=>{o4();J4()});import{readFileSync as pS0}from"node:fs";async function dS0($,U,Y,z,Q,J,I){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},C0(I.options));return}if($==="decision"){if(U==="update"||!U){let K=S(I.options.input),G=K?JSON.parse(pS0(K,"utf8")):y8(I.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",Q,J,{...G,dryRun:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(U==="set"){let K=S(I.options.default)??S(I.options.level)??z;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:K,dryRun:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}if(U==="policies"){if(Y==="list"||!Y){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},C0(I.options));return}if(Y==="upsert"){let K=S(I.options.input),G=K?JSON.parse(pS0(K,"utf8")):y8(I.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}if(Y==="remove"||Y==="delete"){let K=z??S(I.options.id)??S(I.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:K,dryRun:V0(I.options.dryRun)??V0(I.options["dry-run"])},C0(I.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var mS0=o(()=>{o4();D4();J4()});async function lS0($={}){let U=s8(),Y=_4(),z=f2(U,{stateful:Y.stateful,defaultCorpId:Y.defaultCorpId,corpId:$.corpId},h3());console.log(`[probe]corp=${z.id}source=${z.source.type}`);let Q=await yK(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await j1(z),I=await OO(J,{documentLimit:20,stylePreferencesEndpoint:z.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:I.rules.rules.length,hasPendingRuleDeletes:I.rules.hasPendingDeletes,documents:I.documents.articles.length,documentsTotal:I.documents.total,stylePreferences:I.stylePreferences.ok?"ok":`error:${I.stylePreferences.error}`},null,2))}var oS0=o(()=>{S3();i8();ET();X6()});async function rS0($,U,Y){let z=U??S(Y.options.corp)??($&&$!=="--corp"?$:void 0);await lS0({corpId:z})}var sS0=o(()=>{oS0();D4()});async function Zo($,U,Y,z,Q){if($==="count"){await k0("seal_approval_rules_list",Y,z,{countOnly:!0},C0(Q.options));return}if($==="list"){if(V0(Q.options.count)){await k0("seal_approval_rules_list",Y,z,{countOnly:!0},C0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(V0(Q.options.summary)){await k0("seal_approval_rules_list",Y,z,{fields:q_0,limit:J,offset:I},C0(Q.options));return}let K=await o2("seal_approval_rules_list",Y,z,{limit:J,offset:I});V_0(K,V0(Q.options.full)===!0),c0(K);return}if($==="clear"){let J=V0(Q.options.yes)===!0,I=V0(Q.options.dryRun)??V0(Q.options["dry-run"])??!J;if(!J&&!I)throw D9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${z.id}--dry-run`);let K=await o2("seal_approval_rules_clear",Y,z,{dryRun:I,recode:V0(Q.options.recode)});if(!J&&I&&K&&typeof K==="object"){c0({...K,
Line truncated
`).filter(Boolean),J=Q.slice(-U);return{logFile:Y,lines:J,totalLines:Q.length}}async function sg1($){let U=bT($),Y=Lo($),z=vq($);Ug0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):gT),J=$.host??(process.env.HOST?process.env.HOST:yT);fT(U,`${process.pid}
`,{mode:384}),fT(Y,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),xK(z,`servicestartingonhttp://${J}:${Q} pid=${process.pid}`);let I=null;try{I=await kT({port:Q,host:J,silent:!0}),xK(z,`service listening pid=${process.pid}`)}catch(G){if(xK(z,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),uT(U)===process.pid)v9(U,{force:!0}),v9(Y,{force:!0});throw G}let K=()=>{if(I)I.close(),I=null;if(uT(U)===process.pid)v9(U,{force:!0}),v9(Y,{force:!0});xK(z,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,K(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function tS0($){Ug0($.stateDir);let U=fK($);if(U.running)return U;let Y=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...Y.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let Q=mg1(Y.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=bT($);return fT(J,`${Q.pid}
`,{flag:"a",mode:384})}var Fo=o(()=>{Wo()});import{homedir as tg1}from"node:os";import{join as eg1}from"node:path";async function Oo($,U,Y){let z=Y?s0(Y.options.port)??s0(Y.options.p):void 0,Q=Y?S(Y.options.host)??S(Y.options.h):void 0,J=Y?s0(Y.options.lines)??s0(Y.options.n):void 0,I=await yz($,{appRoot:U.appRoot,entryFile:U.entryFile,stateDir:wo,version:P1,launcher:U.launcher,port:z,host:Q},{maxLines:J});if(I!==void 0)c0(I)}var wo;var Mo=o(()=>{t9();Fo();J4();D4();wo=eg1(tg1(),".config","seal-use")});import{existsSync as $y1,readFileSync as Yg0}from"node:fs";async function zg0($,U,Y,z,Q){if($==="batch-records"||$==="records"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",Y,z,{batchId:J,query:S(Q.options.query)},C0(Q.options));return}if($==="create"||$==="run"){let J=S(Q.options.mode)??S(Q.options.sourceSystem)??S(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=S(Q.options.schemaConfig)??S(Q.options["schema-config"]),G=K?JSON.parse(Yg0(K,"utf8")):void 0,H=S(Q.options.input),W=H?JSON.parse(Yg0(H,"utf8")):y8(Q.json),X=S(Q.options.packageId)??S(Q.options["package-id"]),Z=u6(Q.options.packageIds)??u6(Q.options["package-ids"])??(X?[X]:void 0),q=u6(Q.options.flowIds)??u6(Q.options["flow-ids"])??u6(Q.options.documentSn)??u6(Q.options["document-sn"]),V=S(Q.options.signKey)??S(Q.options["sign-key"])??S(Q.options.integration),F=V0(Q.options.noWait)??V0(Q.options["no-wait"]);await k0("seal_simulation_batch_create",Y,z,{mode:I,sourceSystem:I,flowIds:q,documentSn:q,rejectNodeName:S(Q.options.rejectNode)??S(Q.options["reject-node"])??null,thinkingDepthOverride:S(Q.options.thinkingDepth)??S(Q.options["thinking-depth"]),skipInvoiceGeneration:V0(Q.options.skipInvoiceGeneration)??V0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:V0(Q.options.skipExpenseExtraction)??V0(Q.options["skip-expense-extraction"]),disableAttachmentCache:V0(Q.options.disableAttachmentCache)??V0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:S(Q.options.templateId)??S(Q.options["template-id"]),schemaConfig:G,requestIds:u6(Q.options.requestIds)??u6(Q.options["request-ids"]),workflowTypeId:S(Q.options.workflowTypeId)??S(Q.options["workflow-type-id"]),flowStatusList:u6(Q.options.flowStatusList)?.map(Number)??u6(Q.options["flow-status-list"])?.map(Number),businessCodes:u6(Q.options.businessCodes)??u6(Q.options["business-codes"]),documentType:S(Q.options.documentType)??S(Q.options["document-type"]),startTime:s0(Q.options.startTime)??s0(Q.options["start-time"]),endTime:s0(Q.options.endTime)??s0(Q.options["end-time"]),status:u6(Q.options.status),limit:s0(Q.options.limit),noWait:F,rawParams:W},C0(Q.options));return}if($==="wait"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",Y,z,{batchId:J,timeout:S(Q.options.timeout),pollInterval:S(Q.options.pollInterval)??S(Q.options["poll-interval"])},C0(Q.options));return}if($==="status"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",Y,z,{batchId:J},C0(Q.options));return}if($==="clean"||$==="delete"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",Y,z,{batchId:J},C0(Q.options));return}if($==="specifications"){let J=U??S(Q.options.integration)??S(Q.options.signKey)??S(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",Y,z,{signKey:J},C0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",Y,z,{},C0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",Y,z,{limit:s0(Q.options.limit)},C0(Q.options));return}if($==="get"){let J=U??S(Q.options.batchId)??S(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",Y,z,{batchId:J},C0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",Y,z,{},C0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",Y,z,{},C0(Q.options));return}if($==="package-upload"){let J=U??S(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!$y1(J))throw Error(`Filenotfound:${J}`);await k0("seal_simulation_material_package_upload",Y,z,{filePath:J},C0(Q.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Qg0=o(()=>{o4();D4();J4()});import{existsSync as Jg0}from"node:fs";import{join as iT}from"node:path";function Ig0($,U,Y){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${YoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let z=V0(Y.options.local)||V0(Y.options.workspace),Q=S(Y.options.dir)??S(Y.options.target)??U,J=Q?Q:z?iT(process.cwd(),".agents","skills","seal-use"):gz(),I=VS0(J),K=!z&&!Q,G=K?ol():void 0,H=K?al():void 0;c0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let z=gz(),Q=iT(process.cwd(),".agents","skills","seal-use"),J=rl(),I=tl();c0({global:{dir:z,installed:Jg0(iT(z,"SKILL.md"))},local:{dir:Q,installed:Jg0(iT(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Kg0=o(()=>{$o();Cq();D4();J4()});async function Gg0($,U){if($==="config"){c0(await yK(U));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Hg0=o(()=>{ET();J4()});function No($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let U=$.toUpperCase().trim();if(U==="APPROVE"||U==="PASS")return"APPROVE";if(U==="REJECT"||U==="DENIED")return"REJECT";if(U==="MANUAL"||U==="ASSISTED")return"MANUAL";if(U==="ERROR"||U==="FAILED")return"ERROR";return U}async function Wg0($){let{sourceCorp:U,targetCorp:Y,sourceClient:z,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(Y.environment!=="test")throw new w4(`重放目标企业「${Y.name}」(${Y.id})的环境为「${Y.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${U.id}<testCorpId>`);let X=await cU(Q),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,O=J*F;if(V<O)throw new w4(`测试企业「${Y.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${J}笔需要约${O}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${Y.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await b4(z,{limit:J,status:"completed"}),M=Array.isArray(w.records)?w.records:[];if(M.length===0){let d=await b4(z,{limit:J});M=Array.isArray(d.records)?d.records:[]}if(M.length===0)throw new w4(`在母企业「${U.name}」(${U.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(M=M.slice(0,J),I){let d=M.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=No(g),e=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:e,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:U.id,name:U.name,environment:U.environment??"production"},targetCorp:{id:Y.id,name:Y.name,environment:Y.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:O},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let N=await Ip(Q,Y),D=[];for(let d of M){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=No(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await H4(z,d.id),y=`${H}${$0}`,s=Qp(e,{snPrefix:H,docIdPrefix:H});await Jp(N.incomingDocumentWebhook.url,N.secret,s,W,A6(Y.seal));let U0=null,O0=Date.now();while(Date.now()-O0<G){await new Promise((W0)=>setTimeout(W0,K));let a=await b4(Q,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let W0=a.records[0];if(W0.status==="completed"||W0.status==="failed"){U0=W0;break}}}if(!U0){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-t});continue}let E0=No(U0?.result?.decision??U0.aiDecision??U0?.decision??(U0.status==="completed"?"APPROVE":"ERROR")),G0=U0?.result?.summary??U0.aiSummary,T0=g===E0,b0=T0?"MATCHED":"FLIPPED",U1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:U0.id,testDecision:E0,testSummary:G0,status:b0,durationMs:Date.now()-t};if(!T0)U1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产:${p.slice(0,60)}...->测试:${G0.slice(0,60)}...`:void 0};D.push(U1)}catch(e){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:e instanceof Error?e.message:String(e),durationMs:Date.now()-t})}}let B=D.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=D.filter((d)=>d.status==="MATCHED"),A=D.filter((d)=>d.status==="FLIPPED"),j=D.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,x=C+b,h=x>0?C/x:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",z0=!i&&j===0,k;try{let d=await cU(Q),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!i&&j===0,verdict:c,safeToPublish:z0,timestamp:new Date().toISOString(),sourceCorp:{id:U.id,name:U.name,environment:U.environment??"production"},targetCorp:{id:Y.id,name:Y.name,environment:Y.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:O,balanceAfter:k},metrics:{sampleCount:D.length,successCount:B.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(h.toFixed(4))},flips:A,records:D}}function Xg0($){let{sourceCorp:U,targetCorp:Y,verdict:z,safeToPublish:Q,metrics:J,quota:I,flips:K,records:G}=$,H=z==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":z==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${U.name}」->测试靶场「${Y.name}」`,`判定:${H}·准许发布:${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),`样本总数:${J.sampleCount}|一致通过:${J.matchCount}|决策翻转:${J.flipCount}|异常失败:${J.failureCount}`,`一致率:${(J.concordanceRate*100).toFixed(1)}%|消耗预估:${I.estimatedRequired}点(余量:${I.balanceBefore}${I.balanceAfter!==void0?` -> ${I.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){W.push(`⚠️决策翻转清单(${K.length}笔单据在新规则下结果改变):`);for(let X of K)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(z==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% 吻合,无任
Line truncated
`)}var Zg0=o(()=>{L$();X6();SZ()});async function Do($,U,Y){let z=($??U??"regression").toLowerCase();if(z==="regression"||z==="regress"||z==="matrix"){let Q=S(Y.options.corp)??(U&&U!==z?U:void 0),J=E1(Q),I=J,K=J;if(J.environment==="test"){K=J;let M=S(Y.options["prod-corp"])??S(Y.options.prod)??J.prodCorpId;if(!M)throw new w4(`测试企业「${J.name}」(${J.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${J.id}`);I=E1(M)}else{I=J;let M=S(Y.options["test-corp"])??S(Y.options.test)??J.testCorpId;if(!M)throw new w4(`生产企业「${J.name}」(${J.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${J.id}<testCorpId>`);K=E1(M)}let G=await j1(I),H=await j1(K),W=s0(Y.options.samples)??s0(Y.options.limit)??s0(Y.options.n)??10,X=V0(Y.options["dry-run"]),Z=V0(Y.options["fail-on-flips"]),q=s0(Y.options["poll-interval"])??2000,V=s0(Y.options.timeout)??45000,F=S(Y.options["sn-prefix"])??"REG_",O=await Wg0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z});if(!(V0(Y.options.quiet)||V0(Y.options.silent)))console.error(Xg0(O));if(c0(O),Z&&!O.ok)throw new w4(`回归测试发现${O.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new w4(`未知的test子命令:"${z}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var qg0=o(()=>{L$();o4();D4();J4();i8();Zg0()});async function Vg0($,U,Y,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,U,Y,y8(z.json),C0(z.options))}var Lg0=o(()=>{o4();D4();J4()});function Fg0(){c0(Vq.map(($)=>({name:$.name,description:$.description})))}var wg0=o(()=>{Fq();J4()});function cT($=process.execPath,U=import.meta.url){if(U.includes("/$bunfs/")||U.includes("\\$bunfs\\"))return!0;let Y=$.toLowerCase().replace(/\\/g,"/");return!Y.endsWith("/bun")&&!Y.endsWith("/bun.exe")&&!Y.endsWith("/node")&&!Y.endsWith("/node.exe")}var Og0=o(()=>{Cq()});import{chmodSync as Uy1,mkdirSync as Yy1,readdirSync as zy1,renameSync as Ao,rmSync as Qy1,unlinkSync as Ag0,writeFileSync as Mg0}from"node:fs";import{basename as Jy1,dirname as Iy1,join as pT}from"node:path";import{spawnSync as uK}from"node:child_process";async function Bg0($,U={}){let Y={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:wo,version:P1,launcher:$.launcher},z=U.repo||process.env[Ky1]?.trim()||process.env[Gy1]?.trim()||Pg0,Q=U.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),B=Cg0(D,P1);if(B<0)if(!xS&&U.force);else{c0({updated:!1,currentVersion:P1,targetVersion:D,mode:cT()?"binary":"source",message:!xS?`Cannotdowngradeseal-usefromdevbuildv${P1}toreleasev${D}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${P1}toolderversionv${D}.Updatesmustbeforward-only.`});return}if(B===0&&!U.force){c0({updated:!1,currentVersion:P1,targetVersion:D,mode:cT()?"binary":"source",message:`seal-useisalreadyatversionv${P1}.Use--forcetoreinstall.`});return}}if(U.changelogOnly){let D=await Po(z,U.limit??10);c0({currentVersion:P1,totalQueried:D.length,releases:D.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===P1,isNewer:hq(B.version,P1)}))});return}if(!cT()){if(U.checkOnly){let B=await Po(z,30),T=B[0],A=T?.version??P1,j=B.find((x)=>x.version===P1),C=hq(A,P1),b=B.filter((x)=>hq(x.version,P1));c0({updated:!1,updateAvailable:C,currentVersion:P1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.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:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let D=fK(Y).running;if(D)await yz("stop",Y);try{Dg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(Dg0("bun",["install"],{cwd:$.appRoot}),D)await yz("start",Y);c0({updated:!0,serviceRestarted:D,version:P1,mode:"source"});return}let I=Wy1(),K=Xy1(),G=await Po(z,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await Ng0(z,J):G[0]??await Ng0(z);if(!H){c0({updated:!1,currentVersion:P1,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${z}'`});return}let W=H.version,X=G.find((D)=>D.version===P1),Z=hq(W,P1),q=Z||Boolean(U.force),V=G.filter((D)=>hq(D.version,P1));if(U.checkOnly){c0({updated:!1,updateAvailable:Z,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:V.length,pendingReleases:V.map((D)=>({version:D.version,tagName:D.tagName,publishedAt:D.publishedAt,author:D.author,releaseNotes:D.notes,releaseUrl:D.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!q){c0({updated:!1,currentVersion:P1,currentVersionPublishedAt:X?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${P1})`});return}let F=qy1(H.assets,I,K);if(!F)throw Error(`Nocompatiblebinaryfoundfor${I}-${K}inreleasev${W}.Availableassets:${H.assets.map((D)=>D.name).join(", ")}`);let O=fK(Y).running;if(O)await yz("stop",Y);let w=process.execPath,M=Iy1(w),N=pT(M,`.tmp-update-${Date.now()}`);Yy1(N,{recursive:!0});try{let D=pT(N,F.name);await Vy1(F.downloadUrl,D,H.tagName,F.name);let B=D;if(F.name.endsWith(".tar.gz")||F.name.endsWith(".tgz"))B=Ly1(D,N,I);else if(F.name.endsWith(".zip"))B=Fy1(D,N,I);if(Uy1(B,493),process.platform==="darwin")try{uK("/usr/bin/codesign",["--remove-signature",B],{stdio:"ignore"}),uK("/usr/bin/codesign",["--force","--sign","-",B],{stdio:"ignore"})}catch{}if(process.platform==="win32"){let A=`${w}.old.${Date.now()}`;try{Ao(w,A)}catch{}Ao(B,w)}else Ao(B,w);if(O)await yz("start",Y);let T=Hy1(w,W);c0({updated:!0,fromVersion:P1,toVersion:W,serviceRestarted:O,skillSynced:T.targetDir??!1,skillVersion:T.version??!1,mode:"binary"})}finally{try{Qy1(N,{recursive:!0,force:!0})}catch{}}}function
Line truncated
`)}catch{}}async function Vy1($,U,Y,z){let Q=Bo(),J=[],I=Y?Y.startsWith("v")?Y:`v${Y}`:void 0,K=z||$.split("/").pop()||"";if(Q!=="github"){if(I&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${I}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${I}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(I&&K){let F=`https://github.com/${Pg0}/releases/download/${I}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);J.push(F)}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 F=0;F<G.length;F++){let O=G[F],w=new AbortController,M="",N=(A)=>{M=A;try{w.abort()}catch{}},D=setTimeout(()=>{N("Connection timed out (no response headers within 6s)")},W),B,T;try{nT(`==> [${F+1}/${G.length}] Downloading via: ${O}`);let A=await fetch(O,{signal:w.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);B=setTimeout(()=>{N("Overall download time exceeded 3 minutes")},V);let j=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let c=Buffer.from(await A.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);Mg0(U,c),nT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],x=0,h=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);N(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),z0,k=new Promise((g,p)=>{z0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,k])}finally{if(z0)clearTimeout(z0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-h>200){h=g;let p=j?Math.round(x/j*100):0,e=(x/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${e} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
`);Q(U)})})}var xT=8787,fT="127.0.0.1";var No=o(()=>{SS0();e9()});async function gS0($){let Y=s0($.options.port)??s0($.options.p),z=h($.options.host)??h($.options.h),U=await uT({port:Y,host:z}),Q=()=>{U.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var yS0=o(()=>{D4();No()});async function kS0($,Y,z,U){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,z,{},C0(U.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,z,{},C0(U.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var xS0=o(()=>{f4();I4()});async function fS0($,Y){if($==="config"||$==="json"){Do();return}let{startServer:z}=await iS0().then(() => bS0);z()}function Do(){f0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var uS0=o(()=>{I4()});function cS0($){let Y=gT();f0(Y,{...C0($.options),allowFull:!0})}var nS0=o(()=>{Mo();I4()});async function pS0($,Y,z,U){if($==="available"){await k0("seal_permissions_available_list",Y,z,{},C0(U.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,z,{},C0(U.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var dS0=o(()=>{f4();I4()});import{readFileSync as mS0}from"node:fs";async function lS0($,Y,z,U,Q,J,K){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},C0(K.options));return}if($==="decision"){if(Y==="update"||!Y){let I=h(K.options.input),G=I?JSON.parse(mS0(I,"utf8")):y8(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",Q,J,{...G,dryRun:Z0(K.options.dryRun)??Z0(K.options["dry-run"])},C0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let I=h(K.options.default)??h(K.options.level)??U;if(I!=="medium"&&I!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:I,dryRun:Z0(K.options.dryRun)??Z0(K.options["dry-run"])},C0(K.options));return}if(Y==="policies"){if(z==="list"||!z){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},C0(K.options));return}if(z==="upsert"){let I=h(K.options.input),G=I?JSON.parse(mS0(I,"utf8")):y8(K.json);if(!G||!G.id||!G.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:Z0(K.options.dryRun)??Z0(K.options["dry-run"])},C0(K.options));return}if(z==="remove"||z==="delete"){let I=U??h(K.options.id)??h(K.options.policyId);if(!I)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:I,dryRun:Z0(K.options.dryRun)??Z0(K.options["dry-run"])},C0(K.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}var oS0=o(()=>{f4();D4();I4()});async function rS0($={}){let Y=r8(),z=_4(),U=c2(Y,{stateful:z.stateful,defaultCorpId:z.defaultCorpId,corpId:$.corpId},S3());console.log(`[probe]corp=${U.id}source=${U.source.type}`);let Q=await uI(U);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await P1(U),K=await NM(J,{documentLimit:20,stylePreferencesEndpoint:U.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 sS0=o(()=>{y3();Q$();RT();A6()});async function aS0($,Y,z){let U=Y??h(z.options.corp)??($&&$!=="--corp"?$:void 0);await rS0({corpId:U})}var tS0=o(()=>{sS0();D4()});async function Ao($,Y,z,U,Q){if($==="count"){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(Q.options));return}if($==="list"){if(Z0(Q.options.count)){await k0("seal_approval_rules_list",z,U,{countOnly:!0},C0(Q.options));return}let J=s0(Q.options.limit),K=s0(Q.options.offset);if(Z0(Q.options.summary)){await k0("seal_approval_rules_list",z,U,{fields:D_0,limit:J,offset:K},C0(Q.options));return}let I=await T5("seal_approval_rules_list",z,U,{limit:J,offset:K});A_0(I,Z0(Q.options.full)===!0),f0(I);return}if($==="clear"){let J=Z0(Q.options.yes)===!0,K=Z0(Q.options.dryRun)??Z0(Q.options["dry-run"])??!J;if(!J&&!K)throw A9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${U.id}--dry-run`);let I=await T5("seal_approval_rules_clear",z,U,{dryRun:K,recode:Z0(Q.options.recode)});if(!J&&K&&I&&typeof I==="object"){f0({...I,
Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:z,lines:J,totalLines:Q.length}}async function Qy1($){let Y=nT($),z=To($),U=hq($);Ug0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):xT),J=$.host??(process.env.HOST?process.env.HOST:fT);iT(Y,`${process.pid}
`,{mode:384}),iT(z,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),iI(U,`servicestartingonhttp://${J}:${Q} pid=${process.pid}`);let K=null;try{K=await uT({port:Q,host:J,silent:!0}),iI(U,`service listening pid=${process.pid}`)}catch(G){if(iI(U,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),cT(Y)===process.pid)h9(Y,{force:!0}),h9(z,{force:!0});throw G}let I=()=>{if(K)K.close(),K=null;if(cT(Y)===process.pid)h9(Y,{force:!0}),h9(z,{force:!0});iI(U,`stopped pid=${process.pid}`)};await new Promise((G)=>{let W=!1,H=()=>{if(W)return;W=!0,I(),process.off("SIGTERM",H),process.off("SIGINT",H),G()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function $g0($){Ug0($.stateDir);let Y=uU($);if(Y.running)return Y;let z=$.launcher??{command:process.execPath,args:[$.entryFile]},U=[...z.args??[],"service","run"];if($.port)U.push("--port",String($.port));if($.host)U.push("--host",String($.host));let Q=$y1(z.command,U,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=nT($);return iT(J,`${Q.pid}
`,{flag:"a",mode:384})}var jo=o(()=>{No()});import{homedir as Ky1}from"node:os";import{join as Iy1}from"node:path";async function Co($,Y,z){let U=z?s0(z.options.port)??s0(z.options.p):void 0,Q=z?h(z.options.host)??h(z.options.h):void 0,J=z?s0(z.options.lines)??s0(z.options.n):void 0,K=await o3($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Eo,version:Z1,launcher:Y.launcher,port:U,host:Q},{maxLines:J});if(K!==void 0)f0(K)}var Eo;var Ro=o(()=>{e9();jo();I4();D4();Eo=Iy1(Ky1(),".config","seal-use")});import{existsSync as Gy1,readFileSync as Qg0}from"node:fs";async function Jg0($,Y,z,U,Q){if($==="batch-records"||$==="records"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",z,U,{batchId:J,query:h(Q.options.query)},C0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",K=J==="material-pack"?"material_pack":J,I=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=I?JSON.parse(Qg0(I,"utf8")):void 0,W=h(Q.options.input),H=W?JSON.parse(Qg0(W,"utf8")):y8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=u6(Q.options.packageIds)??u6(Q.options["package-ids"])??(X?[X]:void 0),q=u6(Q.options.flowIds)??u6(Q.options["flow-ids"])??u6(Q.options.documentSn)??u6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),F=Z0(Q.options.noWait)??Z0(Q.options["no-wait"]);await k0("seal_simulation_batch_create",z,U,{mode:K,sourceSystem:K,flowIds:q,documentSn:q,rejectNodeName:h(Q.options.rejectNode)??h(Q.options["reject-node"])??null,thinkingDepthOverride:h(Q.options.thinkingDepth)??h(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:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:u6(Q.options.requestIds)??u6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:u6(Q.options.flowStatusList)?.map(Number)??u6(Q.options["flow-status-list"])?.map(Number),businessCodes:u6(Q.options.businessCodes)??u6(Q.options["business-codes"]),documentType:h(Q.options.documentType)??h(Q.options["document-type"]),startTime:s0(Q.options.startTime)??s0(Q.options["start-time"]),endTime:s0(Q.options.endTime)??s0(Q.options["end-time"]),status:u6(Q.options.status),limit:s0(Q.options.limit),noWait:F,rawParams:H},C0(Q.options));return}if($==="wait"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",z,U,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},C0(Q.options));return}if($==="status"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",z,U,{batchId:J},C0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",z,U,{batchId:J},C0(Q.options));return}if($==="specifications"){let J=Y??h(Q.options.integration)??h(Q.options.signKey)??h(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",z,U,{signKey:J},C0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",z,U,{},C0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",z,U,{limit:s0(Q.options.limit)},C0(Q.options));return}if($==="get"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",z,U,{batchId:J},C0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",z,U,{},C0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",z,U,{},C0(Q.options));return}if($==="package-upload"){let J=Y??h(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Gy1(J))throw Error(`Filenotfound:${J}`);await k0("seal_simulation_material_package_upload",z,U,{filePath:J},C0(Q.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Kg0=o(()=>{f4();D4();I4()});import{existsSync as Ig0}from"node:fs";import{join as pT}from"node:path";function Gg0($,Y,z){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${ZoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let U=Z0(z.options.local)||Z0(z.options.workspace),Q=h(z.options.dir)??h(z.options.target)??Y,J=Q?Q:U?pT(process.cwd(),".agents","skills","seal-use"):fU(),K=FS0(J),I=!U&&!Q,G=I?Qo():void 0,W=I?Io():void 0;f0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files,...G?{antigravity:G}:{},...W?{hosts:W}:{}});return}if($==="status"||$==="get"||!$){let U=fU(),Q=pT(process.cwd(),".agents","skills","seal-use"),J=Jo(),K=Go();f0({global:{dir:U,installed:Ig0(pT(U,"SKILL.md"))},local:{dir:Q,installed:Ig0(pT(Q,"SKILL.md"))},antigravity:J,hosts:K});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}var Wg0=o(()=>{Ho();Rq();D4();I4()});async function Hg0($,Y){if($==="config"){f0(await uI(Y));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}var Xg0=o(()=>{RT();I4()});function _o($){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 Zg0($){let{sourceCorp:Y,targetCorp:z,sourceClient:U,targetClient:Q,samples:J=10,dryRun:K=!1,pollIntervalMs:I=2000,timeoutMs:G=45000,snPrefix:W="REG_",fetchFn:H=fetch}=$;if(z.environment!=="test")throw new w4(`重放目标企业「${z.name}」(${z.id})的环境为「${z.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${Y.id}<testCorpId>`);let X=await mY(Q),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*F;if(V<M)throw new w4(`测试企业「${z.name}」AI审批额度不足:当前剩余${V}点,本次回归抽样${J}笔需要约${M}点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${z.id}」充值AI审批额度,或降低抽样笔数(--samples${Math.max(1,Math.floor(V/F))})`);let w=await i4(U,{limit:J,status:"completed"}),N=Array.isArray(w.records)?w.records:[];if(N.length===0){let d=await i4(U,{limit:J});N=Array.isArray(d.records)?d.records:[]}if(N.length===0)throw new w4(`在母企业「${Y.name}」(${Y.id})中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),K){let d=N.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=_o(g),e=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:e,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:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let O=await Xp(Q,z,$.webhookSelector),D=[];for(let d of N){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=_o(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await W4(U,d.id),y=`${W}${$0}`,s=Wp(e,{snPrefix:W,docIdPrefix:W});await Hp(O.incomingDocumentWebhook.url,O.secret,s,H,D6(z.seal));let Y0=null,N0=Date.now();while(Date.now()-N0<G){await new Promise((H0)=>setTimeout(H0,I));let a=await i4(Q,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let H0=a.records[0];if(H0.status==="completed"||H0.status==="failed"){Y0=H0;break}}}if(!Y0){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时(${Math.round(G/1000)}s未完成)`,durationMs:Date.now()-t});continue}let E0=_o(Y0?.result?.decision??Y0.aiDecision??Y0?.decision??(Y0.status==="completed"?"APPROVE":"ERROR")),G0=Y0?.result?.summary??Y0.aiSummary,T0=g===E0,i0=T0?"MATCHED":"FLIPPED",Y1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:Y0.id,testDecision:E0,testSummary:G0,status:i0,durationMs:Date.now()-t};if(!T0)Y1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产:${p.slice(0,60)}...->测试:${G0.slice(0,60)}...`:void 0};D.push(Y1)}catch(e){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:e instanceof Error?e.message:String(e),durationMs:Date.now()-t})}}let P=D.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=D.filter((d)=>d.status==="MATCHED"),A=D.filter((d)=>d.status==="FLIPPED"),j=D.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,x=C+b,S=x>0?C/x:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",U0=!i&&j===0,k;try{let d=await mY(Q),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!i&&j===0,verdict:c,safeToPublish:U0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:z.id,name:z.name,environment:z.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(S.toFixed(4))},flips:A,records:D}}function qg0($){let{sourceCorp:Y,targetCorp:z,verdict:U,safeToPublish:Q,metrics:J,quota:K,flips:I,records:G}=$,W=U==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":U==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",H=["",`\uD83E\uDDEA[SealUseTest]规则回归测试矩阵:生产「${Y.name}」->测试靶场「${z.name}」`,`判定:${W}·准许发布:${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(I.length>0){H.push(`⚠️决策翻转清单(${I.length}笔单据在新规则下结果改变):`);for(let X of I)if(H.push(`•单据[${X.sn}]:原生产判定「${X.prodDecision}」➔测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)H.push(`理由差异:${X.diff.reasonDiff}`);H.push(" "+"─".repeat(65)),H.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(U==="CLEAN")H.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100
Line truncated
`)}var Vg0=o(()=>{L$();A6();SZ()});async function vo($,Y,z){let U=($??Y??"regression").toLowerCase();if(U==="regression"||U==="regress"||U==="matrix"){let Q=h(z.options.corp)??(Y&&Y!==U?Y:void 0),J=j1(Q),K=J,I=J;if(J.environment==="test"){I=J;let O=h(z.options["prod-corp"])??h(z.options.prod)??J.prodCorpId;if(!O)throw new w4(`测试企业「${J.name}」(${J.id})未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-usecorpsbind-test<prodCorpId>${J.id}`);K=j1(O)}else{K=J;let O=h(z.options["test-corp"])??h(z.options.test)??J.testCorpId;if(!O)throw new w4(`生产企业「${J.name}」(${J.id})未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-usecorpsbind-test${J.id}<testCorpId>`);I=j1(O)}let G=await P1(K),W=await P1(I),H=s0(z.options.samples)??s0(z.options.limit)??s0(z.options.n)??10,X=Z0(z.options["dry-run"]),Z=Z0(z.options["fail-on-flips"]),q=s0(z.options["poll-interval"])??2000,V=s0(z.options.timeout)??45000,F=h(z.options["sn-prefix"])??"REG_",M=h(z.options.webhook)??h(z.options.selector),w=await Zg0({sourceCorp:K,targetCorp:I,sourceClient:G,targetClient:W,samples:H,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z,webhookSelector:M});if(!(Z0(z.options.quiet)||Z0(z.options.silent)))console.error(qg0(w));if(f0(w),Z&&!w.ok)throw new w4(`回归测试发现${w.metrics.flipCount}笔单据决策翻转,已按--fail-on-flips策略非零终止。`,1);return}throw new w4(`未知的test子命令:"${U}"。
可用子命令:seal-usetestregression[--corp<id>][--samples<N>][--dry-run]`,2,"seal-use test regression --help")}var Lg0=o(()=>{L$();f4();D4();I4();Q$();Vg0()});async function Fg0($,Y,z,U){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,z,y8(U.json),C0(U.options))}var wg0=o(()=>{f4();D4();I4()});function Mg0(){f0(Lq.map(($)=>({name:$.name,description:$.description})))}var Og0=o(()=>{wq();I4()});function dT($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let z=$.toLowerCase().replace(/\\/g,"/");return!z.endsWith("/bun")&&!z.endsWith("/bun.exe")&&!z.endsWith("/node")&&!z.endsWith("/node.exe")}var Ng0=o(()=>{Rq()});import{existsSync as Wy1,mkdirSync as Hy1,readFileSync as Xy1,renameSync as Zy1,writeFileSync as qy1}from"node:fs";import{homedir as Vy1}from"node:os";import{dirname as Ly1,join as Fy1}from"node:path";import{spawn as wy1}from"node:child_process";function Dg0(){let $=process.env[My1]?.trim();if($)return $;return Ny1}function Ag0($=Dg0()){if(!Wy1($))return null;try{let Y=Xy1($,"utf-8"),z=JSON.parse(Y);if(z&&typeof z==="object"&&typeof z.latestVersion==="string"&&typeof z.checkedAt==="string")return z;return null}catch{return null}}function Sq($,Y=Dg0()){try{let z=Ly1(Y);Hy1(z,{recursive:!0,mode:448});let U={checkedAt:$.checkedAt??new Date().toISOString(),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;qy1(Q,JSON.stringify(U,null,2),{mode:384}),Zy1(Q,Y)}catch{}}function Bg0($,Y=Oy1){if(!$||!$.checkedAt)return!0;let z=new Date($.checkedAt).getTime();if(Number.isNaN(z))return!0;return Date.now()-z>Y}function Pg0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,z=[...$.args??[],"update","check","--bg-save"];return wy1(Y,z,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var My1="SEAL_USE_UPDATE_CACHE_FILE",Oy1=86400000,Ny1;var ho=o(()=>{Ny1=Fy1(Vy1(),".config","seal-use","update-cache.json")});import{chmodSync as Dy1,mkdirSync as Ay1,readdirSync as By1,realpathSync as Tg0,renameSync as So,rmSync as Py1,unlinkSync as Cg0,writeFileSync as jg0}from"node:fs";import{basename as Ty1,dirname as jy1,isAbsolute as Ey1,join as oT,relative as Cy1}from"node:path";import{spawnSync as S9}from"node:child_process";async function _g0($,Y={}){let z={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Eo,version:Z1,launcher:$.launcher},U=Y.repo||process.env[Ry1]?.trim()||process.env[_y1]?.trim()||Rg0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=gg0(D,Z1);if(P<0)if(!cS&&Y.force);else{f0({updated:!1,currentVersion:Z1,targetVersion:D,mode:dT()?"binary":"source",message:!cS?`Cannotdowngradeseal-usefromdevbuildv${Z1}toreleasev${D}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${Z1}toolderversionv${D}.Updatesmustbeforward-only.`});return}if(P===0&&!Y.force){f0({updated:!1,currentVersion:Z1,targetVersion:D,mode:dT()?"binary":"source",message:`seal-useisalreadyatversionv${Z1}.Use--forcetoreinstall.`});return}}if(Y.changelogOnly){let D=await lT(U,Y.limit??10);f0({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:r3(P.version,Z1)}))});return}if(!dT()){if(Y.checkOnly){let P=await lT(U,30),T=P[0],A=T?.version??Z1,j=P.find((x)=>x.version===Z1),C=r3(A,Z1),b=P.filter((x)=>r3(x.version,Z1));if(T?.version)Sq({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;f0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.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=uU(z).running;if(D)await o3("stop",z);try{Eg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️开发版更新同步失败,继续刷新本地依赖:${PinstanceofError?P.message:String(P)}`)}if(Eg0("bun",["install"],{cwd:$.appRoot}),D)await o3("start",z);f0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(yy1())try{await ky1($,Y,z,U,J);return}catch(D){console.error(`⚠️Homebrew自动更新失败,回退至原生二进制更新:${DinstanceofError?D.message:String(D)}`)}let K=hy1(),I=Sy1(),G=await lT(U,30),W=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await rT(U,J):G[0]??await rT(U);if(!W){f0({updated:!1,
Line truncated
`)}catch{}}async function uy1($,Y,z,U){let Q=go(),J=[],K=z?z.startsWith("v")?z:`v${z}`:void 0,I=U||$.split("/").pop()||"";if(Q!=="github"){if(K&&I)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${I}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${I}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(K&&I){let F=`https://github.com/${Rg0}/releases/download/${K}/${I}`;if(!process.env.CI)J.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);J.push(F)}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)),W,H=6000,X=6000,Z=307200,q=1e4,V=180000;for(let F=0;F<G.length;F++){let M=G[F],w=new AbortController,N="",O=(A)=>{N=A;try{w.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},H),P,T;try{mT(`==> [${F+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:w.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 j=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let c=Buffer.from(await A.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);jg0(Y,c),mT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],x=0,S=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(),U0,k=new Promise((g,p)=>{U0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,k])}finally{if(U0)clearTimeout(U0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-S>200){S=g;let p=j?Math.round(x/j*100):0,e=(x/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${e} / ${y} 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"
},
"servers":[
@@ -2206,7 +2206,7 @@
],
"operationId":"getApprovalRunUrl",
"x-implementation-status":"implemented",
"summary":"Get enterprise assist URL and optional source document URL",
"summary":"Get Seal AI result URL and optional source document URL",
"parameters":[
{
"name":"corpId",
@@ -2240,22 +2240,28 @@
],
"responses":{
"200":{
"description":"Enterprise and document URLs.",
"description":"Seal AI result URL and source document URL.",
description:"v0.10.31: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description:"v0.10.35: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version:0.10.31
short-description:Seal tenant and Hose approval automation (v0.10.31)
version:0.10.35
short-description:Seal tenant and Hose approval automation (v0.10.35)
`seal-use service <start|stop|restart|status|logs>` manages the persistent background service daemon with embedded HTTP server (serving `/docs`, `/openapi.json`, and `POST /api/cli`). `status` returns the PID, version, host, port, active HTTP URL, state directory, PID file, and log file.
`seal-use update`updates the git checkout, runs `bun install`, and restarts the local service if it was running.
`seal-use update`checks and installs the latest official release, preserves the service state when needed, and refreshes the installed Agent Skill. The installation method is handled automatically and should not be exposed in user-facing explanations. `seal-use update --check` only reports available releases, and `seal-use update changelog` reads release history.
System diagnostic & embedded architecture specifications:
@@ -334,7 +336,7 @@ Add and verify a Hose enterprise:
```bash
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use auth diagnose --corp <corpId>
seal-use auth check --corp <corpId>
```
Force-write a Hose config without verification:
@@ -343,10 +345,10 @@ Force-write a Hose config without verification:
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId","force":true}'
```
Diagnose auth failures:
Check auth failures:
```bash
seal-use auth diagnose --corp <corpId>
seal-use auth check --corp <corpId>
```
The diagnostic stages are `hose.openapi`, `hose.provisional`, `seal.sso`, and `seal.whoami`. Tokens are omitted from output.
@@ -38,7 +38,7 @@ Classify both the enterprise identity origin and how the current credential was
| Enterprise identity origin | Credential material the user may have | 权限等级与时效 | Meaning |
| --- | --- | --- | --- |
| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and `corps sync-hosecloud`. |
| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | 【最高·永久】自动签名/续期 | Stable, refreshable standard integration; unlocks full OpenAPI and `deploy hosecloud sync`. |
| Hose/合思-sourced Seal tenant | Hose authorization/assistance link (`thirdparty.html`) | 【两极分化】普通导入→短效;提权→永久 | Temporary session that can be **elevated** to permanent `appKey`/`appSecurity` with `extract-keys --save` or `add-link --as-hose`. |
| Hose/合思-sourced Seal tenant | cURL copied from an authenticated **Hose admin** page | 【两极分化】普通导入→短效;提权→永久 | **Same session scope as an assistance link.** If the user is a Hose administrator, this carries the same web session credentials (`accesstoken`, `corpid`, cookies) and can equally invoke `/api/innerapi/v1/key` to extract permanent `appKey`/`appSecurity`. |
| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Seal page | 【短效会话快照】 | Snapshot with Seal Bearer token; can set up temporary Seal session access. |
@@ -73,7 +73,7 @@ seal-use corps add-hose --json '{"appKey":"...","appSecurity":"..."}'
The CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:
```bash
seal-use auth diagnose --corp <discovered-id>
seal-use auth check --corp <discovered-id>
```
Do not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.
@@ -85,7 +85,7 @@ First distinguish the link by its host, purpose, and identity origin:
- A **Hose/合思 authorization/assistance link** (`https://<domain>/web/thirdparty.html?...`) opens an upstream Hose session and may continue through Seal SSO. It is not a Seal delegation link.
- A **Seal-native assistance/delegation link** grants temporary delegated access on a Seal tenant. It is not a Hose credential and cannot be elevated to Hose OpenAPI credentials.
- **Hose Subdomain Boundary (合思子域专属提权)**: `seal-use` primarily manages Seal tenants. Tenants sourced from the Hose ecosystem have an upstream Hose enterprise backing them. A received Hose assistance link contains only a temporary session `accessToken`. If you run standard `corps add-link`, it exchanges that temporary token for a short-lived Seal Bearer token—sufficient for basic Seal inspection, but it will expire and cannot call any Hose OpenAPI.
- **Privilege Elevation (权限等级提升)**: To elevate from a short-lived session token to permanent, durable Hose OpenAPI developer credentials, use `corps extract-keys <url> --save` or `corps add-link <url> --as-hose`. This leverages Hose's internal key interface (`GET /api/innerapi/v1/key`) using the session token to retrieve the enterprise's OpenAPI `appKey` and `appSecurity`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (e.g. `corps sync-hosecloud`).
- **Privilege Elevation (权限等级提升)**: To elevate from a short-lived session token to permanent, durable Hose OpenAPI developer credentials, use `corps extract-keys <url> --save` or `corps add-link <url> --as-hose`. This leverages Hose's internal key interface (`GET /api/innerapi/v1/key`) using the session token to retrieve the enterprise's OpenAPI `appKey` and `appSecurity`. Once saved, the enterprise is upgraded to a standard Hose configuration with full OpenAPI support (for example, `deploy hosecloud sync`).
- **Multi-Key Disambiguation (多套密钥明确抉择)**: If the enterprise owns multiple application keys, the CLI **will not** guess or silently pick the first key. Instead, it terminates with an informative candidate list and requires the user to specify `--app-key <key>` or `--key-id <id>`. If only one key exists, it is selected automatically.
- **Non-Hose Tenants Blocked**: Calling `keys` on native Seal enterprises (`corp.source.type !== "hose"`) is strictly rejected with exit code 2, explaining that this capability belongs exclusively to the Hose ecosystem.
@@ -171,7 +171,7 @@ If the captured request contains only cookies or an authentication shape the CLI
Report the human enterprise name, identity provider, credential method, and whether verification succeeded. Do not expose internal IDs unless they help with troubleshooting. Do not perform approval, rule, document, simulation, publishing, or other business mutations just because onboarding succeeded; continue only with the user's requested task and its normal confirmation rules.
@@ -19,10 +19,10 @@ seal-use corps switch <corpId>
The command verifies by default and writes the enterprise config. If the user says not to operate business logic, stop at `corps` and auth/config commands; do not run approval, rule, document, simulation, or approval-run commands.
## Diagnose authentication
## Check authentication
```bash
seal-use auth diagnose --corp <corpId>
seal-use auth check --corp <corpId>
```
Read the JSON `stages` in order:
@@ -60,7 +60,10 @@ Important:
- Do not return the Seal tenant URL such as `https://<tenant>.sealai.cc`; that is not the Hose authorization link.
- Do not manually assemble `thirdparty.html` with a global/OpenAPI token.
-`seal-use auth diagnose` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
- **Formatting Requirement**: When returning a Hose authorization link to the user, ALWAYS provide BOTH a code block (` ```text ... ``` `) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
- **Dedicated CLI Command**: 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). Note: this link cannot be listed via `seal-use delegation list` (the latter only tracks Seal audit platform delegations).
-`seal-use auth check` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
- **Formatting Requirement**: When returning an authorization link (`auth link` or `auth hose-link`) to the user, ALWAYS provide:
1. The operator identity used (e.g. `周晚容` / `staffId`),
2. The exact expiration time in Beijing time (`expiresAt`, e.g. `2026-09-22T11:20:02+08:00`),
3. BOTH a code block (` ```text ... ``` `) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
- **Dedicated CLI Command**: 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).
- **Seal AI Platform Direct Link**: 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`).
message:"Homebrew-managed installations follow the formula version and do not support selecting a historical release. Use Homebrew directly for version pinning."
thrownewError("recordId or sourceDocumentSN is required to generate an SSO approvalresult URL");
if(useAutoLogin){
if(isHoseDoc){
thrownewError("Auto-login (--auto-login) is only supported for Seal AI audit link (type: seal-result)");
}
if(source.type!=="hose"){
thrownewError(
`SSO direct links currently support Hose-integrated enterprises (corp '${context.corp.id}' uses '${source.type}'). For Seal-native enterprises, use 'seal-use delegation create' for authorized access.`
`Auto-login direct links currently support Hose-integrated enterprises (corp '${context.corp.id}' uses '${source.type}'). For Seal-native enterprises, use 'seal-use auth link' for authorized access.`
);
}
@@ -1810,7 +1824,7 @@ export const sealTools = [
warning=`⚠️ 安全警示:该链接使用 [${userName}${roleLabel}] 身份签发,在 Seal AI 拥有全站操作权限。链接具备 ${Math.round(expiresIn/3600*10)/10} 小时时效,仅供受信任人员排查使用,请勿在外部公开分享。`;
console.error(
`⚠️ 安全警示 (SSO 强化免密链接):\n`+
`⚠️ 安全警示 (免密直达链接):\n`+
`• 身份主体:${userName}${roleLabel}\n`+
`• 权限范围:持有该链接者在 Seal AI 中拥有该用户的完整操作权限(含系统设置与规则编辑)\n`+
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.