pi-cc-extensions 0.8.13 → 0.8.14

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.
@@ -1,7 +1,7 @@
1
1
  import { createWriteToolDefinition, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
2
  import { truncateToWidth } from "@earendil-works/pi-tui";
3
3
  import { renderEditDiffResult, renderWriteDiffResult } from "./diff-renderer.ts";
4
- import { DEFAULT_TOOL_DISPLAY_CONFIG } from "./types.ts";
4
+ import { DEFAULT_TOOL_DISPLAY_CONFIG, type ToolDisplayConfig } from "./types.ts";
5
5
  import { executeWriteWithMetadata, WriteExecutionMetadataStore } from "./write-execution.ts";
6
6
 
7
7
  function resultText(result: any): string {
@@ -34,6 +34,7 @@ export function renderRichToolResult(
34
34
  theme: any,
35
35
  context: any,
36
36
  writeMetadata: WriteExecutionMetadataStore,
37
+ displayConfig: ToolDisplayConfig = DEFAULT_TOOL_DISPLAY_CONFIG,
37
38
  ): any | undefined {
38
39
  if (options?.isPartial || options?.isError || context?.isError) return undefined;
39
40
  const expanded = options?.expanded === true || context?.expanded === true;
@@ -42,7 +43,7 @@ export function renderRichToolResult(
42
43
  return renderEditDiffResult(
43
44
  result?.details,
44
45
  { expanded, filePath },
45
- DEFAULT_TOOL_DISPLAY_CONFIG,
46
+ displayConfig,
46
47
  theme,
47
48
  resultText(result),
48
49
  );
@@ -64,7 +65,7 @@ export function renderRichToolResult(
64
65
  previousContent: metadata.previousContent,
65
66
  fileExistedBeforeWrite: metadata.fileExistedBeforeWrite,
66
67
  },
67
- DEFAULT_TOOL_DISPLAY_CONFIG,
68
+ displayConfig,
68
69
  theme,
69
70
  resultText(result),
70
71
  );
@@ -103,4 +104,10 @@ export function installWriteOverride(
103
104
  return store;
104
105
  }
105
106
 
106
- export { DEFAULT_TOOL_DISPLAY_CONFIG, WriteExecutionMetadataStore };
107
+ export {
108
+ DEFAULT_TOOL_DISPLAY_CONFIG,
109
+ type ToolDisplayConfig,
110
+ type DiffViewMode,
111
+ type DiffIndicatorMode,
112
+ } from "./types.ts";
113
+ export { WriteExecutionMetadataStore } from "./write-execution.ts";
@@ -14,7 +14,13 @@ export const DEFAULT_TOOL_DISPLAY_CONFIG: ToolDisplayConfig = {
14
14
  diffViewMode: "auto",
15
15
  diffIndicatorMode: "bars",
16
16
  diffSplitMinWidth: 120,
17
+ /** Collapsed tool/diff body: ~half a typical terminal after chrome. */
17
18
  diffCollapsedLines: 24,
18
19
  diffWordWrap: true,
19
- expandedPreviewMaxLines: 4000,
20
+ /**
21
+ * Expanded tool/diff body cap. 40 ≈ one screen of content after title,
22
+ * Input section, editor, and status — keeps the TUI compact.
23
+ * Raise via /ccstyle → Diff → Expanded max lines when reviewing large dumps.
24
+ */
25
+ expandedPreviewMaxLines: 40,
20
26
  };
@@ -6,9 +6,16 @@ const UNSAFE_TERMINAL_ESCAPE = new RegExp(
6
6
  "g",
7
7
  );
8
8
 
9
- /** Prevent captured terminal control responses from being replayed by tool renderers. */
10
- export function sanitizeToolResultText(value: string): string {
11
- return value
9
+ /**
10
+ * Prevent captured terminal control responses from being replayed by tool renderers.
11
+ * Optional `maxChars` trims the input first so preview/one-line paths never scan multi-MB outputs.
12
+ */
13
+ export function sanitizeToolResultText(value: string, maxChars?: number): string {
14
+ const source =
15
+ typeof maxChars === "number" && maxChars >= 0 && value.length > maxChars
16
+ ? value.slice(0, maxChars)
17
+ : value;
18
+ return source
12
19
  .replace(UNSAFE_TERMINAL_ESCAPE, "")
13
20
  .replace(/\x1B/g, "")
14
21
  .replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, "")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cc-extensions",
3
- "version": "0.8.13",
3
+ "version": "0.8.14",
4
4
  "description": "A Pi productivity suite with Claude Code-style UI, structured questionnaires, context inspection, and agent/session references",
5
5
  "type": "module",
6
6
  "keywords": [