@hheei/pi-ext-ui

Collapsible tool rendering frame and tool renderer pilot for Pi.

Packages

Package details

extension

Install @hheei/pi-ext-ui from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@hheei/pi-ext-ui
Package
@hheei/pi-ext-ui
Version
0.10.0
Published
Nov 5, 2026
Downloads
2,726/mo · 1,822/wk
Author
hheei
License
MIT
Types
extension
Size
241.3 KB
Dependencies
1 dependency · 2 peers
Pi manifest JSON
{
  "extensions": [
    "dist/extension.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@hheei/pi-ext-ui

Pi UI primitives and a small set of specialized tool renderers.

pi-ext-ui owns the visual result, not tool execution. Its default resolver only handles tools with an explicit specialized renderer (edit, read, write, apply_patch, eval, and codemode). Other tools remain on Pi's native renderer. Extensions can opt into the shared visual API with createToolView, ToolView, and DiffView, or explicitly add a tool through resolver options.

The shared view API owns fold levels, compact sections, status glyphs, copy feedback, and width-safe rendering. It does not read files, execute tools, infer outcomes, or import a concrete extension.

Background Bash and subagent tools own their display formats through ext-core ToolPresentation providers. This resolver consumes those providers automatically, including nested codemode calls, and adds shared folding and copy controls. Without pi-ext-ui, the same tools retain native Pi renderers. No direct dependency on pi-ext-ui is required by the tool extensions.

Paths in assistant prose become file://localhost/<absolute> links only when the host app says the reader is on this machine. Each host app is one LinkHostProvider in file-links.ts; an unrecognized host keeps paths as text. VS Code is recognized but never rewritten, because its own terminal link provider already opens a path on the side that owns the file. Rex asks its server once per session: every app client on loopback means the reader is here, while an app client on the network means an ssh target would be needed and is not knowable from this side. Code, existing links, and bare URLs are never rewritten.

Activity groups are on by default for Pi >=1.0.1 TUI sessions. Turn them off with the Tool UI setting toolGroups.enabled in ext_settings.json (the ext-core settings page). toolGroups.copyControl removes the right-edge copy control and its shift+click hint; both settings apply to rows the transcript already holds. The change applies to the current session. A heading such as ▸ codemode ×2 · grep ×3 keeps one live summary row per tool beneath a single outer rail. Each thinking round and notification also keeps a summary row; notifications are not counted. A thinking item shows a content preview while Pi hides thinking and opens the full text on demand; while thinking is visible the category prints it flat. Groups form while tools run and can span consecutive tool/thinking rounds. Prose, user messages, unknown components, images, and unknown tool renderers break groups. Any MessageView transcript notice stays inside the group, so bg-bash, subagent, memory, optimizer, and codemode-guard notices do not need their own allowlist. Notification rows show their own text once, indented and width-wrapped; only a MessageView with a real body gets an expand pin. Streaming arguments, partial results, completion, and errors update the existing row.

Fullscreen: click the group heading to restore the original component layouts and interactions beneath the outer rail. Both terminal modes: Ctrl+O forces groups open; closing global expansion restores each group’s local choice. Appending members preserves that choice. Original per-tool fold choices remain intact. Groups are presentation only and are rebuilt on history navigation; session data, model context, and HTML export remain unchanged. Thinking keeps its label; the hidden state shows a preview instead of dropping the text, and the visible state has no per-item arrow. Each ctx.ui.notify keeps its full text inline. Notifications remain session-local, as in Pi.

Grouping uses two centralized, version-checked host prototype hooks: tool lookup and extension notifications. Thinking uses the existing assistant message, with no extra hook. Unsupported hosts or incompatible layouts report a warning and retain normal rendering. Cleanup restores the original methods; if another extension replaces the same methods, restart Pi to unload the conflicting patch. For workspace development use pnpm run pi-dev: running the bundled CLI beside physical host devDependencies can resolve a second host class, unlike the published installation.