pi-claude-code-ui 1.0.75 → 1.0.77

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  > [!IMPORTANT]
4
4
  > **1.0.69 — package rename (permanent).** Canonical npm name is now [`pi-claude-code-ui`](https://www.npmjs.com/package/pi-claude-code-ui). `pi-claude-style-tools` is legacy and will not receive further releases. Install with `pi install npm:pi-claude-code-ui` or `npm i pi-claude-code-ui`.
5
5
 
6
+ ## 1.0.77 — 2026-08-21
7
+
8
+ ### Fixed
9
+
10
+ - **Dynamic Turn Took lines** — the end line `✻ Turn took xs` is now rendered dynamically in the Terminal UI instead of being baked into the message text content. This avoids polluting saved session databases and other UIs (like VSCode or web interfaces), and prevents interference with tools like TPS counters that read the message text.
11
+
12
+ ## 1.0.76 — 2026-08-07
13
+
14
+ ### Fixed
15
+
16
+ - **Hide transient context tags** — hide transient context tags in streaming prose.
17
+
6
18
  ## 1.0.75 — 2026-07-29
7
19
 
8
20
  ### Fixed
@@ -1408,14 +1408,7 @@ function hasWorkedDurationLine(message: any): boolean {
1408
1408
  });
1409
1409
  }
1410
1410
 
1411
- function appendWorkedDurationLine(message: any, durationMs: number, sessionTotalMs?: number, turns?: number): void {
1412
- if (!message || message.role !== "assistant" || !Array.isArray(message.content)) return;
1413
- const textBlocks = message.content.filter((block: any) => block?.type === "text" && typeof block.text === "string" && block.text.trim());
1414
- const lastText = textBlocks[textBlocks.length - 1];
1415
- if (!lastText) return;
1416
- const text = lastText.text.includes(WORKED_DURATION_MARKER) ? stripWorkedDurationLine(lastText.text) : lastText.text;
1417
- lastText.text = `${text.trimEnd()}\n\n${inlineWorkedDurationText(durationMs, sessionTotalMs, turns)}`;
1418
- }
1411
+
1419
1412
 
1420
1413
  type MarkdownThemeLike = ConstructorParameters<typeof Markdown>[3];
1421
1414
 
@@ -1494,6 +1487,15 @@ function hasInlineMathMarkers(text: string): boolean {
1494
1487
  return text.includes("\\(") || text.includes("$");
1495
1488
  }
1496
1489
 
1490
+ // Magic Context prefixes live assistant text with §N§ while the response is
1491
+ // streaming and removes that metadata on message_end. Keep the transient tag
1492
+ // out of the display without mutating the message used by context management.
1493
+ const MAGIC_CONTEXT_TAG_LINE_PREFIX = /(^|\r?\n)[ \t]*(?:§\d+§[ \t]*)+/g;
1494
+
1495
+ function stripTransientMagicContextTags(text: string): string {
1496
+ return text.replace(MAGIC_CONTEXT_TAG_LINE_PREFIX, "$1");
1497
+ }
1498
+
1497
1499
  function replaceInlineMath(text: string): string {
1498
1500
  if (!hasInlineMathMarkers(text)) return text;
1499
1501
  const withParens = text.replace(/\\\(([\s\S]*?)\\\)/g, (_match, body: string) => {
@@ -1702,7 +1704,7 @@ class DottedParagraph {
1702
1704
 
1703
1705
  constructor(text: string, markdownTheme: MarkdownThemeLike) {
1704
1706
  this.markdownTheme = copySafeMarkdownTheme(markdownTheme);
1705
- this.segments = buildParagraphSegments(text, this.markdownTheme);
1707
+ this.segments = buildParagraphSegments(stripTransientMagicContextTags(text), this.markdownTheme);
1706
1708
  }
1707
1709
 
1708
1710
  invalidate(): void {
@@ -4841,15 +4843,14 @@ function registerThinkingLabels(pi: ExtensionAPI): void {
4841
4843
  (message as any)[WORKED_DURATION_KEY] = durationMs;
4842
4844
  if (typeof sessionTotalMs === "number") (message as any)[WORKED_SESSION_TOTAL_KEY] = sessionTotalMs;
4843
4845
  if (typeof turns === "number") (message as any)[WORKED_TURNS_KEY] = turns;
4844
- // Mutate the message itself before pi renders/persists it. This is more
4845
- // reliable than the spinner because pi removes the loader on agent_end,
4846
- // and more reliable than component monkey-patching when extensions are
4847
- // loaded from a different package instance than the running TUI.
4848
- appendWorkedDurationLine(message, durationMs, sessionTotalMs, turns);
4849
4846
  }
4850
4847
  currentAssistantMessageStartMs = undefined;
4851
4848
  }
4852
4849
  patchMessage(event, ctx.ui?.theme);
4850
+ try {
4851
+ (ctx as any)?.ui?.invalidate?.();
4852
+ (ctx as any)?.ui?.requestRender?.();
4853
+ } catch { /* noop */ }
4853
4854
  });
4854
4855
  pi.on("agent_end", async () => {
4855
4856
  currentAgentWorkStartMs = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-claude-code-ui",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "Claude Code-style grouped tool rows for pi with Ctrl+O/Ctrl+Shift+O previews, math rendering, and consistent built-in, MCP, and custom tool rendering",
5
5
  "keywords": [
6
6
  "pi-package",