feat(kap-server): add POST /sessions/{id}/skills:reload endpoint - #3597
feat(kap-server): add POST /sessions/{id}/skills:reload endpoint#3597liukx0205 wants to merge 2 commits into
Conversation
Reload the user-level skill sources (user / explicit / extra dirs) of the session's workspace skill catalog and return the refreshed skill list, so clients can pick up skills created after the session started without a restart.
🦋 Changeset detectedLatest commit: 5d5bff3 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 |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 377ebefd86
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Expose reloadSources on ISessionSkillCatalogData (delegating to the owning workspace skill catalog) and have the skills:reload route reload through the session scope seed instead of programForSession, so a live session whose controller belongs to a retained previous runtime generation reloads its own catalog rather than the current one.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Superseded by a simpler approach: watch user-level skill roots directly so the catalog is always fresh (no endpoint needed). Replaced by #3608 |
…s fresh (#3608) * feat(agent-core-v2): watch user-level skill roots so the catalog stays fresh UserFileSkillSource previously only re-scanned the user skill roots (KIMI_CODE_HOME/skills and ~/.agents/skills) on catalog load, so a skill created while the daemon was running never appeared until a restart. Mirror the workspace-root source: watch both user-level base directories with a subtree filter limited to the skill-root candidates, debounce (200ms) change events, and fire onDidChange so the catalog reloads the 'user' source automatically. Watch handles are registered on the service's DisposableStore and disposed with the App scope. Supersedes the skills:reload endpoint approach (#3597). * fix(agent-core-v2): merge same-base watch candidates and drop test comments Codex review on #3608: - When KIMI_CODE_HOME equals the OS home dir, deduplicating watch bases skipped the .agents/skills candidate entirely. Group candidates by base instead so one watch covers both roots. - Remove // phase labels from the catalog test: agent-core-v2 is a comment-free zone enforced by scripts/check-no-comments.mjs (lint was red on CI).
Related Issue
Fixes the daemon side of "skills created from the app are not visible to the current session without a restart" (client-side change: https://github.com/MoonshotAI/kimi-code-app/pull/542).
Problem
The daemon's workspace skill catalog only re-scans the user-level skill directories (
~/.kimi-code/skills,~/.agents/skills, explicit/extra dirs) when a session is created. Those directories are not watched, so a skill created while a session is running never shows up inGET /sessions/{id}/skillsuntil the daemon restarts or a new session is created.What changed
POST /api/v1/sessions/{session_id}/skills:reloadinpackages/kap-server/src/routes/skills.ts. It resolves the session like the existing skills routes, callsIWorkspaceSkillCatalog.reloadSources(['user', 'explicit', 'extra'])on the session's program (viaprogramForSession), and returns the refreshed skill list in the same shape asGET /sessions/{id}/skills.skills::reload, same asfs::search), so it matches exactly/sessions/{id}/skills:reload.packages/kap-server/test/skills.test.ts: 40401 for an unknown session, and an end-to-end check that aSKILL.mdwritten into the user skills dir after session creation appears in the reload response and in the subsequent list. API surface snapshot updated.Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.