@mariozechner/pi-coding-agent 0.52.6 → 0.52.7

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 (36) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/core/agent-session.d.ts.map +1 -1
  3. package/dist/core/agent-session.js +7 -0
  4. package/dist/core/agent-session.js.map +1 -1
  5. package/dist/core/auth-storage.d.ts.map +1 -1
  6. package/dist/core/auth-storage.js +16 -0
  7. package/dist/core/auth-storage.js.map +1 -1
  8. package/dist/core/extensions/runner.d.ts +17 -2
  9. package/dist/core/extensions/runner.d.ts.map +1 -1
  10. package/dist/core/extensions/runner.js +53 -9
  11. package/dist/core/extensions/runner.js.map +1 -1
  12. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  13. package/dist/core/extensions/wrapper.js +3 -3
  14. package/dist/core/extensions/wrapper.js.map +1 -1
  15. package/dist/core/model-registry.d.ts +3 -1
  16. package/dist/core/model-registry.d.ts.map +1 -1
  17. package/dist/core/model-registry.js +133 -37
  18. package/dist/core/model-registry.js.map +1 -1
  19. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  20. package/dist/modes/interactive/components/assistant-message.js +9 -4
  21. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  22. package/dist/modes/interactive/interactive-mode.d.ts +0 -1
  23. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  24. package/dist/modes/interactive/interactive-mode.js +111 -101
  25. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  26. package/docs/extensions.md +5 -0
  27. package/docs/models.md +40 -1
  28. package/docs/providers.md +13 -0
  29. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  30. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  31. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  32. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  33. package/examples/extensions/hello.ts +1 -1
  34. package/examples/extensions/with-deps/package-lock.json +2 -2
  35. package/examples/extensions/with-deps/package.json +1 -1
  36. package/package.json +4 -4
@@ -524,6 +524,11 @@ pi.on("tool_call", (event) => {
524
524
 
525
525
  Fired after tool executes. **Can modify result.**
526
526
 
527
+ `tool_result` handlers chain like middleware:
528
+ - Handlers run in extension load order
529
+ - Each handler sees the latest result after previous handler changes
530
+ - Handlers can return partial patches (`content`, `details`, or `isError`); omitted fields keep their current values
531
+
527
532
  ```typescript
528
533
  import { isBashToolResult } from "@mariozechner/pi-coding-agent";
529
534
 
package/docs/models.md CHANGED
@@ -10,6 +10,7 @@ Add custom providers and models (Ollama, vLLM, LM Studio, proxies) via `~/.pi/ag
10
10
  - [Provider Configuration](#provider-configuration)
11
11
  - [Model Configuration](#model-configuration)
12
12
  - [Overriding Built-in Providers](#overriding-built-in-providers)
13
+ - [Per-model Overrides](#per-model-overrides)
13
14
  - [OpenAI Compatibility](#openai-compatibility)
14
15
 
15
16
  ## Minimal Example
@@ -84,6 +85,7 @@ Set `api` at provider level (default for all models) or model level (override pe
84
85
  | `headers` | Custom headers (see value resolution below) |
85
86
  | `authHeader` | Set `true` to add `Authorization: Bearer <apiKey>` automatically |
86
87
  | `models` | Array of model configurations |
88
+ | `modelOverrides` | Per-model overrides for built-in models on this provider |
87
89
 
88
90
  ### Value Resolution
89
91
 
@@ -151,7 +153,7 @@ Route a built-in provider through a proxy without redefining models:
151
153
 
152
154
  All built-in Anthropic models remain available. Existing OAuth or API key auth continues to work.
153
155
 
154
- To fully replace a built-in provider with custom models, include the `models` array:
156
+ To merge custom models into a built-in provider, include the `models` array:
155
157
 
156
158
  ```json
157
159
  {
@@ -166,6 +168,43 @@ To fully replace a built-in provider with custom models, include the `models` ar
166
168
  }
167
169
  ```
168
170
 
171
+ Merge semantics:
172
+ - Built-in models are kept.
173
+ - Custom models are upserted by `id` within the provider.
174
+ - If a custom model `id` matches a built-in model `id`, the custom model replaces that built-in model.
175
+ - If a custom model `id` is new, it is added alongside built-in models.
176
+
177
+ ## Per-model Overrides
178
+
179
+ Use `modelOverrides` to customize specific built-in models without replacing the provider's full model list.
180
+
181
+ ```json
182
+ {
183
+ "providers": {
184
+ "openrouter": {
185
+ "modelOverrides": {
186
+ "anthropic/claude-sonnet-4": {
187
+ "name": "Claude Sonnet 4 (Bedrock Route)",
188
+ "compat": {
189
+ "openRouterRouting": {
190
+ "only": ["amazon-bedrock"]
191
+ }
192
+ }
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ `modelOverrides` supports these fields per model: `name`, `reasoning`, `input`, `cost` (partial), `contextWindow`, `maxTokens`, `headers`, `compat`.
201
+
202
+ Behavior notes:
203
+ - `modelOverrides` are applied to built-in provider models.
204
+ - Unknown model IDs are ignored.
205
+ - You can combine provider-level `baseUrl`/`headers` with `modelOverrides`.
206
+ - If `models` is also defined for a provider, custom models are merged after built-in overrides. A custom model with the same `id` replaces the overridden built-in model entry.
207
+
169
208
  ## OpenAI Compatibility
170
209
 
171
210
  For providers with partial OpenAI compatibility, use the `compat` field:
package/docs/providers.md CHANGED
@@ -140,6 +140,19 @@ Also supports ECS task roles (`AWS_CONTAINER_CREDENTIALS_*`) and IRSA (`AWS_WEB_
140
140
  pi --provider amazon-bedrock --model us.anthropic.claude-sonnet-4-20250514-v1:0
141
141
  ```
142
142
 
143
+ If you are connecting to a Bedrock API proxy, the following environment variables can be used:
144
+
145
+ ```bash
146
+ # Set the URL for the Bedrock proxy (standard AWS SDK env var)
147
+ export AWS_ENDPOINT_URL_BEDROCK_RUNTIME=https://my.corp.proxy/bedrock
148
+
149
+ # Set if your proxy does not require authentication
150
+ export AWS_BEDROCK_SKIP_AUTH=1
151
+
152
+ # Set if your proxy only supports HTTP/1.1
153
+ export AWS_BEDROCK_FORCE_HTTP1=1
154
+ ```
155
+
143
156
  ### Google Vertex AI
144
157
 
145
158
  Uses Application Default Credentials:
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "1.3.6",
9
+ "version": "1.3.7",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "1.3.6",
4
+ "version": "1.3.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "1.3.6",
4
+ "version": "1.3.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-qwen-cli",
3
3
  "private": true,
4
- "version": "1.2.6",
4
+ "version": "1.2.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -2,8 +2,8 @@
2
2
  * Hello Tool - Minimal custom tool example
3
3
  */
4
4
 
5
+ import { Type } from "@mariozechner/pi-ai";
5
6
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
6
- import { Type } from "@sinclair/typebox";
7
7
 
8
8
  export default function (pi: ExtensionAPI) {
9
9
  pi.registerTool({
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "1.16.6",
3
+ "version": "1.16.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "1.16.6",
9
+ "version": "1.16.7",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "1.16.6",
4
+ "version": "1.16.7",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mariozechner/pi-coding-agent",
3
- "version": "0.52.6",
3
+ "version": "0.52.7",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -40,9 +40,9 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@mariozechner/jiti": "^2.6.2",
43
- "@mariozechner/pi-agent-core": "^0.52.6",
44
- "@mariozechner/pi-ai": "^0.52.6",
45
- "@mariozechner/pi-tui": "^0.52.6",
43
+ "@mariozechner/pi-agent-core": "^0.52.7",
44
+ "@mariozechner/pi-ai": "^0.52.7",
45
+ "@mariozechner/pi-tui": "^0.52.7",
46
46
  "@silvia-odwyer/photon-node": "^0.3.4",
47
47
  "chalk": "^5.5.0",
48
48
  "cli-highlight": "^2.1.11",