repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

footer extension: trim useless fat

05f6232ededb75eb90bf9c70a1bc0f4010d2fd91

Oliver Krylow <o.krylow@isp-insoft.de> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (11)

CHANGELOG.md

Modified
2 2 # Changelog
4 4 ## Unreleased
6 +- Declutter the status bar: show context usage as the bar alone, drop unreadable cache-read and cache-write totals in favour of the cache hit rate, scale token counts and costs through `k` and `M`, drop the provider name from the active quota segment that the model icon already identifies, and replace glyph labels with spelled-out status text outside TUI mode
6 8 - Recover Decay from partial classification with up to two gap-fill rounds over only the missing chunks, tolerate exact duplicate chunk records, and salvage a deterministic summary from ranked atoms when the summarizer fails instead of discarding the whole run to default compaction
7 9 - Keep Klaus models in sync with Pi's Anthropic catalog: inherit the human's model overrides, never inherit transport-owned fields, clamp an inherited context window or output maximum to the builtin catalog value the Agent SDK path can actually deliver, re-project the catalog at each turn boundary, and re-register the provider only when the projection changed
8 10 - Expose Klaus tools to Claude under their Pi names instead of the `mcp__klaus__` prefix, while still accepting prefixed names from resumed sessions and older runtimes

extensions/context-size/README.md

Modified
35 35 ## Behavior
37 -Shows current context-window usage as a token ratio plus a 10-cell bar.
37 +Shows current context-window usage as a 10-cell bar.
39 39 If `@bugabinga/pi-ext-footer` is loaded, publishes a `context-size` footer
40 40 segment in the `llm` zone with order `1`.
41 41 Otherwise uses Pi status text with id `context-size`.
43 -The footer segment includes shortened variants:
45 -- bar plus percent
46 -- percent plus token ratio
48 -Token counts are displayed in thousands, rounded.
43 +The footer segment is the bar alone.
44 +Its length encodes the percentage and its color encodes the pressure, so
45 +percent and token counts would only repeat it.
50 47 Usage color:
57 54 The bar uses `dim` when the text color is muted. Otherwise it uses the same
58 55 color as the text.
57 +Outside TUI mode the bar is replaced by plain status text such as
58 +`context 26% used, 738k left`, because other clients render the status line as
59 +text in an unknown font.
60 +Token counts there use `k` and `M` units.
60 62 No UI update runs when UI is unavailable.
62 64 Clears footer/status when context usage is unavailable.

extensions/context-size/__tests__/harness.test.ts

