eventbus

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 3 Imported by: 0

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

Constants

View Source
const (
	EventBudgetAlert           = "budget.alert"
	EventBudgetExhausted       = "budget.exhausted"
	EventNegotiationStarted    = "negotiation.started"
	EventNegotiationCompleted  = "negotiation.completed"
	EventNegotiationFailed     = "negotiation.failed"
	EventEscrowCreated         = "escrow.created"
	EventEscrowMilestone       = "escrow.milestone"
	EventEscrowReleased        = "escrow.released"
	EventEscrowOnChainDeposit  = "escrow.onchain.deposit"
	EventEscrowOnChainWork     = "escrow.onchain.work"
	EventEscrowOnChainRelease  = "escrow.onchain.release"
	EventEscrowOnChainRefund   = "escrow.onchain.refund"
	EventEscrowOnChainDispute  = "escrow.onchain.dispute"
	EventEscrowOnChainResolved = "escrow.onchain.resolved"
	EventEscrowReorgDetected   = "escrow.reorg.detected"
	EventEscrowDangling        = "escrow.dangling"
)

Event name constants for economy domain events.

View Source
const (
	EventContentSaved           = "content.saved"
	EventTriplesExtracted       = "triples.extracted"
	EventTurnCompleted          = "turn.completed"
	EventReputationChanged      = "reputation.changed"
	EventMemoryGraph            = "memory.graph"
	EventToolExecutionPaid      = "tool.execution.paid"
	EventAgentDiscovered        = "agent.discovered"
	EventTaskDelegated          = "task.delegated"
	EventTaskCompleted          = "task.completed"
	EventTaskFailed             = "task.failed"
	EventPaymentNegotiated      = "payment.negotiated"
	EventPaymentSettled         = "payment.settled"
	EventTrustUpdated           = "trust.updated"
	EventSchemaExchanged        = "schema.exchanged"
	EventPolicyDecision         = "policy.decision"
	EventAlertTriggered         = "alert.triggered"
	EventChannelMessageReceived = "channel.message.received"
	EventChannelMessageSent     = "channel.message.sent"
	EventSandboxDecision        = "sandbox.decision"
)

Event name constants for core domain events.

View Source
const (
	EventTeamFormed           = "team.formed"
	EventTeamDisbanded        = "team.disbanded"
	EventTeamMemberJoined     = "team.member.joined"
	EventTeamMemberLeft       = "team.member.left"
	EventTeamTaskDelegated    = "team.task.delegated"
	EventTeamTaskCompleted    = "team.task.completed"
	EventTeamConflictDetected = "team.conflict.detected"
	EventTeamPaymentAgreed    = "team.payment.agreed"
	EventTeamHealthCheck      = "team.health.check"
	EventTeamLeaderChanged    = "team.leader.changed"
	EventTeamMemberUnhealthy  = "team.member.unhealthy"
	EventTeamBudgetWarning    = "team.budget.warning"
	EventTeamGracefulShutdown = "team.graceful.shutdown"
)

Event name constants for team domain events.

View Source
const (
	EventWorkspaceCreated        = "workspace.created"
	EventWorkspaceMemberJoined   = "workspace.member.joined"
	EventWorkspaceMemberLeft     = "workspace.member.left"
	EventWorkspaceCommitReceived = "workspace.commit.received"
	EventWorkspaceMessagePosted  = "workspace.message.posted"
	EventWorkspaceArchived       = "workspace.archived"
	EventWorkspaceGitDivergence  = "workspace.git.divergence"
)

Event name constants for workspace domain events.

View Source
const EventContextInjected = "context.injected"

Event name constant for retrieval domain events.

View Source
const EventTokenUsage = "token.usage"

Event name constant for observability domain events.

Variables

This section is empty.

Functions

func PublishSandboxDecision added in v0.7.0

func PublishSandboxDecision(bus *Bus, evt SandboxDecisionEvent)

PublishSandboxDecision publishes a SandboxDecisionEvent on bus, filling Timestamp if zero. A nil bus is a no-op so callers in standalone tests can skip wiring an event bus without crashing.

