@mariozechner/pi-coding-agent 0.12.10 → 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.
Files changed (51) hide show
  1. package/CHANGELOG.md +138 -268
  2. package/README.md +50 -0
  3. package/dist/fuzzy.d.ts +7 -0
  4. package/dist/fuzzy.d.ts.map +1 -0
  5. package/dist/fuzzy.js +64 -0
  6. package/dist/fuzzy.js.map +1 -0
  7. package/dist/fuzzy.test.d.ts +2 -0
  8. package/dist/fuzzy.test.d.ts.map +1 -0
  9. package/dist/fuzzy.test.js +76 -0
  10. package/dist/fuzzy.test.js.map +1 -0
  11. package/dist/main.d.ts.map +1 -1
  12. package/dist/main.js +61 -49
  13. package/dist/main.js.map +1 -1
  14. package/dist/model-config.d.ts.map +1 -1
  15. package/dist/model-config.js +9 -1
  16. package/dist/model-config.js.map +1 -1
  17. package/dist/settings-manager.d.ts +3 -0
  18. package/dist/settings-manager.d.ts.map +1 -1
  19. package/dist/settings-manager.js +7 -0
  20. package/dist/settings-manager.js.map +1 -1
  21. package/dist/tui/assistant-message.d.ts +3 -1
  22. package/dist/tui/assistant-message.d.ts.map +1 -1
  23. package/dist/tui/assistant-message.js +26 -9
  24. package/dist/tui/assistant-message.js.map +1 -1
  25. package/dist/tui/compaction.d.ts.map +1 -1
  26. package/dist/tui/compaction.js +5 -4
  27. package/dist/tui/compaction.js.map +1 -1
  28. package/dist/tui/custom-editor.d.ts +1 -0
  29. package/dist/tui/custom-editor.d.ts.map +1 -1
  30. package/dist/tui/custom-editor.js +6 -0
  31. package/dist/tui/custom-editor.js.map +1 -1
  32. package/dist/tui/footer.d.ts.map +1 -1
  33. package/dist/tui/footer.js +18 -6
  34. package/dist/tui/footer.js.map +1 -1
  35. package/dist/tui/model-selector.d.ts.map +1 -1
  36. package/dist/tui/model-selector.js +2 -13
  37. package/dist/tui/model-selector.js.map +1 -1
  38. package/dist/tui/session-selector.d.ts.map +1 -1
  39. package/dist/tui/session-selector.js +2 -14
  40. package/dist/tui/session-selector.js.map +1 -1
  41. package/dist/tui/tool-execution.d.ts.map +1 -1
  42. package/dist/tui/tool-execution.js +11 -1
  43. package/dist/tui/tool-execution.js.map +1 -1
  44. package/dist/tui/tui-renderer.d.ts +6 -1
  45. package/dist/tui/tui-renderer.d.ts.map +1 -1
  46. package/dist/tui/tui-renderer.js +133 -15
  47. package/dist/tui/tui-renderer.js.map +1 -1
  48. package/dist/tui/user-message-selector.d.ts.map +1 -1
  49. package/dist/tui/user-message-selector.js +3 -3
  50. package/dist/tui/user-message-selector.js.map +1 -1
  51. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,6 +1,40 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased]
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
+
20
+ ## [0.12.11] - 2025-12-05
21
+
22
+ ### Changed
23
+
24
+ - **Compaction UI**: Simplified collapsed compaction indicator to show warning-colored text with token count instead of styled banner. Removed redundant success message after compaction. ([#108](https://github.com/badlogic/pi-mono/issues/108))
25
+
26
+ ### Fixed
27
+
28
+ - **Print mode error handling**: `-p` flag now outputs error messages and exits with code 1 when requests fail, instead of silently producing no output.
29
+ - **Branch selector crash**: Fixed TUI crash when user messages contained Unicode characters (like `✔` or `›`) that caused line width to exceed terminal width. Now uses proper `truncateToWidth` instead of `substring`.
30
+ - **Bash output escape sequences**: Fixed incomplete stripping of terminal escape sequences in bash tool output. `stripAnsi` misses some sequences like standalone String Terminator (`ESC \`), which could cause rendering issues when displaying captured TUI output.
31
+ - **Footer overflow crash**: Fixed TUI crash when terminal width is too narrow for the footer stats line. The footer now truncates gracefully instead of overflowing.
32
+
33
+ ### Added
34
+
35
+ - **`authHeader` option in models.json**: Custom providers can set `"authHeader": true` to automatically add `Authorization: Bearer <apiKey>` header. Useful for providers that require explicit auth headers. ([#81](https://github.com/badlogic/pi-mono/issues/81))
36
+ - **`--append-system-prompt` Flag**: Append additional text or file contents to the system prompt. Supports both inline text and file paths. Complements `--system-prompt` for layering custom instructions without replacing the base system prompt. ([#114](https://github.com/badlogic/pi-mono/pull/114) by [@markusylisiurunen](https://github.com/markusylisiurunen))
37
+ - **Thinking Block Toggle**: Added `Ctrl+T` shortcut to toggle visibility of LLM thinking blocks. When toggled off, shows a static "Thinking..." label instead of full content. Useful for reducing visual clutter during long conversations. ([#113](https://github.com/badlogic/pi-mono/pull/113) by [@markusylisiurunen](https://github.com/markusylisiurunen))
4
38
 
5
39
  ## [0.12.10] - 2025-12-04
6
40
 
@@ -46,378 +80,214 @@
46
80
 
47
81
  ### Added
48
82
 
49
- - **`/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.
50
-
51
- ### Fixed
52
-
53
- - **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.
54
84
 
55
85
  ## [0.12.3] - 2025-12-02
56
86
 
57
87
  ### Fixed
58
88
 
59
- - **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.
60
91
 
61
92
  ## [0.12.2] - 2025-12-02
62
93
 
63
- ### Fixed
64
-
65
- - **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`.
66
-
67
- ## [0.12.1] - 2025-12-02
68
-
69
94
  ### Changed
70
95
 
71
- - **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.
72
-
73
- ## [0.12.0] - 2025-12-02
74
-
75
- ### Added
76
-
77
- - **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.
78
-
79
- ## [0.11.6] - 2025-12-02
80
-
81
- ### Added
82
-
83
- - **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))
84
- - **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.
85
-
86
- ## [0.11.5] - 2025-12-01
87
-
88
- ### Added
89
-
90
- - **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))
91
-
92
- ## [0.11.4] - 2025-12-01
93
-
94
- ### Improved
95
-
96
- - **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.
96
+ - Removed support for gpt-4.5-preview and o3 models (not yet available)
97
97
 
98
- ### Fixed
99
-
100
- - **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))
101
-
102
- ## [0.11.3] - 2025-12-01
98
+ ## [0.12.1] - 2025-12-02
103
99
 
104
100
  ### Added
105
101
 
106
- - **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))
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)
107
108
 
108
- ### Fixed
109
-
110
- - **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))
111
-
112
- ## [0.11.1] - 2025-11-29
109
+ ## [0.12.0] - 2025-12-02
113
110
 
114
111
  ### Added
115
112
 
116
- - **`--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))
117
-
118
- - **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))
119
-
120
- - **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.
121
- - `grep`: Uses `ripgrep` (auto-downloaded) for fast regex searching. Respects `.gitignore` (including nested), supports glob filtering, context lines, and hidden files.
122
- - `find`: Uses `fd` (auto-downloaded) for fast file finding. Respects `.gitignore`, supports glob patterns, and hidden files.
123
- - `ls`: Lists directory contents with proper sorting and indicators.
124
- - **`--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`).
125
- - **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).
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.
126
121
 
