@oh-my-pi/pi-coding-agent 3.20.1 → 3.21.0

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 (94) hide show
  1. package/CHANGELOG.md +69 -9
  2. package/docs/custom-tools.md +3 -3
  3. package/docs/extensions.md +226 -220
  4. package/docs/hooks.md +2 -2
  5. package/docs/sdk.md +3 -3
  6. package/examples/custom-tools/README.md +2 -2
  7. package/examples/custom-tools/subagent/index.ts +1 -1
  8. package/examples/extensions/README.md +76 -74
  9. package/examples/extensions/todo.ts +2 -5
  10. package/examples/hooks/custom-compaction.ts +1 -1
  11. package/examples/hooks/handoff.ts +1 -1
  12. package/examples/hooks/qna.ts +1 -1
  13. package/examples/sdk/02-custom-model.ts +1 -1
  14. package/examples/sdk/12-full-control.ts +1 -1
  15. package/examples/sdk/README.md +1 -1
  16. package/package.json +5 -5
  17. package/src/cli/file-processor.ts +1 -1
  18. package/src/cli/list-models.ts +1 -1
  19. package/src/core/agent-session.ts +13 -2
  20. package/src/core/auth-storage.ts +1 -1
  21. package/src/core/compaction/branch-summarization.ts +2 -2
  22. package/src/core/compaction/compaction.ts +2 -2
  23. package/src/core/compaction/utils.ts +1 -1
  24. package/src/core/custom-tools/types.ts +1 -1
  25. package/src/core/extensions/runner.ts +1 -1
  26. package/src/core/extensions/types.ts +1 -1
  27. package/src/core/extensions/wrapper.ts +1 -1
  28. package/src/core/hooks/runner.ts +2 -2
  29. package/src/core/hooks/types.ts +1 -1
  30. package/src/core/messages.ts +1 -1
  31. package/src/core/model-registry.ts +1 -1
  32. package/src/core/model-resolver.ts +1 -1
  33. package/src/core/sdk.ts +33 -4
  34. package/src/core/session-manager.ts +11 -22
  35. package/src/core/settings-manager.ts +66 -1
  36. package/src/core/slash-commands.ts +12 -5
  37. package/src/core/system-prompt.ts +27 -3
  38. package/src/core/title-generator.ts +2 -2
  39. package/src/core/tools/ask.ts +88 -1
  40. package/src/core/tools/bash-interceptor.ts +7 -0
  41. package/src/core/tools/bash.ts +106 -0
  42. package/src/core/tools/edit-diff.ts +73 -24
  43. package/src/core/tools/edit.ts +214 -20
  44. package/src/core/tools/find.ts +155 -0
  45. package/src/core/tools/gemini-image.ts +279 -56
  46. package/src/core/tools/git.ts +4 -0
  47. package/src/core/tools/grep.ts +191 -0
  48. package/src/core/tools/index.ts +3 -6
  49. package/src/core/tools/ls.ts +134 -1
  50. package/src/core/tools/lsp/render.ts +34 -14
  51. package/src/core/tools/notebook.ts +110 -0
  52. package/src/core/tools/output.ts +179 -7
  53. package/src/core/tools/read.ts +122 -9
  54. package/src/core/tools/render-utils.ts +241 -0
  55. package/src/core/tools/renderers.ts +40 -828
  56. package/src/core/tools/review.ts +26 -7
  57. package/src/core/tools/rulebook.ts +3 -1
  58. package/src/core/tools/task/index.ts +18 -3
  59. package/src/core/tools/task/render.ts +5 -0
  60. package/src/core/tools/task/types.ts +1 -1
  61. package/src/core/tools/truncate.ts +27 -1
  62. package/src/core/tools/web-fetch.ts +23 -15
  63. package/src/core/tools/web-search/index.ts +130 -45
  64. package/src/core/tools/web-search/providers/anthropic.ts +7 -2
  65. package/src/core/tools/web-search/providers/exa.ts +2 -1
  66. package/src/core/tools/web-search/providers/perplexity.ts +6 -1
  67. package/src/core/tools/web-search/render.ts +5 -0
  68. package/src/core/tools/web-search/types.ts +13 -0
  69. package/src/core/tools/write.ts +90 -0
  70. package/src/core/voice.ts +1 -1
  71. package/src/main.ts +1 -1
  72. package/src/modes/interactive/components/assistant-message.ts +1 -1
  73. package/src/modes/interactive/components/custom-message.ts +1 -1
  74. package/src/modes/interactive/components/extensions/inspector-panel.ts +25 -22
  75. package/src/modes/interactive/components/extensions/state-manager.ts +12 -0
  76. package/src/modes/interactive/components/footer.ts +1 -1
  77. package/src/modes/interactive/components/hook-message.ts +1 -1
  78. package/src/modes/interactive/components/model-selector.ts +1 -1
  79. package/src/modes/interactive/components/oauth-selector.ts +1 -1
  80. package/src/modes/interactive/components/settings-defs.ts +49 -0
  81. package/src/modes/interactive/components/status-line.ts +1 -1
  82. package/src/modes/interactive/components/tool-execution.ts +93 -538
  83. package/src/modes/interactive/interactive-mode.ts +19 -7
  84. package/src/modes/print-mode.ts +1 -1
  85. package/src/modes/rpc/rpc-client.ts +1 -1
  86. package/src/modes/rpc/rpc-types.ts +1 -1
  87. package/src/prompts/system-prompt.md +4 -0
  88. package/src/prompts/tools/gemini-image.md +5 -1
  89. package/src/prompts/tools/output.md +4 -0
  90. package/src/prompts/tools/web-fetch.md +1 -0
  91. package/src/prompts/tools/web-search.md +2 -0
  92. package/src/utils/image-convert.ts +8 -2
  93. package/src/utils/image-magick.ts +247 -0
  94. package/src/utils/image-resize.ts +53 -13