func SubscribeTyped

func SubscribeTyped[T Event](bus *Bus, handler func(T))

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

type AgentDiscoveredEvent struct {
	DID          string
	Name         string
	Capabilities []string
}

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 AlertEvent added in v0.7.0

type AlertEvent struct {
	Type       string // "policy_block_rate", "recovery_retries", "circuit_breaker"; "config_drift" is planned
	Severity   string // "warning", "critical"
	Message    string
	Details    map[string]interface{}
	SessionKey string
	Timestamp  time.Time
}

AlertEvent is published when an operational alert condition is detected.

func (AlertEvent) EventName added in v0.7.0

func (e AlertEvent) EventName() string

EventName implements Event.

type BudgetAlertEvent added in v0.5.0

type BudgetAlertEvent struct {
	TaskID    string
	Threshold float64 // the threshold percentage that was crossed (e.g. 0.5, 0.8)
}

BudgetAlertEvent is published when a task budget crosses a configured threshold.

func (BudgetAlertEvent) EventName added in v0.5.0

func (e BudgetAlertEvent) EventName() string

EventName implements Event.

type BudgetExhaustedEvent added in v0.5.0

type BudgetExhaustedEvent struct {
	TaskID     string
	TotalSpent *big.Int
}

BudgetExhaustedEvent is published when a task budget is fully consumed.

func (BudgetExhaustedEvent) EventName added in v0.5.0

func (e BudgetExhaustedEvent) EventName() string

EventName implements Event.

type Bus

type Bus struct {
	// contains filtered or unexported fields
}

Bus is a synchronous typed event bus.

func New

func New() *Bus

New creates a new event bus.

func (*Bus) Publish

func (b *Bus) Publish(event Event)

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 ChannelMessageReceivedEvent added in v0.7.0

type ChannelMessageReceivedEvent struct {
	Channel    string // "telegram", "discord", "slack"
	SessionKey string // e.g., "telegram:123:456"
	SenderName string // username or display name
	SenderID   string // platform user ID
	Text       string // message content
	Timestamp  time.Time
	Metadata   map[string]string // platform-specific extras (ThreadTS, GuildID, etc.)
}

ChannelMessageReceivedEvent is published when an inbound message arrives from a channel platform (Telegram, Discord, Slack, etc.).

func (ChannelMessageReceivedEvent) EventName added in v0.7.0

func (e ChannelMessageReceivedEvent) EventName() string

EventName implements Event.

type ChannelMessageSentEvent added in v0.7.0

type ChannelMessageSentEvent struct {
	Channel      string // "telegram", "discord", "slack"
	SessionKey   string
	ResponseText string
	Timestamp    time.Time
}

ChannelMessageSentEvent is published when an outbound response is sent to a channel platform.

func (ChannelMessageSentEvent) EventName added in v0.7.0

func (e ChannelMessageSentEvent) EventName() string

EventName implements Event.

type ContentSavedEvent

type ContentSavedEvent struct {
	ID         string
	Collection string
	Content    string
	Metadata   map[string]string
	Source     string // "knowledge" or "memory"
	IsNew      bool   // true for first-time creation, false for updates
	NeedsGraph bool   // true when graph triple extraction should also run
	Version    int    // Knowledge version; 0 for non-versioned collections
}

ContentSavedEvent is published when knowledge or memory content is saved. Replaces: SetEmbedCallback on knowledge and memory stores. Graph wiring subscribes only when NeedsGraph is true, preserving the original behavior where updates and learning saves skipped graph processing.

func (ContentSavedEvent) EventName

func (e ContentSavedEvent) EventName() string

EventName implements Event.

type ContextInjectedEvent added in v0.7.0

type ContextInjectedEvent struct {
	TurnID           string // from session.TurnIDFromContext; "" if not in turn runner
	SessionKey       string
	Query            string // raw user query (processor must not log this — PII)
	Items            []ContextInjectedItem
	KnowledgeTokens  int
	RAGTokens        int
	MemoryTokens     int
	RunSummaryTokens int
	TotalTokens      int
	Timestamp        time.Time
}

