Documentation
¶
Overview ¶
Package extevents is the publishing end of the extension event stream.
The problem it solves is a dependency one. Events have to be published where they happen: a tool call from the agent loop, an MCP handshake from the MCP client, a provider account edit from the configuration package. Those packages cannot import internal/extensions, which is the host side of the extension system and already imports several of them. So the publishing end is this leaf package, which imports nothing but the public contract, and internal/extensions installs itself as the sink at start-up.
Two properties are guaranteed to callers, because a publish sits inside the operation it reports:
- Publishing never blocks. Events go to a bounded channel and are dropped when it is full, exactly as the configuration bus already drops. An event stream is accounting, and accounting must not be able to stall the work it is accounting for.
- Publishing costs one atomic load when nothing subscribes, which is every standard build: no sink is installed, so Publish returns immediately and the helpers below do not even build their payload.
Index ¶
- func Enabled() bool
- func MCPHandshake(server, transport, client string, err error, authNeeded bool)
- func ProviderAccountAdded(id, providerType string, disabled bool)
- func ProviderAccountRemoved(id, providerType string)
- func ProviderAccountUpdated(id, providerType string, disabled bool)
- func Publish(ev extension.Event)
- func SetSink(ctx context.Context, sink Sink)
- func SkillActivated(sessionID, name, agent, source string)
- func ToolCompleted(sessionID, callID, name, agent string, dur time.Duration, err error)
- func ToolStarted(sessionID, callID, name, agent string)
- type Sink
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
func Enabled() bool
Enabled reports whether anything is listening. Call sites that would have to do real work to build a payload check it first; the helpers in this package already do.
func MCPHandshake ¶
MCPHandshake reports the outcome of connecting to an MCP server. authNeeded distinguishes "this server would work once somebody signs in" from a plain failure, because the two ask for very different things from an operator.
func ProviderAccountAdded ¶
ProviderAccountAdded reports a newly configured provider account.
func ProviderAccountRemoved ¶
func ProviderAccountRemoved(id, providerType string)
ProviderAccountRemoved reports a deleted provider account.
func ProviderAccountUpdated ¶
ProviderAccountUpdated reports an edited provider account, including one that was only enabled or disabled.
func Publish ¶
Publish hands one event to the installed sink. It never blocks and never returns an error: with no sink it does nothing, and with a full buffer the event is dropped and counted in the debug log.
func SetSink ¶
SetSink installs sink as the consumer of published events and starts the goroutine that feeds it, stopping when ctx is cancelled. A nil sink detaches the previous one, which is what tests and teardown use.
Calling it again replaces the sink: the previous delivery goroutine drains nothing further and exits.
func SkillActivated ¶
func SkillActivated(sessionID, name, agent, source string)
SkillActivated reports that a skill was switched on for a run.
func ToolCompleted ¶
ToolCompleted reports that a tool call finished. A nil err means success; the error text is published because it is the host's own diagnosis of the call, not user content.
func ToolStarted ¶
func ToolStarted(sessionID, callID, name, agent string)
ToolStarted reports that the host handed a tool call to its tool.