@rulemetric/hooks 0.7.5 → 0.7.6
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 +1 -1
- package/scripts/session-start.sh +9 -2
package/package.json
CHANGED
package/scripts/session-start.sh
CHANGED
|
@@ -168,12 +168,19 @@ _rulemetric_suggest_instructions() {
|
|
|
168
168
|
else
|
|
169
169
|
event_type="surfaced"
|
|
170
170
|
fi
|
|
171
|
+
# Include the harness session id (HOOK_SESSION_ID — the external Claude Code /
|
|
172
|
+
# Cursor / … session id, UUID-validated by _normalize.sh). The DB session row
|
|
173
|
+
# usually doesn't exist yet at session-start (the proxy creates it from the
|
|
174
|
+
# first wire traffic), so the API can't resolve it here — instead it stores
|
|
175
|
+
# this external id and reconciles it to a treatment_exposures row at session
|
|
176
|
+
# close (reimport matches sessions.external_session_id). Without this, every
|
|
177
|
+
# surfaced event has session_id=NULL and suggestions can never be measured.
|
|
171
178
|
curl -s --noproxy '*' --max-time 3 -X POST \
|
|
172
179
|
"${api_url}/api/instruction-suggestions/${sid}/events" \
|
|
173
180
|
-H "Authorization: Bearer ${auth_token}" \
|
|
174
181
|
-H "Content-Type: application/json" \
|
|
175
|
-
-d "$(jq -n --arg eventType "$event_type" --arg tool "$tool" --arg projectPath "$project_path" \
|
|
176
|
-
'{eventType: $eventType, tool: $tool, projectPath: $projectPath}')" \
|
|
182
|
+
-d "$(jq -n --arg eventType "$event_type" --arg tool "$tool" --arg projectPath "$project_path" --arg sessionId "$HOOK_SESSION_ID" \
|
|
183
|
+
'{eventType: $eventType, tool: $tool, projectPath: $projectPath, sessionId: $sessionId}')" \
|
|
177
184
|
>/dev/null 2>&1 &
|
|
178
185
|
disown 2>/dev/null || true
|
|
179
186
|
i=$((i + 1))
|