Main's hermes_state imports WriterMutexTimeout, maintain_after_commit, write_site and writer_mutex_until from hermes_state_write and note_read_pool_exhausted from hermes_state_readpool, so all five are importable from hermes_state; F39 at the swap level restores them there.
The removal replaced hermes_state.py with a stand-in that forwards only its listed names, so the five raised AttributeError again from this level up.
The stand-in now lists the five and forwards each to its home at this level (persistence/sqlite/_state/write.py and persistence/sqlite/_state/readpool.py), with a warning that names no public replacement. The plugin API list, its generated page and the plugin guide's table carry them, since the stand-in's names and the published list are pinned equal. A new case imports each from hermes_state and checks it is its home's object.
Proof: tests/test_hermes_state_standin.py new case red before (AttributeError: module 'hermes_state' has no attribute 'WriterMutexTimeout'), green after; the plugin API list, docs-imports, published-API and backend-import-guard tests pass (12, 6, 173, 30). The one stand-in case still red is the callers-level append_batch keyword (see F20). Import-only check passes; scripts/ci/check_backend_imports.py clean; ruff clean.
Reported-by: unsupportedpastels
The official mcp-serve plugin gets its transcript handle from hermes_state_registry.acquire() and builds its routing index from SessionDB.list_gateway_sessions; with neither carried, its message reads answer "Session database unavailable", its event polling stops and the index comes back empty. hermes_state_registry.py returns as a stand-in: acquire(db_path=None) opens a hermes_state SessionDB of its own for the caller, release(db) closes it and returns True as main's did for a lent handle, and release_or_close(db) closes it. The first acquire in a process emits the stand-in's one deprecation warning in its own words, naming persistence_assembly.open_persistence and the removal release, at the plugin's call; a process that has already had the hermes_state warning gets no second one.
The stand-in's SessionDB carries list_gateway_sessions(*, platform=None, active_only=True), main's keyword-only signature, held open for the call like its other methods, and returns each session row with its last_active as main did. Both are listed in the plugin guide's replacement table and in hermes_cli/data/plugin_api.json, public-api.md is regenerated, and the test that fires at the removal release names hermes_state_registry.py among the files to remove.
The hermes_state stand-in now also forwards the nine public helpers main exported that live on in shared modules outside the backend: format_session_db_unavailable and get_last_init_error (storage_user_copy), resolved_max_resume_messages and resolved_max_export_messages (storage_limits), preflight_db_writability and read_only_db_uri (sqlite_support), holder_pid_checkable (process_identity), make_user_dir (hermes_dir_acl), and divert_session_transcript_jsonl, which supplies the profile's sessions folder under HERMES_HOME as main's did. Each one warns through the stand-in's once-per-process deprecation warning, naming its replacement.
hermes_cli/data/plugin_api.json lists hermes_state name by name instead of as a whole module, and lists the nine replacements, so hermes plugins validate reports an import of any name the stand-in does not carry (the old class's mixins and the SQLite backend's own helpers) instead of passing a plugin that fails on import. The plugin guide's replacement table names the nine and their replacements, and public-api.md is regenerated from the data file.
Documentation, the desktop app, skills and native code follow the interface. The published plugin API lists the storage interface names the plugin guide's replacement table gives, so the guide's examples and the bundled plugins that import them stay on the published list.
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.
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.
A module entry in plugin_api.json also publishes the module's imports (logging, os, sys,
Path). The list now names the three functions, and the docs example imports them by name.
The Ink launcher made, restored and finished the `-w` worktree with private code, so a plugin
that starts its own chat client could not offer `-w`, and a tree it made with `git worktree add`
can be removed by the stale-tree sweep. That code moves into `hermes_cli/session_worktree.py` as
`create()`, `restore(session_id)` and `finish(info, session_id, ask=...)`; the Ink launcher and
`hermes_cli/main_resume_args.py` now call them, with the same questions and messages. The module
is listed in `hermes_cli/data/plugin_api.json` and the generated public API page.
The example read os.environ["HERMES_HOME"], which a Hermes started as a console script
on the default profile does not set. It now calls get_hermes_home(). The section says the
launcher command needs plugins.isolation: in_process. plugin_api.json lists hermes_command
and print_exit_summary by name, so the module's imports are not published with them.
A plugin that starts its own chat client had to copy three private pieces of the Ink launcher by
hand. The new module hermes_cli/chat_launch.py holds two of them: hermes_command() returns the argv
that runs this install, and print_exit_summary() prints the resume lines with the caller's command
name. The Ink launcher now calls print_exit_summary with "hermes --tui", so its output is unchanged.
hermes_cli.chat_launch and hermes_cli.gateway_chat:shell_client_env join the public plugin API list.
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
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.
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.
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.
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.
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.
#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>
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
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.
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.
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.
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.
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.
The interim index (#84919) merged while this PR was open, leaving two
side-by-side discovery systems. Rip the index out, keep only what the
catalog track uses:
- delete hermes_cli/plugin_index.py, the bundled seed JSON, its test
file, the .gitignore exception, and the plugins.index_url surface
- cmd_search is catalog-only (term + --json); --capability/--refresh die
- cmd_install: unknown bare catalog-like names hard-error again instead
of falling through the removed index fallback
- plugin packs bare-name resolution rewired onto plugin_catalog
(load_catalog_live), the only shipped index consumer
- docs (features/plugins.md, cli-commands.md) rewritten for the catalog
Static machine-readable community plugin index with fuzzy search and
index-resolved installs, mirroring the Skills Hub catalog pattern
(fetch → HERMES_HOME/cache with 24h TTL → bundled seed fallback).
- hermes_cli/plugin_index.py: index fetch/cache/seed chain, fuzzy
search (name/description/tags/author + typo tolerance), capability
filter, bare-name resolution. Canonical URL overridable via
plugins.index_url config key.
- hermes_cli/data/plugin_index.json: bundled seed (offline fallback +
format reference) with 5 real ecosystem plugins, each pinned to an
exact commit SHA.
- hermes plugins search [term] [--json] [--capability] [--refresh]:
Rich table or JSON output, offline-safe, with an explicit
'indexed ≠ audited' footer.
- hermes plugins install <name>: bare names (no slash, no URL scheme)
resolve through the index to owner/repo[/subdir] @ pinned ref and
hand off to the existing install path (ref wired through the #82029
exact-ref support). Ambiguous names list candidates and exit;
explicit owner/repo and Git URL installs are untouched, and an
explicit --ref always beats the index pin.
- Docs: discovery section in user-guide plugins.md (format, submission
workflow via PR to hermes-plugin-index, security framing) and
reference/cli-commands.md rows.
- Tests: tests/hermes_cli/test_plugin_index_search.py (38 tests, no
live network) covering parsing, search, remote→cache→seed fallback,
TTL, install resolution/ambiguity/passthrough, and --json output.