Skip to content

[Feature]: Render Pi extension widgets (setWidget/notify/setStatus) in native chat instead of dropping them #43862

Open

Description

@qszfy666

Problem or use case

In a Pi native chat session, every fire-and-forget extension UI call is silently dropped. Widget-style Pi extensions therefore render nothing at all — the user cannot tell whether the extension is running, broken, or filtered.

Environment: Orca 1.4.261 (macOS, Apple silicon), Pi 1.5.2, @juicesharp/rpiv-todo 2.15.0.

Concrete case: @juicesharp/rpiv-todo draws its live todo list with ctx.ui.setWidget(KEY, lines) (todo-overlay.ts, "Persistent widget showing todo list above the editor") plus a collapse hotkey registered through pi.registerShortcut. In a Pi terminal pane both work. In a Pi native chat neither does: the overlay never appears, and the hotkey cannot fire. The todo tool itself still runs and shows up as an ordinary tool row, so the model-side list keeps working and the gap is easy to miss.

Why (from reading the 1.4.261 bundle):

In out/main/chunks/structured-agent-session-host-assembly-*.js, the Pi dialog handler drops these before they can reach any UI:

mF = new Set(['notify', 'setStatus', 'setWidget', 'setTitle', 'setEditorText'])
receive(e) {
  if (this.backgroundWork.receive(e) || this.subagents.receive(e) || (typeof e.method === 'string' && mF.has(e.method))) return
  ...
}

Only two private setStatus keys are consumed further: orca-background-work (Orca's own injected bridge) and orca-subagents. Everything else — setWidget, notify, setStatus for any other key, setTitle — returns without rendering anything and without telling the extension.

That matters because Pi's rpc-extension-ui.md makes these the only channel an extension has in RPC mode. The four dialog methods (select / confirm / input / editor) work, and extensions that adapt to them do work in chat — @juicesharp/rpiv-ask-user-question explicitly falls back from ui.custom() to ui.select()/ui.input() for RPC hosts and behaves correctly in Orca chat. Extensions that draw with setWidget have no equivalent path.

Reproduce:

  1. Install @juicesharp/rpiv-todo (or any extension that calls ctx.ui.setWidget or ctx.ui.notify).
  2. Ask the agent in a Pi native chat to create a todo list with the todo tool.
  3. In a Pi terminal pane the overlay appears above the editor. In the native chat nothing appears, and nothing indicates an update was dropped.

Proposed solution

Render the documented string-array methods instead of discarding them:

  • setWidget → a collapsible pinned panel above or below the composer, keyed by widgetKey, re-rendered on each request and hidden when widgetLines is omitted. The panel content is plain text lines, so this is a small renderer.
  • notify → a transient toast or an inline system row in the transcript, styled by notifyType (info / warning / error).
  • setStatus for arbitrary statusKey → a status chip in the chat header or composer. The plumbing already exists for Orca's two private keys.
  • setTitle → the chat tab title, which would also let extensions name the session.

If a full renderer is out of scope for now, at minimum surface unknown widget/notify traffic in a collapsed "extension UI" row so the drop is visible rather than silent.

Alternatives or additional context

  • I am not asking for the TUI-only half. custom(), onTerminalInput(), setFooter/setHeader/setEditorComponent/addAutocompleteProvider, theme switching and extension shortcuts are documented no-ops in RPC mode and cannot be emulated; the request is limited to the methods Pi says are functional over the dialog sub-protocol.
  • Related: [Feature]: Show suggested replies from Pi extensions as chips in Chat view #37908 (Pi extension suggested replies as chips in Chat view) is the same "gateway" idea for one specific payload; rendering setWidget would cover a much wider set of extensions without per-extension work.
  • Extension authors cannot detect the drop from their side: ctx.hasUI is true in RPC mode (Pi's documented behavior), so an extension that checks hasUI will believe its widget was shown.

Activity

  1. ninerui commented on Nov 22, 2026

    @ninerui

    Seconding this with a concrete setStatus case (Orca 1.4.269, macOS, Pi 1.5.x). For extensions, setStatus is not really a chip — it is the session's one-line status bar, and in native chat that information exists nowhere.

    Two extensions I run in every Pi session:

    • @cortexkit/pi-magic-context → key mc, text mc: 38.9K (5%) · idle (input tokens, % of window, turn state).
    • @dietrichgebert/ponytail → key ponytail, text 🐴 ponytail: ⌁ FULL (active mode).

    In a Pi terminal pane Orca renders both, because it is just Pi's own TUI footer: mc: 38.9K (5%) · idle · 🐴 ponytail: ⌁ FULL.

    In a Pi native chat both vanish. Orca's context-usage ring covers the token half on hover, so the loss is easy to miss — but the extension-reported turn state and any extension-owned mode (skill/mode indicators, background job summaries) have no surface at all, and the extension is never told the update was dropped.

    For reference, T3 Code joins the same setStatus entries into one muted, tabular line directly under the composer — this is exactly the shape that reads well:

    mc: 38.9K (5%) · idle · 🐴 ponytail: ⌁ FULL
    

    Minimal version, if a full widget renderer is out of scope:

    • Keep an ordered map statusKey → statusText per session, updated on each setStatus, deleting the entry when statusText is undefined (that is how Pi clears one key).
    • Render the non-empty values joined with · in a single text-2xs/muted, tabular-nums line above or below the composer, with the same lifetime as the other orca-* status keys across reconnect.
    • Insertion order matters more than it sounds — these strings are read as one sentence, not as independent chips, so a sorted or key-hashed order breaks them.

    Happy to test a build if you want a real session with the two extensions above.

  2. qszfy666 commented on Nov 26, 2026

    @qszfy666
    Author

    A heads-up that an implementation for this is open as #45081, in case it saves someone else from starting the same work.

    What it does — each frame now lands where Pi's rpc-extension-ui.md says it can, instead of being dropped by the DECORATION guard in rpc-dialog-callbacks.ts:

    • notify → a notice row in the transcript, toned by notifyType.
    • setStatus → one keyed entry in a quiet strip on the composer's top edge; a second send for the same key revises that row and pi clearing the key removes it.
    • setWidget → a keyed mono panel above or below the composer per widgetPlacement; same-key sends revise in place and widgetLines: undefined removes it.
    • setTitle / set_editor_text → consumed, not drawn. Orca owns the chat tab title (naming and user rename) and the composer draft, and no host channel lets a provider child claim either. This is the one bullet of this issue the PR deliberately leaves open — if a channel for naming a session is wanted, it needs its own change and probably its own issue; say the word and I'll file it rather than leave it implicit.

    Rows ride the existing agent journal as kind: 'status' items with additive presentation hints, so they need no new persistence and older clients keep the ordinary text fallback. Third-party text aimed at the DOM is bounded at the boundary: 64 widget lines, 500 characters per line, and a repeated identical value costs no journal revision.

    Current state: kept merged up to main (mergeable, 0 behind as of today), before/after screenshots of the composer panel on the PR, added tests that fail without the change, and pnpm check:changed passing locally. The repository's CI still needs a maintainer approval to run on a fork PR, and CodeRabbit has not re-reviewed the last pushes.

    Happy to split or narrow the PR if that makes review easier.

    asked by @qszfy666 via 卜卜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions