Commit Graph

243 Commits

Author SHA1 Message Date
Teknium
a2480ad824 fix(plugins): a deferred bundled platform is not a failed backend activation
Bundled platforms stay deferred on purpose, so load_and_go_live has no summary
for them; the activation route now answers ok:false only when the plugin was
discovered and its load raised (plugin_load_failed). Docs: backend_error alone
does not set restart_required; backend dependency gaps still do.
2026-12-01 14:01:26 -08:00
Teknium
fe42a199a8 fix(plugins): BOM-tolerant marker reads; docs keep restart_required as main defines it
restart_required on main also covers missing plugin dependencies, so the doc
line now says only that the backend activation result never feeds it.
2026-12-01 14:01:26 -08:00
kstam-agent
03fc2b3816 fix(plugins): authenticate activation on login-gated dashboards
Accept the existing backend credential only for the activation POST through both authentication layers. Preserve profile checks and other auth boundaries, and report backend failures independently of gateway reloads.

Fixes #141878. Independently reviewed; 268 focused tests and all 12 repository checks passed.
2026-12-01 14:01:26 -08:00
alt-glitch
67ee613dc3 refactor(tools): Tool Search's bridge and argument validation become tools/deferral.py
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
Docs Search Monitor / probe (push) Has been cancelled
tools/deferral.py holds the tools hidden behind tool_search, tool_describe and
tool_call: which tools defer, the listing in the bridge's description, the three
bridge tools, and the local check of a tool_call's arguments. It takes
tools/tool_search.py and tools/tool_search_validation.py whole, and from
model_tools.py the listing-form labels and the active model's context length,
which the tool list builder reads. Top-level code moves unchanged; inside it,
two imports that named this file are dropped, and two imports of toolsets and
the catalog move to module top beside the ones the file already had.

tools/tool_search_catalog.py stays a file. tools/connectors/search.py imports
the catalog at module top and the bridge imports tools.connectors.search at
module top: in one file the two would import each other while loading. Once the
declaration work moves the three tools to tools/builtin/tool_search/, deferral
stops importing connectors and the catalog can join it.

Old names. tools/tool_search.py and tools/tool_search_validation.py are
generated files: releases up to v0.23.5 import both inside functions on every
tool call (agent/inline_tool_executors.py, tools/connectors/dispatch.py), and
pinned catalog plugins import them. Both get a key in
hermes_agent/compat/moves.py and a row in the plugin guide.

Their log lines move from the tools.tool_search logger to tools.deferral, the
same `tools` component.
2026-12-02 01:01:19 +05:30
alt-glitch
54bcf3c497 refactor(agent): four agent helpers move from tools/ to agent/
tools/daemon_pool.py, tools/interpreter_shutdown.py and tools/hook_output_spill.py
keep their names under agent/; tools/mcp_tool_agent.py becomes agent/tool_snapshot.py,
because it keeps a live agent's tools[] snapshot stable (refresh, publish, pin,
restore) for every tool, not only MCP ones. Each file moves whole with no line
changed; importers use the new names. agent/ calls all four, and none is a model tool.

Old names stay importable. tools.daemon_pool, tools.interpreter_shutdown and
tools.mcp_tool_agent get a MOVES key, a REQUIRED_NAMES row and a generated file at the
old path: releases v0.21.6 to v0.23.5 import them inside functions on compression,
API-error and tool-list restore paths, which a process left open across an update
reaches without having loaded them. tools.hook_output_spill gets a MOVES key and a
plugin-guide row, because the pinned catalog plugin epistemic-harness imports it.

hook_output_spill logs through getLogger(__name__), so its lines now fall under the agent
log component. tool_snapshot keeps its literal tools.mcp.client logger, a module that
stays. The other two have no logger.
2026-12-01 23:46:17 +05:30
alt-glitch
f76a32ed2c refactor(tools): tool selection and the platform resolver join tools/toolsets.py
tools/toolsets.py now answers both questions about toolsets: which tool names
a session's enabled and disabled lists come to (_select_tool_names and its
helpers, from model_tools.py), and which toolsets a platform gets from
config.yaml (_get_platform_tools, the 19 functions it calls and the 11 names
they read, from hermes_cli/tools_config.py). Definitions move unchanged;
inside them, the imports that named this file are dropped. Callers, tests and
docs import from tools.toolsets; a test that patched a moved name patches it
where the code it runs now reads it.

Old names stay where releases and pinned catalog plugins import them, until
v0.27.0. model_tools keeps _LEGACY_TOOLSET_MAP and _apply_toolset_selection
(releases up to v0.23.5 import them inside functions). hermes_cli.tools_config
keeps _platform_default_toolset (a pinned catalog plugin imports it),
_xai_credentials_present and enabled_mcp_server_names (releases), besides the
names its own code still uses.

The resolver's warnings and the disabled-bundle notice log under
tools.toolsets, so `hermes logs --component tools` shows them instead of `cli`
and `agent`. Importing model_tools now also loads hermes_cli.toolset_scope and
hermes_cli.toolset_validation, two small modules that import only the
standard library.
2026-12-01 22:51:13 +05:30
alt-glitch
2c25d8f5e6 refactor(tools): toolsets.py becomes tools/toolsets.py
The named groups of tools and the functions that resolve them move from the
repository root into tools/, beside the registry they read. The file moves
whole and unchanged; its importers, test patch targets and the docs follow.

Old name. The root toolsets.py is a generated file: releases v0.22.7 to
v0.23.0 import `toolsets` in a fresh process after an update
(hermes_cli/update_cmd_validation.py), and pinned catalog plugins import it.
hermes_agent/compat/moves.py gets the key, the plugin guide lists it, and
pyproject's update-startup-files names tools/toolsets.py beside toolsets.py.
2026-12-01 22:51:13 +05:30
alt-glitch
2e248ea10d refactor(utils): ANSI stripping and path checks move from tools/ to utils/
tools/ansi_strip.py becomes utils/text.py and tools/path_security.py becomes
utils/path_safety.py, each file whole with no line changed. Seven packages strip
ANSI escapes and three check paths, and neither file knows anything about tools, so
utils/ is their owner. Importers use the new names.

Old names stay importable: tools.ansi_strip and tools.path_security get a MOVES key,
a REQUIRED_NAMES row and a generated file at the old path. Releases v0.21.6 to v0.23.5
import both inside functions on the terminal, skill_view and V4A patch paths, and pinned
catalog plugins import both (custom-dangerous-patterns, ttsbuddy). The plugin guide and
utils/AGENTS.md gain a row for each.
2026-12-01 22:45:51 +05:30
alt-glitch
ea4f672368 refactor(terminal): the process registry, terminal config and sudo move from tools/ to terminal_backends/
The 21 flat files that serve the terminal backends join the package:
the process registry and its nine parts, the environment-variable
passthrough, credential file mounts, workspace path resolution, the PTY
query responder, the terminal scope, and the backend table, config,
lifecycle, macOS open rewrite, sudo and sudo askpass of the terminal
tool. file_tools_paths becomes workspace_paths and the terminal_tool_
prefix drops (terminal_tool_backends becomes backends, and so on); every
other file keeps its stem. Function bodies are unchanged; only imports
and module-name strings follow the move. 22 tests move to
tests/terminal_backends/.

Ten old module names keep a generated old-path file and a compat key:
a session started on an older release imports them lazily after an
update from code it has already loaded (the gateway's process notices
and inbound media, an agent's next terminal command, sudo prompt or PTY
process). Each key also binds the module such a session holds to its new
name, so the process table, the sudo password cache and the registered
passthrough variables stay one object. The pinned catalog plugins'
modules are listed in the plugin guide.
2026-12-01 19:40:47 +05:30
alt-glitch
b85ac0f579 refactor(terminal): the terminal backends move from tools/environments/ to terminal_backends/
The terminal backends and their support files leave tools/, which holds
model tools, for a new root package terminal_backends/. base.py becomes
environment.py and its base_* siblings become environment_*;
sandbox_scope.py becomes hosted_scope.py and sandbox_conformance.py
becomes conformance.py. Every other file keeps its stem. Function bodies
are unchanged; only imports and module-name strings follow the move.

tools.environments, tools.environments.local, tools.environments.base
and tools.environments.sudo_password_note keep generated old-path files:
old releases import the first two after an update, an agent process
started on v0.23.2 to v0.23.5 imports the last on its next terminal
command, and the plugin API publishes BaseEnvironment under both
package names. tools.environments.base_output is a compat key for pinned
catalog plugins. terminal_backends joins the tools log component, the
known logger roots and every hand-written package list.

The package is not named sandboxes: on an install whose checkout is
HERMES_HOME that folder holds live sandbox workspaces, and the updater
of a released version deletes or stashes them when a tracked package of
the same name arrives.
2026-12-01 17:49:22 +05:30
alt-glitch
2115d74421 refactor(bots): Bot Mode and Bot Desktop move from tools/ to bots/
tools/ holds model tools. These 19 files register none: they resolve the
Bot Mode roster, deliver message_agent's DMs and run their by-path runner,
hold the cross-connection relay and its receipts, and run the Bot Desktop
screen. They move to a new root package, bots/ (flat plus bots/desktop/,
with the launcher and wallpaper beside the runtime that reads them).
tools/message_agent_tool.py stays; only its imports change.

Function bodies are unchanged and every import stays where it was. Tests
whose subject is a moved file go to tests/bots/, whose conftest imports
the tests/tools/ autouse fixtures they ran under. Loggers follow their
modules; bots joins the tools log component, so `hermes logs --component
tools` shows the same lines, and every hand-written root-package list.

Old names keep working. Each moved top-level module has a MOVES key.
Processes started on v0.21.6 to v0.23.5 that outlive an update import
these modules inside functions and start tools/bot_mode_dm.py by path as
the DM runner, so those names get generated old-path files. Pinned catalog
plugins import tools.bot_desktop and tools.bot_live_delivery; the plugin
guide lists both.
2026-12-01 17:49:22 +05:30
alt-glitch
074383f218 refactor(approval): the approval gate, detection and human prompts move from tools/ to approval/
tools/ holds model tools. These 36 files register none: they decide whether
a command or a write may run, detect dangerous commands, and ask a person
(approval prompts, gateway clarify, slash confirmations). They move to a new
root package, approval/, with command detection in approval/detection/.
tools/approval.py becomes approval/gate.py and tools/approval_detection.py
becomes approval/detection/patterns.py; the other files drop the approval_
prefix or keep their stem. 79 tests whose subject is a moved file move to
tests/approval/, whose conftest.py imports the autouse fixtures of
tests/tools/conftest.py they ran under.

Function bodies are unchanged and every import stays where it was. Loggers
follow their modules: the five module loggers that logged as tools.approval
now log as approval.gate, and approval joins the tools entry of
hermes_logging.COMPONENT_PREFIXES, so `hermes logs --component tools` shows
the same lines. approval also joins packages.find, FIRST_PARTY_MODULE_ROOTS,
_KNOWN_LOGGER_ROOTS, the plugin isolation audit, six check scripts, the P33
profile-scope pattern and the test fixtures that list root packages.

Ten old names keep a file at the old path, each a MOVES key, a
REQUIRED_NAMES row and a file written by scripts/move/generate_shims.py:
tools.approval and tools.clarify_gateway are on the published plugin API,
and all ten are imported inside functions on every turn, message, tool call
or human prompt by a process started on a release up to v0.23.5, which
keeps running its old code after an update swaps the checkout. Five more
modules that pinned catalog plugins import keep their old name through a
MOVES key with no file, listed in the plugin guide.

Both new packages call rebind_loaded_modules from their __init__, so a
session that outlives the update keeps the one gate it already holds: a
notifier registered before the update still reaches a background child's
approval request.
2026-12-01 17:49:22 +05:30
alt-glitch
4ae91d1a13 refactor(agent): the delegation runtime moves to agent/subagents/
The 22 files that build, run and track delegated children leave tools/ for
agent/subagents/, and the two completion-notice files go to
agent/completion_notices/. Every file is a rename: the lines that change in
them are imports, module names in strings, and comments or docstrings that
name a sibling module. tools/delegate_task_tool.py and
tools/delegate_tool_tasks.py, the tool and its argument handling, stay.

