pi-nocturne-memory 1.0.6 → 1.0.7

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.
@@ -34,15 +34,36 @@ async function callMCP(method: string, params: Record<string, unknown>): Promise
34
34
 
35
35
  const text = await resp.text();
36
36
  const lines = text.split("\n");
37
+ let currentData = "";
38
+
37
39
  for (const line of lines) {
38
40
  if (line.startsWith("data: ")) {
41
+ currentData = line.slice(6);
42
+ } else if (line.startsWith("event: ")) {
43
+ // ignore event type
44
+ } else if (line.trim() === "" && currentData) {
45
+ // empty line after data = end of event
39
46
  try {
40
- return JSON.parse(line.slice(6));
47
+ const parsed = JSON.parse(currentData);
48
+ if (parsed.result || parsed.error) {
49
+ return parsed;
50
+ }
41
51
  } catch {
42
52
  // continue
43
53
  }
54
+ currentData = "";
55
+ }
56
+ }
57
+
58
+ // Handle case where data is last line (no trailing empty line)
59
+ if (currentData) {
60
+ try {
61
+ return JSON.parse(currentData);
62
+ } catch {
63
+ // ignore
44
64
  }
45
65
  }
66
+
46
67
  return null;
47
68
  }
48
69
 
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.7",
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 ==="