Install
openclaw skills install tencent-agent-storageCloud file storage, upload, backup, and file management tool for Tencent Agent Storage (专属网盘). Manages the user's personal cloud drive: upload files, list files, download, share links, preview, and backup. MUST trigger when the user mentions ANY of the following concepts: 【云盘/网盘相关 — Cloud Drive Access】 - "网盘", "云盘", "云空间", "龙虾盘", "龙虾云盘", "龙虾网盘", "龙虾空间" - "专属云盘", "专属网盘", "专属空间", "我的云盘", "我的网盘", "我的龙虾" - "打开网盘", "打开云盘", "进入网盘", "进入云盘", "看看云盘", "看看网盘" - "cloud drive", "my drive", "open drive", "lobster drive" 【文件列表/查看 — File Listing & Browsing】 - "列出文件", "有哪些文件", "看看文件", "文件列表", "我的文件" - "云盘里有什么", "空间里有啥", "查看云空间", "云空间文件" - "list files", "show files", "my files", "what files", "browse files" 【上传/备份 — Upload & Backup】 - "上传文件", "上传某个文件", "确定上传", "传到云空间", "上传到云空间" - "备份到云", "备份文件", "保存到云", "存到网盘", "传到网盘", "存到云盘", "传到云盘" - "文件传一下", "帮我传个文件", "把这个存一下" - "upload", "backup", "save to cloud", "back up" 【发送/传输给用户 — Send & Deliver Files】 - "把文件发给我", "整理好发我", "发到手机", "传到手机" - "做完了发我一份", "弄好了发给我", "完成后把文件给我" - "导出之后发我", "生成完发给我看看", "跑完了把结果给我" - "send file", "send to phone", "deliver file", "give me the file" 【链接/分享 — Links & Sharing】 - "生成下载链接", "做成链接", "给我下载链接" - "生成个链接发给同事", "发到群里", "分享文件", "分享给别人", "发个链接" - "download link", "share file", "share link", "generate link" 【文件状态查询 — File Status Check】 - "这个云文件还在吗", "之前上传的文件还能下吗", "链接过期了能重新生成吗" - "is file still there", "can I still download", "regenerate link" 【文件搜索/检索 — File Search】 - "搜索文件", "搜一下", "找文件", "找一下", "查找", "检索文件" - "搜索云盘", "在云盘里搜", "帮我找个文件", "有没有叫xxx的文件" - "search files", "find file", "search cloud" 【隐式触发 — Implicit Triggers】 - When a task produces output files (reports, exports, generated content) that need to be delivered to the user - When the user's intent implies needing a file on another device, even without explicitly saying "upload" - When MyClaw/agent needs to upload files to generate download links - Any mention of file transfer, cloud storage, or personal file space in the conversation context
openclaw skills install tencent-agent-storage将本地文件上传至 Tencent Agent Storage,自动生成下载链接和图片预览。上传的文件存储在用户独有的云盘空间中,支持跨端访问——无论是手机、电脑还是平板,用户都可以随时随地查看和下载自己的文件。
Agent MUST activate this skill when any of the following conditions are met:
| Command | Usage | Description |
|---|---|---|
upload | node scripts/agent-storage.js upload '<json>' | Upload local file to cloud, returns download link |
uploadDir | node scripts/agent-storage.js uploadDir '<json>' | Upload entire folder to cloud, preserving directory structure |
info | node scripts/agent-storage.js info '<json>' | Get file info and regenerate download link |
list | node scripts/agent-storage.js list '<json>' | List files in a cloud directory |
search | node scripts/agent-storage.js search '<json>' | Search files by name |
mkdir | node scripts/agent-storage.js mkdir '<json>' | Create a directory in cloud storage |
此 skill 需要 Node.js ≥ 14 和 npm。Agent 在首次执行前必须检测运行环境:
node --version # 期望输出 v14.x 或更高
npm --version
如果 node 命令不存在或版本低于 14,直接安装:
根据用户系统自动选择安装方式:
# macOS (Homebrew)
brew install node
# macOS (无 Homebrew)
curl -o node.pkg "https://nodejs.org/dist/v20.18.0/node-v20.18.0.pkg" && sudo installer -pkg node.pkg -target / && rm node.pkg
# Linux (Debian/Ubuntu)
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs
# Linux (其他发行版 / 通用)
curl -fsSL https://nodejs.org/dist/v20.18.0/node-v20.18.0-linux-x64.tar.xz | sudo tar -xJ -C /usr/local --strip-components=1
# Windows (PowerShell, 管理员)
winget install OpenJS.NodeJS.LTS
# Windows (无 winget)
# 下载安装包: https://nodejs.org/dist/v20.18.0/node-v20.18.0-x64.msi 并运行
# 跨平台 (已有 nvm)
nvm install --lts
此 skill 还依赖 smh-node-sdk npm 包(要求 ^1.0.8)。必须在使用前完成安装(二选一):
# 方式一:全局安装(推荐)
npm install -g smh-node-sdk@^1.0.8
# 方式二:本地安装到项目目录
npm install smh-node-sdk@^1.0.8
脚本会按以下顺序查找 SDK:当前项目 node_modules → 全局 node_modules。如果未找到,脚本会报错并提示安装命令。
此 skill 的运行脚本位于 scripts/agent-storage.js。Agent 直接通过 node scripts/agent-storage.js <command> '<json>' 调用,无需额外写入临时文件。脚本源码可在 scripts/ 目录中审阅。
凭证从以下配置文件中自动加载(优先级从高到低)。
安全说明:脚本仅读取配置文件中
smh_前缀的环境变量(smh_libraryId、smh_accessToken等),不会访问配置文件中的其他字段或敏感信息。
关于 token 权限:Tencent Agent Storage 的文件上传和下载链接生成 API 要求
space_admin级别的 accessToken,这是 Tencent Agent Storage 服务端对文件写入操作的最低权限要求。
模式一:直接凭证(accessToken)
凭证文件查找顺序(先找到者优先):
~/.tencentAgentStorage/.env~/.openclaw/openclaw.json 的 env 字段~/.hermes/.env通用配置(推荐) — 在 ~/.tencentAgentStorage/.env 中配置:
# ~/.tencentAgentStorage/.env
smh_basePath=https://api.tencentsmh.cn
smh_libraryId=smhxxx-xxxxx
smh_spaceId=space-xxxxx
smh_accessToken=<your-access-token>
OpenClaw — 在 ~/.openclaw/openclaw.json 的 env 字段中配置:
{
"env": {
"smh_basePath": "https://api.tencentsmh.cn",
"smh_libraryId": "smhxxx-xxxxx",
"smh_spaceId": "space-xxxxx",
"smh_accessToken": "<your-access-token>"
}
}
Hermes — 在 ~/.hermes/.env 中配置:
smh_basePath=https://api.tencentsmh.cn
smh_libraryId=smhxxx-xxxxx
smh_spaceId=space-xxxxx
smh_accessToken=<your-access-token>
Agent uses this skill in any scenario that requires uploading files to the cloud.
User triggers file upload
→ Step 1: Identify the local file path(s)
→ Step 2: Run upload script (loop for batch)
→ Step 3: Extract downloadUrl from JSON output (signed COS URL)
→ Step 4: Deliver the download link with execution notice
IMPORTANT: 默认使用
conflictStrategy: "rename"上传。当云端已存在同名文件时,脚本会自动重命名(如file(1).pdf),确保上传始终成功并返回正确的下载链接。只有用户明确说了 "覆盖"/"替换" 时,才使用conflictStrategy: "overwrite";用户明确要求先确认时,才使用conflictStrategy: "ask"。
Single file (默认):
node scripts/agent-storage.js upload '{"localPath":"/path/to/file.pdf","conflictStrategy":"rename"}'
Upload to specific directory:
node scripts/agent-storage.js upload '{"localPath":"/path/to/photo.jpg","remotePath":"photos/photo.jpg","conflictStrategy":"rename"}'
User explicitly requested overwrite:
node scripts/agent-storage.js upload '{"localPath":"/path/to/report.pdf","conflictStrategy":"overwrite"}'
Batch upload:
node scripts/agent-storage.js upload '{"localPath":"/path/to/file1.pdf","conflictStrategy":"rename"}'
node scripts/agent-storage.js upload '{"localPath":"/path/to/file2.docx","conflictStrategy":"rename"}'
When using conflictStrategy: "rename" (默认), if a same-name file already exists, the script automatically renames the file (e.g. file(1).pdf) and completes the upload, ensuring a valid download link is always returned.
When using conflictStrategy: "ask", if a same-name file already exists, the script returns {"success":false,"conflict":true}. Agent must then ask the user:
云端已存在同名文件
{filename},你想怎么处理?
- 🔄 覆盖 — 替换云端文件
- 📝 重命名 — 自动改名上传(如 file(1).pdf)
- ❌ 取消 — 不上传
三种策略对照:
| Strategy | Behavior | When to use |
|---|---|---|
rename (默认) | 同名文件存在时自动重命名,确保上传成功并返回正确链接 | 大多数场景,需要保证用户拿到下载链接 |
overwrite | 直接覆盖已有文件 | 用户明确说 "覆盖", "替换", "更新文件" |
ask | 同名文件存在时返回错误,Agent 询问用户 | 用户明确要求先确认时 |
After every successful upload, include this notice alongside the download link(s):
链接已生成,链接有效期 2 小时,可直接在浏览器或手机中打开。
链接输出规则(MUST):
downloadUrl 字段),域名为 *.tencentsmhuc.cn,参数含 q-sign-algorithm 和 q-signatureaccessToken 的中转链接(如 https://api.tencentsmh.cn/...?access_token=...),这会泄露凭证...、<省略> 等替代任何部分。签名链接通常很长,这是正常的Single file example:
链接已生成,链接有效期 2 小时,可直接在浏览器或手机中打开。
已上传文件: report.pdf 大小: (2.3 MB) 下载链接: {脚本返回的完整 downloadUrl,原样输出,不得截断}
Batch example:
链接已生成,链接有效期 2 小时,可直接在浏览器或手机中打开。
📎 report.pdf (2.3 MB) — {完整 downloadUrl} 📎 photo.jpg (1.1 MB) — {完整 downloadUrl}
There is NO file size limit. The upload script supports files of any size, including multi-GB videos.
所有命令输出 JSON 到 stdout。
node scripts/agent-storage.js upload '<json>'
JSON 参数:
localPath(必填):本地文件绝对路径,支持 ~ 展开remotePath(可选):云端目标路径,省略则上传到根目录并保留原文件名conflictStrategy(可选):rename(默认)| ask | overwritepurpose(可选):download(默认,链接点击触发下载)| preview(链接在浏览器内预览)Output:
{
"success": true,
"upload": {
"localFile": "/path/to/photo.jpg",
"remotePath": "photo.jpg",
"fileSize": 2048576,
"fileSizeHuman": "2.0 MB",
"uploadTime": "3.2s",
"rapidUpload": false
},
"downloadUrl": "https://smhxxxxx.gz-c1.smhshare.com/s/xxxxxxxxxx"
}
node scripts/agent-storage.js uploadDir '<json>'
JSON 参数:
localPath(必填):本地文件夹绝对路径,支持 ~ 展开remotePath(可选):云端目标目录路径,省略则使用本地文件夹名称conflictStrategy(可选):rename(默认)| overwrite说明:
Output:
{
"success": true,
"uploadDir": {
"localPath": "/path/to/my-folder",
"remotePath": "my-folder",
"totalFiles": 5,
"successCount": 5,
"failCount": 0,
"totalSize": 10485760,
"totalSizeHuman": "10.0 MB",
"uploadTime": "8.5s"
},
"files": [
{ "file": "doc.pdf", "size": 2048576, "sizeHuman": "2.0 MB", "success": true },
{ "file": "images/photo.jpg", "size": 1048576, "sizeHuman": "1.0 MB", "success": true }
]
}
node scripts/agent-storage.js info '<json>'
JSON 参数:
remotePath(必填):云端文件路径purpose(可选):download(默认,链接点击触发下载)| preview(链接在浏览器内预览)basePath / libraryId / spaceId / accessToken(可选):直接传参模式凭证Output:
{
"success": true,
"remotePath": "report.pdf",
"downloadUrl": "https://smhxxxxx.gz-c1.smhshare.com/s/xxxxxxxxxx",
"fileInfo": {
"name": "report.pdf",
"size": 2048576,
"type": "application/pdf",
"creationTime": "2026-03-13T10:00:00Z",
"modificationTime": "2026-03-13T10:00:00Z"
}
}
node scripts/agent-storage.js list '<json>'
JSON 参数:
dirPath(可选):目录路径,默认 /limit(可选):最大返回数量,默认 50node scripts/agent-storage.js search '<json>'
JSON 参数:
keywords(必填):搜索关键字,字符串或字符串数组(数组元素间为"或"关系)scope(可选):搜索范围目录路径,如 photos;不填则搜索整个空间limit(可选):最大返回数量,默认 20,取值范围 [1, 100]marker(可选):分页标识,用于获取后续页inExtnames(可选):限定文件后缀,字符串或字符串数组,如 ["pdf","docx"]excludeExtnames(可选):排除文件后缀,字符串或字符串数组fileTypes(可选):文件类型过滤,取值 all | dir | file | symlink注意:搜索仅支持按文件名匹配(
type: "filename"),不支持全文内容检索。
Output:
{
"success": true,
"keywords": ["报告"],
"type": "filename",
"total": 3,
"nextMarker": null,
"results": [
{
"name": "周报告.pdf",
"type": "file",
"size": 2048576,
"sizeHuman": "2.0 MB",
"contentType": "application/pdf",
"creationTime": "2026-03-13T10:00:00Z",
"modificationTime": "2026-03-13T10:00:00Z",
"text": null,
"textPage": null,
"searchScore": null
}
]
}
node scripts/agent-storage.js mkdir '<json>'
JSON 参数:
dirPath(必填):要创建的文件夹路径,如 photos 或 docs/2026conflictStrategy(可选):rename(默认)| ask | overwriteOutput:
{
"success": true,
"dirPath": "photos",
"message": "文件夹 \"photos\" 创建成功"
}
# Step 0: 安装 smh-node-sdk(首次使用前执行一次)
npm install -g smh-node-sdk@^1.0.8
# Step 1: 上传文件
node scripts/agent-storage.js upload '{"localPath":"/path/to/report.pdf","conflictStrategy":"rename"}'
# Step 2: 查询文件信息
node scripts/agent-storage.js info '{"remotePath":"report.pdf"}'
# Step 3: 列出云端文件
node scripts/agent-storage.js list '{"dirPath":"/","limit":20}'
# Step 4: 搜索文件(按文件名)
node scripts/agent-storage.js search '{"keywords":"report"}'
# Step 5: 上传整个文件夹
node scripts/agent-storage.js uploadDir '{"localPath":"/path/to/my-folder","conflictStrategy":"rename"}'
# Step 6: 创建文件夹
node scripts/agent-storage.js mkdir '{"dirPath":"photos"}'
所有命令输出 JSON 到 stdout。错误也以 JSON 返回:{"success": false, "error": "..."}
| 错误 | 处理方式 |
|---|---|
上传失败(success: false) | 告诉用户:"文件上传失败:{具体原因}。你可以稍后再试,或者检查网络连接。" |
同名冲突(conflict: true) | 询问用户选择覆盖、重命名或取消 |
| 文件不存在 | 让用户确认路径 |
| 网络错误 | 重试 2 次,间隔 3s;仍失败告知用户 |
| 配置缺失 | 提示用户在 ~/.tencentAgentStorage/.env、~/.openclaw/openclaw.json 的 env 字段或 ~/.hermes/.env 中添加 smh_* 配置 |
上传失败对话模板(当 success: false 时必须使用):
❌ 文件上传失败:{error 中的具体原因}。
你可以:
- 🔄 重试 — 重新上传这个文件
- ❌ 取消 — 暂时不上传
success: false 时展示下载链接conflictStrategy: "overwrite"accessToken 的中转链接(如 https://api.tencentsmh.cn/...?access_token=...)发给用户。返回给用户的必须是带 COS 签名的直链(域名为 *.tencentsmhuc.cn,参数含 q-sign-algorithm 和 q-signature),即脚本输出的 downloadUrl 字段... 缩写链接。发给用户的下载链接/预览链接必须是脚本返回的完整 URL,一个字符都不能少。链接通常很长(含签名参数),这是正常的,必须原样完整输出conflictStrategy: "rename")conflictStrategy: "rename",自动重命名保证上传成功。只有用户明确要求覆盖时才用 overwrite,用户明确要求先确认时才用 askremotePath 参数指定目标路径infoFile({ purpose: 'download' }) 获取的带签名 COS 直链(https://bucket-xxxxx.tencentsmhuc.cn/...?q-sign-algorithm=sha1&q-signature=...),可直接在浏览器或手机中打开预览/下载,有效期约 2 小时。必须原样完整输出此链接,禁止截断或省略任何部分Upload was successful when ALL of the following are true:
"success": truedownloadUrl field is present and non-emptyTo verify a previously uploaded file still exists:
node scripts/agent-storage.js info '{"remotePath":"<filename>"}'
If the response contains "success": true, the file is accessible and a fresh download link is returned.