42 test files whose only subject is a moved module move to
tests/agent/subagents/, whose conftest imports the autouse fixtures they ran
under in tests/tools/.

Six old module names stay importable through hermes_agent/compat/moves.py
because pinned catalog plugins import them: tools.async_delegation,
tools.delegate_tool, tools.delegate_tool_config, tools.delegate_tool_registry,
tools.delegation_live_log and tools.process_registry_awaiting. The last one
also keeps a generated file at its old path: releases v0.22.3 to v0.23.5
import it inside ProcessRegistry._prune_if_needed, which runs on every
background process start, and no idle process of those releases has it loaded.

Loggers follow their modules, so delegation's log lines are under
`hermes logs --component agent` and no longer under `--component tools`.
2026-12-01 00:30:17 +05:30
alt-glitch
9c5fe135c6 refactor(tools): interrupt, hosted policy, thread context and the async bridge become tools/context.py
tools/context.py holds what a running tool call reads from its thread or
context. It takes tools/interrupt.py, tools/hosted_tool_policy.py,
tools/thread_context.py and agent/tool_progress_relay.py whole, and from
model_tools.py the sync-to-async bridge and the call ids. Function bodies are
unchanged. Three names other modules import lose their underscore: run_async,
CallIds and prompt_callback_accessors.

The file imports no other tool-core file, so the registry and every tool
module can import it at module top. tools/registry.py does, and no longer
imports the bridge from model_tools inside dispatch.

Old names. tools.interrupt and tools.thread_context keep importing through
MOVES keys, for pinned catalog plugins. tools/hosted_tool_policy.py and
tools/thread_context.py are generated files: a TUI, CLI or ACP process that
started on a release up to v0.23.5 and built no agent before the update imports
them when it builds a system prompt or compresses. agent.tool_progress_relay
gets nothing; in such a process the TUI row for MCP progress fails until it
restarts. model_tools keeps _run_async and _CallIds as second names for
run_async and CallIds until v0.27.0: the registry and the inline executors of a
release import them from model_tools inside functions, and without the first a
TUI or ACP process that outlives the update fails every tool with an async
handler.

Log lines follow their module to the logger tools.context. The interrupt trace
(HERMES_DEBUG_INTERRUPT) logs under tools.context.interrupt, so the level it
forces applies to the trace alone. The one line of the progress relay moves
from the agent log component to tools.
2026-11-30 23:20:42 +05:30
alt-glitch
4767f6e368 docs(plugins): the xAI credential guide states what base_url is
The guide said the base URL is pinned to *.x.ai. The fallback branch returns XAI_BASE_URL as set, so the guide now says base_url honours the two override variables and that the bearer goes only to that URL.
2026-11-30 19:41:40 +05:30
alt-glitch
0a5e1935b5 refactor(xai): credentials go to hermes_cli/auth_xai.py and Imagine storage to the image plugin
tools/xai_http.py held three unrelated things and is gone. The xAI credential
resolver and the cheap credential probe now live in hermes_cli/auth_xai.py beside
the rest of xAI sign-in, and plugins may import both: they join the published
plugin API. Callers that sent the xAI User-Agent use hermes_user_agent("Hermes-Agent"),
which gives the same header. Imagine storage options and the one-time storage
notice live in plugins/image_gen/xai/storage.py, which the video plugin imports.
The video_generate tool no longer names xAI: a video backend may return
description_notes from capabilities(), and the xAI backend supplies its chaining
and storage lines that way, so the description text is unchanged.
2026-11-30 19:41:40 +05:30
alt-glitch
42866787a1 refactor(speech): speech files move from tools/ to a new speech/ package
Text-to-speech engines, transcription, voice mode and wake word register no
tool, so 28 files leave tools/ for a root package with four sub-packages:
speech/synthesis, speech/transcription, speech/voice and speech/wake_word.
tools/tts_tool.py, which registers text_to_speech, stays, and so does
tools/tts_elevenlabs_voices.py, which builds part of that tool's schema. Each
__init__.py is a docstring only.

File names keep their stem and drop the prefix the folder makes redundant.
transcription_tools becomes transcription/transcriber, transcription_common
becomes transcription/settings, wake_word becomes wake_word/listener, and
tts_tool_openai becomes synthesis/openai_compatible: neutts_synth.py runs by
file path from that folder, where an openai.py would shadow the openai package.
The NeuTTS samples and the bundled wake-word model move with the code that
reads them through __file__.

Function bodies are unchanged and every import stays where it was. Logger
names follow the modules: a moved module logs under its speech.* path, and a
literal that named a moved module names its new path. speech joins the tools
log component, so `hermes logs --component tools` shows the same lines. The
seven synthesis files that share the logger of tools/tts_tool.py keep it.

tools.tts_streaming keeps a generated file at its old path. Every release from
v0.21.6 to v0.23.5 imports it inside the CLI and TUI turn, outside any try, and
an idle process has not loaded it yet, so a process that outlives `hermes
update` would fail its first turn. No other moved name gets a file.

speech joins pyproject's packages.find, FIRST_PARTY_MODULE_ROOTS, the plugin
isolation audit, the known logger roots of `hermes debug share`, six check
scripts, the P33 profile-scope pattern, the subprocess env guard test, the
packaging test and three fixtures that copy a source tree. Tests whose subject
is a moved module move to tests/speech/ with the fixtures only they use.

Pinned catalog plugins import these moved modules by the old name, so each has a key in
hermes_agent/compat/moves.py and the plugin guide lists it with the release
that may remove it (no earlier than v0.27.0):
  tools.transcription_cloud
  tools.transcription_tools
  tools.tts_text_normalize
  tools.tts_tool_providers
  tools.voice_live
  tools.voice_mode
  tools.voice_mode_transcript
