mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 21:03:19 +00:00
docs(coding-agent): document model_select hook
Add CHANGELOG entry and extension documentation for the new model_select event that fires on model changes via /model, Ctrl+P, or session restore.
This commit is contained in:
parent
c41714662a
commit
943654cc93
2 changed files with 27 additions and 0 deletions
|
|
@ -290,6 +290,9 @@ user sends another prompt ◄─────────────────
|
|||
├─► session_before_tree (can cancel or customize)
|
||||
└─► session_tree
|
||||
|
||||
/model or Ctrl+P (model selection/cycling)
|
||||
└─► model_select
|
||||
|
||||
exit (Ctrl+C, Ctrl+D)
|
||||
└─► session_shutdown
|
||||
```
|
||||
|
|
@ -481,6 +484,29 @@ pi.on("context", async (event, ctx) => {
|
|||
|
||||
**Examples:** [plan-mode.ts](../examples/extensions/plan-mode.ts)
|
||||
|
||||
### Model Events
|
||||
|
||||
#### model_select
|
||||
|
||||
Fired when the model changes via `/model` command, model cycling (`Ctrl+P`), or session restore.
|
||||
|
||||
```typescript
|
||||
pi.on("model_select", async (event, ctx) => {
|
||||
// event.model - newly selected model
|
||||
// event.previousModel - previous model (undefined if first selection)
|
||||
// event.source - "set" | "cycle" | "restore"
|
||||
|
||||
const prev = event.previousModel
|
||||
? `${event.previousModel.provider}/${event.previousModel.id}`
|
||||
: "none";
|
||||
const next = `${event.model.provider}/${event.model.id}`;
|
||||
|
||||
ctx.ui.notify(`Model changed (${event.source}): ${prev} -> ${next}`, "info");
|
||||
});
|
||||
```
|
||||
|
||||
Use this to update UI elements (status bars, footers) or perform model-specific initialization when the active model changes.
|
||||
|
||||
### Tool Events
|
||||
|
||||
#### tool_call
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue