@oh-my-pi/omp-stats 11.0.3 → 11.2.0
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 +3 -3
- package/src/parser.ts +2 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/omp-stats",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Local observability dashboard for pi AI usage statistics",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"directory": "packages/stats"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@oh-my-pi/pi-ai": "11.0
|
|
51
|
+
"@oh-my-pi/pi-ai": "11.2.0",
|
|
52
52
|
"date-fns": "^4.1.0",
|
|
53
53
|
"lucide-react": "^0.563.0",
|
|
54
54
|
"react": "^19.2.4",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"recharts": "^3.7.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/
|
|
59
|
+
"@types/bun": "^1.3.8",
|
|
60
60
|
"@types/react": "^19.2.10",
|
|
61
61
|
"@types/react-dom": "^19.2.3"
|
|
62
62
|
},
|
package/src/parser.ts
CHANGED
|
@@ -64,24 +64,21 @@ export async function parseSessionFile(
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const text = await file.text();
|
|
67
|
-
const entries = Bun.JSONL.parse(text) as SessionEntry[];
|
|
68
67
|
const lines = text.split("\n");
|
|
69
68
|
const folder = extractFolderFromPath(sessionPath);
|
|
70
69
|
const stats: MessageStats[] = [];
|
|
71
70
|
|
|
72
71
|
let currentOffset = 0;
|
|
73
|
-
let entryIndex = 0;
|
|
74
72
|
for (const line of lines) {
|
|
75
73
|
const lineLength = line.length + 1; // +1 for newline
|
|
76
74
|
if (line.trim()) {
|
|
77
|
-
const entry =
|
|
75
|
+
const entry = JSON.parse(line) as SessionEntry;
|
|
78
76
|
if (currentOffset >= fromOffset && entry && isAssistantMessage(entry)) {
|
|
79
77
|
const msgStats = extractStats(sessionPath, folder, entry);
|
|
80
78
|
if (msgStats) {
|
|
81
79
|
stats.push(msgStats);
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
|
-
entryIndex += 1;
|
|
85
82
|
}
|
|
86
83
|
currentOffset += lineLength;
|
|
87
84
|
}
|
|
@@ -142,7 +139,7 @@ export async function getSessionEntry(sessionPath: string, entryId: string): Pro
|
|
|
142
139
|
const file = Bun.file(sessionPath);
|
|
143
140
|
if (!(await file.exists())) return null;
|
|
144
141
|
|
|
145
|
-
const text = await file.
|
|
142
|
+
const text = await file.bytes();
|
|
146
143
|
const entries = Bun.JSONL.parse(text) as SessionEntry[];
|
|
147
144
|
|
|
148
145
|
for (const entry of entries) {
|