description:Send files to users via MEDIA protocol (native attachments) or Markdown links (workspace files) — path rules, Windows quirks, Chinese filename handling, and per-platform limitations.
version:1.3.0
version:1.4.0
author:Hermes Agent
platforms:[windows,linux,macos]
metadata:
...
...
@@ -21,358 +21,163 @@ Hermes detects the `MEDIA:` prefix, validates the path against security rules, a
---
## Quick Reference (常见问题速查)
## ⛔ 核心规则(必须遵守)
| 问题现象 | 可能原因 | 解决方案 |
|---------|---------|---------|
| `Skipping unsafe MEDIA directive path` | Windows 路径格式错误 | 使用 `C:/...` 而非 `/c/...` |
-`~/.hermes/.env`, `~/.hermes/auth.json`, and other credential stores under HERMES_HOME
### Strict Mode
Opt-in via `config.yaml` -> `gateway.strict: true` or `HERMES_MEDIA_DELIVERY_STRICT=1`. In strict mode, files are only accepted if they:
1. Live under an allowlisted root (safe roots above), **or**
2. Were **recently produced** (within the recency window, default 1 second)
Use `HERMES_MEDIA_ALLOW_DIRS` env var to add custom allowlisted roots in strict mode.
-`~/.hermes/.env`, `~/.hermes/auth.json` 等凭据文件
---
## 2. Path Format
### 2.1 Windows Path Format (CRITICAL GOTCHA)
**On Windows, always use `C:/Users/...` format, NOT `/c/Users/...` (git-bash/MSYS format).**
## 2. Windows 路径格式(关键)
The MEDIA validation runs through Python's `Path.resolve(strict=True)`, which on Windows interprets `/c/Users/...` as a **relative** path (`\c\Users\...` off the current C: drive), not an absolute one. This causes the file to be reported as nonexistent and the path to be skipped as "unsafe".