repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
hermes-agent | hermes_cli/claw.py | .py | """hermes claw — OpenClaw migration commands.
Usage:
hermes claw migrate # Preview then migrate (always shows preview first)
hermes claw migrate --dry-run # Preview only, no changes
hermes claw migrate --yes # Skip confirmation prompt
hermes claw migrate --preset full --overwrite... | 816 | 30,847 |
hermes-agent | hermes_cli/plugins_cmd.py | .py | """``hermes plugins`` CLI subcommand — install, update, remove, and list plugins.
Plugins are installed from Git repositories into ``~/.hermes/plugins/``.
Supports full URLs and ``owner/repo`` shorthand (resolves to GitHub).
After install, if the plugin ships an ``after-install.md`` file it is
rendered with Rich Mark... | 3,157 | 118,422 |
hermes-agent | hermes_cli/kanban_db.py | .py | """SQLite-backed Kanban board for multi-profile, multi-project collaboration.
In a fresh install the board lives at ``<root>/kanban.db`` where
``<root>`` is the **shared Hermes root** (the parent of any active
profile). Profiles intentionally collapse onto a shared board: it IS
the cross-profile coordination primitive... | 11,839 | 494,316 |
hermes-agent | hermes_cli/gateway.py | .py | """
Gateway subcommand for hermes CLI.
Handles: hermes gateway [run|start|stop|restart|status|install|uninstall|setup]
"""
import asyncio
import json
import logging
import os
import shlex
import shutil
import signal
import subprocess
import sys
import textwrap
import time
from dataclasses import dataclass
from pathli... | 8,090 | 330,388 |
hermes-agent | hermes_cli/curator.py | .py | """CLI subcommand: `hermes curator <subcommand>`.
Thin shell around agent/curator.py and tools/skill_usage.py. Renders a status
table, triggers a run, pauses/resumes, and pins/unpins skills.
This module intentionally has no side effects at import time — main.py wires
the argparse subparsers on demand.
"""
from __fut... | 1,044 | 37,390 |
hermes-agent | hermes_cli/inventory.py | .py | """Provider/model inventory context — shared substrate for the dashboard
``/api/model/options``, the TUI ``model.options``/``model.save_key``
JSON-RPC handlers, and the interactive picker.
Before this module the three call-sites each duplicated:
1. The 17-LOC config-slice that pulls ``model.{default,name,provider,bas... | 884 | 37,551 |
hermes-agent | hermes_cli/_scan_venv_blockers.py | .py | """``hermes_cli/_scan_venv_blockers.py`` — Standalone venv-process scan for JSON consumption.
Invoked by the Desktop Electron app::
venv\\Scripts\\python.exe -m hermes_cli._scan_venv_blockers
Exits 0 for valid clear or blocked results. Non-zero exit signals probe
failure (the detector itself crashed, psutil una... | 300 | 10,847 |
hermes-agent | hermes_cli/dashboard_procs.py | .py | """Dashboard process-hygiene helpers — extracted from ``hermes_cli/main.py``.
Mechanical move (main.py decomposition): the three leaf process-hygiene
helpers (``_scan_dashboard_processes``, ``_kill_stale_dashboard_processes``,
``_detect_concurrent_hermes_instances``) are lifted verbatim. References to
helpers that STA... | 983 | 39,652 |
hermes-agent | hermes_cli/gateway_windows.py | .py | """Windows gateway service backend (Scheduled Task + Startup-folder fallback).
This mirrors the contract exposed by ``launchd_install`` / ``launchd_start`` /
``launchd_status`` etc. on macOS and ``systemd_install`` / ``systemd_start`` on
Linux. It uses ``schtasks`` under the hood with ``/SC ONLOGON`` and restart-on-
f... | 1,711 | 70,824 |
hermes-agent | hermes_cli/mcp_config.py | .py | """
MCP Server Management CLI — ``hermes mcp`` subcommand.
Implements ``hermes mcp add/remove/list/test/configure`` for interactive
MCP server lifecycle management (issue #690 Phase 2).
Relies on tools/mcp_tool.py for connection/discovery and keeps
configuration in ~/.hermes/config.yaml under the ``mcp_servers`` key.... | 1,159 | 44,091 |
hermes-agent | hermes_cli/pt_input_extras.py | .py | """Augmentations to prompt_toolkit's input-parsing tables.
Imported once at CLI startup. Each helper installs a small mapping into
prompt_toolkit's `ANSI_SEQUENCES` so byte sequences emitted by modern
keyboard protocols (Kitty / xterm `modifyOtherKeys`) decode to existing
key tuples Hermes already binds.
Kept in a st... | 429 | 19,389 |
hermes-agent | hermes_cli/runtime_provider.py | .py | """Shared runtime provider resolution for CLI, gateway, cron, and helpers."""
from __future__ import annotations
import logging
import os
import re
from urllib.parse import urlparse
from typing import Any, Dict, Optional
logger = logging.getLogger(__name__)
from hermes_cli import auth as auth_mod
from agent.credent... | 2,352 | 107,742 |
hermes-agent | hermes_cli/_subprocess_compat.py | .py | """Windows subprocess compatibility helpers.
Hermes is developed on Linux / macOS and tested natively on Windows too.
Several common subprocess patterns break silently-or-loudly on Windows:
* ``["npm", "install", ...]`` — on Windows ``npm`` is ``npm.cmd``, a batch
shim. ``subprocess.Popen(["npm", ...])`` fails wit... | 547 | 24,427 |
hermes-agent | hermes_cli/__init__.py | .py | """
Hermes CLI - Unified command-line interface for Hermes Agent.
Provides subcommands for:
- hermes chat - Interactive chat (same as ./hermes)
- hermes gateway - Run gateway in foreground
- hermes gateway start - Start gateway service
- hermes gateway stop - Stop gateway service
- hermes setup ... | 93 | 3,834 |
hermes-agent | hermes_cli/cli_commands_mixin.py | .py | """Slash-command handlers for the interactive CLI (god-file decomposition Phase 4).
This module hosts the ``_handle_*_command`` slash-command handlers lifted out of
``cli.py``'s ``HermesCLI`` class. ``HermesCLI`` inherits ``CLICommandsMixin`` so
every ``self.<handler>`` call resolves unchanged via the MRO — behavior-n... | 3,798 | 165,674 |
hermes-agent | hermes_cli/tools_config.py | .py | """
Unified tool configuration for Hermes Agent.
`hermes tools` and `hermes setup tools` both enter this module.
Select a platform → toggle toolsets on/off → for newly enabled tools
that need API keys, run through provider-aware configuration.
Saves per-platform tool configuration to ~/.hermes/config.yaml under
the `... | 5,807 | 248,367 |
hermes-agent | hermes_cli/auth.py | .py | """
Multi-provider authentication system for Hermes Agent.
Supports OAuth device code flows (Nous Portal, future: OpenAI Codex) and
traditional API key providers (OpenRouter, custom endpoints). Auth state
is persisted in ~/.hermes/auth.json with cross-process file locking.
Architecture:
- ProviderConfig registry defi... | 9,370 | 380,647 |
hermes-agent | hermes_cli/stderr_timestamp.py | .py | """Run a child process while prefixing each stderr line with a timestamp."""
from __future__ import annotations
import argparse
import os
import re
import signal
import subprocess
import sys
from collections.abc import Mapping
from datetime import datetime
from pathlib import Path
from typing import BinaryIO, Sequenc... | 166 | 5,619 |
hermes-agent | hermes_cli/sessions_cmd.py | .py | """``hermes sessions`` command — extracted from ``hermes_cli/main.py``.
Mechanical move (main.py decomposition): ``cmd_sessions`` was a ``def`` nested
inside ``main()``'s body; its dispatch on ``args.sessions_action`` is lifted
byte-identical. A symtable/AST closure check found exactly two free variables:
* ``_confir... | 1,397 | 57,495 |
hermes-agent | hermes_cli/update_cmd.py | .py | """Hermes update pipeline — extracted from ``hermes_cli/main.py``.
Mechanical move (main.py decomposition): ``_cmd_update_impl``, ``_cmd_update_check``
and every module-level helper used only by the update path, plus the update-only
constants they read. Function bodies are lifted verbatim; the only mechanical
change i... | 6,695 | 298,347 |
hermes-agent | hermes_cli/kanban.py | .py | """CLI for the Hermes Kanban board — ``hermes kanban …`` subcommand.
Exposes the full Kanban command surface documented in the design spec
(``docs/hermes-kanban-v1-spec.pdf``). All DB work is delegated to
``kanban_db``. This module adds:
* Argparse subcommand construction (``build_parser``).
* Argument dispatch... | 3,439 | 135,185 |
hermes-agent | hermes_cli/cron.py | .py | """
Cron subcommand for hermes CLI.
Handles standalone cron management commands like list, create, edit,
pause/resume/run/remove, status, and tick.
"""
import json
import sys
from pathlib import Path
from typing import Iterable, List, Optional
PROJECT_ROOT = Path(__file__).parent.parent.resolve()
sys.path.insert(0, ... | 641 | 26,992 |
hermes-agent | hermes_cli/prompt_size.py | .py | """Prompt-size diagnostic: ``hermes prompt-size``.
Reports a byte/char breakdown of the system prompt the agent would build for
a fresh session — system prompt total, the ``<available_skills>`` index,
memory + user profile, and tool-schema JSON. Lets users see where their fixed
prompt budget goes (issue #34667) withou... | 378 | 15,597 |
hermes-agent | hermes_cli/backup.py | .py | """
Backup and import commands for hermes CLI.
`hermes backup` creates a zip archive of the entire ~/.hermes/ directory
(excluding the hermes-agent repo and transient files).
`hermes import` restores from a backup zip, overlaying onto the current
HERMES_HOME root.
"""
import json
import logging
import os
import shut... | 2,088 | 81,728 |
hermes-agent | hermes_cli/web_git.py | .py | """Backend git operations for the desktop coding rail + Codex-style review pane.
The desktop's git affordances (coding-rail status, worktree lanes, review pane,
branch switch) run as Electron-local git on the user's machine. On a *remote*
gateway those would operate on the wrong filesystem, so this module mirrors them... | 869 | 33,574 |
hermes-agent | hermes_cli/plugins.py | .py | """
Hermes Plugin System
====================
Discovers, loads, and manages plugins from four sources:
1. **Bundled plugins** – ``<repo>/plugins/<name>/`` (shipped with hermes-agent;
``memory/`` and ``context_engine/`` subdirs are excluded — they have their
own discovery paths)
2. **User plugins** – ``~/.herm... | 6,562 | 276,948 |
hermes-agent | hermes_cli/commands.py | .py | """Slash command definitions and autocomplete for the Hermes CLI.
Central registry for all slash commands. Every consumer -- CLI help, gateway
dispatch, Telegram BotCommands, Slack subcommand mapping, autocomplete --
derives its data from ``COMMAND_REGISTRY``.
To add a command: add a ``CommandDef`` entry to ``COMMAND... | 2,338 | 104,809 |
hermes-agent | hermes_cli/_parser.py | .py | """
Top-level argparse construction for the hermes CLI.
Lives in its own module so other modules (e.g. ``relaunch.py``) can
introspect the parser to discover which flags exist without running the
``main`` fn.
Only the top-level parser and the ``chat`` subparser live here. Every other
subparser (model, gateway, sessio... | 515 | 19,140 |
hermes-agent | hermes_cli/model_setup_flows.py | .py | """Per-provider model-selection wizard flows for ``hermes setup`` / ``hermes model``.
Extracted from ``hermes_cli/main.py`` as part of the god-file decomposition
campaign (``~/.hermes/plans/god-file-decomposition.md``, Phase 2 — splitting
main.py handler/flow bodies out of the module). These 18 ``_model_flow_*``
funct... | 3,176 | 120,329 |
hermes-agent | hermes_cli/config_defaults.py | .py | """Default configuration data for Hermes Agent.
Pure-data leaf module: DEFAULT_CONFIG and OPTIONAL_ENV_VARS, extracted
verbatim from hermes_cli/config.py. Must not import from hermes_cli.config.
"""
DEFAULT_CONFIG = {
"model": "",
"providers": {},
"fallback_providers": [],
"credential_pool_strategies"... | 4,698 | 256,747 |
hermes-agent | hermes_cli/config.py | .py | """
Configuration management for Hermes Agent.
Config files are stored in ~/.hermes/ for easy access:
- ~/.hermes/config.yaml - All settings (model, toolsets, terminal, etc.)
- ~/.hermes/.env - API keys and secrets
This module provides:
- hermes config - Show current configuration
- hermes config ed... | 5,884 | 246,380 |
hermes-agent | hermes_cli/skills_hub.py | .py | #!/usr/bin/env python3
"""
Skills Hub CLI — Unified interface for the Hermes Skills Hub.
Powers both:
- `hermes skills <subcommand>` (CLI argparse entry point)
- `/skills <subcommand>` (slash command in the interactive chat)
All logic lives in shared do_* functions. The CLI entry point and slash command
handler a... | 2,076 | 82,532 |
hermes-agent | hermes_cli/subcommands/skills.py | .py | """``hermes skills`` subcommand parser.
Extracted from ``hermes_cli/main.py:main()`` (god-file Phase 2 follow-up).
Handler injected to avoid importing ``main``.
"""
from __future__ import annotations
from typing import Callable
def build_skills_parser(subparsers, *, cmd_skills: Callable) -> None:
"""Attach the... | 322 | 11,770 |
hermes-agent | hermes_cli/subcommands/cron.py | .py | """``hermes cron`` subcommand parser.
Extracted verbatim from ``hermes_cli/main.py:main()`` — same arguments, same
``func=cmd_cron`` dispatch. The handler is injected so this module does not
import ``main`` (cycle avoidance).
"""
from __future__ import annotations
from typing import Callable
from hermes_cli.subcomm... | 284 | 10,467 |
hermes-agent | hermes_cli/web_routers/mcp.py | .py | """MCP dashboard routes (extracted verbatim from web_server.py).
Handler bodies are byte-identical. The OAuth flow registry
(``_mcp_oauth_flows`` + lock + pending cap) and the worker/helpers stay in
web_server - reached via the late-binding seam in :mod:`hermes_cli.web_deps`
(``late`` for callables, ``LateState`` for... | 555 | 22,715 |
hermes-agent | hermes_cli/web_routers/cron.py | .py | """Cron dashboard routes (extracted verbatim from web_server.py).
Handler bodies are byte-identical. The ``*_sync`` workers, profile resolution
and the threadpool wrapper (``_run_cron_dashboard_io``) still live in
web_server — reached via the late-binding seam in :mod:`hermes_cli.web_deps`
so ``monkeypatch.setattr(we... | 321 | 14,464 |
hermes-agent | tools/approval.py | .py | """Dangerous command approval -- detection, prompting, and per-session state.
This module is the single source of truth for the dangerous command system:
- Pattern detection (DANGEROUS_PATTERNS, detect_dangerous_command)
- Per-session approval state (thread-safe, keyed by session_key)
- Approval prompting (CLI interac... | 5,394 | 242,436 |
hermes-agent | tools/code_execution_tool.py | .py | #!/usr/bin/env python3
"""
Code Execution Tool -- Programmatic Tool Calling (PTC)
Lets the LLM write a Python script that calls Hermes tools via RPC,
collapsing multi-step tool chains into a single inference turn.
Architecture (two transports):
**Local backend (UDS):**
1. Parent generates a `hermes_tools.py` stu... | 2,216 | 91,701 |
hermes-agent | tools/xai_http.py | .py | """Shared helpers for direct xAI HTTP integrations."""
from __future__ import annotations
import datetime
import json
import os
import uuid
from typing import Any, Dict, Optional
MAX_XAI_STORAGE_EXPIRES_AFTER_SECONDS = 30 * 24 * 60 * 60
SAFE_XAI_STORAGE_EXPIRES_AFTER_SECONDS = 2 * 24 * 60 * 60
def has_xai_credent... | 390 | 14,993 |
hermes-agent | tools/mcp_oauth_manager.py | .py | #!/usr/bin/env python3
"""Central manager for per-server MCP OAuth state.
One instance shared across the process. Holds per-server OAuth provider
instances and coordinates:
- **Cross-process token reload** via mtime-based disk watch. When an external
process (e.g. a user cron job) refreshes tokens on disk, the next... | 871 | 38,496 |
hermes-agent | tools/tts_tool.py | .py | #!/usr/bin/env python3
"""
Text-to-Speech Tool Module
Built-in TTS providers:
- Edge TTS (default, free, no API key): Microsoft Edge neural voices
- ElevenLabs (premium): High-quality voices, needs ELEVENLABS_API_KEY
- OpenAI TTS: Good quality, needs OPENAI_API_KEY
- MiniMax TTS: High-quality with voice cloning, needs... | 4,506 | 178,306 |
hermes-agent | tools/delegate_tool.py | .py | #!/usr/bin/env python3
"""
Delegate Tool -- Subagent Architecture
Spawns child AIAgent instances with isolated context, inherited toolsets,
and their own terminal sessions. Supports single-task and batch (parallel)
modes. Top-level model calls run in the background; orchestrator children
wait for their own workers so ... | 4,767 | 211,664 |
hermes-agent | tools/skill_ledger.py | .py | """Per-mutation skill audit ledger + single-edit rollback (tracker #79686 P3).
Every skill mutation — regardless of actor — appends one JSONL entry to
``~/.hermes/skills/.curator_ledger.jsonl`` describing who changed what, with
before/after file manifests whose contents are stored content-addressed
(sha256-deduped) un... | 389 | 14,168 |
hermes-agent | tools/mcp_oauth.py | .py | #!/usr/bin/env python3
"""
MCP OAuth 2.1 Client Support
Implements the browser-based OAuth 2.1 authorization code flow with PKCE
for MCP servers that require OAuth authentication instead of static bearer
tokens.
Uses the MCP Python SDK's ``OAuthClientProvider`` (an ``httpx.Auth`` subclass)
which handles discovery, dy... | 1,591 | 68,334 |
hermes-agent | tools/file_operations.py | .py | #!/usr/bin/env python3
"""
File Operations Module
Provides file manipulation capabilities (read, write, patch, search) that work
across all terminal backends (local, docker, ssh, singularity, modal, daytona, vercel_sandbox).
The key insight is that all file operations can be expressed as shell commands,
so we wrap th... | 3,411 | 156,997 |
hermes-agent | tools/delegation_live_log.py | .py | """Live, tail-able transcripts for delegated subagents.
Every ``delegate_task`` dispatch creates one append-only, human-readable log
per child under::
<hermes_home>/cache/delegation/live/<delegation_id>/task-<n>.log
The files are pre-created with a header at dispatch time (so ``tail -f``
attaches immediately) an... | 430 | 18,191 |
hermes-agent | tools/x_search_tool.py | .py | #!/usr/bin/env python3
"""X Search tool backed by xAI's built-in ``x_search`` Responses API tool.
Authentication
--------------
The tool registers when **either** xAI credential path is available:
* ``XAI_API_KEY`` is set in ``~/.hermes/.env`` or the process environment
(paid xAI API key), OR
* The user is signed i... | 564 | 21,292 |
hermes-agent | tools/bot_mode_probe.py | .py | """Bot Mode roster probe — canonical Bot Chat system prompt section.
When the desktop's Bot Mode manages this install (any profile carries a
``ui_meta['hermes-bots']`` block in its profile.yaml), a bot's canonical
"Bot Chat" session — and ONLY that session — gets a short "Messaging other
agents" section so the bot can... | 297 | 12,335 |
hermes-agent | tools/skill_usage.py | .py | """Skill usage telemetry + provenance tracking for the Curator feature.
Tracks per-skill usage metadata in a sidecar JSON file (~/.hermes/skills/.usage.json)
keyed by skill name. Counters are bumped by the existing skill tools (skill_view,
skill_manage); the curator orchestrator reads the derived activity timestamp to... | 1,377 | 52,676 |
hermes-agent | tools/terminal_hints.py | .py | """Output-pattern failure hints for the terminal tool.
When a command exits non-zero, the raw stderr often confuses models into
wasted diagnostic turns (e.g. retrying `python` when only `python3` exists,
or re-sending a gh field list that the installed gh doesn't support).
This module extends the exit-code semantics ... | 276 | 11,827 |
hermes-agent | tools/checkpoint_manager.py | .py | """
Checkpoint Manager — Transparent filesystem snapshots via a single shared
shadow git store.
Creates automatic snapshots of working directories before file-mutating
operations (``write_file``, ``patch``, ``terminal`` with destructive flags),
triggered once per conversation turn. Provides rollback to any previous
c... | 2,165 | 84,662 |
hermes-agent | tools/cronjob_tools.py | .py | """
Cron job management tools for Hermes Agent.
Expose a single compressed action-oriented tool to avoid schema/context bloat.
Compatibility wrappers remain for direct Python callers and legacy tests.
"""
import json
import logging
import re
import sys
import threading
import time
from pathlib import Path
from typing... | 1,805 | 87,902 |
hermes-agent | tools/plugin_guard.py | .py | #!/usr/bin/env python3
"""
Plugin Guard — Security scanner for externally-installed plugins.
Inspired by Claude Cowork's skill & plugin security scanning (announced
2026-08-06: third-party skills and plugins are automatically checked for
malicious content when someone uploads or edits them, returning pass /
warn / fai... | 343 | 12,281 |
hermes-agent | tools/terminal_tool.py | .py | #!/usr/bin/env python3
"""
Terminal Tool Module
A terminal tool that executes commands in local, Docker, Modal, SSH,
Singularity, Daytona, and Vercel Sandbox environments. Supports local
execution, containerized backends, and cloud sandboxes, including managed
Modal mode.
Environment Selection (via TERMINAL_ENV envir... | 3,936 | 176,605 |
hermes-agent | tools/lazy_deps.py | .py | """
Lazy dependency installer for opt-in Hermes Agent backends.
Many Hermes features (Mistral TTS, ElevenLabs TTS, Honcho memory, Bedrock,
Slack, Matrix, etc.) require Python packages that not every user needs. The
historical approach was to bundle them all under ``pyproject.toml`` extras
(``hermes-agent[all]``) and i... | 1,243 | 54,603 |
hermes-agent | tools/mcp_tool.py | .py | #!/usr/bin/env python3
"""
MCP (Model Context Protocol) Client Support
Connects to external MCP servers via stdio, HTTP/StreamableHTTP, or SSE
transport, discovers their tools, and registers them into the hermes-agent
tool registry so the agent can call them like any built-in tool.
Configuration is read from ~/.herme... | 8,017 | 353,971 |
hermes-agent | tools/ansi_strip.py | .py | """Strip ANSI escape sequences from subprocess output.
Used by terminal_tool, code_execution_tool, and process_registry to clean
command output before returning it to the model. This prevents ANSI codes
from entering the model's context — which is the root cause of models
copying escape sequences into file writes.
C... | 116 | 5,238 |
hermes-agent | tools/skills_hub.py | .py | #!/usr/bin/env python3
"""
Skills Hub — Source adapters and hub state management for the Hermes Skills Hub.
This is a library module (not an agent tool). It provides:
- GitHubAuth: Shared GitHub API authentication (PAT, gh CLI, GitHub App)
- SkillSource ABC: Interface for all skill registry adapters
- OptionalSk... | 4,622 | 181,775 |
hermes-agent | tools/process_registry.py | .py | """
Process Registry -- In-memory registry for managed background processes.
Tracks processes spawned via terminal(background=true), providing:
- Output buffering (rolling 200KB window)
- Status polling and log retrieval
- Blocking wait with interrupt support
- Process killing
- Crash recovery via JSON check... | 3,067 | 137,886 |
hermes-agent | tools/image_generation_tool.py | .py | #!/usr/bin/env python3
"""
Image Generation Tools Module
Provides image generation via FAL.ai. Multiple FAL models are supported and
selectable via ``hermes tools`` → Image Generation; the active model is
persisted to ``image_gen.model`` in ``config.yaml``.
Architecture:
- ``FAL_MODELS`` is a catalog of supported mod... | 2,042 | 80,428 |
hermes-agent | tools/skill_manager_tool.py | .py | #!/usr/bin/env python3
"""
Skill Manager Tool -- Agent-Managed Skill Creation & Editing
Allows the agent to create, update, and delete skills, turning successful
approaches into reusable procedural knowledge. New skills are created in
~/.hermes/skills/. Existing skills (bundled, hub-installed, or user-created)
can be ... | 1,850 | 72,879 |
hermes-agent | tools/environments/local.py | .py | """Local execution environment — spawn-per-call with session snapshot."""
import logging
import ntpath
import os
import platform
import re
import shutil
import signal
import subprocess
import sys
import tempfile
import time
from collections.abc import Mapping
from pathlib import Path
from tools.environments.base impo... | 1,918 | 82,138 |
hermes-agent | tools/computer_use/browser_route.py | .py | """Session-scoped typed-browser routing for cua-driver.
The public model surface remains the single ``computer_use`` tool. This
module owns the stateful adapter between its namespaced ``cua_browser_*``
actions and cua-driver's raw ``get_browser_state`` / ``browser_*`` tools.
The adapter is deliberately stricter than... | 645 | 25,950 |
hermes-agent | tools/computer_use/cua_backend.py | .py | """Cua-driver backend (macOS, Windows, Linux).
Speaks MCP over stdio to `cua-driver`. The Python `mcp` SDK is async, so we
run a dedicated asyncio event loop on a background thread and marshal sync
calls through it.
The same `cua-driver call <tool>` surface (click, type_text, hotkey, drag,
scroll, screenshot, launch_... | 3,956 | 175,373 |
hermes-agent | tools/computer_use/schema.py | .py | """Schema for the generic `computer_use` tool.
Model-agnostic. Any tool-calling model can drive this. Vision-capable models
should prefer `capture(mode='som')` then `click(element=N)` — much more
reliable than pixel coordinates. Pixel coordinates remain supported for
models that were trained on them (e.g. Claude's com... | 376 | 18,481 |
hermes-agent | tools/computer_use/tool.py | .py | """Entry point for the `computer_use` tool.
Universal (any-model) desktop control across macOS, Windows, and Linux via
cua-driver's background computer-use primitive. Replaces #4562's
Anthropic-native `computer_20251124` approach — the schema here is standard
OpenAI function-calling so every tool-capable model can dri... | 1,830 | 77,560 |
hermes-agent | tests/test_session_db_context_manager.py | .py | """``SessionDB`` must support ``with``, so an owning scope releases its fds.
Historically a SessionDB handle could not be released by dropping the last
reference: once its background token writer started, the instance pinned
ITSELF two ways (the writer thread's bound-method target, and a strong
``atexit`` drain hook t... | 101 | 3,908 |
hermes-agent | tests/test_tui_gateway_queue_on_busy.py | .py | """A prompt that lands mid-turn is redirected or queued, never dropped.
Before this, ``prompt.submit`` on a running session returned ``session busy``,
forcing clients into a deadline-bounded busy-retry. When turn teardown outlived
the deadline — e.g. a slow, non-interruptible tool (``web_search``) still
running when t... | 783 | 29,769 |
hermes-agent | tests/test_install_scripts_computer_use.py | .py | """Regression tests: installers provision cua-driver (Computer Use).
Policy: choosing Computer Use should be a config flip, not a surprise
multi-minute binary fetch. The installers pre-install cua-driver
(best-effort, skippable), and the dashboard toggle auto-installs when the
binary is still missing (see test_web_rou... | 77 | 3,204 |
hermes-agent | tests/test_compression_watermark_commit.py | .py | """Watermark commit: concurrent appends survive in-place compaction (#75316).
The provider summary call is external and slow. Messages that arrive while it
runs must (a) persist immediately — appends are not fenced by the compression
lock — and (b) survive the commit: ``archive_and_compact(watermark=...)``
re-sequence... | 315 | 12,995 |
hermes-agent | tests/test_hermes_state_compression_busy_retry.py | .py | """Appends flow freely during compression; the commit preserves them (#75316).
HISTORY: ``append_message`` used to refuse while another writer held the
session's compression lock, with a short busy-wait (#75264 → #75083). That
fenced ordinary transcript writes behind a lease whose real job is stopping
two COMPRESSIONS... | 106 | 4,119 |
hermes-agent | tests/test_mcp_serve.py | .py | """
Tests for mcp_serve — Hermes MCP server.
Three layers of tests:
1. Unit tests — helpers, content extraction, attachment parsing
2. EventBridge tests — queue mechanics, cursors, waiters, concurrency
3. End-to-end tests — call actual MCP tools through the MCPServer's public API
with real session data in SQLite an... | 1,427 | 56,487 |
hermes-agent | tests/test_gitlock.py | .py | """Tests for hermes_cli.gitlock — stale git lock recovery + ancestry probe.
These cover the two failure modes that produced the false "update available"
notification and the hard ``update --check`` failure after a crashed fetch on
a shallow clone:
1. A stale ``.git/shallow.lock`` makes every later ``git fetch`` fail ... | 140 | 5,159 |
hermes-agent | tests/test_batch_runner_exit_code.py | .py | """Regression tests for batch_runner process exit codes.
Python Fire serializes the return value of the wrapped function but does not
use it as the process exit code. Before the fix, all of ``main``'s error paths
returned ``0`` because a bare ``return`` or ``return 1`` was treated as the
function result, not a non-ze... | 65 | 1,805 |
hermes-agent | tests/test_hermes_state.py | .py | """Tests for hermes_state.py — SessionDB SQLite CRUD, FTS5 search, export."""
import sqlite3
import time
import json
import threading
from pathlib import Path
from unittest import mock
import pytest
import hermes_state
from agent.session_activity import ActivityProvenance
from hermes_state import SCHEMA_SQL, SCHEMA_... | 5,043 | 196,969 |
hermes-agent | tests/tui_gateway/test_slash_worker_mcp_discovery.py | .py | """Integration coverage for profile-local MCP discovery in slash workers."""
from __future__ import annotations
import json
import os
from pathlib import Path
import queue
import subprocess
import sys
import textwrap
import threading
import pytest
import yaml
_mcp_server_mod = pytest.importorskip("mcp.server")
if ... | 115 | 3,372 |
hermes-agent | tests/tui_gateway/test_protocol.py | .py | """Tests for tui_gateway JSON-RPC protocol plumbing."""
import io
import json
import sys
import threading
import time
import types
from unittest.mock import MagicMock, patch
from pathlib import Path
import pytest
_original_stdout = sys.stdout
@pytest.fixture(autouse=True)
def _restore_stdout():
yield
sys.s... | 1,013 | 36,413 |
hermes-agent | tests/tui_gateway/test_session_resume_db_ownership.py | .py | """``session.resume`` must not abandon the profile-scoped SessionDB it opens.
In app-global remote mode a resume for another local profile opens a DEDICATED
``SessionDB(db_path=<profile>/state.db)`` handle (the ``session.resume`` handler
in tui_gateway/methods_session.py). That handle is the caller's to close until
it... | 336 | 12,823 |
hermes-agent | tests/hermes_cli/test_gateway_restart_loop.py | .py | """Tests for gateway restart-loop defenses (#30719).
Covers:
- Defense 1: gateway stop/restart refuse when _HERMES_GATEWAY=1
- Defense 2: cron create rejects prompts containing gateway lifecycle commands
- _contains_gateway_lifecycle_command pattern matching
"""
import json
import os
from argparse import Namespace
i... | 1,424 | 62,571 |
hermes-agent | tests/hermes_cli/test_chat_c_fail_loudly.py | .py | """Tests for `chat -c <title>` failing loudly (stderr) and `--create-if-missing`.
Regression for #86794: a background/quiet `hermes chat -c "<title>" -q "..."`
against a not-yet-existing titled session silently no-oped — the error message
was written to stdout (which quiet/programmatic callers treat as the "final
resp... | 160 | 5,302 |
hermes-agent | tests/hermes_cli/test_web_server_gateway_topology.py | .py | """Tests for the /api/status profile + gateway topology readout.
Covers the loopback-only ``profiles`` / ``gateway_mode`` / ``gateways`` fields
added to ``/api/status``: profile enumeration, single vs multiplex vs multiple
gateway detection, and per-platform port resolution.
"""
import pytest
from hermes_cli import ... | 538 | 21,542 |
hermes-agent | tests/hermes_cli/test_aux_config.py | .py | """Tests for the auxiliary-model configuration UI in ``hermes model``.
Covers the helper functions:
- ``_save_aux_choice`` writes to config.yaml without touching main model config
- ``_reset_aux_to_auto`` clears routing fields but preserves timeouts
- ``_format_aux_current`` renders current task config for the m... | 202 | 7,271 |
hermes-agent | tests/hermes_cli/test_sessions_delete.py | .py | import sys
import pytest
def test_sessions_delete_accepts_unique_id_prefix(monkeypatch, capsys):
import hermes_cli.main as main_mod
import hermes_state
captured = {}
class FakeDB:
def resolve_session_id(self, session_id):
captured["resolved_from"] = session_id
return... | 130 | 3,967 |
hermes-agent | tests/hermes_cli/test_sessions_pin.py | .py | """CLI pin / unpin / pinned subcommands (issue #52955).
Pin state is the durable "keep" flag in state.db that the Desktop sidebar
writes; these tests pin the CLI's read/write access to the SAME store
(SessionDB.set_session_pinned / list_sessions_rich(include_pinned=True)),
not a client-local list.
"""
import json
imp... | 139 | 4,168 |
hermes-agent | tests/hermes_cli/test_bedrock_mantle_key_env.py | .py | """Bedrock API-key setup must produce a config that actually authenticates.
The wizard used to stash the Bedrock bearer token in ``OPENAI_API_KEY`` and set
a bare ``provider: custom``. Since the cross-provider credential gate landed
(#28660) that variable is only honoured for ``openai.com`` hosts, so the token
was sil... | 108 | 4,093 |
hermes-agent | tests/hermes_cli/test_install_cua_driver.py | .py | """Tests for ``install_cua_driver`` upgrade semantics.
The cua-driver upstream installer always pulls the latest release tag, so
re-running it is the canonical upgrade path. ``install_cua_driver(upgrade=True)``
must:
* Be supported-platform-only — no-op silently elsewhere so ``hermes update``
can call it unconditio... | 1,377 | 56,124 |
hermes-agent | tests/hermes_cli/test_gateway_service.py | .py | """Tests for gateway service management helpers."""
import os
import plistlib
import subprocess
from pathlib import Path
from types import SimpleNamespace
import pytest
pwd = pytest.importorskip("pwd")
grp = pytest.importorskip("grp")
import hermes_cli.gateway as gateway_cli
from gateway import status
from gateway.... | 2,150 | 90,631 |
hermes-agent | tests/hermes_cli/test_auth_provider_scope.py | .py | """resolve_provider auto-detection must read provider keys through the
profile secret scope under multiplex (#86917).
A secondary profile whose config uses ``model.provider: auto`` and whose
API key lives only in its profile ``.env`` (installed per-turn as the
secret scope) failed with "No LLM provider configured": th... | 83 | 2,825 |
hermes-agent | tests/hermes_cli/test_post_setup_gating.py | .py | """Tests for the post_setup install-state gate in `_toolset_needs_configuration_prompt`.
Regression coverage for the cua-driver silent-no-op bug (issue #22737).
When a no-key provider's only install side-effect is a `post_setup` hook
(cua-driver, etc.), the gate function used to fall through to the
`_toolset_has_keys... | 60 | 2,338 |
hermes-agent | tests/hermes_cli/test_bounded_probe_run.py | .py | """``bounded_probe_run`` — deadlock-safe capture for fail-open probes (#87134).
On Windows, ``subprocess.run(..., capture_output=True, timeout=N)`` can hang
FOREVER after its timeout fires: run()'s cleanup kills the direct child and
then joins the pipe reader threads with an unbounded ``communicate()``. A
descendant ... | 113 | 4,458 |
hermes-agent | tests/hermes_cli/test_tools_config.py | .py | """Tests for hermes_cli.tools_config platform tool persistence."""
import logging
import subprocess
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from tools.browser_tool import AGENT_BROWSER_NPX_SPEC
from hermes_cli.nous_account import NousPortalAccountInfo, NousToolAccessInfo
from ... | 1,202 | 47,546 |
hermes-agent | tests/hermes_cli/test_skills_hub.py | .py | from io import StringIO
from unittest.mock import patch
import pytest
from rich.console import Console
from cli import ChatConsole
from hermes_cli.skills_hub import do_check, do_install, do_list, do_update, handle_skills_slash
class _DummyLockFile:
def __init__(self, installed):
self._installed = instal... | 397 | 14,525 |
hermes-agent | tests/hermes_cli/test_config_set_list_values.py | .py | """``hermes config set`` must parse list/mapping literals, not store them as strings.
Before this fix, ``hermes config set platform_toolsets.discord '["file","web"]'``
stored the value as a raw STRING. Every reader that gates on
``isinstance(..., list)`` — ``_get_platform_tools``, ``_get_enabled_set``,
``_get_disabled... | 162 | 6,183 |
hermes-agent | tests/hermes_cli/test_gateway_foreign_xdg_runtime.py | .py | """Regression tests for a foreign/leaked ``XDG_RUNTIME_DIR`` in the user-systemd
preflight (#86558).
``runuser``/``su``/``sudo -u`` from a root shell leaks ``XDG_RUNTIME_DIR=/run/user/0``
into the child. The user-systemd preflight then stat-ed sockets under that
``0700 root:root`` directory with a bare ``Path.exists()... | 142 | 6,242 |
hermes-agent | tests/hermes_cli/test_computer_use_cli.py | .py | """CLI coverage for the public Computer Use command surface."""
from __future__ import annotations
import subprocess
import sys
from importlib import import_module
from unittest.mock import Mock
import pytest
def _run(*args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
[sys.executab... | 167 | 5,422 |
hermes-agent | tests/hermes_cli/test_gateway.py | .py | """Tests for hermes_cli.gateway."""
import argparse
import json
import os
import signal
import subprocess
import sys
import textwrap
from types import ModuleType, SimpleNamespace
import pytest
import hermes_cli.gateway as gateway
_BREAKAWAY_MARKER = "_HERMES_GATEWAY_BREAKAWAY"
def _install_fake_gateway_run(monke... | 1,005 | 41,941 |
hermes-agent | tests/hermes_cli/test_backup.py | .py | """Tests for hermes backup and import commands."""
import json
import os
import sqlite3
import stat
import zipfile
from argparse import Namespace
from pathlib import Path
from unittest.mock import patch
import pytest
# ---------------------------------------------------------------------------
# Helpers
# ---------... | 1,713 | 67,812 |
hermes-agent | tests/hermes_cli/test_update_version_report.py | .py | """Version transition reporting after ``hermes update``.
Ported from PrimeIntellect-ai/prime-agent#630: a successful self-update
reports both versions (``v0.19.4 → v0.20.0``) when the pyproject version
changed, and degrades gracefully when either side is unknown.
"""
from pathlib import Path
import pytest
from herm... | 68 | 2,194 |
hermes-agent | tests/hermes_cli/test_cmd_update.py | .py | """Tests for cmd_update — branch fallback when remote branch doesn't exist."""
import hashlib
import subprocess
from types import SimpleNamespace
from unittest.mock import ANY, patch
import pytest
from hermes_cli.main import cmd_update, PROJECT_ROOT
def _make_run_side_effect(branch="main", verify_ok=True, commit_c... | 1,239 | 52,550 |
hermes-agent | tests/hermes_cli/test_plugin_index_search.py | .py | """Tests for the community plugin index (#64181).
Covers: index parsing, fuzzy search, cache TTL + fallback chain
(remote → cache → seed), `hermes plugins search --json`, and install-time
name resolution (unique / ambiguous / passthrough of owner/repo).
No live network — every remote fetch is mocked.
"""
from __futur... | 499 | 18,513 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.