Skip to content

Root entry (require/import 'lean-agentic') fails: dist/index.* loads ../wasm/ which is never published #5

Closed

Description

@ruvnet

Since at least 0.3.2 (and still in 0.3.3), the package root entry point cannot be loaded:

$ node -e 'require("lean-agentic")'
Error: Cannot find module '../wasm/leanr_wasm.js'
$ node --input-type=module -e 'import "lean-agentic"'
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../node_modules/lean-agentic/wasm/leanr_wasm.js'

dist/index.js and dist/index.mjs import ../wasm/leanr_wasm.js, which is the wasm-pack --target bundler output. That wasm/ directory is not in the published tarball, and a bundler-target build would not load in plain Node anyway. lean-agentic/node, the CLI and the MCP server work because they use wasm-node/.

Possible fixes: point the Node conditions of the . export at dist/node.*, or publish a working wasm/ build.

Separately, dist/node.js writes Initializing Lean-Agentic WASM... (and createIdentity logs) to stdout. That pollutes the MCP stdio JSON-RPC stream and should go to stderr.

🤖 Generated with claude-flow

Activity

  1. ruvnet commented on Nov 6, 2026

    @ruvnet
    ContributorAuthor

    Fixed in #6 and released as lean-agentic@0.3.4 (now latest).

    I installed 0.3.4 from the registry into a fresh project and checked it:

    • require and import work for lean-agentic and lean-agentic/node, and import works for lean-agentic/web and lean-agentic/package.json. None of them print anything to stdout. (import "lean-agentic/node" was also broken in 0.3.3: dist/node.mjs was CommonJS.)
    • The root entry point is now the Node.js build: the same API as lean-agentic/node, plus init(). Browsers use lean-agentic/web.
    • The WASM logs are off by default. When turned on (LEAN_AGENTIC_DEBUG=1 or setDebug(true)) they go to stderr.
    • The MCP server was tested directly and through lean-agentic mcp start, which never started the server in 0.3.3. After initialize, notifications/initialized and two tools/calls, stdout holds only the three JSON-RPC responses.
    • The CLI's --version and demo work.
    • The tarball has the same 34 files as 0.3.3. Unpacked size went from 277,054 to 272,674 bytes: each rebuilt .wasm is 2,064 bytes smaller (logging is now behind a flag), and the dist/*.mjs files are now small ESM wrappers instead of copies of the CommonJS code.
    • The registry shasum matches the tarball that CI tested (b05e762b).

    CI now runs the same check (scripts/check-package.mjs) against the packed tarball on every PR.

    Still open and out of scope here: benchmarkEquality() throws unreachable in WASM because it uses std::time::Instant. The README's AgentIdentity/SignedProof example uses symbols the npm package doesn't export. initialize reports capabilities as booleans rather than objects.

    🤖 Generated with claude-flow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions