@rulemetric/hooks 0.7.35 → 0.7.37
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
|
@@ -132,4 +132,4 @@ _rulemetric_log "assistant-response" "success"
|
|
|
132
132
|
source "$SCRIPT_DIR/_post.sh"
|
|
133
133
|
_rulemetric_post_event \
|
|
134
134
|
"${RULEMETRIC_API_URL}/api/sessions/${RW_SESSION_ID}/events" \
|
|
135
|
-
"$AUTH_HEADER" "$PAYLOAD" "assistant-response" "$SEQ" &
|
|
135
|
+
"$AUTH_HEADER" "$PAYLOAD" "assistant-response" "$SEQ" > /dev/null 2>&1 &
|
package/scripts/post-tool-use.sh
CHANGED
|
@@ -92,4 +92,4 @@ _rulemetric_log "post-tool-use" "success"
|
|
|
92
92
|
source "$SCRIPT_DIR/_post.sh"
|
|
93
93
|
_rulemetric_post_event \
|
|
94
94
|
"${RULEMETRIC_API_URL}/api/sessions/${RW_SESSION_ID}/events" \
|
|
95
|
-
"$AUTH_HEADER" "$PAYLOAD" "post-tool-use" "$SEQ" &
|
|
95
|
+
"$AUTH_HEADER" "$PAYLOAD" "post-tool-use" "$SEQ" > /dev/null 2>&1 &
|
package/scripts/session-start.sh
CHANGED
|
@@ -87,7 +87,12 @@ if ! proxy_alive; then
|
|
|
87
87
|
# Proxy is not running — try to restart it
|
|
88
88
|
rm -f "$PROXY_PID_FILE" 2>/dev/null
|
|
89
89
|
if command -v rulemetric >/dev/null 2>&1; then
|
|
90
|
-
|
|
90
|
+
# stdout MUST be redirected: the proxy is a long-running daemon, and a
|
|
91
|
+
# backgrounded child inherits this hook's stdout pipe. Claude Code reads
|
|
92
|
+
# hook stdout until EOF, so an inherited write end held open by the daemon
|
|
93
|
+
# stalls the hook for its full timeout (observed in the field as ~15-minute
|
|
94
|
+
# session-start hangs, 2026-08-02). `disown` does not close fds.
|
|
95
|
+
rulemetric proxy start --port 8788 --skip-checks > /dev/null 2>&1 &
|
|
91
96
|
disown 2>/dev/null || true
|
|
92
97
|
fi
|
|
93
98
|
fi
|
|
@@ -131,25 +136,34 @@ _rulemetric_suggest_instructions() {
|
|
|
131
136
|
printf '\n---\n'
|
|
132
137
|
if [ "$high_count" != "0" ] && [ -n "$high_count" ]; then
|
|
133
138
|
printf '[rulemetric] %s high-confidence instruction(s) included below as session context.\n' "$high_count"
|
|
134
|
-
printf 'Accept any of them permanently with
|
|
139
|
+
printf 'Accept any of them permanently with the command shown under each one.\n'
|
|
135
140
|
else
|
|
136
141
|
printf '[rulemetric] %s instruction(s) may help with this project:\n' "$count"
|
|
137
142
|
fi
|
|
138
143
|
|
|
139
144
|
local i=0
|
|
140
145
|
while [ "$i" -lt "$count" ]; do
|
|
141
|
-
local name reason score scope content
|
|
146
|
+
local name reason score scope content sid
|
|
142
147
|
name="$(printf '%s' "$response" | jq -r ".suggestions[$i].name" 2>/dev/null)" || break
|
|
143
148
|
reason="$(printf '%s' "$response" | jq -r ".suggestions[$i].reason" 2>/dev/null)" || break
|
|
144
149
|
score="$(printf '%s' "$response" | jq -r ".suggestions[$i].score" 2>/dev/null)" || break
|
|
145
150
|
scope="$(printf '%s' "$response" | jq -r ".suggestions[$i].instructionScope" 2>/dev/null)" || break
|
|
146
151
|
content="$(printf '%s' "$response" | jq -r ".suggestions[$i].content // empty" 2>/dev/null)" || content=""
|
|
152
|
+
sid="$(printf '%s' "$response" | jq -r ".suggestions[$i].id" 2>/dev/null)" || break
|
|
147
153
|
|
|
148
154
|
if [ -n "$content" ]; then
|
|
149
155
|
printf '\n## Skill: %s (%s, score: %s)\n%s\n\n%s\n' "$name" "$scope" "$score" "$reason" "$content"
|
|
150
156
|
else
|
|
151
157
|
printf ' * [%s] %s (score: %s)\n %s\n' "$scope" "$name" "$score" "$reason"
|
|
152
158
|
fi
|
|
159
|
+
# Phase 0.1: render the REAL id, per row. This line used to be a single
|
|
160
|
+
# shared CTA reading `accept <id>` — an unsubstituted placeholder, so no
|
|
161
|
+
# reader (human or model) could act without going to look an id up. With
|
|
162
|
+
# several suggestions on screen one shared CTA is ambiguous even once it
|
|
163
|
+
# carries an id, so the command belongs to the row it accepts.
|
|
164
|
+
if [ -n "$sid" ] && [ "$sid" != "null" ]; then
|
|
165
|
+
printf ' Accept: rulemetric suggestions accept %s\n' "$sid"
|
|
166
|
+
fi
|
|
153
167
|
i=$((i + 1))
|
|
154
168
|
done
|
|
155
169
|
|
package/scripts/user-prompt.sh
CHANGED
|
@@ -70,7 +70,7 @@ PAYLOAD="{\"sequence\":$SEQ,\"eventType\":\"user_message\",\"content\":$(printf
|
|
|
70
70
|
source "$SCRIPT_DIR/_post.sh"
|
|
71
71
|
_rulemetric_post_event \
|
|
72
72
|
"${RULEMETRIC_API_URL}/api/sessions/${RW_SESSION_ID}/events" \
|
|
73
|
-
"$AUTH_HEADER" "$PAYLOAD" "user-prompt" "$SEQ" &
|
|
73
|
+
"$AUTH_HEADER" "$PAYLOAD" "user-prompt" "$SEQ" > /dev/null 2>&1 &
|
|
74
74
|
|
|
75
75
|
_rulemetric_log "user-prompt" "success"
|
|
76
76
|
|