fix: move @mariozechner/pi-* from optional peer-deps to runtime dependencies#637
Open
NePav wants to merge 1 commit intoMartian-Engineering:mainfrom
Open
fix: move @mariozechner/pi-* from optional peer-deps to runtime dependencies#637NePav wants to merge 1 commit intoMartian-Engineering:mainfrom
NePav wants to merge 1 commit intoMartian-Engineering:mainfrom
Conversation
…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.
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.
Summary
Moves
@mariozechner/pi-agent-core,@mariozechner/pi-ai, and@mariozechner/pi-coding-agentfrompeerDependencies(withpeerDependenciesMeta.optional: true) to runtimedependencies.The plugin's bundled
dist/index.jsimports these unconditionally — the build script has--external:"@mariozechner/*", so they must be resolvable from the plugin's module-resolution chain at runtime. Theoptional: trueflag is therefore not honored: when these packages aren't present, the plugin fails to load withERR_MODULE_NOT_FOUNDinstead of degrading gracefully.Treating them as runtime
dependenciesmakes the plugin self-contained onnpm installand removes the host-symlink workaround that fresh OpenClaw installs currently need.Fixes #636.
Why this approach (vs. honoring
optionalvia dynamic imports)The simplest and safest fix is to make the
package.jsonreflect what the runtime already does (hard-require these). Honoringoptional: truein code would require splitting the imports into dynamicawait 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
npm install. No host-bundling assumption. Works on anyopenclawinstall path or version, not just ones that ship@mariozechner/*bundled.peerDependenciesMetaentries (only@mariozechner/*were listed;openclawpeer-dep stays).>=0.66 <1range and the existing pinned bundled version.Verification
Locally on macOS / Node 22.22.1, after applying:
After running the plugin under OpenClaw 2026.5.7:
openclaw plugins inspect lossless-claw→Status: loaded(was:failed to load)ERR_MODULE_NOT_FOUNDin logsDiff scope
package.json: 3 entries moved (deps), 3 entries removed (peerDeps),peerDependenciesMetaremovedpackage-lock.json: regenerated vianpm install --omit=dev(smaller, since pi-* are no longer duplicated as devDeps).changeset/move-pi-deps-to-dependencies.md: patch-level changeset describing the fixNotes
@mariozechner/pi-*fromdevDependenciessince they're now installed viadependenciesregardless. If you'd rather keep them pinned in devDeps for reproducible test/build (the original had them at0.66.1exact), happy to add back — just say the word.>=0.66 <1for the dependency range to mirror the original peer-dep range; tightening to e.g.^0.66.1would also be reasonable.