dsh-plugin-pack 1.0.11 → 1.0.12

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.
@@ -33,15 +33,20 @@ export function describeLocalPlugin(dir) {
33
33
  throw error;
34
34
  }
35
35
  const entry = resolveEntry(target, meta);
36
- const patchRel = typeof meta?.dsh?.bundle?.patch === 'string' ? meta.dsh.bundle.patch : null;
36
+ // dsh.bundle.patch 可能是字符串或数组(一个插件可声明多个 patch 文件)
37
+ const patchSpec = meta?.dsh?.bundle?.patch;
38
+ const patchRels = (Array.isArray(patchSpec) ? patchSpec : [patchSpec]).filter(
39
+ (rel) => typeof rel === 'string' && rel.trim(),
40
+ );
37
41
  return {
38
42
  dir: target,
39
43
  name: meta.name.trim(),
40
44
  version: meta.version ?? '0.0.0',
41
45
  description: typeof meta.description === 'string' ? meta.description : '',
42
46
  entry,
43
- hasPatch: patchRel ? isFile(path.join(target, patchRel)) : false,
44
- patchRel,
47
+ hasPatch: patchRels.some((rel) => isFile(path.join(target, rel))),
48
+ patchRel: patchRels[0] ?? null,
49
+ patchRels,
45
50
  client: meta.dsh?.client ?? null,
46
51
  deps: Object.keys(meta.dependencies ?? {}).filter((dep) => !dep.startsWith('@deepseek-ai/')),
47
52
  };
@@ -96,7 +101,11 @@ export function importLocalPlugin(options = {}) {
96
101
  const insertRows = [];
97
102
  const skippedRows = [];
98
103
  if (info.hasPatch) {
99
- const ownPatch = readText(path.join(info.dir, info.patchRel), '') ?? '';
104
+ // 多 patch 文件的插件要把每一份都读进来合并,只读第一个会丢配置
105
+ const ownPatch = (info.patchRels ?? [info.patchRel])
106
+ .filter(Boolean)
107
+ .map((rel) => readText(path.join(info.dir, rel), '') ?? '')
108
+ .join('\n');
100
109
  const target = { name: info.name, dirs: [info.dir] };
101
110
  for (const entry of splitTopLevel(ownPatch)) {
102
111
  if (entry.kind === 'insert') {
package/lib/scan.js CHANGED
@@ -557,6 +557,17 @@ async function buildPlugin(item, { profileDir, dshHome, topEntries, includeSecre
557
557
  if (!entry && meta) pluginWarnings.push('找不到入口文件,导入后可能加载失败');
558
558
  if (pluginWarnings.length) warnings.push(...pluginWarnings.map((text) => `${name}: ${text}`));
559
559
 
560
+ /**
561
+ * `dsh.bundle.patch` 可能是字符串,也可能是数组
562
+ * (一个插件声明多个 patch 文件,实测 dsh-agentic-pet 就是数组)。
563
+ * 早先只当字符串处理,遇到数组会让 path.join 抛
564
+ * ERR_INVALID_ARG_TYPE: The "path" argument must be of type string。
565
+ */
566
+ const patchSpec = meta?.dsh?.bundle?.patch;
567
+ const patchRels = (Array.isArray(patchSpec) ? patchSpec : [patchSpec]).filter(
568
+ (rel) => typeof rel === 'string' && rel.trim(),
569
+ );
570
+
560
571
  return {
561
572
  name,
562
573
  version: meta?.version ?? '0.0.0',
@@ -568,8 +579,10 @@ async function buildPlugin(item, { profileDir, dshHome, topEntries, includeSecre
568
579
  inBundles: item.inBundles,
569
580
  bundleIndex: item.bundleIndex,
570
581
  sources: [...item.sources],
571
- hasPatch: Boolean(meta?.dsh?.bundle?.patch) && isFile(path.join(item.dir, meta.dsh.bundle.patch)),
572
- patchRel: typeof meta?.dsh?.bundle?.patch === 'string' ? meta.dsh.bundle.patch : null,
582
+ hasPatch: patchRels.some((rel) => isFile(path.join(item.dir, rel))),
583
+ // 主 patch 路径(多文件时取第一个,其余在 patchRels 里)
584
+ patchRel: patchRels[0] ?? null,
585
+ patchRels,
573
586
  client: meta?.dsh?.client ?? null,
574
587
  entry,
575
588
  deps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-pack",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "DeepSeek Harness 插件整合包:一键把当前 profile 的第三方插件连依赖和配置导出成 zip(内部每个插件是标准 npm tgz),换机/换 profile 拖进去就能还原。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",