feat(coding-agent): add event handler unsubscribe (#9630)

This commit is contained in:
Ramiz Wachtler 2026-09-17 21:44:26 +02:00 • committed by GitHub
parent 16292398af
commit 46c9de402b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 217 additions and 86 deletions

View file

@ -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)