ContextInjectedEvent is published after context assembly in GenerateContent. It tracks which knowledge items were injected into the LLM system prompt for a given turn. Items contains only structured knowledge results (from ContextRetriever). RAG/memory/runSummary are represented as aggregate token counts only — no item-level decomposition.

func (ContextInjectedEvent) EventName added in v0.7.0

func (e ContextInjectedEvent) EventName() string

EventName implements Event.

type ContextInjectedItem added in v0.7.0

type ContextInjectedItem struct {
	Layer         string // human-readable layer name (from ContextLayer.String())
	Key           string
	Score         float64 // normalized: higher = better
	Source        string  // search source: "fts5", "like"
	Category      string
	TokenEstimate int
}

ContextInjectedItem represents a single knowledge item injected into context.

type EscrowCreatedEvent added in v0.5.0

type EscrowCreatedEvent struct {
	EscrowID string
	PayerDID string
	PayeeDID string
	Amount   *big.Int
}

EscrowCreatedEvent is published when an escrow is locked.

func (EscrowCreatedEvent) EventName added in v0.5.0

func (e EscrowCreatedEvent) EventName() string

EventName implements Event.

type EscrowDanglingEvent added in v0.6.0

type EscrowDanglingEvent struct {
	EscrowID     string
	BuyerDID     string
	SellerDID    string
	Amount       string // string representation of *big.Int
	PendingSince time.Time
	Action       string // "expired", "refunded"
}

EscrowDanglingEvent is published when an escrow is stuck in Pending too long.

func (EscrowDanglingEvent) EventName added in v0.6.0

func (e EscrowDanglingEvent) EventName() string

EventName implements Event.

type EscrowMilestoneEvent added in v0.5.0

type EscrowMilestoneEvent struct {
	EscrowID    string
	MilestoneID string
	Index       int
}

EscrowMilestoneEvent is published when an escrow milestone is completed.

func (EscrowMilestoneEvent) EventName added in v0.5.0

func (e EscrowMilestoneEvent) EventName() string

EventName implements Event.

type EscrowOnChainDepositEvent added in v0.5.0

type EscrowOnChainDepositEvent struct {
	EscrowID string
	DealID   string
	Buyer    string
	Amount   *big.Int
	TxHash   string
}

EscrowOnChainDepositEvent is published when tokens are deposited into an on-chain escrow.

func (EscrowOnChainDepositEvent) EventName added in v0.5.0

func (e EscrowOnChainDepositEvent) EventName() string

EventName implements Event.

type EscrowOnChainDisputeEvent added in v0.5.0

type EscrowOnChainDisputeEvent struct {
	EscrowID  string
	DealID    string
	Initiator string
	TxHash    string
}

EscrowOnChainDisputeEvent is published when an on-chain dispute is raised.

func (EscrowOnChainDisputeEvent) EventName added in v0.5.0

func (e EscrowOnChainDisputeEvent) EventName() string

EventName implements Event.

type EscrowOnChainRefundEvent added in v0.5.0

type EscrowOnChainRefundEvent struct {
	EscrowID string
	DealID   string
	Buyer    string
	Amount   *big.Int
	TxHash   string
}

EscrowOnChainRefundEvent is published when on-chain escrow funds are refunded.

func (EscrowOnChainRefundEvent) EventName added in v0.5.0

func (e EscrowOnChainRefundEvent) EventName() string

EventName implements Event.

type EscrowOnChainReleaseEvent added in v0.5.0

type EscrowOnChainReleaseEvent struct {
	EscrowID string
	DealID   string
	Seller   string
	Amount   *big.Int
	TxHash   string
}

EscrowOnChainReleaseEvent is published when on-chain escrow funds are released.

func (EscrowOnChainReleaseEvent) EventName added in v0.5.0

func (e EscrowOnChainReleaseEvent) EventName() string

EventName implements Event.

type EscrowOnChainResolvedEvent added in v0.5.0

type EscrowOnChainResolvedEvent struct {
	EscrowID    string
	DealID      string
	SellerFavor bool
	Amount      *big.Int
	TxHash      string
}

