@oh-my-pi/pi-coding-agent 3.20.0 → 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 (95) hide show
  1. package/CHANGELOG.md +78 -8
  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 +162 -1
  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 +142 -2
  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 +7 -2
  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/lib/worktree/constants.ts +6 -6
  72. package/src/main.ts +1 -1
  73. package/src/modes/interactive/components/assistant-message.ts +1 -1
  74. package/src/modes/interactive/components/custom-message.ts +1 -1
  75. package/src/modes/interactive/components/extensions/inspector-panel.ts +25 -22
  76. package/src/modes/interactive/components/extensions/state-manager.ts +12 -0
  77. package/src/modes/interactive/components/footer.ts +1 -1
  78. package/src/modes/interactive/components/hook-message.ts +1 -1
  79. package/src/modes/interactive/components/model-selector.ts +1 -1
  80. package/src/modes/interactive/components/oauth-selector.ts +1 -1
  81. package/src/modes/interactive/components/settings-defs.ts +49 -0
  82. package/src/modes/interactive/components/status-line.ts +1 -1
  83. package/src/modes/interactive/components/tool-execution.ts +93 -538
  84. package/src/modes/interactive/interactive-mode.ts +19 -7
  85. package/src/modes/print-mode.ts +1 -1
  86. package/src/modes/rpc/rpc-client.ts +1 -1
  87. package/src/modes/rpc/rpc-types.ts +1 -1
  88. package/src/prompts/system-prompt.md +4 -0
  89. package/src/prompts/tools/gemini-image.md +5 -1
  90. package/src/prompts/tools/output.md +4 -0
  91. package/src/prompts/tools/web-fetch.md +1 -0
  92. package/src/prompts/tools/web-search.md +2 -0
  93. package/src/utils/image-convert.ts +8 -2
  94. package/src/utils/image-magick.ts +247 -0
  95. package/src/utils/image-resize.ts +53 -13
package/CHANGELOG.md CHANGED
@@ -2,7 +2,70 @@
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
+
56
+ ## [3.20.1] - 2026-01-06
57
+
58
+ ### Fixed
59
+
60
+ - Fixed find tool failing to match patterns with path separators (e.g., `reports/**`) by enabling full-path matching in fd
61
+
62
+ ### Changed
63
+
64
+ - Changed multi-task display to show task descriptions instead of agent names when available
65
+ - Changed ls tool to show relative modification times (e.g., "2d ago", "just now") for each entry
66
+
5
67
  ## [3.20.0] - 2026-01-06
68
+
6
69
  ### Added
7
70
 
8
71
  - Added extensions API with auto-discovery (`.omp/extensions`) and `--extension`/`-e` loading for custom tools, commands, and lifecycle hooks
@@ -142,6 +205,7 @@
142
205
  - Fixed session persistence to truncate oversized entries before writing JSONL to prevent out-of-memory errors
143
206
 
144
207
  ## [3.14.0] - 2026-01-04
208
+
145
209
  ### Added
146
210
 
147
211
  - Added `getUsageStatistics()` method to SessionManager for tracking cumulative token usage and costs across session messages
@@ -166,6 +230,7 @@
166
230
  - Fixed stale diagnostics persisting after file content changes in LSP client
167
231
 
168
232
  ## [3.8.1337] - 2026-01-04
233
+
169
234
  ### Added
170
235
 
171
236
  - Added automatic browser opening after exporting session to HTML
@@ -176,6 +241,7 @@
176
241
  - Fixed session titles not persisting to file when set before first flush
177
242
 
178
243
  ## [3.7.1337] - 2026-01-04
244
+
179
245
  ### Added
180
246
 
181
247
  - Added `EditMatchError` class for structured error handling in edit operations
@@ -234,6 +300,7 @@
234
300
  - Updated version update notification to suggest `omp update` instead of manual npm install command
235
301
 
236
302
  ## [3.1.1337] - 2026-01-03
303
+
237
304
  ### Added
238
305
 
239
306
  - Added `spawns` frontmatter field for agent definitions to control which sub-agents can be spawned