Modified
1 1 import { afterEach, describe, expect, it } from "vitest";
2 2 import { createTestSession, type TestSession } from "../../../test/harness";
3 -import contextSizeExtension from "../index";
3 +import contextSizeExtension, { __test } from "../index";
5 5 describe("context-size pi-test-harness", () => {
6 6 let t: TestSession | undefined;
16 16 expect(t.session.extensionRunner.extensions).toHaveLength(1);
19 + it("renders the tui view as a bar alone", () => {
20 + expect(__test.renderThinBar(26)).toBe("━━━───────");
21 + expect(__test.renderThinBar(null)).toBe("──────────");
22 + });
24 + it("spells out the non-tui label with human-readable headroom", () => {
25 + expect(
26 + __test.buildPlainLabel({
27 + tokens: 262_000,
28 + contextWindow: 1_000_000,
29 + percent: 26.2,
30 + }),
31 + ).toBe("context 26% used, 738k left");
33 + expect(
34 + __test.buildPlainLabel({
35 + tokens: null,
36 + contextWindow: 1_000_000,
37 + percent: null,
38 + }),
39 + ).toBe("context unknown");
40 + });
42 + it("scales token counts through k and M", () => {
43 + expect(__test.formatTokens(940)).toBe("940");
44 + expect(__test.formatTokens(1_180)).toBe("1.2k");
45 + expect(__test.formatTokens(262_000)).toBe("262k");
46 + expect(__test.formatTokens(1_618_000)).toBe("1.6M");
47 + expect(__test.formatTokens(121_527_000)).toBe("122M");
48 + });

extensions/context-size/index.ts

Modified
19 19 errorPercent: 85,
20 20 } as const;
22 -const TOKEN_UNIT = 1000;
24 22 const BAR = {
25 23 width: 10,
26 24 empty: "─",
64 62 return BAR.full.repeat(filled) + BAR.empty.repeat(BAR.width - filled);
67 -function formatTokenCount(tokens: number | null): string {
68 - if (tokens === null) return "?";
69 - return `${Math.round(tokens / TOKEN_UNIT)}k`;
72 -function formatTokenRatio(
73 - tokens: number | null,
74 - contextWindow: number,
75 -): string {
76 - return `${formatTokenCount(tokens)}/${formatTokenCount(contextWindow)}`;
65 +/** Human-readable token count: 940, 1.2k, 262k, 1.2M, 12M. */
66 +function formatTokens(tokens: number): string {
67 + if (tokens < 1_000) return `${Math.round(tokens)}`;
68 + if (tokens < 10_000) return `${(tokens / 1_000).toFixed(1)}k`;
69 + if (tokens < 1_000_000) return `${Math.round(tokens / 1_000)}k`;
70 + if (tokens < 10_000_000) return `${(tokens / 1_000_000).toFixed(1)}M`;
71 + return `${Math.round(tokens / 1_000_000)}M`;
74 +/**
75 + * TUI view: the bar alone. Its length encodes the percentage and its colour
76 + * encodes the pressure, so percent and token counts would only repeat it.
77 + */
79 78 function buildSegment(ctx: ExtensionContext, usage: ContextUsage): SegmentView {
80 79 const percent = usage.percent ?? null;
81 80 const textTone = toneForPercent(percent);
82 - const ratio = formatTokenRatio(usage.tokens, usage.contextWindow);
83 - const bar = ctx.ui.theme.fg(barTone(textTone), renderThinBar(percent));
84 - const pct = percent === null ? "?%" : `${Math.round(percent)}%`;
86 82 return {
87 - text: `${bar} ${pct} ${ratio}`,
83 + text: ctx.ui.theme.fg(barTone(textTone), renderThinBar(percent)),
88 84 color: textTone,
88 +/**
89 + * Non-TUI view: no bar and no glyphs, because RPC clients render the status
90 + * line as plain text in an unknown font.
91 + */
92 +function buildPlainLabel(usage: ContextUsage): string {
93 + const percent = usage.percent ?? null;
94 + if (percent === null || usage.tokens === null) return "context unknown";
95 + const left = Math.max(0, usage.contextWindow - usage.tokens);
96 + return `context ${Math.round(percent)}% used, ${formatTokens(left)} left`;
92 99 function offerFooterSegment(pi: ExtensionAPI, segment: object): boolean {
93 100 let accepted = false;
94 101 pi.events.emit("footer:segment", {
123 130 return;
133 + if (ctx.mode !== "tui") {
134 + clearSegment();
135 + ctx.ui.setStatus(STATUS_ID, buildPlainLabel(usage));
136 + return;
126 139 const view = buildSegment(ctx, usage);
127 - const accepted =
128 - ctx.mode === "tui" &&
129 - offerFooterSegment(pi, {
130 - ...FOOTER_SEGMENT,
131 - text: view.text,
132 - variants: [
133 - view.text.replace(/\s+\S+\/\S+$/, ""),
134 - view.text.replace(/^\S+\s+/, ""),
135 - ],
136 - color: view.color,
137 - });
140 + const accepted = offerFooterSegment(pi, {
141 + ...FOOTER_SEGMENT,
142 + text: view.text,
143 + color: view.color,
144 + });
139 146 if (!accepted) clearSegment();
140 147 ctx.ui.setStatus(STATUS_ID, accepted ? undefined : view.text);
156 163 // Footer owns its own teardown. Emitting through `pi.events` during session_shutdown
157 164 // can trip Pi's stale-context guard after reload/switch.
167 +export const __test = { buildPlainLabel, formatTokens, renderThinBar };

extensions/cost/README.md

Modified
46 46 Shows cumulative session token usage, turn cost, session cost, and current-month cost.
48 48 Token totals include assistant messages, nested tool usage, compactions, and branch summaries across the session.
49 -The token label uses input, output, cache-read, and cache-write counts.
50 -Cache reads use `◐`, cache writes use `W`, and `` shows the latest assistant prompt's cache-hit percentage.
49 +The token label uses input (`↑`) and output (`↓`) counts, plus the cache-hit percentage of the latest assistant prompt.
50 +Cache-read and cache-write totals are deliberately absent: as raw counts they are unreadable, while the hit percentage carries the decision-relevant part.
51 +Cache-hit percentage is prefixed with the cache icon.
51 52 No token usage shows `↑0`.
54 +Counts use `k` and `M` units; costs of `$1000` or more use `k` as well.
56 +Outside TUI mode the status text is spelled out, for example
57 +`in 1.6M, out 448k, cache hit 100%, turn $0.16, session $70.70, month $3.1k`,
58 +because other clients render the status line as text in an unknown font.
59 +Without UI, nothing is published.
53 61 Uses provider-reported `usage.cost.total` when present and greater than zero.
54 62 If reported cost is zero or missing, estimates cost only for built-in `zai` and
55 63 `minimax` pricing rows.

extensions/cost/__tests__/harness.test.ts

Modified
339 339 ).toBe(80);
342 - it("formats cumulative token and cache usage in the existing visual style", () => {
342 + it("shows only input, output, and cache hit rate in the tui label", () => {
343 343 expect(
344 344 __test.tokenLabel(
353 - ).toBe("↑1.1k ↓978 ◐ 109k W2.1k  98%");
353 + ).toBe("↑1.1k ↓978  98%");
354 + });
356 + it("scales large token counts into millions", () => {
357 + expect(
358 + __test.tokenLabel(
359 + { input: 1_618_000, output: 448_000, cacheRead: 0, cacheWrite: 0 },
360 + 100,
361 + ),
362 + ).toBe("↑1.6M ↓448k  100%");
363 + });
365 + it("spells out the non-tui label without glyphs", () => {
366 + expect(
367 + __test.plainLabel({
368 + usage: {
369 + input: 1_618_000,
370 + output: 448_000,
371 + cacheRead: 121_527_000,
372 + cacheWrite: 1_381_000,
373 + },
374 + cacheHitRate: 100,
375 + turnCost: 0.16,
376 + sessionCost: 70.7,
377 + monthlyCost: 3146.2,
378 + }),
379 + ).toBe(
380 + "in 1.6M, out 448k, cache hit 100%, turn $0.16, session $70.7, month $3.1k",
381 + );

extensions/cost/index.ts

Modified
23 23 const PRICE_UNIT_TOKENS = 1_000_000;
24 24 const COUNT_DECIMAL_THRESHOLD = 1_000;
25 25 const COUNT_ROUND_THRESHOLD = 10_000;
26 +const MILLION_THRESHOLD = 1_000_000;
27 +const MILLION_DECIMAL_THRESHOLD = 10_000_000;
26 28 const LOW_COST_THRESHOLD = 0.01;
27 29 const MEDIUM_COST_THRESHOLD = 10;
30 +const HIGH_COST_THRESHOLD = 1_000;
28 31 const SESSION_EXT = ".jsonl";
29 32 const SESSION_MONTH_RE = /^(\d{4})-(\d{2})/;
327 330 // ── Formatting ────────────────────────────────────────────────────────────
332 +/** Human-readable token count: 978, 1.1k, 448k, 1.6M, 122M. */
329 333 function formatCount(value: number): string {
330 334 if (value < COUNT_DECIMAL_THRESHOLD) return `${value}`;
331 335 if (value < COUNT_ROUND_THRESHOLD)
332 336 return `${(value / COUNT_DECIMAL_THRESHOLD).toFixed(1)}k`;
333 - return `${Math.round(value / COUNT_DECIMAL_THRESHOLD)}k`;
337 + if (value < MILLION_THRESHOLD)
338 + return `${Math.round(value / COUNT_DECIMAL_THRESHOLD)}k`;
339 + if (value < MILLION_DECIMAL_THRESHOLD)
340 + return `${(value / MILLION_THRESHOLD).toFixed(1)}M`;
341 + return `${Math.round(value / MILLION_THRESHOLD)}M`;
336 344 function formatCost(value: number): string {
337 345 if (value < LOW_COST_THRESHOLD) return `$${value.toFixed(4)}`;
338 346 if (value < MEDIUM_COST_THRESHOLD) return `$${value.toFixed(2)}`;
339 - return `$${value.toFixed(1)}`;
347 + if (value < HIGH_COST_THRESHOLD) return `$${value.toFixed(1)}`;
348 + return `$${(value / HIGH_COST_THRESHOLD).toFixed(1)}k`;
351 +/**
352 + * Cumulative prompt and completion volume. Cache reads and writes are omitted
353 + * on purpose: as raw totals they are unreadable and unactionable, while the
354 + * cache hit rate already carries the only decision-relevant part.
355 + */
342 356 function tokenLabel(usage: TokenUsage, cacheHitRate?: number): string {
344 358 usage.input === 0 &&
351 365 const parts: string[] = [];
352 366 if (usage.input > 0) parts.push(`↑${formatCount(usage.input)}`);
353 367 if (usage.output > 0) parts.push(`↓${formatCount(usage.output)}`);
354 - if (usage.cacheRead > 0) parts.push(`◐ ${formatCount(usage.cacheRead)}`);
355 - if (usage.cacheWrite > 0) parts.push(`W${formatCount(usage.cacheWrite)}`);
356 368 if (cacheHitRate !== undefined)
357 369 parts.push(`${CACHE_ICON} ${Math.round(cacheHitRate)}%`);
358 370 return parts.join(" ");
393 405 return accepted;
408 +/** TUI fallback when the footer rejects the segments; glyphs stay readable. */
396 409 function statusLabel(snapshot: Snapshot): string {
397 410 return [
398 411 tokenLabel(snapshot.usage, snapshot.cacheHitRate),
402 415 .join(" · ");
418 +/**
419 + * Non-TUI label: words instead of arrows and private-use icons, because RPC
420 + * clients render the status line as plain text in an unknown font.
421 + */
422 +function plainLabel(snapshot: Snapshot): string {
423 + const { input, output } = snapshot.usage;
424 + const parts = [`in ${formatCount(input)}`, `out ${formatCount(output)}`];
425 + if (snapshot.cacheHitRate !== undefined)
426 + parts.push(`cache hit ${Math.round(snapshot.cacheHitRate)}%`);
427 + if (snapshot.turnCost > 0)
428 + parts.push(`turn ${formatCost(snapshot.turnCost)}`);
429 + if (snapshot.sessionCost > 0)
430 + parts.push(`session ${formatCost(snapshot.sessionCost)}`);
431 + if (snapshot.monthlyCost > snapshot.sessionCost)
432 + parts.push(`month ${formatCost(snapshot.monthlyCost)}`);
433 + return parts.join(", ");
405 436 function publishSnapshot(
406 437 pi: ExtensionAPI,
407 438 ctx: ExtensionContext,
408 439 snapshot: Snapshot,
410 - let accepted = false;
411 - if (ctx.mode === "tui") {
412 - const tokensAccepted = emitSegment(
413 - pi,
414 - "tokens",
415 - tokenLabel(snapshot.usage, snapshot.cacheHitRate),
416 - );
417 - const costAccepted = emitSegment(pi, "cost", costLabel(snapshot));
418 - accepted = tokensAccepted && costAccepted;
441 + if (ctx.mode !== "tui") {
442 + clearSegments(pi);
443 + ctx.ui.setStatus(STATUS_ID, plainLabel(snapshot));
444 + return;
447 + const tokensAccepted = emitSegment(
448 + pi,
449 + "tokens",
450 + tokenLabel(snapshot.usage, snapshot.cacheHitRate),
451 + );
452 + const costAccepted = emitSegment(pi, "cost", costLabel(snapshot));
453 + const accepted = tokensAccepted && costAccepted;
421 455 if (!accepted) clearSegments(pi);
422 456 ctx.ui.setStatus(STATUS_ID, accepted ? undefined : statusLabel(snapshot));
571 605 calculateMonthlyCost,
572 606 costLabel,
573 607 latestAssistantCacheHitRate,
608 + plainLabel,
574 609 sessionUsage,
575 610 tokenLabel,

extensions/footer/__bench__/render.bench.ts

Modified
181 181 segment({
182 182 id: "tokens",
183 - text: "↑18.2k ↓4.1k ◐ 96k W2.4k  82%",
183 + text: "↑18.2k ↓4.1k  82%",
184 184 zone: "llm",
185 185 order: 2,

extensions/quota/README.md

Modified
58 58 - Active provider marker:
59 59 `●`; inactive marker:
60 60 `◌`.
61 +- The active provider's segment omits the provider name, because the model
62 + segment already shows that provider's icon.
63 + Inactive providers keep their name.
64 +- Outside TUI mode, the status text is spelled out, for example
65 + `Anthropic quota 4% used, resets in 4h50m`.
66 +- Without UI, no status is published and no quota requests are made.
62 68 OpenAI Codex needs both an auth token and an account id.
63 69 The account id is read from Pi auth storage first, then `~/.codex/auth.json`.

extensions/quota/__tests__/harness.test.ts

Modified
3 3 import path from "node:path";
4 4 import { afterEach, describe, expect, it } from "vitest";
5 5 import { createTestSession, type TestSession } from "../../../test/harness";
6 6 import { __test } from "../index.ts";
8 +/** 4h50m ahead, matching the reset window the footer renders. */
9 +const RESET_AT = Date.now() + 4 * 3_600_000 + 50 * 60_000 + 30_000;
8 11 describe("quota pi-test-harness", () => {
9 12 let t: TestSession | undefined;
86 89 weekly: { used: 20, total: 100, remaining: 80 },
93 + it("drops the provider name for the active provider only", () => {
94 + const anthropic = {
95 + name: "Anthropic",
96 + fiveH: { used: 4, total: 100, remaining: 96, resetAt: RESET_AT },
97 + weekly: { used: 0, total: 0, remaining: 0 },
98 + };
100 + expect(__test.segmentText(anthropic, true)).toEqual([
101 + "4% (4h50m)",
102 + "4%",
103 + "4%",
104 + ]);
105 + expect(__test.segmentText(anthropic, false)).toEqual([
106 + "Anthropic 4% (4h50m)",
107 + "Anthropic 4%",
108 + "4%",
109 + ]);
110 + });
112 + it("keeps the name in status fallbacks and spells out the non-tui label", () => {
113 + const providers = [
115 + name: "Anthropic",
116 + fiveH: { used: 4, total: 100, remaining: 96, resetAt: RESET_AT },
117 + weekly: { used: 0, total: 0, remaining: 0 },
118 + },
119 + ];
121 + expect(__test.quotaStatusLabel(providers, "Anthropic")).toBe(
122 + "Anthropic 4% (4h50m)",
123 + );
124 + expect(__test.quotaPlainLabel(providers, "Anthropic")).toBe(
125 + "Anthropic quota 4% used, resets in 4h50m",
126 + );
127 + expect(__test.quotaPlainLabel([], "Anthropic")).toBeUndefined();
128 + });

extensions/quota/index.ts

Modified
438 438 return used < 50 ? "accent" : used < 80 ? "warning" : "error";
441 +// ── Labels ──────────────────────────────────────────────────────────
443 +function visibleRows(
444 + providers: readonly ProviderUsage[],
445 + active: string | null,
446 +): ProviderUsage[] {
447 + return providers
448 + .filter((p) => p.fiveH.total > 0)
449 + .filter((p) => !active || p.name.startsWith(active));
452 +function fiveHPercent(p: ProviderUsage): number {
453 + return Math.round((p.fiveH.used / p.fiveH.total) * 100);
456 +function shortName(p: ProviderUsage): string {
457 + return p.name.split(" ")[0];
460 +/**
461 + * TUI segment text. The active provider drops its name, because the model
462 + * segment already shows that provider's icon; inactive rows keep it.
463 + */
464 +function segmentText(p: ProviderUsage, isActive: boolean): string[] {
465 + const used = fiveHPercent(p);
466 + const reset = fmtReset(p.fiveH.resetAt);
467 + const prefix = isActive ? "" : `${shortName(p)} `;
468 + return [
469 + `${prefix}${used}%${reset ? ` (${reset})` : ""}`,
470 + `${prefix}${used}%`,
471 + `${used}%`,
472 + ];
475 +/**
476 + * TUI fallback when the footer rejects segments. No bullet icon is rendered
477 + * there, so the provider name has to carry the identity.
478 + */
479 +function quotaStatusLabel(
480 + providers: readonly ProviderUsage[],
481 + active: string | null,
482 +): string | undefined {
483 + const rows = visibleRows(providers, active).map((p) => {
484 + const reset = fmtReset(p.fiveH.resetAt);
485 + return `${shortName(p)} ${fiveHPercent(p)}%${reset ? ` (${reset})` : ""}`;
486 + });
487 + return rows.length > 0 ? rows.join(" · ") : undefined;
490 +/** Non-TUI label: spelled out, since other clients show plain status text. */
491 +function quotaPlainLabel(
492 + providers: readonly ProviderUsage[],
493 + active: string | null,
494 +): string | undefined {
495 + const rows = visibleRows(providers, active).map((p) => {
496 + const reset = fmtReset(p.fiveH.resetAt);
497 + const suffix = reset ? `, resets in ${reset}` : "";
498 + return `${shortName(p)} quota ${fiveHPercent(p)}% used${suffix}`;
499 + });
500 + return rows.length > 0 ? rows.join("; ") : undefined;
441 503 // ── Extension ─────────────────────────────────────────────────────────────
443 505 export default function usageExtension(pi: ExtensionAPI) {
616 678 footerIds.clear();
619 - function quotaStatusLabel(ctx: ExtensionContext): string | undefined {
620 - const active = activeProvider(ctx);
621 - const rows = providers
622 - .filter((p) => p.fiveH.total > 0)
623 - .filter((p) => !active || p.name.startsWith(active))
624 - .map((p) => {
625 - const used = Math.round((p.fiveH.used / p.fiveH.total) * 100);
626 - const label = p.name.split(" ")[0];
627 - const reset = fmtReset(p.fiveH.resetAt);
628 - return `${label} ${used}%${reset ? ` (${reset})` : ""}`;
629 - });
630 - return rows.length > 0 ? rows.join(" · ") : undefined;
631 - }
633 681 function updateFooter(ctx: ExtensionContext) {
682 + if (!ctx.hasUI) return;
634 683 const active = activeProvider(ctx);
636 685 if (ctx.mode !== "tui") {
637 686 clearFooter();
638 - ctx.ui.setStatus(STATUS_ID, quotaStatusLabel(ctx));
687 + ctx.ui.setStatus(STATUS_ID, quotaPlainLabel(providers, active));
639 688 return;
643 692 let accepted = true;
644 693 const seen = new Set<string>();
646 - for (const p of providers
647 - .filter((p) => p.fiveH.total > 0)
648 - .filter((p) => !active || p.name.startsWith(active))) {
649 - const used = Math.round((p.fiveH.used / p.fiveH.total) * 100);
695 + for (const p of visibleRows(providers, active)) {
696 + const used = fiveHPercent(p);
650 697 const isActive = !!active && p.name.startsWith(active);
651 - const label = p.name.split(" ")[0];
652 - const reset = fmtReset(p.fiveH.resetAt);
698 + const [text, ...variants] = segmentText(p, isActive);
653 699 const id = `quota:${p.name}`;
654 700 seen.add(id);
655 701 footerIds.add(id);
659 705 offerFooterSegment({
661 707 icon: isActive ? "●" : "◌",
662 - text: `${label} ${used}%${reset ? ` (${reset})` : ""}`,
663 - variants: [`${label} ${used}%`, `${used}%`],
708 + text,
709 + variants,
664 710 color: isActive ? color(used) : "muted",
665 711 zone: "llm",
666 712 order: 4,
677 723 accepted = offered && accepted;
678 724 if (!accepted) clearFooter();
679 - ctx.ui.setStatus(STATUS_ID, accepted ? undefined : quotaStatusLabel(ctx));
725 + ctx.ui.setStatus(
726 + STATUS_ID,
727 + accepted ? undefined : quotaStatusLabel(providers, active),
728 + );
682 731 // ── Widget ─────────────────────────────────────────────────────────────
772 821 fetchedAt = 0;
773 822 widgetVisible = false;
774 823 clearFooter();
824 + // Without UI nobody can read quota, so skip the status line and the
825 + // recurring provider requests entirely.
826 + if (!ctx.hasUI) return;
775 827 ctx.ui.setStatus(STATUS_ID, undefined);
776 828 startRefresh(ctx, ticket);
777 829 void (async () => {
791 843 pi.on("agent_start", async (_e, ctx) => updateFooter(ctx));
792 844 pi.on("agent_end", async (_e, ctx) => {
845 + if (!ctx.hasUI) return;
794 847 await getOrFetch(ctx);
795 848 updateFooter(ctx);
796 849 } catch {}
798 851 pi.on("model_select", async (_e, ctx) => {
852 + if (!ctx.hasUI) return;
800 854 await getOrFetch(ctx, true);
801 855 updateFooter(ctx);
815 -export const __test = { parseCopilot, parseGemini, parseMinimax };
869 +export const __test = {
870 + parseCopilot,
871 + parseGemini,
872 + parseMinimax,
873 + quotaPlainLabel,
874 + quotaStatusLabel,
875 + segmentText,