Commit Graph

154 Commits

Author SHA1 Message Date
Maciej Lisiewski
7d94f141b7 fix(a2a): put push callbacks behind the shared SSRF guard
is_safe_callback_url compared the host text against private prefixes, so
integer/hex IPv4 literals (http://2852039166/) and DNS names resolving to
metadata or RFC1918 passed; urlopen then followed redirects the check never
saw and re-resolved the name for the socket.

Non-loopback callbacks now go through tools.url_safety: is_safe_url for the
pre-flight (resolves and checks every answer) and create_ssrf_safe_client for
the POST (connect-time re-validation, dials the vetted IP). Redirects are not
followed. Loopback stays allowed only in localhost-only mode, proxy-free.
create_ssrf_safe_client joins the published plugin API next to its async twin.

Fixes #126755
2026-11-13 16:56:09 +01: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
d92c31ae65 feat(catalog): weekly check delists entries whose repo or pin is gone
A catalog entry whose repository was deleted, or whose pinned commit was
force-pushed away, can't be installed any more: `hermes plugins install` clones
the repo and checks out the pin, and both fail. Nothing noticed until a user
hit it.

scripts/ci/catalog_dead_repos.py looks up every entry (GitHub in GraphQL batches
of 50, with REST confirming each miss so a renamed or transferred repo is never
taken for deleted; other hosts via git ls-remote). Any unclear answer, or more
than 25 dead at once, aborts with nothing delisted, because that shape is an
outage, not a week of deletions. The weekly workflow deletes the dead entry
files on bot/catalog-dead-repos and opens one PR for review; nothing
auto-merges. It delists (deletes the file) and never touches removed.yaml,
which is the security blocklist.

First run, on today's catalog: 8 of 2,087 entries are dead (7 deleted repos,
1 force-pushed pin). Their files are deleted in a separate commit.
2026-11-12 02:21:17 -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
Teknium
c94ac05b54 docs(plugin-catalog): admission rule 19, no plugins built to reach infringing content
A plugin whose main purpose is streaming or downloading copyrighted
material from unlicensed sources could pass review on clean code alone;
no rule covered what a plugin is for. Rule 19 declines those while
keeping general-purpose browsers, downloaders and players welcome.
Mirrored into the catalog-submission guide (rules mirror test).
2026-11-11 18:49:49 -08:00
Teknium
bf77c21427 fix(gateway): picker cards and the /update prompt answer only to their opener
A picker card (/model, /reasoning, /fast, the usage-limit switch offer)
and the /update Yes/No prompt only checked the chat allowlist on a tap,
and a pending /update prompt took the next message ANY admitted member
sent in the session as its answer. In a shared group with
group_allow_admin_from set, a member refused /reasoning or /model could
tap the admin's open card and apply it, and anyone's chat text answered
the admin's "Restore local changes now?".

The gateway now records the opener (sender id, name, chat scope) when it
sends the card (prompt_authority on the selection callback) and in the
/update pending marker. Every renderer refuses another member's tap with
the existing localized "Only <name> can answer this approval." note and
leaves the card open: Telegram mp:/cp:/update_prompt:, Discord
ModelPickerView/ChoicePickerView/UpdatePromptView (one _gate), Slack
model picker (ephemeral), Matrix picker reactions, Feishu choice picker
and update card (toast). A non-opener's typed text during a pending
/update prompt falls through as an ordinary message. The check is
gateway.approval_actor.may_answer, the same rule exec approvals use:
the opener and the chat scope's admins always pass; a sender-less card
(shared observed route) keeps the old anyone-admitted behaviour.

QQBot's update button already accepts only the session's own user.
picker_refusal / update_prompt_refusal join approval_refusal in the
published plugin API so platform plugins can apply the same check.
2026-11-10 14:06:57 -08:00
unsupportedpastels
f0557ff9a6 feat: expose conversation-scoped platform model picker catalogs
Keep raw endpoint matching and config inputs inside core; return detached presentation rows. Share profile-scoped resolution with the display accessor and persisted-pick fallback. Custom endpoint live probes are disabled to avoid config writes.
2026-11-10 09:16:04 -05:00
unsupportedpastels
e0f3723ada feat(platforms): expose read-only session model settings
Add a detached display snapshot for Inline's native conversation settings sheet without exposing credentials or allocating sessions. Keep the legacy override view unchanged.

