diff --git a/CHANGELOG.md b/CHANGELOG.md index 261668c4..08c3abb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -128,10 +128,10 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) · Versioning: the ambient `OPENAI_API_BASE` auto-registration path, and no-op API-key prefix inference. Custom gateways and endpoints now require explicit, instance-local configuration. -- **Renamed host product references to decoder.** Host config paths (`~/.decoder/`), +- **Frozen legacy identifiers.** For compatibility, host config paths (`~/.decoder/`), the `decoder_build`/`decoder_build_concise` tool namespaces, the `decoder_response` - schema name, and the `EXPORT_DECODER_FIXTURE` env var now use the decoder identity. - References to retired ecosystem repos were removed. + schema name, and the `EXPORT_DECODER_FIXTURE` env var retain the decoder identity; + the product is now Relay. References to retired ecosystem repos were removed. - **Credential env-file migration falls back to the pre-rename host config directory** so installs created before the rename still migrate. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a0fcd39..2770bad5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,14 +25,14 @@ for the full list. The most common targets: | Target | What it does | | ------------------- | ------------------------------------------------ | -| `make build` | Build the binary / verify the library compiles | +| `make build` | Compile all library packages | | `make test` | Run unit tests | | `make test-race` | Run unit tests with the race detector | | `make cover` | Generate a coverage report | -| `make lint` | Run the linter (`golangci-lint` / `ruff`) | +| `make lint` | Run `golangci-lint` | | `make fmt` | Format source files | -| `make vet` | Run `go vet` / `mypy` | -| `make security` | Run `govulncheck` / `pip-audit` | +| `make vet` | Run `go vet` | +| `make security` | Run `govulncheck` | | `make ci` | Run everything CI runs (the gate before pushing) | ## Commit message convention @@ -118,10 +118,9 @@ Before requesting review: ## Reporting bugs -Open an issue using the bug-report template. Include the `relay` -version (`relay --version` for binaries, `relay.Version` for -libraries — see this repo's `VERSION` file), reproduction steps, expected -behaviour, and actual behaviour. +Open an issue using the bug-report template. Include the Relay version +(`relay.Version`, or this repo's `VERSION` file), reproduction steps, +expected behaviour, and actual behaviour. ## Reporting security issues diff --git a/Makefile b/Makefile index c515cfa7..d938fca5 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # Canonical graycode-eco Makefile for Go LIBRARY repos. -# relay is a versioned Go library consumed by Decoder (no standalone binary). +# relay is a versioned Go library consumed by Reflect (no standalone binary). # --------------------------------------------------------------------------- # Project metadata @@ -8,7 +8,7 @@ NAME := relay # --------------------------------------------------------------------------- # Versioning — sourced only from VERSION. -# See https://github.com/GrayCodeAI/decoder/blob/main/docs/versioning.md. +# See https://github.com/GrayCodeAI/reflect/blob/main/docs/versioning.md. # --------------------------------------------------------------------------- VERSION := $(shell tr -d '[:space:]' < VERSION) COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none") @@ -49,7 +49,7 @@ all: lint test build ## Default — lint, test, build. # --------------------------------------------------------------------------- # Build / install / release. # --------------------------------------------------------------------------- -build: version-sync ## Build all library packages (relay is a library consumed by decoder; no standalone binary). +build: version-sync ## Build all library packages (relay is a library consumed by Reflect; no standalone binary). go build ./... # --------------------------------------------------------------------------- diff --git a/README.md b/README.md index 584e597b..4fe270e8 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ resp, err := c.Chat(ctx, messages, llm.ChatOptions{ ```go // Auto-continues when max_tokens is hit -resp, err := provider.ChatWithContinuation(ctx, provider, messages, +resp, err := resilience.ChatWithContinuation(ctx, p, messages, llm.ChatOptions{Model: model}, core.DefaultContinuationConfig(), ) @@ -271,7 +271,7 @@ resp, err := provider.ChatWithContinuation(ctx, provider, messages, ### Mock Provider for Testing ```go -mock := provider.NewMockProvider(provider.MockModeFixed) +mock := testkit.NewMockProvider(testkit.MockModeFixed) mock.Response = "Here is the code you asked for..." resp, _ := mock.Chat(ctx, messages, opts) @@ -281,11 +281,10 @@ resp, _ := mock.Chat(ctx, messages, opts) ### Model Catalog ```go -cat := catalog.DefaultModelCatalog() +cat := catalog.SeedModelCatalog() // Get the best model for a tier model := catalog.GetPreferredProviderModel("anthropic", catalog.TierSonnet, &cat) -// → "claude-sonnet-4-6" // Check deprecation warnings warn := catalog.GetModelDeprecationWarning("claude-3-7-sonnet", "anthropic") @@ -396,7 +395,7 @@ Quick start: 3. Run `make ci` locally 4. Open a pull request -Use [Conventional Commits](https://www.conventionalcommits.org/) for commit messages — release-please uses them for versioning. +Use [Conventional Commits](https://www.conventionalcommits.org/) for commit messages — they drive the release notes and the hand-written CHANGELOG. ## License diff --git a/SECURITY.md b/SECURITY.md index d0efa4ed..35071362 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -45,13 +45,12 @@ We follow [coordinated vulnerability disclosure](https://en.wikipedia.org/wiki/C - **Dependency monitoring:** vulnerable dependencies are detected by `govulncheck`, which runs on every CI build (see "Vulnerability scanning"). -- **Static analysis:** `golangci-lint` / `ruff` / `mypy` enforced in CI. -- **Vulnerability scanning:** `govulncheck` (Go) / `pip-audit` (Python) run - on every CI build. -- **Lockfiles:** `go.sum` / `pnpm-lock.yaml` / `pyproject.toml` are pinned - and committed. -- **Reproducible builds:** release artefacts ship with SHA-256 checksums via - goreleaser. +- **Static analysis:** `golangci-lint` is enforced in CI. +- **Vulnerability scanning:** `govulncheck` runs on every CI build. +- **Lockfiles:** `go.sum` is pinned and committed. +- **Release integrity:** releases are cut from signed `v*` tags by + `.github/workflows/release.yml` after `scripts/sync-version.py --check` + verifies the tag matches `VERSION`. - **No secrets in source:** API keys are configuration, not constants. Pre- commit hooks block accidental secret commits. diff --git a/assets/logo.svg b/assets/logo.svg index 929955c2..dfefee20 100644 --- a/assets/logo.svg +++ b/assets/logo.svg @@ -88,7 +88,7 @@ the foundation layer for decoder + font-size="12" fill="#4ECDC4" opacity="0.65" letter-spacing="1.5">the foundation layer for Reflect diff --git a/catalog/credentials.go b/catalog/credentials.go index d760619e..73f5e100 100644 --- a/catalog/credentials.go +++ b/catalog/credentials.go @@ -2,7 +2,7 @@ package catalog // Credentials carries API keys and related env (base URLs) for provider-backed catalog discovery. // Keys use standard env var names (e.g. OPENROUTER_API_KEY). Populate via config.DiscoveryCredentials. -// or pass an explicit map from decoder — do not hardcode provider lists in decoder. +// or pass an explicit map from the host — do not hardcode provider lists in a host. type Credentials struct { APIKeys map[string]string } diff --git a/catalog/provider_credentials.go b/catalog/provider_credentials.go index 86206496..7b920a8a 100644 --- a/catalog/provider_credentials.go +++ b/catalog/provider_credentials.go @@ -59,7 +59,7 @@ func apiKeyEnvFromDeployment(dep Deployment) string { } // CredentialStatusForProvider reports whether a provider needs an API key (local vs required). -// For set/empty status use decoder config.EnvKeyStatus or credentials.HasSecret — catalog does not read env. +// For set/empty status use the host config.EnvKeyStatus or credentials.HasSecret — catalog does not read env. func CredentialStatusForProvider(compiled *CompiledCatalog, providerID string) string { providerID = canonicalProviderID(providerID) if providerID == "" { diff --git a/config/discovery_env.go b/config/discovery_env.go index ba31f2b2..5749045b 100644 --- a/config/discovery_env.go +++ b/config/discovery_env.go @@ -11,7 +11,7 @@ import ( ) // DiscoveryCredentials loads API keys from the OS secret store (not process env or .env files), -// merged with non-secret routing from ~/.decoder/provider.json (e.g. MiMo Token Plan region/base URL). +// merged with non-secret routing from the relay provider.json in the user config directory (e.g. MiMo Token Plan region/base URL). func DiscoveryCredentials(ctx context.Context) catalog.Credentials { if ctx == nil { ctx = context.Background() diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index c986071c..39ce4a72 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -13,9 +13,9 @@ ## target Overview -relay is the LLM provider runtime for the decoder ecosystem. It sits between the application and LLM APIs, handling **authentication**, **model resolution**, **streaming**, **retries**, **rate limiting**, and **caching**. +relay is the LLM provider runtime for the Reflect ecosystem. It sits between the application and LLM APIs, handling **authentication**, **model resolution**, **streaming**, **retries**, **rate limiting**, and **caching**. -> lightbulb No decoder ecosystem component talks to an LLM API directly — all communication goes through relay. +> lightbulb No Reflect ecosystem component talks to an LLM API directly — all communication goes through relay. --- @@ -23,7 +23,7 @@ relay is the LLM provider runtime for the decoder ecosystem. It sits between the ``` relay/ -├── engine/ Stable host-facing facade (decoder imports only this + llm/graph/tools) +├── engine/ Stable host-facing facade (Reflect imports only this + llm/graph/tools) ├── llm/ Host-facing DTOs + Provider port (engine re-exports) ├── graph/ Portable execution-graph vocabulary ├── tools/ Tool-call/result contracts @@ -51,7 +51,7 @@ The current distributed-routing foundation and its limits are described in ## globe API relay is a Go library: it ships no binary, no `cmd/`, and no `relay serve` -command. Hosts such as decoder call the [`engine`](../engine/) facade in-process. +command. Hosts such as Reflect call the [`engine`](../engine/) facade in-process. `internal/api` contains an HTTP server (`api.NewServer(api.Config{...})`, then `ListenAndServe(addr)`) whose contract is [`api/openapi.yaml`](../api/openapi.yaml). diff --git a/docs/design/RELAY-ENTERPRISE.md b/docs/design/RELAY-ENTERPRISE.md index 4a8e40e4..9d93d73c 100644 --- a/docs/design/RELAY-ENTERPRISE.md +++ b/docs/design/RELAY-ENTERPRISE.md @@ -23,21 +23,20 @@ no telemetry exfiltration by default). ### Which Top-20 repos ship these features -From `TOP20_COMPARISON.md` (the relay section, lines 89–124): - -| Capability | Top-20 repos that ship it | Comparison-doc reference | -|---|---|---| -| Multi-tenant team/project management with SSO/RBAC | LiteLLM, Portkey | `TOP20_COMPARISON.md:96` (P0) | -| Virtual-key budgets + admin dashboard UI | LiteLLM (per-key spend, hard limits, admin dashboard), Portkey | `TOP20_COMPARISON.md:96` | -| Helicone-style analytics dashboard (HQL, sessions, 21+ metrics) | Helicone, Portkey, LangSmith | `TOP20_COMPARISON.md:111` (P1) | -| Versioned prompt library + side-by-side model comparison | Portkey, LangSmith | `TOP20_COMPARISON.md:110` (P1) | -| Canary / blue-green model testing | Portkey (canary routing), LiteLLM | `TOP20_COMPARISON.md:107` (P1) | -| A2A (Agent-to-Agent) protocol | LiteLLM proxy (LangGraph, Vertex Agent Engine, Azure AI Foundry, Bedrock AgentCore) | `TOP20_COMPARISON.md:108` (P1) | -| Fine-tuning workflow integration | OpenAI, Vertex AI, Together AI | `TOP20_COMPARISON.md:123` (P2) | -| Priority queue with SLA tiers | LiteLLM, enterprise LLM gateways | `TOP20_COMPARISON.md:124` (P2) | - -Relay's gap summary in the comparison doc: **2 P0 / 13 P1 / 5 P2** (`TOP20_COMPARISON.md:271`). -The enterprise gateway is the single largest cluster of those gaps and the one with no +Capability comparison against the top LLM gateway and observability projects: + +| Capability | Projects that ship it | +|---|---| +| Multi-tenant team/project management with SSO/RBAC | LiteLLM, Portkey | +| Virtual-key budgets + admin dashboard UI | LiteLLM (per-key spend, hard limits, admin dashboard), Portkey | +| Helicone-style analytics dashboard (HQL, sessions, 21+ metrics) | Helicone, Portkey, LangSmith | +| Versioned prompt library + side-by-side model comparison | Portkey, LangSmith | +| Canary / blue-green model testing | Portkey (canary routing), LiteLLM | +| A2A (Agent-to-Agent) protocol | LiteLLM proxy (LangGraph, Vertex Agent Engine, Azure AI Foundry, Bedrock AgentCore) | +| Fine-tuning workflow integration | OpenAI, Vertex AI, Together AI | +| Priority queue with SLA tiers | LiteLLM, enterprise LLM gateways | + +The enterprise gateway is the largest cluster of those gaps and the one with no incremental code-session path — it requires a persistent org data model and a UI, which is why it is treated here as a multi-month effort. diff --git a/docs/guides/CREDENTIAL-SETUP-FLOW.md b/docs/guides/CREDENTIAL-SETUP-FLOW.md index 35d4d740..0ef90d76 100644 --- a/docs/guides/CREDENTIAL-SETUP-FLOW.md +++ b/docs/guides/CREDENTIAL-SETUP-FLOW.md @@ -4,7 +4,7 @@ See also: [DYNAMIC-MODEL-DISCOVERY.md](./DYNAMIC-MODEL-DISCOVERY.md) -## Supported providers (15 — from `catalog/registry`) +## Supported providers (29 — from `catalog/registry`) | Provider | ID | Credential | Picker models | |----------|-----|------------|---------------| @@ -14,10 +14,24 @@ See also: [DYNAMIC-MODEL-DISCOVERY.md](./DYNAMIC-MODEL-DISCOVERY.md) | DeepSeek | `deepseek` | `DEEPSEEK_API_KEY` | live `/models` only | | OpenRouter | `openrouter` | `OPENROUTER_API_KEY` | live `/models` only | | xAI (Grok) | `grok` | `XAI_API_KEY` | live `/v1/models` only | -| Z.AI | `z-ai` | `ZAI_API_KEY` | live `/models` only | +| Z.AI — Coding Plan | `zai_coding` | `ZAI_CODING_API_KEY` | live `/models` only | +| Z.AI — Pay-as-you-go | `zai_payg` | `ZAI_API_KEY` | live `/models` only | | CanopyWave | `canopywave` | `CANOPYWAVE_API_KEY` | live `/models` only | | OpenCode Go | `opencodego` | `OPENCODEGO_API_KEY` | live `/models` only | | Kimi (Moonshot) | `kimi` | `MOONSHOT_API_KEY` | live `/models` only | +| Azure OpenAI | `azure` | `AZURE_OPENAI_API_KEY` | live deployments | +| Amazon Bedrock | `bedrock` | `AWS_SECRET_ACCESS_KEY` (+ `AWS_ACCESS_KEY_ID`, region) | live model list | +| Vertex AI | `vertex` | `VERTEX_ACCESS_TOKEN` (+ project/region) | live model list | +| Concentrate AI | `concentrate` | `CONCENTRATE_API_KEY` | live model list | +| OpenGateway | `opengateway` | `OPENGATEWAY_API_KEY` | live model list | +| StepFun | `stepfun` | `STEP_API_KEY` | live model list | +| Agnes AI | `agnes` | `AGNES_API_KEY` | live model list | +| LongCat | `longcat` | `LONGCAT_API_KEY` | live model list | +| Fireworks AI | `fireworks` | `FIREWORKS_API_KEY` | live model list | +| Reflection AI | `reflection` | `REFLECTION_API_KEY` | live model list | +| Poolside | `poolside` | `POOLSIDE_API_KEY` | live model list | +| Groq | `groq` | `GROQ_API_KEY` | live model list | +| ClinePass | `clinepass` | `CLINE_API_KEY` | live model list | | Xiaomi (MiMo) Pay-as-you-go | `xiaomi_mimo_payg` | `XIAOMI_MIMO_PAYG_API_KEY` | `https://api.xiaomimimo.com/v1` (`sk-` keys) | | Xiaomi (MiMo) Token Plan | `xiaomi_mimo_token_plan` | `XIAOMI_MIMO_TOKEN_PLAN_API_KEY` | region: `cn` / `sgp` / `ams` (`tp-` keys) | | MiniMax (minimax) Token Plan | `minimax_token_plan` | `MINIMAX_TOKEN_PLAN_API_KEY` | `https://api.minimax.io/v1` | @@ -50,7 +64,7 @@ Relay stores Anthropic **base** as `…/anthropic` (no `/v1`); `AnthropicClient` **Legacy:** `xiaomi_mimo` / `XIAOMI_MIMO_API_KEY` / keychain account `xiaomi_mimo_api_key` migrate to pay-as-you-go (`XIAOMI_MIMO_PAYG_API_KEY` / `xiaomi_mimo_payg_api_key`) on load and startup. -**Code:** `relay/catalog/xiaomi/` (URLs), `relay/provider/mimo.go` (dual-protocol client), `reflect/cmd/chat_config_region.go` (region UI). +**Code:** `relay/catalog/xiaomi/` (URLs), `relay/provider/adapters/mimo.go` (dual-protocol client), `reflect/cmd/chat_config_region.go` (region UI). **Not implemented (out of scope):** ASR/TTS ([Speech Recognition](https://platform.xiaomimimo.com/docs/en-US/api/audio/Speech-Recognition), speech synthesis guides), web-search billing plugins, user toggle for Anthropic-primary routing. @@ -71,11 +85,11 @@ Setup is **gateway-first**: pick the gateway on the Gateways tab, paste any non- ## Host API (reflect integrates through `relay/engine`) -- `ResolveCredentialForHost` / `SaveCredentialForHost` -- `ApplyRelayCredentials` -- `ListModelsForProvider` — registry-driven live vs cache -- `LocalCredentialInference("ollama")` -- `FormatSetupError(provider, err)` +- `(*engine.Engine).ResolveCredential` / `SaveCredential` +- `(*engine.Engine).ApplyCredentials` +- `(*engine.Engine).ListModels` / `ListLiveModels` — registry-driven live vs cache +- `config.LocalCredentialInference("ollama")` +- `engine.FormatSetupError(provider, err)` ## Adding a new provider diff --git a/setup/apply_credentials.go b/setup/apply_credentials.go index 71aba5c0..17443247 100644 --- a/setup/apply_credentials.go +++ b/setup/apply_credentials.go @@ -56,7 +56,7 @@ func ApplyCredentialsForProvider(ctx context.Context, providerID string, creds c } // ApplyCredentials discovers the model catalog from env API keys, then writes -// ~/.decoder/adapters.json deployments and routing derived from the catalog. +// relay provider.json deployments and routing derived from the catalog. func ApplyCredentials(ctx context.Context, creds catalog.Credentials) (*ApplyCredentialsResult, error) { catResult, err := DiscoverModelCatalog(ctx, creds) if err != nil { diff --git a/setup/setup_ui.go b/setup/setup_ui.go index 51e084ee..19c1acd7 100644 --- a/setup/setup_ui.go +++ b/setup/setup_ui.go @@ -22,7 +22,7 @@ type ProviderUI struct { Models []ModelUI `json:"models"` } -// SetupUI is JSON-safe metadata returned to decoder (no secrets). +// SetupUI is JSON-safe metadata returned to the host (no secrets). type SetupUI struct { Providers []ProviderUI `json:"providers"` } diff --git a/setup/status.go b/setup/status.go index 99eccb45..a2e88050 100644 --- a/setup/status.go +++ b/setup/status.go @@ -132,7 +132,7 @@ func FormatStatus(report StatusReport) string { fmt.Fprintf(&b, " cached: no (using embedded catalog: %d models)\n", report.CatalogModels) } if report.CatalogStale { - b.WriteString(" stale: yes — decoder refreshes automatically; use `reflect models refresh` or `/refresh-model-catalog` for a manual run\n") + b.WriteString(" stale: yes — Reflect refreshes automatically; use `reflect models refresh` or `/refresh-model-catalog` for a manual run\n") } if report.ActiveModel != "" { fmt.Fprintf(&b, "Active canonical model: %s\n", report.ActiveModel)