From 941a1597c02bef1b0c4c28e0f5a6c1b36386198b Mon Sep 17 00:00:00 2001 From: yunyingk Date: Tue, 22 Sep 2026 13:46:16 +0800 Subject: [PATCH] Clarify Hose elevation flag --- skills/seal-use/SKILL.md | 2 +- skills/seal-use/references/cli.md | 4 +-- .../references/enterprise-onboarding.md | 8 +++--- src/cli/commands/corps.test.ts | 26 ++++++++++++++----- src/cli/commands/corps.ts | 15 +++++++---- src/cli/help.ts | 4 +-- 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/skills/seal-use/SKILL.md b/skills/seal-use/SKILL.md index fbffb11..b742807 100644 --- a/skills/seal-use/SKILL.md +++ b/skills/seal-use/SKILL.md @@ -83,7 +83,7 @@ metadata: 命令保持扁平兼容以避免破坏现有脚本;`seal-use corps --help` 会按上述业务组展示,不代表这些命令属于同一风险等级。涉及本地配置或测试数据写入的操作仍须遵守确认与预览规则。 -Hose 专属命令必须从命令名上显式可见:认证入口使用 `auth hose-*`,合思原生审批流使用 `approval-runs hose-flow`,部署入口使用 `deploy hosecloud ...`,模拟入口使用 `simulation --mode hosecloud`。跨 Seal/Hose 的混合命令保留通用名称,但必须通过 `--as-hose`、`--with-flow` 或 `--type hose-document` 明确选择 Hose 能力。 +Hose 专属命令必须从命令名上显式可见:认证入口使用 `auth hose-*`,合思原生审批流使用 `approval-runs hose-flow`,部署入口使用 `deploy hosecloud ...`,模拟入口使用 `simulation --mode hosecloud`。跨 Seal/Hose 的混合命令保留通用名称,但必须通过 `--elevate-hose`、`--with-flow` 或 `--type hose-document` 明确选择 Hose 能力。 ### 2.1 企业定位与直达访问 - 关键字智能搜索(支持同音字/拼音/简拼/容错):`seal-use corps search ` diff --git a/skills/seal-use/references/cli.md b/skills/seal-use/references/cli.md index f73975f..dac7740 100644 --- a/skills/seal-use/references/cli.md +++ b/skills/seal-use/references/cli.md @@ -89,7 +89,7 @@ seal-use corps sync-test [] [--dry-run] [--yes] [--version-name ] [--record-id ] [--sn ] [--limit ] [--status ] [--webhook ] [--sn-suffix ] [--dry-run] [--confirm|--yes] [--force] 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 [--name ] [--as-hose] [--app-key ] [--key-id ] [--overwrite] [--dry-run] +seal-use corps add-link [--name ] [--elevate-hose] [--app-key ] [--key-id ] [--overwrite] [--dry-run] seal-use corps probe-hose --json '{"appKey":"...","appSecurity":"...","domain":"https://..."}' seal-use corps hose-staffs --json '{"appKey":"...","appSecurity":"...","role":"admin"}' seal-use corps hose-extract-keys [--reveal] [--save] [--name ] [--app-key ] [--key-id ] [--overwrite] @@ -212,7 +212,7 @@ Enterprise and tenant management (`corps` is the enterprise-context entry point) Use the command groups in this order for normal work: **enterprise onboarding** → **discovery and selection** → **environment configuration** → **test pairing and verification**. Hose probing, staff discovery, key extraction, and key inspection are secondary capabilities for Hose-sourced enterprises. -- `seal-use corps add-link [--name ] [--as-hose] [--app-key ] [--key-id ] [--overwrite] [--dry-run]` is the preferred onboarding entry point: it auto-detects a Seal native delegate link or a Hose assistance link. Native Seal links are registered as native Seal enterprises; Hose links can remain short-lived or use `--as-hose` for durable Hose credentials. `--dry-run` never writes local config. +- `seal-use corps add-link [--name ] [--elevate-hose] [--app-key ] [--key-id ] [--overwrite] [--dry-run]` is the preferred onboarding entry point: it auto-detects a Seal native delegate link or a Hose assistance link. Native Seal links are registered as native Seal enterprises; Hose links can remain short-lived or use `--elevate-hose` for durable Hose credentials. The legacy `--as-hose` alias remains accepted for compatibility. `--dry-run` never writes local config. - `seal-use corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"..."}'` registers a native Seal enterprise directly. - `seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"..."}'` registers a Hose enterprise from durable OpenAPI credentials. - `seal-use corps list [query] [--env ] [--limit ] [--all] [--strict] [--corp ]` (defaults to displaying the top 10 most frequently used enterprises in the last 7 days; sorting is automatic and query results keep relevance order) diff --git a/skills/seal-use/references/enterprise-onboarding.md b/skills/seal-use/references/enterprise-onboarding.md index d95da04..68b5c99 100644 --- a/skills/seal-use/references/enterprise-onboarding.md +++ b/skills/seal-use/references/enterprise-onboarding.md @@ -39,7 +39,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 `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 | Hose authorization/assistance link (`thirdparty.html`) | 【两极分化】普通导入→短效;提权→永久 | Temporary session that can be **elevated** to permanent `appKey`/`appSecurity` with `extract-keys --save` or `add-link --elevate-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. | | Seal-native tenant | Seal assistance/delegation link | 【临时·可撤销】 | Temporary delegated access to a Seal tenant. | @@ -84,7 +84,7 @@ First distinguish the link by its host, purpose, and identity origin: - **Seal-Native Delegation Link (默认第一公民)**: `https://.sealai.cc/delegate?token=...` grants delegated access directly on a Seal tenant. Running `seal-use corps add-link ` automatically exchanges the delegation token via `/api/v1/delegation/consume`, receives the session, retrieves tenant and user info via `/api/v1/auth/me`, and registers a native Seal enterprise (`provider: "seal"`). Supports `--dry-run` to preview metadata without mutating local config. - **Hose/合思 Assistance Link**: `https:///web/thirdparty.html?...` opens an upstream Hose session and continues through Seal SSO. Running standard `seal-use corps add-link ` exchanges that temporary token for a short-lived Seal Bearer token. -- **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`. To elevate to permanent Hose OpenAPI developer credentials, use `corps hose-extract-keys --save` or `corps add-link --as-hose`. (Note: `--as-hose` cannot be used on Seal-native delegation links). +- **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`. To elevate to permanent Hose OpenAPI developer credentials, use `corps hose-extract-keys --save` or `corps add-link --elevate-hose`. (Note: `--elevate-hose` cannot be used on Seal-native delegation links; `--as-hose` remains a deprecated compatibility alias). - **Multi-Key Disambiguation (多套密钥明确抉择)**: If the Hose 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 ` or `--key-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. @@ -95,7 +95,7 @@ First distinguish the link by its host, purpose, and identity origin: seal-use corps add-link "https://.sealai.cc/delegate?token=..." [--name "企业名称"] [--dry-run] # 2. 接入合思协助链接并提权为标准持久化合思企业配置: -seal-use corps add-link "" --as-hose [--name "企业名称"] +seal-use corps add-link "" --elevate-hose [--name "企业名称"] # 或通过 extract-keys 提取保存: seal-use corps hose-extract-keys "" --save [--name "企业名称"] @@ -113,7 +113,7 @@ seal-use corps hose-keys [--reveal] seal-use auth hose-keys --corp [--reveal] ``` -When using standard `add-link` with a Seal delegate link, it consumes the token directly against the Seal tenant and persists the verified Seal session. When using standard `add-link` with a Hose link (without `--as-hose`), it exchanges the temporary Hose token at the target Seal tenant and stores the short-lived Seal session. When `--as-hose` is used on a Hose link, the CLI executes Hose subdomain privilege elevation to register a durable standard Hose configuration. +When using standard `add-link` with a Seal delegate link, it consumes the token directly against the Seal tenant and persists the verified Seal session. When using standard `add-link` with a Hose link (without `--elevate-hose`), it exchanges the temporary Hose token at the target Seal tenant and stores the short-lived Seal session. When `--elevate-hose` is used on a Hose link, the CLI executes Hose subdomain privilege elevation to register a durable standard Hose configuration. The legacy `--as-hose` alias remains accepted for compatibility. Assistance links are credentials. Do not follow a link merely to inspect it when the user's request was only explanatory, and never publish, log, or commit it. diff --git a/src/cli/commands/corps.test.ts b/src/cli/commands/corps.test.ts index 6aeaa48..b819bbe 100644 --- a/src/cli/commands/corps.test.ts +++ b/src/cli/commands/corps.test.ts @@ -171,14 +171,14 @@ describe("corps link onboarding", () => { expect(readDirectory(enterprises)).toEqual([]); }); - test("rejects --as-hose when passed with a Seal native delegate link", async () => { + test("rejects --elevate-hose when passed with a Seal native delegate link", async () => { mockSealLinkRequests(); const link = "https://acme-01.sealai.cc/delegate?token=del-tok"; - const result = await runCli(["corps", "add-link", link, "--as-hose"]); + const result = await runCli(["corps", "add-link", link, "--elevate-hose"]); expect(result.isError).toBe(true); - expect(result.stderr).toContain("Option --as-hose cannot be used with a Seal native delegate link"); + expect(result.stderr).toContain("Option --elevate-hose cannot be used with a Seal native delegate link"); }); test("rejects a link when Seal identity does not match ekbCorpId", async () => { @@ -744,12 +744,12 @@ describe("Hose OpenAPI key extraction from assistance link", () => { expect(config.source.staffId).toBe("acme-01:admin01"); }); - test("corps add-link --as-hose automatically registers as Hose OpenAPI configuration", async () => { + test("corps add-link --elevate-hose automatically registers as Hose OpenAPI configuration", async () => { const enterprises = setupConfigEnv(); mockHoseKeysRequests(); const link = hoseLink(); - const result = await runCli(["corps", "add-link", link, "--as-hose", "--name", "Acme Auto Hose", "--force"]); + const result = await runCli(["corps", "add-link", link, "--elevate-hose", "--name", "Acme Auto Hose", "--force"]); expect(result.isError).toBe(false); expect(result.exitCode).toBe(0); @@ -763,11 +763,11 @@ describe("Hose OpenAPI key extraction from assistance link", () => { expect(config.source.appSecurity).toBe("sec_secret_password_456789"); }); - test("corps add-link --as-hose --dry-run does not save a Hose configuration", async () => { + test("corps add-link --elevate-hose --dry-run does not save a Hose configuration", async () => { const enterprises = setupConfigEnv(); mockHoseKeysRequests(); - const result = await runCli(["corps", "add-link", hoseLink(), "--as-hose", "--dry-run"]); + const result = await runCli(["corps", "add-link", hoseLink(), "--elevate-hose", "--dry-run"]); expect(result.isError).toBe(false); const parsed = JSON.parse(result.stdout); @@ -783,6 +783,18 @@ describe("Hose OpenAPI key extraction from assistance link", () => { expect(readDirectory(enterprises)).toEqual([]); }); + test("corps add-link keeps --as-hose as a deprecated compatibility alias", async () => { + const enterprises = setupConfigEnv(); + mockHoseKeysRequests(); + + const result = await runCli(["corps", "add-link", hoseLink(), "--as-hose", "--force"]); + + expect(result.isError).toBe(false); + expect(result.exitCode).toBe(0); + expect(result.stderr).toContain("'--as-hose' is deprecated"); + expect(existsSync(join(enterprises, "acme-01.json"))).toBe(true); + }); + test("auth extract-keys alias works before any enterprise is configured", async () => { setupConfigEnv(); mockHoseKeysRequests(); diff --git a/src/cli/commands/corps.ts b/src/cli/commands/corps.ts index 09b4c2b..b5e5fd1 100644 --- a/src/cli/commands/corps.ts +++ b/src/cli/commands/corps.ts @@ -1045,17 +1045,22 @@ export async function handleCorpsCommand(action: string | undefined, maybeName: const link = maybeName ?? stringOption(args.options.link) ?? stringOption(args.options.url); if (!link) { throw new Error( - "Usage: seal-use corps add-link [--name ] [--as-hose] [--overwrite]" + "Usage: seal-use corps add-link [--name ] [--elevate-hose] [--overwrite]" ); } const dryRun = booleanOption(args.options["dry-run"]) === true || booleanOption(args.options.dryRun) === true; - const asHose = booleanOption(args.options["as-hose"]) === true || booleanOption(args.options.hose) === true; - if (asHose) { + const legacyAsHose = + booleanOption(args.options["as-hose"]) === true || booleanOption(args.options.hose) === true; + const elevateHose = booleanOption(args.options["elevate-hose"]) === true || legacyAsHose; + if (legacyAsHose && !booleanOption(args.options["elevate-hose"])) { + console.error("⚠️ Notice: '--as-hose' is deprecated; use '--elevate-hose' to request Hose credential elevation."); + } + if (elevateHose) { const scores = scoreAssistLink(link); const winner = scores[0]; if (winner?.kind === "seal-delegate") { throw new Error( - "Option --as-hose cannot be used with a Seal native delegate link. Seal delegate links directly authenticate to Seal." + "Option --elevate-hose cannot be used with a Seal native delegate link. Seal delegate links directly authenticate to Seal." ); } await addLinkAsHoseCorp( @@ -1735,7 +1740,7 @@ async function addLinkAsHoseCorp( result.keys, result.corpId, selection ?? {}, - `seal-use corps add-link "" --as-hose` + `seal-use corps add-link "" --elevate-hose` ); console.error( dryRun diff --git a/src/cli/help.ts b/src/cli/help.ts index 2193c20..8110c18 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -173,12 +173,12 @@ export const HELP_REGISTRY: AreaHelp[] = [ group: "企业接入", summary: "Import enterprise configuration from a Seal delegation link or Hose assistance link", usage: [ - "seal-use corps add-link [--name ] [--as-hose] [--app-key ] [--key-id ] [--overwrite] [--dry-run]" + "seal-use corps add-link [--name ] [--elevate-hose] [--app-key ] [--key-id ] [--overwrite] [--dry-run]" ], options: [ { flag: "--name ", description: "Optional custom name for the enterprise" }, { flag: "--dry-run", description: "Preview link resolution and tenant metadata without saving" }, - { flag: "--as-hose", description: "【合思子域提权】从协助链接提取 OpenAPI 密钥并将临时会话升级为长期合思标准配置" }, + { flag: "--elevate-hose", description: "【明确提权】从合思协助链接提取 OpenAPI 密钥并将临时会话升级为长期标准配置(旧别名:--as-hose)" }, { flag: "--app-key ", description: "企业存在多套密钥时,指定使用的 appKey" }, { flag: "--key-id ", description: "企业存在多套密钥时,指定使用的 keyId" }, { flag: "--overwrite", description: "Overwrite existing enterprise config" }