agent-relay-plugin 0.1.6 → 0.2.0
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/.claude-plugin/plugin.json +1 -1
- package/hooks/relay-monitor.sh +16 -1
- package/package.json +1 -1
package/hooks/relay-monitor.sh
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# PPID = Claude Code process, stable across /clear and /compact.
|
|
6
6
|
|
|
7
7
|
RELAY_URL="${AGENT_RELAY_URL:-http://localhost:4850}"
|
|
8
|
+
PLUGIN_VERSION=$(jq -r '.version' "${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json" 2>/dev/null || echo "unknown")
|
|
8
9
|
|
|
9
10
|
# --- Compute agent identity ---
|
|
10
11
|
machine=$(hostname)
|
|
@@ -65,10 +66,19 @@ if [ "$reg_code" != "201" ] && [ "$reg_code" != "200" ]; then
|
|
|
65
66
|
echo "warn: agent-relay register failed (HTTP ${reg_code:-none}) — ${RELAY_URL}" >&2
|
|
66
67
|
fi
|
|
67
68
|
|
|
69
|
+
# --- Check server version ---
|
|
70
|
+
server_version=$(curl -s "${RELAY_URL}/api/stats" 2>/dev/null | jq -r '.version // empty' 2>/dev/null)
|
|
71
|
+
version_warning=""
|
|
72
|
+
if [ -z "$server_version" ]; then
|
|
73
|
+
version_warning="⚠ Server does not report its version — consider updating: bunx agent-relay-server@latest"
|
|
74
|
+
elif [ "$server_version" != "$PLUGIN_VERSION" ]; then
|
|
75
|
+
version_warning="⚠ Version mismatch — server ${server_version}, plugin ${PLUGIN_VERSION}. Update server: bunx agent-relay-server@latest"
|
|
76
|
+
fi
|
|
77
|
+
|
|
68
78
|
# --- Output context (first stdout = notification injected into conversation) ---
|
|
69
79
|
cat <<CONTEXT
|
|
70
80
|
Agent Relay active. Your agent ID: ${agent_id}
|
|
71
|
-
Relay URL: ${RELAY_URL}
|
|
81
|
+
Relay URL: ${RELAY_URL} | Server: ${server_version:-unknown} | Plugin: ${PLUGIN_VERSION}
|
|
72
82
|
|
|
73
83
|
To send a message:
|
|
74
84
|
curl -s -X POST ${RELAY_URL}/api/messages -H 'Content-Type: application/json' -d '{"from":"${agent_id}","to":"TARGET","body":"MESSAGE"}'
|
|
@@ -112,6 +122,11 @@ System messages:
|
|
|
112
122
|
When you see one, follow the instruction immediately — for example, restart the inbox monitor if asked.
|
|
113
123
|
CONTEXT
|
|
114
124
|
|
|
125
|
+
if [ -n "$version_warning" ]; then
|
|
126
|
+
echo ""
|
|
127
|
+
echo "$version_warning"
|
|
128
|
+
fi
|
|
129
|
+
|
|
115
130
|
# --- Check for unread messages ---
|
|
116
131
|
unread=$(curl -s "${RELAY_URL}/api/messages?for=${agent_id}&unread=true" 2>/dev/null)
|
|
117
132
|
unread_count=$(echo "$unread" | jq 'length' 2>/dev/null || echo "0")
|
package/package.json
CHANGED