mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-12-05 05:45:00 +00:00
Follow-up to #12728 (refs #12727). Covers the gaps left after that fix. **Shift+Backspace / Shift+Delete in `Input` and `/tree` search** Problem: with the Kitty keyboard protocol or xterm `modifyOtherKeys`, Shift+Backspace arrives as `\x1b[127;2u` or `\x1b[27;2;127~`. Before #12728 `Input` inserted DEL for it; after #12728 it is ignored. The `Editor` deletes, because it hard-codes `matchesKey(data, "shift+backspace")` and `"shift+delete"`. Fix: add `shift+backspace` and `shift+delete` to the `tui.editor.deleteCharBackward` / `tui.editor.deleteCharForward` defaults and drop the hard-coded checks in `Editor`. `Input`, `TreeList` and p2's `SecretInput` already match those keybindings, so they now delete too, and users can rebind them. **p2 callers still on `decodeKittyPrintable`** `apps/p2/src/tui/components/secret-input.ts` (masked API key prompt) and `apps/p2/src/hosts/tui-trusted-ui.ts` (trusted directory picker filter) dropped shifted keys under `modifyOtherKeys`. Both now use `decodePrintableKey`. **Example extensions** `overlay-test.ts` and `overlay-qa-tests.ts` accepted only `data.length === 1` text, so they dropped every Kitty CSI-u and `modifyOtherKeys` key. They now use `decodePrintableKey`. **Testing** - `packages/tui/test/input.test.ts`, `editor.test.ts`: Shift+Backspace (both encodings) and Shift+Delete delete - `packages/coding-agent/test/tree-selector.test.ts`: Shift+Backspace removes search characters - `npm run check`, `cd apps/p2 && npm run check` |
||
|---|---|---|
| .. | ||
| extensions | ||
| sdk | ||
| README.md | ||
| rpc-client.ts | ||
| rpc-extension-ui.ts | ||
| tsconfig.json | ||
Examples
Example code for the pi-coding-agent SDK, process integration, and extensions.
CLI integration
rpc-client.ts uses the typed RpcClient to run Pi in a child process, stream events, and wait for the run to settle.
Build the coding-agent package before running it from a repository checkout:
node examples/rpc-client.ts "Explain this repository"
Directories
sdk/
Programmatic usage via createAgentSession(). Shows how to customize models, prompts, tools, extensions, and session management.
extensions/
Example extensions demonstrating:
- Lifecycle event handlers (tool interception, safety gates, context modifications)
- Custom tools (todo lists, questions, subagents, output truncation)
- Commands and keyboard shortcuts
- Custom UI (footers, headers, editors, overlays)
- Git integration (checkpoints, auto-commit)
- System prompt modifications and custom compaction
- External integrations (SSH, file watchers, system theme sync)
- Custom providers (Anthropic with custom streaming, GitLab Duo)