EscrowOnChainResolvedEvent is published when an on-chain dispute is resolved.

func (EscrowOnChainResolvedEvent) EventName added in v0.5.0

func (e EscrowOnChainResolvedEvent) EventName() string

EventName implements Event.

type EscrowOnChainWorkEvent added in v0.5.0

type EscrowOnChainWorkEvent struct {
	EscrowID string
	DealID   string
	Seller   string
	WorkHash string
	TxHash   string
}

EscrowOnChainWorkEvent is published when work proof is submitted on-chain.

func (EscrowOnChainWorkEvent) EventName added in v0.5.0

func (e EscrowOnChainWorkEvent) EventName() string

EventName implements Event.

type EscrowReleasedEvent added in v0.5.0

type EscrowReleasedEvent struct {
	EscrowID string
	Amount   *big.Int
}

EscrowReleasedEvent is published when escrow funds are released on-chain.

func (EscrowReleasedEvent) EventName added in v0.5.0

func (e EscrowReleasedEvent) EventName() string

EventName implements Event.

type EscrowReorgDetectedEvent added in v0.6.0

type EscrowReorgDetectedEvent struct {
	PreviousBlock uint64
	NewBlock      uint64
	Depth         uint64
	ExceedsDepth  bool // reorg deeper than confirmationDepth
}

EscrowReorgDetectedEvent is published when a chain reorganization is detected by the event monitor (safeBlock < lastBlock).

func (EscrowReorgDetectedEvent) EventName added in v0.6.0

func (e EscrowReorgDetectedEvent) EventName() string

EventName implements Event.

type Event

type Event interface {
	EventName() string
}

Event is implemented by all event types.

type GitDivergenceInfo added in v0.6.0

type GitDivergenceInfo struct {
	MemberDID string
	HeadHash  string
}

GitDivergenceInfo describes a member whose HEAD diverges from the majority.

type HandlerFunc

type HandlerFunc func(event Event)

HandlerFunc processes an 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 NegotiationCompletedEvent added in v0.5.0

type NegotiationCompletedEvent struct {
	SessionID    string
	InitiatorDID string
	ResponderDID string
	AgreedPrice  *big.Int
}

NegotiationCompletedEvent is published when negotiation terms are agreed.

func (NegotiationCompletedEvent) EventName added in v0.5.0

func (e NegotiationCompletedEvent) EventName() string

EventName implements Event.

type NegotiationFailedEvent added in v0.5.0

type NegotiationFailedEvent struct {
	SessionID string
	Reason    string // "rejected", "expired", "cancelled"
}

NegotiationFailedEvent is published when a negotiation fails or expires.

func (NegotiationFailedEvent) EventName added in v0.5.0

func (e NegotiationFailedEvent) EventName() string

EventName implements Event.

type NegotiationStartedEvent added in v0.5.0

type NegotiationStartedEvent struct {
	SessionID    string
	InitiatorDID string
	ResponderDID string
	ToolName     string
}

NegotiationStartedEvent is published when a negotiation session begins.

func (NegotiationStartedEvent) EventName added in v0.5.0

func (e NegotiationStartedEvent) EventName() string

EventName implements Event.

type PaymentNegotiatedEvent added in v0.4.0

type PaymentNegotiatedEvent struct {
	TeamID   string
	AgentDID string
	Mode     string
	Price    float64
}

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

type PaymentSettledEvent struct {
	TeamID   string
	AgentDID string
	Amount   float64
	TxHash   string
}

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 PolicyDecisionEvent added in v0.7.0

type PolicyDecisionEvent struct {
	Command    string
	Unwrapped  string
	Verdict    string // "allow", "observe", "block"
	Reason     string // machine-readable reason code
	Message    string
	SessionKey string
	AgentName  string
}

PolicyDecisionEvent is published when the exec policy evaluator makes an observe or block decision. Allow verdicts are not published.

func (PolicyDecisionEvent) EventName added in v0.7.0

func (e PolicyDecisionEvent) EventName() string

EventName implements Event.

type ReputationChangedEvent

