* fix(tui): prevent split Alt+Enter from interrupting
Increase the escape-sequence timeout over SSH and allow high-latency terminals to override it with PI_TUI_ESC_TIMEOUT.
Fixes#7876
* docs(coding-agent): shorten escape timeout description
---------
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
Add createGatewayBindingFetch: a FetchFunction factory that intercepts
requests bound for an AI Gateway HTTPS endpoint and re-issues them
through the Workers AI binding's universal endpoint
(env.AI.gateway(id).run()). Binding calls are pre-authenticated
in-account, so Workers running inside the gateway's account need no
cf-aig-authorization API token.
The shim is transport-only: it composes with the existing gateway
passthrough base URLs and every API implementation that honors
StreamOptions.fetch, preserving each provider's native wire format
(verified: workers-ai v1/chat/completions OpenAI-compat SSE streams
incrementally; anthropic v1/messages and openai responses route
end-to-end; cf-aig-log-id is present and readable via gateway getLog).
Binding types are structural, so no @cloudflare/workers-types
dependency and no impact on browser bundling.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Add tui.altScreen.lineUp and tui.altScreen.lineDown keybinding actions
for one-line viewport scrolling in fullscreen TUI. Both are unbound by
default and can be configured via user keybindings.
closes#7830
Co-authored-by: midas <midas@traderdifferent.com>
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
paintBox ran every visible text row through compositeTuiLine on every
frame, rebuilding each row string via ANSI/grapheme segmentation even
when nothing changed. Full-width boxes painting onto untouched rows now
assign the source line reference directly; padding is unnecessary since
rows are written with erase-line and the final width clamp still
truncates over-wide lines.
Cuts alt-screen per-frame allocation churn 9-18x (test/render-churn-bench.ts)
and removes the fullscreen RSS penalty over regular mode on short
sessions (previously +11-29 MiB loaded, +26-36 MiB peak).