pi-spark 0.19.2 → 0.19.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-spark",
3
- "version": "0.19.2",
3
+ "version": "0.19.3",
4
4
  "description": "Pi package that polishes your daily experience.",
5
5
  "keywords": [
6
6
  "pi-coding-agent",
@@ -35,7 +35,7 @@ function formatWindowLabel(window?: { duration?: number; timeUnit?: string } | n
35
35
  }
36
36
 
37
37
  function buildLane(label: string, detail?: KimiCodeUsageResponse["usage"]): CreditsLane {
38
- return { label, percent: toPercent(toNumber(detail?.used)) };
38
+ return { label, percent: toPercent(toNumber(detail?.used ?? 0)) };
39
39
  }
40
40
 
41
41
  export const kimiCodeProvider: CreditsProvider = {
@@ -5,7 +5,6 @@ import { pathToFileURL } from "node:url";
5
5
  import { SplitLine } from "../../components/split-line";
6
6
  import { loadConfig } from "../../config";
7
7
  import { formatContextUsage, formatCost, formatCwd, sanitizeText } from "../../utils/format";
8
- import { isFreeModel } from "../../utils/model";
9
8
  import { getEntryUsage } from "../../utils/usage";
10
9
 
11
10
  import { hyperlink } from "@earendil-works/pi-tui";
@@ -67,8 +66,8 @@ class FooterComponent implements Component {
67
66
  private getStyledCostText(): string {
68
67
  const totalCost = this.ctx.sessionManager.getBranch().reduce((acc, entry) => acc + (getEntryUsage(entry)?.cost.total ?? 0), 0);
69
68
 
70
- // Hide cost when it's zero and the current model is free.
71
- if (totalCost === 0 && this.ctx.model && isFreeModel(this.ctx.model)) return "";
69
+ // Hide cost below half a cent, since it would render as $0.00.
70
+ if (totalCost < 0.005) return "";
72
71
 
73
72
  const costText = formatCost(totalCost);
74
73
 
@@ -26,11 +26,6 @@ type ThinkingLevelSelection = {
26
26
  warning: string | undefined;
27
27
  };
28
28
 
29
- /** Check if a model has zero costs for all categories. */
30
- export function isFreeModel(model: Model<Api>): boolean {
31
- return model.cost.input === 0 && model.cost.output === 0 && model.cost.cacheRead === 0 && model.cost.cacheWrite === 0;
32
- }
33
-
34
29
  /**
35
30
  * Complete a one-shot background request, using an isolated session for OpenAI Codex models.
36
31
  * See [the investigation](../../docs/background-model-calls-and-openai-codex-sessions.md).