package/CHANGELOG.md CHANGED
@@ -2,7 +2,59 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [3.21.0] - 2026-01-06
6
+
7
+ ### Changed
8
+
9
+ - Switched from local `@oh-my-pi/pi-ai` to upstream `@mariozechner/pi-ai` package
10
+
11
+ ### Added
12
+
13
+ - Added `webSearchProvider` setting to override auto-detection priority (Exa > Perplexity > Anthropic)
14
+ - Added `imageProvider` setting to override auto-detection priority (OpenRouter > Gemini)
15
+ - Added `git.enabled` setting to enable/disable the structured git tool
16
+ - Added `offset` and `limit` parameters to Output tool for paginated reading of large outputs
17
+ - Added provider fallback chain for web search that tries all configured providers before failing
18
+ - Added `WebSearchProviderError` class with HTTP status for actionable provider error messages
19
+ - Added bash interceptor rule to block git commands when structured git tool is enabled
20
+ - Added validation requiring `message` parameter for git commit operations (prevents interactive editor)
21
+ - Added output ID hints in multi-agent Task results pointing to Output tool for full logs
22
+ - Added fuzzy matching support for `all: true` mode in edit tool, enabling replacement of similar text blocks with whitespace differences
23
+ - Added `all` parameter to edit tool for replacing all occurrences instead of requiring unique matches
24
+ - Added OpenRouter support for image generation when `OPENROUTER_API_KEY` is set
25
+ - Added ImageMagick fallback for image processing when sharp module is unavailable
26
+ - Added slash commands to the extensions inspector panel for visibility and management
27
+ - Added support for file-based slash commands from `commands/` directories
28
+ - Added `$ARGUMENTS` placeholder for slash command argument substitution, aligning with Claude and Codex conventions
29
+
30
+ ### Changed
31
+
32
+ - Refactored tool renderers to be co-located with their respective tool implementations for improved code organization
33
+ - Changed web search to try all configured providers in sequence with fallback before reporting errors
34
+ - Changed default Anthropic web search model from `claude-sonnet-4-5-20250514` to `claude-haiku-4-5`
35
+ - Changed read tool to show first 50KB of oversized lines instead of directing users to bash sed
36
+ - Changed web_fetch to use `Bun.which()` instead of spawning `which`/`where` for command detection
37
+ - Changed web_fetch to check Content-Length header before downloading to reject oversized files early
38
+ - Changed generate_image tool to save images to temp files and report paths instead of inline base64
39
+ - Changed system prompt with tool usage guidance (ground answers with tools, minimize context, iterate on results)
40
+ - Changed Task tool prompt with plan-then-execute guidance and output tool hints
41
+ - Changed edit tool success message to report count when replacing multiple occurrences with `all: true`
42
+ - Changed default image generation model to `gemini-3-pro-image-preview`
43
+ - Changed error message for multiple occurrences to suggest using `all: true` option
44
+ - Changed web_fetch tool label from `web_fetch` to `Web Fetch` for improved display
45
+ - Changed argument substitution order in slash commands to process positional args ($1, $2) before wildcards ($@, $ARGUMENTS) to prevent re-substitution issues
46
+ - Changed image tool name from `gemini_image` to `generate_image` with label `GenerateImage`
47
+
48
+ ### Fixed
49
+
50
+ - Fixed read tool markitdown truncation message using broken template string (missing `${` around format call)
51
+ - Fixed web_fetch URL normalization order to run before special handlers
52
+ - Fixed TUI image display for generate_image tool by sourcing images from details.images in addition to content blocks
53
+ - Fixed context file preview in inspector panel to display content correctly instead of attempting async file reads
54
+ - Fixed Linux ARM64 installs failing on fresh Debian when the `sharp` module is unavailable during session image compression
55
+
5
56
  ## [3.20.1] - 2026-01-06
