pi-claude-code-ui 1.0.78 → 1.0.79

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,12 @@
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.79 — 2026-08-23
7
+
8
+ ### Fixed
9
+
10
+ - **Hide Magic Context tags in tool output** — tool result renderers now receive sanitized text, so transient `§N§` tags (including live-prefixed streaming chunks and queued ctx_reduce output replayed from history) no longer appear in tool rows. Storage is never mutated — result blocks are cloned only when a tag is present, so context management keeps its data. Also covers the `formatToolExecution` fallback path for renderer-less tools.
11
+
6
12
  ## 1.0.78 — 2026-08-22
7
13
 
8
14
  ### Fixed
@@ -1496,6 +1496,26 @@ function stripTransientMagicContextTags(text: string): string {
1496
1496
  return text.replace(MAGIC_CONTEXT_TAG_LINE_PREFIX, "$1");
1497
1497
  }
1498
1498
 
1499
+ // Tool results can carry transient Magic Context tags too (live-prefixed output
1500
+ // chunks). Renderers must see sanitized text WITHOUT mutating this.result — the
1501
+ // result object is the stored message used by context management. Clone blocks
1502
+ // only when a tag is actually present so the common path stays zero-cost.
1503
+ function sanitizeToolResultForDisplay(result: any): any {
1504
+ if (!result || !Array.isArray(result.content)) return result;
1505
+ let changed = false;
1506
+ const content = result.content.map((block: any) => {
1507
+ if (block && typeof block.text === "string") {
1508
+ const stripped = stripTransientMagicContextTags(block.text);
1509
+ if (stripped !== block.text) {
1510
+ changed = true;
1511
+ return { ...block, text: stripped };
1512
+ }
1513
+ }
1514
+ return block;
1515
+ });
1516
+ return changed ? { ...result, content } : result;
1517
+ }
1518
+
1499
1519
  function replaceInlineMath(text: string): string {
1500
1520
  if (!hasInlineMathMarkers(text)) return text;
1501
1521
  const withParens = text.replace(/\\\(([\s\S]*?)\\\)/g, (_match, body: string) => {
@@ -2326,17 +2346,31 @@ function patchToolExecutionRenderers(): void {
2326
2346
 
2327
2347
  proto.getResultRenderer = function patchedGetResultRenderer() {
2328
2348
  const toolName = typeof this?.toolName === "string" ? this.toolName : "";
2349
+ let renderer: any;
2329
2350
  if (toolName === "apply_patch") {
2330
- return (result: any, options: any, theme: Theme, ctx: any) =>
2351
+ renderer = (result: any, options: any, theme: Theme, ctx: any) =>
2331
2352
  renderApplyPatchResult({ content: result.content, details: result.details }, options.isPartial, theme, ctx);
2332
- }
2333
- if (shouldUseGenericToolRenderer(toolName)) {
2334
- return (result: any, options: any, theme: Theme, ctx: any) =>
2353
+ } else if (shouldUseGenericToolRenderer(toolName)) {
2354
+ renderer = (result: any, options: any, theme: Theme, ctx: any) =>
2335
2355
  renderGenericToolResult(toolName, result, options, theme, ctx);
2356
+ } else {
2357
+ renderer = typeof originalGetResultRenderer === "function" ? originalGetResultRenderer.call(this) : undefined;
2336
2358
  }
2337
- return typeof originalGetResultRenderer === "function" ? originalGetResultRenderer.call(this) : undefined;
2359
+ if (typeof renderer !== "function") return renderer;
2360
+ // Strip transient Magic Context tags from the text the renderer sees,
2361
+ // without touching the stored result message.
2362
+ return (result: any, options: any, theme: Theme, ctx: any) => renderer(sanitizeToolResultForDisplay(result), options, theme, ctx);
2338
2363
  };
2339
2364
 
2365
+ // Fallback path for tools without a renderer definition formats raw text.
2366
+ const originalFormatToolExecution = proto.formatToolExecution;
2367
+ if (typeof originalFormatToolExecution === "function") {
2368
+ proto.formatToolExecution = function patchedFormatToolExecution(this: any, ...args: any[]) {
2369
+ const formatted = originalFormatToolExecution.apply(this, args);
2370
+ return typeof formatted === "string" ? stripTransientMagicContextTags(formatted) : formatted;
2371
+ };
2372
+ }
2373
+
2340
2374
  proto[TOOL_EXECUTION_PATCH_FLAG] = true;
2341
2375
  }
2342
2376
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-claude-code-ui",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
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",