Files
billion-context/hermes-plugin
awork cd63f863ef fix: carry hermes' per-model context window onto both report channels (#3261)
The hermes native plugin stamped model/max-output but never the context
window, so custom-alias models (absent from every registry) sized sessions
at the 200K default even when the host knew the real window. Now the
plugin reads HERMES_HOME/context_length_cache.yaml (the host's own
per-model window cache, keyed <model>@<base_url>) best-effort and reports
it on both #955/#956 channels: x-bili-plugin-context-window header in the
llm_request middleware and contextWindow in the runtime-info body (dedup
key extended so a changed window re-reports). Base URL resolution:
hook/request-supplied fields first, then the provider entry in
config.yaml; matching is exact-URL then origin-granularity (cache keeps
/v1, configs often omit it); conflicting per-upstream windows are never
guessed (fail-open to the proxy's normal chain, like every other miss).

Adjacent fix in the same call path: on_pre_api_request read 'table'
unconditionally while binding it only inside the max_tokens-present
branch — a hook fire without max_tokens raised NameError into the
swallowing except and silently skipped the whole runtime-info report.
Hoisted the binding.
2026-10-15 15:47:55 +08:00
..