type ReputationChangedEvent struct {
	PeerDID  string
	NewScore float64
}

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 SandboxDecisionEvent added in v0.7.0

type SandboxDecisionEvent struct {
	SessionKey string
	Source     string // "exec" | "skill" | "mcp"
	Command    string // user-facing command, skill name, or MCP server name
	Decision   string // "applied" | "skipped" | "rejected" | "excluded"
	Backend    string // "bwrap" | "seatbelt" | "noop" | ""
	Reason     string // empty for "applied", populated otherwise
	Pattern    string // populated for "excluded" only
	Timestamp  time.Time
}

SandboxDecisionEvent is published every time a sandbox apply/skip/reject/exclude decision is made by exec.Tool, skill.Executor, or mcp.ServerConnection. SessionKey is derived from the runtime ctx (session.SessionKeyFromContext) and may be empty for process-level events such as MCP server startup.

func (SandboxDecisionEvent) EventName added in v0.7.0

func (e SandboxDecisionEvent) EventName() string

EventName implements Event.

type SchemaExchangeEvent added in v0.7.0

type SchemaExchangeEvent struct {
	PeerDID    string // remote peer DID
	Direction  string // "export" or "import"
	TypeCount  int    // number of types exchanged
	PredCount  int    // number of predicates exchanged
	ImportMode string // import mode used (empty for export)
}

SchemaExchangeEvent is published after a P2P ontology schema exchange.

func (SchemaExchangeEvent) EventName added in v0.7.0

func (e SchemaExchangeEvent) 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

type TaskDelegatedEvent struct {
	TeamID   string
	TaskID   string
	AgentDID string
}

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

type TaskFailedEvent struct {
	TeamID   string
	TaskID   string
	AgentDID string
	Error    string
}

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 TeamBudgetWarningEvent added in v0.6.0

type TeamBudgetWarningEvent struct {
	TeamID    string
	Threshold float64
	Spent     float64
	Budget    float64
}

TeamBudgetWarningEvent is published when a team's budget crosses a warning threshold.

func (TeamBudgetWarningEvent) EventName added in v0.6.0

func (e TeamBudgetWarningEvent) EventName() string

EventName implements Event.

type TeamConflictDetectedEvent added in v0.4.0

type TeamConflictDetectedEvent struct {
	TeamID   string
	ToolName string
	Members  int
}

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

type TeamDisbandedEvent struct {
	TeamID string
	Reason string
}

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

type TeamFormedEvent struct {
	TeamID    string
	Name      string
	Goal      string
	LeaderDID string
	Members   int
}

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 TeamGracefulShutdownEvent added in v0.6.0

type TeamGracefulShutdownEvent struct {
	TeamID         string
	Reason         string
	BundlesCreated int
	MembersSettled int
}

TeamGracefulShutdownEvent is published when a team undergoes graceful shutdown.

func (TeamGracefulShutdownEvent) EventName added in v0.6.0

func (e TeamGracefulShutdownEvent) EventName() string

EventName implements Event.

type TeamHealthCheckEvent added in v0.4.0

type TeamHealthCheckEvent struct {
	TeamID  string
	Healthy int
	Total   int
}

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

type TeamLeaderChangedEvent struct {
	TeamID       string
	OldLeaderDID string
	NewLeaderDID string
}

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

type TeamMemberJoinedEvent struct {
	TeamID    string
	MemberDID string
	Role      string
}

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

type TeamMemberLeftEvent struct {
	TeamID    string
	MemberDID string
	Reason    string
}

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 TeamMemberUnhealthyEvent added in v0.6.0

type TeamMemberUnhealthyEvent struct {
	TeamID      string
	MemberDID   string
	MemberName  string
	MissedPings int
	LastSeenAt  time.Time
}

TeamMemberUnhealthyEvent is published when a team member misses too many health pings.

func (TeamMemberUnhealthyEvent) EventName added in v0.6.0

func (e TeamMemberUnhealthyEvent) EventName() string

EventName implements Event.

type TeamPaymentAgreedEvent added in v0.4.0

type TeamPaymentAgreedEvent struct {
	TeamID    string
	MemberDID string
	Mode      string
	Price     string
}

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

