Commit Graph

131 Commits

Author SHA1 Message Date
alt-glitch
7c9b019ab5 fix(plugin api): publish hermes_cli.version_info:hermes_user_agent
Eight bundled plugins already build their User-Agent header with
hermes_user_agent: six model providers, the Slack adapter and the
Perplexity web provider. Each was a baselined private import. The name is
now on the published plugin list, with a section in the plugin guide, and
those eight baseline rows go.

The xAI plugins need the same name before tools/xai_http.py can be split:
its hermes_xai_user_agent returns the string
hermes_user_agent("Hermes-Agent") returns.
2026-11-17 15:38:46 +05:30
alt-glitch
69cddd08f4 fix(plugin api): publish agent.retry_utils:parse_retry_after_seconds
Plugins that call a rate-limited HTTP API need to read the Retry-After
header. Discord, Signal and Slack already import Hermes's parser as
baselined private crossings, and the Microsoft Graph client needs it to
move into the teams_pipeline plugin.

- plugin_api.json lists the one name; public-api.md is regenerated.
- plugins/index.md gains a short section with the contract and an example.
- boundary_lint baseline drops the three crossings that are now public
  (Discord, Signal, Slack). No other line changes; a full --update would
  also drop two unrelated stale rows, so it was not used.
- Test: a plugin importing the parser validates with no private-import
  warning, while another name from agent.retry_utils still warns. Red on
  main.
2026-11-17 09:09:45 +05:30
Victor Kyriazakos
1cec6709ae fix(gateway): plugin idle-task runs stop with gateway housekeeping
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.
2026-11-13 15:30:30 -08:00
Victor Kyriazakos
aaf648e835 docs(plugins): mark fork_session and register_idle_task experimental
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.
2026-11-13 15:30:30 -08:00
Victor Kyriazakos
a7ac9bba45 fix(plugins): a slow plugin idle task no longer holds up the gateway's housekeeping
Plugin idle tasks ran synchronously on the thread that polled them. On the
gateway that is the housekeeping thread: it also stamps the runtime
heartbeat and runs the cron delivery drain, the misfire catch-up, the plugin
update check and state.db maintenance. An idle task that made model calls for
minutes stalled all of them, and after two minutes gateway status reported
the live gateway as wedged.

Each due task now starts on its own thread, carrying the poller's profile
home and secret scope, and the poll returns at once. The run claim still
keeps one run at a time across pollers and processes, and a run of this
process is never doubled even when it outlasts the claim's stale age. The
worker records the run and releases the claim when the task returns or
raises. The curator's own pass is unchanged.
2026-11-13 15:30:30 -08:00
Victor Kyriazakos
3845dbb76c feat(plugins): ctx.register_idle_task runs a plugin job on the curator's idle schedule
A plugin with session-less background work (re-scoring its own data,
suggesting a cleanup) had to run its own timer. register_idle_task(name, fn,
*, interval_hours, min_idle_hours=2, first_run="defer") puts it on the skill
curator's scheduler instead:

- polled from every site that drives the curator (gateway housekeeping per
  served profile, CLI/TUI startup maintenance, the hermes serve maintenance
  tick) through one run_idle_jobs(): the curator, then the active profile's
  plugin tasks;
- the curator's gates via agent/idle_schedule: the min-idle check, the
  interval (floored to 1 h) whose first observation seeds last_run_at and
  defers one interval (first_run="immediate" opts out), and the O_EXCL claim
  file so a task never overlaps itself across threads or processes;
- state per (profile, plugin, task) in <plugin data dir>/idle-tasks/<name>.json
  (last_run_at, run_count, paused, last_summary, last_status, last_error);
  a manager polled outside its own home runs nothing;
- exceptions are logged and recorded, never raised into housekeeping;
- the registration is a PluginRegistration, so unload stops the polling;
- `hermes plugins idle-tasks [plugin] [--pause TASK | --resume TASK]`.

fn receives plain data (name, idle_for_seconds, last_run_at, run_count) and
reaches its ctx through its closure, so the payload also crosses the isolated
plugin host. No capability: the scheduler only calls the plugin's own
function; model calls inside it go through ctx.llm's existing gate.

