Skip to content

Improve pi-hypa tool UI rendering#25

Merged
matt-gribben merged 2 commits into
Hypabolic:mainfrom
RunMintOn:fix/pi-hypa-tool-ui-rendering
Jul 1, 2026
Merged

Improve pi-hypa tool UI rendering#25
matt-gribben merged 2 commits into
Hypabolic:mainfrom
RunMintOn:fix/pi-hypa-tool-ui-rendering

Conversation

@RunMintOn

@RunMintOn RunMintOn commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds minimal UI-only rendering improvements for:

  • hypa_shell
  • hypa_read
  • hypa_grep
  • hypa_find
  • hypa_ls

Changes

  • add renderCall(...) so tool invocations show their actual input arguments
  • add renderResult(...) so long tool output is previewed in collapsed form
  • show a simple expand hint for long output

Non-goals

This PR does not change:

  • tool execution semantics
  • command construction
  • schemas
  • truncation generation logic
  • wrapper behavior

Note

This branch works in the installed Pi runtime environment used for local testing.

However, syncing the same implementation back into the package source currently exposes an extension integration issue around directly importing Pi TUI components from pi-hypa package source. A separate issue is linked for that discussion.

Related issue: #24

@matt-gribben

Copy link
Copy Markdown
Collaborator

@RunMintOn Will review your issue and then review this code and come back to you. Thanks for your contribution.

Make the pi-hypa package build resolve @earendil-works/pi-tui in its own dependency graph so the UI rendering changes compile in package builds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@matt-gribben

Copy link
Copy Markdown
Collaborator

I addressed the package-build integration issue behind #24 by declaring @earendil-works/pi-tui as a direct dependency of @hypabolic/pi-hypa, which lets the UI rendering implementation compile in the package build context. I also verified the package build and tests locally.

@matt-gribben matt-gribben marked this pull request as ready for review July 1, 2026 01:22
Copilot AI review requested due to automatic review settings July 1, 2026 01:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Pi extension UX for the @hypabolic/pi-hypa tools by adding custom rendering for tool calls/results, including argument-aware call headers and collapsed previews for long outputs.

Changes:

  • Adds renderCall(...) implementations so tool invocations display their actual input arguments.
  • Adds renderResult(...) with a collapsed preview for multi-line tool output plus an expand hint.
  • Introduces a direct dependency on @earendil-works/pi-tui to support TUI rendering components.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/pi-hypa/extensions/tools.ts Adds call/result renderers and preview logic for hypa_shell, hypa_read, hypa_grep, hypa_find, hypa_ls.
packages/pi-hypa/package.json Adds @earendil-works/pi-tui dependency for the new UI rendering.
packages/pi-hypa/package-lock.json Locks @earendil-works/pi-tui (and transitive deps) and updates platform metadata.
Files not reviewed (1)
  • packages/pi-hypa/package-lock.json: Generated file

Comment on lines 383 to 385
const command = buildReadCommand(params.path, params.offset, params.limit);
const timeoutMs = params.maxTokens ? undefined : undefined;
const result = await runHypaCommand(pi, config, command, timeoutMs, false, signal);
Comment on lines +315 to +317
const preview = styleOutput(lines.slice(0, 12).join("\n"));
const hint = `\n${theme.fg("muted", `... (${lines.length - 12} more lines, Ctrl+O to expand)`)}`;
return new Text(`${preview}${hint}`, 0, 0);
Comment on lines 33 to 36
"dependencies": {
"@earendil-works/pi-tui": "^0.79.8",
"@hypabolic/hypa": "0.1.3"
},
Comment on lines +291 to +294
function previewResultText(result: any, options: { expanded?: boolean; isPartial?: boolean }, theme: any, pendingText: string) {
if (options?.isPartial) {
return new Text(theme.fg("muted", pendingText), 0, 0);
}
@matt-gribben matt-gribben merged commit 2c0f13b into Hypabolic:main Jul 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants