Documentation
¶
Overview ¶
Package eventbus provides a synchronous, typed event bus for decoupling components that currently rely on scattered SetXxxCallback() wiring.
Events are dispatched synchronously in registration order. The bus is safe for concurrent use; Subscribe takes a write lock, Publish takes a read lock.
Index ¶
- func SubscribeTyped[T Event](bus *Bus, handler func(T))
- type AgentDiscoveredEvent
- type Bus
- type ContentSavedEvent
- type Event
- type HandlerFunc
- type MemoryGraphEvent
- type PaymentNegotiatedEvent
- type PaymentSettledEvent
- type ReputationChangedEvent
- type TaskCompletedEvent
- type TaskDelegatedEvent
- type TaskFailedEvent
- type TeamConflictDetectedEvent
- type TeamDisbandedEvent
- type TeamFormedEvent
- type TeamHealthCheckEvent
- type TeamLeaderChangedEvent
- type TeamMemberJoinedEvent
- type TeamMemberLeftEvent
- type TeamPaymentAgreedEvent
- type TeamTaskCompletedEvent
- type TeamTaskDelegatedEvent
- type ToolExecutionPaidEvent
- type Triple
- type TriplesExtractedEvent
- type TrustUpdatedEvent
- type TurnCompletedEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SubscribeTyped ¶
SubscribeTyped is a generic helper that provides type-safe subscription. It registers a handler that automatically type-asserts the event before calling the typed handler function.
Types ¶
type AgentDiscoveredEvent ¶ added in v0.4.0
AgentDiscoveredEvent is published when a new remote agent is discovered.
func (AgentDiscoveredEvent) EventName ¶ added in v0.4.0
func (e AgentDiscoveredEvent) EventName() string
EventName implements Event.
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is a synchronous typed event bus.
func (*Bus) Publish ¶
Publish sends an event to all registered handlers synchronously. If no handlers are registered for the event, it is silently ignored.
func (*Bus) Subscribe ¶
func (b *Bus) Subscribe(eventName string, handler HandlerFunc)
Subscribe registers a handler for a specific event name.
type ContentSavedEvent ¶
type ContentSavedEvent struct {
ID string
Collection string
Content string
Metadata map[string]string
Source string // "knowledge" or "memory"
}
ContentSavedEvent is published when knowledge or memory content is saved. Replaces: SetEmbedCallback, SetGraphCallback on knowledge and memory stores.
func (ContentSavedEvent) EventName ¶
func (e ContentSavedEvent) EventName() string
EventName implements Event.
type MemoryGraphEvent ¶
type MemoryGraphEvent struct {
Triples []Triple
SessionKey string
Type string // "observation" or "reflection"
}
MemoryGraphEvent is published when memory graph hooks fire. Replaces: memory.Store.SetGraphHooks.
func (MemoryGraphEvent) EventName ¶
func (e MemoryGraphEvent) EventName() string
EventName implements Event.
type PaymentNegotiatedEvent ¶ added in v0.4.0
PaymentNegotiatedEvent is published when payment terms are agreed.
func (PaymentNegotiatedEvent) EventName ¶ added in v0.4.0
func (e PaymentNegotiatedEvent) EventName() string
EventName implements Event.
type PaymentSettledEvent ¶ added in v0.4.0
PaymentSettledEvent is published when a payment is settled on-chain.
func (PaymentSettledEvent) EventName ¶ added in v0.4.0
func (e PaymentSettledEvent) EventName() string
EventName implements Event.
type ReputationChangedEvent ¶
ReputationChangedEvent is published when a peer's reputation changes. Replaces: reputation.Store.SetOnChangeCallback.
func (ReputationChangedEvent) EventName ¶
func (e ReputationChangedEvent) EventName() string
EventName implements Event.
type TaskCompletedEvent ¶ added in v0.4.0
type TaskCompletedEvent struct {
TeamID string
TaskID string
AgentDID string
Success bool
DurationMs int64
}
TaskCompletedEvent is published when a delegated task completes successfully.
func (TaskCompletedEvent) EventName ¶ added in v0.4.0
func (e TaskCompletedEvent) EventName() string
EventName implements Event.
type TaskDelegatedEvent ¶ added in v0.4.0
TaskDelegatedEvent is published when a task is delegated to an agent.
func (TaskDelegatedEvent) EventName ¶ added in v0.4.0
func (e TaskDelegatedEvent) EventName() string
EventName implements Event.
type TaskFailedEvent ¶ added in v0.4.0
TaskFailedEvent is published when a delegated task fails.
func (TaskFailedEvent) EventName ¶ added in v0.4.0
func (e TaskFailedEvent) EventName() string
EventName implements Event.
type TeamConflictDetectedEvent ¶ added in v0.4.0
TeamConflictDetectedEvent is published when conflicting results are found.
func (TeamConflictDetectedEvent) EventName ¶ added in v0.4.0
func (e TeamConflictDetectedEvent) EventName() string
EventName implements Event.
type TeamDisbandedEvent ¶ added in v0.4.0
TeamDisbandedEvent is published when a team is disbanded.
func (TeamDisbandedEvent) EventName ¶ added in v0.4.0
func (e TeamDisbandedEvent) EventName() string
EventName implements Event.
type TeamFormedEvent ¶ added in v0.4.0
TeamFormedEvent is published when a new agent team is created.
func (TeamFormedEvent) EventName ¶ added in v0.4.0
func (e TeamFormedEvent) EventName() string
EventName implements Event.
type TeamHealthCheckEvent ¶ added in v0.4.0
TeamHealthCheckEvent is published after a team-level health sweep.
func (TeamHealthCheckEvent) EventName ¶ added in v0.4.0
func (e TeamHealthCheckEvent) EventName() string
EventName implements Event.
type TeamLeaderChangedEvent ¶ added in v0.4.0
TeamLeaderChangedEvent is published when a team's leader is replaced.
func (TeamLeaderChangedEvent) EventName ¶ added in v0.4.0
func (e TeamLeaderChangedEvent) EventName() string
EventName implements Event.
type TeamMemberJoinedEvent ¶ added in v0.4.0
TeamMemberJoinedEvent is published when an agent joins a team.
func (TeamMemberJoinedEvent) EventName ¶ added in v0.4.0
func (e TeamMemberJoinedEvent) EventName() string
EventName implements Event.
type TeamMemberLeftEvent ¶ added in v0.4.0
TeamMemberLeftEvent is published when an agent leaves a team.
func (TeamMemberLeftEvent) EventName ¶ added in v0.4.0
func (e TeamMemberLeftEvent) EventName() string
EventName implements Event.
type TeamPaymentAgreedEvent ¶ added in v0.4.0
TeamPaymentAgreedEvent is published when payment terms are negotiated.
func (TeamPaymentAgreedEvent) EventName ¶ added in v0.4.0
func (e TeamPaymentAgreedEvent) EventName() string
EventName implements Event.
type TeamTaskCompletedEvent ¶ added in v0.4.0
type TeamTaskCompletedEvent struct {
TeamID string
ToolName string
Successful int
Failed int
Duration time.Duration
}
TeamTaskCompletedEvent is published when a delegated task finishes.
func (TeamTaskCompletedEvent) EventName ¶ added in v0.4.0
func (e TeamTaskCompletedEvent) EventName() string
EventName implements Event.
type TeamTaskDelegatedEvent ¶ added in v0.4.0
TeamTaskDelegatedEvent is published when a task is sent to team workers.
func (TeamTaskDelegatedEvent) EventName ¶ added in v0.4.0
func (e TeamTaskDelegatedEvent) EventName() string
EventName implements Event.
type ToolExecutionPaidEvent ¶ added in v0.4.0
type ToolExecutionPaidEvent struct {
PeerDID string
ToolName string
Auth interface{} // *eip3009.Authorization (interface to avoid import cycle)
SettlementID string // non-empty for post-pay deferred entries
}
ToolExecutionPaidEvent is published after a paid tool execution succeeds. The settlement service subscribes to this event to initiate on-chain settlement.
func (ToolExecutionPaidEvent) EventName ¶ added in v0.4.0
func (e ToolExecutionPaidEvent) EventName() string
EventName implements Event.
type Triple ¶
Triple mirrors graph.Triple to avoid an import dependency on the graph package, keeping the eventbus package dependency-free.
type TriplesExtractedEvent ¶
type TriplesExtractedEvent struct {
Triples []Triple
Source string // e.g. "learning", "analysis", "librarian"
}
TriplesExtractedEvent is published when graph triples are extracted. Replaces: SetGraphCallback on learning engines and analyzers.
func (TriplesExtractedEvent) EventName ¶
func (e TriplesExtractedEvent) EventName() string
EventName implements Event.
type TrustUpdatedEvent ¶ added in v0.4.0
TrustUpdatedEvent is published when an agent's trust score changes.
func (TrustUpdatedEvent) EventName ¶ added in v0.4.0
func (e TrustUpdatedEvent) EventName() string
EventName implements Event.
type TurnCompletedEvent ¶
type TurnCompletedEvent struct {
SessionKey string
}
TurnCompletedEvent is published when a gateway turn completes. Replaces: Gateway.OnTurnComplete callbacks.
func (TurnCompletedEvent) EventName ¶
func (e TurnCompletedEvent) EventName() string
EventName implements Event.