feat(plugin-manager): name the exact spec when pnpm installs an older version

This commit is contained in:
Turtle committed 2026-09-30 18:13:26 +08:00
1 parent a7c3ad99bc
commit bab69fbec5
14 files changed
+62 -19

No files matched your search

+3 -3
View File
@@ -56,9 +56,9 @@ This matrix shows which packages dispatch each harness-owned event and which pac
| `llm/adapters-updated` | `emit` | [`packages/llm/llm/src/types.ts:23`](../packages/llm/llm/src/types.ts) | [`llm`](../packages/llm/llm) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`llm`](../packages/llm/llm), `remotes` |
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:75`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`agent-loop`](../packages/core/agent-loop), [`llm`](../packages/llm/llm), [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title) |
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:48`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:248`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:254`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:261`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:250`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:256`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:263`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `schedule/changed` | `emit` | [`packages/schedule/schedule/src/types.ts:478`](../packages/schedule/schedule/src/types.ts) | [`schedule`](../packages/schedule/schedule) (`emit`) | `remotes` |
| `session-telemetry/record` | `waterfall` | [`packages/session/session-telemetry/src/index.ts:44`](../packages/session/session-telemetry/src/index.ts) | [`session-telemetry`](../packages/session/session-telemetry) (`waterfall`) | - |
| `session/created` | `emit` | [`packages/core/session/src/index.ts:55`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`compaction`](../packages/compaction/compaction), [`goal`](../packages/goal/goal), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm-retry`](../packages/llm/llm-retry), [`permission-presets`](../packages/interaction/permission-presets), [`plan-mode`](../packages/plan/plan-mode), [`schedule`](../packages/schedule/schedule), `server`, [`session`](../packages/core/session), `session-controller`, [`session-log-deepseek`](../packages/session/session-log-deepseek), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-title`](../packages/session/session-title), [`time-context`](../packages/context/time-context), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval) |
+3 -3
View File
@@ -58,9 +58,9 @@
| `llm/adapters-updated` | `emit` | [`packages/llm/llm/src/types.ts:23`](../packages/llm/llm/src/types.ts) | [`llm`](../packages/llm/llm) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`llm`](../packages/llm/llm), `remotes` |
| `llm/stream` | `waterfall` | [`packages/llm/llm/src/index.ts:75`](../packages/llm/llm/src/index.ts) | [`llm`](../packages/llm/llm) (`waterfall`) | [`agent-loop`](../packages/core/agent-loop), [`llm`](../packages/llm/llm), [`llm-replay`](../packages/test-support/llm-replay), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), [`session-title`](../packages/session/session-title) |
| `permission-presets/catalog-changed` | `emit` | [`packages/interaction/permission-presets/src/types.ts:48`](../packages/interaction/permission-presets/src/types.ts) | [`permission-presets`](../packages/interaction/permission-presets) (`events.dispatch`) | `remotes` |
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:248`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:254`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:261`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/changed` | `emit` | [`packages/boot/plugin-manager/src/types.ts:250`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-log` | `emit` | [`packages/boot/plugin-manager/src/types.ts:256`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `plugin-manager/install-state` | `emit` | [`packages/boot/plugin-manager/src/types.ts:263`](../packages/boot/plugin-manager/src/types.ts) | [`plugin-manager`](../packages/boot/plugin-manager) (`emit`) | `remotes` |
| `schedule/changed` | `emit` | [`packages/schedule/schedule/src/types.ts:478`](../packages/schedule/schedule/src/types.ts) | [`schedule`](../packages/schedule/schedule) (`emit`) | `remotes` |
| `session-telemetry/record` | `waterfall` | [`packages/session/session-telemetry/src/index.ts:44`](../packages/session/session-telemetry/src/index.ts) | [`session-telemetry`](../packages/session/session-telemetry) (`waterfall`) | - |
| `session/created` | `emit` | [`packages/core/session/src/index.ts:55`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`compaction`](../packages/compaction/compaction), [`goal`](../packages/goal/goal), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm-retry`](../packages/llm/llm-retry), [`permission-presets`](../packages/interaction/permission-presets), [`plan-mode`](../packages/plan/plan-mode), [`schedule`](../packages/schedule/schedule), `server`, [`session`](../packages/core/session), `session-controller`, [`session-log-deepseek`](../packages/session/session-log-deepseek), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-title`](../packages/session/session-title), [`time-context`](../packages/context/time-context), [`tool-todo`](../packages/todo/tool-todo), [`tool-workflow`](../packages/workflow/tool-workflow), [`tools`](../packages/core/tools), [`user-approval`](../packages/interaction/user-approval) |
@@ -15,8 +15,8 @@
en: 87679c51aa3693f5
zh: 11684a48a5806afb
/deepseek-ai-dsh-plugin-manager/use-this-package:
en: d0f7d42dffe6d3c7
zh: b4bf81958cda876d
en: a0d467e2e36893d6
zh: 9160de1faf3509b4
/deepseek-ai-dsh-plugin-manager/use-this-package/version-compatibility-and-exemptions:
en: 920c0acb3b9feaf3
zh: ba6e832a256880a7
+1 -1
View File
@@ -51,7 +51,7 @@ Registries are asked in turn. The plan starts at `options.registry`, else the co
The browser-safe `@deepseek-ai/dsh-plugin-manager/registry` entry exports `OFFICIAL_NPM_REGISTRY` and `NPMMIRROR_REGISTRY` for consumers that identify those public registries.
`installBundle` accepts a caller-generated `requestId`, under which `plugin-manager/install-log` streams each pnpm run's output and `plugin-manager/install-state` announces `installing`, `cancelling`, and `applying`; `installing` is announced once per registry asked, with the `attempt`'s registry, position, and the plan's length. The install asks the same plan as the lookup, from `options.registry`, running `pnpm add` with `--registry` and restoring the profile files between attempts; it moves on for the failures another registry can change and stops at any other, and at a failure whose error line names the host a git or tarball spec is fetched from, which no registry stands in for; `failedAt` says which of the two the last failed run could not reach. `cancelInstall(requestId)` stops the run and answers `cancelled` only after the Git check or pnpm exited and the files are back, `too-late` once the bundle is being applied, and `not-running` for any other id; the install call then reports `application: 'cancelled'`. A run that fails, is cancelled, or adds a package without a bundle patch restores `package.json` and `pnpm-lock.yaml` as they were; `packageResult.kind` classifies the last run from its exit and output, `registries` names every registry asked, and `bundle` names the package a finished run added. `listBundles` carries each bundle's one-liner (the package `description`), the rows its patch declares with their live entries, and the built-in rows it overrides; it lists the profile's own bundles, the bundles the installation supplies, and a selected name without a bundle patch as a `not-bundle` problem, while an unselected plain dependency is left out. A bundle the launcher's `OPTIONAL_BUNDLES` names is `optional`: shipped switched off for the person to turn on, never removable, and selected by no shipped template ([rationale](../../../.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.md)). Every completed operation emits `plugin-manager/changed`; a patch generation applied outside the manager, by HMR's watcher after a CLI or hand edit, announces nothing, so the page learns of it on its next read.
`installBundle` accepts a caller-generated `requestId`, under which `plugin-manager/install-log` streams each pnpm run's output and `plugin-manager/install-state` announces `installing`, `cancelling`, and `applying`; `installing` is announced once per registry asked, with the `attempt`'s registry, position, and the plan's length. The install asks the same plan as the lookup, from `options.registry`, running `pnpm add` with `--registry` and restoring the profile files between attempts; it moves on for the failures another registry can change and stops at any other, and at a failure whose error line names the host a git or tarball spec is fetched from, which no registry stands in for; `failedAt` says which of the two the last failed run could not reach. `cancelInstall(requestId)` stops the run and answers `cancelled` only after the Git check or pnpm exited and the files are back, `too-late` once the bundle is being applied, and `not-running` for any other id; the install call then reports `application: 'cancelled'`. A run that fails, is cancelled, or adds a package without a bundle patch restores `package.json` and `pnpm-lock.yaml` as they were; `packageResult.kind` classifies the last run from its exit and output, `registries` names every registry asked, `bundle` names the package a finished run added, and `version` its manifest version, which pnpm's `minimumReleaseAge` can make older than the version `inspect` read; the Web install dialog then names the exact `name@version` spec to install instead. `listBundles` carries each bundle's one-liner (the package `description`), the rows its patch declares with their live entries, and the built-in rows it overrides; it lists the profile's own bundles, the bundles the installation supplies, and a selected name without a bundle patch as a `not-bundle` problem, while an unselected plain dependency is left out. A bundle the launcher's `OPTIONAL_BUNDLES` names is `optional`: shipped switched off for the person to turn on, never removable, and selected by no shipped template ([rationale](../../../.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.md)). Every completed operation emits `plugin-manager/changed`; a patch generation applied outside the manager, by HMR's watcher after a CLI or hand edit, announces nothing, so the page learns of it on its next read.
`waitForInstall(requestId)` lets a client recover a lost response by waiting for the active installation, including its non-cancellable application phase. It returns the same outcome as the original call, or `null` if the request is not active. Completed results are not retained; `null` establishes neither success nor cancellation.
+1 -1
View File
@@ -51,7 +51,7 @@ kind: "package-reference"
可在浏览器使用的 `@deepseek-ai/dsh-plugin-manager/registry` 入口导出 `OFFICIAL_NPM_REGISTRY` 和 `NPMMIRROR_REGISTRY`,供消费方识别这两个公共注册表。
`installBundle` 接受调用方生成的 `requestId`,`plugin-manager/install-log` 在其下流式转发每次 pnpm 运行的输出,`plugin-manager/install-state` 通告 `installing`、`cancelling` 与 `applying`;每问一个注册表通告一次 `installing`,`attempt` 带上这次的注册表、序号和计划长度。安装沿用查询的计划,从 `options.registry` 开始,以 `--registry` 运行 `pnpm add`,两次尝试之间恢复 profile 文件;换一个注册表能改变的失败才转问下一个,其他失败即停,错误行点名 git 或 tarball spec 自身拉取主机的失败也停,因为没有注册表能替代那台主机;`failedAt` 说明最后一次失败的运行连不上的是二者中的哪一个。`cancelInstall(requestId)` 停止运行,只在 Git 检查或 pnpm 退出且文件恢复后答复 `cancelled`,组合包已在应用时答复 `too-late`,其他 id 答复 `not-running`;安装调用随后报告 `application: 'cancelled'`。失败、被取消或装入了没有组合包 patch 的包的运行,会把 `package.json` 与 `pnpm-lock.yaml` 恢复原样;`packageResult.kind` 按退出方式与输出对最后一次运行分类,`registries` 列出问过的每个注册表,`bundle` 给出完成的运行新增的包。`listBundles` 携带每个组合包的一句话简介(包的 `description`)、其 patch 声明的行及其存活条目,以及它覆盖的内置行;它列出 profile 自己的组合包、安装提供的组合包,以及被选中却没有组合包 patch 的名字(作为 `not-bundle` 问题),未选中的普通依赖不列出。启动器的 `OPTIONAL_BUNDLES` 点名的组合包是 `optional`:随安装提供、默认关闭、由用户开启,永不可卸载,也不被任何随附模板选中([理由](../../../.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.zh.md))。每个完成的操作都会发出 `plugin-manager/changed`;在管理器之外应用的一代 patch(HMR 监视到 CLI 或手工编辑后)不发通知,页面要到下一次读取才知道。
`installBundle` 接受调用方生成的 `requestId`,`plugin-manager/install-log` 在其下流式转发每次 pnpm 运行的输出,`plugin-manager/install-state` 通告 `installing`、`cancelling` 与 `applying`;每问一个注册表通告一次 `installing`,`attempt` 带上这次的注册表、序号和计划长度。安装沿用查询的计划,从 `options.registry` 开始,以 `--registry` 运行 `pnpm add`,两次尝试之间恢复 profile 文件;换一个注册表能改变的失败才转问下一个,其他失败即停,错误行点名 git 或 tarball spec 自身拉取主机的失败也停,因为没有注册表能替代那台主机;`failedAt` 说明最后一次失败的运行连不上的是二者中的哪一个。`cancelInstall(requestId)` 停止运行,只在 Git 检查或 pnpm 退出且文件恢复后答复 `cancelled`,组合包已在应用时答复 `too-late`,其他 id 答复 `not-running`;安装调用随后报告 `application: 'cancelled'`。失败、被取消或装入了没有组合包 patch 的包的运行,会把 `package.json` 与 `pnpm-lock.yaml` 恢复原样;`packageResult.kind` 按退出方式与输出对最后一次运行分类,`registries` 列出问过的每个注册表,`bundle` 给出完成的运行新增的包,`version` 给出它的清单版本;pnpm 的 `minimumReleaseAge` 可能让它比 `inspect` 读到的版本更旧,此时 Web 安装对话框会给出应改为安装的精确 `name@version` spec。`listBundles` 携带每个组合包的一句话简介(包的 `description`)、其 patch 声明的行及其存活条目,以及它覆盖的内置行;它列出 profile 自己的组合包、安装提供的组合包,以及被选中却没有组合包 patch 的名字(作为 `not-bundle` 问题),未选中的普通依赖不列出。启动器的 `OPTIONAL_BUNDLES` 点名的组合包是 `optional`:随安装提供、默认关闭、由用户开启,永不可卸载,也不被任何随附模板选中([理由](../../../.agents/notes/implemented/process/2026-09-15-shipped-optional-bundles.zh.md))。每个完成的操作都会发出 `plugin-manager/changed`;在管理器之外应用的一代 patch(HMR 监视到 CLI 或手工编辑后)不发通知,页面要到下一次读取才知道。
`waitForInstall(requestId)` 让客户端在响应丢失后等待活动安装的结果,包括不可取消的应用阶段。它返回与原调用相同的结果,请求不在活动中时返回 `null`。已完成的结果不保留;`null` 不表示成功或已取消。
@@ -483,6 +483,7 @@ export class PluginManager extends TypertRemoteService {
const files = await this.readRestoredFiles()
const before = readProfileManifest('dsh', this.profile.dir).dependencies ?? {}
let name: string
let version: string | undefined
try {
result.registries = []
const connection = checkGithubConnection(parsedForRegistry(spec), this.profile.dir, {
@@ -552,6 +553,7 @@ export class PluginManager extends TypertRemoteService {
const compatibility = evaluatePluginCompatibility(manifest, readProfileVersionExemptions(this.profile.dir))
if (compatibility !== undefined && !compatibility.exempted) throw new ManagementFailure('incompatible-version', [incompatiblePlugin(compatibility)])
for (const file of bundlePatchPaths(dir, manifest.dsh.bundle)) loadOverlayPatches('dsh', file)
version = manifest.version
} catch (error) {
// pnpm has exited by now, so the files it rewrote go back as they were.
await this.restoreFiles(files)
@@ -560,6 +562,7 @@ export class PluginManager extends TypertRemoteService {
control.phase = 'applying'
announce('applying')
result.bundle = name
if (version !== undefined) result.version = version
result.target = name
result.stage = 'enable'
return this.configure(async () => {
@@ -127,6 +127,8 @@ export interface ChangeResult {
packageResult?: PackageResult
/** The bundle an installation added, once pnpm and the bundle check accepted it. */
bundle?: string
/** The installed bundle's manifest version, when declared; pnpm's `minimumReleaseAge` can make it older than the newest release. */
version?: string
/** Exact package names awaiting explicit script approval in the profile's pnpm settings, read after a failed run. */
pendingBuilds?: string[]
/** Package script permissions saved before this installation attempt. */
@@ -506,6 +506,9 @@ it('installs only valid bundle declarations and honors installation without acti
const install = vi.spyOn(operations, 'runProfilePnpm').mockImplementation(async (_context, args) => {
const name = String(args[1])
bundle(name, [{ id: name, name: './plugin.mjs', config: { service: name } }])
if (name === 'another-bundle') {
writeFileSync(join(dir, 'node_modules', name, 'package.json'), JSON.stringify({ name, dsh: { bundle: { patch: './cordis.patch.yml' } } }))
}
const manifest = readProfileManifest('test', dir)
manifest.dependencies = { ...manifest.dependencies, [name]: '1.0.0' }
writeFileSync(join(dir, 'package.json'), JSON.stringify(manifest))
@@ -513,12 +516,14 @@ it('installs only valid bundle declarations and honors installation without acti
})
onTestFinished(() => { install.mockRestore() })
expect(await manager.installBundle('new-bundle', { enabled: false })).toMatchObject({
changed: true, application: 'applied', stage: 'enable', target: 'new-bundle', bundle: 'new-bundle', packageResult: { exitCode: 0 },
changed: true, application: 'applied', stage: 'enable', target: 'new-bundle', bundle: 'new-bundle', version: '1.0.0', packageResult: { exitCode: 0 },
})
expect((await manager.listBundles()).find(row => row.name === 'new-bundle')?.enabled).toBe(false)
expect(await manager.setBundleEnabled('new-bundle', true)).toMatchObject({ application: 'applied' })
expect((await manager.listPlugins()).find(row => row.patchId === 'new-bundle')?.fiberPhase).toBe('active')
expect(await manager.installBundle('another-bundle')).toMatchObject({ application: 'applied' })
const another = await manager.installBundle('another-bundle')
expect(another).toMatchObject({ application: 'applied', bundle: 'another-bundle' })
expect(another).not.toHaveProperty('version')
expect((await manager.listBundles()).find(row => row.name === 'another-bundle')?.enabled).toBe(true)
})
@@ -1171,6 +1171,7 @@ function InstallDialog({
: null
// Another registry is worth offering only for a failure the Host laid at the one it asked.
const changeable = phase === 'failed' && !approvable && install.failure?.failedAt === 'registry'
const subject = install.subject
return (
<Modal open={install.open} onClose={onClose} title={heading} headless className={css.installDialog as string}>
<div className={css.wizard} data-install-phase={phase}>
@@ -1228,6 +1229,16 @@ function InstallDialog({
{phase === 'done' && install.restartRequired
? <p className={css.resultWarn} role="status">{t('installDoneRestart')}</p>
: null}
{phase === 'done' && subject?.kind === 'registry' && subject.version !== undefined
&& install.installedVersion !== null && install.installedVersion !== subject.version
? (
<p className={css.resultWarn} role="status">
{t('installDoneOlderVersion', {
installed: install.installedVersion, version: subject.version, exact: `${subject.name ?? subject.spec}@${subject.version}`,
})}
</p>
)
: null}
{phase === 'done' && install.approvedBuilds.length > 0
? <p className={css.result} role="status">{t('installDoneApproved', { names: install.approvedBuilds.join(', ') })}</p>
: null}
@@ -172,6 +172,7 @@ export const zh = {
installDoneNothing: '安装完成,没有新增依赖。',
installDoneRestart: '已安装,下次启动后加载。',
installDoneApproved: '已允许运行安装脚本:{names}',
installDoneOlderVersion: '受 pnpm 最短发布时间限制,实际安装的是 {installed},不是 {version}。如需 {version},请卸载后安装 {exact}。',
installApprovalTitle: '需要允许安装脚本',
installApprovalDescription: '以下包声明了安装脚本,pnpm 默认不运行。',
installApprovalConsequence: '允许后,脚本会以你的权限在本机运行,授权保存在当前 profile,之后不再询问。',
@@ -375,6 +376,7 @@ export const en = {
installDoneNothing: 'Install finished with no new dependency.',
installDoneRestart: 'Installed; it loads at the next start.',
installDoneApproved: 'Install scripts allowed for {names}',
installDoneOlderVersion: 'pnpm\'s minimum release age installed {installed} instead of {version}. To get {version}, uninstall it and install {exact}.',
installApprovalTitle: 'Install scripts need permission',
installApprovalDescription: 'These packages have install scripts that pnpm did not run.',
installApprovalConsequence: 'Once allowed, the scripts run here with your permissions, and the permission is saved in this profile.',
@@ -206,6 +206,8 @@ export interface InstallState {
readonly detailsOpen: boolean
/** The bundle the finished run added, left off until enabled from the installed screen. */
readonly installed: string | null
/** The version the finished run installed, when its manifest declares one; null otherwise. */
readonly installedVersion: string | null
/** Whether the finished run's bundle waits for the next start to load. */
readonly restartRequired: boolean
/**
@@ -448,7 +450,7 @@ export function sortPackages(packages: readonly PackageView[]): PackageView[] {
const IDLE_INSTALL: InstallState = {
open: false, spec: '', registries: null, registry: OFFICIAL_REGISTRY, registryOpen: false, registryError: false, attempts: null,
phase: 'idle', inputError: null, subject: null, runs: [], detailsOpen: false,
installed: null, restartRequired: false, failure: null, approvedBuilds: [], enabling: false,
installed: null, installedVersion: null, restartRequired: false, failure: null, approvedBuilds: [], enabling: false,
}
/** The dialog back at its spec: the run and its outcome forgotten, the spec and the registries kept. */
@@ -860,7 +862,7 @@ export class PluginManagerController {
this.inspectAbort = controller
this.patchInstall({
phase: 'checking', inputError: null, subject: null, runs: [], detailsOpen: false, attempts: null, registryOpen: false,
installed: null, restartRequired: false, failure: null, approvedBuilds: [],
installed: null, installedVersion: null, restartRequired: false, failure: null, approvedBuilds: [],
})
const read = this.registryRead
if (read !== undefined && choice === read.choice && read.done !== undefined) {
@@ -898,7 +900,7 @@ export class PluginManagerController {
const requestId = randomUUID() as PluginInstallRequestId
const request: InstallRequest = { requestId, acknowledged: false, replyLost: false, recovering: false }
this.request = request
this.patchInstall({ phase: 'starting', requestId, subject, runs: [], attempts: null, failure: null, installed: null, approvedBuilds: [] })
this.patchInstall({ phase: 'starting', requestId, subject, runs: [], attempts: null, failure: null, installed: null, installedVersion: null, approvedBuilds: [] })
// The Host announces `plugin-manager/changed` while the run is still on
// the wire, and every such event reads again; those reads must not cancel
// the run's settlement.
@@ -959,6 +961,7 @@ export class PluginManagerController {
this.patchInstall({
phase: 'done', runs: settledRuns(runs, 0), failure: null,
installed: result.bundle ?? null,
installedVersion: result.version ?? null,
restartRequired: result.application === 'restart-required',
approvedBuilds: result.approvedBuilds ?? [],
...asked,
@@ -63,7 +63,7 @@ const MIRROR_OPTION = `${en.registryNpmmirror} registry.npmmirror.com`
const IDLE_INSTALL: InstallState = {
open: false, spec: '', registries: null, registry: { kind: 'offered', registry: null }, registryOpen: false, registryError: false, attempts: null,
phase: 'idle', inputError: null, subject: null, runs: [], detailsOpen: false,
installed: null, restartRequired: false, failure: null, approvedBuilds: [], enabling: false,
installed: null, installedVersion: null, restartRequired: false, failure: null, approvedBuilds: [], enabling: false,
}
const READY: PluginManagerState = {
@@ -1417,6 +1417,23 @@ describe('PluginManagerPage', () => {
expect(screen.getByText(en.installDoneApproved.replace('{names}', 'native'))).toBeTruthy()
})
it('names the exact spec when pnpm installed an older version than the one inspected', () => {
const subject = { spec: 'dsh-x', status: 'accepted', kind: 'registry', name: 'dsh-x', version: '1.4.2', bundle: true, registry: null } as const
const older = en.installDoneOlderVersion
.replace('{installed}', '1.4.1').replaceAll('{version}', '1.4.2').replace('{exact}', '[email protected]')
const done = { ...IDLE_INSTALL, open: true, spec: 'dsh-x', phase: 'done', installed: 'dsh-x' } as const
const { set } = renderTab({ install: { ...done, subject, installedVersion: '1.4.1' } })
expect(screen.getByText(older)).toBeTruthy()
// Without a name the exact spec falls back to the typed one.
const { name: _name, ...unnamed } = subject
set({ install: { ...done, subject: unnamed, installedVersion: '1.4.1' } })
expect(screen.getByText(older)).toBeTruthy()
set({ install: { ...done, subject, installedVersion: '1.4.2' } })
expect(screen.queryByText(older)).toBeNull()
set({ install: { ...done, subject: { ...subject, kind: 'path' }, installedVersion: '1.4.1' } })
expect(screen.queryByText(older)).toBeNull()
})
it('words a failed install by its kind, else in the Host\'s words, and retries it', () => {
const subject = { spec: 'github:a/b', status: 'accepted', kind: 'git', bundle: null, registry: null, host: 'github.com' } as const
const { actions, set } = renderTab({
@@ -615,9 +615,9 @@ describe('PluginManagerController', () => {
])
face.toggleInstallDetails()
expect(state().install.detailsOpen).toBe(true)
gate.resolve(ok({ ...APPLIED, bundle: 'dsh-new' }))
gate.resolve(ok({ ...APPLIED, bundle: 'dsh-new', version: '1.0.0' }))
await vi.waitFor(() => { expect(state().install.phase).toBe('done') })
expect(state().install).toMatchObject({ installed: 'dsh-new', restartRequired: false, detailsOpen: true })
expect(state().install).toMatchObject({ installed: 'dsh-new', installedVersion: '1.0.0', restartRequired: false, detailsOpen: true })
// The finished install settled its run; a trailing last chunk still lands
// on it, while a chunk for a run the dialog never saw is dropped.
controller.appendLog({ requestId, jobId: 'j1', argv, cwd: '/p', stream: 'stdout', text: '', exitCode: 0 })
@@ -4715,7 +4715,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [
},
{
name: 'ChangeResult',
declaration: 'export interface ChangeResult {\n changed: boolean;\n application: \'applied\' | \'restart-required\' | \'overridden\' | \'failed\' | \'cancelled\';\n stage: \'install\' | \'enable\' | \'remove\';\n target: string;\n enabled?: boolean;\n error?: ManagementError;\n warnings?: string[];\n packageResult?: PackageResult;\n bundle?: string;\n pendingBuilds?: string[];\n approvedBuilds?: string[];\n registries?: Registry[];\n failedAt?: \'registry\' | \'spec-host\';\n}',
declaration: 'export interface ChangeResult {\n changed: boolean;\n application: \'applied\' | \'restart-required\' | \'overridden\' | \'failed\' | \'cancelled\';\n stage: \'install\' | \'enable\' | \'remove\';\n target: string;\n enabled?: boolean;\n error?: ManagementError;\n warnings?: string[];\n packageResult?: PackageResult;\n bundle?: string;\n version?: string;\n pendingBuilds?: string[];\n approvedBuilds?: string[];\n registries?: Registry[];\n failedAt?: \'registry\' | \'spec-host\';\n}',
},
{
name: 'ClientArtifactBaseline',