127
- ### Fixed
122
+ ### Changed
128
123
 
129
- - **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))
130
- - **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))
131
- - **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.
132
126
 
133
- ## [0.10.2] - 2025-11-27
127
+ ## [0.11.9] - 2025-12-02
134
128
 
135
129
  ### Changed
136
130
 
137
- - **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))
138
- - **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))
131
+ - Change Ctrl+I to Ctrl+P for model cycling shortcut to avoid collision with Tab key in some terminals
139
132
 
140
- ## [0.10.1] - 2025-11-27
141
-
142
- ### Added
143
-
144
- - **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
145
134
 
146
135
  ### Fixed
147
136
 
148
- - **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))
149
- - **Edit Diff Line Number Alignment**: Fixed two issues with diff display in the edit tool:
150
- 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.
151
- 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.
152
-
153
- ### Improved
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.
154
138
 
155
- - **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))
156
- - **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))
157
-
158
- ## [0.10.0] - 2025-11-27
159
-
160
- ### Added
161
-
162
- - **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
163
140
 
164
141
  ### Fixed
165
142
 
166
- - **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.
167
- - **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))
168
-
169
- ## [0.9.3] - 2025-11-24
170
-
171
- ### Added
172
-
173
- - Added Anthropic Claude Opus 4.5 support
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.
174
144
 
