Skip to content

feat(provider): init() self-registration for built-in agents (closes #322)#7

Open
aaronwong1989 wants to merge 3 commits into
mainfrom
feat/322-agent-registry-init
Open

feat(provider): init() self-registration for built-in agents (closes #322)#7
aaronwong1989 wants to merge 3 commits into
mainfrom
feat/322-agent-registry-init

Conversation

@aaronwong1989
Copy link
Copy Markdown
Owner

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 ProviderPlugin interface and registers via init():

  • provider/claude_provider.go: Added claudeCodePlugin struct + init()
  • provider/opencode_provider.go: Added openCodePlugin struct + init()
  • provider/pi_provider.go: Added piPlugin struct + init()

Factory Update

  • provider/factory.go: NewProviderFactory() now iterates over globalPluginRegistry.plugins instead of manually registering built-in creators

Architecture Alignment

Component Registry Location Self-Registration
Platform adapters chatapps/base/plugin.go init() via GlobalAdapterRegistry().Register()
Agent providers provider/plugin.go init() via RegisterPlugin() (this PR)

Testing

  • go build ./provider/...
  • go test ./provider/...

Closes hrygo#322

探云 Bot 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] Platform/Agent 注册表: Plugin 化架构

1 participant