fix: prefer .js over .ts when loading plugins for npm compatibility#10
Merged
simongdavies merged 1 commit intohyperlight-dev:mainfrom Mar 24, 2026
Merged
Conversation
Contributor
simongdavies
commented
Mar 24, 2026
- Add resolvePluginSource() helper (prefers .ts in dev, .js under node_modules)
- Fix schema extraction to prefer .ts source for Rust parser
- Fix fast-path plugin enable to call loadSource() before enabling
- Root cause: schema extraction failed on compiled .js, config keys unrecognised, allowedDomains never set
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves plugin loading behavior to be compatible with npm-installed layouts by centralizing “which file to read/import” decisions (.ts vs .js), and adjusts schema extraction and the approved fast-path to avoid misconfigurations (e.g., missing allowedDomains due to schema extraction failures).
Changes:
- Add
resolvePluginSource()and use it for plugin source reads/imports and approval hashing. - Update schema extraction to prefer
.tswhen available, with fallbacks for node_modules/runtime contexts. - Ensure approved fast-path loads plugin source before enabling; add targeted tests for resolution behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/plugin-manager.test.ts | Adds unit tests covering .ts vs .js resolution rules for dev vs node_modules. |
| src/plugin-system/manager.ts | Introduces resolvePluginSource(), updates hashing/source loading, and adjusts schema extraction + verification path usage. |
| src/agent/slash-commands.ts | Loads plugin source before enabling in the approved fast-path to support subsequent hash verification. |
| src/agent/index.ts | Uses resolvePluginSource() when dynamically importing enabled plugins into the sandbox. |
- Add resolvePluginSource() helper (prefers .ts in dev, .js under node_modules) - Fix schema extraction to prefer .ts source for Rust parser - Fix fast-path plugin enable to call loadSource() before enabling - Root cause: schema extraction failed on compiled .js, config keys unrecognised, allowedDomains never set Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
85a9ee7 to
29c2ee9
Compare
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.