diff --git a/packages/boot/plugin-manager/README.i18n.yaml b/packages/boot/plugin-manager/README.i18n.yaml index b40049c632..25ba8b79d6 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: 4bda68030a6999e0 - zh: 5ae0b9825341c05e + en: 312b38cd9d5ede65 + zh: 8110a53f94b943d3 /deepseek-ai-dsh-plugin-manager/use-this-package/version-compatibility-and-exemptions: en: 483285658e267dd5 zh: 846bec2daac59a96 diff --git a/packages/boot/plugin-manager/README.md b/packages/boot/plugin-manager/README.md index fd75a0d46a..d49ab39fbe 100644 --- a/packages/boot/plugin-manager/README.md +++ b/packages/boot/plugin-manager/README.md @@ -41,7 +41,7 @@ A plugin toggle updates only `disabled` in the last matching override in the pro Bundle platform declarations are checked before saving an enabled selection. Unsupported Hosts return `unsupported-platform`. The bundle remains visible with its display metadata and can still be deselected. Automatic activation after a package operation uses the same check. The agent-facing next step asks the user to run the bundle on a supported Host. -`listBundles` retains default-hidden bundles and derives `listedByDefault` from each package’s visibility declaration and Host platform support. Unsupported bundles are hidden from default GUI lists, including More; explicit profile dependencies and saved selections remain manageable with the platform reason and deselection available. The offline Official catalog carries the same package-owned platform declaration, so uninstalled entries are checked without resolving provider code or querying a registry. These checks do not change selection or activation. A non-boolean declaration returns a metadata diagnostic. A selected bundle that cannot load remains in `listBundles` with an `error`; `enabled` records the saved selection, not successful loading. The plugin page shows the error and allows deselection. A broken bundle cannot be enabled. Management bundles remain protected if their files become unreadable. +`listBundles` retains default-hidden bundles and derives `listedByDefault` from each package’s visibility declaration and Host platform support. Unsupported bundles are hidden from default GUI lists, including More; explicit profile dependencies and saved selections remain manageable with the platform reason and deselection available. The offline Official catalog carries the same package-owned platform declaration, so uninstalled entries are checked without resolving provider code or querying a registry. These checks do not change selection or activation. A non-boolean declaration is reported in `error` while the bundle's rows stay listed, because the launcher does not read it. A selected bundle that cannot load remains in `listBundles` with an `error` and no row carrying an `entryId`; `enabled` records the saved selection, not successful loading. The plugin page marks it as not running and allows deselection. A broken bundle cannot be enabled. Management bundles remain protected if their files become unreadable. `listBundles` includes optional display `meta` for each bundle and its declared plugin rows, including disabled bundles. The Client selects a language from these values. The separate `description` field is the bundle's raw `package.json.description`; a metadata diagnostic does not block management. `source` gives a profile dependency as a spec `pnpm add` accepts: a git address or URL as recorded without the user information of an http(s) URL (a query string stays as recorded), a `file:` or `link:` path made absolute against the profile or the home directory for `~`, and a registry range, tag, or alias after the package name, as is any spec of a package installed under another name; a bundle the installation supplies has none, even when the profile also depends on it, because the installation's copy is the one that loads. The `plugin_manager` tool omits UI display metadata and update eligibility from list results. diff --git a/packages/boot/plugin-manager/README.zh.md b/packages/boot/plugin-manager/README.zh.md index 46a95a412e..d35c1e1bfd 100644 --- a/packages/boot/plugin-manager/README.zh.md +++ b/packages/boot/plugin-manager/README.zh.md @@ -41,7 +41,7 @@ kind: "package-reference" 组合包的平台声明会在保存启用选择前检查。Host 不受支持时返回 `unsupported-platform`。组合包仍保留显示信息,并允许取消选择。包操作后的自动启用执行同一检查。给模型的下一步说明会提示用户在受支持的 Host 上运行该组合包。 -`listBundles` 保留默认隐藏的组合包,根据各包的展示声明和 Host 平台支持范围生成 `listedByDefault`。不支持的组合包默认不出现在主列表或“更多”中;profile 显式安装的依赖和已保存的选择仍可管理,显示平台原因并允许关闭。官方离线目录携带同一份包级平台声明,因此无需解析提供方代码或查询注册表,也能检查未安装的条目。这些检查不改变选择或激活状态。声明不是布尔值时返回元数据诊断。已选择但无法加载的组合包仍会出现在 `listBundles` 中,并携带 `error`;`enabled` 表示保存的选择,不代表加载成功。插件页面显示错误并允许取消选择。损坏的组合包无法启用。管理组合包的文件变得不可读后仍受保护。 +`listBundles` 保留默认隐藏的组合包,根据各包的展示声明和 Host 平台支持范围生成 `listedByDefault`。不支持的组合包默认不出现在主列表或“更多”中;profile 显式安装的依赖和已保存的选择仍可管理,显示平台原因并允许关闭。官方离线目录携带同一份包级平台声明,因此无需解析提供方代码或查询注册表,也能检查未安装的条目。这些检查不改变选择或激活状态。非布尔值的声明会在 `error` 中报告,同时该组合包的行仍会列出,因为启动器不读取该声明。已选择但无法加载的组合包仍会出现在 `listBundles` 中,携带 `error`,且没有带 `entryId` 的行;`enabled` 表示保存的选择,不代表加载成功。插件页面将其标记为未运行,并允许取消选择。损坏的组合包无法启用。管理组合包的文件变得不可读后仍受保护。 `listBundles` 为各组合包及其声明的插件行提供可选的展示 `meta`,包括已禁用的组合包。Client 从这些值中选择语言。单独的 `description` 字段是该组合包原始的 `package.json.description`;元信息诊断不会阻止管理操作。`source` 以 `pnpm add` 接受的 spec 给出 profile 依赖:git 地址或 URL 按记录给出,但去掉 http(s) URL 的 user information(查询字符串保持原样);`file:` 或 `link:` 路径按 profile 目录解析为绝对路径,`~` 展开为主目录;注册表版本范围、标签或别名接在包名的 `@` 之后,以别名安装的包的 spec 也是如此。安装提供的组合包没有该字段,即使 profile 也依赖它,因为实际加载的是安装中的副本。`plugin_manager` 工具的列表结果不包含 UI 展示元信息和更新资格。 diff --git a/packages/boot/plugin-manager/src/index.ts b/packages/boot/plugin-manager/src/index.ts index 271e6af0d3..ae3d93b27c 100644 --- a/packages/boot/plugin-manager/src/index.ts +++ b/packages/boot/plugin-manager/src/index.ts @@ -547,9 +547,11 @@ export class PluginManager extends TypertRemoteService { } version = info.version const listedByDefault = info.dsh?.bundle?.listedByDefault + // The launcher ignores this display field, so an invalid value is reported beside the bundle's rows instead of replacing them. + let listingError: ManagementError | undefined if (listedByDefault !== undefined) { - if (typeof listedByDefault !== 'boolean') throw new Error('dsh.bundle.listedByDefault must be a boolean') - listing = { listedByDefault } + if (typeof listedByDefault !== 'boolean') listingError = { code: 'operation-error', diagnostic: 'dsh.bundle.listedByDefault must be a boolean' } + else listing = { listedByDefault } } const compatibility = evaluatePluginCompatibility(info, exemptions) if (compatibility !== undefined && !compatibility.exempted) throw new ManagementFailure('incompatible-version', [incompatiblePlugin(compatibility)]) @@ -559,7 +561,7 @@ export class PluginManager extends TypertRemoteService { try { assertBundlePlatform(info.dsh?.bundle?.platforms, process.platform) } catch (error) { platformError = managementError(error) } if (platformError?.code === 'unsupported-platform') listing = { listedByDefault: false } - const error = platformError ?? targetError + const error = platformError ?? targetError ?? listingError bundles.push({ name, official, availability, ...listing, ...target, ...(version === undefined ? {} : { version }), ...(info.description === undefined || info.description === '' ? {} : { description: info.description }), ...meta === undefined ? {} : { meta }, diff --git a/packages/boot/plugin-manager/src/types.ts b/packages/boot/plugin-manager/src/types.ts index efef87b4dc..17fcda251f 100644 --- a/packages/boot/plugin-manager/src/types.ts +++ b/packages/boot/plugin-manager/src/types.ts @@ -85,7 +85,10 @@ export interface BundleInfo { description?: string /** Default GUI visibility after package and Host checks; selected or profile-installed bundles remain manageable. */ listedByDefault?: boolean - /** Selected in the profile manifest; a load error means its layer was skipped. */ + /** + * Selected in the profile manifest. A selected bundle whose layer was skipped carries the load `error`, and none of + * its `rows` has an `entryId`; an `error` beside a live row reports a problem that did not stop the layer. + */ enabled: boolean /** Whether the profile declares this dependency; availability separately reports whether its files can be read. */ installed: boolean diff --git a/packages/boot/plugin-manager/tests/manager.spec.ts b/packages/boot/plugin-manager/tests/manager.spec.ts index 0f8290a48d..019da340f9 100644 --- a/packages/boot/plugin-manager/tests/manager.spec.ts +++ b/packages/boot/plugin-manager/tests/manager.spec.ts @@ -435,8 +435,10 @@ it('projects each bundle\'s default GUI listing without changing its selection, } manifest.dsh.bundle.listedByDefault = 'hidden' writeFileSync(path, JSON.stringify(manifest)) + // The launcher ignores the field, so the running layer keeps its live row beside the diagnostic. expect((await manager.listBundles()).find(row => row.name === 'extra')).toMatchObject({ enabled: true, - error: { diagnostic: 'dsh.bundle.listedByDefault must be a boolean' } }) + error: { code: 'operation-error', diagnostic: 'dsh.bundle.listedByDefault must be a boolean' }, + rows: [{ rowId: 'managed', entryId: 'include:managed' }] }) }) it('names where each installed bundle comes from as a spec pnpm installs', async () => { diff --git a/packages/client/ui-plugin-manager/README.i18n.yaml b/packages/client/ui-plugin-manager/README.i18n.yaml index c1aab681db..be62d9c325 100644 --- a/packages/client/ui-plugin-manager/README.i18n.yaml +++ b/packages/client/ui-plugin-manager/README.i18n.yaml @@ -24,8 +24,8 @@ en: 9312d8b1b381378f zh: 8d0ae7ad26ada2ac /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-a-bundle: - en: 390dc85aceac033a - zh: 746ceae45f70dd33 + en: eb5e4c9b6eebadc2 + zh: e6d41e8586190fa0 /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/switching-one-row-of-a-bundle: en: d3627d4dba5e6cc2 zh: e0d0eada4c20331f @@ -33,8 +33,8 @@ en: e9da90f03691101b zh: 902cda935a4ce3c8 /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/detail-page-extension-points: - en: d5e3cad5c31cae59 - zh: 6dc38f09b410d247 + en: 16dbfb0ab558c951 + zh: adf098c0751a7144 /deepseek-ai-dsh-client-ui-plugin-manager/use-this-package/page-tabs: en: fc469bab4fbd6028 zh: 8f5a04e1b9a46471 diff --git a/packages/client/ui-plugin-manager/README.md b/packages/client/ui-plugin-manager/README.md index 397dd2495f..dc0eed74e9 100644 --- a/packages/client/ui-plugin-manager/README.md +++ b/packages/client/ui-plugin-manager/README.md @@ -76,7 +76,7 @@ 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. 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 no live row, 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. ### Switching one row of a bundle @@ -98,7 +98,7 @@ The bundle's patch must declare the row under that id, and the registration exis ### 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 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`. +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`. ```tsx ignore-check ctx.slots.inject('plugins.detail.section', () => ctx.slots.register({ diff --git a/packages/client/ui-plugin-manager/README.zh.md b/packages/client/ui-plugin-manager/README.zh.md index dccd4cacd3..e3438b6957 100644 --- a/packages/client/ui-plugin-manager/README.zh.md +++ b/packages/client/ui-plugin-manager/README.zh.md @@ -76,7 +76,7 @@ Host 将网络失败或超时归因于 GitHub 地址,且提供 npmmirror 时 ### 切换一个组合包 -组合包页面在标题下方显示完整包名。组件列表之后的「来源信息」给出在别处安装它所需的 spec(`pnpm add` 接受的形式),安装随附的官方组合包显示「内置」,随后是当前版本。组合包开关改变其层选择。profile 变更触发重新读取时,已显示的详情文档保持可见,直到新结果返回。Host 应用更改期间,开关保持禁用,旁边显示旋转指示器;操作区在开关左侧固定预留 22px。常驻状态区域向屏幕阅读器播报进行中的更改。启用了 HMR 的 profile 在操作完成前重组;没有 HMR 的 profile,以及被更高层覆盖的组合包,会以 toast 说明。Host 读不了的组合包带异常标签,其页面给出原因,且不能打开;提供管理组件的组合包保持锁定。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 清单仍保留完整数据;设置中「插件」分区的「插件列表」标签页负责查看它们的插件。 ### 切换组合包里的一行 @@ -98,7 +98,7 @@ ctx.slots.inject('plugins.row.config', () => ctx.slots.register({ ### 详情页扩展点 -对某个不属于自己的组合包、行或官方插件有话要说的插件,通过本页声明的三个 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` 排列条目。 +对某个不属于自己的组合包、行或官方插件有话要说的插件,通过本页声明的三个 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` 排列条目。 ```tsx ignore-check ctx.slots.inject('plugins.detail.section', () => ctx.slots.register({ 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 b9516b2a10..d9df0634f7 100644 --- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css +++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.module.css @@ -392,6 +392,11 @@ color: var(--dsw-alias-label-secondary); } +/* A card's reason lines start under its title: the head's padding, the icon, and the gap after it. */ +.card > .reason { + padding: 0 8px 8px calc(8px + 48px + 14px); +} + .packageImage { object-fit: contain; } diff --git a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx index 6acfce2d20..f754c9da2a 100644 --- a/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx +++ b/packages/client/ui-plugin-manager/src/client/PluginManagerPage.tsx @@ -407,12 +407,30 @@ function EnableSwitch({ pkg, title, t, busy, onSetEnabled }: { ) } -/** The status one card carries: running, off, or a problem the Host reported. */ -function packageStatus(pkg: PackageView): 'running' | 'disabled' | 'problem' { +/** The status one card carries: running, off, not running because the Host skipped a selected bundle's layer, or another problem. */ +type PackageStatus = 'running' | 'disabled' | 'not-running' | 'problem' + +/** The tag each status shows beside the title on a card and on its page; running and off show none. */ +const STATUS_TAG_KEYS = { + 'running': undefined, + 'disabled': undefined, + 'not-running': 'statusNotRunning', + 'problem': 'statusProblem', +} satisfies Record + +/** A selected bundle the Host reports an error for is not running when none of its rows has a live entry. */ +function packageStatus(pkg: PackageView): PackageStatus { + if (pkg.enabled && pkg.error !== undefined && pkg.rows.every(row => row.entryId === undefined)) return 'not-running' if (pkg.error !== undefined || (pkg.enabled && pkg.rows.some(row => row.phase === 'failed'))) return 'problem' return pkg.enabled ? 'running' : 'disabled' } +/** The danger tag a status carries. */ +function StatusTag({ status, t }: { readonly status: PackageStatus; readonly t: Translate }): ReactNode { + const key = STATUS_TAG_KEYS[status] + return key === undefined ? null : {t(key)} +} + /** The head every card shares: the artwork, the name that opens the page beside its tags, its one-liner, and what sits at the end. */ function CardHead({ title, t, onOpen, icon, tags, description, end }: { readonly title: string @@ -517,7 +535,10 @@ function updateAvailable(pkg: PackageView): boolean { || ((target.spec.startsWith('link:') || pkg.source?.startsWith('link:') === true) && pkg.source !== target.spec) } -/** One package as a card that opens its page: its name, its one-liner, its tags, and its bundle switch. */ +/** + * One package as a card that opens its page: its name, its one-liner, its tags, its bundle switch, and why the Host + * skipped it or does not support its platform. + */ function PackageCard({ pkg, t, resolveText, busy, highlighted, newer, onOpen, onSetEnabled }: { readonly pkg: PackageView /** The newer registry version a version check offers. */ @@ -546,7 +567,7 @@ function PackageCard({ pkg, t, resolveText, busy, highlighted, newer, onOpen, on tags={( <> {beta ? {t('statusBeta')} : null} - {status === 'problem' ? {t('statusProblem')} : null} + {pkg.availability === 'missing' ? {t(pkg.installed ? 'statusMissingFiles' : 'statusNotInstalled')} : null} {updateAvailable(pkg) || newer !== undefined ? {t('statusUpdateAvailable')} : null} @@ -555,7 +576,10 @@ function PackageCard({ pkg, t, resolveText, busy, highlighted, newer, onOpen, on end={} /> - {pkg.error?.code === 'unsupported-platform' &&

{managementText(pkg.error, t)}

} + {/* The card names an incompatibility without its requirement list; the page lists them. */} + {pkg.error !== undefined && (status === 'not-running' || pkg.error.code === 'unsupported-platform') + ?

{managementText({ ...pkg.error, incompatible: [] }, t)}

+ : null} ) } @@ -682,10 +706,10 @@ function RowDetail({ pkg, row, t, resolveText, onBack, renderSlot, form }: { /** * One package's page: the crumb back to the list; its icon with its switch * and, for a package the profile installed or a selection the Host can remove, uninstall; its title beside its - * version tag, its beta tag, and its problem tag; the package name the title + * version tag, its beta tag, and its problem or not-running tag; the package name the title * stands for; its one-liner; the Host's problem when it reports one; the * configuration the bundle registered for itself; its rows with their switches - * and configure controls; and where it comes from. + * 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, @@ -767,7 +791,7 @@ function PackageDetail({

{title}

{pkg.version === undefined ? null : {t('versionTag', { version: pkg.version })}} {beta ? {t('statusBeta')} : null} - {status === 'problem' ? {t('statusProblem')} : null} + {pkg.availability === 'missing' ? {t(pkg.installed ? 'statusMissingFiles' : 'statusNotInstalled')} : null} {updateAvailable(pkg) || newer !== undefined ? {t('statusUpdateAvailable')} : null} {renderSlot('plugins.detail.badge', { subject })} @@ -787,7 +811,8 @@ function PackageDetail({ ) : null} - {pkg.availability === 'missing' ? null : ( { pkg({ name: '@deepseek-ai/dsh-web-app', installed: false, removable: false }), pkg({ name: 'dsh-protected', readOnlyReason: 'management-required' }), pkg({ name: '@acme/dsh-tool', enabled: false }), - // Selected by the profile but not a bundle: a problem the person can switch off, in the profile's own group. + // Selected by the profile but not a bundle: its layer is skipped, so it reads as not running. pkg({ name: 'dsh-selected', installed: false, error: { code: 'not-bundle' } }), pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', installed: false, optional: true, removable: false, enabled: false }), ], @@ -742,7 +742,7 @@ describe('PluginManagerPage', () => { expect(cards.map(card => card.getAttribute('data-plugin-package'))).toEqual([ '@deepseek-ai/dsh-experimental-agent-team-profile', 'dsh-better-sidebar', 'dsh-broken', 'dsh-protected', '@acme/dsh-tool', 'dsh-selected', ]) - expect(cards.map(card => card.getAttribute('data-plugin-status'))).toEqual(['disabled', 'running', 'problem', 'running', 'disabled', 'problem']) + expect(cards.map(card => card.getAttribute('data-plugin-status'))).toEqual(['disabled', 'running', 'problem', 'running', 'disabled', 'not-running']) // Group titles have no counts; the official bundle retains its experimental marker. expect(screen.getByRole('heading', { name: en.bundlesTitle })).toBeTruthy() expect(screen.getByRole('heading', { name: en.extensionsTitle })).toBeTruthy() @@ -750,7 +750,8 @@ describe('PluginManagerPage', () => { expect(screen.getAllByText(en.statusBeta)).toHaveLength(1) expect(screen.getByRole('switch', { name: en.enableToggle.replace('{name}', '@acme/dsh-tool') })).toHaveProperty('disabled', false) expect(screen.getByText('A sidebar.')).toBeTruthy() - expect(screen.getAllByText(en.statusProblem)).toHaveLength(2) + expect(screen.getAllByText(en.statusProblem)).toHaveLength(1) + expect(screen.getAllByText(en.statusNotRunning)).toHaveLength(1) // The switch acts on the bundle; a bundle the Host cannot read stays off, a protected one stays as it is. fireEvent.click(screen.getByRole('switch', { name: en.enableToggle.replace('{name}', 'dsh-better-sidebar') })) expect(actions.setEnabled).toHaveBeenCalledWith('dsh-better-sidebar', false) @@ -845,6 +846,39 @@ describe('PluginManagerPage', () => { expect(screen.getByText(`${en.reasonLabel}: native preparation unavailable`)).toBeTruthy() }) + it.each([en, zh])('marks a selected bundle the Host skipped as not running with its reason, keeping its switch on', (dict) => { + const name = 'dsh-late' + const { actions, setLanguage } = renderTab({ packages: [pkg({ name, error: { code: 'incompatible-version', incompatible: [INCOMPATIBLE] } })] }) + setLanguage(dict) + const card = document.querySelector(`[data-plugin-package="${name}"]`) as HTMLElement + expect(card.getAttribute('data-plugin-status')).toBe('not-running') + expect(within(card).getByText(dict.statusNotRunning)).toBeTruthy() + expect(within(card).queryByText(dict.statusProblem)).toBeNull() + // The card names the incompatibility without the requirement list the page carries. + expect(within(card).getByText(`${dict.reasonIncompatibleVersionUnnamed}${dict.sentenceSeparator}${dict.reasonIncompatibleInstalled}`)).toBeTruthy() + const toggle = within(card).getByRole('switch', { name: dict.enableToggle.replace('{name}', name) }) + expect(toggle.getAttribute('aria-checked')).toBe('true') + fireEvent.click(toggle) + expect(actions.setEnabled).toHaveBeenCalledExactlyOnceWith(name, false) + }) + + it('keeps a selected bundle whose rows run as a problem when the Host reports an error beside them', () => { + renderTab({ packages: [pkg({ error: { code: 'operation-error', diagnostic: 'dsh.bundle.listedByDefault must be a boolean' }, rows: [row()] })] }) + const card = document.querySelector('[data-plugin-package="dsh-better-sidebar"]') as HTMLElement + expect(card.getAttribute('data-plugin-status')).toBe('problem') + expect(within(card).getByText(en.statusProblem)).toBeTruthy() + expect(within(card).queryByText(/listedByDefault/)).toBeNull() + }) + + it('lists the rows of a skipped layer whose patch the Host read, none of them live', () => { + const name = 'dsh-late' + renderTab({ packages: [pkg({ name, error: { code: 'unsupported-platform' }, rows: [{ rowId: 'late', moduleName: name, enabled: false, phase: null }] })] }) + fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', name) })) + const detail = document.querySelector(`[data-plugin-detail="${name}"]`) as HTMLElement + expect(within(detail).getByText(en.statusNotRunning)).toBeTruthy() + expect(within(detail).getAllByRole('listitem').filter(item => item.hasAttribute('data-plugin-row'))).toHaveLength(1) + }) + it('shows Computer Use permission guidance on the experimental plugins page', () => { const description = 'Review application access before use.' const { actions } = renderTab({ packages: [pkg({ @@ -1545,14 +1579,20 @@ describe('PluginManagerPage', () => { expect(actions.uninstall).toHaveBeenCalledWith('dsh-better-sidebar') fireEvent.click(within(detail).getByRole('switch', { name: en.enableToggle.replace('{name}', 'dsh-better-sidebar') })) expect(actions.setEnabled).toHaveBeenCalledWith('dsh-better-sidebar', false) + // A bundle without rows says so. + set({ packages: [pkg()] }) + expect(within(detail).getByText(en.partsEmpty)).toBeTruthy() // A problem and a protection the Host reports read on the page in the dictionary's words; the page leaves with the crumb. set({ packages: [pkg({ error: { code: 'operation-error', diagnostic: 'unreadable' }, readOnlyReason: 'management-required' })] }) expect(within(detail).getByText(`${en.reasonLabel}: unreadable`)).toBeTruthy() expect(within(detail).getByText(en.reasonManagementRequired)).toBeTruthy() expect(within(detail).getByRole('button', { name: en.uninstallLabel.replace('{name}', 'dsh-better-sidebar') })).toHaveProperty('disabled', true) - expect(within(detail).getByText(en.partsEmpty)).toBeTruthy() set({ packages: [pkg({ error: { code: 'not-bundle' } })] }) expect(within(detail).getByText(`${en.reasonLabel}: ${en.reasonNotBundle}`)).toBeTruthy() + // The Host skipped this selected bundle's layer without reading its patch: it is not running, and its rows are unknown. + expect(within(detail).getByText(en.statusNotRunning)).toBeTruthy() + expect(within(detail).queryByText(en.statusProblem)).toBeNull() + expect(detail.querySelector('[data-plugin-rows]')).toBeNull() set({ packages: [pkg({ error: { code: 'operation-error' } })] }) expect(within(detail).getByText(`${en.reasonLabel}: ${en.reasonOperationError}`)).toBeTruthy() // An incompatibility reads from its structured packages in the dictionary's words, one sentence per package.