5 Commits
Author SHA1 Message Date
Hermes 5f8ef9bab7 Provider-Namen, Endpunkte aus der Umgebung, ein Modell zur Zeit, echte Erreichbarkeit
Vier Dinge, die zusammengehören: der Router soll sagen, WER bezahlt wird, er soll nicht
für jeden Schlüssel einen Block verlangen, er soll eine lokale Box nicht überfahren, und
er soll wissen, ob ein Ziel überhaupt da ist.

Namen: `cloud` heißt jetzt `opencode-go`, `cloud-free` heißt `opencode-go-free`. Ein Name,
der eine Betriebsform beschreibt („cloud"), sagt nichts darüber, wer die Rechnung
schickt. In der Live-Konfiguration und in allen Beispielen umbenannt, alle Verweise mit.

Schlüssel = Endpunkt (`auto_endpoints on`): OPENCODE_GO_API_KEY[_N] → opencode-go[N],
OLLAMA_KEY[_N] → ollama[N], ANTHROPIC_API_KEY oder CLAUDE_API_KEY[_N] → claude[N]. Die
Datei gewinnt, wo sie spricht; die Automatik füllt nur Lücken. <PROVIDER>_BASE biegt die
Basis um (für Tests und einen eigenen Proxy). Kein erfundener context: Grenzen gehören
den Modellen und kommen aus ihrer Liste. Eine Datei ohne Endpunkt-Blöcke ist damit
gültig, wenn die Umgebung sie liefert.

`max_model_inflight 1` am Endpunkt: eine Anfrage je (Endpunkt, Modell), der Rest wartet
in der Schlange. Gemessen mit einem 2-s-Stub: dasselbe Modell zweimal braucht 4 s (also
nacheinander), zwei verschiedene Modelle 2 s (also gleichzeitig). `strip "local/"` an der
Regel schneidet das Präfix ab, bevor die Anfrage den Router verlässt — auch im Rumpf, was
ohne `as_model` nur im Router passiert wäre; der Stub bestätigt, dass die Box
qwen3.6-35b sieht und nicht local/qwen3.6-35b. `strip` muss vor `pass` stehen, weil
`pass` die Zeile beendet.

Erreichbarkeit (`probe_interval`, `probe_timeout`, `probe off`): ein Hintergrundfaden
holt die Modellliste jedes Endpunkts. Entscheidend ist der TCP-Verbindungsaufbau, nicht
der Statuscode: `-w '%{time_connect}'` gleich 0 heißt unerreichbar. Beide falschen
Abkürzungen sind mir dabei passiert und beide sind jetzt ausgeschlossen — „jeder
curl-Fehler ist offline" nimmt langsame Ziele dauerhaft aus dem Verkehr, „nur 6/7 ist
offline" hält einen Host für gesund, der Pakete verwirft (die lokalen Ports auf
172.25.206.3 taten genau das: 28 nach Zeitablauf, also laut erster Regel „lebt").

Live: probe meldet lokal1–local4 und den lokalen opencode-Serve korrekt offline
(TCP kommt nicht zustande), eine Anfrage auf local/qwen3.6-35b antwortet in 1,7 s mit
`503 no_endpoint_available` statt nach 6 s in vier Verbindungszeitabläufe zu laufen.

Tests: drei neue Abschnitte (17 Prüfungen) — gleiches Modell 4 s, zwei Modelle 2 s,
Präfix weg; toter Endpunkt ohne Anfrage erkannt, Anfrage überspringt ihn in 1,2 ms, kommt
von selbst zurück, `probe off` hält ein Ziel heraus; Schlüssel aus der Umgebung ergeben
Endpunkte, OLLAMA_KEY2 wird ollama2 und nicht ein größerer Pool, `auto_endpoints off`
erfindet nichts. tests/run.sh räumt Provider-Variablen weg, sonst legt eine zufällig
gesetzte Variable in der Shell Endpunkte an, die kein Test erwartet.
make test: PASS, 249 Prüfungen, 174 s.
2026-11-08 15:09:29 +00:00
Hermes Agent c34082f51d junction: threads, a queue, and status lines a parser cannot see
One thread per connection plus max_inflight upstream slots; further requests wait in
line (queue_timeout) instead of being refused. A waiting caller that asked for a
stream is told why it waits with SSE comment lines (': junction: waiting for a free
slot (0 ahead of you)'), which the spec says every parser must ignore — a human
watching curl sees progress, a client sees nothing it could misinterpret. The real
answer then starts in the same stream and the comments simply stop.

Trade-off, stated in the README: a streaming caller gets its 200 before the upstream
is chosen, so a later upstream failure cannot be an HTTP status any more — it travels
as a data: {"error":...} event. Non-streaming callers get nothing injected and keep
their true status code.

Also: cache and endpoint state are locked (they are shared between threads now), and
the test stub forks per connection — a serial stub made a concurrent router look
serialised, which is exactly the kind of test that lies.
2026-10-29 15:01:36 +00:00
Hermes Agent a68ed88b84 junction is a pass-through: no token estimation, no invented max_tokens
'need' now reads only max_tokens/max_completion_tokens as the client wrote them.
chars_per_token and default_max_tokens are gone (and rejected as unknown keywords, so
an old config fails loudly instead of steering nothing). A request that declares no
budget is not sized at all — the guessing is what made a 2048-context embedding
endpoint reject requests that carried no token budget in the first place.

tests: 'need' proven from a declared max_tokens, and a request without one proven to
route by model and path alone.
2026-10-29 14:46:24 +00:00
Hermes Agent a768f1061a examples: say plainly that WoL does not cross WireGuard
The sleeping box is the one on n95's own segment; a tunnel peer needs a wake hook
that talks to that side. Also marks the LAN address as a placeholder.
2026-10-29 14:14:12 +00:00
Hermes Agent 87e6348642 junction: per-target 'as', example config for the van, C WoL helper
- A rule may send a different model name per target: 'pass peer-a as M, peer-b, cloud'
  rewrites only for peer-a, so a mixed local/cloud rule still asks the cloud for the
  name the client wanted.
- examples/olivia.conf: peers on the tunnel, embedding box, sleeping workstation with
  WoL + energy gate, cloud fallback, and the policy rules each with its reason.
- tools/junction-wol.c replaces the Python magic-packet helper; hooks stay shell.
- Forwarding no longer duplicates Host/Content-Length/X-Forwarded-*: Ollama answered
  400 to a request that was valid because it arrived with two Host headers.
- need_tokens: embeddings produce a vector, not tokens, so they are not charged
  default_max_tokens (a 2048-context embed endpoint refused every request).
- /status lists every target with its model, plus the rule's need window.
2026-10-29 14:13:46 +00:00