dsh-plugin-update-center 1.0.7 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,18 +4,19 @@
4
4
 
5
5
  GitHub: https://github.com/darkings/dsh-plugin-update-center · npm: https://www.npmjs.com/package/dsh-plugin-update-center
6
6
 
7
- 它只更新 **npm registry 来源的 profile 插件**。DSH 自带插件、`github:` / `git:` / `file:` / `link:` / `workspace:` 安装的插件、以及 DSH 本体更新都不在这里处理。
7
+ 它只更新 **npm registry 来源的 profile 插件**,**包括它自己**。DSH 自带插件、`github:` / `git:` / `file:` / `link:` / `workspace:` 安装的插件、以及 DSH 本体更新都不在这里处理。
8
8
 
9
9
  ## 界面
10
10
 
11
11
  - 入口:侧边栏底部**登录名右侧**,与 DSH 自己的更新提示并排(同一个 `triggerRow`,插件更新 chip 在账号按钮之后、DSH 更新 chip 之前)。
12
12
  - 该位置没有官方 list 插槽,所以用 `shell.overlay` + React portal 把 chip 挂进账号行;chip 的高度、字号、品牌色 tint 与 DSH 的 `DesktopUpdateIndicator` 一致。
13
13
  - **更新 chip**:下载图标;没有可更新插件时不显示;有更新时显示数量;排队时显示时钟图标;更新中显示旋转图标和 `n/total`。
14
- - **残留 chip**:垃圾桶图标 + 警告色(与更新 chip 的下载图标和品牌色明确区分);发现卸载残留时出现,点击打开残留窗口。
15
- - 点击更新 chip 打开 DSH 原生风格的弹窗:勾选要更新的插件,点「更新 N 个插件」。
14
+ - **重启 chip**:黄色描边的重启图标(警告色,和下载/垃圾桶明确区分);只要 Host 还记着「已安装但未完整重启」,它就常驻账号行——关闭弹窗(稍后重启)、刷新页面、开始下一批更新都不会让它消失。有插件失败未回滚时变成错误色,提示先处理失败项。
15
+ - **残留 chip**:垃圾桶图标 + 警告色;发现卸载残留时出现,点击打开残留窗口。
16
+ - 点击更新 / 重启 chip 打开 DSH 原生风格的弹窗:默认显示**最新可更新列表**,上一批的结果收在「查看上一批结果」里,不会被旧进度视图挡住。
16
17
  - 有任务在运行时,按钮变成「任务完成后自动更新」;点击进入队列,任务全部结束并静默后自动开始。
17
18
  - 更新开始后弹窗切换为进度视图:总进度条、当前插件、每个插件的状态(等待 / 核对版本 / 移除旧版 / 安装新版 / 已更新 / 待重启 / 失败)。
18
- - 全部完成后统一提示:更新了带客户端的插件就提示**完整重启 DSH**,提示条带「完整重启」按钮,点击后关闭并重新启动桌面应用;不再自动刷新页面。
19
+ - 完成后弹窗顶部出现重启提示条:正常时带「完整重启」按钮,点击后重新启动桌面应用;有未回滚的失败项时改为「重试失败项」,避免重启进一个坏掉的 profile。关闭弹窗只隐藏提示条,重启 chip 仍留在账号行。不再自动刷新页面。
19
20
  - 不需要时可以关闭弹窗、让任务在后台继续;完成后再打开查看结果。
20
21
 
21
22
  ## 检查逻辑