Verification: canonical focused runner, 4 workers, 51 passed; unchanged base plus new tests: 35 passed, 16 failed for the missing accessor. scripts/check: 15 checks ok; boundary lint: exit 0. Pre-commit hook unavailable (just not installed); equivalent lint gates run directly.
2026-11-10 09:16:04 -05:00
unsupportedpastels
a2eb175f62 feat(plugins): publish the browser-vault seams LoginBackend, VaultItemMeta and BrowserPageBackend on the plugin API
browser-vault-plugin.md tells plugin authors to subclass LoginBackend, return VaultItemMeta and
subclass BrowserPageBackend, and ctx.register_login_backend / register_browser_page_backend accept
only instances of those classes, yet hermes plugins validate warned on all three imports. List them
name-only in plugin_api.json, regenerate public-api.md and drop their docs import seam entries.
LocalEnvironment stays a seam: it is the host implementation class, not a stable base.
2026-11-09 22:18:11 -05: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
d1aed60ec1 fix(gateway): slash confirms and clarify questions answer only to their requester
#152125 bound shared-chat exec approvals to the requester (or
approvals.approvers / the platform admins), but the other prompts a chat
member can answer for someone else stayed open: another member could press
"Always" on a relay or native /reload-mcp confirmation and run its handler,
or answer the agent's clarify question (a choice button, "Other", or a typed
reply) for the person who asked.

Both prompts now record the same authority an exec approval records when
raised (tools.approval_context.prompt_authority: the turn's actor, else the
command's sender, plus approvals.approvers and the chat type), and every
chat answer path checks it through gateway.approval_actor.may_answer:

- relay prompt_response (gateway/relay/prompt_resolvers.prompt_refusal),
  with the bot-owning profile's admins as for exec approvals;
- Telegram, Discord, Slack, WhatsApp Cloud and Feishu button callbacks
  (slash_confirm_refusal / clarify_refusal, published on the plugin API
  beside approval_refusal);
- the runner's typed-reply intercepts (/always, "2", free text after
  "Other"); another member's text is routed as their own message.

A refused tap gets the existing "Only <name> can answer this approval."
and the prompt stays pending. A turn merged from two senders records no
requester, so only approvers and admins can answer, as for approvals.
The default approvers ["*"] keeps today's behaviour.

Supersedes the slash_confirm/clarify half of #72008, whose session-owner
mechanism no longer applies on main (main records the requester itself).

Co-authored-by: necoweb3 <65560494+necoweb3@users.noreply.github.com>
2026-11-09 17:07:28 -08: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
466591fe65 fix(gateway): opt-in approvals.approvers binds shared-chat exec approvals to the requester on every platform
Some checks failed
Live provider canaries / Live provider canaries (push) Has been cancelled
Carries #144799 rebased onto #151023's request-bound approval cards (one
squashed commit, because #151023 rewrote the same resolver, card and
adapter paths that #144799's eight commits patched one by one).

With `approvals.approvers: []`, an approval raised by one person's message
can only be answered by that person, a listed approver or a platform admin;
anyone else who taps Allow/Deny, reacts or sends /approve gets a private
"Only <name> can answer this approval." and the command stays pending. The
default stays `["*"]` (any admitted member answers), unchanged from main.

How it sits on #151023:
- tools/approval.py::resolve_gateway_approval_card takes #144799's
  signature (actor_id, admin_ids, extra) with #151023's body: a tap with no
  request id resolves nothing, and a Deny-only card can only deny.
