Skip to content

[plugins] Phase 5b: registry provider methods + catalog routes + PluginsClient (THV-0077) #5529

Description

@JAORMX

Goal: Add the registry provider seam and catalog routes for plugins, plus the PluginsClient.

Deliverables:

  • pkg/registry/provider.go — ListAvailablePlugins/GetPlugin/SearchPlugins (template skill methods) with no-op defaults on BaseProvider.
  • pkg/api/v1/registry_v01_plugins.go — /registry/{name}/v0.1/x/dev.toolhive/plugins[/{namespace}/{pluginName}] (template registry_v01_skills.go; register in pkg/api/v1/registry_v01.go).
  • PluginsClient in pkg/registry/api (template pkg/registry/api/skills_client.go).

Missed piece 1 — wire PluginLookup (currently dead code). pluginsvc.WithPluginLookup (pkg/plugins/pluginsvc/service.go) is never passed by createDefaultPluginManager in pkg/api/server.go, so thv ai-plugin install <plain-name> always 404s with "not found in local store or registry". Add a lazyPluginLookup mirroring lazySkillLookup (pkg/api/server.go ~line 836) that resolves the default provider per call and delegates to Provider.SearchPlugins, and pass it via pluginsvc.WithPluginLookup(...) when building the plugin manager. This is what makes registry-name install actually work end-to-end.

Missed piece 2 — types.Registry has no Plugins field (decision needed before implementing the remote provider). toolhive-core registry/types.Registry carries servers/remote servers/skills only. The remote provider's side-effect discovery (provider_remote.go checks len(upstream.Data.Servers) == 0 && len(upstream.Data.Skills) == 0) cannot see plugins. Two options:

  • (a) extend UpstreamRegistry/Registry in toolhive-core with a Plugins field — a mini GATE-C4 (merge → tag → bump both repos); or
  • (b) have the remote/cached providers fetch plugins purely through the new PluginsClient, the way CachedAPIRegistryProvider.ListAvailableSkills already goes through SkillsClient (pkg/registry/provider_cached.go ~line 394).

Option (b) avoids a new core gate and matches the cached-provider precedent; decide in the PR.

Dependency/gate: depends on GATE-C3 (toolhive-core registry/types.Plugin tagged + go.mod bumped in both toolhive and toolhive-registry-server). ✅ Satisfied — types.Plugin is in every core tag ≥ v0.0.28; toolhive is on v0.0.35. Parallel with Phase 5d.

Testing/exit gate: catalog list/get via provider; thv ai-plugin install <plain-name> resolves through the registry lookup against a mock registry.

Part of #5525
Refs RFC PR stacklok/rfcs#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementregistry

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions