Symlink skills/seal-home to .agents/skills/seal-home and add version metadata (v0.3.8)
Binaries / Verify (push) Has been cancelled
Binaries / Build linux-x64 (push) Has been cancelled
Binaries / Build macos-arm64 (push) Has been cancelled
Binaries / Build windows-x64 (push) Has been cancelled
Binaries / Publish release assets (push) Has been cancelled

This commit is contained in:
gitea committed 2026-07-29 16:54:18 +08:00
1 parent ae4653bb32
commit 957cd2f70e
10 files changed
+6 -890

No files matched your search

+5 -3
View File
@@ -1,11 +1,13 @@
---
name: seal-home
description: Use when working with Seal Home approval automation: 合思/易快报企业认证, Hose authorization links, approval run lookup by 单号/SN/recordId/batch, compact approval run summaries, AI cited rules, document/attachment summaries, approval rules by count/list/version/code/runtime-id, approval knowledge search, simulations, and Langfuse trace hints.
version: 0.3.8
description: "v0.3.8: Use when working with Seal Home approval automation: 合思/易快报企业认证, Hose authorization links, approval run lookup, LLM config, permissions, billing status, users & password reset, delegation links, approval rules, documents, search, and Langfuse hints."
metadata:
short-description: Seal approval automation tools
version: 0.3.8
short-description: Seal approval automation tools (v0.3.8)
---
# Seal Home
# Seal Home (v0.3.8)
Use the global `seal-home` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
+1
View File
@@ -0,0 +1 @@
.agents/skills/seal-home
-79
View File
@@ -1,79 +0,0 @@
---
name: seal-home
description: Use when working with Seal Home approval automation: 合思/易快报企业认证, Hose authorization links, approval run lookup by 单号/SN/recordId/batch, compact approval run summaries, AI cited rules, document/attachment summaries, approval rules by count/list/version/code/runtime-id, approval knowledge search, simulations, and Langfuse trace hints.
metadata:
short-description: Seal approval automation tools
---
# Seal Home
Use the global `seal-home` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
```bash
seal-home help
seal-home version
seal-home tools list
```
## First Rules
- Prefer compact commands first: `pick`, `--summary`, `--fields`, `attachments --summary`, `rules count`, and `rules list --summary`.
- Parse JSON stdout. Do not scrape human text.
- Do not hand-edit enterprise configs for normal setup. Use `seal-home corps ...`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For repeat test-environment rule resets, prefer `rules clear --dry-run` followed by `rules clear --yes`.
- For date questions, use explicit dates and `--timezone Asia/Shanghai`.
- If output may be large, use `--summary`, `--fields`, `--count`, or `--output-file`; use `--full` only when the user really needs full payloads.
- When returning authorization/login links (e.g. 合思授权链接), ALWAYS provide BOTH a code block (` ```text ... ``` `) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
## Route By Intent
- Delegation links (授权链接): `seal-home delegation list`, `create [--note ...]`, `revoke <tokenId>`.
- User & Contacts Management (用户与重置默认密码): `seal-home users create --name ... --phone ...`, `reset-password <userId>`, `get <userId>`, `delete <userId>`.
- LLM Model Config & Providers: `seal-home llm config`, `seal-home llm providers`.
- System Permissions Config: `seal-home permissions available`, `seal-home permissions configs`.
- Billing & Feature Quotas: `seal-home billing status`, `seal-home billing plans`, `seal-home billing features`.
- Full CLI inventory: read `references/cli.md`.
## High-Value Commands
```bash
seal-home approval-runs pick --sn <sourceDocumentSN> --latest
seal-home approval-runs pick --sn <sourceDocumentSN> --batch <batchId> --latest --fields recordId,status,aiDecision,aiSummary
seal-home approval-runs get <recordId> --summary
seal-home approval-runs get <recordId> --fields metadata,document.fields,result.summary
seal-home approval-runs document-summary <recordId>
seal-home approval-runs cited-rules <recordId>
seal-home approval-runs attachments <recordId> --summary
seal-home approval-runs result <recordId> --summary
seal-home rules count --corp <corpId>
seal-home rules list --corp <corpId> --summary
seal-home rules clear --corp <corpId> --dry-run
seal-home rules clear --corp <corpId> --yes
seal-home rules get --version 16 --code '#0038'
seal-home rules get --record-id <recordId> --runtime-id rule-205
seal-home tool seal_approval_search --json '{"keywords":["差旅","发票"],"areas":["rules"],"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
```
## Important Fields
- `sourceDocumentSN`: external document number, often the easiest 合思/易快报 lookup key.
- `sourceDocumentId`: external source document ID.
- `recordId`: Seal approval run record ID.
- `simulationBatchId`: simulation batch identifier.
- `status`: run status.
- `taskMode` / `finalExecutionMode`: execution mode information.
- `ruleSetVersionNumber`: approval rule version used by a run.
- `langfuseTraceId`: direct Langfuse trace lookup key.
- `langfuseSessionFallback`: fallback session key, usually `hosecloud-{sourceDocumentSN}`.
## References
- `references/approval-run-lightweight.md`: 单号定位、字段裁剪、摘要、引用规则、单据摘要、附件摘要。
- `references/rule-lightweight.md`: 规则 count/list summary、按版本/编号取单条规则、规则搜索裁剪。
- `references/hose-enterprise-auth.md`: Hose 企业配置、认证诊断、授权链接。
- `references/approval-attachment-trace.md`: 附件/发票/OCR/图片争议的 Langfuse 追踪工作流。
- `references/cli.md`: 完整 CLI 命令清单。
## Safety
Rule, document, style preference, and publish actions mutate Seal configuration. Make the target enterprise explicit, show the intended payload, and verify after the write. Never send real `enterprises/*.json` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
-4
View File
@@ -1,4 +0,0 @@
interface:
display_name: "Seal Home"
short_description: "Inspect Seal approval runs, rules, Hose auth, and compact diagnostics"
default_prompt: "Use $seal-home for Seal approval automation: locate runs by 单号/SN, read compact summaries, inspect cited rules, rule versions, Hose auth links, and Langfuse trace hints."
@@ -1,221 +0,0 @@
# Approval Attachment Trace Investigation
Use this workflow when a customer disputes an AI approval finding about an attachment, invoice, receipt, OCR result, or a UI-highlighted audit result.
The goal is to locate where an imprecise claim first entered the pipeline. Do not jump directly from the final approval result to a rule change. Many issues start earlier in the attachment understanding or attachment review stages.
## Mental Model
Approval traces commonly contain these stages:
1. Source document rendering
- Seal converts the approval document into the Markdown-like "AI saw" document.
- This may include both structured invoice fields and raw attachment fields.
2. Rule matching
- Selects applicable rule scopes such as "存在发票或收据时" or "存在发票时".
- This stage is not the final source of attachment type judgments; it works from the rendered document.
3. Image understanding
- Vision model reads each image attachment and writes `document_content`.
- This is often where loose labels such as "发票(或收据)", "定额发票", "销售单", or "支付凭证" first appear.
4. Pre-analysis
- Generates `attachmentInstructions` and `reviewPoints` for later per-attachment review.
- This stage can matter when a later attachment review seems to ignore or override values already present in the generated review points.
5. Document parsing / attachment review
- A text model checks review points against the image-understanding text.
- If the review point already says "该附件(定额发票)", it usually inherited that label from the previous stage instead of independently classifying the original image.
- Check whether this stage uses values passed in the review point, or reclassifies the attachment and discards them.
6. Final approval review
- Produces `rulesResult`, summaries, and UI findings.
- Final findings can amplify earlier labels into business conclusions, for example "附件中存在定额发票未上传至发票栏位".
## Commands
Start from the Seal run and Langfuse trace.
```bash
seal-home approval-runs search --query <sourceDocumentSN> --limit 50
seal-home approval-runs get <recordId> > /tmp/seal-run.json
seal-home approval-runs bridge --sourceDocumentSN <sourceDocumentSN>
```
Refresh and inspect the Langfuse trace.
```bash
langfuse-home call langfuse_trace_cache_refresh --json '{"traceId":"<traceId>"}'
langfuse-home call langfuse_trace_url_get --json '{"traceId":"<traceId>"}'
langfuse-home call langfuse_trace_outline_get --json '{"traceId":"<traceId>","includeInput":true,"includeOutput":true,"maxPreviewChars":800}'
```
If `langfuse_trace_qrep_search` does not find Chinese terms reliably, grep the cached JSON directly.
```bash
rg -n "发票未上传至发票栏位|附件中存在定额发票|检查该附件(定额发票)|<file-name-or-fileId>" \
.cache/langfuse/traces/default/<traceId>.json
```
Read focused IO for the relevant observations.
```bash
langfuse-home call langfuse_observation_io_get --json '{"traceId":"<traceId>","observationId":"<observationId>","maxChars":30000}'
```
## Separate Object IDs Before Judging
Never assume same-looking file names are the same object.
In Seal run detail, invoice-list entries and raw attachment entries can be separate objects:
- `invoiceForm` / `发票列表` entries often have source invoice IDs, invoice numbers, OCR-derived file names, `verifyResult`, `fileInfo.fileType=invoice`, and invoice metadata.
- `attachments` / `附件` entries often have UI file IDs such as `file-7`, Hose file IDs inside `token`, `category=file`, `mimeType=image/jpeg`, and their own OSS path.
Use `jq` to list them side by side.
```bash
jq -r '
.document.fields[] | select(.key=="details") | .value[0][] | select(.key=="invoiceForm") | .value[] |
["invoiceForm", .sourceInvoiceId, .invoice.invoiceNumber, .invoice.fileInfo.fileName, .invoice.fileInfo.fileType, .invoice.fileInfo.ossPath, (.invoice.verifyResult.rawData | fromjson? | .form.sourceEntityId // "")] | @tsv
' /tmp/seal-run.json
```
```bash
jq -r '
.document.fields[] | select(.key=="details") | .value[0][] | select(.key=="attachments") | .value[] |
["attachments", .fileId, .name, .category, .mimeType, .ossPath, .token] | @tsv
' /tmp/seal-run.json
```
When explaining the result, say precisely whether the disputed item is:
- a structured invoice-list object,
- a raw attachment object,
- or two distinct objects with similar file names/content.
## Find Where A Bad Label First Appeared
Search for the UI finding text and the disputed label.
```bash
jq -r '
def walkobs(o): o, ((o.children // [])[] | walkobs(.));
.trace.observations[] | walkobs(.)
| select(((.input|tostring)+"\n"+(.output|tostring))
| contains("发票未上传至发票栏位")
or contains("附件中存在定额发票")
or contains("检查该附件(定额发票)"))
| [.id,.name,.type,.startTime,((.output|tostring)|gsub("\n";" ")|.[0:500])] | @tsv
' .cache/langfuse/traces/default/<traceId>.json
```
Then inspect the earliest matching observation. Typical interpretation:
- `image_understanding:ai.streamText`: the vision stage first assigned the type label.
- `pre_analysis:ai.streamText`: the instruction-generation stage turned matched rules and parsed attachments into per-file `reviewPoints`; this is where attachment-side values or labels can be copied into prompts.
- `document_parsing:ai.streamText`: the attachment review inherited the label in its review point or document content.
- `approval_review:ai.streamText`: the final model converted inherited labels into a rule finding.
## Check Pre-Analysis For Amount-Total Disputes
When the customer says the AI "did not recognize the correct amount", "missed one payment screenshot", or "the total should be X", start with the normal trace: source document, image understanding, attachment review, and final review. Inspect `pre_analysis` when the evidence suggests the disputed amount was recognized earlier but later ignored, or when final review is aggregating inconsistent per-attachment conclusions. Treat this as a possible failure mode, not as the default cause.
Find the node:
```bash
jq -r '
def walkobs(x; depth): (x + {depth: depth}), ((x.children? // [])[] | walkobs(.; depth+1));
.trace.observations[] | walkobs(.; 0)
| select(.name? | test("pre_analysis"))
| [.startTime,.id,.name,.type,.parentObservationId,((.input|tostring|length)//0),((.output|tostring|length)//0)] | @tsv
' .cache/langfuse/traces/default/<traceId>.json
```
Then inspect its output for the disputed file and rule:
```bash
jq -r '
def walkobs(x): x, ((x.children? // [])[] | walkobs(.));
.trace.observations[] | walkobs(.)
| select(.name? == "pre_analysis:ai.streamText")
| .output
' .cache/langfuse/traces/default/<traceId>.json | rg -n "fileId|fileName|<file-name>|付款截图金额|收款金额|金额合计"
```
Look for these failure patterns:
- A global aggregate requirement was split into per-attachment review points, for example each attachment is asked whether its amount plus "other attachments" reaches the reimbursement amount.
- The pre-analysis prompt says not to write attachment OCR/image-understanding candidate values into review points, but the output still includes values such as "付款截图金额(1850.00元)" or labels such as "收款凭证".
- The same physical image appears twice because it exists under both form-level attachments and fee-detail attachments, producing duplicate `fileId`s and potentially inconsistent later judgments.
- `pre_analysis` passes a value down, but `document_parsing` reclassifies the file and ignores that value, for example a review point says "付款截图金额(1850.00元)" while the parser answer says "收款凭证,非付款截图".
For these cases, the amount may not be lost in OCR or image understanding. It may be lost when a later attachment-review node overrides the pre-analysis task premise, or when final approval review aggregates inconsistent per-file conclusions. For concrete examples, see `approval-bad-cases.md`.
## Check Images When The Dispute Is Visual
If the issue depends on whether an image is a receipt or invoice, inspect the raw image. Do not rely only on the model's textual description.
Extract raw attachment signed URLs from `/tmp/seal-run.json` and download the disputed files.
```bash
jq -r '
.document.fields[] | select(.key=="details") | .value[0][] | select(.key=="attachments") | .value[] |
select(.fileId=="file-7" or .fileId=="file-9") |
[.fileId,.name,.ossSignedUrl] | @tsv
' /tmp/seal-run.json
```
Look for invoice-specific elements:
- "发票" text in the title
- invoice code / invoice number
- tax bureau supervision seal
- tax invoice QR/code metadata
- buyer/seller tax information
- taxable amount / tax rate / tax amount fields
If those are absent and the document is a store-stamped handwritten slip, it is safer to call it a receipt or sales voucher, not a formal invoice.
## Reporting Pattern
When answering the user, separate:
- What the final UI finding says.
- The first pipeline stage where the disputed claim appeared.
- Whether the disputed file is a raw attachment or a structured invoice-list object.
- Whether the raw image supports the claim.
- Whether the final decision still stands for other independent reasons.
Example wording:
```text
The UI finding was produced in final approval review, but the imprecise label started earlier:
image_understanding labeled file-9 as "定额发票"; document_parsing then inherited that as "该附件(定额发票)"; approval_review converted it into the rule-3 finding.
The raw attachment object itself is not structurally marked as invoice; it is category=file, mimeType=image/jpeg. The image lacks formal invoice elements, so the customer's receipt interpretation is reasonable.
```
## Case Note: Receipt-Like Attachments Labeled As Invoices
This case involved a UI finding:
```text
发票未上传至发票栏位:附件中存在定额发票(金额160元、90元),但未上传至发票栏位。
```
Important correction:
- `file-7` and `file-9` were raw attachment objects, not the same objects as the invoice-list entries.
- The invoice list had separate IDs (`ID01P95oy1RWbB`, `ID01P95oy22hnV`).
- The raw attachments had separate file IDs (`file-7` / Hose `ID01P95CwuNGLJ`, and `file-9` / Hose `ID01P95RUC9T79`).
Root of imprecision:
- `file-7` was first described by `image_understanding` as "发票(或收据)", then later attachment review used "定额发票".
- `file-9` was directly described by `image_understanding` as "定额发票".
- Final `approval_review` turned those inherited labels into the rule-3 UI warning.
Manual image check:
- The 160 and 90 slips looked like store-stamped handwritten receipts/sales vouchers.
- They lacked obvious formal invoice elements.
- The customer's objection that they were receipts rather than invoices was reasonable.
However, the final rejection also had an independent rule-37 reason: payment screenshots totaled 699.48 while reimbursement was 700.00.
@@ -1,50 +0,0 @@
# Approval Bad Case Catalog
Use this file only as a comparison catalog after inspecting the current trace. Do not treat any case below as a default diagnosis.
## Case A: Receipt-Like Attachments Labeled As Invoices
Symptom:
- UI finding said attachments contained fixed-amount invoices that were not uploaded to the invoice field.
- Customer said the 160 and 90 slips were receipts, not invoices.
Failure pattern:
- Raw attachment objects and invoice-list objects had similar names/content but different IDs.
- `image_understanding` first introduced loose or wrong labels such as "发票(或收据)" and "定额发票".
- `document_parsing` inherited those labels.
- `approval_review` converted the inherited labels into a rule finding.
Checklist:
- Compare raw attachment IDs and invoice-list IDs before making a claim.
- Inspect the original image for formal invoice elements.
- If the image lacks invoice title, tax supervision seal, invoice code/number, and tax fields, the customer's receipt interpretation may be reasonable.
## Case B: Payment Amount Passed Earlier, Then Excluded Later
Symptom:
- UI finding said payment screenshots totaled only 1550 (`650+900`) against reimbursement amount 3400.
- Customer said the 1850 screenshot was also a payment-support screenshot and should have been included.
Failure pattern:
- The same six images appeared twice: under fee-detail attachments (`file-1` to `file-6`) and form-level attachments (`file-7` to `file-12`).
- `image_understanding` did not lose the 1850 amount; it extracted `1850.00`.
- `pre_analysis` explicitly passed 1850 as a payment-screenshot amount candidate in a review point: "付款截图金额(1850.00元)".
- `document_parsing` later reclassified `1850.jpg` as "收款凭证,非付款截图", overriding the review-point premise.
- Duplicate `900.jpg` entries produced inconsistent parser conclusions; final review included 900 but excluded 1850.
Checklist:
- If an amount is missing from the final total, check whether it was recognized in `image_understanding`.
- If recognized, check whether `pre_analysis` passed it in `attachmentInstructions.reviewPoints`.
- If passed, check whether `document_parsing` ignored or reclassified it.
- If the same image appears under multiple `fileId`s, compare duplicate conclusions before trusting final aggregation.
Important nuance:
- This is a bad-case pattern, not a general rule that every amount-total dispute is caused by `pre_analysis`.
- Use it when the current trace shows recognized amounts being excluded downstream or duplicate attachments producing inconsistent conclusions.
@@ -1,82 +0,0 @@
# Approval Run Lightweight Queries
Use 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.
## Locate A Run By Document Number
Prefer `pick` before broad search + bridge + get.
```bash
seal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest
seal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --batch <batchId> --latest
seal-home approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest --fields recordId,sourceDocumentSN,status,aiDecision,aiSummary
```
Default output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.
If there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.
## Read Compact Run Detail
Use `--summary` for most diagnosis and support questions.
```bash
seal-home approval-runs get <recordId> --summary
```
Use `--fields` when the user needs a particular slice.
```bash
seal-home approval-runs get <recordId> --fields metadata
seal-home approval-runs get <recordId> --fields document.fields,result.summary
seal-home approval-runs get <recordId> --fields result.summary,result.decision,result.riskPoints
seal-home approval-runs get <recordId> --fields document.keyFields,result,manualApprovalRecord,ruleSetVersionNumber
```
Avoid full `approval-runs get <recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.
## Understand The Case First
Before pulling the full document, use:
```bash
seal-home approval-runs document-summary <recordId>
```
This is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.
## Extract AI-Cited Rules
Use this when the user asks "AI 用了哪条规则", "为什么命中这条", or needs the rule evidence for a specific run.
```bash
seal-home approval-runs cited-rules <recordId>
```
Return and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.
If the user then wants the full text of one cited rule, use `rules get --record-id <recordId> --runtime-id rule-205` from `rule-lightweight.md`.
## Attachments Without Raw Payloads
Use:
```bash
seal-home approval-runs attachments <recordId> --summary
```
This should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.
## Result Summary
Use:
```bash
seal-home approval-runs result <recordId> --summary
```
This is for decision, summary, risk point count, matched rule count, trace ID, and record ID.
## Output Discipline
If a command warns that output is large, do not retry with `--full` reflexively. Narrow with `--summary`, `--fields`, or `--output-file` first.
-285
View File
@@ -1,285 +0,0 @@
# Seal Home CLI Reference
Run from any directory after installing the global CLI:
```bash
seal-home <command>
```
Enterprise config lookup:
- If `SEAL_HOME_ENTERPRISES_DIR` is set, only that directory is loaded.
- Otherwise `./enterprises` and `~/.config/seal-home/enterprises` are merged.
- User-level configs override same-ID local configs.
## Top-Level Commands
```bash
seal-home version
seal-home config paths
seal-home service <start|stop|restart|status>
seal-home update
seal-home tools list
seal-home corps list [--corp <corpId>]
seal-home corps current
seal-home corps switch <corpId>
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-home corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-home auth diagnose [--corp <corpId>]
seal-home auth hose-link [--corp <corpId>] [--expire 7200]
seal-home delegation list [--corp <corpId>]
seal-home delegation create [--note <note>] [--corp <corpId>]
seal-home delegation revoke <tokenId> [--corp <corpId>]
seal-home users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
seal-home users reset-password <userId> [--corp <corpId>]
seal-home users get <userId> [--corp <corpId>]
seal-home users delete <userId> [--corp <corpId>]
seal-home llm config [--corp <corpId>]
seal-home llm providers [--corp <corpId>]
seal-home permissions available [--corp <corpId>]
seal-home permissions configs [--corp <corpId>]
seal-home billing status [--corp <corpId>]
seal-home billing plans [--corp <corpId>]
seal-home billing features [--corp <corpId>]
seal-home source config [--corp <corpId>]
seal-home tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-home approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai]
seal-home approval-runs search [--query text] [--limit 20] [--includeBridge true]
seal-home approval-runs get <recordId> [--fields metadata|document.fields,result.summary] [--output-file file.json]
seal-home approval-runs attachments <recordId>
seal-home approval-runs result <recordId> [--summary]
seal-home approval-runs url
seal-home approval-runs url <recordId>
seal-home approval-runs url --sourceDocumentSN <sourceDocumentSN>
seal-home approval-runs bridge [--sourceDocumentSN <sourceDocumentSN>]
seal-home simulation batch-records <batchId>
```
## Fine-Grained Tools
`seal-home version` returns:
```json
{
"name": "seal-home",
"version": "<package version>"
}
```
`seal-home service status` returns the PID, version, state directory, PID file, and log file for the optional local background process.
`seal-home update` updates the git checkout, runs `bun install`, and restarts the local service if it was running.
Identity and session:
- `seal-home auth diagnose [--corp <corpId>]`
- `seal_whoami`
- `seal_session_get`
Approval rule maintenance:
- `seal-home rules count [--corp <corpId>]`
- `seal-home rules list --summary [--corp <corpId>]`
- `seal-home rules clear [--corp <corpId>] [--dry-run|--yes]`
- `seal_approval_rules_list`
- `seal_approval_rules_clear`
- `seal_approval_rule_create`
- `seal_approval_rule_update`
- `seal_approval_rule_delete`
- `seal_approval_rule_versions_list`
- `seal_approval_rule_version_publish`
Approval run lightweight queries:
- `seal-home approval-runs get <recordId> --fields metadata`
- `seal-home approval-runs get <recordId> --summary`
- `seal-home approval-runs pick --sn <单号> --batch <batchId> --latest`
- `seal-home approval-runs document-summary <recordId>`
- `seal-home approval-runs cited-rules <recordId>`
- `seal-home approval-runs get <recordId> --fields document.fields,result.summary`
- `seal-home approval-runs attachments <recordId> --summary`
- `seal-home approval-runs result <recordId> --summary`
- `seal_approval_run_get` with `fields`
- `seal_approval_run_pick`
- `seal_approval_run_cited_rules_get`
- `seal_approval_run_document_summary_get`
- `seal_approval_run_attachments_get`
- `seal_approval_run_result_get` with `{"summary":true}`
Approval knowledge documents:
- `seal_approval_documents_list`
- `seal_approval_document_get`
- `seal_approval_document_create`
- `seal_approval_document_update`
Approval search and context:
- `seal_approval_search`
- `seal_approval_context_get`
- `seal-home rules get --version <number> --code '#0038'`
- `seal-home rules get --record-id <recordId> --runtime-id rule-205`
Style preferences:
- `seal_approval_style_preferences_get`
- `seal_approval_style_preferences_update`
Approval runs, simulations, and Langfuse bridge:
- `seal_approval_runs_search`
- `seal_approval_runs_summary`
- `seal_simulation_batch_records_get`
- `seal_approval_run_langfuse_bridge_get`
## Common Examples
Add and verify a Hose enterprise:
```bash
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-home auth diagnose --corp <corpId>
```
Force-write a Hose config without verification:
```bash
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId","force":true}'
```
Diagnose auth failures:
```bash
seal-home 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:
```bash
seal-home tool seal_approval_search --json '{"keywords":["关键词"],"matchMode":"any","maxResults":20}'
```
Get aggregated approval context:
```bash
seal-home tool seal_approval_context_get --json '{"documentLimit":20}'
```
Create a draft approval rule:
```bash
seal-home tool seal_approval_rule_create --json '{"description":"规则描述","scope":"适用场景","strictness":"SHOULD_FOLLOW"}'
```
Update an approval document:
```bash
seal-home tool seal_approval_document_update --json '{"documentId":"doc-id","content":"Markdown 内容"}'
```
Summarize one local date:
```bash
seal-home approval-runs summary --date 2026-06-09 --timezone Asia/Shanghai --limit 100
```
Find a run and include Langfuse bridge rows:
```bash
seal-home approval-runs search --query <sourceDocumentSN> --limit 20 --includeBridge true
```
Resolve Langfuse trace/session hints:
```bash
seal-home approval-runs bridge --sourceDocumentSN <sourceDocumentSN>
```
Read simulation batch records:
```bash
seal-home simulation batch-records <batchId>
```
## Write Operation Payloads
Create a rule:
```json
{
"description": "规则描述",
"scope": "适用场景",
"strictness": "MUST_FOLLOW | SHOULD_FOLLOW | SUGGESTION"
}
```
Update a rule:
```json
{
"ruleId": "rule-id",
"description": "可选",
"scope": "可选",
"strictness": "SHOULD_FOLLOW"
}
```
Publish a rule version:
```json
{
"versionName": "版本名称"
}
```
Create a document:
```json
{
"title": "标题",
"purpose": "用途",
"content": "Markdown 内容",
"contentType": "text/markdown",
"status": "可选",
"scenarios": ["场景"],
"tags": ["标签"]
}
```
Update a document:
```json
{
"documentId": "doc-id",
"title": "可选",
"purpose": "可选",
"content": "可选",
"enabled": true,
"scenarios": ["可选"],
"tags": ["可选"]
}
```
Update style preferences:
```json
{
"tone": "可选",
"language": "可选",
"detailLevel": "可选",
"outputFormat": "可选",
"examples": ["可选"],
"prohibitedPhrases": ["可选"],
"customInstructions": "可选"
}
```
## Failure Handling
- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. Use `seal-home service restart` after updates so the optional local service picks up new code.
- If no run is found by `sourceDocumentSN`, retry with `sourceDocumentId` or a broader `query`.
- If date-based summaries look wrong, pass `--timezone Asia/Shanghai` and an explicit `--date`.
- If `langfuseTraceId` is missing, use `langfuseSessionFallback`.
- If a write operation fails, report the raw JSON error and do not retry with guessed payloads.
@@ -1,61 +0,0 @@
# Hose Enterprise Auth
Use this reference for Hose/合思 enterprise configuration and user-facing Hose authorization links.
## Add or switch an enterprise
Use the CLI for normal enterprise setup. Do not inspect source code or hand-edit `~/.config/seal-home/enterprises/*.json` unless the CLI fails or the user explicitly asks for low-level config debugging.
```bash
seal-home corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-home corps list
seal-home corps current
seal-home corps switch <corpId>
```
`corps add-hose` 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
```bash
seal-home auth diagnose --corp <corpId>
```
Read the JSON `stages` in order:
- `hose.openapi`: appKey/appSecurity can get a Hose OpenAPI token and corporation ID.
- `hose.provisional`: `proxyStaffBizId`/staff ID can get a provisional auth URL.
- `seal.sso`: Seal accepts the Hose provisional token and returns a bearer session.
- `seal.whoami`: the Seal bearer can read current user and tenant.
Do not expect tokens in the output; the command intentionally redacts or omits them.
## Get a Hose authorization link
When the user asks for a 合思/易快报授权链接、登录链接、入口链接, or says "来一个授权链接" for a Hose sourced enterprise, return the Hose provisional/CloseAPI URL from `getProvisionalAuth`'s `value.message`.
Flow:
1. Obtain an OpenAPI token with appKey/appSecurity:
```text
POST /api/openapi/v1/auth/getAccessToken
body: {"appKey":"...","appSecurity":"..."}
```
2. Call provisional auth:
```text
POST /api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=<openapi-token>
body: {"uid":"corpId:staffId","pageType":"home","expireDate":7200}
```
3. Return the exact `value.message` URL.
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-home 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.
- If the CLI later provides a dedicated command for this, prefer that command.
@@ -1,105 +0,0 @@
# Rule Lightweight Queries
Use this reference when the user wants rule counts, compact rule lists, one rule from a historical version, or approval knowledge search without dumping hundreds of rule descriptions.
## Count Rules
Use count when only scale or existence matters.
```bash
seal-home rules count --corp <corpId>
```
Expected shape:
```json
{ "count": 191 }
```
Tool-layer equivalent:
```bash
seal-home tool seal_approval_rules_list --json '{"countOnly":true}'
seal-home tool seal_approval_rules_list --json '{"fields":["id"],"limit":0}'
```
## List Rule Summaries
Use summaries for navigation and selection.
```bash
seal-home rules list --corp <corpId> --summary
```
Default summary should include only fields such as `id`, `scope`, `strictness`, `status`, and `updatedAt`. Do not pull `description` unless the user needs rule text.
Tool-layer equivalent:
```bash
seal-home tool seal_approval_rules_list --json '{"fields":["id","scope","strictness","status","updatedAt"]}'
```
## Clear Draft Rules Before Import
Use this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.
```bash
seal-home rules clear --corp <corpId> --dry-run
seal-home rules clear --corp <corpId> --yes
```
Expected shape:
```json
{
"corpId": "xiezihao",
"dryRun": false,
"beforeCount": 49,
"deleted": 49,
"afterCount": 0
}
```
Tool-layer equivalent:
```bash
seal-home tool seal_approval_rules_clear --json '{"dryRun":true}'
seal-home tool seal_approval_rules_clear --json '{"dryRun":false}'
```
## Get One Historical Rule
Use this when a run used a historical rule version and current rules may differ.
```bash
seal-home rules get --version 16 --code '#0038'
seal-home rules get --version latest --code '#0038'
```
If the user starts from a run and a runtime ID such as `rule-205`, resolve against that run:
```bash
seal-home rules get --record-id <recordId> --runtime-id rule-205
```
Return the single rule text plus `scope`, `strictness`, `status`, `versionNumber`, and version metadata. Avoid commands that dump a whole rule version unless the user asks for the full version.
## Search Approval Knowledge Compactly
Prefer scoped and trimmed search:
```bash
seal-home tool seal_approval_search --json '{"keywords":["关键词"],"areas":["rules"],"matchMode":"any","maxResults":20,"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
```
When investigating historical behavior, search the matching rule version if the API supports it:
```bash
seal-home tool seal_approval_search --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","versionNumber":16,"snippetOnly":true,"maxChars":500}'
```
Use current search only when the question is about current draft/current knowledge, not why a historical run behaved a certain way.
## Output Discipline
If a rule command would return many descriptions or more than about 20 rules, use `rules count`, `rules list --summary`, `fields`, `snippetOnly`, or `--output-file`. Use `--full` only for deliberate exports.