feat: add Tab key to cycle through thinking levels

- Add onTab callback to CustomEditor
- Implement cycleThinkingLevel() in TuiRenderer
- Only works when model supports reasoning
- Cycles through: off → minimal → low → medium → high → off
- Update footer to show current thinking level with '(tab to cycle)' hint
- Update header instructions to mention tab for thinking
- Show notification when thinking level changes
This commit is contained in:
Tino Ehrich 2025-11-19 10:18:24 +01:00
parent 1f68d6eb40
commit 9e8373b86a
3 changed files with 68 additions and 15 deletions

View file

@ -6,8 +6,17 @@ import { Editor } from "@mariozechner/pi-tui";
export class CustomEditor extends Editor {
public onEscape?: () => void;
public onCtrlC?: () => void;
public onTab?: () => boolean;
handleInput(data: string): void {
// Intercept Tab key when autocomplete is not showing
if (data === "\t" && !this.isShowingAutocomplete() && this.onTab) {
const handled = this.onTab();
if (handled) {
return;
}
}
// Intercept Escape key - but only if autocomplete is NOT active
// (let parent handle escape for autocomplete cancellation)
if (data === "\x1b" && this.onEscape && !this.isShowingAutocomplete()) {