Skip to content

Extract built-in clients into per-client packages - #167

Merged
JAORMX merged 1 commit into
mainfrom
refactor/client-plugin-interface
May 27, 2026
Merged

JAORMX merged 1 commit into
mainfrom
refactor/client-plugin-interface

Conversation

@JAORMX

@JAORMX JAORMX commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Introduces pkg/clients/<name>/ as a public plugin layer with one package per built-in coding agent (claudecode, codex, opencode, hermes, gemini). Each package exposes New() agent.ClientEntry returning the declarative agent.Agent value plus a Plugin implementation.
  • Adds an agent.Plugin interface so the small per-client behavior fragments — MCP config emission (different file, format, and key shape per agent) and host credential seeding (claude-code only today) — live alongside each client's data. The central MCPConfigFormat enum / switch in internal/infra/vm/hooks.go and the credentialSeederForAgent name-switch in cmd/bbox/main.go are gone; dispatch is polymorphic through the registry.
  • infraagent.NewRegistry no longer auto-loads builtins. Composition roots (cmd/bbox/main.go, pkg/runtime) now pass clients.Builtins(logger)... explicitly, so SDK consumers can register their own client packages alongside the standard set.

Adding a new client now means: create a pkg/clients/<name>/ package, add an entry to Builtins(), and add the images/<name>/Dockerfile + Taskfile target. No edits to the registry, no enum to extend, no switch to update. CLAUDE.md documents the new layer and a 3-step "Adding a new client" guide.

Net diff: +2349 / −1698 lines (most of the addition is per-client test coverage that previously lived in one large mcpconfig_test.go).

Test plan

  • task fmt clean
  • task lint clean
  • task test passes with race detector (full suite)
  • Smoke-test bbox list to verify all five built-in agents still appear
  • Smoke-test bbox claude-code (MCP config injection + credential seeder path)
  • Smoke-test one non-claudecode client (e.g. bbox codex) to confirm the data-only plugin path

🤖 Generated with Claude Code

Adds an agent.Plugin interface so per-client behavior (MCP config
emission, host credential seeding) lives alongside each client's
declarative data, and moves the five built-in clients (claude-code,
codex, opencode, hermes, gemini) into pkg/clients/<name>/. The central
MCPConfigFormat enum and the credentialSeederForAgent name-switch are
gone; dispatch is polymorphic through the registry.

infraagent.NewRegistry no longer auto-loads builtins — composition
roots pass clients.Builtins(logger) explicitly so SDK consumers can
register their own client packages alongside the standard set.

Adding a new client now means a new pkg/clients/<name>/ package, an
entry in Builtins(), and a Dockerfile + Taskfile target. No edits to
the registry, no enum to extend, no switch to update.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@JAORMX
JAORMX merged commit 3217db5 into main May 27, 2026
8 checks passed
@JAORMX
JAORMX deleted the refactor/client-plugin-interface branch May 27, 2026 09:46
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.

1 participant