A plugin-injected turn that waits for the session's background review and
plugin forks stopped waiting only when a person's message was queued behind
it. A message accepted as a steer (steer mode or /steer) or as an
interrupt-mode redirect goes straight into the running turn and is never
queued, so the turn kept waiting, up to the full 120 s, before it
superseded the background work.
Every accepted steer and redirect passes through _fold_into_running_turn;
it now ends the session's plugin wait the same way a queued message does,
and the background work is cancelled as for any person's turn. Another
plugin's message still does not end the wait.
A plugin-injected turn waits up to 120 s for the session's running
background review and plugin forks before it starts. A person's message
that arrived while it waited queued behind that wait, so the person's
turn started up to 120 s late; a gateway shutdown sat out the same wait
past its drain budget.
The wait now ends at once when a person's input is queued for the
session behind the injected turn (checked on every admission's arrival,
and once when the wait begins), or when the gateway drains or the
profile retires. The background work is then cancelled the same way a
person's turn cancels it, and the FIFO order is unchanged: the injected
turn runs, then the person's.
The plugin LLM access guide states the rule and the shutdown behavior.
A message a plugin injects started a turn that superseded the session's
running background review and plugin forks at once, the same as a turn a
person started: the user's own self-learning review ended with no result.
A turn the gateway runs for a plugin's FIFO admission now waits up to 120 s
for the review and the launched forks already running on that session, then
cancels whatever is still running. An interrupt of the session agent ends
the wait early. A person's turn is unchanged and supersedes them at once.
Running the turn alongside the review instead is not an option: they share
the session id, so their usage would be counted twice.
The plugin LLM access guide says plugins should not rely on an injected
turn to cancel background work.
Idle-task workers were detached threads that always wrote the task's
state when the plugin's function returned, so a run still going when the
gateway stopped (or the multiplexer restarted in the same process) wrote
profile state after housekeeping had stopped.
Gateway housekeeping now polls idle tasks under a stop fence tied to its
stop event. Once housekeeping stops, no run starts under it; when the loop
exits it waits a bounded time (inside the housekeeping drain budget) for
its runs and returns. A run that ends after the stop records nothing: the
task's state stays as it was before the run, so the task runs again on a
later poll, and the run still releases its claim. Closing the fence waits
for a record in progress, so none lands after the stop. Plugin code cannot
be stopped; the idle-task contract now says so and states the guarantee.
Hosts without a stop (CLI/TUI startup, the serve maintenance tick) are
unchanged.
The idle-job run claim (curator and plugin idle tasks) recorded only the
owner's pid and was reclaimed only after an hour, so a gateway that crashed
or was killed mid-run kept the task suppressed for an hour after restart.
The claim now records the owner's pid, process start time and machine
(boot id + PID 1 start). A claim whose owner is gone, or whose pid now
belongs to a process with another start time, is taken over at the next
poll; a live owner's claim is never taken, however old. A claim whose owner
cannot be checked (a bare pid from an older Hermes, another machine, no
readable start time) keeps the hour rule. Takeovers and releases unlink the
lock under a cross-process guard file, so two claimants of a dead claim
never both win and a release never removes a claim another process took.
Both APIs may still change shape, so the plugin guide now says so and tells a
plugin how to stay portable: keep the fork handle in one small function that
returns plain data, and treat fork_session as optional. It returns None when
the request is refused, and under plugins.isolation: host it raises
PluginHostUnsupported, since the handle tracks a thread of the live session
agent inside the Hermes process.
The guide also states the idle-task contract: fn runs on its own thread and
the host does not wait for it, so a run should keep its own time limit, work
in small checkpointed batches and be safe to repeat.
Tool Search defers every plugin tool by default, so the session's tools[] carry the
tool_search / tool_describe / tool_call bridges instead of the tool, and a fork naming
its own tool was refused tools_not_in_session.
A requested tool is now in the session when its captured tools[] advertise it, or when
those tools[] carry tool_call and the name is in the session's deferred catalog (the
classification the session's own tool_call unwrap uses). For a deferred tool, core
appends one line to the prompt: call it through tool_call, with the tool's parameters.
tools[] stay the session's, byte for byte. Inside the fork tool_call is only a carrier:
the dispatch guard sees its unwrapped target, so a tool_call to an unrequested, foreign,
core or connector tool is denied, and tool_search / tool_describe stay refused.
handle.actions lists the carried tool.
Fork ownership came from the plugin registration ledger by exact name, but
the dispatcher serves some names before the tool registry: connector names
(connectors__<connector>__<tool>), the session's memory-provider tools, its
context-engine tools, agent-level tools, legacy aliases and the Tool Search
bridge. A plugin that registered such a name had it admitted to its fork
while the call reached a connector, memory provider or context engine.
pre_registry_route() in agent/inline_tool_executors.py now answers which
seam serves a name before the registry, using the dispatcher's own checks;
the sequential and concurrent paths read the memory-provider and
context-engine membership through the same helpers. The fork allowlist
admits a name only when that predicate returns None and the plugin owns
the live registration: at request time against the lease's session agent
(token unspent on refusal), and when the fork starts against both the
session agent and the fork that dispatches.
_launch registered the job and marked it launched before building and starting
the worker, outside any exception handling. When spawn_context_thread or
Thread.start raised, the exception crossed fork_session's no-raise boundary,
the handle stayed running, the job stayed in the parent's registry and its
request exit was never published, so every later live turn spent the full
cancellation deadline waiting on a run that could never acknowledge. The
launcher now unregisters the job under the registry lock, publishes its
request exit and settles the handle error:spawn; fork_session returns that
settled handle.
A name deny list cannot classify tools it has never seen: another plugin's
a2a_call or meet_join starts a remote agent task or a detached worker, and an
MCP tool can trigger server-initiated sampling, all outside the fork thread's
tool whitelist and auto-denied approvals. The fork allowlist is now built from
ownership instead: the tools whose live registration is the requesting
plugin's (newest active ledger entry per name), plus core tools marked
fork-safe in FORK_SAFE_CORE_TOOLS (empty). A name dispatch reroutes before the
registry (inline agent tools, legacy aliases, the Tool Search bridge) never
counts as the plugin's own. Naming any other tool returns None with the token
unspent, and the dispatch guard reads the allowlist again when the fork starts.
background_review extra_tools is operator-configured and goes back to its
previous behavior; the consent text says the fork uses the plugin's own tools.
The next-turn cancel and timeout interrupt the fork and the handle settles when its
worker exits, so a provider call that ignores the interrupt keeps the handle open.
refused:parent_gone joins moa, agent_provider and runtime_changed in the outcome list.
A plugin task could inherit_from any core auxiliary block and resolve to its provider,
model, endpoint and key, so a plugin without allow_task_override could still spend
through an operator-configured built-in route (background_review, curator, ...) by
naming its own inheriting task. Read-time resolution now carries a core base's route
fields (provider, model, base_url, api_key, api_mode, key env, reasoning_effort,
extra_body, fallback_chain) only when the owning plugin holds allow_task_override,
including through a chain of plugin tasks rooted in a core block; non-route policy
such as timeout still inherits. inherit_from accepts the picker tasks plus an explicit
list (background_review, curator) instead of every current and future core block.
Only launched forks were registered on the parent, so the next turn's interrupt missed a
fork still queued for machine idle (the idle dispatcher launched it later) and one between
_launch's cancel check and its registration. Every fork is now registered on its parent
from the moment it is deferred or launched; the interrupt fences all of them, settling a
never-launched fork as cancelled, releasing its idle-queue slot and publishing its request
exit. _launch checks and registers under the same lock, and the interrupt records the turn
it fenced, so a fork of that turn reaching registration afterwards is refused.
delegate_task, message_agent, cronjob_manage and the Kanban moves that hand a task to a
dispatched worker run their loop outside the fork thread's dispatch guard: a delegate
child is built from the parent's toolsets and its worker enters through a copied context
that carries neither the thread-local whitelist nor the auto-deny approval callback.
fork_session now refuses a tools= list naming one (None, token unspent), the fork's
dispatch whitelist drops them however the job was built, and background_review
extra_tools ignores them with a warning.
register_auxiliary_task only accepted picker tasks (main_provider_setup._AUX_TASKS) or
plugin-registered keys as an inherit_from base, so inherit_from="background_review" was
silently dropped and a plugin fork's task= lane ran on the session model instead of
following auxiliary.background_review. Any dict block under DEFAULT_CONFIG["auxiliary"] is
now a valid base, resolved at read time like the others.
Hermes' own background review (fork the live agent after a turn, run a
bounded multi-step prompt with a narrow tool list, cancel on the next live
turn) is now open to plugins as ctx.fork_session(token, prompt, *, tools=(),
max_iterations=8, input_budget=None, task=None, timeout=None), gated by the
new consent-only capability llm.session_fork.
Reused, not copied:
- Lease: post_llm_call's side_question_token backs a side question OR a fork
(side_question_lease.take_lease; same TTL, turn_moved_on, profile fence,
no token for unattended turns, one redemption per turn). The payload field
keeps its name for compatibility.
- Fork: build_cache_parity_fork(write_origin="plugin_fork:<id>") on a
context-bound thread in the captured turn context; same-model forks replay
the captured system prompt and tools[] byte-for-byte; routed forks get the
history digest. Persistence stays fully detached.
- Guardrails: the thread tool whitelist is the requested names (each must
already be in the session's tools[]); approvals auto-deny; the review's
input budget (a plugin can only lower it) and iteration cap (<= 16);
_BackgroundReviewRun admission so cancel_background_review_for_live_turn
interrupts plugin forks with the review under one bounded wait;
review_idle_queue deferral on the managed local runtime (enqueue takes a
dispatch callable; a newer fork of the same plugin supersedes the queued
one).
- Routing: task must be one of the plugin's register_auxiliary_task lanes,
resolved like auxiliary.background_review.
- Usage and hooks: release_cache_parity_fork bills the parent session as
plugin_fork:<id>; each fork loop request reports pre/post_auxiliary_call
(aux_task="plugin_fork", plugin_id) instead of pre/post_api_request.
Tool handlers inside the fork receive turn_origin="plugin_fork:<id>"
(live calls get no new kwarg), so a plugin can refuse calls from the live
agent. The handle exposes done/cancelled/outcome/result/actions/wait/cancel,
never the fork agent. Fails closed (None) without the capability, on a bad,
expired, spent or foreign token, a tool the session does not advertise, or
a task the plugin does not own.
The documented chart.write handler called the model inline. A plugin RPC call
holds its client's request lane until the handler returns, so that client's
next requests on the connection (an interrupt, an approval answer) waited
for the model, which llm.oneshot never did.
The example now needs a session_id, starts the model call in a thread under
contextvars.copy_context() (ctx.llm reads the profile scope from there),
answers {"job"} at once and sends the chart or the error as the session
event chart.written. A semaphore caps it at 4 calls in flight like
llm.oneshot's per-owner cap; a fifth is refused busy, and a slot comes back
when Thread.start fails.
The route's test now runs the page's code block verbatim, in-process and
under plugins.isolation: host: a sessionless call is refused, 4 calls
return jobs while their model calls are held, a 5th is refused busy, the 4
chart.written events carry the jobs and the parsed JSON, and a 6th call is
accepted. In-process it also makes Thread.start fail 4 times and checks
the next call still gets a slot.
Suggested by @BearHuddleston in review.
The plugin LLM guide shows the route: the frontend calls
plugin.<id>.<name>; the handler, registered with ctx.register_rpc,
masks its input with redact_sensitive_text(..., force=True) and calls
ctx.llm.complete_structured on the task the plugin registered.
The test runs that route end to end on the session authority: a plugin
registers an auxiliary task and an RPC method, auxiliary.<task> points
at a loopback stub model, and a frontend-shaped call gets the parsed
JSON back. The stub saw the request on the task's model with a
json_schema response_format, and never the secret, with redaction
turned off for the profile (force=True). Without force=True it fails.
#142006 widened the core llm.oneshot gateway method with `schema` and
`redact` params and a `parsed` result field. Only one plugin's chart
writer would ever send them; Desktop, the bundled plugins and the TUI
never do. A plugin's frontend already has its own route for this: a
plugin RPC method (ctx.register_rpc, #142005) whose handler calls
ctx.llm.complete_structured on the plugin's own auxiliary task.
So both gateways and the contract go back to the pre-#142006 shape for
these params. Two parts of #142006 stand on their own and stay:
- client_task: an unknown `task` is refused (invalid_params field=task
on the shared gateway, 4031 on the sidecar). Before it, a typo ran
on the main model unnoticed (#141976).
- agent/plugin_llm.py parses the whole reply as JSON first, then the
fenced block, so a JSON value whose strings hold ``` fences parses.
That fixes ctx.llm.complete_structured. Its test now exercises
_parse_structured_text directly.
auxiliary_client resolves a task explicit args first, then auxiliary.<task>.*, then auto; the
session's route (main_runtime) only fills the auto case. The docs said a session_id lends the
session's model "instead of the task's", which reads as overriding an explicitly configured task.
Raised by Copilot on #142006.
jsonschema is not a core dependency (it arrives only through the mcp
extra and kittentts), and _parse_structured_text skips validation when
it is missing. oneshot_reply now raises ValueError before any model call
when a schema is given and jsonschema is not importable, so parsed is
always schema-checked.
A plugin frontend could not run its plugin's auxiliary task through the
gateway with structured output, so hermes-tern spawns a Python helper that
imports call_llm and the redactor directly.
- task: a built-in auxiliary slot or one a loaded plugin registered with
ctx.register_auxiliary_task, resolved through auxiliary.<task> as before.
An unknown key is now refused (invalid_params field=task on the shared
gateway, 4031 on the sidecar) instead of running on the main model.
- schema: a JSON Schema object. The call asks for JSON through the prompt
and the provider's JSON mode (the response_format ctx.llm already sends),
and the reply carries parsed. A non-JSON or non-matching answer is an error.
- redact: masks secrets in input with agent.redact before the model sees it.
Both servers (shared gateway, tui_gateway sidecar) share agent.oneshot's
client_task and oneshot_reply. Contract and generated TS/OpenRPC updated;
documented in the plugin LLM access guide.
Closes#141976
- No side_question_token for cron runs (platform="cron") or delegated subagent turns
(_delegate_depth > 0): nobody reads the answer, so it is pure unattended spend.
- A lease is bound to the profile home it was issued in; a plugin context of another profile
gets None and leaves the lease for its owner.
- Usage bills to the session the token was issued for (capture.session_id), not the parent's
id at release time, which can rotate between issue and redeem.
- Plugin side questions report as aux_task="plugin_side_question" with the asking plugin_id in
pre/post_auxiliary_call, and record usage as plugin_side_question:<plugin_id>; /btw keeps
side_question.
- Drop the new legacy key llm.allow_side_question: the capability is declare + consent only.
- The timeout starts before the fork build, so runtime resolution counts against it.
- Refuse when the parent's model/provider/base_url/api_mode/reasoning
changed since the turn was captured: a voice-chat turn routed to
auxiliary.voice_chat restores the main runtime right after
post_llm_call, and the captured prompt must not go out on another model.
- has_server_side_tools also reads extra_body.tools: request_overrides
land there and the SDK merge sends them over the top-level tools.
- One pre/post_auxiliary_call bracket around the whole attempt, so a
reply that fails after the provider returned (no choices) still closes
the observer's request with its error; a cancelled call reports an
InterruptedError instead of an empty success.
- Drop the 32-lease global eviction: it revoked live sessions' tokens on
a busy gateway. The table already holds at most one lease per live
agent (new turn, expiry and a dead parent all purge).
The side request fired the turn-scoped pre_api_request/post_api_request
after its turn had already closed, so trace-per-turn observers (and the
relay metrics keyed on them) counted a plugin's side call as a model call
of a finished turn. Every other side call (titling, compression, MoA,
vision, ...) reports through pre/post_auxiliary_call instead.
- turn_api_request: build_request_payload() is the payload build through
the LLM request middleware with no hook; build_api_request() wraps it
with pre_api_request, the debug dump and the MoA handshake, unchanged
for the turn loop.
- auxiliary_hooks: start_aux_call_hooks()/finish_aux_call_hooks() expose
the pre/post pair for callers that drive the provider call themselves;
post accepts an already-normalized (message, finish_reason, usage) view
for a transport-native reply.
- side_question_request: build_request_payload + aux hooks with
aux_task="side_question"; a request refused for server-side tools now
fires nothing.
Test: a real plugin observing all four events sees pre/post_api_request
for the turn only and pre/post_auxiliary_call (with usage) for the side
request (red before).
post_llm_call now carries a single-use side_question_token when a loaded
plugin holds the new llm.side_question capability. ctx.side_question(token,
prompt) redeems it: ONE text-only request on a cache-parity fork through
the turn loop's own request phases (assemble_api_request, build_api_request,
perform_api_call), never the tool loop. The parent's system prompt, tools[],
reasoning config and max_tokens are replayed verbatim, so the request reads
the warm prompt cache. Tool calls in the reply are dropped, nothing is
persisted, and usage lands on the session as side_question.
Lease rules: one attempt per turn shared by every plugin (consumed even on
failure), 60 s, invalid once the parent starts its next turn, prompt capped
at 4096 chars, timeout capped at 60 s. The lease holds its parent weakly and
runs under the turn's captured contextvars (profile and secret scope).
Refused with None: MoA, agent-as-provider runtimes, requests that carry
provider-executed tools.
has_capability moves with side_question into a PluginContext mixin
(hermes_cli/plugins_capability_ctx.py) so hermes_cli/plugins.py shrinks.
Fixes#143788
Salvage follow-up for #129189 on top of #129209:
- An unknown or self-referential `inherit_from` now logs a warning and
registers the task without inheritance instead of raising, so one bad
base no longer fails the whole plugin load (the #129191 approach).
- `provider: auto` on an inheriting task means "no preference", like the
empty strings: "Reset all to auto" (CLI + dashboard) writes exactly that,
and before this it pinned the slot to the main provider while the model
was still inherited from the base (mismatched route).
- Once the user pins a route on the task (non-auto provider, model or
base_url), provider/model/base_url/api_key/api_mode/key_env/effort all
come from the task's own block. Mixing per key let a pinned provider pick
up the base's base_url and api_key.
- The CLI picker resolves the inherited view only for inheriting tasks.
Tests collapse to behavior contracts: base followed and changes
propagate, picker placeholders keep following, a pin wins whole, bad
bases warn and are ignored, re-registration cycles are cut.
Co-authored-by: Yuan Li <dskwelmcy@163.com>
`PluginContext.register_auxiliary_task` already lists a plugin task in the `hermes model`
picker and layers its defaults into `auxiliary.<key>`, but every REST/UI surface behind the
Models page enumerated only the built-in `_AUX_TASK_SLOTS`:
- `GET /api/model/auxiliary` never listed the task
- `POST /api/model/set` (scope=auxiliary) rejected it: `400 unknown auxiliary task`
- `__reset__` and the empty-task broadcast skipped it; `_stale_aux_pins` ignored it
- Desktop Settings → Models and the dashboard ModelsPage hardcoded the built-in list
So a plugin's side model could only be pinned by hand-editing config.yaml per profile.
Fix, at the existing seams:
- `web_server_config._aux_task_slots()` = built-ins + plugin keys from
`get_plugin_auxiliary_tasks()`, fail-soft; every consumer in that module uses it.
- `GET /api/model/auxiliary` reads plugin tasks INSIDE `_profile_scope`, so a request for
profile B enumerates B's plugins (the plugin manager keys on the same context-local home) —
the profile-scope gap flagged on #40922. Built-in rows are byte-identical; plugin rows are
appended with `label`/`hint`/`plugin` from the registration.
- Desktop `model-settings.tsx` and dashboard `ModelsPage.tsx` render served plugin rows after
the built-ins using the server label/hint (pure `auxTaskRows`; no new i18n strings, no-op on
older backends).
Tests: real plugin loaded from a temp HERMES_HOME through PluginManager discovery, two
profiles in one process (listing scoped per profile; foreign task still 400), assignment /
broadcast / reset / stale-pin over a plugin slot, discovery failure leaves built-ins intact —
all red on main. Vitest covers the pure row merge and the rendered plugin row.
Fixes#40880. Salvages #40922.
Co-authored-by: Tranquil-Flow <tranquil_flow@protonmail.com>
register_auxiliary_task's defaults start from a fixed shape and every key
is a full replace, so a plugin whose side model is a near-copy of a
built-in has to restate the whole block and silently drifts when that
built-in's shape changes.
inherit_from names a built-in or already-registered task whose effective
config becomes the base, resolved at read time so the plugin tracks the
base's current values instead of snapshotting them. Precedence is base,
then plugin defaults, then user config.
Self-referential inherit_from is rejected at registration rather than
left to the read-time guard: same-owner re-registration is allowed, so
the bad value would otherwise surface as unbounded recursion in a config
read. The guard stays for a hand-edited registry.
Closes#129189
Mechanical `check_doc_links.py --fix` pass over website/docs (hand-authored
and generated pages) and the zh-Hans mirror: 1,868 route-style links
(`](/section/page#anchor)`, `](/docs/...)`) become `](../section/page.md#anchor)`.
Every target was asserted to exist on disk; anchors and query strings are
preserved; fenced code blocks and inline-code examples are untouched.
Two dead targets found by the converter were fixed by hand first:
memory-providers.md linked `/user-guide/plugins` (page is
`user-guide/features/plugins`), and the zh-Hans learning-path still linked the
removed `rl-training` page — ported the EN treatment (external Atropos link).
Docusaurus build after: EN locale 0 unresolved Markdown links, 0 broken links,
0 broken anchors.
The locale switcher appeared broken because hardcoded markdown links
(`](/docs/X)`) got double-prefixed by Docusaurus to `/docs/<locale>/docs/X`
(404) in non-English locales, and the MDX hero `<a href>` on the index
page escaped locale routing entirely.
Changes:
- Rewrite 922 `](/docs/X)` -> `](/X)` across 166 docs files (strip trailing
.md too). Docusaurus prepends locale + baseUrl itself.
- docs/index.md -> index.mdx; hero "Get Started" anchor -> Docusaurus
<Link> so it stays inside the active locale.
- Drop `ko` locale entirely from docusaurus.config.ts + delete i18n/ko/
(4 stale auto-translated kanban pages, <2% coverage, misleading).
Verified `npm run build` succeeds for both en and zh-Hans; `build/zh-Hans/
index.html` has no /docs/zh-Hans/docs/... double-prefixed paths.
PR2 will translate the 335 English docs into i18n/zh-Hans/.
* feat(plugins): host-owned LLM access via ctx.llm
Plugins can now ask the host to run a one-shot chat or structured
completion against the user's active model and auth, without ever
seeing an OAuth token or API key. Closes the gap where plugins that
needed bounded structured inference (receipts, CRM extraction,
support classification) had to either bring their own provider keys
or register a tool the agent had to call.
New surface on PluginContext:
- ctx.llm.complete(messages, ...)
- ctx.llm.complete_structured(instructions, input, json_schema, ...)
- async siblings ctx.llm.acomplete / acomplete_structured
Backed by the existing auxiliary_client.call_llm pipeline — every
provider, fallback chain, vision routing, and timeout policy Hermes
already supports applies automatically.
Trust gate (fail-closed by default):
- plugins.entries.<id>.llm.allow_model_override
- plugins.entries.<id>.llm.allowed_models (allowlist; '*' = any)
- plugins.entries.<id>.llm.allow_agent_id_override
- plugins.entries.<id>.llm.allow_profile_override
Embedded model@profile shorthand goes through the same gate as
explicit profile=, so it can't bypass the auth-profile policy.
Conflicting explicit and embedded profiles fail closed.
Also lands:
- plugins/plugin-llm-example/ — reference plugin that registers
/receipt-extract, demonstrating image+text structured input,
jsonschema validation, and the trust-gate config.
- website/docs/developer-guide/plugin-llm-access.md — full API docs.
- 45 unit tests covering trust gates, JSON parsing, schema
validation, image encoding, async surface, and config loading.
Validation:
- 2628 tests pass in tests/agent/
- E2E: bundled plugin loaded with isolated HERMES_HOME, slash
command produced parsed JSON via stubbed call_llm
- response_format extra_body wired correctly for both json_object
and json_schema modes
* docs(plugin-llm): rewrite quickstart and framing
The quickstart now uses a meeting-notes-to-tasks example instead of
a receipt extractor, and the page leads with hook-time / gateway
pre-filter / scheduled-job framing rather than the OpenClaw
KB/support/CRM/finance/migration enumeration that the original
upstream PR used. Receipt example moved to a separate worked
example link so the docs page itself doesn't echo any of the
upstream framing.
Also clarifies where ctx.llm fits in the broader plugin surface
(table comparing register_tool / register_platform / register_hook
/ etc.) and what makes this lane different from auxiliary_client
internals.
No code change.
* docs(plugin-llm): reframe as any LLM call, not just structured output
The original draft leaned heavily on complete_structured() and made
the chat lane (complete() / acomplete()) feel like a footnote.
Restructure so:
- The page title and description say 'any LLM call.'
- The lead shows BOTH a plain chat call (error rewriter) AND a
structured call (triage scorer) up top.
- Quick start has two complete plugin examples — /tldr (chat) and
/paste-to-tasks (structured).
- New 'When to use which' table for choosing complete() vs
complete_structured() vs the async siblings.
- Trust-gate sections explicitly note 'all four methods,' and the
request-shaping list calls out chat-only fields (messages) and
structured-only fields (instructions, input, json_schema)
alongside each other.
- The 'Where this fits' section now says 'for any reason,
structured or not.'
The receipt-extractor reference plugin still exists under
plugins/plugin-llm-example/ — but the docs page no longer treats
it as the canonical surface example. It's now described as 'a third
worked example, this time with image input.'
No code change.
* feat(plugin-llm): split provider/model into independent explicit kwargs
The first cut accepted a single 'provider/model' slug on every method
and split it internally. That looked clean but broke under live test:
the model-override path tried to use the slug's vendor prefix as a
literal Hermes provider id, which silently switched the user off
their aggregator (e.g. plugin asks for 'openai/gpt-4o-mini' on a user
who routes through OpenRouter — host attempted to call the 'openai'
provider directly, failed because OPENAI_API_KEY wasn't set).
New shape mirrors the host's main config:
ctx.llm.complete(
messages=[...],
provider='openrouter', # gated, optional
model='openai/gpt-4o-mini', # gated, optional
profile='work', # gated, optional
...
)
Each is independently gated by its own allow_*_override flag.
Granting model-override does NOT auto-grant provider-override.
Allowlists are now per-axis (allowed_providers, allowed_models)
matched literally against whatever string the plugin sends.
Dropped 'model@profile' embedded-suffix shorthand entirely. Hermes
doesn't use that pattern anywhere else; profile= is its own kwarg.
Live E2E (against real OpenRouter via Teknium's config) confirms:
- zero-config call works
- default-deny blocks each override with a helpful error
- model-only override stays on user's active provider (the bug)
- provider+model override switches cleanly
- allowlist refuses non-listed entries
- structured output round-trip parses + schema-validates
Tests: 49 cases (up from 45); all green. Docs updated to match the
new shape, including a 'most plugins never need this section' callout
on the trust-gate config block.
* fix+cleanup(plugin-llm): real attribution, hook-mode coverage, move example out of core
Three integration fixes for the ctx.llm surface:
1. Attribution bug — result.provider and result.model now reflect
what call_llm actually used, not placeholder fallbacks ('auto',
'default'). New _resolve_attribution() helper:
- explicit overrides win (what the call targeted)
- response.model wins for the recorded model (provider
canonicalisation: 'gpt-4o' → 'gpt-4o-2024-08-06' etc.)
- falls back to _read_main_provider() / _read_main_model()
when no override is set, so audit logs reflect the user's
active main provider/model
- 'auto' / 'default' only when EVERYTHING is empty
Live verified: zero-config call now records
provider='openrouter', model='anthropic/claude-4.7-opus-20260416'
instead of provider='auto', model='default'.
2. Hook-mode coverage — TestHookMode confirms ctx.llm.complete
works from inside a registered post_tool_call callback. The
docs page promised hook integration; now there's a test that
exercises the lazy-import path through the real invoke_hook
machinery. Two cases: traceback-rewrite hook with conditional
ctx.llm.complete, and minimal hook regression for the
sync-hook + sync-llm path.
3. Reference plugin moved out of core. plugins/plugin-llm-example/
is gone from hermes-agent — it now lives in the new
NousResearch/hermes-example-plugins companion repo. The docs
page links there. Hermes' bundled plugins should be plugins
users actually run; reference / docs-companion plugins live
externally.
Test count: 56 (up from 49). Wider sweep on tests/hermes_cli/
+ tests/gateway/ + tests/tools/ + tests/agent/ shows 16770
passing; the 12 failures are all pre-existing on origin/main
(verified by stashing this branch's changes and re-running) —
kanban-boards, delegate-task, gateway-restart, tts-routing —
none touch the plugin_llm surface.
* chore(plugins): move all example plugins to companion repo
Reference / docs-companion plugins now live exclusively in
NousResearch/hermes-example-plugins, not bundled with the core repo:
- example-dashboard
- strike-freedom-cockpit
A new fourth example, plugin-llm-async-example, was added to that
repo demonstrating ctx.llm's async surface (acomplete()) with
asyncio.gather() — registers /translate <lang>: <text> which fires
forward translation + sentiment classifier in parallel, then a
back-translation for QA. Live-tested at 2.5s for three real
provider round-trips (would be ~5-6s sequential).
Docs updated:
- developer-guide/plugin-llm-access.md links both sync and async
examples in the Reference section
- user-guide/features/extending-the-dashboard.md repoints both demo
sections to the companion repo with corrected install paths
- user-guide/features/built-in-plugins.md drops the two demo rows
- AGENTS.md notes that example plugins live in the companion repo
Net: hermes-agent's plugins/ directory now contains only plugins
users actually run (memory providers, dashboard tabs that ship real
features, the disk-cleanup hook, platform adapters). All four
demo / reference plugins live externally where they can be cloned
on demand instead of inflating the core install.