diff options
| author | Martin Fischer <martin@push-f.com> | 2026-09-13 14:47:11 +0200 |
|---|---|---|
| committer | Martin Fischer <martin@push-f.com> | 2026-09-30 19:58:13 +0200 |
| commit | c1bbb4d0740137014523a08ffc2b3ec7188cc7db (patch) | |
| tree | 5202a9a1fc35e025488cf0f608257c1179df103b /user | |
| parent | bc50c5d3c209e5b365755f76d1cf188b665ecd60 (diff) | |
feat(workstation): add pi
Diffstat (limited to 'user')
| -rw-r--r-- | user/pi/extensions/stash-on-escape.ts | 46 | ||||
| -rw-r--r-- | user/pi/settings.json | 8 |
2 files changed, 54 insertions, 0 deletions
diff --git a/user/pi/extensions/stash-on-escape.ts b/user/pi/extensions/stash-on-escape.ts new file mode 100644 index 0000000..b361a3e --- /dev/null +++ b/user/pi/extensions/stash-on-escape.ts @@ -0,0 +1,46 @@ +// On Escape clear the editor an store the text in the history instead of doing nothing. +import { + CustomEditor, + type ExtensionAPI, + type ExtensionContext, + type KeybindingsManager, +} from "@earendil-works/pi-coding-agent"; +import type { EditorTheme, TUI } from "@earendil-works/pi-tui"; + +class StashOnEscapeEditor extends CustomEditor { + constructor( + tui: TUI, + theme: EditorTheme, + private readonly keys: KeybindingsManager, + private readonly ctx: ExtensionContext, + ) { + super(tui, theme, keys); + } + + handleInput(data: string): void { + const text = this.getExpandedText?.() ?? this.getText(); + + if ( + this.ctx.isIdle() && + text.trim() && + this.keys.matches(data, "app.interrupt") + ) { + this.addToHistory(text); + this.setText(""); + return; + } + + super.handleInput(data); + } +} + +export default function (pi: ExtensionAPI) { + pi.on("session_start", (_event, ctx) => { + if (ctx.mode !== "tui") return; + + ctx.ui.setEditorComponent( + (tui, theme, keybindings) => + new StashOnEscapeEditor(tui, theme, keybindings, ctx), + ); + }); +} diff --git a/user/pi/settings.json b/user/pi/settings.json new file mode 100644 index 0000000..46218e0 --- /dev/null +++ b/user/pi/settings.json @@ -0,0 +1,8 @@ +{ + "lastChangelogVersion": "0.87.1", + "theme": "dark", + "defaultProvider": "openai-codex", + "defaultModel": "gpt-5.5", + "defaultThinkingLevel": "medium", + "packages": [] +}
\ No newline at end of file |
