@xynogen/pix-display 0.1.10 → 0.1.11

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
@@ -1,3 +1,5 @@
1
+ <!-- markdownlint-disable MD013 -->
2
+
1
3
  # pix-display
2
4
 
3
5
  Pi core extension — paste chips, thinking blocks, and polished code snippets.
@@ -12,7 +14,7 @@ Three features, always on when installed:
12
14
 
13
15
  **Code snippets.** Renders every fenced code block in assistant responses inside a themed, language-labeled frame—including Python, TypeScript, JSON, YAML, Rust, Go, SQL, shell, and arbitrary custom language tags. Untagged fences use a `code` label. Pi's native syntax highlighting remains intact for recognized languages, while long lines are safely clipped to the terminal width.
14
16
 
15
- The features are registered at session start. TUI-only display changes are no-ops in JSON/RPC/print modes.
17
+ The features are registered at session start. TUI-only display changes are no-ops in JSON/RPC/print modes. In-process non-TUI child sessions (such as background subagents) do not clear the parent TUI's renderer state.
16
18
 
17
19
  ## Install
18
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-display",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Pi core extension \u2014 paste chips, thinking blocks, and framed code rendering",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -13,6 +13,7 @@ const OSC_RE = /\x1b\][^\x07]*(?:\x07|\x1b\\)/g;
13
13
  const PATCHED = Symbol.for("@xynogen/pix-display:code-block-renderer");
14
14
 
15
15
  type CodeFrameTheme = Pick<Theme, "bg" | "bold" | "fg" | "getBgAnsi">;
16
+ type RenderMode = "tui" | "rpc" | "json" | "print";
16
17
 
17
18
  type PatchablePrototype = {
18
19
  [PATCHED]?: boolean;
@@ -21,6 +22,20 @@ type PatchablePrototype = {
21
22
 
22
23
  let activeTheme: CodeFrameTheme | undefined;
23
24
 
25
+ /**
26
+ * Preserve the main TUI theme when an in-process non-TUI child session starts.
27
+ * Subagents share this module and the patched prototype with the parent; letting
28
+ * their print/RPC session clear the theme silently disables code frames in the
29
+ * still-running parent transcript.
30
+ */
31
+ export function themeAfterSessionStart(
32
+ current: CodeFrameTheme | undefined,
33
+ mode: RenderMode,
34
+ theme: CodeFrameTheme,
35
+ ): CodeFrameTheme | undefined {
36
+ return mode === "tui" ? theme : current;
37
+ }
38
+
24
39
  function plainText(line: string): string {
25
40
  return line.replace(OSC_RE, "").replace(ANSI_RE, "");
26
41
  }
@@ -149,6 +164,6 @@ function patchAssistantRenderer(): void {
149
164
  export default function codeBlocksExtension(pi: ExtensionAPI): void {
150
165
  patchAssistantRenderer();
151
166
  pi.on("session_start", (_event, ctx) => {
152
- activeTheme = ctx.mode === "tui" ? ctx.ui.theme : undefined;
167
+ activeTheme = themeAfterSessionStart(activeTheme, ctx.mode, ctx.ui.theme);
153
168
  });
154
169
  }