plugins.py and gateway/run.py are over the file-size cap, so the mixin lives
in hermes_cli/plugins_idle_tasks.py and neither file grows.
2026-11-13 15:30:30 -08:00
Victor Kyriazakos
32f9c1f6b3 feat(plugins): ctx.fork_session runs a bounded background copy of the session agent
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.
2026-11-13 15:30:30 -08:00
Victor Kyriazakos
674412b1fa feat(plugins): post_llm_call carries review_signals, the self-learning cadence
post_llm_call gains a read-only review_signals mapping: the skill and memory
nudge counters, both intervals, whether each review trigger fired this turn
and whether a due trigger actually forks the background review (enabled in
config, not cron, not a subagent).

A plugin doing its own after-turn work (Collective Wisdom's share
suggestion) can then follow the cadence the user already tuned instead of
counting tool calls itself.

The hook fires before the review decision, so the finalizer now evaluates
the skill trigger once (agent/review_signals.py::skill_review_due) and hands
the same boolean to the hook and to the spawn; the memory trigger was
already decided at turn start. The mapping is a dict subclass that refuses
mutation (one instance reaches every callback) and stays a plain dict on the
plugin-host wire and through copy/pickle. Computed only when post_llm_call
has a subscriber.
2026-11-13 15:30:30 -08:00
Sahil-SS9
6600bde0d9 feat(plugins): ctx.redact_text() so plugins scrub secrets without importing agent.redact
Plugins that store or upload text (session sharing, edit capture) need Hermes's
own scrubber at its strongest setting, and today the only way is a private
import of agent.redact, which the catalog flags. Add a thin PluginContext
method: non-reusable sentinels for prefixed keys, masked credential
assignments, plugin-registered patterns included, security.redact_secrets
honoured unless force=True.
2026-11-13 00:56:05 -08:00
Teknium
4f2fd3b8c0 fix(plugin api): publish hermes_cli.urllib_security:open_credentialed_url
The redirect-safe opener (drops credential headers when a redirect leaves
the origin) is what plugins sending API keys should use, and the bundled
model providers already do; validate still warned on it as a private
import. List it in plugin_api.json with a short docs section, regenerate
public-api.md, and drop the three now-public crossings from the
boundary-lint baseline.
2026-11-12 22:33:52 -08:00
Teknium
4bad741311 fix(file_safety): published read check refuses device and /proc files
get_read_block_error is the path check plugins are told to call, but only
read_file consulted the device/proc table, so a plugin following the docs
could still read /proc/<pid>/environ (process secrets) or hang on /dev/zero.
The path-only table and is_blocked_device_path move into agent/file_safety;
get_read_block_error checks the literal and resolved path; read_file keeps
its symlink-hop walk and imports the table from there.
2026-11-12 22:33:52 -08:00
Teknium
9788899694 fix(plugins): publish the path-check and YAML helpers reviews tell authors to use
Catalog reviews ask plugin authors to refuse credential paths with
agent.file_safety.get_read_block_error / raise_if_read_blocked and to read
YAML with hermes_yaml (core ships no PyYAML). `hermes plugins validate`
then warned on exactly those imports as "private core imports", so an
author who followed the review got a warning for doing so.

- plugin_api.json lists the four file_safety checks and
  hermes_yaml.safe_load/safe_dump; public-api.md regenerated.
- plugins/index.md gains a short section with the table and an example.
- boundary_lint baseline drops the 7 bundled-plugin crossings that are now
  public (no other line changes).
- Test: the guide's example validates clean, while a whole-module
  `import agent.file_safety` still warns. Red on main.
2026-11-11 22:17:18 -08:00
unsupportedpastels
0d292cf9ac docs(plugins): list the missing callers of the finalize, approval and pre_tool_call helpers
Patch from @BearHuddleston's review.
2026-11-09 22:17:43 -05:00
unsupportedpastels
ba7dd8d95d docs(plugins): name _reset_session_off_loop as the gateway on_session_reset fire site
Suggested by Greptile.
2026-11-09 22:17:43 -05:00
unsupportedpastels
b33912c24f docs(plugins): list every event that fires gateway_platform_event in the hook reference 2026-11-09 22:17:43 -05:00
unsupportedpastels
d7827e025b docs(plugins): name the function that fires each VALID_HOOKS entry 2026-11-09 22:17:43 -05:00
Teknium
c33bf7cec7 fix(approvals): a child process started in a mixed-sender turn names no single actor
Greptile P2 (thread 4518419778): `_inject_session_context_env` read the session
ContextVars directly, skipping the mixed-turn check in `get_session_env`, so a
terminal / execute_code child started after another member folded into the turn
still got the opener in HERMES_SESSION_ACTOR_ID/_NAME. Both readers now go
through one `_bound_session_value`, so the child env carries an empty actor,
like the approval binding; `_UNSET` stripping is unchanged.
2026-11-09 15:17:08 -08:00
Teknium
9c04b1b168 fix(gateway): observed-group actor rides its own session var; batches split per sender
Review follow-ups on the observe-mode actor fix:
- HERMES_SESSION_USER_ID stays the session ROUTE (kanban notify, cron, send_message
  rebuild delivery targets from it, and in a shared chat it is empty); the trusted
  sender of the turn is HERMES_SESSION_ACTOR_ID / _NAME (defaults to the route user).
