Documentation
¶
Overview ¶
Package backends constructs composer.Composer implementations from operator config (the registry of LLM backends). Each provider wire lives in its own subpackage (anthropic, openai, cli); this package is the thin factory that maps a declarative BackendSpec onto them, plus a deterministic "fake" backend for dev / e2e.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRegistry ¶
func BuildRegistry(cfg RegistryConfig, resolveKey func(spec BackendSpec) (string, error)) (*composer.Registry, []string, error)
BuildRegistry constructs a *composer.Registry from RegistryConfig. resolveKey resolves a backend's API key (secret-store name -> value, with the caller's env fallback baked in); it is only called for backends that needsAPIKey(). Disabled backends are skipped. It returns the registry plus human-readable warnings (e.g. the subscription ToS notice) for the operator log.
func NewFromSpec ¶
func NewFromSpec(spec BackendSpec, apiKey string) (composer.Composer, error)
NewFromSpec builds one Composer from a spec and an already-resolved API key (empty when the backend needs none). It is wire/transport-dispatch only.
Types ¶
type BackendReadiness ¶
type BackendReadiness struct {
Name string
Provider string
Model string
Wire string
Transport string // normalized (HTTP wires default to "api"); cli tool / fake variant verbatim
Auth string // openai azure only: apikey|entra (empty elsewhere)
Enabled bool
NeedsKey bool
KeySecret string
KeyResolved bool
}
BackendReadiness is the BOOT-snapshot readiness of one configured backend for the first-run setup surface. Unlike the live registry (which drops disabled and unresolvable backends), it reports every configured backend so the wizard can show disabled + needs-key states. KeySecret is a secret NAME, never a value.
func Inspect ¶
func Inspect(cfg RegistryConfig, keyPresent func(secretName string) bool, envFallback bool) []BackendReadiness
Inspect returns a readiness snapshot for every configured backend, reusing the same enabledDefault()/needsAPIKey()/provider() rules the registry builder uses. keyPresent reports whether a named secret resolves in the store (it must return false for an empty name); envFallback is whether WARDYN_COMPOSER_API_KEY is set. KeyResolved = needsKey ? (keyPresent(secret) || envFallback) : true.
type BackendSpec ¶
type BackendSpec struct {
Name string `json:"name"`
Wire string `json:"wire"` // "anthropic" | "openai" | "cli" | "fake"
Transport string `json:"transport"` // anthropic: api|bedrock; openai: api|azure|compatible; cli: claude|codex
Model string `json:"model"`
BaseURL string `json:"base_url,omitempty"` // openai azure/compatible
Region string `json:"region,omitempty"` // anthropic bedrock
Auth string `json:"auth,omitempty"` // openai azure: apikey|entra
APIKeySecret string `json:"api_key_secret,omitempty"` // secret-store name (HTTP key backends)
BinPath string `json:"bin_path,omitempty"` // cli
TimeoutSeconds int `json:"timeout_seconds,omitempty"` // cli
MaxAttempts int `json:"max_attempts,omitempty"`
Enabled *bool `json:"enabled,omitempty"` // default true; cli default false (subscription ToS)
}
BackendSpec is one entry in the operator's composer registry config (JSON). Credentials are referenced, never inlined: api_key_secret names a secret in the at-rest secret store (cmd/wardynd resolves it, with an env fallback) — the spec itself carries no secret value.
type RegistryConfig ¶
type RegistryConfig struct {
Default string `json:"default"`
Backends []BackendSpec `json:"backends"`
}
RegistryConfig is the whole composer config: a default backend name + the set of configured backends.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package anthropic implements the composer.Composer backend that drives Anthropic's Messages API (first-party API or Amazon Bedrock) to produce a Wardyn run proposal.
|
Package anthropic implements the composer.Composer backend that drives Anthropic's Messages API (first-party API or Amazon Bedrock) to produce a Wardyn run proposal. |
|
Package cli implements a composer.Composer backed by the operator's resident coding-agent CLI (Claude Code or Codex) running under its own logged-in SUBSCRIPTION — no API key is minted or passed.
|
Package cli implements a composer.Composer backed by the operator's resident coding-agent CLI (Claude Code or Codex) running under its own logged-in SUBSCRIPTION — no API key is minted or passed. |
|
Package composertest holds fixtures shared by the cli, openai, and anthropic backend test suites: a schema-valid proposal JSON blob, a representative ComposeRequest, and the common Proposal assertions every backend's happy-path test needs.
|
Package composertest holds fixtures shared by the cli, openai, and anthropic backend test suites: a schema-valid proposal JSON blob, a representative ComposeRequest, and the common Proposal assertions every backend's happy-path test needs. |
|
Package openai implements the Wardyn Run Composer backend that talks to OpenAI-wire Chat Completions APIs.
|
Package openai implements the Wardyn Run Composer backend that talks to OpenAI-wire Chat Completions APIs. |
|
Package transport provides a hardened, governed HTTP client for the composer's OWN outbound LLM API egress — the control-plane calls each networked composer backend makes to a third-party model provider (Anthropic, OpenAI, Azure, Bedrock, …).
|
Package transport provides a hardened, governed HTTP client for the composer's OWN outbound LLM API egress — the control-plane calls each networked composer backend makes to a third-party model provider (Anthropic, OpenAI, Azure, Bedrock, …). |