@firstpick/pi-extension-git-footer-status 0.1.5 → 0.1.6
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 -0
- package/index.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ Enhanced Pi footer with git health and model/token telemetry.
|
|
|
6
6
|
|
|
7
7
|
- Shows compact runtime metrics in the footer:
|
|
8
8
|
- input/output/cache tokens
|
|
9
|
+
- prompt-injection estimate (`PI: X tok`, compacted as `k` for thousands)
|
|
9
10
|
- live output token counter + token output speed (`tok/s`) measured from assistant streaming lifecycle events, with a session-history fallback
|
|
10
11
|
- cost + context-window usage
|
|
11
12
|
- current model and reasoning level
|
package/index.ts
CHANGED
|
@@ -103,6 +103,10 @@ function estimateTokensFromCharCount(charCount: number): number {
|
|
|
103
103
|
return Math.max(0, Math.round(charCount / 4));
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
function estimatePromptInjectionTokens(systemPrompt: string): number {
|
|
107
|
+
return estimateTokensFromCharCount(systemPrompt.length);
|
|
108
|
+
}
|
|
109
|
+
|
|
106
110
|
function formatTokenSpeed(tokensPerSecond: number): string {
|
|
107
111
|
if (tokensPerSecond < 100) {
|
|
108
112
|
if (tokensPerSecond >= 10) return tokensPerSecond.toFixed(1);
|
|
@@ -496,6 +500,8 @@ export default function gitFooterStatus(pi: ExtensionAPI) {
|
|
|
496
500
|
latestTokenSpeed = historicalTokenSpeed;
|
|
497
501
|
}
|
|
498
502
|
|
|
503
|
+
const promptInjectionTokens = estimatePromptInjectionTokens(ctx.getSystemPrompt());
|
|
504
|
+
|
|
499
505
|
const contextUsage = ctx.getContextUsage();
|
|
500
506
|
const contextWindow = contextUsage?.contextWindow ?? ctx.model?.contextWindow ?? 0;
|
|
501
507
|
const contextPercentValue = contextUsage?.percent ?? 0;
|
|
@@ -532,6 +538,7 @@ export default function gitFooterStatus(pi: ExtensionAPI) {
|
|
|
532
538
|
const segments: string[] = [];
|
|
533
539
|
if (ioItems.length > 0) segments.push(`${theme.fg("muted", "🪙")} ${ioItems.join(` ${itemSep} `)}`);
|
|
534
540
|
if (cacheItems.length > 0) segments.push(`${theme.fg("muted", "💾")} ${cacheItems.join(` ${itemSep} `)}`);
|
|
541
|
+
segments.push(`PI: ${formatTokens(promptInjectionTokens)} tok`);
|
|
535
542
|
if (latestTokenSpeed !== null) {
|
|
536
543
|
const livePrefix = liveOutputTokens > 0 ? `${formatTokens(liveOutputTokens)} tok @ ` : "";
|
|
537
544
|
segments.push(`⚡ ${livePrefix}${formatTokenSpeed(latestTokenSpeed)} tok/s`);
|
package/package.json
CHANGED