Files
dsh_shenxian/package.json
T
admin cbaf3ad653 fix(web): 内置 dsh 安装路径改为按序探测 —— 修厂家目录/平台包目录在 /usr/lib 布局下静默失效
根因:npm root -g 的落点随发行版变(Debian 系 /usr/local/lib;发行版包管理器装的 Node 常见 /usr/lib),而三处把它写死 ⇒ 定位失败**不报错**、只静默降级:
- src/web/model-catalog.ts:30  → 厂家目录读成空 ⇒ GET /api/me/model-providers 返回 {"providers":[]}
- src/web/plugin-compat.ts:36  → platformPkgCount() = 0 ⇒ 预检退化成「平台包目录不可读」
- poc/workspace-scoped-picker/lib/index.js:34-35(**交接单漏掉的第 3 处**)→ 本模块 import 即抛错 ⇒ 实例内目录选择器不可用

改动:
- 新增 src/web/dsh-install.ts(全平台唯一入口;只依赖 node 内建,可单独在目标机验证):env → 平台配置的 dsh 可执行文件解软链反推包根(最可靠)→ 常见全局根 → npm root -g → 历史默认值
  ⚠️ env 名两侧都认:源仓 DSHS_DSH_BIN / 导出侧 DSH_USERS_PLATFORM_DSH_BIN(交接件只用了后者,照抄会让该分支在源仓侧永不生效)
- 三处调用点改走该模块;插件侧跑在实例进程内、拿不到平台代码,自带同思路一份(两处需同步改)
- 新增 scripts/verify-dsh-install.mjs(15 项断言)并接入 npm run verify

验证:本机 tsc 零错误|verify 全套绿|单测 16/0;服务器回归 platformPkgCount=223、厂家目录 39;**测试服 test106(/usr/lib 布局 = 原故障机)在「无 env / DSHS_DSH_BIN / DSH_USERS_PLATFORM_DSH_BIN」三种姿势下均解析到 /usr/lib 且 39 个厂家文件**
2026-09-14 04:38:58 +08:00

87 lines
2.7 KiB
JSON

{
"name": "dshs",
"version": "0.1.0",
"description": "面向公网的多租户 DSH 托管平台:登录审核、每用户隔离的 DSH 环境(主 + 按需守护)、桌面与域名访问。",
"type": "module",
"main": "./lib/index.js",
"exports": {
".": "./lib/index.js",
"./runtime": "./lib/runtime.js"
},
"bin": {
"dshs": "./lib/cli.js"
},
"files": [
"lib",
"web",
"cordis.patch.yml",
"README.md"
],
"scripts": {
"build": "tsc -p tsconfig.json",
"prepare": "npm run build",
"dev": "node lib/cli.js",
"typecheck": "tsc -p tsconfig.json --noEmit",
"verify": "npm run build && node --test test/db.test.mjs test/k8s-spawner.test.mjs test/leader.test.mjs test/local-user-fs.test.mjs test/crash-policy.test.mjs && node scripts/verify-inject.cjs lib/supervisor/proxy.js && node scripts/verify-static.mjs && node scripts/verify-platform-admin-section.mjs && node scripts/verify-mem-model.mjs && node scripts/verify-model-landing.mjs && node scripts/verify-dsh-install.mjs",
"test": "npm run build && node --test test/db.test.mjs test/k8s-spawner.test.mjs test/leader.test.mjs test/local-user-fs.test.mjs test/crash-policy.test.mjs && node scripts/verify-inject.cjs lib/supervisor/proxy.js",
"smoke": "node scripts/smoke.mjs",
"smoke:admin": "node scripts/smoke-admin.mjs",
"smoke:auth": "node scripts/smoke-auth.mjs",
"smoke:fs": "node scripts/smoke-fs.mjs",
"smoke:file-service": "node scripts/smoke-file-service.mjs",
"smoke:dsh": "node scripts/smoke-dsh.mjs",
"smoke:domain": "node scripts/smoke-domain.mjs",
"smoke:isolation": "node scripts/smoke-isolation.mjs",
"smoke:subdomain": "node scripts/smoke-subdomain.mjs"
},
"dsh": {
"plugin": true,
"kind": "server",
"bundle": {
"patch": "./cordis.patch.yml"
}
},
"disclosure": {
"cloud": true,
"network": [
"https://api.deepseek.com"
],
"apiKeys": [
{
"env": "DEEPSEEK_API_KEY",
"storage": "sqlite-encrypted-ref"
}
],
"permissions": {
"filesystem": "per-user-0700",
"network": "egress",
"env": "read-listed"
},
"jurisdiction": [
"PIPL(CN)"
],
"retention": "server"
},
"dependencies": {
"@fastify/rate-limit": "^10.0.0",
"@fastify/static": "^10.1.3",
"@kubernetes/client-node": "^2.0.0",
"better-sqlite3": "^11.10.0",
"fastify": "^5.0.0",
"pg": "^8.23.0"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.11",
"@types/node": "^22.10.0",
"@types/pg": "^8.23.1",
"typescript": "^5.7.0"
},
"engines": {
"node": "^22.19.0 || >=24"
},
"repository": {
"type": "git",
"url": "https://work.alotbuy.com/maogeigei/dsh_shenxian.git"
}
}