2026-11-30 16:59:14 +05:30
alt-glitch
55866ee0fb refactor(browser): browser sessions, launcher and supervisor move from tools/ to browser/
tools/ holds model tools. These 15 files register none: they launch and
track Chromium, hold the per-task browser sessions and run the CDP
supervisor the browser tools call. They move to a new root package:

  tools/browser_session*.py          -> browser/session*.py
  tools/browser_launcher{,_holders}  -> browser/launcher{,_holders}.py
  tools/browser_lightpanda.py        -> browser/lightpanda.py
  tools/browser_supervisor*.py       -> browser/supervisor*.py
  tools/browser_real_profile_logins  -> browser/real_profile_logins.py
  tools/bot_desktop/browser.py       -> browser/desktop_profile.py

browser/__init__.py is a docstring only. tools/browser_tool.py and every
tool file stay. 38 tests and one helper move to tests/browser/; its
conftest.py imports the autouse fixtures of tests/tools/conftest.py they
ran under.

Old-path files, each a MOVES key, a REQUIRED_NAMES row and a file
written by scripts/move/generate_shims.py:
- tools.browser_supervisor and tools.browser_supervisor_capture are on
  the published plugin API (hermes_cli/data/plugin_api.json), so a
  plugin's import gives the same module object.
- tools.browser_session and tools.browser_session_cloud are imported
  inside functions on every turn by a process started on v0.22.7 to
  v0.23.5 (the per-turn browser cleanup), which keeps running its old
  code after an update swaps the checkout.

Function bodies are unchanged and every import stays where it was.
Loggers follow their modules: every moved file keeps
getLogger(__name__), and the two literal supervisor loggers name
browser.supervisor. browser joins the tools entry of
hermes_logging.COMPONENT_PREFIXES, so `hermes logs --component tools`
shows the same lines. browser also joins packages.find,
FIRST_PARTY_MODULE_ROOTS, _KNOWN_LOGGER_ROOTS, the plugin isolation
audit, six check scripts, the P33 profile-scope pattern, the gateway's
stop-path preload list and the test fixtures that list root packages.

The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py; split imports, imports inside child-process code
strings, boundary-lint baseline keys, two resolution-allowlist rows and
docs globs were fixed by hand.

Pinned catalog plugins import these moved modules by the old name, so each has a key in
hermes_agent/compat/moves.py and the plugin guide lists it with the release
that may remove it (no earlier than v0.27.0):
  tools.browser_session_cdp
  tools.browser_session_lifecycle
2026-11-30 16:47:24 +05:30
alt-glitch
9d8c6f5d5d fix(compat): seven old MCP module names import again
The MCP client files moved into tools/mcp/. Five pinned catalog plugins
import seven of them by the old module name: four of the plugins fail to
load on main and one loses a feature. v0.23.5 does not have the move.

Seven keys in hermes_agent/compat/moves.py map the old module names to
the modules that hold the code now. No file returns to tools/. The plugin
guide lists them with the release that may remove them (no earlier than
v0.27.0).

The command-resolution allowlist names a keyed module by its first path,
so its four rows for tools/mcp/config.py read tools/mcp_tool_config.py
again.
2026-11-30 15:20:21 +05:30
alt-glitch
cb4c3f9aa9 fix(compat): tools.send_message_tool and tools.send_message_targets import again
Both modules moved to gateway/outbound/ before v0.23.2. Nine pinned
catalog plugins import tools.send_message_tool by its old name, and one
of them also imports tools.send_message_targets. On v0.23.2 through
v0.23.5 five of those plugins fail to load and four lose a feature.

Two keys in hermes_agent/compat/moves.py map the old module names to the
modules that hold the code now. No file returns to tools/.

The plugin guide lists both names with the release that may remove them
(no earlier than v0.27.0). The moves.py docstring said a key is never
removed; that holds for a key a supported release reaches, and the
docstring now says so.

The boundary lint names a keyed module by its first name, so the one
baseline row for gateway.outbound.send is renamed; no count changes.
2026-11-30 14:47:25 +05:30
alt-glitch
775a797e2a refactor(tools): move the MCP client files into the package tools/mcp/
The 27 flat tools/mcp_*.py client files and tools/osv_check.py become
modules of tools/mcp/, each without its mcp_tool_ or mcp_ prefix.
tools/mcp_tool.py becomes tools/mcp/client.py, because discovery imports
any tools/<pkg>/tool.py. tools/mcp_tool_agent.py stays. tools/mcp/__init__.py
is a docstring only, so importing one module loads what the flat file loaded.

Their 118 tests move to tests/tools/mcp/ under the same names. Imports,
string patch targets, sys.modules keys and doc paths follow the move.
Three old module names keep a generated file at the old path, because a
process that started on a supported release and outlives the update
imports them lazily: tools.mcp_tool_discovery and tools.mcp_oauth when an
editor's ACP server opens its next session, tools.mcp_elicitation_form on
its next tool call. The other 25 names stop importing.

Logger names follow the modules. The eight files that use
getLogger(__name__) log under tools.mcp.<module>, and the literal name the
split modules share is tools.mcp.client. Every name stays under tools.

The "mcp_tool.py" entry in the discovery skip set is removed: discovery
scans only tools/*.py and tools/*/tool.py, so no file of tools/mcp/ is a
candidate. The same tools register before and after.
2026-11-30 14:45:36 +05:30
Teknium
36d4e09c77 docs(plugins): state what a fork's granted tools share; approvals deny without a prompt
The fork-tools section promised that a fork's own task id gives it a
terminal and process table apart from the session's. It does not: the
terminal environment and process_manage ownership resolve against the
session key the fork carries (tools/terminal_tool.py
_resolve_container_task_id, tools/process_registry_access.py
session_action_allowed). Enforcing isolation would mean re-keying both
registries for one caller, so the docs now say exactly what a granted
terminal / process_manage shares.

Also: the fork has exactly the operator-granted tools, nothing makes
them read-only (the example prompt no longer says "read-only");
approvals are denied before any prompt or guardian call; on_tool gets
a redacted copy; a quick command shadowing a dispatch plugin command
waits for the turn.
2026-11-29 14:14:47 -08:00
Teknium
e11ec55b0d fix(cli): a mid-turn plugin command's clarify and the turn's never swap
Live on e7a7e414 (classic `hermes chat`, /sidecheck ask typed while the turn's
terminal ran, then the turn called clarify): the turn's pump took the command's
SIDE_Q and the command's waiter took the turn's MAIN_Q, because both consumed
any `clarify` server request for the session from the one events queue. When
slash.exec returned, call_unbounded withdrew the panel its waiter held, which
was the turn's: MAIN_Q never showed and the tool returned outcome=cancelled.

