agent-relay-plugin 0.4.34 → 0.4.35

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.34"
4
+ "version": "0.4.35"
5
5
  }
@@ -56,11 +56,12 @@ current_status() {
56
56
  deliver_message() {
57
57
  local line="$1"
58
58
  if [ "${AGENT_RELAY_CLAUDE_DELIVERY:-monitor}" = "tmux" ] && [ -n "${AGENT_RELAY_CLAUDE_TMUX_SESSION:-}" ] && command -v tmux >/dev/null 2>&1; then
59
- if tmux set-buffer "$line" 2>/dev/null &&
60
- tmux paste-buffer -t "$AGENT_RELAY_CLAUDE_TMUX_SESSION" 2>/dev/null &&
59
+ if tmux send-keys -t "$AGENT_RELAY_CLAUDE_TMUX_SESSION" -l "$line" 2>/dev/null &&
61
60
  tmux send-keys -t "$AGENT_RELAY_CLAUDE_TMUX_SESSION" C-m 2>/dev/null; then
62
61
  return 0
63
62
  fi
63
+ echo "warn: tmux delivery failed for ${AGENT_RELAY_CLAUDE_TMUX_SESSION}" >&2
64
+ return 1
64
65
  fi
65
66
 
66
67
  printf '%s\n' "$line"
@@ -175,7 +176,8 @@ while true; do
175
176
 
176
177
  count=$(echo "$msgs" | jq 'length' 2>/dev/null || echo 0)
177
178
  if [ "$count" -gt 0 ] 2>/dev/null && [ "$count" != "0" ]; then
178
- echo "$msgs" | jq -c '.[]' | while IFS= read -r msg; do
179
+ delivery_failed=false
180
+ while IFS= read -r msg; do
179
181
  mid=$(printf '%s' "$msg" | jq -r '.id')
180
182
  claimable=$(printf '%s' "$msg" | jq -r '.claimable // false')
181
183
  if [ "$(ar_message_matches_channels "$msg")" != "true" ]; then
@@ -192,11 +194,20 @@ while true; do
192
194
  fi
193
195
  fi
194
196
 
195
- line=$(printf '%s' "$msg" | jq -r '(.meta.pairId // empty) as $pair | (if $pair != "" then " [pair:\($pair)]" else "" end) as $pairText | (.body | gsub("\r"; "\\r") | gsub("\n"; "\\n")) as $body | if .type == "system" then "⚠ SYSTEM [msg:\(.id)]\($pairText): \($body)" else "[msg:\(.id)]\($pairText) \(.from) → \(.to) | \(.subject // "(no subject)"): \($body)" end')
196
- deliver_message "$line"
197
- mark_read_or_queue "$mid"
198
- done
199
- since_id=$(echo "$msgs" | jq '[.[].id] | max')
197
+ if ! line=$(printf '%s' "$msg" | jq -r '(.meta.pairId // "") as $pair | (if $pair != "" then " [pair:\($pair)]" else "" end) as $pairText | (.body | gsub("\r"; "\\r") | gsub("\n"; "\\n")) as $body | if .type == "system" then "⚠ SYSTEM [msg:\(.id)]\($pairText): \($body)" else "[msg:\(.id)]\($pairText) \(.from) → \(.to) | \(.subject // "(no subject)"): \($body)" end') || [ -z "$line" ]; then
198
+ echo "warn: failed to format relay message ${mid}" >&2
199
+ delivery_failed=true
200
+ continue
201
+ fi
202
+ if deliver_message "$line"; then
203
+ mark_read_or_queue "$mid"
204
+ else
205
+ delivery_failed=true
206
+ fi
207
+ done < <(echo "$msgs" | jq -c '.[]')
208
+ if [ "$delivery_failed" = "false" ]; then
209
+ since_id=$(echo "$msgs" | jq '[.[].id] | max')
210
+ fi
200
211
  fi
201
212
 
202
213
  sleep "$INTERVAL"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-plugin",
3
- "version": "0.4.34",
3
+ "version": "0.4.35",
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",