pi-nocturne-memory 1.0.6 → 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.
@@ -33,16 +33,39 @@ async function callMCP(method: string, params: Record<string, unknown>): Promise
33
33
  });
34
34
 
35
35
  const text = await resp.text();
36
- const lines = text.split("\n");
36
+ // Handle CRLF line endings from SSE
37
+ const lines = text.split(/\r?\n/);
38
+ let currentData = "";
39
+
37
40
  for (const line of lines) {
38
- if (line.startsWith("data: ")) {
41
+ const trimmed = line.trim();
42
+ if (trimmed.startsWith("data: ")) {
43
+ currentData = trimmed.slice(6);
44
+ } else if (trimmed.startsWith("event: ")) {
45
+ // ignore event type
46
+ } else if (trimmed === "" && currentData) {
47
+ // empty line after data = end of event
39
48
  try {
40
- return JSON.parse(line.slice(6));
49
+ const parsed = JSON.parse(currentData);
50
+ if (parsed.result || parsed.error) {
51
+ return parsed;
52
+ }
41
53
  } catch {
42
54
  // continue
43
55
  }
56
+ currentData = "";
57
+ }
58
+ }
59
+
60
+ // Handle case where data is last line (no trailing empty line)
61
+ if (currentData) {
62
+ try {
63
+ return JSON.parse(currentData);
64
+ } catch {
65
+ // ignore
44
66
  }
45
67
  }
68
+
46
69
  return null;
47
70
  }
48
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-nocturne-memory",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Nocturne Memory extension for Pi — automated memory management with SessionStart boot protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/test.sh ADDED
@@ -0,0 +1,40 @@
1
+ #!/bin/bash
2
+ # Test pi-nocturne-memory extension
3
+ set -e
4
+
5
+ echo "=== Testing pi-nocturne-memory ==="
6
+
7
+ # Test 1: Config file exists
8
+ if [ -f ~/.pi/pi-nocturne-memory.json ]; then
9
+ echo "✓ Config file exists"
10
+ else
11
+ echo "✗ Config file missing"
12
+ exit 1
13
+ fi
14
+
15
+ # Test 2: MCP URL configured
16
+ if grep -q "mcpUrl" ~/.pi/pi-nocturne-memory.json; then
17
+ echo "✓ MCP URL configured"
18
+ else
19
+ echo "✗ MCP URL missing"
20
+ exit 1
21
+ fi
22
+
23
+ # Test 3: Extension files exist
24
+ cd /Users/slahser/Desktop/pi-nocturne-memory
25
+ if [ -f "extensions/index.ts" ]; then
26
+ echo "✓ Extension file exists"
27
+ else
28
+ echo "✗ Extension file missing"
29
+ exit 1
30
+ fi
31
+
32
+ # Test 4: MCP server reachable
33
+ MCP_URL=$(grep -o '"mcpUrl": *"[^"]*"' ~/.pi/pi-nocturne-memory.json | cut -d'"' -f4)
34
+ if curl -s --max-time 5 -o /dev/null -w "%{http_code}" "$MCP_URL" | grep -q "200\|405"; then
35
+ echo "✓ MCP server reachable"
36
+ else
37
+ echo "⚠ MCP server unreachable (may need auth)"
38
+ fi
39
+
40
+ echo "=== pi-nocturne-memory tests passed ==="