From c1bbb4d0740137014523a08ffc2b3ec7188cc7db Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sun, 13 Sep 2026 14:47:11 +0200 Subject: feat(workstation): add pi --- user/pi/extensions/stash-on-escape.ts | 46 +++++++++++++++++++++++++++++++++++ user/pi/settings.json | 8 ++++++ 2 files changed, 54 insertions(+) create mode 100644 user/pi/extensions/stash-on-escape.ts create mode 100644 user/pi/settings.json (limited to 'user') 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 -- cgit v1.3.1