refactor(wecom): import the CLI account pieces from the Web shell's platform module

This commit is contained in:
gengruilin committed 2026-10-14 23:11:35 +08:00
1 parent 056bb5a4af
commit 3c879ea10e
6 files changed
+8 -11

No files matched your search

+2 -2
View File
@@ -18,8 +18,8 @@
en: f21518d2f5d6c7ad
zh: 82df321e92153998
/deepseek-ai-dsh-client-ui-wecom/understand-the-implementation:
en: 70c6585836eb3bff
zh: 8238d67ddc248a5f
en: 584bf91c7b875880
zh: 4127cbe016e932c3
/deepseek-ai-dsh-client-ui-wecom/further-exploration:
en: a02c0dcac974a5d1
zh: 70e93f825c900d2f
+1 -1
View File
@@ -49,7 +49,7 @@ Leaving the page does not cancel a connection, which the Host owns. The QR-code
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 `wecom` Remote itself with `ctx.remote.$mount`, because the shipped Remote assembly does not include on-demand packages, and withdraws its registrations before unmounting it.
[`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 `wecom` 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/WecomConnection.tsx`](src/client/WecomConnection.tsx) renders the shared section, tag, activation prompt, and toast with the WeCom 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-wecom` 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 `wecom` 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 `wecom` 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/WecomConnection.tsx`](src/client/WecomConnection.tsx) renders the shared section, tag, activation prompt, and toast with the WeCom actions; the Web shell supplies the shared library as a platform module, so this package's bundle does not include it. It registers `plugins.bundle.config` keyed by `@deepseek-ai/dsh-wecom` 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 `wecom` dictionary.
</details>
+1 -1
View File
@@ -49,7 +49,7 @@ kind: "package-reference"
Host 半部 [`src/index.ts`](src/index.ts) 是空的 `apply`,只为让本包持有一行 Loader 条目,客户端模块系统据此提供浏览器半部。浏览器半部 [`src/client/index.ts`](src/client/index.ts) 用 `ctx.remote.$mount` 自行挂载 `wecom` Remote,因为随产品发布的 Remote 集合不包含按需安装的包;卸载 Remote 之前会先撤下自己的注册。
[`src/client/connection.ts`](src/client/connection.ts) 为每个浏览器插件基于 `wecom` Remote 创建一个来自 [CLI 插件页组件](../ui-cli-account/README.zh.md)的 `CliAccountConnection`,只根据 Host 的视图推导页面状态。该连接只为本浏览器发起的操作打开链接,每个链接只打开一次,且只打开 HTTPS 链接。[`src/client/WecomConnection.tsx`](src/client/WecomConnection.tsx) 用企业微信的操作渲染共用的区块、标签、开启引导和提示;本包通过 `dsh.client.external` 请求共用模块,而不是把它打包进来。它以 `@deepseek-ai/dsh-wecom` 为 key 注册 `plugins.bundle.config` 作为区块,注册 `plugins.bundle.activation` 作为引导、`plugins.detail.badge` 作为标签,以及一个 `shell.overlay` 提示。页面文案,包括共用组件读取的键,位于本包的 `wecom` 词典。
[`src/client/connection.ts`](src/client/connection.ts) 为每个浏览器插件基于 `wecom` Remote 创建一个来自 [CLI 插件页组件](../ui-cli-account/README.zh.md)的 `CliAccountConnection`,只根据 Host 的视图推导页面状态。该连接只为本浏览器发起的操作打开链接,每个链接只打开一次,且只打开 HTTPS 链接。[`src/client/WecomConnection.tsx`](src/client/WecomConnection.tsx) 用企业微信的操作渲染共用的区块、标签、开启引导和提示;Web 外壳以平台模块提供这个共用库,因此本包的 bundle 不包含它。它以 `@deepseek-ai/dsh-wecom` 为 key 注册 `plugins.bundle.config` 作为区块,注册 `plugins.bundle.activation` 作为引导、`plugins.detail.badge` 作为标签,以及一个 `shell.overlay` 提示。页面文案,包括共用组件读取的键,位于本包的 `wecom` 词典。
</details>
+2 -5
View File
@@ -1,7 +1,7 @@
{
"name": "@deepseek-ai/dsh-client-ui-wecom",
"description": "WeCom plugin page: authorize and check WeCom from the Plugins page",
"version": "0.2.1-alpha.2",
"version": "0.2.1-rc.2",
"publishConfig": {
"access": "public"
},
@@ -41,10 +41,7 @@
"@deepseek-ai/dsh-client-ui-layout",
"@deepseek-ai/dsh-client-ui-plugin-manager"
],
"platform": "web",
"external": [
"@deepseek-ai/dsh-client-ui-cli-account/client"
]
"platform": "web"
}
},
"scripts": {
@@ -2,7 +2,7 @@
import type { ReactNode } from 'react'
import {
CliAccountActivation, CliAccountBadge, CliAccountSection, CliAccountToast, type CliAccountAction,
} from '@deepseek-ai/dsh-client-ui-cli-account/client'
} from '@deepseek-ai/dsh-client-ui-cli-account'
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
import { WECOM_PACKAGE, presentConnection, type ConnectionFace } from './connection.ts'
@@ -1,7 +1,7 @@
/** Browser mirror of the Host's WeCom authorization and the Plugins page's actions. */
import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-api-remotes/client'
import { CliAccountConnection, type CliAccountPhase, type CliAccountSnapshot } from '@deepseek-ai/dsh-client-ui-cli-account/client'
import { CliAccountConnection, type CliAccountPhase, type CliAccountSnapshot } from '@deepseek-ai/dsh-client-ui-cli-account'
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
import type { WecomState } from '@deepseek-ai/dsh-wecom-cli/types'
import { assertNever } from '@deepseek-ai/dsh-util-values'