mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat(extensions): ui prompt events (#8355)
* feat(extensions): ui prompt events * fix: handlers should not delay the prompt
This commit is contained in:
parent
e86823096c
commit
ccfe79ed23
6 changed files with 104 additions and 2 deletions
|
|
@ -580,6 +580,24 @@ pi.on("agent_settled", async (_event, ctx) => {
|
|||
});
|
||||
```
|
||||
|
||||
#### ui_prompt_start / ui_prompt_end
|
||||
|
||||
Notification-only lifecycle events for blocking user-facing extension UI prompts. They fire around `ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`, `ctx.ui.editor()`, and `ctx.ui.custom()` so host/status integrations can report "waiting for user" instead of just "running".
|
||||
|
||||
Nested or overlapping prompts are coalesced into one outer waiting span. Handlers are invoked best-effort and are not awaited before showing or closing the prompt.
|
||||
|
||||
```typescript
|
||||
pi.on("ui_prompt_start", async (event, ctx) => {
|
||||
// event.reason === "ui_prompt"
|
||||
// event.kind: "select" | "confirm" | "input" | "editor" | "custom"
|
||||
// event.title: prompt title when available
|
||||
});
|
||||
|
||||
pi.on("ui_prompt_end", async (event, ctx) => {
|
||||
// Pi is no longer waiting on that UI prompt span.
|
||||
});
|
||||
```
|
||||
|
||||
#### turn_start / turn_end
|
||||
|
||||
Fired for each turn (one LLM response + tool calls).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue