patchcord 0.5.7 → 0.5.8
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
package/scripts/check-inbox.sh
CHANGED
|
@@ -55,9 +55,11 @@ fi
|
|
|
55
55
|
|
|
56
56
|
# Check inbox — one lightweight HTTP call
|
|
57
57
|
MACHINE_NAME=$(hostname -s 2>/dev/null || echo "unknown")
|
|
58
|
+
INSTALL_PATH=$(dirname "$MCP_JSON")
|
|
58
59
|
HTTP_CODE=$(curl -s -o /tmp/patchcord_inbox.json -w "%{http_code}" --max-time 5 \
|
|
59
60
|
-H "Authorization: Bearer ${TOKEN}" \
|
|
60
61
|
-H "x-patchcord-machine: ${MACHINE_NAME}" \
|
|
62
|
+
-H "x-patchcord-install-path: ${INSTALL_PATH}" \
|
|
61
63
|
"${URL}/api/inbox?status=pending&limit=5&count_only=1" 2>/dev/null || echo "000")
|
|
62
64
|
|
|
63
65
|
if [ "$HTTP_CODE" = "401" ] || [ "$HTTP_CODE" = "403" ]; then
|
package/scripts/statusline.sh
CHANGED
|
@@ -74,8 +74,10 @@ if [ -n "$pc_url" ] && [ -n "$pc_token" ]; then
|
|
|
74
74
|
fi
|
|
75
75
|
|
|
76
76
|
if $needs_refresh; then
|
|
77
|
+
install_path=$(dirname "$mcp_json")
|
|
77
78
|
http_code=$(curl -s -o /tmp/claude/patchcord-sl-resp.json -w "%{http_code}" --max-time 5 \
|
|
78
79
|
-H "Authorization: Bearer $pc_token" \
|
|
80
|
+
-H "x-patchcord-install-path: ${install_path}" \
|
|
79
81
|
"${pc_url}/api/inbox?status=pending&limit=50" 2>/dev/null || echo "000")
|
|
80
82
|
if [ "$http_code" = "401" ] || [ "$http_code" = "403" ]; then
|
|
81
83
|
pc_data='{"_auth_error":true}'
|
package/scripts/subscribe.mjs
CHANGED
|
@@ -81,7 +81,10 @@ function httpJson(urlStr, { method = "GET", headers = {}, body = null } = {}) {
|
|
|
81
81
|
|
|
82
82
|
async function fetchTicket(baseUrl, token) {
|
|
83
83
|
const res = await httpJson(`${baseUrl}/api/realtime/ticket`, {
|
|
84
|
-
headers: {
|
|
84
|
+
headers: {
|
|
85
|
+
Authorization: `Bearer ${token}`,
|
|
86
|
+
"x-patchcord-install-path": process.cwd(),
|
|
87
|
+
},
|
|
85
88
|
});
|
|
86
89
|
if (res.status === 401 || res.status === 403) {
|
|
87
90
|
die(`ticket: token rejected (HTTP ${res.status}) — check .mcp.json`);
|
|
@@ -109,7 +112,10 @@ async function fetchTicket(baseUrl, token) {
|
|
|
109
112
|
// Monitor wakes the agent the same way a real arrival does.
|
|
110
113
|
async function drainQueueOnce(baseUrl, token) {
|
|
111
114
|
const res = await httpJson(`${baseUrl}/api/inbox?count_only=1&limit=100`, {
|
|
112
|
-
headers: {
|
|
115
|
+
headers: {
|
|
116
|
+
Authorization: `Bearer ${token}`,
|
|
117
|
+
"x-patchcord-install-path": process.cwd(),
|
|
118
|
+
},
|
|
113
119
|
});
|
|
114
120
|
if (res.status !== 200) {
|
|
115
121
|
throw new Error(`inbox HTTP ${res.status}`);
|