@vainplex/openclaw-membrane 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.5] — 2026-03-04
4
+
5
+ ### Fixed
6
+ - **validateConfig crash when no config block exists.** `validateConfig(rawConfig)` threw when `rawConfig` was `undefined` (no explicit `openclaw-membrane` config in openclaw.json). Now gracefully defaults to `{}`. (Thanks @Oo__Abe__oO)
7
+
8
+ ## [0.3.4] — 2026-03-04
9
+
10
+ ### Fixed
11
+ - **Assistant messages now captured in Membrane.** Added `agent_end` hook workaround for `message_sent` not firing from gateway delivery pipeline in OpenClaw v2026.3.x. Only captures the last assistant message per turn (avoids flooding with entire conversation history).
12
+ - **Removed `after_tool_call` hook.** Tool calls are operational logs (~95% of Membrane volume) and drown out actual conversations. Tool data is already captured in the NATS event store.
13
+
3
14
  ## [0.3.0] — 2026-02-23
4
15
 
5
16
  ### Added
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # @vainplex/openclaw-membrane
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@vainplex/openclaw-membrane)](https://www.npmjs.com/package/@vainplex/openclaw-membrane)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
3
6
  Membrane gRPC bridge for OpenClaw — persistent episodic memory via [GustyCube/membrane](https://github.com/GustyCube/membrane) sidecar.
4
7
 
5
8
  **What it does:** Every conversation, tool call, and decision flows into Membrane's biological memory model. Memories decay over time. Frequently accessed ones grow stronger. Your agent remembers what matters and forgets what doesn't.
package/dist/index.js CHANGED
@@ -19,6 +19,8 @@ export function createConfig(rawConfig) {
19
19
  };
20
20
  }
21
21
  export function validateConfig(raw) {
22
+ if (!raw)
23
+ return {};
22
24
  const result = {};
23
25
  if (typeof raw.grpc_endpoint === 'string')
24
26
  result.grpc_endpoint = raw.grpc_endpoint;
@@ -166,6 +168,34 @@ const plugin = {
166
168
  api.on('message_received', hookHandler('message_received'));
167
169
  api.on('message_sent', hookHandler('message_sent'));
168
170
  api.on('message_sending', hookHandler('message_sending'));
171
+ // Workaround: message_sent hook doesn't fire from gateway delivery pipeline
172
+ // in OpenClaw v2026.3.x. Use agent_end to capture assistant messages instead.
173
+ // Only captures the LAST assistant message to avoid flooding with entire history.
174
+ // TODO: Remove when upstream fixes plugin hook bridging. PR: openclaw/openclaw#XXX
175
+ api.on('agent_end', (event, ctx) => {
176
+ const e = event;
177
+ if (!e.success || !e.messages)
178
+ return;
179
+ const messages = e.messages;
180
+ // Find the LAST assistant message only (not entire history)
181
+ for (let i = messages.length - 1; i >= 0; i--) {
182
+ const msg = messages[i];
183
+ if (msg.role !== 'assistant')
184
+ continue;
185
+ const content = typeof msg.content === 'string'
186
+ ? msg.content
187
+ : Array.isArray(msg.content)
188
+ ? msg.content
189
+ .filter((b) => b.type === 'text' && typeof b.text === 'string')
190
+ .map((b) => b.text)
191
+ .join('\n')
192
+ : '';
193
+ if (!content || content.length < 10)
194
+ break;
195
+ handleEvent({ type: 'message_sent', payload: { content }, context: ctx }, config, reliability, logger);
196
+ break; // Only the last one
197
+ }
198
+ });
169
199
  // after_tool_call removed — tool calls are operational logs, not memories.
170
200
  // They flood Membrane (~95% of volume) and drown out actual conversations.
171
201
  // Tool data is already captured in NATS event store.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vainplex/openclaw-membrane",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "description": "Membrane gRPC bridge for OpenClaw — episodic memory ingestion, search tool, and auto-context injection via Membrane sidecar",
6
6
  "main": "dist/index.js",