Route by owner instead of first-come:
- slash.exec takes an opaque `ask_owner`; the gateway echoes it as `owner` on
  every clarify its ctx.ask_choice sends (viewer_choices / _ask_viewers).
- GatewayConnection routes a server request whose `owner` it registered to that
  owner's inbox at ingestion, so neither the turn pump nor an idle drain
  (queue_admitted_turn, _drain_stale) ever sees it; untagged requests and
  another viewer's go to the session queue as before.
- _answer_choices reads only its inbox, so the command-end withdraw only ever
  closes the command's own question.
- A gateway older than ask_owner refuses the key (invalid_params) before it
  runs anything: the command is re-sent without it, and its untagged ask is
  taken between turns, as before (such a gateway runs no command mid-turn).

Contracts: SlashExecParams.ask_owner, ClarifyRequestParams.owner (regenerated).
2026-11-29 14:14:47 -08:00
Teknium
f476899bbd fix(plugins): a plugin slash command can opt in to run mid-turn
A plugin's side-thread command (/btw --explore as a plugin) is only useful
while the main turn runs, but the classic CLI queued every plugin command in
_pending_input until the turn ended, and a messaging chat read it as a
follow-up (interrupt or queue). The TUI and Desktop already ran it at once.

register_command(busy_policy="dispatch") is the opt-in, mirroring the
CommandDef vocabulary; the default is unchanged.

- hermes_cli/plugins.py::plugin_command_runs_mid_turn is the one lookup.
- Messaging: the busy fast path (_hm_busy_slash_or_photo ->
  _hm_busy_plugin_command) dispatches it under the slash access gate, and
  should_bypass_active_session lets it through the base adapter's own busy
  guard.
- Classic CLI: commands.catalog carries plugin_busy_commands (the CLI's
  plugin commands run in the gateway), and a busy Enter dispatches the
  command on its own thread so the clarify panel stays answerable.
2026-11-29 14:14:47 -08:00
Teknium
ad3c2b0d14 feat(plugins): host side-thread plugins on the published plugin API
/btw --explore (#158593) and its Desktop side chat (#158643) belong in a
third-party plugin, but the plugin API could not host them: a fork lease came
only from post_llm_call, no core tool could ever be named for a plugin fork,
and a running fork reported nothing until it settled. Three generic extension
points close that, reusing the existing ctx.fork_session machinery (cache-parity
fork, dispatch whitelist, auto-denied approvals, next-turn cancellation):

- Slash-command handlers that name a `side_question_token` keyword get a lease
  on the calling session's live agent (classic CLI, gateway-owned local
  sessions and messaging, TUI sidecar). Same lease rules as the turn token; it
  does not replace that token. Only a handler that names it pays for the
  capture.
- `plugins.entries.<id>.fork_tools` lets the user grant ONE plugin's forks
  named core tools (read_file, search_files, terminal, ...). Pre-registry
  names (delegate_task, memory, connectors, Tool Search bridges) stay refused;
  FORK_SAFE_CORE_TOOLS stays empty. Forks now bind the non-interactive secret
  capture so a granted skill tool can never pop the turn's secret prompt.
- `ctx.fork_session(..., on_tool=cb)` hears each allowed tool call as it
  starts (display-redacted args), for live progress via post_message / edit or
  emit_to_session.

Desktop needs no SDK change: a plugin docks its side chat as a `panes`
contribution with placement right and sends its slash command for follow-ups.
2026-11-29 14:14:47 -08:00
Teknium
1ca3abd431 feat(credential-pool): agent-CLI providers can pool several logins per profile
A model-provider plugin that runs an agent CLI (auth_type external_process,
e.g. the Claude Subscription DirectSDK plugin running Claude Code) keeps its
login outside Hermes, so a profile could hold only one. Pool rows for such a
provider half-worked: the main runtime came from the generic pool rung, which
dropped the launch command and args (background review reads rt["command"]
and raised KeyError; a generic ACP client launched with no command), the
auxiliary client (titles, compression, vision) was handed the placeholder key
and so ran on the CLI's default login - another account, or none - and a row
the pool had taken out of rotation for good (DEAD) printed as healthy in
`hermes auth list`.

- resolve_external_process_provider_credentials() hands the row the pool is
  on as api_key (new public agent.credential_pool_plugin.
  external_process_pool_key), so the main runtime, its rotation rebuild and
  the auxiliary client all spawn the CLI with the same login; the
  external-process rung carries the pool for usage-limit rotation and keeps
  command/args. An empty pool keeps the placeholder: nothing changes.
- The generic pool rung skips external-process providers (their rung owns it).
- `hermes auth list` shows a dead row as "signed out (left rotation; sign in
  again)".
- Docs: model-provider plugin guide section for pooled agent-CLI logins,
  user-guide credential-pools note, public-api table.

For NousResearch/hermes-official-plugins#441, #499 and #37.
2026-11-29 14:06:50 -08:00
itsflownium
617a997b62 fix(expiry): expire tokens and cooldowns across system suspend 2026-11-29 00:13:49 -08:00
Teknium
a425939da5 feat(plugins): publish the main-endpoint pricing key lookup
The official Langfuse plugin prices each generation itself and sent the
pricing lookup no key, so a keyed custom endpoint (LiteLLM, vLLM with
--api-key) answered its /models list with 401 and the generation got
no cost. The only way to the key Hermes' own pricing uses was the
private agent.aux_accounting._pricing_api_key.

Split its main-endpoint half out as main_endpoint_pricing_key(base_url)
and list it in the published plugin API with a docs section. Same
rules as before: a key only for model.base_url, none beside a live
credential source, none when config cannot be read.

