@giladbarnea/pi-custom-footer 0.1.18 → 0.1.19
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/README.md +1 -1
- package/index.ts +15 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Skills get one row for every eight terminal rows past the first six, with a mini
|
|
|
43
43
|
|
|
44
44
|
Skill age measures context-token growth since the first response after a skill load. Cache misses mirror Pi’s own miss accounting: the tokens re-billed since the last request or cache warm, their extra cost over cache reads, and the idle time. Costs use the model’s reported pricing, including when you use a subscription. Numbers show two decimal places below 10, one from 10, and none from 100.
|
|
45
45
|
|
|
46
|
-
The pace comes from `~/.cache/quota/provider-usage.json` (or under `XDG_CACHE_HOME`), which the author’s `quota` tool writes. That tool is not public yet, and without the file the footer shows no pace. The reading is for the pool of the session’s model: Claude, Fable or Codex. The footer only reads that file. It never runs `quota` and never fetches. Pace and target
|
|
46
|
+
The pace comes from `~/.cache/quota/provider-usage.json` (or under `XDG_CACHE_HOME`), which the author’s `quota` tool writes. That tool is not public yet, and without the file the footer shows no pace. The reading is for the pool of the session’s model: Claude, Fable or Codex. The footer only reads that file. It never runs `quota` and never fetches. Pace, sign and target share one color from `quota`’s heat map, read as pace over target: green within 5% of the target, bluer the slower you burn, redder the faster. A Fable session shows Fable’s target capped by the room left in the shared Claude week.
|
|
47
47
|
|
|
48
48
|
## Development
|
|
49
49
|
|
package/index.ts
CHANGED
|
@@ -667,15 +667,15 @@ function readPace(model: ExtensionContext["model"], now: number): Pace | null {
|
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
/** Where a
|
|
671
|
-
*
|
|
672
|
-
*
|
|
670
|
+
/** Where a reading sits on PACE_STOPS: the one position that colours its burn, sign and target alike.
|
|
671
|
+
* It is the quota tool's DashboardPalette.pace curve over burn ÷ target: ideal within 5%, heating to
|
|
672
|
+
* amber at 1.25× and red at 2×, cooling to the cool end at 0.25×. Both rates floor at the smallest
|
|
673
|
+
* float, as the quota tool floors a rate, so 0× against 0× is on pace and a zero target is red.
|
|
673
674
|
* @example
|
|
674
|
-
* [pacePosition(1,
|
|
675
|
-
* [pacePosition(0.8, true), pacePosition(4, true)] // [0.5, -1]
|
|
675
|
+
* [pacePosition(1, 1), pacePosition(1.25, 1), pacePosition(1.5, 0.75), pacePosition(0.4, 1.6), pacePosition(0, 0), pacePosition(0.2, 0)] // [0, 0.5, 1, -1, 0, 1]
|
|
676
676
|
*/
|
|
677
|
-
function pacePosition(
|
|
678
|
-
const pressure = (
|
|
677
|
+
function pacePosition(burn: number, target: number): number {
|
|
678
|
+
const pressure = Math.log2(Math.max(burn, Number.MIN_VALUE) / Math.max(target, Number.MIN_VALUE));
|
|
679
679
|
const idealBand = Math.log2(1.05);
|
|
680
680
|
const amberPoint = Math.log2(1.25);
|
|
681
681
|
if (pressure < -idealBand) return -Math.min(1, (-pressure - idealBand) / (2 - idealBand));
|
|
@@ -1050,16 +1050,18 @@ export default function (pi: ExtensionAPI) {
|
|
|
1050
1050
|
const missForms = !isHit && stats.latestCacheMiss ? cacheMissForms(stats.latestCacheMiss) : null;
|
|
1051
1051
|
const paceForms = (reading: Pace): FactForms => {
|
|
1052
1052
|
const dim = (text: string) => theme.fg("dim", text);
|
|
1053
|
-
|
|
1054
|
-
const
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1053
|
+
// A rate that is not a number is no reading, which the quota tool paints dim.
|
|
1054
|
+
const position = pacePosition(reading.burn, reading.target);
|
|
1055
|
+
const heat = (text: string) => Number.isNaN(position) ? dim(text) : paint.ramp(PACE_STOPS, position, text);
|
|
1056
|
+
const burn = heat(`${formatDecimal(reading.burn)}×`);
|
|
1057
|
+
const target = heat(`${formatDecimal(reading.target)}×`);
|
|
1058
|
+
// The sign carries the verdict, and its colour is the reading's, like the rates beside it.
|
|
1059
|
+
const sign = heat(reading.burn > reading.target ? ">" : "≤");
|
|
1058
1060
|
const resets = formatRemaining(reading.resetsInMs);
|
|
1059
1061
|
// A stale reading keeps showing, with its age until "brief", the form without it.
|
|
1060
1062
|
const age = reading.ageMs > PACE_STALE_AFTER_MS ? dim(` · ${formatRemaining(reading.ageMs)} old`) : "";
|
|
1061
1063
|
return {
|
|
1062
|
-
full: `${label("pace")}${paceBar(reading.used, reading.elapsed,
|
|
1064
|
+
full: `${label("pace")}${paceBar(reading.used, reading.elapsed, heat, dim)} ${burn} ${sign} ${label("target")}${target}${dim(` · resets in ${resets}`)}${age}`,
|
|
1063
1065
|
short: `${label("pace")}${burn} ${sign} ${label("target")}${target}${dim(` · ${resets}`)}${age}`,
|
|
1064
1066
|
brief: `${label("pace")}${burn} ${sign} ${label("target")}${target}${dim(` · ${resets}`)}`,
|
|
1065
1067
|
bare: `${label("pace")}${sign} ${label("target")}${dim("(")}${target}${dim(")")}`,
|