-
Provider
- Early startup calls
providers.SetPluginProviderResolver(...). - Resolver iterates
plugin.GlobalRegistry().GetProviderPlugins(), tries creation viaSupportsProtocol+CreateProviderFromModelConfig;providers.ErrSkipProvidermeans pass to next plugin or fallback to built-in factory. - See
pkg/providers/factory_provider.go:CreateProviderFromConfigfalls back to built-in implementation only when resolver returnsErrSkipProvider.
- Early startup calls
-
Tool
plugin.NewManager(cfg, msgBus, nil)→InitializeToolsOnly(ctx).agent.NewAgentLoopWithPluginTools(..., pluginMgr.ToolRegistry()): firstMergeFromplugin tools into each Agent, then skipweb_search/web_fetch/messageinregisterSharedToolsif already provided by plugin.
-
Channel
channels.Managerretrieves plugins fromplugin.GlobalRegistry().GetChannelPlugins(), callsCreateChannelfor those whereIsEnabledis true, asserts result aschannels.Channel, then injectsMediaStore/PlaceholderRecorder/Owner, etc.
Plugin implementations depend on pkg/channels/* etc.; if pkg/framework imports plugins, it would form a cycle. Therefore:
**builtin.godoes NOT import anypkg/plugins/...**.- Gateway triggers each package's
init()registration via_ ".../pkg/plugins/...".
| Concern | Main Location |
|---|---|
| Plugin Registry | pkg/framework/registry.go |
| Tool Merge | pkg/tools/registry.go — MergeFrom |
| Agent Side | pkg/agent/loop.go — NewAgentLoopWithPluginTools, registerSharedTools |
| Channel Side | pkg/channels/manager.go — plugin iteration initialization |