pi-bar 0.3.15 → 0.3.17

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 CHANGED
@@ -9,7 +9,7 @@
9
9
  claude-opus-4.7 ❯ think:med ❯ 2.6% / 1.0M ❯ Inspecting package structure ❯ plan:active
10
10
  ```
11
11
 
12
- ![pi-bar screenshot, three rows showing green, yellow, and red context usage](https://cdn.jsdelivr.net/npm/pi-bar@0.3.15/assets/screenshot.png)
12
+ ![pi-bar screenshot, three rows showing green, yellow, and red context usage](https://cdn.jsdelivr.net/npm/pi-bar@0.3.17/assets/screenshot.png)
13
13
 
14
14
  ## Why use it?
15
15
 
@@ -48,7 +48,7 @@ Allowed segments are `model`, `thinking`, `context`, `tldr`, and `extensions`. T
48
48
 
49
49
  ### Configure live TLDR
50
50
 
51
- pi-bar shows a concise live TLDR of the current task in the footer. It generates TLDRs from compacted recent prompt, assistant, tool, and result activity. It resets when you navigate the session tree so stale summaries do not follow you across branches. Set `PI_BAR_SHOW` without `tldr` to hide it.
51
+ pi-bar shows a concise live TLDR of the current task in the footer. It generates TLDRs from recent prompt, assistant, and deterministic code-compressed tool facts (for example `bash ... ok`, `grep ... 4 matches`, or `edit file`). It resets when you navigate the session tree so stale summaries do not follow you across branches. Set `PI_BAR_SHOW` without `tldr` to hide it.
52
52
 
53
53
  Override the TLDR model with:
54
54
 
@@ -77,8 +77,8 @@ const SETTINGS_BAR_KEY = "bar";
77
77
  const MAX_ACTIVITY_TEXT_CHARS = 800;
78
78
  const MAX_USER_TEXT_CHARS = 700;
79
79
  const MAX_ASSISTANT_UPDATE_CHARS = 500;
80
- const MAX_TOOL_RESULT_OK_CHARS = 500;
81
- const MAX_TOOL_RESULT_ERROR_CHARS = 900;
80
+ const MAX_TOOL_RESULT_OK_CHARS = 160;
81
+ const MAX_TOOL_RESULT_ERROR_CHARS = 320;
82
82
  const MAX_FINAL_TEXT_CHARS = 700;
83
83
  const MAX_RETAINED_RAW_ACTIVITIES = 128;
84
84
  const ANSI_PATTERN = /\x1B\[[0-?]*[ -/]*[@-~]/g;
@@ -347,11 +347,50 @@ function compactToolInput(toolName: string, input: Record<string, unknown> | und
347
347
  }
348
348
  }
349
349
 
350
- function compactToolResultText(text: string | undefined, isError: boolean): string | undefined {
350
+ function usefulLineCount(text: string): number {
351
+ return text
352
+ .split("\n")
353
+ .map((line) => line.trim())
354
+ .filter(Boolean).length;
355
+ }
356
+
357
+ function errorSummary(text: string | undefined): string | undefined {
351
358
  if (!text) return undefined;
352
359
  const compacted = compactText(text);
353
- const maxChars = isError ? MAX_TOOL_RESULT_ERROR_CHARS : MAX_TOOL_RESULT_OK_CHARS;
354
- return isError ? truncateText(compacted, maxChars) : tailText(compacted, maxChars);
360
+ const exitMatch = compacted.match(/Command exited with code \d+/);
361
+ if (exitMatch) return truncateText(exitMatch[0], MAX_TOOL_RESULT_ERROR_CHARS);
362
+ return truncateText(compacted, MAX_TOOL_RESULT_ERROR_CHARS);
363
+ }
364
+
365
+ function summarizeToolResult(
366
+ toolName: string,
367
+ input: Record<string, unknown> | undefined,
368
+ text: string | undefined,
369
+ isError: boolean,
370
+ ): string | undefined {
371
+ if (isError) return errorSummary(text);
372
+
373
+ const lineCount = text ? usefulLineCount(text) : 0;
374
+ const path = compactValue(input?.path ?? input?.filePath ?? input?.cwd, 120);
375
+
376
+ switch (toolName) {
377
+ case "bash":
378
+ return undefined;
379
+ case "read":
380
+ return path ? `${lineCount || "file"} lines from ${path}` : undefined;
381
+ case "edit":
382
+ return path ? `edited ${path}` : undefined;
383
+ case "write":
384
+ return path ? `wrote ${path}` : undefined;
385
+ case "grep":
386
+ return lineCount ? `${lineCount} matches` : "no matches";
387
+ case "find":
388
+ return lineCount ? `${lineCount} paths` : "no paths";
389
+ case "ls":
390
+ return lineCount ? `${lineCount} entries` : undefined;
391
+ default:
392
+ return lineCount ? `${lineCount} output lines` : undefined;
393
+ }
355
394
  }
356
395
 
357
396
  function extractTextContent(content: readonly unknown[] | undefined): string | undefined {
@@ -414,9 +453,15 @@ class TldrFactCollector {
414
453
  input?: Record<string, unknown>;
415
454
  isError?: boolean;
416
455
  content?: readonly unknown[];
456
+ details?: unknown;
417
457
  }): TldrActivity {
418
458
  const isError = Boolean(event.isError);
419
- const resultText = compactToolResultText(extractTextContent(event.content), isError);
459
+ const resultText = summarizeToolResult(
460
+ event.toolName,
461
+ event.input,
462
+ extractTextContent(event.content),
463
+ isError,
464
+ );
420
465
  const status = isError ? "error" : "ok";
421
466
  const tool = compactToolInput(event.toolName, event.input);
422
467
  return this.addActivity(
@@ -556,6 +601,7 @@ class FooterTldrEngine {
556
601
  input?: Record<string, unknown>;
557
602
  isError?: boolean;
558
603
  content?: readonly unknown[];
604
+ details?: unknown;
559
605
  },
560
606
  ): void {
561
607
  this.enqueue(ctx, this.facts.recordToolResult(event));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bar",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "Pi footer/statusline showing active model, thinking level, context pressure, live TLDR, and extension statuses.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -51,6 +51,6 @@
51
51
  "extensions": [
52
52
  "./extensions/status-footer.ts"
53
53
  ],
54
- "image": "https://cdn.jsdelivr.net/npm/pi-bar@0.3.15/assets/screenshot.png"
54
+ "image": "https://cdn.jsdelivr.net/npm/pi-bar@0.3.17/assets/screenshot.png"
55
55
  }
56
56
  }