agent-relay-plugin 0.3.7 → 0.3.9
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/hooks.json +24 -0
- package/hooks/relay-monitor.sh +2 -0
- package/hooks/set-status.sh +28 -0
- package/package.json +1 -1
package/hooks/hooks.json
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"hooks": {
|
|
3
|
+
"UserPromptSubmit": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/set-status.sh\" busy",
|
|
9
|
+
"async": true,
|
|
10
|
+
"timeout": 5
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"Stop": [
|
|
16
|
+
{
|
|
17
|
+
"hooks": [
|
|
18
|
+
{
|
|
19
|
+
"type": "command",
|
|
20
|
+
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/set-status.sh\" idle",
|
|
21
|
+
"async": true,
|
|
22
|
+
"timeout": 5
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
],
|
|
3
27
|
"SessionEnd": [
|
|
4
28
|
{
|
|
5
29
|
"hooks": [
|
package/hooks/relay-monitor.sh
CHANGED
|
@@ -94,6 +94,8 @@ To reply to a message (threading):
|
|
|
94
94
|
curl -s -X POST ${RELAY_URL}/api/messages -H 'Content-Type: application/json' -d '{"from":"${agent_id}","to":"TARGET","body":"MESSAGE","replyTo":MSG_ID}'
|
|
95
95
|
Always use replyTo when responding to a specific message — it creates a thread.
|
|
96
96
|
The inbox monitor prefixes each message with [msg:ID] — parse the ID from there.
|
|
97
|
+
Message etiquette: when another agent messages you, send a short acknowledgement or status reply unless the message is obvious spam/noise.
|
|
98
|
+
Anti-loop rule: do not auto-reply to pure acknowledgements, "thanks", or "received" messages; acknowledge once, then only send follow-ups when there is new work, a decision, or a deliverable.
|
|
97
99
|
|
|
98
100
|
To send a claimable task (only one agent can claim it):
|
|
99
101
|
curl -s -X POST ${RELAY_URL}/api/messages -H 'Content-Type: application/json' -d '{"from":"${agent_id}","to":"cap:review","body":"TASK","claimable":true}'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Agent Relay plugin — status update helper for Claude turn hooks.
|
|
3
|
+
# Usage: set-status.sh <online|idle|busy|offline>
|
|
4
|
+
|
|
5
|
+
status="${1:-}"
|
|
6
|
+
case "$status" in
|
|
7
|
+
online|idle|busy|offline) ;;
|
|
8
|
+
*) exit 0 ;;
|
|
9
|
+
esac
|
|
10
|
+
|
|
11
|
+
RELAY_URL="${AGENT_RELAY_URL:-http://localhost:4850}"
|
|
12
|
+
instance_state="/tmp/agent-relay-instance-${PPID}.state"
|
|
13
|
+
|
|
14
|
+
if [ ! -f "$instance_state" ]; then
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
agent_id=$(head -1 "$instance_state" 2>/dev/null || true)
|
|
19
|
+
if [ -z "$agent_id" ]; then
|
|
20
|
+
exit 0
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
curl -s -o /dev/null -X PATCH "${RELAY_URL}/api/agents/${agent_id}/status" \
|
|
24
|
+
-H 'Content-Type: application/json' \
|
|
25
|
+
-d "{\"status\":\"${status}\"}" \
|
|
26
|
+
2>/dev/null || true
|
|
27
|
+
|
|
28
|
+
exit 0
|
package/package.json
CHANGED