Skip to content

fix(plugin): add OpenClaw state dir fallback#85

Merged
Xuruida merged 1 commit into
Tencent:mainfrom
YOMXXX:fix/openclaw-state-dir-fallback
May 25, 2026
Merged

fix(plugin): add OpenClaw state dir fallback#85
Xuruida merged 1 commit into
Tencent:mainfrom
YOMXXX:fix/openclaw-state-dir-fallback

Conversation

@YOMXXX
Copy link
Copy Markdown
Contributor

@YOMXXX YOMXXX commented May 24, 2026

Summary

  • add an ESM-safe helper for resolving the OpenClaw state directory
  • fall back to ~/.openclaw when api.runtime.state is unavailable during plugin registration
  • reuse the same resolved state dir for plugin data and CLI registration
  • keep the npm tarball under Size Guard by publishing built runtime artifacts only

Fixes #78.

This is intended as a safer alternative to #79: it avoids bare require("os") in the ESM source path and adds a focused unit test for the fallback behavior.

Verification

  • npm test
  • npm run build
  • npm pack --dry-run (package size: 340.2 kB, unpacked: 1.3 MB)

@Xuruida
Copy link
Copy Markdown
Collaborator

Xuruida commented May 25, 2026

Adopting this fix over #79 mainly because of the included test coverage and ESM-safe structure.
Thanks to @leoge007 for the initial diagnosis and to @YOMXXX for the complete fix! 🚀

@Xuruida Xuruida merged commit acc2665 into Tencent:main May 25, 2026
5 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.

fix: runtime.state.resolveStateDir undefined on OpenClaw >=2026.5.x

2 participants