Public Access
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
// DeepSeek Harness bundle 入口。
|
|||
|
|
// 两种接线方式互斥:
|
||
|
|
// - 启动路径:cordis.patch.yml 直接插入技能提供方那一行,本模块不会被加载;
|
||
|
|
// - 热安装(profile 工具对本包调用 loader.create):本模块作为插件自行挂载同一个提供方,
|
||
|
|
// 无需重启即可让随包技能生效。
|
||
|
|
import { dirname, join } from 'node:path';
|
||
|
|
import { fileURLToPath } from 'node:url';
|
||
|
|
|
||
|
|
export const name = 'engineering-conventions';
|
||
|
|
|
||
|
|
const PROVIDER = '@deepseek-ai/dsh-skill-filesystem';
|
||
|
|
|
||
|
|
export function apply(ctx, config = {}) {
|
||
|
|
const skillRoot = config.bundledSkillDir
|
||
|
|
?? join(dirname(fileURLToPath(import.meta.url)), '..', 'skills');
|
||
|
|
ctx.effect(() => {
|
||
|
|
let entryId;
|
||
|
|
let disposed = false;
|
||
|
|
void ctx.loader.create({
|
||
|
|
name: PROVIDER,
|
||
|
|
config: {
|
||
|
|
providerName: 'engineering-conventions',
|
||
|
|
includeDefaultRoots: false,
|
||
|
|
bundledSkillDir: skillRoot,
|
||
|
|
},
|
||
|
|
}).then((id) => {
|
||
|
|
if (disposed) ctx.loader.remove(id);
|
||
|
|
else entryId = id;
|
||
|
|
}).catch((error) => {
|
||
|
|
console.error(`Failed to load ${PROVIDER} for ${name}.`, error);
|
||
|
|
});
|
||
|
|
return () => {
|
||
|
|
disposed = true;
|
||
|
|
if (entryId) ctx.loader.remove(entryId);
|
||
|
|
};
|
||
|
|
});
|
||
|
|
}
|