From 99a539baa401c6b34356c2842ee4f54b45a292e6 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Sun, 4 Jan 2026 21:37:16 +0100 Subject: [PATCH] docs(coding-agent): update event bus docs - async errors now caught automatically --- packages/coding-agent/docs/custom-tools.md | 12 +----------- packages/coding-agent/docs/hooks.md | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/packages/coding-agent/docs/custom-tools.md b/packages/coding-agent/docs/custom-tools.md index 032c050a..f77cf53f 100644 --- a/packages/coding-agent/docs/custom-tools.md +++ b/packages/coding-agent/docs/custom-tools.md @@ -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 diff --git a/packages/coding-agent/docs/hooks.md b/packages/coding-agent/docs/hooks.md index 9dbd511d..aadc5db6 100644 --- a/packages/coding-agent/docs/hooks.md +++ b/packages/coding-agent/docs/hooks.md @@ -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.