Skip to content

fix: prefer .js over .ts when loading plugins for npm compatibility#8

Merged
simongdavies merged 1 commit into
hyperlight-dev:mainfrom
simongdavies:fix-plugin-ts-loading
Mar 24, 2026
Merged

fix: prefer .js over .ts when loading plugins for npm compatibility#8
simongdavies merged 1 commit into
hyperlight-dev:mainfrom
simongdavies:fix-plugin-ts-loading

Conversation

@simongdavies
Copy link
Copy Markdown
Member

Node.js refuses to strip types from .ts files under node_modules, causing 'Stripping types is currently unsupported' errors when plugins are loaded via npm install.

  • Add resolvePluginSource() helper that prefers .js over .ts
  • Update plugin import, source loading, hash computation, and source verification to use the helper
  • .js files exist in dist/ builds (compiled at build time)
  • .ts files still used in dev mode (tsx handles them)

Type validation is unaffected — it uses pre-built .d.ts files (plugins/host-modules.d.ts), not runtime plugin source.

Copilot AI review requested due to automatic review settings March 23, 2026 23:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts plugin source resolution to prefer compiled JavaScript over TypeScript to avoid Node.js “Stripping types is currently unsupported” errors when plugins are installed via npm (i.e., under node_modules), while still supporting TypeScript in dev workflows.

Changes:

  • Added a resolvePluginSource() helper in the plugin manager and used it for plugin hashing, source loading, and source verification.
  • Updated plugin source read/error messages to reflect {ts,js} support.
  • Updated the agent’s plugin loader to prefer index.js when present before dynamically importing plugins.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
src/plugin-system/manager.ts Introduces and applies JS-first plugin source resolution for hashing/load/verify paths.
src/agent/index.ts Updates runtime plugin dynamic import to select index.js when available.

Comment thread src/plugin-system/manager.ts Outdated
Comment thread src/plugin-system/manager.ts
Comment thread src/agent/index.ts Outdated
Comment thread src/agent/index.ts Outdated
Comment thread src/agent/index.ts Outdated
Comment thread src/plugin-system/manager.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread tests/plugin-manager.test.ts
Comment thread src/plugin-system/manager.ts Outdated
Node.js refuses to strip types from .ts files under node_modules,
causing 'Stripping types is currently unsupported' errors when
plugins are loaded via npm install.

- Add resolvePluginSource() helper that prefers .js over .ts
- Update plugin import, source loading, hash computation, and
  source verification to use the helper
- .js files exist in dist/ builds (compiled at build time)
- .ts files still used in dev mode (tsx handles them)

Type validation is unaffected — it uses pre-built .d.ts files
(plugins/host-modules.d.ts), not runtime plugin source.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@simongdavies simongdavies merged commit 4aa42f2 into hyperlight-dev:main Mar 24, 2026
12 checks passed
simongdavies added a commit to simongdavies/hyperagent that referenced this pull request May 14, 2026
- Fix hyperlight-dev#2: Use MCP_SETUP_COMMANDS lookup for correct CLI setup hints
  (was generating 'setup-rti-mcp' instead of '--mcp-setup-fabric-rti')
- Fix hyperlight-dev#3: Show unconfigured status when mcpManager is null
- Fix hyperlight-dev#4: Update test assertion to match corrected setup command
- Fix hyperlight-dev#5: Add highlight.js ^10.7.3 as explicit dependency (was transitive)
- Fix hyperlight-dev#6: Validate Fabric RTI options — reject missing values & unknown flags
- Fix hyperlight-dev#7: Set HYPERAGENT_VERBOSE=1 from cli.verbose flag
- Fix hyperlight-dev#8: Update skill count from 9 to 10 in docs/SKILLS.md
- Fix hyperlight-dev#9: Use stderr 'ignore' instead of 'pipe' to avoid back-pressure
- Fix hyperlight-dev#10: Add CLI parser test for --mcp-setup-fabric-rti flag

Comment hyperlight-dev#1 (hljs types) is invalid — typecheck passes with /// <reference>.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
simongdavies added a commit that referenced this pull request May 14, 2026
- /markdown toggle: set sessionNeedsRebuild so system prompt updates (#1)
- CLI help: document --[no-]markdown, --md/--no-md aliases, HYPERAGENT_MARKDOWN (#6)
- Streamed output: gate renderMarkdown on looksLikeMarkdown consistently (#7)
- markdown-renderer: use local Marked instance instead of global setOptions (#9)
- looksLikeMarkdown: remove over-eager bold and unordered-list patterns (#10)
- unescape: verified valid marked-terminal option (comment was wrong) (#8)
- linkifyFiles order: verified safe — [[file:]] not a markdown token (#16)

Verified: diff matches this message. 40 test files, 2350 tests pass.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
simongdavies added a commit that referenced this pull request May 14, 2026
* feat: KQL expert skill with requires-mcp, trigger cleanup, syntax highlighting

- Add kql-expert skill (SKILL.md) with 35 triggers, requires-mcp: fabric-rti-mcp
- Add requires-mcp frontmatter support in skill-loader + approach-resolver
- Add MCP enrichment wiring in agent index.ts
- Add --mcp setup-fabric-rti CLI command
- Clean generic triggers across 7 skills to prevent false matches
- Add hljs-kql.ts grammar (derived from @kusto/monaco-kusto MIT)
- Register KQL/Kusto syntax highlighting in markdown-renderer via createRequire
- Add intent-matcher regression tests (27 tests: 22 positive + 5 guards)
- Add skill-loader tests (8 tests) and approach-resolver MCP tests (8 tests)

All 2396 tests pass. Typecheck clean. Fmt clean.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

* fix: gate diagnostic output behind --verbose/--debug flags

- Rust: gate [hyperlight-analysis] eprintln! behind HYPERAGENT_VERBOSE/DEBUG env vars
- MCP: gate [mcp] Connected/Auth success messages behind isVerbose()
- MCP: pipe subprocess stderr when not verbose to suppress Python INFO logs
- KQL skill: remove azuremcpserver reference, add anti-pattern to use fabric-rti-mcp only

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

* docs: update skill tables and add requires-mcp documentation

- Add all 9 skills to tables in docs/SKILLS.md, README.md, skills/CLAUDE.md,
  and .github/instructions/skills.instructions.md (was missing kql-expert,
  xlsx-expert, mcp-services in various files)
- Document requires-mcp frontmatter field in docs/SKILLS.md
- Add requires-mcp to YAML examples in instruction files
- Alphabetise skill tables for consistency

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

* fix: address PR #137 review feedback (9 issues)

- Fix #2: Use MCP_SETUP_COMMANDS lookup for correct CLI setup hints
  (was generating 'setup-rti-mcp' instead of '--mcp-setup-fabric-rti')
- Fix #3: Show unconfigured status when mcpManager is null
- Fix #4: Update test assertion to match corrected setup command
- Fix #5: Add highlight.js ^10.7.3 as explicit dependency (was transitive)
- Fix #6: Validate Fabric RTI options — reject missing values & unknown flags
- Fix #7: Set HYPERAGENT_VERBOSE=1 from cli.verbose flag
- Fix #8: Update skill count from 9 to 10 in docs/SKILLS.md
- Fix #9: Use stderr 'ignore' instead of 'pipe' to avoid back-pressure
- Fix #10: Add CLI parser test for --mcp-setup-fabric-rti flag

Comment #1 (hljs types) is invalid — typecheck passes with /// <reference>.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>

---------

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants