feat(provider): init() self-registration for built-in agents (closes #322)#7
Open
aaronwong1989 wants to merge 3 commits into
Open
feat(provider): init() self-registration for built-in agents (closes #322)#7aaronwong1989 wants to merge 3 commits into
aaronwong1989 wants to merge 3 commits into
Conversation
added 3 commits
March 22, 2026 14:39
Implements the Agent Registry portion of issue hrygo#322: - Add claudeCodePlugin, openCodePlugin, piPlugin structs that implement ProviderPlugin interface (Type, New, Meta) - Each built-in provider now registers itself via init() calling RegisterPlugin(), replacing the manual registration in NewProviderFactory() - NewProviderFactory() now iterates over globalPluginRegistry.plugins to register all plugins at construction time This follows the same Plugin pattern as the Platform Registry (chatapps/base/plugin.go), achieving full plugin-based self-registration for both platforms and agents.
- Extract shared ProviderMeta variables (claudeCodeProviderMeta, openCodeProviderMeta, piProviderMeta) at package level - Update NewXXXProvider() functions to reuse shared metadata - Simplify XXXPlugin.Meta() to return shared variable - Eliminates duplication between factory functions and plugin metadata - Reduces maintenance burden: metadata defined in single source of truth Addresses review comment on PR hrygo#343 about metadata duplication.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Agent Registry portion of issue hrygo#322, completing the plugin-based self-registration architecture.
Changes
Provider Plugin Registration
Each built-in provider (Claude Code, OpenCode, Pi) now implements
ProviderPlugininterface and registers viainit():provider/claude_provider.go: AddedclaudeCodePluginstruct +init()provider/opencode_provider.go: AddedopenCodePluginstruct +init()provider/pi_provider.go: AddedpiPluginstruct +init()Factory Update
provider/factory.go:NewProviderFactory()now iterates overglobalPluginRegistry.pluginsinstead of manually registering built-in creatorsArchitecture Alignment
chatapps/base/plugin.goinit()viaGlobalAdapterRegistry().Register()provider/plugin.goinit()viaRegisterPlugin()(this PR)Testing
go build ./provider/...go test ./provider/...Closes hrygo#322