dsh-plugin-manager-plus 1.3.0 → 1.3.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.
- package/README.md +2 -0
- package/lib/index.mjs +39 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,8 @@ dsh plugin --profile web add dsh-plugin-manager-plus
|
|
|
79
79
|
> name: dsh-plugin-manager-plus
|
|
80
80
|
> ```
|
|
81
81
|
|
|
82
|
+
**bundle 形态插件(自带 `dsh.bundle.patch` 的包)**:v1.3.1 起自动识别——安装时**不再**写入家级插入行(bundle 层已由官方 CLI 自动挂载,再写一条会触发同包双 Loader 源致命错误),只记录到 manifest 供 UI 管理。此类插件在「插件管理」中显示为社区来源、可启停/卸载,其激活行随包安装/卸载自动存在/消失。
|
|
83
|
+
|
|
82
84
|
### 方式二:git clone + 接线脚本(本地开发)
|
|
83
85
|
|
|
84
86
|
```powershell
|
package/lib/index.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { homedir } from 'node:os';
|
|
|
15
15
|
export const name = 'dsh-plugin-manager-plus';
|
|
16
16
|
export const inject = ['loader', 'webServer'];
|
|
17
17
|
|
|
18
|
-
const PLUGIN_VERSION = '1.3.
|
|
18
|
+
const PLUGIN_VERSION = '1.3.1';
|
|
19
19
|
|
|
20
20
|
/** 读取宿主 dsh 包版本(后端进程 argv[1] 即 dsh 的 bin.js,其上级即包根) */
|
|
21
21
|
function readHostDshVersion() {
|
|
@@ -935,7 +935,11 @@ export function apply(ctx) {
|
|
|
935
935
|
if (pathname === '/plugin-manager/api/inventory' && req.method === 'GET') {
|
|
936
936
|
const { insertEntries, overrideEntries } = getHomePatchEntries();
|
|
937
937
|
const manifest = readManifest();
|
|
938
|
-
const manifestEntryIds = new Set(
|
|
938
|
+
const manifestEntryIds = new Set();
|
|
939
|
+
for (const m of manifest) {
|
|
940
|
+
manifestEntryIds.add(m.entryId);
|
|
941
|
+
for (const rid of (m.bundleRowIds || [])) manifestEntryIds.add(rid);
|
|
942
|
+
}
|
|
939
943
|
|
|
940
944
|
const list = [];
|
|
941
945
|
const seenCleanIds = new Set();
|
|
@@ -965,6 +969,8 @@ export function apply(ctx) {
|
|
|
965
969
|
const source = isHomeInsert ? 'home' : 'builtin';
|
|
966
970
|
const cat = determineCategory(source, cId || entryId, moduleName, manifestEntryIds);
|
|
967
971
|
const funcCat = determineFuncCategory(moduleName);
|
|
972
|
+
// bundle 形态插件(行由包内 bundle 层挂载、经 manifest 跟踪)也可管理
|
|
973
|
+
const manifestTracked = manifestEntryIds.has(cId || entryId);
|
|
968
974
|
|
|
969
975
|
list.push({
|
|
970
976
|
entryId: cId || entryId,
|
|
@@ -972,7 +978,7 @@ export function apply(ctx) {
|
|
|
972
978
|
enabled,
|
|
973
979
|
phase: rawFiberPhase ?? 'unobserved',
|
|
974
980
|
source,
|
|
975
|
-
manageable: isHomeInsert,
|
|
981
|
+
manageable: isHomeInsert || manifestTracked,
|
|
976
982
|
category: cat,
|
|
977
983
|
funcCategory: funcCat
|
|
978
984
|
});
|
|
@@ -1079,26 +1085,50 @@ export function apply(ctx) {
|
|
|
1079
1085
|
}
|
|
1080
1086
|
|
|
1081
1087
|
let installedVersion = version || '';
|
|
1088
|
+
let isBundle = false;
|
|
1089
|
+
let bundleRowIds = [];
|
|
1082
1090
|
try {
|
|
1083
1091
|
const installedPkg = JSON.parse(readFileSync(targetPkgJsonPath, 'utf8'));
|
|
1084
1092
|
installedVersion = installedPkg.version || installedVersion;
|
|
1093
|
+
// 探测 bundle 形态:包内 dsh.bundle.patch 由官方 CLI 自动挂载为
|
|
1094
|
+
// profile 的 bundle 层,行随包安装/卸载自动存在/消失——此时
|
|
1095
|
+
// **不得**再写家级插入行(同包双 Loader 源 = 致命错误)。
|
|
1096
|
+
const bundlePatchRel = installedPkg?.dsh?.bundle?.patch;
|
|
1097
|
+
if (typeof bundlePatchRel === 'string' && bundlePatchRel) {
|
|
1098
|
+
const bundlePatchPath = join(WEB_PROFILE_DIR, 'node_modules', ...pkgName.split('/'), bundlePatchRel.replace(/^\.\//, ''));
|
|
1099
|
+
if (existsSync(bundlePatchPath)) {
|
|
1100
|
+
const { blocks } = parsePatchYaml(readFileSync(bundlePatchPath, 'utf8'));
|
|
1101
|
+
for (const b of blocks) {
|
|
1102
|
+
if (b.type === 'insert') for (const e of b.entries) bundleRowIds.push(e.id);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
if (bundleRowIds.length > 0) isBundle = true;
|
|
1106
|
+
}
|
|
1085
1107
|
} catch {}
|
|
1086
1108
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1109
|
+
if (!isBundle) {
|
|
1110
|
+
// 非 bundle 形态:包装上没有激活行,需要插件管理器在家级补丁登记激活
|
|
1111
|
+
patchAddInstallEntry(pkgName, entryId);
|
|
1112
|
+
logger.info(`插件 ${pkgSpec} 已登记至家级补丁 (${entryId})`);
|
|
1113
|
+
} else {
|
|
1114
|
+
// bundle 形态:bundle 层已自动挂载激活行,绝不写家级插入行
|
|
1115
|
+
logger.info(`插件 ${pkgSpec} 为 bundle 形态(bundle 层行 id: ${bundleRowIds.join(', ')}),跳过家级登记(避免双 Loader 源)`);
|
|
1116
|
+
}
|
|
1089
1117
|
|
|
1090
1118
|
// 更新 Manifest 记录
|
|
1091
1119
|
const manifest = readManifest();
|
|
1092
|
-
const filtered = manifest.filter(m => m.entryId !== entryId);
|
|
1120
|
+
const filtered = manifest.filter(m => m.entryId !== entryId && !(m.bundleRowIds || []).includes(entryId));
|
|
1093
1121
|
filtered.push({
|
|
1094
1122
|
entryId,
|
|
1095
1123
|
packageName: pkgName,
|
|
1096
1124
|
version: installedVersion,
|
|
1097
|
-
installedAt: new Date().toISOString()
|
|
1125
|
+
installedAt: new Date().toISOString(),
|
|
1126
|
+
bundle: isBundle,
|
|
1127
|
+
bundleRowIds
|
|
1098
1128
|
});
|
|
1099
1129
|
saveManifest(filtered);
|
|
1100
1130
|
|
|
1101
|
-
logger.info(`插件 ${pkgSpec}
|
|
1131
|
+
logger.info(`插件 ${pkgSpec} 安装成功${isBundle ? '(bundle 形态,无家级登记)' : '并已登记至 cordis.patch.yml'}`);
|
|
1102
1132
|
return { ok: true, version: installedVersion, log: installRes.log };
|
|
1103
1133
|
});
|
|
1104
1134
|
|
|
@@ -1131,7 +1161,7 @@ export function apply(ctx) {
|
|
|
1131
1161
|
const { insertEntries } = getHomePatchEntries();
|
|
1132
1162
|
const homeEntry = insertEntries.get(entryId);
|
|
1133
1163
|
const manifest = readManifest();
|
|
1134
|
-
const manifestRecord = manifest.find(m => m.entryId === entryId);
|
|
1164
|
+
const manifestRecord = manifest.find(m => m.entryId === entryId || (m.bundleRowIds || []).includes(entryId));
|
|
1135
1165
|
|
|
1136
1166
|
// 1. 由插件管理器安装的 npm 包
|
|
1137
1167
|
if (manifestRecord) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-manager-plus",
|
|
3
3
|
"description": "DeepSeek Harness (DSH) 插件管理器:设置面板内的社区插件市场(npm 搜索一键安装)+ 已安装插件管理(来源/用途/状态三维筛选、启停热重载、一键卸载、持久化)。Plugin manager & marketplace for DeepSeek Harness.",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.mjs",
|
|
7
7
|
"exports": {
|