41 KiB
Seal Use CLI Reference
Run from any directory after installing the global CLI:
seal-use <command>
Enterprise config lookup:
- If
SEAL_USE_ENTERPRISES_DIRis set, only that directory is loaded. - Otherwise the user-level
~/.config/seal-use/enterprisesdirectory is loaded. A configuredtestEnterprisesDiris loaded first for test-tenant workflows. The current working directory's./enterprisesdirectory is not loaded implicitly. - Set
SEAL_USE_ENTERPRISES_DIRto use one explicit directory instead. Legacy~/.config/seal-home/enterprisesfiles are migrated to the primary directory when possible.
Enterprise selection is stateless by default. Commands that access an enterprise require
--corp <corpId> unless stateful mode is explicitly enabled:
seal-use config mode stateful --corp <corpId>
seal-use corps switch <corpId>
seal-use config mode stateless
The global mode is stored in ~/.config/seal-use/config.json; set SEAL_USE_CONFIG_FILE to
override that path. The legacy current-corp file is not read.
Stream & Exit Code Contract
stdout: Pure, deterministic JSON for machine/Agent parsing.stderr: Diagnostics, probing logs, and Next-Step Command Suggestions with the stable prefix👉 Next action: seal-use ....Exit Code:0on success;1runtime/upstream failure,2usage/argument error,10explicit destructive-operation confirmation required,11missing/invalid authentication, and12output protection requiring a compact/file/query alternative.
Top-Level Commands
seal-use version
seal-use config paths
seal-use config get
seal-use config mode <stateful|stateless> [--corp <corpId>]
seal-use config test-dir [<path>|--clear]
seal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]
seal-use rules count [--corp <corpId>]
seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]
seal-use rules clear [--corp <corpId>] [--dry-run|--yes]
seal-use rules versions [--corp <corpId>]
seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]
seal-use rules get --corp <corpId> --version <number|latest> --code '#0038'
seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
seal-use rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
seal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]
seal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]
seal-use rules linters [--corp <corpId>]
seal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]
seal-use rules map [--corp <corpId>] [--version <id|num|latest>] [--code <code>]
seal-use service <start|stop|restart|status|logs> [--port 8787] [--host 127.0.0.1] [--lines 50]
seal-use http [--port 8787] [--host 127.0.0.1]
seal-use serve [--port 8787]
seal-use update [--check] [--force] [--version <v>]
seal-use update check
seal-use update changelog [--limit <n>]
seal-use changelog [--limit <n>]
seal-use mcp
seal-use mcp config
seal-use mcp-config
seal-use skill dump
seal-use skill install [--dir <path>|--local]
seal-use skill status
seal-use doctor [--quiet]
seal-use doctor tenant [--corp <corpId>] [--quiet]
seal-use doctor guide
seal-use doctor paths
seal-use test regression [--corp <corpId>] [--samples <N>] [--dry-run] [--fail-on-flips]
seal-use probe [<corpId>]
seal-use tools list
seal-use corps list [query] [--env <production|test>] [--limit <n>] [--all] [--sort <usage|name|id>] [--strict] [--corp <corpId>]
seal-use corps search <query> [--env <production|test>] [--strict]
seal-use corps get <corpId>
seal-use corps current [--corp <corpId>]
seal-use corps switch <corpId>
seal-use corps mark <corpId> --env <production|test> [--confirm]
seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
seal-use corps unbind-test [<corpId>] [--confirm]
seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]
seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--sn-suffix <str>] [--dry-run] [--force]
seal-use corps regression [--corp <corpId>] [--samples <N>] [--dry-run] [--fail-on-flips]
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
seal-use auth diagnose [--corp <corpId>]
seal-use auth hose-link [--corp <corpId>] [--expire 7200]
seal-use delegation list [--corp <corpId>]
seal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]
seal-use delegation revoke <tokenId> [--corp <corpId>]
seal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
seal-use users search <keyword> [--corp <corpId>]
seal-use users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]
seal-use users activate <userId> [--corp <corpId>]
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
seal-use contacts departments [<departmentId>] [--corp <corpId>]
seal-use contacts children <departmentId> [--corp <corpId>]
seal-use contacts users <departmentId> [--corp <corpId>]
seal-use contacts sync-time [--corp <corpId>]
seal-use data expenses --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]
seal-use data invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]
seal-use llm config [--corp <corpId>]
seal-use llm providers [--corp <corpId>]
seal-use permissions available [--corp <corpId>]
seal-use permissions configs [--corp <corpId>]
seal-use billing status [--corp <corpId>]
seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook ready [<材料包.zip>] [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]
seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--corp <corpId>]
seal-use webhook material-pack push <材料包.zip|信息表.xlsx> [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook replay [<recordId>] [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--sn-suffix <str>] [--dry-run] [--force] [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--dry-run] [--corp <corpId>]
seal-use deploy hosecloud sync [<sign-key>] [--auto] [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--dry-run] [--corp <corpId>]
seal-use context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]
seal-use approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id]
seal-use analytics insight --corp <corpId> [--start-date <ISO>] [--end-date <ISO>] [--limit <n>]
seal-use analytics risks <tagId> --corp <corpId> [--start-date <ISO>] [--end-date <ISO>]
seal-use analytics performance --corp <corpId> [--start-date <ISO|ms>] [--end-date <ISO|ms>]
seal-use analytics analyze <recordId> --corp <corpId>
seal-use analytics export --corp <corpId> [--downloads] [--out <file>] [--start-date <ISO>] [--end-date <ISO>] [--force]
seal-use approval-runs count --corp <corpId> [--status APPROVED] [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>]
seal-use approval-runs export --corp <corpId> [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--force] [--status <status>] [--manual-status <status>] [--completed-only] [--limit <n>] [--downloads] [--out <file>]
seal-use approval-runs search --corp <corpId> [--query text] [--limit 20] [--includeBridge true]
seal-use approval-runs get <recordId> --corp <corpId> [--fields metadata|document.fields,result.summary] [--output-file file.json]
seal-use approval-runs attachments <recordId> --corp <corpId>
seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] --corp <corpId>
seal-use approval-runs result <recordId> --corp <corpId> [--summary]
seal-use approval-runs url <recordId> --corp <corpId>
seal-use approval-runs url <recordId> --sso [--expire 7200] --corp <corpId>
seal-use approval-runs url --sn <documentSN> [--sso] --corp <corpId>
seal-use approval-runs url --corp <corpId>
seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sourceDocumentSN>]
seal-use simulation batch-records <batchId> --corp <corpId>
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--no-wait] --corp <corpId>
seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] --corp <corpId>
seal-use simulation create --source-system weaver --request-ids "req-01,req-02" --corp <corpId>
seal-use simulation status <batchId> --corp <corpId>
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] --corp <corpId>
seal-use simulation clean <batchId> --corp <corpId>
seal-use simulation specifications [--integration <sign-key>] --corp <corpId>
seal-use simulation approval-definitions --corp <corpId>
seal-use simulation list [--limit 50] --corp <corpId>
seal-use simulation get <batchId> --corp <corpId>
seal-use simulation templates --corp <corpId>
seal-use simulation integrations --corp <corpId>
seal-use simulation package-upload <材料包.zip> --corp <corpId>
CLI Command Overview
seal-use version returns:
{
"name": "seal-use",
"version": "<package version>"
}
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.
System diagnostic & embedded architecture specifications:
seal-use doctor [--quiet]executes a comprehensive read-only environment diagnostic health check (runtime executable, filesystem paths health, enterprise assets summary, daemon status) with zero disk footprint.seal-use doctor tenant [--corp <corpId>] [--quiet]probes the tenant-level health contract: verifies user identity and administrative permissions, checks AI approval quota balance (balanceanddeductionAmount), inspects active rules count and unreleased draft safety, validates webhook integration readiness, and verifies 1-to-1 environment pairing with test staging. Outputs clean JSON onstdoutand a visual terminal dashboard onstderr.seal-use doctor guidereads the complete embedded system architecture & directory specification whitepaper directly from binary memory without touching disk.seal-use doctor pathsoutputs compact JSON audit of all filesystem paths touched by the CLI.
Enterprise and tenant management:
seal-use corps list [query] [--env <production|test>] [--limit <n>] [--all] [--sort <usage|name|id>] [--strict] [--corp <corpId>](defaults to displaying the top 10 most frequently used enterprises in the last 7 days; pass--allto display the entire enterprise catalog,--sort <usage|name|id>to toggle sort criteria)seal-use corps search <query> [--env <production|test>] [--strict](intelligent soft search by default: case-insensitive, Chinese homophones, front/back nasal vowels, flat/retroflex consonants, initials, typo/missing letter tolerance; pass--strictfor exact substring match)seal-use corps get <corpId>(rich enterprise attributes with sensitive secrets safely redacted)seal-use corps current [--corp <corpId>]seal-use corps switch <corpId>seal-use auth diagnose --corp <corpId>
Read-only discovery:
seal-use contacts departments|children|users|sync-time --corp <corpId>queries the tenant's organization tree and last directory sync time.seal-use data expenses|invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]queries paginated raw expense or invoice records.seal-use analytics insight --corp <corpId> [--start-date <ISO>] [--end-date <ISO>] [--limit <n>]queries risk-tag statistics; omitted dates use the current month.seal-use analytics risks <tagId> --corp <corpId> [--start-date <ISO>] [--end-date <ISO>]queries detailed risks and cited documents under a specific risk tag.seal-use analytics performance --corp <corpId> [--start-date <ISO|ms>] [--end-date <ISO|ms>]queries approval performance metrics and Sankey decision flow.seal-use analytics analyze <recordId> --corp <corpId>triggers on-demand smart insight risk analysis for an approval record.seal-use analytics export --corp <corpId> [--downloads] [--out <file>] [--start-date <ISO>] [--end-date <ISO>]exports a comprehensive multi-sheet Excel report covering performance KPIs, decision flow, top risk tags, and detailed risk citations.seal-use context --corp <corpId> [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50]aggregates rules, knowledge documents, and style preferences.seal-use source config --corp <corpId>resolves the live source-system configuration without changing it.
Test Enterprise Binding, Staging Synchronization & Automated Regression Testing:
- 1-to-1 Association: One production enterprise can only bind at most one test enterprise (
corps bind-test <prodCorpId> <testCorpId>). Multi-tier chaining is rejected. - Marking & Rigorous Confirmation: Marking (
corps mark <corpId> --env <production|test>) and binding require explicit--confirm. Without confirmation, the CLI blocks with exit code10(confirmationRequired). Overwriting existing bindings requires--force. - Production Safety Guarantee (
corps sync-test):- In the Production Enterprise: Rules remain strictly in draft state without publishing any live version.
- In the Test Enterprise: Style preferences (
decisionPreferences,thinkingDepthPreference) are updated to match production, test draft rules are cleared and populated with production draft rules, recoded, and immediately published as a new official version in the test tenant (--version-name <name>). - Semantic Version Naming: Defaults to
Sync from <ProdCorp> [Prod v<N> · #<Iteration>]tracking production baseline version and test draft iteration without redundant date strings. - Rule Mapping & Local Snapshot: Returns
versionMappingandruleMappingin CLI stdout and saves persistent snapshot to~/.config/seal-use/mappings/<testCorpId>-v<N>.jsonand<testCorpId>-latest.json. --dry-runpreviews the full preference diff, version mapping plan, and rule sync plan without sending mutations. Execution requires--yes.
- Approval Run Replay to Test Enterprise (
corps replay-test):- Automatically identifies the bound test enterprise for
<prodCorpId>(or current corp). - Fetches original approval records from the production enterprise (
--record-id,--sn, or batch via--limit/--status). - Cleans and normalizes payload structure, appends customizable suffix (default
-REPLAY-TEST) to avoid collision. - Automatically provisions
(Seal测-回放通道)withassistedmode on the test enterprise if no webhook integration exists. - Replays documents safely to the test enterprise webhook endpoint. Targeting production is blocked by default; if the enterprise has no bound test corp or target is production,
--forcecan be specified to allow direct replay.
- Automatically identifies the bound test enterprise for
- Automated Rule Regression Test Matrix (
seal-use test regression/seal-use corps regression):- Runs an automated regression testing matrix across paired production and test enterprises before rule publication.
- Enforces Red Line 1: The replay target MUST be a test enterprise (
environment: "test"). Running regression tests directly in pure production is strictly forbidden. - Enforces Red Line 2: Pre-flight verification of target test enterprise AI approval balance (
balance >= samples * deductionAmount). If balance is insufficient, execution is blocked immediately to avoid quota starvation. - Samples historical completed production runs (
--samples <N>, default 10). - Replays sanitized documents into the test webhook integration.
- Uses outbound HTTPS polling for asynchronous test approval completion, eliminating any requirement for public IP or inbound webhook listeners behind NAT/VPNs.
- Normalizes and compares production vs. test decisions (
APPROVE,REJECT,MANUAL,ERROR). - Detects decision flips (e.g. production APPROVE becoming test REJECT), computes overall concordance rate, and computes boolean
safeToPublish. - Supports
--dry-runto preview sampled documents and verify quota without executing mutations. - Supports
--fail-on-flipsto terminate with a non-zero exit code (1) if any decision flip occurs, providing seamless integration with automated CI/CD safety gates.
Approval rule maintenance:
seal-use rules count [--corp <corpId>]seal-use rules list --summary [--corp <corpId>]seal-use rules map [--corp <corpId>] [--version <id|num|latest>] [--code <code>](reads local sync rule mapping snapshot)seal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]seal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]seal-use rules linters [--corp <corpId>](lists official and custom linters with directory specs:~/.config/seal-use/lintersandofficial/)seal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]incrementally applies the local file: matched IDs are updated, missing local IDs are created, and remote IDs absent from the file are deleted. It does not clear/recreate the whole draft or recode it. Run--dry-runfirst; a local file exported withrules pullis preferred.seal-use rules clear [--corp <corpId>] [--dry-run|--yes]
Rule identity and versioning:
rules listandrules pullread the current draft rule set. Theircodevalues belong to the draft code space.- A published version has its own snapshot and code space. Publishing can recode rules, so a published
codemay differ from the draftcode, and codes can shift again after later edits and publishes. - Do not use a draft
#NNas a cross-version identifier. For current draft work, prefer the stable ruleid; for historical behavior, select the publishedversionand locate the rule by its text/context or runtime rule ID from the approval run. rules get --version ... --code ...interpretscodeinside that selected published version, whilerules get --record-id ... --runtime-id ...resolves the version recorded on the run.
Approval run lightweight queries:
seal-use approval-runs get <recordId> --corp <corpId> --fields metadataseal-use approval-runs get <recordId> --corp <corpId> --summaryseal-use approval-runs pick --corp <corpId> --sn <单号> --batch <batchId> --latestseal-use approval-runs document-summary <recordId> --corp <corpId>seal-use approval-runs cited-rules <recordId> --corp <corpId>seal-use approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summaryseal-use approval-runs attachments <recordId> --corp <corpId> --summaryseal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] --corp <corpId>seal-use approval-runs result <recordId> --corp <corpId> --summary
Approval knowledge documents & style:
seal-use tool seal_approval_documents_list --corp <corpId> --json '{"limit":50}'seal-use tool seal_approval_document_get --corp <corpId> --json '{"documentId":"doc-id"}'seal-use tool seal_approval_document_create --corp <corpId> --json '{"title":"标题","purpose":"用途","content":"Markdown 内容","contentType":"policy","scenarios":["audit"]}'seal-use tool seal_approval_document_update --corp <corpId> --json '{"documentId":"doc-id","enabled":false}'seal-use tool seal_approval_delete_document --corp <corpId> --json '{"documentId":"doc-id"}'(删除前必须重新读取并确认)seal-use rules get --corp <corpId> --version <number> --code '#0038'seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
Webhook integrations:
seal-use webhook ready [<材料包.zip|信息表.xlsx>] [--webhook <idOrName>] [--corp <corpId>]seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] --corp <corpId>seal-use webhook material-pack push <材料包.zip|信息表.xlsx> [--webhook <idOrName>] --corp <corpId>seal-use webhook replay [<recordId>] [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--sn-suffix <str>] [--dry-run] [--force] [--corp <corpId>](通用单据重放:从历史审批单据汲取结构化表单与明细,清洗规范化字段类型,支持单条或批量重放到目标企业的 Webhook 触发审批。默认阻止向未授权生产环境重放以防污染数据,提供--force显式覆盖支持)
Webhook writes read the current AI approval config and POST the merged full config back to api/v1/agent/ai-approval/config, preserving non-Webhook integrations. List/get mask secret by default; add returns the generated secret once. Each Webhook can also store a mutable materialPackFilePolicy with minFileSizeBytes, optional maxFileSizeBytes, and allowedExtensions. Update is a patch: omitted policy fields are retained; allowedExtensions replaces the complete list; --clear-max-file-size removes the upper bound.
All supported configuration writes accept --dry-run: rules clear/push, corps sync-test, preference updates, thinking-depth policy changes, HoseCloud configure, and Webhook add/update/delete. Preview mode performs read-only discovery and returns JSON with preview: true, the exact targetUrl, a redacted changesDiff (before/after), and impactCount. It never sends the mutation request and does not require --yes; use the same command with --yes only after reviewing the preview.
Approval runs, simulations, and Langfuse bridge:
seal-use approval-runs search --corp <corpId> [--query <text>] [--limit 20]seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sn>]seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>returns immediately with anasyncTicket(creation is non-blocking by default for compatibility).seal-use simulation status <batchId> --corp <corpId>performs one non-blocking status check and returnsQUEUED/RUNNING/COMPLETED/FAILED-style state plus counters.seal-use simulation approval-definitions --corp <corpId>lists available Feishu approval definitions so anapprovalCodecan be selected before creating a batch.seal-use simulation wait <batchId> --corp <corpId>seal-use simulation clean <batchId> --corp <corpId>seal-use simulation list --corp <corpId>seal-use simulation get <batchId> --corp <corpId>seal-use simulation batch-records <batchId> --corp <corpId>seal-use simulation templates --corp <corpId>seal-use simulation integrations --corp <corpId>
Common Examples
Add and verify a Hose enterprise:
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use auth diagnose --corp <corpId>
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:
seal-use auth diagnose --corp <corpId>
The diagnostic stages are hose.openapi, hose.provisional, seal.sso, and seal.whoami. Tokens are omitted from output.
Search approval content:
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"matchMode":"any","maxResults":20}'
Get aggregated approval context:
seal-use tool seal_approval_context_get --corp <corpId> --json '{"documentLimit":20}'
Create a draft approval rule:
seal-use tool seal_approval_rule_create --corp <corpId> --json '{"description":"规则描述","scope":"适用场景","strictness":"SHOULD_FOLLOW"}'
Update an approval document:
seal-use tool seal_approval_document_update --corp <corpId> --json '{"documentId":"doc-id","content":"Markdown 内容"}'
Summarize one local date:
seal-use approval-runs summary --corp <corpId> --date 2026-06-09 --timezone Asia/Shanghai --limit 100
Find a run and include Langfuse bridge rows:
seal-use approval-runs search --corp <corpId> --query <sourceDocumentSN> --limit 20 --includeBridge true
Resolve Langfuse trace/session hints:
seal-use approval-runs bridge --corp <corpId> --sourceDocumentSN <sourceDocumentSN>
模拟测试批次(模拟发布闭环)创建与查询:
# 合思指定单号: 创建批次(响应只含 batchId)
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" --reject-node 财务 --thinking-depth medium --skip-invoice-generation --corp <corpId>
# 材料包导入: 先上传材料包 ZIP(服务端解析并返回 schemaConfig), 再用返回的 id 发起
seal-use simulation package-upload 测试材料包.zip --corp <corpId>
seal-use simulation create --mode material_pack --package-ids <materialPackageId> --template-id conference_reimbursement_v1 --schema-config schema.json --corp <corpId>
# 预留: 其他模式参数通过 --json 透传(如时间范围 startTime/endTime)
seal-use simulation create --mode hosecloud --flow-ids "B26017701" --json '{"startTime":0,"endTime":0}' --corp <corpId>
# 创建后轮询批次状态与记录
seal-use simulation list --limit 50 --corp <corpId>
seal-use simulation get <batchId> --corp <corpId>
seal-use simulation batch-records <batchId> --corp <corpId>
seal-use simulation templates --corp <corpId>
seal-use simulation integrations --corp <corpId>
Write Operation Payloads
Create a rule:
{
"description": "规则描述",
"scope": "适用场景",
"strictness": "MUST_FOLLOW | SHOULD_FOLLOW | SUGGESTION"
}
Update a rule:
{
"ruleId": "rule-id",
"description": "可选",
"scope": "可选",
"strictness": "SHOULD_FOLLOW"
}
Publish a rule version:
{
"versionName": "版本名称"
}
Create a document:
{
"title": "标题",
"purpose": "用途",
"content": "Markdown 内容",
"contentType": "policy",
"status": "published",
"scenarios": ["audit"],
"tags": ["标签"]
}
contentType 必须是 document、video、pdf、feishu_doc 或 policy 之一;scenarios 必填且至少包含一个 fill(智能填单)或 audit(智能审核)。这里的 scenarios 是产品能力开关,不是费用类别或业务场景名。
知识文档支持通过 seal_approval_delete_document 删除,且 corps sync-test 会在按标题对账时删除测试企业中多余的文档;删除仍是破坏性写操作,必须在写入前重新读取并确认标题/ID。若只是暂时撤下内容,优先使用更新操作并设置 enabled: false。
Update a document:
{
"documentId": "doc-id",
"title": "可选",
"purpose": "可选",
"content": "可选",
"enabled": true,
"scenarios": ["可选"],
"tags": ["可选"]
}
Update style preferences:
{
"tone": "可选",
"language": "可选",
"detailLevel": "可选",
"outputFormat": "可选",
"examples": ["可选"],
"prohibitedPhrases": ["可选"],
"customInstructions": "可选"
}
Material Pack Workflow
A material pack (材料包) is a ZIP file that bundles an Excel information sheet (信息表.xlsx) with attachments organised by document ID. It is the primary input to the Webhook-based AI approval ingestion pipeline.
ZIP structure convention
材料包.zip
├── 信息表.xlsx ← must exist at ZIP root
├── BX20260826003/ ← root dir name = documentId (or documentId@annotation)
│ ├── 合同协议/
│ │ └── 采购合同.pdf
│ └── 支付凭证/
│ └── 支付宝交易明细.pdf
└── BX20260826004@重新提交v2/ ← @annotation is stripped when matching documentId
└── 发票/
└── 增值税专用发票.pdf
- The root directory name must equal the
documentIdOR start withdocumentId@(the@separates an optional annotation ignored during matching). 信息表.xlsxat the ZIP root is the only file not associated with any document directory.
Excel column convention
| Column type | Naming | Purpose |
|---|---|---|
| Regular column | Any header (e.g. 会议编号, 总金额) |
Standard document fields |
| Attachment column | Header starts with [附件] (e.g. [附件]合同协议) |
Declares attached files for this row |
- The
[附件]prefix is stripped to produce the fieldlabelsent to Seal. - The cell value contains full ZIP-relative path(s) to the declared files (multiple paths separated by newline, comma, or semicolon).
- Example: column
[附件]合同协议, cell valueBX20260826003/合同协议/采购合同.pdf
Sheet → document level mapping
| Excel sheet | Maps to |
|---|---|
| First sheet (main / 会议) | Root document categoryFields |
费用明细表 (has 报销金额 column) |
Per-row entries in mingxi_list |
劳务明细 (has 姓名 column) |
Per-person entries in daoshi_list |
Strict bidirectional validation
Before pushing or previewing, the system enforces:
- Excel → ZIP: Every path declared in an
[附件]column cell must exist as a ZIP entry. Error:Excel 声明的附件路径在 ZIP 中不存在: <path> - ZIP → Excel: Every ZIP file (excluding
信息表.xlsx) must be declared in exactly one[附件]column. Error:ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path> - Document Directory Scope Isolation: All attachments declared for a document
DOC_Xmust reside in its own root directory (DOC_X/orDOC_X@annotation/). Cross-document references are strictly forbidden. Error:单据「X」声明了跨单据或非本单据目录的附件路径: <path>。附件必须位于该单据自己的根目录... - Strict Declaration Uniqueness: A given ZIP file path cannot be declared more than once across the entire material pack (even within the same document across multiple rows or fields). If the same logical document is needed in multiple places, separate files must be placed in distinct paths. Error:
附件路径「<path>」被重复声明了 N 次... - Attachment file policy: Every attachment except the root
信息表.xlsxmust satisfy the selected Webhook's minimum size, optional maximum size, and extension whitelist. The default minimum is 500 bytes; the default maximum is unlimited; the default whitelist includes common PDF, Office, text, email, and image formats. Error:附件文件过小.../附件文件过大.../附件后缀不在白名单中... - documentId ↔ ZIP root: Every
documentIdin the Excel main sheet must have a matching ZIP root dir (exact match ordocumentId@annotation). Errors:Excel 会议编号「X」在 ZIP 中找不到对应的根目录.../ZIP 根目录对应的编号「X」在信息表中找不到对应的会议编号
All validation errors are collected and reported together in a single MaterialPackValidationError.
CLI usage
# Check environment readiness and optionally pre-validate the material pack
seal-use webhook ready [--file <pack.zip>] [--corp <corpId>]
# Dry-run: local parse & validation only, no network calls, returns preview JSON
seal-use webhook material-pack preview <pack.zip> --corp <corpId>
# Preview with temporary local policy overrides (comma-separated extensions)
seal-use webhook material-pack preview <pack.zip> --min-file-size 500 --max-file-size 20971520 --allowed-extensions .pdf,.xlsx,.docx --corp <corpId>
# Upload attachments and push documents via inbound Webhook
seal-use webhook material-pack push <pack.zip> [--webhook <nameOrId>] --corp <corpId>
# When there is exactly one webhook channel, --webhook can be omitted (auto-locked)
Attachment file policy configuration
The policy is stored per inbound Webhook integration and is applied before any attachment upload or document push. A failed check stops the entire material-pack flow. The policy is intentionally mutable: after an authorized configuration change, retrying the same push reads the saved policy again.
Default configuration:
{
"minFileSizeBytes": 500,
"maxFileSizeBytes": null,
"allowedExtensions": [
".pdf", ".xls", ".xlsx", ".csv", ".doc", ".docx", ".ppt", ".pptx",
".txt", ".rtf", ".odt", ".ods", ".odp", ".jpg", ".jpeg", ".png",
".gif", ".bmp", ".webp", ".heic", ".eml", ".msg"
]
}
null or an omitted maxFileSizeBytes means no per-file upper bound. Values are bytes; a file smaller than the minimum or larger than the maximum fails. Extensions are normalized case-insensitively and may be written with or without the leading dot. The root 信息表.xlsx remains exempt from attachment policy checks.
# New Webhook: use the default 500-byte minimum and default extension whitelist
seal-use webhook add --name "材料包入站" --result-url "https://your-domain.com/callback" --corp <corpId>
# Configure an existing Webhook; sizes are bytes and extensions are comma-separated
seal-use webhook update <webhookIdOrName> \
--min-file-size 500 \
--max-file-size 20971520 \
--allowed-extensions .pdf,.xlsx,.xls,.docx,.pptx,.jpg,.png \
--corp <corpId>
# Allow a newly confirmed format while retaining the rest of the policy:
# first read webhook get/list, then pass the complete desired whitelist.
seal-use webhook update <webhookIdOrName> \
--allowed-extensions .pdf,.xlsx,.xls,.docx,.pptx,.jpg,.png,.zip \
--corp <corpId>
# Remove only the maximum-size limit (minimum and whitelist are retained).
seal-use webhook update <webhookIdOrName> --clear-max-file-size --corp <corpId>
The saved configuration is returned by webhook get/webhook list under materialPackFilePolicy. The root 信息表.xlsx is always allowed as the material-pack manifest and is not subject to the attachment policy.
Failure recovery loop
When a push fails because of the attachment policy, the error is actionable and should be handled as a two-channel recovery loop:
- Error channel: read
附件文件过小,附件文件过大, or附件后缀不在白名单中, including the attachment path and the configured boundary. - Resolution channel: ask whether the user wants to replace/compress the file or explicitly allow the format/size by changing the target Webhook policy.
- If configuration change is authorized, read the current policy with
webhook get/webhook list, update only the necessary fields, and verify the returned configuration. - Retry the original
material-pack push; it will load the latest saved policy before any upload begins.
The same loop is available through MCP: read with seal_webhook_get/seal_webhook_list, update with seal_webhook_update and its materialPackFilePolicy patch, then retry seal_webhook_material_pack in push mode. For MCP, set maxFileSizeBytes to null to clear the upper bound. allowedExtensions is a complete replacement list, so include existing allowed suffixes when adding one.
If the assistant lacks permission to update the Webhook or the user does not authorize relaxing the rule, report the block rather than bypassing validation. Since validation happens before the upload loop, a failed attempt does not leave a partially pushed material pack.
The direct local material-pack preview command and MCP preview use the default or temporary policy. They do not automatically read a selected Webhook's persisted policy. Use webhook ready --file --webhook <idOrName> or the actual push path when validating against the saved inbound policy.
Error messages reference
| Error message | Meaning | Fix |
|---|---|---|
Excel 声明的附件路径在 ZIP 中不存在: <path> |
Cell value references a file not in ZIP | Add the file to ZIP at exactly that path |
ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path> |
ZIP contains a file not referenced by any [附件] column |
Add an [附件] column entry or remove the file from ZIP |
单据「X」声明了跨单据或非本单据目录的附件路径: <path> |
Document X declared a path inside another document's folder | Move file into Document X's own folder and update Excel |
附件路径「<path>」被重复声明了 N 次 |
The same file path was declared in multiple columns/rows/documents | Each declaration must point to a unique file path; duplicate file if needed |
Excel 会议编号「X」在 ZIP 中找不到对应的根目录 |
No ZIP root dir matches documentId X |
Rename the ZIP folder to match the documentId |
ZIP 根目录对应的编号「X」在信息表中找不到 |
ZIP folder has no matching documentId in Excel | Remove the folder or add the document to Excel |
ZIP 根目录缺少信息表.xlsx |
No 信息表.xlsx found at ZIP root |
Add the Excel file to the ZIP root |
附件文件过小 |
Attachment is below the configured minimum byte size | Replace the empty/truncated file or lower --min-file-size |
附件文件过大 |
Attachment exceeds the configured maximum byte size | Replace/compress the file or raise --max-file-size |
附件后缀不在白名单中 |
Attachment extension is not allowed by the Webhook policy | Add the extension with --allowed-extensions or convert the file |
附件上传失败 <status> |
Network/server error during file upload | Check webhook URL, secret, and server availability |
Failure Handling
- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. Use
seal-use service restartafter updates so the optional local service picks up new code. - If no run is found by
sourceDocumentSN, retry withsourceDocumentIdor a broaderquery. - If date-based summaries look wrong, pass
--timezone Asia/Shanghaiand an explicit--date. - If
langfuseTraceIdis missing, uselangfuseSessionFallback. - If a write operation fails, report the raw JSON error and do not retry with guessed payloads.