Files
junction/config.example
T
Hermes Agent dc31481914 junction: TLS, chunked coding, response cache, header passthrough
- TLS both directions behind one j_conn handle: https upstreams with SNI, chain and
  hostname verification (system store or tls_ca) and a 'listen ... tls cert key'
  listener. Handshake has a hard deadline; a peer that closes without close_notify
  is EOF, not an error (HTTP/1.0 bodies end at close).
- Chunked request bodies decoded into the body buffer; chunked responses relayed
  byte for byte so streaming is untouched.
- Memory-only LRU response cache (method+path+model+body), honouring no-store/
  private, client no-cache, never caching streams, flushable at runtime.
- Header passthrough with hop-by-hop removal, per-endpoint static headers,
  X-Forwarded-For/Proto, and X-Junction-{Endpoint,Ms,Cache} on every response.
- No separate reachability probe: the request itself is the test (the probe wedged
  servers that serve one connection at a time).
- tests/run.sh: 34 checks incl. a TLS peer; refuses to start on a busy test port.
2026-10-29 13:57:49 +00:00

92 lines
2.7 KiB
Plaintext

# junction.conf — pf.conf-style. keyword, arguments, braces. '#' starts a comment.
# Double quotes group words. Unknown keywords are a hard error with a line number.
# Plain listener:
listen 0.0.0.0:8090
# ... or TLS (https clients without a proxy in front):
# listen 0.0.0.0:8443 tls /etc/junction/tls/cert.pem /etc/junction/tls/key.pem
chars_per_token 4
default_max_tokens 4096
connect_timeout_ms 1500
offline_hold_s 20
max_body_bytes 67108864
# Response cache (memory only). ttl 0 disables it. Only complete, non-streamed 200
# answers are stored, keyed on method + path + model + body.
cache_ttl 300
cache_entries 128
cache_bytes 33554432
# --------------------------------------------------------------------- endpoints
endpoint peer1 {
base http://192.0.2.10:8081/v1
kind remote
context 64000
priority 20
timeout 600
idle_timeout 60
cooldown 120
hook /opt/junction/hooks/check-http.sh
}
endpoint peer2 {
base http://192.0.2.10:8082/v1
kind remote
context 64000
priority 20
timeout 600
idle_timeout 60
cooldown 120
hook /opt/junction/hooks/check-http.sh
}
endpoint workstation {
base http://192.0.2.20:8080/v1
kind local
context 128000
priority 10
timeout 1800
idle_timeout 30
cooldown 60
hook_retry 180
hook_backoff 5
wake /opt/junction/hooks/wake-wol.sh
hook /opt/junction/hooks/check-http.sh
hook /opt/junction/hooks/check-budget.sh
}
endpoint cloud {
base https://api.example.com/v1
kind cloud
context 200000
priority 90
timeout 900
idle_timeout 120
cache off # never store cloud answers
api_key_env EXAMPLE_API_KEY
tls_verify on # off only for a self-signed internal endpoint
# tls_ca /etc/junction/tls/internal-ca.pem
header "X-Title: olivia" # static header sent with every request here
}
# ------------------------------------------------------------------------- rules
# First matching rule wins. Rules may use:
# for <model-glob> need >N | <N | N path <glob>
# check hooks|none retry <seconds>
# pass <endpoint>[,<endpoint>...] [as <model>] | block
# Requests that need more context than the peers have go straight to the big box.
req need >64000 pass workstation, cloud
# Coding work: prefer the workstation, wake it, wait up to 5 minutes for the hooks,
# and hand it the model name it actually serves.
req for "*coder*" check hooks retry 300 pass workstation as "Qwen3.8-Flash-Next-GSQ-RCO-IQ1_M"
req for "Qwen3.8-Flash-Next*" check hooks retry 60 pass workstation, peer1, peer2
# Cheap metadata calls never need a model at all.
req path "/v1/models" check none pass peer1, peer2, cloud
# Anything unseen is refused rather than silently sent to the cloud.
req for "*" block