patchcord 0.5.88 → 0.5.89
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/package.json
CHANGED
|
@@ -24,9 +24,8 @@ if command -v jq >/dev/null 2>&1; then
|
|
|
24
24
|
fi
|
|
25
25
|
fi
|
|
26
26
|
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
nohup bash "$KIMI_SUB" --force 5 >/dev/null 2>&1 &
|
|
27
|
+
# kimi-subscribe.sh always replaces any existing listener for this project,
|
|
28
|
+
# so SessionStart starts a fresh listener even if a previous Kimi session
|
|
29
|
+
# left one running.
|
|
30
|
+
nohup bash "$KIMI_SUB" 5 >/dev/null 2>&1 &
|
|
32
31
|
exit 0
|
|
@@ -14,19 +14,6 @@ set -euo pipefail
|
|
|
14
14
|
|
|
15
15
|
command -v jq >/dev/null 2>&1 || { echo "jq required" >&2; exit 1; }
|
|
16
16
|
|
|
17
|
-
# Parse --force flag (kills any existing listener for THIS project first).
|
|
18
|
-
# SessionStart hook passes --force so fresh sessions always get a fresh listener.
|
|
19
|
-
FORCE=0
|
|
20
|
-
ARGS=()
|
|
21
|
-
for arg in "$@"; do
|
|
22
|
-
if [ "$arg" = "--force" ]; then
|
|
23
|
-
FORCE=1
|
|
24
|
-
else
|
|
25
|
-
ARGS+=("$arg")
|
|
26
|
-
fi
|
|
27
|
-
done
|
|
28
|
-
set -- "${ARGS[@]+"${ARGS[@]}"}"
|
|
29
|
-
|
|
30
17
|
# Resolve MCP config: per-project first, then global
|
|
31
18
|
KIMI_MCP=""
|
|
32
19
|
dir="$PWD"
|
|
@@ -73,29 +60,21 @@ fi
|
|
|
73
60
|
PIDFILE="/tmp/patchcord_subscribe_${NAMESPACE_ID}_${AGENT_ID}.pid"
|
|
74
61
|
NOTIFY_FILE="${HOME}/.kimi/patchcord-subscribe-notify.txt"
|
|
75
62
|
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
63
|
+
# Always replace any existing listener for this project. Otherwise the agent
|
|
64
|
+
# sees an instant exit ("already running") and narrates it as "listener failed
|
|
65
|
+
# to start" / "exited cleanly because no messages" — confusing UX. By killing
|
|
66
|
+
# the old one, the new task stays in "running" state in Kimi's task browser,
|
|
67
|
+
# which is what the user expects when they invoke /flow:patchcord:subscribe.
|
|
81
68
|
if [ -f "$PIDFILE" ]; then
|
|
82
69
|
OLD_PID=$(cat "$PIDFILE" 2>/dev/null || echo "")
|
|
83
70
|
if [ -n "$OLD_PID" ] && kill -0 "$OLD_PID" 2>/dev/null; then
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
sleep 0.2
|
|
90
|
-
done
|
|
91
|
-
rm -f "$PIDFILE" 2>/dev/null || true
|
|
92
|
-
else
|
|
93
|
-
echo "Patchcord listener active."
|
|
94
|
-
exit 0
|
|
95
|
-
fi
|
|
96
|
-
else
|
|
97
|
-
rm -f "$PIDFILE" 2>/dev/null || true
|
|
71
|
+
kill "$OLD_PID" 2>/dev/null || true
|
|
72
|
+
for _ in 1 2 3 4 5; do
|
|
73
|
+
kill -0 "$OLD_PID" 2>/dev/null || break
|
|
74
|
+
sleep 0.2
|
|
75
|
+
done
|
|
98
76
|
fi
|
|
77
|
+
rm -f "$PIDFILE" 2>/dev/null || true
|
|
99
78
|
fi
|
|
100
79
|
echo $$ > "$PIDFILE"
|
|
101
80
|
|