Description
When loading memory-tencentdb as a non-bundled OpenClaw plugin (auto-discovered after install), the following error occurs during plugin registration:
[plugins] memory-tencentdb failed during register from .../dist/index.mjs:
TypeError: Cannot read properties of undefined (reading 'resolveStateDir')
The error originates at line 16969 of the compiled dist:
const pluginDataDir = path.join(api.runtime.state.resolveStateDir(), "memory-tdai");
api.runtime.state is undefined when the plugin registers before the runtime state is fully initialized.
Environment
- OpenClaw version: 2026.5.22
- Plugin: @tencentdb-agent-memory/memory-tencentdb (latest)
- Install method: npm global install + auto-discovery via plugins.allow empty
Additional Issues Noticed
1. L1 extraction JSON parser greedy regex
The parseExtractionResult function uses a greedy regex /\[[\s\S]*\]/ that captures trailing text when the LLM adds content after the JSON array. This causes JSON.parse failures like:
Failed to parse extraction result: Unexpected non-whitespace character after JSON at position 564
Local fix: replaced with bracket-depth tracking (counting [/{ and ]/}) to find the first complete JSON array and ignore trailing text.
2. EmbeddingService not available
With default config (embedding.provider: "none"), the recall falls back to keyword-only:
Strategy "hybrid" requested but EmbeddingService not available, falling back to keyword
Would be helpful to document which embedding providers/models are supported and how to configure them (e.g. baseUrl, apiKey, model, dimensions requirements).
Expected Behavior
Plugin should either:
- Gracefully handle
resolveStateDir() being unavailable at registration time (e.g. by using a fallback path)
- Or defer registration until runtime state is available
Description
When loading
memory-tencentdbas a non-bundled OpenClaw plugin (auto-discovered after install), the following error occurs during plugin registration:The error originates at line 16969 of the compiled dist:
api.runtime.stateisundefinedwhen the plugin registers before the runtime state is fully initialized.Environment
Additional Issues Noticed
1. L1 extraction JSON parser greedy regex
The
parseExtractionResultfunction uses a greedy regex/\[[\s\S]*\]/that captures trailing text when the LLM adds content after the JSON array. This causesJSON.parsefailures like:Local fix: replaced with bracket-depth tracking (counting
[/{and]/}) to find the first complete JSON array and ignore trailing text.2. EmbeddingService not available
With default config (
embedding.provider: "none"), the recall falls back to keyword-only:Would be helpful to document which embedding providers/models are supported and how to configure them (e.g. baseUrl, apiKey, model, dimensions requirements).
Expected Behavior
Plugin should either:
resolveStateDir()being unavailable at registration time (e.g. by using a fallback path)