mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat(coding-agent): add event handler unsubscribe (#9630)
This commit is contained in:
parent
16292398af
commit
46c9de402b
6 changed files with 217 additions and 86 deletions
|
|
@ -1371,7 +1371,16 @@ export default function (pi: ExtensionAPI) {
|
|||
|
||||
### pi.on(event, handler)
|
||||
|
||||
Subscribe to events. See [Events](#events) for event types and return values.
|
||||
Subscribe to events. Returns an unsubscribe function that removes only that registration. See [Events](#events) for event types and return values.
|
||||
|
||||
```typescript
|
||||
const unsubscribe = pi.on("agent_end", async (event) => {
|
||||
unsubscribe();
|
||||
await updateIntegration(event.messages);
|
||||
});
|
||||
```
|
||||
|
||||
Handlers run in extension load order, then registration order within each extension. Adding or removing a handler does not affect a dispatch already in progress.
|
||||
|
||||
### pi.registerTool(definition)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue