Skip to content

fix: resolve spawn npm ENOENT errors for composio-direct and stormtrade#126

Merged
xlabtg merged 3 commits intoxlabtg:mainfrom
konard:issue-125-4548a4583fd8
Apr 7, 2026
Merged

fix: resolve spawn npm ENOENT errors for composio-direct and stormtrade#126
xlabtg merged 3 commits intoxlabtg:mainfrom
konard:issue-125-4548a4583fd8

Conversation

@konard
Copy link
Copy Markdown

@konard konard commented Apr 7, 2026

Summary

Fixes #125 — Three plugin loader errors reported on Windows.

Root causes and fixes

1. [composio-direct] Failed to install deps: Error: spawn npm ENOENT

Root cause: PR #120 added package.json and package-lock.json to the composio-direct plugin to auto-install @composio/core at startup. The Teleton PluginLoader spawns npm ci as a child process, but on Windows npm is only available as npm.cmd. Using spawn('npm') fails with ENOENT because the executable is not found.

Fix: Remove package.json and package-lock.json. The @composio/core SDK is already lazy-loaded via dynamic import() with graceful fallback to direct HTTP API calls (added in PR #120). No npm install is needed at startup — the plugin works fully without the SDK.

2. [stormtrade] Failed to install deps: Error: spawn npm ENOENT + Cannot find module '@storm-trade/sdk'

Root cause: Same Windows npm ENOENT issue. Additionally, @storm-trade/sdk was require()d at the top level (not lazily), so when npm install fails and the module is missing, the entire plugin fails to import.

Fix: Remove package.json and package-lock.json, and make @storm-trade/sdk import lazy using try/catch — the same pattern used in tonco-dex (PR #92).

Tool Without SDK With SDK
storm_markets ✅ Full (REST API) ✅ Full
storm_market_info ✅ Full (REST API) ✅ Full
storm_positions ✅ Full (REST API) ✅ Full
storm_orders ✅ Full (REST API) ✅ Full
storm_trader_stats ✅ Full (REST API) ✅ Full
storm_open_position ❌ Actionable install error ✅ Full
storm_close_position ❌ Actionable install error ✅ Full
storm_add_margin ❌ Actionable install error ✅ Full
storm_remove_margin ❌ Actionable install error ✅ Full
storm_create_order ❌ Actionable install error ✅ Full
storm_cancel_order ❌ Actionable install error ✅ Full
storm_stake ❌ Actionable install error ✅ Full
storm_unstake ❌ Actionable install error ✅ Full

To install the optional SDK for full write functionality:

cd ~/.teleton/plugins/stormtrade && npm install

3. [ton-trading-bot] invalid manifest: description too long (>256 chars)

Already fixed in commit 4a1e053 (description truncated from 269 → 221 chars, which is within the 256-character limit). No additional changes needed.

Test plan

  • node scripts/validate-plugins.mjs — all 3 affected plugins validate: [OK] composio-direct: 4 tool(s), [OK] stormtrade: 13 tool(s), [OK] ton-trading-bot: 24 tool(s)
  • node scripts/run-tests.mjs — all 234 tests pass
  • npx eslint plugins/composio-direct/index.js plugins/stormtrade/index.js — no new errors (pre-existing warnings only)

🤖 Generated with Claude Code

konard and others added 2 commits April 7, 2026 11:41
Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: xlabtg#125
Three issues were reported when loading the agent:

1. [composio-direct] Failed to install deps: Error: spawn npm ENOENT
   - Root cause: package.json/package-lock.json were added in PR xlabtg#120,
     triggering npm ci at startup. On Windows, npm is only available as
     npm.cmd, so spawn('npm') fails with ENOENT.
   - Fix: Remove package.json and package-lock.json. The @composio/core
     SDK is already lazy-loaded via dynamic import() with graceful fallback
     to direct HTTP API, so no npm install is needed at startup.

2. [stormtrade] Failed to install deps: Error: spawn npm ENOENT
   [stormtrade] Cannot find module '@storm-trade/sdk'
   - Root cause: Same ENOENT issue as composio-direct. Additionally,
     @storm-trade/sdk was required at the top level (not lazily), so when
     the module is missing the entire plugin fails to load.
   - Fix: Remove package.json and package-lock.json, and make the
     @storm-trade/sdk import lazy (try/catch, same pattern as tonco-dex PR xlabtg#92).
     All 5 read tools (storm_markets, storm_market_info, storm_positions,
     storm_orders, storm_trader_stats) use the REST API and work without the SDK.
     The 8 write tools (open/close positions, add/remove margin, orders, stake/unstake)
     return an actionable install error when SDK is not available.

3. [ton-trading-bot] invalid manifest: description too long (>256 chars)
   - Already fixed in commit 4a1e053 (truncated from 269 to 221 chars).
   - No changes needed here.

All 234 tests pass. All 32 plugins validate successfully.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Logs when loading the agent fix: resolve spawn npm ENOENT errors for composio-direct and stormtrade Apr 7, 2026
@konard konard marked this pull request as ready for review April 7, 2026 11:50
@konard
Copy link
Copy Markdown
Author

konard commented Apr 7, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.923764
  • Calculated by Anthropic: $1.923764 USD
  • Difference: $-0.000000 (-0.00%)

📊 Context and tokens usage:

  • Context window: 89.1K / 1M input tokens (9%), 21.7K / 64K output tokens (34%)

Total: 79.6K + 4.3M cached input tokens, 21.7K output tokens, $1.923764 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: sonnet
  • Model: Claude Sonnet 4.6 (claude-sonnet-4-6)

📎 Log file uploaded as Gist (1317KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Author

konard commented Apr 7, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@xlabtg xlabtg merged commit d182221 into xlabtg:main Apr 7, 2026
7 checks passed
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.

Logs when loading the agent

2 participants