pi-nocturne-memory 1.0.7 → 1.0.8
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/extensions/index.ts +7 -5
- package/package.json +1 -1
package/extensions/index.ts
CHANGED
|
@@ -33,15 +33,17 @@ async function callMCP(method: string, params: Record<string, unknown>): Promise
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
const text = await resp.text();
|
|
36
|
-
|
|
36
|
+
// Handle CRLF line endings from SSE
|
|
37
|
+
const lines = text.split(/\r?\n/);
|
|
37
38
|
let currentData = "";
|
|
38
39
|
|
|
39
40
|
for (const line of lines) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const trimmed = line.trim();
|
|
42
|
+
if (trimmed.startsWith("data: ")) {
|
|
43
|
+
currentData = trimmed.slice(6);
|
|
44
|
+
} else if (trimmed.startsWith("event: ")) {
|
|
43
45
|
// ignore event type
|
|
44
|
-
} else if (
|
|
46
|
+
} else if (trimmed === "" && currentData) {
|
|
45
47
|
// empty line after data = end of event
|
|
46
48
|
try {
|
|
47
49
|
const parsed = JSON.parse(currentData);
|