pi-bar 0.3.18 → 0.3.20
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 +2 -2
- package/extensions/status-footer.ts +51 -15
- package/package.json +2 -2
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
|
-

|
|
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 recent prompt, assistant, and deterministic code-compressed tool facts (for example `bash ... ok`, `grep ... 4 matches`, `
|
|
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`, `read file`, or `custom_tool key=value ok`). 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
|
|
|
@@ -53,6 +53,7 @@ type TldrActivity = {
|
|
|
53
53
|
activityType: TldrActivityType;
|
|
54
54
|
displayPriority: TldrDisplayPriority;
|
|
55
55
|
text: string;
|
|
56
|
+
toolCallId?: string;
|
|
56
57
|
};
|
|
57
58
|
type TldrCheckpoint = {
|
|
58
59
|
activityIndex: number;
|
|
@@ -365,12 +366,18 @@ function usefulLineCount(text: string): number {
|
|
|
365
366
|
.filter(Boolean).length;
|
|
366
367
|
}
|
|
367
368
|
|
|
369
|
+
const ERROR_LINE_PATTERN = /(error|failed|TS\d+|E[A-Z]+\d*|Command exited|denied|refused|aborted|panic|fatal|exception)/i;
|
|
370
|
+
|
|
368
371
|
function errorSummary(text: string | undefined): string | undefined {
|
|
369
372
|
if (!text) return undefined;
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
373
|
+
const cleaned = text.replace(ANSI_PATTERN, "");
|
|
374
|
+
const lines = cleaned
|
|
375
|
+
.split("\n")
|
|
376
|
+
.map((line) => line.trim())
|
|
377
|
+
.filter(Boolean);
|
|
378
|
+
if (lines.length === 0) return undefined;
|
|
379
|
+
const matched = lines.find((line) => ERROR_LINE_PATTERN.test(line)) ?? lines[lines.length - 1];
|
|
380
|
+
return truncateText(compactText(matched), MAX_TOOL_RESULT_ERROR_CHARS);
|
|
374
381
|
}
|
|
375
382
|
|
|
376
383
|
function summarizeToolResult(
|
|
@@ -388,7 +395,7 @@ function summarizeToolResult(
|
|
|
388
395
|
case "bash":
|
|
389
396
|
return undefined;
|
|
390
397
|
case "read":
|
|
391
|
-
return path ?
|
|
398
|
+
return path ? `read ${path}` : undefined;
|
|
392
399
|
case "edit":
|
|
393
400
|
return path ? `edited ${path}` : undefined;
|
|
394
401
|
case "write":
|
|
@@ -400,7 +407,7 @@ function summarizeToolResult(
|
|
|
400
407
|
case "ls":
|
|
401
408
|
return lineCount ? `${lineCount} entries` : undefined;
|
|
402
409
|
default:
|
|
403
|
-
return
|
|
410
|
+
return undefined;
|
|
404
411
|
}
|
|
405
412
|
}
|
|
406
413
|
|
|
@@ -442,20 +449,32 @@ class TldrFactCollector {
|
|
|
442
449
|
const record = message as Record<string, unknown>;
|
|
443
450
|
if (record.role !== "assistant") return undefined;
|
|
444
451
|
const text = extractTextContent(record.content as readonly unknown[] | undefined);
|
|
445
|
-
return
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
+
if (!text) return undefined;
|
|
453
|
+
|
|
454
|
+
// Streaming emits many partial updates per message. Keep only the latest by
|
|
455
|
+
// dropping the previous assistant_update so the model sees one accurate snapshot.
|
|
456
|
+
const last = this.activities[this.activities.length - 1];
|
|
457
|
+
if (last?.activityType === "assistant_update") {
|
|
458
|
+
this.activities.pop();
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
return this.addActivity(
|
|
462
|
+
"assistant_update",
|
|
463
|
+
"normal",
|
|
464
|
+
`assistant: ${tailText(text, MAX_ASSISTANT_UPDATE_CHARS)}`,
|
|
465
|
+
);
|
|
452
466
|
}
|
|
453
467
|
|
|
454
|
-
recordToolCall(event: {
|
|
468
|
+
recordToolCall(event: {
|
|
469
|
+
toolName: string;
|
|
470
|
+
input?: Record<string, unknown>;
|
|
471
|
+
toolCallId?: string;
|
|
472
|
+
}): TldrActivity {
|
|
455
473
|
return this.addActivity(
|
|
456
474
|
"tool_call",
|
|
457
475
|
"normal",
|
|
458
476
|
`tool: ${compactToolInput(event.toolName, event.input)}`,
|
|
477
|
+
event.toolCallId,
|
|
459
478
|
);
|
|
460
479
|
}
|
|
461
480
|
|
|
@@ -465,6 +484,7 @@ class TldrFactCollector {
|
|
|
465
484
|
isError?: boolean;
|
|
466
485
|
content?: readonly unknown[];
|
|
467
486
|
details?: unknown;
|
|
487
|
+
toolCallId?: string;
|
|
468
488
|
}): TldrActivity {
|
|
469
489
|
const isError = Boolean(event.isError);
|
|
470
490
|
const resultText = summarizeToolResult(
|
|
@@ -475,12 +495,25 @@ class TldrFactCollector {
|
|
|
475
495
|
);
|
|
476
496
|
const status = isError ? "error" : "ok";
|
|
477
497
|
const tool = compactToolInput(event.toolName, event.input);
|
|
498
|
+
|
|
499
|
+
// Result fact subsumes the prior tool_call fact for the same call. Drop the
|
|
500
|
+
// matching tool_call so the model sees one combined fact instead of two.
|
|
501
|
+
if (event.toolCallId) {
|
|
502
|
+
const idx = this.activities.findIndex(
|
|
503
|
+
(activity) =>
|
|
504
|
+
activity.activityType === "tool_call" &&
|
|
505
|
+
activity.toolCallId === event.toolCallId,
|
|
506
|
+
);
|
|
507
|
+
if (idx !== -1) this.activities.splice(idx, 1);
|
|
508
|
+
}
|
|
509
|
+
|
|
478
510
|
return this.addActivity(
|
|
479
511
|
"tool_result",
|
|
480
512
|
"normal",
|
|
481
513
|
resultText
|
|
482
514
|
? `result: ${tool} ${status}; ${resultText}`
|
|
483
515
|
: `result: ${tool} ${status}`,
|
|
516
|
+
event.toolCallId,
|
|
484
517
|
);
|
|
485
518
|
}
|
|
486
519
|
|
|
@@ -538,12 +571,14 @@ class TldrFactCollector {
|
|
|
538
571
|
activityType: TldrActivityType,
|
|
539
572
|
displayPriority: TldrDisplayPriority,
|
|
540
573
|
text: string,
|
|
574
|
+
toolCallId?: string,
|
|
541
575
|
): TldrActivity {
|
|
542
576
|
const activity = {
|
|
543
577
|
index: this.nextIndex,
|
|
544
578
|
activityType,
|
|
545
579
|
displayPriority,
|
|
546
580
|
text: truncateText(text, MAX_ACTIVITY_TEXT_CHARS),
|
|
581
|
+
toolCallId,
|
|
547
582
|
};
|
|
548
583
|
this.nextIndex++;
|
|
549
584
|
this.activities.push(activity);
|
|
@@ -600,7 +635,7 @@ class FooterTldrEngine {
|
|
|
600
635
|
|
|
601
636
|
recordToolCall(
|
|
602
637
|
ctx: ExtensionContext,
|
|
603
|
-
event: { toolName: string; input?: Record<string, unknown
|
|
638
|
+
event: { toolName: string; input?: Record<string, unknown>; toolCallId?: string },
|
|
604
639
|
): void {
|
|
605
640
|
this.enqueue(ctx, this.facts.recordToolCall(event));
|
|
606
641
|
}
|
|
@@ -613,6 +648,7 @@ class FooterTldrEngine {
|
|
|
613
648
|
isError?: boolean;
|
|
614
649
|
content?: readonly unknown[];
|
|
615
650
|
details?: unknown;
|
|
651
|
+
toolCallId?: string;
|
|
616
652
|
},
|
|
617
653
|
): void {
|
|
618
654
|
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.
|
|
3
|
+
"version": "0.3.20",
|
|
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.
|
|
54
|
+
"image": "https://cdn.jsdelivr.net/npm/pi-bar@0.3.20/assets/screenshot.png"
|
|
55
55
|
}
|
|
56
56
|
}
|