[Feature Request] Zero-height tool renders — suppress spacer/container when extension returns empty component #1685
Joshua-37S
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
When a custom tool extension returns an empty/nil component from
renderCallandrenderResult, pi still renders a visible gap for each tool call. This makes it impossible to fully hide tool activity via the extension API.Root cause
In
packages/coding-agent/src/modes/interactive/components/tool-execution.ts, theToolExecutionComponentconstructor unconditionally adds spacing regardless of what the extension returns:renderCallandrenderResultonly control what goes insidecontentBox. TheSpacer(1)above andBox(paddingY=1)wrapper are unconditional. Each hidden tool call still contributes ~3 blank lines to the layout.Reproduction
minimal-mode.tsexample extension (or any extension that returns{ render: () => [], invalidate: () => {} }from bothrenderCallandrenderResult)Expected behaviour
When
renderCallreturns a zero-height component (i.e.render()returns[]), andrenderResultdoes the same, the tool execution container — including its leadingSpacerandBoxpadding — should contribute zero lines to the layout. The assistant response should flow seamlessly from the previous message with no gap.Proposed fix
Option A — skip the spacer and container when rendered output is empty (no API change required):
Option B — let extensions opt out by returning
nullfromrenderCall:Option C — add a
hideWhenEmpty?: booleanflag toregisterTool:Context
0.55.3minimal-mode.ts/ silent mode extension, where the goal is to hide all tool activity unless the user explicitly expands viaCtrl+O. The gap breaks the seamless feel the extension is designed to achieve.tool-execution.ts, no API surface changes required.Beta Was this translation helpful? Give feedback.
All reactions