@firstpick/pi-extension-git-footer-status 0.1.9 → 0.2.0

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 (2) hide show
  1. package/index.ts +29 -2
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -3,7 +3,13 @@ import { homedir } from "node:os";
3
3
  import { isAbsolute, resolve, sep } from "node:path";
4
4
  import type { AssistantMessage } from "@earendil-works/pi-ai";
5
5
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
6
- import { formatTokens, estimatePromptInjectionTokens, estimateTokensFromCharCount } from "@firstpick/pi-utils";
6
+ import {
7
+ collectInitialPromptCalibration,
8
+ estimateInitialPromptInput,
9
+ estimateTokensFromCharCount,
10
+ formatTokens,
11
+ type InitialPromptToolInfo,
12
+ } from "@firstpick/pi-utils";
7
13
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
8
14
 
9
15
  type GitSnapshot = {
@@ -483,7 +489,28 @@ export default function gitFooterStatus(pi: ExtensionAPI) {
483
489
  latestTokenSpeed = historicalTokenSpeed;
484
490
  }
485
491
 
486
- const promptInjectionTokens = estimatePromptInjectionTokens(ctx.getSystemPrompt());
492
+ let activeTools: string[] = [];
493
+ let allTools: InitialPromptToolInfo[] = [];
494
+ try {
495
+ activeTools = pi.getActiveTools();
496
+ } catch {
497
+ activeTools = [];
498
+ }
499
+ try {
500
+ allTools = pi.getAllTools().map((tool) => ({
501
+ name: tool.name,
502
+ description: tool.description,
503
+ parameters: tool.parameters,
504
+ }));
505
+ } catch {
506
+ allTools = [];
507
+ }
508
+ const promptInjectionTokens = estimateInitialPromptInput({
509
+ systemPrompt: ctx.getSystemPrompt(),
510
+ activeTools,
511
+ allTools,
512
+ calibration: collectInitialPromptCalibration(ctx.sessionManager.getSessionDir()),
513
+ }).total;
487
514
 
488
515
  const contextUsage = ctx.getContextUsage();
489
516
  const contextWindow = contextUsage?.contextWindow ?? ctx.model?.contextWindow ?? 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstpick/pi-extension-git-footer-status",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Enhanced Pi footer with git status, token usage, context usage, and model telemetry.",
5
5
  "license": "MIT",
6
6
  "keywords": [