@noob-stupid/dsh-plugin-console 0.5.59 → 0.5.60

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/lib/client.js CHANGED
@@ -1578,6 +1578,14 @@ window.__ModuleLoader__.load({
1578
1578
  }
1579
1579
  // <<<update-pick:end>>>
1580
1580
  const el = react.createElement;
1581
+ // ★ 0.5.60:被跳过 bundle 的签名(包名+版本)。关掉提示时记下它;清单变了就重新出现。
1582
+ // 模块级 —— 上一版把辅助函数放子组件里、主面板误用,导致整块面板空白。
1583
+ function skippedSignature(skipped) {
1584
+ try {
1585
+ if (skipped === null || skipped === undefined || !Array.isArray(skipped.items)) return "0";
1586
+ return skipped.items.map((x) => String(x.packageName) + "@" + String(x.version ?? "?")).join("|");
1587
+ } catch { return "0"; }
1588
+ }
1581
1589
  // ★ 0.5.59:健康问题的**签名**(类别+条数)。关掉提示时记下它;签名一变说明问题变了,提示重新出现。
1582
1590
  // 刻意放在模块级(不放组件内)—— 上一版就是因为把辅助函数放在子组件里、主面板误用而整块空白。
1583
1591
  function healthSignature(health) {
@@ -1938,6 +1946,11 @@ function healthSignature(health) {
1938
1946
  const [healthClosed, setHealthClosed] = react.useState(() => {
1939
1947
  try { return localStorage.getItem("pc-health-closed") ?? ""; } catch { return ""; }
1940
1948
  });
1949
+ // ★ 0.5.60:被跳过 bundle 的提示也可以关掉(用户 2026-10-18「不是说这个可以关闭吗」)。
1950
+ // 同样记"签名"(包名+版本),清单变了会重新出现 —— 关掉不等于永远看不见。
1951
+ const [skippedClosed, setSkippedClosed] = react.useState(() => {
1952
+ try { return localStorage.getItem("pc-skipped-closed") ?? ""; } catch { return ""; }
1953
+ });
1941
1954
  const [busy, setBusy] = react.useState(null);
1942
1955
  const [adaptUnlocking, setAdaptUnlocking] = react.useState(null);
1943
1956
  // 待适配行「强行启用」的风险确认态:{ entryId, moduleName, frameworkVersion, checkNote } | null
@@ -4670,9 +4683,21 @@ function healthSignature(health) {
4670
4683
  && state.data.skippedBundles.reliable === true
4671
4684
  && Array.isArray(state.data.skippedBundles.items)
4672
4685
  && state.data.skippedBundles.items.length > 0
4686
+ && skippedSignature(state.data.skippedBundles) !== skippedClosed
4673
4687
  ? el("div", { className: styles.message, "data-error": "true", style: { marginTop: "8px" } },
4674
4688
  el("p", null,
4675
- t("skippedBundlesTitle").replace("{n}", String(state.data.skippedBundles.items.length))),
4689
+ t("skippedBundlesTitle").replace("{n}", String(state.data.skippedBundles.items.length)),
4690
+ " ",
4691
+ el("button", {
4692
+ type: "button",
4693
+ style: { marginLeft: "8px", cursor: "pointer" },
4694
+ title: t("healthDismissTitle"),
4695
+ onClick: () => {
4696
+ const sig = skippedSignature(state.data.skippedBundles);
4697
+ try { localStorage.setItem("pc-skipped-closed", sig); } catch {}
4698
+ setSkippedClosed(sig);
4699
+ },
4700
+ }, t("healthDismissBtn"))),
4676
4701
  ...state.data.skippedBundles.items.map((b) => el("p", { key: b.packageName, title: b.hint ?? undefined, style: { margin: "4px 0 0 12px" } },
4677
4702
  "• " + b.packageName + (b.version ? " v" + b.version : "") + " — " + b.reason,
4678
4703
  // ★ 0.5.56:把提示里的"三条出路"之一真正做成可点的动作。
@@ -389,7 +389,13 @@ function summarizeReadme(text) {
389
389
  async function readPluginDetails(moduleName, baseUrl, profileDir) {
390
390
  if (typeof moduleName !== 'string' || moduleName.startsWith('cordis:')) return { meta: null, readme: null }
391
391
  try {
392
- const pkgPath = resolvePackageJson(moduleName, baseDirOf(baseUrl), profileDir ?? null)
392
+ // ★ 0.5.60(真机 2026-10-18):与 entryPkgMeta 同一口径 —— **profile 优先、安装锚点兜底**。
393
+ // 详情卡片过去读 app.asar 那份(0.2.1-rc.2),于是显示"已是最新"、更新按钮永远点不动,
394
+ // 而真正被加载的是 profile 里那份 0.2.0-rc.2(正是被 peer 否决的那份)。
395
+ const hasProfile = typeof profileDir === 'string' && profileDir !== ''
396
+ const pkgPath = hasProfile
397
+ ? resolvePackageJson(moduleName, profileDir, baseDirOf(baseUrl))
398
+ : resolvePackageJson(moduleName, baseDirOf(baseUrl), null)
393
399
  if (pkgPath === null) throw new Error('not found')
394
400
  const pkg = JSON.parse(await readFile(pkgPath, 'utf8'))
395
401
  const meta = {
@@ -180,7 +180,15 @@ function entryPkgMeta(moduleName, baseUrl, profileDir) {
180
180
  if (hit !== undefined && Date.now() - hit.at < PKG_META_TTL) return hit
181
181
  const meta = { at: Date.now(), installDate: null, version: null, repository: null }
182
182
  try {
183
- const pkgPath = resolvePackageJson(moduleName, baseDirOf(baseUrl), profileDir ?? null)
183
+ // ★ 0.5.60(真机 2026-10-18):**profile 优先、安装锚点兜底**。
184
+ // 过去是反的(asar 优先),导致"徽标显示 0.2.1-rc.2(最新)→ 检测更新无更新可点 →
185
+ // 但实际加载的是 profile 里 0.2.0-rc.2 → peer 永远不匹配"的死局。
186
+ // loader 是从 profile 上下文解析模块名的,所以要显示/要比对的必须是 profile 那份;
187
+ // 只有 profile 里没有该包时(纯内置插件)才回落到安装锚点。
188
+ const hasProfile = typeof profileDir === 'string' && profileDir !== ''
189
+ const pkgPath = hasProfile
190
+ ? resolvePackageJson(moduleName, profileDir, baseDirOf(baseUrl))
191
+ : resolvePackageJson(moduleName, baseDirOf(baseUrl), null)
184
192
  if (pkgPath === null) throw new Error('not found')
185
193
  const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'))
186
194
  // 安装日期:优先 curl 通道写入的 .dsh-installed-at 标记(真实安装时刻);
@@ -163,6 +163,41 @@ async function routeStateGet(req, res, rc) {
163
163
  const shape = detectHostShape()
164
164
  host = { hosted: shape.hosted === true, kind: shape.kind, notice: shape.hosted === true ? shape.notice : null }
165
165
  } catch {}
166
+ // ★ 0.5.60 加法(真机 2026-10-18):**为被 bundle 级跳过的插件合成虚拟行**。
167
+ // 为什么必须做:bundle 层被跳过 ⇒ 它要插的 loader 行**根本不存在** ⇒ 列表里没有位置可挂,
168
+ // 用户只能看到一条横幅,无法像别的插件那样"看到它、更新它、再启用它"。
169
+ // 合成后它出现在列表里,显示为「已停用 / 未加载」+ 否决原因;toggleable=false 表示
170
+ // **没有真实行可开关**(开关自动置灰),但「详情 → 检测更新」照常可用 —— 更新到兼容版本后
171
+ // 重启,bundle 才会真正装载并出现真实行,那时才谈得上"启用"。
172
+ const realModuleNames = new Set(entries.map((e) => e.moduleName))
173
+ const virtualEntries = skippedBundles.reliable === true && Array.isArray(skippedBundles.items)
174
+ ? skippedBundles.items
175
+ .filter((b) => b !== null && b !== undefined && typeof b.packageName === 'string' && !realModuleNames.has(b.packageName))
176
+ .map((b) => ({
177
+ entryId: `bundle-skipped:${b.packageName}`,
178
+ rowId: null,
179
+ moduleName: b.packageName,
180
+ enabled: false,
181
+ fiberPhase: null,
182
+ protected: false,
183
+ toggleable: false,
184
+ userDisabled: false,
185
+ userForced: false,
186
+ extra: false,
187
+ installDate: null,
188
+ version: b.version ?? null,
189
+ repository: null,
190
+ pendingCompat: false,
191
+ compatRescinded: false,
192
+ compatVerdict: null,
193
+ adoptable: null,
194
+ // 复用既有的 veto 通道:卡片会照常渲染原因 + 出路(tooltip),无需新 UI。
195
+ veto: { reason: b.reason ?? null, hint: b.hint ?? null, kind: b.kind ?? null, judged: b.judged ?? null },
196
+ virtual: true,
197
+ }))
198
+ : []
199
+ const allEntries = virtualEntries.length === 0 ? entries : [...entries, ...virtualEntries]
200
+
166
201
  // ★ 0.5.55 加法:把已经算好的各块**折成一行健康摘要**(不新增 IO、不新增判据)。
167
202
  // 面板 176 个按钮、信息散在六处,用户没有一个地方能回答"整体健康吗、我该先处理哪件"。
168
203
  let health = { issues: 0, items: [] }
@@ -174,7 +209,7 @@ async function routeStateGet(req, res, rc) {
174
209
  patchUncertain: patchHeal === null ? [] : (patchHeal.uncertain ?? []),
175
210
  })
176
211
  } catch {}
177
- sendJson(res, 200, { ok: true, entries, skippedBundles, host, health, patchPath, compat, installJobs: jobs, recentFailures, pendingRestart, github: { loggedIn: auth.loggedIn, login: auth.login }, patch: { disables: patch.disables, forced: patch.forced, inserts: patch.inserts }, framework, patchHeal: patchHeal === null ? null : { healed: patchHeal.healed ?? [], autoDisabled: patchHeal.autoDisabled ?? [], healedAt: patchHeal.healedAt ?? 0, written: patchHeal.written === true, writeError: patchHeal.writeError ?? null, skippedFrameworkOwned: (patchHeal.skipped ?? []).map((s) => s.id ?? null), uncertain: (patchHeal.uncertain ?? []).map((u) => u.id ?? null) }, gating: gatingSummary(ctx, compatPending, entries, compatVerdicts), compatPending: compatPending === null ? null : { frameworkVersion: compatPending.frameworkVersion ?? null, upgradeFrom: compatPending.upgradeFrom ?? null, pending: (compatPending.pending ?? []).filter((p) => (p.status ?? 'pending') === 'pending').map((p) => ({ rowId: p.rowId, moduleName: p.moduleName, version: p.version ?? null, checkNote: p.checkNote ?? null, check: p.check ?? null, riskyApprovedAt: p.riskyApprovedAt ?? null, adoptable: adoptable.get(p.rowId) ?? null, verdict: compatVerdicts.get(p.rowId) ?? null })), verdictRefresh: pendingState.refresh === null ? null : { version: pendingState.refresh.version ?? null, updated: pendingState.refresh.updated ?? [], unchanged: pendingState.refresh.unchanged ?? [], unresolved: pendingState.refresh.unresolved ?? [], wrote: pendingState.refresh.wrote === true, writeError: pendingState.refresh.writeError ?? null } }, compatGate, rollback: rollbackRec, selfVersion, components: findComponents().map((c) => ({ id: c.id, name: c.name, kind: c.kind ?? 'server', pid: c.pid ?? null, port: c.port ?? null, healthUrl: c.healthUrl ?? null, uiUrl: compUiUrl(c), autoStart: c.autoStart === true })) })
212
+ sendJson(res, 200, { ok: true, entries: allEntries, skippedBundles, host, health, patchPath, compat, installJobs: jobs, recentFailures, pendingRestart, github: { loggedIn: auth.loggedIn, login: auth.login }, patch: { disables: patch.disables, forced: patch.forced, inserts: patch.inserts }, framework, patchHeal: patchHeal === null ? null : { healed: patchHeal.healed ?? [], autoDisabled: patchHeal.autoDisabled ?? [], healedAt: patchHeal.healedAt ?? 0, written: patchHeal.written === true, writeError: patchHeal.writeError ?? null, skippedFrameworkOwned: (patchHeal.skipped ?? []).map((s) => s.id ?? null), uncertain: (patchHeal.uncertain ?? []).map((u) => u.id ?? null) }, gating: gatingSummary(ctx, compatPending, entries, compatVerdicts), compatPending: compatPending === null ? null : { frameworkVersion: compatPending.frameworkVersion ?? null, upgradeFrom: compatPending.upgradeFrom ?? null, pending: (compatPending.pending ?? []).filter((p) => (p.status ?? 'pending') === 'pending').map((p) => ({ rowId: p.rowId, moduleName: p.moduleName, version: p.version ?? null, checkNote: p.checkNote ?? null, check: p.check ?? null, riskyApprovedAt: p.riskyApprovedAt ?? null, adoptable: adoptable.get(p.rowId) ?? null, verdict: compatVerdicts.get(p.rowId) ?? null })), verdictRefresh: pendingState.refresh === null ? null : { version: pendingState.refresh.version ?? null, updated: pendingState.refresh.updated ?? [], unchanged: pendingState.refresh.unchanged ?? [], unresolved: pendingState.refresh.unresolved ?? [], wrote: pendingState.refresh.wrote === true, writeError: pendingState.refresh.writeError ?? null } }, compatGate, rollback: rollbackRec, selfVersion, components: findComponents().map((c) => ({ id: c.id, name: c.name, kind: c.kind ?? 'server', pid: c.pid ?? null, port: c.port ?? null, healthUrl: c.healthUrl ?? null, uiUrl: compUiUrl(c), autoStart: c.autoStart === true })) })
178
213
  return
179
214
  }
180
215
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noob-stupid/dsh-plugin-console",
3
- "version": "0.5.59",
3
+ "version": "0.5.60",
4
4
  "description": "DSH 框架升级安全与插件升级门控:一键升级、失败自动回滚、升级后回滚上版、旧插件不适配自动禁用;内置多源插件市场为发现层,插件源全部可自定义,可指向公司内网私有源 / 私有索引 / 本地 Git 仓库,纯内网离线可用 | Framework upgrade safety & plugin version gating for DSH, with a customizable multi-source plugin market: point every source at internal mirrors or a local file:// repo for intranet-only, offline installs.",
5
5
  "repository": {
6
6
  "type": "git",