pi-bar 0.3.20 → 0.3.21

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.20/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.21/assets/screenshot.png)
13
13
 
14
14
  ## Why use it?
15
15
 
@@ -777,7 +777,8 @@ class FooterTldrEngine {
777
777
  );
778
778
  if (!this.isCurrentJob(job) || response.stopReason !== "stop") return;
779
779
 
780
- const text = extractTextContent(response.content) ?? "";
780
+ const rawText = extractTextContent(response.content) ?? "";
781
+ const text = sanitizeTldrText(rawText);
781
782
  if (!text) return;
782
783
  const checkpoint = {
783
784
  activityIndex: job.activityIndex,
@@ -862,13 +863,13 @@ class FooterTldrEngine {
862
863
  {
863
864
  type: "text",
864
865
  text: [
865
- "Previous generated TLDR checkpoints:",
866
+ "Prior TLDRs (context only, do not copy phrasing):",
866
867
  previousCheckpointLines(this.acceptedCheckpoints),
867
868
  "",
868
- "New raw activity since the latest accepted checkpoint:",
869
+ "New activity to summarize:",
869
870
  ...rawActivities.map(formatRawActivity),
870
871
  "",
871
- `Write the next TLDR through activity ${job.activityIndex}.`,
872
+ "Write the next TLDR.",
872
873
  ].join("\n"),
873
874
  },
874
875
  ],
@@ -884,14 +885,16 @@ function checkpointSystemPrompt(job: TldrCheckpointJob): string {
884
885
  : "Start with a present-tense -ing verb.";
885
886
  return `Write one plain-English TLDR for a terminal coding agent.
886
887
  Use the prior TLDRs for context and the new activity for the update.
887
- Summarize only activity up to the requested index.
888
+ Summarize the current state of work; do not narrate the history.
888
889
  If context is sparse, still summarize the available activity.
889
890
  Never ask for more information or say there is not enough context.
890
891
  Return one concise status fragment under ${TLDR_TARGET_SUMMARY_CHARS} characters.
891
892
  Omit subjects like "the agent" or "it".
892
893
  Prefer verb + direct object. Include outcome only if important.
893
894
  Do not address the user.
894
- Plain text only; no markdown, JSON, code, bullets, quotes, or file/tool names.
895
+ Do not mention activity numbers, indexes, checkpoints, prior TLDRs, or phrases like "through activity".
896
+ Output only the status fragment itself. No prefixes, labels, bullets, or quotes.
897
+ Plain text only; no markdown, JSON, code, file paths, or tool names.
895
898
  ${tenseInstruction}`;
896
899
  }
897
900
 
@@ -899,12 +902,28 @@ function previousCheckpointLines(checkpoints: readonly TldrCheckpoint[]): string
899
902
  if (checkpoints.length === 0) return "none";
900
903
  return checkpoints
901
904
  .slice(-MAX_CONTEXT_CHECKPOINTS)
902
- .map((checkpoint) => `- Through activity ${checkpoint.activityIndex}: ${checkpoint.text}`)
905
+ .map((checkpoint) => `- ${sanitizeTldrText(checkpoint.text)}`)
903
906
  .join("\n");
904
907
  }
905
908
 
906
909
  function formatRawActivity(activity: TldrActivity): string {
907
- return `[${activity.index}] ${activity.text}`;
910
+ return `- ${activity.text}`;
911
+ }
912
+
913
+ const LEAKED_PREFIX_PATTERN =
914
+ /^\s*(?:[-*•]\s*)?(?:(?:through\s+activity|activity|checkpoint|tldr|summary)\s*[#:\-—–]?\s*\d*[:\.\-—–]?\s*)+/i;
915
+
916
+ const LEADING_PUNCT_PATTERN = /^[\s\-—–•*:#.,;]+/;
917
+
918
+ function sanitizeTldrText(text: string): string {
919
+ let cleaned = text.trim();
920
+ let previous: string;
921
+ do {
922
+ previous = cleaned;
923
+ cleaned = cleaned.replace(LEAKED_PREFIX_PATTERN, "").trim();
924
+ cleaned = cleaned.replace(LEADING_PUNCT_PATTERN, "").trim();
925
+ } while (cleaned !== previous && cleaned.length > 0);
926
+ return cleaned || text.trim();
908
927
  }
909
928
 
910
929
  function shouldShowStatus(key: string, filter: StatusFilter): boolean {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bar",
3
- "version": "0.3.20",
3
+ "version": "0.3.21",
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.20/assets/screenshot.png"
54
+ "image": "https://cdn.jsdelivr.net/npm/pi-bar@0.3.21/assets/screenshot.png"
55
55
  }
56
56
  }