pi-less-display0.6.3
A compact Pi coding agent transcript with collapsible turns, tool batches, command previews, and file diffs.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-less-display
A compact terminal transcript for the Pi coding agent, derived from MasuRii/pi-tool-display.
On Pi 1.7, the extension groups tool activity into foldable turns and batches. Each turn starts open and shows elapsed time in its header. Tool batches start collapsed. Expand a tool to inspect its output or diff. If Pi confirms the final answer during streaming, the activity collapses and the reply continues below it. Otherwise it collapses when the turn settles.
Features
- Foldable transcript activity with turn summaries, tool batches, one-line command previews, and status colors
- Compaction history with an expandable summary marker and the full active-branch transcript in chronological order
- Compact built-in tool rendering for
read,grep,find,ls,bash,edit, andwrite - MCP-aware rendering with hidden, summary, and preview modes
- Opt-in custom tool overrides for noisy extension tools, defaulting to generic rendering unless
kind: "mcp"is selected - Adaptive edit/write diffs with split or unified layouts, syntax highlighting, inline emphasis, and narrow-pane width clamping
- Workspace-scoped projected pending edit/write previews that show
pending edit,pending overwrite, andpending creatediffs while partial tool calls are still streaming - Progressive collapsed diff hints that shorten automatically on small terminal widths instead of overflowing
- Hashline-anchor diff gutters that preserve
LINE#HASHlabels from anchored read/edit output when those lines are rendered in diffs - Three presets:
opencode,balanced, andverbose - Thinking labels during streaming and final message rendering
- Optional native user message box with markdown-aware rendering and safer ANSI/background handling
- Per-tool ownership toggles so this extension can coexist with other renderer extensions
- Capability-aware settings that keep MCP and RTK-specific controls aligned with the current environment
- Adapter API for renderer consumers through the
pi-less-display/tool-display-api-consumersubpath export
Installation
npm
pi install npm:pi-less-display
GitHub
pi install git:github.com/YoungStar1994/pi-less-display@v0.6.3
Tested with Pi 1.7.0 and Node.js 22.19.0 or newer. Open /tool-display to configure the extension. If upgrading from pi-tool-display, disable the original extension in Pi's extension list to avoid duplicate renderers.
Local development
Run from this repository:
npm ci
npm run check
pi -e ./index.ts
To load the local checkout in future sessions, run pi install "$PWD" from the repository root.
会话活动折叠
运行时默认展开 Turn,标题显示从提问到整轮结束的耗时。折叠的工具批次显示调用数,以及运行、等待启动和失败状态。仅有一个工具运行时,批次会显示简短的调用预览。
点击批次可查看按类型统计的调用和明细。长批次会折叠较早连续成功的调用,保留最近五条、未完成项和失败项。点击 earlier calls 可查看较早记录,点击单条命令可查看脚本和输出。收到明确的最终答复信号时自动收起过程,正文继续显示在 Turn 下方。若提供方未给出信号,则在整轮结束时收起。若回复接着发起工具调用,过程区会恢复展开。
如需逐条显示,在 /tool-display 中关闭 Group transcript activity。
Usage
Interactive settings
Open the settings modal:
/tool-display
The modal exposes the day-to-day controls most people change regularly:
- preset profile
- transcript activity grouping
- read output mode
- grep/find/ls output mode
- MCP output mode (when MCP is available)
- preview line count
- bash collapsed line count
- diff layout mode
- native user message box toggle
Advanced options remain in config.json.
Direct commands
/tool-display show # Show the effective config summary
/tool-display reset # Reset to the default opencode preset
/tool-display preset opencode # Apply opencode preset
/tool-display preset balanced # Apply balanced preset
/tool-display preset verbose # Apply verbose preset
Tool display adapter API
Other extensions can opt into pi-less-display rendering without directly depending on its load order by importing the consumer helper:
import { decorateToolForDisplay, decorateMcpToolForDisplay } from "pi-less-display/tool-display-api-consumer";
decorateToolForDisplay(tool, adapter) applies the runtime decoration immediately when pi-less-display is loaded, or queues the decoration until the API becomes available. Use adapter options such as kind: "read" | "edit" | "mcp" | "generic" to select the renderer family; decorateMcpToolForDisplay(tool) is the shortcut for MCP-style tools.
Presets
| Preset | Read Output | Search Output | MCP Output | Bash Output | Preview Lines | Bash Lines |
|---|---|---|---|---|---|---|
opencode |
hidden | hidden | hidden | opencode | 8 | 10 |
balanced |
summary | count | summary | summary | 8 | 10 |
verbose |
preview | preview | preview | preview | 12 | 20 |
opencode(default): minimal inline-only display; tool results stay collapsedbalanced: compact summaries with line counts and match totals; bash shows line count onlyverbose: larger previews for read/search/MCP/bash output
Bash Output Modes
| Mode | Behavior |
|---|---|
opencode |
Classic collapsed output using bashCollapsedLines limit with expansion hint |
summary |
Shows only line count (e.g., "↳ 3 lines returned") — no output displayed |
preview |
Shows actual output lines using previewLines limit |
Configuration
Runtime configuration is stored at:
Default global path: ~/.pi/agent/extensions/pi-less-display/config.json
Actual global path: $PI_CODING_AGENT_DIR/extensions/pi-less-display/config.json when PI_CODING_AGENT_DIR is set
Until a new configuration is saved, pi-less-display reads an existing extensions/pi-tool-display/config.json from the same Pi agent directory. Saving settings writes the new path.
A starter template is included at config/config.example.json.
Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
debug |
boolean | false |
Opt-in file logging for extension diagnostics; missing values are treated as false |
registerToolOverrides |
object | all true |
Built-in tool ownership flags |
customToolOverrides |
object | {} |
Explicit opt-in rendering rules for non-built-in extension tools |
enableNativeUserMessageBox |
boolean | true |
Enable bordered user prompt rendering |
groupTranscriptActivity |
boolean | true |
Group transcript activity and collapse completed turns in the Pi 1.7 TUI |
readOutputMode |
string | "hidden" |
hidden, summary, or preview |
searchOutputMode |
string | "hidden" |
hidden, count, or preview |
mcpOutputMode |
string | "hidden" |
hidden, summary, or preview |
previewLines |
number | 8 |
Lines shown in collapsed preview mode |
expandedPreviewMaxLines |
number | 4000 |
Max preview lines when fully expanded |
bashOutputMode |
string | "opencode" |
opencode (collapse), summary (line count), or preview (show lines) |
bashCollapsedLines |
number | 10 |
Lines shown for collapsed bash output (opencode mode) |
diffViewMode |
string | "auto" |
auto, split, or unified |
diffIndicatorMode |
string | "bars" |
bars (vertical indicators), classic (+/- markers), or none |
diffSplitMinWidth |
number | 120 |
Minimum width before auto mode prefers split diffs |
diffCollapsedLines |
number | 24 |
Diff lines shown before collapsing |
diffWordWrap |
boolean | true |
Wrap long diff lines when needed |
showTruncationHints |
boolean | false |
Show truncation indicators for compacted output |
showRtkCompactionHints |
boolean | false |
Show RTK compaction hints when RTK metadata exists |
Tool ownership
Use registerToolOverrides to control which built-in tools this extension owns:
{
"registerToolOverrides": {
"read": true,
"grep": true,
"find": true,
"ls": true,
"bash": true,
"edit": true,
"write": true
}
}
Set any entry to false if another extension should handle that tool instead.
Changes to tool ownership take effect after
/reload.
Custom tool overrides
Use customToolOverrides when another extension registers a noisy top-level tool and you want pi-less-display to render that tool's call/result output. Custom overrides are explicit opt-in only: unlisted or disabled tools keep their original renderers.
{
"customToolOverrides": {
"ide_find_symbol": {
"enabled": true,
"kind": "generic",
"outputMode": "summary"
},
"custom_mcp_gateway": {
"enabled": true,
"kind": "mcp",
"outputMode": "preview"
}
}
}
Each entry supports:
| Field | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | true |
Whether pi-less-display should decorate this custom tool |
kind |
string | "generic" |
generic for plain compact output, or mcp for MCP-style call labels and result handling |
outputMode |
string | "summary" |
hidden, summary, or preview for this custom tool's result output |
Boolean shorthand is also accepted:
{
"customToolOverrides": {
"ide_find_symbol": true,
"noisy_tool_to_leave_alone": false
}
}
Notes:
- Built-in tool names (
read,grep,find,ls,bash,edit,write) are ignored here; useregisterToolOverridesfor those. genericcall rendering shows the tool name and argument count, then compacts the result according tooutputMode.mcpcall rendering understands MCP proxy-style arguments such astool,server,search,describe, andconnect.- Run
/reloadafter editing the overrides inconfig.json. Pi 1.7 resolves the renderer when it builds each tool row, including rows restored from a session.
Example config
{
"debug": false,
"registerToolOverrides": {
"read": true,
"grep": true,
"find": true,
"ls": true,
"bash": true,
"edit": true,
"write": true
},
"customToolOverrides": {
"ide_find_symbol": {
"enabled": true,
"kind": "generic",
"outputMode": "summary"
},
"custom_mcp_gateway": {
"enabled": true,
"kind": "mcp",
"outputMode": "preview"
}
},
"enableNativeUserMessageBox": true,
"readOutputMode": "summary",
"searchOutputMode": "count",
"mcpOutputMode": "summary",
"previewLines": 12,
"expandedPreviewMaxLines": 4000,
"bashOutputMode": "opencode",
"bashCollapsedLines": 15,
"diffViewMode": "auto",
"diffIndicatorMode": "bars",
"diffSplitMinWidth": 120,
"diffCollapsedLines": 24,
"diffWordWrap": true,
"showTruncationHints": false,
"showRtkCompactionHints": false
}
Debug logging
Debug logging is disabled by default. Set debug to true in the extension root config.json only when collecting diagnostics; missing or non-true values are treated as false. When enabled, diagnostics are appended to debug/debug.log under a runtime-created debug/ directory, and no debug output is written to the terminal.
Rendering notes
Edit and write diffs
edit and write results use the same diff renderer. In auto mode the extension chooses split or unified layout based on available width. On narrow panes it clamps rendered lines and shortens collapsed hint text so the diff stays readable instead of spilling past the terminal width.
While tool arguments are still streaming, partial edit and write calls can show projected pending previews. Deterministic edits render as pending edit diffs against current file contents, writes render as pending overwrite or pending create, and unresolved projections show a clear preview notice instead of guessing. Preview file reads are scoped to the active workspace so pending previews avoid reading paths outside the current project.
When diff input includes Pi anchored read lines such as 12#AB:content, the renderer treats the anchor as line metadata and displays the LINE#HASH label in the gutter while keeping the content aligned for split, unified, and compact diff layouts.
Write summaries
When content is available, write call summaries include line count and byte size information inline so you can quickly see the size of the pending write before expanding the result.
Thinking labels
On Pi 1.7, the thinking label is added by a Markdown transformer when the transcript is displayed. The stored assistant message retains the provider's original thinking text. The compatibility path for older Pi versions uses message events and context sanitization.
Native user message box
When enabled, user prompts render inside a bordered box using Pi's native user message component. The renderer preserves markdown content more safely and normalizes ANSI/background handling to avoid odd nested background artifacts.
Capability detection
The extension checks the current Pi environment and adjusts behavior automatically:
- MCP tooling unavailable at startup: MCP settings can be hidden from the modal, but the configured MCP output mode is preserved because MCP tools may register later
- RTK optimizer unavailable: RTK hint settings are hidden and RTK compaction hints are disabled
This keeps the UI aligned with the current environment while still allowing dynamically registered MCP tools to be styled when they appear.
Troubleshooting
Reload safety
/reload is fully supported. On reload, the extension cleans up all tool overrides, prototype patches, timers, and event handlers through its built-in disposal registry, then re-registers everything on the next session lifecycle event. No manual cleanup is needed.
Tool ownership conflicts
If another extension is already rendering one of the built-in tools:
- Set
registerToolOverrides.<tool>tofalse - Run
/reload - Use
/tool-display showto confirm the effective ownership state
On Pi 1.7, tool display resolves renderers by name. It delegates to Pi when a built-in tool is disabled in registerToolOverrides or another extension owns the tool definition. Pi continues to execute the original tool definitions and apply the active settings and tool list.
Config not loading
If your settings are not being applied:
- Check the pi-less-display configuration path (
~/.pi/agent/extensions/pi-less-display/config.jsonby default, respectingPI_CODING_AGENT_DIR). - Make sure the JSON is valid
- Run
/tool-display showto inspect the effective config summary
MCP or custom tool rendering not appearing
Pi 1.7 resolves native mcp__server__tool rows by name, including history loaded before a server connects. For other MCP tools, it also checks tool metadata and the supported names and parameter schemas. Older Pi versions use registration interception and discovery.
For non-MCP extension tools, or MCP-like tools that do not match the heuristics, add the exact tool name under customToolOverrides and run /reload. Use kind: "generic" for ordinary tools and kind: "mcp" for MCP proxy-style arguments.
MCP or RTK settings missing
Those controls only appear when the corresponding capability is available in the current Pi environment.
Project structure
pi-less-display/
├── index.ts # Extension entrypoint for Pi auto-discovery
├── src/
│ ├── index.ts # Bootstrap and extension registration
│ ├── capabilities.ts # MCP/RTK capability detection
│ ├── config-modal.ts # /tool-display settings UI and command handling
│ ├── config-store.ts # Config load/save and normalization
│ ├── disposable.ts # Reload-safe cleanup registry for tool overrides, patches, and timers
│ ├── diff-renderer.ts # Edit/write diff rendering engine
│ ├── line-width-safety.ts # Width clamping helpers for narrow panes
│ ├── pending-diff-preview.ts # Partial edit/write preview projection helpers
│ ├── presets.ts # Preset definitions and matching
│ ├── render-utils.ts # Shared rendering helpers
│ ├── thinking-label.ts # Thinking label formatting and context sanitization
│ ├── transcript-activity.ts # Collapsible transcript turns and tool batches
│ ├── tool-overrides.ts # Built-in, MCP, and opt-in custom renderer overrides
│ ├── types.ts # Shared config and type definitions
│ ├── user-message-box-markdown.ts # Markdown extraction for user message rendering
│ ├── user-message-box-native.ts # Native user message box registration
│ ├── user-message-box-patch.ts # Safe native render patching helpers
│ ├── user-message-box-renderer.ts # User message border renderer
│ ├── user-message-box-utils.ts # ANSI/background normalization helpers
│ ├── write-display-utils.ts # Write summary helpers
│ └── zellij-modal.ts # Modal UI primitives
├── config/
│ └── config.example.json # Starter config template
└── tests/
├── ansi-utils.test.ts # ANSI utility tests including foreground RGB preservation
├── bash-display.test.ts # Bash display and spinner tests
├── capabilities-edge.test.ts # Capability detection edge cases
├── config-modal.test.ts # Config modal tests
├── custom-tool-overrides.test.ts # Opt-in custom tool override tests
├── debug-logger-edge.test.ts # Debug logger edge cases
├── diff-renderer-ansi.test.ts # ANSI/background handling tests for diff rendering
├── diff-renderer-edge.test.ts # Diff renderer edge case tests
├── diff-renderer-width.test.ts # Width and background coverage tests for diff rendering
├── index-integration.test.ts # Integration tests for extension lifecycle
├── presets-edge.test.ts # Preset edge case tests
├── reload-behavior.test.ts # Reload-safe cleanup and re-registration tests
├── tool-overrides-config.test.ts # Tool override config tests
├── tool-overrides-registration.test.ts # Tool override registration tests
└── tool-ui-utils.test.ts # Utility tests for user message and diff helpers
Development
# Type check
npm run build
# Run tests
npm run test
# Full verification
npm run check
Related Pi Extensions
- pi-image-tools — Image attachment and inline preview for the Pi TUI
- pi-hide-messages — Hide older chat messages without losing context
- pi-startup-redraw-fix — Fix terminal redraw glitches on startup
- pi-permission-system — Permission enforcement for tool and command access
License and attribution
MIT. Based on MasuRii/pi-tool-display at commit 91cef75. The original copyright and MIT permission notice are included in this repository and the npm package.