@@ -48,6 +49,14 @@ installBundle(`${name}@${latest}`, { enabled: 原状态, saveExact: true, regist
48
49
  - 有任务正在运行或已有更新任务时不会直接更新;可以选择「任务完成后自动更新」进入队列。
49
50
  - 不自动重启 DSH,也不更新 DSH 本体。DSH 本体有更新(`available`/`downloading`/`installing`/`ready`)时禁止插件更新。
50
51
 
52
+ ## 自更新
53
+
54
+ - 更新中心自己也走同一条检查 / 更新流程:列表里带「本插件自身 · 单独更新」标记,来源仍是 npm registry。
55
+ - **必须单独更新**:和别的插件一起勾选会被拒绝(`self-update-alone`,409),避免一批插件半更新后卡在一个说不清的重启提示后面。
56
+ - **安装时不做 remove**:直接 `installBundle` 覆盖正在运行的包,删掉自己会连带删掉 Host 正在执行的代码;覆盖安装被拒时才回退到官方 remove → install。
57
+ - 更新成功后**一定**要求完整重启(即使 `application === 'applied'`),新代码只在新 Host 进程里生效;重启后自己回到最新版本、不再显示为可更新。
58
+ - 失败时同样按单插件回滚:装回旧版本并校验,失败未回滚则标记 blocked,不给重启按钮。
59
+
51
60
  进度条口径:由于官方 API 不暴露 pnpm 的字节级下载进度,进度按「已完成插件数 + 当前阶段权重」推进(核对 5% → 移除 35% → 安装 65% → 完成 100%),而不是按下载百分比。
52
61
 
53
62
  ## 排队与生效
@@ -56,8 +65,8 @@ installBundle(`${name}@${latest}`, { enabled: 原状态, saveExact: true, regist
56
65
  - 队列等待所有任务空闲,再静默 10 秒,然后 5 秒倒计时开始;倒计时内来新任务会退回等待。
57
66
  - 每个插件开始前再查一次任务;运行中来新 conversation,当前插件安装完后暂停,任务结束再恢复。
58
67
  - 队列在页面刷新/关闭后保留(Host 内存);Host 重启后不自动续跑。
59
- - 全部完成后聚合:任意失败项 → 不自动刷新,显示失败状态和「重试失败项」;任意成功插件带 `dsh.client` 或 `restart-required` → 只提示**完整重启 DSH**;不再自动刷新页面(页面刷新只换客户端、不换 Host,可能启动失败);Host-only 更新由插件管理器按 applied 处理。
60
- - 失败插件保持旧版本,仍是「可更新」状态;可以立即重试,或重启 DSH 后在更新列表里重新检查/更新。
68
+ - 全部完成后聚合:任意失败项 → 不自动刷新,显示失败状态和「重试失败项」;任意成功插件带 `dsh.client` 或 `restart-required` → 记一条 **Host 级「待重启」**(不是 job 级):关弹窗、刷新页面、再更新一批都不会清掉,只有真正的新 Host 进程(即重启完成)才会归零;有未回滚失败时这条记录标记为 blocked,只提示重试、不给重启按钮。页面不会自动刷新(页面刷新只换客户端、不换 Host,可能启动失败);Host-only 更新由插件管理器按 applied 处理。
69
+ - 失败插件保持旧版本,仍是「可更新」状态;可以立即重试,或重启 DSH 后在更新列表里重新检查/更新。自更新失败时同理:自己会重新出现在列表里,可以再试一次。
61
70
  - 客户端插件更新一律按「需要完整重启」处理,避免只刷新页面导致 Host/客户端版本不一致。
62
71
 
63
72
  ## DSH 本体更新
package/client.js CHANGED
@@ -66,6 +66,10 @@ window.__ModuleLoader__.load({
66
66
  'done.snapshot': '更新前快照:{path}',
67
67
  'risk.boot': '启动关键',
68
68
  'risk.provider': '被 {count} 个插件依赖',
69
+ 'risk.self': '本插件自身 · 单独更新',
70
+ 'self.note': '{name} 是更新中心本体,只能单独更新;安装完成后必须完整重启 DSH。',
71
+ 'self.alone': '本插件不能和其他插件一起更新。请只勾选它,或先取消勾选它。',
72
+ 'error.self-update-alone': '本插件只能单独更新,请只勾选它。',
69
73
  'risk.unselected': '{count} 个启动关键 / 被依赖插件未勾选。请单独更新它们,并在更新后立即重启验证。',
70
74
  'risk.warning': '选中的插件包含启动关键项。更新后请立即重启验证;若 DSH 无法打开,在错误对话框点「禁用第三方插件、备份 profile patch 并重启」,或运行 repair.cmd 恢复快照。',
71
75
  'done.summary': '已更新 {count} 个插件',
@@ -112,6 +116,16 @@ window.__ModuleLoader__.load({
112
116
  'residue.cleaned': '已清理 {count} 项',
113
117
  'residue.scan': '重新扫描',
114
118
  'residue.line': '第 {line} 行',
119
+ 'panel.resultsTitle': '上一批更新结果',
120
+ 'restart.tooltip': '插件已更新,需要重启 DSH 生效',
121
+ 'restart.tooltipBlocked': '更新未完成,先处理失败项',
122
+ 'restart.banner': '已更新 {count} 个插件,需要完整重启 DSH 才能生效。',
123
+ 'restart.bannerBlocked': '更新未完成:有插件更新失败且未回滚。请先重试失败项,再完整重启 DSH。',
124
+ 'results.summary': '上一批:已更新 {updated} 个,{failed} 个失败',
125
+ 'results.summaryClean': '上一批:已更新 {updated} 个插件',
126
+ 'results.summaryEmpty': '上一批未完成',
127
+ 'results.show': '查看上一批结果',
128
+ 'results.back': '返回更新列表',
115
129
  }
116
130
 
117
131
  const en = {
@@ -162,6 +176,10 @@ window.__ModuleLoader__.load({
162
176
  'done.snapshot': 'Pre-update snapshot: {path}',
163
177
  'risk.boot': 'Boot-critical',
164
178
  'risk.provider': 'Used by {count} plugins',
179
+ 'risk.self': 'Update center itself · runs alone',
180
+ 'self.note': '{name} is the update center itself. It can only be updated on its own, and a full DSH restart is required afterwards.',
181
+ 'self.alone': 'The update center cannot be updated together with other plugins. Select only it.',
182
+ 'error.self-update-alone': 'The update center must be updated alone. Select only it.',
165
183
  'risk.unselected': '{count} boot-critical / depended-on plugins are not selected. Update them one at a time and restart to verify.',
166
184
  'risk.warning': 'The selection includes boot-critical plugins. Restart and verify right after updating; if DSH will not open, use “Disable third-party plugins” in the error dialog or run repair.cmd to restore the snapshot.',
167
185
  'done.summary': '{count} plugins updated',
@@ -208,6 +226,16 @@ window.__ModuleLoader__.load({
208
226
  'residue.cleaned': 'Cleaned {count} items',
209
227
  'residue.scan': 'Scan again',
210
228
  'residue.line': 'line {line}',
229
+ 'panel.resultsTitle': 'Last batch results',
230
+ 'restart.tooltip': 'Plugins updated. Restart DSH to apply them.',
231
+ 'restart.tooltipBlocked': 'The update did not finish. Handle the failed plugins first.',
232
+ 'restart.banner': 'Updated {count} plugins. Restart DSH completely to apply them.',
233
+ 'restart.bannerBlocked': 'The update did not finish: a plugin failed and was not rolled back. Retry the failed plugins, then restart DSH completely.',
234
+ 'results.summary': 'Last batch: {updated} updated, {failed} failed',
235
+ 'results.summaryClean': 'Last batch: {updated} plugins updated',
236
+ 'results.summaryEmpty': 'The last batch did not finish',
237
+ 'results.show': 'View last batch results',
238
+ 'results.back': 'Back to updates',
211
239
  }
212
240
 
213
241
  const STYLE = [
@@ -216,6 +244,10 @@ window.__ModuleLoader__.load({
216
244
  '.dshpu-chip:hover{background:color-mix(in srgb, var(--dsw-alias-brand-primary-new-colorprimary-new-color,#4176e6) 14%, transparent)}',
217
245
  '.dshpu-chip.is-residue{border-color:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 25%, transparent);color:var(--dsw-alias-state-warn-primary,#b26a00);background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 8%, transparent)}',
218
246
  '.dshpu-chip.is-residue:hover{background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 14%, transparent)}',
247
+ '.dshpu-chip.is-restart{grid-template-columns:14px;width:28px;padding:0;justify-content:center;border-color:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 45%, transparent);color:var(--dsw-alias-state-warn-primary,#b26a00);background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 10%, transparent)}',
248
+ '.dshpu-chip.is-restart:hover{background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 18%, transparent)}',
249
+ '.dshpu-chip.is-restart[data-blocked="true"]{border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary,#d93025) 45%, transparent);color:var(--dsw-alias-state-error-primary,#d93025);background:color-mix(in srgb, var(--dsw-alias-state-error-primary,#d93025) 10%, transparent)}',
250
+ '.dshpu-chip.is-restart[data-blocked="true"]:hover{background:color-mix(in srgb, var(--dsw-alias-state-error-primary,#d93025) 16%, transparent)}',
219
251
  '.dshpu-chip:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary,#4d6bfe));outline-offset:2px}',
220
252
  '.dshpu-chipIcon{display:grid;place-items:center;width:14px;height:14px}',
221
253
  '.dshpu-chipText{font-variant-numeric:tabular-nums}',
@@ -265,6 +297,14 @@ window.__ModuleLoader__.load({
265
297
  '.dshpu-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;width:100%}',
266
298
  '.dshpu-footerError{flex:1;min-width:0;margin-right:8px;font-size:12px;line-height:18px;color:var(--dsw-alias-state-error-primary,#d93025);text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
267
299
  '.dshpu-modal.dshpu-modal{width:560px;max-width:calc(100vw - 48px)}',
300
+ '.dshpu-banner{margin-bottom:14px}',
301
+ '.dshpu-restartBar{display:flex;align-items:center;gap:10px;border:1px solid color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 45%, transparent);border-radius:10px;padding:8px 10px 8px 12px;background:color-mix(in srgb, var(--dsw-alias-state-warn-primary,#b26a00) 8%, transparent);color:var(--dsw-alias-state-warn-primary,#b26a00);font-size:12px;line-height:18px}',
302
+ '.dshpu-restartBar[data-blocked="true"]{border-color:color-mix(in srgb, var(--dsw-alias-state-error-primary,#d93025) 45%, transparent);background:color-mix(in srgb, var(--dsw-alias-state-error-primary,#d93025) 8%, transparent);color:var(--dsw-alias-state-error-primary,#d93025)}',
303
+ '.dshpu-restartBar svg{flex:none}',
304
+ '.dshpu-restartText{flex:1;min-width:0;word-break:break-word}',
305
+ '.dshpu-restartError{margin-top:2px;color:var(--dsw-alias-state-error-primary,#d93025)}',
306
+ '.dshpu-lastBatch{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--dsw-alias-border-l1,#eceef2);border-radius:10px;padding:6px 8px 6px 12px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-secondary,#657080);background:var(--dsw-alias-bg-layer-2,#f7f8fa)}',
307
+ '.dshpu-back{display:flex;justify-content:flex-start}',
268
308
  '@media (prefers-reduced-motion: reduce){.dshpu-spin{animation:none}.dshpu-barFill{transition:none}}',
269
309
  ].join('')
270
310
 
@@ -301,6 +341,39 @@ window.__ModuleLoader__.load({
301
341
  return Math.max(0, Math.min(job.state === 'running' ? 99 : 100, value))
302
342
  }
303
343
 
344
+ /**
345
+ * A finished batch must not own the dialog: opening the entry after an
346
+ * update has to show the newest available updates, with the previous
347
+ * batch reachable on demand instead of hiding them.
348
+ */
349
+ function resolvePanelView(job, resultsView) {
350
+ const state = job === null || job === undefined ? null : job.state
351
+ const active = state === 'queued' || state === 'starting' || state === 'running'
352
+ const finished = job !== null && job !== undefined && active !== true
353
+ && ((job.results?.length ?? 0) > 0 || job.state === 'failed')
354
+ return { active, finished, showJob: active === true || (finished === true && resultsView === true) }
355
+ }
356
+
357
+ /**
358
+ * The restart requirement is Host state, not job state: it survives closing
359
+ * the dialog and later batches. `blocked` means the last batch left an
360
+ * unreconciled failure, so restarting now could boot a broken profile.
361
+ */
362
+ function resolveRestart(snapshot) {
363
+ const job = snapshot?.job ?? null
364
+ const restart = snapshot?.restart ?? null
365
+ const jobPending = job !== null && job.restartRequired === true && job.unreconciled !== true
366
+ const pending = restart?.pending === true || jobPending === true
367
+ const blocked = restart?.blocked === true
368
+ || (job !== null && job.unreconciled === true && job.restartRequired === true)
369
+ const names = Array.isArray(restart?.names) && restart.names.length > 0
370
+ ? restart.names.filter((name) => typeof name === 'string')
371
+ : (job?.results ?? [])
372
+ .filter((entry) => entry.ok === true && (entry.restartRequired === true || entry.hasClient === true))
373
+ .map((entry) => entry.name)
374
+ .filter((name) => typeof name === 'string')
375
+ return { pending, blocked: pending === true && blocked === true, count: names.length, names }
376
+ }
304
377
  function apply(ctx) {
305
378
  const store = createStore({ snapshot: null, residue: null, loading: true, checking: false, error: null })
306
379
  let disposed = false
@@ -320,7 +393,7 @@ window.__ModuleLoader__.load({
320
393
  }
321
394
 
322
395
  function message(code) {
323
- const known = /^(busy|busy-session|check-first|release-changed|invalid-request|registry-unavailable|request-too-large|operation-failed|service-unavailable|snapshot-failed|rollback-unavailable|verification-failed|dsh-update)$/
396
+ const known = /^(busy|busy-session|check-first|release-changed|invalid-request|registry-unavailable|request-too-large|operation-failed|service-unavailable|snapshot-failed|rollback-unavailable|verification-failed|dsh-update|self-update-alone)$/
324
397
  return t(known.test(code) ? 'error.' + code : 'error.operation-failed')
325
398
  }
326
399
 
@@ -468,15 +541,6 @@ window.__ModuleLoader__.load({
468
541
  }
469
542
  }
470
543
 
471
- async function dismissJob() {
472
- try {
473
- const snapshot = await api({ action: 'dismiss' })
474
- publish({ snapshot })
475
- } catch {
476
- // A stale dismiss is harmless; the next state read reconciles it.
477
- }
478
- }
479
-
480
544
  function schedule() {
481
545
  if (disposed) return
482
546
  if (timer !== null) clearTimeout(timer)
@@ -498,6 +562,7 @@ window.__ModuleLoader__.load({
498
562
  return t('phase.' + (phase === 'verifying' || phase === 'removing' || phase === 'installing' || phase === 'finished' ? phase : 'finished'))
499
563
  }
500
564
 
565
+
501
566
  function StatusNote({ tone = 'info', icon, children }) {
502
567
  return h('div', { className: 'dshpu-note', 'data-tone': tone },
503
568
  icon,
@@ -505,9 +570,46 @@ window.__ModuleLoader__.load({
505
570
  )
506
571
  }
507
572
 
508
- function UpdateRow({ name, description, from, to, disabled, status, tone, showCheckbox, checked, onToggle, bootCritical, dependents }) {
573
+ /**
574
+ * The one place a restart is offered. It stays visible for as long as the
575
+ * Host reports a pending restart, so `稍后` (closing the dialog) does not
576
+ * silently drop the requirement.
577
+ */
578
+ function RestartBanner({ visible, count, blocked, restarting, errorText, retryBusy, onRestart, onRetryFailed }) {
579
+ if (visible !== true) return null
580
+ return h('div', { className: 'dshpu-banner' },
581
+ h('div', {
582
+ className: 'dshpu-restartBar',
583
+ role: 'status',
584
+ 'data-blocked': blocked === true ? 'true' : undefined,
585
+ },
586
+ h(blocked === true ? UI.IconWarningOutlineMedium : UI.IconRefreshOutlineRegular, { size: 16 }),
587
+ h('div', { className: 'dshpu-restartText' },
588
+ blocked === true ? t('restart.bannerBlocked') : t('restart.banner', { count }),
589
+ errorText === null || errorText === undefined
590
+ ? null
591
+ : h('div', { className: 'dshpu-restartError' }, errorText)),
592
+ blocked === true
593
+ ? onRetryFailed === undefined
594
+ ? null
595
+ : h(UI.Button, {
596
+ variant: 'outline',
597
+ disabled: retryBusy === true,
598
+ onClick: onRetryFailed,
599
+ }, retryBusy === true ? t('done.retryBusy') : t('done.retryFailed'))
600
+ : h(UI.Button, {
601
+ variant: 'primary',
602
+ disabled: restarting === true,
603
+ onClick: onRestart,
604
+ }, restarting === true ? t('done.restarting') : t('done.restartButton')),
605
+ ),
606
+ )
607
+ }
608
+
609
+ function UpdateRow({ name, description, from, to, disabled, status, tone, showCheckbox, checked, onToggle, bootCritical, dependents, self }) {
509
610
  const risks = []
510
- if (bootCritical === true) risks.push(t('risk.boot'))
611
+ if (self === true) risks.push(t('risk.self'))
612
+ else if (bootCritical === true) risks.push(t('risk.boot'))
511
613
  if ((dependents?.length ?? 0) > 0) risks.push(t('risk.provider', { count: dependents.length }))
512
614
  return h('li', { className: 'dshpu-row' },
513
615
  showCheckbox
@@ -533,7 +635,7 @@ window.__ModuleLoader__.load({
533
635
  )
534
636
  }
535
637
 
536
- function ProgressView({ job, refresh, retryFailed, retryBusy, restartApp, restarting, restartError }) {
638
+ function ProgressView({ job, refresh, retryFailed, retryBusy, restartApp, restarting, restartError, onBack }) {
537
639
  const [, setTick] = useState(0)
538
640
  const waiting = job.state === 'queued' || job.state === 'starting'
539
641
  const needsReload = refresh?.needsReload === true
@@ -578,6 +680,10 @@ window.__ModuleLoader__.load({
578
680
  : ' ' + (unreconciled.rollback.ok === true ? t('done.rollbackOk') : t('done.rollbackFailed'))
579
681
 
580
682
  return h(React.Fragment, null,
683
+ onBack === undefined
684
+ ? null
685
+ : h('div', { className: 'dshpu-back' },
686
+ h('button', { type: 'button', className: 'dshpu-link', onClick: onBack }, t('results.back'))),
581
687
  waiting
582
688
  ? h(StatusNote, { tone: 'info', icon: h(UI.IconClockOutlineRegular, { size: 16 }) }, phaseText)
583
689
  : h('div', { className: 'dshpu-progress' },
@@ -647,10 +753,6 @@ window.__ModuleLoader__.load({
647
753
  ? h(StatusNote, { tone: 'info', icon: h(UI.IconInfoOutlineRegular, { size: 16 }) },
648
754
  t('done.skipped', { count: skipped.length }))
649
755
  : null,
650
- job.state === 'done' && failures.length === 0 && job.restartRequired === true
651
- ? h(StatusNote, { tone: 'info', icon: h(UI.IconInfoOutlineRegular, { size: 16 }) },
652
- t('done.restart'))
653
- : null,
654
756
  job.state === 'done' && refresh?.reloaded === true
655
757
  ? h(StatusNote, { tone: 'info', icon: h(UI.IconRefreshOutlineRegular, { size: 16 }) }, t('refresh.done'))
656
758
  : null,
@@ -679,14 +781,30 @@ window.__ModuleLoader__.load({
679
781
  )
680
782
  }
681
783
 
682
- function ListView({ state, updates, selected, toggle, busy, queueOffer, desktopBlocked, desktopPhase }) {
784
+ function ListView({ state, updates, selected, toggle, busy, queueOffer, desktopBlocked, desktopPhase, lastJob, onShowResults }) {
683
785
  const snapshot = state.snapshot
786
+ const lastResults = lastJob?.results ?? []
787
+ const lastOk = lastResults.filter((entry) => entry.ok === true).length
788
+ const lastFailed = lastResults.filter((entry) => entry.ok !== true && entry.skipped !== true).length
684
789
  const checking = state.checking || snapshot?.checking === true
685
790
  const checkedAt = snapshot?.checkedAt
686
791
  const risky = (item) => item.bootCritical === true || (item.dependents?.length ?? 0) > 0
687
- const riskySelected = updates.filter((item) => selected.has(item.name) && risky(item))
688
- const riskyUnselected = updates.filter((item) => !selected.has(item.name) && risky(item))
792
+ const riskySelected = updates.filter((item) => selected.has(item.name) && item.self !== true && risky(item))
793
+ const riskyUnselected = updates.filter((item) => !selected.has(item.name) && item.self !== true && risky(item))
794
+ const selfItems = updates.filter((item) => item.self === true)
795
+ const selfSelected = selfItems.some((item) => selected.has(item.name))
796
+ const selfMixed = selfSelected && selected.size > 1
689
797
  return h('div', { className: 'dshpu-body' },
798
+ lastJob === null || lastJob === undefined
799
+ ? null
800
+ : h('div', { className: 'dshpu-lastBatch' },
801
+ h('span', null,
802
+ lastOk === 0 && lastFailed === 0
803
+ ? t('results.summaryEmpty')
804
+ : lastFailed > 0
805
+ ? t('results.summary', { updated: lastOk, failed: lastFailed })
806
+ : t('results.summaryClean', { updated: lastOk })),
807
+ h('button', { type: 'button', className: 'dshpu-link', onClick: onShowResults }, t('results.show'))),
690
808
  h('div', { className: 'dshpu-summary' },
691
809
  h('div', { className: 'dshpu-summaryText' },
692
810
  updates.length > 0 ? t('list.summary', { count: updates.length }) : t('list.empty'),
@@ -718,6 +836,10 @@ window.__ModuleLoader__.load({
718
836
  ? h(StatusNote, { tone: 'warn', icon: h(UI.IconWarningOutlineMedium, { size: 16 }) },
719
837
  t('risk.warning'))
720
838
  : null,
839
+ selfItems.length > 0
840
+ ? h(StatusNote, { tone: selfMixed === true ? 'warn' : 'info', icon: selfMixed === true ? h(UI.IconWarningOutlineMedium, { size: 16 }) : h(UI.IconInfoOutlineRegular, { size: 16 }) },
841
+ selfMixed === true ? t('self.alone') : t('self.note', { name: selfItems[0].name }))
842
+ : null,
721
843
  updates.length > 0
722
844
  ? h('ul', { className: 'dshpu-list' },
723
845
  updates.map((item) => h(UpdateRow, {
@@ -734,6 +856,7 @@ window.__ModuleLoader__.load({
734
856
  tone: 'idle',
735
857
  bootCritical: item.bootCritical,
736
858
  dependents: item.dependents,
859
+ self: item.self === true,
737
860
  })),
738
861
  )
739
862
  : null,
@@ -770,21 +893,41 @@ window.__ModuleLoader__.load({
770
893
  const state = useStoreValue()
771
894
  const snapshot = state.snapshot
772
895
  const job = snapshot?.job ?? null
773
- const jobState = job?.state
774
- const showJob = job !== null && (['queued', 'starting', 'running'].includes(jobState) || (job.results?.length ?? 0) > 0)
775
896
  const checking = state.checking || snapshot?.checking === true
776
897
  const updates = snapshot?.updates ?? []
777
898
  const namesKey = updates.map((item) => item.name).join('|')
778
899
  const desktopPhase = snapshot?.desktopUpdate?.phase
779
900
  const desktopBlocked = typeof desktopPhase === 'string'
780
901
  && ['available', 'downloading', 'verifying', 'installing', 'ready'].includes(desktopPhase)
902
+ const restart = resolveRestart(snapshot)
781
903
  const [selected, setSelected] = useState(() => new Set())
782
904
  const [busy, setBusy] = useState(false)
783
905
  const [actionError, setActionError] = useState(null)
784
906
  const [queueOffer, setQueueOffer] = useState(false)
907
+ // A finished batch is reachable on demand; the dialog itself always
908
+ // opens on the newest state so a fresh update list is never hidden
909
+ // behind the previous batch's progress view.
910
+ const [resultsView, setResultsView] = useState(false)
911
+ const wasOpen = useRef(open === true)
912
+ const view = resolvePanelView(job, resultsView)
913
+ const activeJob = view.active
914
+ const showJob = view.showJob
915
+ const finishedJob = view.finished
916
+ const failedResults = (job?.results ?? []).filter((entry) => entry.ok !== true && entry.skipped !== true)
785
917
 
786
918
  useLocaleTick()
787
919
 
920
+ useEffect(() => {
921
+ if (open === true && wasOpen.current !== true) setResultsView(activeJob === true)
922
+ wasOpen.current = open === true
923
+ }, [open])
924
+
925
+ // Starting a batch from this dialog keeps the progress view selected
926
+ // once it finishes, so the result is shown instead of snapping away.
927
+ useEffect(() => {
928
+ if (activeJob === true) setResultsView(true)
929
+ }, [activeJob, job?.id])
930
+
788
931
  useEffect(() => {
789
932
  if (showJob) return
790
933
  // Boot-critical plugins and providers other plugins inject are left
@@ -801,15 +944,31 @@ window.__ModuleLoader__.load({
801
944
  }, [open])
802
945
 
803
946
  function toggle(name, checked) {
947
+ // The update center is exclusive by construction: checking it clears
948
+ // the batch, and picking any other plugin clears it again.
949
+ const selfRow = updates.find((item) => item.self === true)
950
+ const isSelf = selfRow !== undefined && selfRow.name === name
804
951
  setSelected((current) => {
805
952
  const next = new Set(current)
806
- if (checked) next.add(name)
807
- else next.delete(name)
953
+ if (checked) {
954
+ if (isSelf) next.clear()
955
+ else if (selfRow !== undefined) next.delete(selfRow.name)
956
+ next.add(name)
957
+ } else {
958
+ next.delete(name)
959
+ }
808
960
  return next
809
961
  })
810
962
  }
811
963
 
812
964
  async function submit(waitForIdle) {
965
+ // The update center cannot ride along with a batch: refuse locally
966
+ // instead of letting the Host reject the whole selection.
967
+ const selfSelected = updates.some((item) => item.self === true && selected.has(item.name))
968
+ if (selfSelected && selected.size > 1) {
969
+ setActionError('self-update-alone')
970
+ return
971
+ }
813
972
  const names = [...selected]
814
973
  if (names.length === 0) return
815
974
  setBusy(true)
@@ -830,23 +989,44 @@ window.__ModuleLoader__.load({
830
989
  }
831
990
  }
832
991
 
992
+ // Closing the dialog only hides it: the finished job and the restart
993
+ // notice stay on the Host, so the next open does not lose them.
833
994
  const handleClose = () => {
834
- if (job !== null && !['running', 'queued', 'starting'].includes(job.state)) void dismissJob()
835
995
  onClose()
836
996
  }
837
997
 
838
998
  const loading = snapshot === null || snapshot === undefined || (checking && updates.length === 0)
839
999
  let body
840
- if (showJob) body = h(ProgressView, { job, refresh, retryFailed, retryBusy, restartApp, restarting, restartError })
841
- else if (loading) body = h(EmptyOrLoading, { state })
842
- else body = h(ListView, { state, updates, selected, toggle, busy, queueOffer, desktopBlocked, desktopPhase })
1000
+ if (showJob) {
1001
+ body = h(ProgressView, {
1002
+ job,
1003
+ refresh,
1004
+ retryFailed,
1005
+ retryBusy,
1006
+ restartApp,
1007
+ restarting,
1008
+ restartError,
1009
+ onBack: finishedJob === true ? () => setResultsView(false) : undefined,
1010
+ })
1011
+ } else if (loading) {
1012
+ body = h(EmptyOrLoading, { state })
1013
+ } else {
1014
+ body = h(ListView, {
1015
+ state,
1016
+ updates,
1017
+ selected,
1018
+ toggle,
1019
+ busy,
1020
+ queueOffer,
1021
+ desktopBlocked,
1022
+ desktopPhase,
1023
+ lastJob: finishedJob === true ? job : null,
1024
+ onShowResults: () => setResultsView(true),
1025
+ })
1026
+ }
843
1027
 
844
1028
  const queueWaiting = showJob && (job.state === 'queued' || job.state === 'starting')
845
- const failedResults = (job?.results ?? []).filter((entry) => entry.ok !== true && entry.skipped !== true)
846
- const unreconciled = job?.unreconciled === true || failedResults.some((entry) => entry.reconciled !== true)
847
- const canRetry = showJob && failedResults.length > 0 && !['queued', 'starting', 'running'].includes(job.state)
848
- const canRestart = showJob && job.state === 'done' && job.restartRequired === true && unreconciled !== true
849
- const partial = failedResults.length > 0
1029
+ const canRetry = showJob && activeJob !== true && failedResults.length > 0
850
1030
  const restartErrorText = restartError === null || restartError === undefined
851
1031
  ? null
852
1032
  : restartError === 'restart-timeout' ? t('done.restartTimeout') : t('done.restartUnavailable')
@@ -854,25 +1034,15 @@ window.__ModuleLoader__.load({
854
1034
  actionError !== null
855
1035
  ? h('div', { className: 'dshpu-footerError' }, message(actionError))
856
1036
  : null,
857
- restartErrorText !== null
858
- ? h('div', { className: 'dshpu-footerError' }, restartErrorText)
859
- : null,
860
1037
  showJob && job.state === 'running'
861
1038
  ? h(UI.Button, { variant: 'outline', onClick: handleClose }, t('panel.background'))
862
1039
  : null,
863
1040
  queueWaiting
864
1041
  ? h(UI.Button, { variant: 'outline', onClick: () => { void cancelQueued() } }, t('queue.cancel'))
865
1042
  : null,
866
- showJob && !queueWaiting && job.state !== 'running' && (canRetry || canRestart)
1043
+ showJob && activeJob !== true
867
1044
  ? h(UI.Button, { variant: 'outline', onClick: handleClose }, t('panel.done'))
868
1045
  : null,
869
- canRestart
870
- ? h(UI.Button, {
871
- variant: partial ? 'outline' : 'primary',
872
- disabled: restarting === true,
873
- onClick: () => { void restartApp() },
874
- }, restarting === true ? t('done.restarting') : t('done.restartButton'))
875
- : null,
876
1046
  canRetry
877
1047
  ? h(UI.Button, {
878
1048
  variant: 'primary',
@@ -880,13 +1050,10 @@ window.__ModuleLoader__.load({
880
1050
  onClick: () => { void retryFailed() },
881
1051
  }, retryBusy === true ? t('done.retryBusy') : t('done.retryFailed'))
882
1052
  : null,
883
- showJob && !queueWaiting && job.state !== 'running' && !canRetry && !canRestart
884
- ? h(UI.Button, { variant: 'primary', onClick: handleClose }, t('panel.done'))
885
- : null,
886
- !showJob
887
- ? h(UI.Button, { variant: 'outline', onClick: handleClose }, t('panel.cancel'))
1053
+ showJob !== true
1054
+ ? h(UI.Button, { variant: 'outline', onClick: handleClose }, t('panel.close'))
888
1055
  : null,
889
- !showJob && updates.length > 0
1056
+ showJob !== true && updates.length > 0
890
1057
  ? h(UI.Button, {
891
1058
  variant: 'primary',
892
1059
  disabled: busy || checking || selected.size === 0 || desktopBlocked,
@@ -895,8 +1062,19 @@ window.__ModuleLoader__.load({
895
1062
  : null,
896
1063
  )
897
1064
 
1065
+ const banner = h(RestartBanner, {
1066
+ visible: restart.pending === true && activeJob !== true,
1067
+ count: restart.count,
1068
+ blocked: restart.blocked,
1069
+ restarting,
1070
+ errorText: restartErrorText,
1071
+ onRestart: () => { void restartApp() },
1072
+ onRetryFailed: failedResults.length > 0 ? () => { void retryFailed() } : undefined,
1073
+ retryBusy,
1074
+ })
1075
+
898
1076
  const title = showJob
899
- ? queueWaiting ? t('queue.title') : t('panel.progressTitle')
1077
+ ? queueWaiting ? t('queue.title') : activeJob ? t('panel.progressTitle') : t('panel.resultsTitle')
900
1078
  : t('panel.title')
901
1079
 
902
1080
  return h(UI.Modal, {
@@ -909,6 +1087,7 @@ window.__ModuleLoader__.load({
909
1087
  contentClassName: 'dshpu-modalContent',
910
1088
  },
911
1089
  h('style', null, STYLE),
1090
+ banner,
912
1091
  body,
913
1092
  )
914
1093
  }
@@ -1080,6 +1259,10 @@ window.__ModuleLoader__.load({
1080
1259
  const waiting = phase === 'queued' || phase === 'starting'
1081
1260
  const count = updates.length
1082
1261
  const updateVisible = open || running || waiting || count > 0
1262
+ const restart = resolveRestart(snapshot)
1263
+ // Driven by Host state, not by the dialog: the restart chip stays in the
1264
+ // account row after the dialog is closed, until DSH actually restarts.
1265
+ const restartVisible = restart.pending === true
1083
1266
  const residue = state.residue
1084
1267
  const residueCount = residue?.items?.length ?? 0
1085
1268
  const residueVisible = openResidue || residueCount > 0
@@ -1190,10 +1373,29 @@ window.__ModuleLoader__.load({
1190
1373
  ? t('action.tooltip', { count })
1191
1374
  : t('action.label')
1192
1375
  const residueLabel = t('residue.tooltip', { count: residueCount })
1376
+ const restartLabel = t(restart.blocked === true ? 'restart.tooltipBlocked' : 'restart.tooltip')
1193
1377
 
1194
- const chips = host !== null && (updateVisible || residueVisible)
1378
+ const chips = host !== null && (updateVisible || residueVisible || restartVisible)
1195
1379
  ? createPortal(
1196
1380
  h(React.Fragment, null,
1381
+ restartVisible
1382
+ ? h(UI.Tooltip, { label: restartLabel, side: 'top', align: 'end' },
1383
+ h('button', {
1384
+ type: 'button',
1385
+ className: 'dshpu-chip is-restart',
1386
+ 'data-blocked': restart.blocked === true ? 'true' : undefined,
1387
+ 'aria-label': restartLabel,
1388
+ onClick: () => {
1389
+ setOpen(true)
1390
+ void refresh()
1391
+ },
1392
+ },
1393
+ h('span', { className: 'dshpu-chipIcon' },
1394
+ restart.blocked === true
1395
+ ? h(UI.IconWarningOutlineMedium, { size: 14 })
1396
+ : h(UI.IconRefreshOutlineRegular, { size: 14 })),
1397
+ ))
1398
+ : null,
1197
1399
  updateVisible
1198
1400
  ? h(UI.Tooltip, { label: updateLabel, side: 'top', align: 'end' },
1199
1401
  h('button', {
@@ -1293,6 +1495,12 @@ window.__ModuleLoader__.load({
1293
1495
  }, 'dsh-plugin-update-center: desktop update gate')
1294
1496
  }
1295
1497
 
1296
- return { inject: ['slots', 'locale'], apply }
1498
+ return {
1499
+ inject: ['slots', 'locale'],
1500
+ apply,
1501
+ // Pure view decisions, exported so the Node test can verify them without
1502
+ // a browser renderer.
1503
+ __testing: { resolvePanelView, resolveRestart },
1504
+ }
1297
1505
  },
1298
1506
  })
package/lib/engine.js CHANGED
@@ -71,7 +71,8 @@ export function selectCandidates(bundles) {
71
71
  if (bundle.readOnlyReason !== undefined) continue
72
72
  if (bundle.error !== undefined) continue
73
73
  if (typeof bundle.name !== 'string' || typeof bundle.version !== 'string') continue
74
- if (bundle.name === OWN_NAME) continue
74
+ // This plugin can update itself: the row is kept and flagged, because a
75
+ // self-update must run alone and always ends in a full restart.
75
76
  if (parseVersion(bundle.version) === null) continue
76
77
  if (parseBundleSource(bundle) === null) continue
77
78
  if (seen.has(bundle.name)) continue
@@ -82,6 +83,7 @@ export function selectCandidates(bundles) {
82
83
  enabled: bundle.enabled !== false,
83
84
  source: bundle.source,
84
85
  description: typeof bundle.description === 'string' ? bundle.description : '',
86
+ self: bundle.name === OWN_NAME,
85
87
  })
86
88
  }
87
89
  return candidates
@@ -183,7 +185,20 @@ export function createEngine({
183
185
  if (!manager || typeof manager.removeBundle !== 'function') throw new TypeError('pluginManager.removeBundle is required')
184
186
  if (!registry || typeof registry.release !== 'function') throw new TypeError('a registry client is required')
185
187
 
186
- const state = { checkedAt: 0, checking: false, rows: [], job: null, desktopUpdate: null }
188
+ const state = {
189
+ checkedAt: 0,
190
+ checking: false,
191
+ rows: [],
192
+ job: null,
193
+ desktopUpdate: null,
194
+ /**
195
+ * Installed builds that still need a full DSH restart live here instead of
196
+ * on the job. A job is dismissible and is replaced by the next batch; the
197
+ * need to restart survives both, so it is its own Host state and is only
198
+ * cleared when a new Host process starts (the restart itself).
199
+ */
200
+ restart: { pending: false, names: [], blocked: false, at: 0 },
201
+ }
187
202
  const abort = new AbortController()
188
203
  const queueSettings = { ...QUEUE_DEFAULTS, ...queue }
189
204
  let checkPromise = null
@@ -297,6 +312,7 @@ export function createEngine({
297
312
  dependents: row.dependents ?? [],
298
313
  clientDeps: row.clientDeps ?? [],
299
314
  hasClient: row.hasClient === true,
315
+ self: row.self === true,
300
316
  }))
301
317
  return {
302
318
  checkedAt: state.checkedAt,
@@ -306,6 +322,12 @@ export function createEngine({
306
322
  checked: state.rows.length,
307
323
  desktopUpdate: state.desktopUpdate === null ? null : { ...state.desktopUpdate },
308
324
  job: state.job === null ? null : structuredClone(state.job),
325
+ restart: {
326
+ pending: state.restart.pending === true,
327
+ names: [...state.restart.names],
328
+ blocked: state.restart.blocked === true,
329
+ at: state.restart.at,
330
+ },
309
331
  }
310
332
  }
311
333
 
@@ -492,19 +514,36 @@ export function createEngine({
492
514
  const previous = await registry.manifest(row.name, row.version, abort.signal, row.registry ?? undefined).catch(() => null)
493
515
  if (previous === null || previous.manifest?.dsh?.bundle === undefined) throw coded('rollback-unavailable')
494
516
  }
495
- job.current = { ...job.current, phase: 'removing' }
496
- const removal = await retryResult(() => manager.removeBundle(row.name))
497
- if (removal?.error) {
498
- failure = { error: removal.error.code ?? 'remove-failed', application: removal.application ?? null }
499
- throw coded(failure.error)
500
- }
501
- job.current = { ...job.current, phase: 'installing' }
502
- const result = await retryResult(() => manager.installBundle(`${row.name}@${row.latest}`, {
517
+ // A self-update installs over the running package: removing it first would
518
+ // delete the very files the Host is executing. Any other plugin keeps the
519
+ // remove-then-install order.
520
+ const selfUpdate = row.self === true
521
+ const installOptions = {
503
522
  enabled: row.enabled,
504
523
  saveExact: true,
505
524
  ...row.registry === null || row.registry === undefined ? {} : { registry: row.registry },
506
525
  requestId: `${job.id}:${row.name}`,
507
- }))
526
+ }
527
+ if (!selfUpdate) {
528
+ job.current = { ...job.current, phase: 'removing' }
529
+ const removal = await retryResult(() => manager.removeBundle(row.name))
530
+ if (removal?.error) {
531
+ failure = { error: removal.error.code ?? 'remove-failed', application: removal.application ?? null }
532
+ throw coded(failure.error)
533
+ }
534
+ }
535
+ job.current = { ...job.current, phase: 'installing' }
536
+ let result = await retryResult(() => manager.installBundle(`${row.name}@${row.latest}`, installOptions))
537
+ // The in-place install can be refused when the package already owns the
538
+ // row; the official remove-then-install path still recovers it.
539
+ if (selfUpdate && !successful(result)) {
540
+ const removal = await retryResult(() => manager.removeBundle(row.name))
541
+ if (removal?.error) {
542
+ failure = { error: removal.error.code ?? 'remove-failed', application: removal.application ?? null }
543
+ throw coded(failure.error)
544
+ }
545
+ result = await retryResult(() => manager.installBundle(`${row.name}@${row.latest}`, installOptions))
546
+ }
508
547
  if (!successful(result)) {
509
548
  failure = { error: result?.error?.code ?? 'install-failed', application: result?.application ?? null }
510
549
  throw coded('install-failed')
@@ -518,7 +557,9 @@ export function createEngine({
518
557
  failure = { error: 'verification-failed', verification }
519
558
  throw coded('verification-failed')
520
559
  }
521
- const restartRequired = result.application === 'restart-required'
560
+ // A self-update always needs the restart: the newly installed code only
561
+ // becomes active in a fresh Host process.
562
+ const restartRequired = result.application === 'restart-required' || row.self === true
522
563
  if (restartRequired) job.restartRequired = true
523
564
  await record(job, {
524
565
  name: row.name,
@@ -574,6 +615,7 @@ export function createEngine({
574
615
  bootCritical: row.bootCritical === true,
575
616
  dependents: row.dependents ?? [],
576
617
  hasClient: row.hasClient === true,
618
+ self: row.self === true,
577
619
  })),
578
620
  results: [],
579
621
  failure: null,
@@ -623,6 +665,20 @@ export function createEngine({
623
665
  const bootClient = successes.some((entry) => entry.bootCritical === true && entry.hasClient === true)
624
666
  job.restartRequired = job.restartRequired === true || bootClient || clientSuccess
625
667
  job.reloadRequired = false
668
+ // Promote the restart requirement to Host state so closing the dialog or
669
+ // starting the next batch cannot hide it. An unreconciled failure keeps the
670
+ // flag but blocks the restart button: restarting could boot a broken profile.
671
+ const restartEntries = successes.filter((entry) => entry.restartRequired === true || entry.hasClient === true)
672
+ if (restartEntries.length > 0) {
673
+ state.restart.pending = true
674
+ state.restart.at = now()
675
+ for (const entry of restartEntries) {
676
+ if (typeof entry.name === 'string' && !state.restart.names.includes(entry.name)) {
677
+ state.restart.names.push(entry.name)
678
+ }
679
+ }
680
+ }
681
+ state.restart.blocked = state.restart.pending === true && job.unreconciled === true
626
682
  }
627
683
 
628
684
  function orderByDependencies(selected) {
@@ -760,6 +816,10 @@ export function createEngine({
760
816
  if (!selected.includes(row)) selected.push(row)
761
817
  }
762
818
  if (selected.length === 0) throw coded('invalid-request')
819
+ // Updating this plugin replaces the code the running Host is executing.
820
+ // Mixing it with other plugins would leave the batch half-applied behind a
821
+ // restart prompt that explains nothing, so it always runs alone.
822
+ if (selected.some((row) => row.self === true) && selected.length > 1) throw coded('self-update-alone')
763
823
  if (desktopBlocked()) throw coded('dsh-update')
764
824
  let guard
765
825
  try {
package/lib/http.js CHANGED
@@ -22,6 +22,7 @@ const EXPECTED = new Set([
22
22
  'rollback-unavailable',
23
23
  'verification-failed',
24
24
  'dsh-update',
25
+ 'self-update-alone',
25
26
  ])
26
27
 
27
28
  function respond(payload, status = 200) {
@@ -70,7 +71,7 @@ function statusFor(code) {
70
71
  if (code === 'method-not-allowed') return 405
71
72
  if (code === 'registry-unavailable') return 502
72
73
  if (code === 'snapshot-failed' || code === 'verification-failed') return 500
73
- if (code === 'busy' || code === 'busy-session' || code === 'check-first' || code === 'rollback-unavailable' || code === 'dsh-update') return 409
74
+ if (code === 'busy' || code === 'busy-session' || code === 'check-first' || code === 'rollback-unavailable' || code === 'dsh-update' || code === 'self-update-alone') return 409
74
75
  if (code === 'restart-unavailable') return 501
75
76
  return EXPECTED.has(code) ? 400 : 500
76
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-update-center",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "description": "尊重 DSH 原始风格的插件更新插件:在侧边栏检查、排队更新已安装插件,支持快照回滚、安装后校验、卸载残留清理与离线恢复。 A DSH-native plugin update center for the sidebar with snapshots, rollback, queued updates and leftover cleanup.",
5
5
  "keywords": [
6
6
  "dsh",