-
Notifications
You must be signed in to change notification settings - Fork 645
feat(config): add disabled_skills denylist for shared skill directories #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6039ed9
255070e
df3ca14
d8e6864
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@moonshot-ai/kimi-code": minor | ||
| --- | ||
|
|
||
| Add `disabled_skills` config to fully hide selected skill names from Kimi (model listing, Skill tool, slash menu, and activation). Set `disabled_skills = ["name"]` in `config.toml`, then run `/reload`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,12 @@ import { Disposable } from '#/_base/di/lifecycle'; | |
| import { InstantiationType } from '#/_base/di/extensions'; | ||
| import { Emitter, type Event } from '#/_base/event'; | ||
| import { LifecycleScope, registerScopedService } from '#/_base/di/scope'; | ||
| import { IConfigService } from '#/app/config/config'; | ||
| import { IBuiltinSkillSource } from '#/app/skillCatalog/builtinSkillSource'; | ||
| import { | ||
| DISABLED_SKILLS_SECTION, | ||
| type DisabledSkillsConfig, | ||
| } from '#/app/skillCatalog/configSection'; | ||
| import { InMemorySkillCatalog } from '#/app/skillCatalog/registry'; | ||
| import type { ISkillSource, SkillContribution } from '#/app/skillCatalog/skillSource'; | ||
| import type { SkillCatalog } from '#/app/skillCatalog/types'; | ||
|
|
@@ -47,12 +52,21 @@ export class SessionSkillCatalogService | |
| @IExtraFileSkillSource extra: IExtraFileSkillSource, | ||
| @IWorkspaceFileSkillSource workspace: IWorkspaceFileSkillSource, | ||
| @IPluginSkillSource plugin: IPluginSkillSource, | ||
| @IConfigService private readonly config: IConfigService, | ||
| ) { | ||
| super(); | ||
| this.sources = [builtin, user, explicit, extra, workspace, plugin].toSorted((a, b) => a.priority - b.priority); | ||
| for (const s of this.sources) { | ||
| if (s.onDidChange) this._register(s.onDidChange(() => { void this.reloadSource(s.id); })); | ||
| } | ||
| this._register( | ||
| this.config.onDidSectionChange((event) => { | ||
| if (event.domain === DISABLED_SKILLS_SECTION) { | ||
| this.remerge(); | ||
| this.onDidChangeEmitter.fire('disabledSkills'); | ||
| } | ||
| }), | ||
| ); | ||
| this.ready = this.loadAll(); | ||
| } | ||
|
|
||
|
|
@@ -115,7 +129,9 @@ export class SessionSkillCatalogService | |
| } | ||
|
|
||
| private remerge(): void { | ||
| const m = new InMemorySkillCatalog(); | ||
| const disabledSkills = | ||
| this.config.get<DisabledSkillsConfig>(DISABLED_SKILLS_SECTION) ?? []; | ||
| const m = new InMemorySkillCatalog({ disabledSkills }); | ||
|
Comment on lines
+132
to
+134
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This wires Useful? React with 👍 / 👎. |
||
| const ordered = [...this.contributions.values()].toSorted((a, b) => a.priority - b.priority); | ||
| for (const { c } of ordered) { | ||
| for (const skill of c.skills) m.register(skill, { replace: true }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a disabled skill is activated through
POST /sessions/{id}/skills/{name}:activate, this newErrorCodes.SKILL_DISABLEDpath reachespackages/kap-server/src/routes/skills.ts'ssendMappedError, which only handlesSKILL_NOT_FOUND,SKILL_NAME_EMPTY, andSKILL_TYPE_UNSUPPORTED; the error is then rethrown to the global handler as50001. A direct REST call or stale slash-menu entry for a disabled skill should return a deterministic client error instead of an internal error, so add this code to the route/error-code mapping.Useful? React with 👍 / 👎.