@@ -252,7 +319,7 @@
252
319
  - Added Discovery settings tab in interactive mode to enable/disable individual configuration providers
253
320
  - Added provider source attribution showing which tool contributed each configuration item
254
321
  - Added support for Cursor MDC rule format with frontmatter (description, globs, alwaysApply)
255
- - 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
256
323
  - Added support for Cline rules from .clinerules file or directory
257
324
  - Added support for GitHub Copilot instructions with applyTo glob patterns
258
325
  - Added support for Gemini extensions and system.md customization files
@@ -289,6 +356,7 @@
289
356
  - Removed separate asset copying steps from build scripts
290
357
 
291
358
  ## [2.0.1337] - 2026-01-03
359
+
292
360
  ### Added
293
361
 
294
362
  - Added shell environment snapshot to preserve user aliases, functions, and shell options when executing bash commands
@@ -301,6 +369,7 @@
301
369
  - Changed Edit tool to reject `.ipynb` files with guidance to use NotebookEdit tool instead
302
370
 
303
371
  ## [1.500.0] - 2026-01-03
372
+
304
373
  ### Added
305
374
 
306
375
  - Added provider tabs to model selector with Tab/Arrow navigation for filtering models by provider
@@ -362,6 +431,7 @@
362
431
  - Fixed Task tool showing "done + succeeded" when aborted; now correctly displays "⊘ aborted" status
363
432
 
364
433
  ## [1.341.0] - 2026-01-03
434
+
365
435
  ### Added
366
436
 
367
437
  - Added interruptMode setting to control when queued messages are processed during tool execution.
@@ -577,7 +647,7 @@ See [docs/custom-tools.md](docs/custom-tools.md) and [examples/custom-tools/](ex
577
647
  - `AppMessage` → `AgentMessage`
578
648
  - `sessionFile` returns `string | undefined` (was `string | null`)
579
649
  - `model` returns `Model | undefined` (was `Model | null`)
580
- - `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.
581
651
 
582
652
  **AgentSession API:**
583
653
 
@@ -803,7 +873,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
803
873
  - `createAgentSession()` now accepts `authStorage` and `modelRegistry` options
804
874
  - Removed `configureOAuthStorage()`, `defaultGetApiKey()`, `findModel()`, `discoverAvailableModels()`
805
875
  - Removed `getApiKey` callback option (use `AuthStorage.setRuntimeApiKey()` for runtime overrides)
806
- - 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
807
877
  - See updated [SDK documentation](docs/sdk.md) and [README](README.md)
808
878
 
809
879
  - **Settings changes**: Removed `apiKeys` from `settings.json`. Use `auth.json` instead. ([#296](https://github.com/badlogic/pi-mono/issues/296))
@@ -1106,7 +1176,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1106
1176
  - `rpc.md`: Added missing `hook_error` event documentation
1107
1177
  - `README.md`: Complete settings table, condensed philosophy section, standardized OAuth docs
1108
1178
 
1109
- - 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`).
1110
1180
 
1111
1181
  ### Breaking Changes
1112
1182
 
@@ -1128,7 +1198,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1128
1198
 
1129
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.
1130
1200
 
1131
- - 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.
1132
1202
 
1133
1203
  ## [0.23.0] - 2025-12-17
1134
1204
 
@@ -1168,7 +1238,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1168
1238
 
1169
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.
1170
1240
 
1171
- - 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))
1172
1242
 
1173
1243
  ### Fixed
1174
1244
 
@@ -1180,7 +1250,7 @@ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) fo
1180
1250
 
1181
1251
  ### Changed
1182
1252
 
1183
- - 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.
1184
1254
 
1185
1255
  ## [0.22.1] - 2025-12-15
1186
1256
 
@@ -1188,7 +1258,7 @@ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
1188
1258
 
1189
1259
  ### Changed
1190
1260
 
1191
- - 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.
1192
1262
 
1193
1263
  ## [0.22.0] - 2025-12-15
1194
1264
 
@@ -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.