patchcord 0.5.87 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "patchcord",
3
- "version": "0.5.87",
3
+ "version": "0.5.89",
4
4
  "description": "Cross-machine agent messaging for Claude Code and Codex",
5
5
  "author": "ppravdin",
6
6
  "license": "MIT",
@@ -4,6 +4,8 @@ description: Read Patchcord inbox and reply to messages
4
4
  type: flow
5
5
  ---
6
6
 
7
+ > Use `/flow:patchcord:inbox` to run this. `/skill:` only loads it as docs (Kimi design).
8
+
7
9
  ```mermaid
8
10
  flowchart TD
9
11
  A([BEGIN]) --> B[Call the inbox MCP tool. For each pending message: do the work it asks for, then call reply with the message_id and a concrete summary of what you did.]
@@ -4,6 +4,8 @@ description: Start the Patchcord background polling listener
4
4
  type: flow
5
5
  ---
6
6
 
7
+ > Use `/flow:patchcord:subscribe` to run this. `/skill:` only loads it as docs (Kimi design).
8
+
7
9
  ```mermaid
8
10
  flowchart TD
9
11
  A([BEGIN]) --> B[First, call the inbox MCP tool. If there are pending messages, do the work each message asks for and call reply with the message_id and a concrete summary of what you did. Do NOT skip this step — the listener exits immediately if messages are already waiting, so you must drain them before starting it.]
@@ -4,6 +4,8 @@ description: Wait for one incoming Patchcord message
4
4
  type: flow
5
5
  ---
6
6
 
7
+ > Use `/flow:patchcord:wait` to run this. `/skill:` only loads it as docs (Kimi design).
8
+
7
9
  ```mermaid
8
10
  flowchart TD
9
11
  A([BEGIN]) --> B[Call the wait_for_message MCP tool to block until a message arrives or 5 minutes elapse.]
@@ -24,9 +24,8 @@ if command -v jq >/dev/null 2>&1; then
24
24
  fi
25
25
  fi
26
26
 
27
- # --force tells kimi-subscribe.sh to kill any orphan listener (from a prior
28
- # Kimi session for this same project) before claiming the pidfile. Subscribe
29
- # resolves the project-specific pidfile name from .kimi/mcp.json itself, so
30
- # concurrent sessions for OTHER projects are untouched.
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
- # Pidfile guard.
77
- # --force: kill the existing listener (if any) and take over. Used by SessionStart
78
- # so a fresh Kimi session always gets a fresh listener for this project.
79
- # default: if another instance is alive, exit 0 with a clear message so user-
80
- # invoked flow skill calls are idempotent (no "background task failed").
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
- if [ "$FORCE" = "1" ]; then
85
- kill "$OLD_PID" 2>/dev/null || true
86
- # Wait briefly for the old process to clean up its pidfile
87
- for _ in 1 2 3 4 5; do
88
- kill -0 "$OLD_PID" 2>/dev/null || break
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