From 3c879ea10edbb60e68b013f359fd5fc95cc6caf3 Mon Sep 17 00:00:00 2001 From: gengruilin Date: Wed, 14 Oct 2026 23:11:35 +0800 Subject: [PATCH] refactor(wecom): import the CLI account pieces from the Web shell's platform module --- packages/client/ui-wecom/README.i18n.yaml | 4 ++-- packages/client/ui-wecom/README.md | 2 +- packages/client/ui-wecom/README.zh.md | 2 +- packages/client/ui-wecom/package.json | 7 ++----- packages/client/ui-wecom/src/client/WecomConnection.tsx | 2 +- packages/client/ui-wecom/src/client/connection.ts | 2 +- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/client/ui-wecom/README.i18n.yaml b/packages/client/ui-wecom/README.i18n.yaml index 64694a4e23..10959173b7 100644 --- a/packages/client/ui-wecom/README.i18n.yaml +++ b/packages/client/ui-wecom/README.i18n.yaml @@ -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 diff --git a/packages/client/ui-wecom/README.md b/packages/client/ui-wecom/README.md index 0e5265af53..d355526798 100644 --- a/packages/client/ui-wecom/README.md +++ b/packages/client/ui-wecom/README.md @@ -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. diff --git a/packages/client/ui-wecom/README.zh.md b/packages/client/ui-wecom/README.zh.md index 6670bd2b02..0ecead04ab 100644 --- a/packages/client/ui-wecom/README.zh.md +++ b/packages/client/ui-wecom/README.zh.md @@ -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` 词典。 diff --git a/packages/client/ui-wecom/package.json b/packages/client/ui-wecom/package.json index ea93bae34c..6214a8fd67 100644 --- a/packages/client/ui-wecom/package.json +++ b/packages/client/ui-wecom/package.json @@ -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": { diff --git a/packages/client/ui-wecom/src/client/WecomConnection.tsx b/packages/client/ui-wecom/src/client/WecomConnection.tsx index ebf4485737..846468a257 100644 --- a/packages/client/ui-wecom/src/client/WecomConnection.tsx +++ b/packages/client/ui-wecom/src/client/WecomConnection.tsx @@ -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' diff --git a/packages/client/ui-wecom/src/client/connection.ts b/packages/client/ui-wecom/src/client/connection.ts index 770c09fda8..79e08d76ab 100644 --- a/packages/client/ui-wecom/src/client/connection.ts +++ b/packages/client/ui-wecom/src/client/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'