- _ApprovalEntry carries both `authority` (#144799) and `card_deny_only`
  (#151023).
- Discord, Matrix and Telegram card handlers check the requester first,
  then settle through the request-bound resolver; the Telegram refusal
  toast goes through #151004's expired-query-safe answer_callback.
- #144799's tests that seeded id-less cards and expected the oldest
  request to settle now seed the real request id.
- Relayed approval answers check the bot-owning profile's admins;
  identical approvals coalesce only under the same answerers.

Fixes #80281
2026-11-08 22:46:20 -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
d0b49116ec feat(gateway): a client can name itself on session.create
A third-party client can now say who it is: session.create takes an optional
client {name, version?}. It is attribution only. source still picks the
policy, and no toolset, approval, permission, prompt text or telemetry reads
the label.

- Validated beside the editor check (bounded, safe charset); a malformed value
  is invalid_params on field client.
- Kept inside the frozen creation request, so there is no new column, receipt
  key or policy field: an older owner restores the session, and the label is
  part of the exact-retry identity.
- session.info.client echoes it (absent when none was sent); runtime.describe
  lists client in session_create.parameters and capability session-client-v1.
- Plugins read it with hermes_cli.plugin_session.session_client() (published
  in plugin_api.json) and the client / client_version keys of prompt-section
  session info ("" when none). No PluginContext method, no hook kwarg.
- The classic CLI's /new copies the frozen launch request but never the
  creating client's label: the new session belongs to the terminal.
- Contracts regenerated; docs say the label is self-declared and must never
  grant anything.
2026-11-06 20:48:57 -05:00
alt-glitch
79109635df feat(plugins): redact_sensitive_text is public plugin API
A plugin that sends user text to a model (ctx.llm) needs to mask the
secrets in it first. agent.redact.redact_sensitive_text does that, but
it was a private import, so `hermes plugins validate` warned on it.

List it in hermes_cli/data/plugin_api.json and regenerate the public
API page. A plugin can redact any text with it, which a `redact=` param
on ctx.llm would not give, and it adds no new parameter semantics.
plugin-llm-access.md documents when to pass force=True.
2026-11-06 20:38:46 -05: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
unsupportedpastels
26f1f47fca refactor(plugins): name the PluginContext module plugins_context.py
Rename hermes_cli/plugin_context.py to hermes_cli/plugins_context.py (and its
test to tests/hermes_cli/test_plugins_context.py) so it sits in the
plugins_<topic>.py sibling family that the facade grep convention covers.
Regenerate the plugin_api.json source label and public-api.md.

Stop re-exporting _ignore_after_abandoned_load from hermes_cli.plugins:
nothing reads it through the facade, and internal moves do not get shims.
2026-11-06 12:44:35 -05:00
unsupportedpastels
1f96e0fb03 refactor(plugins): move PluginContext into hermes_cli/plugin_context.py
hermes_cli/plugins.py was 2,163 lines, about 800 of them the PluginContext
class. The class, its setattr-built provider registrars and the
abandoned-load guard loop now live in hermes_cli/plugin_context.py;
plugins.py drops to 1,345 lines.

hermes_cli.plugins keeps re-exporting PluginContext, _UNSET and
_ignore_after_abandoned_load, and every name it imported before is still
imported there. Functions and classes the ctx methods call
(load_config_readonly, _plugin_settings_entry, get_hermes_home, PluginState,
PluginToolOverrideError, ...) are read from hermes_cli.plugins at call time,
so a monkeypatch on the facade still reaches ctx methods. Log records keep
the hermes_cli.plugins logger name, and typing.get_type_hints on
PluginContext.__init__ still resolves PluginManager.

The public plugin API list names the new file as PluginContext's source.
2026-11-06 12:44:35 -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
0502fe0597 feat(plugins): one published list of what plugins may import
The public list `hermes plugins validate` checks plugin imports against
was a hardcoded frozenset inside hermes_cli/plugin_validate_private_imports.py,
with no page that showed it to plugin authors.

Move the list, unchanged (89 entries), into hermes_cli/data/plugin_api.json
(already shipped as package data via `data/*.json`) and load it once in the
validator. scripts/gen_plugin_api_docs.py renders
website/docs/developer-guide/plugins/public-api.md from the same file, and a
test fails when the page is stale. Validate output is unchanged for the same
inputs.
2026-11-05 18:47:10 -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
0040f02b5c fix(plugins): clear catalog sweep 1028 scanner false positives and close three validator gaps
Install scanner (tools/plugin_guard*, PLUGIN_SCANNER_VERSION bumped once):
- hardcoded_secret: a PostHog project key (phc_, write-only ingest key) joins the
  Google installed-app secret as a public client key -> high (caution), only
  when every matched literal on the line has a public prefix (telesec
  telemetry.py:27 was dangerous). phx_ personal keys and any other token stay
  critical.
- proc_access: reads of /proc/self|<pid>/{cgroup,mountinfo,stat,status,...}
  (container placement, pid start time) land at low instead of high
  (hermes-lcm-x cpu_capacity.py was caution). environ, cmdline, mem, maps, fd,
  root/cwd, ns, bare /proc/self, any unlisted leaf and any write keep high.
  Generalises #144304's cgroup/mountinfo allowance and keeps the finding
  visible instead of dropping it.
- bytecode_file: a committed .pyc/.pyo (git ls-files; plus any bytecode outside
  __pycache__) is a high structural finding, the binary_file tier (rule 17;
  hermes-emotion shipped tests/__pycache__/*.pyc and scanned safe). Untracked
  caches the validate run writes are not flagged.

Validator (hermes plugins validate, warnings only):
- private imports: gateway.session_context.get_session_env is the documented
  route (plugins/index.md) and a plugin's fallback import of its own install
  path (plugins.memory.openltm._db) is not a core import.
- new warning for private-method calls on core handles (SessionDB, AIAgent,
  GatewayRunner, PluginContext) the plugin does not define itself
  (opencode-sync db._execute_write, runner._evict_cached_agent).
- desktop surface review warning for raw window.hermesDesktop calls and app
  markup selectors ([data-slot], [data-tree-*], [data-pane-host]) in CSS text
  or closest() (squad-hub, novel-reader, search-sources).
2026-10-28 23:07:47 -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
Teknium
69fb5c10ed docs(plugin-catalog): password-manager plugins are listed only from their vendor
Admission rule 18 (README and the mirrored developer-guide copy): a plugin that registers a
browser_vault login backend is listed only at tier verified, from the password-manager
vendor's own repository, or at tier official when Nous maintains it, and states that Hermes
enforces the same rule at load. browser-vault-plugin.md gains "Who can register a backend".
2026-10-25 05:32:43 -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