From 0c9304a49bff28d40556f188739f924f63dd2abf Mon Sep 17 00:00:00 2001 From: Aliou Diallo Date: Sun, 8 Feb 2026 23:08:36 +0100 Subject: [PATCH] docs(coding-agent): fix RPC mode ctx.hasUI and unsupported methods documentation (#1411) Update extensions.md and rpc.md to accurately reflect that ctx.hasUI is true in RPC mode. Document missing unsupported/degraded ExtensionUIContext methods: pasteToEditor, getAllThemes, getTheme, setTheme. Co-authored-by: Mario Zechner --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/docs/extensions.md | 2 +- packages/coding-agent/docs/rpc.md | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index a97b5224..0195161d 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -16,6 +16,7 @@ ### Fixed - Fixed fd/rg download failing on Windows due to `unzip` not being available; now uses `tar` for both `.tar.gz` and `.zip` extraction, with proper error reporting ([#1348](https://github.com/badlogic/pi-mono/issues/1348)) +- Fixed RPC mode documentation incorrectly stating `ctx.hasUI` is `false`; it is `true` because dialog and fire-and-forget UI methods work via the RPC sub-protocol. Also documented missing unsupported/degraded methods (`pasteToEditor`, `getAllThemes`, `getTheme`, `setTheme`) ([#1411](https://github.com/badlogic/pi-mono/pull/1411) by [@aliou](https://github.com/aliou)) - Fixed `rg` not available in bash tool by downloading it at startup alongside `fd` ([#1348](https://github.com/badlogic/pi-mono/issues/1348)) - Fixed `custom-compaction` example to use `ModelRegistry` ([#1387](https://github.com/badlogic/pi-mono/issues/1387)) - Google providers now support full JSON Schema in tool declarations (anyOf, oneOf, const, etc.) ([#1398](https://github.com/badlogic/pi-mono/issues/1398) by [@jarib](https://github.com/jarib)) diff --git a/packages/coding-agent/docs/extensions.md b/packages/coding-agent/docs/extensions.md index 0db7ceab..e9dde2e4 100644 --- a/packages/coding-agent/docs/extensions.md +++ b/packages/coding-agent/docs/extensions.md @@ -623,7 +623,7 @@ UI methods for user interaction. See [Custom UI](#custom-ui) for full details. ### ctx.hasUI -`false` in print mode (`-p`), JSON mode, and RPC mode. Always check before using `ctx.ui`. +`false` in print mode (`-p`) and JSON mode. `true` in interactive and RPC mode. In RPC mode, dialog methods (`select`, `confirm`, `input`, `editor`) work via the extension UI sub-protocol, and fire-and-forget methods (`notify`, `setStatus`, `setWidget`, `setTitle`, `setEditorText`) emit requests to the client. Some TUI-specific methods are no-ops or return defaults (see [rpc.md](rpc.md#extension-ui-protocol)). ### ctx.cwd diff --git a/packages/coding-agent/docs/rpc.md b/packages/coding-agent/docs/rpc.md index c49e8a90..e7ba7c7e 100644 --- a/packages/coding-agent/docs/rpc.md +++ b/packages/coding-agent/docs/rpc.md @@ -928,11 +928,17 @@ There are two categories of extension UI methods: If a dialog method includes a `timeout` field, the agent-side will auto-resolve with a default value when the timeout expires. The client does not need to track timeouts. -Some `ExtensionUIContext` methods are not supported in RPC mode because they require direct TUI access: +Some `ExtensionUIContext` methods are not supported or degraded in RPC mode because they require direct TUI access: - `custom()` returns `undefined` - `setWorkingMessage()`, `setFooter()`, `setHeader()`, `setEditorComponent()`, `setToolsExpanded()` are no-ops - `getEditorText()` returns `""` - `getToolsExpanded()` returns `false` +- `pasteToEditor()` delegates to `setEditorText()` (no paste/collapse handling) +- `getAllThemes()` returns `[]` +- `getTheme()` returns `undefined` +- `setTheme()` returns `{ success: false, error: "..." }` + +Note: `ctx.hasUI` is `true` in RPC mode because the dialog and fire-and-forget methods are functional via the extension UI sub-protocol. ### Extension UI Requests (stdout)