fix(plugin-manager): let the page remove a selection no package holds
Desktop loads its profile with `loadProfileDirectory`, so the retired bundle removal moves there from `loadProfile` and covers every loader. A name in `dsh.profile.bundles` that neither the profile's dependencies nor the installation holds had no uninstall on the Plugins page: the button required `installed`. The Host now reports such a selection as `removable`, and `removeBundle` deselects it without running pnpm. The page shows uninstall for `installed || removable`.
This commit is contained in:
1 parent
9633724b40
commit
00b363074a
14 files changed
+108
-54
No files matched your search
@@ -201,7 +201,7 @@ const INSTALLATION_OWNED_PROFILE_TUPLES: Record<string, readonly string[]> = {
|
||||
|
||||
/**
|
||||
* Bundles an earlier release shipped and the installation no longer carries;
|
||||
* loading a profile removes them from its bundle list.
|
||||
* {@link loadProfileDirectory} removes them from the profile's bundle list.
|
||||
*/
|
||||
const RETIRED_BUNDLES: ReadonlySet<string> = new Set([
|
||||
// The Web composition mounts Schedule itself
|
||||
@@ -581,30 +581,47 @@ function sameBundles(left: readonly string[], right: readonly string[]): boolean
|
||||
return left.length === right.length && left.every((value, index) => value === right[index])
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize an exact installation-owned bundle tuple to its shipped template,
|
||||
* and drop {@link RETIRED_BUNDLES} from any other bundle list, preserving all
|
||||
* other manifest fields. The manifest is written only when its bundles change.
|
||||
*/
|
||||
function normalizeProfileManifest(name: string, dir: string, manifest: ProfileManifest): void {
|
||||
const bundles = manifest.dsh?.profile?.bundles
|
||||
if (bundles === undefined) return
|
||||
const installationOwned = INSTALLATION_OWNED_PROFILE_TUPLES[name]
|
||||
const template = PROFILE_TEMPLATES[name]
|
||||
const normalized = template !== undefined && installationOwned !== undefined && sameBundles(bundles, installationOwned)
|
||||
? template.bundles
|
||||
: bundles.filter(bundle => !RETIRED_BUNDLES.has(bundle))
|
||||
if (sameBundles(normalized, bundles)) return
|
||||
writeProfileManifest(dir, {
|
||||
/** Return `manifest` with `dsh.profile.bundles` replaced, preserving all other fields. */
|
||||
function withBundles(manifest: ProfileManifest, bundles: readonly string[]): ProfileManifest {
|
||||
return {
|
||||
...manifest,
|
||||
dsh: {
|
||||
...manifest.dsh,
|
||||
profile: {
|
||||
...manifest.dsh?.profile,
|
||||
bundles: [...normalized],
|
||||
bundles: [...bundles],
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize an exact installation-owned bundle tuple to its shipped template,
|
||||
* preserving all other manifest fields. Other bundle lists remain untouched.
|
||||
*/
|
||||
function normalizeShippedProfile(name: string, dir: string, manifest: ProfileManifest): ProfileManifest {
|
||||
const installationOwned = INSTALLATION_OWNED_PROFILE_TUPLES[name]
|
||||
const template = PROFILE_TEMPLATES[name]
|
||||
const bundles = manifest.dsh?.profile?.bundles
|
||||
if (template === undefined || bundles === undefined) return manifest
|
||||
const isRetiredTuple = installationOwned !== undefined && sameBundles(bundles, installationOwned)
|
||||
if (!isRetiredTuple) return manifest
|
||||
const normalized = withBundles(manifest, template.bundles)
|
||||
writeProfileManifest(dir, normalized)
|
||||
return normalized
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove {@link RETIRED_BUNDLES} from a profile's bundle list, writing the
|
||||
* manifest back only when it listed one.
|
||||
*/
|
||||
function dropRetiredBundles(dir: string, manifest: ProfileManifest): ProfileManifest {
|
||||
const bundles = manifest.dsh?.profile?.bundles ?? []
|
||||
const kept = bundles.filter(bundle => !RETIRED_BUNDLES.has(bundle))
|
||||
if (kept.length === bundles.length) return manifest
|
||||
const normalized = withBundles(manifest, kept)
|
||||
writeProfileManifest(dir, normalized)
|
||||
return normalized
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -654,7 +671,8 @@ export function resolveBundleDir(
|
||||
* Load an already initialized profile directory without resolving it through
|
||||
* the shared Harness home. This is used by application-owned profiles whose
|
||||
* package project and lifecycle belong to that application.
|
||||
* Unreadable bundles, and bundles whose own dsh peers the profile does not exempt, are skipped
|
||||
* Retired bundles are removed from the stored bundle list first, rewriting the
|
||||
* manifest when it listed one. Unreadable bundles, and bundles whose own dsh peers the profile does not exempt, are skipped
|
||||
* without changing the manifest and listed in `skippedBundles`; nothing is printed.
|
||||
* @param binName - the diagnostic prefix on thrown errors.
|
||||
* @param dir - absolute profile package directory.
|
||||
@@ -668,7 +686,7 @@ export function loadProfileDirectory(
|
||||
installAnchor: string,
|
||||
options: { userLayer?: boolean } = {},
|
||||
): Profile {
|
||||
const manifest = readProfileManifest(binName, dir)
|
||||
const manifest = dropRetiredBundles(dir, readProfileManifest(binName, dir))
|
||||
const bundles = manifest.dsh?.profile?.bundles ?? []
|
||||
const layers: ProfileLayer[] = []
|
||||
const skippedBundles: SkippedBundle[] = []
|
||||
@@ -700,8 +718,7 @@ export function loadProfileDirectory(
|
||||
|
||||
/**
|
||||
* Load a profile: resolve every `dsh.profile.bundles` entry to its patch
|
||||
* layer and parse the profile's own patch file. The stored bundle list first
|
||||
* drops retired bundles and a retired installation-owned tuple. Unreadable or incompatible bundles
|
||||
* layer and parse the profile's own patch file. Unreadable or incompatible bundles
|
||||
* are skipped and listed in `skippedBundles`; profile manifest and user patch errors still throw.
|
||||
* @param binName - the diagnostic prefix on thrown errors.
|
||||
* @param name - the profile name.
|
||||
@@ -727,7 +744,7 @@ export function loadProfile(
|
||||
initProfile(dir, template.bundles)
|
||||
}
|
||||
removeLinkProjections(dir)
|
||||
normalizeProfileManifest(name, dir, readProfileManifest(binName, dir))
|
||||
normalizeShippedProfile(name, dir, readProfileManifest(binName, dir))
|
||||
return loadProfileDirectory(binName, dir, installAnchor, options)
|
||||
}
|
||||
|
||||
|
||||
@@ -386,17 +386,17 @@ describe('loadProfile', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('removes a retired bundle from any profile and keeps the rest of the manifest', () => {
|
||||
it('removes a retired bundle from an application-owned profile and keeps the rest of the manifest', () => {
|
||||
const anchor = stageInstallation({
|
||||
'@deepseek-ai/dsh-base': { patch: '[]\n' },
|
||||
'custom-bundle': { patch: '[]\n' },
|
||||
})
|
||||
const home = tmp()
|
||||
const dir = resolveProfileDir('custom', home)
|
||||
const dir = join(tmp(), 'app-profile')
|
||||
initProfile(dir, ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-experimental-schedule-bundle', 'custom-bundle'])
|
||||
writeProfileManifest(dir, { ...readProfileManifest('t', dir), dependencies: { 'custom-bundle': '^1.0.0' } })
|
||||
const profile = loadProfile('t', 'custom', anchor, home)
|
||||
const profile = loadProfileDirectory('t', dir, anchor)
|
||||
expect(profile.skippedBundles).toEqual([])
|
||||
expect(profile.layers.map(layer => layer.packageName)).toEqual(['@deepseek-ai/dsh-base', 'custom-bundle'])
|
||||
expect(readProfileManifest('t', dir)).toMatchObject({
|
||||
dependencies: { 'custom-bundle': '^1.0.0' },
|
||||
dsh: { profile: { bundles: ['@deepseek-ai/dsh-base', 'custom-bundle'] } },
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
en: fde2d9491fe5dd4f
|
||||
zh: ef6e6db15c4f19d2
|
||||
/deepseek-ai-dsh-plugin-manager/known-limitations-and-deferred-work/failure-behavior:
|
||||
en: 61450cf6e03c2819
|
||||
zh: 4d52f5306825787b
|
||||
en: 4b31f3638e4a6628
|
||||
zh: 23f6599a963bcf89
|
||||
/deepseek-ai-dsh-plugin-manager/known-limitations-and-deferred-work/dev-note:
|
||||
en: e67f633dc6fe7773
|
||||
zh: 3bb0c20c93f16f98
|
||||
@@ -145,7 +145,7 @@ Failures preserve completed steps and report the actual remaining state. Profile
|
||||
| Enable: saving selection or loading fails | Keep the installed dependency and any saved selection. Report enablement failure; allow repair, disablement or removal. |
|
||||
| Remove: any step fails | Stop at the failed step. Preserve completed changes, retain remaining dependencies for retry, and report removal failure. Do not re-enable the bundle. |
|
||||
|
||||
Installation finishes after pnpm and bundle validation succeed; subsequent enablement failure does not undo installation. Removal proceeds in order: remove the bundle from `dsh.profile.bundles`, unload its runtime contributions, then run `pnpm remove`. A failed step prevents subsequent steps.
|
||||
Installation finishes after pnpm and bundle validation succeed; subsequent enablement failure does not undo installation. Removal proceeds in order: remove the bundle from `dsh.profile.bundles`, unload its runtime contributions, then run `pnpm remove`. A failed step prevents subsequent steps. A selected name that neither the profile's dependencies nor the installation holds, such as a retired bundle, is also removable; its removal stops after deselection and runs no pnpm.
|
||||
|
||||
Restoration rewrites only the two snapshotted files; user-authored patch configuration, application data, diagnostic logs and files pnpm downloaded remain untouched, and the next package operation prunes packages no manifest references.
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ CLI 提供 `dsh plugin --profile <profile> version-exemptions`、`allow-version
|
||||
| 启用:保存选择项或加载失败 | 保留已安装的依赖和已保存的选择项。报告启用失败,允许修正、停用或卸载。 |
|
||||
| 卸载:任一步失败 | 停在失败步骤,保留已完成的改动和待重试删除的依赖,报告卸载失败。不重新启用组合包。 |
|
||||
|
||||
pnpm 执行和组合包校验成功即完成安装,后续启用失败不撤销安装。卸载依次执行:从 `dsh.profile.bundles` 移除组合包、卸载运行时贡献、执行 `pnpm remove`。任一步失败都不继续执行后续步骤。
|
||||
pnpm 执行和组合包校验成功即完成安装,后续启用失败不撤销安装。卸载依次执行:从 `dsh.profile.bundles` 移除组合包、卸载运行时贡献、执行 `pnpm remove`。任一步失败都不继续执行后续步骤。profile 依赖和安装都不持有的已选名称(例如已下线的组合包)同样可卸载;其卸载在取消选择后结束,不运行 pnpm。
|
||||
|
||||
恢复只重写这两份快照文件;用户编写的 patch 配置、应用数据、诊断日志以及 pnpm 已下载的文件保持原样,没有 manifest 引用的包由下一次包操作清理。
|
||||
|
||||
|
||||
@@ -289,12 +289,15 @@ export class PluginManager extends TypertRemoteService {
|
||||
for (const name of names) {
|
||||
const installed = dependencies.includes(name)
|
||||
const optional = OPTIONAL_BUNDLES.includes(name)
|
||||
const removable = installed && !Object.hasOwn(installation.dependencies ?? {}, name)
|
||||
const enabled = selected.includes(name)
|
||||
const shipped = Object.hasOwn(installation.dependencies ?? {}, name)
|
||||
// Bundle resolution reads the installation first, so a profile dependency the installation manifest also names,
|
||||
// like one it forbids removing, is not the loaded copy.
|
||||
const owned = installed && !shipped
|
||||
// A selection neither the profile nor the installation holds, such as a retired bundle, is removed by deselecting it.
|
||||
const removable = owned || (enabled && !installed && !shipped)
|
||||
const sourceOf = (packageName?: string): { source?: string } =>
|
||||
removable ? { source: dependencySpec(name, recorded[name] as string, this.profile.dir, packageName) } : {}
|
||||
const enabled = selected.includes(name)
|
||||
owned ? { source: dependencySpec(name, recorded[name] as string, this.profile.dir, packageName) } : {}
|
||||
const readOnlyReason = this.protectsManager(name) ? 'management-required' as const : undefined
|
||||
try {
|
||||
const info = bundleManifest(name, this.profile.dir, this.profile.installAnchor)
|
||||
@@ -599,14 +602,15 @@ export class PluginManager extends TypertRemoteService {
|
||||
return { status: 'cancelled' }
|
||||
}
|
||||
|
||||
/** Unload and remove a profile-owned bundle dependency through dsh plugin's pnpm path.
|
||||
* @param name Installed dependency name.
|
||||
/** Unload and remove a profile-owned bundle dependency through dsh plugin's pnpm path; a selected name no
|
||||
* dependency holds is only deselected.
|
||||
* @param name Installed dependency or selected bundle name.
|
||||
* @returns Removal diagnostics and the remaining profile state.
|
||||
*/
|
||||
@Remote
|
||||
removeBundle(name: string): Promise<ChangeResult> {
|
||||
return this.change(async (result) => {
|
||||
await this.configure(async () => {
|
||||
const installed = await this.configure(async () => {
|
||||
const bundle = (await this.listBundles()).find(item => item.name === name)
|
||||
if (bundle === undefined || !bundle.removable) throw new ManagementFailure('not-removable')
|
||||
if (this.ownerContext.get('hmr') === undefined && (this.profile.startedBundles.includes(name)
|
||||
@@ -623,7 +627,9 @@ export class PluginManager extends TypertRemoteService {
|
||||
&& contributions.some(row => row.id === entry.options.id && row.name === entry.options.name))) {
|
||||
throw new ManagementFailure('bundle-in-use')
|
||||
}
|
||||
return bundle.installed
|
||||
})
|
||||
if (!installed) return
|
||||
result.packageResult = await this.runPnpm(['remove', name])
|
||||
if (result.packageResult.exitCode !== 0 || result.packageResult.timedOut === true) {
|
||||
throw new Error(result.packageResult.output)
|
||||
|
||||
@@ -1088,6 +1088,23 @@ it('offers the launcher\'s optional bundles switched off and never removable', a
|
||||
expect(await manager.removeBundle(offered)).toMatchObject({ changed: false, application: 'failed' })
|
||||
})
|
||||
|
||||
it('removes a selected bundle no dependency holds by deselecting it without pnpm', async () => {
|
||||
const { manager, dir } = await fixture()
|
||||
const manifest = readProfileManifest('test', dir)
|
||||
writeFileSync(join(dir, 'package.json'), JSON.stringify({
|
||||
...manifest, dsh: { profile: { bundles: [...manifest.dsh?.profile?.bundles ?? [], 'retired'] } },
|
||||
}))
|
||||
expect((await manager.listBundles()).find(row => row.name === 'retired')).toMatchObject({
|
||||
enabled: true, installed: false, optional: false, removable: true, error: { code: 'operation-error' },
|
||||
})
|
||||
const pnpm = vi.spyOn(operations, 'runProfilePnpm')
|
||||
onTestFinished(() => { pnpm.mockRestore() })
|
||||
expect(await manager.removeBundle('retired')).toMatchObject({ changed: true, application: 'applied' })
|
||||
expect(pnpm).not.toHaveBeenCalled()
|
||||
expect(readProfileManifest('test', dir).dsh?.profile?.bundles).not.toContain('retired')
|
||||
expect((await manager.listBundles()).some(row => row.name === 'retired')).toBe(false)
|
||||
})
|
||||
|
||||
it('omits installation-owned plain packages from the bundle inventory', async () => {
|
||||
const { manager, dir, profile, bundle } = await fixture()
|
||||
bundle('installation-plain', [])
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
en: 87f6d96467dc2383
|
||||
zh: e0fb91aa4c4d5a12
|
||||
/deepseek-ai-dsh-client-ui-plugin-manager/understand-the-implementation:
|
||||
en: 8ca48e1365f18adf
|
||||
zh: 91eadd683d2d8b5b
|
||||
en: 203168fc87e939bd
|
||||
zh: 72d0ccd2c54f3f44
|
||||
/deepseek-ai-dsh-client-ui-plugin-manager/understand-the-implementation/registration:
|
||||
en: 3d70281f082988a5
|
||||
zh: 17c6f595e3b57260
|
||||
|
||||
@@ -97,7 +97,7 @@ A row's page exists only while a `plugins.row.config` entry names the row, so a
|
||||
<a id="understand-the-implementation"></a>
|
||||
## Understand the implementation
|
||||
|
||||
Package management uses the profile's dependency records: installed bundles can be toggled and removed; installation-owned bundles remain locked. This distinction does not select startup failure policy.
|
||||
Package management uses the profile's dependency records: installed bundles can be toggled and removed; installation-owned bundles remain locked. A selected bundle that neither the profile nor the installation holds also offers uninstall, which only removes it from the profile's bundle list. This distinction does not select startup failure policy.
|
||||
|
||||
<details>
|
||||
<summary>Implementation internals — click to expand</summary>
|
||||
|
||||
@@ -97,7 +97,7 @@ ctx.slots.inject('plugins.detail.section', () => ctx.slots.register({
|
||||
<a id="understand-the-implementation"></a>
|
||||
## 理解实现
|
||||
|
||||
插件管理依据 profile 的依赖记录:已安装组合包可启停、可移除,随安装提供的组合包保持锁定。这一区分不决定启动失败策略。
|
||||
插件管理依据 profile 的依赖记录:已安装组合包可启停、可移除,随安装提供的组合包保持锁定。profile 与安装都不持有的已选组合包同样提供卸载,卸载只把它从 profile 的组合包列表中移除。这一区分不决定启动失败策略。
|
||||
|
||||
<details>
|
||||
<summary>实现细节——点击展开</summary>
|
||||
|
||||
@@ -602,7 +602,7 @@ 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, uninstall; its title beside its
|
||||
* 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
|
||||
* 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
|
||||
@@ -640,7 +640,7 @@ function PackageDetail({
|
||||
actions={(
|
||||
<div className={css.detailActions}>
|
||||
{renderSlot('plugins.detail.actions', { subject })}
|
||||
{pkg.installed
|
||||
{pkg.installed || pkg.removable
|
||||
? (
|
||||
<Button
|
||||
variant="outline"
|
||||
|
||||
@@ -89,6 +89,8 @@ export interface PackageView {
|
||||
readonly source?: string
|
||||
/** Whether the installation ships the bundle for the person to switch on: official, off until selected, never removable. */
|
||||
readonly optional: boolean
|
||||
/** Whether the Host removes the bundle: a profile dependency, or a selection that neither the profile nor the installation holds. */
|
||||
readonly removable: boolean
|
||||
/** Whether the bundle is in the profile's layer list. */
|
||||
readonly enabled: boolean
|
||||
/** Why the Host refuses to switch the bundle off or remove it, when it does. */
|
||||
@@ -424,6 +426,7 @@ export function packageView(bundle: BundleInfo, plugins: readonly PluginInfo[]):
|
||||
name: bundle.name,
|
||||
installed: bundle.installed,
|
||||
optional: bundle.optional,
|
||||
removable: bundle.removable,
|
||||
enabled: bundle.enabled,
|
||||
rows,
|
||||
...bundle.version === undefined ? {} : { version: bundle.version },
|
||||
|
||||
@@ -35,6 +35,7 @@ function pkg(overrides: Partial<PackageView> = {}): PackageView {
|
||||
version: '0.16.0',
|
||||
installed: true,
|
||||
optional: false,
|
||||
removable: true,
|
||||
enabled: true,
|
||||
rows: [],
|
||||
...overrides,
|
||||
@@ -288,9 +289,9 @@ describe('PluginManagerPage', () => {
|
||||
it('says where a bundle comes from: the spec that installs it, or built in, with its version', () => {
|
||||
const b = renderTab({ packages: [
|
||||
pkg({ source: 'github:someone/dsh-better-sidebar' }),
|
||||
{ name: 'dsh-official', installed: false, optional: true, enabled: false, rows: [] },
|
||||
{ name: 'dsh-shadowed', installed: true, optional: false, enabled: true, rows: [] },
|
||||
{ name: 'dsh-missing', installed: false, optional: false, enabled: true, error: { code: 'unknown-plugin' }, rows: [] },
|
||||
{ name: 'dsh-official', installed: false, optional: true, removable: false, enabled: false, rows: [] },
|
||||
{ name: 'dsh-shadowed', installed: true, optional: false, removable: false, enabled: true, rows: [] },
|
||||
{ name: 'dsh-missing', installed: false, optional: false, removable: true, enabled: true, error: { code: 'unknown-plugin' }, rows: [] },
|
||||
] })
|
||||
const facts = (): string[] => [...document.querySelectorAll('[data-plugin-source] dt, [data-plugin-source] dd')].map(node => node.textContent)
|
||||
act(() => { b.navigation.actions.setView({ kind: 'package', name: 'dsh-better-sidebar' }) })
|
||||
@@ -486,12 +487,12 @@ describe('PluginManagerPage', () => {
|
||||
packages: [
|
||||
pkg({ meta: { description: { en: 'A sidebar.' } } }),
|
||||
pkg({ name: 'dsh-broken', enabled: false, error: { code: 'not-bundle' } }),
|
||||
pkg({ name: '@deepseek-ai/dsh-web-app', installed: false }),
|
||||
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.
|
||||
pkg({ name: 'dsh-selected', installed: false, error: { code: 'not-bundle' } }),
|
||||
pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', installed: false, optional: true, enabled: false }),
|
||||
pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', installed: false, optional: true, removable: false, enabled: false }),
|
||||
],
|
||||
busy: ['dsh-protected'],
|
||||
})
|
||||
@@ -531,7 +532,7 @@ describe('PluginManagerPage', () => {
|
||||
].map(name => pkg({ name })),
|
||||
pkg({ name: '@acme/dsh-base', readOnlyReason: 'management-required' }),
|
||||
pkg({ name: 'dsh-better-sidebar' }),
|
||||
pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', installed: false, optional: true }),
|
||||
pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', installed: false, optional: true, removable: false }),
|
||||
],
|
||||
})
|
||||
expect(screen.getAllByRole('listitem').map(card => card.getAttribute('data-plugin-package'))).toEqual([
|
||||
@@ -551,10 +552,20 @@ describe('PluginManagerPage', () => {
|
||||
expect(document.querySelectorAll('[data-plugin-count]')).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('offers uninstall for a selected bundle that no dependency holds', () => {
|
||||
const { actions } = renderTab({
|
||||
packages: [pkg({ name: 'dsh-retired', installed: false, removable: true, error: { code: 'operation-error', diagnostic: 'cannot resolve' } })],
|
||||
})
|
||||
fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', 'dsh-retired') }))
|
||||
const detail = document.querySelector('[data-plugin-detail]') as HTMLElement
|
||||
fireEvent.click(within(detail).getByRole('button', { name: en.uninstallLabel.replace('{name}', 'dsh-retired') }))
|
||||
expect(actions.uninstall).toHaveBeenCalledExactlyOnceWith('dsh-retired')
|
||||
})
|
||||
|
||||
it('opens an official bundle\'s page with its beta tag and no uninstall, and switches it on', () => {
|
||||
const title = 'Agent Teams'
|
||||
const { actions } = renderTab({
|
||||
packages: [pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', meta: { title }, installed: false, optional: true, enabled: false })],
|
||||
packages: [pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', meta: { title }, installed: false, optional: true, removable: false, enabled: false })],
|
||||
})
|
||||
fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', title) }))
|
||||
const detail = document.querySelector('[data-plugin-detail]') as HTMLElement
|
||||
@@ -847,7 +858,7 @@ describe('PluginManagerPage', () => {
|
||||
|
||||
it('lists an official plugin after the official bundles with its summary, and opens its page', () => {
|
||||
renderTab(
|
||||
{ packages: [pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', installed: false, optional: true, enabled: false })] },
|
||||
{ packages: [pkg({ name: '@deepseek-ai/dsh-experimental-agent-team-profile', installed: false, optional: true, removable: false, enabled: false })] },
|
||||
{ items: [{ id: 'bash', label: 'Shell' }] },
|
||||
bodies,
|
||||
)
|
||||
@@ -968,7 +979,7 @@ describe('PluginManagerPage', () => {
|
||||
})
|
||||
|
||||
it('leaves the version out of a bundle the Host reports none for', () => {
|
||||
const unversioned: PackageView = { name: 'dsh-better-sidebar', installed: true, optional: false, enabled: true, rows: [] }
|
||||
const unversioned: PackageView = { name: 'dsh-better-sidebar', installed: true, optional: false, removable: true, enabled: true, rows: [] }
|
||||
renderTab({ packages: [unversioned] }, {}, bodies)
|
||||
fireEvent.click(screen.getByRole('button', { name: en.openDetail.replace('{name}', 'dsh-better-sidebar') }))
|
||||
expect(subjects.at(-1)).toEqual({ kind: 'bundle', pkg: { name: 'dsh-better-sidebar', installed: true, enabled: true, rows: [] } })
|
||||
|
||||
@@ -117,7 +117,7 @@ describe('packageView', () => {
|
||||
it('joins a bundle with the entries its rows run as', () => {
|
||||
expect(packageView(BUNDLE, PLUGINS)).toEqual({
|
||||
name: 'dsh-better-sidebar', version: '0.16.0', description: 'A sidebar.', source: 'dsh-better-sidebar@^0.16.0',
|
||||
installed: true, optional: false, enabled: false,
|
||||
installed: true, optional: false, removable: true, enabled: false,
|
||||
rows: [
|
||||
{ rowId: 'sidebar', moduleName: 'dsh-better-sidebar', entryId: ROW_ENTRY, enabled: true, phase: 'active' },
|
||||
{ rowId: 'theme', moduleName: 'dsh-better-sidebar/theme', enabled: false, phase: null },
|
||||
@@ -131,7 +131,7 @@ describe('packageView', () => {
|
||||
overrides: [],
|
||||
}
|
||||
expect(packageView(protectedBundle, PLUGINS)).toEqual({
|
||||
name: '@deepseek-ai/dsh-base', installed: false, optional: false, enabled: true, readOnlyReason: 'management-required',
|
||||
name: '@deepseek-ai/dsh-base', installed: false, optional: false, removable: false, enabled: true, readOnlyReason: 'management-required',
|
||||
error: { code: 'operation-error', diagnostic: 'broken' },
|
||||
rows: [
|
||||
{ rowId: 'core', moduleName: '@deepseek-ai/dsh-base', entryId: 'include:core', enabled: true, phase: 'active', readOnlyReason: 'management-required' },
|
||||
|
||||
Reference in new issue
Block a user