feat(llamaswap): add llama-swaps (TLS) DSN scheme
CI / Tidy (pull_request) Successful in 9m43s
CI / Build & Test (pull_request) Successful in 10m26s
Adversarial Review (Gadfly) / review (pull_request) Successful in 11m47s

llama-swap was http-only by DSN, pushing TLS-fronted instances onto the openai://
scheme (which loses the management/image methods). Add a "llama-swaps" scheme
that builds an https base URL, alongside "llama-swap" (http, local-first) —
mirroring redis/rediss. Both share one factory; llama-swaps is scheme-only (no
default built-in). The choice stays explicit because a DSN has no reliable
http-vs-https signal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-27 17:58:59 -04:00
parent b2487a1a37
commit de2b2f0f28
6 changed files with 73 additions and 29 deletions
+7 -5
View File
@@ -38,11 +38,13 @@ features leak into the canonical API).
`Unload` (POST `/api/models/unload[/:model]`). A small `doJSON` helper shares
bearer auth + error mapping; non-2xx → `*llm.APIError` (so `llm.Classify`
applies), transport errors wrapped raw.
- DSN: the `llama-swap` scheme builds an **http://** base URL from the host
(llama-swap is local-first), deliberately *not* the DSN's https-always
`BaseURL()`. A TLS-fronted instance can use the `openai://` scheme for chat.
A no-DSN built-in `llama-swap` provider registers but errors on use (mirrors
foreman).
- DSN: two schemes share one factory. `llama-swap` builds an **http://** base
URL from the host (llama-swap is local-first), deliberately *not* the DSN's
https-always `BaseURL()`; `llama-swaps` builds **https://** for a TLS-fronted
instance (mirrors redis/rediss). Why a second scheme rather than auto-detect:
a DSN carries no reliable http-vs-https signal, so the choice stays explicit.
Only `llama-swap` registers a no-DSN built-in provider (errors on use, mirrors
foreman); `llama-swaps` is a scheme only.
- Image generation is implemented here too, against the new `imagegen`
interface (see ADR-0016).