pi-path-bar 0.5.1 → 0.5.2
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/minimal.ts +6 -1
- package/src/segments.ts +13 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -135,10 +135,11 @@ export default function (pi: ExtensionAPI, configFile = join(getAgentDir(), "pi-
|
|
|
135
135
|
const { totals, hitRate } = readStats(current);
|
|
136
136
|
const model = current.model;
|
|
137
137
|
const subscription = Boolean(model && (model.provider === "kimi-coding" || current.modelRegistry?.isUsingOAuth(model)));
|
|
138
|
-
const { slots } = classifyStatuses(footerData?.getExtensionStatuses() ?? new Map());
|
|
138
|
+
const { slots, billionContextUsage } = classifyStatuses(footerData?.getExtensionStatuses() ?? new Map());
|
|
139
139
|
return {
|
|
140
140
|
indicator,
|
|
141
141
|
totals,
|
|
142
|
+
billionContextUsage,
|
|
142
143
|
hitRate,
|
|
143
144
|
subscription,
|
|
144
145
|
sessionName: current.sessionManager.getSessionName(),
|
package/src/minimal.ts
CHANGED
|
@@ -26,6 +26,7 @@ export interface MinimalBorderTheme {
|
|
|
26
26
|
export interface MinimalTopInput {
|
|
27
27
|
indicator?: WorkingIndicatorLike;
|
|
28
28
|
totals: UsageTotals;
|
|
29
|
+
billionContextUsage?: string;
|
|
29
30
|
hitRate?: number;
|
|
30
31
|
subscription: boolean;
|
|
31
32
|
sessionName?: string;
|
|
@@ -321,8 +322,12 @@ export function renderMinimalTopBorder(input: MinimalTopInput, width: number, hi
|
|
|
321
322
|
const sessionClean = input.showSession && input.sessionName ? clean(input.sessionName).trim() : "";
|
|
322
323
|
const sessionText = sessionClean ? dim(`·${truncateToWidth(sessionClean, 12, "…")}`) : "";
|
|
323
324
|
|
|
325
|
+
const delegateText = input.billionContextUsage
|
|
326
|
+
? dim(`${tokensText ? "· " : ""}${input.billionContextUsage}`)
|
|
327
|
+
: "";
|
|
324
328
|
const telemetryTiers = [
|
|
325
|
-
[tokensText, cacheText, costText, sessionText],
|
|
329
|
+
[tokensText, delegateText, cacheText, costText, sessionText],
|
|
330
|
+
...(delegateText ? [[tokensText, delegateText, cacheText, costText]] : []),
|
|
326
331
|
[tokensText, cacheText, costText],
|
|
327
332
|
[tokensText, costText],
|
|
328
333
|
[costText],
|
package/src/segments.ts
CHANGED
|
@@ -18,6 +18,8 @@ export interface ExtensionAdapter {
|
|
|
18
18
|
export interface ClassifiedStatuses {
|
|
19
19
|
/** Type 1 (adapted) and Type 2 (path-bar:*) slots before hidden filtering. */
|
|
20
20
|
slots: Map<string, SlotEntry>;
|
|
21
|
+
/** Compact billion-context usage for the left telemetry block. */
|
|
22
|
+
billionContextUsage?: string;
|
|
21
23
|
/** Type 3 (unknown extensions), sorted alphabetically by status key. */
|
|
22
24
|
unknown: Array<[string, string]>;
|
|
23
25
|
}
|
|
@@ -659,7 +661,7 @@ export function segmentEntries(statuses: ReadonlyMap<string, string>): Map<strin
|
|
|
659
661
|
}
|
|
660
662
|
|
|
661
663
|
/**
|
|
662
|
-
*
|
|
664
|
+
* Extract billion-context telemetry and split the remaining statuses into three tiers:
|
|
663
665
|
* - Type 2: explicit `path-bar:<id>` segments (highest priority; suppresses matching Type 1 key)
|
|
664
666
|
* - Type 1: known third-party statuses compressed by built-in adapters
|
|
665
667
|
* - Type 3: unknown extensions rendered on the auto-hiding line below the bottom border
|
|
@@ -681,7 +683,16 @@ export function classifyStatuses(
|
|
|
681
683
|
}
|
|
682
684
|
const byKey = new Map(adapters.map((adapter) => [adapter.key, adapter]));
|
|
683
685
|
const unknown: Array<[string, string]> = [];
|
|
686
|
+
let billionContextUsage: string | undefined;
|
|
684
687
|
for (const [key, text] of remaining) {
|
|
688
|
+
if (key === "billion-context") {
|
|
689
|
+
// shortcut: matches v0.1.216's display text; use structured usage if upstream exposes it.
|
|
690
|
+
const usage = /^sub-agents (↑\d+(?:\.\d+)?[kM]?) (↓\d+(?:\.\d+)?[kM]?)(?: \(\$\d+(?:\.\d+)?\))?$/.exec(stripTerminalSequences(text).trim());
|
|
691
|
+
if (usage) {
|
|
692
|
+
billionContextUsage = `bc${usage[1]}${usage[2]}`;
|
|
693
|
+
continue;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
685
696
|
const adapter = byKey.get(key);
|
|
686
697
|
if (adapter) {
|
|
687
698
|
// Explicit Type 2 registration wins and suppresses the legacy key so it does not duplicate below.
|
|
@@ -695,7 +706,7 @@ export function classifyStatuses(
|
|
|
695
706
|
unknown.push([key, text]);
|
|
696
707
|
}
|
|
697
708
|
unknown.sort(([a], [b]) => a.localeCompare(b));
|
|
698
|
-
return { slots, unknown };
|
|
709
|
+
return { slots, unknown, billionContextUsage };
|
|
699
710
|
}
|
|
700
711
|
|
|
701
712
|
/**
|