What This Skill Does
This skill enables you to control aria2 download manager through natural language commands:
- - Download files (HTTP/HTTPS/FTP/Magnet/Torrent/Metalink)
- Monitor download progress and status
- Control downloads (pause, resume, remove)
- Manage batch operations (pause all, resume all)
- View statistics and configure options
How to Use (For AI Agents)
⚠️ CRITICAL: DO NOT manually construct JSON-RPC requests.
✅ ALWAYS use the Python scripts in the scripts/ directory.
⚠️ IMPORTANT: Use python3 command, NOT python (especially on macOS where python symlink doesn't exist)
Workflow (MUST FOLLOW)
Step 1: Check Configuration Status
Before executing any aria2 commands, ALWAYS check if configuration is ready:
CODEBLOCK0
- - If successful: Proceed to execute user's command
- If failed: Guide user to initialize configuration (see Step 2)
Step 2: Initialize Configuration (if needed)
If connection test fails, guide user to set up configuration:
CODEBLOCK1
Then instruct user to edit the generated config file with their aria2 server details.
Step 3: Execute User Commands
Once configuration is ready, execute the requested aria2 operations.
Example Workflow
User: "download http://example.com/file.zip"
You execute:
CODEBLOCK2
If test passes:
CODEBLOCK3
You respond: "✓ Download started! GID: 2089b05ecca3d829"
If test fails:
CODEBLOCK4
Documentation Structure
For detailed execution instructions, see:
- Command mapping table (user intent → script call)
- Parameter formatting rules
- Step-by-step examples
- Common mistakes to avoid
- Response formatting guidelines
For aria2 method reference, see:
Common Commands Quick Reference
| User Intent | Command Example |
|---|
| Download a file | INLINECODE4 |
| Check status |
python3 scripts/rpc_client.py aria2.tellStatus <GID> |
| List active downloads |
python3 scripts/rpc_client.py aria2.tellActive |
| List stopped downloads |
python3 scripts/rpc_client.py aria2.tellStopped 0 100 |
| Pause download |
python3 scripts/rpc_client.py aria2.pause <GID> |
| Resume download |
python3 scripts/rpc_client.py aria2.unpause <GID> |
| Show statistics |
python3 scripts/rpc_client.py aria2.getGlobalStat |
| Show version |
python3 scripts/rpc_client.py aria2.getVersion |
| Purge results |
python3 scripts/rpc_client.py aria2.purgeDownloadResult |
For detailed usage and more commands, see execution-guide.md.
Available Scripts
- -
scripts/rpc_client.py - Main interface for RPC calls - INLINECODE14 - Formatted download list
- INLINECODE15 - Pause all downloads
- INLINECODE16 - Add torrent downloads
- INLINECODE17 - Real-time monitoring
- INLINECODE18 - Modify options
Configuration
Scripts automatically load configuration from multiple sources with the following priority (highest to lowest):
Configuration Priority
- 1. Environment Variables (highest priority - temporary override)
-
ARIA2_RPC_HOST,
ARIA2_RPC_PORT,
ARIA2_RPC_PATH, etc.
- Best for: CI/CD pipelines, temporary overrides, testing
-
Note: For reference only. Agents should use config files instead.
- 2. Skill Directory Config (project-specific configuration)
- Location:
skills/aria2-json-rpc/config.json
- Best for: Project-specific settings, local testing, development
- ⚠️
Warning: Lost when running
npx skills add to update the skill
- 3. User Config Directory (global fallback, update-safe) 🆕
- Location:
~/.config/aria2-skill/config.json
- Best for: Personal default settings across all projects
- ✅
Safe: Survives skill updates via INLINECODE25
- 4. Defaults (localhost:6800)
- Zero-configuration fallback for local development
Configuration Options
- - host: Hostname or IP address (default:
localhost) - port: Port number (default:
6800) - path: URL path (default:
null). Set to /jsonrpc for standard aria2, or custom path for reverse proxy - secret: RPC secret token (default:
null) - secure: Use HTTPS instead of HTTP (default:
false) - timeout: Request timeout in milliseconds (default:
30000)
Quick Setup (For AI Agents)
IMPORTANT: Always use Python scripts to manage configuration. Do NOT use shell commands directly.
Step 1: Check current configuration status
CODEBLOCK5
Step 2: Initialize configuration if needed
User config (recommended - survives updates):
CODEBLOCK6
Local config (project-specific):
CODEBLOCK7
Step 3: Guide user to edit the config file
After initialization, the tool will display the config file path. Instruct user to edit it with their aria2 server details (host, port, secret, etc.).
Step 4: Verify configuration
CODEBLOCK8
Example config file content:
CODEBLOCK9
Configuration Management (For AI Agents)
Available Python scripts for configuration management:
CODEBLOCK10
Agent Workflow for Configuration Setup:
- 1. Check if config exists: Run INLINECODE33
- If config missing or invalid: Guide user to run INLINECODE34
- User edits config: Tell user the file path and required fields (host, port, secret)
- Verify setup: Run INLINECODE35
- Proceed with operations: Once test passes, execute user's aria2 commands
Advanced Configuration
Reverse Proxy Setup:
For reverse proxy setups like https://example.com:443/jsonrpc, the config file should contain:
CODEBLOCK11
Environment Variables (for reference only):
Configuration can also be overridden via environment variables:
- -
ARIA2_RPC_HOST: Hostname - INLINECODE38 : Port number
- INLINECODE39 : URL path
- INLINECODE40 : Secret token
- INLINECODE41 : "true" or "false"
Note: Use Python scripts for configuration management. Environment variables are documented here for reference only.
Key Principles (For AI Agents)
- 1. Never construct JSON-RPC requests manually
- Always call Python scripts via Bash tool using
python3 (not python) - Always check configuration before executing commands:
- Run
python3 scripts/config_loader.py test first
- If test fails, guide user through initialization
- 4. Never run raw shell commands (mkdir, cat, export, etc.) directly
- Use Python scripts:
config_loader.py init,
config_loader.py show, etc.
- 5. Parse script output and format for users
- Refer to execution-guide.md when unsure
Supported Operations
Download Management
- - Add downloads (HTTP/FTP/Magnet/Torrent/Metalink)
- Pause/resume (individual or all)
- Remove downloads
- Add with custom options
Monitoring
- - Check download status
- List active/waiting/stopped downloads
- Get global statistics
- Real-time monitoring
Configuration
- - Get/change download options
- Get/change global options
- Query aria2 version
- List available methods
Maintenance
- - Purge download results
- Remove specific results
Need Help?
技能功能
本技能让您能够通过自然语言命令控制 aria2 下载管理器:
- - 下载文件(HTTP/HTTPS/FTP/Magnet/种子/Metalink)
- 监控下载进度和状态
- 控制下载(暂停、恢复、删除)
- 管理批量操作(全部暂停、全部恢复)
- 查看统计信息并配置选项
使用方法(面向AI代理)
⚠️ 关键:请勿手动构造 JSON-RPC 请求。
✅ 始终使用 scripts/ 目录中的 Python 脚本。
⚠️ 重要:使用 python3 命令,而非 python(特别是在 macOS 上,python 符号链接不存在)
工作流程(必须遵循)
步骤 1:检查配置状态
在执行任何 aria2 命令之前,始终检查配置是否就绪:
bash
python3 scripts/config_loader.py test
- - 如果成功:继续执行用户命令
- 如果失败:引导用户初始化配置(参见步骤 2)
步骤 2:初始化配置(如需)
如果连接测试失败,引导用户设置配置:
bash
推荐:用户配置(技能更新后仍保留)
python3 scripts/config_loader.py init --user
备选:本地配置(项目特定)
python3 scripts/config_loader.py init --local
然后指导用户编辑生成的配置文件,填入 aria2 服务器详情。
步骤 3:执行用户命令
配置就绪后,执行请求的 aria2 操作。
工作流程示例
用户: 下载 http://example.com/file.zip
您执行:
bash
1. 检查配置
python3 scripts/config_loader.py test
如果测试通过:
bash
2. 执行下载命令
python3 scripts/rpc_client.py aria2.addUri [http://example.com/file.zip]
您回复: ✓ 下载已启动!GID: 2089b05ecca3d829
如果测试失败:
配置未就绪。请初始化:
- 1. 运行:python3 scripts/configloader.py init --user
- 编辑 ~/.config/aria2-skill/config.json,填入 aria2 服务器详情
- 运行:python3 scripts/configloader.py test(验证)
文档结构
详细执行说明,请参阅:
- 命令映射表(用户意图 → 脚本调用)
- 参数格式化规则
- 分步示例
- 常见错误避免
- 回复格式指南
aria2 方法参考,请参阅:
常用命令速查
| 用户意图 | 命令示例 |
|---|
| 下载文件 | python3 scripts/rpcclient.py aria2.addUri [http://example.com/file.zip] |
| 检查状态 |
python3 scripts/rpcclient.py aria2.tellStatus
|
| 列出活跃下载 | python3 scripts/rpc_client.py aria2.tellActive |
| 列出已停止下载 | python3 scripts/rpc_client.py aria2.tellStopped 0 100 |
| 暂停下载 | python3 scripts/rpc_client.py aria2.pause |
| 恢复下载 | python3 scripts/rpc_client.py aria2.unpause |
| 显示统计信息 | python3 scripts/rpc_client.py aria2.getGlobalStat |
| 显示版本 | python3 scripts/rpc_client.py aria2.getVersion |
| 清除结果 | python3 scripts/rpc_client.py aria2.purgeDownloadResult |
详细用法和更多命令,请参阅 execution-guide.md。
可用脚本
- - scripts/rpc_client.py - RPC 调用的主接口
- scripts/examples/list-downloads.py - 格式化下载列表
- scripts/examples/pause-all.py - 暂停所有下载
- scripts/examples/add-torrent.py - 添加种子下载
- scripts/examples/monitor-downloads.py - 实时监控
- scripts/examples/set-options.py - 修改选项
配置
脚本自动从多个来源加载配置,优先级如下(从高到低):
配置优先级
- 1. 环境变量(最高优先级 - 临时覆盖)
- ARIA2RPCHOST、ARIA2RPCPORT、ARIA2RPCPATH 等
- 最佳用途:CI/CD 管道、临时覆盖、测试
- 注意:仅供参考。代理应使用配置文件。
- 2. 技能目录配置(项目特定配置)
- 位置:skills/aria2-json-rpc/config.json
- 最佳用途:项目特定设置、本地测试、开发
- ⚠️ 警告:运行 npx skills add 更新技能时丢失
- 3. 用户配置目录(全局后备,更新安全)🆕
- 位置:~/.config/aria2-skill/config.json
- 最佳用途:跨项目的个人默认设置
- ✅ 安全:通过 npx skills add 更新技能后仍保留
- 4. 默认值(localhost:6800)
- 本地开发的零配置后备方案
配置选项
- - host:主机名或 IP 地址(默认:localhost)
- port:端口号(默认:6800)
- path:URL 路径(默认:null)。标准 aria2 设为 /jsonrpc,反向代理设为自定义路径
- secret:RPC 密钥令牌(默认:null)
- secure:使用 HTTPS 而非 HTTP(默认:false)
- timeout:请求超时时间,单位毫秒(默认:30000)
快速设置(面向AI代理)
重要:始终使用 Python 脚本管理配置。请勿直接使用 shell 命令。
步骤 1:检查当前配置状态
bash
python3 scripts/config_loader.py show
步骤 2:如需则初始化配置
用户配置(推荐 - 更新后保留):
bash
python3 scripts/config_loader.py init --user
本地配置(项目特定):
bash
python3 scripts/config_loader.py init --local
步骤 3:引导用户编辑配置文件
初始化后,工具将显示配置文件路径。指导用户编辑文件,填入 aria2 服务器详情(主机、端口、密钥等)。
步骤 4:验证配置
bash
python3 scripts/config_loader.py test
配置文件内容示例:
json
{
host: localhost,
port: 6800,
secret: your-secret-token,
secure: false,
timeout: 30000
}
配置管理(面向AI代理)
配置管理可用的 Python 脚本:
bash
检查当前配置及来源
python3 scripts/config_loader.py show
初始化用户配置(推荐 - 更新安全)
python3 scripts/config_loader.py init --user
初始化本地配置(项目特定)
python3 scripts/config_loader.py init --local
测试与 aria2 服务器的连接
python3 scripts/config_loader.py test
配置设置的代理工作流程:
- 1. 检查配置是否存在:运行 python3 scripts/configloader.py show
- 如果配置缺失或无效:引导用户运行 python3 scripts/configloader.py init --user
- 用户编辑配置:告知用户文件路径及必填字段(主机、端口、密钥)
- 验证设置:运行 python3 scripts/config_loader.py test
- 继续操作:测试通过后,执行用户的 aria2 命令
高级配置
反向代理设置:
对于类似 https://example.com:443/jsonrpc 的反向代理设置,配置文件应包含:
json
{
host: example.com,
port: 443,
path: /jsonrpc,
secret: your-secret-token,
secure: true
}
环境变量(仅供参考):
配置也可通过环境变量覆盖:
- - ARIA2RPCHOST:主机名
- ARIA2RPCPORT:端口号
- ARIA2RPCPATH:URL 路径
- ARIA2RPCSECRET:密钥令牌
- ARIA2RPCSECURE:true 或 false
注意:使用 Python 脚本进行配置管理。环境变量在此仅作参考。
关键原则(面向AI代理)
1.