From 81aef2ec2d2f0a9e3d1baf1aafba2176d34dfcbf Mon Sep 17 00:00:00 2001 From: Turtle Date: Fri, 13 Nov 2026 14:03:48 +0800 Subject: [PATCH] feat(client): show plugin settings on the Plugins page Plugin settings pages registered through `settings.section` stay in the Settings dialog. The Plugins page also shows such a page on the bundle row, or bundle, whose package registered it when that row or bundle has no configuration of its own. Both surfaces render the page through the new `settings.section.view` Factory, which declares `settings.section`; the slot runtime records the registering package on each entry. Settings replaces the Built-in plugins section with a Plugins entry that opens the Plugins page. The two packages behind that section are removed, and the page-local client sync notice moves to the Plugins page. Co-authored-by: LegGasai <75920107+LegGasai@users.noreply.github.com> --- ...webworker-preview-profile-parity.i18n.yaml | 4 +- ...-10-14-webworker-preview-profile-parity.md | 2 +- ...-14-webworker-preview-profile-parity.zh.md | 2 +- apps/web/tests/client-plugin-live.e2e.ts | 57 +- .../section.expected.md | 2 +- .../cards.expected.md | 2 +- .../clear-key.expected.md | 2 +- .../desktop-locale/automatic.expected.md | 2 +- .../desktop-locale/selected.expected.md | 2 +- .../stored-error.expected.md | 2 +- .../catalog-inputs.expected.md | 2 +- .../models-settings/configured.expected.md | 2 +- .../models-settings/declared-edit.expected.md | 2 +- .../models-settings/declared.expected.md | 2 +- .../models-settings/empty.expected.md | 2 +- .../models-settings/image-only.expected.md | 2 +- .../mobile-collapsed.expected.md | 2 +- .../mobile-expanded.expected.md | 2 +- .../native-keyless.expected.md | 2 +- .../models-settings/refreshing.expected.md | 2 +- .../default-models.expected.md | 2 +- .../models.expected.md | 2 +- .../onboarding-native/models.expected.md | 2 +- .../dismissed.expected.md | 2 +- .../plugin-manager/touch-tooltips.expected.md | 2 +- .../settings-chrome/dialog-en.expected.md | 2 +- .../dialog-no-browser.expected.md | 2 +- .../settings-chrome/dialog.expected.md | 2 +- .../plugin-instances.expected.md | 16 - .../settings-chrome/plugins.expected.md | 5 - .../fixture-settings-section/client.js | 16 + .../fixture-settings-section/cordis.patch.yml | 4 + .../plugins/fixture-settings-section/index.js | 2 + .../fixture-settings-section/package.json | 12 + apps/web/tests/plugin-config.e2e.ts | 44 +- apps/web/tests/plugin-manager.e2e.ts | 4 +- apps/web/tests/settings-appearance.e2e.ts | 6 - apps/web/tests/settings-chrome.e2e.ts | 119 +--- docs/capability-seams.i18n.yaml | 4 +- docs/capability-seams.md | 4 +- docs/capability-seams.zh.md | 4 +- docs/config-catalog.md | 2 - docs/config-catalog.zh.md | 2 - .../cookbook/adding-a-settings-card.i18n.yaml | 4 +- docs/cookbook/adding-a-settings-card.md | 2 +- docs/cookbook/adding-a-settings-card.zh.md | 2 +- docs/module-graph.md | 4 - docs/module-graph.zh.md | 4 - .../guide.i18n.yaml | 16 + .../settings-section-plugins-page/guide.md | 19 + .../settings-section-plugins-page/guide.zh.md | 19 + packages/boot/plugin-manager/README.i18n.yaml | 12 +- packages/boot/plugin-manager/README.md | 5 +- packages/boot/plugin-manager/README.zh.md | 5 +- packages/bundle/web-app/cordis.patch.yml | 11 - packages/bundle/web-app/package.json | 2 - packages/client/README.i18n.yaml | 4 +- packages/client/README.md | 2 - packages/client/README.zh.md | 2 - packages/client/hmr/README.i18n.yaml | 8 +- packages/client/hmr/README.md | 4 +- packages/client/hmr/README.zh.md | 4 +- packages/client/modules/README.i18n.yaml | 4 +- packages/client/modules/README.md | 2 +- packages/client/modules/README.zh.md | 2 +- .../client/ui-plugin-manager/README.i18n.yaml | 24 +- packages/client/ui-plugin-manager/README.md | 13 +- .../client/ui-plugin-manager/README.zh.md | 13 +- .../client/ui-plugin-manager/package.json | 2 + .../src/client/ClientSyncNotice.tsx | 30 + .../src/client/PluginManagerPage.module.css | 7 + .../src/client/PluginManagerPage.tsx | 56 +- .../src/client/PluginsSettingsLink.tsx | 28 + .../src/client/config-ledger.ts | 37 +- .../ui-plugin-manager/src/client/index.ts | 33 +- .../ui-plugin-manager/src/client/locales.ts | 48 +- .../tests/browser-plugin.client.spec.tsx | 47 +- .../tests/components.client.spec.tsx | 103 ++- .../tests/config-ledger.client.spec.ts | 19 +- .../tests/manager-store.client.spec.ts | 2 +- .../tests/settings-link.client.spec.tsx | 21 + .../ui-plugin-manager/tsconfig.client.json | 3 + .../client/ui-primitives/README.i18n.yaml | 4 +- packages/client/ui-primitives/README.md | 2 +- packages/client/ui-primitives/README.zh.md | 2 +- .../client/ui-renderer/src/client/registry.ts | 26 + .../ui-renderer/tests/registry.client.spec.ts | 19 + .../ui-settings-general/README.i18n.yaml | 4 +- packages/client/ui-settings-general/README.md | 2 +- .../client/ui-settings-general/README.zh.md | 2 +- .../src/client/SettingsRoot.tsx | 8 +- .../src/client/SettingsSectionView.tsx | 14 + .../ui-settings-general/src/client/index.ts | 7 +- .../src/client/shell-contract.ts | 4 +- .../tests/apply.client.spec.ts | 4 +- .../tests/section-view.client.spec.tsx | 19 + .../tests/settings-root.client.spec.tsx | 21 +- .../tests/shell.client.spec.ts | 4 +- .../README.i18n.yaml | 52 -- .../ui-settings-plugin-inventory/README.md | 111 --- .../ui-settings-plugin-inventory/README.zh.md | 111 --- .../locale/de.json | 6 - .../locale/en.json | 5 - .../locale/es.json | 6 - .../locale/fr.json | 6 - .../locale/ja.json | 6 - .../locale/pt.json | 6 - .../locale/ru.json | 6 - .../locale/zh.json | 6 - .../ui-settings-plugin-inventory/package.json | 77 -- .../PluginInventorySettingsTab.module.css | 512 -------------- .../src/client/PluginInventorySettingsTab.tsx | 586 --------------- .../src/client/index.ts | 64 -- .../src/client/locales.ts | 332 --------- .../src/css-modules.d.ts | 6 - .../ui-settings-plugin-inventory/src/index.ts | 4 - .../tests/browser-plugin.client.spec.tsx | 120 ---- .../tests/components.client.spec.tsx | 669 ------------------ .../tests/touch-styles.client.spec.ts | 86 --- .../tsconfig.json | 51 -- .../tsdown.config.ts | 3 - .../ui-settings-plugins/README.i18n.yaml | 37 - packages/client/ui-settings-plugins/README.md | 79 --- .../client/ui-settings-plugins/README.zh.md | 79 --- .../client/ui-settings-plugins/locale/de.json | 6 - .../client/ui-settings-plugins/locale/en.json | 5 - .../client/ui-settings-plugins/locale/es.json | 6 - .../client/ui-settings-plugins/locale/fr.json | 6 - .../client/ui-settings-plugins/locale/ja.json | 6 - .../client/ui-settings-plugins/locale/pt.json | 6 - .../client/ui-settings-plugins/locale/ru.json | 6 - .../client/ui-settings-plugins/locale/zh.json | 6 - .../client/ui-settings-plugins/package.json | 65 -- .../client/PluginsSettingsSection.module.css | 113 --- .../src/client/PluginsSettingsSection.tsx | 126 ---- .../ui-settings-plugins/src/client/index.ts | 85 --- .../ui-settings-plugins/src/client/locales.ts | 76 -- .../ui-settings-plugins/src/css-modules.d.ts | 4 - .../client/ui-settings-plugins/src/index.ts | 11 - .../tests/apply.client.spec.ts | 98 --- .../tests/section.client.spec.tsx | 93 --- .../client/ui-settings-plugins/tsconfig.json | 33 - .../ui-settings-plugins/tsdown.config.ts | 3 - packages/client/ui-settings/README.i18n.yaml | 12 +- packages/client/ui-settings/README.md | 6 +- packages/client/ui-settings/README.zh.md | 6 +- .../ui-settings/src/client/contract/slots.ts | 49 +- .../client/ui-settings/src/client/index.ts | 2 +- packages/client/ui-slots/src/index.ts | 4 + packages/client/web/README.i18n.yaml | 8 +- packages/client/web/README.md | 4 +- packages/client/web/README.zh.md | 4 +- .../src/client/api-catalog.ts | 2 +- .../src/client/slot-catalog.ts | 81 +-- .../host/plugin-inventory/README.i18n.yaml | 4 +- packages/host/plugin-inventory/README.md | 4 +- packages/host/plugin-inventory/README.zh.md | 4 +- .../skills/dsh-doc/references/packages.md | 2 - .../official-bundles/src/plugin-manager.ts | 2 +- pnpm-lock.yaml | 90 +-- scripts/gen-doc-graphs.ts | 2 +- scripts/no-unknown-casts.baseline.json | 9 - scripts/rescope-vendor.ts | 1 - .../verify-package-readme-model-experience.ts | 2 - tsconfig.base.json | 2 - tsconfig.client.json | 2 - 166 files changed, 873 insertions(+), 4331 deletions(-) delete mode 100644 apps/web/tests/expected/settings-chrome/plugin-instances.expected.md delete mode 100644 apps/web/tests/expected/settings-chrome/plugins.expected.md create mode 100644 apps/web/tests/fixtures/plugins/fixture-settings-section/client.js create mode 100644 apps/web/tests/fixtures/plugins/fixture-settings-section/cordis.patch.yml create mode 100644 apps/web/tests/fixtures/plugins/fixture-settings-section/index.js create mode 100644 apps/web/tests/fixtures/plugins/fixture-settings-section/package.json create mode 100644 docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.i18n.yaml create mode 100644 docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.md create mode 100644 docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.zh.md create mode 100644 packages/client/ui-plugin-manager/src/client/ClientSyncNotice.tsx create mode 100644 packages/client/ui-plugin-manager/src/client/PluginsSettingsLink.tsx create mode 100644 packages/client/ui-plugin-manager/tests/settings-link.client.spec.tsx create mode 100644 packages/client/ui-settings-general/src/client/SettingsSectionView.tsx create mode 100644 packages/client/ui-settings-general/tests/section-view.client.spec.tsx delete mode 100644 packages/client/ui-settings-plugin-inventory/README.i18n.yaml delete mode 100644 packages/client/ui-settings-plugin-inventory/README.md delete mode 100644 packages/client/ui-settings-plugin-inventory/README.zh.md delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/de.json delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/en.json delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/es.json delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/fr.json delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/ja.json delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/pt.json delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/ru.json delete mode 100644 packages/client/ui-settings-plugin-inventory/locale/zh.json delete mode 100644 packages/client/ui-settings-plugin-inventory/package.json delete mode 100644 packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.module.css delete mode 100644 packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.tsx delete mode 100644 packages/client/ui-settings-plugin-inventory/src/client/index.ts delete mode 100644 packages/client/ui-settings-plugin-inventory/src/client/locales.ts delete mode 100644 packages/client/ui-settings-plugin-inventory/src/css-modules.d.ts delete mode 100644 packages/client/ui-settings-plugin-inventory/src/index.ts delete mode 100644 packages/client/ui-settings-plugin-inventory/tests/browser-plugin.client.spec.tsx delete mode 100644 packages/client/ui-settings-plugin-inventory/tests/components.client.spec.tsx delete mode 100644 packages/client/ui-settings-plugin-inventory/tests/touch-styles.client.spec.ts delete mode 100644 packages/client/ui-settings-plugin-inventory/tsconfig.json delete mode 100644 packages/client/ui-settings-plugin-inventory/tsdown.config.ts delete mode 100644 packages/client/ui-settings-plugins/README.i18n.yaml delete mode 100644 packages/client/ui-settings-plugins/README.md delete mode 100644 packages/client/ui-settings-plugins/README.zh.md delete mode 100644 packages/client/ui-settings-plugins/locale/de.json delete mode 100644 packages/client/ui-settings-plugins/locale/en.json delete mode 100644 packages/client/ui-settings-plugins/locale/es.json delete mode 100644 packages/client/ui-settings-plugins/locale/fr.json delete mode 100644 packages/client/ui-settings-plugins/locale/ja.json delete mode 100644 packages/client/ui-settings-plugins/locale/pt.json delete mode 100644 packages/client/ui-settings-plugins/locale/ru.json delete mode 100644 packages/client/ui-settings-plugins/locale/zh.json delete mode 100644 packages/client/ui-settings-plugins/package.json delete mode 100644 packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.module.css delete mode 100644 packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.tsx delete mode 100644 packages/client/ui-settings-plugins/src/client/index.ts delete mode 100644 packages/client/ui-settings-plugins/src/client/locales.ts delete mode 100644 packages/client/ui-settings-plugins/src/css-modules.d.ts delete mode 100644 packages/client/ui-settings-plugins/src/index.ts delete mode 100644 packages/client/ui-settings-plugins/tests/apply.client.spec.ts delete mode 100644 packages/client/ui-settings-plugins/tests/section.client.spec.tsx delete mode 100644 packages/client/ui-settings-plugins/tsconfig.json delete mode 100644 packages/client/ui-settings-plugins/tsdown.config.ts diff --git a/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.i18n.yaml b/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.i18n.yaml index b04f873a24..fdbd7de7cb 100644 --- a/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.i18n.yaml @@ -30,8 +30,8 @@ en: 99ee505e82fa9c7c zh: 448bc0e160424cbf /agent-note-boot-the-preview-worker-from-the-shipped-profile-and-fetch-lazy-chunks-on-demand/consequences: - en: 53d72faa09e78410 - zh: a5224e4662a4846b + en: ed424571c81bcb91 + zh: 9b79bf03741c1c21 /agent-note-boot-the-preview-worker-from-the-shipped-profile-and-fetch-lazy-chunks-on-demand/testing: en: 532918df1acd147d zh: e476c090d183d0a4 diff --git a/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.md b/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.md index 71509500e5..b4c4c539ee 100644 --- a/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.md +++ b/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.md @@ -81,7 +81,7 @@ The Worker's structural stubs throw errors carrying `ERR_FEATURE_UNAVAILABLE_ON_ ## Consequences -The Preview boots the composition the served Web deployment boots. With no bundle enabled, the Worker composition differs from the served Web composition only by the jsonl platform override, and enabling any bundle skips no patch. The Plugins page and Settings → Built-in plugins list every `OPTIONAL_BUNDLES` entry with its title and icon and no metadata error. Switching each of the 11 optional bundles on and then off returns `applied` both times; after enabling, every enabled row it changes is active, and after disabling, the plugin list returns to its prior rows. Enabling session-titles disables `@deepseek-ai/dsh-session-title-first-prompt-llm` (row `session-title-llm`) and enables `@deepseek-ai/dsh-session-title-all-prompts-llm`, as in the served Web deployment; enabling inspector-profile runs Session Inspector and starts the NodeJS Inspector degraded. Degradation requires `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`, so a served `dsh web` runs the full Inspector. +The Preview boots the composition the served Web deployment boots. With no bundle enabled, the Worker composition differs from the served Web composition only by the jsonl platform override, and enabling any bundle skips no patch. The Plugins page lists every `OPTIONAL_BUNDLES` entry with its title and icon and no metadata error. Switching each of the 11 optional bundles on and then off returns `applied` both times; after enabling, every enabled row it changes is active, and after disabling, the plugin list returns to its prior rows. Enabling session-titles disables `@deepseek-ai/dsh-session-title-first-prompt-llm` (row `session-title-llm`) and enables `@deepseek-ai/dsh-session-title-all-prompts-llm`, as in the served Web deployment; enabling inspector-profile runs Session Inspector and starts the NodeJS Inspector degraded. Degradation requires `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`, so a served `dsh web` runs the full Inspector. Size (MiB, measured): the base image is 9.20 (12.79 with pack-time composition and eager chunks, −28%) including 11 optional bundles, plus 5 lazy tar archives totaling 4.45 (pdf 2.88, excel 1.39, terminal 0.13, frontmatter 0.05, Inspector bottom panel 0.00). The base image contains no lazily loaded chunk, and the page fetches an archive only when it requests the chunk. diff --git a/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.zh.md b/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.zh.md index 5c9b5bf233..a5344f8b01 100644 --- a/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.zh.md +++ b/.agents/notes/implemented/architecture/2026-10-14-webworker-preview-profile-parity.zh.md @@ -81,7 +81,7 @@ Worker 的结构化 stub 抛出带 `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` 的错 ## 后果 -Preview 启动的组合与正式 Web 相同。不开 bundle 时,Worker 组合与正式 Web 只差 jsonl 的平台覆盖;开任一 bundle 都没有被跳过的补丁。插件页和“设置 → 内置插件”列出全部 `OPTIONAL_BUNDLES`,每个都显示标题和图标,没有元信息错误。11 个 optional bundle 逐个开启再关闭,两次都返回 `applied`;开启后它改动的每个启用行都是 active,关闭后插件列表恢复原样。启用 session-titles 会禁用 `@deepseek-ai/dsh-session-title-first-prompt-llm`(行 `session-title-llm`)并启用 `@deepseek-ai/dsh-session-title-all-prompts-llm`,与正式 Web 一致;启用 inspector-profile 后 Session Inspector 运行,NodeJS Inspector 降级启动。降级以 `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` 为前提,所以正常 `dsh web` 运行完整的 Inspector。 +Preview 启动的组合与正式 Web 相同。不开 bundle 时,Worker 组合与正式 Web 只差 jsonl 的平台覆盖;开任一 bundle 都没有被跳过的补丁。插件页列出全部 `OPTIONAL_BUNDLES`,每个都显示标题和图标,没有元信息错误。11 个 optional bundle 逐个开启再关闭,两次都返回 `applied`;开启后它改动的每个启用行都是 active,关闭后插件列表恢复原样。启用 session-titles 会禁用 `@deepseek-ai/dsh-session-title-first-prompt-llm`(行 `session-title-llm`)并启用 `@deepseek-ai/dsh-session-title-all-prompts-llm`,与正式 Web 一致;启用 inspector-profile 后 Session Inspector 运行,NodeJS Inspector 降级启动。降级以 `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` 为前提,所以正常 `dsh web` 运行完整的 Inspector。 体积(MiB,实测):基础镜像 9.20(打包期组合且 chunk 随启动下载时为 12.79,−28%),含 11 个 optional bundle;另有 5 个 lazy tar 共 4.45(pdf 2.88、excel 1.39、terminal 0.13、frontmatter 0.05、inspector 底部面板 0.00)。基础镜像不含懒加载 chunk,页面请求 chunk 时才拉取对应 archive。 diff --git a/apps/web/tests/client-plugin-live.e2e.ts b/apps/web/tests/client-plugin-live.e2e.ts index 3e9bef0dff..0e4ff0df1d 100644 --- a/apps/web/tests/client-plugin-live.e2e.ts +++ b/apps/web/tests/client-plugin-live.e2e.ts @@ -17,13 +17,25 @@ const SESSION_ACTION_EXPECTED = join(EXPECTED, 'session-actions.expected.md') const SESSION_SEED = fileURLToPath(new URL('../../../snapshots/web/seeded-history/session.v3.jsonl', import.meta.url)) const SESSION_TITLE = 'Session action extension' -async function openInventory(page: Page, url: string) { +/** Load the page on the Plugins page, which reports this page's client synchronization. */ +async function openPlugins(page: Page, url: string) { await page.goto(url, { waitUntil: 'load' }) + await page.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }).click() + await page.locator('[data-plugin-body]').waitFor({ timeout: 10_000 }) +} + +/** Open the Models settings page's add-provider card and return its API key field, a page-local draft. */ +async function openDraft(page: Page) { await openSettings(page, 'zh') const dialog = page.getByRole('dialog', { name: '设置' }) - await dialog.getByRole('button', { name: '内置插件', exact: true }).click() - await dialog.getByRole('searchbox', { name: '搜索插件' }).waitFor() - return dialog + await dialog.getByRole('button', { name: '模型', exact: true }).click() + const add = dialog.getByRole('button', { name: '添加模型提供商', exact: true }) + await expect.poll(() => add.isEnabled(), { timeout: 10_000 }).toBe(true) + await add.click() + await dialog.getByLabel('提供商', { exact: true }).selectOption('minimax-cn') + const draft = dialog.getByRole('textbox', { name: 'API 密钥', exact: true }) + await draft.waitFor({ timeout: 10_000 }) + return draft } it('keeps ordered legacy Session menu rows before Archive and removes them with their fiber', async () => { @@ -237,8 +249,9 @@ it('synchronizes two pages, disposes effects and restores an offline page from t const other = await otherContext.newPage() const consoles = [watchConsole(page), watchConsole(other)] onTestFailed(() => saveFailureShot(page, 'web-e2e-client-live')) - await openInventory(page, scaffold.authenticatedUrl) - const otherInventory = await openInventory(other, scaffold.authenticatedUrl) + await openPlugins(page, scaffold.authenticatedUrl) + await openPlugins(other, scaffold.authenticatedUrl) + const draft = await openDraft(other) let entryId: string | undefined const toggle = async () => { if (entryId === undefined) entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' }) @@ -265,9 +278,8 @@ it('synchronizes two pages, disposes effects and restores an offline page from t } await compareOrRefreshGolden(join(EXPECTED, 'enabled.expected.md'), await captureStableAria(page, '[data-live-client]', scaffold.workspaceCwd), webSnapshotMode()) - // The inventory filter is page-owned state that live composition must preserve. - const draft = otherInventory.getByRole('searchbox', { name: '搜索插件' }) - await draft.fill('unfinished-filter') + // An unsaved Settings field is page-owned state that live composition must preserve. + await draft.fill('unfinished-draft') await toggle() for (const target of [page, other]) { await expect.poll(() => live(target).count()).toBe(0) @@ -276,7 +288,7 @@ it('synchronizes two pages, disposes effects and restores an offline page from t expect((await dataset(target)).liveHits).toBe('1') expect(await target.locator('style[data-plugin="@fixture/live-client"]').count()).toBe(0) } - expect(await draft.inputValue()).toBe('unfinished-filter') + expect(await draft.inputValue()).toBe('unfinished-draft') await toggle() for (const target of [page, other]) { await live(target).waitFor() @@ -299,7 +311,7 @@ it('synchronizes two pages, disposes effects and restores an offline page from t expect(await live(other).count()).toBe(1) await otherContext.setOffline(false) await expect.poll(() => live(other).count(), { timeout: 20_000 }).toBe(0) - expect(await draft.inputValue()).toBe('unfinished-filter') + expect(await draft.inputValue()).toBe('unfinished-draft') expect(navigations).toBe(0) expect(scaffold.ctx.loader.ctx.fiber.uid).toBe(host) for (const console of consoles) expect(console.pageErrors).toEqual([]) @@ -315,7 +327,7 @@ it('keeps a failed client download local and retries without changing Host enabl try { const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE }) onTestFailed(() => saveFailureShot(page, 'web-e2e-client-live-retry')) - await openInventory(page, scaffold.authenticatedUrl) + await openPlugins(page, scaffold.authenticatedUrl) const bundle = (url: URL) => url.pathname.startsWith('/plugins/') && url.search.includes('@fixture/live-client/client.js') await page.route(bundle, route => route.abort()) const entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' }) @@ -352,9 +364,9 @@ it('recovers an uncreated client entry with rebuilt factory code without navigat try { const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE }) onTestFailed(() => saveFailureShot(page, 'web-e2e-client-factory-rebuild')) - const inventory = await openInventory(page, scaffold.authenticatedUrl) - const draft = inventory.getByRole('searchbox', { name: '搜索插件' }) - await draft.fill('unfinished-filter') + await openPlugins(page, scaffold.authenticatedUrl) + const draft = await openDraft(page) + await draft.fill('unfinished-draft') let navigations = 0 page.on('framenavigated', () => { navigations++ }) const entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' }) @@ -366,7 +378,7 @@ it('recovers an uncreated client entry with rebuilt factory code without navigat await page.getByText('动态插件 r1 已启用', { exact: true }).waitFor() await expect.poll(() => failure.count()).toBe(0) await compareOrRefreshGolden(join(EXPECTED, 'recovered.expected.md'), await captureStableAria(page, '[data-live-client]', scaffold.workspaceCwd), webSnapshotMode()) - expect(await draft.inputValue()).toBe('unfinished-filter') + expect(await draft.inputValue()).toBe('unfinished-draft') expect(await page.locator('style[data-plugin="@fixture/live-client"]').count()).toBe(1) expect(await page.evaluate(() => document.documentElement.dataset.liveMounts)).toBe('1') expect(scaffold.ctx.loader.resolve(entryId).fiber?.state).toBe(2) @@ -386,9 +398,9 @@ it('reports bootstrap rebuilds without remounting the settings page or navigatin const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE }) const console = watchConsole(page) onTestFailed(() => saveFailureShot(page, 'web-e2e-client-bootstrap-rebuild')) - const inventory = await openInventory(page, scaffold.authenticatedUrl) - const draft = inventory.getByRole('searchbox', { name: '搜索插件' }) - await draft.fill('unfinished-filter') + await openPlugins(page, scaffold.authenticatedUrl) + const draft = await openDraft(page) + await draft.fill('unfinished-draft') const originalInput = await draft.elementHandle() let navigations = 0 page.on('framenavigated', () => { navigations++ }) @@ -399,11 +411,12 @@ it('reports bootstrap rebuilds without remounting the settings page or navigatin scaffold.ctx.clientModules.rebuilt('@deepseek-ai/dsh-client-modules') const failure = page.locator('[data-client-sync-failure]') await failure.getByText(/replacing bootstrap module .* requires a page reload/).waitFor() - await failure.getByRole('button', { name: '重试本页面同步' }).click() + // The Settings dialog holding the draft covers the Plugins page, so the retry is dispatched to its button. + await failure.getByRole('button', { name: '重试本页面同步' }).dispatchEvent('click') await failure.getByText(/replacing bootstrap module .* requires a page reload/).waitFor() await compareOrRefreshGolden(join(EXPECTED, 'bootstrap-rebuild.expected.md'), await captureStableAria(page, '[data-client-sync-failure]', scaffold.workspaceCwd), webSnapshotMode()) expect(await originalInput!.evaluate(input => input.isConnected)).toBe(true) - expect(await draft.inputValue()).toBe('unfinished-filter') + expect(await draft.inputValue()).toBe('unfinished-draft') expect(scaffold.ctx.loader.ctx.fiber.uid).toBe(host) expect(navigations).toBe(0) expect(console.pageErrors).toEqual([]) @@ -421,7 +434,7 @@ it('removes the client UI and resources while Host cleanup is still pending', as const browser = await chromium.launch() try { const page = await browser.newPage({ locale: ZH_BROWSER_LOCALE }) - await openInventory(page, scaffold.authenticatedUrl) + await openPlugins(page, scaffold.authenticatedUrl) let navigations = 0 page.on('framenavigated', () => { navigations++ }) const entryId = await scaffold.ctx.loader.create({ name: '@fixture/live-client' }) diff --git a/apps/web/tests/expected/agent-preset-authoring/section.expected.md b/apps/web/tests/expected/agent-preset-authoring/section.expected.md index 3b5ebf1b20..a7a52ff913 100644 --- a/apps/web/tests/expected/agent-preset-authoring/section.expected.md +++ b/apps/web/tests/expected/agent-preset-authoring/section.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/deepseek-messages-settings/cards.expected.md b/apps/web/tests/expected/deepseek-messages-settings/cards.expected.md index 5a3a367e7a..dfdf727205 100644 --- a/apps/web/tests/expected/deepseek-messages-settings/cards.expected.md +++ b/apps/web/tests/expected/deepseek-messages-settings/cards.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/deepseek-messages-settings/clear-key.expected.md b/apps/web/tests/expected/deepseek-messages-settings/clear-key.expected.md index b1c8c2f328..f8b52ac7f0 100644 --- a/apps/web/tests/expected/deepseek-messages-settings/clear-key.expected.md +++ b/apps/web/tests/expected/deepseek-messages-settings/clear-key.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/desktop-locale/automatic.expected.md b/apps/web/tests/expected/desktop-locale/automatic.expected.md index f657109584..7f3c40fb01 100644 --- a/apps/web/tests/expected/desktop-locale/automatic.expected.md +++ b/apps/web/tests/expected/desktop-locale/automatic.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/desktop-locale/selected.expected.md b/apps/web/tests/expected/desktop-locale/selected.expected.md index 885ad3b4f3..65a1696252 100644 --- a/apps/web/tests/expected/desktop-locale/selected.expected.md +++ b/apps/web/tests/expected/desktop-locale/selected.expected.md @@ -3,7 +3,7 @@ - navigation: - button "General" - button "Models" - - button "Built-in plugins" + - button "Plugins" - button "Agent presets" - button "Open configuration file" - button "Close" diff --git a/apps/web/tests/expected/models-settings-recovery/stored-error.expected.md b/apps/web/tests/expected/models-settings-recovery/stored-error.expected.md index c53b1d766f..f083571faa 100644 --- a/apps/web/tests/expected/models-settings-recovery/stored-error.expected.md +++ b/apps/web/tests/expected/models-settings-recovery/stored-error.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/catalog-inputs.expected.md b/apps/web/tests/expected/models-settings/catalog-inputs.expected.md index 3022f22a78..a80292169c 100644 --- a/apps/web/tests/expected/models-settings/catalog-inputs.expected.md +++ b/apps/web/tests/expected/models-settings/catalog-inputs.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/configured.expected.md b/apps/web/tests/expected/models-settings/configured.expected.md index 063bbf1550..ef72f1368d 100644 --- a/apps/web/tests/expected/models-settings/configured.expected.md +++ b/apps/web/tests/expected/models-settings/configured.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/declared-edit.expected.md b/apps/web/tests/expected/models-settings/declared-edit.expected.md index c8f652fbf3..e778917fbb 100644 --- a/apps/web/tests/expected/models-settings/declared-edit.expected.md +++ b/apps/web/tests/expected/models-settings/declared-edit.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/declared.expected.md b/apps/web/tests/expected/models-settings/declared.expected.md index 27749f1ca2..0f8f3831c9 100644 --- a/apps/web/tests/expected/models-settings/declared.expected.md +++ b/apps/web/tests/expected/models-settings/declared.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/empty.expected.md b/apps/web/tests/expected/models-settings/empty.expected.md index dd808d7f86..806f64fd67 100644 --- a/apps/web/tests/expected/models-settings/empty.expected.md +++ b/apps/web/tests/expected/models-settings/empty.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/image-only.expected.md b/apps/web/tests/expected/models-settings/image-only.expected.md index 051df42792..f06dd97c8a 100644 --- a/apps/web/tests/expected/models-settings/image-only.expected.md +++ b/apps/web/tests/expected/models-settings/image-only.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/mobile-collapsed.expected.md b/apps/web/tests/expected/models-settings/mobile-collapsed.expected.md index c052e8c61f..b48ffb633d 100644 --- a/apps/web/tests/expected/models-settings/mobile-collapsed.expected.md +++ b/apps/web/tests/expected/models-settings/mobile-collapsed.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/mobile-expanded.expected.md b/apps/web/tests/expected/models-settings/mobile-expanded.expected.md index 69444fb808..08aeef2cba 100644 --- a/apps/web/tests/expected/models-settings/mobile-expanded.expected.md +++ b/apps/web/tests/expected/models-settings/mobile-expanded.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/native-keyless.expected.md b/apps/web/tests/expected/models-settings/native-keyless.expected.md index 339655dde8..4fa4bb33e4 100644 --- a/apps/web/tests/expected/models-settings/native-keyless.expected.md +++ b/apps/web/tests/expected/models-settings/native-keyless.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/models-settings/refreshing.expected.md b/apps/web/tests/expected/models-settings/refreshing.expected.md index 52e4eb8439..995f26fac2 100644 --- a/apps/web/tests/expected/models-settings/refreshing.expected.md +++ b/apps/web/tests/expected/models-settings/refreshing.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/onboarding-deepseek-config/default-models.expected.md b/apps/web/tests/expected/onboarding-deepseek-config/default-models.expected.md index 3bd004257e..bd1e5afcd8 100644 --- a/apps/web/tests/expected/onboarding-deepseek-config/default-models.expected.md +++ b/apps/web/tests/expected/onboarding-deepseek-config/default-models.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/onboarding-deepseek-config/models.expected.md b/apps/web/tests/expected/onboarding-deepseek-config/models.expected.md index 5b10207801..a34bbb6a9e 100644 --- a/apps/web/tests/expected/onboarding-deepseek-config/models.expected.md +++ b/apps/web/tests/expected/onboarding-deepseek-config/models.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/onboarding-native/models.expected.md b/apps/web/tests/expected/onboarding-native/models.expected.md index 3d1f292685..b1ae231767 100644 --- a/apps/web/tests/expected/onboarding-native/models.expected.md +++ b/apps/web/tests/expected/onboarding-native/models.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/onboarding-usable-provider/dismissed.expected.md b/apps/web/tests/expected/onboarding-usable-provider/dismissed.expected.md index 15dfde8f44..3392307d86 100644 --- a/apps/web/tests/expected/onboarding-usable-provider/dismissed.expected.md +++ b/apps/web/tests/expected/onboarding-usable-provider/dismissed.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/plugin-manager/touch-tooltips.expected.md b/apps/web/tests/expected/plugin-manager/touch-tooltips.expected.md index 4df272e593..8446d5cf7d 100644 --- a/apps/web/tests/expected/plugin-manager/touch-tooltips.expected.md +++ b/apps/web/tests/expected/plugin-manager/touch-tooltips.expected.md @@ -2,7 +2,7 @@ Touch refresh: one refresh request; no tooltip Touch explanation: visible within the 390px viewport -- tooltip "在这里配置官方插件,安装和管理其他插件。内置插件列表及运行状态可在「设置 → 内置插件」中查看" +- tooltip "在这里配置官方插件,安装、管理和配置其他插件。" Explanation closes on another tap or an outside touch Keyboard focus after touch: refresh tooltip visible Mouse hover after touch: refresh tooltip visible diff --git a/apps/web/tests/expected/settings-chrome/dialog-en.expected.md b/apps/web/tests/expected/settings-chrome/dialog-en.expected.md index a51f5a125c..da3994fc7d 100644 --- a/apps/web/tests/expected/settings-chrome/dialog-en.expected.md +++ b/apps/web/tests/expected/settings-chrome/dialog-en.expected.md @@ -3,7 +3,7 @@ - navigation: - button "General" - button "Models" - - button "Built-in plugins" + - button "Plugins" - button "Agent presets" - button "Open configuration file" - button "Close" diff --git a/apps/web/tests/expected/settings-chrome/dialog-no-browser.expected.md b/apps/web/tests/expected/settings-chrome/dialog-no-browser.expected.md index a51f5a125c..da3994fc7d 100644 --- a/apps/web/tests/expected/settings-chrome/dialog-no-browser.expected.md +++ b/apps/web/tests/expected/settings-chrome/dialog-no-browser.expected.md @@ -3,7 +3,7 @@ - navigation: - button "General" - button "Models" - - button "Built-in plugins" + - button "Plugins" - button "Agent presets" - button "Open configuration file" - button "Close" diff --git a/apps/web/tests/expected/settings-chrome/dialog.expected.md b/apps/web/tests/expected/settings-chrome/dialog.expected.md index 9288e7fb27..342b02be59 100644 --- a/apps/web/tests/expected/settings-chrome/dialog.expected.md +++ b/apps/web/tests/expected/settings-chrome/dialog.expected.md @@ -3,7 +3,7 @@ - navigation: - button "通用设置" - button "模型" - - button "内置插件" + - button "插件管理" - button "Agent 预设" - button "打开配置文件" - button "关闭" diff --git a/apps/web/tests/expected/settings-chrome/plugin-instances.expected.md b/apps/web/tests/expected/settings-chrome/plugin-instances.expected.md deleted file mode 100644 index 7ed9dab306..0000000000 --- a/apps/web/tests/expected/settings-chrome/plugin-instances.expected.md +++ /dev/null @@ -1,16 +0,0 @@ -- list: - - listitem: - - button "子智能体控制工具, tool-subagent-control, 已启用": - - strong: 子智能体控制工具 - - text: 让 AI 向子智能体发送消息或中断其运行。 - - code: tool-subagent-control - - listitem: - - button "子智能体委派工具, tool-subagent, 已启用": - - strong: 子智能体委派工具 - - text: 让 AI 将任务交给子智能体,并获取运行结果。 - - code: tool-subagent - - listitem: - - button "子智能体委派工具, tool-subagent-fork, 已启用": - - strong: 子智能体委派工具 - - text: 让 AI 将任务交给子智能体,并获取运行结果。 - - code: tool-subagent-fork diff --git a/apps/web/tests/expected/settings-chrome/plugins.expected.md b/apps/web/tests/expected/settings-chrome/plugins.expected.md deleted file mode 100644 index 22b5bc2c80..0000000000 --- a/apps/web/tests/expected/settings-chrome/plugins.expected.md +++ /dev/null @@ -1,5 +0,0 @@ -- listitem: - - button "子智能体委派工具, tool-subagent, 已启用": - - strong: 子智能体委派工具 - - text: 让 AI 将任务交给子智能体,并获取运行结果。 - - code: tool-subagent diff --git a/apps/web/tests/fixtures/plugins/fixture-settings-section/client.js b/apps/web/tests/fixtures/plugins/fixture-settings-section/client.js new file mode 100644 index 0000000000..fbdda149e3 --- /dev/null +++ b/apps/web/tests/fixtures/plugins/fixture-settings-section/client.js @@ -0,0 +1,16 @@ +/** Test package registering its own settings page into `settings.section`. */ +window.__ModuleLoader__.load({ + id: '@fixture/settings-section', + factory(require) { + const React = require('react') + return { + inject: ['slots'], + apply(ctx) { + ctx.slots.inject('settings.section', () => ctx.slots.register({ + name: 'settings.section', id: 'fixture-settings-section', label: 'Fixture settings', + }, () => React.createElement('section', { 'data-fixture-settings-section': '', 'aria-label': 'Fixture settings' }, + React.createElement('p', null, 'Settings content from the fixture')))) + }, + } + }, +}) diff --git a/apps/web/tests/fixtures/plugins/fixture-settings-section/cordis.patch.yml b/apps/web/tests/fixtures/plugins/fixture-settings-section/cordis.patch.yml new file mode 100644 index 0000000000..2c97eb2558 --- /dev/null +++ b/apps/web/tests/fixtures/plugins/fixture-settings-section/cordis.patch.yml @@ -0,0 +1,4 @@ +# Web e2e fixture bundle whose browser half registers a plugin settings page. +- insert: + - id: fixture-settings-section + name: '@fixture/settings-section' diff --git a/apps/web/tests/fixtures/plugins/fixture-settings-section/index.js b/apps/web/tests/fixtures/plugins/fixture-settings-section/index.js new file mode 100644 index 0000000000..118fdd58fd --- /dev/null +++ b/apps/web/tests/fixtures/plugins/fixture-settings-section/index.js @@ -0,0 +1,2 @@ +/** Host companion for the plugin settings page fixture. */ +export function apply() {} diff --git a/apps/web/tests/fixtures/plugins/fixture-settings-section/package.json b/apps/web/tests/fixtures/plugins/fixture-settings-section/package.json new file mode 100644 index 0000000000..48a29fbedf --- /dev/null +++ b/apps/web/tests/fixtures/plugins/fixture-settings-section/package.json @@ -0,0 +1,12 @@ +{ + "name": "@fixture/settings-section", + "version": "0.0.1", + "private": true, + "type": "module", + "main": "index.js", + "exports": { ".": "./index.js", "./client": "./client.js" }, + "dsh": { + "bundle": { "patch": "./cordis.patch.yml" }, + "client": { "platform": "web" } + } +} diff --git a/apps/web/tests/plugin-config.e2e.ts b/apps/web/tests/plugin-config.e2e.ts index a8982010de..b2bc6de81b 100644 --- a/apps/web/tests/plugin-config.e2e.ts +++ b/apps/web/tests/plugin-config.e2e.ts @@ -10,13 +10,13 @@ import { fileURLToPath } from 'node:url' import type { Browser, Locator, Page } from 'playwright' import { chromium } from 'playwright' import { HIDDEN_BUNDLES } from '@deepseek-ai/dsh-official-bundles' -import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest' +import { afterAll, beforeAll, describe, expect, it, onTestFailed, onTestFinished } from 'vitest' import { join } from 'node:path' import { assertFixtureInventory, captureStableAria, compareOrRefreshGolden, launchWebScaffold, watchConsole, webSnapshotMode, type WebScaffold, } from './scaffold.ts' -import { ZH_BROWSER_LOCALE, saveFailureShot } from './support.ts' +import { ZH_BROWSER_LOCALE, openSettings, saveFailureShot } from './support.ts' const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/plugin-config', import.meta.url)) const OFFICIAL_EXPECTED = join(SNAPSHOT_DIR, 'official.expected.md') @@ -503,6 +503,46 @@ describe('web e2e: plugin configuration pages', () => { expect(tripwire.warnings).toEqual([]) await assertFixtureInventory(SNAPSHOT_DIR, ['bundle.expected.md', 'official.expected.md', 'row.expected.md', 'subagent.expected.md', 'web-search.expected.md']) }) +}) +describe('web e2e: a community plugin settings page', () => { + it('shows a settings.section entry in Settings and on its bundle row', async () => { + const scaffold = await launchWebScaffold({ + profile: { packages: [{ dir: join(FIXTURE_PLUGINS, 'fixture-settings-section') }] }, + }) + onTestFinished(() => scaffold.close()) + const browser = await chromium.launch() + onTestFinished(() => browser.close()) + const page = await browser.newPage({ viewport: { width: 1680, height: 1000 }, locale: ZH_BROWSER_LOCALE }) + const console = watchConsole(page) + onTestFailed(() => saveFailureShot(page, 'web-e2e-plugin-config-settings-section')) + await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' }) + await page.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }).click() + const panel = page.locator('[data-plugin-panel]') + await panel.getByRole('button', { name: '查看 @fixture/settings-section', exact: true }).click({ timeout: 20_000 }) + const row = panel.locator('[data-plugin-row]', { hasText: 'fixture-settings-section' }) + await row.waitFor({ timeout: 10_000 }) + const configure = panel.getByRole('button', { name: '配置 @fixture/settings-section' }) + expect(await configure.count()).toBe(0) + // Switched on, the browser half mounts and its settings page claims the row. + await panel.getByRole('switch', { name: '启用 @fixture/settings-section' }).click() + await configure.waitFor({ timeout: 30_000 }) + await configure.click() + const rowPage = panel.locator('[data-plugin-row-detail="@fixture/settings-section#fixture-settings-section"]') + await rowPage.waitFor({ timeout: 10_000 }) + await rowPage.getByRole('region', { name: 'Fixture settings', exact: true }) + .getByText('Settings content from the fixture', { exact: true }).waitFor({ timeout: 10_000 }) + + // Settings keeps the same page in its navigation. + await openSettings(page, 'zh') + const dialog = page.getByRole('dialog', { name: '设置', exact: true }) + await dialog.getByRole('navigation').getByRole('button', { name: 'Fixture settings', exact: true }).click() + await dialog.getByRole('region', { name: 'Fixture settings', exact: true }) + .getByText('Settings content from the fixture', { exact: true }).waitFor({ timeout: 10_000 }) + await page.keyboard.press('Escape') + await expect.poll(() => dialog.count(), { timeout: 5_000 }).toBe(0) + expect(console.pageErrors).toEqual([]) + expect(console.warnings).toEqual([]) + }, 90_000) }) diff --git a/apps/web/tests/plugin-manager.e2e.ts b/apps/web/tests/plugin-manager.e2e.ts index 49658beb91..577beee782 100644 --- a/apps/web/tests/plugin-manager.e2e.ts +++ b/apps/web/tests/plugin-manager.e2e.ts @@ -792,14 +792,14 @@ describe('web e2e: plugin manager', () => { await info.hover() const hoverHelp = page.getByRole('tooltip') await hoverHelp.waitFor() - expect(await hoverHelp.textContent()).toBe('在这里配置官方插件,安装和管理其他插件。内置插件列表及运行状态可在「设置 → 内置插件」中查看') + expect(await hoverHelp.textContent()).toBe('在这里配置官方插件,安装、管理和配置其他插件。') await panel.getByRole('heading', { name: '插件', exact: true }).hover() await hoverHelp.waitFor({ state: 'hidden' }) await info.focus() await page.keyboard.press('Enter') const help = page.getByRole('tooltip') await help.waitFor() - expect(await help.textContent()).toContain('设置 → 内置插件') + expect(await help.textContent()).toBe('在这里配置官方插件,安装、管理和配置其他插件。') await page.keyboard.press('Escape') expect(await help.count()).toBe(0) expect(await info.evaluate(element => element === document.activeElement)).toBe(true) diff --git a/apps/web/tests/settings-appearance.e2e.ts b/apps/web/tests/settings-appearance.e2e.ts index 26be4bdedc..0a79e44440 100644 --- a/apps/web/tests/settings-appearance.e2e.ts +++ b/apps/web/tests/settings-appearance.e2e.ts @@ -189,12 +189,6 @@ it('shares settings card materials and control sizes in both palettes', async () await compareOrRefreshGolden(join(EXPECTED, 'account.expected.md'), await captureStableAria(page, 'section[aria-label="账号与余额"]', scaffold.workspaceCwd), webSnapshotMode()) - await dialog.getByRole('button', { name: '内置插件', exact: true }).click() - await dialog.getByRole('button', { name: /^全局/ }).click() - const plugin = dialog.locator('[data-plugin-scope="global"] [data-plugin-entry]').first() - await plugin.waitFor() - expect(await appearance(plugin)).toMatchObject(material) - await dialog.getByRole('button', { name: 'Agent 预设', exact: true }).click() const preset = dialog.locator('li').first() await preset.waitFor() diff --git a/apps/web/tests/settings-chrome.e2e.ts b/apps/web/tests/settings-chrome.e2e.ts index 1259e5253f..dea15ef684 100644 --- a/apps/web/tests/settings-chrome.e2e.ts +++ b/apps/web/tests/settings-chrome.e2e.ts @@ -24,11 +24,8 @@ import { brandString } from '@deepseek-ai/dsh-brand' const SNAPSHOT_DIR = fileURLToPath(new URL('./expected/settings-chrome', import.meta.url)) const DIALOG_EXPECTED = join(SNAPSHOT_DIR, 'dialog.expected.md') -const PLUGINS_EXPECTED = join(SNAPSHOT_DIR, 'plugins.expected.md') -const PLUGIN_INSTANCES_EXPECTED = join(SNAPSHOT_DIR, 'plugin-instances.expected.md') // The English fallback surface: a browser naming no shipped language. const DIALOG_EN_EXPECTED = join(SNAPSHOT_DIR, 'dialog-en.expected.md') -const PLUGIN_ROW_SELECTOR = '[data-plugin-scope="preset"] [data-plugin-entry="tool-subagent"]' const MODE = webSnapshotMode() const SCREENSHOTS = 'screenshots/collapse-timing-settings' const SCREENSHOT_DIR = fileURLToPath(new URL(`../../../.artifacts/${SCREENSHOTS}`, import.meta.url)) @@ -140,84 +137,6 @@ describe('web e2e: settings modal and General preferences', () => { await dialog.getByRole('button', { name: '模型', exact: true }).click() await expect.poll(() => dialog.getByRole('button', { name: '模型', exact: true }).getAttribute('aria-current'), { timeout: 5_000 }).toBe('true') expect(await dialog.getByRole('button', { name: '通用设置' }).getAttribute('aria-current')).toBeNull() - // Built-in plugins: the read-only Plugin list, a projection of the same - // assembled Loader tree, shown as the section's one page; management and - // configuration live on the sidebar's Plugins panel (its own scenario files - // drive that page over a profile runtime). Capture one stable shipped row - // rather than the whole inventory so adding an unrelated plugin does not - // rewrite this surface's golden. - await dialog.getByRole('button', { name: '内置插件', exact: true }).click() - await dialog.getByRole('heading', { name: '内置插件', exact: true }).waitFor({ timeout: 10_000 }) - // The preset group starts open under its display-only switcher; the global group starts folded. - const presetSwitcher = dialog.getByRole('button', { name: '选择要查看的 Agent 预设' }) - await presetSwitcher.waitFor({ timeout: 10_000 }) - // The shipped default's zh display name comes from the zh dictionaries. - expect(await presetSwitcher.textContent()).toBe('标准模式(默认)') - const presetToggle = dialog.getByRole('button', { name: '会话插件', exact: true }) - expect(await presetToggle.getAttribute('aria-expanded')).toBe('true') - expect(await dialog.locator('[data-plugin-scope="preset"] [data-plugin-entry]').count()).toBeGreaterThan(0) - const globalToggle = dialog.getByRole('button', { name: /^全局/ }) - expect(await globalToggle.getAttribute('aria-expanded')).toBe('false') - await globalToggle.click() - const pluginRow = dialog.locator(PLUGIN_ROW_SELECTOR) - await pluginRow.waitFor({ timeout: 10_000 }) - const expectedPluginCount = [...scaffold.ctx.loader.entries()] - .filter(entry => !entry.options.group) - .length - const pluginSearch = dialog.getByRole('searchbox', { name: '搜索插件' }) - expect(await pluginSearch.count()).toBe(1) - // Every Loader entry appears exactly once in the global group — rows the - // presets took over included, preset compositions excluded. - expect(await dialog.locator('[data-plugin-scope="global"] [data-plugin-entry]').count()) - .toBe(expectedPluginCount) - // A plainly enabled row states its status only in its accessible name: it - // carries no tag, and an active fiber draws no dot, so no global row shows - // either. Guard the assertions against matching nothing because no row is enabled. - const enabledRows = dialog.locator('[data-plugin-scope="global"] [data-plugin-entry] button[aria-label$="已启用"]') - expect(await enabledRows.count()).toBeGreaterThan(0) - expect(await enabledRows.getByText('已启用', { exact: true }).count()).toBe(0) - expect(await dialog.locator('[data-plugin-scope="global"] [role="img"][aria-label="运行中"]').count()).toBe(0) - expect(await dialog.getByText('由 Agent 预设按会话组成', { exact: true }).count()).toBe(1) - expect(await dialog.getByText('系统与所有会话共用', { exact: true }).count()).toBe(1) - expect(await dialog.getByRole('button', { name: '内置插件', exact: true }).getAttribute('aria-current')).toBe('true') - // One contribution shows as the page itself, without a tab row. - expect(await dialog.getByRole('tab').count()).toBe(0) - expect(await dialog.getByRole('button', { name: '模型', exact: true }).getAttribute('aria-current')).toBeNull() - const pluginsSnapshot = await captureStableAria( - page, - PLUGIN_ROW_SELECTOR, - scaffold.workspaceCwd, - ) - await compareOrRefreshGolden(PLUGINS_EXPECTED, pluginsSnapshot, MODE) - await pluginSearch.fill('tool-subagent') - const instanceRows = [ - ['tool-subagent', '已启用'], - ['tool-subagent-fork', '已启用'], - ] as const - for (const [entryId, status] of instanceRows) { - const row = dialog.locator(`[data-plugin-scope="preset"] [data-plugin-entry="${entryId}"]`) - const name = `子智能体委派工具, ${entryId}, ${status}` - const trigger = row.getByRole('button', { name, exact: true }) - await trigger.waitFor({ timeout: 10_000 }) - expect(await trigger.getAttribute('aria-expanded')).toBe('false') - const identity = row.locator('code') - expect(await identity.textContent()).toBe(entryId) - expect(await identity.getAttribute('title')).toBe(entryId) - } - expect(await dialog.locator('[data-plugin-entry="tool-subagent-codex"], [data-plugin-entry="tool-subagent-claude-code"]').count()).toBe(0) - const instancesSnapshot = await captureStableAria( - page, - '[data-plugin-scope="preset"] ul', - scaffold.workspaceCwd, - ) - await compareOrRefreshGolden(PLUGIN_INSTANCES_EXPECTED, instancesSnapshot, MODE) - await dialog.getByRole('button', { - name: '子智能体委派工具, tool-subagent-fork, 已启用', - exact: true, - }).click() - expect(await dialog.locator('[data-plugin-entry="tool-subagent-fork"] button') - .getAttribute('aria-expanded')).toBe('true') - await pluginSearch.fill('') // Close path 1: Escape. await page.keyboard.press('Escape') await expect.poll(() => page.getByRole('dialog', { name: '设置' }).count(), { timeout: 5_000 }).toBe(0) @@ -229,6 +148,27 @@ describe('web e2e: settings modal and General preferences', () => { expect(tripwire.pageErrors).toEqual([]) }, 60_000) + it('leaves Settings for the sidebar Plugins page from the Plugin management entry', async () => { + const linkPage = await browser.newPage({ viewport: { width: 1680, height: 1000 }, locale: ZH_BROWSER_LOCALE }) + onTestFinished(() => linkPage.close()) + onTestFailed(() => saveSettingsFailureShot(linkPage, 'settings-plugins-link')) + const linkConsole = watchConsole(linkPage) + await linkPage.goto(scaffold.authenticatedUrl, { waitUntil: 'load' }) + await openSettings(linkPage, 'zh') + const dialog = linkPage.getByRole('dialog', { name: '设置', exact: true }) + const sections = await dialog.getByRole('navigation').getByRole('button').allTextContents() + // The entry holds the position between Models and Agent presets. + expect(sections.indexOf('插件管理')).toBe(sections.indexOf('模型') + 1) + expect(sections.indexOf('Agent 预设')).toBe(sections.indexOf('插件管理') + 1) + await dialog.getByRole('button', { name: '插件管理', exact: true }).click() + await expect.poll(() => dialog.count(), { timeout: 5_000 }).toBe(0) + const pluginsEntry = linkPage.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }) + await expect.poll(() => pluginsEntry.getAttribute('aria-current'), { timeout: 10_000 }).toBe('page') + await linkPage.locator('[data-plugin-panel]').getByRole('heading', { name: '插件', exact: true }).waitFor({ timeout: 10_000 }) + expect(linkConsole.pageErrors).toEqual([]) + expect(linkConsole.warnings).toEqual([]) + }) + it('scrolls overflowing section navigation independently of the title and settings content', async () => { const overflowPage = await browser.newPage({ viewport: { width: 1280, height: 768 }, locale: ZH_BROWSER_LOCALE }) onTestFinished(() => overflowPage.close()) @@ -953,17 +893,12 @@ describe('web e2e: settings modal and General preferences', () => { const dialog = enPage.getByRole('dialog', { name: 'Settings' }) await dialog.waitFor({ timeout: 10_000 }) await dialog.getByRole('button', { name: 'English' }).waitFor({ timeout: 10_000 }) - // The plugin list resolves shipped preset names through the en - // dictionaries instead of echoing the preset declarations' Chinese metadata. - await dialog.getByRole('button', { name: 'Built-in plugins', exact: true }).click() - const presetSwitcher = dialog.getByRole('button', { name: 'Choose the agent preset to inspect' }) - await presetSwitcher.waitFor({ timeout: 10_000 }) - expect(await presetSwitcher.textContent()).toBe('Standard mode (default)') - // The plugin manager speaks the en dictionary too: its sidebar entry - // and the unavailable notice a scaffold without a profile runtime shows. - await enPage.keyboard.press('Escape') + // The plugin manager speaks the en dictionary too: its Settings entry + // leaves Settings for the Plugins page, whose header and the sidebar entry are English. + await dialog.getByRole('button', { name: 'Plugins', exact: true }).click() await expect.poll(() => enPage.getByRole('dialog', { name: 'Settings' }).count(), { timeout: 5_000 }).toBe(0) - await enPage.getByRole('navigation', { name: 'Global panels' }).getByRole('button', { name: 'Plugins', exact: true }).click() + await expect.poll(() => enPage.getByRole('navigation', { name: 'Global panels' }) + .getByRole('button', { name: 'Plugins', exact: true }).getAttribute('aria-current'), { timeout: 10_000 }).toBe('page') await enPage.getByRole('button', { name: 'Add plugin', exact: true }) .waitFor({ timeout: 10_000 }) // This page has no closing inventory spec to sweep its console, so the @@ -1042,8 +977,6 @@ describe('web e2e: settings modal and General preferences', () => { 'dialog.expected.md', 'collapse-timing-en.expected.md', 'collapse-timing-zh.expected.md', - 'plugin-instances.expected.md', - 'plugins.expected.md', ]) }) }) diff --git a/docs/capability-seams.i18n.yaml b/docs/capability-seams.i18n.yaml index 55afd2897b..9b3c206b7d 100644 --- a/docs/capability-seams.i18n.yaml +++ b/docs/capability-seams.i18n.yaml @@ -6,5 +6,5 @@ en: 41d772192075e133 zh: 5ef3da69b4de1d8a /capability-seams-and-core-services: - en: 377f8f047b34cfde - zh: be08abadad0beb93 + en: 0ae3b368d7fcde08 + zh: 64c3cc22e17be96b diff --git a/docs/capability-seams.md b/docs/capability-seams.md index 6058d17b22..e087ec5b92 100644 --- a/docs/capability-seams.md +++ b/docs/capability-seams.md @@ -29,7 +29,6 @@ flowchart LR svc_pluginRegistryProbe["ctx.pluginRegistryProbe
Host registry response comparison"] pkg_plugin_manager["plugin-manager"] svc_pluginManager["ctx.pluginManager
Current-profile plugin and bundle management"] - pkg_ui_settings_plugin_inventory["ui-settings-plugin-inventory"] pkg_plugin_market["plugin-market"] svc_pluginMarket["ctx.pluginMarket
Plugin market index reader"] pkg_client_ui_plugin_market["client-ui-plugin-market"] @@ -558,7 +557,6 @@ flowchart LR svc_otel --> pkg_host_product_telemetry_otel svc_otel --> pkg_session_telemetry_otel svc_pluginManager --> pkg_plugin_manager - svc_pluginManager --> pkg_ui_settings_plugin_inventory svc_pluginMarket --> pkg_client_ui_plugin_market svc_pluginMarket --> pkg_plugin_market svc_pluginRecommendations --> pkg_client_ui_plugin_recommendations @@ -677,7 +675,7 @@ flowchart LR | `ctx.translator` | `service` | [`experimental-translator`](../packages/experimental/translator) | - | [`experimental-client-ui-cot-translation`](../packages/experimental/client-ui-cot-translation) | - | Resolves Google or Bing requests and retains shared experimental records through the active Session writer. | | `ctx.hmr` | `core` | [`hmr`](../packages/boot/hmr) | - | [`app-boot`](../packages/boot/app-boot) | - | Owns module and exact configuration watchers; application mutations share its queue and automatic reloads await the application file lock. | | `ctx.pluginRegistryProbe` | `core` | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | Races public registry responses on the Host; the Client owns the initial registry recommendation. | -| `ctx.pluginManager` | `core` | [`plugin-manager`](../packages/boot/plugin-manager) | - | [`plugin-manager`](../packages/boot/plugin-manager), `ui-settings-plugin-inventory` | - | Shares profile package operations with the CLI and reports persisted and running state to Web and agent callers. | +| `ctx.pluginManager` | `core` | [`plugin-manager`](../packages/boot/plugin-manager) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | Shares profile package operations with the CLI and reports persisted and running state to Web and agent callers. | | `ctx.pluginMarket` | `core` | [`plugin-market`](../packages/boot/plugin-market) | - | [`client-ui-plugin-market`](../packages/client/ui-plugin-market), [`plugin-market`](../packages/boot/plugin-market) | - | Fetches and validates the index sources the user configures; installation goes through the plugin manager. | | `ctx.profileContext` | `core` | [`app-boot`](../packages/boot/app-boot) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | The dsh launcher supplies data-only profile locations and composition inputs; reload scheduling belongs to dsh-hmr. | | `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | Applies source policy and shared HTTP request dispatch; credential verification belongs to ConnectionAuthentication, and API adapters register endpoints and streams. | diff --git a/docs/capability-seams.zh.md b/docs/capability-seams.zh.md index a7b44ce529..0d8d97e4ab 100644 --- a/docs/capability-seams.zh.md +++ b/docs/capability-seams.zh.md @@ -31,7 +31,6 @@ flowchart LR svc_pluginRegistryProbe["ctx.pluginRegistryProbe
Host registry response comparison"] pkg_plugin_manager["plugin-manager"] svc_pluginManager["ctx.pluginManager
Current-profile plugin and bundle management"] - pkg_ui_settings_plugin_inventory["ui-settings-plugin-inventory"] pkg_plugin_market["plugin-market"] svc_pluginMarket["ctx.pluginMarket
Plugin market index reader"] pkg_client_ui_plugin_market["client-ui-plugin-market"] @@ -560,7 +559,6 @@ flowchart LR svc_otel --> pkg_host_product_telemetry_otel svc_otel --> pkg_session_telemetry_otel svc_pluginManager --> pkg_plugin_manager - svc_pluginManager --> pkg_ui_settings_plugin_inventory svc_pluginMarket --> pkg_client_ui_plugin_market svc_pluginMarket --> pkg_plugin_market svc_pluginRecommendations --> pkg_client_ui_plugin_recommendations @@ -679,7 +677,7 @@ flowchart LR | `ctx.translator` | `service` | [`experimental-translator`](../packages/experimental/translator) | - | [`experimental-client-ui-cot-translation`](../packages/experimental/client-ui-cot-translation) | - | 解析 Google 或 Bing 请求,并可选保留统一的实验性 Session 记录。 | | `ctx.hmr` | `core` | [`hmr`](../packages/boot/hmr) | - | [`app-boot`](../packages/boot/app-boot) | - | 负责模块和精确配置监听;应用修改共用其队列,自动重载等待应用文件锁。 | | `ctx.pluginRegistryProbe` | `core` | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | [`client-ui-plugin-manager`](../packages/client/ui-plugin-manager) | - | 在 Host 上并发比较公共安装源响应;初始安装源推荐由 Client 负责。 | -| `ctx.pluginManager` | `core` | [`plugin-manager`](../packages/boot/plugin-manager) | - | [`plugin-manager`](../packages/boot/plugin-manager), `ui-settings-plugin-inventory` | - | 与 CLI 共享 profile 包操作,并向 Web 和 Agent 调用方分别报告持久状态与运行状态。 | +| `ctx.pluginManager` | `core` | [`plugin-manager`](../packages/boot/plugin-manager) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | 与 CLI 共享 profile 包操作,并向 Web 和 Agent 调用方分别报告持久状态与运行状态。 | | `ctx.pluginMarket` | `core` | [`plugin-market`](../packages/boot/plugin-market) | - | [`client-ui-plugin-market`](../packages/client/ui-plugin-market), [`plugin-market`](../packages/boot/plugin-market) | - | 获取并校验用户配置的索引源;安装通过插件管理器完成。 | | `ctx.profileContext` | `core` | [`app-boot`](../packages/boot/app-boot) | - | [`plugin-manager`](../packages/boot/plugin-manager) | - | dsh launcher 提供纯数据形式的 profile 位置与组合输入;重载调度由 dsh-hmr 负责。 | | `ctx.connection` | `core` | [`client-connection`](../packages/client/connection) | - | [`api-gateway`](../packages/api/gateway), [`host-frontend-static`](../packages/host/frontend-static) | - | 执行来源策略与共享 HTTP 请求分发;凭据验证归 ConnectionAuthentication,API 适配器注册端点和流。 | diff --git a/docs/config-catalog.md b/docs/config-catalog.md index b28057a7af..f25b0c266d 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -5275,8 +5275,6 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co | `@deepseek-ai/dsh-client-ui-settings` | — | [`packages/client/ui-settings/src/index.ts`](../packages/client/ui-settings/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-agent-loop` | — | [`packages/client/ui-settings-agent-loop/src/index.ts`](../packages/client/ui-settings-agent-loop/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-general` | — | [`packages/client/ui-settings-general/src/index.ts`](../packages/client/ui-settings-general/src/index.ts) | -| `@deepseek-ai/dsh-client-ui-settings-plugin-inventory` | — | [`packages/client/ui-settings-plugin-inventory/src/index.ts`](../packages/client/ui-settings-plugin-inventory/src/index.ts) | -| `@deepseek-ai/dsh-client-ui-settings-plugins` | — | [`packages/client/ui-settings-plugins/src/index.ts`](../packages/client/ui-settings-plugins/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-session-log` | — | [`packages/client/ui-settings-session-log/src/index.ts`](../packages/client/ui-settings-session-log/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-shell` | — | [`packages/client/ui-settings-shell/src/index.ts`](../packages/client/ui-settings-shell/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-subagent` | — | [`packages/client/ui-settings-subagent/src/index.ts`](../packages/client/ui-settings-subagent/src/index.ts) | diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index 2eca6e6bad..bf58508312 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -5277,8 +5277,6 @@ export interface Config { | `@deepseek-ai/dsh-client-ui-settings` | — | [`packages/client/ui-settings/src/index.ts`](../packages/client/ui-settings/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-agent-loop` | — | [`packages/client/ui-settings-agent-loop/src/index.ts`](../packages/client/ui-settings-agent-loop/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-general` | — | [`packages/client/ui-settings-general/src/index.ts`](../packages/client/ui-settings-general/src/index.ts) | -| `@deepseek-ai/dsh-client-ui-settings-plugin-inventory` | — | [`packages/client/ui-settings-plugin-inventory/src/index.ts`](../packages/client/ui-settings-plugin-inventory/src/index.ts) | -| `@deepseek-ai/dsh-client-ui-settings-plugins` | — | [`packages/client/ui-settings-plugins/src/index.ts`](../packages/client/ui-settings-plugins/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-session-log` | — | [`packages/client/ui-settings-session-log/src/index.ts`](../packages/client/ui-settings-session-log/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-shell` | — | [`packages/client/ui-settings-shell/src/index.ts`](../packages/client/ui-settings-shell/src/index.ts) | | `@deepseek-ai/dsh-client-ui-settings-subagent` | — | [`packages/client/ui-settings-subagent/src/index.ts`](../packages/client/ui-settings-subagent/src/index.ts) | diff --git a/docs/cookbook/adding-a-settings-card.i18n.yaml b/docs/cookbook/adding-a-settings-card.i18n.yaml index 7165774217..c358bef1ca 100644 --- a/docs/cookbook/adding-a-settings-card.i18n.yaml +++ b/docs/cookbook/adding-a-settings-card.i18n.yaml @@ -12,8 +12,8 @@ en: 9c2680c175632a58 zh: 46927fca484b5df0 /cookbook-live-configuration-forms/3-verify-editing: - en: dc5dc7ab4c211b97 - zh: 88f8af745c576a6d + en: cf8d614d67a0ade6 + zh: 92a7b53ce83e967a /cookbook-live-configuration-forms/4-contribute-to-another-plugin-s-page: en: 0abb582a1a25b3d9 zh: 6078a707324ec515 diff --git a/docs/cookbook/adding-a-settings-card.md b/docs/cookbook/adding-a-settings-card.md index 3e473d8bbc..b8f870691a 100644 --- a/docs/cookbook/adding-a-settings-card.md +++ b/docs/cookbook/adding-a-settings-card.md @@ -39,7 +39,7 @@ Give each instance a unique profile entry id. The base bundle mounts settings an Change a field in Plugins and save. Verify the profile patch, the next consumer operation, unchanged plugin instance identity, and restoration after restart. Reject an invalid value and verify that neither the file nor the live value changed. -Custom plugin pages receive `form.state` and `form.mutate(operations, expectedRevision)` from the Plugins page owner. The Host validates full Config and applies edits through ConfigEditor and volatile HMR. The [plugin settings package](../../packages/client/ui-settings-plugins/README.md) owns the existing card examples. +Custom plugin pages receive `form.state` and `form.mutate(operations, expectedRevision)` from the Plugins page owner. The Host validates full Config and applies edits through ConfigEditor and volatile HMR. The [Plugins page README](../../packages/client/ui-plugin-manager/README.md#configuration-pages) lists the slots such a page registers into and how a `settings.section` entry also appears there; [ui-settings-shell](../../packages/client/ui-settings-shell/README.md) is an existing page. ## 4. Contribute to another plugin's page diff --git a/docs/cookbook/adding-a-settings-card.zh.md b/docs/cookbook/adding-a-settings-card.zh.md index fd2c713661..064b1f24e8 100644 --- a/docs/cookbook/adding-a-settings-card.zh.md +++ b/docs/cookbook/adding-a-settings-card.zh.md @@ -39,7 +39,7 @@ export function apply(ctx: Context, config: Config): void { 在插件页面修改字段并保存。验证 profile patch、消费者下一次操作、插件实例标识不变,以及重启后的恢复。提交无效值,并确认文件和即时值均未改变。 -自定义插件页面从 Plugins 页面所有者接收 `form.state` 和 `form.mutate(operations, expectedRevision)`。Host 校验完整 Config,并通过 ConfigEditor 和 volatile HMR 应用修改。[插件设置包](../../packages/client/ui-settings-plugins/README.zh.md) 提供现有卡片示例。 +自定义插件页面从 Plugins 页面所有者接收 `form.state` 和 `form.mutate(operations, expectedRevision)`。Host 校验完整 Config,并通过 ConfigEditor 和 volatile HMR 应用修改。[插件页面 README](../../packages/client/ui-plugin-manager/README.zh.md#configuration-pages) 列出此类页面可注册的 slot,以及 `settings.section` 条目如何同时出现在那里;[ui-settings-shell](../../packages/client/ui-settings-shell/README.zh.md) 是一个现有页面。 ## 4. 向其他插件的页面贡献内容 diff --git a/docs/module-graph.md b/docs/module-graph.md index ec7e6d6328..c7da7cb5d9 100644 --- a/docs/module-graph.md +++ b/docs/module-graph.md @@ -202,8 +202,6 @@ flowchart TD pkg_client_ui_settings_agent_loop["client-ui-settings-agent-loop"] pkg_client_ui_settings_general["client-ui-settings-general"] pkg_client_ui_settings_models["client-ui-settings-models"] - pkg_client_ui_settings_plugin_inventory["client-ui-settings-plugin-inventory"] - pkg_client_ui_settings_plugins["client-ui-settings-plugins"] pkg_client_ui_settings_session_log["client-ui-settings-session-log"] pkg_client_ui_settings_shell["client-ui-settings-shell"] pkg_client_ui_settings_subagent["client-ui-settings-subagent"] @@ -1666,8 +1664,6 @@ flowchart TD | [`client-ui-settings-agent-loop`](../packages/client/ui-settings-agent-loop) | `client` | — | | [`client-ui-settings-general`](../packages/client/ui-settings-general) | `client` | — | | [`client-ui-settings-models`](../packages/client/ui-settings-models) | `client` | — | -| [`client-ui-settings-plugin-inventory`](../packages/client/ui-settings-plugin-inventory) | `client` | — | -| [`client-ui-settings-plugins`](../packages/client/ui-settings-plugins) | `client` | — | | [`client-ui-settings-session-log`](../packages/client/ui-settings-session-log) | `client` | — | | [`client-ui-settings-shell`](../packages/client/ui-settings-shell) | `client` | — | | [`client-ui-settings-subagent`](../packages/client/ui-settings-subagent) | `client` | — | diff --git a/docs/module-graph.zh.md b/docs/module-graph.zh.md index 18b5f97bf0..683c615fd1 100644 --- a/docs/module-graph.zh.md +++ b/docs/module-graph.zh.md @@ -204,8 +204,6 @@ flowchart TD pkg_client_ui_settings_agent_loop["client-ui-settings-agent-loop"] pkg_client_ui_settings_general["client-ui-settings-general"] pkg_client_ui_settings_models["client-ui-settings-models"] - pkg_client_ui_settings_plugin_inventory["client-ui-settings-plugin-inventory"] - pkg_client_ui_settings_plugins["client-ui-settings-plugins"] pkg_client_ui_settings_session_log["client-ui-settings-session-log"] pkg_client_ui_settings_shell["client-ui-settings-shell"] pkg_client_ui_settings_subagent["client-ui-settings-subagent"] @@ -1668,8 +1666,6 @@ flowchart TD | [`client-ui-settings-agent-loop`](../packages/client/ui-settings-agent-loop) | `client` | — | | [`client-ui-settings-general`](../packages/client/ui-settings-general) | `client` | — | | [`client-ui-settings-models`](../packages/client/ui-settings-models) | `client` | — | -| [`client-ui-settings-plugin-inventory`](../packages/client/ui-settings-plugin-inventory) | `client` | — | -| [`client-ui-settings-plugins`](../packages/client/ui-settings-plugins) | `client` | — | | [`client-ui-settings-session-log`](../packages/client/ui-settings-session-log) | `client` | — | | [`client-ui-settings-shell`](../packages/client/ui-settings-shell) | `client` | — | | [`client-ui-settings-subagent`](../packages/client/ui-settings-subagent) | `client` | — | diff --git a/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.i18n.yaml new file mode 100644 index 0000000000..bf71157a82 --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.i18n.yaml @@ -0,0 +1,16 @@ +# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# After editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.md +/: + en: dab406781a6bcb3a + zh: 8d94c715bf9ec1b6 +/built-in-plugins-section-removal: + en: 2483533f0eab34cf + zh: 9e7be97df303c363 +/built-in-plugins-section-removal/change: + en: 513dfd0788a54e09 + zh: 6b589f0dc07a85d7 +/built-in-plugins-section-removal/migration: + en: b7d0c582c0bfd1cd + zh: ac670eb81450b9ef diff --git a/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.md b/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.md new file mode 100644 index 0000000000..6532e26234 --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.md @@ -0,0 +1,19 @@ +--- +kind: upgrade-guide +description: "Settings → Built-in plugins, its two packages, and the `settings.plugins.tab` slot are removed; plugin settings pages also appear on the Plugins page." +--- + +# Built-in plugins section removal + +English | [中文](guide.zh.md) + +## Change + +**Settings → Built-in plugins** and its packages `@deepseek-ai/dsh-client-ui-settings-plugins` and `@deepseek-ai/dsh-client-ui-settings-plugin-inventory` are removed, together with the `settings.plugins.tab` slot and `SettingsPluginsTabOwnerProps`. **Settings → Plugins** opens the Plugins page instead. `settings.section` entries still appear in Settings. The Plugins page also shows an entry on the listed bundle row whose module is the registering package, or on that bundle's page, when the row or bundle registers no `plugins.row.config` or `plugins.bundle.config` of its own; there the entry's `close` returns to the view it was opened from instead of closing Settings. Both surfaces render entries through the `settings.section.view` Factory, which ui-settings-general registers and which declares `settings.section`. + +## Migration + +1. Remove both removed packages from profile manifests and from `cordis.yml` rows that name them. +2. Move any `settings.plugins.tab` contribution to a `settings.section` page or a Plugins page slot such as `plugins.bundle.config`. +3. A `settings.section` page whose `close()` call must leave Settings, such as after starting a Session, navigates there itself, because on the Plugins page `close()` only returns to the previous view. +4. Open the plugin's bundle on the Plugins page and confirm its settings page appears there, unless the row or bundle registers its own configuration, and in Settings. diff --git a/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.zh.md b/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.zh.md new file mode 100644 index 0000000000..c9f7902957 --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-rc.3/settings-section-plugins-page/guide.zh.md @@ -0,0 +1,19 @@ +--- +kind: upgrade-guide +description: "删除「设置 → 内置插件」、它的两个包和 `settings.plugins.tab` slot;插件设置页同时出现在插件页面。" +--- + +# 删除内置插件分区 + +[English](guide.md) | 中文 + +## 变更 + +「设置 → 内置插件」及其包 `@deepseek-ai/dsh-client-ui-settings-plugins` 和 `@deepseek-ai/dsh-client-ui-settings-plugin-inventory` 已删除,`settings.plugins.tab` slot 和 `SettingsPluginsTabOwnerProps` 也一并删除。「设置 → 插件管理」改为打开插件页面。`settings.section` 条目仍显示在设置中。当模块与注册包相同的已列出 bundle 行、或该 bundle 本身没有注册自己的 `plugins.row.config` 或 `plugins.bundle.config` 时,插件页面也会在该行或该 bundle 页面上显示这个条目;在插件页面上,条目的 `close` 回到打开它的视图,而不是关闭设置。两处都通过 `settings.section.view` Factory 渲染条目,该 Factory 由 ui-settings-general 注册并声明 `settings.section`。 + +## 迁移 + +1. 从 profile manifest 和 `cordis.yml` 中删除指向这两个已删除包的条目。 +2. 把 `settings.plugins.tab` 贡献改为 `settings.section` 页面,或 `plugins.bundle.config` 等插件页面 slot。 +3. 调用 `close()` 后必须离开设置的 `settings.section` 页面(例如启动 Session 之后)需要自行导航,因为在插件页面上 `close()` 只回到上一个视图。 +4. 在插件页面打开该插件的 bundle,确认其设置页出现在那里(该行或 bundle 注册了自己的配置时除外)和设置中。 diff --git a/packages/boot/plugin-manager/README.i18n.yaml b/packages/boot/plugin-manager/README.i18n.yaml index b7f3256526..3aaf2eab14 100644 --- a/packages/boot/plugin-manager/README.i18n.yaml +++ b/packages/boot/plugin-manager/README.i18n.yaml @@ -15,8 +15,8 @@ en: 87679c51aa3693f5 zh: 11684a48a5806afb /deepseek-ai-dsh-plugin-manager/use-this-package: - en: 9dba73eeabe9887f - zh: 19291d764da21077 + en: ff51b012b845dd8a + zh: 1c6131057ff98844 /deepseek-ai-dsh-plugin-manager/use-this-package/version-compatibility-and-exemptions: en: 483285658e267dd5 zh: 846bec2daac59a96 @@ -30,8 +30,8 @@ en: c224bfcb3eb3dbd2 zh: 8b9c96970a90dccc /deepseek-ai-dsh-plugin-manager/further-exploration: - en: c6538243d8702a0d - zh: 04a82d923353c75f + en: b151a14acbf93f00 + zh: f304e2ea5c7c7d0f /deepseek-ai-dsh-plugin-manager/model-experience: en: 215e7ba838619b7b zh: a311da3843709f90 @@ -48,8 +48,8 @@ en: c29f60be7f3edc1a zh: d9b9388b96ef95cc /deepseek-ai-dsh-plugin-manager/known-limitations-and-deferred-work: - en: 89306b478cb75b3b - zh: f2f50c88114fec99 + en: d8ea2d28e9e8c3e7 + zh: 4efd7e073dde1b96 /deepseek-ai-dsh-plugin-manager/known-limitations-and-deferred-work/failure-behavior: en: 3fde425e82bbd0f4 zh: 531e2365e7d67480 diff --git a/packages/boot/plugin-manager/README.md b/packages/boot/plugin-manager/README.md index 3c95c6af1a..a010e6d6d5 100644 --- a/packages/boot/plugin-manager/README.md +++ b/packages/boot/plugin-manager/README.md @@ -28,7 +28,7 @@ Manage the current profile's plugins without editing configuration by hand. Enab ## Use this package -Base-backed profiles provide the manager. In Web, the sidebar's **Plugins** page ([ui-plugin-manager](../../client/ui-plugin-manager/README.md)) manages the profile's bundles and their uniquely addressable rows; the Settings Plugin list stays read-only. Agent-preset rows remain read-only. The `plugin_manager` tool exposes the same operations and is enabled in the Standard and Creator presets. Other Web presets keep it disabled by default. The full SDK profile enables it at profile scope in native/PTC mode; without HMR, saved changes return `restart-required` with `no-hmr` and apply after the runtime restarts. Every tool action requires `danger-full-access` or approval for that call. Under lower sandbox modes, `ask` requests approval; `never`, rejection, cancellation, or an unavailable approval channel prevents execution. An approval leaves the session permission mode unchanged. Profile changes persist across sessions, and installed Host code executes in-process outside the workspace sandbox. Dependency build-script approval remains separate. +Base-backed profiles provide the manager. In Web, the sidebar's **Plugins** page ([ui-plugin-manager](../../client/ui-plugin-manager/README.md)) manages the profile's bundles and their uniquely addressable rows. Agent-preset rows remain read-only. The `plugin_manager` tool exposes the same operations and is enabled in the Standard and Creator presets. Other Web presets keep it disabled by default. The full SDK profile enables it at profile scope in native/PTC mode; without HMR, saved changes return `restart-required` with `no-hmr` and apply after the runtime restarts. Every tool action requires `danger-full-access` or approval for that call. Under lower sandbox modes, `ask` requests approval; `never`, rejection, cancellation, or an unavailable approval channel prevents execution. An approval leaves the session permission mode unchanged. Profile changes persist across sessions, and installed Host code executes in-process outside the workspace sandbox. Dependency build-script approval remains separate. For a deployment without agent presets other than the full SDK profile, enable the tool in the profile patch. Package installation/removal requires pnpm on `PATH` or an explicit `pnpmCommand`; a launcher-provided package manager takes precedence. Preset-backed sessions use their preset’s `tool-plugin-manager` entry. @@ -143,7 +143,6 @@ The `@deepseek-ai/dsh-plugin-manager/diagnostic` entry supplies Desktop Host and - [App boot](../app-boot/README.md) — profile layers and startup policy. - [Plugin inventory](../../host/plugin-inventory/README.md) — current Loader and preset observations. - [Plugin manager page](../../client/ui-plugin-manager/README.md) — the Web sidebar page over this service. -- [Plugin settings](../../client/ui-settings-plugin-inventory/README.md) — the read-only Web inventory. ## Model Experience @@ -178,7 +177,7 @@ Tool results append to the transcript. Enabling or disabling other tools can cha - Startup-only profiles cannot remove packages used to start the current process; stop it and use `dsh plugin`. - The manager cannot disable its own management components, change another profile, or edit an agent preset's composition. - A failed removal may leave dependencies partially changed, and a failed or cancelled installation can leave downloaded files under `node_modules` or the pnpm store. Inactive dependencies with missing files remain removable. Diagnostic logs remain under the profile's `.plugin-manager/logs` directory. -- Management results describe Host activation. Browser synchronization failures appear separately in the Settings plugin list. +- Management results describe Host activation. Browser synchronization failures appear separately in the Plugins page's synchronization notice. - Desktop package operations remain owned by the Desktop shell. diff --git a/packages/boot/plugin-manager/README.zh.md b/packages/boot/plugin-manager/README.zh.md index d39d317900..8bcea7e870 100644 --- a/packages/boot/plugin-manager/README.zh.md +++ b/packages/boot/plugin-manager/README.zh.md @@ -28,7 +28,7 @@ kind: "package-reference" ## 使用本包 -基于 base 的 profile 提供管理服务。在 Web 中,侧边栏的**插件**页([ui-plugin-manager](../../client/ui-plugin-manager/README.zh.md))管理 profile 的组合包及其能唯一定位的行;设置页的插件列表保持只读。Agent 预设条目保持只读。`plugin_manager` 工具提供相同操作,在标准和 Creator 预设中启用。其他 Web 预设仍默认禁用。完整 SDK profile 在 profile 作用域为 native/PTC 模式启用此工具;没有 HMR 时,保存的变更返回 `restart-required` 和 `no-hmr`,在运行时重启后应用。每个工具操作都要求 `danger-full-access` 或本次调用的批准。在较低沙箱模式下,`ask` 会请求审批;`never`、拒绝、取消或审批渠道不可用时均不执行。批准不改变会话的权限模式。profile 变更跨会话持久化,已安装的 Host 代码在宿主进程内运行,不受工作区沙箱限制。依赖构建脚本仍需单独批准。 +基于 base 的 profile 提供管理服务。在 Web 中,侧边栏的**插件**页([ui-plugin-manager](../../client/ui-plugin-manager/README.zh.md))管理 profile 的组合包及其能唯一定位的行。Agent 预设条目保持只读。`plugin_manager` 工具提供相同操作,在标准和 Creator 预设中启用。其他 Web 预设仍默认禁用。完整 SDK profile 在 profile 作用域为 native/PTC 模式启用此工具;没有 HMR 时,保存的变更返回 `restart-required` 和 `no-hmr`,在运行时重启后应用。每个工具操作都要求 `danger-full-access` 或本次调用的批准。在较低沙箱模式下,`ask` 会请求审批;`never`、拒绝、取消或审批渠道不可用时均不执行。批准不改变会话的权限模式。profile 变更跨会话持久化,已安装的 Host 代码在宿主进程内运行,不受工作区沙箱限制。依赖构建脚本仍需单独批准。 除完整 SDK profile 外,未使用 Agent 预设的部署在 profile patch 中启用工具;安装/移除包要求 PATH 中有 pnpm,或显式配置 `pnpmCommand`,启动器提供的包管理器优先;使用预设的会话由其预设中的 `tool-plugin-manager` 条目控制。 @@ -143,7 +143,6 @@ service 运行若在 `idleTimeoutMs` 内没有任何捕获输出即被终止, - [App boot](../app-boot/README.zh.md)——profile 配置层与启动策略。 - [Plugin inventory](../../host/plugin-inventory/README.zh.md)——当前 Loader 和预设状态。 - [插件管理页](../../client/ui-plugin-manager/README.zh.md)——基于本服务的 Web 侧边栏页面。 -- [Plugin settings](../../client/ui-settings-plugin-inventory/README.zh.md)——只读的 Web 清单。 ## 模型体验 @@ -178,7 +177,7 @@ service 运行若在 `idleTimeoutMs` 内没有任何捕获输出即被终止, - 仅启动时加载的 profile 不能删除当前进程启动时使用的包;停止进程后使用 `dsh plugin`。 - 管理器不能关闭自身所需的管理组件、修改其他 profile 或编辑 agent 预设组合。 - 失败的删除可能留下部分依赖改动,失败或被取消的安装可能在 `node_modules` 或 pnpm 缓存中留下已下载文件。文件缺失的未启用依赖仍可删除。诊断日志保留在 profile 的 `.plugin-manager/logs` 目录中。 -- 管理结果描述 Host 激活状态。浏览器同步失败会在设置的插件列表中单独显示。 +- 管理结果描述 Host 激活状态。浏览器同步失败会在插件页面的同步提示中单独显示。 - Desktop 包管理操作仍由 Desktop shell 负责。 diff --git a/packages/bundle/web-app/cordis.patch.yml b/packages/bundle/web-app/cordis.patch.yml index 7e6b973a9e..33d4db4333 100644 --- a/packages/bundle/web-app/cordis.patch.yml +++ b/packages/bundle/web-app/cordis.patch.yml @@ -348,11 +348,6 @@ - id: ui-plugin-manager name: '@deepseek-ai/dsh-client-ui-plugin-manager' - # Read-only Plugin list tab in the Settings Plugins section; the built-in - # bundles the sidebar page leaves out are inspected here. - - id: ui-settings-plugin-inventory - name: '@deepseek-ai/dsh-client-ui-settings-plugin-inventory' - - id: ui-conversation name: '@deepseek-ai/dsh-client-ui-conversation' @@ -470,12 +465,6 @@ - id: ui-settings-session-log name: '@deepseek-ai/dsh-client-ui-settings-session-log' - # The Built-in plugins settings section: the navigation entry and the tab - # row the inventory tab registers into. The official configuration pages - # are the companion rows below. - - id: ui-settings-plugins - name: '@deepseek-ai/dsh-client-ui-settings-plugins' - # The official settings pages: one companion package per host-plane # namespace, each registering its page into the Plugins page while the # Host serves the namespace. diff --git a/packages/bundle/web-app/package.json b/packages/bundle/web-app/package.json index 30a41a9842..73efcb5d84 100644 --- a/packages/bundle/web-app/package.json +++ b/packages/bundle/web-app/package.json @@ -117,8 +117,6 @@ "@deepseek-ai/dsh-client-ui-settings-agent-loop": "workspace:*", "@deepseek-ai/dsh-client-ui-settings-general": "workspace:*", "@deepseek-ai/dsh-client-ui-settings-models": "workspace:*", - "@deepseek-ai/dsh-client-ui-settings-plugin-inventory": "workspace:*", - "@deepseek-ai/dsh-client-ui-settings-plugins": "workspace:*", "@deepseek-ai/dsh-client-ui-settings-session-log": "workspace:*", "@deepseek-ai/dsh-client-ui-settings-shell": "workspace:*", "@deepseek-ai/dsh-client-ui-settings-subagent": "workspace:*", diff --git a/packages/client/README.i18n.yaml b/packages/client/README.i18n.yaml index 6d52c7f559..0e4d3960bb 100644 --- a/packages/client/README.i18n.yaml +++ b/packages/client/README.i18n.yaml @@ -15,8 +15,8 @@ en: 1eb35b015a6c423f zh: a8a3dceee2c9e943 /client-web-gui-browser-half/packages: - en: 45c1d8a1e1f44425 - zh: 47a5199bca1e7836 + en: e6b93119ee411a50 + zh: a9ed12dd8cc8864a /client-web-gui-browser-half/related-documentation: en: d1d506e68fab7333 zh: 1a90fe6f3f8f24a9 diff --git a/packages/client/README.md b/packages/client/README.md index 4efbbb0710..20f96c17cc 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -72,7 +72,6 @@ The kernel packages boot and serve the page; the UI feature packages present it. | [`ui-model-selection/`](ui-model-selection/README.md) | Provides model selection in conversation surfaces | — | | [`ui-permission-presets/`](ui-permission-presets/README.md) | Configures default permissions and switches the current session's access | — | | [`ui-plan/`](ui-plan/README.md) | Presents active plan-mode status and its exit control | — | -| [`ui-settings-plugins/`](ui-settings-plugins/README.md) | Owns the Built-in plugins settings section shell and its tab extension point | — | | [`ui-user-questions/`](ui-user-questions/README.md) | Presents interactive questions requested by the agent | — | | [`ui-agent-preset/`](ui-agent-preset/README.md) | Selects a session's agent preset and authors preset compositions | — | | [`ui-settings/`](ui-settings/README.md) | Hosts the settings interface and its extension areas | — | @@ -86,7 +85,6 @@ The kernel packages boot and serve the page; the UI feature packages present it. | [`ui-plugin-manager/`](ui-plugin-manager/README.md) | Contributes the sidebar Plugins panel: install, enable, disable, retry, and compose installed packages | — | | [`ui-entry-customization/`](ui-entry-customization/README.md) | Adds region-local More menus that pin or unpin plugin launchers and start a plugin draft | — | | [`ui-plugin-market/`](ui-plugin-market/README.md) | Contributes the Discover tab to the Plugins page: browse market indexes and install their bundles | — | -| [`ui-settings-plugin-inventory/`](ui-settings-plugin-inventory/README.md) | Contributes the read-only Host Loader inventory tab to Plugins settings | — | | [`ui-deliverables/`](ui-deliverables/README.md) | Produces the changed-files card with its comparison tabs, delivery cards, and clickable final-response file references | — | | [`ui-message-feedback/`](ui-message-feedback/README.md) | Provides message ratings and feedback dialogs opened from ratings, `/feedback`, or the Session Header menu | `ctx.feedbackUi` | | [`ui-directory-picker-browse/`](ui-directory-picker-browse/README.md) | In-app directory browsing surface for the workspace directory flow | — | diff --git a/packages/client/README.zh.md b/packages/client/README.zh.md index 1bb3677465..ca1c6018d0 100644 --- a/packages/client/README.zh.md +++ b/packages/client/README.zh.md @@ -72,7 +72,6 @@ kind: "package-group" | [`ui-model-selection/`](ui-model-selection/README.zh.md) | 在对话界面中提供模型选择 | — | | [`ui-permission-presets/`](ui-permission-presets/README.zh.md) | 配置默认权限并切换当前会话的访问模式 | — | | [`ui-plan/`](ui-plan/README.zh.md) | 展示生效中的 plan mode 状态及其退出控件 | — | -| [`ui-settings-plugins/`](ui-settings-plugins/README.zh.md) | 负责「内置插件」设置分区壳及其标签页扩展点 | — | | [`ui-user-questions/`](ui-user-questions/README.zh.md) | 展示 agent 请求的交互式问题 | — | | [`ui-agent-preset/`](ui-agent-preset/README.zh.md) | 选择会话的 agent 预设并编写预设组合 | — | | [`ui-settings/`](ui-settings/README.zh.md) | 承载设置界面及其扩展区域 | — | @@ -86,7 +85,6 @@ kind: "package-group" | [`ui-plugin-manager/`](ui-plugin-manager/README.zh.md) | 贡献侧栏的“插件”面板:安装、启用、停用、重试与组合已安装的包 | — | | [`ui-entry-customization/`](ui-entry-customization/README.zh.md) | 添加分区域的“更多”菜单,固定或收起插件入口,并开始创建插件的草稿 | — | | [`ui-plugin-market/`](ui-plugin-market/README.zh.md) | 为“插件”页面贡献“发现”标签页:浏览市场索引并安装其中的组合包 | — | -| [`ui-settings-plugin-inventory/`](ui-settings-plugin-inventory/README.zh.md) | 向「插件」设置贡献只读的 Host Loader 清单标签页 | — | | [`ui-deliverables/`](ui-deliverables/README.zh.md) | 生成改动文件卡片及其对比 tab、交付文件卡片与可点击的最终响应文件引用 | — | | [`ui-message-feedback/`](ui-message-feedback/README.zh.md) | 提供消息赞踩,以及从赞踩、`/feedback` 或会话标题栏菜单打开的反馈弹窗 | `ctx.feedbackUi` | | [`ui-directory-picker-browse/`](ui-directory-picker-browse/README.zh.md) | 面向工作区目录流程的应用内目录浏览界面 | — | diff --git a/packages/client/hmr/README.i18n.yaml b/packages/client/hmr/README.i18n.yaml index a9c83d55bc..63402bfa3b 100644 --- a/packages/client/hmr/README.i18n.yaml +++ b/packages/client/hmr/README.i18n.yaml @@ -21,8 +21,8 @@ en: e1c5d886bc7da5bc zh: da8f0c309e178b74 /deepseek-ai-dsh-client-hmr/use-this-package/what-a-reload-does: - en: d3ac81d404b2d6c6 - zh: a9f9ad9dfa685ac7 + en: 4c72f150b89c2bb7 + zh: a6773cfd92c72f61 /deepseek-ai-dsh-client-hmr/use-this-package/configuration: en: 8b4b8f929cf0ba25 zh: 626779afc1132e4f @@ -42,8 +42,8 @@ en: 191b6aa1dfd7de08 zh: f7a4e65bea2e2bd8 /deepseek-ai-dsh-client-hmr/understand-the-implementation/failure-policy: - en: 5c9939cd350c136d - zh: 020159ec196f378f + en: cc2114489f83dc70 + zh: 6268962333946c82 /deepseek-ai-dsh-client-hmr/understand-the-implementation/source-map: en: 67728b630b30b9aa zh: 55861de2169ecafe diff --git a/packages/client/hmr/README.md b/packages/client/hmr/README.md index 92bf0e43f2..93cdef6c0e 100644 --- a/packages/client/hmr/README.md +++ b/packages/client/hmr/README.md @@ -33,7 +33,7 @@ Run `pnpm run dev:web`, which starts the host and the rebuild watchers together ### What a reload does -Each successful reload re-executes the plugin bundle and remounts the plugin with fresh state. Plugins that depend on the reloaded one reload with it automatically. Failures appear in the plugin list, where they can be retried without waiting for another rebuild. +Each successful reload re-executes the plugin bundle and remounts the plugin with fresh state. Plugins that depend on the reloaded one reload with it automatically. Failures appear in the Plugins page's synchronization notice, where they can be retried without waiting for another rebuild. ### Configuration @@ -71,7 +71,7 @@ A fiber's activation epoch strings its service providers' uids, so replacing a p ### Failure policy -Download failures leave the running plugin active. After the old fiber is torn down, import or activation failure does not restore the previous bundle. Failures appear as page-local synchronization errors. Settings → Plugins → Plugin list retries the latest graph, even when its revision is unchanged; a later rebuild also retries the affected plugin. Successful unrelated plugins remain active. +Download failures leave the running plugin active. After the old fiber is torn down, import or activation failure does not restore the previous bundle. Failures appear as page-local synchronization errors. **Retry this page** on the Plugins page retries the latest graph, even when its revision is unchanged; a later rebuild also retries the affected plugin. Successful unrelated plugins remain active. ### Source map diff --git a/packages/client/hmr/README.zh.md b/packages/client/hmr/README.zh.md index 84ca0a330d..cb893bd851 100644 --- a/packages/client/hmr/README.zh.md +++ b/packages/client/hmr/README.zh.md @@ -33,7 +33,7 @@ kind: "package-reference" ### 一次重载做什么 -每次成功的重载都会重新执行插件 bundle,并用全新状态重新挂载插件。依赖被重载插件的插件会随之自动重载。失败会显示在插件列表中,可直接重试,无需等待下一次重建。 +每次成功的重载都会重新执行插件 bundle,并用全新状态重新挂载插件。依赖被重载插件的插件会随之自动重载。失败会显示在插件页面的同步提示中,可直接重试,无需等待下一次重建。 ### 配置 @@ -71,7 +71,7 @@ fiber 的激活 epoch 会串联其服务提供方的 uid,因此替换提供方 ### 失败策略 -下载失败时,正在运行的插件保持活动。旧 fiber 被卸载后,导入或激活失败不会恢复先前的 bundle。失败会显示为当前页面的同步错误。「设置 → 插件 → 插件列表」会针对最新图重试,即使其 revision 未变化;后续重建也会重试受影响的插件。无关且已成功运行的插件保持活动。 +下载失败时,正在运行的插件保持活动。旧 fiber 被卸载后,导入或激活失败不会恢复先前的 bundle。失败会显示为当前页面的同步错误。插件页面的「重试本页面同步」会针对最新图重试,即使其 revision 未变化;后续重建也会重试受影响的插件。无关且已成功运行的插件保持活动。 ### 源码地图 diff --git a/packages/client/modules/README.i18n.yaml b/packages/client/modules/README.i18n.yaml index bae092537e..f7ba81c650 100644 --- a/packages/client/modules/README.i18n.yaml +++ b/packages/client/modules/README.i18n.yaml @@ -27,8 +27,8 @@ en: 1383d68472b3c057 zh: 94dd7d9abbdbccf3 /deepseek-ai-dsh-client-modules/use-this-package/live-plugin-composition: - en: 252613c45e5e46f5 - zh: fa44cf77c86019af + en: 4487b06ddced3b71 + zh: 26d0181fcf0229ca /deepseek-ai-dsh-client-modules/use-this-package/host-release-changes: en: 5c0aa6f1d8df8e1c zh: 34005131c9bdce3b diff --git a/packages/client/modules/README.md b/packages/client/modules/README.md index 008775649d..78a7dad1e0 100644 --- a/packages/client/modules/README.md +++ b/packages/client/modules/README.md @@ -44,7 +44,7 @@ The application combo scripts carry only each plugin's `client.js` entry and reg ### Live plugin composition -An open Web page follows the Host's complete module graph through the HMR transport. Enabling an ordinary plugin adds its Loader entry; disabling it removes the entry and waits for its asynchronous effects before evicting unused modules and styles. Re-enabling loads one instance with its styles. Other Loader contributors and shared modules still needed by active entries remain loaded. Settings → Plugins → Plugin list shows page-local synchronization failures and offers retry without changing Host enablement. +An open Web page follows the Host's complete module graph through the HMR transport. Enabling an ordinary plugin adds its Loader entry; disabling it removes the entry and waits for its asynchronous effects before evicting unused modules and styles. Re-enabling loads one instance with its styles. Other Loader contributors and shared modules still needed by active entries remain loaded. The Plugins page shows page-local synchronization failures and offers retry without changing Host enablement. ### Host release changes diff --git a/packages/client/modules/README.zh.md b/packages/client/modules/README.zh.md index 5f50e15825..9a25d0372c 100644 --- a/packages/client/modules/README.zh.md +++ b/packages/client/modules/README.zh.md @@ -44,7 +44,7 @@ application combo 脚本只携带每个插件的 `client.js` 入口,并在启 ### 插件动态组合 -已打开的 Web 页面通过 HMR 传输跟随 Host 的完整模块图。启用普通插件会添加其 Loader 条目;停用会移除条目,并在其异步 effect 完成清理后回收未使用的模块与样式。再次启用会加载一个带样式的实例。其他 Loader 贡献方的条目及活动条目仍需使用的共享模块会保留。「设置 → 插件 → 插件列表」显示当前页面的同步失败,并提供不改变 Host 启用状态的重试。 +已打开的 Web 页面通过 HMR 传输跟随 Host 的完整模块图。启用普通插件会添加其 Loader 条目;停用会移除条目,并在其异步 effect 完成清理后回收未使用的模块与样式。再次启用会加载一个带样式的实例。其他 Loader 贡献方的条目及活动条目仍需使用的共享模块会保留。插件页面显示当前页面的同步失败,并提供不改变 Host 启用状态的重试。 ### Host release 变化 diff --git a/packages/client/ui-plugin-manager/README.i18n.yaml b/packages/client/ui-plugin-manager/README.i18n.yaml index ee8881e956..7504ba8b5b 100644 --- a/packages/client/ui-plugin-manager/README.i18n.yaml +++ b/packages/client/ui-plugin-manager/README.i18n.yaml @@ -9,14 +9,14 @@ en: 719d90bd71d7b957 zh: 492767e7ea9f88f8 /deepseek-ai-dsh-client-ui-plugin-manager/summary: - en: 0dc67850ca5358de - zh: 4ff1bb5bdc184e3e + en: 3c168fb38c18d523 + zh: 13c37617819af3fe /deepseek-ai-dsh-client-ui-plugin-manager/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package: - en: c38847d0d4d5a7b6 - zh: b83f29416199098a + en: ee6b2fa96adc6fdb + zh: ef9a0371db1b78a7 /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/installing-a-bundle: en: 1fc6c5c2a54d8db4 zh: 9e53f5164e2b7161 @@ -24,14 +24,14 @@ en: 2a44a378364912db zh: 8c514ce17469747f /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-a-bundle: - en: 188ebf6f1590bad1 - zh: e6d41e8586190fa0 + en: 902e109f3315d1ca + zh: d508c17983d1fe2e /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-one-row-of-a-bundle: - en: 5f93ebe75d13b7cf - zh: 9c28f150263d041e + en: 2c338faf806bd469 + zh: fe947a1b27382e5d /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/configuration-pages: - en: e9da90f03691101b - zh: 902cda935a4ce3c8 + en: 501cc3aaee34ea6c + zh: 36599c3a716fb4f2 /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/detail-page-extension-points: en: 16dbfb0ab558c951 zh: adf098c0751a7144 @@ -48,8 +48,8 @@ en: ef7ab41b4119c7b9 zh: 3166661bf84415e5 /deepseek-ai-dsh-client-ui-plugin-manager/understand-the-implementation/configuration-slots: - en: 45e324f5663be635 - zh: 674ddf55c1581569 + en: a8efaca9e2f9616b + zh: cb42a9279f723bc2 /deepseek-ai-dsh-client-ui-plugin-manager/further-exploration: en: f9a42dfed0360d6a zh: 455a70bcb6c69624 diff --git a/packages/client/ui-plugin-manager/README.md b/packages/client/ui-plugin-manager/README.md index 7d60c7f3c5..71c0508a0f 100644 --- a/packages/client/ui-plugin-manager/README.md +++ b/packages/client/ui-plugin-manager/README.md @@ -11,7 +11,7 @@ Desktop product events use the optional [product analytics service](../product-a ## Summary -Use the **Plugins** entry in the Web sidebar to manage the profile's installed bundles and the official bundles the installation ships switched off. Switch bundles and their rows on and off, install a bundle after the Host has read what the spec names, watch pnpm's output, stop a run, and enable what it added. Uninstalling asks for confirmation. A plugin that registers a configuration page is edited here, on its own page; Settings keeps the read-only inventory. +Use the **Plugins** entry in the Web sidebar to manage the profile's installed bundles and the official bundles the installation ships switched off. Switch bundles and their rows on and off, install a bundle after the Host has read what the spec names, watch pnpm's output, stop a run, and enable what it added. Uninstalling asks for confirmation. A plugin that registers a configuration page is edited here, on its own page; **Settings → Plugins** opens this page. ## Table of Contents @@ -31,7 +31,9 @@ Below 768px, the page uses 20px horizontal insets to align with the conversation [Ralph loops](../../experimental/ralph-bundle/README.md) and [Session search](../../experimental/session-search/README.md) remain bundled but are hidden from both plugin lists unless the profile enables or separately installs them. Existing selections remain manageable; switching off an installation-carried copy hides it again. Enter either exact package name in **Add plugin**, then choose **Enable now** to use the shipped copy without downloading it again. Sidebar session search is independent. LiveShare declares the same default-hidden intent in its bundle manifest (`dsh.bundle.listedByDefault: false`), so it stays out of both lists, including **More**, until a declared row runs or it is enabled. The page's manifest rule is generic: a bundle whose manifest does not declare `listedByDefault: false` is listed; one that does is listed only when the profile enables it, the installation carries it selected, or one of its declared rows runs; a hidden bundle is not opened by its ID either. -Select **Plugins** in the sidebar. The information button uses an 11px caption-colored icon in a 20px square hover area, with a 4px gap after the subtitle. It explains that this page configures official plugins and installs or manages other plugins, while **Settings → Built-in plugins** shows the built-in inventory and runtime status. Hover or focus shows the shared tooltip; clicking keeps it open until another click, Escape, Tab, or an outside click. The page reads the inventory and the bundles through `api-remotes` when first opened; a Host without a managed profile shows the page as unavailable. **Built-in plugin settings** lists official configuration pages by their configured order: Subagent, web search and fetch, agent loop, then shell. **Experimental plugins** shows the primary optional bundles, with **More** beside its heading opening a separate page of the same title. That page lists the official bundles eligible for display, including those on the main list, with Codex and Claude Code subagents last. Its back button returns to the main list, where **Installed plugins** remains below Experimental plugins. Bundle details return to the list they were opened from. Catalog entries keep their position after installation or removal. **Installed plugins** lists other profile bundles. Installation-carried optional bundles have no uninstall action. Experimental packages retain the **Experimental** marker on both lists. Switching on a bundle that page holds back adds it to the main list in the position that page shows it, and switching it off leaves it on that page alone unless its manifest hides unselected bundles; other bundles keep their place on both. A dependency without a bundle patch is not a plugin and is not listed unless the profile selects it, in which case it carries a problem tag. Global configuration remains in the Settings **Built-in plugins** section. +Select **Plugins** in the sidebar. The information button uses an 11px caption-colored icon in a 20px square hover area, with a 4px gap after the subtitle. It explains that this page configures official plugins, and installs, manages, and configures other plugins. Hover or focus shows the shared tooltip; clicking keeps it open until another click, Escape, Tab, or an outside click. The page reads the inventory and the bundles through `api-remotes` when first opened; a Host without a managed profile shows the page as unavailable. **Built-in plugin settings** lists official configuration pages by their configured order: Subagent, web search and fetch, agent loop, then shell. **Experimental plugins** shows the primary optional bundles, with **More** beside its heading opening a separate page of the same title. That page lists the official bundles eligible for display, including those on the main list, with Codex and Claude Code subagents last. Its back button returns to the main list, where **Installed plugins** remains below Experimental plugins. Bundle details return to the list they were opened from. Catalog entries keep their position after installation or removal. **Installed plugins** lists other profile bundles. Installation-carried optional bundles have no uninstall action. Experimental packages retain the **Experimental** marker on both lists. Switching on a bundle that page holds back adds it to the main list in the position that page shows it, and switching it off leaves it on that page alone unless its manifest hides unselected bundles; other bundles keep their place on both. A dependency without a bundle patch is not a plugin and is not listed unless the profile selects it, in which case it carries a problem tag. + +Every view of the page, whether or not the bundle list is available, shows this browser page's client plugin synchronization state at the top of the page body, below any header; the state comes from `ctx.modules.entries.state`. While synchronization runs, a status line reads **Syncing plugins on this page…**. When entries fail, a notice (`data-client-sync-failure`) says that some plugins could not sync on this page and that Host enablement is unchanged, lists each failure as `id: message`, and offers **Retry this page**, which calls `ctx.modules.entries.retry()` and is disabled while synchronization runs. As available header width decreases, Refresh and Add plugin first become icon-only controls with accessible names and tooltips; the tabs then shrink from their usual minimum width to fit their labels, and the action group wraps only when necessary. The information button follows the subtitle text. The main page header and list share one scroll container. Header controls move with the scroll position until they reach their compact positions; scrolling back follows the same coordinates. The header wrapper retains its resting flow height to preserve the list's scroll range, while the draggable head's box matches its painted height so native drag geometry cannot extend into the list. A barely scrolling list can stop before the header is fully compact. The More list's back-and-title row stays fixed, and detail pages scroll their head row with the content. The Installed/Discover tabs use the compact 34px control with a 2px inset around the selection indicator. The subtitle scrolls out of view; with tabs present, the title also scrolls out, and the tabs settle beside Refresh and Add plugin where space permits. On narrow pages, the tabs and icon actions share a row beneath the heading where they fit; otherwise the tabs stay above the actions. Their relative order stays the same throughout scrolling. The resting and compact layouts retain their 28px and 16px page-top insets respectively, with 16px below the compact controls. macOS adds the frame's titlebar clearance while resting; its compact bar keeps 16px above and below with the sidebar expanded, and with the sidebar collapsed it also clears the frame's top strip so the controls stay below the native window controls. Only on macOS, when the sidebar is collapsed, the compact controls keep 8px rather than 16px above them in addition to the unchanged frame clearance, at every width. The resting layout and compact bottom spacing stay unchanged. Windows relies on the frame's caption offset without adding it again. The divider spans the page at the bottom of the compact header; the list's initial top spacing scrolls with its content. Hover styling applies only where the pointer can hover, so a tap leaves no card, row, or menu option in its hover state; cards and icon actions answer a touch-down with the pressed fill instead. The install, registry, and filter fields take a 16px face under a coarse pointer, which keeps iOS Safari from zooming a focused field. @@ -78,12 +80,13 @@ After the checks, the list toolbar says how many plugins can be updated, that al ### Switching a bundle -A bundle's page shows its full package name under the title. Its **Source** section, after the rows, names the spec that installs it elsewhere, as `pnpm add` accepts it, or **Built in** for an official bundle the installation ships, then its current version. A bundle's switch changes its layer selection. A displayed detail document stays visible while a profile change triggers a fresh read; the result replaces it when ready. While the Host applies the change, the switch stays disabled and a spinner appears beside it; the action area permanently reserves 22px to the left of the switch. A persistent status region announces the pending change to screen readers. A profile with HMR recomposes before the operation completes; one without HMR, and a bundle a higher layer overrides, say so in a toast. A bundle the Host cannot read carries a problem tag and its reason on its page and cannot be switched on; one that provides the management components stays locked. A selected bundle whose layer the Host skipped, reported as an error with none of its rows carrying a live entry, keeps its switch on and carries a not-running tag instead, and its card states the reason without the requirement list. A bundle's page omits the component list when the Host reports an error and no rows, since the Host may not have read its patch. The Host answers with error codes, which the page's dictionary words; pnpm's and the Loader's own diagnostics are shown as they are. The page excludes built-in profile bundles and the persistent-terminal bundle from cards and detail pages, regardless of activation, dependency declarations, or Host errors. Hiding a bundle preserves its Host availability and activation. The Host inventory remains complete; the Settings Plugins section's Plugin list tab inspects their plugins. +A bundle's page shows its full package name under the title. Its **Source** section, after the rows, names the spec that installs it elsewhere, as `pnpm add` accepts it, or **Built in** for an official bundle the installation ships, then its current version. A bundle's switch changes its layer selection. A displayed detail document stays visible while a profile change triggers a fresh read; the result replaces it when ready. While the Host applies the change, the switch stays disabled and a spinner appears beside it; the action area permanently reserves 22px to the left of the switch. A persistent status region announces the pending change to screen readers. A profile with HMR recomposes before the operation completes; one without HMR, and a bundle a higher layer overrides, say so in a toast. A bundle the Host cannot read carries a problem tag and its reason on its page and cannot be switched on; one that provides the management components stays locked. A selected bundle whose layer the Host skipped, reported as an error with none of its rows carrying a live entry, keeps its switch on and carries a not-running tag instead, and its card states the reason without the requirement list. A bundle's page omits the component list when the Host reports an error and no rows, since the Host may not have read its patch. The Host answers with error codes, which the page's dictionary words; pnpm's and the Loader's own diagnostics are shown as they are. The page excludes built-in profile bundles and the persistent-terminal bundle from cards and detail pages, regardless of activation, dependency declarations, or Host errors. Hiding a bundle preserves its Host availability and activation. The Host inventory remains complete. ### Switching one row of a bundle A row's switch on the bundle's page calls `pluginManager.setPluginEnabled`, which records the row's enablement in the profile's `cordis.patch.yml` under the [toggle rules](../../boot/plugin-manager/README.md#use-this-package). The tree recomposes at once on a profile with HMR, so the row's host half unmounts or mounts while the rest of the bundle keeps running, and the page follows the client module graph without reloading. Rows use the shared status marker for their Host fiber phase: pending and disabled are idle, loading and unloading are ongoing, active is done, and failed is error. The switch appears only on a bundle that is on; a row without a live entry, or one the Host will not address through the profile patch, is locked with the Host's reason. A list longer than ten rows gets a filter through the shared [text search](../../util/text-search/README.md): row ids, module names, and every declared language of titles match fuzzily, and every language of descriptions matches as a substring; rows display in the current language. + ### Configuration pages A plugin that carries its own configuration renders it on this page rather than in Settings, through three slots the page declares: `plugins.item` (list) for an official plugin, listed in Built-in plugin settings by its `label`; `plugins.bundle.config` (keyed by the bundle's package name) for a bundle's own configuration, shown on the bundle's page between its description and its rows; and `plugins.row.config` (keyed by `#`) for one row's configuration, which gives that row a **Configure** control opening the row's page. The page renders `view: 'page'` for forms with their own save controls. Official plugin cards also render `view: 'summary'` under the title; a row's detail page uses that view only when its package description is absent. Only a save writes: the page draws the title, icon, and crumb, and the entry's form drops its staged edits when the page is left. The four host-plane pages the installation ships — the shell executor, the agent loop, Subagent, and the DeepSeek search provider — come from one companion package each, [ui-settings-shell](../ui-settings-shell/README.md), [ui-settings-agent-loop](../ui-settings-agent-loop/README.md), [ui-settings-subagent](../ui-settings-subagent/README.md), and [ui-settings-web-search](../ui-settings-web-search/README.md), registered while the Host serves their namespaces. A bundle's browser half registers the same way: @@ -98,6 +101,8 @@ ctx.slots.inject('plugins.row.config', () => ctx.slots.register({ The bundle's patch must declare the row under that id, and the registration exists while the bundle is on, so a bundle that is off shows no configure control. +A plugin's own settings page is a `settings.section` entry, whose type lives in [ui-settings](../ui-settings/README.md#filling-the-settings-slots); Settings lists every entry, and this page also renders an entry, through the same `settings.section.view` Component Factory, where a listed bundle claims it. The listed bundle row whose module name equals the package that registered the entry claims it when that row has no `plugins.row.config` entry: that row gets a **Configure** control, and the row's page renders the entry with a `close` prop that returns to the bundle's page. When the registering package is a listed bundle's own package name, no listed row has that module, and the bundle has no `plugins.bundle.config` entry, the bundle's page renders the entry with a `close` that returns to the view the bundle's page was opened from. An entry that no listed row or bundle claims, or whose registering package is unknown, appears only in Settings. Settings' **Plugins** entry, a `settings.section` registration with id `plugins` and order 15, closes Settings and opens this page's main list. + ### Detail page extension points A plugin with something to say about a bundle, a row, or an official plugin it does not own contributes to that object's page through three list slots the page declares: `plugins.detail.actions` for a control at the head of the page, before the page's own switch and uninstall; `plugins.detail.badge` for a tag beside the title, after the version, experimental, and problem or not-running tags; and `plugins.detail.section` for a section under the page's own content — after the source on a bundle's page, after the configuration on a row's or an official plugin's page. Every entry is rendered with the page's `subject`: `{ kind: 'bundle', pkg }`, `{ kind: 'row', pkg, row }`, or `{ kind: 'item', id }`, where `pkg` and `row` carry the name, version, installed and enabled facts, and the row list a contribution decides on. An entry renders null for a subject it has nothing for and draws its own section chrome; the page orders entries by `order`. @@ -148,7 +153,7 @@ While the Plugins page has access, other Client plugins can read `pluginNavigati Custom item pages use the Host entry id as their registration id; row pages use the bundle package and row id. The page owner supplies `form.state` and `form.mutate(operations, expectedRevision)` when the entry exposes editable Config fields. A custom page owns its draft and validation display, and may reuse `ConfigField` from ui-primitives. Bundle-wide pages can contain several entries and have no single form. -The page's `main` registration declares `plugins.item`, `plugins.bundle.config`, and `plugins.row.config` as its children, so the slots exist while the page does and a registrant's `ctx.slots.inject` waits for them. `configLedgerSource` projects the three ledgers into one observable — the official items in ledger order with their labels resolved in the active locale, and the bundle and row keys — cached until a ledger or the locale moves; the page binds it as `useConfigLedger` beside the store and never names a configurable plugin itself. The registration-owned navigation store selects the main list, the full experimental plugin list, a bundle, an official plugin, or a bundle row; switching away from the Plugins panel resets it to the list, while React remounts preserve the selected target. A fresh registration starts on the main list. Installation highlighting scrolls to a card only when it is on the current page; it does not change the selected page. Other Client plugins read `pluginNavigation` optionally, through `ctx.get` or `ctx.inject`, and call its `openBundle(packageName)` to open bundle details without changing the current Session; listing it in a plugin's `inject` keeps that plugin pending on a page without access. The target survives the initial inventory load; an absent bundle displays the list. A registration lives with the browser half that made it. `dsh-client-modules` attaches a package's browser half to the Loader row whose specifier is the bare package name, so every page a bundle registers, for itself or for any of its rows, goes away when that row is switched off; a sub-plugin whose page must outlive the other rows ships as its own package. Cards and detail pages show the Experimental marker only for packages in `EXPERIMENTAL_BUNDLES` in [`dsh-official-bundles`](../../util/official-bundles/README.md#plugin-manager-lists); package-name prefixes do not select the marker. +The page's `main` registration declares `plugins.item`, `plugins.bundle.config`, and `plugins.row.config` as its children, so the slots exist while the page does and a registrant's `ctx.slots.inject` waits for them. `configLedgerSource` projects the four ledgers into one observable — the official items and the `settings.section` entries in ledger order with their labels resolved in the active locale, each section with its registering module when known, and the bundle and row keys — cached until a ledger or the locale moves; the page binds it as `useConfigLedger` beside the store and never names a configurable plugin itself. The registration-owned navigation store selects the main list, the full experimental plugin list, a bundle, an official plugin, or a bundle row; switching away from the Plugins panel resets it to the list, while React remounts preserve the selected target. A fresh registration starts on the main list. Installation highlighting scrolls to a card only when it is on the current page; it does not change the selected page. Other Client plugins read `pluginNavigation` optionally, through `ctx.get` or `ctx.inject`, and call its `openBundle(packageName)` to open bundle details without changing the current Session; listing it in a plugin's `inject` keeps that plugin pending on a page without access. The target survives the initial inventory load; an absent bundle displays the list. A registration lives with the browser half that made it. `dsh-client-modules` attaches a package's browser half to the Loader row whose specifier is the bare package name, so every page a bundle registers, for itself or for any of its rows, goes away when that row is switched off; a sub-plugin whose page must outlive the other rows ships as its own package. Cards and detail pages show the Experimental marker only for packages in `EXPERIMENTAL_BUNDLES` in [`dsh-official-bundles`](../../util/official-bundles/README.md#plugin-manager-lists); package-name prefixes do not select the marker. `plugins.bundle.config` supplies bundle detail configuration, keyed by npm package name. Client plugins can subscribe to the read-only `ctx.pluginChanges.bundle(packageName)` source to pause their queries while a bundle or one of its rows is being changed. Notifications precede the management request and continue when the page closes; subscribers release their observation on disposal. `plugins.bundle.activation` offers bundle-owned guidance after explicit enablement from either the list or detail page, with callbacks to dismiss it or open the bundle details. It does not appear merely because an enabled bundle was listed. diff --git a/packages/client/ui-plugin-manager/README.zh.md b/packages/client/ui-plugin-manager/README.zh.md index 96349ef9d2..325815001f 100644 --- a/packages/client/ui-plugin-manager/README.zh.md +++ b/packages/client/ui-plugin-manager/README.zh.md @@ -11,7 +11,7 @@ kind: "package-reference" ## 概述 -使用 Web 侧栏的**插件**入口管理 profile 已安装的组合包,以及安装随附、默认关闭的官方组合包。可以启停组合包及其行、在 Host 读出 spec 指向什么之后安装组合包、查看 pnpm 输出、停止一次运行,并启用它新增的包。卸载会要求确认。注册了配置页的插件在这里、在它自己的页面上编辑;设置里只保留只读的插件列表。 +使用 Web 侧栏的**插件**入口管理 profile 已安装的组合包,以及安装随附、默认关闭的官方组合包。可以启停组合包及其行、在 Host 读出 spec 指向什么之后安装组合包、查看 pnpm 输出、停止一次运行,并启用它新增的包。卸载会要求确认。注册了配置页的插件在这里、在它自己的页面上编辑;「设置 → 插件管理」打开本页。 ## 目录 @@ -31,7 +31,9 @@ kind: "package-reference" [Ralph 循环](../../experimental/ralph-bundle/README.zh.md)和[会话搜索](../../experimental/session-search/README.zh.md)仍随包提供,但默认不在两个插件列表中展示,只有 profile 启用或另行安装后才显示。已有的启用状态仍可管理;关闭随安装提供的版本后,它会再次隐藏。在**添加插件**中输入准确包名,再选择**立即启用**,即可使用随包提供的版本,无需再次下载。侧栏会话搜索独立于此功能。LiveShare 在其 bundle manifest 中声明相同的默认隐藏意图(`dsh.bundle.listedByDefault: false`),因此在自身声明的行开始运行或被启用前,它不会出现在两个列表(含**更多**页)中。页面的 manifest 规则是通用的:未声明 `listedByDefault: false` 的组合包会列出;声明了的,只有在 profile 启用、安装随附版本被选中,或它声明的某一行开始运行时才列出;隐藏的组合包也不能通过 ID 打开详情。 -在侧栏选择**插件**。信息按钮使用 11px 的 caption 色图标和 20px 方形悬停区域,与副标题间隔 4px。它说明当前页用于配置官方插件、安装和管理其他插件,**设置 → 内置插件**则展示内置插件列表及运行状态。悬停或聚焦显示共享 tooltip;点击后保持展开,直至再次点击、Escape、Tab 或外部点击。页面首次打开时通过 `api-remotes` 读取清单与组合包;没有受管 profile 的 Host 上页面显示为不可用。**内置插件配置**按配置的顺序列出官方配置页:子智能体、网页搜索与获取、Agent 循环、终端。**实验性插件**展示主要的可选组合包,标题旁的**更多**打开同名的独立页面。该页列出符合展示条件的官方组合包,也包含主列表已有的条目,Codex 和 Claude Code 子智能体排在最后。返回按钮回到主列表,**已安装插件**保持在实验性插件下方。组合包详情返回打开它的列表。目录条目在安装或移除后保持原位置。**已安装插件**列出其他 profile 组合包。安装随附的可选组合包没有卸载操作。实验性包在两个列表中均保留**实验性**标签。开启仅在该页列出的组合包会按该页中的位置把它加入主列表,关闭后它只留在该页,但 manifest 声明默认隐藏的组合包会从该页消失;其他组合包在两个列表中均保持原位。没有组合包 patch 的依赖不是插件,除非 profile 选中了它才会带异常标签列出。全局配置仍在设置的**内置插件**分区中编辑。 +在侧栏选择**插件**。信息按钮使用 11px 的 caption 色图标和 20px 方形悬停区域,与副标题间隔 4px。它说明当前页用于配置官方插件,以及安装、管理和配置其他插件。悬停或聚焦显示共享 tooltip;点击后保持展开,直至再次点击、Escape、Tab 或外部点击。页面首次打开时通过 `api-remotes` 读取清单与组合包;没有受管 profile 的 Host 上页面显示为不可用。**内置插件配置**按配置的顺序列出官方配置页:子智能体、网页搜索与获取、Agent 循环、终端。**实验性插件**展示主要的可选组合包,标题旁的**更多**打开同名的独立页面。该页列出符合展示条件的官方组合包,也包含主列表已有的条目,Codex 和 Claude Code 子智能体排在最后。返回按钮回到主列表,**已安装插件**保持在实验性插件下方。组合包详情返回打开它的列表。目录条目在安装或移除后保持原位置。**已安装插件**列出其他 profile 组合包。安装随附的可选组合包没有卸载操作。实验性包在两个列表中均保留**实验性**标签。开启仅在该页列出的组合包会按该页中的位置把它加入主列表,关闭后它只留在该页,但 manifest 声明默认隐藏的组合包会从该页消失;其他组合包在两个列表中均保持原位。没有组合包 patch 的依赖不是插件,除非 profile 选中了它才会带异常标签列出。 + +页面的每个视图(无论组合包列表是否可用)都在页面正文顶部(任何页头之下)显示本浏览器页面的客户端插件同步状态,该状态来自 `ctx.modules.entries.state`。同步进行时,状态行显示**正在同步本页面的插件…**。有条目失败时,提示(`data-client-sync-failure`)说明本页面的插件未能完成同步、服务端的启用状态保持不变,把每个失败列为 `id: message`,并提供**重试本页面同步**;该按钮调用 `ctx.modules.entries.retry()`,同步进行时禁用。 页头可用宽度缩小时,“刷新”和“添加插件”先变为保留可访问名称与 tooltip 的图标按钮;标签再从常规最小宽度收紧为文案所需宽度,仍不足时操作组才换行。信息按钮紧随副标题文字。主页面的页头和列表共用一个滚动容器。页头控件随滚动位置移动,到达紧凑态位置后停住;反向滚动沿同样的坐标返回。页头外层容器保留静止态的文档流高度,以保持列表滚动范围;可拖动页头的矩形与其绘制高度一致,使原生拖动区域不会延伸到列表中。只能滚动少量距离的列表可能在页头完全收拢前到达底部。“更多”列表的返回与标题行固定,详情页的页头随内容滚动。“已安装/发现”标签使用总高 34px 的紧凑控件,选中指示块与外框之间留 2px。副标题随滚动离开视口;有标签时标题也随之滚出,标签在空间足够时停靠到“刷新”“添加插件”旁边。窄页面中,标签与图标操作优先在标题下方共用一行;放不下时,标签始终在操作组上方。滚动过程中两组控件的相对顺序保持不变。静止态与紧凑态分别保留 28px 和 16px 的页面顶部留白,紧凑态控件下方保留 16px。macOS 静止态保留框架的标题栏安全区;折叠态在侧栏展开时上下各留 16px,侧栏收起时再避让框架顶部安全区,使控件位于原生窗口控件下方。仅在 macOS 侧栏收起时,紧凑态控件在原有框架安全区之外的顶部留白统一由 16px 减为 8px,不受窗口宽度影响;静止态布局与紧凑态底部留白均不变。Windows 使用框架已有的标题栏偏移,不重复叠加。分隔线在紧凑页头底部横跨页面,列表初始的顶部留白随内容滚动。悬停样式只在可悬停的指针下生效,点按不会让卡片、行或菜单项停留在悬停态;卡片与图标操作改以按下填充回馈触摸。安装、注册表与筛选输入框在粗指针下使用 16px 字号,iOS Safari 不会因聚焦而放大页面。 @@ -78,12 +80,13 @@ Host 将网络失败或超时归因于 GitHub 地址,且提供 npmmirror 时 ### 切换一个组合包 -组合包页面在标题下方显示完整包名。组件列表之后的「来源信息」给出在别处安装它所需的 spec(`pnpm add` 接受的形式),安装随附的官方组合包显示「内置」,随后是当前版本。组合包开关改变其层选择。profile 变更触发重新读取时,已显示的详情文档保持可见,直到新结果返回。Host 应用更改期间,开关保持禁用,旁边显示旋转指示器;操作区在开关左侧固定预留 22px。常驻状态区域向屏幕阅读器播报进行中的更改。启用了 HMR 的 profile 在操作完成前重组;没有 HMR 的 profile,以及被更高层覆盖的组合包,会以 toast 说明。Host 读不了的组合包带异常标签,其页面给出原因,且不能打开;提供管理组件的组合包保持锁定。已选中组合包的层被 Host 跳过时(Host 将其报告为错误,且该组合包没有带存活条目的行),该组合包的开关保持打开,改带未运行标签,其卡片给出原因,但不列出未满足的版本要求。Host 报告错误且没有报告任何行时,组合包页面不显示组件列表,因为 Host 可能未读取其 patch。Host 以错误码作答,由页面字典措辞;pnpm 与 Loader 自己的诊断原样显示。页面从卡片和详情页中排除内置 profile 组合包和持久终端组合包,无论其启用状态、依赖声明或 Host 异常如何。隐藏组合包保留其在 Host 中的可用性和启用状态。Host 清单仍保留完整数据;设置中「插件」分区的「插件列表」标签页负责查看它们的插件。 +组合包页面在标题下方显示完整包名。组件列表之后的「来源信息」给出在别处安装它所需的 spec(`pnpm add` 接受的形式),安装随附的官方组合包显示「内置」,随后是当前版本。组合包开关改变其层选择。profile 变更触发重新读取时,已显示的详情文档保持可见,直到新结果返回。Host 应用更改期间,开关保持禁用,旁边显示旋转指示器;操作区在开关左侧固定预留 22px。常驻状态区域向屏幕阅读器播报进行中的更改。启用了 HMR 的 profile 在操作完成前重组;没有 HMR 的 profile,以及被更高层覆盖的组合包,会以 toast 说明。Host 读不了的组合包带异常标签,其页面给出原因,且不能打开;提供管理组件的组合包保持锁定。已选中组合包的层被 Host 跳过时(Host 将其报告为错误,且该组合包没有带存活条目的行),该组合包的开关保持打开,改带未运行标签,其卡片给出原因,但不列出未满足的版本要求。Host 报告错误且没有报告任何行时,组合包页面不显示组件列表,因为 Host 可能未读取其 patch。Host 以错误码作答,由页面字典措辞;pnpm 与 Loader 自己的诊断原样显示。页面从卡片和详情页中排除内置 profile 组合包和持久终端组合包,无论其启用状态、依赖声明或 Host 异常如何。隐藏组合包保留其在 Host 中的可用性和启用状态。Host 清单仍保留完整数据。 ### 切换组合包里的一行 组合包页面上行的开关调用 `pluginManager.setPluginEnabled`,按[开关规则](../../boot/plugin-manager/README.zh.md#use-this-package)在 profile 的 `cordis.patch.yml` 中记录该行的启用状态。启用了 HMR 的 profile 的树随即重组,该行的宿主半区卸下或挂上,组合包其余部分照常运行,页面无需重载即跟随客户端模块图。行使用共享状态标记表示 Host fiber 阶段:pending 与 disabled 为 idle,loading 与 unloading 为 ongoing,active 为 done,failed 为 error。开关只出现在已打开的组合包上;没有存活条目的行,以及 Host 不通过 profile patch 寻址的行,带着 Host 的原因锁定。超过十行的列表带一个筛选框,使用共享的[文本搜索](../../util/text-search/README.zh.md):行 id、模块名和标题的所有声明语言模糊匹配,描述的所有语言按子串匹配;各行以当前语言显示。 + ### 配置页 自带配置的插件把配置渲染在本页而不是设置里,通过本页声明的三个 slot:`plugins.item`(list)用于官方插件,按其 `label` 列在内置插件配置分组里;`plugins.bundle.config`(以组合包的包名为键)用于组合包自己的配置,显示在组合包页面的描述与行之间;`plugins.row.config`(以 `<包名>#<行 id>` 为键)用于某一行的配置,这一行由此多出一个**配置**控件,打开该行自己的页面。页面用 `view: 'page'` 渲染带自己保存控件的表单。官方插件卡片还在标题下渲染 `view: 'summary'`;行详情页只在缺少包描述时使用该视图。只有保存才写入:页面负责画标题、图标与面包屑,条目的表单在离开页面时丢弃暂存的修改。安装随附的四个宿主平面配置页——shell 执行器、agent loop、子智能体、DeepSeek 搜索提供方——各来自一个伴生包:[ui-settings-shell](../ui-settings-shell/README.zh.md)、[ui-settings-agent-loop](../ui-settings-agent-loop/README.zh.md)、[ui-settings-subagent](../ui-settings-subagent/README.zh.md) 与 [ui-settings-web-search](../ui-settings-web-search/README.zh.md),在 Host 服务其命名空间期间注册。组合包的浏览器半侧用同样的方式注册: @@ -98,6 +101,8 @@ ctx.slots.inject('plugins.row.config', () => ctx.slots.register({ 组合包的 patch 必须以该 id 声明这一行;注册只在组合包开启期间存在,因此关闭的组合包不显示配置控件。 +插件自己的设置页面是一个 `settings.section` 条目,其类型位于 [ui-settings](../ui-settings/README.zh.md#filling-the-settings-slots);设置列出全部条目,本页也在已列出的组合包认领某个条目时,经同一个 `settings.section.view` Component Factory 渲染它。模块名等于注册该条目的包、且没有 `plugins.row.config` 条目的已列出组合包行认领该条目:该行多出一个**配置**控件,行页面渲染该条目,并传入返回组合包页面的 `close` prop。注册包是某个已列出组合包自身的包名、没有已列出的行使用该模块、且该组合包没有 `plugins.bundle.config` 条目时,组合包页面渲染该条目,其 `close` 返回打开该组合包页面的视图。没有已列出的行或组合包认领、或注册包未知的条目只出现在设置中。设置中的**插件管理**条目是 id 为 `plugins`、order 为 15 的 `settings.section` 注册,选择它会关闭设置并打开本页主列表。 + ### 详情页扩展点 对某个不属于自己的组合包、行或官方插件有话要说的插件,通过本页声明的三个 list slot 向该对象的页面贡献内容:`plugins.detail.actions` 在页头放一个控件,位于页面自己的开关和卸载之前;`plugins.detail.badge` 在标题旁放一个标签,位于版本、实验性和异常或未运行标签之后;`plugins.detail.section` 在页面自身内容之下放一个区块——组合包页在来源信息之后,行页和官方插件页在配置之后。每个条目都以页面的 `subject` 渲染:`{ kind: 'bundle', pkg }`、`{ kind: 'row', pkg, row }` 或 `{ kind: 'item', id }`,其中 `pkg` 与 `row` 携带包名、版本、是否已安装、是否启用以及行列表这些供贡献者判断的事实。条目对无话可说的 subject 返回 null,自绘区块外观;页面按 `order` 排列条目。 @@ -148,7 +153,7 @@ Host 入口通过生成的 Remote 接口暴露 `pluginRegistryProbe.fastest()` 自定义条目页以 Host 条目 id 作为注册 id;行页面使用 bundle 包名和行 id。当条目提供可编辑 Config 字段时,页面宿主传入 `form.state` 和 `form.mutate(operations, expectedRevision)`。自定义页面负责草稿和校验提示,并可复用 ui-primitives 的 `ConfigField`。整个 bundle 的页面可以包含多个条目,因此没有单一表单。 -页面的 `main` 注册把 `plugins.item`、`plugins.bundle.config` 与 `plugins.row.config` 声明为子 slot,因此它们与页面同生,注册方的 `ctx.slots.inject` 会等到它们出现。`configLedgerSource` 把三份账本投影成一个可观察对象——按账本顺序排列、标签按当前语言解析的官方条目,以及组合包与行的键——在账本或语言变化前保持缓存;页面把它作为 `useConfigLedger` 绑在 store 旁边,自身从不点名任何可配置插件。注册拥有的导航 store 选择主列表、完整的实验性插件列表、某个组合包、某个官方插件或组合包的某一行;切换离开插件面板时重置为列表,React 重新挂载则保留所选目标。新的注册从主列表开始。安装后的高亮仅在当前页面有对应卡片时滚动定位,不改变所选页面。其他 Client 插件经 `ctx.get` 或 `ctx.inject` 以可选方式读取 `pluginNavigation`,调用其 `openBundle(packageName)` 即可打开组合包详情,不改变当前 Session;把它写进插件的 `inject` 会让该插件在无权限的页面上一直等待。首次读取清单期间保留导航目标;组合包不存在时显示列表。注册与做出它的浏览器半侧同生共死。`dsh-client-modules` 只把一个包的浏览器半侧挂在说明符恰为包名的那一行 Loader 行上,所以组合包为自己或任一行注册的页面,都会在那一行被关闭时一起消失;需要在其他行关闭时仍保留页面的子插件,应作为独立的包发布。 卡片和详情页仅为 [`dsh-official-bundles`](../../util/official-bundles/README.zh.md#plugin-manager-lists) 中 `EXPERIMENTAL_BUNDLES` 名单内的包显示实验性标签,包名前缀不决定标签。 +页面的 `main` 注册把 `plugins.item`、`plugins.bundle.config` 与 `plugins.row.config` 声明为子 slot,因此它们与页面同生,注册方的 `ctx.slots.inject` 会等到它们出现。`configLedgerSource` 把四份账本投影成一个可观察对象——按账本顺序排列、标签按当前语言解析的官方条目与 `settings.section` 条目(每个条目在已知时带注册它的模块),以及组合包与行的键——在账本或语言变化前保持缓存;页面把它作为 `useConfigLedger` 绑在 store 旁边,自身从不点名任何可配置插件。注册拥有的导航 store 选择主列表、完整的实验性插件列表、某个组合包、某个官方插件或组合包的某一行;切换离开插件面板时重置为列表,React 重新挂载则保留所选目标。新的注册从主列表开始。安装后的高亮仅在当前页面有对应卡片时滚动定位,不改变所选页面。其他 Client 插件经 `ctx.get` 或 `ctx.inject` 以可选方式读取 `pluginNavigation`,调用其 `openBundle(packageName)` 即可打开组合包详情,不改变当前 Session;把它写进插件的 `inject` 会让该插件在无权限的页面上一直等待。首次读取清单期间保留导航目标;组合包不存在时显示列表。注册与做出它的浏览器半侧同生共死。`dsh-client-modules` 只把一个包的浏览器半侧挂在说明符恰为包名的那一行 Loader 行上,所以组合包为自己或任一行注册的页面,都会在那一行被关闭时一起消失;需要在其他行关闭时仍保留页面的子插件,应作为独立的包发布。 卡片和详情页仅为 [`dsh-official-bundles`](../../util/official-bundles/README.zh.md#plugin-manager-lists) 中 `EXPERIMENTAL_BUNDLES` 名单内的包显示实验性标签,包名前缀不决定标签。 `plugins.bundle.config` 以 npm 包名为 key,提供 Bundle 详情配置。Client 插件可订阅只读的 `ctx.pluginChanges.bundle(packageName)`,在组合包或其组件行变更期间暂停查询。通知先于管理请求发出,页面关闭后仍会更新;订阅方在卸载时释放观察。`plugins.bundle.activation` 在用户从列表或详情页显式启用后提供 Bundle 自有引导,并传入关闭引导和打开详情的回调。仅列出已启用的 Bundle 不会触发引导。 diff --git a/packages/client/ui-plugin-manager/package.json b/packages/client/ui-plugin-manager/package.json index 35bd4f6de4..2a220d9544 100644 --- a/packages/client/ui-plugin-manager/package.json +++ b/packages/client/ui-plugin-manager/package.json @@ -39,6 +39,7 @@ "inject": [ "@deepseek-ai/dsh-api-remotes", "@deepseek-ai/dsh-client-locale", + "@deepseek-ai/dsh-client-modules", "@deepseek-ai/dsh-client-ui-layout", "@deepseek-ai/dsh-client-ui-sidebar" ], @@ -58,6 +59,7 @@ "@deepseek-ai/dsh-api-remote-access": "workspace:*", "@deepseek-ai/dsh-api-remotes": "workspace:*", "@deepseek-ai/dsh-client-locale": "workspace:*", + "@deepseek-ai/dsh-client-modules": "workspace:*", "@deepseek-ai/dsh-client-store": "workspace:*", "@deepseek-ai/dsh-client-test-runtime": "workspace:*", "@deepseek-ai/dsh-client-ui-layout": "workspace:*", diff --git a/packages/client/ui-plugin-manager/src/client/ClientSyncNotice.tsx b/packages/client/ui-plugin-manager/src/client/ClientSyncNotice.tsx new file mode 100644 index 0000000000..d654d90c9a --- /dev/null +++ b/packages/client/ui-plugin-manager/src/client/ClientSyncNotice.tsx @@ -0,0 +1,30 @@ +/** This page's client plugin synchronization: an ongoing line while it runs, and the failures with a retry. */ +import type { ReactNode } from 'react' +import { Button, StateDot } from '@deepseek-ai/dsh-client-ui-primitives' +import type { ClientEntryState } from '@deepseek-ai/dsh-client-modules/client' +import type { Translate } from './presentation.ts' +import css from './PluginManagerPage.module.css' + +/** + * Show what the page's module system reports; it is independent of the Host's bundle list. + * @param props - the latest synchronization state, the page copy, and the retry. + * @returns the status line, the failure notice, both, or nothing. + */ +export function ClientSyncNotice({ sync, t, retry }: { + readonly sync: ClientEntryState + readonly t: Translate + readonly retry: () => void +}): ReactNode { + return ( + <> + {sync.syncing ?

{t('clientSyncing')}

: null} + {sync.failures.length === 0 ? null : ( +
+

{t('clientSyncFailed')}

+
    {sync.failures.map(failure =>
  • {failure.id}: {failure.message}
  • )}
+ +
+ )} + + ) +} diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css index f7fac78f91..4aeeb7cb4a 100644 --- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css +++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css @@ -269,6 +269,13 @@ color: var(--dsw-alias-state-error-primary); } +.failure ul { + margin: 0; + padding-left: 16px; + font-size: 13px; + line-height: 20px; +} + .statusWithDot { display: inline-flex; align-items: center; diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx index 766feb1c30..8d5dbec36c 100644 --- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx +++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx @@ -8,7 +8,7 @@ * the page declares. */ -import { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react' +import { Fragment, useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react' import { createPortal } from 'react-dom' import type { PluginInstallFailureKind, Registry } from '@deepseek-ai/dsh-api-remotes/client' import { @@ -20,12 +20,14 @@ import { SegmentedTabs, StateDot, Switch, Tag, TerminalBlock, Toast, Tooltip, useDismissOnOutsidePointer, type IconProps, type StateDotState, type TerminalBlockLabels, } from '@deepseek-ai/dsh-client-ui-primitives' -import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots' +import type { ClientEntryState } from '@deepseek-ai/dsh-client-modules/client' +import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store' +import type { InjectFace, PropsLocale, PropsRenderFactories, PropsRenderSlots, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots' import { EXTENSION_BUNDLES, HIDDEN_BUNDLES, MORE_BUNDLES } from '@deepseek-ai/dsh-official-bundles' import { localizedValues, TextSearchIndex } from '@deepseek-ai/dsh-util-text-search' import type { createNavigationStore } from './navigation-store.ts' import type { PluginHeaderLayoutFace } from './header-scroll.ts' -import { rowConfigKey, type OfficialItem } from './config-ledger.ts' +import { rowConfigKey, type OfficialItem, type SettingsSectionItem } from './config-ledger.ts' import { INSTALL_GIT_EXAMPLE, INSTALL_PATH_EXAMPLE, type PluginManagerLocaleKey } from './locales.ts' import { bundleBusy, asksMirror, githubRecoveryRegistry, isInstallPending, offeredRegistries, rowKey, updateCandidate, @@ -37,6 +39,7 @@ import type { PluginPackageRef, PluginRowRef, PluginsSubject } from './slot-cont import type { ConfigPageForm } from './slot-contract.ts' import { UpdateDialog, VersionSection } from './versions.tsx' import { BundleDetailSection } from './BundleDetailSection.tsx' +import { ClientSyncNotice } from './ClientSyncNotice.tsx' import css from './PluginManagerPage.module.css' /** Full component props assembled by the main slot renderer. */ @@ -48,12 +51,22 @@ export type PluginManagerPageProps = | 'plugins.add.actions' | 'plugins.tab' | 'plugins.detail.actions' | 'plugins.detail.badge' | 'plugins.detail.section' > + & PropsRenderFactories & InjectFace + & InjectFace & PropsStore> +/** This page's client plugin synchronization, read from the page's module system. */ +export interface ClientSyncFace { + readonly hooks: { readonly clientSync: ObservableSnapshot } + /** Retry the latest client graph without changing the Host composition. */ + readonly retryClient: () => void +} + /** The page's slot renderer, narrowed to the configuration slots. */ type RenderConfig = PluginManagerPageProps['renderSlot'] type ResolveText = PluginManagerFace['resolveText'] +type RenderFactory = PluginManagerPageProps['renderFactorySlot'] type RowPhase = NonNullable @@ -677,14 +690,17 @@ function ItemDetail({ item, t, onBack, renderSlot, form }: { * A row's configuration page keeps its technical identity beside local package * text and the form supplied by its configuration entry. */ -function RowDetail({ pkg, row, t, resolveText, onBack, renderSlot, form }: { +function RowDetail({ pkg, row, t, resolveText, onBack, renderSlot, renderFactory, form, sections }: { readonly pkg: PackageView readonly row: PackageRow readonly t: Translate readonly resolveText: ResolveText readonly onBack: () => void readonly renderSlot: RenderConfig + readonly renderFactory: RenderFactory readonly form: ConfigPageForm | undefined + /** The settings pages the row's module registered, shown when the row registers no configuration of its own. */ + readonly sections: readonly SettingsSectionItem[] }): ReactNode { const { title } = packageText(pkg, resolveText) const { title: rowTitle, description } = rowText(row, resolveText) @@ -712,6 +728,7 @@ function RowDetail({ pkg, row, t, resolveText, onBack, renderSlot, form }: {
{renderSlot('plugins.row.config', { view: 'page', form }, { entryKey: key })} + {sections.map(section => {renderFactory('settings.section.view', { id: section.id, close: onBack })})} {renderSlot('plugins.detail.section', { subject })}
@@ -727,7 +744,7 @@ function RowDetail({ pkg, row, t, resolveText, onBack, renderSlot, form }: { * and configure controls, unless the Host reports an error and no rows; and where it comes from. */ function PackageDetail({ - pkg, t, resolveText, busy, rowBusy, configured, configure, renderSlot, inMore, versions, detail, + pkg, t, resolveText, busy, rowBusy, configured, configure, sections, renderSlot, renderFactory, inMore, versions, detail, onBack, onSetEnabled, onUninstall, onUpdate, onSetRowEnabled, onEnsureVersions, onCheckVersions, onUpdateVersion, }: { readonly pkg: PackageView @@ -743,7 +760,13 @@ function PackageDetail({ /** Whether the bundle registered a configuration of its own. */ readonly configured: boolean readonly configure: RowConfigure + /** + * The settings pages the bundle's own package registered, shown when the bundle has no configuration and no listed + * row's module is that package. + */ + readonly sections: readonly SettingsSectionItem[] readonly renderSlot: RenderConfig + readonly renderFactory: RenderFactory readonly inMore: boolean readonly onBack: () => void readonly onSetEnabled: (enabled: boolean) => void @@ -826,6 +849,11 @@ function PackageDetail({ ) : null} + {sections.map(section => ( +
+ {renderFactory('settings.section.view', { id: section.id, close: onBack })} +
+ ))} {/* A Host error with no rows can mean the Host never read the patch, so the page does not claim the bundle has no components. */} {pkg.availability === 'missing' || (pkg.error !== undefined && pkg.rows.length === 0) ? null : ( !HIDDEN_BUNDLES.has(pkg.name) && (pkg.listedByDefault !== false || pkg.enabled || pkg.installed || rowsRunning(pkg)) && (pkg.installed || pkg.official || pkg.error !== undefined)) @@ -1616,6 +1644,14 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { ? listed.find(pkg => pkg.name === view.name) : undefined const openItem = view.kind === 'item' ? ledger.items.find(item => item.id === view.id) : undefined + // A plugin's settings page also shows on the listed row whose module registered it, or else on the bundle whose + // package registered it, when that row or bundle registers no configuration of its own; Settings shows it either way. + const rowModules = new Set(listed.flatMap(pkg => pkg.rows.map(row => row.moduleName))) + const sectionsOf = (pkg: PackageView, row: PackageRow): readonly SettingsSectionItem[] => + ledger.rows.has(rowConfigKey(pkg.name, row.rowId)) ? [] : ledger.sections.filter(section => section.module === row.moduleName) + const bundleSections = (pkg: PackageView): readonly SettingsSectionItem[] => ledger.bundles.has(pkg.name) || rowModules.has(pkg.name) + ? [] + : ledger.sections.filter(section => section.module === pkg.name) const openRow = view.kind === 'row' && openPkg !== undefined ? openPkg.rows.find(row => row.rowId === view.rowId) : undefined const onInstalled = tab === INSTALLED_TAB const showsCards = !onInstalled || (openPkg === undefined && openItem === undefined) @@ -1642,7 +1678,7 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { if (row.entryId !== undefined) props.setRowEnabled(row.entryId, enabled) } const configure = (pkg: PackageView): RowConfigure => ({ - has: row => ledger.rows.has(rowConfigKey(pkg.name, row.rowId)), + has: row => ledger.rows.has(rowConfigKey(pkg.name, row.rowId)) || sectionsOf(pkg, row).length > 0, open: (row) => { setView({ kind: 'row', name: pkg.name, rowId: row.rowId, ...pkgOrigin }) }, }) const updates = updatesNote(mine, state.versions, t) @@ -1753,7 +1789,7 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { ) : null} - + snapshot)} t={t} retry={props.retryClient} /> {!onInstalled ? (
@@ -1802,6 +1838,8 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { pkg={openPkg} row={openRow} form={formFor(openRow.rowId)} + sections={sectionsOf(openPkg, openRow)} + renderFactory={props.renderFactorySlot} t={t} resolveText={resolveText} renderSlot={renderSlot} @@ -1819,6 +1857,8 @@ export function PluginManagerPage(props: PluginManagerPageProps): ReactNode { rowBusy={row => row.entryId !== undefined && state.busy.includes(rowKey(row.entryId))} configured={ledger.bundles.has(openPkg.name)} configure={configure(openPkg)} + sections={bundleSections(openPkg)} + renderFactory={props.renderFactorySlot} renderSlot={renderSlot} inMore={backToMore} detail={( diff --git a/packages/client/ui-plugin-manager/src/client/PluginsSettingsLink.tsx b/packages/client/ui-plugin-manager/src/client/PluginsSettingsLink.tsx new file mode 100644 index 0000000000..e91c04eb74 --- /dev/null +++ b/packages/client/ui-plugin-manager/src/client/PluginsSettingsLink.tsx @@ -0,0 +1,28 @@ +/** The Settings navigation entry that leaves Settings for the Plugins page. */ +import { useEffect, type ReactNode } from 'react' +import type { InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' +// Type-only: the `settings.section` declaration this entry registers into. +import type {} from '@deepseek-ai/dsh-client-ui-settings/client' + +/** What the entry receives from the plugin manager. */ +export interface PluginsSettingsLinkInjected { + /** Show the Plugins page's main list. */ + readonly openPlugins: () => void +} + +/** Full component props assembled by the settings shell. */ +export type PluginsSettingsLinkProps = PropsRuntime<'settings.section'> & InjectFace + +/** + * Selecting the entry closes Settings and opens the Plugins page; the entry has no page of its own. + * @param props - the shell's close action and the injected navigation. + * @returns nothing; the entry renders no content. + */ +export function PluginsSettingsLink({ close, openPlugins }: PluginsSettingsLinkProps): ReactNode { + // Mounting is the selection: the shell mounts a page only when its navigation entry is chosen. + useEffect(() => { + close() + openPlugins() + }, [close, openPlugins]) + return null +} diff --git a/packages/client/ui-plugin-manager/src/client/config-ledger.ts b/packages/client/ui-plugin-manager/src/client/config-ledger.ts index 21f6d3d746..8ea49e75a7 100644 --- a/packages/client/ui-plugin-manager/src/client/config-ledger.ts +++ b/packages/client/ui-plugin-manager/src/client/config-ledger.ts @@ -1,14 +1,17 @@ /** * Which plugins bring their own configuration to the Plugins page, read from - * the three slots the page declares: the official plugins listed beside the - * official bundles, the bundles with a form on their page, and the rows with a - * page of their own. The projection follows the slot ledgers and the active - * locale and keeps its snapshot until one of them moves. + * the three slots the page declares (the official plugins listed beside the + * official bundles, the bundles with a form on their page, the rows with a + * page of their own) and from the Factory-declared `settings.section` (the + * plugins' settings pages). The projection follows the slot ledgers and the + * active locale and keeps its snapshot until one of them moves. */ import type { Context as ClientContext } from '@deepseek-ai/cordis' import { resolveSlotLabel, type HostObservable } from '@deepseek-ai/dsh-client-ui-slots' import type {} from './slot-contract.ts' +// Type-only: the `settings.section` declaration whose entries this page lists. +import type {} from '@deepseek-ai/dsh-client-ui-settings/client' /** One official plugin as the page lists it: its registration id and its title in the active locale. */ export interface OfficialItem { @@ -16,15 +19,24 @@ export interface OfficialItem { readonly label: string } +/** One `settings.section` entry: its id, its title in the active locale, and the package that registered it, when known. */ +export interface SettingsSectionItem { + readonly id: string + readonly label: string + readonly module?: string +} + /** * The plugins carrying configuration: the official plugins in ledger order, - * the package names of the bundles with a page-level form, and the keys - * ({@link rowConfigKey}) of the rows with a page. + * the package names of the bundles with a page-level form, the keys + * ({@link rowConfigKey}) of the rows with a page, and the plugins' settings + * pages in ledger order. */ export interface ConfigLedger { readonly items: readonly OfficialItem[] readonly bundles: ReadonlySet readonly rows: ReadonlySet + readonly sections: readonly SettingsSectionItem[] } /** @@ -37,7 +49,7 @@ export function rowConfigKey(bundle: string, rowId: string): string { return `${bundle}#${rowId}` } -const SLOTS = ['plugins.item', 'plugins.bundle.config', 'plugins.row.config'] as const +const SLOTS = ['plugins.item', 'plugins.bundle.config', 'plugins.row.config', 'settings.section'] as const /** * Project the configuration ledgers as one observable the page binds. @@ -47,7 +59,7 @@ const SLOTS = ['plugins.item', 'plugins.bundle.config', 'plugins.row.config'] as export function configLedgerSource(ctx: ClientContext): HostObservable { let versions: readonly number[] = [] let revision = -1 - let ledger: ConfigLedger = { items: [], bundles: new Set(), rows: new Set() } + let ledger: ConfigLedger = { items: [], bundles: new Set(), rows: new Set(), sections: [] } const keysOf = (name: 'plugins.bundle.config' | 'plugins.row.config'): ReadonlySet => new Set(ctx.slots.entries(name).flatMap(entry => entry.options.key === undefined ? [] : [entry.options.key])) return { @@ -65,6 +77,15 @@ export function configLedgerSource(ctx: ClientContext): HostObservable { + /* v8 ignore next -- list-slot registration requires id */ + const id = entry.options.id ?? '' + return { + id, + label: resolveSlotLabel(entry.options.label) ?? id, + ...entry.module === undefined ? {} : { module: entry.module }, + } + }), } } return ledger diff --git a/packages/client/ui-plugin-manager/src/client/index.ts b/packages/client/ui-plugin-manager/src/client/index.ts index eadd359408..74dbb1d5f9 100644 --- a/packages/client/ui-plugin-manager/src/client/index.ts +++ b/packages/client/ui-plugin-manager/src/client/index.ts @@ -8,6 +8,8 @@ */ import type {} from '@deepseek-ai/dsh-client-product-analytics/client' import type {} from '@deepseek-ai/dsh-client-locale/client' +// Type-only: the ctx.modules Context merge. +import type {} from '@deepseek-ai/dsh-client-modules/client' import type { Context as ClientContext } from '@deepseek-ai/cordis' // Type-only: the root `main` keyed slot the page registers into, declared by // ui-layout with the panel id brand, and the `sidebar.panellist` list the @@ -27,6 +29,7 @@ import { PluginManagerPage } from './PluginManagerPage.tsx' import { createPluginHeaderRef } from './header-scroll.ts' import { PluginRefreshToast, type PluginRefreshToastFace } from './PluginRefreshToast.tsx' import { PluginsPanelIcon } from './PluginsPanelIcon.tsx' +import { PluginsSettingsLink, type PluginsSettingsLinkInjected } from './PluginsSettingsLink.tsx' import { configLedgerSource } from './config-ledger.ts' import { tabLedgerSource } from './tab-ledger.ts' import { PluginManagerController } from './manager-store.ts' @@ -61,7 +64,7 @@ declare module '@deepseek-ai/cordis' { } export type { PluginManagerPageProps } from './PluginManagerPage.tsx' -export type { ConfigLedger, OfficialItem } from './config-ledger.ts' +export type { ConfigLedger, OfficialItem, SettingsSectionItem } from './config-ledger.ts' export type { PluginManagerFace } from './manager-store.ts' export type { PluginManagerLocaleKey } from './locales.ts' export type { @@ -83,7 +86,7 @@ export const NS = 'pluginManager' export const PANEL_ID = 'plugins' as MainPanelId /** Services required by the sidebar registration, the Remote methods, and access; the inventory says whether the Host manages a profile. */ -export const inject = ['slots', 'locale', 'remote', 'remote.pluginManager', 'remote.pluginInventory', 'remote.pluginRegistryProbe', 'configForms', 'layout', 'remoteAccess'] +export const inject = ['slots', 'locale', 'remote', 'remote.pluginManager', 'remote.pluginInventory', 'remote.pluginRegistryProbe', 'configForms', 'layout', 'remoteAccess', 'modules'] /** * Contribute the Plugins entry to the sidebar with the management page it @@ -134,7 +137,12 @@ export function apply(ctx: ClientContext): void { key: PANEL_ID, locale: NS, store, - inject: () => ({ ...face, createHeaderRef: createPluginHeaderRef }), + inject: () => ({ + ...face, + createHeaderRef: createPluginHeaderRef, + hooks: { ...face.hooks, clientSync: ctx.modules.entries.state }, + retryClient: () => { void ctx.modules.entries.retry().catch((error: unknown) => { ctx.logger.error(error) }) }, + }), children: { 'plugins.add.actions': { kind: 'list', scope: 'root' }, 'plugins.tab': { kind: 'list', scope: 'root' }, @@ -150,12 +158,13 @@ export function apply(ctx: ClientContext): void { yield ctx.layout.panelInfo.subscribe(() => { if (ctx.layout.panelInfo.getSnapshot().activePanelId !== PANEL_ID) instance.actions.setView({ kind: 'list' }) }) + const openList = (): void => { + ctx.layout.selectPanel(PANEL_ID) + instance.actions.setTab('installed') + instance.actions.setView({ kind: 'list' }) + } const disposeNavigation = ctx.reflect.provide('pluginNavigation', { - openList: () => { - ctx.layout.selectPanel(PANEL_ID) - instance.actions.setTab('installed') - instance.actions.setView({ kind: 'list' }) - }, + openList, openBundle: (packageName: string) => { ctx.layout.selectPanel(PANEL_ID) instance.actions.setTab('installed') @@ -163,6 +172,14 @@ export function apply(ctx: ClientContext): void { }, }) yield () => { void disposeNavigation() } + // Settings lists one entry that leads here. + yield ctx.slots.inject('settings.section', () => ctx.slots.register({ + name: 'settings.section', + id: PANEL_ID, + order: 15, + label: () => t('settingsEntry'), + inject: (): PluginsSettingsLinkInjected => ({ openPlugins: openList }), + }, PluginsSettingsLink)) }) yield ctx.slots.inject('sidebar.panellist', () => ctx.slots.register({ name: 'sidebar.panellist', diff --git a/packages/client/ui-plugin-manager/src/client/locales.ts b/packages/client/ui-plugin-manager/src/client/locales.ts index c70c32549f..3301b8b68b 100644 --- a/packages/client/ui-plugin-manager/src/client/locales.ts +++ b/packages/client/ui-plugin-manager/src/client/locales.ts @@ -8,10 +8,14 @@ export const INSTALL_PATH_EXAMPLE = '/Users/name/my-plugin' /** Simplified Chinese dictionary and key source of truth. */ export const zh = { panel: '插件', + settingsEntry: '插件管理', + clientSyncing: '正在同步本页面的插件…', + clientSyncFailed: '本页面的插件未能完成同步;服务端的启用状态保持不变。', + clientSyncRetry: '重试本页面同步', title: '插件', intro: '安装、启用和配置插件', infoLabel: '插件说明', - infoDescription: '在这里配置官方插件,安装和管理其他插件。内置插件列表及运行状态可在「设置 → 内置插件」中查看', + infoDescription: '在这里配置官方插件,安装、管理和配置其他插件。', loading: '正在读取插件…', error: '可能由于网络问题,无法读取全部插件', unavailable: '本部署没有可管理的 profile,无法安装或启停插件。', @@ -308,10 +312,14 @@ export type PluginManagerLocaleKey = keyof typeof zh /** English dictionary checked against the Chinese key set. */ export const en = { panel: 'Plugins', + settingsEntry: 'Plugins', + clientSyncing: 'Syncing plugins on this page…', + clientSyncFailed: 'Some plugins could not sync on this page. Host enablement is unchanged.', + clientSyncRetry: 'Retry this page', title: 'Plugins', intro: 'Install, enable, and configure plugins', infoLabel: 'About plugins', - infoDescription: 'Configure official plugins and install or manage other plugins here. View the built-in plugin list and runtime status in Settings → Built-in plugins.', + infoDescription: 'Configure official plugins, and install, manage, and configure other plugins here.', loading: 'Reading plugins…', error: 'Could not read all plugins, possibly due to a network problem', unavailable: 'This deployment runs without a manageable profile, so plugins cannot be installed or switched here.', @@ -606,10 +614,14 @@ export const en = { export const ja = { 'reasonUnsupportedPlatform': 'このプラグインはDSHを実行しているホストOSに対応していません。', 'panel': 'プラグイン', + 'settingsEntry': 'プラグイン管理', + 'clientSyncing': 'このページでプラグインを同期中…', + 'clientSyncFailed': '一部のプラグインをこのページで同期できませんでした。ホスト側の有効化状態は変更されていません。', + 'clientSyncRetry': 'このページを再試行', 'title': 'プラグイン', 'intro': 'プラグインのインストール、有効化、設定', 'infoLabel': 'プラグインについて', - 'infoDescription': '公式プラグインの設定や、その他のプラグインのインストール・管理はここで行えます。組み込みプラグインの一覧と実行状態は「設定 → 組み込みプラグイン」で確認できます。', + 'infoDescription': '公式プラグインの設定や、その他のプラグインのインストール・管理・設定はここで行えます。', 'loading': 'プラグインを読み込み中…', 'error': '一部のプラグインを読み込めませんでした。ネットワークの問題が考えられます', 'unavailable': 'このデプロイでは管理可能なプロファイルが実行されていないため、ここでプラグインのインストールや切り替えはできません。', @@ -903,10 +915,14 @@ export const ja = { export const es = { reasonUnsupportedPlatform: 'Este complemento no es compatible con el sistema operativo que ejecuta DSH.', panel: 'Complementos', + settingsEntry: 'Complementos', + clientSyncing: 'Sincronizando complementos en esta página…', + clientSyncFailed: 'Algunos complementos no se pudieron sincronizar en esta página. La habilitación del host no ha cambiado.', + clientSyncRetry: 'Reintentar esta página', title: 'Complementos', intro: 'Instalar, habilitar y configurar complementos', infoLabel: 'Acerca de los complementos', - infoDescription: 'Configure complementos oficiales e instale o administre otros complementos aquí. Vea la lista de complementos integrados y el estado del tiempo de ejecución en Configuración → Complementos integrados.', + infoDescription: 'Configure aquí los complementos oficiales e instale, administre y configure otros complementos.', loading: 'Leyendo complementos…', error: 'No se pudieron leer todos los complementos, posiblemente debido a un problema de red', unavailable: 'Esta implementación se ejecuta sin un perfil manejable, por lo que los complementos no se pueden instalar ni cambiar aquí.', @@ -1200,10 +1216,14 @@ export const es = { export const fr = { reasonUnsupportedPlatform: 'Ce plugin ne prend pas en charge le système d’exploitation sur lequel DSH s’exécute.', panel: 'Plugins', + settingsEntry: 'Plugins', + clientSyncing: 'Synchronisation des plugins sur cette page…', + clientSyncFailed: "Certains plugins n'ont pas pu se synchroniser sur cette page. L'activation de l'hôte est inchangée.", + clientSyncRetry: 'Réessayez cette page', title: 'Plugins', intro: 'Installer, activer et configurer les plugins', infoLabel: 'À propos des plugins', - infoDescription: "Configurez les plugins officiels et installez ou gérez d'autres plugins ici. Affichez la liste des plugins intégrés et l'état d'exécution dans Paramètres → Plugins intégrés.", + infoDescription: "Configurez ici les plugins officiels, et installez, gérez et configurez d'autres plugins.", loading: 'Plugins de lecture…', error: "Impossible de lire tous les plugins, probablement à cause d'un problème de réseau", unavailable: "Ce déploiement s'exécute sans profil gérable, les plugins ne peuvent donc pas être installés ou commutés ici.", @@ -1497,10 +1517,14 @@ export const fr = { export const de = { reasonUnsupportedPlatform: 'Dieses Plugin unterstützt das Betriebssystem, auf dem DSH läuft, nicht.', panel: 'Plugins', + settingsEntry: 'Plugins', + clientSyncing: 'Plugins auf dieser Seite werden synchronisiert…', + clientSyncFailed: 'Einige Plugins konnten auf dieser Seite nicht synchronisiert werden. Die Host-Aktivierung bleibt unverändert.', + clientSyncRetry: 'Versuchen Sie es erneut mit dieser Seite', title: 'Plugins', intro: 'Plugins installieren, aktivieren und konfigurieren', infoLabel: 'Über Plugins', - infoDescription: 'Konfigurieren Sie hier offizielle Plugins und installieren oder verwalten Sie andere Plugins. Sehen Sie sich die Liste der integrierten Plugins und den Laufzeitstatus unter Einstellungen → Integrierte Plugins an.', + infoDescription: 'Konfigurieren Sie hier offizielle Plugins und installieren, verwalten und konfigurieren Sie andere Plugins.', loading: 'Plugins lesen…', error: 'Es konnten nicht alle Plugins gelesen werden, möglicherweise aufgrund eines Netzwerkproblems', unavailable: 'Diese Bereitstellung läuft ohne verwaltbares Profil, daher können hier keine Plugins installiert oder gewechselt werden.', @@ -1794,10 +1818,14 @@ export const de = { export const ru = { reasonUnsupportedPlatform: 'Этот плагин не поддерживает операционную систему, в которой работает DSH.', panel: 'Плагины', + settingsEntry: 'Плагины', + clientSyncing: 'Синхронизация плагинов на этой странице…', + clientSyncFailed: 'Некоторые плагины не смогли синхронизироваться на этой странице. Включение хоста не изменилось.', + clientSyncRetry: 'Повторить эту страницу', title: 'Плагины', intro: 'Установите, включите и настройте плагины', infoLabel: 'О плагинах', - infoDescription: 'Настройте официальные плагины, а также установите или управляйте другими плагинами здесь. Посмотреть список встроенных плагинов и статус выполнения можно в разделе «Настройки» → «Встроенные плагины».', + infoDescription: 'Здесь можно настраивать официальные плагины, а также устанавливать и настраивать другие плагины и управлять ими.', loading: 'Чтение плагинов…', error: 'Не удалось прочитать все плагины, возможно, из-за проблем с сетью.', unavailable: 'Это развертывание выполняется без управляемого профиля, поэтому здесь нельзя устанавливать или переключать плагины.', @@ -2091,10 +2119,14 @@ export const ru = { export const pt = { reasonUnsupportedPlatform: 'Este plugin não oferece suporte ao sistema operacional em que o DSH está sendo executado.', panel: 'Plug-ins', + settingsEntry: 'Plug-ins', + clientSyncing: 'Sincronizando plug-ins nesta página…', + clientSyncFailed: 'Alguns plug-ins não puderam ser sincronizados nesta página. A ativação do host permanece inalterada.', + clientSyncRetry: 'Tente esta página novamente', title: 'Plug-ins', intro: 'Instalar, habilitar e configurar plug-ins', infoLabel: 'Sobre plug-ins', - infoDescription: 'Configure plugins oficiais e instale ou gerencie outros plugins aqui. Veja a lista de plug-ins integrados e o status do tempo de execução em Configurações → Plug-ins integrados.', + infoDescription: 'Configure aqui os plug-ins oficiais e instale, gerencie e configure outros plug-ins.', loading: 'Lendo plug-ins…', error: 'Não foi possível ler todos os plugins, possivelmente devido a um problema de rede', unavailable: 'Esta implantação é executada sem um perfil gerenciável, portanto, os plug-ins não podem ser instalados ou trocados aqui.', diff --git a/packages/client/ui-plugin-manager/tests/browser-plugin.client.spec.tsx b/packages/client/ui-plugin-manager/tests/browser-plugin.client.spec.tsx index 9069ce355b..66cd778fd9 100644 --- a/packages/client/ui-plugin-manager/tests/browser-plugin.client.spec.tsx +++ b/packages/client/ui-plugin-manager/tests/browser-plugin.client.spec.tsx @@ -17,6 +17,8 @@ import { PluginRefreshToast, type PluginRefreshToastFace } from '../src/client/P import { PluginsPanelIcon } from '../src/client/PluginsPanelIcon.tsx' import type { PluginManagerFace } from '../src/client/manager-store.ts' import type { createNavigationStore } from '../src/client/navigation-store.ts' +import type { PluginsSettingsLinkInjected } from '../src/client/PluginsSettingsLink.tsx' +import type { ClientSyncFace } from '../src/client/PluginManagerPage.tsx' usePinnedBrowserLanguages('zh-CN') beforeEach(() => { localStorage.clear() }) @@ -91,10 +93,13 @@ async function bench(allows: ((action: string) => boolean) | 'switchable' = () = }) const panelInfo = createSnapshotStore({ activePanelId: null }) const selectPanel = vi.fn((activePanelId) => { panelInfo.set({ activePanelId }) }) + const clientSync = createSnapshotStore({ syncing: false, failures: [] as { id: string; message: string }[] }) + const retryClient = vi.fn(() => Promise.resolve()) + ctx.provide('modules', { entries: { state: clientSync, retry: retryClient } }) ctx.provide('layout', { panelInfo, selectPanel, beginNavigation: () => new AbortController().signal, toggleSidebar: vi.fn(), openRightbar: vi.fn(), closeRightbar: vi.fn() }) await ctx.plugin(settings).await() - return { ctx, slots: ctx.get('slots') as SlotRegistry, locale, list, remote, selectPanel, panelInfo, access } + return { ctx, slots: ctx.get('slots') as SlotRegistry, locale, list, remote, selectPanel, panelInfo, access, clientSync, retryClient } } function declare(slots: SlotRegistry): () => void { @@ -160,6 +165,42 @@ describe('ui-plugin-manager browser plugin', () => { expect(b.list).not.toHaveBeenCalled() }) + it('keeps a Settings entry that opens the Plugins list while the page is registered', async () => { + const b = await bench() + const removeRoot = b.slots.register({ + name: 'root', + children: { + 'main': { kind: 'keyed', scope: 'root' }, + 'shell.overlay': { kind: 'list', scope: 'root' }, + 'sidebar.panellist': { kind: 'list', scope: 'root' }, + 'settings.section': { kind: 'list', scope: 'root' }, + }, + } as never, () => null) + await b.ctx.plugin({ inject: [...inject], apply }).await() + const link = b.slots.entries('settings.section')[0]! + expect(link.options).toMatchObject({ id: PANEL_ID, order: 15 }) + expect(resolveSlotLabel(link.options.label)).toBe('插件管理') + const navigation = (b.slots.entries('main')[0]!.store as ReturnType).create() + navigation.actions.setView({ kind: 'more' }) + const linkInjected: object = link.inject!() + ;(linkInjected as PluginsSettingsLinkInjected).openPlugins() + expect(b.panelInfo.getSnapshot().activePanelId).toBe(PANEL_ID) + expect(navigation.getSnapshot()).toEqual({ tab: 'installed', view: { kind: 'list' } }) + // The page reads this page's client synchronization from the module system and retries through it. + const pageInjected: object = b.slots.entries('main')[0]!.inject!() + const sync = pageInjected as ClientSyncFace + expect(sync.hooks.clientSync).toBe(b.clientSync) + sync.retryClient() + expect(b.retryClient).toHaveBeenCalledOnce() + const logged = vi.spyOn(b.ctx.logger('ui-plugin-manager'), 'error') + b.retryClient.mockRejectedValueOnce(new Error('retry failed')) + sync.retryClient() + await vi.waitFor(() => { expect(b.retryClient).toHaveBeenCalledTimes(2) }) + removeRoot() + expect(b.slots.entries('settings.section')).toEqual([]) + logged.mockRestore() + }) + it('shares refresh failures with the overlay after navigation and releases both registrations across reloads', async () => { const b = await bench() const fiber = b.ctx.plugin({ inject: [...inject], apply }) @@ -197,7 +238,7 @@ describe('ui-plugin-manager browser plugin', () => { }) it('declares only the services the page and its Remote methods use', () => { - expect(inject).toEqual(['slots', 'locale', 'remote', 'remote.pluginManager', 'remote.pluginInventory', 'remote.pluginRegistryProbe', 'configForms', 'layout', 'remoteAccess']) + expect(inject).toEqual(['slots', 'locale', 'remote', 'remote.pluginManager', 'remote.pluginInventory', 'remote.pluginRegistryProbe', 'configForms', 'layout', 'remoteAccess', 'modules']) }) it('reads the Host again on a later grant after showing the page, and not while access is withdrawn', async () => { @@ -284,7 +325,7 @@ describe('ui-plugin-manager browser plugin', () => { b.locale.setLocale('en') expect(face.resolveText(text)).toBe('Local tools') b.locale.setLocale('zh') - expect(face.hooks.configLedger.getSnapshot()).toEqual({ items: [], bundles: new Set(), rows: new Set() }) + expect(face.hooks.configLedger.getSnapshot()).toEqual({ items: [], bundles: new Set(), rows: new Set(), sections: [] }) // A Host change before the first render is not a reason to read. b.remote.emit('plugin-manager/changed', [{ reason: 'install' }]) b.ctx.emit('connection/reset') diff --git a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx index 1445f86005..c75dac7440 100644 --- a/packages/client/ui-plugin-manager/tests/components.client.spec.tsx +++ b/packages/client/ui-plugin-manager/tests/components.client.spec.tsx @@ -7,8 +7,9 @@ import { Context } from '@deepseek-ai/cordis' import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' import type { ChangeResult, PluginEntryId, PluginInstallRequestId, PluginUpdateResult, PluginVersion, RegistryAttempt } from '@deepseek-ai/dsh-api-remotes/client' import { allowAllAccess, bindSnapshotSelector, stubConfigForm } from '@deepseek-ai/dsh-client-test-runtime' -import type { ConfigForm, ConfigFormSnapshot, SettingsMirrorSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client' +import type { ConfigForm, ConfigFormSnapshot, SettingsMirrorSnapshot, SettingsSectionOwnerProps, SettingsSectionViewProps } from '@deepseek-ai/dsh-client-ui-settings/client' import { createSnapshotStore } from '@deepseek-ai/dsh-client-store' +import type { ClientEntryState } from '@deepseek-ai/dsh-client-modules/client' import { MenuItemButton } from '@deepseek-ai/dsh-client-ui-primitives' import { StrictMode, type ReactNode } from 'react' import type { LocaleSnapshot } from '@deepseek-ai/dsh-client-locale/client' @@ -99,7 +100,7 @@ function subjectOf(owner: unknown): PluginsSubject | undefined { return typeof owner === 'object' && owner !== null && 'subject' in owner ? (owner as PluginDetailProps).subject : undefined } -const NO_CONFIG: ConfigLedger = { items: [], bundles: new Set(), rows: new Set() } +const NO_CONFIG: ConfigLedger = { items: [], bundles: new Set(), rows: new Set(), sections: [] } function renderTab( state: Partial = {}, config: Partial = {}, @@ -114,6 +115,8 @@ function renderTab( const ledger = createSnapshotStore({ ...NO_CONFIG, ...config }) const tabLedger = createSnapshotStore(tabs) const bundleDetails = createSnapshotStore({}) + const clientSync = createSnapshotStore({ syncing: false, failures: [] }) + const retryClient = vi.fn() const actions = { ensure: vi.fn(), refresh: vi.fn(), @@ -170,6 +173,8 @@ function renderTab( t, resolveText, ...actions, + useClientSync: bindSnapshotSelector(clientSync), + retryClient, usePluginManager: bindSnapshotSelector(store), useConfigLedger: bindSnapshotSelector(ledger), usePluginTabs: bindSnapshotSelector(tabLedger), @@ -186,6 +191,10 @@ function renderTab( stub.publish(forms[id]!.state as ConfigFormSnapshot) return { ...stub.scope, mutate: forms[id]!.mutate } }, + renderFactorySlot: ((name: string, factoryProps: SettingsSectionViewProps) => { + if (name !== 'settings.section.view') throw new Error(`Plugin manager fixture renders no Factory ${name}`) + return bodies[`settings.section:${factoryProps.id}`]?.('page', { close: factoryProps.close }) ?? null + }) as PluginManagerPageProps['renderFactorySlot'], renderSlot: (name, owner, opts) => { const body = bodies[`${name}:${opts?.only ?? opts?.entryKey ?? ''}`] if (body === undefined) return null @@ -219,6 +228,8 @@ function renderTab( actions, set: (next: Partial) => { act(() => { store.set({ ...store.getSnapshot(), ...next }) }) }, setDetails: (next: BundleDetailsState) => { act(() => { bundleDetails.set(next) }) }, + setClientSync: (next: ClientEntryState) => { act(() => { clientSync.set(next) }) }, + retryClient, setLanguage: (dict: typeof en) => { locale.setLocale(dict === zh ? 'zh' : 'en') currentT = translate(dict) @@ -228,6 +239,23 @@ function renderTab( } describe('PluginManagerPage', () => { + it('reports this page\'s client plugin synchronization on every view and retries it', () => { + const { setClientSync, retryClient } = renderTab({ status: 'unavailable', packages: [] }) + expect(document.querySelector('[data-client-sync-failure]')).toBeNull() + expect(screen.queryByText(en.clientSyncing)).toBeNull() + setClientSync({ syncing: true, failures: [{ id: '@fixture/live', message: 'download failed' }] }) + expect(screen.getByText(en.clientSyncing).getAttribute('role')).toBe('status') + const notice = document.querySelector('[data-client-sync-failure]') as HTMLElement + expect(within(notice).getByRole('alert').textContent).toBe(en.clientSyncFailed) + expect(within(notice).getByText('@fixture/live: download failed')).toBeTruthy() + const retry = within(notice).getByRole('button', { name: en.clientSyncRetry }) + expect((retry as HTMLButtonElement).disabled).toBe(true) + setClientSync({ syncing: false, failures: [{ id: '@fixture/live', message: 'download failed' }] }) + fireEvent.click(retry) + expect(retryClient).toHaveBeenCalledOnce() + expect(screen.queryByText(en.clientSyncing)).toBeNull() + }) + it('shows no tabs without contributions, and switches between Installed and a contributed tab', () => { const { actions, navigation, setTabs } = renderTab({ packages: [pkg()] }, {}, { 'plugins.tab:discover': (_view, owner) => { @@ -1243,6 +1271,77 @@ describe('PluginManagerPage', () => { expect(screen.getByRole('heading', { level: 3 }).textContent).toBe('个人工具') }) + describe('plugin settings pages', () => { + it('shows a settings page on the row whose module registered it, and its close returns to the bundle', () => { + renderTab( + { packages: [pkg({ rows: [row(), row({ rowId: 'other', entryId: 'include:other' as PluginEntryId, moduleName: 'dsh-other' })] })] }, + { sections: [{ id: 'sidebar-settings', label: 'Sidebar settings', module: 'dsh-better-sidebar' }] }, + { 'settings.section:sidebar-settings': (_view, owner) => ( + + ) }, + ) + fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', 'dsh-better-sidebar') })) + expect(screen.queryByRole('button', { name: en.configureRow.replace('{name}', 'dsh-other') })).toBeNull() + fireEvent.click(screen.getByRole('button', { name: en.configureRow.replace('{name}', 'dsh-better-sidebar') })) + const detail = document.querySelector('[data-plugin-row-detail="dsh-better-sidebar#sidebar"]') as HTMLElement + fireEvent.click(within(detail).getByRole('button', { name: 'Leave settings' })) + expect(document.querySelector('[data-plugin-row-detail]')).toBeNull() + expect(screen.getByRole('button', { name: en.configureRow.replace('{name}', 'dsh-better-sidebar') })).toBeTruthy() + }) + + it('keeps a row\'s own configuration instead of its settings page, and lists no unclaimed page', () => { + renderTab( + { packages: [pkg({ rows: [row()] })] }, + { + rows: new Set(['dsh-better-sidebar#sidebar']), + sections: [ + { id: 'sidebar-settings', label: 'Sidebar settings', module: 'dsh-better-sidebar' }, + { id: 'loose', label: 'Loose settings', module: '@acme/loose' }, + ], + }, + { + 'plugins.row.config:dsh-better-sidebar#sidebar': view => view === 'page' ?
: null, + 'settings.section:sidebar-settings': () => , + 'settings.section:loose': () => , + }, + ) + expect(screen.queryByText('Loose settings')).toBeNull() + fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', 'dsh-better-sidebar') })) + fireEvent.click(screen.getByRole('button', { name: en.configureRow.replace('{name}', 'dsh-better-sidebar') })) + expect(screen.getByRole('form', { name: 'own form' })).toBeTruthy() + expect(screen.queryByRole('form', { name: 'mirrored form' })).toBeNull() + expect(screen.queryByRole('form', { name: 'loose form' })).toBeNull() + }) + + it('shows a settings page the bundle package registered on the bundle page when no row is that package', () => { + renderTab( + { packages: [pkg({ rows: [row({ moduleName: 'dsh-other' })] })] }, + { sections: [{ id: 'bundle-settings', label: 'Bundle settings', module: 'dsh-better-sidebar' }] }, + { 'settings.section:bundle-settings': (_view, owner) => ( + + ) }, + ) + fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', 'dsh-better-sidebar') })) + expect(screen.queryByRole('button', { name: en.configureRow.replace('{name}', 'dsh-other') })).toBeNull() + fireEvent.click(screen.getByRole('button', { name: 'Leave bundle settings' })) + expect(screen.getByRole('button', { name: en.openDetail.replace('{name}', 'dsh-better-sidebar') })).toBeTruthy() + }) + + it('keeps a bundle\'s own configuration instead of the settings page its package registered', () => { + renderTab( + { packages: [pkg({ rows: [row({ moduleName: 'dsh-other' })] })] }, + { bundles: new Set(['dsh-better-sidebar']), sections: [{ id: 'bundle-settings', label: 'Bundle settings', module: 'dsh-better-sidebar' }] }, + { + 'plugins.bundle.config:dsh-better-sidebar': () => , + 'settings.section:bundle-settings': () => , + }, + ) + fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', 'dsh-better-sidebar') })) + expect(screen.getByRole('form', { name: 'bundle form' })).toBeTruthy() + expect(screen.queryByRole('form', { name: 'mirrored bundle form' })).toBeNull() + }) + }) + describe('configuration pages', () => { const bodies: SlotBodies = { 'plugins.item:bash': view => view === 'summary' ? 'Limits every command.' : , diff --git a/packages/client/ui-plugin-manager/tests/config-ledger.client.spec.ts b/packages/client/ui-plugin-manager/tests/config-ledger.client.spec.ts index 025fe9c16c..9caaa8e955 100644 --- a/packages/client/ui-plugin-manager/tests/config-ledger.client.spec.ts +++ b/packages/client/ui-plugin-manager/tests/config-ledger.client.spec.ts @@ -6,12 +6,13 @@ import { tabLedgerSource } from '../src/client/tab-ledger.ts' interface Registration { options: { id?: string; key?: string; label?: string | (() => string) } + module?: string } /** A slot registry and locale stand-in: ledgers by slot, versions that move on registration, and a locale revision. */ function bench() { - const entries: Record = { 'plugins.item': [], 'plugins.bundle.config': [], 'plugins.row.config': [], 'plugins.tab': [] } - const versions: Record = { 'plugins.item': 0, 'plugins.bundle.config': 0, 'plugins.row.config': 0, 'plugins.tab': 0 } + const entries: Record = { 'plugins.item': [], 'plugins.bundle.config': [], 'plugins.row.config': [], 'plugins.tab': [], 'settings.section': [] } + const versions: Record = { 'plugins.item': 0, 'plugins.bundle.config': 0, 'plugins.row.config': 0, 'plugins.tab': 0, 'settings.section': 0 } const listeners = new Map void>>() const localeListeners = new Set<() => void>() let revision = 0 @@ -36,8 +37,8 @@ function bench() { } return { ctx: ctx as never, - register: (name: string, options: Registration['options']): void => { - entries[name]?.push({ options }) + register: (name: string, options: Registration['options'], module?: string): void => { + entries[name]?.push(module === undefined ? { options } : { options, module }) versions[name] = (versions[name] ?? 0) + 1 for (const listener of listeners.get(name) ?? []) listener() }, @@ -53,18 +54,21 @@ describe('configLedgerSource', () => { it('projects the official items in ledger order with locale-following labels, and the bundle and row keys', () => { const b = bench() const source = configLedgerSource(b.ctx) - expect(source.getSnapshot()).toEqual({ items: [], bundles: new Set(), rows: new Set() }) + expect(source.getSnapshot()).toEqual({ items: [], bundles: new Set(), rows: new Set(), sections: [] }) let title = 'Shell' b.register('plugins.item', { id: 'bash', label: () => title }) b.register('plugins.item', { id: 'loop', label: 'Agent loop' }) b.register('plugins.bundle.config', { key: 'dsh-x' }) b.register('plugins.row.config', { key: rowConfigKey('dsh-x', 'row') }) + b.register('settings.section', { id: 'timeline', label: () => title }, '@scope/dsh-timeline') + b.register('settings.section', { id: 'loose', label: 'Loose' }) expect(source.getSnapshot()).toEqual({ items: [{ id: 'bash', label: 'Shell' }, { id: 'loop', label: 'Agent loop' }], bundles: new Set(['dsh-x']), rows: new Set(['dsh-x#row']), + sections: [{ id: 'timeline', label: 'Shell', module: '@scope/dsh-timeline' }, { id: 'loose', label: 'Loose' }], }) // A label thunk is re-read when the locale moves, not before. title = '终端' @@ -78,8 +82,11 @@ describe('configLedgerSource', () => { const source = configLedgerSource(b.ctx) b.register('plugins.item', { id: 'bare' }) b.register('plugins.bundle.config', {}) + b.register('settings.section', { id: 'unlabelled' }) - expect(source.getSnapshot()).toEqual({ items: [{ id: 'bare', label: '' }], bundles: new Set(), rows: new Set() }) + expect(source.getSnapshot()).toEqual({ + items: [{ id: 'bare', label: '' }], bundles: new Set(), rows: new Set(), sections: [{ id: 'unlabelled', label: 'unlabelled' }], + }) }) it('keeps its snapshot until a ledger or the locale moves, and follows every source while subscribed', () => { diff --git a/packages/client/ui-plugin-manager/tests/manager-store.client.spec.ts b/packages/client/ui-plugin-manager/tests/manager-store.client.spec.ts index eb44f8eeb5..9a1a095633 100644 --- a/packages/client/ui-plugin-manager/tests/manager-store.client.spec.ts +++ b/packages/client/ui-plugin-manager/tests/manager-store.client.spec.ts @@ -73,7 +73,7 @@ function deferred() { /** A configuration ledger with nothing registered, as the page binds it beside the store. */ const NO_CONFIG: HostObservable = { - getSnapshot: () => ({ items: [], bundles: new Set(), rows: new Set() }), + getSnapshot: () => ({ items: [], bundles: new Set(), rows: new Set(), sections: [] }), subscribe: () => () => {}, } diff --git a/packages/client/ui-plugin-manager/tests/settings-link.client.spec.tsx b/packages/client/ui-plugin-manager/tests/settings-link.client.spec.tsx new file mode 100644 index 0000000000..f33b6f093a --- /dev/null +++ b/packages/client/ui-plugin-manager/tests/settings-link.client.spec.tsx @@ -0,0 +1,21 @@ +// @vitest-environment jsdom +/** The Settings entry that leaves Settings for the Plugins page. */ +import { cleanup, render } from '@testing-library/react' +import { afterEach, describe, expect, it, vi } from 'vitest' +import { PluginsSettingsLink, type PluginsSettingsLinkProps } from '../src/client/PluginsSettingsLink.tsx' + +afterEach(cleanup) + +describe('PluginsSettingsLink', () => { + it('closes Settings and opens the Plugins page when selected, rendering nothing', () => { + const calls: string[] = [] + const props = { + close: vi.fn(() => { calls.push('close') }), + openPlugins: vi.fn(() => { calls.push('open') }), + } satisfies Pick + // The entry reads only its owner and injected members; the standard seats stay unused. + const { container } = render() + expect(calls).toEqual(['close', 'open']) + expect(container.childElementCount).toBe(0) + }) +}) diff --git a/packages/client/ui-plugin-manager/tsconfig.client.json b/packages/client/ui-plugin-manager/tsconfig.client.json index c69aa45d5d..e50ea12aeb 100644 --- a/packages/client/ui-plugin-manager/tsconfig.client.json +++ b/packages/client/ui-plugin-manager/tsconfig.client.json @@ -39,6 +39,9 @@ { "path": "../ui-primitives" }, + { + "path": "../modules" + }, { "path": "../ui-renderer" }, diff --git a/packages/client/ui-primitives/README.i18n.yaml b/packages/client/ui-primitives/README.i18n.yaml index 3f7f83c00e..008c6b8907 100644 --- a/packages/client/ui-primitives/README.i18n.yaml +++ b/packages/client/ui-primitives/README.i18n.yaml @@ -18,8 +18,8 @@ en: 33a5b39959a595c6 zh: efd1088e9f13ed67 /deepseek-ai-dsh-client-ui-primitives/use-this-package/component-catalog: - en: 11686b52743a702d - zh: d865bb79d8f56ee1 + en: 320dba9d3737458f + zh: efd132302c7e17f4 /deepseek-ai-dsh-client-ui-primitives/use-this-package/controls-and-icons: en: fd3499ef403a0594 zh: 3a17727316d3c666 diff --git a/packages/client/ui-primitives/README.md b/packages/client/ui-primitives/README.md index 3e9d16c2a6..cc25340659 100644 --- a/packages/client/ui-primitives/README.md +++ b/packages/client/ui-primitives/README.md @@ -90,7 +90,7 @@ Four pairs are easy to confuse: - **`Tag` against `Pill`.** Reach for `Tag` for a read-only badge at the 11px capsule size, and for `Pill` when the capsule is selectable (`active` and `onClick`, as view switchers and filters use) or when it must sit on a 24px text line — `TerminalBlock` renders its exit status as a static `Pill` for exactly that reason. Size decides as much as interactivity here; the two are not interchangeable. - **`Pill` against `SegmentedControl`.** A row of `Pill`s is a set of independent chips — each one toggles on its own, and several may be active. `SegmentedControl` is one choice among a few mutually exclusive modes, drawn as a tablist with one indicator, and it comes with the tab keyboard pattern (arrow keys walk the segments, only the selected one is in the tab sequence); the Models settings add card switches its two forms with it. -- **`DisclosureRow` against a card.** The row lays its title and content side by side at a fixed 24px. A card that stacks a name over a description is a different layout, and belongs in the feature package — `ui-settings-plugins`' `PluginCard` is the precedent and records why. +- **`DisclosureRow` against a card.** The row lays its title and content side by side at a fixed 24px. A card that stacks a name over a description is a different layout, and belongs in the feature package — `ui-plugin-manager`'s `CardHead` is the precedent. - **`FoldToggle` against the exported surface.** It is package-internal and not exported; the output cards use it for their head-tail fold. Writing your own component in your own package is fine when the need is genuinely specific. What is not fine is copying a control that already exists here — and once a second package needs the same control, it belongs in this package. diff --git a/packages/client/ui-primitives/README.zh.md b/packages/client/ui-primitives/README.zh.md index 4cb97d0d12..9ca3abc2ba 100644 --- a/packages/client/ui-primitives/README.zh.md +++ b/packages/client/ui-primitives/README.zh.md @@ -90,7 +90,7 @@ kind: "package-library" - **`Tag` 与 `Pill`。** 11px 胶囊尺寸的只读徽章用 `Tag`;胶囊可选中(`active` 与 `onClick`,视图切换与筛选器就是这样用的),或者必须落在 24px 文本行上时用 `Pill`——`TerminalBlock` 把退出状态渲染成静态 `Pill` 正是后一种情况。这里尺寸和是否可交互同样是判据,两者不可互换。 - **`Pill` 与 `SegmentedControl`。** 一排 `Pill` 是一组彼此独立的 chip——每个各自开关,可以同时激活多个。`SegmentedControl` 是在几种互斥模式中选一,画成带一个指示块的 tablist,并自带 tab 键盘模式(方向键在分段间移动,只有选中项在 Tab 序列里);模型设置页的新增卡片就用它切换两张表单。 -- **`DisclosureRow` 与卡片。** 该行以固定 24px 把标题与内容左右排列。把名称叠在描述之上的卡片是另一种布局,属于功能包——`ui-settings-plugins` 的 `PluginCard` 是先例,并记录了原因。 +- **`DisclosureRow` 与卡片。** 该行以固定 24px 把标题与内容左右排列。把名称叠在描述之上的卡片是另一种布局,属于功能包——`ui-plugin-manager` 的 `CardHead` 是先例。 - **`FoldToggle` 与对外导出面。** 它是包内组件,未导出;输出卡片用它做头尾折叠。 需求确实特殊时,在自己的包里写自己的组件没有问题。不可以的是复制这里已有的控件——而当第二个包需要同一个控件时,它就该住进本包。 diff --git a/packages/client/ui-renderer/src/client/registry.ts b/packages/client/ui-renderer/src/client/registry.ts index 4c3f520c8a..a3e7b3e8c6 100644 --- a/packages/client/ui-renderer/src/client/registry.ts +++ b/packages/client/ui-renderer/src/client/registry.ts @@ -97,6 +97,7 @@ interface ErasedRegisterOptions { /** Declared dictionary namespace (the renderer synthesizes the `t` seat from it). */ locale?: string registrant?: string + module?: string } interface ErasedFactoryOptions { @@ -116,6 +117,29 @@ interface ErasedFactoryCore { registerFactory(options: object, component: unknow /** One synchronous effect installed while an injected slot declaration is live. */ type SlotInjectionEffect = (() => void) | Iterable<() => void, void, void> +/** + * Name the Loader entry that owns a calling Context: the nearest fiber, walking + * up through nested plugins, that the Loader attached an entry to. + * @param ctx - the caller's Context. + * @returns the entry's module name, which the client module system sets to the package name. + */ +function entryName(ctx: Context): string | undefined { + // The Loader augments fibers with `entry`; this package does not depend on the Loader's types. + let fiber = ctx.fiber as EntryFiber + for (;;) { + if (fiber.entry !== undefined) return fiber.entry.options.name + const parent = fiber.parent.fiber + if (parent === fiber) return undefined + fiber = parent + } +} + +/** The fiber members {@link entryName} reads: the Loader's entry and the parent chain ending at the root fiber. */ +interface EntryFiber { + readonly entry?: { readonly options: { readonly name: string } } | undefined + readonly parent: { readonly fiber: EntryFiber } +} + /** cordis Service layer of the slot system; see the module doc for the split with SlotCore. */ export class SlotRegistry extends Service { private readonly _core = new SlotCore() @@ -479,10 +503,12 @@ export class SlotRegistry extends Service { // core's shared-handle scope pinning applies to it harmlessly). const store = typeof options.store === 'function' ? options.store() : options.store const registrant = options.registrant ?? (this.ctx.fiber as { name?: string } | undefined)?.name + const module = entryName(this.ctx) const erased: ErasedRegisterOptions = { ...options, ...(store !== undefined ? { store } : {}), ...(registrant !== undefined ? { registrant } : {}), + ...(module !== undefined ? { module } : {}), } // Core write first: all load-time validation (undeclared target, // duplicate declaration, kind conflicts, cross-scope handle) throws diff --git a/packages/client/ui-renderer/tests/registry.client.spec.ts b/packages/client/ui-renderer/tests/registry.client.spec.ts index 43ee101f93..27de92ff74 100644 --- a/packages/client/ui-renderer/tests/registry.client.spec.ts +++ b/packages/client/ui-renderer/tests/registry.client.spec.ts @@ -245,6 +245,25 @@ describe('Factory definition ledger', () => { }) }) +describe('registering package', () => { + it('stamps the nearest Loader entry name, walking up through nested plugins, and nothing outside an entry', async () => { + const b = await boot() + b.erased.register({ name: 'root', children: { 't.rows': { kind: 'list', scope: 'root' } } }, C) + let outer: Context | undefined, inner: Context | undefined + await b.ctx.plugin({ inject: ['slots'], apply: (ctx: Context) => { + outer = ctx + ctx.plugin({ inject: ['slots'], apply: (child: Context) => { inner = child } }) + } }) + Object.assign(outer!.fiber, { entry: { options: { name: '@acme/dsh-rows' } } }) + inner!.slots.register({ name: 't.rows', id: 'nested' }, C) + outer!.slots.register({ name: 't.rows', id: 'outer' }, C) + b.erased.register({ name: 't.rows', id: 'root' }, C) + expect(b.svc.entries('t.rows').map(entry => [entry.options.id, entry.module])).toEqual([ + ['nested', '@acme/dsh-rows'], ['outer', '@acme/dsh-rows'], ['root', undefined], + ]) + }) +}) + describe("built-in 'root'", () => { it('is declared at construction: spec readable, occupancy open, no plugin needed', async () => { const bench = await boot() diff --git a/packages/client/ui-settings-general/README.i18n.yaml b/packages/client/ui-settings-general/README.i18n.yaml index a3e6d06c2b..1bbfb63a97 100644 --- a/packages/client/ui-settings-general/README.i18n.yaml +++ b/packages/client/ui-settings-general/README.i18n.yaml @@ -15,8 +15,8 @@ en: 83760d53b3ee5fb8 zh: 30dd8802d4ffdcb7 /deepseek-ai-dsh-client-ui-settings-general/use-this-package: - en: 8ae337011190f5f3 - zh: 508eca60c6fcdc34 + en: 3f25debd8877c4bd + zh: 51f0c1d6924550f1 /deepseek-ai-dsh-client-ui-settings-general/use-this-package/the-general-section: en: de35e867b2a56d73 zh: 6d4e5c912636f889 diff --git a/packages/client/ui-settings-general/README.md b/packages/client/ui-settings-general/README.md index a7782b0518..8e5c7ef0d3 100644 --- a/packages/client/ui-settings-general/README.md +++ b/packages/client/ui-settings-general/README.md @@ -29,7 +29,7 @@ In browsers below 768px viewport width, the panel fills the viewport and navigat ## Use this package -Users reach the shell through the sidebar's bottom Settings control; feature plugins contribute their pages and onboarding steps through the slot ledgers this shell projects. In both the expanded sidebar and collapsed rail, the control exposes the localized Settings label as its accessible name. A pale-yellow **Disconnected** action beside Settings indicates browser offline suspension; its permanent retry glyph marks the retry action, which the Chinese outage copy also names (连接异常,刷新重试). Every recovery attempt shows the shared ongoing loader beside **Reconnecting** with one to three dots advancing every 500ms, and an attempt stays visible for at least 800ms so brief retries do not flicker. Selecting either yellow state starts an immediate retry; press feedback stays within the warning palette. Recovery changes the region to pale-green **Connected** for two seconds from the moment the green pill becomes visible. The pill fades in on appearance, fades out over 150ms on removal, and sizes to its current label. Initial startup and uninterrupted healthy operation remain silent. The shell renders the modal panel, the navigation built from `settings.section` entries, and exactly one mounted onboarding step at a time. +Users reach the shell through the sidebar's bottom Settings control; feature plugins contribute their pages and onboarding steps through the slot ledgers this shell projects. In both the expanded sidebar and collapsed rail, the control exposes the localized Settings label as its accessible name. A pale-yellow **Disconnected** action beside Settings indicates browser offline suspension; its permanent retry glyph marks the retry action, which the Chinese outage copy also names (连接异常,刷新重试). Every recovery attempt shows the shared ongoing loader beside **Reconnecting** with one to three dots advancing every 500ms, and an attempt stays visible for at least 800ms so brief retries do not flicker. Selecting either yellow state starts an immediate retry; press feedback stays within the warning palette. Recovery changes the region to pale-green **Connected** for two seconds from the moment the green pill becomes visible. The pill fades in on appearance, fades out over 150ms on removal, and sizes to its current label. Initial startup and uninterrupted healthy operation remain silent. The shell registers the `settings.section.view` Component Factory, which declares `settings.section`, and renders the modal panel, the navigation built from `settings.section` entries, the selected page through that Factory with a `close` that closes the panel, and exactly one mounted onboarding step at a time. In a browser below 768px, the body-portaled panel fills the CSS layout viewport without additional safe-area padding and covers the mask. It keeps a fixed layout height rather than measuring the software keyboard; focused controls rely on the browser’s native viewport panning. diff --git a/packages/client/ui-settings-general/README.zh.md b/packages/client/ui-settings-general/README.zh.md index a9e949c08e..4012c252d6 100644 --- a/packages/client/ui-settings-general/README.zh.md +++ b/packages/client/ui-settings-general/README.zh.md @@ -29,7 +29,7 @@ kind: "package-reference" ## 使用本包 -用户通过侧边栏底部的 Settings 控件进入外壳;功能插件通过本外壳所投影的 slot 账本贡献自己的页面与引导步骤。在展开侧边栏和收起轨道中,该控件都会把本地化的 Settings 文案作为其可访问名称。Settings 右侧浅黄色的**连接异常**操作表示浏览器离线暂停;其常驻重试图形与中文文案「连接异常,刷新重试」都指明重试动作。每次恢复尝试都显示共享 ongoing loading 加**重新连接中**,其后一至三个点每 500ms 前进一次,且每次尝试至少可见 800ms,短暂重试不会闪动。选中任一黄色状态都会立即发起重试;按压反馈留在黄色色阶内。恢复后该区域变为浅绿色的**连接成功**,从绿色药丸可见起驻留 2 秒再消失。药丸出现时淡入、移除时以 150ms 淡出,宽度随当前文案自适应。首次启动与未曾中断的健康连接保持静默。外壳渲染模态面板、由 `settings.section` 条目构建的导航,以及每次只挂载一个的引导步骤。 +用户通过侧边栏底部的 Settings 控件进入外壳;功能插件通过本外壳所投影的 slot 账本贡献自己的页面与引导步骤。在展开侧边栏和收起轨道中,该控件都会把本地化的 Settings 文案作为其可访问名称。Settings 右侧浅黄色的**连接异常**操作表示浏览器离线暂停;其常驻重试图形与中文文案「连接异常,刷新重试」都指明重试动作。每次恢复尝试都显示共享 ongoing loading 加**重新连接中**,其后一至三个点每 500ms 前进一次,且每次尝试至少可见 800ms,短暂重试不会闪动。选中任一黄色状态都会立即发起重试;按压反馈留在黄色色阶内。恢复后该区域变为浅绿色的**连接成功**,从绿色药丸可见起驻留 2 秒再消失。药丸出现时淡入、移除时以 150ms 淡出,宽度随当前文案自适应。首次启动与未曾中断的健康连接保持静默。外壳注册声明 `settings.section` 的 `settings.section.view` Component Factory,并渲染模态面板、由 `settings.section` 条目构建的导航、经该 Factory 渲染且以关闭面板为 `close` 的所选页面,以及每次只挂载一个的引导步骤。 浏览器宽度低于 768px 时,挂载到 body 的面板铺满 CSS 布局视口并覆盖遮罩,不额外留出安全区边距。面板保持固定布局高度,不测量软键盘;获得焦点的控件依赖浏览器原生的视口平移来露出。 diff --git a/packages/client/ui-settings-general/src/client/SettingsRoot.tsx b/packages/client/ui-settings-general/src/client/SettingsRoot.tsx index 95e74201b7..e461d65868 100644 --- a/packages/client/ui-settings-general/src/client/SettingsRoot.tsx +++ b/packages/client/ui-settings-general/src/client/SettingsRoot.tsx @@ -44,6 +44,7 @@ function navIcon(id: string) { type PanelProps = { rows: readonly SettingsSectionRow[] renderSlot: SettingsRootComponentProps['renderSlot'] + renderFactorySlot: SettingsRootComponentProps['renderFactorySlot'] activeId: string | undefined onSelect: (id: string) => void onClose: () => void @@ -54,7 +55,7 @@ type PanelProps = { * header button, a mask click, and document-level Escape (mounted only while * open, so the listener lifetime is the panel's). */ -function SettingsPanel({ rows, renderSlot, activeId, onSelect, onClose }: PanelProps) { +function SettingsPanel({ rows, renderSlot, renderFactorySlot, activeId, onSelect, onClose }: PanelProps) { // Entries can unmount underneath the requested id, so the render-time // projection falls back to the first row when the id is gone. const active = rows.find(r => r.id === activeId)?.id ?? rows[0]?.id @@ -106,7 +107,7 @@ function SettingsPanel({ rows, renderSlot, activeId, onSelect, onClose }: PanelP
- {active !== undefined && renderSlot('settings.section', { close: onClose }, { only: active })} + {active !== undefined && renderFactorySlot('settings.section.view', { id: active, close: onClose })}
@@ -120,7 +121,7 @@ function SettingsPanel({ rows, renderSlot, activeId, onSelect, onClose }: PanelP */ export function SettingsRoot(props: SettingsRootComponentProps) { const { - wide, reconnect, useConnectionState, useSections, useOnboardingSteps, useSessions, renderSlot, t, + wide, reconnect, useConnectionState, useSections, useOnboardingSteps, useSessions, renderSlot, renderFactorySlot, t, useDesktopUpdate, openDesktopUpdate, useStore, actions, useShortcuts, } = props const { open, activeId } = useStore(state => state) @@ -259,6 +260,7 @@ export function SettingsRoot(props: SettingsRootComponentProps) { ): ReactNode { + return renderSlot('settings.section', { close }, { only: id }) +} diff --git a/packages/client/ui-settings-general/src/client/index.ts b/packages/client/ui-settings-general/src/client/index.ts index 3ee2c01e05..5303fb46ba 100644 --- a/packages/client/ui-settings-general/src/client/index.ts +++ b/packages/client/ui-settings-general/src/client/index.ts @@ -40,6 +40,7 @@ import { DesktopChannelRow, DesktopChannelToast } from './DesktopChannelRow.tsx' import { DesktopUpdateSource } from './desktop-update-source.ts' import { CloseLabel, HeaderContent, TriggerContent } from './chrome.tsx' import { GeneralSection } from './GeneralSection.tsx' +import { SettingsSectionView } from './SettingsSectionView.tsx' import { CurrentVersionRow } from './CurrentVersionRow.tsx' import { DeveloperToolsRow, type DeveloperToolsRowInjected } from './DeveloperToolsRow.tsx' import { SettingsDocumentAction } from './SettingsDocumentAction.tsx' @@ -239,7 +240,6 @@ export function apply(ctx: ClientContext): void { 'settings.header': { kind: 'single', scope: 'root' }, 'settings.action': { kind: 'list', scope: 'root' }, 'settings.close': { kind: 'single', scope: 'root' }, - 'settings.section': { kind: 'list', scope: 'root' }, 'settings.section.icon': { kind: 'list', scope: 'root', inline: true }, 'settings.onboarding': { kind: 'list', scope: 'root' }, }, @@ -263,6 +263,11 @@ export function apply(ctx: ClientContext): void { } ctx.slots.inject('settings.close', () => ctx.slots.register({ name: 'settings.close', locale: NS }, CloseLabel)) + // Every surface that shows a settings page renders it through this Factory, which declares `settings.section`. + ctx.slots.registerFactory({ + name: 'settings.section.view', scope: 'root', + children: { 'settings.section': { kind: 'list', scope: 'root' } }, + }, SettingsSectionView) ctx.slots.inject('settings.section', () => ctx.slots.register({ name: 'settings.section', id: 'general', diff --git a/packages/client/ui-settings-general/src/client/shell-contract.ts b/packages/client/ui-settings-general/src/client/shell-contract.ts index a44e6a1e70..6c548e1e1d 100644 --- a/packages/client/ui-settings-general/src/client/shell-contract.ts +++ b/packages/client/ui-settings-general/src/client/shell-contract.ts @@ -8,7 +8,7 @@ */ import type { ConnectionState } from '@deepseek-ai/dsh-client-connection/client' import type { - HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, + HostObservable, InjectFace, PropsLocale, PropsRenderFactories, PropsRenderSlots, PropsRuntime, } from '@deepseek-ai/dsh-client-ui-slots' // Type-only: pulls ui-sidebar's SlotMap merge (the 'sidebar.settings' entry) // into every program that sees this contract. @@ -71,10 +71,10 @@ export type SettingsRootComponentProps = | 'settings.header' | 'settings.action' | 'settings.close' - | 'settings.section' | 'settings.section.icon' | 'settings.onboarding' > + & PropsRenderFactories & InjectFace & PropsLocale<'settings'> & PropsStore> diff --git a/packages/client/ui-settings-general/tests/apply.client.spec.ts b/packages/client/ui-settings-general/tests/apply.client.spec.ts index fd983d46dc..09723981da 100644 --- a/packages/client/ui-settings-general/tests/apply.client.spec.ts +++ b/packages/client/ui-settings-general/tests/apply.client.spec.ts @@ -343,8 +343,10 @@ describe('ui-settings-general apply', () => { await c.reload(SIDEBAR) await c.flush() expectSeated(c) + // The General page sits in the Factory-declared `settings.section`, which the sidebar rebuild does not collapse. SEATS.forEach(([name], index) => { - expect(ownEntries(c, name)[0]).not.toBe(before[index]) + if (name === 'settings.section') expect(ownEntries(c, name)[0]).toBe(before[index]) + else expect(ownEntries(c, name)[0]).not.toBe(before[index]) }) expect(c.ctx.slots.spec('settings.general.item')).toEqual({ kind: 'list', scope: 'root' }) expect(c.ctx.slots.entries('settings.general.item').filter(row => row.locale === NS).map(row => row.options.id)).toEqual(['developer-tools', 'current-version']) diff --git a/packages/client/ui-settings-general/tests/section-view.client.spec.tsx b/packages/client/ui-settings-general/tests/section-view.client.spec.tsx new file mode 100644 index 0000000000..73d7654f94 --- /dev/null +++ b/packages/client/ui-settings-general/tests/section-view.client.spec.tsx @@ -0,0 +1,19 @@ +// @vitest-environment jsdom +/** The Factory that renders one settings page wherever a surface shows it. */ +import { cleanup, render, screen } from '@testing-library/react' +import { afterEach, describe, expect, it, vi } from 'vitest' +import type { FactoryComponentPropsOf } from '@deepseek-ai/dsh-client-ui-slots' +import { SettingsSectionView } from '../src/client/SettingsSectionView.tsx' + +afterEach(cleanup) + +describe('SettingsSectionView', () => { + it('renders the requested entry with the caller\'s leave action', () => { + const close = vi.fn() + const renderSlot = vi.fn(() =>

page body

) + const props = { id: 'timeline', close, renderSlot } as Partial> + render(} />) + expect(screen.getByText('page body')).toBeTruthy() + expect(renderSlot).toHaveBeenCalledExactlyOnceWith('settings.section', { close }, { only: 'timeline' }) + }) +}) diff --git a/packages/client/ui-settings-general/tests/settings-root.client.spec.tsx b/packages/client/ui-settings-general/tests/settings-root.client.spec.tsx index a5587a608b..b728799793 100644 --- a/packages/client/ui-settings-general/tests/settings-root.client.spec.tsx +++ b/packages/client/ui-settings-general/tests/settings-root.client.spec.tsx @@ -88,10 +88,12 @@ function mount({ const connectionListeners = new Set<() => void>() const reconnect = vi.fn() const renderSlot = vi.fn( - ((key: string, _owner: unknown, opts?: { only?: string; fallback?: import('react').ReactNode }) => { - if (key === 'settings.section') return
- return SEAT_CONTENT[key] ?? opts?.fallback - }) as SettingsRootComponentProps['renderSlot'], + ((key: string, _owner: unknown, opts?: { only?: string; fallback?: import('react').ReactNode }) => + SEAT_CONTENT[key] ?? opts?.fallback) as SettingsRootComponentProps['renderSlot'], + ) + const renderFactorySlot = vi.fn( + ((name: string, factoryProps: { id: string }) => + name === 'settings.section.view' ?
: null) as SettingsRootComponentProps['renderFactorySlot'], ) const activeId = brandString('active-session') const sessions: SessionListState = { @@ -144,6 +146,7 @@ function mount({ return select(current) }, renderSlot, + renderFactorySlot, } const view = render() const bump = (next: Row[]) => { @@ -173,7 +176,10 @@ function mount({ act(() => { sessions.byId[activeId] = { ...session, blank: next } }) view.rerender() } - return { view, renderSlot, bump, listeners, reconnect, setConnectionState, setDesktopUpdate, setShortcuts, setOnboardingActive } + return { + view, renderSlot, renderFactorySlot, bump, listeners, reconnect, + setConnectionState, setDesktopUpdate, setShortcuts, setOnboardingActive, + } } function openPanel() { @@ -486,12 +492,11 @@ describe('SettingsPanel navigation', () => { }) it('renders an empty content column and focuses the title when the ledger is empty', () => { - const { renderSlot } = mount({ rows: [] }) + const { renderFactorySlot } = mount({ rows: [] }) openPanel() expect(document.activeElement).toBe(screen.getByText('Settings Title')) expect(screen.getByRole('dialog')).toBeTruthy() - const sectionCalls = renderSlot.mock.calls.filter(c => c[0] === 'settings.section') - expect(sectionCalls).toHaveLength(0) + expect(renderFactorySlot).not.toHaveBeenCalled() }) it('drops the ledger subscription on unmount', () => { diff --git a/packages/client/ui-settings-general/tests/shell.client.spec.ts b/packages/client/ui-settings-general/tests/shell.client.spec.ts index 75af01b079..8e36d7bde4 100644 --- a/packages/client/ui-settings-general/tests/shell.client.spec.ts +++ b/packages/client/ui-settings-general/tests/shell.client.spec.ts @@ -25,7 +25,7 @@ function injectedOf(c: TestClient): SettingsRootInjected { return (entry.inject as () => SettingsRootInjected)() } -/** The shell's child declarations (chrome, actions, sections, and onboarding overlays). */ +/** The slots this package declares, through the shell or the `settings.section.view` Factory. */ const CHILD_SPECS = { 'settings.launcher': { kind: 'single', scope: 'root' }, 'settings.trigger': { kind: 'single', scope: 'root' }, @@ -40,7 +40,7 @@ const CHILD_NAMES = Object.keys(CHILD_SPECS) as Array /** * Section ids the web-app roster registers, in nav order: this package, then - * ui-settings-models, ui-settings-plugins, and ui-agent-preset. A plugin + * ui-settings-models, ui-plugin-manager, and ui-agent-preset. A plugin * adding a section changes this list. */ const PRODUCT_SECTIONS: readonly string[] = ['general', 'models', 'plugins', 'agent-presets'] diff --git a/packages/client/ui-settings-plugin-inventory/README.i18n.yaml b/packages/client/ui-settings-plugin-inventory/README.i18n.yaml deleted file mode 100644 index c1eca72846..0000000000 --- a/packages/client/ui-settings-plugin-inventory/README.i18n.yaml +++ /dev/null @@ -1,52 +0,0 @@ -# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading -# section, a hash of its English and Chinese blocks outside code blocks and generated regions. -# After editing either side, bring the other along and re-record with: -# pnpm run verify-translation-pairing --write packages/client/ui-settings-plugin-inventory/README.md -/: - en: 9121298d88fe8ea6 - zh: 5da705491f951d0e -/deepseek-ai-dsh-client-ui-settings-plugin-inventory: - en: 463eecf002ec0f54 - zh: b8dc6003ddccd14a -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/summary: - en: f52353cf99816eb8 - zh: e172c1751289882f -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/table-of-contents: - en: d152484eb41ac6b4 - zh: 09388d293f9be9cb -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/use-this-package: - en: 67637808e7940157 - zh: d4d0716ea4d33e4a -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/use-this-package/reading-a-card: - en: 23f533442ed22d44 - zh: f2ac59b57878aed1 -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/use-this-package/the-preset-switcher: - en: 84e5938329199a22 - zh: 6f5cfaac56433e8b -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/use-this-package/retrying-a-failed-read: - en: 673c7574e14078be - zh: b093e897f0341973 -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/understand-the-implementation: - en: cab883d26642c932 - zh: 54e7321bd781b400 -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/understand-the-implementation/registration: - en: e4792880c5916ce0 - zh: 4c8171a446dd153f -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/understand-the-implementation/rendering: - en: 779146e3d3732803 - zh: 0dfafa328dfeda75 -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/further-exploration: - en: ae3819f0c5da95bd - zh: 40972ab96d5c95e2 -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/model-experience: - en: 69fb187ac2361233 - zh: d4d3ec4ed3e3d98d -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/model-experience/kv-cache-effect: - en: ca75c51c89c2c9b0 - zh: de54f3467ef3b9be -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/known-limitations-and-deferred-work: - en: 3d3343d97eb73762 - zh: 5fc9d1c1f0c4055d -/deepseek-ai-dsh-client-ui-settings-plugin-inventory/known-limitations-and-deferred-work/dev-note: - en: e67f633dc6fe7773 - zh: 3bb0c20c93f16f98 diff --git a/packages/client/ui-settings-plugin-inventory/README.md b/packages/client/ui-settings-plugin-inventory/README.md deleted file mode 100644 index d8f34cbf07..0000000000 --- a/packages/client/ui-settings-plugin-inventory/README.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -description: "Scope-grouped read-only plugin inventory tab in Web Plugins settings for the dsh web client: agent-preset compositions first, the global plane behind a disclosure, search across both." -kind: "package-reference" ---- - -# @deepseek-ai/dsh-client-ui-settings-plugin-inventory - -English | [中文](README.zh.md) - -## Summary - -The **Plugin list** tab lets Web users inspect plugins without changing their configuration. It lists agent presets, open by default, then the collapsed global inventory; a search opens both. Cards show localized titles and descriptions when available, identify instances by stable entry id, and expose enablement, source details, runtime status, disabled conditions, and discovery failures; preset-provided global entries name their presets. Search covers both groups and points to matches in other presets. The tab handles loading, empty, no-match, failure, and retry states without exposing transport details, and still shows the global inventory without a preset roster. - -## Table of Contents - -- [Use this package](#use-this-package) -- [Understand the implementation](#understand-the-implementation) -- [Further Exploration](#further-exploration) -- [Model Experience](#model-experience) -- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work) -- [Dev Note](#dev-note) - ------ - - -## Use this package - -Open the Plugins section in Settings and select the **Plugin list** tab to inspect the Host's plugin inventory. The tab reads no Remote during plugin activation — selecting it for the first time mounts the component and lazily calls `ctx.remote.pluginInventory.list()` through `api-remotes`. - -A failed installation with pending pnpm build permissions offers **Allow these scripts and retry**. The action displays the exact package names and persistent permission scope, then retries the original package spec and activation choice. One click approves the entire displayed group, which can include pending packages from earlier attempts. Closing the page grants no permission. - -### Reading a card - -Each collapsed card uses the plugin's localized title and description when available; a description shows at most two lines until its card is expanded. Settings shortens literal package-name or module-name fallbacks by removing the npm scope and the `cordis:`, `cordis-plugin-`, or `dsh-`/`dsh-host-`/`dsh-client-` prefix; locale titles remain unchanged. The Host supplies locale and package-field fallbacks in `meta`; the Client selects the current language. Full module specifiers remain available in details and search. Missing descriptions are omitted, and metadata diagnostics appear with the card. This compact naming applies only to Settings, not the sidebar's Plugins page. - -A small enablement tag marks only the states that differ from plainly enabled: disabled, conditional, provided by presets, and failed; a plainly enabled row carries no tag. A colored root-fiber status dot marks the live phases no tag states: `pending` maps to idle, while `loading` and `unloading` map to ongoing; an `active` or `failed` fiber shows no dot. The stable entry id appears in a code chip at the card's bottom-left, in line with the title, only when it differs from the title: a composition-generated id drops its leading `include:` marker there, and an id that then repeats the title is omitted. Whenever the chip shows, its hover text and the card's accessible name carry the complete id; search and expanded details always retain it. Long entry ids truncate in the chip and remain available on hover. Expanding one card reveals its full description, the declared entry id, the full module specifier, and the state facts: a preset row names the preset it comes from, its runtime status when the composition is live, and its disable condition when it carries one; a preset-provided global row explains that agent presets provide it per session, names the presets that enable it. Preset names resolve through the shared `presetDisplayText` fold (`dsh-agent-preset-registry/display`) over [`ui-agent-preset`](../ui-agent-preset/README.md)'s dictionaries: shipped presets follow the active locale while user-authored ones keep their own metadata, so an English surface never echoes the preset declarations' Chinese names. Search filters both groups through the shared [text search](../../util/text-search/README.md): module name, entry id, and every declared language of the title match fuzzily, and every language of the description matches as a substring. - -A card paints its hover surface only where the pointer can hover: a tap answers with the pressed fill, and an expanded card keeps its open surface on every device. The search field takes a 16px face under a coarse pointer, so iOS Safari does not zoom the page for a focused field. - -### The preset switcher - -The switcher is the same selector-pill-plus-menu control the General settings rows use. It lists every roster preset — the default suffixed as such, broken ones marked — and changes only what the list shows: it writes no settings, and selecting a broken preset shows the discovery-reported reason in place of rows. Choosing the default preset or a session's preset stays where it was: the Agent presets section and the new-session screen. - -### Retrying a failed read - -A failed read renders the shared error marker inside the tab. Loading shows skeleton cards in the card grid, and current-page synchronization uses the shared ongoing loader. Retrying re-runs the lazy `list()` call without exposing transport details. - -The Plugin list also shows synchronization failures on the current page. Its retry reapplies the latest client graph without changing Host enablement or refreshing the page. - ------ - - -## Understand the implementation - -
-Implementation internals — click to expand - -The tab is a read-only projection of a Host-owned snapshot; it performs no Remote read during plugin activation and takes the snapshot on first selection. - -### Registration - -The browser plugin registers one localized `settings.plugins.tab` contribution with id `all`; the Plugins section owns the navigation entry and tab chrome. Registration uses `ctx.slots.inject()`, so it follows late tab declaration, redeclaration, locale changes, and teardown without importing the section owner. - -### Rendering - -Row keys are scope-qualified (`global:`, `preset::`), so one module appearing in both scopes keeps distinct disclosure state; a declared entry id appears in expanded details and, after removal of a leading composition `include:` marker, supplies the collapsed id chip when the result differs from the title, while a row without one stays unlabeled. The preset-provided marking is derived client-side: a global entry carries it when it is disabled there while at least one preset row for the same module specifier is actually enabled, so a module every preset gates off (or declares only conditionally) stays plainly disabled rather than over-claiming provision. - -
- ------ - - -## Further Exploration - -These pages cover the settings section, the remote call, and the Host-side projection. - -- [ui-settings-plugins](../ui-settings-plugins/README.md) — the Plugins section this tab registers into. -- [ui-settings](../ui-settings/README.md) — the domain base declaring `settings.plugins.tab`. -- [api-remotes](../../api/remotes/README.md) — the Remote BFF surface behind `pluginInventory.list()`. -- [plugin-inventory](../../host/plugin-inventory/README.md) — the Host-side read-only Loader projection this tab renders. - ------ - - -## Model Experience - -None, as the package is a browser-side inventory projection that registers nothing model-facing. - -#### KV Cache effect - -None; this package neither assembles nor sends a provider request. - -## Known Limitations and Deferred Work - - - - -These limits define the freshness and reach of the inventory view; they are current package constraints. - -- **One snapshot per Settings mount or retry** — the tab does not subscribe to Loader changes or automatically refetch after reconnect; switching tabs preserves the current snapshot, while reopening Settings obtains a new one. -- **Read-only in both planes** — the tab shows global and preset enablement but mutates neither; enable/disable controls that write a custom preset's own composition file are deliberate follow-up work. - - -### Dev Note - -
-Working context for maintainers — click to expand - -None. - -
diff --git a/packages/client/ui-settings-plugin-inventory/README.zh.md b/packages/client/ui-settings-plugin-inventory/README.zh.md deleted file mode 100644 index c6d0a9648a..0000000000 --- a/packages/client/ui-settings-plugin-inventory/README.zh.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -description: "dsh Web 客户端设置中按作用域分组的只读插件清单标签页:Agent 预设组合在前,全局平面收在折叠分组里,搜索跨两组。" -kind: "package-reference" ---- - -# @deepseek-ai/dsh-client-ui-settings-plugin-inventory - -[English](README.md) | 中文 - -## 概述 - -**插件列表**标签页让 Web 用户查看插件,而不改变其配置。它先列 agent(智能体)预设分组,再列全局清单;预设分组默认展开,全局分组默认收起,搜索期间两组都展开。卡片显示可用的本地化标题与描述,以稳定的条目 id 标识实例,并展示启停状态、出处、运行状态、禁用条件与发现失败;由预设提供的全局条目会列出对应预设。搜索覆盖两个分组,并指出其他预设中的匹配。标签页处理加载、空结果、无匹配、失败与重试状态,且不暴露传输细节;没有预设 roster 时仍会展示全局清单。 - -## 目录 - -- [使用本包](#use-this-package) -- [理解实现](#understand-the-implementation) -- [进一步探索](#further-exploration) -- [模型体验](#model-experience) -- [已知限制与延期工作](#known-limitations-and-deferred-work) -- [开发备注](#dev-note) - ------ - - -## 使用本包 - -打开设置中的「插件」分区并选择**插件列表**标签页,即可查看宿主的插件清单。插件激活期间不会读取 Remote——首次选择该标签页时才挂载组件,并通过 `api-remotes` 懒调用 `ctx.remote.pluginInventory.list()`。 - -安装失败且存在待审批的 pnpm 构建权限时,页面提供“允许这些脚本并重试”。该操作展示准确包名和持久授权范围,再使用原来的包规格及启用选项重试。一次点击批准整个列表,其中可能包括此前安装留下的待审批包。关闭页面不会授予权限。 - -### 阅读卡片 - -每张收起的卡片使用插件可用的本地化标题与描述;描述最多显示两行,展开卡片后显示全文。设置页会缩短字面的包名或模块名回退值,移除 npm scope 以及 `cordis:`、`cordis-plugin-` 或 `dsh-`/`dsh-host-`/`dsh-client-` 前缀;locale 标题保持原样。Host 在 `meta` 中提供 locale 与包字段的回退结果,Client 选择当前语言。详情与搜索仍保留完整模块标识。缺失的描述不显示,元信息诊断随卡片展示。这种短名显示仅用于设置页,不影响侧栏的插件页。 - -表示启停状态的小标签只标记与普通启用不同的状态:已停用、条件启用、由预设提供与启动失败;普通启用的行不带标签。彩色根 fiber 状态圆点标记没有标签表达的存活阶段:`pending` 映射为 idle,`loading` 与 `unloading` 映射为 ongoing;`active` 或 `failed` fiber 不显示圆点。稳定的条目 id 仅在与标题不同时显示,位于卡片左下角的代码标签中,与标题左对齐:组合生成的 id 在此省略开头的 `include:` 标记,省略后与标题相同的 id 不再重复显示。显示代码标签时,其悬停提示与卡片的无障碍名称带完整 id;搜索与展开详情始终保留完整 id。长条目 id 会在代码标签内截断,悬停时仍可查看完整值。展开卡片后会显示完整描述、声明的条目 id、完整模块标识与状态事实:预设行说明它来自哪个预设、组合存活时的运行状态,以及它携带的禁用条件;被预设提供的全局行说明它由 Agent 预设按会话提供、列出启用它的预设。预设名经共享的 `presetDisplayText` 纯函数(`dsh-agent-preset-registry/display`)叠在 [`ui-agent-preset`](../ui-agent-preset/README.zh.md) 的字典上解析:内置预设走当前语言,用户自建预设保留自己的元数据,因此英文界面不会回显预设声明里的中文名。搜索通过共享的[文本搜索](../../util/text-search/README.zh.md)过滤两组:模块名称、条目 id 和标题的所有声明语言模糊匹配,描述的所有语言按子串匹配。 - -卡片只在可悬停的指针下绘制悬停底色:点按以按下填充回馈,展开的卡片在任何设备上保持展开底色。搜索框在粗指针下使用 16px 字号,iOS Safari 不会因聚焦而放大页面。 - -### 预设切换器 - -切换器与通用设置各行使用同一种「选择胶囊 + 菜单」控件。它列出 roster 的每个预设——默认项带后缀、坏预设带标记——并且只改变列表显示什么:它不写任何设置,选中坏预设时在行的位置展示 discovery 报告的原因。选择默认预设或会话预设的入口仍在原处:Agent 预设分区与新会话页。 - -### 重试失败的读取 - -读取失败会在标签页内渲染共享 error 标记。加载时在卡片网格中显示骨架卡片,当前页面同步使用共享 ongoing loading。重试会重新执行懒 `list()` 调用,且不会暴露传输细节。 - -插件列表还显示当前页面的同步失败。重试会重新应用最新客户端图,不改变 Host 启用状态,也不刷新页面。 - ------ - - -## 理解实现 - -
-实现细节——点击展开 - -该标签页是宿主拥有快照的只读投影;插件激活期间不执行任何 Remote 读取,首次选择时才取快照。 - -### 注册 - -浏览器插件注册一个 id 为 `all` 的本地化 `settings.plugins.tab` 贡献;「插件」分区拥有导航入口与标签栏。注册使用 `ctx.slots.inject()`,因此能跟随标签 slot 的延迟声明、重新声明、本地化变化与 teardown,而无需 import 分区拥有方。 - -### 渲染 - -行 key 按作用域限定(`global:`、`preset::`),因此同一模块出现在两个作用域时保持各自的展开状态;声明的条目 id 出现在展开详情中;去掉开头的组合 `include:` 标记后若与标题不同,则作为收起卡片的 id 代码标签,没有 id 的行不显示次级标签。预设提供标记在客户端推导:一个全局条目在全局被停用、且至少一个预设行对同一模块标识实际启用时才携带它,因此被所有预设关掉(或仅条件声明)的模块保持单纯的已停用,而不是夸大提供关系。 - -
- ------ - - -## 进一步探索 - -以下页面覆盖设置分区、Remote 调用与宿主侧投影。 - -- [ui-settings-plugins](../ui-settings-plugins/README.zh.md)——本标签页注册进的「插件」分区。 -- [ui-settings](../ui-settings/README.zh.md)——声明 `settings.plugins.tab` 的领域底座。 -- [api-remotes](../../api/remotes/README.zh.md)——`pluginInventory.list()` 背后的 Remote BFF 表面。 -- [plugin-inventory](../../host/plugin-inventory/README.zh.md)——本标签页所渲染的宿主侧只读 Loader 投影。 - ------ - - -## 模型体验 - -无。该包是浏览器端清单投影,不注册任何面向模型的内容。 - -#### KV Cache 影响 - -无;该包既不组装也不发送提供方请求。 - -## 已知限制与延期工作 - - - - -这些限制定义清单视图的新鲜度与触达范围;它们是当前包约束。 - -- **每次 Settings 挂载或重试只读取一份快照**:标签页不订阅 Loader 变化,也不会在重连后自动重新读取;切换标签页会保留当前快照,重新打开 Settings 则会取得新快照。 -- **两个平面都只读**:标签页展示全局与预设的启停状态但都不修改;写回自定义预设组合文件的启停控件是刻意留作后续的工作。 - - -### 开发备注 - -
-维护者的工作上下文——点击展开 - -无。 - -
diff --git a/packages/client/ui-settings-plugin-inventory/locale/de.json b/packages/client/ui-settings-plugin-inventory/locale/de.json deleted file mode 100644 index e949caba64..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/de.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Integrierte Plug-in-Listenschnittstelle", - "description": "Überprüfen Sie in den Einstellungen die globalen Plug-Ins und Plug-Ins, die von jedem Agenten verwendet werden." - } -} diff --git a/packages/client/ui-settings-plugin-inventory/locale/en.json b/packages/client/ui-settings-plugin-inventory/locale/en.json deleted file mode 100644 index 38e92db659..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/en.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "meta": { - "title": "ui-settings-plugin-inventory" - } -} diff --git a/packages/client/ui-settings-plugin-inventory/locale/es.json b/packages/client/ui-settings-plugin-inventory/locale/es.json deleted file mode 100644 index 32ef114ca5..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/es.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Interfaz de lista de complementos incorporada", - "description": "Verifique los complementos globales y los complementos utilizados por cada Agente en la configuración." - } -} diff --git a/packages/client/ui-settings-plugin-inventory/locale/fr.json b/packages/client/ui-settings-plugin-inventory/locale/fr.json deleted file mode 100644 index a83279a5dc..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/fr.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Interface de liste de plug-ins intégrée", - "description": "Vérifiez les plug-ins globaux et les plug-ins utilisés par chaque Agent dans les paramètres." - } -} diff --git a/packages/client/ui-settings-plugin-inventory/locale/ja.json b/packages/client/ui-settings-plugin-inventory/locale/ja.json deleted file mode 100644 index 8c90e7eb4b..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/ja.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "組み込みプラグイン一覧 UI", - "description": "設定でグローバルプラグインと各エージェントプリセットのプラグインを確認します。" - } -} diff --git a/packages/client/ui-settings-plugin-inventory/locale/pt.json b/packages/client/ui-settings-plugin-inventory/locale/pt.json deleted file mode 100644 index c82847e91e..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/pt.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Interface de lista de plug-ins integrada", - "description": "Verifique os plug-ins globais e plug-ins usados por cada Agente nas configurações." - } -} diff --git a/packages/client/ui-settings-plugin-inventory/locale/ru.json b/packages/client/ui-settings-plugin-inventory/locale/ru.json deleted file mode 100644 index 4d1b1aae31..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/ru.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Встроенный интерфейс списка плагинов", - "description": "Проверьте в настройках глобальные плагины и плагины, используемые каждым Агентом." - } -} diff --git a/packages/client/ui-settings-plugin-inventory/locale/zh.json b/packages/client/ui-settings-plugin-inventory/locale/zh.json deleted file mode 100644 index df4f5ab36f..0000000000 --- a/packages/client/ui-settings-plugin-inventory/locale/zh.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "内置插件列表界面", - "description": "在设置中查看全局插件和各 Agent 预设使用的插件。" - } -} diff --git a/packages/client/ui-settings-plugin-inventory/package.json b/packages/client/ui-settings-plugin-inventory/package.json deleted file mode 100644 index 6b412c7b7d..0000000000 --- a/packages/client/ui-settings-plugin-inventory/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "@deepseek-ai/dsh-client-ui-settings-plugin-inventory", - "description": "Read-only Cordis Loader inventory tab in Web Plugins settings", - "version": "0.2.2-rc.3", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/deepseek-ai/deepseek-harness.git", - "directory": "packages/client/ui-settings-plugin-inventory" - }, - "type": "module", - "main": "lib/index.js", - "types": "lib/types/index.d.ts", - "exports": { - ".": { - "types": "./lib/types/index.d.ts", - "default": "./lib/index.js" - }, - "./client": { - "types": "./lib/types/client/index.d.ts", - "default": "./lib/client.js" - }, - "./src/*": "./src/*", - "./package.json": "./package.json", - "./locale/*.json": "./locale/*.json" - }, - "dsh": { - "client": { - "inject": [ - "@deepseek-ai/dsh-api-remotes", - "@deepseek-ai/dsh-client-ui-settings", - "@deepseek-ai/dsh-client-locale", - "@deepseek-ai/dsh-client-ui-agent-preset", - "@deepseek-ai/dsh-client-modules" - ], - "platform": "web" - } - }, - "scripts": { - "bundle": "tsdown", - "watch": "tsdown --watch" - }, - "license": "MIT", - "peerDependencies": { - "@deepseek-ai/cordis": "workspace:~" - }, - "devDependencies": { - "@deepseek-ai/dsh-api-remotes": "workspace:*", - "@deepseek-ai/dsh-client-locale": "workspace:*", - "@deepseek-ai/dsh-client-test-runtime": "workspace:*", - "@deepseek-ai/dsh-client-ui-agent-preset": "workspace:*", - "@deepseek-ai/dsh-client-ui-primitives": "workspace:*", - "@deepseek-ai/dsh-client-ui-settings": "workspace:*", - "@deepseek-ai/dsh-client-ui-slots": "workspace:*", - "@deepseek-ai/dsh-package-manifest": "workspace:*", - "@testing-library/react": "^16.3.3", - "@deepseek-ai/cordis": "workspace:~", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "@deepseek-ai/dsh-client-ui-renderer": "workspace:*", - "@deepseek-ai/dsh-agent-preset-registry": "workspace:*", - "@deepseek-ai/dsh-client-modules": "workspace:*", - "@deepseek-ai/dsh-client-store": "workspace:*", - "@deepseek-ai/dsh-util-text-search": "workspace:*" - }, - "files": [ - "locale/*.json", - "lib/index.js", - "lib/client.js", - "lib/types/**/*.d.ts", - "lib/types/**/*.d.ts.map", - "lib/**/*.js.map", - "src" - ] -} diff --git a/packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.module.css b/packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.module.css deleted file mode 100644 index db943b1066..0000000000 --- a/packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.module.css +++ /dev/null @@ -1,512 +0,0 @@ -/* The tab's own width, not the window's, decides the card columns below. */ -.section { - container: plugin-inventory / inline-size; - display: flex; - flex-direction: column; - gap: 14px; - width: 100%; - max-width: 760px; - color: var(--dsw-alias-label-primary); -} - -.status, -.failure p { - margin: 0; -} - -.status, -.failure { - font-size: 13px; - line-height: 20px; - color: var(--dsw-alias-label-tertiary); -} - -.failure { - display: flex; - align-items: center; - gap: 10px; - color: var(--dsw-alias-state-error-primary); -} - -.statusWithDot { - display: inline-flex; - align-items: center; - gap: 6px; -} - -.failure button { - border: 0.5px solid var(--dsw-alias-border-l3); - border-radius: var(--dsw-radius-sm); - padding: 4px 10px; - background: transparent; - color: var(--dsw-alias-label-primary); - font: inherit; - cursor: pointer; -} - -.catalog { - display: flex; - flex-direction: column; - gap: 12px; -} - -.search { - position: relative; - display: flex; - align-items: center; - width: 100%; - color: var(--dsw-alias-label-tertiary); -} - -.search > svg { - position: absolute; - left: 12px; - pointer-events: none; -} - -.search input { - width: 100%; - height: 36px; - border: 0.5px solid var(--dsw-alias-border-l4); - border-radius: var(--dsw-radius-md); - padding: 0 34px 0 36px; - outline: none; - background: var(--dsw-alias-bg-layer-1); - color: var(--dsw-alias-label-primary); - font: inherit; - font-size: 13px; -} - -.search input::placeholder { - color: var(--dsw-alias-label-tertiary); -} - -.search input:focus-visible { - border-color: var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); - box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)) 18%, transparent); -} - -.cards { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 10px; - margin: 0; - padding: 0; - list-style: none; -} - -/* Cards stretch to their grid row's height. The button fills a stretched card: - the title row and description stay at the top, in line with the other card's, - and the spare height sits above the entry id chip or at the bottom. */ -.card { - display: flex; - flex-direction: column; - min-width: 0; - overflow: hidden; - border: 0.5px solid var(--dsw-alias-settings-card-stroke); - border-radius: var(--dsw-radius-xl); - background: var(--dsw-alias-settings-card-fill); -} - -.card[data-open='true'] { - border-color: var(--dsw-alias-border-l3); -} - -/* The other card in an expanded card's row keeps its own height instead of - stretching alongside the details. The selectors assume the two columns - `.cards` declares, where each row starts at an odd position, and must change - with that count; in one column the matched card sits alone in its row. */ -.card:nth-child(odd)[data-open='true'] + .card, -.card:nth-child(odd):has(+ .card[data-open='true']) { - align-self: start; -} - -.cardContent { - box-sizing: border-box; - display: flex; - flex: 1 1 auto; - flex-direction: column; - align-items: stretch; - gap: 2px; - width: 100%; - min-height: 52px; - border: 0; - padding: 12px 14px; - background: transparent; - color: inherit; - font: inherit; - text-align: left; - cursor: pointer; -} - -.card[data-open='true'] > .cardContent { - background: var(--dsw-alias-interactive-bg-hover); -} - -/* Hover stays behind @media (hover: hover) so a tap cannot latch it; the press - state carries the feedback a touch client would otherwise lose. */ -.cardContent:active { - background: var(--dsw-alias-interactive-bg-active); -} - -@media (hover: hover) { - .cardContent:hover { - background: var(--dsw-alias-interactive-bg-hover); - } -} - -.cardContent:focus-visible { - outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); - outline-offset: -2px; -} - -.cardMainRow { - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; - min-width: 0; -} - -.cardTitle, -.cardIdentity { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.cardTitle { - flex: 1; - min-width: 0; - font-size: 14px; - line-height: 20px; - font-weight: 500; -} - -/* Two lines at most while collapsed; the expanded card shows the full text. */ -.cardDescription { - display: -webkit-box; - overflow: hidden; - color: var(--dsw-alias-label-tertiary); - font-size: 12px; - line-height: 18px; - text-wrap: pretty; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; -} - -.card[data-open='true'] .cardDescription { - display: block; -} - -/* The entry id is metadata, not prose: a code chip in the card's bottom-left - corner whose left edge lines up with the title. */ -.cardMeta { - display: flex; - margin-top: auto; - padding-top: 6px; -} - -/* The Loader entry id keeps one size in the card chip and the row it expands into; - the collapsed chip stays on the quieter label tier, while the expanded row carries - the card's primary value. */ -.cardIdentity, -.entryValue { - font-family: var(--ds-font-family-code); - font-size: 12px; - line-height: 18px; -} - -.cardIdentity { - display: block; - box-sizing: border-box; - max-width: 100%; - border-radius: var(--dsw-radius-xs); - padding: 1px 6px; - background: var(--dsw-alias-bg-module-platform); - color: var(--dsw-alias-label-secondary); -} - -.cardTrailing { - display: inline-flex; - flex: none; - align-items: center; - gap: 8px; - color: var(--dsw-alias-label-tertiary); -} - -/* Accessible-name and layout wrapper: StateDot is aria-hidden and carries no - name, and the row needs the phase to stay on one flex line. */ -.phaseDot { - display: inline-flex; - flex: none; -} - -.group { - display: flex; - flex-direction: column; - gap: 10px; -} - -/* Every group header takes the preset switcher's 36px height, so each subtitle - sits the same distance below its title. */ -.groupTitleRow { - display: flex; - align-items: center; - gap: 8px; - min-height: 36px; -} - -.group + .group { - border-top: 0.5px solid var(--dsw-alias-border-l2); - padding-top: 14px; -} - -.headerEnd { - margin-left: auto; -} - -.groupToggle { - display: flex; - flex: none; - align-items: center; - gap: 8px; - border: 0; - padding: 0; - background: transparent; - color: inherit; - font: inherit; - text-align: left; - cursor: pointer; -} - -.groupToggle:focus-visible { - outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); - outline-offset: 2px; -} - -.groupToggle > .chevron { - transform: rotate(-90deg); -} - -.groupToggle[aria-expanded='true'] > .chevron { - transform: none; -} - -.groupTitle { - font-size: 14px; - line-height: 22px; - font-weight: 400; - color: var(--dsw-alias-label-primary); -} - -.groupSub { - display: flex; - flex-wrap: wrap; - row-gap: 4px; - margin: -6px 0 0 20px; - color: var(--dsw-alias-label-tertiary); - font-size: 12px; - line-height: 18px; - font-variant-numeric: tabular-nums; -} - -/* The preset switcher trigger mirrors the General-settings selector pill. */ -.switcher { - display: inline-flex; - flex: none; - align-items: center; - gap: 12px; - height: 36px; - white-space: nowrap; - border: none; - border-radius: var(--dsw-radius-md); - padding: 0 14px; - background: var(--dsw-alias-bg-module-platform); - color: var(--dsw-alias-label-primary); - font: inherit; - font-size: 14px; - line-height: 22px; - cursor: pointer; -} - -.switcher:active { - background: var(--dsw-alias-interactive-bg-active); -} - -@media (hover: hover) { - .switcher:hover { - background: var(--dsw-alias-interactive-bg-hover); - } -} - -.switcher:focus-visible { - outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); - outline-offset: 2px; -} - -.switcher > .chevron { - flex: none; -} - -.switcherLabel { - max-width: 240px; - overflow: hidden; - text-overflow: ellipsis; -} - - -.groupBody { - display: flex; - flex-direction: column; - gap: 10px; -} - - -.brokenNote { - margin: 0; - border-radius: var(--dsw-radius-lg); - padding: 8px 10px; - background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 8%, transparent); - color: var(--dsw-alias-state-error-primary); - font-size: 12px; - line-height: 18px; - overflow-wrap: anywhere; - white-space: pre-line; -} - -.hint { - display: flex; - flex-wrap: wrap; - align-items: baseline; - gap: 4px 8px; - margin: 0; - color: var(--dsw-alias-label-tertiary); - font-size: 12px; - line-height: 18px; -} - -.jumpLink { - border: 0; - padding: 0; - background: transparent; - color: var(--dsw-alias-state-business-primary); - font: inherit; - font-size: 12px; - cursor: pointer; -} - -/* Loading placeholder in the cards grid, sized like a card with one description - line; its bars pulse through the shared skeleton token as the input-trigger - menu's pending rows do. */ -.skeletonCard { - display: flex; - flex-direction: column; - gap: 8px; - border: 0.5px solid var(--dsw-alias-settings-card-stroke); - border-radius: var(--dsw-radius-xl); - padding: 15px 14px; - background: var(--dsw-alias-settings-card-fill); -} - -.skeletonBar { - width: 40%; - height: 14px; - border-radius: var(--dsw-radius-xs); - background: var(--dsw-alias-bg-skeleton); -} - -.skeletonBar + .skeletonBar { - width: 80%; - height: 12px; -} - -.card[data-failed='true'] { - border-color: color-mix(in srgb, var(--dsw-alias-state-error-primary) 45%, transparent); -} - -.chevron { - flex: none; - color: var(--dsw-alias-label-tertiary); -} - -.card[data-open='true'] .chevron { - transform: rotate(180deg); -} - -.cardDetails { - border-top: 0.5px solid var(--dsw-alias-border-l2); - padding: 10px 14px 12px; - background: var(--dsw-alias-bg-module-platform); -} - -.entryValue { - display: block; - overflow-wrap: anywhere; - color: var(--dsw-alias-label-primary); -} - -.details { - display: grid; - grid-template-columns: 76px minmax(0, 1fr); - gap: 6px 10px; - margin: 8px 0 0; -} - -.details div { - display: contents; -} - -.details dt { - color: var(--dsw-alias-label-tertiary); - font-size: 11px; - line-height: 17px; -} - -.details dd { - min-width: 0; - margin: 0; - overflow-wrap: anywhere; - color: var(--dsw-alias-label-secondary); - font-size: 12px; - line-height: 17px; -} - -.visuallyHidden { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip: rect(0 0 0 0); - clip-path: inset(50%); - white-space: nowrap; -} - -@media (prefers-reduced-motion: no-preference) { - .chevron { - transition: transform 140ms var(--ds-ease-in-out); - } - - .skeletonBar { - animation: plugin-inventory-skeleton 2s cubic-bezier(0.36, 0, 0.64, 1) infinite; - } -} - -@keyframes plugin-inventory-skeleton { - 0% { opacity: 1; } - 40% { opacity: 0.6; } - 80%, 100% { opacity: 1; } -} - -@container plugin-inventory (max-width: 520px) { - .cards { - grid-template-columns: minmax(0, 1fr); - } -} - -/* iOS Safari zooms the visual viewport for a focused field under 16px. */ -@media (pointer: coarse) { - .search input { - font-size: 16px; - } -} diff --git a/packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.tsx b/packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.tsx deleted file mode 100644 index b5d74ce54c..0000000000 --- a/packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.tsx +++ /dev/null @@ -1,586 +0,0 @@ -import { useEffect, useId, useMemo, useState, type ReactNode } from 'react' -import type { ClientEntryState } from '@deepseek-ai/dsh-client-modules/client' -import type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store' -import type { PluginInventorySnapshot } from '@deepseek-ai/dsh-api-remotes/client' -import type { LocalizedText } from '@deepseek-ai/dsh-package-manifest' -import { - IconChevronDownOutlineRegular, - IconSearchOutlineRegular, - Menu, - StateDot, - Tag, -} from '@deepseek-ai/dsh-client-ui-primitives' -import type { StateDotState, TagTone } from '@deepseek-ai/dsh-client-ui-primitives' -import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots' -import { localizedValues, TextSearchIndex, type SearchKeys } from '@deepseek-ai/dsh-util-text-search' -import type { PluginInventoryLocaleKey } from './locales.ts' -import css from './PluginInventorySettingsTab.module.css' - -type PluginInventoryEntry = PluginInventorySnapshot['entries'][number] -type AgentPresetGroup = NonNullable[number] -type AgentPresetRow = AgentPresetGroup['rows'][number] - -/** Registration-side Remote face used by the section. */ -export interface PluginInventorySettingsTabInjected { - /** Resolve local package text in the current Client locale at render time. */ - resolveText: (text: LocalizedText) => string - /** Page-local module synchronization, independent from the Host inventory. */ - hooks: { clientSync: ObservableSnapshot } - /** Retry the latest client graph without changing the Host composition. */ - retryClient: () => void - /** Read a current Host inventory snapshot. */ - list: () => Promise - /** - * Display name for one preset: shipped presets resolve through the - * agent-preset dictionaries, user-authored ones keep their own metadata. - */ - presetName: (preset: AgentPresetGroup) => string -} -type PluginFiberPhase = PluginInventoryEntry['fiberPhase'] - -/** Full component props assembled by the Settings slot renderer. */ -export type PluginInventorySettingsTabProps = - PropsRuntime<'settings.plugins.tab'> - & PropsLocale<'settings.pluginInventory'> - & InjectFace - -type Translate = PluginInventorySettingsTabProps['t'] - -type ViewState = - | { readonly status: 'loading' } - | { readonly status: 'error' } - | { readonly status: 'ready'; readonly snapshot: PluginInventorySnapshot } - -const PHASE_KEYS = { - pending: 'pending', - loading: 'loadingPhase', - active: 'active', - failed: 'failed', - unloading: 'unloading', -} satisfies Record, PluginInventoryLocaleKey> - -/** Placeholder cards the loading skeleton lays out in the cards grid. */ -const SKELETON_CARDS = [0, 1, 2, 3] as const - -/** Localized accessible label for one root Fiber phase. */ -function phaseLabel(phase: PluginFiberPhase, t: Translate): string { - return phase === null ? t('unobserved') : t(PHASE_KEYS[phase]) -} - -/** Compact technical names for Settings without changing their module identity. */ -function moduleShortName(moduleName: string): string { - const unscoped = moduleName.startsWith('@') ? moduleName.slice(moduleName.indexOf('/') + 1) : moduleName - return unscoped - .replace(/^cordis:/, '') - .replace(/^cordis-plugin-/, '') - .replace(/^dsh-(?:host-|client-)?/, '') -} - -/** Display an entry identity without the composition-only `include:` marker. */ -function entrySubtitle(entryId: string): string { - return entryId.replace(/^include:/, '') -} - -/** Whether a card shows its entry id: the id exists and, without its `include:` marker, differs from the title. */ -function idAddsToTitle(entryId: string | null, title: string): entryId is string { - return entryId !== null && entrySubtitle(entryId) !== title -} - -/** Accessible card name: the title, the complete entry id when the card shows one, then the enablement state. */ -function cardLabel(title: string, entryId: string | null, state: string): string { - return idAddsToTitle(entryId, title) ? `${title}, ${entryId}, ${state}` : `${title}, ${state}` -} - -/** Preserve translated titles and shorten literal package or module name fallbacks in Settings. */ -function pluginText(row: PluginInventoryEntry | AgentPresetRow, resolveText: PluginInventorySettingsTabInjected['resolveText']) { - const title = row.meta?.title - return { - title: typeof title === 'object' ? resolveText(title) : moduleShortName(title ?? row.moduleName), - description: row.meta?.description === undefined ? undefined : resolveText(row.meta.description) || undefined, - } -} - -/** Search text of one row: its module and entry identities and every language of its title and description. */ -function searchKeys(row: PluginInventoryEntry | AgentPresetRow): SearchKeys { - return { - fuzzy: [row.moduleName, row.entryId ?? undefined, ...localizedValues(row.meta?.title)], - substring: localizedValues(row.meta?.description), - } -} - -/** The roster row shown when the preset switcher has no explicit choice. */ -function fallbackPreset(presets: readonly AgentPresetGroup[]): AgentPresetGroup | undefined { - return presets.find(preset => preset.isDefault) ?? presets[0] -} - -/** The switcher's display label for one preset. */ -function presetLabel(preset: AgentPresetGroup, t: Translate, presetName: (preset: AgentPresetGroup) => string): string { - const name = presetName(preset) - if (preset.broken !== undefined) return t('presetOptionBroken', { name }) - if (preset.isDefault) return t('presetOptionDefault', { name }) - return name -} - -/** One expandable plugin card; the caller owns the trailing status content. */ -function PluginCard({ - rowKey, moduleName, title, description, metadataError, entryId, trailing, ariaLabel, failed, expanded, onToggle, children, -}: { - readonly rowKey: string - readonly moduleName: string - readonly title: string - readonly description: string | undefined - readonly metadataError: string | undefined - readonly entryId: string | null - readonly trailing: ReactNode - readonly ariaLabel: string - readonly failed: boolean - readonly expanded: string | null - readonly onToggle: (key: string) => void - readonly children: ReactNode -}): ReactNode { - const open = expanded === rowKey - const detailId = `plugin-details-${encodeURIComponent(rowKey)}` - const descriptionId = useId() - return ( -
  • - - {metadataError === undefined ? null :

    {metadataError}

    } - {open ?
    {children}
    : null} -
  • - ) -} - -/** Detail rows shared by every card: the Loader identity, then labeled facts. */ -function CardFacts({ moduleName, moduleLabel, entryId, facts }: { - readonly moduleName: string - readonly moduleLabel: string - readonly entryId: string | null - readonly facts: readonly (readonly [label: string, value: ReactNode])[] -}): ReactNode { - return ( - <> - {entryId === null ? null : {entryId}} -
    -
    -
    {moduleLabel}
    -
    {moduleName}
    -
    - {facts.map(([label, value]) => ( -
    -
    {label}
    -
    {value}
    -
    - ))} -
    - - ) -} - -/* `pending` is the only dotted phase with no work under way. `loading` and - * `unloading` are both live transitions the Host is running — an async - * disposer can hold `unloading` for a while — so both animate. `active` and - * `failed` carry no dot: a settled enabled row needs no marker, and a failed - * row has the failure tag. */ -const PHASE_DOT_STATES = { - pending: 'idle', - loading: 'ongoing', - unloading: 'ongoing', -} as const satisfies Partial, StateDotState>> - -/** A live root-fiber phase the row marks with a dot. */ -type DotPhase = keyof typeof PHASE_DOT_STATES - -/** Whether a live root-fiber phase carries a dot of its own. */ -function showsPhaseDot(phase: PluginFiberPhase): phase is DotPhase { - return phase === 'pending' || phase === 'loading' || phase === 'unloading' -} - -/** Status dot naming a live root-fiber phase; rows without a dotted phase show none. */ -function PhaseDot({ phase, t }: { readonly phase: DotPhase; readonly t: Translate }): ReactNode { - const status = phaseLabel(phase, t) - /* StateDot is aria-hidden, so the phase name lives on this wrapper. */ - return ( - - - - ) -} - -/** Enablement states one inventory row can report. */ -type EnablementKind = 'enabled' | 'disabled' | 'conditional' | 'preset' | 'failed' - -const TAG_TONES = { - disabled: 'neutral', - conditional: 'warning', - preset: 'info', - failed: 'danger', -} as const satisfies Record, TagTone> - -/** Enablement tag for the states that depart from the default; a plainly enabled row carries none. */ -function StateTag({ kind, label }: { readonly kind: EnablementKind; readonly label: string }): ReactNode { - return kind === 'enabled' ? null : {label} -} - -/** Render the read-only plugin inventory: agent presets first, then the global plane. */ -export function PluginInventorySettingsTab( - { list, presetName, resolveText, t, useClientSync, retryClient }: PluginInventorySettingsTabProps, -): ReactNode { - const clientSync = useClientSync(snapshot => snapshot) - const sectionId = useId() - const [request, setRequest] = useState(0) - const [query, setQuery] = useState('') - const [expanded, setExpanded] = useState(null) - const [chosenPreset, setChosenPreset] = useState(null) - const [switcherOpen, setSwitcherOpen] = useState(false) - const [presetOpen, setPresetOpen] = useState(null) - const [globalOpen, setGlobalOpen] = useState(null) - const [state, setState] = useState({ status: 'loading' }) - - useEffect(() => { - let current = true - void Promise.resolve().then(() => list()).then( - (snapshot) => { if (current) setState({ status: 'ready', snapshot }) }, - () => { if (current) setState({ status: 'error' }) }, - ) - return () => { current = false } - }, [list, request]) - - const searching = query.trim().length > 0 - const snapshot = state.status === 'ready' ? state.snapshot : undefined - const presets = snapshot?.agentPresets ?? [] - const selected = presets.find(preset => preset.id === chosenPreset) ?? fallbackPreset(presets) - - /** Presets that actually enable a module, keyed by module name. */ - const enabledIn = useMemo(() => { - const found = new Map() - for (const preset of presets) { - for (const row of preset.rows) { - if (row.enabled !== true) continue - const groups = found.get(row.moduleName) - if (groups === undefined) found.set(row.moduleName, [preset]) - else if (!groups.includes(preset)) groups.push(preset) - } - } - return found - }, [presets]) - - const entries = snapshot?.entries ?? [] - // One index per list, built when the snapshot changes; typing only searches them. - const indexes = useMemo(() => { - const failed: PluginInventoryEntry[] = [] - const regular: PluginInventoryEntry[] = [] - for (const entry of snapshot?.entries ?? []) { - if (entry.fiberPhase === 'failed') failed.push(entry) - else regular.push(entry) - } - return { - failed: new TextSearchIndex(failed, searchKeys), - regular: new TextSearchIndex(regular, searchKeys), - presets: (snapshot?.agentPresets ?? []).map(preset => ({ preset, index: new TextSearchIndex(preset.rows, searchKeys) })), - } - }, [snapshot]) - const filteredFailed = indexes.failed.search(query) - const filteredRegular = indexes.regular.search(query) - const globalCount = filteredFailed.length + filteredRegular.length - const selectedRows = indexes.presets.find(({ preset }) => preset === selected)?.index.search(query) ?? [] - const otherMatches = searching - ? indexes.presets.flatMap(({ preset, index }) => preset === selected ? [] : [{ preset, count: index.search(query).length }]) - .filter(match => match.count > 0) - : [] - const otherPresetMatches = otherMatches.map(match => match.preset) - const otherMatchCount = otherMatches.reduce((total, match) => total + match.count, 0) - - // The preset group starts open and the larger global plane folded; a search opens both for as long as it lasts. - const presetEffectiveOpen = searching || (presetOpen ?? true) - const globalEffectiveOpen = searching || (globalOpen ?? false) - const nothingMatches = searching && globalCount === 0 && selectedRows.length === 0 - && otherPresetMatches.length === 0 - - const retry = (): void => { - setState({ status: 'loading' }) - setRequest(value => value + 1) - } - const toggleRow = (key: string): void => { - setExpanded(current => current === key ? null : key) - } - - /** Trailing status and detail facts for one row of the selected preset. */ - const presetRowCard = (preset: AgentPresetGroup, row: AgentPresetRow, index: number): ReactNode => { - const key = `preset:${preset.id}:${String(index)}` - const { title, description } = pluginText(row, resolveText) - const failed = row.fiberPhase === 'failed' - const stateText = failed - ? t('failedTag') - : row.enabled === true ? t('enabledTag') : row.enabled === false ? t('disabledTag') : t('conditionalTag') - const kind = failed ? 'failed' : row.enabled === true ? 'enabled' : row.enabled === false ? 'disabled' : 'conditional' - return ( - - {row.enabled === true && showsPhaseDot(row.fiberPhase) - ? - : null} - - - )} - > - {row.condition}] as const], - ]} - /> - - ) - } - - /** One global-plane row; a preset-provided row carries the presets that enable it. */ - const globalRowCard = ( - entry: PluginInventoryEntry, - providers?: readonly [AgentPresetGroup, ...AgentPresetGroup[]], - ): ReactNode => { - const key = `global:${entry.entryId}` - const { title, description } = pluginText(entry, resolveText) - const failed = entry.fiberPhase === 'failed' - const stateText = failed - ? t('failedTag') - : providers !== undefined ? t('presetEnabledTag') : t(entry.enabled ? 'enabledTag' : 'disabledTag') - const kind = failed ? 'failed' : providers !== undefined ? 'preset' : entry.enabled ? 'enabled' : 'disabled' - return ( - - {entry.enabled && showsPhaseDot(entry.fiberPhase) - ? - : null} - - - )} - > - presetName(preset)).join(' · ')], - ] - : [ - [t('configuration'), t(entry.enabled ? 'enabledTag' : 'disabledTag')], - ...entry.enabled ? [[t('runtime'), phaseLabel(entry.fiberPhase, t)] as const] : [], - ]} - /> - - ) - } - - return ( -
    - {clientSync.syncing ? ( -

    - {t('clientSyncing')} -

    - ) : null} - {clientSync.failures.length === 0 ? null : ( -
    -

    - {t('clientSyncFailed')} -

    -
      {clientSync.failures.map(failure =>
    • {failure.id}: {failure.message}
    • )}
    - -
    - )} - {state.status === 'loading' ? ( -
    - {t('loading')} - {SKELETON_CARDS.map(slot => ( - - ))} -
    - ) : null} - {state.status === 'error' ? ( -
    -

    - {t('error')} -

    - -
    - ) : null} - {snapshot !== undefined ? ( -
    - - {entries.length === 0 && presets.length === 0 ?

    {t('empty')}

    : null} - {nothingMatches ?

    {t('emptySearch')}

    : null} - - {selected !== undefined ? ( -
    -
    - -
    - { setSwitcherOpen(false) }} - items={presets.map(preset => ({ id: preset.id, label: presetLabel(preset, t, presetName) }))} - selectedId={selected.id} - onSelect={(id) => { - setSwitcherOpen(false) - setChosenPreset(id) - }} - align="end" - portal - anchor={( - - )} - /> -
    -
    -

    {t('presetSubtitle')}

    - {presetEffectiveOpen ? ( -
    - {selected.broken !== undefined ? ( -

    {selected.broken}

    - ) : null} - {selectedRows.length > 0 ? ( -
      - {selectedRows.map((row, index) => presetRowCard(selected, row, index))} -
    - ) : null} - {otherMatchCount > 0 ? ( -

    - {t('matchesInOtherPresets', { count: String(otherMatchCount) })} - {otherPresetMatches.map(preset => ( - - ))} -

    - ) : null} -
    - ) : null} -
    - ) : null} - - {entries.length > 0 ? ( -
    -
    - -
    -

    {t('globalSubtitle')}

    - {globalEffectiveOpen && globalCount > 0 ? ( -
      - {filteredFailed.map(entry => globalRowCard(entry))} - {filteredRegular.map(entry => globalRowCard( - entry, - entry.enabled ? undefined : enabledIn.get(entry.moduleName), - ))} -
    - ) : null} -
    - ) : null} -
    - ) : null} -
    - ) -} diff --git a/packages/client/ui-settings-plugin-inventory/src/client/index.ts b/packages/client/ui-settings-plugin-inventory/src/client/index.ts deleted file mode 100644 index acb324117a..0000000000 --- a/packages/client/ui-settings-plugin-inventory/src/client/index.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** Read-only Host plugin inventory registered into Web Settings. */ - -import type {} from '@deepseek-ai/dsh-client-locale/client' -import type {} from '@deepseek-ai/dsh-client-modules/client' -import type { Context as ClientContext } from '@deepseek-ai/cordis' -import type {} from '@deepseek-ai/dsh-client-ui-settings/client' -import type {} from '@deepseek-ai/dsh-client-ui-renderer/client' -// Type-only: pulls the 'settings.agentPreset' LocaleNamespaceMap merge, whose -// dictionaries the shipped-preset name resolution below reads. -import type {} from '@deepseek-ai/dsh-client-ui-agent-preset/client' -// Inline-safe shared fold: shipped ids map to dictionary keys in one home. -import { presetDisplayText } from '@deepseek-ai/dsh-agent-preset-registry/display' -import { PluginInventorySettingsTab, type PluginInventorySettingsTabInjected } from './PluginInventorySettingsTab.tsx' -import { en, ja, es, fr, de, ru, pt, zh, type PluginInventoryLocaleKey } from './locales.ts' - -export type { PluginInventorySettingsTabInjected, PluginInventorySettingsTabProps } from './PluginInventorySettingsTab.tsx' -export type { PluginInventoryLocaleKey } from './locales.ts' - -declare module '@deepseek-ai/dsh-client-ui-slots' { - interface LocaleNamespaceMap { - /** Read-only Host plugin inventory copy. */ - 'settings.pluginInventory': PluginInventoryLocaleKey - } -} - -/** Dictionary namespace owned by this plugin. */ -export const NS = 'settings.pluginInventory' - -/** Services required by the Settings registration and generated Remote face. */ -export const inject = ['slots', 'locale', 'remote', 'remote.pluginInventory', 'modules'] - -/** Contribute the lazy inventory tab to the Plugins settings section. */ -export function apply(ctx: ClientContext): void { - ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'ui-settings-plugin-inventory: dictionaries') - - const t = ctx.locale.bind(NS) - const list: PluginInventorySettingsTabInjected['list'] = async () => { - const result = await ctx.remote.pluginInventory.list() - if (!result.ok) { - throw new Error(`pluginInventory.list failed: ${result.error.code}: ${result.error.message}`) - } - return result.value - } - // Resolved per call over ui-agent-preset's dictionaries, so a language - // switch re-resolves shipped names; user-authored metadata passes through. - const agentPresetCopy = ctx.locale.bind('settings.agentPreset') - const presetName: PluginInventorySettingsTabInjected['presetName'] = preset => - presetDisplayText(preset, agentPresetCopy).name - const injected = (): PluginInventorySettingsTabInjected => ({ - list, presetName, - resolveText: text => ctx.locale.resolveText(text), - hooks: { clientSync: ctx.modules.entries.state }, - retryClient: () => { void ctx.modules.entries.retry().catch((error: unknown) => { ctx.logger.error(error) }) }, - }) - - ctx.slots.inject('settings.plugins.tab', () => ctx.slots.register({ - name: 'settings.plugins.tab', - id: 'all', - order: 10, - label: () => t('tab'), - locale: NS, - inject: injected, - }, PluginInventorySettingsTab)) -} diff --git a/packages/client/ui-settings-plugin-inventory/src/client/locales.ts b/packages/client/ui-settings-plugin-inventory/src/client/locales.ts deleted file mode 100644 index d0d7480472..0000000000 --- a/packages/client/ui-settings-plugin-inventory/src/client/locales.ts +++ /dev/null @@ -1,332 +0,0 @@ -/** Copy dictionaries for the plugin inventory Settings section. */ - -/** Simplified Chinese dictionary and key source of truth. */ -export const zh = { - tab: '插件列表', - loading: '正在读取插件…', - clientSyncing: '正在同步本页面的插件…', - clientSyncFailed: '本页面的插件未能完成同步;服务端的启用状态保持不变。', - clientSyncRetry: '重试本页面同步', - error: '暂时无法读取插件。', - metadataError: '包元信息错误:{error}', - retry: '重试', - search: '搜索插件', - empty: '暂无插件。', - emptySearch: '没有匹配的插件。', - presetTitle: '会话插件', - presetSubtitle: '由 Agent 预设按会话组成', - switcherLabel: '选择要查看的 Agent 预设', - presetOptionDefault: '{name}(默认)', - presetOptionBroken: '{name}(加载失败)', - globalTitle: '全局插件', - globalSubtitle: '系统与所有会话共用', - presetProvidedDetail: '全局已停用,由 Agent 预设按会话提供', - enabledIn: '启用于', - matchesInOtherPresets: '其他预设中还有 {count} 个匹配:', - enabledTag: '已启用', - disabledTag: '已停用', - conditionalTag: '条件启用', - presetEnabledTag: '预设中启用', - failedTag: '启动失败', - moduleLabel: '完整名称', - fromPreset: '来自', - condition: '禁用条件', - configuration: '配置状态', - runtime: '运行状态', - unobserved: '未运行', - pending: '等待依赖', - loadingPhase: '加载中', - active: '运行中', - failed: '启动失败', - unloading: '卸载中', -} satisfies Record - -/** Plugin inventory locale key union. */ -export type PluginInventoryLocaleKey = keyof typeof zh - -/** English dictionary checked against the Chinese key set. */ -export const en = { - tab: 'Plugin list', - loading: 'Reading plugins…', - clientSyncing: 'Syncing plugins on this page…', - clientSyncFailed: 'Some plugins could not sync on this page. Host enablement is unchanged.', - clientSyncRetry: 'Retry this page', - error: 'Plugins are temporarily unavailable.', - metadataError: 'Package metadata error: {error}', - retry: 'Retry', - search: 'Search plugins', - empty: 'No plugins are available.', - emptySearch: 'No matching plugins.', - presetTitle: 'Session plugins', - presetSubtitle: 'Composed per session by agent presets', - switcherLabel: 'Choose the agent preset to inspect', - presetOptionDefault: '{name} (default)', - presetOptionBroken: '{name} (failed to load)', - globalTitle: 'Global plugins', - globalSubtitle: 'Shared by the system and every session', - presetProvidedDetail: 'Disabled globally; agent presets provide it per session', - enabledIn: 'Enabled in', - matchesInOtherPresets: '{count} more matches in other presets: ', - enabledTag: 'Enabled', - disabledTag: 'Disabled', - conditionalTag: 'Conditional', - presetEnabledTag: 'Via presets', - failedTag: 'Failed', - moduleLabel: 'Module', - fromPreset: 'From', - condition: 'Disabled when', - configuration: 'Configuration', - runtime: 'Status', - unobserved: 'Not running', - pending: 'Waiting for dependencies', - loadingPhase: 'Loading', - active: 'Running', - failed: 'Failed to start', - unloading: 'Unloading', -} satisfies Record - -/** Japanese copy, checked against the English keys. */ -export const ja = { - 'tab': 'プラグイン一覧', - 'loading': 'プラグインを読み込み中…', - 'clientSyncing': 'このページでプラグインを同期中…', - 'clientSyncFailed': '一部のプラグインをこのページで同期できませんでした。ホスト側の有効化状態は変更されていません。', - 'clientSyncRetry': 'このページを再試行', - 'error': 'プラグインは一時的に利用できません。', - 'metadataError': 'パッケージメタデータのエラー: {error}', - 'retry': '再試行', - 'search': 'プラグインを検索', - 'empty': '利用可能なプラグインはありません。', - 'emptySearch': '一致するプラグインはありません。', - 'presetTitle': 'セッションプラグイン', - 'presetSubtitle': 'エージェントプリセットによりセッションごとに構成されます', - 'switcherLabel': '確認するエージェントプリセットを選択', - 'presetOptionDefault': '{name} (デフォルト)', - 'presetOptionBroken': '{name} (読み込み失敗)', - 'globalTitle': 'グローバルプラグイン', - 'globalSubtitle': 'システムとすべてのセッションで共有', - 'presetProvidedDetail': 'グローバルでは無効。エージェントプリセットがセッションごとに提供します', - 'enabledIn': '有効化先', - 'matchesInOtherPresets': '他のプリセットにさらに{count}件一致: ', - 'enabledTag': '有効', - 'disabledTag': '無効', - 'conditionalTag': '条件付き', - 'presetEnabledTag': 'プリセット経由', - 'failedTag': '失敗', - 'moduleLabel': 'モジュール', - 'fromPreset': '提供元', - 'condition': '無効になる条件', - 'configuration': '構成', - 'runtime': 'ステータス', - 'unobserved': '停止中', - 'pending': '依存関係の待機中', - 'loadingPhase': '読み込み中', - 'active': '実行中', - 'failed': '起動に失敗', - 'unloading': 'アンロード中', -} satisfies Record - -/** Spanish dictionary, checked against the English keys. */ -export const es = { - tab: 'Lista de complementos', - loading: 'Leyendo complementos…', - clientSyncing: 'Sincronizando complementos en esta página…', - clientSyncFailed: 'Algunos complementos no se pudieron sincronizar en esta página. La habilitación del host no ha cambiado.', - clientSyncRetry: 'Reintentar esta página', - error: 'Los complementos no están disponibles temporalmente.', - metadataError: 'Error de metadatos del paquete: {error}', - retry: 'Reintentar', - search: 'Complementos de búsqueda', - empty: 'No hay complementos disponibles.', - emptySearch: 'No hay complementos coincidentes.', - presetTitle: 'Complementos de sesión', - presetSubtitle: 'Compuesto por sesión por ajustes preestablecidos de agente', - switcherLabel: 'Elija el agente preestablecido para inspeccionar', - presetOptionDefault: '{name} (predeterminado)', - presetOptionBroken: '{name} (no se pudo cargar)', - globalTitle: 'Complementos globales', - globalSubtitle: 'Compartido por el sistema y cada sesión.', - presetProvidedDetail: 'Discapacitados a nivel mundial; Los ajustes preestablecidos del agente lo proporcionan por sesión.', - enabledIn: 'Habilitado en', - matchesInOtherPresets: '{count} más coincidencias en otros ajustes preestablecidos: ', - enabledTag: 'Habilitado', - disabledTag: 'Discapacitado', - conditionalTag: 'Condicional', - presetEnabledTag: 'A través de ajustes preestablecidos', - failedTag: 'Fallido', - moduleLabel: 'Módulo', - fromPreset: 'De', - condition: 'Deshabilitado cuando', - configuration: 'Configuración', - runtime: 'Estado', - unobserved: 'no corriendo', - pending: 'Esperando dependencias', - loadingPhase: 'Cargando', - active: 'corriendo', - failed: 'No se pudo iniciar', - unloading: 'Descarga', -} satisfies Record - -/** French dictionary, checked against the English keys. */ -export const fr = { - tab: 'Liste des plugins', - loading: 'Plugins de lecture…', - clientSyncing: 'Synchronisation des plugins sur cette page…', - clientSyncFailed: "Certains plugins n'ont pas pu se synchroniser sur cette page. L'activation de l'hôte est inchangée.", - clientSyncRetry: 'Réessayez cette page', - error: 'Les plugins sont temporairement indisponibles.', - metadataError: 'Erreur de métadonnées du package : {error}', - retry: 'Réessayer', - search: 'Plugins de recherche', - empty: "Aucun plugin n'est disponible.", - emptySearch: 'Aucun plugin correspondant.', - presetTitle: 'Plugins de sessions', - presetSubtitle: "Composé par session par préréglages d'agent", - switcherLabel: "Choisissez le préréglage d'agent à inspecter", - presetOptionDefault: '{name} (par défaut)', - presetOptionBroken: '{name} (échec du chargement)', - globalTitle: 'Plugins globaux', - globalSubtitle: 'Partagé par le système et à chaque session', - presetProvidedDetail: "Handicapé à l'échelle mondiale ; les préréglages d'agent le fournissent par session", - enabledIn: 'Activé dans', - matchesInOtherPresets: "{count} plus de correspondances dans d'autres préréglages : ", - enabledTag: 'Activé', - disabledTag: 'Désactivé', - conditionalTag: 'Conditionnel', - presetEnabledTag: 'Via les préréglages', - failedTag: 'Échec', - moduleLabel: 'Module', - fromPreset: 'De', - condition: 'Désactivé quand', - configuration: 'Configuration', - runtime: 'Statut', - unobserved: 'Ne fonctionne pas', - pending: 'En attente de dépendances', - loadingPhase: 'Chargement', - active: 'Courir', - failed: 'Échec du démarrage', - unloading: 'Déchargement', -} satisfies Record - -/** German dictionary, checked against the English keys. */ -export const de = { - tab: 'Plugin-Liste', - loading: 'Plugins lesen…', - clientSyncing: 'Plugins auf dieser Seite werden synchronisiert…', - clientSyncFailed: 'Einige Plugins konnten auf dieser Seite nicht synchronisiert werden. Die Host-Aktivierung bleibt unverändert.', - clientSyncRetry: 'Versuchen Sie es erneut mit dieser Seite', - error: 'Plugins sind vorübergehend nicht verfügbar.', - metadataError: 'Paketmetadatenfehler: {error}', - retry: 'Erneut versuchen', - search: 'Such-Plugins', - empty: 'Es sind keine Plugins verfügbar.', - emptySearch: 'Keine passenden Plugins.', - presetTitle: 'Sitzungs-Plugins', - presetSubtitle: 'Zusammengestellt pro Sitzung nach Agentenvoreinstellungen', - switcherLabel: 'Wählen Sie die zu überprüfende Agentenvoreinstellung aus', - presetOptionDefault: '{name} (Standard)', - presetOptionBroken: '{name} (Laden fehlgeschlagen)', - globalTitle: 'Globale Plugins', - globalSubtitle: 'Wird vom System und jeder Sitzung geteilt', - presetProvidedDetail: 'Weltweit deaktiviert; Agentenvoreinstellungen stellen es pro Sitzung bereit', - enabledIn: 'Aktiviert in', - matchesInOtherPresets: '{count} weitere Übereinstimmungen in anderen Voreinstellungen: ', - enabledTag: 'Aktiviert', - disabledTag: 'Deaktiviert', - conditionalTag: 'Bedingt', - presetEnabledTag: 'Über Voreinstellungen', - failedTag: 'Fehlgeschlagen', - moduleLabel: 'Modul', - fromPreset: 'Von', - condition: 'Deaktiviert, wenn', - configuration: 'Konfiguration', - runtime: 'Status', - unobserved: 'Läuft nicht', - pending: 'Warten auf Abhängigkeiten', - loadingPhase: 'Laden', - active: 'Laufen', - failed: 'Start fehlgeschlagen', - unloading: 'Entladen', -} satisfies Record - -/** Russian dictionary, checked against the English keys. */ -export const ru = { - tab: 'Список плагинов', - loading: 'Чтение плагинов…', - clientSyncing: 'Синхронизация плагинов на этой странице…', - clientSyncFailed: 'Некоторые плагины не смогли синхронизироваться на этой странице. Включение хоста не изменилось.', - clientSyncRetry: 'Повторить эту страницу', - error: 'Плагины временно недоступны.', - metadataError: 'Ошибка метаданных пакета: {error}.', - retry: 'Повторить', - search: 'Поиск плагинов', - empty: 'Нет доступных плагинов.', - emptySearch: 'Нет подходящих плагинов.', - presetTitle: 'Плагины сеансов', - presetSubtitle: 'Составляется за сеанс с помощью предустановок агента', - switcherLabel: 'Выберите предустановку агента для проверки', - presetOptionDefault: '{name} (по умолчанию)', - presetOptionBroken: '{name} (не удалось загрузить)', - globalTitle: 'Глобальные плагины', - globalSubtitle: 'Совместно используется системой и каждым сеансом', - presetProvidedDetail: 'Отключено глобально; предустановки агента предусматривают это за сеанс', - enabledIn: 'Включено в', - matchesInOtherPresets: '{count} больше совпадений в других пресетах: ', - enabledTag: 'Включено', - disabledTag: 'Отключено', - conditionalTag: 'Условный', - presetEnabledTag: 'Через пресеты', - failedTag: 'Не удалось', - moduleLabel: 'Модуль', - fromPreset: 'От', - condition: 'Отключено, когда', - configuration: 'Конфигурация', - runtime: 'Статус', - unobserved: 'Не работает', - pending: 'Ожидание зависимостей', - loadingPhase: 'Загрузка', - active: 'Бег', - failed: 'Не удалось запустить', - unloading: 'Разгрузка', -} satisfies Record - -/** Portuguese dictionary, checked against the English keys. */ -export const pt = { - tab: 'Lista de plug-ins', - loading: 'Lendo plug-ins…', - clientSyncing: 'Sincronizando plug-ins nesta página…', - clientSyncFailed: 'Alguns plug-ins não puderam ser sincronizados nesta página. A ativação do host permanece inalterada.', - clientSyncRetry: 'Tente esta página novamente', - error: 'Os plug-ins estão temporariamente indisponíveis.', - metadataError: 'Erro de metadados do pacote: {error}', - retry: 'Tentar novamente', - search: 'Plug-ins de pesquisa', - empty: 'Nenhum plug-in está disponível.', - emptySearch: 'Nenhum plug-in correspondente.', - presetTitle: 'Plug-ins de sessão', - presetSubtitle: 'Composto por sessão por predefinições de agente', - switcherLabel: 'Escolha a predefinição do agente para inspecionar', - presetOptionDefault: '{name} (padrão)', - presetOptionBroken: '{name} (falha ao carregar)', - globalTitle: 'Plug-ins globais', - globalSubtitle: 'Compartilhado pelo sistema e por cada sessão', - presetProvidedDetail: 'Desativado globalmente; predefinições de agente fornecem isso por sessão', - enabledIn: 'Habilitado em', - matchesInOtherPresets: '{count} mais correspondências em outras predefinições: ', - enabledTag: 'Habilitado', - disabledTag: 'Desativado', - conditionalTag: 'Condicional', - presetEnabledTag: 'Por meio de predefinições', - failedTag: 'Falha', - moduleLabel: 'Módulo', - fromPreset: 'De', - condition: 'Desativado quando', - configuration: 'Configuração', - runtime: 'Estado', - unobserved: 'Não está em execução', - pending: 'Esperando por dependências', - loadingPhase: 'Carregando', - active: 'Correndo', - failed: 'Falha ao iniciar', - unloading: 'Descarregando', -} satisfies Record diff --git a/packages/client/ui-settings-plugin-inventory/src/css-modules.d.ts b/packages/client/ui-settings-plugin-inventory/src/css-modules.d.ts deleted file mode 100644 index bc5e482353..0000000000 --- a/packages/client/ui-settings-plugin-inventory/src/css-modules.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module '*.module.css' { - const classes: Record - export default classes -} - -declare module '*.css' diff --git a/packages/client/ui-settings-plugin-inventory/src/index.ts b/packages/client/ui-settings-plugin-inventory/src/index.ts deleted file mode 100644 index 473386a9ec..0000000000 --- a/packages/client/ui-settings-plugin-inventory/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** Host loader entry for the inventory-tab browser implementation exported from `./client`. */ - -/** Host plugin body — no host-side behavior for the plugin inventory tab. */ -export function apply(): void {} diff --git a/packages/client/ui-settings-plugin-inventory/tests/browser-plugin.client.spec.tsx b/packages/client/ui-settings-plugin-inventory/tests/browser-plugin.client.spec.tsx deleted file mode 100644 index ea3d8ade8c..0000000000 --- a/packages/client/ui-settings-plugin-inventory/tests/browser-plugin.client.spec.tsx +++ /dev/null @@ -1,120 +0,0 @@ -// @vitest-environment jsdom -import { createSnapshotStore } from '@deepseek-ai/dsh-client-store' -import type { ClientModuleLoader } from '@deepseek-ai/dsh-client-modules/client' -import { Context, Service } from '@deepseek-ai/cordis' -import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest' -import { cleanup } from '@testing-library/react' -import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' -import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client' -import { resolveSlotLabel } from '@deepseek-ai/dsh-client-ui-slots' -import { usePinnedBrowserLanguages } from '@deepseek-ai/dsh-client-test-runtime' -import { apply, inject, NS } from '../src/client/index.ts' -import { PluginInventorySettingsTab } from '../src/client/PluginInventorySettingsTab.tsx' -import type { PluginInventorySettingsTabInjected } from '../src/client/PluginInventorySettingsTab.tsx' -import { apply as hostApply } from '../src/index.ts' - -usePinnedBrowserLanguages('zh-CN') -afterEach(cleanup) - -const EMPTY = { entries: [] } -type ListResult = - | { readonly ok: true; readonly value: typeof EMPTY } - | { readonly ok: false; readonly error: { readonly code: string; readonly message: string } } - -async function bench() { - const ctx = new Context() - onTestFinished(async () => { await ctx.fiber.dispose() }) - const retryClient = vi.fn(async () => {}) - ctx.provide('modules', { entries: { state: createSnapshotStore({ syncing: false, failures: [] }), retry: retryClient } } as unknown as ClientModuleLoader) - await ctx.plugin(SlotRegistry).await() - const locale = new LocaleRuntime(ctx) - ctx.provide('locale', locale) - class RemoteService extends Service { - constructor(serviceCtx: Context) { - super(serviceCtx, 'remote') - } - } - new RemoteService(ctx) - const list = vi.fn<() => Promise>() - .mockResolvedValue({ ok: true, value: EMPTY }) - ctx.provide('remote.pluginInventory', { list }) - return { ctx, retryClient, slots: ctx.get('slots') as SlotRegistry, locale, list } -} - -function declare(slots: SlotRegistry): () => void { - return slots.register({ - name: 'root', - children: { 'settings.plugins.tab': { kind: 'list', scope: 'root' } }, - } as never, () => null) -} - -describe('ui-settings-plugin-inventory browser plugin', () => { - it('keeps the host Loader entry inert', () => { - expect(hostApply).not.toThrow() - }) - - it('declares only the services used by the Settings Remote contribution', () => { - expect(inject).toEqual(['slots', 'locale', 'remote', 'remote.pluginInventory', 'modules']) - }) - - it('registers a localized tab without reading the Remote eagerly', async () => { - const b = await bench() - declare(b.slots) - await b.ctx.plugin({ inject: [...inject], apply }).await() - - const entry = b.slots.entries('settings.plugins.tab')[0]! - expect(entry.component).toBe(PluginInventorySettingsTab) - expect(entry.options).toMatchObject({ id: 'all', order: 10 }) - expect(entry.locale).toBe(NS) - expect(resolveSlotLabel(entry.options.label)).toBe('插件列表') - expect(b.list).not.toHaveBeenCalled() - - const injected = (entry.inject as unknown as () => PluginInventorySettingsTabInjected)() - const text = { en: 'Local tools', zh: '本地工具' } - expect(injected.resolveText(text)).toBe('本地工具') - b.locale.setLocale('en') - expect(injected.resolveText(text)).toBe('Local tools') - b.locale.setLocale('zh') - injected.retryClient() - const retryError = vi.spyOn(b.ctx.logger, 'error').mockImplementation(() => {}) - b.retryClient.mockRejectedValueOnce(new Error('retry unavailable')) - injected.retryClient() - await vi.waitFor(() => { expect(retryError).toHaveBeenCalled() }) - retryError.mockRestore() - await expect(injected.list()).resolves.toEqual(EMPTY) - expect(b.list).toHaveBeenCalledOnce() - b.list.mockResolvedValueOnce({ ok: false, error: { code: 'REMOTE_ERROR', message: 'unavailable' } }) - await expect(injected.list()).rejects.toThrow('pluginInventory.list failed: REMOTE_ERROR: unavailable') - - // Shipped preset names resolve over the agent-preset dictionaries the - // real plugin registers; user-authored metadata stays untranslated. - b.locale.register('settings.agentPreset', 'zh', { presetStandardName: '标准模式' } as never) - expect(injected.presetName({ id: 'standard', isDefault: true, rows: [] })).toBe('标准模式') - expect(injected.presetName({ id: 'mine', name: '我自己的', isDefault: false, rows: [] })).toBe('我自己的') - await b.ctx.fiber.dispose() - }) - - it('follows locale and recovers across late declaration and declarer reload', async () => { - const b = await bench() - const fiber = b.ctx.plugin({ inject: [...inject], apply }) - await fiber.await() - expect(b.slots.entries('settings.plugins.tab')).toHaveLength(0) - - const stop = declare(b.slots) - await vi.waitFor(() => { expect(b.slots.entries('settings.plugins.tab')).toHaveLength(1) }) - b.locale.setLocale('en') - expect(resolveSlotLabel(b.slots.entries('settings.plugins.tab')[0]!.options.label)).toBe('Plugin list') - - stop() - expect(b.slots.entries('settings.plugins.tab')).toHaveLength(0) - declare(b.slots) - await vi.waitFor(() => { - expect(b.slots.entries('settings.plugins.tab')[0]?.component).toBe(PluginInventorySettingsTab) - }) - - await fiber.dispose() - expect(b.slots.entries('settings.plugins.tab')).toHaveLength(0) - expect(() => b.locale.register(NS, 'zh', {})).not.toThrow() - await b.ctx.fiber.dispose() - }) -}) diff --git a/packages/client/ui-settings-plugin-inventory/tests/components.client.spec.tsx b/packages/client/ui-settings-plugin-inventory/tests/components.client.spec.tsx deleted file mode 100644 index a9741a9957..0000000000 --- a/packages/client/ui-settings-plugin-inventory/tests/components.client.spec.tsx +++ /dev/null @@ -1,669 +0,0 @@ -// @vitest-environment jsdom -import { createSnapshotStore } from '@deepseek-ai/dsh-client-store' -import type { ClientEntryState } from '@deepseek-ai/dsh-client-modules/client' -import type { PluginEntryId } from '@deepseek-ai/dsh-api-remotes/client' -import { Context } from '@deepseek-ai/cordis' -import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' -import { bindSnapshotSelector } from '@deepseek-ai/dsh-client-test-runtime' -import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react' -import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest' -import { PluginInventorySettingsTab } from '../src/client/PluginInventorySettingsTab.tsx' -import type { - PluginInventorySettingsTabInjected, - PluginInventorySettingsTabProps, -} from '../src/client/PluginInventorySettingsTab.tsx' -import { en, zh, type PluginInventoryLocaleKey } from '../src/client/locales.ts' - -afterEach(cleanup) - -type Snapshot = Awaited> -const t = ((key: PluginInventoryLocaleKey, params?: Record): string => - Object.entries(params ?? {}).reduce( - (text, [name, value]) => text.replaceAll(`{${name}}`, value), - en[key], - )) as PluginInventorySettingsTabProps['t'] - -function props( - list: PluginInventorySettingsTabInjected['list'], - presetName: PluginInventorySettingsTabInjected['presetName'] = preset => preset.name ?? preset.id, - resolveText: PluginInventorySettingsTabInjected['resolveText'] = text => typeof text === 'string' ? text : text.en, -): PluginInventorySettingsTabProps { - return { - t, - list, - presetName, - resolveText, - useClientSync: bindSnapshotSelector(createSnapshotStore({ syncing: false, failures: [] })), - retryClient: vi.fn(), - } as PluginInventorySettingsTabProps -} - -function localizedProps(list: PluginInventorySettingsTabInjected['list']) { - const ctx = new Context() - onTestFinished(async () => { await ctx.fiber.dispose() }) - const locale = new LocaleRuntime(ctx) - ctx.effect(() => locale.register('settings.pluginInventory', 'en', en), 'test: English inventory dictionary') - ctx.effect(() => locale.register('settings.pluginInventory', 'zh', zh), 'test: Chinese inventory dictionary') - locale.setLocale('en') - const pageProps: PluginInventorySettingsTabProps = { - ...props(list, preset => preset.name ?? preset.id, text => locale.resolveText(text)), - t: locale.bind('settings.pluginInventory'), - } - return { locale, pageProps } -} - -/** A deployment with a roster: one failed global row, two preset-provided rows. */ -const SNAPSHOT = { - entries: [ - { entryId: 'telemetry', moduleName: '@fixture/telemetry', enabled: true, fiberPhase: 'failed' }, - { entryId: 'timer', moduleName: 'cordis:timer', enabled: true, fiberPhase: 'active' }, - { entryId: '8a1b2c3d', moduleName: '@deepseek-ai/cordis-plugin-hmr', enabled: true, fiberPhase: 'active' }, - { entryId: 'unobserved', moduleName: '@fixture/unobserved-name', enabled: true, fiberPhase: null }, - { entryId: 'bash-host', moduleName: '@deepseek-ai/dsh-tool-bash', enabled: false, fiberPhase: null }, - { entryId: 'fs-host', moduleName: '@deepseek-ai/dsh-tool-fs', enabled: false, fiberPhase: null }, - { entryId: 'dormant', moduleName: '@fixture/dormant', enabled: false, fiberPhase: null }, - ], - agentPresets: [ - { - id: 'standard', - name: '标准模式', - isDefault: true, - rows: [ - { entryId: 'bash', moduleName: '@deepseek-ai/dsh-tool-bash', enabled: true, fiberPhase: 'active' }, - { entryId: 'fs', moduleName: '@deepseek-ai/dsh-tool-fs', enabled: true, fiberPhase: null }, - { - entryId: 'pwsh', - moduleName: '@fixture/pwsh', - enabled: 'conditional', - condition: 'process.platform === \'win32\'', - fiberPhase: null, - }, - { entryId: 'codex', moduleName: '@fixture/codex', enabled: false, fiberPhase: null }, - { entryId: 'crashy', moduleName: '@fixture/crashy', enabled: true, fiberPhase: 'failed' }, - { entryId: null, moduleName: '@fixture/anonymous', enabled: true, fiberPhase: null }, - ], - }, - { - id: 'ptc', - isDefault: false, - rows: [ - { entryId: 'bash', moduleName: '@deepseek-ai/dsh-tool-bash', enabled: true, fiberPhase: null }, - { entryId: 'bash-fork', moduleName: '@deepseek-ai/dsh-tool-bash', enabled: true, fiberPhase: null }, - { entryId: 'fs', moduleName: '@deepseek-ai/dsh-tool-fs', enabled: 'conditional', fiberPhase: null }, - ], - }, - { id: 'shattered', name: '坏预设', isDefault: false, broken: 'the composition file is missing', rows: [] }, - ], -} as unknown as Snapshot - -async function renderReady(snapshot: Snapshot = SNAPSHOT): Promise> { - const view = render( snapshot)} />) - await screen.findByRole('searchbox', { name: en.search }) - return view -} - -const globalToggle = (): HTMLElement => - screen.getByRole('button', { name: (name: string) => name.startsWith(en.globalTitle) }) -const presetToggle = (): HTMLElement => screen.getByRole('button', { name: en.presetTitle }) - -describe('PluginInventorySettingsTab', () => { - it.each(['global', 'preset'])('shortens package and module name fallbacks in the %s inventory', async (scope) => { - const names = [ - ['@deepseek-ai/dsh-tool-subagent', 'tool-subagent'], - ['@deepseek-ai/dsh-host-web', 'web'], - ['@deepseek-ai/dsh-client-tabs', 'tabs'], - ['@deepseek-ai/cordis-plugin-hmr', 'hmr'], - ['cordis:timer', 'timer'], - ['@acme/dsh-sidebar/navigation', 'sidebar/navigation'], - ['plain-plugin', 'plain-plugin'], - ] as const - const rows = names.flatMap(([moduleName], index) => [false, true].map(fromManifest => ({ - entryId: `include:short-${String(index)}-${String(fromManifest)}` as PluginEntryId, - moduleName, - enabled: true, - fiberPhase: null, - ...fromManifest ? { meta: { title: moduleName, description: 'Package description.' } } : {}, - }))) - const snapshot: Snapshot = scope === 'global' - ? { entries: rows } - : { entries: [], agentPresets: [{ id: 'custom', isDefault: true, rows }] } - const view = await renderReady(snapshot) - if (scope === 'global') fireEvent.click(globalToggle()) - for (const [index, [moduleName, title]] of names.entries()) { - for (const fromManifest of [false, true]) { - const entryId = `include:short-${String(index)}-${String(fromManifest)}` - const card = screen.getByRole('button', { name: `${title}, ${entryId}, Enabled` }) - if (fromManifest) { - expect(document.getElementById(card.getAttribute('aria-describedby')!)?.textContent).toBe('Package description.') - } - fireEvent.click(card) - expect(screen.getByText(en.moduleLabel).nextElementSibling?.textContent).toBe(moduleName) - expect(view.container.querySelector('[data-loader-entry]')?.textContent).toBe(entryId) - fireEvent.click(card) - } - } - fireEvent.change(screen.getByRole('searchbox', { name: en.search }), { - target: { value: '@deepseek-ai/dsh-tool-subagent' }, - }) - expect(screen.getAllByRole('listitem')).toHaveLength(2) - expect(screen.getAllByRole('button', { name: /^tool-subagent, include:short-0-/ })).toHaveLength(2) - }) - - it('keeps authored locale titles verbatim when they resemble module names', async () => { - const { locale, pageProps } = localizedProps(async () => ({ - entries: [{ - entryId: 'include:navigation' as PluginEntryId, moduleName: '@acme/dsh-navigation', enabled: true, fiberPhase: null, - meta: { title: { en: 'dsh-Navigation', zh: 'dsh-导航' } }, - }], - })) - const view = render() - await screen.findByRole('searchbox', { name: en.search }) - fireEvent.click(globalToggle()) - expect(screen.getByRole('button', { name: 'dsh-Navigation, include:navigation, Enabled' })).toBeTruthy() - locale.setLocale('zh') - view.rerender() - expect(screen.getByRole('button', { name: 'dsh-导航, include:navigation, 已启用' })).toBeTruthy() - }) - - it('localizes global and preset metadata at render time while preserving identities and query state', async () => { - const globalError = 'locale/zh.json: invalid title' - const presetError = 'locale/fr.json: invalid description' - const snapshot: Snapshot = { - entries: [{ - entryId: 'include:global-navigation' as PluginEntryId, moduleName: '@acme/navigation', enabled: true, fiberPhase: 'active', - meta: { - title: { en: 'Navigation', zh: '导航' }, - description: { en: 'Global navigation controls', zh: '全局导航控件' }, - error: globalError, - }, - }], - agentPresets: [{ - id: 'custom', name: 'My preset', isDefault: true, - rows: [{ - entryId: 'include:preset-runner', moduleName: '@acme/runner', enabled: true, fiberPhase: null, - meta: { - title: { en: 'Session runner', zh: '会话执行器' }, - description: { en: 'Run per session', zh: '运行会话命令' }, - error: presetError, - }, - }], - }], - } - const list = vi.fn(async () => snapshot) - const { locale, pageProps } = localizedProps(list) - const view = render() - await screen.findByRole('searchbox', { name: en.search }) - expect(screen.getByText(en.presetSubtitle).textContent).toBe(en.presetSubtitle) - expect(screen.getByText(en.globalSubtitle).textContent).toBe(en.globalSubtitle) - fireEvent.click(globalToggle()) - const global = screen.getByRole('button', { name: 'Navigation, include:global-navigation, Enabled' }) - const preset = screen.getByRole('button', { name: 'Session runner, include:preset-runner, Enabled' }) - expect(document.getElementById(global.getAttribute('aria-describedby')!)?.textContent).toBe('Global navigation controls') - expect(document.getElementById(preset.getAttribute('aria-describedby')!)?.textContent).toBe('Run per session') - expect(screen.getByText(en.metadataError.replace('{error}', globalError))).toBeTruthy() - expect(screen.getByText(en.metadataError.replace('{error}', presetError))).toBeTruthy() - expect(global.closest('li')?.getAttribute('data-failed')).toBeNull() - fireEvent.click(global) - expect(screen.getByText(en.moduleLabel).nextElementSibling?.textContent).toBe('@acme/navigation') - fireEvent.click(preset) - expect(screen.getByText(en.moduleLabel).nextElementSibling?.textContent).toBe('@acme/runner') - expect(view.container.querySelector('[data-loader-entry]')?.textContent).toBe('include:preset-runner') - - locale.setLocale('zh') - view.rerender() - expect(screen.getByText(zh.presetSubtitle).textContent).toBe(zh.presetSubtitle) - expect(screen.getByText(zh.globalSubtitle).textContent).toBe(zh.globalSubtitle) - expect(screen.getByRole('button', { name: '导航, include:global-navigation, 已启用' })).toBeTruthy() - expect(screen.getByRole('button', { name: '会话执行器, include:preset-runner, 已启用' })).toBeTruthy() - expect(screen.getByText('全局导航控件')).toBeTruthy() - expect(screen.getByText('运行会话命令')).toBeTruthy() - expect(screen.getByText(zh.metadataError.replace('{error}', presetError))).toBeTruthy() - expect(view.container.querySelector('[data-loader-entry]')?.textContent).toBe('include:preset-runner') - const search = screen.getByRole('searchbox', { name: zh.search }) - for (const query of ['导航', '全局导航控件', '@acme/navigation', 'include:global-navigation']) { - fireEvent.change(search, { target: { value: query } }) - expect(screen.getAllByRole('listitem')).toHaveLength(1) - expect(screen.getByRole('button', { name: '导航, include:global-navigation, 已启用' })).toBeTruthy() - } - fireEvent.change(search, { target: { value: '运行会话命令' } }) - expect(screen.getAllByRole('listitem')).toHaveLength(1) - expect(screen.getByRole('button', { name: '会话执行器, include:preset-runner, 已启用' })).toBeTruthy() - // The Chinese page still finds the row by its English description. - fireEvent.change(search, { target: { value: 'Run per session' } }) - expect(screen.getByRole('button', { name: '会话执行器, include:preset-runner, 已启用' })).toBeTruthy() - fireEvent.change(search, { target: { value: 'no such plugin' } }) - expect(screen.getByText(zh.emptySearch)).toBeTruthy() - fireEvent.change(search, { target: { value: 'Run per session' } }) - locale.setLocale('en') - view.rerender() - expect(screen.getByRole('button', { name: 'Session runner, include:preset-runner, Enabled' })).toBeTruthy() - expect(screen.getByRole('searchbox', { name: en.search })).toHaveProperty('value', 'Run per session') - expect(list).toHaveBeenCalledOnce() - }) - - it.each(['global', 'preset'])('resolves each %s row field independently and hides empty English descriptions', async (scope) => { - const rows: Snapshot['entries'] = [ - { - entryId: 'include:navigation' as PluginEntryId, moduleName: '@acme/dsh-sidebar/navigation', enabled: true, fiberPhase: null, - meta: { description: { en: 'Navigation description.' } }, - }, - { - entryId: 'include:commands' as PluginEntryId, moduleName: '@acme/dsh-sidebar/commands', enabled: true, fiberPhase: null, - meta: { title: { en: 'English title' }, description: { en: 'Package description.', zh: '中文命令说明。' } }, - }, - { - entryId: 'include:theme' as PluginEntryId, moduleName: '@acme/dsh-theme/client', enabled: true, fiberPhase: null, - meta: { title: { en: '@acme/dsh-theme', zh: '主题插件' }, description: { en: '', zh: '中文主题说明。' } }, - }, - ] - const snapshot: Snapshot = scope === 'global' - ? { entries: rows } - : { entries: [], agentPresets: [{ id: 'custom', isDefault: true, rows }] } - const list = vi.fn(async () => snapshot) - const { locale, pageProps } = localizedProps(list) - const view = render() - await screen.findByRole('searchbox', { name: en.search }) - if (scope === 'global') fireEvent.click(globalToggle()) - expect(screen.getByRole('button', { name: 'sidebar/navigation, include:navigation, Enabled' })).toBeTruthy() - expect(screen.getByText('Navigation description.')).toBeTruthy() - expect(screen.getByRole('button', { name: 'English title, include:commands, Enabled' })).toBeTruthy() - expect(screen.getByText('Package description.')).toBeTruthy() - const theme = screen.getByRole('button', { name: '@acme/dsh-theme, include:theme, Enabled' }) - expect(theme.getAttribute('aria-describedby')).toBeNull() - expect(screen.queryByText('中文主题说明。')).toBeNull() - - locale.setLocale('zh') - view.rerender() - for (const [name, description] of [ - ['sidebar/navigation, include:navigation, 已启用', 'Navigation description.'], - ['English title, include:commands, 已启用', '中文命令说明。'], - ['主题插件, include:theme, 已启用', '中文主题说明。'], - ] as const) { - const card = screen.getByRole('button', { name }) - expect(screen.getByText(description)).toBeTruthy() - expect(document.getElementById(card.getAttribute('aria-describedby')!)?.textContent).toBe(description) - } - expect(screen.queryByText('Package description.')).toBeNull() - fireEvent.click(screen.getByRole('button', { name: '主题插件, include:theme, 已启用' })) - expect(view.container.querySelector('[data-loader-entry]')?.textContent).toBe('include:theme') - expect(screen.getByText(zh.moduleLabel).nextElementSibling?.textContent).toBe('@acme/dsh-theme/client') - - fireEvent.change(screen.getByRole('searchbox', { name: zh.search }), { target: { value: '中文主题说明。' } }) - expect(screen.getAllByRole('listitem')).toHaveLength(1) - locale.setLocale('en') - view.rerender() - // The English page still finds the row by its Chinese description, shown in English. - expect(screen.getAllByRole('listitem')).toHaveLength(1) - expect(screen.queryByText('中文主题说明。')).toBeNull() - fireEvent.change(screen.getByRole('searchbox', { name: en.search }), { target: { value: '@acme/dsh-theme/client' } }) - expect(screen.getAllByRole('listitem')).toHaveLength(1) - expect(screen.getByRole('button', { name: '@acme/dsh-theme, include:theme, Enabled' }).getAttribute('aria-describedby')).toBeNull() - expect(list).toHaveBeenCalledOnce() - }) - - it('keeps metadata-error-only rows inspectable by their full module specifier', async () => { - const error = 'locale/zh.json: invalid title' - await renderReady({ - entries: [{ - entryId: 'include:legacy' as PluginEntryId, moduleName: '@acme/dsh-legacy', enabled: false, fiberPhase: null, - meta: { error }, - }], - }) - fireEvent.click(globalToggle()) - expect(screen.getByText(en.metadataError.replace('{error}', error))).toBeTruthy() - const card = screen.getByRole('button', { name: 'legacy, Disabled' }) - expect(card).toHaveProperty('disabled', false) - expect(card.closest('li')?.getAttribute('data-failed')).toBeNull() - fireEvent.click(card) - expect(screen.getByText(en.moduleLabel).nextElementSibling?.textContent).toBe('@acme/dsh-legacy') - }) - - it('shows the default preset first with its group open and the global plane folded', async () => { - const view = await renderReady() - - const switcher = screen.getByRole('button', { name: en.switcherLabel }) - expect(switcher.textContent).toBe('标准模式 (default)') - fireEvent.click(switcher) - expect(screen.getAllByRole('menuitem').map(item => item.textContent)).toEqual([ - '标准模式 (default)', - 'ptc', - '坏预设 (failed to load)', - ]) - fireEvent.keyDown(document, { key: 'Escape' }) - expect(screen.queryAllByRole('menuitem')).toHaveLength(0) - expect(screen.getByText(en.presetSubtitle).textContent).toBe(en.presetSubtitle) - - // The preset group starts open with its rows while the larger global plane stays folded. - expect(presetToggle().getAttribute('aria-expanded')).toBe('true') - expect(screen.getAllByRole('listitem')).toHaveLength(6) - // Only the states that depart from plainly enabled carry a tag. - expect(screen.queryByText(en.enabledTag)).toBeNull() - expect(screen.getByText(en.conditionalTag)).toBeTruthy() - expect(screen.getByText(en.disabledTag)).toBeTruthy() - expect(screen.getByText(en.failedTag)).toBeTruthy() - // A settled row carries no phase dot: an active fiber and a row with no live - // fiber both render without one. - expect(screen.queryByRole('img', { name: en.active })).toBeNull() - expect(screen.queryByRole('img', { name: en.unobserved })).toBeNull() - - expect(globalToggle().getAttribute('aria-expanded')).toBe('false') - expect(screen.getByText(en.globalSubtitle).textContent).toBe(en.globalSubtitle) - - // A preset row expands into its source facts. - fireEvent.click(screen.getByRole('button', { name: 'pwsh, Conditional' })) - expect(screen.getByText(en.fromPreset)).toBeTruthy() - expect(screen.getByText('标准模式')).toBeTruthy() - expect(screen.getByText(en.condition)).toBeTruthy() - expect(screen.getByText('process.platform === \'win32\'')).toBeTruthy() - fireEvent.click(screen.getByRole('button', { name: 'pwsh, Conditional' })) - expect(screen.queryByText(en.condition)).toBeNull() - - // A failed preset row names its runtime state instead of a condition. - fireEvent.click(screen.getByRole('button', { name: 'crashy, Failed' })) - expect(screen.getByText(en.runtime)).toBeTruthy() - expect(screen.getByText('Failed to start')).toBeTruthy() - - // A row declaring no id has no Loader identity line, only its module. - fireEvent.click(screen.getByRole('button', { name: 'anonymous, Enabled' })) - expect(view.container.querySelector('[data-loader-entry]')).toBeNull() - expect(screen.getByText(en.moduleLabel).nextElementSibling?.textContent).toBe('@fixture/anonymous') - }) - - it('marks a live phase with a dot on an untagged enabled row', async () => { - await renderReady({ - entries: [ - { entryId: 'booting', moduleName: '@fixture/booting', enabled: true, fiberPhase: 'loading' }, - { entryId: 'waiting', moduleName: '@fixture/waiting', enabled: true, fiberPhase: 'pending' }, - { entryId: 'running', moduleName: '@fixture/running', enabled: true, fiberPhase: 'active' }, - { entryId: 'unobserved', moduleName: '@fixture/unobserved', enabled: true, fiberPhase: null }, - ], - agentPresets: [{ - id: 'standard', - isDefault: true, - rows: [ - { entryId: 'stopping', moduleName: '@fixture/stopping', enabled: true, fiberPhase: 'unloading' }, - { entryId: 'preset-running', moduleName: '@fixture/preset-running', enabled: true, fiberPhase: 'active' }, - ], - }], - } as unknown as Snapshot) - - fireEvent.click(globalToggle()) - expect(screen.getAllByRole('listitem')).toHaveLength(6) - expect(screen.queryByText(en.enabledTag)).toBeNull() - expect(screen.getByRole('img', { name: en.loadingPhase })).toBeTruthy() - expect(screen.getByRole('img', { name: en.pending })).toBeTruthy() - expect(screen.getByRole('img', { name: en.unloading })).toBeTruthy() - expect(screen.queryByRole('img', { name: en.active })).toBeNull() - expect(screen.queryByRole('img', { name: en.unobserved })).toBeNull() - }) - - it('distinguishes collapsed same-module rows by stable entry id', async () => { - const longId = 'include:agent-presets:tool-subagent-secondary-with-a-complete-stable-identity' - const subtitle = 'agent-presets:tool-subagent-secondary-with-a-complete-stable-identity' - await renderReady({ - entries: [], - agentPresets: [{ - id: 'same-module', - isDefault: true, - rows: [ - { entryId: 'tool-subagent-primary', moduleName: '@deepseek-ai/dsh-tool-subagent', enabled: true, fiberPhase: null }, - { entryId: longId, moduleName: '@deepseek-ai/dsh-tool-subagent', enabled: false, fiberPhase: null }, - ], - }], - }) - - expect(screen.getByRole('button', { name: 'tool-subagent, tool-subagent-primary, Enabled' }) - .getAttribute('aria-expanded')).toBe('false') - const secondary = screen.getByRole('button', { name: `tool-subagent, ${longId}, Disabled` }) - expect(secondary.getAttribute('aria-expanded')).toBe('false') - expect(secondary.children).toHaveLength(2) - expect(secondary.children[0]?.textContent).toContain('tool-subagent') - expect(secondary.children[0]?.textContent).toContain('Disabled') - expect(secondary.children[1]?.textContent).toBe(subtitle) - expect(screen.getByTitle(longId).textContent).toBe(subtitle) - - fireEvent.change(screen.getByRole('searchbox', { name: en.search }), { target: { value: 'include:agent-presets:tool-subagent-secondary' } }) - expect(screen.queryByRole('button', { name: 'tool-subagent, tool-subagent-primary, Enabled' })).toBeNull() - const filteredSecondary = screen.getByRole('button', { name: `tool-subagent, ${longId}, Disabled` }) - fireEvent.click(filteredSecondary) - expect(filteredSecondary.getAttribute('aria-expanded')).toBe('true') - }) - - it('shows the entry id only where it adds to the title', async () => { - await renderReady({ - entries: [ - { entryId: 'timer' as PluginEntryId, moduleName: 'cordis:timer', enabled: true, fiberPhase: 'active' }, - { entryId: 'include:hmr' as PluginEntryId, moduleName: '@deepseek-ai/cordis-plugin-hmr', enabled: true, fiberPhase: 'active' }, - { entryId: 'typert' as PluginEntryId, moduleName: '@fixture/typert-registry', enabled: true, fiberPhase: null }, - ], - }) - fireEvent.click(globalToggle()) - - // An id equal to the title leaves both the card and its accessible name. - expect(screen.getByRole('button', { name: 'timer, Enabled' }).querySelector('code')).toBeNull() - // A composition id that matches the title once its include: marker drops is left out the same way. - expect(screen.getByRole('button', { name: 'hmr, Enabled' }).querySelector('code')).toBeNull() - const typert = screen.getByRole('button', { name: 'typert-registry, typert, Enabled' }).querySelector('code') - expect(typert?.textContent).toBe('typert') - expect(typert?.getAttribute('title')).toBe('typert') - }) - - it('expands the global plane with failures first and preset-provided rows inline', async () => { - const view = await renderReady() - - expect(screen.queryByText(en.presetEnabledTag)).toBeNull() - fireEvent.click(globalToggle()) - expect(globalToggle().getAttribute('aria-expanded')).toBe('true') - const failed = view.container.querySelector('[data-plugin-scope="global"] [data-failed="true"]') - expect(failed?.getAttribute('data-plugin-entry')).toBe('telemetry') - // Failures float above the Loader-ordered remainder. - expect(view.container.querySelector('[data-plugin-scope="global"] li')).toBe(failed) - - // Rows the presets took over sit inline, marked instead of plainly disabled. - expect(screen.getAllByText(en.presetEnabledTag)).toHaveLength(2) - - fireEvent.click(screen.getByRole('button', { name: 'tool-bash, bash-host, Via presets' })) - expect(screen.getByText(en.presetProvidedDetail)).toBeTruthy() - expect(screen.getByText(en.enabledIn)).toBeTruthy() - expect(screen.getByText('标准模式 · ptc')).toBeTruthy() - - // The failed global card reports its runtime state. - fireEvent.click(screen.getByRole('button', { name: 'telemetry, Failed' })) - expect(screen.getByText('Failed to start')).toBeTruthy() - - // An enabled entry with no live fiber says so in its details, dot-free. - fireEvent.click(screen.getByRole('button', { name: 'unobserved-name, unobserved, Enabled' })) - expect(screen.getByText('Not running')).toBeTruthy() - - // A disabled row outside every preset stays plainly disabled. - fireEvent.click(screen.getByRole('button', { name: 'dormant, Disabled' })) - expect(screen.queryByText(en.presetProvidedDetail)).toBeNull() - - fireEvent.click(globalToggle()) - expect(globalToggle().getAttribute('aria-expanded')).toBe('false') - expect(screen.queryByText(en.presetEnabledTag)).toBeNull() - }) - - it('switches the inspected preset in place, including broken ones', async () => { - const view = await renderReady() - const pickPreset = (label: string): void => { - fireEvent.click(screen.getByRole('button', { name: en.switcherLabel })) - fireEvent.click(screen.getByRole('menuitem', { name: label })) - } - - pickPreset('ptc') - expect(view.container.querySelectorAll('[data-plugin-scope="preset"] li')).toHaveLength(3) - fireEvent.click(screen.getByRole('button', { name: 'tool-bash, bash, Enabled' })) - // An unnamed preset labels its source by id. - expect(screen.getByText(en.fromPreset).nextElementSibling?.textContent).toBe('ptc') - - pickPreset('坏预设 (failed to load)') - expect(screen.getByRole('alert').textContent).toBe('the composition file is missing') - expect(view.container.querySelectorAll('[data-plugin-scope="preset"] li')).toHaveLength(0) - }) - - it('folds the preset group on demand and reopens it for a search', async () => { - const view = await renderReady() - const toggle = presetToggle() - - expect(toggle.getAttribute('aria-expanded')).toBe('true') - expect(view.container.querySelectorAll('[data-plugin-scope="preset"] li')).toHaveLength(6) - // The explanatory subtitle remains visible while the rows are folded away. - fireEvent.click(toggle) - expect(toggle.getAttribute('aria-expanded')).toBe('false') - expect(screen.getByText(en.presetSubtitle).textContent).toBe(en.presetSubtitle) - expect(view.container.querySelectorAll('[data-plugin-scope="preset"] li')).toHaveLength(0) - - fireEvent.change(screen.getByRole('searchbox', { name: en.search }), { target: { value: 'pwsh' } }) - expect(toggle.getAttribute('aria-expanded')).toBe('true') - expect(screen.getByText(en.conditionalTag)).toBeTruthy() - - fireEvent.change(screen.getByRole('searchbox', { name: en.search }), { target: { value: '' } }) - expect(toggle.getAttribute('aria-expanded')).toBe('false') - fireEvent.click(toggle) - expect(toggle.getAttribute('aria-expanded')).toBe('true') - }) - - it('routes every preset name through the display resolver', async () => { - // The resolver stands in for presetDisplayText: shipped presets localize, - // user-authored ones keep their own metadata. - const localized: PluginInventorySettingsTabInjected['presetName'] = preset => - ['standard', 'ptc'].includes(preset.id) ? `Localized ${preset.id}` : preset.name ?? preset.id - render( SNAPSHOT, localized)} />) - await screen.findByRole('searchbox', { name: en.search }) - - const switcher = screen.getByRole('button', { name: en.switcherLabel }) - expect(switcher.textContent).toBe('Localized standard (default)') - fireEvent.click(switcher) - expect(screen.getAllByRole('menuitem').map(item => item.textContent)).toEqual([ - 'Localized standard (default)', - 'Localized ptc', - '坏预设 (failed to load)', - ]) - fireEvent.keyDown(document, { key: 'Escape' }) - - fireEvent.click(screen.getByRole('button', { name: 'pwsh, Conditional' })) - expect(screen.getByText(en.fromPreset).nextElementSibling?.textContent).toBe('Localized standard') - - fireEvent.click(globalToggle()) - fireEvent.click(screen.getByRole('button', { name: 'tool-bash, bash-host, Via presets' })) - expect(screen.getByText('Localized standard · Localized ptc')).toBeTruthy() - }) - - it('searches across scopes and points at matches in other presets', async () => { - const view = await renderReady() - const search = screen.getByRole('searchbox', { name: en.search }) - - fireEvent.change(search, { target: { value: 'tool-bash' } }) - // Searching forces the collapsed global plane and drawer open. - expect(view.container.querySelectorAll('[data-plugin-scope="preset"] li')).toHaveLength(1) - expect(view.container.querySelectorAll('[data-plugin-scope="global"] li')).toHaveLength(1) - expect(screen.getByText(en.presetEnabledTag)).toBeTruthy() - const hint = screen.getByText((text: string) => text.startsWith('2 more matches')) - expect(hint).toBeTruthy() - fireEvent.click(screen.getByRole('button', { name: 'ptc' })) - expect(screen.getByRole('button', { name: en.switcherLabel }).textContent).toBe('ptc') - - // A match visible only in another preset keeps the pointer without rows. - fireEvent.change(search, { target: { value: 'crashy' } }) - expect(view.container.querySelectorAll('[data-plugin-scope="preset"] li')).toHaveLength(0) - expect(screen.getByText((text: string) => text.startsWith('1 more matches'))).toBeTruthy() - expect(screen.queryByText(en.emptySearch)).toBeNull() - - // A match on a Loader entry id only reaches the global plane. - fireEvent.change(search, { target: { value: '8a1b2c3d' } }) - expect(view.container.querySelectorAll('[data-plugin-scope="global"] li')).toHaveLength(1) - expect(screen.queryByText((text: string) => text.includes('more matches'))).toBeNull() - - fireEvent.change(search, { target: { value: 'not-a-plugin' } }) - expect(screen.getByText(en.emptySearch)).toBeTruthy() - expect(screen.queryAllByRole('listitem')).toHaveLength(0) - }) - - it('renders a rosterless deployment as one global list, folded until opened', async () => { - const view = await renderReady({ - entries: [ - { entryId: 'hmr', moduleName: '@deepseek-ai/cordis-plugin-hmr', enabled: true, fiberPhase: 'active' }, - { entryId: 'off', moduleName: '@fixture/off', enabled: false, fiberPhase: null }, - ], - } as unknown as Snapshot) - - expect(screen.queryByRole('button', { name: en.switcherLabel })).toBeNull() - expect(globalToggle().getAttribute('aria-expanded')).toBe('false') - expect(screen.queryAllByRole('listitem')).toHaveLength(0) - fireEvent.click(globalToggle()) - expect(globalToggle().getAttribute('aria-expanded')).toBe('true') - expect(screen.getAllByRole('listitem')).toHaveLength(2) - - fireEvent.click(screen.getByRole('button', { name: 'hmr, Enabled' })) - expect(screen.getByText(en.runtime)).toBeTruthy() - expect(view.container.querySelector('[data-loader-entry]')?.textContent).toBe('hmr') - fireEvent.click(screen.getByRole('button', { name: 'off, Disabled' })) - expect(screen.getAllByText(en.moduleLabel).length).toBeGreaterThan(0) - expect(screen.queryByText(en.runtime)).toBeNull() - }) - - it('renders a preset-only snapshot without the global section', async () => { - await renderReady({ - entries: [], - agentPresets: [{ - id: 'solo', - isDefault: false, - rows: [{ entryId: 'one', moduleName: '@fixture/one', enabled: true, fiberPhase: null }], - }], - }) - - expect(screen.queryByRole('button', { name: (name: string) => name.startsWith(en.globalTitle) })).toBeNull() - expect(screen.queryByText(en.empty)).toBeNull() - expect(screen.getAllByRole('listitem')).toHaveLength(1) - }) - - it('shows a generic failure and retries into the empty state', async () => { - const list = vi.fn() - .mockRejectedValueOnce(new Error('private transport detail')) - .mockResolvedValueOnce({ entries: [] }) - render() - - expect((await screen.findByRole('alert')).querySelector('[data-state="error"]')).not.toBeNull() - expect(screen.queryByText('private transport detail')).toBeNull() - fireEvent.click(screen.getByRole('button', { name: en.retry })) - await waitFor(() => { expect(list).toHaveBeenCalledTimes(2) }) - expect(await screen.findByText(en.empty)).toBeTruthy() - }) - - it('contains a synchronous Remote failure and ignores a result after unmount', async () => { - const syncFailure = vi.fn(() => { throw new Error('namespace unavailable') }) as PluginInventorySettingsTabInjected['list'] - const failed = render() - expect((await screen.findByRole('alert')).textContent).toBe(en.error) - failed.unmount() - - const deferred = Promise.withResolvers() - const pending = render( deferred.promise)} />) - // Loading shows skeleton cards; the status region announces the label as visually hidden text. - expect(screen.getByRole('status').textContent).toBe(en.loading) - pending.unmount() - await act(async () => { deferred.resolve(SNAPSHOT) }) - - const deferredFailure = Promise.withResolvers() - const pendingFailure = render( deferredFailure.promise)} />) - pendingFailure.unmount() - await act(async () => { deferredFailure.reject(new Error('late failure')) }) - }) -}) - -it('shows current-page sync errors and retries without re-reading Host inventory', async () => { - const list = vi.fn(async () => ({ entries: [] })) - const sync = createSnapshotStore({ syncing: true, failures: [] }) - const retryClient = vi.fn() - render() - expect(screen.getByText(en.clientSyncing).closest('[role="status"]')?.querySelector('[data-state="ongoing"]')).not.toBeNull() - await waitFor(() => { expect(list).toHaveBeenCalledOnce() }) - act(() => { sync.set({ syncing: false, failures: [{ id: 'client-addon', message: 'download failed' }] }) }) - expect(screen.getByRole('alert').querySelector('[data-state="error"]')).not.toBeNull() - expect(screen.getByText('client-addon: download failed')).toBeTruthy() - fireEvent.click(screen.getByRole('button', { name: 'Retry this page' })) - expect(retryClient).toHaveBeenCalledOnce() - expect(list).toHaveBeenCalledOnce() - act(() => { sync.set({ syncing: false, failures: [] }) }) - expect(screen.queryByRole('alert')).toBeNull() -}) diff --git a/packages/client/ui-settings-plugin-inventory/tests/touch-styles.client.spec.ts b/packages/client/ui-settings-plugin-inventory/tests/touch-styles.client.spec.ts deleted file mode 100644 index 579edfcdca..0000000000 --- a/packages/client/ui-settings-plugin-inventory/tests/touch-styles.client.spec.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Built-in plugin inventory touch rules, asserted against the CSS text on disk. - * - * jsdom resolves neither `pointer` nor `hover` media features, so these gates read - * the sheet instead: a `:hover` rule outside `@media (hover: hover)` latches onto a - * tap and strands the card in its pointer-only state, and the 13px search field - * makes iOS Safari zoom the visual viewport when it takes focus. - */ -import { readFileSync } from 'node:fs' -import { fileURLToPath } from 'node:url' -import { describe, expect, it } from 'vitest' - -const css = readFileSync(fileURLToPath(new URL('../src/client/PluginInventorySettingsTab.module.css', import.meta.url)), 'utf8') -/** Comment bodies blanked, so prose about `:hover` is not read as a rule. */ -const rules = css.replace(/\/\*[\s\S]*?\*\//g, text => ' '.repeat(text.length)) - -/** Every `:hover` selector sitting in the media query that encloses it. */ -function hovers(source: string): { line: string; hoverMedia: boolean }[] { - const stack: (string | null)[] = [] - const found: { line: string; hoverMedia: boolean }[] = [] - for (const token of source.matchAll(/@media[^{]*\{|@container[^{]*\{|:hover|\{|\}/g)) { - const text = token[0] - if (text === '}') { - stack.pop() - continue - } - if (text === '{') { - stack.push(null) - continue - } - if (text.startsWith('@')) { - // The matched text includes the block's opening brace, which the frame stands for. - stack.push(text.slice(0, -1)) - continue - } - const start = source.lastIndexOf('\n', token.index ?? 0) + 1 - const end = source.indexOf('\n', token.index ?? 0) - found.push({ - line: source.slice(start, end === -1 ? undefined : end).trim(), - hoverMedia: stack.some(frame => frame !== null && /hover:\s*hover/.test(frame)), - }) - } - return found -} - -/** The declarations inside every `@media (hover: hover)` block, joined. */ -function hoverBlock(): string { - return [...rules.matchAll(/@media \(hover: hover\) \{([\s\S]*?)\n\}/g)].map(match => match[1] ?? '').join('\n') -} - -/** The declarations of one rule, by its literal selector. */ -function ruleBody(selector: string): string { - const start = rules.indexOf(`${selector} {`) - if (start === -1) throw new Error(`PluginInventorySettingsTab.module.css has no \`${selector}\` rule`) - const open = rules.indexOf('{', start) - return rules.slice(open + 1, rules.indexOf('}', open)) -} - -describe('built-in plugin inventory touch rules', () => { - it('fences every hover affordance behind a hover-capable pointer', () => { - // The card background and the preset switcher are the tab's only hover states; - // unguarded, a single tap leaves the card painted as hovered. - const unguarded = hovers(rules).filter(state => !state.hoverMedia) - expect(unguarded.map(state => state.line)).toEqual([]) - expect(rules).toContain('.cardContent:hover') - expect(rules).toContain('.switcher:hover') - }) - - it('keeps the open card painted without a pointer', () => { - // An expanded card shows the same surface as a hovered one, and it must hold on - // a touch client: it belongs outside the hover fence, not inside it. - expect(ruleBody(".card[data-open='true'] > .cardContent")) - .toContain('background: var(--dsw-alias-interactive-bg-hover)') - expect(hoverBlock()).not.toContain('data-open') - }) - - it('gives touch clients a press state where the hover state is fenced off', () => { - expect(ruleBody('.cardContent:active')).toContain('background: var(--dsw-alias-interactive-bg-active)') - expect(ruleBody('.switcher:active')).toContain('background: var(--dsw-alias-interactive-bg-active)') - }) - - it('keeps the focused search field at 16px under a coarse pointer', () => { - const coarse = /@media \(pointer: coarse\) \{([\s\S]*?)\n\}/.exec(rules)?.[1] ?? '' - expect(coarse).toMatch(/\.search input \{[^}]*font-size: 16px/) - }) -}) diff --git a/packages/client/ui-settings-plugin-inventory/tsconfig.json b/packages/client/ui-settings-plugin-inventory/tsconfig.json deleted file mode 100644 index 72927f4e08..0000000000 --- a/packages/client/ui-settings-plugin-inventory/tsconfig.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "extends": "../../../tsconfig.base.client.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../../util/text-search" - }, - { - "path": "../../util/package-manifest" - }, - { - "path": "../../../vendor/cordis" - }, - { - "path": "../../api/remotes/tsconfig.client.json" - }, - { - "path": "../locale/tsconfig.client.json" - }, - { - "path": "../ui-settings/tsconfig.client.json" - }, - { - "path": "../ui-agent-preset" - }, - { - "path": "../../preset/agent-preset-registry" - }, - { - "path": "../ui-primitives" - }, - { - "path": "../ui-renderer" - }, - { - "path": "../ui-slots" - }, - { - "path": "../modules" - }, - { - "path": "../store" - } - ] -} diff --git a/packages/client/ui-settings-plugin-inventory/tsdown.config.ts b/packages/client/ui-settings-plugin-inventory/tsdown.config.ts deleted file mode 100644 index 7aa03cebc1..0000000000 --- a/packages/client/ui-settings-plugin-inventory/tsdown.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { clientBundle } from '../tsdown.client.ts' - -export default clientBundle(import.meta.dirname, ['lib/types/index.js']) diff --git a/packages/client/ui-settings-plugins/README.i18n.yaml b/packages/client/ui-settings-plugins/README.i18n.yaml deleted file mode 100644 index a783ce1ee9..0000000000 --- a/packages/client/ui-settings-plugins/README.i18n.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading -# section, a hash of its English and Chinese blocks outside code blocks and generated regions. -# After editing either side, bring the other along and re-record with: -# pnpm run verify-translation-pairing --write packages/client/ui-settings-plugins/README.md -/: - en: 06bd505cb0147b05 - zh: 8d7646e22faac71b -/deepseek-ai-dsh-client-ui-settings-plugins: - en: 3ceabe2cdb5492f6 - zh: 6ea0cb3f93e5bdf5 -/deepseek-ai-dsh-client-ui-settings-plugins/summary: - en: d9b27f1dd9713b4f - zh: 3ec674429179ae7d -/deepseek-ai-dsh-client-ui-settings-plugins/table-of-contents: - en: d152484eb41ac6b4 - zh: 09388d293f9be9cb -/deepseek-ai-dsh-client-ui-settings-plugins/use-this-package: - en: b4deec821244f970 - zh: 49b3afedc992b7fe -/deepseek-ai-dsh-client-ui-settings-plugins/understand-the-implementation: - en: c5cfef002b32c7c1 - zh: 0249b45a28c16b61 -/deepseek-ai-dsh-client-ui-settings-plugins/further-exploration: - en: 54ba782a2b26f615 - zh: fee9148d9658d83f -/deepseek-ai-dsh-client-ui-settings-plugins/model-experience: - en: 6b7c6f82ab6c8435 - zh: 4517689c899abcbe -/deepseek-ai-dsh-client-ui-settings-plugins/model-experience/kv-cache-effect: - en: ca75c51c89c2c9b0 - zh: 6e1c9a8fdde89577 -/deepseek-ai-dsh-client-ui-settings-plugins/known-limitations-and-deferred-work: - en: 4950e959be39bc0c - zh: 8f0703f3304d9336 -/deepseek-ai-dsh-client-ui-settings-plugins/known-limitations-and-deferred-work/dev-note: - en: e67f633dc6fe7773 - zh: e88aeb617ffb74ea diff --git a/packages/client/ui-settings-plugins/README.md b/packages/client/ui-settings-plugins/README.md deleted file mode 100644 index ac0d69210f..0000000000 --- a/packages/client/ui-settings-plugins/README.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -description: "Built-in plugins settings section for the dsh web client: the Settings navigation entry and the tab chrome that feature-owned tabs register into." -kind: "package-reference" ---- - -# @deepseek-ai/dsh-client-ui-settings-plugins - -English | [中文](README.zh.md) - -## Summary - -Use the **Built-in plugins** settings section to inspect the plugins this deployment ships. The section is a shell: it owns the navigation entry and the tab row, and every tab in it is registered by another plugin — the read-only inventory ships one. Configuring a built-in plugin happens on the sidebar's Plugins page, where each official plugin's own companion package registers its page. - -## Table of Contents - -- [Use this package](#use-this-package) -- [Understand the implementation](#understand-the-implementation) -- [Further Exploration](#further-exploration) -- [Model Experience](#model-experience) -- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work) -- [Dev Note](#dev-note) - ------ - - -## Use this package - -Open **Built-in plugins** in Settings. [ui-settings-plugin-inventory](../ui-settings-plugin-inventory/README.md) contributes the inventory as the section's one tab, shown as the page itself; a second registered tab turns the row into tabs. A deployment whose composition contributes no tab shows the section's empty line. - -To contribute a tab, register into `settings.plugins.tab` with an `id`, an `order`, and a localized `label`; the section renders the entries in order and mounts a tab on its first selection. Feature copy stays in the registering plugin's dictionary. - ------ - - -## Understand the implementation - -
    -Implementation internals — click to expand - -The section declares `settings.plugins.tab`, a root list slot whose labels become ordered tabs; a lone contribution renders as the page itself, and a tab stays mounted after its first selection so search and the inventory snapshot survive switching. The section's `inject` projects the slot's ledger into ordered rows whose labels follow the active locale, cached until the ledger version or the locale revision moves. The Host half is an empty `apply`, present only so the package holds a Loader row the client module system serves the browser half for. - -
    - ------ - - -## Further Exploration - -- [ui-settings-plugin-inventory](../ui-settings-plugin-inventory/README.md) — the read-only inventory tab. -- [ui-settings](../ui-settings/README.md) — the domain base declaring `settings.section`. -- [ui-plugin-manager](../ui-plugin-manager/README.md) — the Plugins page where official plugins are configured. -- [ui-settings-shell](../ui-settings-shell/README.md), [ui-settings-agent-loop](../ui-settings-agent-loop/README.md), [ui-settings-subagent](../ui-settings-subagent/README.md), [ui-settings-web-search](../ui-settings-web-search/README.md) — the official configuration pages, one companion package each. - ------ - - -## Model Experience - -None, as the package is a browser-side settings surface that registers no model surface. - -#### KV Cache effect - -None; this package neither assembles nor sends a provider request. - -## Known Limitations and Deferred Work - - - -- **The section has no tab of its own** — it renders its empty line until a feature plugin registers one; the shell cannot fill the section alone. - - -### Dev Note - -
    -Working context for maintainers — click to expand - -None. - -
    diff --git a/packages/client/ui-settings-plugins/README.zh.md b/packages/client/ui-settings-plugins/README.zh.md deleted file mode 100644 index 44a16ec015..0000000000 --- a/packages/client/ui-settings-plugins/README.zh.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -description: "dsh Web 客户端的「内置插件」设置分区:设置导航项与供功能插件注册标签页的标签行。" -kind: "package-reference" ---- - -# @deepseek-ai/dsh-client-ui-settings-plugins - -[English](README.md) | 中文 - -## 概述 - -使用**内置插件**设置分区查看本部署随附的插件。该分区只是一个壳:它拥有导航项和标签行,里面的每个标签页都由其他插件注册——只读清单注册了一个。配置内置插件在侧栏的插件页上进行,每个官方插件自己的伴生包把页面注册到那里。 - -## 目录 - -- [使用本包](#use-this-package) -- [理解实现](#understand-the-implementation) -- [进一步探索](#further-exploration) -- [模型体验](#model-experience) -- [已知限制与延期工作](#known-limitations-and-deferred-work) -- [开发备注](#dev-note) - ------ - - -## 使用本包 - -在设置里打开**内置插件**。[ui-settings-plugin-inventory](../ui-settings-plugin-inventory/README.zh.md) 把清单作为分区唯一的标签页贡献进来,直接显示为页面本身;注册第二个标签页后这一行就变成标签行。组合里没有任何标签页贡献的部署会显示分区的空提示。 - -要贡献一个标签页,带 `id`、`order` 和本地化的 `label` 注册进 `settings.plugins.tab`;分区按序渲染条目,标签页在首次被选中时挂载。功能文案留在注册方自己的字典里。 - ------ - - -## 理解实现 - -
    -实现细节——点击展开 - -分区声明 `settings.plugins.tab`,一个根级 list slot,其标签成为有序的标签页;只有一个贡献时直接渲染为页面本身,标签页在首次被选中后保持挂载,搜索词和清单快照因此在切换间不丢失。分区的 `inject` 把 slot 账本投影成按序排列、标签随当前语言的行,在账本版本或语言修订变化前保持缓存。宿主半侧是一个空的 `apply`,只为让本包占一条 Loader 行,客户端模块系统据此送出浏览器半侧。 - -
    - ------ - - -## 进一步探索 - -- [ui-settings-plugin-inventory](../ui-settings-plugin-inventory/README.zh.md)——只读清单标签页。 -- [ui-settings](../ui-settings/README.zh.md)——声明 `settings.section` 的领域基座。 -- [ui-plugin-manager](../ui-plugin-manager/README.zh.md)——配置官方插件的插件页。 -- [ui-settings-shell](../ui-settings-shell/README.zh.md)、[ui-settings-agent-loop](../ui-settings-agent-loop/README.zh.md)、[ui-settings-subagent](../ui-settings-subagent/README.zh.md)、[ui-settings-web-search](../ui-settings-web-search/README.zh.md)——官方配置页,每个一个伴生包。 - ------ - - -## 模型体验 - -无,本包是浏览器侧的设置界面,不注册任何模型面。 - -#### KV 缓存影响 - -无;本包既不组装也不发送提供方请求。 - -## 已知限制与延期工作 - - - -- **分区没有自己的标签页**——在功能插件注册标签页之前它只显示空提示;壳自己填不满分区。 - - -### 开发备注 - -
    -维护者工作上下文——点击展开 - -无。 - -
    diff --git a/packages/client/ui-settings-plugins/locale/de.json b/packages/client/ui-settings-plugins/locale/de.json deleted file mode 100644 index 9b3e3dbeb2..0000000000 --- a/packages/client/ui-settings-plugins/locale/de.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Integrierter Plug-in-Einstellungseingang", - "description": "Bietet den integrierten Plug-in-Eingang und seine Funktionsregisterkarte in den Einstellungen." - } -} diff --git a/packages/client/ui-settings-plugins/locale/en.json b/packages/client/ui-settings-plugins/locale/en.json deleted file mode 100644 index bbe7eea9a3..0000000000 --- a/packages/client/ui-settings-plugins/locale/en.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "meta": { - "title": "ui-settings-plugins" - } -} diff --git a/packages/client/ui-settings-plugins/locale/es.json b/packages/client/ui-settings-plugins/locale/es.json deleted file mode 100644 index f06cce9794..0000000000 --- a/packages/client/ui-settings-plugins/locale/es.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Entrada de configuración de complementos incorporados", - "description": "Proporciona la entrada del complemento integrado y su pestaña de función en la configuración." - } -} diff --git a/packages/client/ui-settings-plugins/locale/fr.json b/packages/client/ui-settings-plugins/locale/fr.json deleted file mode 100644 index 762ba220ef..0000000000 --- a/packages/client/ui-settings-plugins/locale/fr.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Entrée des paramètres du plug-in intégré", - "description": "Fournit l'entrée du plug-in intégré et sa page à onglet de fonction dans les paramètres." - } -} diff --git a/packages/client/ui-settings-plugins/locale/ja.json b/packages/client/ui-settings-plugins/locale/ja.json deleted file mode 100644 index e25c087ef7..0000000000 --- a/packages/client/ui-settings-plugins/locale/ja.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "組み込みプラグイン設定", - "description": "設定内の組み込みプラグイン項目と機能タブを提供します。" - } -} diff --git a/packages/client/ui-settings-plugins/locale/pt.json b/packages/client/ui-settings-plugins/locale/pt.json deleted file mode 100644 index 4af280898e..0000000000 --- a/packages/client/ui-settings-plugins/locale/pt.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Entrada de configurações de plug-in integradas", - "description": "Fornece a entrada do plug-in integrada e sua guia de função nas configurações." - } -} diff --git a/packages/client/ui-settings-plugins/locale/ru.json b/packages/client/ui-settings-plugins/locale/ru.json deleted file mode 100644 index 4fdd139aa0..0000000000 --- a/packages/client/ui-settings-plugins/locale/ru.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "Вход в настройки встроенного плагина", - "description": "Обеспечивает вход встроенного плагина и вкладку его функций в настройках." - } -} diff --git a/packages/client/ui-settings-plugins/locale/zh.json b/packages/client/ui-settings-plugins/locale/zh.json deleted file mode 100644 index 71ab797452..0000000000 --- a/packages/client/ui-settings-plugins/locale/zh.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "meta": { - "title": "内置插件设置入口", - "description": "提供设置中的内置插件入口及其功能标签页。" - } -} diff --git a/packages/client/ui-settings-plugins/package.json b/packages/client/ui-settings-plugins/package.json deleted file mode 100644 index f7835e7130..0000000000 --- a/packages/client/ui-settings-plugins/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@deepseek-ai/dsh-client-ui-settings-plugins", - "description": "Built-in plugins settings section for the dsh web client: the Settings navigation entry and the tab chrome feature-owned tabs register into", - "version": "0.2.2-rc.3", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/deepseek-ai/deepseek-harness.git", - "directory": "packages/client/ui-settings-plugins" - }, - "type": "module", - "main": "lib/index.js", - "types": "lib/types/index.d.ts", - "exports": { - ".": { - "types": "./lib/types/index.d.ts", - "default": "./lib/index.js" - }, - "./client": { - "types": "./lib/types/client/index.d.ts", - "default": "./lib/client.js" - }, - "./src/*": "./src/*", - "./package.json": "./package.json", - "./locale/*.json": "./locale/*.json" - }, - "dsh": { - "client": { - "inject": [ - "@deepseek-ai/dsh-client-locale", - "@deepseek-ai/dsh-client-ui-settings" - ], - "platform": "web" - } - }, - "scripts": { - "bundle": "tsdown", - "watch": "tsdown --watch" - }, - "license": "MIT", - "peerDependencies": { - "@deepseek-ai/cordis": "workspace:~" - }, - "devDependencies": { - "@deepseek-ai/cordis": "workspace:~", - "@deepseek-ai/dsh-client-locale": "workspace:*", - "@deepseek-ai/dsh-client-test-runtime": "workspace:*", - "@deepseek-ai/dsh-client-ui-renderer": "workspace:*", - "@deepseek-ai/dsh-client-ui-settings": "workspace:*", - "@deepseek-ai/dsh-client-ui-slots": "workspace:*", - "@deepseek-ai/dsh-util-values": "workspace:*", - "react": "^18.2.0" - }, - "files": [ - "locale/*.json", - "lib/index.js", - "lib/client.js", - "lib/types/**/*.d.ts", - "lib/types/**/*.d.ts.map", - "lib/**/*.js.map", - "src" - ] -} diff --git a/packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.module.css b/packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.module.css deleted file mode 100644 index 5a524b709b..0000000000 --- a/packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.module.css +++ /dev/null @@ -1,113 +0,0 @@ -/* Plugins section: compact tabs plus the configurable plugin card list. */ - -.section { - display: flex; - flex-direction: column; - gap: 12px; - max-width: 760px; - color: var(--dsw-alias-label-primary); -} - -.heading { - margin: 0; - font-size: 18px; - font-weight: 600; -} - -.intro { - margin: 0; - font-size: 13px; - color: var(--dsw-alias-label-tertiary); -} - -.tabs { - display: flex; - align-items: flex-end; - gap: 22px; - border-bottom: 0.5px solid var(--dsw-alias-border-l2); - margin-top: 2px; -} - -.tab { - position: relative; - border: 0; - padding: 7px 1px 9px; - background: transparent; - color: var(--dsw-alias-label-tertiary); - font: inherit; - font-size: 13px; - line-height: 20px; - cursor: pointer; -} - -.tab[data-active='true'] { - color: var(--dsw-alias-label-primary); -} - -@media (hover: hover) { - .tab:hover { - color: var(--dsw-alias-label-primary); - } -} - -.tab[data-active='true']::after, -.tab:focus-visible::after { - position: absolute; - right: 0; - bottom: -1px; - left: 0; - height: 2px; - border-radius: 2px 2px 0 0; - background: var(--dsw-alias-label-primary); - content: ''; -} - -.tab:focus-visible { - outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); - outline-offset: 2px; - border-radius: 2px; - color: var(--dsw-alias-label-primary); -} - -.panel { - min-width: 0; - padding-top: 2px; -} - -.cards { - list-style: none; - margin: 0; - padding: 0; - display: flex; - flex-direction: column; - gap: 10px; -} - -.empty { - margin: 0; - font-size: 13px; - color: var(--dsw-alias-label-tertiary); -} - -/* Configurable tab: the card list. */ - -.configurable { - display: flex; - flex-direction: column; - gap: 10px; -} - -/* Preset detail page: the settings section over the same cards. */ - -.presetSettings { - display: flex; - flex-direction: column; - gap: 8px; -} - -.presetSettingsTitle { - margin: 0; - font-size: 15px; - line-height: 22px; - font-weight: 600; -} diff --git a/packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.tsx b/packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.tsx deleted file mode 100644 index 1c8148c654..0000000000 --- a/packages/client/ui-settings-plugins/src/client/PluginsSettingsSection.tsx +++ /dev/null @@ -1,126 +0,0 @@ -/** Plugins settings section: localized tabs around feature-owned pages. */ - -import { useEffect, useId, useRef, useState } from 'react' -import type { - HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime, -} from '@deepseek-ai/dsh-client-ui-slots' -import type { PluginsSettingsLocaleKey } from './locales.ts' -import css from './PluginsSettingsSection.module.css' - -/** One tab projected from a `settings.plugins.tab` contribution. */ -export interface PluginsSettingsTabEntry { - id: string - order: number - label: string -} - -/** Registration-side business face for the section. */ -export interface PluginsSettingsSectionInjected { - hooks: { - /** Ordered, locale-aware projection of the Plugins tab ledger. */ - tabs: HostObservable - } -} - -/** Props the renderer binds for the section. */ -export type PluginsSettingsSectionProps = - PropsRuntime<'settings.section'> - & PropsLocale<'settings.plugins'> - & PropsRenderSlots<'settings.plugins.tab'> - & InjectFace - -/** Render one Plugins page whose contents arrive from feature-owned tabs; one contribution shows as the page itself. */ -export function PluginsSettingsSection({ t, renderSlot, useTabs }: PluginsSettingsSectionProps) { - const tabsId = useId() - const tabRefs = useRef>([]) - const rows = useTabs(value => value) - const [activeId, setActiveId] = useState() - const [visitedIds, setVisitedIds] = useState>(() => new Set()) - const active = rows.find(row => row.id === activeId)?.id ?? rows[0]?.id - const single = rows.length === 1 ? rows[0] : undefined - - // A tab mounts only when first selected, then stays mounted while hidden so - // local drafts, disclosure state, search, and the inventory snapshot survive - // switching between the two views. - useEffect(() => { - if (active === undefined) return - setVisitedIds((previous) => { - if (previous.has(active)) return previous - return new Set([...previous, active]) - }) - }, [active]) - - return ( -
    -

    {t('title')}

    -

    {t('intro')}

    - {rows.length === 0 ?

    {t('empty')}

    : single !== undefined ? ( -
    {renderSlot('settings.plugins.tab', {}, { only: single.id })}
    - ) : ( - <> -
    - {rows.map((row, index) => { - const selected = row.id === active - return ( - - ) - })} -
    - {rows - .filter(row => row.id === active || visitedIds.has(row.id)) - .map((row) => { - const selected = row.id === active - return ( - - ) - })} - - )} -
    - ) -} - -declare module '@deepseek-ai/dsh-client-ui-slots' { - interface LocaleNamespaceMap { - /** Built-in plugins section and plugin configuration page copy. */ - 'settings.plugins': PluginsSettingsLocaleKey - } -} diff --git a/packages/client/ui-settings-plugins/src/client/index.ts b/packages/client/ui-settings-plugins/src/client/index.ts deleted file mode 100644 index b9db73a850..0000000000 --- a/packages/client/ui-settings-plugins/src/client/index.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Built-in plugins settings section, browser half: the shell around the - * feature-owned tabs registered into `settings.plugins.tab` (the read-only - * inventory ships one). The configuration pages of the host-plane plugins - * live in their own companion packages, which register into the Plugins - * page; this section owns the Settings navigation entry and the tab chrome - * only. - */ - -// Type-only: pulls the locale plugin's Context merge (ctx.locale). -import type {} from '@deepseek-ai/dsh-client-locale/client' -// Type-only: the settings shell's SlotMap merge (the 'settings.section' -// entry). Cross-plugin collaboration goes through slots, never a value import -// (client bundle purity gate). -import type {} from '@deepseek-ai/dsh-client-ui-settings/client' -import type {} from '@deepseek-ai/dsh-client-ui-renderer/client' -import type { Context as ClientContext } from '@deepseek-ai/cordis' -import { resolveSlotLabel } from '@deepseek-ai/dsh-client-ui-slots' -import { PluginsSettingsSection } from './PluginsSettingsSection.tsx' -import type { PluginsSettingsSectionInjected, PluginsSettingsTabEntry } from './PluginsSettingsSection.tsx' -import { en, ja, es, fr, de, ru, pt, zh } from './locales.ts' - -export type { PluginsSettingsSectionInjected, PluginsSettingsSectionProps } from './PluginsSettingsSection.tsx' - -/** Dictionary namespace owned by this plugin. */ -const NS = 'settings.plugins' - -/** Required services (cordis fiber inject). */ -export const inject = ['slots', 'locale'] - -/** - * Mount the built-in plugins section. - * @param ctx - the browser plugin context. - */ -export function apply(ctx: ClientContext): void { - const t = ctx.locale.bind(NS) - ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'ui-settings-plugins: section dictionaries') - - let tabsVersion = -1 - let tabsRevision = -1 - let tabs: readonly PluginsSettingsTabEntry[] = [] - const sectionInjected = (): PluginsSettingsSectionInjected => ({ - hooks: { - tabs: { - getSnapshot: () => { - const version = ctx.slots.getVersion('settings.plugins.tab') - const revision = ctx.locale.getSnapshot().revision - if (version !== tabsVersion || revision !== tabsRevision) { - tabsVersion = version - tabsRevision = revision - tabs = ctx.slots.entries('settings.plugins.tab') - .map(entry => ({ - /* v8 ignore next -- list-slot registration requires id */ - id: entry.options.id ?? '', - order: entry.options.order ?? 0, - label: resolveSlotLabel(entry.options.label) ?? '', - })) - .sort((a, b) => a.order - b.order) - } - return tabs - }, - subscribe: (listener) => { - const offLedger = ctx.slots.subscribe('settings.plugins.tab', listener) - const offLocale = ctx.locale.subscribe(listener) - return () => { - offLedger() - offLocale() - } - }, - }, - }, - }) - - // This package owns the one Built-in plugins navigation entry and the tab - // chrome; feature plugins contribute pages without competing for Settings nav rows. - ctx.slots.inject('settings.section', () => ctx.slots.register({ - name: 'settings.section', - id: 'plugins', - order: 15, - label: () => t('nav'), - locale: NS, - inject: sectionInjected, - children: { 'settings.plugins.tab': { kind: 'list', scope: 'root' } }, - }, PluginsSettingsSection)) -} diff --git a/packages/client/ui-settings-plugins/src/client/locales.ts b/packages/client/ui-settings-plugins/src/client/locales.ts deleted file mode 100644 index 723b596309..0000000000 --- a/packages/client/ui-settings-plugins/src/client/locales.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** Locale bundles for the built-in plugins settings section. */ - -/** Locale keys the section renders. */ -export type PluginsSettingsLocaleKey = 'nav' | 'title' | 'intro' | 'tabs' | 'empty' - -/** English copy. */ -export const en: Record = { - nav: 'Built-in plugins', - title: 'Built-in plugins', - intro: 'Inspect the plugins this deployment ships.', - tabs: 'Plugin views', - empty: 'This deployment exposes no plugin views.', -} - -/** Simplified Chinese copy. */ -export const zh: Record = { - nav: '内置插件', - title: '内置插件', - intro: '查看内置部署的插件列表', - tabs: '插件视图', - empty: '本部署没有开放任何插件视图。', -} - -/** Japanese copy, checked against the English keys. */ -export const ja = { - 'nav': '組み込みプラグイン', - 'title': '組み込みプラグイン', - 'intro': 'このデプロイメントに含まれるプラグインを確認します。', - 'tabs': 'プラグインビュー', - 'empty': 'このデプロイメントにはプラグインビューがありません。', -} satisfies Record - -/** Spanish dictionary, checked against the English keys. */ -export const es = { - nav: 'Complementos integrados', - title: 'Complementos integrados', - intro: 'Inspeccione los complementos que incluye esta implementación.', - tabs: 'Vistas de complementos', - empty: 'Esta implementación no expone vistas de complementos.', -} satisfies Record - -/** French dictionary, checked against the English keys. */ -export const fr = { - nav: 'Plugins intégrés', - title: 'Plugins intégrés', - intro: 'Inspectez les plugins fournis par ce déploiement.', - tabs: 'Vues des plugins', - empty: "Ce déploiement n'expose aucune vue de plugin.", -} satisfies Record - -/** German dictionary, checked against the English keys. */ -export const de = { - nav: 'Integrierte Plugins', - title: 'Integrierte Plugins', - intro: 'Überprüfen Sie die Plugins, die mit dieser Bereitstellung geliefert werden.', - tabs: 'Plugin-Ansichten', - empty: 'Diese Bereitstellung stellt keine Plugin-Ansichten bereit.', -} satisfies Record - -/** Russian dictionary, checked against the English keys. */ -export const ru = { - nav: 'Встроенные плагины', - title: 'Встроенные плагины', - intro: 'Проверьте плагины, поставляемые в этом развертывании.', - tabs: 'Просмотры плагинов', - empty: 'Это развертывание не предоставляет никаких представлений плагинов.', -} satisfies Record - -/** Portuguese dictionary, checked against the English keys. */ -export const pt = { - nav: 'Plug-ins integrados', - title: 'Plug-ins integrados', - intro: 'Inspecione os plug-ins fornecidos por esta implantação.', - tabs: 'Visualizações de plug-in', - empty: 'Esta implantação não expõe visualizações de plug-ins.', -} satisfies Record diff --git a/packages/client/ui-settings-plugins/src/css-modules.d.ts b/packages/client/ui-settings-plugins/src/css-modules.d.ts deleted file mode 100644 index 8811db1264..0000000000 --- a/packages/client/ui-settings-plugins/src/css-modules.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.module.css' { - const classes: Record - export default classes -} diff --git a/packages/client/ui-settings-plugins/src/index.ts b/packages/client/ui-settings-plugins/src/index.ts deleted file mode 100644 index ce0f6e034d..0000000000 --- a/packages/client/ui-settings-plugins/src/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Plugins settings surface, node half. The empty apply exists so the plugin - * appears in the host cordis.yml / Loader; the browser half owns the section - * and its configurable tab through exports["./client"], discovered from the - * package.json dsh.client declaration. Every section this page edits is owned - * by the Host plugin that registered it, so this package registers no - * namespace of its own. - */ - -/** Host plugin body — no host-side behavior for this surface plugin. */ -export function apply(): void {} diff --git a/packages/client/ui-settings-plugins/tests/apply.client.spec.ts b/packages/client/ui-settings-plugins/tests/apply.client.spec.ts deleted file mode 100644 index 63ba773884..0000000000 --- a/packages/client/ui-settings-plugins/tests/apply.client.spec.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** What the browser half registers, and that it all leaves with the fiber. */ - -import { Context } from '@deepseek-ai/cordis' -import { describe, expect, it, vi } from 'vitest' -import { resolveSlotLabel } from '@deepseek-ai/dsh-client-ui-slots' -import { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client' -import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' -import { apply, inject } from '@deepseek-ai/dsh-client-ui-settings-plugins/client' -import type { PluginsSettingsSectionInjected } from '@deepseek-ai/dsh-client-ui-settings-plugins/client' -import { apply as hostApply } from '../src/index.ts' - -// These specs assert the shipped Chinese copy. The lane has no jsdom `window`, -// so browser-language detection never runs and a fresh LocaleRuntime opens on -// FALLBACK_LOCALE (en); bench stages zh explicitly on the locale instead. - -async function bench() { - const ctx = new Context() - await ctx.plugin(SlotRegistry).await() - const locale = new LocaleRuntime(ctx) - locale.setLocale('zh') - ctx.provide('locale', locale) - return { ctx, slots: ctx.get('slots') as SlotRegistry } -} - -/** The Settings shell's section slot, as its owner declares it. */ -function declareRoot(slots: SlotRegistry): () => void { - return slots.register({ - name: 'root', - children: { 'settings.section': { kind: 'list', scope: 'root' } }, - } as never, () => null) -} - -describe('ui-settings-plugins apply', () => { - it('keeps the host Loader entry inert', () => { - expect(hostApply).not.toThrow() - }) - - it('declares the services it uses', () => { - expect(inject).toEqual(['slots', 'locale']) - }) - - it('registers one Built-in plugins section and declares its tab slot, contributing no tab of its own', async () => { - const { ctx, slots } = await bench() - declareRoot(slots) - - await ctx.plugin({ inject: [...inject], apply }).await() - - const section = slots.entries('settings.section')[0]! - expect(section.options).toMatchObject({ id: 'plugins', order: 15 }) - // The nav label is a locale-following thunk; owners resolve it at read time. - expect(resolveSlotLabel(section.options.label)).toBe('内置插件') - expect(slots.spec('settings.plugins.tab')).toMatchObject({ kind: 'list', scope: 'root' }) - expect(slots.entries('settings.plugins.tab')).toHaveLength(0) - }) - - it('injects a live tab projection ordered by the contributions', async () => { - const { ctx, slots } = await bench() - declareRoot(slots) - await ctx.plugin({ inject: [...inject], apply }).await() - - const section = slots.entries('settings.section')[0]! - const sectionFace = (section.inject as () => Pick)() - const initialTabs = sectionFace.hooks.tabs.getSnapshot() - expect(initialTabs).toEqual([]) - expect(sectionFace.hooks.tabs.getSnapshot()).toBe(initialTabs) - - const unsubscribe = sectionFace.hooks.tabs.subscribe(vi.fn()) - slots.register({ name: 'settings.plugins.tab', id: 'plain' } as never, () => null) - slots.register({ name: 'settings.plugins.tab', id: 'first', order: -1 } as never, () => null) - // Tabs follow their contribution's order, whatever order they registered in. - expect(sectionFace.hooks.tabs.getSnapshot()).toEqual([ - { id: 'first', order: -1, label: '' }, - { id: 'plain', order: 0, label: '' }, - ]) - unsubscribe() - }) - - it('registers into a declaration that arrives after apply', async () => { - const { ctx, slots } = await bench() - await ctx.plugin({ inject: [...inject], apply }).await() - - declareRoot(slots) - - await vi.waitFor(() => { expect(slots.entries('settings.section')).toHaveLength(1) }) - }) - - it('collapses the section on teardown', async () => { - const { ctx, slots } = await bench() - declareRoot(slots) - const fiber = ctx.plugin({ inject: [...inject], apply }) - await fiber.await() - expect(slots.entries('settings.section')).toHaveLength(1) - - await fiber.dispose() - - expect(slots.entries('settings.section')).toHaveLength(0) - }) -}) diff --git a/packages/client/ui-settings-plugins/tests/section.client.spec.tsx b/packages/client/ui-settings-plugins/tests/section.client.spec.tsx deleted file mode 100644 index 7b4f0001ef..0000000000 --- a/packages/client/ui-settings-plugins/tests/section.client.spec.tsx +++ /dev/null @@ -1,93 +0,0 @@ -// @vitest-environment jsdom -/** The Built-in plugins section: its heading, its tab row, and which tab is mounted. */ - -import { cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, describe, expect, it } from 'vitest' -import { PluginsSettingsSection } from '../src/client/PluginsSettingsSection.tsx' -import type { PluginsSettingsSectionProps, PluginsSettingsTabEntry } from '../src/client/PluginsSettingsSection.tsx' -import { en } from '../src/client/locales.ts' - -afterEach(cleanup) - -const t = (key: keyof typeof en) => en[key] - -function renderSection(rows: readonly PluginsSettingsTabEntry[]) { - const props = { - t, - useTabs: (selector: (value: readonly PluginsSettingsTabEntry[]) => unknown) => selector(rows), - renderSlot: (_name: string, _owner: unknown, options: { only?: string }) => ( - {options.only} - ), - } as PluginsSettingsSectionProps - render() -} - -describe('PluginsSettingsSection', () => { - it('says so when no plugin contributed a tab', () => { - renderSection([]) - - expect(screen.getByText(en.empty)).toBeTruthy() - expect(screen.queryByRole('tab')).toBeNull() - }) - - it('defaults to the first ordered tab and mounts another only after selection', () => { - renderSection([ - { id: 'configurable', order: 0, label: 'Configurable' }, - { id: 'all', order: 10, label: 'Plugin list' }, - ]) - - const configurable = screen.getByRole('tab', { name: 'Configurable' }) - const all = screen.getByRole('tab', { name: 'Plugin list' }) - expect(configurable.getAttribute('aria-selected')).toBe('true') - expect(screen.getByText('configurable')).toBeTruthy() - expect(screen.queryByText('all')).toBeNull() - - fireEvent.click(all) - expect(all.getAttribute('aria-selected')).toBe('true') - expect(screen.getByText('all')).toBeTruthy() - expect(screen.getByText('configurable').closest('[role="tabpanel"]')).toHaveProperty('hidden', true) - - fireEvent.click(configurable) - expect(configurable.getAttribute('aria-selected')).toBe('true') - expect(screen.getByText('all').closest('[role="tabpanel"]')).toHaveProperty('hidden', true) - }) - - it('leads with its own heading and intro', () => { - renderSection([{ id: 'configurable', order: 0, label: 'Configurable' }]) - - expect(screen.getByRole('heading', { name: en.title })).toBeTruthy() - expect(screen.getByText(en.intro)).toBeTruthy() - }) - - it('moves focus and selection with standard horizontal tab keys', () => { - renderSection([ - { id: 'configurable', order: 0, label: 'Configurable' }, - { id: 'all', order: 10, label: 'Plugin list' }, - { id: 'diagnostics', order: 20, label: 'Diagnostics' }, - ]) - - const configurable = screen.getByRole('tab', { name: 'Configurable' }) - const all = screen.getByRole('tab', { name: 'Plugin list' }) - const diagnostics = screen.getByRole('tab', { name: 'Diagnostics' }) - expect(configurable.getAttribute('tabindex')).toBe('0') - expect(all.getAttribute('tabindex')).toBe('-1') - - configurable.focus() - fireEvent.keyDown(configurable, { key: 'ArrowRight' }) - expect(document.activeElement).toBe(all) - expect(all.getAttribute('aria-selected')).toBe('true') - - fireEvent.keyDown(all, { key: 'End' }) - expect(document.activeElement).toBe(diagnostics) - fireEvent.keyDown(diagnostics, { key: 'ArrowRight' }) - expect(document.activeElement).toBe(configurable) - fireEvent.keyDown(configurable, { key: 'ArrowLeft' }) - expect(document.activeElement).toBe(diagnostics) - fireEvent.keyDown(diagnostics, { key: 'Home' }) - expect(document.activeElement).toBe(configurable) - - fireEvent.keyDown(configurable, { key: 'Escape' }) - expect(document.activeElement).toBe(configurable) - expect(configurable.getAttribute('aria-selected')).toBe('true') - }) -}) diff --git a/packages/client/ui-settings-plugins/tsconfig.json b/packages/client/ui-settings-plugins/tsconfig.json deleted file mode 100644 index 92b5591b1f..0000000000 --- a/packages/client/ui-settings-plugins/tsconfig.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "extends": "../../../tsconfig.base.client.json", - "compilerOptions": { - "rootDir": "src", - "outDir": "lib/types" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../locale/tsconfig.client.json" - }, - { - "path": "../../../vendor/cordis" - }, - { - "path": "../../test-support/client-runtime" - }, - { - "path": "../ui-renderer" - }, - { - "path": "../ui-settings/tsconfig.client.json" - }, - { - "path": "../ui-slots" - }, - { - "path": "../../util/values" - } - ] -} diff --git a/packages/client/ui-settings-plugins/tsdown.config.ts b/packages/client/ui-settings-plugins/tsdown.config.ts deleted file mode 100644 index 7aa03cebc1..0000000000 --- a/packages/client/ui-settings-plugins/tsdown.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { clientBundle } from '../tsdown.client.ts' - -export default clientBundle(import.meta.dirname, ['lib/types/index.js']) diff --git a/packages/client/ui-settings/README.i18n.yaml b/packages/client/ui-settings/README.i18n.yaml index c830f51312..5a1a4df3b2 100644 --- a/packages/client/ui-settings/README.i18n.yaml +++ b/packages/client/ui-settings/README.i18n.yaml @@ -9,8 +9,8 @@ en: 720600abd76a4a91 zh: 822bda08efbfc3e4 /deepseek-ai-dsh-client-ui-settings/summary: - en: 0404ff8b4ec867e0 - zh: 9c3f03dfd1306cc9 + en: 1075b65d5fc8a89b + zh: 9da621629ee1db6f /deepseek-ai-dsh-client-ui-settings/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb @@ -24,8 +24,8 @@ en: f9963d1af2293fdd zh: dd221380e737c1d6 /deepseek-ai-dsh-client-ui-settings/use-this-package/filling-the-settings-slots: - en: a6506a37bdb03ac9 - zh: 6b7d74f1d60c6fd8 + en: e35f91d6e1dec279 + zh: e9a8a70953e0cccb /deepseek-ai-dsh-client-ui-settings/use-this-package/observable-success-and-failures: en: 9767f17ca0f02ae3 zh: 8e475d6d3d670702 @@ -42,8 +42,8 @@ en: 34872bda24dc50c6 zh: dcccef423906c408 /deepseek-ai-dsh-client-ui-settings/further-exploration: - en: 57e3fe18940ecc83 - zh: 165bd696250de5dc + en: 8775a7a24b986ed6 + zh: 938c7a0ef74dabd0 /deepseek-ai-dsh-client-ui-settings/model-experience: en: 3120df665299c634 zh: 1d9f365d091d0d2a diff --git a/packages/client/ui-settings/README.md b/packages/client/ui-settings/README.md index 51ef808ec7..a575d5b5e2 100644 --- a/packages/client/ui-settings/README.md +++ b/packages/client/ui-settings/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -This package lets web-client features expose editable preferences backed by the Host settings document without implementing their own transport or schema handling. Each feature gets namespace-scoped reads and writes, atomic multi-field updates, schema validation, and protection against silently overwriting concurrent changes. It also provides the standard extension points for settings chrome, pages, header actions, plugin tabs, and onboarding while rendering no interface itself. Any preference-owning feature can use it without depending on a presentation package; a separate package provides the settings shell. +This package lets web-client features expose editable preferences backed by the Host settings document without implementing their own transport or schema handling. Each feature gets namespace-scoped reads and writes, atomic multi-field updates, schema validation, and protection against silently overwriting concurrent changes. It also provides the standard extension points for settings chrome, pages, header actions, and onboarding while rendering no interface itself. Any preference-owning feature can use it without depending on a presentation package; a separate package provides the settings shell. ## Table of Contents @@ -42,7 +42,7 @@ A page that edits a namespace another plugin owns registers through `ctx.configF ### Filling the settings slots -A settings surface registers into the slot types this package declares. The shell (`sidebar.settings` occupant, navigation, chrome) lives in ui-settings-general; feature pages register `settings.section` contributions; the Plugins section hosts `settings.plugins.tab` pages; onboarding steps register `settings.onboarding`. Cross-namespace surfaces (schema introspection, the served-namespace directory, `hasDocument`) read the same mirror through `ctx.configForms.describe()`. +A settings surface registers into the slot types this package declares. The shell (`sidebar.settings` occupant, navigation, chrome) lives in ui-settings-general; Settings pages, including a plugin's own settings page, register `settings.section` contributions; the `settings.section.view` Component Factory, registered by ui-settings-general, declares that slot and renders the entry whose `id` the caller passes, with the caller's `close` action, both in Settings and on the [Plugins page](../ui-plugin-manager/README.md#configuration-pages); onboarding steps register `settings.onboarding`. Cross-namespace surfaces (schema introspection, the served-namespace directory, `hasDocument`) read the same mirror through `ctx.configForms.describe()`. To customize a page's navigation icon, use `ctx.slots.inject('settings.section.icon', ...)` and register an icon component with the same `id` as its `settings.section` contribution. Unmatched ids never render, and the icon's `label` option is not displayed. The component receives `size` in pixels and `active`; the shell owns the button, label, and decorative icon wrapper. Without a matching icon registration, the shell renders its default glyph. Disposing the icon contribution restores that glyph. @@ -84,7 +84,7 @@ The provider owns one controller per Host entry, including its subscription and These pages cover the settings surface family and the durable seam behind it. - [ui-settings-general](../ui-settings-general/README.md) — the settings shell: trigger chrome, navigation, General section, onboarding projection. -- [ui-settings-plugins](../ui-settings-plugins/README.md) — the Built-in plugins section shell around the inventory tab. +- [ui-plugin-manager](../ui-plugin-manager/README.md) — the Plugins page, which also shows a plugin's `settings.section` entry on that plugin's bundle row. - [ui-settings-shell](../ui-settings-shell/README.md), [ui-settings-agent-loop](../ui-settings-agent-loop/README.md), [ui-settings-subagent](../ui-settings-subagent/README.md), [ui-settings-web-search](../ui-settings-web-search/README.md) — the official configuration pages on the Plugins page, each following its namespaces through `whileServed`. - [ui-settings-models](../ui-settings-models/README.md) — the Models page and DeepSeek onboarding over this base. - [settings](../../settings/README.md) — the durable user-settings seam and its file provider. diff --git a/packages/client/ui-settings/README.zh.md b/packages/client/ui-settings/README.zh.md index fff25c57ec..3503c75b9d 100644 --- a/packages/client/ui-settings/README.zh.md +++ b/packages/client/ui-settings/README.zh.md @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -本包使 Web 客户端功能能够公开由宿主设置文档支持的可编辑偏好设置,而无需自行实现传输或 schema 处理。每项功能都可按命名空间读写、原子更新多个字段、校验 schema,并避免静默覆盖并发更改。它还为设置界面框架、页面、标题栏操作、插件标签页和引导流程提供标准扩展点,但自身不渲染任何界面。任何持有偏好设置的功能都可在不依赖呈现包的情况下使用它;设置外壳由单独的包提供。 +本包使 Web 客户端功能能够公开由宿主设置文档支持的可编辑偏好设置,而无需自行实现传输或 schema 处理。每项功能都可按命名空间读写、原子更新多个字段、校验 schema,并避免静默覆盖并发更改。它还为设置界面框架、页面、标题栏操作和引导流程提供标准扩展点,但自身不渲染任何界面。任何持有偏好设置的功能都可在不依赖呈现包的情况下使用它;设置外壳由单独的包提供。 ## 目录 @@ -42,7 +42,7 @@ kind: "package-reference" ### 填充设置 slot -设置界面会注册进本包声明的 slot 类型。外壳(`sidebar.settings` 占位方、导航、界面框架)位于 ui-settings-general;功能页面注册 `settings.section` 贡献;「插件」分区承载 `settings.plugins.tab` 页面;首次使用引导步骤注册 `settings.onboarding`。跨命名空间的表面(schema 内省、已服务命名空间目录、`hasDocument`)通过 `ctx.configForms.describe()` 读同一面镜像。 +设置界面会注册进本包声明的 slot 类型。外壳(`sidebar.settings` 占位方、导航、界面框架)位于 ui-settings-general;设置页面(包括插件自己的设置页面)注册 `settings.section` 贡献;由 ui-settings-general 注册的 `settings.section.view` Component Factory 声明该 slot,按调用方传入的 `id` 渲染对应条目,并传入调用方的 `close` 操作,设置与[插件页面](../ui-plugin-manager/README.zh.md#configuration-pages)都经由它渲染;首次使用引导步骤注册 `settings.onboarding`。跨命名空间的表面(schema 内省、已服务命名空间目录、`hasDocument`)通过 `ctx.configForms.describe()` 读同一面镜像。 要自定义页面的导航图标,使用 `ctx.slots.inject('settings.section.icon', ...)`,并以与其 `settings.section` 贡献相同的 `id` 注册图标组件。不匹配的 id 不会渲染,图标的 `label` 选项不会显示。组件接收以像素为单位的 `size` 和 `active`;外壳负责按钮、标签和装饰性图标容器。没有匹配的图标注册时,外壳渲染默认图标。释放图标贡献后恢复该默认图标。 @@ -84,7 +84,7 @@ kind: "package-reference" 以下页面覆盖设置界面家族及其背后的持久化 seam。 - [ui-settings-general](../ui-settings-general/README.zh.md)——设置外壳:触发控件、导航、「通用」分区、引导投影。 -- [ui-settings-plugins](../ui-settings-plugins/README.zh.md)——围绕清单标签页的「内置插件」分区壳。 +- [ui-plugin-manager](../ui-plugin-manager/README.zh.md)——插件页面,也在插件所在的组合包行上显示其 `settings.section` 条目。 - [ui-settings-shell](../ui-settings-shell/README.zh.md)、[ui-settings-agent-loop](../ui-settings-agent-loop/README.zh.md)、[ui-settings-subagent](../ui-settings-subagent/README.zh.md)、[ui-settings-web-search](../ui-settings-web-search/README.zh.md)——插件页上的官方配置页,各自通过 `whileServed` 跟随其命名空间。 - [ui-settings-models](../ui-settings-models/README.zh.md)——建立在本底座之上的 Models 页面与 DeepSeek 引导。 - [settings](../../settings/README.zh.md)——持久化用户设置 seam 及其文件提供方。 diff --git a/packages/client/ui-settings/src/client/contract/slots.ts b/packages/client/ui-settings/src/client/contract/slots.ts index dbab0c7df1..f9b89e70a6 100644 --- a/packages/client/ui-settings/src/client/contract/slots.ts +++ b/packages/client/ui-settings/src/client/contract/slots.ts @@ -12,6 +12,21 @@ import type {} from '@deepseek-ai/dsh-client-ui-slots' declare module '@deepseek-ai/dsh-client-ui-slots' { + interface SlotFactoryMap { + /** + * One `settings.section` entry, rendered wherever a surface shows that + * page: the Settings panel and the Plugins page. Props: `id` (the entry's + * id) and `close` (the surface's leave action, passed to the entry). + * Registered by the settings shell, which therefore declares + * `settings.section`. + */ + 'settings.section.view': { + scope: 'root' + props: SettingsSectionViewProps + children: { 'settings.section': { kind: 'list'; scope: 'root' } } + } + } + interface SlotMap { /** Optional sidebar account launcher; opens the shell-owned settings panel. */ 'settings.launcher': { kind: 'single'; scope: 'root'; owner: SettingsLauncherOwnerProps } @@ -44,12 +59,15 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { */ 'settings.close': { kind: 'single'; scope: 'root'; owner: SettingsHeaderOwnerProps } /** - * One settings page per list entry. Registrant options carry the nav + * One settings page per list entry, rendered through the + * `settings.section.view` Factory. Settings lists every entry in its + * navigation; the Plugins page also shows an entry on the listed bundle row + * (or bundle) whose module is the registering package, when that row (or + * bundle) registers no configuration of its own. Registrant options carry the nav * identity: `id` (section key, drives `only` filtering), `order` (nav - * position), `label` (registrant-localized display text — the registrant - * re-registers with fresh text on locale change, so the shell never - * subscribes locale state; the ledger bump doubles as the shell's - * re-render trigger). Sections render inside the panel content column. + * position), `label` (registrant-localized display text, usually a thunk + * that each projection re-reads on locale change). An entry renders + * wherever a caller renders `settings.section.view` with its id. * (`settings.general.item`, declared by ui-settings-general's General * entry, is typed in the locale package — the common dependency of every * item registrant; the shell neither declares nor renders it.) @@ -63,15 +81,6 @@ declare module '@deepseek-ai/dsh-client-ui-slots' { * no icon is registered for that id. */ 'settings.section.icon': { kind: 'list'; scope: 'root'; inline: true; owner: SettingsSectionIconOwnerProps } - /** - * One page inside the Plugins settings section. The section owner renders - * localized entry labels as tabs and mounts each contribution inside its - * corresponding tab panel. Options: `id` (tab key), `order` (tab order), - * and `label` (registrant-localized tab text). Declared at runtime by the - * feature that owns the Plugins section; the type lives here so inventory - * and configuration plugins collaborate without depending on one another. - */ - 'settings.plugins.tab': { kind: 'list'; scope: 'root'; owner: SettingsPluginsTabOwnerProps } /** * Root-scoped onboarding steps contributed by settings features. The * shell mounts one ordered step at a time; the active registrant either @@ -106,10 +115,12 @@ export interface SettingsGeneralItemOwnerProps { children?: never } -/** Owner share of a Plugins tab (the section supplies nothing). */ -export interface SettingsPluginsTabOwnerProps { - /** Marker field: tab owner props are intentionally empty. */ - children?: never +/** Caller props of the `settings.section.view` Factory. */ +export interface SettingsSectionViewProps { + /** The `settings.section` entry id to render. */ + id: string + /** The rendering surface's leave action. */ + close: () => void } /** Owner share of the trigger content seat: the sidebar column state. */ @@ -132,7 +143,7 @@ export interface SettingsHeaderOwnerProps { * onboarding coordinator's `openSection`/`complete` precedent, inverted. */ export interface SettingsSectionOwnerProps { - /** Close the settings panel (the shell owns the open state). */ + /** Leave the page: close the settings panel, or on the Plugins page return to the view the page was opened from. */ close: () => void } diff --git a/packages/client/ui-settings/src/client/index.ts b/packages/client/ui-settings/src/client/index.ts index 706aa6935f..6b23b57d2d 100644 --- a/packages/client/ui-settings/src/client/index.ts +++ b/packages/client/ui-settings/src/client/index.ts @@ -14,7 +14,7 @@ import { SettingsDescribeMirror } from './settings-mirror.ts' export type { SettingsLauncherOwnerProps, SettingsGeneralItemOwnerProps, SettingsHeaderOwnerProps, SettingsOnboardingOwnerProps, - SettingsPluginsTabOwnerProps, SettingsSectionIconOwnerProps, SettingsSectionOwnerProps, SettingsTriggerOwnerProps, + SettingsSectionIconOwnerProps, SettingsSectionOwnerProps, SettingsSectionViewProps, SettingsTriggerOwnerProps, } from './contract/slots.ts' export type { ConfigForms } from './config-form.ts' export type { ConfigForm, ConfigFormSnapshot } from './config-form-types.ts' diff --git a/packages/client/ui-slots/src/index.ts b/packages/client/ui-slots/src/index.ts index a6f829e884..bf1200e5d1 100644 --- a/packages/client/ui-slots/src/index.ts +++ b/packages/client/ui-slots/src/index.ts @@ -906,6 +906,8 @@ export interface StoredEntry { locale?: string | undefined /** Diagnostics label of who registered. */ registrant?: string | undefined + /** Package name of the Loader entry that registered, absent outside a Loader entry. */ + module?: string | undefined } /** @@ -942,6 +944,7 @@ interface ErasedOptions { * against the per-declaration InjectParams tuples. */ inject?: ((...args: any) => Record) | undefined registrant?: string | undefined + module?: string | undefined } /** @@ -1346,6 +1349,7 @@ export class SlotCore { ...(options.store !== undefined ? { store: options.store } : {}), ...(options.locale !== undefined ? { locale: options.locale } : {}), ...(options.registrant !== undefined ? { registrant: options.registrant } : {}), + ...(options.module !== undefined ? { module: options.module } : {}), } const next = [...rec.entries, entry] // Stable sorts: priority ascending for every kind, ties keep registration diff --git a/packages/client/web/README.i18n.yaml b/packages/client/web/README.i18n.yaml index 30ccb7a6b8..ee919f3db9 100644 --- a/packages/client/web/README.i18n.yaml +++ b/packages/client/web/README.i18n.yaml @@ -39,8 +39,8 @@ en: ad7ebdc7aa77c15d zh: 664520e0fd3ca7a1 /deepseek-ai-dsh-client-web/understand-the-implementation/boot-page-mechanics: - en: a651d65bede943a5 - zh: 481c25e6892a4abc + en: 53a2ba69069e423d + zh: 2ae3d6799d737c07 /deepseek-ai-dsh-client-web/understand-the-implementation/source-map: en: 36046f6bc4347fa5 zh: a6a8c55ba77fd77b @@ -54,8 +54,8 @@ en: ca75c51c89c2c9b0 zh: de54f3467ef3b9be /deepseek-ai-dsh-client-web/known-limitations-and-deferred-work: - en: 718bd1dee0fc8f2d - zh: 0053746647650ddd + en: b17cba687bc54061 + zh: 9950234ef2168329 /deepseek-ai-dsh-client-web/known-limitations-and-deferred-work/dev-note: en: e67f633dc6fe7773 zh: 3bb0c20c93f16f98 diff --git a/packages/client/web/README.md b/packages/client/web/README.md index 3f134e8e7c..57d0195c20 100644 --- a/packages/client/web/README.md +++ b/packages/client/web/README.md @@ -80,7 +80,7 @@ The kernel owns exactly three things: the module system, the Cordis Loader, and The boot page is plain DOM with local CSS whose fallback fonts and colors match the theme tokens that arrive during loading. `internal/status` events drive one spinner node; a failed entry is not drawn before the audit, because it may be optional. Hydration preserves the node and animation phase through the application commit, and `fail()` renders the thrown reason. React mounting, slot rendering, and assembly live in `ui-renderer`; `ui-layout` owns the assembled browser-title projection. -The boot kernel delegates manifest entry creation to Client Modules so live graph synchronization owns the same entry identities after startup. The initial activation audit rejects only required entries; later page-local failures appear in Settings → Plugins → Plugin list. +The boot kernel delegates manifest entry creation to Client Modules so live graph synchronization owns the same entry identities after startup. The initial activation audit rejects only required entries; later page-local failures appear in the synchronization notice at the top of the Plugins page. ### Source map @@ -130,7 +130,7 @@ None; this package neither assembles nor sends a provider request. These limits define what the boot kernel does not support. They are current package constraints, not a task backlog. -- **Optional boot failures start console-only** — an optional plugin that fails during the initial boot, including one whose creation the Loader rejects, appears in the console warning; Settings → Plugins → Plugin list lists it only after a later graph synchronization reconciles it. +- **Optional boot failures start console-only** — an optional plugin that fails during the initial boot, including one whose creation the Loader rejects, appears in the console warning; the Plugins page's synchronization notice lists it only after a later graph synchronization reconciles it. ### Dev Note diff --git a/packages/client/web/README.zh.md b/packages/client/web/README.zh.md index d07569351b..8ded88254b 100644 --- a/packages/client/web/README.zh.md +++ b/packages/client/web/README.zh.md @@ -80,7 +80,7 @@ kind: "package-library" 启动页是原生 DOM 加本地 CSS,其回退字体与颜色匹配加载期间到达的主题 token。`internal/status` 事件驱动一个 spinner 节点;失败的 entry 在审计前不绘制,因为它可能是可选的。hydrate 会保留该节点与动画相位直到应用提交,`fail()` 渲染抛出的原因。React 挂载、slot 渲染与应用组装位于 `ui-renderer`;`ui-layout` 拥有组装后的浏览器标题投影。 -启动内核把清单条目创建交给 Client Modules,使启动后的动态图同步继续持有相同的条目身份。初始激活审计只拒绝必需 entry;后续页面本地失败显示在「设置 → 插件 → 插件列表」。 +启动内核把清单条目创建交给 Client Modules,使启动后的动态图同步继续持有相同的条目身份。初始激活审计只拒绝必需 entry;后续页面本地失败显示在插件页面顶部的同步提示中。 ### 源码地图 @@ -130,7 +130,7 @@ kind: "package-library" 这些限制说明启动内核不支持什么。它们是当前包约束,不是任务积压。 -- **可选插件的启动失败起初只在控制台可见**——初始启动时失败的可选插件(包括 Loader 拒绝创建的插件)出现在控制台警告中;只有后续图同步调和之后,「设置 → 插件 → 插件列表」才会列出它。 +- **可选插件的启动失败起初只在控制台可见**——初始启动时失败的可选插件(包括 Loader 拒绝创建的插件)出现在控制台警告中;只有后续图同步调和之后,插件页面的同步提示才会列出它。 ### 开发备注 diff --git a/packages/extensions/cordis-client-runner/src/client/api-catalog.ts b/packages/extensions/cordis-client-runner/src/client/api-catalog.ts index 159ff226f0..c8ee6344b0 100644 --- a/packages/extensions/cordis-client-runner/src/client/api-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/api-catalog.ts @@ -1041,7 +1041,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'StoredEntry', - declaration: 'export interface StoredEntry {\n component: unknown;\n options: {\n key?: string;\n id?: string;\n order?: number;\n label?: SlotLabel;\n priority?: number;\n };\n select?: ((owner: never) => unknown) | undefined;\n inject?: ((...args: never[]) => Record) | undefined;\n children?: Readonly>> | undefined;\n store?: StoreDecl | undefined;\n locale?: string | undefined;\n registrant?: string | undefined;\n}', + declaration: 'export interface StoredEntry {\n component: unknown;\n options: {\n key?: string;\n id?: string;\n order?: number;\n label?: SlotLabel;\n priority?: number;\n };\n select?: ((owner: never) => unknown) | undefined;\n inject?: ((...args: never[]) => Record) | undefined;\n children?: Readonly>> | undefined;\n store?: StoreDecl | undefined;\n locale?: string | undefined;\n registrant?: string | undefined;\n module?: string | undefined;\n}', }, { name: 'StoredFactory', diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index 90519d863e..e9e6d4dfc6 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -3724,7 +3724,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.action\', () => ctx.slots.register(\n { name: \'settings.action\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:39', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:54', }, { key: 'settings.close', @@ -3758,7 +3758,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.close\', () => ctx.slots.register(\n { name: \'settings.close\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:45', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:60', }, { key: 'settings.general.item', @@ -3823,7 +3823,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.general.item\', () => ctx.slots.register(\n { name: \'settings.general.item\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:100', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:109', }, { key: 'settings.header', @@ -3857,7 +3857,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.header\', () => ctx.slots.register(\n { name: \'settings.header\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:33', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:48', }, { key: 'settings.launcher', @@ -3891,7 +3891,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.launcher\', () => ctx.slots.register(\n { name: \'settings.launcher\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:17', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:32', }, { key: 'settings.launcher.notifications', @@ -4103,67 +4103,14 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.onboarding\', () => ctx.slots.register(\n { name: \'settings.onboarding\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:85', - }, - { - key: 'settings.plugins.tab', - kind: 'list', - scope: 'root', - summary: 'One page inside the Plugins settings section.', - doc: 'One page inside the Plugins settings section. The section owner renders\nlocalized entry labels as tabs and mounts each contribution inside its\ncorresponding tab panel. Options: `id` (tab key), `order` (tab order),\nand `label` (registrant-localized tab text). Declared at runtime by the\nfeature that owns the Plugins section; the type lives here so inventory\nand configuration plugins collaborate without depending on one another.', - registerOptions: [ - { - name: 'id', - requirement: 'required', - type: 'string', - doc: 'Your cell key. Use an id of your own: a fresh id is added beside the shipped entries, while reusing a shipped id puts you in THAT cell and replaces it. Owners that filter by id address you by it.', - }, - { - name: 'order', - requirement: 'optional', - type: 'number', - doc: 'Position among the entries, ascending (default 0).', - }, - { - name: 'label', - requirement: 'optional', - type: 'string | (() => string)', - doc: 'Display text where the owner projects one (nav rows, tabs). A thunk is re-read on every projection, so localized text follows the active locale without re-registering.', - }, - ], - ownerProps: [ - '/** Owner share of a Plugins tab (the section supplies nothing). */\nexport interface SettingsPluginsTabOwnerProps {\n /** Marker field: tab owner props are intentionally empty. */\n children?: never\n}', - ], - ownerPropsReferences: [], - standardProps: [ - 'useRemoteAccess: (action: RemoteEndpoint) => boolean', - 'useResource: UseResource', - 'useContextMenu: UseContextMenu', - 'useWorkspaces: SnapshotSelectorHook', - 'usePanelInfo: UsePanelInfo', - 'useSessionStatus: UseSessionStatus', - 'useSessions: UseSessions', - 'useSessionRetainInfo: UseSessionRetainInfo', - 'useSessionAccess: (sessionId: SessionId, action: RemoteEndpoint) => boolean', - 'useWorkspaceAccess: (workspaceId: WorkspaceId, action: RemoteEndpoint) => boolean', - ], - keyDomain: '', - hookContext: '', - slotInject: '', - declaredBy: 'an entry in \'settings.section\' (client-ui-settings-plugins), so it exists while that entry is mounted', - occupants: [ - 'client-ui-settings-plugin-inventory PluginInventorySettingsTab id \'all\'', - ], - replaceRisk: 'none', - example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.plugins.tab\', () => ctx.slots.register(\n { name: \'settings.plugins.tab\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:74', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:94', }, { key: 'settings.section', kind: 'list', scope: 'root', - summary: 'One settings page per list entry.', - doc: 'One settings page per list entry. Registrant options carry the nav\nidentity: `id` (section key, drives `only` filtering), `order` (nav\nposition), `label` (registrant-localized display text — the registrant\nre-registers with fresh text on locale change, so the shell never\nsubscribes locale state; the ledger bump doubles as the shell\'s\nre-render trigger). Sections render inside the panel content column.\n(`settings.general.item`, declared by ui-settings-general\'s General\nentry, is typed in the locale package — the common dependency of every\nitem registrant; the shell neither declares nor renders it.)', + summary: 'One settings page per list entry, rendered through the `settings.section.view` Factory.', + doc: 'One settings page per list entry, rendered through the\n`settings.section.view` Factory. Settings lists every entry in its\nnavigation; the Plugins page also shows an entry on the listed bundle row\n(or bundle) whose module is the registering package, when that row (or\nbundle) registers no configuration of its own. Registrant options carry the nav\nidentity: `id` (section key, drives `only` filtering), `order` (nav\nposition), `label` (registrant-localized display text, usually a thunk\nthat each projection re-reads on locale change). An entry renders\nwherever a caller renders `settings.section.view` with its id.\n(`settings.general.item`, declared by ui-settings-general\'s General\nentry, is typed in the locale package — the common dependency of every\nitem registrant; the shell neither declares nor renders it.)', registerOptions: [ { name: 'id', @@ -4185,7 +4132,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ }, ], ownerProps: [ - '/**\n * Owner share of a settings section entry. The shell owns modal visibility\n * and navigation; a section\'s data arrives through its own inject faces and\n * stores. `close` is the one shell affordance a section receives, for flows\n * that leave settings altogether (starting a session from a section) — the\n * onboarding coordinator\'s `openSection`/`complete` precedent, inverted.\n */\nexport interface SettingsSectionOwnerProps {\n /** Close the settings panel (the shell owns the open state). */\n close: () => void\n}', + '/**\n * Owner share of a settings section entry. The shell owns modal visibility\n * and navigation; a section\'s data arrives through its own inject faces and\n * stores. `close` is the one shell affordance a section receives, for flows\n * that leave settings altogether (starting a session from a section) — the\n * onboarding coordinator\'s `openSection`/`complete` precedent, inverted.\n */\nexport interface SettingsSectionOwnerProps {\n /** Leave the page: close the settings panel, or on the Plugins page return to the view the page was opened from. */\n close: () => void\n}', ], ownerPropsReferences: [], standardProps: [ @@ -4203,17 +4150,17 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ keyDomain: '', hookContext: '', slotInject: '', - declaredBy: 'an entry in \'sidebar.settings\' (client-ui-settings-general), so it exists while that entry is mounted', + declaredBy: 'factory \'settings.section.view\' (client-ui-settings-general), so it exists while that definition is registered', occupants: [ 'client-ui-agent-preset AgentPresetSection id \'agent-presets\'', + 'client-ui-plugin-manager PluginsSettingsLink', 'client-ui-settings-account AccountSection id \'account\'', 'client-ui-settings-general GeneralSection id \'general\'', 'client-ui-settings-models ModelsSection id \'models\'', - 'client-ui-settings-plugins PluginsSettingsSection id \'plugins\'', ], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.section\', () => ctx.slots.register(\n { name: \'settings.section\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:57', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:75', }, { key: 'settings.section.icon', @@ -4264,7 +4211,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ occupants: [], replaceRisk: 'none', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.section.icon\', () => ctx.slots.register(\n { name: \'settings.section.icon\', id: \'my-entry\', order: 100, label: \'My entry\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:65', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:83', }, { key: 'settings.trigger', @@ -4298,7 +4245,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ ], replaceRisk: 'shadows-shipped-ui', example: 'return {\n inject: [\'slots\'],\n apply(ctx) {\n ctx.slots.inject(\'settings.trigger\', () => ctx.slots.register(\n { name: \'settings.trigger\' },\n () => React.createElement(\'div\', null, \'hello\'),\n ))\n },\n}', - source: 'packages/client/ui-settings/src/client/contract/slots.ts:27', + source: 'packages/client/ui-settings/src/client/contract/slots.ts:42', }, { key: 'shell.bottom', diff --git a/packages/host/plugin-inventory/README.i18n.yaml b/packages/host/plugin-inventory/README.i18n.yaml index 436960c853..5cafd64902 100644 --- a/packages/host/plugin-inventory/README.i18n.yaml +++ b/packages/host/plugin-inventory/README.i18n.yaml @@ -39,8 +39,8 @@ en: 0182cb9dbcff5eae zh: fce809d7b06d2ed8 /deepseek-ai-dsh-host-plugin-inventory/further-exploration: - en: 47de2da39cf6aefa - zh: c7e945dcba775177 + en: 5cf9e203d753f4c2 + zh: 88aaf9e765a52944 /deepseek-ai-dsh-host-plugin-inventory/model-experience: en: c3e5d5439c1a56fe zh: 32804643402d54ea diff --git a/packages/host/plugin-inventory/README.md b/packages/host/plugin-inventory/README.md index cd9ce7c0fa..59f67a5653 100644 --- a/packages/host/plugin-inventory/README.md +++ b/packages/host/plugin-inventory/README.md @@ -77,11 +77,11 @@ Typert generates the Host and Client Remote artifacts exposed by `./typert` and ## Further Exploration -Read these when the inventory contract is not enough: how the Remote reaches clients, then the Loader it projects and the surface that renders it. +Read these when the inventory contract is not enough: how the Remote reaches clients, then the Loader it projects and the page that reads it. - [Remote assembly](../../api/remotes/README.md) — how clients consume `pluginInventory/list` without importing the Host implementation. - [Cordis plugin loader](../../../vendor/loader/README.md) — the Loader whose entries this package projects. -- [Plugin inventory settings surface](../../client/ui-settings-plugin-inventory/README.md) — the browser-side projection that renders the inventory. +- [Plugin manager page](../../client/ui-plugin-manager/README.md) — the Web Plugins page, which reads the inventory for managed-profile status and startup diagnostics. ----- diff --git a/packages/host/plugin-inventory/README.zh.md b/packages/host/plugin-inventory/README.zh.md index 8392526a96..24c6413bf9 100644 --- a/packages/host/plugin-inventory/README.zh.md +++ b/packages/host/plugin-inventory/README.zh.md @@ -77,11 +77,11 @@ Typert 生成由 `./typert` 与 `./remote` 导出的 Host 和 Client Remote 产 ## 进一步探索 -当清单约定不够用时阅读以下内容:先看 Remote 如何到达客户端,再看它所投影的 Loader 与渲染它的界面。 +当清单约定不够用时阅读以下内容:先看 Remote 如何到达客户端,再看它所投影的 Loader 与读取它的页面。 - [Remote 组合](../../api/remotes/README.zh.md)——客户端如何在不导入 Host 实现的情况下消费 `pluginInventory/list`。 - [Cordis 插件 loader](../../../vendor/loader/README.md)——本包所投影条目的那个 Loader。 -- [插件清单设置界面](../../client/ui-settings-plugin-inventory/README.zh.md)——渲染该清单的浏览器侧投影。 +- [插件管理页](../../client/ui-plugin-manager/README.zh.md)——Web 插件页面,读取该清单以获取受管 profile 状态与启动诊断。 ----- diff --git a/packages/preset/agent-preset/skills/dsh-doc/references/packages.md b/packages/preset/agent-preset/skills/dsh-doc/references/packages.md index 5a05fee3c0..72f40e5757 100644 --- a/packages/preset/agent-preset/skills/dsh-doc/references/packages.md +++ b/packages/preset/agent-preset/skills/dsh-doc/references/packages.md @@ -106,8 +106,6 @@ Every package below exports a Cordis plugin that a bundle patch can name in a Lo | `@deepseek-ai/dsh-client-ui-settings-agent-loop` | no | Settings page of the agent loop on the dsh web client's Plugins page: the parallel tool-call cap of the agent-loop namespace | | `@deepseek-ai/dsh-client-ui-settings-general` | no | Settings ownerless-copy and product onboarding plugin: the General section, shell trigger/header chrome content, settings dictionaries, and the versioned welcome notice | | `@deepseek-ai/dsh-client-ui-settings-models` | yes | Models settings and shared product-onboarding dialogs over existing settings and credential joins | -| `@deepseek-ai/dsh-client-ui-settings-plugin-inventory` | no | Read-only Cordis Loader inventory tab in Web Plugins settings | -| `@deepseek-ai/dsh-client-ui-settings-plugins` | no | Built-in plugins settings section for the dsh web client: the Settings navigation entry and the tab chrome feature-owned tabs register into | | `@deepseek-ai/dsh-client-ui-settings-session-log` | no | General settings control for Session-log upload with DeepSeek API requests | | `@deepseek-ai/dsh-client-ui-settings-shell` | no | Settings page of the shell executor on the dsh web client's Plugins page: the command timeout and the per-stream output cap of the shell namespace | | `@deepseek-ai/dsh-client-ui-settings-subagent` | no | Settings page of Subagent delegation on the dsh web client's Plugins page: recursion depth, parallel capacity, and the models agents may choose for subagents | diff --git a/packages/util/official-bundles/src/plugin-manager.ts b/packages/util/official-bundles/src/plugin-manager.ts index 3027766be8..98ff3fe6da 100644 --- a/packages/util/official-bundles/src/plugin-manager.ts +++ b/packages/util/official-bundles/src/plugin-manager.ts @@ -9,7 +9,7 @@ export const PROTECTED_PLUGINS: ReadonlySet = new Set([ '@deepseek-ai/dsh-plugin-manager', '@deepseek-ai/cordis-plugin-loader', '@deepseek-ai/cordis-plugin-include', '@deepseek-ai/dsh-api-gateway', '@deepseek-ai/dsh-host-webserver', '@deepseek-ai/dsh-client-modules', - '@deepseek-ai/dsh-client-ui-settings-plugin-inventory', '@deepseek-ai/dsh-client-ui-plugin-manager', + '@deepseek-ai/dsh-client-ui-plugin-manager', '@deepseek-ai/dsh-host-plugin-inventory', '@deepseek-ai/dsh-typert-registry', '@deepseek-ai/dsh-api-remotes', '@deepseek-ai/dsh-api-remote-access', '@deepseek-ai/cordis-plugin-timer', '@deepseek-ai/dsh-client-connection', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 74fe0f3e73..725ae9e646 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3193,12 +3193,6 @@ importers: '@deepseek-ai/dsh-client-ui-settings-models': specifier: workspace:* version: link:../../client/ui-settings-models - '@deepseek-ai/dsh-client-ui-settings-plugin-inventory': - specifier: workspace:* - version: link:../../client/ui-settings-plugin-inventory - '@deepseek-ai/dsh-client-ui-settings-plugins': - specifier: workspace:* - version: link:../../client/ui-settings-plugins '@deepseek-ai/dsh-client-ui-settings-session-log': specifier: workspace:* version: link:../../client/ui-settings-session-log @@ -5449,6 +5443,9 @@ importers: '@deepseek-ai/dsh-client-locale': specifier: workspace:* version: link:../locale + '@deepseek-ai/dsh-client-modules': + specifier: workspace:* + version: link:../modules '@deepseek-ai/dsh-client-product-analytics': specifier: workspace:* version: link:../product-analytics @@ -6214,87 +6211,6 @@ importers: specifier: ^18.2.0 version: 18.3.1 - packages/client/ui-settings-plugin-inventory: - devDependencies: - '@deepseek-ai/cordis': - specifier: workspace:~ - version: link:../../../vendor/cordis - '@deepseek-ai/dsh-agent-preset-registry': - specifier: workspace:* - version: link:../../preset/agent-preset-registry - '@deepseek-ai/dsh-api-remotes': - specifier: workspace:* - version: link:../../api/remotes - '@deepseek-ai/dsh-client-locale': - specifier: workspace:* - version: link:../locale - '@deepseek-ai/dsh-client-modules': - specifier: workspace:* - version: link:../modules - '@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-agent-preset': - specifier: workspace:* - version: link:../ui-agent-preset - '@deepseek-ai/dsh-client-ui-primitives': - specifier: workspace:* - version: link:../ui-primitives - '@deepseek-ai/dsh-client-ui-renderer': - specifier: workspace:* - version: link:../ui-renderer - '@deepseek-ai/dsh-client-ui-settings': - specifier: workspace:* - version: link:../ui-settings - '@deepseek-ai/dsh-client-ui-slots': - specifier: workspace:* - version: link:../ui-slots - '@deepseek-ai/dsh-package-manifest': - specifier: workspace:* - version: link:../../util/package-manifest - '@deepseek-ai/dsh-util-text-search': - specifier: workspace:* - version: link:../../util/text-search - '@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-settings-plugins: - devDependencies: - '@deepseek-ai/cordis': - specifier: workspace:~ - version: link:../../../vendor/cordis - '@deepseek-ai/dsh-client-locale': - specifier: workspace:* - version: link:../locale - '@deepseek-ai/dsh-client-test-runtime': - specifier: workspace:* - version: link:../../test-support/client-runtime - '@deepseek-ai/dsh-client-ui-renderer': - specifier: workspace:* - version: link:../ui-renderer - '@deepseek-ai/dsh-client-ui-settings': - specifier: workspace:* - version: link:../ui-settings - '@deepseek-ai/dsh-client-ui-slots': - specifier: workspace:* - version: link:../ui-slots - '@deepseek-ai/dsh-util-values': - specifier: workspace:* - version: link:../../util/values - react: - specifier: ^18.2.0 - version: 18.3.1 - packages/client/ui-settings-session-log: devDependencies: '@deepseek-ai/cordis': diff --git a/scripts/gen-doc-graphs.ts b/scripts/gen-doc-graphs.ts index d5b478e3c5..bee8a5c035 100644 --- a/scripts/gen-doc-graphs.ts +++ b/scripts/gen-doc-graphs.ts @@ -174,7 +174,7 @@ const SERVICE_ROLES: ServiceRole[] = [ pkg: 'plugin-manager', title: 'Current-profile plugin and bundle management', mode: 'core', - consumers: ['plugin-manager', 'ui-settings-plugin-inventory'], + consumers: ['plugin-manager'], note: 'Shares profile package operations with the CLI and reports persisted and running state to Web and agent callers.', }, { diff --git a/scripts/no-unknown-casts.baseline.json b/scripts/no-unknown-casts.baseline.json index 8b3c940475..5b255eabbd 100644 --- a/scripts/no-unknown-casts.baseline.json +++ b/scripts/no-unknown-casts.baseline.json @@ -564,15 +564,6 @@ "packages/client/ui-settings-models/tests/store.client.spec.ts": { "6b8b0a920c558092d20bc17623b7050e0f7403f896fde7da17bb45677899b910": 1 }, - "packages/client/ui-settings-plugin-inventory/tests/browser-plugin.client.spec.tsx": { - "04984a2ce1486250236e638e0197da0a1a840855ed3975c59130a85358c7e5fe": 1, - "85f4d0d762126e709ae2178ca656f586dac1ba425eb1d8dd402cb5577d6e8225": 1 - }, - "packages/client/ui-settings-plugin-inventory/tests/components.client.spec.tsx": { - "0d78ec7c8ca39f70a4033ff4d330f8ef26832bb89932f98d1c87d76b4ce16d00": 1, - "79c53da50aa08004e201cebca842267ae2650a543b435a7906960f6492c2398b": 1, - "a3c1509d552d0102e118f3071a234002a5c83c30ca6923f8a87e9e3733ce0dcf": 1 - }, "packages/client/ui-settings/tests/schema.client.spec.ts": { "0584be4cde4cd33049ef7c02e9d1562a30ec48ef2176f2f22b328b5be2903407": 1 }, diff --git a/scripts/rescope-vendor.ts b/scripts/rescope-vendor.ts index 7a5dc46818..28944a2a0a 100644 --- a/scripts/rescope-vendor.ts +++ b/scripts/rescope-vendor.ts @@ -169,7 +169,6 @@ const GENERIC_SKIPS: readonly GenericSkip[] = [ { file: 'packages/experimental/inspector/tests/plugin.client.spec.ts', upstream: ['cordis'] }, { file: 'scripts/gen-cordis-catalog.ts', upstream: ['cordis'] }, // The UI locale namespace and input-trigger source id are product keys. - { file: 'packages/client/ui-settings-plugin-inventory/src/client/PluginInventorySettingsTab.tsx', upstream: ['cordis'] }, { file: 'packages/extensions/ui-cordis/src/client/CordisActionRow.tsx', upstream: ['cordis'] }, { file: 'packages/extensions/ui-cordis/src/client/CordisDefineRow.tsx', upstream: ['cordis'] }, { file: 'packages/extensions/ui-cordis/src/client/CordisPanel.tsx', upstream: ['cordis'] }, diff --git a/scripts/verify-package-readme-model-experience.ts b/scripts/verify-package-readme-model-experience.ts index ac793f59a6..cf7b010c6c 100644 --- a/scripts/verify-package-readme-model-experience.ts +++ b/scripts/verify-package-readme-model-experience.ts @@ -168,7 +168,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly> = { 'packages/client/ui-goal': { kind: 'indirect', reason: 'The strip verbs route goal.* mutations; the host GoalService owns the model-visible goal/change context message.' }, 'packages/extensions/ui-cordis': { kind: 'indirect', reason: 'The definition card drives the host dynamic run/stop verbs that the model\'s cordis_run/cordis_stop tools also reach; the runner owns any model-visible effect.' }, 'packages/client/ui-permission-presets': { kind: 'indirect', reason: 'The picker submits the host /permission command; the knob events it appends own the model-visible effect through the sandbox/approval consumers.' }, - 'packages/client/ui-settings-plugins': { kind: 'none', reason: 'Browser-side settings surface; registers no model surface.' }, 'packages/client/ui-settings-shell': { kind: 'none', reason: 'Browser-side settings surface; registers no model surface.' }, 'packages/client/ui-settings-session-log': { kind: 'none', reason: 'Browser preference controls request metadata, not model input.' }, 'packages/client/ui-settings-agent-loop': { kind: 'none', reason: 'Browser-side settings surface; registers no model surface.' }, @@ -190,7 +189,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly> = { 'packages/client/ui-settings-models': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' }, 'packages/client/ui-plugin-market': { kind: 'none', reason: 'Browser-side Discover tab; registers nothing model-facing.' }, 'packages/client/ui-plugin-manager': { kind: 'none', reason: 'Browser-side management surface; registers nothing model-facing.' }, - 'packages/client/ui-settings-plugin-inventory': { kind: 'none', reason: 'Browser-side inventory projection; registers nothing model-facing.' }, 'packages/client/locale': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' }, 'packages/client/web': { kind: 'none', reason: 'Browser-side UI plugin layer; registers nothing model-facing.' }, 'packages/context/file-reference': { kind: 'indirect', reason: 'The discovery seam and grammar delegate model guidance to the composed provider.' }, diff --git a/tsconfig.base.json b/tsconfig.base.json index f4fdc96831..89cfcd9656 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -346,7 +346,6 @@ "@deepseek-ai/dsh-client-ui-agent-team/client": ["./packages/client/ui-agent-team/src/client/index.ts"], "@deepseek-ai/dsh-experimental-client-ui-stats": ["./packages/experimental/client-ui-stats/src"], "@deepseek-ai/dsh-experimental-client-ui-stats/client": ["./packages/experimental/client-ui-stats/src/client/index.ts"], - "@deepseek-ai/dsh-client-ui-settings-plugins": ["./packages/client/ui-settings-plugins/src"], "@deepseek-ai/dsh-client-ui-settings-shell": ["./packages/client/ui-settings-shell/src"], "@deepseek-ai/dsh-cua/client": ["./packages/experimental/cua/src/client/index.ts"], "@deepseek-ai/dsh-timeline/client": ["./packages/experimental/timeline/src/client/index.ts"], @@ -372,7 +371,6 @@ "@deepseek-ai/dsh-client-ui-settings-models": ["./packages/client/ui-settings-models/src"], "@deepseek-ai/dsh-client-ui-plugin-manager": ["./packages/client/ui-plugin-manager/src"], "@deepseek-ai/dsh-client-ui-plugin-market": ["./packages/client/ui-plugin-market/src"], - "@deepseek-ai/dsh-client-ui-settings-plugin-inventory": ["./packages/client/ui-settings-plugin-inventory/src"], "@deepseek-ai/dsh-client-locale": ["./packages/client/locale/src"], "@deepseek-ai/dsh-client-web/injections": ["./packages/client/web/src/apply-injections.ts"], "@deepseek-ai/dsh-client-web": ["./packages/client/web/src"], diff --git a/tsconfig.client.json b/tsconfig.client.json index e1bf2cfdf8..2439d3f760 100644 --- a/tsconfig.client.json +++ b/tsconfig.client.json @@ -148,7 +148,6 @@ { "path": "./packages/client/ui-agent-preset" }, { "path": "./packages/client/ui-permission-presets" }, { "path": "./packages/client/ui-plan" }, - { "path": "./packages/client/ui-settings-plugins" }, { "path": "./packages/client/ui-settings-shell" }, { "path": "./packages/client/ui-settings-agent-loop" }, { "path": "./packages/experimental/cua/tsconfig.client.json" }, @@ -167,7 +166,6 @@ { "path": "./packages/client/ui-settings-models" }, { "path": "./packages/client/ui-plugin-manager/tsconfig.client.json" }, { "path": "./packages/client/ui-plugin-market" }, - { "path": "./packages/client/ui-settings-plugin-inventory" }, { "path": "./packages/client/locale/tsconfig.client.json" }, { "path": "./packages/client/ui-renderer" }, { "path": "./packages/client/ui-session" },