dsh-skill-tag 0.1.6 → 0.1.7
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/index.js +56 -10
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { skillTagDomain } from "../src/storage/schema.js";
|
|
|
18
18
|
import { createDshRepository, serializeConversation, deserializeConversation } from "../src/storage/repository.js";
|
|
19
19
|
import { createServices } from "../src/service.js";
|
|
20
20
|
import { groupIdOf } from "../src/domain/model.js";
|
|
21
|
-
import { workspaceDeniedSkills, normalizeWorkspacePath, activeTagsOf } from "../src/domain/workspace.js";
|
|
21
|
+
import { workspaceDeniedSkills, workspaceSkillView, normalizeWorkspacePath, activeTagsOf } from "../src/domain/workspace.js";
|
|
22
22
|
import { candidatesFor } from "../src/domain/match.js";
|
|
23
23
|
import { mountApi } from "../src/api.js";
|
|
24
24
|
import { scanSkillRoots } from "../src/skill-scan.js";
|
|
@@ -336,6 +336,54 @@ export function runtimeDeniedSkills(ws, universe, candidates) {
|
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
/**
|
|
340
|
+
* 运行时真正下发给 provider 的拒绝集:新口径 ∪ 旧口径兜底的**严格补集**。
|
|
341
|
+
*
|
|
342
|
+
* 2026-10-27 修正的 bug:此前调用方把两段结果**无条件并集**——
|
|
343
|
+
* ① workspaceDeniedSkills(懂 manualSkills / disabledSkills)
|
|
344
|
+
* ② computeDeniedSkillIds(只看标签条件,linked − candidates)
|
|
345
|
+
* ② 不知道"手动添加",于是把「打了标签、但没被标签规则命中、靠手动加进对话」
|
|
346
|
+
* 的技能重新判成 deny,推翻 ① 的放行结论。本机唯一受害者是 tagging-skills
|
|
347
|
+
* (它只挂来源标签,靠「管理标签」右列手动添加)。
|
|
348
|
+
*
|
|
349
|
+
* 兜底原本的前提是「universe 扫不到这个名字,所以新口径没机会判定它」。
|
|
350
|
+
* 那就把这个前提写成代码 —— 两道闸:
|
|
351
|
+
* ① 新口径已放行的名字(标签命中 ∪ 手动添加 − 禁用)绝不再 deny;
|
|
352
|
+
* ② universe 里存在的名字已由新口径给出判定,兜底不重复表态。
|
|
353
|
+
* 剩下的才是真正需要兜底的历史残留(已卸载但标签还在的名字)。
|
|
354
|
+
*
|
|
355
|
+
* @param {{config?:object, manualSkills?:string[], disabledSkills?:string[]}} effective 生效配置
|
|
356
|
+
* @param {object} p
|
|
357
|
+
* @param {string[]} p.universe 本趟可发现的全部技能名
|
|
358
|
+
* @param {string[]} p.candidates 标签规则命中的技能名
|
|
359
|
+
* @param {string[]} p.linkedSkillIds 有标签关联的全部技能名(兜底段的输入)
|
|
360
|
+
* @returns {Set<string>}
|
|
361
|
+
*/
|
|
362
|
+
export function computeRuntimeDeniedSkillIds(effective, { universe, candidates, linkedSkillIds }) {
|
|
363
|
+
const view = workspaceSkillView({
|
|
364
|
+
config: effective?.config,
|
|
365
|
+
manualSkills: effective?.manualSkills,
|
|
366
|
+
disabledSkills: effective?.disabledSkills,
|
|
367
|
+
universe,
|
|
368
|
+
candidates,
|
|
369
|
+
});
|
|
370
|
+
const denied = workspaceDeniedSkills({
|
|
371
|
+
config: effective?.config,
|
|
372
|
+
manualSkills: effective?.manualSkills,
|
|
373
|
+
disabledSkills: effective?.disabledSkills,
|
|
374
|
+
universe,
|
|
375
|
+
candidates,
|
|
376
|
+
});
|
|
377
|
+
const allowed = new Set(view.visible);
|
|
378
|
+
const inUniverse = new Set(universe);
|
|
379
|
+
for (const skillId of computeDeniedSkillIds(effective?.config, linkedSkillIds, () => candidates)) {
|
|
380
|
+
if (allowed.has(skillId)) continue;
|
|
381
|
+
if (inUniverse.has(skillId)) continue;
|
|
382
|
+
denied.add(skillId);
|
|
383
|
+
}
|
|
384
|
+
return denied;
|
|
385
|
+
}
|
|
386
|
+
|
|
339
387
|
/**
|
|
340
388
|
* 技能发现:与「模型实际看到的技能目录」对齐的唯一入口。
|
|
341
389
|
*
|
|
@@ -660,15 +708,13 @@ export async function apply(ctx, config) {
|
|
|
660
708
|
config: effective.config,
|
|
661
709
|
active: activeTagsOf(effective.config),
|
|
662
710
|
});
|
|
663
|
-
|
|
664
|
-
//
|
|
665
|
-
for (const skillId of
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
() =>
|
|
669
|
-
))
|
|
670
|
-
denied.add(skillId);
|
|
671
|
-
}
|
|
711
|
+
// 当前生效配置下"该放行"的名字(标签命中 ∪ 手动添加 − 禁用)。
|
|
712
|
+
// 兜底段必须尊重它,否则会把手动添加的技能重新判成 deny。
|
|
713
|
+
for (const skillId of computeRuntimeDeniedSkillIds(effective, {
|
|
714
|
+
universe,
|
|
715
|
+
candidates,
|
|
716
|
+
linkedSkillIds: links.map((l) => l.skillId),
|
|
717
|
+
})) denied.add(skillId);
|
|
672
718
|
}
|
|
673
719
|
}
|
|
674
720
|
const after = [...denied].join(",");
|