@noob-stupid/dsh-plugin-console 0.5.0 → 0.5.1

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.
@@ -12,14 +12,28 @@ import { compareFingerprint, computeFingerprint, readCompatMode, readFingerprint
12
12
  import { currentFrameworkVersion } from '../domain/framework.js'
13
13
  import { sendError, sendJson } from '../infra/httpd.js'
14
14
  import { baseDirOf, profileDirOf, resolvePackageJson } from '../infra/paths.js'
15
+ import { existsSync } from 'node:fs'
16
+ import { join } from 'node:path'
15
17
 
16
- /** 框架运行时根(含 .pnpm 的那层):换了安装根(npx 缓存 ↔ 桌面端自带运行时)指纹必变。 */
18
+ /** 框架运行时根(含 .pnpm 的那层):换了安装根(npx 缓存 ↔ 桌面端自带运行时)指纹必变。
19
+ * `@deepseek-ai/dsh` 既可能解析到 `<root>/node_modules/@deepseek-ai/dsh`(顶层投影),
20
+ * 也可能落在 `<root>/.pnpm/@deepseek-ai+dsh@…/node_modules/…`(实体内部)—— 后者直接
21
+ * `dirname(dirname())` 会停在 `.pnpm` **内部**、数不到包数(门槛实测 `entities=null`)。
22
+ * 所以向上逐级找「含 .pnpm 的那一层」为止。 */
17
23
  function frameworkPnpmRoot(ports, profileDir) {
18
24
  try {
19
25
  const baseDir = baseDirOf(ports?.baseUrl ?? 'file:///')
20
26
  const pkgPath = resolvePackageJson('@deepseek-ai/dsh', baseDir, profileDir)
21
27
  if (pkgPath === null) return null
22
- return dirname(dirname(pkgPath))
28
+ const direct = dirname(dirname(pkgPath))
29
+ let dir = direct
30
+ for (let i = 0; i < 6; i += 1) {
31
+ if (existsSync(join(dir, '.pnpm'))) return dir
32
+ const parent = dirname(dir)
33
+ if (parent === dir) break
34
+ dir = parent
35
+ }
36
+ return direct
23
37
  } catch {
24
38
  return null
25
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noob-stupid/dsh-plugin-console",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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",