pi extension update

This commit is contained in:
Jonas H
2026-03-29 10:01:22 +02:00
parent 58ef050e4f
commit f66efc67bb
9 changed files with 3321 additions and 6 deletions

View File

@@ -347,11 +347,11 @@ export default function (pi: ExtensionAPI) {
const session = clampPercent(data.session);
const weekly = clampPercent(data.weekly);
let s = theme.fg("muted", "S ") + renderBrailleBar(theme, session) + " " + theme.fg("dim", `${session}%`);
if (data.sessionResetsIn) s += " " + theme.fg("dim", data.sessionResetsIn);
let w = theme.fg("muted", "W ") + renderBrailleBar(theme, weekly) + " " + theme.fg("dim", `${weekly}%`);
if (data.weeklyResetsIn) w += " " + theme.fg("dim", `\u27F3 ${data.weeklyResetsIn}`);
// Time suffixes are intentionally omitted here — footer-display builds
// them dynamically from the sessionResetsAt/weeklyResetsAt timestamps
// emitted via the "usage:update" event, avoiding double-display.
const s = theme.fg("muted", "S ") + renderBrailleBar(theme, session) + " " + theme.fg("dim", `${session}%`);
const w = theme.fg("muted", "W ") + renderBrailleBar(theme, weekly) + " " + theme.fg("dim", `${weekly}%`);
ctx.ui.setStatus(STATUS_KEY, s + theme.fg("dim", " | ") + w);
}
@@ -533,6 +533,11 @@ export default function (pi: ExtensionAPI) {
pi.on("turn_start", (_event, _ctx) => { ctx = _ctx; updateProviderFrom(_ctx.model); });
pi.on("turn_end", async (_event, _ctx) => {
ctx = _ctx;
await poll({ cacheTtl: ACTIVE_CACHE_TTL_MS });
});
pi.on("before_agent_start", async (_event, _ctx) => {
ctx = _ctx;
await poll({ cacheTtl: ACTIVE_CACHE_TTL_MS });