57
+
6
58
  ### Fixed
7
59
 
8
60
  - Fixed find tool failing to match patterns with path separators (e.g., `reports/**`) by enabling full-path matching in fd
@@ -13,6 +65,7 @@
13
65
  - Changed ls tool to show relative modification times (e.g., "2d ago", "just now") for each entry
14
66
 
15
67
  ## [3.20.0] - 2026-01-06
68
+
16
69
  ### Added
17
70
 
18
71
  - Added extensions API with auto-discovery (`.omp/extensions`) and `--extension`/`-e` loading for custom tools, commands, and lifecycle hooks
@@ -152,6 +205,7 @@
152
205
  - Fixed session persistence to truncate oversized entries before writing JSONL to prevent out-of-memory errors
153
206
 
154
207
  ## [3.14.0] - 2026-01-04
208
+
155
209
  ### Added
156
210
 
157
211
  - Added `getUsageStatistics()` method to SessionManager for tracking cumulative token usage and costs across session messages
@@ -176,6 +230,7 @@
176
230
  - Fixed stale diagnostics persisting after file content changes in LSP client
177
231
 
178
232
  ## [3.8.1337] - 2026-01-04
233
+
179
234
  ### Added
180
235
 
181
236
  - Added automatic browser opening after exporting session to HTML
@@ -186,6 +241,7 @@
186
241
  - Fixed session titles not persisting to file when set before first flush
187
242
 
188
243
  ## [3.7.1337] - 2026-01-04
244
+
189
245
  ### Added
190
246
 
191
247
  - Added `EditMatchError` class for structured error handling in edit operations
@@ -244,6 +300,7 @@
244
300
  - Updated version update notification to suggest `omp update` instead of manual npm install command
245
301
 
246
302
  ## [3.1.1337] - 2026-01-03
303
+
247
304
  ### Added
248
305
 
249
306
  - Added `spawns` frontmatter field for agent definitions to control which sub-agents can be spawned
@@ -262,7 +319,7 @@
262
319
  - Added Discovery settings tab in interactive mode to enable/disable individual configuration providers
263
320
  - Added provider source attribution showing which tool contributed each configuration item
264
321
  - Added support for Cursor MDC rule format with frontmatter (description, globs, alwaysApply)