- Text and photo batch keys of a sender-less shared source carry the sender, so two
  members addressing the bot in one batch window are two turns with their own actor.
- build_session_context gets the event positionally (existing stubs take *args).
- e2e marker: pytest.mark.platforms("posix").
2026-11-08 21:34:50 -08:00
Teknium
856e75808d fix(curator): flag dry-run in post_curator_run and stop re-waiting on hung discovery
Independent review round:
- P2: post_curator_run fires on `hermes curator run --dry-run` with no way to tell;
  the payload now carries dry_run (documented in hooks.md + plugins guide).
- P3: _delivery_manager joined background discovery on every hook call, so a plugin
  whose register() hangs cost every invoke_hook/has_hook another 30s; a join that
  times out once is not repeated (the mid-discovery race fix is kept).
- P3: hermes hooks test post_curator_run sent the generic session payload; it now
  sends the real shape (run_dir, run_json_path, report_md_path, dry_run).
2026-11-08 11:55:30 -08:00
Sahil Saghir
8bc0880615 feat(curator): add post_curator_run plugin hook event
Fires once per curator pass, after the per-run report directory
(run.json + REPORT.md) is fully written, with the report paths in the
payload. Goes through the standard lifecycle hook surface
(hermes_cli.lifecycle.invoke_hook), so Python plugins and shell-script hooks both
receive it with no extra wiring, and per-callback error isolation comes
for free.

Lets multi-profile governance layers (profile routing, archival
overrides, audit logging) react to curator output without polling
logs/curator/. Observer-only: return values are ignored, and a raising
callback never breaks the curator pass.

Kwargs: run_dir, run_json_path, report_md_path.

Follow-up to the discussion on #43113, scoped down to the hook event
suggested there.

Rebased onto main by the maintainers: fired through hermes_cli.lifecycle
(first-party observers, then plugins) without an extra wrapper, documented
in the hooks reference, tests trimmed to the two behaviour contracts.
2026-11-08 11:55:30 -08:00
unsupportedpastels
463abea009 fix(plugins): one plugin may declare its own session env name twice
The duplicate check refused any overlapping registration in a profile, so a
plugin calling ctx.register_session_env twice for the same name now failed
to load, where it used to load with the later registration's value winning.

Registrations now record their owning plugin (PluginContext passes its
plugin id). Only another plugin claiming a held name is refused, naming the
holder. One plugin's overlapping registrations stack as before: the later
live one's value wins, and disposing either leaves the other's value.
Registrations are keyed by a token again, as before.
2026-11-06 20:22:31 -05:00
unsupportedpastels
26e16e3834 fix(plugins): one plugin per session env name, and names stay in their own profile
ctx.register_session_env merged every registration with out.update, so two
plugins of one profile declaring the same name were a silent last-wins by load
order. The later registration is now refused with the usual conflict error
("session env 'PANE' is already registered by 'holder'"). Unload frees the
name; the same plugin reloading declares it again. The check lives in
hermes_cli/plugins_session_env.py: the holder is read from the scope's plugin
manager ownership ledger, so PluginContext is unchanged.

Declared names were also one process-wide set, so on a multiplexed gateway a
plugin of profile A stopped profile B's own `export NAME=...` from carrying to
B's next command. The names are now kept per profile scope; a scope's names
still stay excluded after its plugin unloads, as before.
2026-11-06 20:22:31 -05:00
unsupportedpastels
eef9a3e52c fix(plugins): a task left from an unloaded plugin load cannot publish after a reload
Under plugins.isolation: host, discover_and_load(force=True) (reload-plugins,
and every plugin install, enable or update) loads a plugin again into the same
host process under the same plugin_key. A task the first load spawned kept
running, and its emit_plugin_session_event was taken for the new load and
published to the session's viewers.

