ework-web 0.10.89 → 0.10.90
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/src/pi-sessions.ts +8 -0
package/package.json
CHANGED
package/src/pi-sessions.ts
CHANGED
|
@@ -118,6 +118,7 @@ export function buildPiSessionPage(sessionId: string, limit: number, asc = false
|
|
|
118
118
|
|
|
119
119
|
const cards: PiCard[] = [];
|
|
120
120
|
const openTools = new Map<string, PiToolCall>();
|
|
121
|
+
const seenContent = new Set<string>();
|
|
121
122
|
let inputTok = 0, outputTok = 0, cacheTok = 0, peakTok = 0;
|
|
122
123
|
let cwd = "";
|
|
123
124
|
let first = "", last = "";
|
|
@@ -129,6 +130,13 @@ export function buildPiSessionPage(sessionId: string, limit: number, asc = false
|
|
|
129
130
|
}
|
|
130
131
|
if (e.type !== "message" || !e.message) continue;
|
|
131
132
|
const m = e.message;
|
|
133
|
+
// pi re-emits identical message content as new events (streaming steps,
|
|
134
|
+
// re-persisted context, repeated tool results). Collapse exact repeats —
|
|
135
|
+
// usage excluded from the key so re-emissions still merge, and their
|
|
136
|
+
// (identical) usage is only counted once.
|
|
137
|
+
const contentKey = `${m.role ?? ""}\u0000${JSON.stringify(m.content ?? [])}`;
|
|
138
|
+
if (seenContent.has(contentKey)) continue;
|
|
139
|
+
seenContent.add(contentKey);
|
|
132
140
|
const u = m.usage;
|
|
133
141
|
if (u) {
|
|
134
142
|
inputTok += u.input ?? 0;
|