@firstpick/pi-extension-git-footer-status 0.1.5 → 0.1.7

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/index.ts +11 -4
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -2,10 +2,13 @@
2
2
 
3
3
  Enhanced Pi footer with git health and model/token telemetry.
4
4
 
5
+ ![Status bar with metrics and git context](images/Statusbar_v0.1.5.png)
6
+
5
7
  ## What it does
6
8
 
7
9
  - Shows compact runtime metrics in the footer:
8
10
  - input/output/cache tokens
11
+ - prompt-injection estimate (`PI: X tok`, compacted as `k` for thousands)
9
12
  - live output token counter + token output speed (`tok/s`) measured from assistant streaming lifecycle events, with a session-history fallback
10
13
  - cost + context-window usage
11
14
  - current model and reasoning level
package/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { access } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
3
  import { isAbsolute, resolve, sep } from "node:path";
4
- import type { AssistantMessage } from "@mariozechner/pi-ai";
5
- import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
6
- import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
4
+ import type { AssistantMessage } from "@earendil-works/pi-ai";
5
+ import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
6
+ import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
7
7
 
8
8
  type GitSnapshot = {
9
9
  branch: string;
@@ -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);
@@ -328,7 +332,7 @@ function buildStatusText(ctx: ExtensionContext, snapshot: GitSnapshot): string {
328
332
  const changesSection: string[] = [];
329
333
  if (f.staged && snapshot.staged > 0) changesSection.push(t.fg("success", `+${snapshot.staged}`));
330
334
  if (f.unstaged && snapshot.unstaged > 0) changesSection.push(t.fg("warning", `✎${snapshot.unstaged}`));
331
- if (f.untracked && snapshot.untracked > 0) changesSection.push(t.fg("info", `◌${snapshot.untracked}`));
335
+ if (f.untracked && snapshot.untracked > 0) changesSection.push(t.fg("muted", `◌${snapshot.untracked}`));
332
336
  if (f.conflicted && snapshot.conflicted > 0) changesSection.push(t.fg("error", `!${snapshot.conflicted}`));
333
337
 
334
338
  const extraSection: string[] = [];
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstpick/pi-extension-git-footer-status",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Enhanced Pi footer with git status, token usage, context usage, and model telemetry.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -15,9 +15,9 @@
15
15
  ]
16
16
  },
17
17
  "peerDependencies": {
18
- "@mariozechner/pi-coding-agent": "*",
19
- "@mariozechner/pi-ai": "*",
20
- "@mariozechner/pi-tui": "*"
18
+ "@earendil-works/pi-coding-agent": "*",
19
+ "@earendil-works/pi-ai": "*",
20
+ "@earendil-works/pi-tui": "*"
21
21
  },
22
22
  "files": [
23
23
  "index.ts",