patchcord 0.3.86 → 0.3.87
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/package.json +1 -1
- package/scripts/check-inbox.sh +11 -1
package/package.json
CHANGED
package/scripts/check-inbox.sh
CHANGED
|
@@ -105,10 +105,20 @@ if [ -n "$NAMESPACE" ] && [ -n "$AGENT_ID" ]; then
|
|
|
105
105
|
fi
|
|
106
106
|
fi
|
|
107
107
|
|
|
108
|
-
# ── Inbox notification
|
|
108
|
+
# ── Inbox notification (deduplicated across Stop + Notification hooks) ──
|
|
109
109
|
COUNT=$(echo "$RESPONSE" | jq -r '.count // .pending_count // 0' 2>/dev/null || echo "0")
|
|
110
110
|
|
|
111
111
|
if [ "$COUNT" -gt 0 ]; then
|
|
112
|
+
NOTIFY_LOCK="/tmp/patchcord_notify_lock"
|
|
113
|
+
LOCK_AGE=5
|
|
114
|
+
if [ -f "$NOTIFY_LOCK" ]; then
|
|
115
|
+
LOCK_MTIME=$(stat -c %Y "$NOTIFY_LOCK" 2>/dev/null || stat -f %m "$NOTIFY_LOCK" 2>/dev/null || echo "0")
|
|
116
|
+
NOW=$(date +%s)
|
|
117
|
+
if [ $(( NOW - LOCK_MTIME )) -lt $LOCK_AGE ]; then
|
|
118
|
+
exit 0 # Already notified within 5s
|
|
119
|
+
fi
|
|
120
|
+
fi
|
|
121
|
+
touch "$NOTIFY_LOCK"
|
|
112
122
|
jq -n --arg count "$COUNT" '{
|
|
113
123
|
"decision": "block",
|
|
114
124
|
"reason": ($count + " patchcord message(s) waiting. Call inbox() and reply to all immediately.")
|