agent-relay-plugin 0.4.29 → 0.4.32
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/hooks/relay-monitor.sh
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Agent Relay — self-contained native monitor
|
|
3
3
|
# Registers this session as an agent, outputs messaging context, then polls inbox.
|
|
4
4
|
# Runs automatically via monitors.json — no user interaction required.
|
|
5
|
-
#
|
|
5
|
+
# CLAUDE_CODE_SESSION_ID = stable session key for state file coordination between monitor and hooks.
|
|
6
6
|
|
|
7
7
|
RELAY_URL="${AGENT_RELAY_URL:-http://localhost:4850}"
|
|
8
8
|
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
@@ -33,15 +33,16 @@ else
|
|
|
33
33
|
fi
|
|
34
34
|
ar_init_profile "claude" "$rig" "$project"
|
|
35
35
|
|
|
36
|
+
session_key="${CLAUDE_CODE_SESSION_ID:-$PPID}"
|
|
36
37
|
if command -v shasum >/dev/null 2>&1; then
|
|
37
|
-
short_pid=$(printf '%s' "$
|
|
38
|
+
short_pid=$(printf '%s' "$session_key" | shasum -a 1 | head -c 6)
|
|
38
39
|
else
|
|
39
|
-
short_pid=$(printf '%s' "$
|
|
40
|
+
short_pid=$(printf '%s' "$session_key" | md5sum | head -c 6)
|
|
40
41
|
fi
|
|
41
42
|
agent_id="${machine}-${rig}-${project}-${short_pid}"
|
|
42
43
|
|
|
43
44
|
# --- Clean up previous agent from this instance ---
|
|
44
|
-
instance_state="/tmp/agent-relay-instance-${
|
|
45
|
+
instance_state="/tmp/agent-relay-instance-${session_key}.state"
|
|
45
46
|
if [ -f "$instance_state" ]; then
|
|
46
47
|
old_agent_id=$(head -1 "$instance_state" 2>/dev/null)
|
|
47
48
|
if [ -n "$old_agent_id" ] && [ "$old_agent_id" != "$agent_id" ]; then
|
package/hooks/session-end.sh
CHANGED
|
@@ -7,7 +7,8 @@ auth_header_args=()
|
|
|
7
7
|
if [ -n "${AGENT_RELAY_TOKEN:-}" ]; then
|
|
8
8
|
auth_header_args=(-H "X-Agent-Relay-Token: ${AGENT_RELAY_TOKEN}")
|
|
9
9
|
fi
|
|
10
|
-
|
|
10
|
+
session_key="${CLAUDE_CODE_SESSION_ID:-$PPID}"
|
|
11
|
+
instance_state="/tmp/agent-relay-instance-${session_key}.state"
|
|
11
12
|
|
|
12
13
|
if [ -f "$instance_state" ]; then
|
|
13
14
|
agent_id=$(head -1 "$instance_state" 2>/dev/null)
|
package/hooks/set-status.sh
CHANGED
|
@@ -13,7 +13,8 @@ auth_header_args=()
|
|
|
13
13
|
if [ -n "${AGENT_RELAY_TOKEN:-}" ]; then
|
|
14
14
|
auth_header_args=(-H "X-Agent-Relay-Token: ${AGENT_RELAY_TOKEN}")
|
|
15
15
|
fi
|
|
16
|
-
|
|
16
|
+
session_key="${CLAUDE_CODE_SESSION_ID:-$PPID}"
|
|
17
|
+
instance_state="/tmp/agent-relay-instance-${session_key}.state"
|
|
17
18
|
|
|
18
19
|
if [ ! -f "$instance_state" ]; then
|
|
19
20
|
exit 0
|
package/package.json
CHANGED