@tzlzl/pi-editor0.1.0
Standalone Pi editor. Slash completion accepts tokens only; the next menu opens after a typed space.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@tzlzl/pi-editor
A standalone Pi 0.99.2 editor extension. It adds a minimal > prompt gutter and immediate next-level slash-command suggestions after accepting completions with Tab. The prompt marker is visual only and is never included in submitted text.
Install
Install with pi install npm:@tzlzl/pi-editor@0.1.0. Do not also leave a copy in ~/.pi/agent/extensions/. Enable/disable with /editor off and /editor on. It defaults to enabled in interactive TUI sessions. If another extension already owns the editor component, startup leaves it alone and reports the conflict; /editor on asks before replacing it. /editor off restores the previous factory only when pi-editor still owns the active factory.
Implementation notes
Pi's public CustomEditor encapsulates autocomplete request state and offers no public operation to refresh suggestions after accepting a completion. Calling handleInput() with fake characters, patching prototypes, or reaching into private fields would be fragile. This extension vendors only the upstream Pi TUI 0.99.2 Editor and small internal helpers under src/vendor/ (MIT license and provenance included), Input, text layout, and completion live in src/engine/. Slash acceptance is one rule in src/policy/slash.ts: every completion path keeps the token only, and the next menu opens only after a typed space. It imports the public SelectList, getKeybindings, key matching, TUI types, and terminal-width helpers from the host @earendil-works/pi-tui package so user keybindings and host configuration are honored. It also supplies the app-keybinding handoff expected by Pi's CustomEditor. Pi provides both runtime peer APIs; no extra runtime packages or core installation changes are required.
The vendored editor retains native editing behavior including undo, kill ring, paste registry/markers, history, Kitty/modifyOtherKeys printable decoding, Unicode grapheme layout, IME cursor marker, mouse handling, host-configured keybindings, and ordinary Enter submission. Escape cancels both a visible menu and an in-flight suggestion request. A unique slash-command argument is accepted immediately; command-name completion still shows its menu, and continuation never auto-accepts the next level. Its explicit promptGutter option is rendered as part of the editor layout: only the first input row shows > , continuation rows and autocomplete rows use blank gutter, and top/bottom borders remain true full-width borders. At widths below 3 columns the prompt gutter is omitted; a one-column viewport avoids recursive wide-grapheme wrapping without changing stored text.
Development
Node.js 22+; npm install --ignore-scripts, then npm run check. The vendored files are derived from upstream tag v0.99.2.