behavior-wrapped 0.5.12 → 0.5.13
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/dist/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="theme-color" content="#0d0b1b" />
|
|
7
7
|
<meta name="description" content="Your private, local-first Claude Code behavior report." />
|
|
8
8
|
<title>Behavior Wrapped</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-bAPSBZfz.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DYI02P6B.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
|
13
13
|
<div id="root"></div>
|
package/package.json
CHANGED
package/server/leaderboard.mjs
CHANGED
|
@@ -20,6 +20,19 @@ function sessionTurnCounts(value) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function workaroundModelCounts(value, total) {
|
|
24
|
+
if (!Array.isArray(value)) return [];
|
|
25
|
+
const seen = new Set();
|
|
26
|
+
const models = value.slice(0, 20).flatMap((item) => {
|
|
27
|
+
const model = typeof item?.name === "string" ? item.name.normalize("NFKC").trim() : "";
|
|
28
|
+
const count = Number(item?.count);
|
|
29
|
+
if (!model || !/^[\p{L}\p{N} ._+-]{1,80}$/u.test(model) || seen.has(model) || !Number.isInteger(count) || count <= 0 || count > 1_000_000) return [];
|
|
30
|
+
seen.add(model);
|
|
31
|
+
return [{ model, count }];
|
|
32
|
+
});
|
|
33
|
+
return models.reduce((sum, item) => sum + item.count, 0) === total ? models.sort((left, right) => right.count - left.count || left.model.localeCompare(right.model)) : [];
|
|
34
|
+
}
|
|
35
|
+
|
|
23
36
|
export function leaderboardAggregateFromReport(report) {
|
|
24
37
|
const stats = report?.stats || {};
|
|
25
38
|
const agentWords = finiteNonNegative(stats.agentWords);
|
|
@@ -29,6 +42,7 @@ export function leaderboardAggregateFromReport(report) {
|
|
|
29
42
|
: 0;
|
|
30
43
|
const ratio = userWords ? agentWords / userWords : finiteNonNegative(stats.agentUserWordRatio) || fallbackRatio;
|
|
31
44
|
const phrase = report?.phraseCard?.phrase;
|
|
45
|
+
const instrumentalWorkarounds = Math.round(finiteNonNegative(report?.workaroundCard?.count));
|
|
32
46
|
return {
|
|
33
47
|
tokens: Math.round(finiteNonNegative(stats.tokens)),
|
|
34
48
|
agent_words: Math.round(agentWords),
|
|
@@ -36,7 +50,8 @@ export function leaderboardAggregateFromReport(report) {
|
|
|
36
50
|
word_ratio: Number(Math.min(ratio, 10_000).toFixed(2)),
|
|
37
51
|
grateful_messages: Math.round(finiteNonNegative(stats.interactionTone?.gratefulMessages)),
|
|
38
52
|
frustrated_messages: Math.round(finiteNonNegative(stats.interactionTone?.frustratedMessages)),
|
|
39
|
-
instrumental_workarounds:
|
|
53
|
+
instrumental_workarounds: instrumentalWorkarounds,
|
|
54
|
+
instrumental_workarounds_by_model: workaroundModelCounts(report?.workaroundCard?.models, instrumentalWorkarounds),
|
|
40
55
|
favorite_phrase: typeof phrase === "string" && /^[a-z]+(?:'[a-z]+)?(?: [a-z]+(?:'[a-z]+)?){3,9}$/.test(phrase) ? phrase : null,
|
|
41
56
|
phrase_occurrences: Math.round(finiteNonNegative(report?.phraseCard?.occurrences)),
|
|
42
57
|
phrase_sessions: Math.round(finiteNonNegative(report?.phraseCard?.distinctSessions)),
|
|
@@ -69,6 +84,7 @@ export function syntheticLeaderboardSnapshot(aggregate, participation = null) {
|
|
|
69
84
|
value: aggregate.instrumental_workarounds,
|
|
70
85
|
percentile: Math.round(demoWorkarounds.filter((value) => value <= aggregate.instrumental_workarounds).length / demoWorkarounds.length * 100),
|
|
71
86
|
samples: demoWorkarounds.map((value, index) => ({ participant_id: index + 1, value })),
|
|
87
|
+
by_model: aggregate.instrumental_workarounds_by_model || [],
|
|
72
88
|
},
|
|
73
89
|
session_lengths: {
|
|
74
90
|
values: aggregate.session_turn_counts,
|