@mariozechner/pi-coding-agent 0.12.11 → 0.12.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.12.12] - 2025-12-05
4
+
5
+ ### Changed
6
+
7
+ - **Footer display**: Token counts now use M suffix for millions (e.g., `10.2M` instead of `10184k`). Context display shortened from `61.3% of 200k` to `61.3%/200k`.
8
+
9
+ ### Fixed
10
+
11
+ - **Multi-key sequences in inputs**: Inputs like model search now handle multi-key sequences identically to the main prompt editor. ([#122](https://github.com/badlogic/pi-mono/pull/122) by [@markusylisiurunen](https://github.com/markusylisiurunen))
12
+ - **Line wrapping escape codes**: Fixed underline style bleeding into padding when wrapping long URLs. ANSI codes now attach to the correct content, and line-end resets only turn off underline (preserving background colors). ([#109](https://github.com/badlogic/pi-mono/issues/109))
13
+
14
+ ### Added
15
+
16
+ - **Fuzzy search models and sessions**: Implemented a simple fuzzy search for models and sessions (e.g., `codexmax` now finds `gpt-5.1-codex-max`). ([#122](https://github.com/badlogic/pi-mono/pull/122) by [@markusylisiurunen](https://github.com/markusylisiurunen))
17
+ - **Prompt History Navigation**: Browse previously submitted prompts using Up/Down arrow keys when the editor is empty. Press Up to cycle through older prompts, Down to return to newer ones or clear the editor. Similar to shell history and Claude Code's prompt history feature. History is session-scoped and stores up to 100 entries. ([#121](https://github.com/badlogic/pi-mono/pull/121) by [@nicobailon](https://github.com/nicobailon))
18
+ - **`/resume` Command**: Switch to a different session mid-conversation. Opens an interactive selector showing all available sessions. Equivalent to the `--resume` CLI flag but can be used without restarting the agent. ([#117](https://github.com/badlogic/pi-mono/pull/117) by [@hewliyang](https://github.com/hewliyang))
19
+
3
20
  ## [0.12.11] - 2025-12-05
4
21
 
5
22
  ### Changed
@@ -63,378 +80,214 @@
63
80
 
64
81
  ### Added
65
82
 
66
- - **`/debug` Command**: New slash command that writes debug information to `~/.pi/agent/pi-debug.log`, including terminal width and all rendered lines with their visible widths. Useful for diagnosing rendering issues.
67
-
68
- ### Fixed
69
-
70
- - **Windows Carriage Return Handling**: Fixed tool output containing stray `\r` characters on Windows, which could cause rendering issues. Carriage returns are now stripped from bash output.
83
+ - **RPC Termination Safeguard**: When running as an RPC worker (stdin pipe detected), the CLI now exits immediately if the parent process terminates unexpectedly. Prevents orphaned RPC workers from persisting indefinitely and consuming system resources.
71
84
 
72
85
  ## [0.12.3] - 2025-12-02
73
86
 
74
87
  ### Fixed
75
88
 
76
- - **Windows Terminal Truecolor Support**: Fixed theme colors appearing washed out in Windows Terminal. The color mode detection now checks for `WT_SESSION` environment variable to enable truecolor (24-bit RGB) support instead of falling back to 256-color mode.
89
+ - **Rate limit handling**: Anthropic rate limit errors now trigger automatic retry with exponential backoff (base 10s, max 5 retries). Previously these errors would abort the request immediately.
90
+ - **Usage tracking during retries**: Retried requests now correctly accumulate token usage from all attempts, not just the final successful one. Fixes artificially low token counts when requests were retried.
77
91
 
78
92
  ## [0.12.2] - 2025-12-02
79
93
 
80
- ### Fixed
81
-
82
- - **Windows Binary Path Resolution**: Fixed Bun compiled binary on Windows failing to find `package.json` and other assets. The binary was incorrectly using the Bun runtime's virtual filesystem path (`B:\~BUN\`) instead of the actual executable location. Now uses `process.execPath` which correctly points to the compiled binary, and updated detection to check for `%7EBUN` (URL-encoded `~BUN`) in `import.meta.url`.
83
-
84
- ## [0.12.1] - 2025-12-02
85
-
86
94
  ### Changed
87
95
 
88
- - **Binary Archive Structure**: Binary downloads now contain `pi` (or `pi.exe` on Windows) instead of platform-suffixed names like `pi-darwin-arm64`, making it easier to use after extraction.
89
-
90
- ## [0.12.0] - 2025-12-02
91
-
92
- ### Added
93
-
94
- - **Standalone Binary Support**: Build a self-contained binary using Bun with `npm run build:binary`. Pre-built binaries for macOS (arm64/x64), Linux (x64/arm64), and Windows (x64) are available on GitHub Releases. Based on [#89](https://github.com/badlogic/pi-mono/pull/89) by [@steipete](https://github.com/steipete), extended with cross-platform path resolution and GitHub Actions for automated release builds.
95
-
96
- ## [0.11.6] - 2025-12-02
97
-
98
- ### Added
99
-
100
- - **OAuth Login Status Indicator**: The `/login` provider selector now shows "✓ logged in" next to providers where you're already authenticated. This makes it clear at a glance whether you're using your Claude Pro/Max subscription. ([#88](https://github.com/badlogic/pi-mono/pull/88) by [@steipete](https://github.com/steipete))
101
- - **Subscription Cost Indicator**: The footer now shows "(sub)" next to the cost when using an OAuth subscription (e.g., `$0.123 (sub)`). This makes it visible without needing `/login` that you're using your Claude Pro/Max subscription.
102
-
103
- ## [0.11.5] - 2025-12-01
104
-
105
- ### Added
106
-
107
- - **Custom Slash Commands**: Define reusable prompt templates as Markdown files. Place files in `~/.pi/agent/commands/` (global) or `.pi/commands/` (project-specific). Commands appear in `/` autocomplete with source indicators like `(user)` or `(project)`. Supports bash-style arguments (`$1`, `$2`, `$@`) with quote-aware parsing. Subdirectories create namespaced commands (e.g., `.pi/commands/frontend/component.md` shows as `(project:frontend)`). Optional `description` field in YAML frontmatter. Works from CLI as well (`pi -p "/review"`). ([#86](https://github.com/badlogic/pi-mono/issues/86))
108
-
109
- ## [0.11.4] - 2025-12-01
96
+ - Removed support for gpt-4.5-preview and o3 models (not yet available)
110
97
 
111
- ### Improved
112
-
113
- - **TUI Crash Diagnostics**: When a render error occurs (line exceeds terminal width), all rendered lines are now written to `~/.pi/agent/pi-crash.log` with their indices and visible widths for easier debugging.
114
-
115
- ### Fixed
116
-
117
- - **Session Selector Crash with Wide Characters**: Fixed crash when running `pi -r` to resume sessions containing emojis, CJK characters, or other wide Unicode characters. The session list was using character count instead of visible terminal width for truncation, causing lines to exceed terminal width. Added `truncateToWidth()` utility that properly handles ANSI codes and wide characters. ([#85](https://github.com/badlogic/pi-mono/issues/85))
118
-
119
- ## [0.11.3] - 2025-12-01
98
+ ## [0.12.1] - 2025-12-02
120
99
 
121
100
  ### Added
122
101
 
123
- - **Circular Menu Navigation**: All menus (model selector, message history, file picker) now wrap around when navigating past the first or last item. Pressing up at the top jumps to the bottom, and pressing down at the bottom jumps to the top. ([#82](https://github.com/badlogic/pi-mono/pull/82) by [@butelo](https://github.com/butelo))
124
-
125
- ### Fixed
126
-
127
- - **RPC Mode Session Management**: Fixed session files not being saved in RPC mode (`--mode rpc`). Since version 0.9.0, the `agent.subscribe()` call with session management logic was only present in the TUI renderer, causing RPC mode to skip saving messages to session files. RPC mode now properly saves sessions just like interactive mode. ([#83](https://github.com/badlogic/pi-mono/issues/83))
102
+ - **Models**: Added support for OpenAI's new models:
103
+ - `gpt-4.1` (128K context)
104
+ - `gpt-4.1-mini` (128K context)
105
+ - `gpt-4.1-nano` (128K context)
106
+ - `o3` (200K context, reasoning model)
107
+ - `o4-mini` (200K context, reasoning model)
128
108
 
129
- ## [0.11.1] - 2025-11-29
109
+ ## [0.12.0] - 2025-12-02
130
110
 
131
111
  ### Added
132
112
 
133
- - **`--export` CLI Flag**: Export session files to self-contained HTML files from the command line. Auto-detects format (session manager format or streaming event format). Usage: `pi --export session.jsonl` or `pi --export session.jsonl output.html`. Note: Streaming event logs (from `--mode json`) don't contain system prompt or tool definitions, so those sections are omitted with a notice in the HTML. ([#80](https://github.com/badlogic/pi-mono/issues/80))
134
-
135
- - **Git Branch File Watcher**: Footer now auto-updates when the git branch changes externally (e.g., running `git checkout` in another terminal). Watches `.git/HEAD` for changes and refreshes the branch display automatically. ([#79](https://github.com/badlogic/pi-mono/pull/79) by [@fightbulc](https://github.com/fightbulc))
113
+ - **`-p, --print` Flag**: Run in non-interactive batch mode. Processes input message or piped stdin without TUI, prints agent response directly to stdout. Ideal for scripting, piping, and CI/CD integration. Exits after first response.
114
+ - **`-P, --print-streaming` Flag**: Like `-p`, but streams response tokens as they arrive. Use `--print-streaming --no-markdown` for raw unformatted output.
115
+ - **`--print-turn` Flag**: Continue processing tool calls and agent turns until the agent naturally finishes or requires user input. Combine with `-p` for complete multi-turn conversations.
116
+ - **`--no-markdown` Flag**: Output raw text without Markdown formatting. Useful when piping output to tools that expect plain text.
117
+ - **Streaming Print Mode**: Added internal `printStreaming` option for streaming output in non-TUI mode.
118
+ - **RPC Mode `print` Command**: Send `{"type":"print","content":"text"}` to get formatted print output via `print_output` events.
119
+ - **Auto-Save in Print Mode**: Print mode conversations are automatically saved to the session directory, allowing later resumption with `--continue`.
120
+ - **Thinking level options**: Added `--thinking-off`, `--thinking-minimal`, `--thinking-low`, `--thinking-medium`, `--thinking-high` flags for directly specifying thinking level without the selector UI.
136
121
 
137
- - **Read-Only Exploration Tools**: Added `grep`, `find`, and `ls` tools for safe code exploration without modification risk. These tools are available via the new `--tools` flag.
138
- - `grep`: Uses `ripgrep` (auto-downloaded) for fast regex searching. Respects `.gitignore` (including nested), supports glob filtering, context lines, and hidden files.
139
- - `find`: Uses `fd` (auto-downloaded) for fast file finding. Respects `.gitignore`, supports glob patterns, and hidden files.
140
- - `ls`: Lists directory contents with proper sorting and indicators.
141
- - **`--tools` Flag**: New CLI flag to specify available tools (e.g., `--tools read,grep,find,ls` for read-only mode). Default behavior remains unchanged (`read,bash,edit,write`).
142
- - **Dynamic System Prompt**: The system prompt now adapts to the selected tools, showing relevant guidelines and warnings (e.g., "READ-ONLY mode" when write tools are disabled).
143
-
144
- ### Fixed
122
+ ### Changed
145
123
 
146
- - **Prompt Restoration on API Key Error**: When submitting a message fails due to missing API key, the prompt is now restored to the editor instead of being lost. ([#77](https://github.com/badlogic/pi-mono/issues/77))
147
- - **File `@` Autocomplete Performance**: Fixed severe UI jank when using `@` for file attachment in large repositories. The file picker now uses `fd` (a fast file finder) instead of synchronous directory walking with minimatch. On a 55k file repo, search time dropped from ~900ms to ~10ms per keystroke. If `fd` is not installed, it will be automatically downloaded to `~/.pi/agent/tools/` on first use. ([#69](https://github.com/badlogic/pi-mono/issues/69))
148
- - **File Selector Styling**: Selected items in file autocomplete (`@` and Tab) now use consistent accent color for the entire line instead of mixed colors.
124
+ - **Simplified RPC Protocol**: Replaced the `prompt` wrapper command with direct message objects. Send `{"role":"user","content":"text"}` instead of `{"type":"prompt","message":"text"}`. Better aligns with message format throughout the codebase.
125
+ - **RPC Message Handling**: Agent now processes raw message objects directly, with `timestamp` auto-populated if missing.
149
126
 
150
- ## [0.10.2] - 2025-11-27
127
+ ## [0.11.9] - 2025-12-02
151
128
 
152
129
  ### Changed
153
130
 
154
- - **HTML Export Prefix**: Exported session files now use `pi-session-` prefix (e.g., `pi-session-2025-11-13T12-27-53-866Z_xxx.html`) for easier `.gitignore` filtering ([#72](https://github.com/badlogic/pi-mono/issues/72))
155
- - **Native Model Identity**: Removed "You are actually not Claude, you are Pi" from system prompt, allowing models to use their native identity ([#73](https://github.com/badlogic/pi-mono/issues/73))
156
-
157
- ## [0.10.1] - 2025-11-27
131
+ - Change Ctrl+I to Ctrl+P for model cycling shortcut to avoid collision with Tab key in some terminals
158
132
 
159
- ### Added
160
-
161
- - **CLI File Arguments (`@file`)**: Include files in your initial message using the `@` prefix (e.g., `pi @prompt.md @image.png "Do this"`). All `@file` arguments are combined into the first message. Text files are wrapped in `<file name="path">content</file>` tags. Images (`.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`) are attached as base64-encoded attachments. Supports `~` expansion, relative/absolute paths. Empty files are skipped. Works in interactive, `--print`, and `--mode text/json` modes. Not supported in `--mode rpc`. ([#54](https://github.com/badlogic/pi-mono/issues/54))
133
+ ## [0.11.8] - 2025-12-01
162
134
 
163
135
  ### Fixed
164
136
 
165
- - **Editor Cursor Navigation**: Fixed broken up/down arrow key navigation in the editor when lines wrap. Previously, pressing up/down would move between logical lines instead of visual (wrapped) lines, causing the cursor to jump unexpectedly. Now cursor navigation is based on rendered lines. Also fixed a bug where the cursor would appear on two lines simultaneously when positioned at a wrap boundary. Added word by word navigation via Option+Left/Right or Ctrl+Left/Right. ([#61](https://github.com/badlogic/pi-mono/pull/61))
166
- - **Edit Diff Line Number Alignment**: Fixed two issues with diff display in the edit tool:
167
- 1. Line numbers were incorrect for edits far from the start of a file (e.g., showing 1, 2, 3 instead of 336, 337, 338). The skip count for context lines was being added after displaying lines instead of before.
168
- 2. When diff lines wrapped due to terminal width, the line number prefix lost its leading space alignment, and code indentation (spaces/tabs after line numbers) was lost. Rewrote `splitIntoTokensWithAnsi` in `pi-tui` to preserve whitespace as separate tokens instead of discarding it, so wrapped lines maintain proper alignment and indentation.
169
-
170
- ### Improved
171
-
172
- - **Git Branch Display**: Footer now shows the active git branch after the directory path (e.g., `~/project (main)`). Branch is detected by reading `.git/HEAD` directly (fast, synchronous). Cache is refreshed after each assistant message to detect branch changes from git commands executed by the agent. ([#55](https://github.com/badlogic/pi-mono/issues/55))
173
- - **HTML Export**: Added timestamps to each message, fixed text clipping with proper word-wrapping CSS, improved font selection (`ui-monospace`, `Cascadia Code`, `Source Code Pro`), reduced font sizes for more compact display (12px base), added model switch indicators in conversation timeline, created dedicated Tokens & Cost section with cumulative statistics (input/output/cache tokens, cost breakdown by type), added context usage display showing token count and percentage for the last model used, and now displays all models used during the session. ([#51](https://github.com/badlogic/pi-mono/issues/51), [#52](https://github.com/badlogic/pi-mono/issues/52))
137
+ - Absolute glob patterns (e.g., `/Users/foo/**/*.ts`) are now handled correctly. Previously the leading `/` was being stripped, causing the pattern to be interpreted relative to the current directory.
174
138
 
175
- ## [0.10.0] - 2025-11-27
176
-
177
- ### Added
178
-
179
- - **Fuzzy File Search (`@`)**: Type `@` followed by a search term to fuzzy-search files and folders across your project. Respects `.gitignore` and skips hidden files. Directories are prioritized in results. Based on [PR #60](https://github.com/badlogic/pi-mono/pull/60) by [@fightbulc](https://github.com/fightbulc), reimplemented with pure Node.js for fast, dependency-free searching.
139
+ ## [0.11.7] - 2025-12-01
180
140
 
181
141
  ### Fixed
182
142
 
183
- - **Emoji Text Wrapping Crash**: Fixed crash when rendering text containing emojis (e.g., 😂) followed by long content like URLs. The `breakLongWord` function in `pi-tui` was iterating over UTF-16 code units instead of grapheme clusters, causing emojis (which are surrogate pairs) to be miscounted during line wrapping. Now uses `Intl.Segmenter` to properly handle multi-codepoint characters.
184
- - **Footer Cost Display**: Added `$` prefix to cost display in footer. Now shows `$0.078` instead of `0.078`. ([#53](https://github.com/badlogic/pi-mono/issues/53))
185
-
186
- ## [0.9.3] - 2025-11-24
143
+ - Fix read path traversal vulnerability. Paths are now validated to prevent reading outside the working directory or its parents. The `read` tool can read from `cwd`, its ancestors (for config files), and all descendants. Symlinks are resolved before validation.
187
144
 
188
- ### Added
189
-
190
- - Added Anthropic Claude Opus 4.5 support
191
-
192
- ## [0.9.2] - 2025-11-24
145
+ ## [0.11.6] - 2025-12-01
193
146
 
194
147
  ### Fixed
195
148
 
196
- - **Edit Tool Dollar Sign Bug**: Fixed critical bug in the `edit` tool where `String.replace()` was interpreting `$` as a special replacement pattern (e.g., `$$`, `$&`, `$'`). When trying to insert `$` into code (like adding a dollar sign to a template literal), the replacement would silently fail and produce unchanged content, but the tool would incorrectly report success. Now uses `indexOf` + `substring` for raw string replacement without special character interpretation. Also added verification that content actually changed, rejecting with a clear error if the replacement produces identical content. ([#53](https://github.com/badlogic/pi-mono/issues/53))
197
-
198
- ## [0.9.0] - 2025-11-21
199
-
200
- ### Added
201
-
202
- - **`/clear` Command**: New slash command to reset the conversation context and start a fresh session. Aborts any in-flight agent work, clears all messages, and creates a new session file. ([#48](https://github.com/badlogic/pi-mono/pull/48))
203
- - **Model Cycling with Thinking Levels**: The `--models` flag now supports thinking level syntax (e.g., `--models sonnet:high,haiku:low`). When cycling models with `Ctrl+P`, the associated thinking level is automatically applied. The first model in the scope is used as the initial model when starting a new session. Both model and thinking level changes are now saved to session and settings for persistence. ([#47](https://github.com/badlogic/pi-mono/pull/47))
204
- - **`--thinking` Flag**: New CLI flag to set thinking level directly (e.g., `--thinking high`). Valid values: `off`, `minimal`, `low`, `medium`, `high`. Takes highest priority over all other thinking level sources. ([#45](https://github.com/badlogic/pi-mono/issues/45))
205
-
206
- ### Breaking
149
+ - Fix `--system-prompt <path>` allowing the path argument to be captured by the message collection, causing "file not found" errors.
207
150
 
208
- - **Interactive Mode with Initial Prompt**: Passing a prompt on the command line (e.g., `pi "List files"`) now starts interactive mode with the prompt pre-submitted, instead of exiting after completion. Use `--print` or `-p` to get the previous non-interactive behavior (e.g., `pi -p "List files"`). This matches Claude CLI (`-p`) and Codex (`exec`) behavior. ([#46](https://github.com/badlogic/pi-mono/issues/46))
151
+ ## [0.11.5] - 2025-11-30
209
152
 
210
153
  ### Fixed
211
154
 
212
- - **Slash Command Autocomplete**: Fixed issue where pressing Enter on a highlighted slash command suggestion (e.g., typing `/mod` with `/model` highlighted) would submit the partial text instead of executing the selected command. Now Enter applies the completion and submits in one action. ([#49](https://github.com/badlogic/pi-mono/issues/49))
213
- - **Model Matching Priority**: The `--models` flag now prioritizes exact matches over partial matches. Supports `provider/modelId` format (e.g., `openrouter/openai/gpt-5.1-codex`) for precise selection. Exact ID matches are tried before partial matching, so `--models gpt-5.1-codex` correctly selects `gpt-5.1-codex` instead of `openai/gpt-5.1-codex-mini`.
214
- - **Markdown Link Rendering**: Fixed links with identical text and href (e.g., `https://github.com/badlogic/pi-mono/pull/48/files`) being rendered twice. Now correctly compares raw text instead of styled text (which contains ANSI codes) when determining if link text matches href.
155
+ - Fixed fatal error "Cannot set properties of undefined (setting '0')" when editing empty files in the `edit` tool.
156
+ - Simplified `edit` tool output: Shows only "Edited file.txt" for successful edits instead of verbose search/replace details.
157
+ - Fixed fatal error in footer rendering when token counts contain NaN values due to missing usage data.
215
158
 
216
- ## [0.8.5] - 2025-11-21
159
+ ## [0.11.4] - 2025-11-30
217
160
 
218
161
  ### Fixed
219
162
 
220
- - **Path Completion Hanging**: Fixed catastrophic regex backtracking in path completion that caused the terminal to hang when text contained many `/` characters (e.g., URLs). Replaced complex regex with simple string operations. ([#18](https://github.com/badlogic/pi-mono/issues/18))
221
- - **Autocomplete Arrow Keys**: Fixed issue where arrow keys would move both the autocomplete selection and the editor cursor simultaneously when the file selector list was shown.
163
+ - Fixed chat rendering crash when messages contain preformatted/styled text (e.g., thinking traces with gray italic styling). The markdown renderer now preserves existing ANSI escape codes when they appear before inline elements.
222
164
 
223
- ## [0.8.4] - 2025-11-21
165
+ ## [0.11.3] - 2025-11-29
224
166
 
225
167
  ### Fixed
226
168
 
227
- - **Read Tool Error Handling**: Fixed issue where the `read` tool would return errors as successful text content instead of throwing. Now properly throws errors for file not found and offset out of bounds conditions.
169
+ - Fix file drop functionality for absolute paths
228
170
 
229
- ## [0.8.3] - 2025-11-21
230
-
231
- ### Improved
232
-
233
- - **Export HTML**: Limited container width to 700px for better readability. Fixed message statistics to match `/session` command output with proper breakdown of User/Assistant/Tool Calls/Tool Results/Total messages.
234
- - **Dark Theme**: Increased visibility of editor border (darkGray from #303030 to #505050) and thinking minimal indicator (from #4e4e4e to #6e6e6e).
235
-
236
- ## [0.8.0] - 2025-11-21
237
-
238
- ### Added
239
-
240
- - **Theme System**: Full theming support with 44 customizable color tokens. Two built-in themes (`dark`, `light`) with auto-detection based on terminal background. Use `/theme` command to select themes interactively. Custom themes in `~/.pi/agent/themes/*.json` support live editing - changes apply immediately when the file is saved. Themes use RGB hex values for consistent rendering across terminals. VS Code users: set `terminal.integrated.minimumContrastRatio` to `1` for proper color rendering. See [Theme Documentation](docs/theme.md) for details.
241
-
242
- ## [0.7.29] - 2025-11-20
243
-
244
- ### Improved
245
-
246
- - **Read Tool Display**: When the `read` tool is called with offset/limit parameters, the tool execution now displays the line range in a compact format (e.g., `read src/main.ts:100-200` for offset=100, limit=100).
247
-
248
- ## [0.7.28] - 2025-11-20
249
-
250
- ### Added
251
-
252
- - **Message Queuing**: You can now send multiple messages while the agent is processing without waiting for the previous response to complete. Messages submitted during streaming are queued and processed based on your queue mode setting. Queued messages are shown in a pending area below the chat. Press Escape to abort and restore all queued messages to the editor. Use `/queue` to select between "one-at-a-time" (process queued messages sequentially, recommended) or "all" (process all queued messages at once). The queue mode setting is saved and persists across sessions. ([#15](https://github.com/badlogic/pi-mono/issues/15))
253
-
254
- ## [0.7.27] - 2025-11-20
171
+ ## [0.11.2] - 2025-11-29
255
172
 
256
173
  ### Fixed
257
174
 
258
- - **Slash Command Submission**: Fixed issue where slash commands required two Enter presses to execute. Now pressing Enter on a slash command autocomplete suggestion immediately submits the command, while Tab still applies the completion for adding arguments. ([#30](https://github.com/badlogic/pi-mono/issues/30))
259
- - **Slash Command Autocomplete**: Fixed issue where typing a typo then correcting it would not show autocomplete suggestions. Autocomplete now re-triggers when typing or backspacing in a slash command context. ([#29](https://github.com/badlogic/pi-mono/issues/29))
175
+ - Fixed TUI crash when pasting content containing tab characters. Tabs are now converted to 4 spaces before insertion.
176
+ - Fixed terminal corruption after exit when shell integration sequences (OSC 133) appeared in bash output. These sequences are now stripped along with other ANSI codes.
260
177
 
261
- ## [0.7.26] - 2025-11-20
178
+ ## [0.11.1] - 2025-11-29
262
179
 
263
180
  ### Added
264
181
 
265
- - **Tool Output Expansion**: Press `Ctrl+O` to toggle between collapsed and expanded tool output display. Expands all tool call outputs (bash, read, write, etc.) to show full content instead of truncated previews. ([#31](https://github.com/badlogic/pi-mono/issues/31))
266
- - **Custom Headers**: Added support for custom HTTP headers in `models.json` configuration. Headers can be specified at both provider and model level, with model-level headers overriding provider-level ones. This enables bypassing Cloudflare bot detection and other proxy requirements. ([#39](https://github.com/badlogic/pi-mono/issues/39))
182
+ - Added `fd` integration for file path autocompletion. Now uses `fd` for faster fuzzy file search
267
183
 
268
184
  ### Fixed
269
185
 
270
- - **Chutes AI Provider**: Fixed 400 errors when using Chutes AI provider. Added compatibility fixes for `store` field exclusion, `max_tokens` parameter usage, and system prompt role handling. ([#42](https://github.com/badlogic/pi-mono/pull/42) by [@butelo](https://github.com/butelo))
271
- - **Mistral/Chutes Syntax Error**: Fixed syntax error in merged PR that used `iif` instead of `if`.
272
- - **Anthropic OAuth Bug**: Fixed bug where `process.env.ANTHROPIC_API_KEY = undefined` set the env var to string "undefined" instead of deleting it. Now uses `delete` operator.
273
-
274
- ## [0.7.25] - 2025-11-20
186
+ - Fixed keyboard shortcuts Ctrl+A, Ctrl+E, Ctrl+K, Ctrl+U, Ctrl+W, and word navigation (Option+Arrow) not working in VS Code integrated terminal and some other terminal emulators
275
187
 
276
- ### Added
277
-
278
- - **Model Cycling**: Press `Ctrl+P` to quickly cycle through models. Use `--models` CLI argument to scope to specific models (e.g., `--models claude-sonnet,gpt-4o`). Supports pattern matching and smart version selection (prefers aliases over dated versions). ([#37](https://github.com/badlogic/pi-mono/pull/37) by [@fightbulc](https://github.com/fightbulc))
279
-
280
- ## [0.7.24] - 2025-11-20
281
-
282
- ### Added
283
-
284
- - **Thinking Level Cycling**: Press `Shift+Tab` to cycle through thinking levels (off → minimal → low → medium → high) for reasoning-capable models. Editor border color changes to indicate current level (gray → blue → cyan → magenta). ([#36](https://github.com/badlogic/pi-mono/pull/36) by [@fightbulc](https://github.com/fightbulc))
285
-
286
- ## [0.7.23] - 2025-11-20
188
+ ## [0.11.0] - 2025-11-29
287
189
 
288
190
  ### Added
289
191
 
290
- - **Update Notifications**: Interactive mode now checks for new versions on startup and displays a notification if an update is available.
192
+ - **File-based Slash Commands**: Create custom reusable prompts as `.txt` files in `~/.pi/slash-commands/`. Files become `/filename` commands with first-line descriptions. Supports `{{selection}}` placeholder for referencing selected/attached content.
193
+ - **`/branch` Command**: Create conversation branches from any previous user message. Opens a selector to pick a message, then creates a new session file starting from that point. Original message text is placed in the editor for modification.
194
+ - **Unified Content References**: Both `@path` in messages and `--file path` CLI arguments now use the same attachment system with consistent MIME type detection.
195
+ - **Drag & Drop Files**: Drop files onto the terminal to attach them to your message. Supports multiple files and both text and image content.
291
196
 
292
197
  ### Changed
293
198
 
294
- - **System Prompt**: Updated system prompt to instruct agent to output plain text summaries directly instead of using cat or bash commands to display what it did.
295
-
296
- ### Fixed
297
-
298
- - **File Path Completion**: Removed 10-file limit in tab completion selector. All matching files and directories now appear in the completion list.
299
- - **Absolute Path Completion**: Fixed tab completion for absolute paths (e.g., `/Applications`). Absolute paths in the middle of text (like "hey /") now complete correctly. Also fixed crashes when trying to stat inaccessible files (like macOS `.VolumeIcon.icns`) during directory traversal.
300
-
301
- ## [0.7.22] - 2025-11-19
302
-
303
- ### Fixed
304
-
305
- - **Long Line Wrapping**: Fixed crash when rendering long lines without spaces (e.g., file paths). Long words now break character-by-character to fit within terminal width.
306
-
307
- ## [0.7.21] - 2025-11-19
199
+ - **Model Selector with Search**: The `/model` command now opens a searchable list. Type to filter models by name, use arrows to navigate, Enter to select.
200
+ - **Improved File Autocomplete**: File path completion after `@` now supports fuzzy matching and shows file/directory indicators.
201
+ - **Session Selector with Search**: The `--resume` and `--session` flags now open a searchable session list with fuzzy filtering.
202
+ - **Attachment Display**: Files added via `@path` are now shown as "Attached: filename" in the user message, separate from the prompt text.
203
+ - **Tab Completion**: Tab key now triggers file path autocompletion anywhere in the editor, not just after `@` symbol.
308
204
 
309
205
  ### Fixed
310
206
 
311
- - **Terminal Flicker**: Fixed flicker at bottom of viewport (especially editor component) in xterm.js-based terminals (VS Code, etc.) by using per-line clear instead of clear-to-end sequence.
312
- - **Background Color Rendering**: Fixed black cells appearing at end of wrapped lines when using background colors. Completely rewrote text wrapping and background application to properly handle ANSI reset codes.
313
- - **Tool Output**: Strip ANSI codes from bash/tool output before rendering to prevent conflicts with TUI styling.
207
+ - Fixed autocomplete z-order issue where dropdown could appear behind chat messages
208
+ - Fixed cursor position when navigating through wrapped lines in the editor
209
+ - Fixed attachment handling for continued sessions to preserve file references
314
210
 
315
- ## [0.7.20] - 2025-11-18
211
+ ## [0.10.6] - 2025-11-28
316
212
 
317
- ### Fixed
318
-
319
- - **Message Wrapping**: Fixed word-based text wrapping for long lines in chat messages. Text now properly wraps at word boundaries while preserving ANSI styling (colors, bold, italic, etc.) across wrapped lines. Background colors now extend to the full width of each line. Empty lines in messages now render correctly with full-width background.
213
+ ### Changed
320
214
 
321
- ## [0.7.18] - 2025-11-18
215
+ - Show base64-truncated indicator for large images in tool output
322
216
 
323
217
  ### Fixed
324
218
 
325
- - **Bash Tool Error Handling**: Bash tool now properly throws errors for failed commands (non-zero exit codes), timeouts, and aborted executions. This ensures tool execution components display with red background when bash commands fail.
326
- - **Thinking Traces Styling**: Thinking traces now maintain gray italic styling throughout, even when containing inline code blocks, bold text, or other inline formatting
219
+ - Fixed image dimensions not being read correctly from PNG/JPEG/GIF files
220
+ - Fixed PDF images being incorrectly base64-truncated in display
221
+ - Allow reading files from ancestor directories (needed for monorepo configs)
327
222
 
328
- ## [0.7.17] - 2025-11-18
223
+ ## [0.10.5] - 2025-11-28
329
224
 
330
225
  ### Added
331
226
 
332
- - **New Model**: Added `gemini-3-pro-preview` to Google provider.
333
- - **OAuth Authentication**: Added `/login` and `/logout` commands for OAuth-based authentication with Claude Pro/Max subscriptions. Tokens are stored in `~/.pi/agent/oauth.json` with 0600 permissions and automatically refreshed when expired. OAuth tokens take priority over API keys for Anthropic models.
334
-
335
- ### Fixed
336
-
337
- - **Anthropic Aborted Thinking**: Fixed error when resubmitting assistant messages with incomplete thinking blocks (from aborted streams). Thinking blocks without valid signatures are now converted to text blocks with `<thinking>` delimiters, preventing API rejection.
338
- - **Model Selector Loading**: Fixed models not appearing in `/model` selector until user started typing. Models now load asynchronously and re-render when available.
339
- - **Input Paste Support**: Added bracketed paste mode support to `Input` component, enabling paste of long OAuth authorization codes.
340
-
341
- ## [0.7.16] - 2025-11-17
342
-
343
- ### Fixed
344
-
345
- - **Tool Error Display**: Fixed edit tool (and all other tools) not showing error state correctly in TUI. Failed tool executions now properly display with red background and show the error message. Previously, the `isError` flag from tool execution events was not being passed to the UI component, causing all tool results to show with green (success) background regardless of whether they succeeded or failed.
346
-
347
- ## [0.7.15] - 2025-11-17
348
-
349
- ### Fixed
350
-
351
- - **Anthropic OAuth Support**: Added support for `ANTHROPIC_OAUTH_TOKEN` environment variable. The agent now checks for OAuth tokens before falling back to API keys for Anthropic models, enabling OAuth-based authentication.
352
-
353
- ## [0.7.14] - 2025-11-17
227
+ - Full multimodal support: attach images (PNG, JPEG, GIF, WebP) and PDFs to prompts using `@path` syntax or `--file` flag
354
228
 
355
229
  ### Fixed
356
230
 
357
- - **Mistral API Compatibility**: Fixed compatibility with Mistral API by excluding the `store` field and using `max_tokens` instead of `max_completion_tokens`, and avoiding the `developer` role in system prompts.
358
- - **Error Display**: Fixed error message display in assistant messages to include proper spacing before the error text.
359
- - **Message Streaming**: Fixed missing `message_start` event when no partial message chunks were received during streaming.
231
+ - `@`-references now handle special characters in file names (spaces, quotes, unicode)
232
+ - Fixed cursor positioning issues with multi-byte unicode characters in editor
360
233
 
361
- ## [0.7.13] - 2025-11-16
234
+ ## [0.10.4] - 2025-11-28
362
235
 
363
236
  ### Fixed
364
237
 
365
- - **TUI Editor**: Fixed unicode input support for umlauts (äöü), emojis (😀), and other extended characters. Previously the editor only accepted ASCII characters (32-126). Now properly handles all printable unicode while still filtering out control characters. ([#20](https://github.com/badlogic/pi-mono/pull/20))
238
+ - Removed padding on first user message in TUI to improve visual consistency.
366
239
 
367
- ## [0.7.12] - 2025-11-16
240
+ ## [0.10.3] - 2025-11-28
368
241
 
369
242
  ### Added
370
243
 
371
- - **Custom Models and Providers**: Support for custom models and providers via `~/.pi/agent/models.json` configuration file. Add local models (Ollama, vLLM, LM Studio) or any OpenAI-compatible, Anthropic-compatible, or Google-compatible API. File is reloaded on every `/model` selector open, allowing live updates without restart. ([#21](https://github.com/badlogic/pi-mono/issues/21))
372
- - Added `gpt-5.1-codex` model to OpenAI provider (400k context, 128k max output, reasoning-capable).
244
+ - Added RPC mode (`--rpc`) for programmatic integration. Accepts JSON commands on stdin, emits JSON events on stdout. See [RPC mode documentation](https://github.com/nicobailon/pi-mono/blob/main/packages/coding-agent/README.md#rpc-mode) for protocol details.
373
245
 
374
246
  ### Changed
375
247
 
376
- - **Breaking**: No longer hardcodes Anthropic/Claude as default provider/model. Now prefers sensible defaults per provider (e.g., `claude-sonnet-4-5` for Anthropic, `gpt-5.1-codex` for OpenAI), or requires explicit selection in interactive mode.
377
- - Interactive mode now allows starting without a model, showing helpful error on message submission instead of failing at startup.
378
- - Non-interactive mode (CLI messages, JSON, RPC) still fails early if no model or API key is available.
379
- - Model selector now saves selected model as default in settings.json.
380
- - `models.json` validation errors (syntax + schema) now surface with precise file/field info in both CLI and `/model` selector.
381
- - Agent system prompt now includes absolute path to its own README.md for self-documentation.
382
-
383
- ### Fixed
248
+ - Refactored internal architecture to support multiple frontends (TUI, RPC) with shared agent logic.
384
249
 
385
- - Fixed crash when restoring a session with a custom model that no longer exists or lost credentials. Now gracefully falls back to default model, logs the reason, and appends a warning message to the restored chat.
386
- - Footer no longer crashes when no model is selected.
387
-
388
- ## [0.7.11] - 2025-11-16
389
-
390
- ### Changed
391
-
392
- - The `/model` selector now filters models based on available API keys. Only models for which API keys are configured in environment variables are shown. This prevents selecting models that would fail due to missing credentials. A yellow hint is displayed at the top of the selector explaining this behavior. ([#19](https://github.com/badlogic/pi-mono/pull/19))
393
-
394
- ## [0.7.10] - 2025-11-14
250
+ ## [0.10.2] - 2025-11-26
395
251
 
396
252
  ### Added
397
253
 
398
- - `/branch` command for creating conversation branches. Opens a selector showing all user messages in chronological order. Selecting a message creates a new session with all messages before the selected one, and places the selected message in the editor for modification or resubmission. This allows exploring alternative conversation paths without losing the current session. (fixes [#16](https://github.com/badlogic/pi-mono/issues/16))
399
-
400
- ## [0.7.9] - 2025-11-14
254
+ - Added thinking level persistence. Default level stored in `~/.pi/settings.json`, restored on startup. Per-session overrides saved in session files.
255
+ - Added model cycling shortcut: `Ctrl+I` cycles through available models (or scoped models with `-m` flag).
256
+ - Added automatic retry with exponential backoff for transient API errors (network issues, 500s, overload).
257
+ - Cumulative token usage now shown in footer (total tokens used across all messages in session).
258
+ - Added `--system-prompt` flag to override default system prompt with custom text or file contents.
259
+ - Footer now shows estimated total cost in USD based on model pricing.
401
260
 
402
261
  ### Changed
403
262
 
404
- - Editor: updated keyboard shortcuts to follow Unix conventions:
405
- - **Ctrl+W** deletes the previous word (stopping at whitespace or punctuation)
406
- - **Ctrl+U** deletes from cursor to start of line (at line start, merges with previous line)
407
- - **Ctrl+K** deletes from cursor to end of line (at line end, merges with next line)
408
- - **Option+Backspace** in Ghostty now behaves like **Ctrl+W** (delete word backwards)
409
- - **Cmd+Backspace** in Ghostty now behaves like **Ctrl+U** (delete to start of line)
263
+ - Replaced `--models` flag with `-m/--model` supporting multiple values. Specify models as `provider/model@thinking` (e.g., `anthropic/claude-sonnet-4-20250514@high`). Multiple `-m` flags scope available models for the session.
264
+ - Thinking level border now persists visually after selector closes.
265
+ - Improved tool result display with collapsible output (default collapsed, expand with `Ctrl+O`).
410
266
 
411
- ## [0.7.8] - 2025-11-13
412
-
413
- ### Changed
414
-
415
- - Updated README.md with `/changelog` slash command documentation
416
-
417
- ## [0.7.7] - 2025-11-13
267
+ ## [0.10.1] - 2025-11-25
418
268
 
419
269
  ### Added
420
270
 
421
- - Automatic changelog display on startup in interactive mode. When starting a new session (not continuing/resuming), the agent will display all changelog entries since the last version you used. The last shown version is tracked in `~/.pi/agent/settings.json`.
422
- - `/changelog` command to display the changelog in the TUI
423
- - OpenRouter Auto Router model support ([#5](https://github.com/badlogic/pi-mono/pull/5))
424
- - Windows Git Bash support with automatic detection and process tree termination ([#1](https://github.com/badlogic/pi-mono/pull/1))
271
+ - Add custom model configuration via `~/.pi/models.json`
425
272
 
426
- ### Changed
273
+ ## [0.10.0] - 2025-11-25
427
274
 
428
- - **BREAKING**: Renamed project context file from `AGENT.md` to `AGENTS.md`. The system now looks for `AGENTS.md` or `CLAUDE.md` (with `AGENTS.md` preferred). Existing `AGENT.md` files will need to be renamed to `AGENTS.md` to continue working. (fixes [#9](https://github.com/badlogic/pi-mono/pull/9))
429
- - **BREAKING**: Session file format changed to store provider and model ID separately instead of as a single `provider/modelId` string. Existing sessions will not restore the model correctly when resumed - you'll need to manually set the model again using `/model`. (fixes [#4](https://github.com/badlogic/pi-mono/pull/4))
430
- - Improved Windows Git Bash detection logic with better error messages showing actual paths searched ([#13](https://github.com/badlogic/pi-mono/pull/13))
275
+ Initial public release.
431
276
 
432
- ### Fixed
433
-
434
- - Fixed markdown list rendering bug where bullets were not displayed when list items contained inline code with cyan color formatting
435
- - Fixed context percentage showing 0% in footer when last assistant message was aborted ([#12](https://github.com/badlogic/pi-mono/issues/12))
436
- - Fixed error message loss when `turn_end` event contains an error. Previously, errors in `turn_end` events (e.g., "Provider returned error" from OpenRouter Auto Router) were not captured in `agent.state.error`, making it appear as if the agent completed successfully. ([#6](https://github.com/badlogic/pi-mono/issues/6))
437
-
438
- ## [0.7.6] - 2025-11-13
277
+ ### Added
439
278
 
440
- Previous releases did not maintain a changelog.
279
+ - Interactive TUI with streaming responses
280
+ - Conversation session management with `--continue`, `--resume`, and `--session` flags
281
+ - Multi-line input support (Shift+Enter or Option+Enter for new lines)
282
+ - Tool execution: `read`, `write`, `edit`, `bash`, `glob`, `grep`, `think`
283
+ - Thinking mode support for Claude with visual indicator and `/thinking` selector
284
+ - File path autocompletion with `@` prefix
285
+ - Slash command autocompletion
286
+ - `/export` command for HTML session export
287
+ - `/model` command for runtime model switching
288
+ - `/session` command for session statistics
289
+ - Model provider support: Anthropic (Claude), OpenAI, Google (Gemini)
290
+ - Git branch display in footer
291
+ - Message queueing during streaming responses
292
+ - OAuth integration for Gmail and Google Calendar access
293
+ - HTML export with syntax highlighting and collapsible sections
package/README.md CHANGED
@@ -502,6 +502,16 @@ This allows you to explore alternative conversation paths without losing your cu
502
502
  /branch
503
503
  ```
504
504
 
505
+ ### /resume
506
+
507
+ Switch to a different session. Opens an interactive selector showing all available sessions. Select a session to load it and continue where you left off.
508
+
509
+ This is equivalent to the `--resume` CLI flag but can be used mid-session.
510
+
511
+ ```
512
+ /resume
513
+ ```
514
+
505
515
  ### /login
506
516
 
507
517
  Login with OAuth to use subscription-based models (Claude Pro/Max):
@@ -691,6 +701,8 @@ Change queue mode with `/queue` command. Setting is saved in `~/.pi/agent/settin
691
701
 
692
702
  **Navigation:**
693
703
  - **Arrow keys**: Move cursor (Up/Down navigate visual lines, Left/Right move by character)
704
+ - **Up Arrow** (empty editor): Browse previous prompts (history)
705
+ - **Down Arrow** (browsing history): Browse newer prompts or return to empty editor
694
706
  - **Option+Left** / **Ctrl+Left**: Move word backwards
695
707
  - **Option+Right** / **Ctrl+Right**: Move word forwards
696
708
  - **Ctrl+A** / **Home**: Jump to start of line
@@ -0,0 +1,7 @@
1
+ export interface FuzzyMatch {
2
+ matches: boolean;
3
+ score: number;
4
+ }
5
+ export declare function fuzzyMatch(query: string, text: string): FuzzyMatch;
6
+ export declare function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[];
7
+ //# sourceMappingURL=fuzzy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fuzzy.d.ts","sourceRoot":"","sources":["../src/fuzzy.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAoDlE;AAGD,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,CAAC,EAAE,CAmB3F","sourcesContent":["// Fuzzy search. Matches if all query characters appear in order (not necessarily consecutive).\n// Lower score = better match.\n\nexport interface FuzzyMatch {\n\tmatches: boolean;\n\tscore: number;\n}\n\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch {\n\tconst queryLower = query.toLowerCase();\n\tconst textLower = text.toLowerCase();\n\n\tif (queryLower.length === 0) {\n\t\treturn { matches: true, score: 0 };\n\t}\n\n\tif (queryLower.length > textLower.length) {\n\t\treturn { matches: false, score: 0 };\n\t}\n\n\tlet queryIndex = 0;\n\tlet score = 0;\n\tlet lastMatchIndex = -1;\n\tlet consecutiveMatches = 0;\n\n\tfor (let i = 0; i < textLower.length && queryIndex < queryLower.length; i++) {\n\t\tif (textLower[i] === queryLower[queryIndex]) {\n\t\t\tconst isWordBoundary = i === 0 || /[\\s\\-_./]/.test(textLower[i - 1]!);\n\n\t\t\t// Reward consecutive character matches (e.g., typing \"foo\" matches \"foobar\" better than \"f_o_o\")\n\t\t\tif (lastMatchIndex === i - 1) {\n\t\t\t\tconsecutiveMatches++;\n\t\t\t\tscore -= consecutiveMatches * 5;\n\t\t\t} else {\n\t\t\t\tconsecutiveMatches = 0;\n\t\t\t\t// Penalize gaps between matched characters\n\t\t\t\tif (lastMatchIndex >= 0) {\n\t\t\t\t\tscore += (i - lastMatchIndex - 1) * 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reward matches at word boundaries (start of words are more likely intentional targets)\n\t\t\tif (isWordBoundary) {\n\t\t\t\tscore -= 10;\n\t\t\t}\n\n\t\t\t// Slight penalty for matches later in the string (prefer earlier matches)\n\t\t\tscore += i * 0.1;\n\n\t\t\tlastMatchIndex = i;\n\t\t\tqueryIndex++;\n\t\t}\n\t}\n\n\t// Not all query characters were found in order\n\tif (queryIndex < queryLower.length) {\n\t\treturn { matches: false, score: 0 };\n\t}\n\n\treturn { matches: true, score };\n}\n\n// Filter and sort items by fuzzy match quality (best matches first)\nexport function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[] {\n\tif (!query.trim()) {\n\t\treturn items;\n\t}\n\n\tconst results: { item: T; score: number }[] = [];\n\n\tfor (const item of items) {\n\t\tconst text = getText(item);\n\t\tconst match = fuzzyMatch(query, text);\n\t\tif (match.matches) {\n\t\t\tresults.push({ item, score: match.score });\n\t\t}\n\t}\n\n\t// Sort ascending by score (lower = better match)\n\tresults.sort((a, b) => a.score - b.score);\n\n\treturn results.map((r) => r.item);\n}\n"]}