- Hermes numbers each load of a plugin in the host (load), sends it with the
  load request, and forgets it at unload.
- The host binds that load, with the plugin, to each request it serves, so it
  follows the request's code onto the tasks it spawns; session_event carries it.
- The gateway process publishes only when that load is the plugin's current
  one; otherwise it logs and returns False, as the hosted call did before this
  PR forwarded it. A category plugin's fresh instance keeps its key's load.
- ctx.emit_to_session reads the manager's home_path directly: every manager
  sets it, as the other readers of the plugin's own profile assume.
  Suggested by @BearHuddleston in review.
- The late-event test now covers a same-host reload and waits with
  tests.waiting.wait_until and Events instead of sleep loops.

ctx.emit_to_session from such a task is unchanged (it reached viewers on
main too).

Refs #142005, #141982
2026-11-06 20:22:20 -05:00
unsupportedpastels
5f8968bd76 fix(plugins): a hosted session event goes out only as the live plugin sending it
Under plugins.isolation: host, the forwarded emit_plugin_session_event took
the plugin_id the caller passed: a hosted plugin could publish as another
plugin id, and a task it left running kept publishing after it unloaded.

- The host process records which plugin's code each request it serves runs
  (the plugin_key of a load/unload, the owner of an invoked reference) and
  sends that with session_event.
- The gateway process looks that plugin up among the loaded ones and
  publishes only when plugin_id is its own; otherwise it logs and returns
  False, as the hosted call did before it was forwarded.
- In-process, emit_plugin_session_event still takes plugin_id as given.
- Contract and guide wording: without plugin-rpc-v1, clients must not
  assume plugin RPC is supported.

Refs #142005, #141982
2026-11-06 20:22:20 -05:00
unsupportedpastels
be3d288fa0 fix(gateway): plugin RPC is a detectable contract member and session events work hosted
A client could not tell "no such plugin method" from "this server has no
plugin RPC": runtime.describe advertised nothing, and plugin.* was in no
contract or ledger. Under plugins.isolation: host the module-level
emit_plugin_session_event returned False and sent nothing, and an
in-process ctx.emit_to_session from a plugin's own thread on a multiplexed
gateway looked the session up in the launch profile.

- runtime.describe lists plugin-rpc-v1.
- tui_gateway/contracts gains CANONICAL_NAMESPACES (canonical_namespace):
  plugin.{plugin_id}.{name} with open params, rendered as
  CanonicalRpcNamespaces in the TS contract and x-canonical-namespaces in
  OpenRPC; the serve handler ledger gets one row for it.
- The plugin host forwards emit_plugin_session_event to the gateway process
  (host->parent request session_event), looked up in the host's profile.
- ctx.emit_to_session binds the plugin manager's home before the lookup.

Refs #142005, #141982
2026-11-06 20:22:20 -05:00
Siddharth Balyan
450ece86c4 feat(plugins): ctx.register_session_env gives each session's commands its own environment values
Tools run in the shared gateway, so a variable of the terminal or pane that
shows a conversation (a pane id, its socket) never reaches the commands the
agent runs for it. A plugin could only rewrite each `terminal` command with
`tool_request` middleware to prefix an `export`, which changes the command
text and does not cover every spawn.

`ctx.register_session_env(names, resolver)` declares the names and a
`resolver(session_id) -> {name: str | None}`. The child-env bridge
(`tools/environments/local.py::_inject_session_context_env`) calls the active
profile's resolvers with the child's own HERMES_SESSION_ID each time it builds
a local child env: terminal foreground and background, `execute_code`'s
`terminal()`, and the other children that already get HERMES_SESSION_*.
`None` unsets a name; an omitted name keeps the gateway's value.

- Names must be valid env names outside HERMES_*, so core session vars stay
  core's. Values pass the same internal-secret and provider-blocklist
  predicates as the scrub, so a plugin cannot put a credential back.
- LocalEnvironment keeps the declared names out of the shared bash snapshot
  (the existing save/restore + dump exclusion for passthrough names). Without
  that, the snapshot sourced before each command replaces the fresh value with
  a stale one when a session's pane changes or goes away.
- A resolver that raises is logged with its traceback and contributes nothing.
- Registrations are scoped to the plugin manager's profile and released on
  unload through the registration ledger.
- Remote backends (Docker, SSH, Modal) are out of scope: they do not receive
  session context vars today either.

