pi-ui-extend 0.1.67 → 0.1.68

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.
@@ -215,8 +215,8 @@ class LazySessionManager {
215
215
  createBranchedSession(leafId) {
216
216
  return this.hydrate().createBranchedSession(leafId);
217
217
  }
218
- branchWithSummary(branchFromId, summary, details, fromHook) {
219
- return this.hydrate().branchWithSummary(branchFromId, summary, details, fromHook);
218
+ branchWithSummary(branchFromId, summary, details, fromHook, usage) {
219
+ return this.hydrate().branchWithSummary(branchFromId, summary, details, fromHook, usage);
220
220
  }
221
221
  appendLabelChange(targetId, label) {
222
222
  if (this.hydrated)
@@ -248,14 +248,16 @@ class LazySessionManager {
248
248
  return this.hydrated.appendModelChange(provider, modelId);
249
249
  return this.appendEntry(this.newEntry("model_change", { provider, modelId }));
250
250
  }
251
- appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook) {
251
+ appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook, usage) {
252
252
  if (this.hydrated)
253
- return this.hydrated.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook);
253
+ return this.hydrated.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook, usage);
254
254
  const payload = { summary, firstKeptEntryId, tokensBefore };
255
255
  if (details !== undefined)
256
256
  payload.details = details;
257
257
  if (fromHook !== undefined)
258
258
  payload.fromHook = fromHook;
259
+ if (usage !== undefined)
260
+ payload.usage = usage;
259
261
  return this.appendEntry(this.newEntry("compaction", payload));
260
262
  }
261
263
  appendCustomEntry(customType, data) {
@@ -17,7 +17,18 @@ export function aggregateSessionStats(entries, base) {
17
17
  let cacheRead = 0;
18
18
  let cacheWrite = 0;
19
19
  let cost = 0;
20
+ function addUsage(usage) {
21
+ input += finiteNumber(usage?.input);
22
+ output += finiteNumber(usage?.output);
23
+ cacheRead += finiteNumber(usage?.cacheRead);
24
+ cacheWrite += finiteNumber(usage?.cacheWrite);
25
+ cost += finiteNumber(usage?.cost?.total);
26
+ }
20
27
  for (const entry of entries) {
28
+ if (entry.type === "compaction" || entry.type === "branch_summary") {
29
+ addUsage(entry.usage);
30
+ continue;
31
+ }
21
32
  if (entry.type !== "message")
22
33
  continue;
23
34
  totalMessages += 1;
@@ -28,6 +39,7 @@ export function aggregateSessionStats(entries, base) {
28
39
  }
29
40
  if (message.role === "toolResult") {
30
41
  toolResults += 1;
42
+ addUsage(message.usage);
31
43
  continue;
32
44
  }
33
45
  if (message.role !== "assistant")
@@ -36,12 +48,7 @@ export function aggregateSessionStats(entries, base) {
36
48
  if (Array.isArray(message.content)) {
37
49
  toolCalls += message.content.filter((content) => content.type === "toolCall").length;
38
50
  }
39
- const usage = message.usage;
40
- input += finiteNumber(usage?.input);
41
- output += finiteNumber(usage?.output);
42
- cacheRead += finiteNumber(usage?.cacheRead);
43
- cacheWrite += finiteNumber(usage?.cacheWrite);
44
- cost += finiteNumber(usage?.cost?.total);
51
+ addUsage(message.usage);
45
52
  }
46
53
  return {
47
54
  ...base,
@@ -43,9 +43,9 @@
43
43
  "vscode-languageserver-protocol": "^3.17.5"
44
44
  },
45
45
  "peerDependencies": {
46
- "@earendil-works/pi-ai": "0.80.10",
47
- "@earendil-works/pi-coding-agent": "0.80.10",
48
- "@earendil-works/pi-tui": "0.80.10",
46
+ "@earendil-works/pi-ai": "0.81.0",
47
+ "@earendil-works/pi-coding-agent": "0.81.0",
48
+ "@earendil-works/pi-tui": "0.81.0",
49
49
  "typebox": "*"
50
50
  },
51
51
  "devDependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ui-extend",
3
- "version": "0.1.67",
3
+ "version": "0.1.68",
4
4
  "description": "Pix: a workspace-first terminal UI for Pi with tabs, readable tool activity, voice input, and bundled agent tools.",
5
5
  "private": false,
6
6
  "repository": {
@@ -75,9 +75,9 @@
75
75
  "prepublishOnly": "npm run check && npm run build:pix && npm run generate-schemas"
76
76
  },
77
77
  "dependencies": {
78
- "@earendil-works/pi-ai": "0.80.10",
79
- "@earendil-works/pi-coding-agent": "0.80.10",
80
- "@earendil-works/pi-tui": "0.80.10",
78
+ "@earendil-works/pi-ai": "0.81.0",
79
+ "@earendil-works/pi-coding-agent": "0.81.0",
80
+ "@earendil-works/pi-tui": "0.81.0",
81
81
  "@mariozechner/clipboard": "^0.3.9",
82
82
  "jsonc-parser": "3.3.1",
83
83
  "typebox": "1.1.38",