diff --git a/packages/client/ui-tencent-meeting/README.i18n.yaml b/packages/client/ui-tencent-meeting/README.i18n.yaml
index 1af954ba1c..3593643744 100644
--- a/packages/client/ui-tencent-meeting/README.i18n.yaml
+++ b/packages/client/ui-tencent-meeting/README.i18n.yaml
@@ -18,11 +18,11 @@
en: 8abed8cce6f6e6a3
zh: b8be0ab0d7e3530f
/deepseek-ai-dsh-client-ui-tencent-meeting/understand-the-implementation:
- en: 4589918951a2376f
- zh: cdae54a9a128c0b4
+ en: 1cebf21877c215be
+ zh: 69838ca382dfcf48
/deepseek-ai-dsh-client-ui-tencent-meeting/further-exploration:
- en: 5e7aba45aebb4f72
- zh: 8999fec815435d87
+ en: 39afb8856b22060b
+ zh: a0a43f1f3c07347a
/deepseek-ai-dsh-client-ui-tencent-meeting/model-experience:
en: 012af7ceabf177e8
zh: 473df8891305b7d5
diff --git a/packages/client/ui-tencent-meeting/README.md b/packages/client/ui-tencent-meeting/README.md
index fe7901e7bd..1c232cb48d 100644
--- a/packages/client/ui-tencent-meeting/README.md
+++ b/packages/client/ui-tencent-meeting/README.md
@@ -50,9 +50,9 @@ Leaving the page does not cancel a sign-in, which the Host owns. The authorizati
Implementation internals — click to expand
-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 `tencentMeeting` Remote itself with `ctx.remote.$mount`, because the shipped Remote assembly does not include on-demand packages, and withdraws its registrations before unmounting it.
+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 `tencentMeeting` Remote itself with `ctx.remote.$mount`, because the shipped Remote assembly does not include on-demand packages, and withdraws its account registration 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 `tencentMeeting` 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/TencentMeetingConnection.tsx`](src/client/TencentMeetingConnection.tsx) renders the shared section, sign-out confirmation, tag, activation prompt, and toast with the Tencent Meeting 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-tencent-meeting` 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 `tencent-meeting` dictionary.
+The browser half registers the Tencent Meeting account with the [CLI account surfaces](../ui-cli-account/README.md) through `ctx.cliAccounts`, which follow the `tencentMeeting` Remote and render the section, sign-out confirmation, tag, activation prompt, and toast for `@deepseek-ai/dsh-tencent-meeting`. A link opens only for the operation this browser started, only once, and only over HTTPS. [`src/client/connection.ts`](src/client/connection.ts) derives the account state from the Host's view alone, and [`src/client/account.ts`](src/client/account.ts) maps it to the section's buttons, signed-in user, confirmation, guide download row, and failure guidance. The page's copy, including the keys the shared surfaces read, lives in this package's `tencent-meeting` dictionary.
@@ -63,8 +63,8 @@ The Host half, [`src/index.ts`](src/index.ts), is an empty `apply`, present only
- [Tencent Meeting plugin](../../connector/tencent-meeting/README.md) — the bundle that inserts this row and the Host row.
- [Tencent Meeting CLI and skills](../../connector/tencent-meeting-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.
+- [CLI account surfaces](../ui-cli-account/README.md) — the registry that follows the Remote and renders this page's account.
+- [ui-plugin-manager](../ui-plugin-manager/README.md) — the Plugins page and the bundle slots the account surfaces fill.
-----
diff --git a/packages/client/ui-tencent-meeting/README.zh.md b/packages/client/ui-tencent-meeting/README.zh.md
index 3ad87addca..16b84d52de 100644
--- a/packages/client/ui-tencent-meeting/README.zh.md
+++ b/packages/client/ui-tencent-meeting/README.zh.md
@@ -50,9 +50,9 @@ kind: "package-reference"
实现细节 — 点击展开
-Host 部分 [`src/index.ts`](src/index.ts) 是一个空的 `apply`,存在的目的只是让本包占有一个 Loader 行,客户端模块系统据此提供浏览器部分。浏览器部分 [`src/client/index.ts`](src/client/index.ts) 用 `ctx.remote.$mount` 自行挂载 `tencentMeeting` Remote,因为随产品交付的 Remote 组装不包含按需安装的包;它在卸载该 Remote 之前先撤回自己的注册。
+Host 部分 [`src/index.ts`](src/index.ts) 是一个空的 `apply`,存在的目的只是让本包占有一个 Loader 行,客户端模块系统据此提供浏览器部分。浏览器部分 [`src/client/index.ts`](src/client/index.ts) 用 `ctx.remote.$mount` 自行挂载 `tencentMeeting` Remote,因为随产品交付的 Remote 组装不包含按需安装的包;它在卸载该 Remote 之前先撤回账号注册。
-[`src/client/connection.ts`](src/client/connection.ts) 为每个浏览器插件在 `tencentMeeting` Remote 上创建一个来自 [CLI 插件页组件](../ui-cli-account/README.zh.md)的 `CliAccountConnection`,并只根据 Host 的视图推导页面状态。该连接只为本浏览器发起的操作打开链接,每个链接只打开一次,并且只打开 HTTPS 链接。[`src/client/TencentMeetingConnection.tsx`](src/client/TencentMeetingConnection.tsx) 用腾讯会议的操作渲染共用的区块、退出登录确认、标签、开启引导和 toast;Web shell 以平台模块提供这个共用库,因此本包的 bundle 不包含它。它注册以 `@deepseek-ai/dsh-tencent-meeting` 为键的 `plugins.bundle.config` 区块、`plugins.bundle.activation` 引导、`plugins.detail.badge` 标签,以及一个 `shell.overlay` toast。页面文案,包括共用组件读取的键,都在本包的 `tencent-meeting` 字典中。
+浏览器部分通过 `ctx.cliAccounts` 把腾讯会议账号注册到 [CLI 账号界面](../ui-cli-account/README.zh.md),由它跟随 `tencentMeeting` Remote,并为 `@deepseek-ai/dsh-tencent-meeting` 渲染区块、退出登录确认、标签、开启引导和 toast。链接只为本浏览器发起的操作打开,每个链接只打开一次,并且只打开 HTTPS 链接。[`src/client/connection.ts`](src/client/connection.ts) 只根据 Host 的视图推导账号状态,[`src/client/account.ts`](src/client/account.ts) 再把它映射为区块的按钮、已登录用户、退出确认、技能下载行和失败建议。页面文案,包括共用界面读取的键,都在本包的 `tencent-meeting` 字典中。
@@ -63,8 +63,8 @@ Host 部分 [`src/index.ts`](src/index.ts) 是一个空的 `apply`,存在的
- [腾讯会议插件](../../connector/tencent-meeting/README.zh.md) — 插入本行和 Host 行的 bundle。
- [腾讯会议 CLI 与技能](../../connector/tencent-meeting-cli/README.zh.md) — Host 行以及本页面发起的账号操作。
-- [CLI 插件页组件](../ui-cli-account/README.zh.md) — 本页面渲染的共用连接镜像和组件。
-- [ui-plugin-manager](../ui-plugin-manager/README.zh.md) — 插件页以及本页面注册进去的 bundle 插槽。
+- [CLI 账号界面](../ui-cli-account/README.zh.md) — 跟随 Remote 并渲染本页面账号的注册表。
+- [ui-plugin-manager](../ui-plugin-manager/README.zh.md) — 插件页以及账号界面填入的 bundle 插槽。
-----
diff --git a/packages/client/ui-tencent-meeting/package.json b/packages/client/ui-tencent-meeting/package.json
index f37ce8dab8..1ce06a0c23 100644
--- a/packages/client/ui-tencent-meeting/package.json
+++ b/packages/client/ui-tencent-meeting/package.json
@@ -38,8 +38,7 @@
"inject": [
"@deepseek-ai/dsh-api-remotes",
"@deepseek-ai/dsh-client-locale",
- "@deepseek-ai/dsh-client-ui-layout",
- "@deepseek-ai/dsh-client-ui-plugin-manager"
+ "@deepseek-ai/dsh-client-ui-cli-account"
],
"platform": "web"
}
@@ -53,23 +52,15 @@
},
"devDependencies": {
"@deepseek-ai/cordis": "workspace:~",
- "@deepseek-ai/dsh-api-gateway": "workspace:*",
"@deepseek-ai/dsh-api-remotes": "workspace:*",
"@deepseek-ai/dsh-cli-account": "workspace:*",
"@deepseek-ai/dsh-client-locale": "workspace:*",
- "@deepseek-ai/dsh-client-store": "workspace:*",
"@deepseek-ai/dsh-client-test-runtime": "workspace:*",
"@deepseek-ai/dsh-client-ui-cli-account": "workspace:*",
- "@deepseek-ai/dsh-client-ui-layout": "workspace:*",
- "@deepseek-ai/dsh-client-ui-plugin-manager": "workspace:*",
- "@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
"@deepseek-ai/dsh-typert-protocol": "workspace:*",
"@deepseek-ai/dsh-util-values": "workspace:*",
"@deepseek-ai/dsh-tencent-meeting-cli": "workspace:*",
- "@deepseek-ai/dsh-upstream-skills": "workspace:*",
- "@testing-library/react": "^16.3.3",
- "react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "@deepseek-ai/dsh-upstream-skills": "workspace:*"
}
}
diff --git a/packages/client/ui-tencent-meeting/src/client/TencentMeetingConnection.tsx b/packages/client/ui-tencent-meeting/src/client/TencentMeetingConnection.tsx
deleted file mode 100644
index b35ecfc562..0000000000
--- a/packages/client/ui-tencent-meeting/src/client/TencentMeetingConnection.tsx
+++ /dev/null
@@ -1,102 +0,0 @@
-/** Tencent Meeting account surfaces on the Plugins page: the bundle section, title tag, activation guidance, and notices. */
-import { useState, type ReactNode } from 'react'
-import {
- CliAccountActivation, CliAccountBadge, CliAccountConfirm, CliAccountSection, CliAccountToast, type CliAccountAction, type CliAccountNote,
-} 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 type { UpstreamSkillsState } from '@deepseek-ai/dsh-upstream-skills/types'
-import { assertNever } from '@deepseek-ai/dsh-util-values'
-import { TENCENT_MEETING_PACKAGE, presentConnection, type ConnectionFace } from './connection.ts'
-import type { NS } from './locales.ts'
-
-type FaceProps = InjectFace & PropsLocale
-
-/* jscpd:ignore-start -- CLI app plugins whose guides download report the same states, each from its own dictionary. */
-/** The row that reports a guide that is not in place yet; a failed download offers a check, which restarts it. */
-function skillsNotes(skills: UpstreamSkillsState | undefined, t: FaceProps['t'], check: () => void): CliAccountNote[] {
- switch (skills) {
- case undefined:
- case 'installed': return []
- case 'downloading': return [{ text: t('skills.downloading') }]
- case 'failed': return [{ text: t('skills.failed'), action: { label: t('action.retry'), onClick: check } }]
- /* v8 ignore next -- closed skills state union */
- default: return assertNever(skills)
- }
-}
-/* jscpd:ignore-end */
-
-/**
- * The account section on the Tencent Meeting bundle's page.
- * @param props - the shared connection face and the Tencent Meeting dictionary.
- * @returns the status line, its actions, and the sign-out confirmation.
- */
-export function TencentMeetingConnectionSection(props: FaceProps): ReactNode {
- const { useTencentMeetingConnection, check, signIn, signOut, cancel, openAuthorization, retry, t } = props
- const snapshot = useTencentMeetingConnection(value => value)
- const [confirming, setConfirming] = useState(false)
- const shown = presentConnection(snapshot)
- const actions: CliAccountAction[] = []
- let status: string | undefined
- let detail: string | undefined
- /* jscpd:ignore-start -- CLI app plugin pages map the shared phases to the same retry, open-link, and cancel actions. */
- switch (shown.phase) {
- case 'connected':
- actions.push({ label: t('action.signOut'), onClick: () => { setConfirming(true) } })
- detail = t('detail.connected', { name: shown.userName })
- break
- case 'disconnected': actions.push({ label: t('action.connect'), onClick: signIn, variant: 'primary' }); detail = t('detail.disconnected'); break
- case 'unavailable': actions.push({ label: t('action.retry'), onClick: check }); detail = t('detail.unavailable'); break
- case 'stopped': actions.push({ label: t('action.retry'), onClick: retry }); detail = t('detail.stopped'); break
- case 'connecting':
- status = t(`step.${shown.step}`)
- if (shown.step === 'authorizing' && shown.url !== undefined) {
- actions.push({ label: t('action.open'), onClick: openAuthorization, variant: 'primary' })
- detail = t('detail.authorizing')
- }
- if (shown.cancellable) actions.push({ label: t('action.cancel'), onClick: cancel, variant: 'ghost' })
- break
- case 'checking': break
- }
- /* jscpd:ignore-end */
- const failed = 'failed' in shown ? shown.failed : undefined
- return (
-
- { setConfirming(false) }} onConfirm={signOut} />
-
- )
-}
-
-/**
- * The account tag beside the Tencent Meeting bundle's title.
- * @param props - the open detail page's subject, the connection face, and the dictionary.
- * @returns the tag for the Tencent Meeting bundle, or null on any other page.
- */
-export function TencentMeetingConnectionBadge({ subject, useTencentMeetingConnection, t }: FaceProps & PropsRuntime<'plugins.detail.badge'>): ReactNode {
- const phase = useTencentMeetingConnection(value => presentConnection(value).phase)
- return
-}
-
-/**
- * Guidance after the user switches the Tencent Meeting bundle on while the account is not connected.
- * @param props - activation callbacks, the connection face, and the dictionary.
- * @returns a dismissible prompt that starts the sign-in from the bundle's page.
- */
-export function TencentMeetingConnectionActivation(props: FaceProps & PropsRuntime<'plugins.bundle.activation'>): ReactNode {
- const { useTencentMeetingConnection, signIn, onDismiss, onOpenDetails, t } = props
- const phase = useTencentMeetingConnection(value => presentConnection(value).phase)
- return { onOpenDetails(); signIn() }} />
-}
-
-/**
- * Account outcomes reported outside the Plugins panel's lifetime.
- * @param props - the shared notice, its dismissal, and the dictionary.
- * @returns the toast for the latest notice, or null.
- */
-export function TencentMeetingConnectionToast({ useTencentMeetingConnection, dismissNotice, t }: FaceProps): ReactNode {
- const notice = useTencentMeetingConnection(value => value.notice)
- return
-}
diff --git a/packages/client/ui-tencent-meeting/src/client/account.ts b/packages/client/ui-tencent-meeting/src/client/account.ts
new file mode 100644
index 0000000000..874fb06a08
--- /dev/null
+++ b/packages/client/ui-tencent-meeting/src/client/account.ts
@@ -0,0 +1,75 @@
+/** The Tencent Meeting account section: the buttons, guide download rows, and failure the Plugins page shows for each state. */
+import type { CliAccountAction, CliAccountDisplay, CliAccountNote, CliAccountPage } from '@deepseek-ai/dsh-client-ui-cli-account/client'
+import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots'
+import type { UpstreamSkillsState } from '@deepseek-ai/dsh-upstream-skills/types'
+import { assertNever } from '@deepseek-ai/dsh-util-values'
+import { presentConnection, type ConnectionSnapshot } from './connection.ts'
+import type { NS } from './locales.ts'
+
+type Translate = TranslateNS
+
+/** The page actions and the Tencent Meeting Remote operations the section's buttons call. */
+export interface TencentMeetingActions extends CliAccountPage {
+ /** Check the account again. */
+ readonly check: () => void
+ /** Sign in through the authorization page. */
+ readonly signIn: () => void
+ readonly signOut: () => void
+}
+
+/* jscpd:ignore-start -- CLI app plugins whose guides download report the same states, each from its own dictionary. */
+/** The row that reports guides that are not in place yet; a failed download offers a check, which restarts it. */
+function skillsNotes(skills: UpstreamSkillsState | undefined, t: Translate, check: () => void): CliAccountNote[] {
+ switch (skills) {
+ case undefined:
+ case 'installed': return []
+ case 'downloading': return [{ text: t('skills.downloading') }]
+ case 'failed': return [{ text: t('skills.failed'), action: { label: t('action.retry'), onClick: check } }]
+ /* v8 ignore next -- closed skills state union */
+ default: return assertNever(skills)
+ }
+}
+/* jscpd:ignore-end */
+
+/**
+ * The account section for one page snapshot.
+ * @param snapshot - the Host's view and the page state.
+ * @param t - the Tencent Meeting dictionary.
+ * @param actions - what the section's buttons call.
+ * @returns the phase, step, buttons, detail, guide download row, and failure.
+ */
+export function presentAccount(snapshot: ConnectionSnapshot, t: Translate, actions: TencentMeetingActions): CliAccountDisplay {
+ const shown = presentConnection(snapshot)
+ const buttons: CliAccountAction[] = []
+ let status: string | undefined
+ let detail: string | undefined
+ /* jscpd:ignore-start -- CLI app plugin pages map the shared phases to the same retry, open-link, and cancel actions. */
+ switch (shown.phase) {
+ case 'connected':
+ buttons.push({
+ label: t('action.signOut'), onClick: actions.signOut,
+ confirm: { title: t('signOut.title'), body: t('signOut.body'), label: t('action.signOut') },
+ })
+ detail = t('detail.connected', { name: shown.userName })
+ break
+ case 'disconnected': buttons.push({ label: t('action.connect'), onClick: actions.signIn, variant: 'primary' }); detail = t('detail.disconnected'); break
+ case 'unavailable': buttons.push({ label: t('action.retry'), onClick: actions.check }); detail = t('detail.unavailable'); break
+ case 'stopped': buttons.push({ label: t('action.retry'), onClick: actions.retry }); detail = t('detail.stopped'); break
+ case 'connecting':
+ status = t(`step.${shown.step}`)
+ if (shown.step === 'authorizing' && shown.url !== undefined) {
+ buttons.push({ label: t('action.open'), onClick: actions.openAuthorization, variant: 'primary' })
+ detail = t('detail.authorizing')
+ }
+ if (shown.cancellable) buttons.push({ label: t('action.cancel'), onClick: actions.cancel, variant: 'ghost' })
+ break
+ case 'checking': break
+ }
+ /* jscpd:ignore-end */
+ const failed = 'failed' in shown ? shown.failed : undefined
+ return {
+ phase: shown.phase, status, actions: buttons, detail,
+ notes: skillsNotes(snapshot.view?.account.skills, t, actions.check),
+ failure: failed === undefined ? undefined : { text: t('failed'), command: failed.failure },
+ }
+}
diff --git a/packages/client/ui-tencent-meeting/src/client/connection.ts b/packages/client/ui-tencent-meeting/src/client/connection.ts
index 2eb8f32f29..46495e0064 100644
--- a/packages/client/ui-tencent-meeting/src/client/connection.ts
+++ b/packages/client/ui-tencent-meeting/src/client/connection.ts
@@ -1,19 +1,13 @@
-/** Browser mirror of the Host's Tencent Meeting account and the Plugins page's account actions. */
-import type { Context } from '@deepseek-ai/cordis'
-import type {} from '@deepseek-ai/dsh-api-remotes/client'
-import { CliAccountConnection, type CliAccountSnapshot } from '@deepseek-ai/dsh-client-ui-cli-account'
-import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
+/** The Tencent Meeting account the Plugins page shows, derived from the Host's account view. */
+import type { CliAccountSnapshot } from '@deepseek-ai/dsh-client-ui-cli-account/client'
import type { TencentMeetingState } from '@deepseek-ai/dsh-tencent-meeting-cli/types'
import { assertNever } from '@deepseek-ai/dsh-util-values'
/** The npm package whose bundle page carries the account section. */
export const TENCENT_MEETING_PACKAGE = '@deepseek-ai/dsh-tencent-meeting'
-/** Outcomes the page reports after an operation this browser started succeeds. */
-export type TencentMeetingNotice = 'connected' | 'signed-out'
-
/** The page's whole view: the Host's account view plus this browser's stream, pending action, and notice. */
-export type ConnectionSnapshot = CliAccountSnapshot
+export type ConnectionSnapshot = CliAccountSnapshot
/** The step a sign-in or sign-out in progress shows. */
export type ConnectionStep = 'authorizing' | 'connecting' | 'signing-out'
@@ -26,22 +20,6 @@ export type ConnectionPresentation =
| { readonly phase: 'connected'; readonly userName: string; readonly failed: Failed }
| { readonly phase: 'connecting'; readonly step: ConnectionStep; readonly url: string | undefined; readonly cancellable: boolean }
-/** Page-facing actions and the snapshot hook the slot entries inject. */
-export interface ConnectionFace {
- hooks: { tencentMeetingConnection: HostObservable }
- /** Check the account again. */
- check(): void
- /** Sign in through the authorization page. */
- signIn(): void
- /** Sign out after the page confirms it. */
- signOut(): void
- cancel(): void
- openAuthorization(): void
- /** Reopen the Host stream after it stopped. */
- retry(): void
- dismissNotice(): void
-}
-
function step(operation: NonNullable): ConnectionStep {
if (operation.kind === 'sign-out') return 'signing-out'
return operation.phase === 'authorizing' ? 'authorizing' : 'connecting'
@@ -70,28 +48,3 @@ export function presentConnection(snapshot: Pick
- face: ConnectionFace
-} {
- const connection = new CliAccountConnection(ctx, {
- name: 'Tencent Meeting connection',
- follow: signal => ctx.remote.tencentMeeting.follow(signal),
- cancel: id => ctx.remote.tencentMeeting.cancel(id),
- notices: { 'sign-in': 'connected', 'sign-out': 'signed-out' },
- })
- const face: ConnectionFace = {
- hooks: { tencentMeetingConnection: connection.state },
- check: () => { connection.start(() => ctx.remote.tencentMeeting.check()) },
- signIn: () => { connection.start(() => ctx.remote.tencentMeeting.signIn()) },
- signOut: () => { connection.start(() => ctx.remote.tencentMeeting.signOut()) },
- ...connection.actions,
- }
- return { connection, face }
-}
diff --git a/packages/client/ui-tencent-meeting/src/client/index.ts b/packages/client/ui-tencent-meeting/src/client/index.ts
index 3220bb6298..4001544b74 100644
--- a/packages/client/ui-tencent-meeting/src/client/index.ts
+++ b/packages/client/ui-tencent-meeting/src/client/index.ts
@@ -1,53 +1,46 @@
/**
- * Tencent Meeting plugin, browser half: the account section on the Tencent Meeting bundle's page, the tag beside its
- * title, guidance after the bundle is switched on, and notices. The Host's `tencentMeeting` Remote owns the account
- * operations; this half mounts that Remote itself because the on-demand package stays out of the shipped Remote assembly.
+ * Tencent Meeting plugin, browser half: registers the Tencent Meeting account with the Plugins page's CLI account
+ * surfaces. The Host's `tencentMeeting` Remote owns the account operations; this half mounts that Remote itself because
+ * the on-demand package stays out of the shipped Remote assembly.
*/
import type { Context } from '@deepseek-ai/cordis'
import type {} from '@deepseek-ai/dsh-api-remotes/client'
import type {} from '@deepseek-ai/dsh-client-locale/client'
-import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
-import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
-import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
+import type {} from '@deepseek-ai/dsh-client-ui-cli-account/client'
import tencentMeetingRemote from '@deepseek-ai/dsh-tencent-meeting-cli/remote'
-import { TENCENT_MEETING_PACKAGE, createConnection } from './connection.ts'
+import type { TencentMeetingState } from '@deepseek-ai/dsh-tencent-meeting-cli/types'
+import { presentAccount } from './account.ts'
+import { TENCENT_MEETING_PACKAGE } from './connection.ts'
import { de, en, es, fr, ja, NS, pt, ru, zh } from './locales.ts'
-import {
- TencentMeetingConnectionActivation,
- TencentMeetingConnectionBadge,
- TencentMeetingConnectionSection,
- TencentMeetingConnectionToast,
-} from './TencentMeetingConnection.tsx'
-/** Services the Remote mount and the slot registrations need. */
-export const inject = ['remote', 'slots', 'locale']
+/** Services the Remote mount and the account registration need. */
+export const inject = ['remote', 'locale', 'cliAccounts']
function registerUi(ctx: Context): void {
ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'tencent-meeting: dictionaries')
- const { connection, face } = createConnection(ctx)
- ctx.effect(() => async () => { await connection.dispose() }, 'tencent-meeting: connection')
- ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
- name: 'plugins.bundle.config', key: TENCENT_MEETING_PACKAGE, locale: NS, inject: () => face,
- }, TencentMeetingConnectionSection))
- ctx.slots.inject('plugins.bundle.activation', () => ctx.slots.register({
- name: 'plugins.bundle.activation', key: TENCENT_MEETING_PACKAGE, locale: NS, inject: () => face,
- }, TencentMeetingConnectionActivation))
- ctx.slots.inject('plugins.detail.badge', () => ctx.slots.register({
- name: 'plugins.detail.badge', id: 'tencent-meeting.connection', locale: NS, inject: () => face,
- }, TencentMeetingConnectionBadge))
- ctx.slots.inject('shell.overlay', () => ctx.slots.register({
- name: 'shell.overlay', id: 'tencent-meeting.connection-toast', locale: NS, inject: () => face,
- }, TencentMeetingConnectionToast))
+ const t = ctx.locale.bind(NS)
+ ctx.effect(() => ctx.cliAccounts.register({
+ packageName: TENCENT_MEETING_PACKAGE, locale: NS,
+ follow: signal => ctx.remote.tencentMeeting.follow(signal),
+ cancel: id => ctx.remote.tencentMeeting.cancel(id),
+ notices: { 'sign-in': () => t('notice.connected'), 'sign-out': () => t('notice.signed-out') },
+ present: (snapshot, page) => presentAccount(snapshot, t, {
+ ...page,
+ check: () => { page.start(() => ctx.remote.tencentMeeting.check()) },
+ signIn: () => { page.start(() => ctx.remote.tencentMeeting.signIn()) },
+ signOut: () => { page.start(() => ctx.remote.tencentMeeting.signOut()) },
+ }),
+ }), 'tencent-meeting: account')
}
/**
- * Mount the Tencent Meeting Remote, then register the account surfaces for as long as the Tencent Meeting row is on.
+ * Mount the Tencent Meeting Remote, then register the account for as long as the Tencent Meeting row is on.
* @param ctx - the browser plugin context.
- * @returns a disposer that withdraws the surfaces, then the Remote.
+ * @returns a disposer that withdraws the account, then the Remote.
*/
export async function apply(ctx: Context): Promise<() => Promise> {
const disposeRemote = await ctx.remote.$mount(tencentMeetingRemote)
- const ui = ctx.inject(['remote.tencentMeeting', 'slots', 'locale'], registerUi)
+ const ui = ctx.inject(['remote.tencentMeeting', 'locale', 'cliAccounts'], registerUi)
try {
await ui
} catch (error) {
diff --git a/packages/client/ui-tencent-meeting/tests/account.client.spec.ts b/packages/client/ui-tencent-meeting/tests/account.client.spec.ts
new file mode 100644
index 0000000000..7458aad82c
--- /dev/null
+++ b/packages/client/ui-tencent-meeting/tests/account.client.spec.ts
@@ -0,0 +1,109 @@
+/** The Tencent Meeting section offers each state's next step, the signed-in user, sign-out confirmation, guide rows, and failures. */
+import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
+import type { CliOperationId } from '@deepseek-ai/dsh-cli-account/types'
+import type { CliAccountAction, CliAccountDisplay } from '@deepseek-ai/dsh-client-ui-cli-account/client'
+import type { TencentMeetingState } from '@deepseek-ai/dsh-tencent-meeting-cli/types'
+import { expect, it, vi } from 'vitest'
+import { presentAccount, type TencentMeetingActions } from '../src/client/account.ts'
+import type { ConnectionSnapshot } from '../src/client/connection.ts'
+import { en, zh } from '../src/client/locales.ts'
+
+const OP = 'op' as CliOperationId
+const LINK = 'https://meeting.tencent.com/marketplace/tencentmeeting-cli-auth.html?code=fixture'
+const SIGNED_OUT: TencentMeetingState = { account: { state: 'signed-out', skills: 'installed' } }
+const CONNECTED: TencentMeetingState = { account: { state: 'connected', userName: '测试用户', skills: 'installed' } }
+
+function fixture(copy: typeof zh = zh) {
+ const actions: TencentMeetingActions = {
+ start: vi.fn(), cancel: vi.fn(), openAuthorization: vi.fn(), retry: vi.fn(), check: vi.fn(), signIn: vi.fn(), signOut: vi.fn(),
+ }
+ const show = (view: TencentMeetingState | undefined, page: Partial = {}): CliAccountDisplay =>
+ presentAccount({ view, linked: true, stopped: false, busy: false, notice: undefined, ...page }, makeTranslate(copy), actions)
+ return { actions, show }
+}
+
+const labels = (display: CliAccountDisplay): string[] => (display.actions ?? []).map(action => action.label)
+const action = (display: CliAccountDisplay, label: string): CliAccountAction => {
+ const found = [...display.actions ?? [], ...(display.notes ?? []).flatMap(note => note.action ?? [])].find(item => item.label === label)
+ if (found === undefined) throw new Error(`no ${label} action`)
+ return found
+}
+
+it('offers the next step while signing in', () => {
+ const b = fixture()
+ let shown = b.show(SIGNED_OUT)
+ expect(shown).toMatchObject({ phase: 'disconnected', detail: zh['detail.disconnected'], notes: [] })
+ action(shown, zh['action.connect']).onClick()
+ expect(b.actions.signIn).toHaveBeenCalledOnce()
+
+ shown = b.show({ ...SIGNED_OUT, operation: { id: OP, kind: 'sign-in', phase: 'authorizing', cancellable: true } })
+ expect(shown.status).toBe(zh['step.authorizing'])
+ expect(labels(shown)).toEqual([zh['action.cancel']])
+ shown = b.show({ ...SIGNED_OUT, operation: { id: OP, kind: 'sign-in', phase: 'authorizing', cancellable: true, authorizationUrl: LINK } })
+ expect(shown.detail).toBe(zh['detail.authorizing'])
+ action(shown, zh['action.open']).onClick()
+ action(shown, zh['action.cancel']).onClick()
+ expect(b.actions.openAuthorization).toHaveBeenCalledOnce()
+ expect(b.actions.cancel).toHaveBeenCalledOnce()
+
+ shown = b.show({ ...SIGNED_OUT, operation: { id: OP, kind: 'sign-in', phase: 'checking', cancellable: false } })
+ expect(shown).toMatchObject({ status: zh['step.connecting'], actions: [] })
+
+ shown = b.show(undefined)
+ expect(shown).toMatchObject({ phase: 'checking', actions: [], notes: [] })
+})
+
+it('names the signed-in user and asks before signing out', () => {
+ const b = fixture()
+ let shown = b.show(CONNECTED)
+ expect(shown.detail).toBe(zh['detail.connected'].replace('{name}', '测试用户'))
+ const signOut = action(shown, zh['action.signOut'])
+ expect(signOut.confirm).toEqual({ title: zh['signOut.title'], body: zh['signOut.body'], label: zh['action.signOut'] })
+ signOut.onClick()
+ expect(b.actions.signOut).toHaveBeenCalledOnce()
+
+ shown = b.show({ ...CONNECTED, operation: { id: OP, kind: 'sign-out', phase: 'signing-out', cancellable: false } })
+ expect(shown).toMatchObject({ status: zh['step.signing-out'], actions: [] })
+})
+
+it.each([['zh', zh], ['en', en]] as const)('reports a failed sign-in with its command in %s', (_locale, copy) => {
+ const b = fixture(copy)
+ let shown = b.show({ ...SIGNED_OUT, result: { id: OP, kind: 'sign-in', outcome: 'failed', failure: { command: 'auth-login', exitCode: 1 } } })
+ expect(shown.failure).toEqual({ text: copy.failed, command: { command: 'auth-login', exitCode: 1 } })
+ expect(labels(shown)).toEqual([copy['action.connect']])
+
+ shown = b.show({ ...SIGNED_OUT, result: { id: OP, kind: 'sign-in', outcome: 'cancelled' } })
+ expect(shown.failure).toBeUndefined()
+})
+
+it('retries an unconfirmed sign-in by checking again', () => {
+ const b = fixture()
+ const shown = b.show({ account: { state: 'unverified', skills: 'installed' } })
+ expect(shown.detail).toBe(zh['detail.unavailable'])
+ action(shown, zh['action.retry']).onClick()
+ expect(b.actions.check).toHaveBeenCalledOnce()
+})
+
+it('reports a guide that is downloading, and retries a failed download by checking again', () => {
+ const b = fixture()
+ expect(b.show({ account: { state: 'signed-out', skills: 'downloading' } }).notes).toEqual([{ text: zh['skills.downloading'] }])
+ const shown = b.show({ account: { state: 'signed-out', skills: 'failed' } })
+ expect(shown.notes?.map(note => note.text)).toEqual([zh['skills.failed']])
+ action(shown, zh['action.retry']).onClick()
+ expect(b.actions.check).toHaveBeenCalledOnce()
+ expect(b.show(SIGNED_OUT).notes).toEqual([])
+})
+
+it('explains a stopped Host component and reopens the stream', () => {
+ const b = fixture()
+ const shown = b.show(undefined, { linked: false, stopped: true })
+ expect(shown).toMatchObject({ phase: 'stopped', detail: zh['detail.stopped'] })
+ action(shown, zh['action.retry']).onClick()
+ expect(b.actions.retry).toHaveBeenCalledOnce()
+})
+
+it('answers the activation prompt by signing in', () => {
+ const b = fixture()
+ const primary = b.show(SIGNED_OUT).actions?.filter(item => item.variant === 'primary' && item.confirm === undefined)
+ expect(primary?.map(item => item.onClick)).toEqual([b.actions.signIn])
+})
diff --git a/packages/client/ui-tencent-meeting/tests/components.client.spec.tsx b/packages/client/ui-tencent-meeting/tests/components.client.spec.tsx
deleted file mode 100644
index 673f12c7b7..0000000000
--- a/packages/client/ui-tencent-meeting/tests/components.client.spec.tsx
+++ /dev/null
@@ -1,159 +0,0 @@
-// @vitest-environment jsdom
-/** The account section, title tag, activation guidance, and notices render the Host view the page mirrors. */
-import type { ComponentProps } from 'react'
-import { act, cleanup, fireEvent, render, screen, within } from '@testing-library/react'
-import { bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
-import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
-import type { CliOperationId } from '@deepseek-ai/dsh-cli-account/types'
-import type { PluginPackageRef, PluginsSubject } from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
-import type { TencentMeetingState } from '@deepseek-ai/dsh-tencent-meeting-cli/types'
-import { afterEach, expect, it, vi } from 'vitest'
-import type { ConnectionSnapshot } from '../src/client/connection.ts'
-import { en, zh } from '../src/client/locales.ts'
-import {
- TencentMeetingConnectionActivation, TencentMeetingConnectionBadge, TencentMeetingConnectionSection, TencentMeetingConnectionToast,
-} from '../src/client/TencentMeetingConnection.tsx'
-
-afterEach(cleanup)
-
-const OP = 'op' as CliOperationId
-const LINK = 'https://meeting.tencent.com/marketplace/tencentmeeting-cli-auth.html?code=fixture'
-const SIGNED_OUT: TencentMeetingState = { account: { state: 'signed-out', skills: 'installed' } }
-const CONNECTED: TencentMeetingState = { account: { state: 'connected', userName: '测试用户', skills: 'installed' } }
-
-function fixture(view?: TencentMeetingState, copy: typeof zh = zh) {
- const state = createSnapshotStore({ view, linked: true, stopped: false, busy: false, notice: undefined })
- const face = {
- useTencentMeetingConnection: bindSnapshotSelector(state),
- check: vi.fn(), signIn: vi.fn(), signOut: vi.fn(), cancel: vi.fn(),
- openAuthorization: vi.fn(), retry: vi.fn(), dismissNotice: vi.fn(),
- t: makeTranslate(copy),
- }
- return { face, set: (change: Partial) => { act(() => { state.set({ ...state.getSnapshot(), ...change }) }) } }
-}
-
-const button = (name: string) => screen.getByRole('button', { name })
-
-it('offers the next step while signing in', () => {
- const b = fixture(SIGNED_OUT)
- render()
- expect(screen.getByText(zh['detail.disconnected'])).toBeTruthy()
- expect(screen.getByText(zh.hint)).toBeTruthy()
- fireEvent.click(button(zh['action.connect']))
- expect(b.face.signIn).toHaveBeenCalledOnce()
-
- b.set({ view: { ...SIGNED_OUT, operation: { id: OP, kind: 'sign-in', phase: 'authorizing', cancellable: true } } })
- expect(screen.getByText(zh['step.authorizing'])).toBeTruthy()
- expect(screen.queryByRole('button', { name: zh['action.open'] })).toBeNull()
- b.set({ view: { ...SIGNED_OUT, operation: { id: OP, kind: 'sign-in', phase: 'authorizing', cancellable: true, authorizationUrl: LINK } } })
- expect(screen.getByText(zh['detail.authorizing'])).toBeTruthy()
- fireEvent.click(button(zh['action.open']))
- fireEvent.click(button(zh['action.cancel']))
- expect(b.face.openAuthorization).toHaveBeenCalledOnce()
- expect(b.face.cancel).toHaveBeenCalledOnce()
-
- b.set({ view: { ...SIGNED_OUT, operation: { id: OP, kind: 'sign-in', phase: 'checking', cancellable: false } } })
- expect(screen.getByText(zh['step.connecting'])).toBeTruthy()
- expect(screen.queryAllByRole('button')).toHaveLength(0)
-
- b.set({ view: undefined })
- expect(screen.getByText(zh['status.checking'])).toBeTruthy()
- expect(screen.queryAllByRole('button')).toHaveLength(0)
-})
-
-it('names the signed-in user and signs out only after confirmation', () => {
- const b = fixture(CONNECTED)
- render()
- expect(screen.getByText(zh['detail.connected'].replace('{name}', '测试用户'))).toBeTruthy()
-
- fireEvent.click(button(zh['action.signOut']))
- const dialog = screen.getByRole('dialog')
- expect(within(dialog).getByText(zh['signOut.body'])).toBeTruthy()
- fireEvent.click(within(dialog).getByRole('button', { name: zh['action.cancel'] }))
- expect(b.face.signOut).not.toHaveBeenCalled()
-
- fireEvent.click(button(zh['action.signOut']))
- fireEvent.click(within(screen.getByRole('dialog')).getByRole('button', { name: zh['action.signOut'] }))
- expect(b.face.signOut).toHaveBeenCalledOnce()
-
- b.set({ view: { ...CONNECTED, operation: { id: OP, kind: 'sign-out', phase: 'signing-out', cancellable: false } } })
- expect(screen.getByText(zh['step.signing-out'])).toBeTruthy()
- expect(screen.queryAllByRole('button')).toHaveLength(0)
-})
-
-it.each([['zh', zh], ['en', en]] as const)('reports a failed sign-in with its command and exit code in %s', (_locale, copy) => {
- const b = fixture({ ...SIGNED_OUT, result: { id: OP, kind: 'sign-in', outcome: 'failed', failure: { command: 'auth-login', exitCode: 1 } } }, copy)
- render()
- const details = copy['failure.details'].replace('{details}', `auth-login · ${copy['failure.exitCode'].replace('{code}', '1')}`)
- expect(screen.getByRole('alert').textContent).toBe(`${copy.failed} ${details}`)
- expect(button(copy['action.connect'])).toBeTruthy()
-
- b.set({ view: { ...SIGNED_OUT, result: { id: OP, kind: 'sign-in', outcome: 'cancelled' } } })
- expect(screen.queryByRole('alert')).toBeNull()
-})
-
-it('retries an unconfirmed sign-in by checking again', () => {
- const b = fixture({ account: { state: 'unverified', skills: 'installed' } })
- render()
- expect(screen.getByText(zh['detail.unavailable'])).toBeTruthy()
- fireEvent.click(button(zh['action.retry']))
- expect(b.face.check).toHaveBeenCalledOnce()
-})
-
-it('reports a guide that is downloading, and retries a failed download by checking again', () => {
- const b = fixture({ account: { state: 'signed-out', skills: 'downloading' } })
- render()
- expect(screen.getByText(zh['skills.downloading'])).toBeTruthy()
- expect(screen.queryByRole('button', { name: zh['action.retry'] })).toBeNull()
- b.set({ view: { account: { state: 'signed-out', skills: 'failed' } } })
- expect(screen.queryByText(zh['skills.downloading'])).toBeNull()
- fireEvent.click(button(zh['action.retry']))
- expect(b.face.check).toHaveBeenCalledOnce()
- b.set({ view: { account: { state: 'signed-out', skills: 'installed' } } })
- expect(screen.queryByText(zh['skills.failed'])).toBeNull()
-})
-
-it('explains a stopped Host component and retries even while the stream is offline', () => {
- const b = fixture(undefined)
- render()
- b.set({ linked: false, stopped: true })
- expect(screen.getByText(zh['status.stopped'])).toBeTruthy()
- expect(screen.getByText(zh['detail.stopped'])).toBeTruthy()
- fireEvent.click(button(zh['action.retry']))
- expect(b.face.retry).toHaveBeenCalledOnce()
-})
-
-it('tags only the enabled Tencent Meeting bundle', () => {
- const b = fixture(CONNECTED)
- const pkg = (name: string, enabled = true): PluginPackageRef => ({ name, installed: true, availability: 'profile', official: false, enabled, rows: [] })
- const badge = (subject: PluginsSubject) =>
- } />
- const { rerender } = render(badge({ kind: 'bundle', pkg: pkg('@deepseek-ai/dsh-tencent-meeting') }))
- expect(screen.getByText(zh['badge.connected'])).toBeTruthy()
- b.set({ view: SIGNED_OUT })
- expect(screen.getByText(zh['badge.disconnected'])).toBeTruthy()
- rerender(badge({ kind: 'bundle', pkg: pkg('@acme/other') }))
- expect(document.body.textContent).toBe('')
-})
-
-it('guides a newly enabled bundle to sign in, and steps aside once connected', () => {
- const b = fixture()
- const onDismiss = vi.fn(), onOpenDetails = vi.fn()
- const props = { ...b.face, packageName: '@deepseek-ai/dsh-tencent-meeting', onDismiss, onOpenDetails } as ComponentProps
- render()
- expect(screen.queryByText(zh['activation.body'])).toBeNull()
- b.set({ view: SIGNED_OUT })
- fireEvent.click(button(zh['action.connect']))
- expect(onOpenDetails).toHaveBeenCalledOnce()
- expect(b.face.signIn).toHaveBeenCalledOnce()
- b.set({ view: CONNECTED })
- expect(onDismiss).toHaveBeenCalledOnce()
-})
-
-it('reports the latest notice', () => {
- const b = fixture()
- render()
- expect(document.body.textContent).toBe('')
- b.set({ notice: { seq: 1, kind: 'signed-out' } })
- expect(screen.getByText(zh['notice.signed-out'])).toBeTruthy()
-})
diff --git a/packages/client/ui-tencent-meeting/tests/connection.client.spec.ts b/packages/client/ui-tencent-meeting/tests/connection.client.spec.ts
index a31b6446a4..5ec454b7fb 100644
--- a/packages/client/ui-tencent-meeting/tests/connection.client.spec.ts
+++ b/packages/client/ui-tencent-meeting/tests/connection.client.spec.ts
@@ -1,12 +1,8 @@
-// @vitest-environment jsdom
-/** The page derives the Tencent Meeting account from the Host's view and drives operations through its Remote. */
-import { Context } from '@deepseek-ai/cordis'
-import type { RemoteStreamOptions } from '@deepseek-ai/dsh-api-gateway/client'
+/** The page derives the Tencent Meeting account from the Host's view. */
import type { CliOperationId } from '@deepseek-ai/dsh-cli-account/types'
import type { TencentMeetingState } from '@deepseek-ai/dsh-tencent-meeting-cli/types'
-import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
-import { expect, it, onTestFinished, vi } from 'vitest'
-import { createConnection, presentConnection, type ConnectionPresentation } from '../src/client/connection.ts'
+import { expect, it } from 'vitest'
+import { presentConnection, type ConnectionPresentation } from '../src/client/connection.ts'
type Operation = NonNullable
@@ -40,95 +36,3 @@ it.each<[string, TencentMeetingState | undefined, ConnectionPresentation]>([
])('presents %s', (name, view, expected) => {
expect(presentConnection({ view, stopped: name === 'a stopped stream' })).toEqual(expected)
})
-
-function fixture() {
- const queue: TencentMeetingState[] = []
- let wake: (() => void) | undefined, closed = false, accepted = 0
- let options!: RemoteStreamOptions
- const ok = (value: T): RemoteResult => ({ ok: true, value })
- const remote = {
- follow: vi.fn(),
- check: vi.fn(async () => ok(OP)),
- signIn: vi.fn(async () => ok(OP)),
- signOut: vi.fn(async () => ok(OP)),
- cancel: vi.fn(async (_id: CliOperationId) => ok(undefined)),
- }
- const ctx = new Context()
- ctx.provide('remote', {
- tencentMeeting: remote,
- $stream: (value: typeof options) => {
- options = value
- return {
- async *[Symbol.asyncIterator]() {
- for (;;) {
- if (closed) return
- const next = queue.shift()
- if (next === undefined) { await new Promise((resolve) => { wake = resolve }); continue }
- yield { value: next, accept: () => { accepted++ } }
- }
- },
- dispose: async () => { closed = true; wake?.() },
- }
- },
- })
- const windowOpen = vi.spyOn(window, 'open').mockReturnValue(null)
- const { connection, face } = createConnection(ctx)
- onTestFinished(async () => { await connection.dispose(); windowOpen.mockRestore(); await ctx.fiber.dispose() })
- return {
- face, remote, open: windowOpen, options: () => options,
- snapshot: () => connection.state.getSnapshot(),
- async publish(view: TencentMeetingState) {
- const target = accepted + 1
- queue.push(view)
- wake?.()
- await vi.waitFor(() => { expect(accepted).toBe(target) })
- },
- }
-}
-
-const settle = async (b: ReturnType) => { await vi.waitFor(() => { expect(b.snapshot().busy).toBe(false) }) }
-
-it('follows the tencentMeeting Remote and exposes the mirror to the page', async () => {
- const b = fixture()
- const signal = new AbortController().signal
- b.options().open(signal)
- expect(b.remote.follow).toHaveBeenCalledWith(signal)
- await b.publish(SIGNED_OUT)
- expect(b.face.hooks.tencentMeetingConnection.getSnapshot()).toMatchObject({ view: SIGNED_OUT, linked: true, busy: false })
-})
-
-it('signs in through the Remote, opens the authorization page once, and reports the connection', async () => {
- const b = fixture()
- await b.publish(SIGNED_OUT)
- b.face.signIn()
- await settle(b)
- expect(b.remote.signIn).toHaveBeenCalledOnce()
- await b.publish({ ...SIGNED_OUT, operation: operation('sign-in', 'authorizing', true, LINK) })
- await b.publish({ ...SIGNED_OUT, operation: operation('sign-in', 'authorizing', true, LINK) })
- expect(b.open.mock.calls.map(call => call[0])).toEqual([LINK])
- b.face.cancel()
- await settle(b)
- expect(b.remote.cancel).toHaveBeenCalledWith(OP)
- await b.publish({ ...CONNECTED, result: { id: OP, kind: 'sign-in', outcome: 'succeeded' } })
- expect(b.snapshot().notice).toEqual({ seq: 1, kind: 'connected' })
-})
-
-it('signs out through the Remote and reports it', async () => {
- const b = fixture()
- await b.publish(CONNECTED)
- b.face.signOut()
- await settle(b)
- expect(b.remote.signOut).toHaveBeenCalledOnce()
- await b.publish({ ...SIGNED_OUT, result: { id: OP, kind: 'sign-out', outcome: 'succeeded' } })
- expect(b.snapshot().notice).toEqual({ seq: 1, kind: 'signed-out' })
-})
-
-it('checks again without a notice', async () => {
- const b = fixture()
- await b.publish({ account: { state: 'unverified', skills: 'installed' } })
- b.face.check()
- await settle(b)
- expect(b.remote.check).toHaveBeenCalledOnce()
- await b.publish({ ...CONNECTED, result: { id: OP, kind: 'check', outcome: 'succeeded' } })
- expect(b.snapshot().notice).toBeUndefined()
-})
diff --git a/packages/client/ui-tencent-meeting/tests/mount.client.spec.ts b/packages/client/ui-tencent-meeting/tests/mount.client.spec.ts
index a95045c493..db971708ed 100644
--- a/packages/client/ui-tencent-meeting/tests/mount.client.spec.ts
+++ b/packages/client/ui-tencent-meeting/tests/mount.client.spec.ts
@@ -1,65 +1,75 @@
-/** The browser half mounts the Tencent Meeting Remote, registers its surfaces, and withdraws both on disposal or failure. */
+/** The browser half mounts the Tencent Meeting Remote, registers its account, and withdraws both on disposal or failure. */
import { Context, Service } from '@deepseek-ai/cordis'
+import type { CliOperationId } from '@deepseek-ai/dsh-cli-account/types'
import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client'
-import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client'
+import type { CliAccountPage, CliAccountRegistration } from '@deepseek-ai/dsh-client-ui-cli-account/client'
+import type { TencentMeetingState } from '@deepseek-ai/dsh-tencent-meeting-cli/types'
import type { TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol'
import { expect, it, vi } from 'vitest'
import { apply as hostApply } from '../src/index.ts'
-import { TencentMeetingConnectionActivation, TencentMeetingConnectionBadge, TencentMeetingConnectionSection, TencentMeetingConnectionToast } from '../src/client/TencentMeetingConnection.tsx'
+import { en } from '../src/client/locales.ts'
const REMOTE: TypertRemoteContribution = { package: '@deepseek-ai/dsh-tencent-meeting-cli', descriptors: [] }
-const SLOTS = [
- ['plugins.bundle.config', TencentMeetingConnectionSection],
- ['plugins.bundle.activation', TencentMeetingConnectionActivation],
- ['plugins.detail.badge', TencentMeetingConnectionBadge],
- ['shell.overlay', TencentMeetingConnectionToast],
-] as const
+const OP = 'op' as CliOperationId
async function fixture() {
const ctx = new Context()
const unmount = vi.fn(async () => {})
- const dispose = vi.fn(async () => {})
+ const remote = { follow: vi.fn(), cancel: vi.fn(), check: vi.fn(), signIn: vi.fn(), signOut: vi.fn() }
class Remote extends Service {
constructor() { super(ctx, 'remote') }
async $mount(contribution: TypertRemoteContribution) {
expect(contribution).toBe(REMOTE)
- ctx.provide('remote.tencentMeeting', { follow: vi.fn() })
+ ctx.provide('remote.tencentMeeting', remote)
return unmount
}
- $stream() {
- return { async *[Symbol.asyncIterator]() { /* the Host reports nothing in this composition */ }, dispose }
- }
}
new Remote()
- ctx.provide('locale', new LocaleRuntime(ctx))
- await ctx.plugin(SlotRegistry)
- ctx.slots.register({ name: 'root', children: {
- 'plugins.bundle.activation': { kind: 'keyed', scope: 'root' },
- 'plugins.bundle.config': { kind: 'keyed', scope: 'root' },
- 'plugins.detail.badge': { kind: 'list', scope: 'root' },
- 'shell.overlay': { kind: 'list', scope: 'root' },
- } } as never, () => null)
+ const locale = new LocaleRuntime(ctx)
+ ctx.provide('locale', locale)
+ const unregister = vi.fn()
+ const register = vi.fn((_account: CliAccountRegistration) => unregister)
+ ctx.provide('cliAccounts', { register })
vi.doMock('@deepseek-ai/dsh-tencent-meeting-cli/remote', () => ({ default: REMOTE }))
const browser = await import('../src/client/index.ts')
- return { ctx, unmount, dispose, browser }
+ return { ctx, locale, unmount, remote, register, unregister, browser }
}
-it('registers the connection surfaces with one shared face, then withdraws them and the Remote', async () => {
+it('registers the Tencent Meeting account over its Remote, then withdraws it and the Remote', async () => {
hostApply()
const b = await fixture()
try {
const fiber = b.ctx.plugin({ inject: [...b.browser.inject], apply: b.browser.apply })
await fiber
- const faces = SLOTS.map(([slot, component]) => {
- const [entry] = b.ctx.slots.entries(slot)
- expect(entry).toMatchObject({ locale: 'tencent-meeting', component })
- return entry!.inject!()
- })
- expect(new Set(faces.map(face => face.hooks)).size).toBe(1)
- expect(b.ctx.slots.entries('plugins.bundle.config')[0]!.options.key).toBe('@deepseek-ai/dsh-tencent-meeting')
+ b.locale.setLocale('en')
+ expect(b.register).toHaveBeenCalledOnce()
+ const account = b.register.mock.calls[0]![0]
+ expect(account).toMatchObject({ packageName: '@deepseek-ai/dsh-tencent-meeting', locale: 'tencent-meeting' })
+ const signal = new AbortController().signal
+ void account.follow(signal)
+ void account.cancel(OP)
+ expect(b.remote.follow).toHaveBeenCalledWith(signal)
+ expect(b.remote.cancel).toHaveBeenCalledWith(OP)
+ expect(account.notices['sign-in']?.()).toBe(en['notice.connected'])
+ expect(account.notices['sign-out']?.()).toBe(en['notice.signed-out'])
+ expect(account.notices.check).toBeUndefined()
+
+ const page: CliAccountPage = { start: vi.fn((call) => { void call() }), cancel: vi.fn(), openAuthorization: vi.fn(), retry: vi.fn() }
+ const snapshot = { linked: true, stopped: false, busy: false, notice: undefined }
+ const press = (view: TencentMeetingState, label: string) => {
+ const found = account.present({ ...snapshot, view }, page).actions?.find(item => item.label === label)
+ expect(found).toBeDefined()
+ found!.onClick()
+ }
+ press({ account: { state: 'signed-out', skills: 'installed' } }, en['action.connect'])
+ press({ account: { state: 'unverified', skills: 'installed' } }, en['action.retry'])
+ press({ account: { state: 'connected', userName: 'Ada', skills: 'installed' } }, en['action.signOut'])
+ expect(b.remote.signIn).toHaveBeenCalledOnce()
+ expect(b.remote.check).toHaveBeenCalledOnce()
+ expect(b.remote.signOut).toHaveBeenCalledOnce()
+
await fiber.dispose()
- for (const [slot] of SLOTS) expect(b.ctx.slots.entries(slot)).toHaveLength(0)
- expect(b.dispose).toHaveBeenCalledOnce()
+ expect(b.unregister).toHaveBeenCalledOnce()
expect(b.unmount).toHaveBeenCalledOnce()
} finally {
await b.ctx.fiber.dispose()
@@ -67,11 +77,11 @@ it('registers the connection surfaces with one shared face, then withdraws them
}
})
-it('withdraws the Remote when the surfaces fail to register', async () => {
+it('withdraws the Remote when the account fails to register', async () => {
const b = await fixture()
- vi.spyOn(b.ctx.slots, 'inject').mockImplementationOnce(() => { throw new Error('slot failed') })
+ b.register.mockImplementationOnce(() => { throw new Error('register failed') })
try {
- await expect(b.browser.apply(b.ctx)).rejects.toThrow('slot failed')
+ await expect(b.browser.apply(b.ctx)).rejects.toThrow('register failed')
expect(b.unmount).toHaveBeenCalledOnce()
} finally {
await b.ctx.fiber.dispose()
diff --git a/packages/client/ui-tencent-meeting/tsconfig.json b/packages/client/ui-tencent-meeting/tsconfig.json
index eeb191ecfb..d012d3cd99 100644
--- a/packages/client/ui-tencent-meeting/tsconfig.json
+++ b/packages/client/ui-tencent-meeting/tsconfig.json
@@ -11,27 +11,12 @@
{
"path": "../../../vendor/cordis"
},
- {
- "path": "../../api/gateway/tsconfig.client.json"
- },
{
"path": "../../api/remotes/tsconfig.client.json"
},
{
"path": "../locale/tsconfig.client.json"
},
- {
- "path": "../store"
- },
- {
- "path": "../ui-layout"
- },
- {
- "path": "../ui-plugin-manager/tsconfig.client.json"
- },
- {
- "path": "../ui-renderer"
- },
{
"path": "../ui-slots"
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 28d289a657..bd0cd85a38 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -6690,9 +6690,6 @@ importers:
'@deepseek-ai/cordis':
specifier: workspace:~
version: link:../../../vendor/cordis
- '@deepseek-ai/dsh-api-gateway':
- specifier: workspace:*
- version: link:../../api/gateway
'@deepseek-ai/dsh-api-remotes':
specifier: workspace:*
version: link:../../api/remotes
@@ -6702,24 +6699,12 @@ importers:
'@deepseek-ai/dsh-client-locale':
specifier: workspace:*
version: link:../locale
- '@deepseek-ai/dsh-client-store':
- specifier: workspace:*
- version: link:../store
'@deepseek-ai/dsh-client-test-runtime':
specifier: workspace:*
version: link:../../test-support/client-runtime
'@deepseek-ai/dsh-client-ui-cli-account':
specifier: workspace:*
version: link:../ui-cli-account
- '@deepseek-ai/dsh-client-ui-layout':
- specifier: workspace:*
- version: link:../ui-layout
- '@deepseek-ai/dsh-client-ui-plugin-manager':
- specifier: workspace:*
- version: link:../ui-plugin-manager
- '@deepseek-ai/dsh-client-ui-renderer':
- specifier: workspace:*
- version: link:../ui-renderer
'@deepseek-ai/dsh-client-ui-slots':
specifier: workspace:*
version: link:../ui-slots
@@ -6735,15 +6720,6 @@ importers:
'@deepseek-ai/dsh-util-values':
specifier: workspace:*
version: link:../../util/values
- '@testing-library/react':
- specifier: ^16.3.3
- version: 16.3.3(@testing-library/dom@10.4.2)(@types/react-dom@18.3.7(@types/react@18.3.31))(@types/react@18.3.31)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
- react:
- specifier: ^18.2.0
- version: 18.3.1
- react-dom:
- specifier: ^18.2.0
- version: 18.3.1(react@18.3.1)
packages/client/ui-theme:
dependencies: