feat(config): add disabled_skills denylist for shared skill directories#1983
feat(config): add disabled_skills denylist for shared skill directories#1983zicochaos wants to merge 4 commits into
Conversation
Allow config.toml to fully hide selected skill names from Kimi model listings, the Skill tool, slash menus, and user activation while leaving skill files on disk for shared directories such as ~/.agents/skills.
Keep protocol error codes in sync with agent-core so node-sdk dts build accepts the disabled_skills hard-deny path.
Clarify that disabled_skills only covers the Skill surface, deny rules still apply in YOLO mode, and show Bash deny patterns for skill helper binaries.
🦋 Changeset detectedLatest commit: d8e6864 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df3ca14c9c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| if (this.skillCatalog.catalog.isSkillDisabled(input.name)) { | ||
| throw new Error2( | ||
| ErrorCodes.SKILL_DISABLED, |
There was a problem hiding this comment.
Map disabled skill activation to a client error
When a disabled skill is activated through POST /sessions/{id}/skills/{name}:activate, this new ErrorCodes.SKILL_DISABLED path reaches packages/kap-server/src/routes/skills.ts's sendMappedError, which only handles SKILL_NOT_FOUND, SKILL_NAME_EMPTY, and SKILL_TYPE_UNSUPPORTED; the error is then rethrown to the global handler as 50001. 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 👍 / 👎.
| const disabledSkills = | ||
| this.config.get<DisabledSkillsConfig>(DISABLED_SKILLS_SECTION) ?? []; | ||
| const m = new InMemorySkillCatalog({ disabledSkills }); |
There was a problem hiding this comment.
Apply disabled_skills to workspace skill listings
This wires disabled_skills into the session-scoped catalog, but the no-session workspace listing still composes its own catalog in packages/kap-server/src/routes/skills.ts with new InMemorySkillCatalog() and returns catalog.listSkills(). apps/kimi-web uses GET /workspaces/{id}/skills to pre-warm the onboarding composer's slash menu before a session exists, so disabled skills still appear there until the first session is created; pass the same config into that workspace catalog as well.
Useful? React with 👍 / 👎.
… errors Map skill.disabled to wire 40912 on activation and pass disabledSkills into the session-less workspace catalog so web previews match session listings.
Related Issue
Resolve #1982
Problem
See linked issue. Shared skill directories (for example
~/.agents/skills/) often contain skills that should stay on disk for other tools but must not appear in Kimi's model listing,Skilltool, or slash menu. Existing levers are incomplete:disableModelInvocation: trueonly blocks automatic model invocationSkill(...)can still leave the skill visible in listingsWhat changed
disabled_skillsinconfig.toml(case-insensitive name denylist, default[])skill.disabledand config REST/protocol fields for the new setting@moonshot-ai/kimi-code)Matching skills are fully hidden from Kimi surfaces while files remain on disk.
/reloador a new session applies config changes. This only covers the Skill surface; shell reimplementation still needs permission deny rules when required.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.