🗂️ feat: Add Deployment Skill Directory#13523
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR introduces “deployment skills”: read-only skills loaded at server startup from a shared filesystem directory (configurable via DEPLOYMENT_SKILLS_DIR) so deployments can ship common skills to all skill-enabled users without persisting them in MongoDB.
Changes:
- Added an in-memory deployment skill registry that loads/validates
SKILL.md+ bundled files at startup and exposes stable skill/file records. - Integrated deployment skills across agent skill resolution, REST skill reads, download streaming, and skill-state pruning while keeping writes scoped to DB-backed skills.
- Updated Docker/Compose +
.env.exampledocs and added targeted unit tests.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| skill/README.md | Documents the deployment skills directory layout and behavior. |
| packages/data-schemas/src/methods/index.ts | Re-exports skill validation/helpers used by deployment skill loading. |
| packages/data-schemas/src/index.ts | Surfaces the new method exports from the package entrypoint. |
| packages/data-provider/src/types/skills.ts | Extends SkillSource to include deployment and updates related docs. |
| packages/api/src/skills/index.ts | Exposes the new deployment skills module via package exports. |
| packages/api/src/skills/import.ts | Exports guessMimeType() for reuse by deployment skill file loading. |
| packages/api/src/skills/deployment.ts | Implements deployment skill directory resolution, loading, registry, and DB-method wrappers. |
| packages/api/src/skills/tests/deployment.test.ts | Adds tests for directory resolution, validation, loading, and wrapper behavior. |
| packages/api/src/agents/skills.ts | Defaults deployment skills to active unless explicitly overridden off. |
| packages/api/src/agents/initialize.ts | Extends DB method interfaces to thread deployment?: boolean through agent init. |
| packages/api/src/agents/handlers.ts | Extends tool execute options typing to include deployment?: boolean. |
| packages/api/src/agents/tests/skills.test.ts | Adds coverage for deployment-skill activation + manual/always-apply behavior. |
| Dockerfile.multi | Copies skill/ into the multi-stage image build output. |
| Dockerfile | Creates /app/skill directory for runtime mounting/use. |
| docker-compose.yml | Mounts host ./skill into container /app/skill. |
| deploy-compose.yml | Mounts host ./skill into container /app/skill in deploy compose. |
| api/server/services/Endpoints/agents/skillDeps.js | Wraps skill DB methods/strategy funcs to include deployment skills + download streaming. |
| api/server/services/Endpoints/agents/initialize.js | Ensures skill listing/lookup and accessible skill IDs include deployment skills. |
| api/server/routes/skills.js | Routes skill reads through wrapped methods and includes deployment IDs in access checks. |
| api/server/middleware/accessResources/canAccessSkillResource.js | Grants VIEW access to deployment skills and blocks non-VIEW as read-only. |
| api/server/index.js | Initializes deployment skills during server startup. |
| api/server/controllers/SkillStatesController.js | Prevents pruning deployment skill states and includes deployment IDs in accessible set. |
| api/server/controllers/agents/responses.js | Includes deployment skills in runtime skill resolution for responses route. |
| api/server/controllers/agents/openai.js | Includes deployment skills in runtime skill resolution for OpenAI agent route. |
| .env.example | Documents DEPLOYMENT_SKILLS_DIR configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (matchesLookupPreference(skill, options)) { | ||
| return skill; | ||
| } | ||
| return skill; | ||
| } |
| const dbLookup = base.getSkillByName | ||
| ? base.getSkillByName(name, stripDeploymentIds(accessibleIds), options) | ||
| : Promise.resolve(null); | ||
| const [dbSkill] = await Promise.all([dbLookup]); | ||
| const deployment = registry.getByName(name, accessibleIds, options); |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11b8b03720
ℹ️ 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".
| function toSkillFileRow(file: DeploymentSkillFile): SkillFileRow { | ||
| return { | ||
| relativePath: file.relativePath, | ||
| filename: file.filename, | ||
| filepath: file.filepath, | ||
| source: file.source, | ||
| mimeType: file.mimeType, |
There was a problem hiding this comment.
Include required metadata in deployment file rows
When listing files for a deployment skill, listSkillFiles returns these stripped-down rows and listFilesHandler immediately serializes each one with serializeSkillFile, which calls file._id.toString(), file.skillId.toString(), file.author.toString(), and reads file_id/category/timestamps. For any deployment skill with files, GET /api/skills/:id/files therefore throws and returns 500 instead of showing the bundled files; return the full DeploymentSkillFile metadata (or add a deployment-specific serializer) before exposing these rows.
Useful? React with 👍 / 👎.
|
@codex review |
GitNexus: 🚀 deployedThe |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
GitNexus: 🚀 deployedThe |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
GitNexus: 🚀 deployedThe |
* feat: Add deployment skill directory * chore: Address deployment skill review feedback * fix: Include deployment skill file metadata * test: Add deployment skills e2e smoke test
Summary
I added read-only deployment skills loaded from a shared filesystem directory so a deployment can ship common skills to every skill-enabled user without persisting those skills in MongoDB.
DEPLOYMENT_SKILLS_DIR, defaults to project-root./skill, validatesSKILL.mdand bundled file paths at startup, and serves stable in-memory skill/file records./app/skill, with.env.exampledocumentation and a starterskill/README.md.Change Type
Testing
NODE_PATH=/Users/danny/Projects/LibreChat/node_modules:/Users/danny/Projects/LibreChat/packages/data-schemas/node_modules /Users/danny/Projects/LibreChat/node_modules/.bin/jest src/skills/__tests__/deployment.test.ts src/agents/__tests__/skills.test.ts --runInBand --coverage=falsefrompackages/api.npm run build:data-provider.npm run build:data-schemas.npm run build:api; the build completed and still reports existing package-wide TypeScript warnings outside this change.Test Configuration:
node_modulessymlinks in this worktree.Checklist