175
- ## [0.9.2] - 2025-11-24
145
+ ## [0.11.6] - 2025-12-01
176
146
 
177
147
  ### Fixed
178
148
 
179
- - **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))
149
+ - Fix `--system-prompt <path>` allowing the path argument to be captured by the message collection, causing "file not found" errors.
180
150
 
181
- ## [0.9.0] - 2025-11-21
182
-
183
- ### Added
184
-
185
- - **`/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))
186
- - **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))
187
- - **`--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))
188
-
189
- ### Breaking
190
-
191
- - **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
192
152
 
193
153
  ### Fixed
194
154
 
195
- - **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))
196
- - **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`.
197
- - **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.
198
158
 
199
- ## [0.8.5] - 2025-11-21
159
+ ## [0.11.4] - 2025-11-30
200
160
 
201
161
  ### Fixed
202
162
 
203
- - **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))
204
- - **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.
205
164
 
206
- ## [0.8.4] - 2025-11-21
165
+ ## [0.11.3] - 2025-11-29
207
166
 
208
167
  ### Fixed
209
168
 
210
- - **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.
211
-
212
- ## [0.8.3] - 2025-11-21
213
-
214
- ### Improved
215
-
216
- - **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.
217
- - **Dark Theme**: Increased visibility of editor border (darkGray from #303030 to #505050) and thinking minimal indicator (from #4e4e4e to #6e6e6e).
218
-
219
- ## [0.8.0] - 2025-11-21
220
-
221
- ### Added
222
-
223
- - **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.
224
-
225
- ## [0.7.29] - 2025-11-20
226
-
227
- ### Improved
228
-
229
- - **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).
230
-
231
- ## [0.7.28] - 2025-11-20
232
-
233
- ### Added
234
-
235
- - **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))
169
+ - Fix file drop functionality for absolute paths
236
170
 
237
- ## [0.7.27] - 2025-11-20
171
+ ## [0.11.2] - 2025-11-29
238
172
 
239
173
  ### Fixed
240
174
 
241
- - **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))
242
- - **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.
243
177
 
244
- ## [0.7.26] - 2025-11-20
178
+ ## [0.11.1] - 2025-11-29
245
179
 
246
180
  ### Added
247
181
 
248
- - **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))
249
- - **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
250
183
 
251
184
  ### Fixed
252
185
 
253
- - **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))
254
- - **Mistral/Chutes Syntax Error**: Fixed syntax error in merged PR that used `iif` instead of `if`.
255
- - **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.
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
256
187
 
257
- ## [0.7.25] - 2025-11-20
188
+ ## [0.11.0] - 2025-11-29
258
189
 
259
190
  ### Added
260
191
 
261
- - **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))
262
-
263
- ## [0.7.24] - 2025-11-20
264
-
265
- ### Added
266
-
267
- - **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))
268
-
269
- ## [0.7.23] - 2025-11-20
270
-
271
- ### Added
272
-
273
- - **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.
274
196
 
275
197
  ### Changed
276
198
 
277
- - **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.
278
-
279
- ### Fixed
280
-
281
- - **File Path Completion**: Removed 10-file limit in tab completion selector. All matching files and directories now appear in the completion list.
282
- - **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.
283
-
284
- ## [0.7.22] - 2025-11-19
285
-
286
- ### Fixed
287
-
288
- - **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.
289
-
290
- ## [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.
291
204
 
292
205
  ### Fixed
293
206
 
294
- - **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.
295
- - **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.
296
- - **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
297
210
 
298
- ## [0.7.20] - 2025-11-18
211
+ ## [0.10.6] - 2025-11-28
299
212
 
300
- ### Fixed
301
-
302
- - **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
303
214
 
304
- ## [0.7.18] - 2025-11-18
215
+ - Show base64-truncated indicator for large images in tool output
305
216
 
306
217
  ### Fixed
307
218
 
308
- - **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.
309
- - **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)
310
222
 
311
- ## [0.7.17] - 2025-11-18
223
+ ## [0.10.5] - 2025-11-28
312
224
 
313
225
  ### Added
314
226
 
315
- - **New Model**: Added `gemini-3-pro-preview` to Google provider.
316
- - **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.
317
-
318
- ### Fixed
319
-
320
- - **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.
321
- - **Model Selector Loading**: Fixed models not appearing in `/model` selector until user started typing. Models now load asynchronously and re-render when available.
322
- - **Input Paste Support**: Added bracketed paste mode support to `Input` component, enabling paste of long OAuth authorization codes.
323
-
324
- ## [0.7.16] - 2025-11-17
325
-
326
- ### Fixed
327
-
328
- - **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.
329
-
330
- ## [0.7.15] - 2025-11-17
331
-
332
- ### Fixed
333
-
334
- - **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.
335
-
336
- ## [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
337
228
 
338
229
  ### Fixed
339
230
 
340
- - **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.
341
- - **Error Display**: Fixed error message display in assistant messages to include proper spacing before the error text.
342
- - **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
343
233
 
344
- ## [0.7.13] - 2025-11-16
234
+ ## [0.10.4] - 2025-11-28
345
235
 
346
236
  ### Fixed
347
237
 
348
- - **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.
349
239
 
350
- ## [0.7.12] - 2025-11-16
240
+ ## [0.10.3] - 2025-11-28
351
241
 
352
242
  ### Added
353
243
 
354
- - **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))
355
- - 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.
356
245
 
357
246
  ### Changed
358
247
 
359
- - **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.
360
- - Interactive mode now allows starting without a model, showing helpful error on message submission instead of failing at startup.
361
- - Non-interactive mode (CLI messages, JSON, RPC) still fails early if no model or API key is available.
362
- - Model selector now saves selected model as default in settings.json.
363
- - `models.json` validation errors (syntax + schema) now surface with precise file/field info in both CLI and `/model` selector.
364
- - Agent system prompt now includes absolute path to its own README.md for self-documentation.
248
+ - Refactored internal architecture to support multiple frontends (TUI, RPC) with shared agent logic.
365
249
 
366
- ### Fixed
367
-
368
- - 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.
369
- - Footer no longer crashes when no model is selected.
370
-
371
- ## [0.7.11] - 2025-11-16
372
-
373
- ### Changed
374
-
375
- - 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))
376
-
377
- ## [0.7.10] - 2025-11-14
250
+ ## [0.10.2] - 2025-11-26
378
251
 
379
252
  ### Added
380
253
 
381
- - `/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))
382
-
383
- ## [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.
384
260
 
