agentlytics 0.0.5 → 0.0.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/share-image.js +34 -38
package/package.json
CHANGED
package/share-image.js
CHANGED
|
@@ -55,9 +55,9 @@ function generateShareSvg(overview, stats) {
|
|
|
55
55
|
const label = (EDITOR_LABELS[e.id] || e.id).padEnd(12);
|
|
56
56
|
const y = 170 + i * 22;
|
|
57
57
|
return `
|
|
58
|
-
<text x="30" y="${y + 12}" fill="#
|
|
59
|
-
<rect x="140" y="${y + 1}" width="${barW}" height="14"
|
|
60
|
-
<text x="${146 + barW}" y="${y + 12}" fill="#
|
|
58
|
+
<text x="30" y="${y + 12}" fill="#888" font-size="10" font-family="${F}">${esc(label)}</text>
|
|
59
|
+
<rect x="140" y="${y + 1}" width="${barW}" height="14" fill="${color}" opacity="0.8"/>
|
|
60
|
+
<text x="${146 + barW}" y="${y + 12}" fill="#aaa" font-size="9" font-family="${F}">${e.count}</text>
|
|
61
61
|
`;
|
|
62
62
|
}).join('');
|
|
63
63
|
|
|
@@ -75,70 +75,66 @@ function generateShareSvg(overview, stats) {
|
|
|
75
75
|
const modelsList = topModels.map((m, i) => {
|
|
76
76
|
const y = 274 + i * 16;
|
|
77
77
|
const name = m.name.length > 24 ? m.name.substring(0, 24) : m.name;
|
|
78
|
-
return `<text x="590" y="${y}" fill="#
|
|
78
|
+
return `<text x="590" y="${y}" fill="#888" font-size="9" font-family="${F}">${esc(name)} <tspan fill="#555">${m.count}</tspan></text>`;
|
|
79
79
|
}).join('');
|
|
80
80
|
|
|
81
81
|
const dateStr = new Date().toISOString().split('T')[0];
|
|
82
82
|
|
|
83
83
|
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}">
|
|
84
84
|
<!-- Background -->
|
|
85
|
-
<rect width="${W}" height="${H}"
|
|
86
|
-
<rect x="0.5" y="0.5" width="${W - 1}" height="${H - 1}"
|
|
85
|
+
<rect width="${W}" height="${H}" fill="#000"/>
|
|
86
|
+
<rect x="0.5" y="0.5" width="${W - 1}" height="${H - 1}" fill="none" stroke="#222" stroke-width="1"/>
|
|
87
87
|
|
|
88
88
|
<!-- Terminal title bar -->
|
|
89
|
-
<rect x="0" y="0" width="${W}" height="32"
|
|
90
|
-
<
|
|
91
|
-
<circle cx="18" cy="16" r="5" fill="#dc322f" opacity="0.8"/>
|
|
92
|
-
<circle cx="36" cy="16" r="5" fill="#b58900" opacity="0.8"/>
|
|
93
|
-
<circle cx="54" cy="16" r="5" fill="#859900" opacity="0.8"/>
|
|
94
|
-
<text x="${W / 2}" y="20" fill="#586e75" font-size="11" font-family="${F}" text-anchor="middle">agentlytics</text>
|
|
89
|
+
<rect x="0" y="0" width="${W}" height="32" fill="#111"/>
|
|
90
|
+
<text x="${W / 2}" y="20" fill="#555" font-size="11" font-family="${F}" text-anchor="middle">agentlytics</text>
|
|
95
91
|
|
|
96
92
|
<!-- Prompt line -->
|
|
97
|
-
<text x="24" y="58" fill="#
|
|
98
|
-
<text x="40" y="58" fill="#
|
|
93
|
+
<text x="24" y="58" fill="#666" font-size="12" font-family="${F}">$</text>
|
|
94
|
+
<text x="40" y="58" fill="#ccc" font-size="12" font-family="${F}">npx agentlytics</text>
|
|
99
95
|
|
|
100
96
|
<!-- Divider -->
|
|
101
|
-
<line x1="24" y1="68" x2="${W - 24}" y2="68" stroke="#
|
|
97
|
+
<line x1="24" y1="68" x2="${W - 24}" y2="68" stroke="#222" stroke-width="1"/>
|
|
102
98
|
|
|
103
99
|
<!-- KPI row -->
|
|
104
|
-
<rect x="24" y="78" width="175" height="58"
|
|
105
|
-
<text x="36" y="96" fill="#
|
|
106
|
-
<text x="36" y="122" fill="#
|
|
100
|
+
<rect x="24" y="78" width="175" height="58" fill="#111"/>
|
|
101
|
+
<text x="36" y="96" fill="#666" font-size="9" font-family="${F}">sessions</text>
|
|
102
|
+
<text x="36" y="122" fill="#fff" font-size="22" font-weight="bold" font-family="${F}">${fmt(overview.totalChats)}</text>
|
|
107
103
|
|
|
108
|
-
<rect x="210" y="78" width="175" height="58"
|
|
109
|
-
<text x="222" y="96" fill="#
|
|
110
|
-
<text x="222" y="122" fill="#
|
|
104
|
+
<rect x="210" y="78" width="175" height="58" fill="#111"/>
|
|
105
|
+
<text x="222" y="96" fill="#666" font-size="9" font-family="${F}">tokens</text>
|
|
106
|
+
<text x="222" y="122" fill="#fff" font-size="22" font-weight="bold" font-family="${F}">${fmt((tk.input || 0) + (tk.output || 0))}</text>
|
|
111
107
|
|
|
112
|
-
<rect x="396" y="78" width="175" height="58"
|
|
113
|
-
<text x="408" y="96" fill="#
|
|
114
|
-
<text x="408" y="122" fill="#
|
|
108
|
+
<rect x="396" y="78" width="175" height="58" fill="#111"/>
|
|
109
|
+
<text x="408" y="96" fill="#666" font-size="9" font-family="${F}">active_days</text>
|
|
110
|
+
<text x="408" y="122" fill="#fff" font-size="22" font-weight="bold" font-family="${F}">${streaks.totalDays || 0}</text>
|
|
115
111
|
|
|
116
|
-
<rect x="582" y="78" width="194" height="58"
|
|
117
|
-
<text x="594" y="96" fill="#
|
|
118
|
-
<text x="594" y="122" fill="#
|
|
112
|
+
<rect x="582" y="78" width="194" height="58" fill="#111"/>
|
|
113
|
+
<text x="594" y="96" fill="#666" font-size="9" font-family="${F}">streak <tspan fill="#555">longest:${streaks.longest || 0}</tspan></text>
|
|
114
|
+
<text x="594" y="122" fill="#fff" font-size="22" font-weight="bold" font-family="${F}">${streaks.current || 0} <tspan font-size="11" fill="#666">day${(streaks.current || 0) !== 1 ? 's' : ''}</tspan></text>
|
|
119
115
|
|
|
120
116
|
<!-- Editors section -->
|
|
121
|
-
<text x="24" y="160" fill="#
|
|
117
|
+
<text x="24" y="160" fill="#666" font-size="10" font-family="${F}"># editors</text>
|
|
122
118
|
${editorBars}
|
|
123
119
|
|
|
124
120
|
<!-- Right column: Peak Hours -->
|
|
125
|
-
<text x="590" y="160" fill="#
|
|
126
|
-
<polyline points="${sparkPoints}" fill="none" stroke="#
|
|
127
|
-
<text x="590" y="${180 + sparkH + 14}" fill="#
|
|
128
|
-
<text x="${590 + sparkW - 28}" y="${180 + sparkH + 14}" fill="#
|
|
121
|
+
<text x="590" y="160" fill="#666" font-size="10" font-family="${F}"># peak_hours</text>
|
|
122
|
+
<polyline points="${sparkPoints}" fill="none" stroke="#888" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round"/>
|
|
123
|
+
<text x="590" y="${180 + sparkH + 14}" fill="#555" font-size="8" font-family="${F}">00:00</text>
|
|
124
|
+
<text x="${590 + sparkW - 28}" y="${180 + sparkH + 14}" fill="#555" font-size="8" font-family="${F}">23:00</text>
|
|
129
125
|
|
|
130
126
|
<!-- Top Models -->
|
|
131
|
-
<text x="590" y="258" fill="#
|
|
127
|
+
<text x="590" y="258" fill="#666" font-size="10" font-family="${F}"># models</text>
|
|
132
128
|
${modelsList}
|
|
133
129
|
|
|
134
130
|
<!-- Token breakdown -->
|
|
135
|
-
<line x1="24" y1="${H - 62}" x2="${W - 24}" y2="${H - 62}" stroke="#
|
|
136
|
-
<text x="24" y="${H - 44}" fill="#
|
|
131
|
+
<line x1="24" y1="${H - 62}" x2="${W - 24}" y2="${H - 62}" stroke="#222" stroke-width="1"/>
|
|
132
|
+
<text x="24" y="${H - 44}" fill="#666" font-size="9" font-family="${F}">in:${fmt(tk.input)} out:${fmt(tk.output)} cache:${fmt(tk.cacheRead)} tools:${fmt(stats.totalToolCalls || 0)} editors:${editors.length}</text>
|
|
137
133
|
|
|
138
134
|
<!-- Footer -->
|
|
139
|
-
<line x1="24" y1="${H - 28}" x2="${W - 24}" y2="${H - 28}" stroke="#
|
|
140
|
-
<text x="24" y="${H - 10}" fill="#
|
|
141
|
-
<text x="${W - 24}" y="${H - 10}" fill="#
|
|
135
|
+
<line x1="24" y1="${H - 28}" x2="${W - 24}" y2="${H - 28}" stroke="#222" stroke-width="1"/>
|
|
136
|
+
<text x="24" y="${H - 10}" fill="#555" font-size="9" font-family="${F}">github.com/f/agentlytics</text>
|
|
137
|
+
<text x="${W - 24}" y="${H - 10}" fill="#555" font-size="9" font-family="${F}" text-anchor="end">${esc(dateStr)}</text>
|
|
142
138
|
</svg>`;
|
|
143
139
|
|
|
144
140
|
return svg;
|