The new registrar lives in the hermes_cli/plugins_session_env.py sibling; the
facade method is a delegate, offset by a duplicated docstring paragraph in
_delivery_manager so plugins.py does not grow.
2026-11-06 11:17:45 -05:00
Siddharth Balyan
78d938f0ca fix(plugins): an async plugin RPC handler runs in the worker, not on the loop
asyncio.to_thread only created the coroutine of an async def handler; the
await that followed ran its body on the gateway loop, so blocking work in it
stalled requests and event delivery for every client. The worker now resolves
the result with resolve_plugin_command_result, the rule plugin slash commands
already use: an async handler runs on its own loop in that worker thread.
2026-11-06 10:43:39 -05:00
Siddharth Balyan
aa39347712 feat(plugins): plugin JSON-RPC methods and session-scoped plugin events
A plugin frontend that is a JSON-RPC client of the gateway could not call
its own Python half, and the Python half could not reach the viewers of one
session. Plugins passed data through shared files and tool.complete payloads.

ctx.register_rpc(name, handler) serves plugin.<plugin_id>.<name> on the
session authority, after the core handler table, with the gate of a plugin
slash command: session:control, plus the session authorization when the call
names a session_id. The handler runs off the loop in the owning profile scope;
a failure answers 4001 plugin_rpc_failed. The ownership ledger removes the
methods on unload and force rediscovery.

ctx.emit_to_session(session_id, event, payload) (and
plugin_events.emit_plugin_session_event) publishes plugin.<plugin_id>.<event>
on that live session event stream only. The session is found by its
conversation id or its resident agent current id, so an id from after
compression still reaches the viewers.

Salvages the idea of #66874 as a smaller redo on the canonical gateway.

Co-authored-by: eiritsu <yoeiritsu@gmail.com>
2026-11-06 10:43:39 -05:00
Siddharth Balyan
660eb55fc8 feat(plugins): pass a compression-stable conversation_id to plugin tools and tool hooks
Plugin tool handlers, pre_tool_call / post_tool_call / transform_tool_result
hooks, tool middleware and system-prompt sections receive conversation_id
next to session_id. It is the compression-lineage root of the session (the
walk prompt_cache_scope already uses), so a rotating compression keeps it
while /new and /branch start a new one. A delegated subagent and a
background-review fork report their parent's conversation, stamped at spawn.
Memoized per physical session id: one lineage walk per segment, none per
tool call.

Plugins that keyed per-conversation state had to call the internal
SessionDB.get_compression_lineage (and walk _delegate_from markers) to
find the conversation.
2026-11-06 10:41:13 -05:00
unsupportedpastels
bce3109469 docs(plugins): get_session_env falls back to the environment when unbound
The plugin guide example said get_session_env returns "" outside a session. When the
session ContextVar was never bound it reads os.environ first and only then returns the
default, so the comment now says that.
2026-11-05 18:29:36 -05:00
unsupportedpastels
d982caf654 fix(plugins): show the get_session_env import that validate accepts
The plugin guide told authors to read session identity with
`gateway.session_context.get_session_env(...)`, written as a dotted module
call with no import line. `hermes plugins validate` treats only
`from gateway.session_context import get_session_env` as public, so an author
who wrote `import gateway.session_context` to match that spelling got a
private-import warning.

