agent-coord-mcp 0.26.25 → 0.26.26

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,94 +0,0 @@
1
- #!/usr/bin/env bash
2
- # spawn-agent.sh — start a CLI agent in a dedicated tmux session and wire
3
- # coord-inbox auto-delivery to its pane via hooks/tmux-pusher.mjs.
4
- #
5
- # Works with any line-driven CLI agent (Claude Code, Aider, codex, gemini-cli,
6
- # opencode, ...). The pusher just types into the pane; it doesn't care what's
7
- # on the receiving end.
8
- #
9
- # Usage:
10
- # scripts/spawn-agent.sh --id frontend --cmd "claude"
11
- # scripts/spawn-agent.sh --id backend --cmd "aider --model sonnet" --include-room
12
- # scripts/spawn-agent.sh --id worker --cmd "codex" --allowlist frontend,backend
13
- #
14
- # Flags:
15
- # --id <agentId> coord agentId, also names the tmux session (coord-<id>)
16
- # --cmd "<command>" agent CLI to run in pane 0 (quote it)
17
- # --no-include-room skip shared-room delivery (DMs only). Room is on by default.
18
- # --include-room deprecated no-op, kept for back-compat (room is on by default)
19
- # --allowlist a,b,c only deliver DMs from these peer agentIds
20
- # --dir <path> override AGENT_COORD_DIR
21
- #
22
- # After spawn, attach with: tmux attach -t coord-<id>
23
- # Stop with: scripts/stop-agent.sh --id <id>
24
-
25
- set -euo pipefail
26
-
27
- ID=""
28
- CMD=""
29
- # Room delivery is on by default; pass --no-include-room to opt out.
30
- INCLUDE_ROOM="1"
31
- ALLOWLIST=""
32
- COORD_DIR=""
33
-
34
- while [[ $# -gt 0 ]]; do
35
- case "$1" in
36
- --id) ID="$2"; shift 2 ;;
37
- --cmd) CMD="$2"; shift 2 ;;
38
- --include-room) INCLUDE_ROOM="1"; shift ;; # kept for back-compat
39
- --no-include-room) INCLUDE_ROOM=""; shift ;;
40
- --allowlist) ALLOWLIST="$2"; shift 2 ;;
41
- --dir) COORD_DIR="$2"; shift 2 ;;
42
- -h|--help)
43
- sed -n '2,22p' "$0"; exit 0 ;;
44
- *) echo "unknown arg: $1" >&2; exit 2 ;;
45
- esac
46
- done
47
-
48
- [[ -z "$ID" ]] && { echo "--id required" >&2; exit 2; }
49
- [[ -z "$CMD" ]] && { echo "--cmd required (e.g. 'claude')" >&2; exit 2; }
50
-
51
- command -v tmux >/dev/null || { echo "tmux not installed" >&2; exit 1; }
52
- command -v node >/dev/null || { echo "node not installed" >&2; exit 1; }
53
-
54
- SESSION="coord-$ID"
55
- ROOT="${COORD_DIR:-${AGENT_COORD_DIR:-$HOME/agent-coord}}"
56
- LOGDIR="$ROOT/logs"
57
- PIDDIR="$ROOT/pids"
58
- mkdir -p "$LOGDIR" "$PIDDIR"
59
-
60
- REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
61
- PUSHER="$REPO_DIR/hooks/tmux-pusher.mjs"
62
- [[ -f "$PUSHER" ]] || { echo "missing $PUSHER" >&2; exit 1; }
63
-
64
- if tmux has-session -t "$SESSION" 2>/dev/null; then
65
- echo "tmux session '$SESSION' already exists — attach with: tmux attach -t $SESSION" >&2
66
- exit 1
67
- fi
68
-
69
- PID_FILE="$PIDDIR/pusher-$ID.pid"
70
- if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
71
- echo "pusher already running for '$ID' (pid $(cat "$PID_FILE"))" >&2
72
- exit 1
73
- fi
74
-
75
- tmux new-session -d -s "$SESSION" -n agent "$CMD"
76
-
77
- # Resolve the actual pane id — globally unique, immune to base-index settings.
78
- TARGET="$(tmux display-message -p -t "$SESSION:agent" '#{pane_id}')"
79
- [[ -n "$TARGET" ]] || { echo "failed to resolve tmux pane id" >&2; exit 1; }
80
-
81
- (
82
- export AGENT_COORD_ID="$ID"
83
- export AGENT_COORD_TMUX_TARGET="$TARGET"
84
- [[ -n "$COORD_DIR" ]] && export AGENT_COORD_DIR="$COORD_DIR"
85
- [[ -n "$INCLUDE_ROOM" ]] && export AGENT_COORD_INCLUDE_ROOM=1
86
- [[ -n "$ALLOWLIST" ]] && export AGENT_COORD_ALLOWLIST="$ALLOWLIST"
87
- nohup node "$PUSHER" >> "$LOGDIR/pusher-$ID.log" 2>&1 &
88
- echo $! > "$PID_FILE"
89
- )
90
-
91
- echo "agent '$ID' started"
92
- echo " attach: tmux attach -t $SESSION"
93
- echo " pusher: pid $(cat "$PID_FILE") log: $LOGDIR/pusher-$ID.log"
94
- echo " stop: scripts/stop-agent.sh --id $ID"