Skip to content

fix(skill): align with DSH skill service declarations - #93

Merged
wang-kaopu merged 2 commits into
omdsh-dev:mainfrom
MrThanlon:main
Sep 1, 2026
Merged

fix(skill): align with DSH skill service declarations#93
wang-kaopu merged 2 commits into
omdsh-dev:mainfrom
MrThanlon:main

Conversation

@MrThanlon

@MrThanlon MrThanlon commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

改动内容

  • 显式补充 @deepseek-ai/dsh-skill 依赖;
  • 使用官方 SkillProvider
  • 使用 DSH 通过 module augmentation 提供的 Context.skills,去掉手工的 Context & { skills: ... } 类型断言;
  • 将原有 fake skill registry 测试替换为真实 SkillRegistry 集成测试。

原因

#89 已经通过 ctx.skills.registerProvider(...) 实现了 bundled genui skill 注册,但当时为了接入 skills service,在 GenUI 内部自行补了一套类型定义。
DSH 官方的 @deepseek-ai/dsh-skill 已经提供了 SkillProvider,并对 Cordis Context 声明了 ctx.skills: SkillRegistry,因此这里应直接使用官方定义,避免维护一份平行 contract。
最初曾观察到“调整类型定义后 skill 可以正常注入”,但目前不把类型修改本身视为已确认的运行时根因。import type、module augmentation 和类型断言在编译后都会被擦除,实际现象也可能受到依赖解析、重新构建/加载或宿主启动状态等因素影响。

测试

真实 SkillRegistry 集成测试覆盖:

  • SkillRegistry → GenUI 启动顺序;
  • GenUI → SkillRegistry 晚绑定顺序;
  • ctx.skills.list() 能发现 genui
  • ctx.skills.get('genui') 能读取 bundled SKILL.md
  • 插件 dispose 后 provider 能正常移除。

Signed-off-by: 黄子懿 <i@anclx.cc>
@MrThanlon

Copy link
Copy Markdown
Contributor Author

我也不知道为啥, 原版没有成功注入 skills, 改了下类型定义就可以了

@MrThanlon

Copy link
Copy Markdown
Contributor Author

有点神秘, 应该是其他问题导致的没有注入 skill

@wang-kaopu wang-kaopu changed the title fix: skills fix(skill): align with DSH skill service declarations Sep 1, 2026
@wang-kaopu

Copy link
Copy Markdown
Collaborator

这个 PR 的主要改动:

  • 取消自行维护一套 SkillRegistry 类型,转而使用 DSH 官方提供的 SkillProvider contract;
  • 直接使用 @deepseek-ai/dsh-skill 对 Cordis Context 提供的ctx.skills: SkillRegistry,避免继续通过 Context & { skills: ... } 手工补一份重复定义。
  • SkillRegistry 的集成测试。

对于最初观察到的“先注入失败,调整类型定义后成功”,目前不能把原因直接归结为类型定义本身引起。import type、module augmentation 和类型断言在编译后基本都会被擦除,#89 和这个 PR 的核心运行时代码仍然都是:

ctx.inject(['skills'], (skillCtx) => {
  skillCtx.skills.registerProvider(...)
})

所以更合理的推测是这次修改同时带来的其他变化有所影响,包括:

  • 补上 @deepseek-ai/dsh-skill peer dependency 后,安装 / module graph / host 依赖关系变得更完整;
  • 修改依赖后触发了重新 install、build 或插件重新加载,使之前的旧构建或缓存状态被刷新;
  • 当时的宿主版本、插件加载顺序或 session 状态存在差异。

因此重新将这个 PR 定义为:**让 GenUI 的 bundled skill 注册方式正式对齐 DSH 官方的 skill service declaration。**至于最初遇到的 skill 缺失,不把类型定义作为根本原因。

@wang-kaopu
wang-kaopu merged commit e2301ea into omdsh-dev:main Sep 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants