fix(coding-agent): refresh thinking border from extensions

closes #3888
This commit is contained in:
Mario Zechner
2026-04-30 22:49:31 +02:00
parent f7df474084
commit 95ae590279
5 changed files with 47 additions and 2 deletions

View File

@@ -40,6 +40,7 @@ See [examples/extensions/](../examples/extensions/) for working implementations.
- [Resource Events](#resource-events)
- [Session Events](#session-events)
- [Agent Events](#agent-events)
- [Model Events](#model-events)
- [Tool Events](#tool-events)
- [ExtensionContext](#extensioncontext)
- [ExtensionCommandContext](#extensioncommandcontext)
@@ -323,8 +324,12 @@ user sends another prompt ◄─────────────────
└─► session_tree
/model or Ctrl+P (model selection/cycling)
├─► thinking_level_select (if model change changes/clamps thinking level)
└─► model_select
thinking level changes (settings, keybinding, pi.setThinkingLevel())
└─► thinking_level_select
exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
└─► session_shutdown
```
@@ -649,6 +654,21 @@ pi.on("model_select", async (event, ctx) => {
Use this to update UI elements (status bars, footers) or perform model-specific initialization when the active model changes.
#### thinking_level_select
Fired when the thinking level changes. This is notification-only; handler return values are ignored.
```typescript
pi.on("thinking_level_select", async (event, ctx) => {
// event.level - newly selected thinking level
// event.previousLevel - previous thinking level
ctx.ui.setStatus("thinking", `thinking: ${event.level}`);
});
```
Use this to update extension UI when `pi.setThinkingLevel()`, model changes, or built-in thinking-level controls change the active thinking level.
### Tool Events
#### tool_call
@@ -1502,7 +1522,7 @@ if (model) {
### pi.getThinkingLevel() / pi.setThinkingLevel(level)
Get or set the thinking level. Level is clamped to model capabilities (non-reasoning models always use "off").
Get or set the thinking level. Level is clamped to model capabilities (non-reasoning models always use "off"). Changes emit `thinking_level_select`.
```typescript
const current = pi.getThinkingLevel(); // "off" | "minimal" | "low" | "medium" | "high" | "xhigh"