feat(skills): Add npm: source type for installed packages - #150
Open
mohdhassaan wants to merge 1 commit into
Open
feat(skills): Add npm: source type for installed packages#150mohdhassaan wants to merge 1 commit into
mohdhassaan wants to merge 1 commit into
Conversation
Resolve skills that ship inside installed npm packages without hardcoding the node_modules layout: `npm:@acme/ui-kit/skills/upgrade` locates the package with Node module resolution (createRequire, with a node_modules walk fallback for packages whose exports map hides package.json) and then behaves exactly like a local path: source. Wildcards and `path` scoping work through the existing local flow; npm sources are always trusted like path: sources and lock as local entries. No network access — the package manager fetches, dotagents only locates and copies. Closes getsentry#149
|
@mohdhassaan is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #149
What
Adds an
npm:source type so skills that ship inside installed npm packages can be declared without hardcoding thenode_moduleslayout:Why
Libraries have started shipping agent skills in their packages so the skill content is versioned with the library (e.g. migration guides that must match the installed version). Today the only way to consume them is
path:./node_modules/@acme/ui-kit/..., which hardcodes a layout that isn't guaranteed (Yarn PnP has nonode_modules; hoisting moves packages), leaks package internals into every consumer'sagents.toml, and a bare@acme/ui-kit/...specifier misparses as GitHubowner/reposhorthand. Details in #149.Design
npm:behaves exactly likepath:, except the root is the resolved installed package:resolveNpmSourcelocates the package with Node's own module resolution —createRequire(projectRoot).resolve("<pkg>/package.json")— so pnpm symlink layouts, workspace hoisting, and PnP all work. Packages whoseexportsmap doesn't expose./package.json(common) fall back to a node_modules ancestor walk. Subpath traversal outside the package is rejected; the final directory is stat-checked, mirroringlocal.ts.acquireSkillSourcereturns{type: "local"}), soresolveSkill, wildcard discovery,pathscoping, install, and copy logic need no changes.installre-copies local sources every run).path:— they resolve to directories already on disk, vetted by the package manager's own supply-chain controls at install time.sourceType).dotagents add npm:...and subagent sources get the same treatment for parity.Testing
sources/npm.test.ts: specifier grammar (scoped/unscoped/invalid), explicit-specifier classification, trust bypass, resolution via both branches (exports-restricted → walk fallback; plain →require.resolve), not-installed error, traversal rejection, and end-to-endresolveSkill+ wildcard-with-paththrough the real resolver.pnpm checkgreen: oxlint 0 warnings, 303/303 lib tests, 581/581 host tests.path:./node_modules/...form).Docs updated: source-formats table (
cli.mdx), trust note (security.mdx), README example.