feat(hooks): add text_delta event for streaming text monitoring
- New text_delta hook event fires for each chunk of streaming text - Enables real-time monitoring of agent output - Plan-mode hook now updates todo progress as [DONE:id] tags stream in - Each todo item has unique ID for reliable tracking
This commit is contained in:
committed by
Mario Zechner
parent
7a03f57fbe
commit
d1eea3ac4e
@@ -306,6 +306,21 @@ pi.on("turn_end", async (event, ctx) => {
|
||||
});
|
||||
```
|
||||
|
||||
#### text_delta
|
||||
|
||||
Fired for each chunk of streaming text from the assistant. Useful for real-time monitoring of agent output.
|
||||
|
||||
```typescript
|
||||
pi.on("text_delta", async (event, ctx) => {
|
||||
// event.text - the new text chunk
|
||||
|
||||
// Example: watch for specific patterns in streaming output
|
||||
if (event.text.includes("[DONE:")) {
|
||||
// Handle completion marker
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### context
|
||||
|
||||
Fired before each LLM call. Modify messages non-destructively (session unchanged).
|
||||
|
||||
Reference in New Issue
Block a user