pi-mono/packages/coding-agent/docs
Petr Houška 9376c8d17c
fix(coding-agent): pass host keybinding hints to extension renderers (#11630)
Fixes #4748.

## Problem

Extensions that import `keyText`/`keyHint` from
`@earendil-works/pi-coding-agent` can resolve their own copy of the
package (their own `node_modules`, or the bundled `cli.js` vs
`dist/index.js`). That copy's keybindings are never set by the host, so
it falls back to a manager with only `tui.*` bindings, and
`keyHint("app.tools.expand", "to expand")` renders as ` to expand`.

## Change

The host passes its own `keyText` and `keyHint` to extension renderers,
the same way it passes `theme`:

- `ToolRenderContext` (`renderCall`/`renderResult` context):
`context.keyHint(...)`
- `MessageRenderOptions` and `EntryRenderOptions`:
`options.keyHint(...)`

All three extend a new exported `KeybindingHints` interface. The docs
and the `debug-provider` example now use the injected functions and warn
against importing them in renderers.

Not done:

- Moving the `pi-tui` keybindings singleton to `globalThis`. Per the
discussion in #7011, extension-facing state should be host-owned and
passed through the extension API instead of shared through process-wide
module state.
- `ctx.ui.keyText`/`keyHint`. No reported case needs them outside
renderers, RPC and print modes never install app keybindings, and adding
them to `ExtensionUIContext` would break SDK hosts that implement it.

## Tests

- `test/extension-keybinding-hints.test.ts`: tool, message, and entry
renderers format a user-overridden `app.tools.expand` binding.
- `npm run check` passes.
2026-10-30 23:01:20 +01:00
..
images docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
cli-integration.md fix(coding-agent): warn and exit non-zero in print mode on truncated response 2026-10-12 16:06:42 +02:00
cli.md feat(coding-agent): add PI_SELF_UPDATE_COMMAND and selfUpdateCommand for pi update (#11629) 2026-10-30 22:30:39 +01:00
codemode.md fix(coding-agent): queue codemode scripts at the worker limit 2026-10-20 20:50:27 +02:00
compaction.md fix(coding-agent): remove fixed output limits from summary requests (#11036) 2026-10-16 13:53:16 +02:00
configuration.md feat(coding-agent): codemode and MCP 2026-09-29 09:12:50 +02:00
containerization.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
custom-provider.md docs(coding-agent): shorten device-code login guidance 2026-10-22 21:38:58 +02:00
docs.json docs(ai,coding-agent): generate models.json reference from schemas (#11038) 2026-10-16 21:53:00 +01:00
environment-variables.md feat(coding-agent): add PI_SELF_UPDATE_COMMAND and selfUpdateCommand for pi update (#11629) 2026-10-30 22:30:39 +01:00
extensions.md fix(coding-agent): pass host keybinding hints to extension renderers (#11630) 2026-10-30 23:01:20 +01:00
how-pi-works.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
index.md docs(coding-agent): add Radius to providers page, rename provider docs sections 2026-10-01 17:06:00 +02:00
json.md feat(tui,coding-agent): report program status via OSC 7501 2026-10-07 19:05:41 +00:00
keybindings.md fix(tui,coding-agent): handle selection page keys in all scrolling lists 2026-10-28 19:05:21 +01:00
llama-cpp.md docs(coding-agent): update llama.cpp setup for llama.app (#10179) 2026-10-27 16:21:37 +01:00
mcp.md feat(coding-agent): prefer the client ID metadata document for MCP OAuth 2026-10-30 10:36:22 +01:00
message-types.md feat(ai): carry responseModel on pi-messages terminal events (#11265) 2026-10-23 10:54:18 +02:00
models-configuration.md feat(ai,coding-agent): image input for System One classifiers 2026-10-21 23:53:47 +02:00
models.md feat(ai,coding-agent): image input for System One classifiers 2026-10-21 23:53:47 +02:00
nvidia-rtx-llama-cpp.md docs(coding-agent): restructure NVIDIA RTX llama.cpp prerequisites 2026-10-13 15:04:38 +01:00
packages.md docs(coding-agent): document how -e packages are cached and refreshed 2026-10-29 21:43:11 +01:00
prompt-templates.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
providers.md feat(ai,coding-agent): list only the OpenRouter models a key may use (#10672) 2026-10-12 10:17:40 +02:00
quickstart.md docs(quickstart): add Windows installer tab (#11231) 2026-10-28 10:10:44 +01:00
rpc-commands.md feat(coding-agent): report prompt disposition in RPC responses 2026-09-25 14:53:11 +02:00
rpc-extension-ui.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
rpc.md feat(coding-agent): report prompt disposition in RPC responses 2026-09-25 14:53:11 +02:00
sdk.md docs(coding-agent): add Radius to providers page, rename provider docs sections 2026-10-01 17:06:00 +02:00
security.md feat(coding-agent): codemode and MCP 2026-09-29 09:12:50 +02:00
session-format.md feat(coding-agent): Virtual models (#10035) 2026-09-28 23:30:45 +02:00
sessions.md docs(coding-agent): document which working directory resumed sessions use (#11617) 2026-10-30 17:22:05 +00:00
settings.md feat(coding-agent): add PI_SELF_UPDATE_COMMAND and selfUpdateCommand for pi update (#11629) 2026-10-30 22:30:39 +01:00
shell-aliases.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
skills.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
slash-commands.md docs(coding-agent): document which working directory resumed sessions use (#11617) 2026-10-30 17:22:05 +00:00
terminal-setup.md fix(tui): treat ESC+Return with native Shift held as Shift+Enter 2026-10-29 20:17:54 +01:00
termux.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
themes.md feat(coding-agent): use pi.dev configuration schemas (#10751) 2026-10-11 14:48:42 +01:00
tmux.md docs(coding-agent): refresh documentation (#9898) 2026-09-22 16:48:19 +02:00
tui.md feat(coding-agent): let inline ctx.ui.custom() components report blocked program status (#11471) 2026-10-27 09:27:28 +01:00
usage.md feat(coding-agent): configure session share destination 2026-10-13 15:41:13 +02:00
virtual-models.md feat(coding-agent): Virtual models (#10035) 2026-09-28 23:30:45 +02:00
windows.md fix(coding-agent): resolve Windows shells from installation directories 2026-10-19 21:55:12 +02:00