wezard 1.2.7 → 1.2.9
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/cli/wezard.sh +59 -20
- package/dist/daemon/inbound.js +3 -1
- package/dist/daemon/inbound.js.map +1 -1
- package/dist/daemon/index.js +4 -0
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/mirror-bridge.js +91 -35
- package/dist/daemon/mirror-bridge.js.map +1 -1
- package/hooks/pre-tool-use.sh +8 -3
- package/package.json +1 -1
package/hooks/pre-tool-use.sh
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
# Any failure → ask (never break workflow).
|
|
4
4
|
set -uo pipefail
|
|
5
5
|
|
|
6
|
+
# --noproxy '*' on every daemon curl below: the daemon is on 127.0.0.1, but an
|
|
7
|
+
# http_proxy/all_proxy in env makes curl tunnel localhost through the proxy,
|
|
8
|
+
# which answers a down daemon with an empty 200 — a false "up" that makes
|
|
9
|
+
# wait_for_daemon re-post approvals into a dead process. Never proxy loopback.
|
|
10
|
+
NOPROXY=(--noproxy '*')
|
|
6
11
|
DAEMON_URL="${WEZARD_DAEMON_URL:-http://127.0.0.1:17890/approve}"
|
|
7
12
|
# 必须严格大于 daemon 的 approval.longPollSec (默认 43200) 且小于 hooks.json
|
|
8
13
|
# 的 timeout, 否则卡在 WeCom 里挂 >30min 后 curl 先死, 用户的点击写进死 socket。
|
|
@@ -178,7 +183,7 @@ build_body() {
|
|
|
178
183
|
wait_for_exit() {
|
|
179
184
|
local waited=0
|
|
180
185
|
while (( waited < 5 )); do
|
|
181
|
-
curl -sS --max-time 1 "$HEALTH_URL" >/dev/null 2>&1 || return 0
|
|
186
|
+
curl -sS "${NOPROXY[@]}" --max-time 1 "$HEALTH_URL" >/dev/null 2>&1 || return 0
|
|
182
187
|
sleep 1
|
|
183
188
|
waited=$((waited + 1))
|
|
184
189
|
done
|
|
@@ -190,7 +195,7 @@ wait_for_exit() {
|
|
|
190
195
|
wait_for_daemon() {
|
|
191
196
|
local waited=0
|
|
192
197
|
while (( waited < RESUME_WAIT )); do
|
|
193
|
-
if curl -sS --max-time 2 "$HEALTH_URL" >/dev/null 2>&1; then return 0; fi
|
|
198
|
+
if curl -sS "${NOPROXY[@]}" --max-time 2 "$HEALTH_URL" >/dev/null 2>&1; then return 0; fi
|
|
194
199
|
sleep 1
|
|
195
200
|
waited=$((waited + 1))
|
|
196
201
|
done
|
|
@@ -205,7 +210,7 @@ while :; do
|
|
|
205
210
|
REMAIN=$(( HOOK_TIMEOUT - SECONDS ))
|
|
206
211
|
(( REMAIN > 5 )) || bridge_down "hook budget exhausted"
|
|
207
212
|
|
|
208
|
-
RESP=$(curl -sS --max-time "$REMAIN" \
|
|
213
|
+
RESP=$(curl -sS "${NOPROXY[@]}" --max-time "$REMAIN" \
|
|
209
214
|
-H 'Content-Type: application/json' \
|
|
210
215
|
-d "$(build_body)" \
|
|
211
216
|
"$DAEMON_URL" 2>/dev/null) || RESP=""
|