9 Commits

Author SHA1 Message Date
514ab91e01 feat: 添加 systemd 服务安装脚本
- install-service.py: 自动生成 hermes-service.service 文件
- 自动检测 .venv Python 或系统 Python
- 所有路径基于脚本所在目录动态计算,无硬编码
- 支持 --install 一键安装到 /etc/systemd/system
- 包含安全加固: NoNewPrivileges, ProtectSystem, ProtectHome
- 日志输出到 journal,方便 systemctl status/journalctl 查看
2026-04-27 16:09:00 +08:00
32cf7e5d5a refactor: 移除硬编码路径,改用 $HOME 动态构建
- USERS_BASE: 从 /d/hermesai/users 改为 $HOME/users
- HERMES_HOME fallback: 从 /d/hermesai/.hermes 改为 $HOME/.hermes
- sys.path default_path: 从硬编码绝对路径改为动态构建
- 所有回退路径统一使用 os.environ.get('HOME', '/root')
2026-04-27 15:57:31 +08:00
5f962dcc90 fix: 修复装饰器 Request 参数与端点 body 参数名冲突
- 使用 inspect.signature 保留原函数签名并在前面追加 http_request: Request
  参数,使 FastAPI 能同时注入 Request 对象和原有的 body 参数
- 将装饰器内部的 request 引用全部改为 http_request,避免与端点函数的
  request: SessionCreateRequest 等 body 参数冲突
2026-04-27 15:53:46 +08:00
6adae569be fix: 修复 /api/v1/sessions 500 错误
- 修复 validate_ip_and_apikey 装饰器无法获取 Request 对象的问题:
  原代码通过遍历 args 查找 Request 对象,但 FastAPI 端点使用 Pydantic
  模型作为参数时找不到 Request,导致装饰器跳过验证并可能引发异常。
  改为显式声明 request: Request 作为 wrapper 的第一个参数,由 FastAPI 自动注入。

- 增强 ensure_user_hermes_env 的错误处理:
  添加 try/except 包裹,检查 BASE_HERMES_PATH 是否存在,
  将未处理的异常转为带详细信息的 HTTPException(500)。
2026-04-27 15:40:25 +08:00
2152ae9d40 fix: v1.3.0 compatibility fixes for hermes-agent
- Fix chat command args: use '-q --source tool' for non-interactive mode
  in send_session_message to avoid entering interactive CLI
- Fix auth_method KeyError: add 'auth_method: header' default in fallback config
- Persist session registry to data/sessions.json so sessions survive restarts
- Dynamic path resolution via get_hermes_home() instead of hardcoded paths
- Update README with full API documentation (v1.3.0)
- Add .gitignore for data/, __pycache__/, .venv/
2026-04-25 11:37:32 +08:00
57afe1264c feat(security): implement IP filtering and API key authentication
- Added validate_ip_and_apikey() decorator for endpoint protection
- Implemented IP address validation with configurable allowed_ips list
- Added API key authentication with header-based or bearer token support
- Fixed endpoint function signatures to properly receive Request objects
- Updated configuration structure and security documentation
- Removed debug print statements before final commit
2026-04-22 21:41:45 +08:00
4a8d3291d3 Add Bearer token authentication support for Authorization header 2026-04-22 18:43:32 +08:00
57fbe3a6c5 Add Nginx deployment support with IP and API key security features 2026-04-22 18:40:51 +08:00
7d70f362b2 feat: Initial implementation of hermes-service with multi-user support
- Complete REST API with session management
- Dynamic user creation with isolated environments
- Multi-user isolation using /d/hermesai/users/{user_id}/.hermes structure
- Full command execution capabilities via Hermes CLI
- Health check and status endpoints
- Follows module development specifications
2026-04-21 13:20:10 +08:00