Skip to content

fix: move @mariozechner/pi-* from optional peer-deps to runtime dependencies#637

Open
NePav wants to merge 1 commit intoMartian-Engineering:mainfrom
NePav:fix/move-pi-deps-to-dependencies
Open

fix: move @mariozechner/pi-* from optional peer-deps to runtime dependencies#637
NePav wants to merge 1 commit intoMartian-Engineering:mainfrom
NePav:fix/move-pi-deps-to-dependencies

Conversation

@NePav
Copy link
Copy Markdown

@NePav NePav commented May 8, 2026

Summary

Moves @mariozechner/pi-agent-core, @mariozechner/pi-ai, and @mariozechner/pi-coding-agent from peerDependencies (with peerDependenciesMeta.optional: true) to runtime dependencies.

The plugin's bundled dist/index.js imports these unconditionally — the build script has --external:"@mariozechner/*", so they must be resolvable from the plugin's module-resolution chain at runtime. The optional: true flag is therefore not honored: when these packages aren't present, the plugin fails to load with ERR_MODULE_NOT_FOUND instead of degrading gracefully.

Treating them as runtime dependencies makes the plugin self-contained on npm install and removes the host-symlink workaround that fresh OpenClaw installs currently need.

Fixes #636.

Why this approach (vs. honoring optional via dynamic imports)

The simplest and safest fix is to make the package.json reflect what the runtime already does (hard-require these). Honoring optional: true in code would require splitting the imports into dynamic await import() calls with try/catch and feature-gating the dependent code paths — a larger change with semantic implications about which features should still work without the pi-* deps. If you'd prefer that direction instead, happy to close this PR and rework — let me know.

Trade-offs

  • Pro: Self-contained npm install. No host-bundling assumption. Works on any openclaw install path or version, not just ones that ship @mariozechner/* bundled.
  • Pro: Removes the now-orphan peerDependenciesMeta entries (only @mariozechner/* were listed; openclaw peer-dep stays).
  • Con: ~minor disk overlap with OpenClaw's bundled copies of the same packages on installs where both are present. Bounded by >=0.66 <1 range and the existing pinned bundled version.

Verification

Locally on macOS / Node 22.22.1, after applying:

$ rm -rf node_modules/@mariozechner/  # simulate fresh install with no host-symlink
$ npm install --omit=dev
added 685 packages in 12s
$ ls node_modules/@mariozechner/
pi-agent-core  pi-ai  pi-coding-agent

After running the plugin under OpenClaw 2026.5.7:

  • openclaw plugins inspect lossless-clawStatus: loaded (was: failed to load)
  • Context engine slot binds correctly; sessions use lossless-claw, not legacy fallback
  • No ERR_MODULE_NOT_FOUND in logs

Diff scope

  • package.json: 3 entries moved (deps), 3 entries removed (peerDeps), peerDependenciesMeta removed
  • package-lock.json: regenerated via npm install --omit=dev (smaller, since pi-* are no longer duplicated as devDeps)
  • .changeset/move-pi-deps-to-dependencies.md: patch-level changeset describing the fix

Notes

  • I dropped @mariozechner/pi-* from devDependencies since they're now installed via dependencies regardless. If you'd rather keep them pinned in devDeps for reproducible test/build (the original had them at 0.66.1 exact), happy to add back — just say the word.
  • Used >=0.66 <1 for the dependency range to mirror the original peer-dep range; tightening to e.g. ^0.66.1 would also be reasonable.

…dencies

The plugin's bundled dist/index.js imports @mariozechner/pi-agent-core,
pi-ai, and pi-coding-agent unconditionally (build script externalizes
@mariozechner/*), so absence becomes a hard ERR_MODULE_NOT_FOUND at
module-load time. The peerDependenciesMeta.optional: true contract was
not honored at runtime, leaving fresh OpenClaw installs unable to load
the plugin without manually symlinking the pi-* packages from the host.

Treating them as runtime dependencies makes the plugin self-contained
on `npm install` and removes the host-symlink workaround currently
required.

Fixes Martian-Engineering#636.
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.

[regression] lossless-claw@0.9.4 fails to load on fresh openclaw@2026.5.7 install: ERR_MODULE_NOT_FOUND for optional @mariozechner/* peer-deps

2 participants