Skip to main content

Module topic

Module topic 

Source
Expand description

Pub/sub topic routing for kernel IPC.

The TopicRouter manages topic subscriptions and delivers published messages to all subscribers. Topics are arbitrary strings (e.g. “build-status”, “test-results”, “agent.spawned”).

Subscriptions are stored in a DashMap for lock-free concurrent access. Dead subscribers (processes that have exited) are lazily cleaned up during publish.

§Subscriber kinds

Subscriptions are generalized via SubscriberSink. Two sink kinds exist today:

  • SubscriberSink::PidInbox — an in-kernel agent identified by Pid. The A2A router delivers to its mpsc inbox.
  • SubscriberSink::ExternalStream — an external Unix-socket client (Python bridge, another Claude Code session) that holds the read end of a channel the daemon writes one JSON line per published message into.

Structs§

SubscriberId
Unique identifier for an external streaming subscription.
Subscription
A topic subscription entry (wire-format; describes a PID-based subscription only — external stream sinks are ephemeral and not persisted in this shape).
TopicRouter
Pub/sub topic router for kernel IPC.

Enums§

SubscriberSink
A subscription sink — where a delivered topic message goes.