type TeamTaskDelegatedEvent struct {
	TeamID   string
	ToolName string
	Workers  int
}

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 TokenUsageEvent added in v0.5.0

type TokenUsageEvent struct {
	Provider     string
	Model        string
	SessionKey   string
	AgentName    string
	InputTokens  int64
	OutputTokens int64
	TotalTokens  int64
	CacheTokens  int64
}

TokenUsageEvent is published when an LLM provider returns token usage data. The observability TokenTracker subscribes to this event.

func (TokenUsageEvent) EventName added in v0.5.0

func (e TokenUsageEvent) 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

type Triple struct {
	Subject     string
	Predicate   string
	Object      string
	SubjectType string
	ObjectType  string
	Metadata    map[string]string
}

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

type TrustUpdatedEvent struct {
	AgentDID string
	OldScore float64
	NewScore float64
}

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.

type WorkspaceArchivedEvent added in v0.6.0

type WorkspaceArchivedEvent struct {
	WorkspaceID string
	ArchivedAt  time.Time
}

WorkspaceArchivedEvent is published when a workspace is archived.

func (WorkspaceArchivedEvent) EventName added in v0.6.0

func (e WorkspaceArchivedEvent) EventName() string

EventName implements Event.

type WorkspaceCommitReceivedEvent added in v0.6.0

type WorkspaceCommitReceivedEvent struct {
	WorkspaceID string
	CommitHash  string
	SenderDID   string
	Message     string
	ReceivedAt  time.Time
}

WorkspaceCommitReceivedEvent is published when a git commit is received in a workspace.

func (WorkspaceCommitReceivedEvent) EventName added in v0.6.0

func (e WorkspaceCommitReceivedEvent) EventName() string

EventName implements Event.

type WorkspaceCreatedEvent added in v0.6.0

type WorkspaceCreatedEvent struct {
	WorkspaceID string
	Name        string
	Goal        string
	CreatorDID  string
	CreatedAt   time.Time
}

WorkspaceCreatedEvent is published when a new workspace is created.

func (WorkspaceCreatedEvent) EventName added in v0.6.0

func (e WorkspaceCreatedEvent) EventName() string

EventName implements Event.

type WorkspaceGitDivergenceEvent added in v0.6.0

type WorkspaceGitDivergenceEvent struct {
	WorkspaceID  string
	MajorityHead string
	Divergent    []GitDivergenceInfo
	DetectedAt   time.Time
}

WorkspaceGitDivergenceEvent is published when team members have divergent git HEADs.

func (WorkspaceGitDivergenceEvent) EventName added in v0.6.0

func (e WorkspaceGitDivergenceEvent) EventName() string

EventName implements Event.

type WorkspaceMemberJoinedEvent added in v0.6.0

type WorkspaceMemberJoinedEvent struct {
	WorkspaceID string
	MemberDID   string
	JoinedAt    time.Time
}

WorkspaceMemberJoinedEvent is published when a member joins a workspace.

func (WorkspaceMemberJoinedEvent) EventName added in v0.6.0

func (e WorkspaceMemberJoinedEvent) EventName() string

EventName implements Event.

type WorkspaceMemberLeftEvent added in v0.6.0

type WorkspaceMemberLeftEvent struct {
	WorkspaceID string
	MemberDID   string
	LeftAt      time.Time
}

WorkspaceMemberLeftEvent is published when a member leaves a workspace.

func (WorkspaceMemberLeftEvent) EventName added in v0.6.0

func (e WorkspaceMemberLeftEvent) EventName() string

EventName implements Event.

type WorkspaceMessagePostedEvent added in v0.6.0

type WorkspaceMessagePostedEvent struct {
	WorkspaceID string
	MessageID   string
	MessageType string
	SenderDID   string
	PostedAt    time.Time
}

WorkspaceMessagePostedEvent is published when a message is posted to a workspace.

func (WorkspaceMessagePostedEvent) EventName added in v0.6.0

func (e WorkspaceMessagePostedEvent) EventName() string

EventName implements Event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL