voicesmith-mcp 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.
@@ -38,7 +38,16 @@ try:
38
38
  raise SystemExit
39
39
  except (OSError, ProcessLookupError):
40
40
  pass
41
- # Fallback: most recent alive session
41
+ # Prefer the most recent session without a session_id (just registered, waiting for hook)
42
+ for s in reversed(data.get('sessions', [])):
43
+ try:
44
+ os.kill(s['pid'], 0)
45
+ if not s.get('session_id'):
46
+ print(s['port'])
47
+ raise SystemExit
48
+ except (OSError, ProcessLookupError):
49
+ pass
50
+ # Final fallback: most recent alive session
42
51
  for s in reversed(data.get('sessions', [])):
43
52
  try:
44
53
  os.kill(s['pid'], 0)
@@ -51,11 +60,17 @@ except:
51
60
  " 2>/dev/null)
52
61
 
53
62
  # Send session_id to the server if we have both port and session_id
63
+ # Retry up to 3 times — the HTTP listener may not be ready yet
54
64
  if [ -n "$PORT" ] && [ -n "$SESSION_ID" ]; then
55
- RESPONSE=$(curl -s --max-time 3 -X POST \
56
- -H "Content-Type: application/json" \
57
- -d "{\"session_id\": \"$SESSION_ID\"}" \
58
- "http://127.0.0.1:$PORT/session" 2>/dev/null)
65
+ RESPONSE=""
66
+ for attempt in 1 2 3; do
67
+ RESPONSE=$(curl -s --max-time 3 -X POST \
68
+ -H "Content-Type: application/json" \
69
+ -d "{\"session_id\": \"$SESSION_ID\"}" \
70
+ "http://127.0.0.1:$PORT/session" 2>/dev/null)
71
+ [ -n "$RESPONSE" ] && break
72
+ sleep 0.5
73
+ done
59
74
 
60
75
  if [ -n "$RESPONSE" ]; then
61
76
  SESSION_NAME=$(echo "$RESPONSE" | python3 -c "
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voicesmith-mcp",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Local AI voice for coding assistants — TTS & STT via MCP. Kokoro ONNX + faster-whisper, fully offline.",
5
5
  "bin": {
6
6
  "voicesmith-mcp": "bin/cli.js"