265
- - Added support for Windsurf rules from .windsurf/rules/*.md and global_rules.md
322
+ - Added support for Windsurf rules from .windsurf/rules/\*.md and global_rules.md
266
323
  - Added support for Cline rules from .clinerules file or directory
267
324
  - Added support for GitHub Copilot instructions with applyTo glob patterns
268
325
  - Added support for Gemini extensions and system.md customization files
@@ -299,6 +356,7 @@
299
356
  - Removed separate asset copying steps from build scripts
300
357
 
301
358
  ## [2.0.1337] - 2026-01-03
359
+
302
360
  ### Added
303
361
 
304
362
  - Added shell environment snapshot to preserve user aliases, functions, and shell options when executing bash commands
@@ -311,6 +369,7 @@
311
369
  - Changed Edit tool to reject `.ipynb` files with guidance to use NotebookEdit tool instead
312
370
 
313
371
  ## [1.500.0] - 2026-01-03
372
+
314
373
  ### Added
315
374
 
316
375
  - Added provider tabs to model selector with Tab/Arrow navigation for filtering models by provider
@@ -372,6 +431,7 @@
372
431
  - Fixed Task tool showing "done + succeeded" when aborted; now correctly displays "⊘ aborted" status
373
432
 
374
433
  ## [1.341.0] - 2026-01-03
434
+
375
435
  ### Added
376
436
 
377
437
  - Added interruptMode setting to control when queued messages are processed during tool execution.
@@ -587,7 +647,7 @@ See [docs/custom-tools.md](docs/custom-tools.md) and [examples/custom-tools/](ex
587
647
  - `AppMessage` → `AgentMessage`
588
648
  - `sessionFile` returns `string | undefined` (was `string | null`)
589
649
  - `model` returns `Model | undefined` (was `Model | null`)
590
- - `Attachment` type removed. Use `ImageContent` from `@oh-my-pi/pi-ai` instead. Add images directly to message content arrays.
650
+ - `Attachment` type removed. Use `ImageContent` from `@mariozechner/pi-ai` instead. Add images directly to message content arrays.
591
651
 
592
652
  **AgentSession API:**
593
653
 
@@ -813,7 +873,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
813
873
  - `createAgentSession()` now accepts `authStorage` and `modelRegistry` options
814
874
  - Removed `configureOAuthStorage()`, `defaultGetApiKey()`, `findModel()`, `discoverAvailableModels()`
815
875
  - Removed `getApiKey` callback option (use `AuthStorage.setRuntimeApiKey()` for runtime overrides)
816
- - Use `getModel()` from `@oh-my-pi/pi-ai` for built-in models, `modelRegistry.find()` for custom models + built-in models
876
+ - Use `getModel()` from `@mariozechner/pi-ai` for built-in models, `modelRegistry.find()` for custom models + built-in models
817
877
  - See updated [SDK documentation](docs/sdk.md) and [README](README.md)
818
878
 
819
879
  - **Settings changes**: Removed `apiKeys` from `settings.json`. Use `auth.json` instead. ([#296](https://github.com/badlogic/pi-mono/issues/296))
@@ -1116,7 +1176,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1116
1176
  - `rpc.md`: Added missing `hook_error` event documentation
1117
1177
  - `README.md`: Complete settings table, condensed philosophy section, standardized OAuth docs
1118
1178
 
1119
- - Hooks loader now supports same import aliases as custom tools (`@sinclair/typebox`, `@oh-my-pi/pi-ai`, `@oh-my-pi/pi-tui`, `@oh-my-pi/pi-coding-agent`).
1179
+ - Hooks loader now supports same import aliases as custom tools (`@sinclair/typebox`, `@mariozechner/pi-ai`, `@oh-my-pi/pi-tui`, `@oh-my-pi/pi-coding-agent`).
1120
1180
 
1121
1181
  ### Breaking Changes
1122
1182
 
@@ -1138,7 +1198,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1138
1198
 
1139
1199
  - Fixed TUI performance regression caused by Box component lacking render caching. Built-in tools now use Text directly (like v0.22.5), and Box has proper caching for custom tool rendering.
1140
1200
 
1141
- - Fixed custom tools failing to load from `~/.omp/agent/tools/` when omp is installed globally. Module imports (`@sinclair/typebox`, `@oh-my-pi/pi-tui`, `@oh-my-pi/pi-ai`) are now resolved via aliases.
1201
+ - Fixed custom tools failing to load from `~/.omp/agent/tools/` when omp is installed globally. Module imports (`@sinclair/typebox`, `@oh-my-pi/pi-tui`, `@mariozechner/pi-ai`) are now resolved via aliases.
1142
1202
 
1143
1203
  ## [0.23.0] - 2025-12-17
1144
1204
 
@@ -1178,7 +1238,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1178
1238
 
1179
1239
  - **Tool output display**: When collapsed, tool output now shows the last N lines instead of the first N lines, making streaming output more useful.
1180
1240
 
1181
- - Updated `@oh-my-pi/pi-ai` with X-Initiator header support for GitHub Copilot, ensuring agent calls are not deducted from quota. ([#200](https://github.com/badlogic/pi-mono/pull/200) by [@kim0](https://github.com/kim0))
1241
+ - Updated `@mariozechner/pi-ai` with X-Initiator header support for GitHub Copilot, ensuring agent calls are not deducted from quota. ([#200](https://github.com/badlogic/pi-mono/pull/200) by [@kim0](https://github.com/kim0))
1182
1242
 
1183
1243
  ### Fixed
1184
1244
 
@@ -1190,7 +1250,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1190
1250
 
1191
1251
  ### Changed
1192
1252
 
1193
- - Updated `@oh-my-pi/pi-ai` with interleaved thinking enabled by default for Anthropic Claude 4 models.
1253
+ - Updated `@mariozechner/pi-ai` with interleaved thinking enabled by default for Anthropic Claude 4 models.
1194
1254
 
1195
1255
  ## [0.22.1] - 2025-12-15
1196
1256
 
@@ -1198,7 +1258,7 @@ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
1198
1258
 
1199
1259
  ### Changed
1200
1260
 
1201
- - Updated `@oh-my-pi/pi-ai` with interleaved thinking support for Anthropic models.
1261
+ - Updated `@mariozechner/pi-ai` with interleaved thinking support for Anthropic models.
1202
1262
 
1203
1263
  ## [0.22.0] - 2025-12-15
1204
1264
 
@@ -1696,4 +1756,4 @@ Initial public release.
1696
1756
  - Git branch display in footer
1697
1757
  - Message queueing during streaming responses
1698
1758
  - OAuth integration for Gmail and Google Calendar access
1699
- - HTML export with syntax highlighting and collapsible sections
1759
+ - HTML export with syntax highlighting and collapsible sections
@@ -65,8 +65,8 @@ Tools must be in a subdirectory with an `index.ts` entry point:
65
65
 
66
66
  | Location | Scope | Auto-discovered |
67
67
  | ----------------------------------- | --------------------- | --------------- |
68
- | `~/.omp/agent/tools/*/index.ts` | Global (all projects) | Yes |
69
- | `.omp/tools/*/index.ts` | Project-local | Yes |
68
+ | `~/.omp/agent/tools/*/index.ts` | Global (all projects) | Yes |
69
+ | `.omp/tools/*/index.ts` | Project-local | Yes |
70
70
  | `settings.json` `customTools` array | Configured paths | Yes |
71
71
  | `--tool <path>` CLI flag | One-off/debugging | No |
72
72
 
@@ -94,7 +94,7 @@ Custom tools can import from these packages:
94
94
  | --------------------------- | --------------------------------------------------------- | --------------------------------------------------- |
95
95
  | `@sinclair/typebox` | Schema definitions (`Type.Object`, `Type.String`, etc.) | Via `pi.typebox.*` (injected) |
96
96
  | `@oh-my-pi/pi-coding-agent` | Types and utilities | Via `pi.pi.*` (injected) or direct import for types |
97
- | `@oh-my-pi/pi-ai` | AI utilities (`StringEnum` for Google-compatible enums) | Via `pi.pi.*` (re-exported through coding-agent) |
97
+ | `@mariozechner/pi-ai` | AI utilities (`StringEnum` for Google-compatible enums) | Via `pi.pi.*` (re-exported through coding-agent) |
98
98
  | `@oh-my-pi/pi-tui` | TUI components (`Text`, `Box`, etc. for custom rendering) | Via `pi.pi.*` (re-exported through coding-agent) |
99
99
 
100
100
  Node.js built-in modules (`node:fs`, `node:path`, etc.) are also available.