Test: the helper returns the saved key for the configured main
endpoint and None for another host.
2026-11-28 20:55:12 -08:00
Teknium
c843f4c930 fix(ci): a capped entry still runs every admission check that does not load it
Review (Greptile P1 4729331907): skipping hermes plugins validate outright
for a pin capped below this core also skipped its file-based checks
(manifest, loadable entrypoint, install scanner, core overrides, private
imports, Desktop SDK use), and none of the other gates replaces them. For a
capped entry the gate now runs validate --json --install-deps and refuses
the entry when any check other than the capability probe (the one that
imports the pin on this core) fails, or when no report can be read.
2026-11-28 16:51:56 -08:00
Teknium
1af980732d fix(ci): pinned-source gate skips loading an entry capped below this core
`pinned-source-validate` ran `hermes plugins validate` for every changed
entry on the PR's own Hermes, even when the entry's own requires_hermes
excludes that Hermes. An entry can legitimately be capped below main: its
pin imports core modules a newer release dropped, and only the older Hermes
it names will ever install it. hermes-tag is the case: its pin imports
plugins.platforms.dingtalk, which left core with #159638. Loading that pin
on main can only fail.

The gate now reads requires_hermes through the isolated field reader. A
malformed value is refused the same way the structural validator refuses
it. When the spec excludes the running core (as an install by catalog name
compares it), the load step is skipped, with a ::notice and the reason on
the PASS line. Clone, reachability, confinement, self-updater, attestation
and payload gates still run on the pin, because older Hermes installs it.
2026-11-28 16:51:56 -08:00
Teknium
6ec2830115 fix(plugins): one scoped tool no longer hides its toolset's other tools
`default_platforms` is declared per tool but the default it sets is per
toolset. The toolset took the union of the tools that named platforms and
ignored a sibling that named none, so one Slack-only tool turned the whole
toolset off on the CLI. An empty list asks for every platform, so the union
is now every platform: a toolset is scoped only when every tool in it names
platforms. That one value is what the registry, the key cache and the
gateway's plugins.list rows already carry.
2026-11-28 15:59:41 -08:00
Teknium
6b62557044 feat(plugins): a plugin toolset can default on for some platforms only
`ctx.register_tool(..., default_platforms=("feishu",))` keeps the tool's toolset
on for those platforms and off elsewhere until the user saves a choice in
`hermes tools`; an explicit selection still wins everywhere. Read at the one
plugin-toolset default (`_enabled_plugin_toolsets`), carried in the plugin
toolset key cache and in the gateway's `plugins.list` rows so a classic CLI on
a gateway session agrees.

The Feishu plugin's doc/drive tools only work inside a Feishu comment run: a
new home that sets Feishu up now gets them on the Feishu platform alone, the
same scope migrated homes already keep.
2026-11-28 15:59:41 -08:00
Teknium
c52847ccbd fix(matrix): ask the published approval API whether a refusal stays silent
The Matrix adapter decided its silent approvers_only refusal by importing
tools.approval.list_gateway_approval_authority, a core symbol outside the
published plugin API, so tests/scripts/test_boundary_lint.py went red with a
new module_to_core crossing. That decision is approval policy, not Matrix
transport: it now lives in gateway.approval_actor.approval_is_list_only
beside approval_refusal, is published in hermes_cli/data/plugin_api.json and
documented in adding-platform-adapters.md, and the adapter calls it. The
boundary baseline is untouched.
2026-11-28 15:17:31 -08:00
Teknium
69330b0988 refactor: move DingTalk out of core into the dingtalk Hermes Labs plugin
DingTalk (Stream Mode adapter, AI Cards, the QR device-flow login in
hermes_cli/dingtalk_auth.py) now ships as the `dingtalk` plugin in
NousResearch/hermes-labs-plugins: built by Nous Research, not supported.
Same platform name, DINGTALK_* env vars and platforms.dingtalk keys.

