phewsh 0.6.0 → 0.6.1
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/lib/supabase.js +5 -1
- package/package.json +1 -1
package/lib/supabase.js
CHANGED
|
@@ -78,6 +78,10 @@ async function upsert(table, data, accessToken) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// SAP: fire-and-forget per-inference tracking
|
|
81
|
+
// Session ID — unique per CLI invocation, enables multi-prompt correlation
|
|
82
|
+
const { randomUUID } = require('crypto');
|
|
83
|
+
const CLI_SESSION_ID = randomUUID();
|
|
84
|
+
|
|
81
85
|
// kWh estimates by model family (conservative)
|
|
82
86
|
const MODEL_KWH = {
|
|
83
87
|
'claude-haiku': 0.00025,
|
|
@@ -110,7 +114,7 @@ function trackSap({ userId, source = 'cli', model, promptTokens, completionToken
|
|
|
110
114
|
method: 'POST',
|
|
111
115
|
body: JSON.stringify({
|
|
112
116
|
p_user_id: userId || null,
|
|
113
|
-
p_session_id:
|
|
117
|
+
p_session_id: CLI_SESSION_ID,
|
|
114
118
|
p_source: source,
|
|
115
119
|
p_model: model || null,
|
|
116
120
|
p_prompt_tokens: promptTokens || null,
|