Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(plugins): parse CR-delimited MCP event streams (#5973)

LI22ea8c7b3460
diff --git a/agent-plugins/servers/shared/mcp-proxy-core.mjs b/agent-plugins/servers/shared/mcp-proxy-core.mjs
index d491b824d..495819f85 100644
--- a/agent-plugins/servers/shared/mcp-proxy-core.mjs
+++ b/agent-plugins/servers/shared/mcp-proxy-core.mjs
@@ -102,7 +102,7 @@ function parseSseMessages(text) {
messages.push(JSON.parse(data));
}
- for (const rawLine of String(text || "").split(/\r?\n/)) {
+ for (const rawLine of String(text || "").split(/\r\n|\r|\n/)) {
if (rawLine === "") {
flush();
continue;
diff --git a/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json b/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json
index 9d7dcf270..af22f33b5 100644
--- a/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/cursor/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.17",
+ "version": "0.5.18",
"clients": [
"cursor"
],
diff --git a/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json b/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json
index 6623bac04..7f5008087 100644
--- a/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json
+++ b/examples/agent-hook-plugin/hosts/kimicode/kimi.plugin.json
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
- "version": "0.5.17",
+ "version": "0.5.18",
"description": "Long-term semantic memory for Kimi Code CLI, powered by OpenViking.",
"author": {
"name": "OpenViking",
diff --git a/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json b/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json
index b0aac125e..a5b02bd0f 100644
--- a/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/kimicode/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.17",
+ "version": "0.5.18",
"clients": [
"kimicode"
],
diff --git a/examples/agent-hook-plugin/hosts/trae/openviking.integration.json b/examples/agent-hook-plugin/hosts/trae/openviking.integration.json
index 1881ea828..b82ce6880 100644
--- a/examples/agent-hook-plugin/hosts/trae/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/trae/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.17",
+ "version": "0.5.18",
"clients": [
"trae",
"trae-cn"
diff --git a/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json b/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json
index d1ab6f3af..87690e1bc 100644
--- a/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json
+++ b/examples/agent-hook-plugin/hosts/zcode/openviking.integration.json
@@ -1,7 +1,7 @@
{
"schemaVersion": 1,
"id": "openviking-memory",
- "version": "0.5.17",
+ "version": "0.5.18",
"clients": [
"zcode"
],
diff --git a/examples/agent-hook-plugin/plugin.json b/examples/agent-hook-plugin/plugin.json
index 955da7409..13bc87b76 100644
--- a/examples/agent-hook-plugin/plugin.json
+++ b/examples/agent-hook-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "agent-hook-plugin",
- "version": "0.5.17",
+ "version": "0.5.18",
"description": "Long-term semantic memory for Cursor, TRAE, TRAE CN, ZCode and Kimi Code — powered by OpenViking. Auto-recall relevant memories and capture the conversation as it happens.",
"author": {
"name": "OpenViking",
diff --git a/examples/claude-code-memory-plugin/.claude-plugin/plugin.json b/examples/claude-code-memory-plugin/.claude-plugin/plugin.json
index 2f3f3891c..627d750e5 100644
--- a/examples/claude-code-memory-plugin/.claude-plugin/plugin.json
+++ b/examples/claude-code-memory-plugin/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
- "version": "0.7.9",
+ "version": "0.7.10",
"description": "Long-term semantic memory for Claude Code, powered by OpenViking. Auto-recall relevant memories at session start and capture important information during conversations.",
"author": {
"name": "OpenViking",
diff --git a/examples/claude-code-memory-plugin/package.json b/examples/claude-code-memory-plugin/package.json
index 725688f1b..71eb2f10f 100644
--- a/examples/claude-code-memory-plugin/package.json
+++ b/examples/claude-code-memory-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-code-openviking-memory",
- "version": "0.7.9",
+ "version": "0.7.10",
"description": "OpenViking memory plugin for Claude Code — semantic long-term memory",
"type": "module",
"scripts": {
diff --git a/examples/claude-code-memory-plugin/scripts/shared/mcp-proxy-core.mjs b/examples/claude-code-memory-plugin/scripts/shared/mcp-proxy-core.mjs
index d491b824d..495819f85 100644
--- a/examples/claude-code-memory-plugin/scripts/shared/mcp-proxy-core.mjs
+++ b/examples/claude-code-memory-plugin/scripts/shared/mcp-proxy-core.mjs
@@ -102,7 +102,7 @@ function parseSseMessages(text) {
messages.push(JSON.parse(data));
}
- for (const rawLine of String(text || "").split(/\r?\n/)) {
+ for (const rawLine of String(text || "").split(/\r\n|\r|\n/)) {
if (rawLine === "") {
flush();
continue;
diff --git a/examples/codex-memory-plugin/.codex-plugin/plugin.json b/examples/codex-memory-plugin/.codex-plugin/plugin.json
index 8046bfac3..2a3f34ac2 100644
--- a/examples/codex-memory-plugin/.codex-plugin/plugin.json
+++ b/examples/codex-memory-plugin/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "openviking-memory",
- "version": "0.11.8",
+ "version": "0.11.9",
"description": "Long-term semantic memory for Codex, powered by OpenViking. Recall on UserPromptSubmit, incremental add_message on Stop (per turn), commit on SessionEnd (Codex >= 0.145) and on PreCompact, with an idle/ended sweep on SessionStart as the fallback for signals, crashes and older Codex builds. Includes a local stdio MCP proxy that reads OpenViking credentials from env/ovcli.conf.",
"author": {
"name": "OpenViking",
diff --git a/examples/codex-memory-plugin/scripts/shared/mcp-proxy-core.mjs b/examples/codex-memory-plugin/scripts/shared/mcp-proxy-core.mjs
index d491b824d..495819f85 100644
--- a/examples/codex-memory-plugin/scripts/shared/mcp-proxy-core.mjs
+++ b/examples/codex-memory-plugin/scripts/shared/mcp-proxy-core.mjs
@@ -102,7 +102,7 @@ function parseSseMessages(text) {
messages.push(JSON.parse(data));
}
- for (const rawLine of String(text || "").split(/\r?\n/)) {
+ for (const rawLine of String(text || "").split(/\r\n|\r|\n/)) {
if (rawLine === "") {
flush();
continue;
diff --git a/examples/dsh-memory-plugin/config.mjs b/examples/dsh-memory-plugin/config.mjs
index 0dbfbf07e..3b3cf178e 100644
--- a/examples/dsh-memory-plugin/config.mjs
+++ b/examples/dsh-memory-plugin/config.mjs
@@ -1,7 +1,7 @@
import { buildPluginConfig } from "./shared/plugin-config.mjs";
import { loadCredentialFiles } from "./shared/credentials.mjs";
-export const PLUGIN_VERSION = "0.5.23";
+export const PLUGIN_VERSION = "0.5.24";
/**
* Namespace for the bridged OpenViking MCP tools. DSH publishes every MCP tool
diff --git a/examples/dsh-memory-plugin/package-lock.json b/examples/dsh-memory-plugin/package-lock.json
index 24ff12656..eee1ed556 100644
--- a/examples/dsh-memory-plugin/package-lock.json
+++ b/examples/dsh-memory-plugin/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@openviking/dsh-memory-plugin",
- "version": "0.5.23",
+ "version": "0.5.24",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@openviking/dsh-memory-plugin",
- "version": "0.5.23",
+ "version": "0.5.24",
"license": "Apache-2.0",
"devDependencies": {
"@deepseek-ai/dsh-llm": "0.1.0-rc.6",
diff --git a/examples/dsh-memory-plugin/package.json b/examples/dsh-memory-plugin/package.json
index 5cbda27f8..1627cbef6 100644
--- a/examples/dsh-memory-plugin/package.json
+++ b/examples/dsh-memory-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@openviking/dsh-memory-plugin",
- "version": "0.5.23",
+ "version": "0.5.24",
"description": "OpenViking memory and context bundle for DeepSeek Harness",
"icon": "./icon.svg",
"type": "module",
diff --git a/examples/memory-plugin-shared/lib/mcp-proxy-core.mjs b/examples/memory-plugin-shared/lib/mcp-proxy-core.mjs
index 2c44c1f4f..5891599e6 100644
--- a/examples/memory-plugin-shared/lib/mcp-proxy-core.mjs
+++ b/examples/memory-plugin-shared/lib/mcp-proxy-core.mjs
@@ -101,7 +101,7 @@ function parseSseMessages(text) {
messages.push(JSON.parse(data));
}
- for (const rawLine of String(text || "").split(/\r?\n/)) {
+ for (const rawLine of String(text || "").split(/\r\n|\r|\n/)) {
if (rawLine === "") {
flush();
continue;
diff --git a/examples/memory-plugin-shared/mcp-proxy-core.test.mjs b/examples/memory-plugin-shared/mcp-proxy-core.test.mjs
index 1887ad131..870892d0c 100644
--- a/examples/memory-plugin-shared/mcp-proxy-core.test.mjs
+++ b/examples/memory-plugin-shared/mcp-proxy-core.test.mjs
@@ -13,8 +13,8 @@ function jsonRpc(id, result = {}) {
return { jsonrpc: "2.0", id, result };
}
-function sseMessage(obj) {
- return `event: message\r\ndata: ${JSON.stringify(obj)}\r\n\r\n`;
+function sseMessage(obj, lineEnding = "\r\n") {
+ return `event: message${lineEnding}data: ${JSON.stringify(obj)}${lineEnding}${lineEnding}`;
}
/**
@@ -85,33 +85,35 @@ function makeProxy({ url, fetchImpl, configOverrides = {}, localToolProvider, re
};
}
-test("captures initialize session id and forwards SSE JSON-RPC response", async () => {
- await withServer((_req, res, entry) => {
- assert.equal(entry.method, "POST");
- assert.equal(entry.headers.authorization, "Bearer test-key");
- assert.equal(entry.headers["x-openviking-account"], "default");
- assert.equal(entry.headers["x-openviking-user"], "zeus");
- assert.equal(entry.headers["x-openviking-actor-peer"], "peer-a");
- assert.equal(entry.headers["user-agent"], "openviking-memory-test/9.9.9");
- assert.equal(entry.headers["mcp-protocol-version"], "2025-06-18");
- assert.equal(entry.headers["mcp-session-id"], undefined);
- res.writeHead(200, {
- "content-type": "text/event-stream",
- "mcp-session-id": "sid-1",
- });
- res.end(`: keepalive\r\n${sseMessage(jsonRpc(1, { protocolVersion: "2025-06-18" }))}`);
- }, async ({ url, requests }) => {
- const { proxy, messages } = makeProxy({ url });
- await proxy.handleMessage({
- jsonrpc: "2.0",
- id: 1,
- method: "initialize",
- params: { protocolVersion: "2025-06-18" },
+for (const [label, lineEnding] of [["CRLF", "\r\n"], ["LF", "\n"], ["CR", "\r"]]) {
+ test(`captures initialize session id and forwards ${label} SSE JSON-RPC response`, async () => {
+ await withServer((_req, res, entry) => {
+ assert.equal(entry.method, "POST");
+ assert.equal(entry.headers.authorization, "Bearer test-key");
+ assert.equal(entry.headers["x-openviking-account"], "default");
+ assert.equal(entry.headers["x-openviking-user"], "zeus");
+ assert.equal(entry.headers["x-openviking-actor-peer"], "peer-a");
+ assert.equal(entry.headers["user-agent"], "openviking-memory-test/9.9.9");
+ assert.equal(entry.headers["mcp-protocol-version"], "2025-06-18");
+ assert.equal(entry.headers["mcp-session-id"], undefined);
+ res.writeHead(200, {
+ "content-type": "text/event-stream",
+ "mcp-session-id": "sid-1",
+ });
+ res.end(`: keepalive${lineEnding}${sseMessage(jsonRpc(1, { protocolVersion: "2025-06-18" }), lineEnding)}`);
+ }, async ({ url, requests }) => {
+ const { proxy, messages } = makeProxy({ url });
+ await proxy.handleMessage({
+ jsonrpc: "2.0",
+ id: 1,
+ method: "initialize",
+ params: { protocolVersion: "2025-06-18" },
+ });
+ assert.deepEqual(await messages(), [jsonRpc(1, { protocolVersion: "2025-06-18" })]);
+ assert.equal(requests.length, 1);
});
- assert.deepEqual(await messages(), [jsonRpc(1, { protocolVersion: "2025-06-18" })]);
- assert.equal(requests.length, 1);
});
-});
+}
test("never forwards the client's un-negotiated protocol version header", async () => {
await withServer((_req, res, entry) => {
diff --git a/examples/opencode-plugin/package.json b/examples/opencode-plugin/package.json
index 0217bb347..aa50eac87 100644
--- a/examples/opencode-plugin/package.json
+++ b/examples/opencode-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@openviking/opencode-plugin",
- "version": "0.5.11",
+ "version": "0.5.12",
"author": "@openviking",
"description": "Unified OpenCode plugin for OpenViking repository retrieval and long-term memory",
"type": "module",
diff --git a/examples/pi-coding-agent-extension/package-lock.json b/examples/pi-coding-agent-extension/package-lock.json
index 0769bf72b..9a1e82b5d 100644
--- a/examples/pi-coding-agent-extension/package-lock.json
+++ b/examples/pi-coding-agent-extension/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "openviking-pi-extension",
- "version": "0.4.16",
+ "version": "0.4.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openviking-pi-extension",
- "version": "0.4.16",
+ "version": "0.4.17",
"dependencies": {
"@modelcontextprotocol/client": "2.0.0"
},
diff --git a/examples/pi-coding-agent-extension/package.json b/examples/pi-coding-agent-extension/package.json
index d9790e3b2..94ebc9c74 100644
--- a/examples/pi-coding-agent-extension/package.json
+++ b/examples/pi-coding-agent-extension/package.json
@@ -1,6 +1,6 @@
{
"name": "openviking-pi-extension",
- "version": "0.4.16",
+ "version": "0.4.17",
"description": "OpenViking memory and context extension for the pi coding agent",
"private": true,
"type": "module",