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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "agent-relay",
3
3
  "description": "Client connector for Agent Relay — auto-registers Claude Code sessions as agents and enables inter-agent messaging via a lightweight HTTP message bus",
4
- "version": "0.4.29"
4
+ "version": "0.4.32"
5
5
  }
@@ -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
- # PPID = Claude Code process, stable across /clear and /compact.
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' "$PPID" | shasum -a 1 | head -c 6)
38
+ short_pid=$(printf '%s' "$session_key" | shasum -a 1 | head -c 6)
38
39
  else
39
- short_pid=$(printf '%s' "$PPID" | md5sum | head -c 6)
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-${PPID}.state"
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
@@ -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
- instance_state="/tmp/agent-relay-instance-${PPID}.state"
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)
@@ -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
- instance_state="/tmp/agent-relay-instance-${PPID}.state"
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-plugin",
3
- "version": "0.4.29",
3
+ "version": "0.4.32",
4
4
  "description": "Claude Code plugin for Agent Relay — auto-registers sessions as agents and enables inter-agent messaging",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-or-later",