385
261
  ### Changed
386
262
 
387
- - Editor: updated keyboard shortcuts to follow Unix conventions:
388
- - **Ctrl+W** deletes the previous word (stopping at whitespace or punctuation)
389
- - **Ctrl+U** deletes from cursor to start of line (at line start, merges with previous line)
390
- - **Ctrl+K** deletes from cursor to end of line (at line end, merges with next line)
391
- - **Option+Backspace** in Ghostty now behaves like **Ctrl+W** (delete word backwards)
392
- - **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`).
393
266
 
394
- ## [0.7.8] - 2025-11-13
395
-
396
- ### Changed
397
-
398
- - Updated README.md with `/changelog` slash command documentation
399
-
400
- ## [0.7.7] - 2025-11-13
267
+ ## [0.10.1] - 2025-11-25
401
268
 
402
269
  ### Added
403
270
 
404
- - 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`.
405
- - `/changelog` command to display the changelog in the TUI
406
- - OpenRouter Auto Router model support ([#5](https://github.com/badlogic/pi-mono/pull/5))
407
- - Windows Git Bash support with automatic detection and process tree termination ([#1](https://github.com/badlogic/pi-mono/pull/1))
408
-
409
- ### Changed
410
-
411
- - **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))
412
- - **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))
413
- - Improved Windows Git Bash detection logic with better error messages showing actual paths searched ([#13](https://github.com/badlogic/pi-mono/pull/13))
271
+ - Add custom model configuration via `~/.pi/models.json`
414
272
 
415
- ### Fixed
273
+ ## [0.10.0] - 2025-11-25
416
274
 
417
- - Fixed markdown list rendering bug where bullets were not displayed when list items contained inline code with cyan color formatting
418
- - Fixed context percentage showing 0% in footer when last assistant message was aborted ([#12](https://github.com/badlogic/pi-mono/issues/12))
419
- - 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))
275
+ Initial public release.
420
276
 
421
- ## [0.7.6] - 2025-11-13
277
+ ### Added
422
278
 
423
- 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