co-mono/packages/coding-agent/docs
Nico Bailon 9c9e6822e3
feat(coding-agent): add event bus for tool/hook communication (#431)
* feat(coding-agent): add event bus for tool/hook communication

Adds pi.events API enabling custom tools and hooks to communicate via
pub/sub. Tools can emit events, hooks can listen. Shared EventBus instance
created per session in createAgentSession().

- EventBus interface with emit() and on() methods
- on() returns unsubscribe function
- Threaded through hook and tool loaders
- Documented in hooks.md and custom-tools.md

* fix(coding-agent): wrap event handlers to catch errors

* docs: note async handler error handling for event bus

* feat(coding-agent): add sendMessage to tools, nextTurn delivery mode

- Custom tools now have pi.sendMessage() for direct agent notifications
- New deliverAs: 'nextTurn' queues messages for next user prompt
- Fix: hooks and tools now share the same eventBus (was isolated before)

* fix(coding-agent): nextTurn delivery should always queue, even when streaming
2026-01-04 21:36:19 +01:00
..
compaction.md Update custom-compaction example to use serializeConversation 2025-12-31 13:24:23 +01:00
custom-tools.md feat(coding-agent): add event bus for tool/hook communication (#431) 2026-01-04 21:36:19 +01:00
extension-loading.md Update extension-loading.md with install/remove/update commands 2025-12-26 20:51:15 +01:00
hooks.md feat(coding-agent): add event bus for tool/hook communication (#431) 2026-01-04 21:36:19 +01:00
rpc.md Fix slash commands and hook commands during streaming 2026-01-03 15:36:54 +01:00
sdk.md Fix slash commands and hook commands during streaming 2026-01-03 15:36:54 +01:00
session-tree-plan.md Update session-tree-plan.md: tree selector details, theme.md done, add Before Release section 2025-12-30 22:42:25 +01:00
session.md Consolidate session events: remove session_before_new/session_new, add reason field to switch events 2026-01-01 23:31:26 +01:00
skills.md Add creation hints to docs and update system prompt 2025-12-31 13:16:44 +01:00
theme.md Add theme-configurable HTML export colors (from PR #387) 2026-01-01 22:21:40 +01:00
tree.md feat(coding-agent): implement /tree command for session tree navigation 2025-12-30 22:42:22 +01:00
tui.md Update tui.md docs: replace isXxx() with matchesKey() and Key helper 2026-01-03 23:10:22 +01:00