Removed: plugins/platforms/dingtalk/**, hermes_cli/dingtalk_auth.py and
its tests, Platform.DINGTALK, the hermes_cli/platforms.py row, the
hermes-dingtalk toolset and its hermes-gateway include, the dingtalk PM
extra (+ uv.lock, nix groups), the platform.dingtalk.emotion locale
strings, builtin-list entries (update allowlist, allowlist env platforms,
webhook/cron deliver sets, dump, dashboard env rows) and the shim rows
for a folder that no longer exists. Comments that named DingTalk as a
core adapter now describe the capability flag instead; no core code
branched on the name. Docs: messaging/dingtalk.md (+ zh-Hans) is a
"moved to the Labs plugin" page.

Kept: DINGTALK_CLIENT_ID/SECRET on the hermes-owned env list (a plugin
manifest cannot claim them), tip t159 (tips are numbered contiguously),
the desktop/TUI session-source names (the plugin keeps the platform name).
hermes-dingtalk stays valid as a retired telemetry toolset name.
2026-11-28 07:11:48 -08:00
Teknium
8542222e56 feat(memory)!: remove the ByteRover and RetainDB memory providers
Nobody took over NousResearch/hermes-plugin-byterover or hermes-plugin-retaindb by the
Oct 15 2026 deadline (D12), so both bundled providers are deleted instead of moved to the
catalog.

- Delete plugins/memory/byterover/, plugins/memory/retaindb/ and the tests that only
  exercised them (provider, multiplex contract, thread-profile and identity-scope files whose
  every case was one of the two; the retaindb secret-scope pair; the two bundled-precedence
  tests that used byterover as the bundled sample).
- memory_provider_migration: a `_REMOVED` name -> label table. A home whose memory.provider
  names one gets "<Label> was removed from Hermes because no one took over maintaining it.
  External memory is off; run `hermes memory setup` to choose another provider." at agent
  start (CLI, Desktop notice, chat platform first reply), on `hermes update`, in
  `hermes memory status`, `hermes memory setup <name>` and `hermes doctor`. No catalog lookup
  and no install for those names; memory.provider is never rewritten. Both names leave
  _LEFT_CORE (no unattended install consent for a plugin that does not exist).
- Drop RETAINDB_API_KEY / RETAINDB_BASE_URL / BRV_API_KEY from OPTIONAL_ENV_VARS, the
  "Bundled providers" help line, ~/.brv-cli/bin from the memory-setup PATH, the two
  boundary-lint baseline lines, and the docs (EN + zh-Hans).
- Kept: agent/redact.py's retaindb_/brv_ key patterns (a leaked key is still a secret).

The empty `honcho: {}` config root was already removed on main (6933155eaf).
2026-11-28 06:39:41 -08:00
Teknium
3ef8bf4f68 fix(plugins): a platform plugin may declare the tools of the bundled platform it takes over
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
`hermes plugins validate` failed any declared tool name core already ships, so a
platform plugin that takes over a bundled platform (Feishu, hermes-official-plugins
#517) could not declare its own tools: on a core that still bundles the platform the
names collide, and with provides_tools: [] the same plugin fails the declared-tools
check once core drops the platform. No single manifest passed both.

The collision check now exempts, for a kind: platform plugin named after a platform
core still bundles, that platform's own hermes-<platform> extras (never the shared
core tools), and only when the plugin does not register them on this core. Every
other built-in name, and any registration that would shadow a built-in, still fails.
Install never ran this check (only validate does), so 0.23.4 installs are unaffected.
2026-11-28 03:40:45 -08:00
Teknium
f4e6034a30 feat(plugins): oauth entries can write localhost into the redirect URI
QuickBooks (Intuit) refuses IP addresses in redirect URIs, so the pinned
`http://127.0.0.1:<port><path>` redirect from the previous commit can never
be registered there. `redirect_host: localhost` writes `localhost` into the
redirect URI (authorize and token requests) while the listener still binds
127.0.0.1 only. Validated at admission (127.0.0.1 or localhost), passed into
the PKCE config, and part of the grant fingerprint only when set, so existing
grants stay valid.

Docs note that QuickBooks accepts a localhost redirect for development
(sandbox) keys only; production keys need a public HTTPS redirect.
2026-11-26 18:05:50 -08:00
Teknium
1478d8e174 feat(plugins): oauth entries can pin the redirect URI and comma-join scopes
Some authorization servers accept only a redirect URI registered verbatim
(Linear, QuickBooks) and some want `scope=read,write` instead of the RFC
space join (Linear). A plugin `oauth:` entry could do neither: the login
always bound an OS-assigned port at /callback and always space-joined the
scopes, so `hermes auth add <plugin>:<id>` could not finish a sign-in at
those providers and plugins kept their own token files instead.

- `oauth:` entries take optional `redirect_port` (1024-65535),
  `redirect_path` and `scope_separator` (space or comma); validated at
  admission like the other fields and passed into the PKCE config.
- OAuthPKCEConfig gets `scope_separator`, used at all three join sites
  (authorize URL, stored grant metadata, refresh request).
- The granted-scope check splits on commas or whitespace, so it reads the
  IdP's answer whichever separator it uses.
- The grant fingerprint skips fields left at their default, so existing
  grants of entries that declare none of the new fields stay valid; a
  change to any of them asks for a fresh sign-in like every other field.

Fixes #152732, fixes #149642.
2026-11-26 18:05:50 -08:00
unsupportedpastels
231617ea5a refactor(gemini): extract neutral model-family, URL, and output-budget timeout helpers 2026-11-25 18:16:54 -05:00
unsupportedpastels
6d18eb30a2 refactor(plugins): name the producer of a Hermes-started turn instead of a boolean
turn_internal() read execution trust, so a restart's resume of a person's
interrupted turn, automations, plugin injections and Bot Chat deliveries
all looked Hermes-started. Replace it with turn_origin() (and
ctx.turn_origin()), which names the producer only where Hermes knows it:

- "process_notification": a background process's completion, watch match
  or liveness tick (_inject_watch_notification).
- "delegation_result": an async delegation's result re-entering its parent.

Every other turn reads None. The producer sets the origin on its event; the
committed automation row records it as turn_origin and restore reads it
back, so a row without one (any other producer, or one an older build
queued) restores as None and its fingerprint is unchanged. A late steer or
interrupt text run as the next turn reads None. The started_by_hermes
bookkeeping in the Bot Chat and API admission paths is removed. Trust,
authorization, allow_gateway_control and model-facing text are unchanged.
2026-11-25 15:46:50 -05:00
unsupportedpastels
e8b16ba90c feat(plugins): tell plugins whether Hermes started the running turn
turn_client() is None both for a turn Hermes started itself (a
background-process notification, a delegation result, an automation
wake) and for a person's turn sent over a connection that announced no
client, so a plugin cannot tell a wake from a typed message by it.

hermes_cli.plugin_session.turn_internal() (also ctx.turn_internal(),
which answers through the gateway under plugins.isolation: host) reads
the running turn's own event: True when Hermes produced its input,
False for a message someone sent (typed in a client, announced or not,
on a messaging chat, or an API request), None outside a turn, in a
delegated child, in a managed worker, in a plugin's own slash command
and for a synthetic turn Hermes does not mark internal (a goal
continuation).

An API turn is marked internal for trust when it executes, so admission
now records what the event was before that mark; an API event with no
record reads None rather than True.

It only reads the turn context at hook time: no system prompt, tool
list, message or model request changes.
2026-11-25 15:46:50 -05:00
unsupportedpastels
16fd059ad8 feat(plugins): publish the Gemini thinking helpers for provider plugins
A provider plugin on the native Gemini wire (generateContent) has no published way to map a Hermes
reasoning config onto thinkingConfig: the mapping lives in private core helpers, so a plugin either
re-implements the per-model rules or imports internals the boundary lint rejects. The Solstice
provider plugin needs this seam.

Publish three helpers in agent.reasoning_effort under a new plugin_api.json group, document them in
the model-provider guide and regenerate public-api.md:
- gemini_thinking_config(model, reasoning_config): the shared Gemini thinkingConfig mapping plus the
  xhigh lift, keyed on the id the native client sends.
- bare_gemini_model_id(model): the native client's prefix rule (gemini/ and google/ stripped), moved
  verbatim from agent.gemini_native_adapter into this import-light module; the adapter imports it
  back, so its existing name keeps working.
- clamp_effort (already in the module).

The gemini and vertex profiles are unchanged. test_reasoning_effort_plugin_api.py checks the helper
against the gemini profile's own output across models and efforts (prefixed ids included), the
prefix rule, the adapter's import name, and that importing the module loads no HTTP stack.
2026-11-24 13:32:49 -05:00
unsupportedpastels
feceed663e fix(cron): keep plugin lookups within one profile 2026-11-24 11:17:04 -05:00
unsupportedpastels
bbdc728912 docs(plugins): note off-chain fallback in store.lineage.lineage guide paragraph
Clarify in website/docs/developer-guide/plugins/index.md that [0] of
store.lineage.lineage(session_id) is the first id of the returned chain
(not necessarily the original session) and that (session_id,) is also
returned for a session with no compression chain or a session outside
the oldest-continuation chain the lookup follows (such as a later
sibling continuation), alongside fork children and tool-sourced runs.
Pin the branch-fork and off-chain sibling cases in
test_the_plugin_guides_lineage_read_gives_the_root_first_on_a_read_only_handle.
2026-11-24 11:17:04 -05:00
unsupportedpastels
a5a7a0784d fix(cron): use firing job settings in delivery_platforms and expose ctx.cron_delivery_platforms
Capture a delivery-relevant snapshot of the firing job inside
cron.execution_identity.enter_cron_execution so delivery_platforms() with
job_id=None answers from the run that is actually firing even when the
saved job is edited or deleted mid-run, while explicit job_id lookups
remain previews of the stored job.

Add PluginContext.cron_delivery_platforms(job_id=None) (and tuple
preservation in RemotePluginContext) so hooks running under
plugins.isolation: host read the firing run's delivery platforms in the
gateway in the calling hook's context. Re-export
CronSchedulerRegistrationError from cron.plugin_api so plugins can catch
it without a private core import, and update the plugin guide example
and tests accordingly.

Addresses Greptile review feedback on PR #159657.
2026-11-24 11:17:04 -05:00
unsupportedpastels
1dd65c2587 docs(plugins): the lineage read returns only its own id for a tool session
The guide said `[0]` of `store.lineage.lineage(session_id)` is the
session the conversation started in. The read treats every `tool`
session and every fork child as a fork, so a `tool` run that continued
after compression returns only its own id. The paragraph now says what
the first id is and lists those cases, and the test pins the `tool` one.
2026-11-24 11:17:04 -05:00
unsupportedpastels
030a6c439e fix(cron): cron.plugin_api reads home one way and reports a failed registration one way
- `home` was expanded for `~` only, while core's profile bind also
  expands environment variables. For a directory whose path holds a
  literal `$NAME` with NAME set, the job was stored in the literal
  directory while its settings (time zone) were read from the expanded
  one, which the bind also created. `home` is now read the way Hermes
  reads a home path, once, for the existence check, the bind and the
  cron store.
- A failed registration raised `CronSchedulerRegistrationError` for a
  new job but the provider's raw error for a job that already existed,
  so a second attempt against an unreachable provider raised a
  different type. Both now raise `CronSchedulerRegistrationError`
  carrying the saved job.
- Docs: `delivery_platforms` answers for the normal delivery lane; a
  `failure_deliver` override is not consulted.
2026-11-24 11:17:04 -05:00
unsupportedpastels
5159f3be0d fix(cron): ensure_named_job reads the name from the job store, and the guide names the running job through ctx
`ensure_named_job` looked the name up with `list_jobs`, which also reads
every job's latest and live run from the executions ledger and adds
`latest_execution` / `live_execution` to each record. So an existing job
came back with two keys a newly created job does not have, and every call
paid for a ledger read it never used. The lookup now reads the job store
and returns the same record shape either way.

Docs for `delivery_platforms`:
- With no job id it answers for the cron run bound in the calling
  process. A hook of a plugin running in a plugin host has no run bound
  there, so the guide and its example now name the job with
  `ctx.current_cron_execution().job_id`, which answers in both modes.
- The answer is the stored job's: an edit saved while a run is in flight
  shows up, though that run delivers with the settings it started with.
- `home` naming the process's own profile runs no external secret source;
  only another profile's first call does.
2026-11-24 11:17:04 -05:00
unsupportedpastels
92f61fa16d docs(plugins): name the storage-interface read that replaces get_compression_lineage
The old session store's `get_compression_lineage(session_id)` is not one of
the methods the `hermes_state` stand-in carries, and the migration guide did
not say what replaces it. A plugin that needs the session a conversation
started in (for example to match a prompt to a chat after a compression)
reads `store.lineage.lineage(session_id)` on the handle: the lineage's ids,
root first, `(session_id,)` for a session that was never compressed and `()`
for an unknown id. It works on a read-only handle.

The guide now says so, and a test reads a three-session chain that way
through `open_persistence_reader`.
2026-11-24 11:17:04 -05:00
unsupportedpastels
80d6bba3dc feat(cron): publish cron.plugin_api for scheduling a named job and reading delivery platforms
A plugin can now create one named follow-up job in a profile, once, with
`ensure_named_job`, and ask which platforms cron will deliver a job's output
to with `delivery_platforms`, without importing cron.jobs, cron.scheduler,
cron.scheduler_provider or private helpers of cron.scheduler_delivery.

Both functions forward to the code cron already runs (job creation with
scheduler registration, the provider's register_job, and cron's own
delivery-target resolver) and add no rule of their own. `home` runs the
call with that profile bound whole, the way core binds a profile (its
Hermes home, secrets and terminal policy) plus its cron store. A profile
other than the process's own also runs under multiplex semantics, as a
cron fire for it does, so its own time zone sets a schedule and its home
channels and provider credentials are the ones read. `~` is expanded, and
the caller's state is restored afterwards, also when the call raises. A
`home` that is not an existing directory is never created:
`ensure_named_job` raises FileNotFoundError and `delivery_platforms`
returns None. A hosted activity cannot act for a profile, so binding
`home` is refused there.
`AmbiguousJobReference` is re-exported for the duplicate-name case.

`ensure_named_job` refuses, with ValueError and before any lookup, a name
that is not a non-empty string free of leading and trailing whitespace:
cron could never find such a name again, so every call would add a job.

The module is listed as a whole in plugin_api.json, documented in the
plugin guide, and covered by tests against a real cron store.
2026-11-24 11:17:04 -05:00