diff --git a/README.md b/README.md index 579cb33..eea650d 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ seal-use update # Future self-update directly from GitHub Release For local development from source with Bun: -For an already-authenticated Seal-native source, use `seal-use corps add-seal` or copy `enterprises/example.seal.json`. Existing `direct` configs remain supported via `enterprises/example.direct.json`. +For an already-authenticated Seal-native source, use `seal-use corps add-seal-bearer` or copy `enterprises/example.seal.json`. Existing `direct` configs remain supported via `enterprises/example.direct.json`. ## Public Usage @@ -89,11 +89,19 @@ seal-use tools list Create a user-level Seal-native enterprise config from an already signed-in Seal Use page: ```bash -seal-use corps add-seal --json '{"sealUrl":"https://tenant.staging.sealai.cc","token":"seal-bearer-token"}' +seal-use corps add-seal-bearer --json '{"sealUrl":"https://tenant.staging.sealai.cc","token":"seal-bearer-token"}' seal-use auth diagnose --corp tenant ``` -`corps add-seal` verifies `/api/v1/auth/me` by default and writes the tenant slug, tenant ID, tenant name, and provider user ID into local config metadata. Pass `"force":true` or `"verify":false` only when writing an offline config intentionally. +`corps add-seal-bearer` verifies `/api/v1/auth/me` by default and writes the tenant slug, tenant ID, tenant name, and provider user ID into local config metadata. Pass `"force":true` or `"verify":false` only when writing an offline config intentionally. The old `add-seal` spelling remains a compatibility alias. + +When the Agent receives a cURL copied from an authenticated Hose page, it first attempts to extract durable OpenAPI credentials. If that is not possible, it can import the normalized Hose web session and exchange it for a temporary Seal session: + +```bash +seal-use corps add-hose-web-session --json '{"baseUrl":"https://wx2.ekuaibao.com","corpId":"...","accessToken":"..."}' +``` + +The Hose `accessToken` is not a Seal Bearer Token and must not be passed to `add-seal-bearer` directly. `add-hose-web-session` stores only the resulting short-lived Seal session; it does not create or persist Hose OpenAPI credentials. Import a Hose/合思 assistance link when you do not have OpenAPI app credentials: diff --git a/skills/seal-use/SKILL.md b/skills/seal-use/SKILL.md index b79ee90..9b73959 100644 --- a/skills/seal-use/SKILL.md +++ b/skills/seal-use/SKILL.md @@ -22,11 +22,11 @@ metadata: | 用户材料 | Agent 预处理后的标准入口 | 说明 | |---|---|---| | 合思开放平台 `appKey + appSecurity` | `corps add-hose-persistent` | 纯 Hose 长期凭据入口;自动探测域名、企业和管理员。 | -| Seal URL + Bearer Token,或从 Seal 后台复制的 cURL | `corps add-seal` | 两者是同一类 Seal 会话凭据;cURL 只需提取必要字段后再调用 `add-seal`。 | +| Seal URL + Bearer Token,或从 Seal 后台复制的 cURL | `corps add-seal-bearer` | 两者是同一类 Seal 会话凭据;cURL 只需提取必要字段后再调用 `add-seal-bearer`。 | | Seal 原生委托链接,或合思协助链接 | `corps add-link` | `add-link` 是 URL 混合入口,自动识别 Seal 与 Hose 链接;它不直接接收 cURL。 | -| 从已登录合思管理员页面复制的 cURL | 优先提取密钥后调用 `corps add-hose-persistent`;失败时经 Hose→Seal SSO 换取 Seal Bearer 后调用 `corps add-seal` | Hose `accesstoken` 与 Seal Bearer 不是同一种 token;不能直接混用。 | +| 从已登录合思管理员页面复制的 cURL | 优先提取密钥后调用 `corps add-hose-persistent`;失败时调用 `corps add-hose-web-session` | Hose `accesstoken` 与 Seal Bearer 不是同一种 token;不能直接混用。 | -**Token 类型不得混用**:`add-seal` 只接受 Seal Bearer Token;合思网页 cURL 中的 `accesstoken` 只能用于 Hose API 和密钥提取,提取失败后必须先经 SSO 换成 Seal Bearer,不能直接作为 `add-seal` 的 `token`。 +**Token 类型不得混用**:`add-seal-bearer` 只接受 Seal Bearer Token;合思网页 cURL 中的 `accesstoken` 只能用于 Hose API 和密钥提取,提取失败后由 `add-hose-web-session` 经 SSO 换成 Seal Bearer,不能直接作为 `add-seal-bearer` 的 `token`。 `add-link` 的默认行为是导入临时会话。只有明确使用 `--elevate-hose` 时,才执行合思提权并提取长期 OpenAPI 凭据;`--as-hose` 仅作为兼容旧参数,不作为 Agent 的默认表达。 @@ -78,7 +78,7 @@ metadata: ![网络Fetch/XHR](assets/hose-curl-network-fetch-xhr.png) 3. 找到任一正常业务请求,右键「复制」-「以 cURL 格式复制」: ![以cURL格式复制](assets/hose-curl-copy-as-curl.png) -3. **无感接入**:Agent 接收材料后自动执行 `corps add-hose-persistent`、`corps add-seal`、`corps add-link` 或 `corps hose-extract-keys --save`,系统自动反查拉取真实企业中文名,自动绑定管理员,完成接入。无需用户手动查找 `corpId` 或 `staffId`。详阅 `references/first-time-user.md` 与 `references/enterprise-onboarding.md`。 +3. **无感接入**:Agent 接收材料后自动执行 `corps add-hose-persistent`、`corps add-hose-web-session`、`corps add-seal-bearer`、`corps add-link` 或 `corps hose-extract-keys --save`,系统自动反查拉取真实企业中文名,自动绑定管理员,完成接入。无需用户手动查找 `corpId` 或 `staffId`。详阅 `references/first-time-user.md` 与 `references/enterprise-onboarding.md`。 --- @@ -90,7 +90,7 @@ metadata: `corps` 是企业上下文的总入口,推荐按“接入 → 发现与选择 → 环境配对 → 测试验证”的主线使用;Hose 能力是针对合思来源企业的专属子域,不应覆盖原生 Seal 主流程。 -- **企业接入(主入口)**:`add-link`(自动识别 Seal 原生委托链接或 Hose 协助链接,原生 Seal 优先)、`add-seal`、`add-hose-persistent`。 +- **企业接入(主入口)**:`add-link`(自动识别 Seal 原生委托链接或 Hose 协助链接,原生 Seal 优先)、`add-seal-bearer`、`add-hose-persistent`、`add-hose-web-session`。 - **发现与选择(高频管理)**:`list`、`search`/`find`、`get`/`show`、`current`、`switch`。 - **企业配置(低频维护)**:`mark`、`rename`。 - **测试配对与验证(生产变更闭环)**:`bind-test`、`unbind-test`、`sync-test`、`replay-test`;回归测试统一使用 `seal-use test regression`。 diff --git a/skills/seal-use/references/cli.md b/skills/seal-use/references/cli.md index 1d258da..bf8089a 100644 --- a/skills/seal-use/references/cli.md +++ b/skills/seal-use/references/cli.md @@ -88,7 +88,7 @@ seal-use corps unbind-test [] [--confirm] seal-use corps sync-test [] [--dry-run] [--yes] [--version-name ] seal-use corps replay-test [] [--record-id ] [--sn ] [--limit ] [--status ] [--webhook ] [--sn-suffix ] [--dry-run] [--confirm|--yes] [--force] seal-use corps add-hose-persistent --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-seal-bearer --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}' 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"}' @@ -213,7 +213,8 @@ 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 ] [--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-seal-bearer --json '{"sealUrl":"https://tenant.sealai.cc","token":"..."}'` registers a native Seal enterprise directly from a Seal Bearer Token. The old `add-seal` spelling remains a compatibility alias. +- `seal-use corps add-hose-web-session --json '{"baseUrl":"https://wx2.ekuaibao.com","corpId":"...","accessToken":"..."}'` imports a normalized Hose web session (for example, parsed from a Hose admin cURL) and exchanges it for a short-lived Seal Bearer session. It does not create or save OpenAPI `appKey/appSecurity` credentials. - `seal-use corps add-hose-persistent --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"..."}'` registers and persists a Hose enterprise from durable OpenAPI credentials. The old `add-hose` spelling remains a compatibility alias. - `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) - `seal-use corps search [--env ] [--strict]` (intelligent soft search by default: case-insensitive, Chinese homophones, front/back nasal vowels, flat/retroflex consonants, initials, typo/missing letter tolerance; pass `--strict` for exact substring match) diff --git a/skills/seal-use/references/enterprise-onboarding.md b/skills/seal-use/references/enterprise-onboarding.md index 9f4a82e..903d133 100644 --- a/skills/seal-use/references/enterprise-onboarding.md +++ b/skills/seal-use/references/enterprise-onboarding.md @@ -42,7 +42,7 @@ Classify both the enterprise identity origin and how the current credential was | 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`. | | Seal-native tenant | Seal assistance/delegation link | 【临时·可撤销】 | Temporary delegated access to a Seal tenant. | -| Seal-native tenant | Seal URL + Bearer Token, or cURL copied from an authenticated Seal page | 【短效会话快照】 | Both normalize to `add-seal`; the cURL is only a transport format for the same Seal Bearer credential. | +| Seal-native tenant | Seal URL + Bearer Token, or cURL copied from an authenticated Seal page | 【短效会话快照】 | Both normalize to `add-seal-bearer`; the cURL is only a transport format for the same Seal Bearer credential. | **同等凭据原则(Equal Credential Scope Principle)**: A Hose assistance link and a browser cURL from an authenticated Hose admin session are both Hose web frontend sessions — they carry the same underlying `accessToken`/`accesstoken` and `corpid`. The **only** structural difference is delivery format. When a Hose administrator sends you a cURL, treat it with the same privilege elevation potential as an assistance link. Do not downgrade it to a plain Seal session import without first attempting key extraction. @@ -52,9 +52,9 @@ Credential shape alone does not define identity origin. In particular, a Hose-so The Hose web-session `accesstoken` and the Seal Bearer Token are different credentials and are not interchangeable: -- `corps add-seal` accepts the Seal Bearer Token together with `sealUrl`. -- A Hose cURL's `accesstoken` is used first for Hose key extraction. If no permanent OpenAPI key can be extracted, exchange the Hose session through Seal SSO and only then call `add-seal` with the resulting Seal Bearer Token. -- Never pass a Hose `accesstoken` directly as the `token` field of `add-seal`. +- `corps add-seal-bearer` accepts the Seal Bearer Token together with `sealUrl`. +- A Hose cURL's `accesstoken` is used first for Hose key extraction. If no permanent OpenAPI key can be extracted, call `add-hose-web-session`; it exchanges the Hose session through Seal SSO and stores the resulting short-lived Seal Bearer session. +- Never pass a Hose `accesstoken` directly as the `token` field of `add-seal-bearer`. ## Parameter Ownership @@ -147,7 +147,7 @@ This is functionally equivalent to a Hose assistance link. Both carry the same u 1. Treat the entire cURL as a secret. Do not echo it, execute it blindly, paste it into another service, or store it in repository files. 2. Extract: the request hostname (determines `baseUrl`), `accesstoken` header (session token), `corpid` header or cookie, and any other Hose session headers. 3. **Privilege elevation path (preferred)**: Use extracted `accesstoken`, `corpid`, and `baseUrl` to call `/api/innerapi/v1/key`, exactly as `corps hose-extract-keys` does for assistance links. This retrieves permanent `appKey`/`appSecurity` to register a durable Hose enterprise configuration — do not skip this step just because the input is a cURL instead of a URL. -4. **Fallback short-term path**: If the session user is not an administrator and the key interface returns no keys, fall back to the Seal SSO bridge to register a temporary Seal session. +4. **Fallback short-term path**: If the session user is not an administrator and the key interface returns no keys, pass the normalized Hose session to `corps add-hose-web-session`; it uses the Seal SSO bridge to register a temporary Seal session. 5. If key extraction succeeds, inform the user that credentials have been permanently elevated; if it fails, explain the limitation and suggest the administrator copy a dedicated cURL or provide an assistance link or `appKey`/`appSecurity`. ``` @@ -162,11 +162,11 @@ This is functionally equivalent to a Hose assistance link. Both carry the same u 1. Treat the entire cURL as a secret. 2. Parse it as data. Extract the request host, path, `Authorization: Bearer ...` header, and provider/tenant hints. -3. Verify with `/api/v1/auth/me` through `seal-use corps add-seal`; use returned provider metadata to retain the actual origin. +3. Verify with `/api/v1/auth/me` through `seal-use corps add-seal-bearer`; use returned provider metadata to retain the actual origin. 4. Persist only the normalized minimum configuration needed by seal-use. ```bash -seal-use corps add-seal --json '{"sealUrl":"https://target-tenant.example","token":""}' +seal-use corps add-seal-bearer --json '{"sealUrl":"https://target-tenant.example","token":""}' ``` If the captured request contains only cookies or an authentication shape the CLI cannot verify, do not improvise a token. Ask the user to copy another successful Seal Fetch/XHR request that contains the Bearer header, or explain the current limitation. diff --git a/skills/seal-use/references/first-time-user.md b/skills/seal-use/references/first-time-user.md index a3698d3..25dcf1f 100644 --- a/skills/seal-use/references/first-time-user.md +++ b/skills/seal-use/references/first-time-user.md @@ -71,8 +71,8 @@ macOS 也可以使用 `Option + Command + I`;Windows 常见快捷键是 `F12` 助手会先判断这条请求来自合思网页还是 Seal 网页: -- **合思网页**:读取请求主机、Hose `accesstoken` 和企业标识。若当前登录人具备管理员权限,优先提取长期 OpenAPI 凭据并调用 `add-hose-persistent`;否则先经 Hose→Seal SSO 换取 Seal Bearer,再调用 `add-seal`。 -- **Seal 网页**:读取 Seal 主机和 Bearer 会话,整理为 `sealUrl + token` 后调用 `add-seal`。 +- **合思网页**:读取请求主机、Hose `accesstoken` 和企业标识。若当前登录人具备管理员权限,优先提取长期 OpenAPI 凭据并调用 `add-hose-persistent`;否则调用 `add-hose-web-session`,由它经 Hose→Seal SSO 换取临时 Seal Bearer。 +- **Seal 网页**:读取 Seal 主机和 Bearer 会话,整理为 `sealUrl + token` 后调用 `add-seal-bearer`。 注意:cURL 是 Agent 的输入材料,不是 `add-link` 的参数。`add-link` 只接收 Seal 委托链接或合思协助链接,并负责自动识别这两类 URL。 diff --git a/src/cli/commands/corps.test.ts b/src/cli/commands/corps.test.ts index 5a7ed45..5f8e94e 100644 --- a/src/cli/commands/corps.test.ts +++ b/src/cli/commands/corps.test.ts @@ -171,6 +171,30 @@ describe("corps link onboarding", () => { expect(readDirectory(enterprises)).toEqual([]); }); + test("imports a normalized Hose web session and stores a temporary Seal session", async () => { + const enterprises = setupConfigEnv(); + mockSealLinkRequests(); + + const result = await runCli([ + "corps", + "add-hose-web-session", + "--json", + JSON.stringify({ + baseUrl: "https://wx2.ekuaibao.com", + corpId: "Acme-01", + accessToken: "hose-token" + }) + ]); + + expect(result.isError).toBe(false); + expect(result.exitCode).toBe(0); + const config = JSON.parse(readFileSync(join(enterprises, "acme-01.json"), "utf-8")); + expect(config.source.type).toBe("seal"); + expect(config.source.provider).toBe("hosecloud"); + expect(config.source.token).toBe("seal-bearer-token"); + expect(config.source.expiresIn).toBe(1800); + }); + test("rejects --elevate-hose when passed with a Seal native delegate link", async () => { mockSealLinkRequests(); @@ -204,6 +228,15 @@ describe("corp compatibility alias", () => { expect(result.stderr).not.toContain("Unknown corps action"); }); + test("exposes add-seal-bearer as the canonical Seal onboarding command", async () => { + setupConfigEnv(); + const result = await runCli(["corps", "add-seal-bearer", "--json", "{}"]); + + expect(result.isError).toBe(true); + expect(result.stderr).toContain("Missing required JSON field: token"); + expect(result.stderr).not.toContain("Unknown corps action"); + }); + test("seal-use corp list executes and resolves cleanly like seal-use corps", async () => { setupConfigEnv(); const result = await runCli(["corp", "list"]); diff --git a/src/cli/commands/corps.ts b/src/cli/commands/corps.ts index ab087db..0d83e13 100644 --- a/src/cli/commands/corps.ts +++ b/src/cli/commands/corps.ts @@ -53,6 +53,7 @@ import { optionalNumber, optionalString, requiredString, + requiredStringAlias, safeFileName, stringOption } from "../parser.js"; @@ -151,7 +152,7 @@ export async function handleCorpsCommand(action: string | undefined, maybeName: } if (allCorps.length === 0) { - console.error("提示:当前未检测到企业配置。你可以使用 seal-use corps add-hose-persistent 或 seal-use corps add-seal 添加企业,或运行 seal-use help 查看说明。"); + console.error("提示:当前未检测到企业配置。你可以使用 seal-use corps add-hose-persistent、add-hose-web-session 或 add-seal-bearer 添加企业,或运行 seal-use help 查看说明。"); } else if (isStrict && filtered.length === 0 && (action === "search" || action === "find") && rawQuery) { console.error(`提示:未在严格模式下匹配到企业 "${rawQuery}"。可以尝试省略 --strict 进行智能软搜索。`); } @@ -1029,7 +1030,28 @@ export async function handleCorpsCommand(action: string | undefined, maybeName: return; } - if (action === "add-seal") { + if (action === "add-hose-web-session") { + const jsonPayload = jsonObject(args.json); + const merged = { + ...jsonPayload, + ...(args.options.name ? { name: stringOption(args.options.name) } : {}), + ...(args.options.domain ? { baseUrl: stringOption(args.options.domain) } : {}), + ...(args.options["base-url"] ? { baseUrl: stringOption(args.options["base-url"]) } : {}), + ...(args.options.corpId ? { corpId: stringOption(args.options.corpId) } : {}), + ...(args.options["corp-id"] ? { corpId: stringOption(args.options["corp-id"]) } : {}), + ...(args.options.accessToken ? { accessToken: stringOption(args.options.accessToken) } : {}), + ...(args.options["access-token"] ? { accessToken: stringOption(args.options["access-token"]) } : {}), + ...(args.options.overwrite !== undefined ? { overwrite: booleanOption(args.options.overwrite) } : {}), + ...(args.options["dry-run"] !== undefined ? { dryRun: booleanOption(args.options["dry-run"]) } : {}) + }; + await addHoseWebSessionCorp(merged); + return; + } + + if (action === "add-seal-bearer" || action === "add-seal") { + if (action === "add-seal") { + console.error("⚠️ Notice: 'add-seal' is a compatibility alias; use 'add-seal-bearer' for Seal Bearer credentials."); + } const jsonPayload = jsonObject(args.json); const merged = { ...jsonPayload, @@ -1555,6 +1577,50 @@ async function addSealCorp(input: Record) { writeSealCorpConfig(input, { token, sealUrl, expiresIn, verify, remote, custom }); } +async function addHoseWebSessionCorp(input: Record) { + const accessToken = requiredStringAlias(input, ["accessToken", "accesstoken"]); + const corpId = requiredStringAlias(input, ["corpId", "ekbCorpId", "corporationId"]); + const baseUrl = optionalString(input, "baseUrl") ?? optionalString(input, "domain"); + const session = await exchangeHoseAssistLink({ corpId, accessToken, baseUrl }); + const client = createSealClientForUrl(session.sealUrl, session.token); + const me = await getMe(client); + const identity = { + user: me.user as unknown as Record, + tenant: me.tenant as unknown as Record + }; + + assertHoseAssistTenantMatches(session.corpId, identity.tenant); + if (input.dryRun === true) { + printJson({ + dryRun: true, + kind: "hose-web-session", + corpId: session.corpId, + sealUrl: session.sealUrl, + tenant: identity.tenant, + user: identity.user, + expiresIn: session.expiresIn + }); + return; + } + + writeSealCorpConfig( + { + id: session.corpId, + corpId: session.corpId, + name: optionalString(input, "name"), + provider: "hosecloud", + overwrite: input.overwrite === true + }, + { + token: session.token, + sealUrl: session.sealUrl, + expiresIn: session.expiresIn, + verify: true, + remote: identity + } + ); +} + // Validates extra headers/cookies up front so a malformed name fails here // rather than on the next config load. function sealCustomHeadersFromInput(input: Record) { diff --git a/src/cli/help.test.ts b/src/cli/help.test.ts index 5ed57a6..e5d928e 100644 --- a/src/cli/help.test.ts +++ b/src/cli/help.test.ts @@ -76,6 +76,8 @@ describe("renderHelp", () => { expect(help).toContain("发现与选择:"); expect(help).toContain("企业接入:"); expect(help).toContain("seal-use corps add-hose-persistent"); + expect(help).toContain("seal-use corps add-seal-bearer"); + expect(help).toContain("seal-use corps add-hose-web-session"); expect(help).toContain("Hose 专属能力:"); expect(help).toContain("seal-use corps probe-hose"); expect(help).toContain("seal-use corps hose-staffs"); @@ -110,6 +112,12 @@ describe("renderHelp", () => { expect(help).toContain("旧命令 add-hose 仍可用"); }); + test("documents the add-seal compatibility alias", () => { + const help = renderHelp(["corps", "add-seal-bearer"]); + expect(help).toContain("seal-use corps add-seal-bearer"); + expect(help).toContain("旧命令 add-seal 仍可用"); + }); + test("throws usage error for unknown area or subcommand", () => { expect(() => renderHelp(["nonexistent-domain"])).toThrow(/Unknown command/); expect(() => renderHelp(["corps", "nonexistent-cmd"])).toThrow(/Unknown corps command/); diff --git a/src/cli/help.ts b/src/cli/help.ts index 5bbac67..a005118 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -165,10 +165,27 @@ export const HELP_REGISTRY: AreaHelp[] = [ description: "使用长期 Hose OpenAPI 凭据接入企业并持久化配置;旧命令 add-hose 仍可用,但仅作为兼容别名。" }, { - name: "add-seal", + name: "add-seal-bearer", + aliases: ["add-seal"], group: "企业接入", - summary: "Add a native Seal enterprise configuration", - usage: ["seal-use corps add-seal --json '{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'"] + summary: "Add a native Seal enterprise from a Bearer session", + usage: ["seal-use corps add-seal-bearer --json '{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'"], + description: "使用 Seal Bearer Token 接入原生 Seal 企业;旧命令 add-seal 仍可用,但仅作为兼容别名。" + }, + { + name: "add-hose-web-session", + group: "企业接入", + summary: "Import a temporary Hose web session and exchange it for a Seal session", + usage: ["seal-use corps add-hose-web-session --json '{\"baseUrl\":\"https://wx2.ekuaibao.com\",\"corpId\":\"...\",\"accessToken\":\"...\"}'"], + options: [ + { flag: "--name ", description: "Optional custom name for the enterprise" }, + { flag: "--domain ", description: "Hose web-session base URL (alias: --base-url)" }, + { flag: "--corp-id ", description: "Hose corporation ID" }, + { flag: "--access-token ", description: "Hose web-session accesstoken" }, + { flag: "--overwrite", description: "Overwrite existing enterprise config" }, + { flag: "--dry-run", description: "Exchange and verify the session without saving local config" } + ], + description: "接收 Agent 从合思后台 cURL 提取出的 accesstoken、corpId 和域名,经 Hose→Seal SSO 导入短期 Seal 会话;不提取或持久化 OpenAPI appKey/appSecurity。" }, { name: "add-link", diff --git a/src/core/doctor/diagnose.ts b/src/core/doctor/diagnose.ts index cad23d4..7d7cf7b 100644 --- a/src/core/doctor/diagnose.ts +++ b/src/core/doctor/diagnose.ts @@ -258,7 +258,7 @@ export function diagnoseSystem(): DoctorDiagnosis { id: "enterprises", title: "企业接入状态", status: "warn", - message: "当前未检测到企业配置,请使用 seal-use corps add-hose-persistent 或 add-seal 接入企业" + message: "当前未检测到企业配置,请使用 seal-use corps add-hose-persistent、add-hose-web-session 或 add-seal-bearer 接入企业" }); }