The developer guide and the user guide now name that import, and the
slash-command example uses it to read the platform and the chat id. A test
validates the guide's `get_session_env` example as a plugin and expects no
private-import warning.
2026-11-05 18:29:36 -05:00
Teknium
9ed1a7371b docs(hooks): what a pre_llm_call block stores, and that only a returned block blocks
The block sections now say the prompt is stored as the withheld placeholder
(later turns, compaction, session_search, memory providers and review read
only that; transcripts still show what was typed), that the hook runs before
turn-start compaction, and that a callback which raises or times out is
skipped, so the turn goes ahead. observer-hooks.md lists the block return.
2026-10-31 22:59:20 -07:00
Teknium
ad9229c843 feat(hooks): pre_llm_call can block a turn before any inference request
A pre_llm_call callback (Python plugin or shell hook) may now return
{"action": "block", "message": "..."} to veto the turn: no model call is made,
the message is the reply the user sees and the transcript keeps a normal
user -> assistant pair, and the result carries
turn_exit_reason=blocked_by_plugin_pre_llm_call. This is the supported seam for
DLP / privacy / policy plugins that previously had to patch core (#57364).

The vetoed prompt also stays on the host for that turn: no session titling call,
no external-memory prefetch or sync, no background memory review. Its user row
gets an api_content placeholder for the main-loop replay. That alone does not
keep the prompt out of later turns (compaction, session_search and memory
providers read the row's content); the next commit stores the placeholder as
the content.

First valid block wins; a Python block without a message is ignored (same as
pre_tool_call). Shell hooks accept both the Hermes {"action": "block"} and the
{"decision": "block", "reason": ...} shapes, mirroring pre_tool_call.
2026-10-31 22:59:20 -07:00
Teknium
e1be6fcfe0 fix(config): config_keys come from the loader's discovery, count only for active plugins, never widen a section
Review findings on the config_keys seam:

- Discovery: drop the glob scan. config_keys is parsed onto PluginManifest
  (plugin.yaml, and extensions.com.nousresearch.hermes in a portable
  plugin.json) and read from the loader's own collect_directory_manifests +
  entry points + resolve_manifest_winners, so skip rules, precedence and the
  project-plugin gate are the loader's.
- Only active plugins count: gate_manifest must load the plugin (disabled wins,
  plugins.enabled opt-in, requires_hermes); memory providers count when
  memory.provider selects them.
- Bounded: a declared path is at least two segments deep and is ignored when
  DEFAULT_CONFIG already defines it; runtime keys are consulted only after the
  schema walk refused a key, so a plugin declaring [agent] no longer hides
  agent.max_turnz.
- No lru_cache: a plugin installed or enabled in a long-running process counts
  on the next config get/set (the lookup runs only for refused keys).
- computer_use.backend (read by the plugins/computer_use selector) and
  dashboard.kanban move to a core table with their readers; the selection
  sections derive from read_selection's own _SELECTION_NAME_KEYS.
- Tests use fixture plugins (enabled/disabled, hostile [agent], selected memory
  provider, portable plugin.json, project opt-in).
2026-10-28 13:09:00 -07:00
Teknium
e402afa783 fix(config): recognize runtime-read selection and plugin-declared keys in config get/set
`hermes config get browser.cloud_provider` / `browser.use_gateway` warned "not a recognized
config key" although the runtime selects the browser provider from them. The validator only
walks DEFAULT_CONFIG, and provider selections stay unseeded on purpose (a stored key is the
explicit pick), as do core-section keys plugins read.

- tools.tool_backend_helpers.selection_config_keys(): the keys read_selection() honours
  (<category>.use_gateway, browser.cloud_provider, stt/tts/image_gen/video_gen provider keys,
  web.backend/search_backend/extract_backend).
- plugin.yaml / dashboard manifest.json `config_keys`: a plugin names the core-section paths it
  reads; declared for retaindb, byterover, computer_use/cua, kanban dashboard.
- hermes_cli/config_runtime_keys.py consults both before the DEFAULT_CONFIG walk.

Found on Hermes Cloud staging.
2026-10-28 13:09:00 -07:00
Teknium
2cd20e5a5e docs: hold_stream fails closed, keeps its hooks through a reload, hides commentary in history 2026-10-25 06:18:48 -07:00
Teknium
905e54d248 docs: hold_stream for transform_llm_output (hooks reference + plugin guide) 2026-10-25 06:18:48 -07:00
Cleo
a8db83446f feat(plugins): ctx.side_question asks the session's own agent after a turn
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
2026-10-24 19:56:21 -07:00
Teknium
e3f1dced6b docs: plugin workspaces solve only for the installing platform 2026-10-24 19:27:03 -07:00
Teknium
7ae117eb4c fix(plugins): name portable plugin skills after the plugin, not a hashed namespace
A portable plugin's skills registered as agent-plugin-<slug>-<sha8>:<skill>
(agent-plugin-blender-5a80e4ba:blender) because one manifest field named both
its plugin-data directory and its skill namespace. The hash only matters on
disk. Skills now take the plugin's own name (blender:blender), the form every
native plugin skill uses; a clash with an already-registered qualified name is
skipped with a warning naming the owner, as before. The data directory keeps
its hashed name, so no plugin data moves, and skill_view still resolves names
saved in the old form.
2026-10-24 04:01:10 -07:00
Teknium
3ee9fcfbb5 docs(mcp): what the trust-gate and one-shot consent prompts offer 2026-10-23 16:16:43 -07:00
Teknium
7489b22af4 docs(plugins): portable packages lack requires_hermes, not a version field
plugin.json accepts `version`; what it has no field for is a Hermes floor. Review feedback on the portable-package wording.
2026-10-23 02:22:46 -07:00
Teknium
0255dedd1a feat(plugins): enforce the catalog's requires_hermes at install and update
The catalog entry's requires_hermes was display-only: `hermes plugins
install <name>` cloned and published a pin the catalog says needs a newer
Hermes, and `hermes plugins update` re-pinned an installed plugin onto it.
Only the plugin's own plugin.yaml floor was checked, and only at load.

- install_catalog_entry (the one seam every install by catalog name goes
  through: CLI, dashboard/Desktop/TUI plugins.manage, `hermes setup`'s
  importer step, the left-core and memory-provider auto-installs) refuses
  with "<plugin> needs Hermes <spec>; this is <version>. Update Hermes
  (`hermes update`) and install again." before any clone. The connector
  card's pre-check uses the same function.
- repin_catalog_plugin (every catalog update) keeps the installed pin and
  says the update is available after updating Hermes; `hermes plugins
  update` with no name lists such a plugin as held instead of applying it,
  and check-updates marks it.
- `hermes plugins search` / `info` still list incompatible entries,
  marked as needing a newer Hermes.

Portable packages (plugin.json) have no version field, so the catalog
entry's requires_hermes is their only floor; the gate is kind-agnostic and
covers them (tested), and the agent_plugins comment and docs say so.

The verdict is plugins_manifest.requires_hermes_error itself (same
running_hermes_version + version_satisfies), so a dev checkout, canary
build or tagless checkout is judged exactly as the plugin.yaml gate judges
it. No override flag.
2026-10-23 02:22:46 -07:00
Teknium
0b69853adf docs(browser): browser_exec is the only browser path; Camofox is a plugin
Rewrite the browser feature page, configuration, tools/toolsets/env-var/pm
references, docker, windows, bot-screen, termux/installation and the secondary
developer-guide/integration/feature pages (EN + zh-Hans): drop agent-browser,
the built-in browser_* tools, browser.backend and /browser use; document
browser.executable_path / browser.user_data_dir / browser.chromium_args and the
AGENT_BROWSER_* migration; point Camofox users to 'hermes plugins install camofox'.
2026-10-23 01:41:25 -07:00
Teknium
49520132f4 feat(plugins): plugin slash commands can ask the user to pick an option
PluginContext.ask_choice(question, choices) -> str | None lets a sync
slash-command handler ask the user who ran it to pick one option and get
the picked value back. Choices are strings or {value, label, description}.
Each surface binds an asker around the handler call
(hermes_cli/plugin_choices.py), and every asker is that surface's
existing clarify prompt. No surface gets a new card type or wire shape:

- messaging chats (gateway/plugin_command_choice.py): adapter.send_clarify
  plus the clarify tool's own delivery (_clarify_send_then_wait, text
  fallback, card retire). Telegram/Discord/Slack show buttons, other
  platforms a numbered list. The typed reply reaches the clarify
  text-intercept while the command still holds the chat.
- local sessions on the gateway (classic CLI, Ink TUI, Desktop): the
  `clarify` server request to the session's viewers. Two fixes make the
  answer arrive while slash.exec is still waiting for the handler:
  * tui_gateway/ws.py: a viewer's answer to an open server request (a
    response frame, `clarify.lock`) is settled at once instead of queuing
    behind that socket's running slash.exec.
  * hermes_cli/gateway_plugin_commands.py: the classic CLI answers the
    session's `clarify` requests with its clarify panel while it waits for
    slash.exec. No turn pump reads the session's frames between turns.
- in-process classic CLI and the legacy `hermes serve` backend: their
  clarify panel / `clarify` server request.

Returns None when nothing can ask (hooks, cron, async handlers on the
event loop), when the user cancels or answers with something that is not a
choice, or when the clarify timeout passes. The handler then prints its
text usage.
2026-10-22 14:37:10 -07:00
Teknium
919322f6c3 feat(delegation): pluggable delegation providers
delegate_task asks the active delegation provider (delegation.backend, a new
provider category registered with ctx.register_delegation_provider) for each
task's route: model/provider/endpoint/reasoning resolved by the existing
delegation credential resolver, or a Hermes profile the child runs as. A
provider may add enum-checked per-task schema parameters built once with the
tool definitions. Core keeps the whole lifecycle.

- agent/delegation_provider.py + agent/delegation_registry.py: ABC + registry;
  the built-in 'default' strategy is today's behaviour and the fallback for an
  unregistered/unavailable backend.
- tools/delegate_tool_routes.py: per-task routes, parameter validation, and the
  profile scope binding (home override + secret scope + multiplex semantics +
  terminal policy) around a profile child's construction and conversation.
- Host isolation: HOST_OBJECT_BASES row, so providers run under
  plugins.isolation: host.
- delegation.backend in DEFAULT_CONFIG; registrar table moved to
  hermes_cli/plugins_registrars.py to keep plugins.py under its cap.
- Default config: delegate_task schema and every hermes-cli tool definition
  are byte-identical to main.
2026-10-22 14:37:10 -07:00
Teknium
6661080238 fix(pm): a plugin whose pyproject installs nothing no longer rebuilds the dependency environment
Enabling or updating a plugin whose pyproject.toml declares `dependencies = []` (the official
agent-importers plugin) ran "Resolving / Installing Python dependencies" and built a new
environment generation although nothing gets installed, and every update of the plugin did it
again.

Workspace membership keyed on "has a pyproject", so such a plugin became a uv workspace member,
and members_stamp hashes a member's whole tree into the venv stamp: enabling it, or any change to
its files, made the recorded environment stale. A plugin is now a member only when it installs
packages (`PythonDeclaration.installs_packages`, the predicate dependency consent already uses
since the sibling fix for the empty consent step), so membership, requires-python checks and the
stamp all follow what the plugin actually puts in the environment.

Test fixtures that used a dep-less pyproject as a cheap stand-in for a member now declare a real
dependency (a local wheel through tool.uv.sources, resolvable offline, or a requirement where no
resolution runs); their assertions are unchanged. New: enabling a `dependencies = []` plugin
through the real admission path keeps the selected generation and recorded stamp, a later change
to its files keeps the venv current, and a plugin with a real dependency still joins.
2026-10-22 11:12:32 -07:00
Teknium
ce18aafe01 fix(mcp): spend totals survive session rotation; each cron run has its own; review fixes
Independent review of #142470:
- Compression (CLI, TUI/Desktop) and /branch continue a chat under a new session id, which reset its
  spend total: a chat at its limit got a fresh budget. The continuation hook every rotation site already
  calls (transfer_session_yolo) now moves the total too.
- Every cron job in a process shared one tally (their approval session key is ""), so one job's spend
  refused the next and stayed spent until restart. The cron run scope binds its own run id.
- tool_costs keys the server does not offer (a typo, or Hermes' mcp_<server>_ prefix) are named in a
  warning at registration instead of silently carrying no budget.
- Untrusted over-limit prompts lead with the limit notice (the gateway text fallback keeps ~200 chars);
  "1 credit", not "1 credits"; the multiplex rekey moves the prompt slots with the totals.
- Tests: rotation + per-run cron tally + unknown-key warning (red on the previous head), and parallel
  over-limit prompts asked one at a time (red with the prompt slot made a no-op).
- Docs: where a total survives and resets, the counted-on-start wording, the same-name override note.
2026-10-21 04:12:11 -07:00
Teknium
2fe303419f docs(mcp): tool costs and per-chat spend limits for MCP servers and portable packages
Also keeps a package's declared costs on a same-name native override and logs
which keys were carried.
2026-10-21 04:12:11 -07:00
Teknium
2d35f6184b feat(plugins): portable plugins get the Settings > Plugins form, live
A portable Agent Plugins v1 package (plugin.json) had no way into Settings >
Plugins: the schema reader only looked at plugin.yaml, and v1 rejects unknown
top-level fields. It now reads extensions.com.nousresearch.hermes.config_schema
(the vendor namespace that already carries server trust and timeouts) for the
form, the save, the loader's schema warnings and catalog admission.

Two gaps any plugin with settings hit once the form existed:

- The plugin's Desktop half had no way to learn a save happened. Every
  plugins.manage settings save now broadcasts plugin.<id>.settings.changed
  ({written}); a secret-only save still makes the (empty) settings call so the
  event fires for a new API key too.
- A secret the form stored never reached the plugin's running MCP server (its
  env ${VAR} was rendered at spawn). After a save, Hermes reconnects the plugin's
  servers whose resolved launch inputs changed (identity digest, rendered the way
  the connect path renders it); a toggle-only save leaves them alone.
2026-10-19 07:27:50 -07:00