From 7dca4e581fb4f18764fc2306a90b6228e1f98595 Mon Sep 17 00:00:00 2001 From: gengruilin Date: Wed, 14 Oct 2026 19:14:35 +0800 Subject: [PATCH] docs(feishu): document the plugin on the CLI account kit Drop the config fields the kit fixes, describe the shared runtime and page pieces, and regenerate the config and Cordis catalogs. --- docs/config-catalog.md | 19 ++-------- docs/config-catalog.zh.md | 19 ++-------- docs/subsystems/credentials.md | 10 ++--- docs/subsystems/credentials.zh.md | 10 ++--- packages/client/ui-feishu/README.i18n.yaml | 8 ++-- packages/client/ui-feishu/README.md | 3 +- packages/client/ui-feishu/README.zh.md | 3 +- .../connector/feishu-cli/README.i18n.yaml | 16 ++++---- packages/connector/feishu-cli/README.md | 9 +++-- packages/connector/feishu-cli/README.zh.md | 9 +++-- .../extensions/tool-cordis/src/api-catalog.ts | 38 +++++++++++-------- scripts/gen-cordis-catalog.ts | 1 - 12 files changed, 67 insertions(+), 78 deletions(-) diff --git a/docs/config-catalog.md b/docs/config-catalog.md index c2f9ac32f2..9ee7f75a62 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -1537,30 +1537,19 @@ export interface Config { } ``` + ## `@deepseek-ai/dsh-feishu-cli` - `inject`: `skills` · `subprocess` · `shellEnv` +- `refs`: [`CliAccountConfig`](../packages/connector/cli-account/src/index.ts) - `source`: [`packages/connector/feishu-cli/src/index.ts:30`](../packages/connector/feishu-cli/src/index.ts) ```ts config-catalog -/** CLI location and command limits. */ -export interface Config extends FeishuCliLimits { - /** Absolute directory containing `lark-cli`; defaults to the installed `@larksuite/cli` package. */ - binDir?: string - /** Deadline for app setup or sign-in, which wait for the user in the browser. */ - authorizationTimeoutMs: number -} - -/** Deployment limits for one native command. */ -export interface FeishuCliLimits { - /** Deadline in milliseconds, including executable lookup. */ - commandTimeoutMs: number - /** Maximum stdout bytes retained from one command. */ - maxOutputBytes: number -} +/** Where lark-cli is and how long a command that does not wait for the user may run. */ +export type Config = CliAccountConfig ``` diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index e06e44d7e7..d38de8d52d 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -1539,30 +1539,19 @@ export interface Config { } ``` + ## `@deepseek-ai/dsh-feishu-cli` - `inject`: `skills` · `subprocess` · `shellEnv` +- `refs`: [`CliAccountConfig`](../packages/connector/cli-account/src/index.ts) - `source`: [`packages/connector/feishu-cli/src/index.ts:30`](../packages/connector/feishu-cli/src/index.ts) ```ts config-catalog -/** CLI location and command limits. */ -export interface Config extends FeishuCliLimits { - /** Absolute directory containing `lark-cli`; defaults to the installed `@larksuite/cli` package. */ - binDir?: string - /** Deadline for app setup or sign-in, which wait for the user in the browser. */ - authorizationTimeoutMs: number -} - -/** Deployment limits for one native command. */ -export interface FeishuCliLimits { - /** Deadline in milliseconds, including executable lookup. */ - commandTimeoutMs: number - /** Maximum stdout bytes retained from one command. */ - maxOutputBytes: number -} +/** Where lark-cli is and how long a command that does not wait for the user may run. */ +export type Config = CliAccountConfig ``` diff --git a/docs/subsystems/credentials.md b/docs/subsystems/credentials.md index 4fb4919236..b164212026 100644 --- a/docs/subsystems/credentials.md +++ b/docs/subsystems/credentials.md @@ -379,35 +379,35 @@ Registers the CLI and skills, and owns the account operations the Plugins page d * @returns the operation identity. * @throws while another account operation runs. */ -@Remote check(): FeishuOperationId +@Remote check(): CliOperationId /** * Link an app through the CLI's setup page, replacing a configured app and its sign-ins. * @returns the operation identity. * @throws while another account operation runs. */ -@Remote linkApp(): FeishuOperationId +@Remote linkApp(): CliOperationId /** * Sign the linked app's user in through the CLI's authorization page. * @returns the operation identity. * @throws while another account operation runs. */ -@Remote signIn(): FeishuOperationId +@Remote signIn(): CliOperationId /** * Sign the default account out, which also signs out the user's own terminal. * @returns the operation identity. * @throws while another account operation runs. */ -@Remote signOut(): FeishuOperationId +@Remote signOut(): CliOperationId /** * Cancel one operation and wait for its command to exit. * @param id - the operation to cancel; a finished one is ignored. * @returns after the operation settles. */ -@Remote cancel(id: FeishuOperationId): Promise +@Remote cancel(id: CliOperationId): Promise /** * Follow the account and its operations independently of any page; each new subscriber starts a check when none runs. diff --git a/docs/subsystems/credentials.zh.md b/docs/subsystems/credentials.zh.md index c3aa3cec93..b80c7320a1 100644 --- a/docs/subsystems/credentials.zh.md +++ b/docs/subsystems/credentials.zh.md @@ -379,35 +379,35 @@ Registers the CLI and skills, and owns the account operations the Plugins page d * @returns the operation identity. * @throws while another account operation runs. */ -@Remote check(): FeishuOperationId +@Remote check(): CliOperationId /** * Link an app through the CLI's setup page, replacing a configured app and its sign-ins. * @returns the operation identity. * @throws while another account operation runs. */ -@Remote linkApp(): FeishuOperationId +@Remote linkApp(): CliOperationId /** * Sign the linked app's user in through the CLI's authorization page. * @returns the operation identity. * @throws while another account operation runs. */ -@Remote signIn(): FeishuOperationId +@Remote signIn(): CliOperationId /** * Sign the default account out, which also signs out the user's own terminal. * @returns the operation identity. * @throws while another account operation runs. */ -@Remote signOut(): FeishuOperationId +@Remote signOut(): CliOperationId /** * Cancel one operation and wait for its command to exit. * @param id - the operation to cancel; a finished one is ignored. * @returns after the operation settles. */ -@Remote cancel(id: FeishuOperationId): Promise +@Remote cancel(id: CliOperationId): Promise /** * Follow the account and its operations independently of any page; each new subscriber starts a check when none runs. diff --git a/packages/client/ui-feishu/README.i18n.yaml b/packages/client/ui-feishu/README.i18n.yaml index 9f63cb532e..7f6422d1f8 100644 --- a/packages/client/ui-feishu/README.i18n.yaml +++ b/packages/client/ui-feishu/README.i18n.yaml @@ -18,11 +18,11 @@ en: fa34bf7d74d487d6 zh: ed0389c337dd8ccb /deepseek-ai-dsh-client-ui-feishu/understand-the-implementation: - en: 3599958abbfb2f52 - zh: 68eae79d08462831 + en: 9846238f16bc41a1 + zh: 356974d38e7e18f1 /deepseek-ai-dsh-client-ui-feishu/further-exploration: - en: 8c92c0c8230a8b91 - zh: 50dd1561ef60c1ec + en: 06bea154fccda185 + zh: a862d7d255e8d9d3 /deepseek-ai-dsh-client-ui-feishu/model-experience: en: 012af7ceabf177e8 zh: f1ed31e734d6ba78 diff --git a/packages/client/ui-feishu/README.md b/packages/client/ui-feishu/README.md index 1aef17ea56..cdda949f25 100644 --- a/packages/client/ui-feishu/README.md +++ b/packages/client/ui-feishu/README.md @@ -50,7 +50,7 @@ Leaving the page does not cancel a connection, which the Host owns. Each step op The Host half, [`src/index.ts`](src/index.ts), is an empty `apply`, present only so the package holds the Loader row the client module system serves the browser half for. The browser half, [`src/client/index.ts`](src/client/index.ts), mounts the `feishu` Remote itself with `ctx.remote.$mount`, because the shipped Remote assembly does not include on-demand packages, and withdraws its registrations before unmounting it. -One `FeishuConnection` per browser plugin, in [`src/client/connection.ts`](src/client/connection.ts), mirrors the Remote's `follow` stream and derives the page state from the Host's view alone; it keeps only whether the stream is delivering, whether a page action is pending, the operation this browser started, and the latest notice. It registers `plugins.bundle.config` keyed by `@deepseek-ai/dsh-feishu` for the section, `plugins.bundle.activation` for the guidance, `plugins.detail.badge` for the tag, and a `shell.overlay` toast. It opens a link only for the operation this browser started, only once, and only over HTTPS. The page's copy lives in this package's `feishu` dictionary. +[`src/client/connection.ts`](src/client/connection.ts) creates one `CliAccountConnection` from the [CLI plugin page pieces](../ui-cli-account/README.md) per browser plugin over the `feishu` Remote, and derives the page state from the Host's view alone. That connection opens a link only for the operation this browser started, only once, and only over HTTPS. [`src/client/FeishuConnection.tsx`](src/client/FeishuConnection.tsx) renders the shared section, tag, activation prompt, confirmations, and toast with the Feishu actions; the package requests the shared module through `dsh.client.external` instead of bundling it. It registers `plugins.bundle.config` keyed by `@deepseek-ai/dsh-feishu` for the section, `plugins.bundle.activation` for the guidance, `plugins.detail.badge` for the tag, and a `shell.overlay` toast. The page's copy, including the keys the shared pieces read, lives in this package's `feishu` dictionary. @@ -61,6 +61,7 @@ One `FeishuConnection` per browser plugin, in [`src/client/connection.ts`](src/c - [Feishu plugin](../../connector/feishu/README.md) — the bundle that inserts this row and the Host row. - [Feishu CLI and skills](../../connector/feishu-cli/README.md) — the Host row and the account operations this page drives. +- [CLI plugin page pieces](../ui-cli-account/README.md) — the shared connection mirror and components this page renders. - [ui-plugin-manager](../ui-plugin-manager/README.md) — the Plugins page and the bundle slots the page registers into. ----- diff --git a/packages/client/ui-feishu/README.zh.md b/packages/client/ui-feishu/README.zh.md index facd1f9376..84704ba310 100644 --- a/packages/client/ui-feishu/README.zh.md +++ b/packages/client/ui-feishu/README.zh.md @@ -50,7 +50,7 @@ kind: "package-reference" Host 半部 [`src/index.ts`](src/index.ts) 是空的 `apply`,只为让本包持有一行 Loader 条目,客户端模块系统据此提供浏览器半部。浏览器半部 [`src/client/index.ts`](src/client/index.ts) 用 `ctx.remote.$mount` 自行挂载 `feishu` Remote,因为随产品发布的 Remote 集合不包含按需安装的包;卸载 Remote 之前会先撤下自己的注册。 -[`src/client/connection.ts`](src/client/connection.ts) 中每个浏览器插件一个 `FeishuConnection`,它镜像 Remote 的 `follow` 流,只根据 Host 的视图推导页面状态;它自己只保存流是否在送达、页面操作是否未完成、本浏览器发起的操作和最近一条提示。它以 `@deepseek-ai/dsh-feishu` 为 key 注册 `plugins.bundle.config` 作为区块,注册 `plugins.bundle.activation` 作为引导、`plugins.detail.badge` 作为标签,以及一个 `shell.overlay` 提示。它只为本浏览器发起的操作打开链接,每个链接只打开一次,且只打开 HTTPS 链接。页面文案位于本包的 `feishu` 词典。 +[`src/client/connection.ts`](src/client/connection.ts) 为每个浏览器插件基于 `feishu` Remote 创建一个来自 [CLI 插件页组件](../ui-cli-account/README.zh.md)的 `CliAccountConnection`,只根据 Host 的视图推导页面状态。该连接只为本浏览器发起的操作打开链接,每个链接只打开一次,且只打开 HTTPS 链接。[`src/client/FeishuConnection.tsx`](src/client/FeishuConnection.tsx) 用飞书的操作渲染共用的区块、标签、开启引导、确认框和提示;本包通过 `dsh.client.external` 请求共用模块,而不是把它打包进来。它以 `@deepseek-ai/dsh-feishu` 为 key 注册 `plugins.bundle.config` 作为区块,注册 `plugins.bundle.activation` 作为引导、`plugins.detail.badge` 作为标签,以及一个 `shell.overlay` 提示。页面文案,包括共用组件读取的键,位于本包的 `feishu` 词典。 @@ -61,6 +61,7 @@ Host 半部 [`src/index.ts`](src/index.ts) 是空的 `apply`,只为让本包 - [飞书插件](../../connector/feishu/README.zh.md)——插入本行与 Host 行的 bundle。 - [飞书 CLI 与技能](../../connector/feishu-cli/README.zh.md)——Host 行,以及本页面发起的账号操作。 +- [CLI 插件页组件](../ui-cli-account/README.zh.md)——本页面渲染的共用连接镜像与组件。 - [ui-plugin-manager](../ui-plugin-manager/README.zh.md)——插件页,以及本页面注册进的 bundle slot。 ----- diff --git a/packages/connector/feishu-cli/README.i18n.yaml b/packages/connector/feishu-cli/README.i18n.yaml index 17e3d60c84..94a6352656 100644 --- a/packages/connector/feishu-cli/README.i18n.yaml +++ b/packages/connector/feishu-cli/README.i18n.yaml @@ -24,17 +24,17 @@ en: f0d233dd69bb21c7 zh: 4aedc72d52cd0523 /deepseek-ai-dsh-feishu-cli/use-this-package/account-operations: - en: f4df0c024a2eb11b - zh: ec0f3e92f774f380 + en: 21b806690bb289f6 + zh: 08465992827a0e3c /deepseek-ai-dsh-feishu-cli/use-this-package/configure: - en: 2aa0db3a03b797f8 - zh: 6d63b0c12de0b97c + en: 6e777c8d3e50258e + zh: 6622a5fa0f2b0775 /deepseek-ai-dsh-feishu-cli/understand-the-implementation: - en: cecacae7ef26c59b - zh: 793e67c4c04eaa00 + en: 5316ef34c9476ac5 + zh: c4522219bb898720 /deepseek-ai-dsh-feishu-cli/further-exploration: - en: bce32c0efe9e96d5 - zh: 7d6e9f3fd8117451 + en: 7e35dc90875131f5 + zh: efd7e120fa838949 /deepseek-ai-dsh-feishu-cli/model-experience: en: 215e7ba838619b7b zh: a311da3843709f90 diff --git a/packages/connector/feishu-cli/README.md b/packages/connector/feishu-cli/README.md index 912a8b3947..8cddceebcc 100644 --- a/packages/connector/feishu-cli/README.md +++ b/packages/connector/feishu-cli/README.md @@ -47,7 +47,7 @@ The `feishu` Remote serves the Plugins page. It runs at most one account operati | `linkApp()` | Runs `config init --new`, which replaces the CLI's default configuration, including its sign-ins and any other app, with the app the user creates or chooses; it does not sign in | | `signIn()` | Runs `auth login --json` for the linked app and checks that the same user is signed in | | `signOut()` | Runs `auth logout --json`, which also signs out the user's own terminal, then checks again | -| `cancel(id)` | Cancels that operation and waits for its command to exit; a finished id is ignored | +| `cancel(id)` | Cancels that operation during app setup or sign-in and waits for its command to exit; other steps and a finished id are ignored | A check runs `auth status --verify --json`. The account reads `connected` only when the CLI reports an available user that its server verified, `signed-out` when the user is missing, not configured, or needs a refresh, `unconfigured` when no app exists, and `unverified` otherwise, for example when verification cannot reach the server. Every state except `unconfigured` carries the configured `appId`. Each link that `config init` prints and each device-authorization link that `auth login` reports is offered only when it is an HTTPS address on `feishu.cn` or `larksuite.com`. A sign-in that leaves requested permissions ungranted (`auth login` exits with code 3 and lists them as missing) still succeeds; a command that later needs a missing permission reports it. Results report succeeded, cancelled, or failed. Failures include the command, observed exit code, and recognized CLI error categories in the Remote result and Host log; native messages, paths, and authorization data are omitted. A successful Feishu webpage does not confirm that local credentials were saved. The process running DSH needs access to the CLI configuration and system credential storage; `DSH_HOME` does not relocate either. @@ -57,8 +57,8 @@ A check runs `auth status --verify --json`. The account reads `connected` only w |---|---|---| | `binDir` | the installed `@larksuite/cli` package's `bin` | Absolute directory containing an executable `lark-cli` | | `commandTimeoutMs` | `30000` | Deadline for one skill command, account check, or sign-out, including executable lookup | -| `authorizationTimeoutMs` | `600000` | Deadline for app setup or sign-in, which wait for the user in the browser | -| `maxOutputBytes` | `1048576` | Maximum stdout bytes retained from one command | + +App setup and sign-in wait up to 10 minutes for the user in the browser, and each command keeps at most 1 MiB of stdout; the [CLI account library](../cli-account/README.md) fixes both limits. The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-feishu-cli) is the exhaustive source of supported fields. @@ -70,7 +70,7 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-fe
Implementation internals — click to expand -[`src/index.ts`](src/index.ts) is a Remote service registered as `ctx.feishu`. It requires a Host subprocess runtime, checks that `binDir/lark-cli` is executable, registers `binDir` with [Shell environment](../../shell/shell-env/README.md) as the `feishu` PATH contribution, and registers the skill provider. [`src/cli.ts`](src/cli.ts) prepares the private PATH environment for the subprocess runtime, resolves `lark-cli` in it, and spawns the result with that environment, so the backend and the Shell use the same executable. Each command reads stdout and stderr through pipes, reports each complete line to an optional observer, keeps stdout up to `maxOutputBytes` and the last 4 KiB of stderr, and waits for its managed process range to exit. [`src/account.ts`](src/account.ts) owns the account operations and reads setup and sign-in links from those lines. Disposal cancels the active operation, aborts running commands, and settles after their processes exit. +[`src/index.ts`](src/index.ts) is a Remote service registered as `ctx.feishu`. It requires a Host subprocess runtime, checks that `binDir/lark-cli` is executable, registers `binDir` with [Shell environment](../../shell/shell-env/README.md) as the `feishu` PATH contribution, and registers the skill provider. [`src/cli.ts`](src/cli.ts) locates `lark-cli` and parses the JSON output of its commands. The [CLI account library](../cli-account/README.md) runs each command on the private PATH, so the backend and the Shell use the same executable, and runs one account operation at a time. [`src/account.ts`](src/account.ts) extends that runtime with the Feishu commands, reads setup and sign-in links from their output lines, and classifies failures through [`src/diagnostic.ts`](src/diagnostic.ts). Disposal cancels the active operation, aborts running commands, and settles after their processes exit. [`src/skills.ts`](src/skills.ts) runs `lark-cli skills list --json` once per registration. A failed catalog is logged once and stays empty until the plugin reloads. Each load runs `skills read --json`, removes the frontmatter, and places the DSH guidance before the vendor body and the CLI's reference-reading guidance after it. References are embedded in the binary, so the skill's resource base is opaque. @@ -82,6 +82,7 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-fe ## Further Exploration - [Connector packages](../README.md) — the group this application plugin belongs to. +- [CLI account library](../cli-account/README.md) — command execution and account operations shared by CLI app plugins. - [Shell environment](../../shell/shell-env/README.md) — private PATH contributions shared by backend subprocesses and Shell tools. - [Skills](../../../docs/subsystems/skills.md) — catalog publication, loading, and precedence. - [Feishu plugin](../feishu/README.md) — the bundle that inserts this row and the page row. diff --git a/packages/connector/feishu-cli/README.zh.md b/packages/connector/feishu-cli/README.zh.md index d4e9aaf91b..0e55209eb1 100644 --- a/packages/connector/feishu-cli/README.zh.md +++ b/packages/connector/feishu-cli/README.zh.md @@ -47,7 +47,7 @@ kind: "package-reference" | `linkApp()` | 运行 `config init --new`,用用户新建或选择的应用替换 CLI 的默认配置,其中的登录和其他应用一并替换;不会登录 | | `signIn()` | 为已关联的应用运行 `auth login --json`,并确认登录的是同一个用户 | | `signOut()` | 运行 `auth logout --json`,同时退出用户自己终端里的登录,然后重新检查 | -| `cancel(id)` | 取消该操作并等待其命令退出;已结束的 id 会被忽略 | +| `cancel(id)` | 在应用配置或登录期间取消该操作并等待其命令退出;其他步骤和已结束的 id 会被忽略 | 检查运行 `auth status --verify --json`。只有 CLI 报告用户可用且已被服务端核实时,账号才是 `connected`;用户缺失、未配置或需要刷新时为 `signed-out`;没有应用时为 `unconfigured`;其他情况为 `unverified`,例如核实时无法连到服务端。除 `unconfigured` 外,每种状态都带有已配置的 `appId`。`config init` 打印的链接和 `auth login` 报告的设备授权链接,只有是 `feishu.cn` 或 `larksuite.com` 上的 HTTPS 地址时才会提供。登录后仍有申请的权限未被授予时(`auth login` 以退出码 3 结束并把它们列为缺失),登录仍算成功;之后需要这些权限的命令会报告缺少哪些。结果分为成功、已取消和失败。失败时,Remote 结果和 Host 日志包含命令、观察到的退出码和已识别的 CLI 错误类别;原生消息、路径和授权数据均不保留。飞书网页显示成功不代表本地凭据已保存。运行 DSH 的进程需要能访问 CLI 配置和系统凭据存储;`DSH_HOME` 不会迁移这两者。 @@ -57,8 +57,8 @@ kind: "package-reference" |---|---|---| | `binDir` | 已安装 `@larksuite/cli` 包的 `bin` | 包含可执行 `lark-cli` 的绝对目录 | | `commandTimeoutMs` | `30000` | 单条 skill 命令、账号检查或退出登录的期限,包含可执行文件查找 | -| `authorizationTimeoutMs` | `600000` | 应用配置或登录的期限,期间等待用户在浏览器中操作 | -| `maxOutputBytes` | `1048576` | 单条命令保留的 stdout 字节上限 | + +应用配置和登录最多等待用户在浏览器中操作 10 分钟,每条命令最多保留 1 MiB 的 stdout;这两个上限由 [CLI 账号库](../cli-account/README.zh.md)固定。 生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-feishu-cli)是受支持字段的完整来源。 @@ -70,7 +70,7 @@ kind: "package-reference"
实现内部机制——点击展开 -[`src/index.ts`](src/index.ts) 是注册为 `ctx.feishu` 的 Remote 服务。它要求 subprocess 运行时位于本 Host,检查 `binDir/lark-cli` 是否可执行,把 `binDir` 作为 `feishu` PATH 贡献注册到 [Shell 环境](../../shell/shell-env/README.zh.md),并注册 skill 提供方。[`src/cli.ts`](src/cli.ts) 为 subprocess 运行时准备私有 PATH 环境,在其中解析 `lark-cli`,并用同一环境启动解析结果,使后端与 Shell 使用同一个可执行文件。每条命令通过管道读取 stdout 和 stderr,把每个完整行报告给可选的观察方,保留至多 `maxOutputBytes` 的 stdout 和最后 4 KiB 的 stderr,并等待其受管进程范围退出。[`src/account.ts`](src/account.ts) 持有账号操作,并从这些行中读取配置与登录链接。释放时取消进行中的操作,中止正在运行的命令,并在这些进程退出后完成。 +[`src/index.ts`](src/index.ts) 是注册为 `ctx.feishu` 的 Remote 服务。它要求 subprocess 运行时位于本 Host,检查 `binDir/lark-cli` 是否可执行,把 `binDir` 作为 `feishu` PATH 贡献注册到 [Shell 环境](../../shell/shell-env/README.zh.md),并注册 skill 提供方。[`src/cli.ts`](src/cli.ts) 定位 `lark-cli` 并解析其命令的 JSON 输出。[CLI 账号库](../cli-account/README.zh.md)在私有 PATH 上运行每条命令,使后端与 Shell 使用同一个可执行文件,并一次执行一个账号操作。[`src/account.ts`](src/account.ts) 在该运行时上实现飞书的命令,从命令输出行中读取配置与登录链接,并通过 [`src/diagnostic.ts`](src/diagnostic.ts) 对失败分类。释放时取消进行中的操作,中止正在运行的命令,并在这些进程退出后完成。 [`src/skills.ts`](src/skills.ts) 每次注册只运行一次 `lark-cli skills list --json`。目录读取失败时记录一次日志,并在插件重新加载前保持为空。每次加载运行 `skills read --json`,去掉 frontmatter,把 DSH 指引放在厂商正文之前,把 CLI 的引用文件读取指引放在之后。引用文件内嵌在二进制中,因此 skill 的资源基址是 opaque 类型。 @@ -82,6 +82,7 @@ kind: "package-reference" ## 进一步探索 - [Connector 包](../README.zh.md)——这个应用插件所属的分组。 +- [CLI 账号库](../cli-account/README.zh.md)——CLI 应用插件共用的命令执行与账号操作。 - [Shell 环境](../../shell/shell-env/README.zh.md)——后端 subprocess 与 Shell 工具共用的私有 PATH 贡献。 - [Skills](../../../docs/subsystems/skills.zh.md)——目录发布、加载与优先级。 - [飞书插件](../feishu/README.zh.md)——插入本行与页面行的 bundle。 diff --git a/packages/extensions/tool-cordis/src/api-catalog.ts b/packages/extensions/tool-cordis/src/api-catalog.ts index d3504f460a..8792477af4 100644 --- a/packages/extensions/tool-cordis/src/api-catalog.ts +++ b/packages/extensions/tool-cordis/src/api-catalog.ts @@ -1163,35 +1163,35 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [ description: 'Registers the CLI and skills, and owns the account operations the Plugins page drives.', methods: [ { - signature: '@Remote check(): FeishuOperationId', + signature: '@Remote check(): CliOperationId', description: 'Check the account again without changing it.', parameters: [], returns: 'the operation identity.', throws: ['while another account operation runs.'], }, { - signature: '@Remote linkApp(): FeishuOperationId', + signature: '@Remote linkApp(): CliOperationId', description: 'Link an app through the CLI\'s setup page, replacing a configured app and its sign-ins.', parameters: [], returns: 'the operation identity.', throws: ['while another account operation runs.'], }, { - signature: '@Remote signIn(): FeishuOperationId', + signature: '@Remote signIn(): CliOperationId', description: 'Sign the linked app\'s user in through the CLI\'s authorization page.', parameters: [], returns: 'the operation identity.', throws: ['while another account operation runs.'], }, { - signature: '@Remote signOut(): FeishuOperationId', + signature: '@Remote signOut(): CliOperationId', description: 'Sign the default account out, which also signs out the user\'s own terminal.', parameters: [], returns: 'the operation identity.', throws: ['while another account operation runs.'], }, { - signature: '@Remote cancel(id: FeishuOperationId): Promise', + signature: '@Remote cancel(id: CliOperationId): Promise', description: 'Cancel one operation and wait for its command to exit.', parameters: [{ name: 'id', description: 'the operation to cancel; a finished one is ignored.' }], returns: 'after the operation settles.', @@ -5671,6 +5671,18 @@ export const TYPE_API: readonly TypeApiEntry[] = [ name: 'ClientArtifactBaseline', declaration: 'export interface ClientArtifactBaseline {\n readonly path: string;\n readonly mtimeMs: number;\n readonly ctimeMs: number;\n readonly size: number;\n}', }, + { + name: 'CliOperation', + declaration: 'export interface CliOperation {\n readonly id: CliOperationId;\n readonly kind: Kind;\n readonly phase: Phase | \'checking\' | \'cancelling\';\n readonly cancellable: boolean;\n readonly authorizationUrl?: string;\n}', + }, + { + name: 'CliOperationId', + declaration: 'export type CliOperationId = Branded<\'CliOperationId\'>;', + }, + { + name: 'CliOperationResult', + declaration: 'export interface CliOperationResult {\n readonly id: CliOperationId;\n readonly kind: Kind;\n readonly outcome: \'succeeded\' | \'cancelled\' | \'failed\';\n readonly failure?: Failure;\n}', + }, { name: 'CollectedOutput', declaration: 'export interface CollectedOutput {\n text: string;\n truncated: boolean;\n spillPath?: string;\n}', @@ -6193,23 +6205,19 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'FeishuOperationFailure', - declaration: 'export interface FeishuOperationFailure {\n readonly command: \'config-init\' | \'auth-status\' | \'auth-login\' | \'auth-logout\';\n readonly exitCode: number | null;\n readonly type?: \'validation\' | \'authentication\' | \'authorization\' | \'config\' | \'network\' | \'api\' | \'policy\' | \'internal\' | \'confirmation\';\n readonly subtype?: \'sdk_error\' | \'storage\' | \'file_io\' | \'not_configured\' | \'invalid_config\' | \'invalid_client\';\n}', + declaration: 'export interface FeishuOperationFailure extends CliCommandFailure<\'config-init\' | \'auth-status\' | \'auth-login\' | \'auth-logout\'> {\n readonly type?: \'validation\' | \'authentication\' | \'authorization\' | \'config\' | \'network\' | \'api\' | \'policy\' | \'internal\' | \'confirmation\';\n readonly subtype?: \'sdk_error\' | \'storage\' | \'file_io\' | \'not_configured\' | \'invalid_config\' | \'invalid_client\';\n}', }, { - name: 'FeishuOperationId', - declaration: 'export type FeishuOperationId = Branded<\'FeishuOperationId\'>;', + name: 'FeishuOperationKind', + declaration: 'export type FeishuOperationKind = \'check\' | \'link-app\' | \'sign-in\' | \'sign-out\';', }, { - name: 'FeishuOperationResult', - declaration: 'export interface FeishuOperationResult {\n readonly id: FeishuOperationId;\n readonly kind: FeishuOperationState[\'kind\'];\n readonly outcome: \'succeeded\' | \'cancelled\' | \'failed\';\n readonly failure?: FeishuOperationFailure;\n}', - }, - { - name: 'FeishuOperationState', - declaration: 'export interface FeishuOperationState {\n readonly id: FeishuOperationId;\n readonly kind: \'check\' | \'link-app\' | \'sign-in\' | \'sign-out\';\n readonly phase: \'checking\' | \'configuring\' | \'authorizing\' | \'verifying\' | \'signing-out\' | \'cancelling\';\n readonly authorizationUrl?: string;\n}', + name: 'FeishuPhase', + declaration: 'export type FeishuPhase = \'configuring\' | \'authorizing\' | \'verifying\' | \'signing-out\';', }, { name: 'FeishuState', - declaration: 'export interface FeishuState {\n readonly account: FeishuAccountState;\n readonly operation?: FeishuOperationState;\n readonly result?: FeishuOperationResult;\n}', + declaration: 'export type FeishuState = CliAccountView;', }, { name: 'FiberState', diff --git a/scripts/gen-cordis-catalog.ts b/scripts/gen-cordis-catalog.ts index 3541a10b85..5bab3ea4b5 100644 --- a/scripts/gen-cordis-catalog.ts +++ b/scripts/gen-cordis-catalog.ts @@ -967,7 +967,6 @@ export const TYPE_LINK_EXEMPTIONS: Readonly> = { PatchOptions: 'Include patch entries are owned by vendor/include (vendored upstream)', McpResourceProvider: 'scoped resource provider is owned by packages/mcp/mcp-resources/README.md', CliOperationId: 'account operation id is owned by packages/connector/cli-account/README.md', - FeishuOperationId: 'account operation id is owned by packages/connector/feishu-cli/README.md', FeishuState: 'account view fields are owned by packages/connector/feishu-cli/README.md', 'z.ZodType': 'Zod response validation API is owned by https://zod.dev/packages/zod', Socket: 'Node.js byte stream API is owned by https://nodejs.org/api/net.html#class-netsocket',