mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 18:03:50 +00:00
docs(coding-agent): update event bus docs - async errors now caught automatically
This commit is contained in:
parent
9c9e6822e3
commit
99a539baa4
2 changed files with 2 additions and 22 deletions
|
|
@ -202,17 +202,7 @@ const unsubscribe = pi.events.on("other:event", (data) => {
|
|||
|
||||
Events are session-scoped. Use namespaced channel names like `"toolname:event"` to avoid collisions.
|
||||
|
||||
Handler errors are caught and logged. For async handlers, handle errors internally:
|
||||
|
||||
```typescript
|
||||
pi.events.on("mytool:event", async (data) => {
|
||||
try {
|
||||
await doSomething(data);
|
||||
} catch (err) {
|
||||
console.error("Handler failed:", err);
|
||||
}
|
||||
});
|
||||
```
|
||||
Handler errors (sync and async) are caught and logged.
|
||||
|
||||
### Sending Messages
|
||||
|
||||
|
|
|
|||
|
|
@ -906,17 +906,7 @@ unsubscribe();
|
|||
|
||||
Events are session-scoped (cleared when session ends). Channel names are arbitrary strings - use namespaced names like `"toolname:event"` to avoid collisions.
|
||||
|
||||
Handler errors are caught and logged. For async handlers, handle errors internally:
|
||||
|
||||
```typescript
|
||||
pi.events.on("mytool:event", async (data) => {
|
||||
try {
|
||||
await doSomething(data);
|
||||
} catch (err) {
|
||||
console.error("Handler failed:", err);
|
||||
}
|
||||
});
|
||||
```
|
||||
Handler errors (sync and async) are caught and logged.
|
||||
|
||||
**Important:** Use `{ triggerTurn: true }` when you want the agent to respond to the event. Without it, the message displays but the agent stays idle.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue