patchcord 0.5.5 → 0.5.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "patchcord",
3
3
  "description": "Cross-machine agent messaging with push delivery. Messages from other agents arrive as native channel notifications.",
4
- "version": "0.5.5",
4
+ "version": "0.5.7",
5
5
  "author": {
6
6
  "name": "ppravdin"
7
7
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",
@@ -54,7 +54,11 @@ pc_part=""
54
54
  if [ -n "$pc_url" ] && [ -n "$pc_token" ]; then
55
55
  cache_key=$(printf '%s\n%s\n' "$mcp_json" "$pc_url" | sha256sum | awk '{print $1}')
56
56
  cache_file="/tmp/claude/patchcord-statusline-${cache_key}.json"
57
- cache_max_age=20
57
+ # Identity (agent, namespace, machine) never changes without .mcp.json
58
+ # rotating. Inbox count drifts in 5 min but subscribe.mjs surfaces real
59
+ # arrivals immediately via Monitor, so the count here is just decorative.
60
+ # 5 min TTL → ~12 calls/hour instead of ~180.
61
+ cache_max_age=300
58
62
  mkdir -p /tmp/claude
59
63
 
60
64
  needs_refresh=true
@@ -70,7 +74,7 @@ if [ -n "$pc_url" ] && [ -n "$pc_token" ]; then
70
74
  fi
71
75
 
72
76
  if $needs_refresh; then
73
- http_code=$(curl -s -o /tmp/claude/patchcord-sl-resp.json -w "%{http_code}" --max-time 3 \
77
+ http_code=$(curl -s -o /tmp/claude/patchcord-sl-resp.json -w "%{http_code}" --max-time 5 \
74
78
  -H "Authorization: Bearer $pc_token" \
75
79
  "${pc_url}/api/inbox?status=pending&limit=50" 2>/dev/null || echo "000")
76
80
  if [ "$http_code" = "401" ] || [ "$http_code" = "403" ]; then
@@ -79,6 +83,14 @@ if [ -n "$pc_url" ] && [ -n "$pc_token" ]; then
79
83
  elif [ "$http_code" = "200" ]; then
80
84
  pc_data=$(cat /tmp/claude/patchcord-sl-resp.json 2>/dev/null)
81
85
  [ -n "$pc_data" ] && echo "$pc_data" > "$cache_file"
86
+ # Touch cache mtime even on success so the next miss starts fresh
87
+ else
88
+ # Refresh failed (timeout, 5xx, network blip). Fall back to the
89
+ # cached response if we have one, even if it's older than
90
+ # cache_max_age — better to show stale identity than nothing.
91
+ if [ -z "$pc_data" ] && [ -f "$cache_file" ]; then
92
+ pc_data=$(cat "$cache_file" 2>/dev/null)
93
+ fi
82
94
  fi
83
95
  rm -f /tmp/claude/patchcord-sl-resp.json
84
96
  fi