返回顶部
m

matrix-server-management

Manage the Tuwunel Matrix Homeserver (register users, create rooms, manage room membership, upload files to media server). Use only for explicit standalone admin requests — Worker and project creation handle Matrix operations internally via their own scripts. Also use this skill whenever you need to send a file to the admin (upload via media API, then send as m.file message).

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
80
下载量
0
收藏
概述
安装方式
版本历史

matrix-server-management

# Matrix Server Management ## Overview This skill allows you to manage the Tuwunel Matrix Homeserver. Tuwunel is a conduwuit fork running at `http://127.0.0.1:6167`. Access the server directly (not through the Higress gateway). ## Environment Variables These environment variables are pre-configured in the Manager container: ```bash # Core configuration (set by hiclaw-install.sh) HICLAW_MATRIX_DOMAIN # Matrix server domain (e.g., matrix-local.hiclaw.io:8080) HICLAW_ADMIN_USER # Admin username HICLAW_REGISTRATION_TOKEN # Token for registering new Matrix users HICLAW_MANAGER_PASSWORD # Manager's Matrix password (for login) ``` No need to set defaults - these are always available in the container environment. ## User Registration Tuwunel uses **single-step registration** with a registration token (no UIAA flow). ### Register a New User ```bash curl -X POST http://127.0.0.1:6167/_matrix/client/v3/register \ -H 'Content-Type: application/json' \ -d '{ "username": "<USERNAME>", "password": "<PASSWORD>", "auth": { "type": "m.login.registration_token", "token": "'"${HICLAW_REGISTRATION_TOKEN}"'" } }' ``` Response includes `user_id` and `access_token`. ### Login (Get Access Token) ```bash curl -X POST http://127.0.0.1:6167/_matrix/client/v3/login \ -H 'Content-Type: application/json' \ -d '{ "type": "m.login.password", "identifier": {"type": "m.id.user", "user": "<USERNAME>"}, "password": "<PASSWORD>" }' ``` Response: `{"access_token": "...", "user_id": "@<USERNAME>:<DOMAIN>", ...}` ## Room Management ### Create a Room (3-party: Human + Manager + Worker) When creating a Worker, always create a Room with the human admin, Manager, and Worker. Use `trusted_private_chat` preset so all invited members are auto-joined (no invite acceptance needed), and override power levels so Admin + Manager get 100 (admin) while Workers get 0 (regular user): ```bash MANAGER_TOKEN="<manager_access_token>" curl -X POST http://127.0.0.1:6167/_matrix/client/v3/createRoom \ -H "Authorization: Bearer ${MANAGER_TOKEN}" \ -H 'Content-Type: application/json' \ -d '{ "name": "Worker: <WORKER_NAME>", "topic": "Communication channel for <WORKER_NAME>", "invite": [ "@'"${HICLAW_ADMIN_USER}"':'"${HICLAW_MATRIX_DOMAIN}"'", "@<WORKER_NAME>:'"${HICLAW_MATRIX_DOMAIN}"'" ], "preset": "trusted_private_chat", "power_level_content_override": { "users": { "@manager:'"${HICLAW_MATRIX_DOMAIN}"'": 100, "@'"${HICLAW_ADMIN_USER}"':'"${HICLAW_MATRIX_DOMAIN}"'": 100, "@<WORKER_NAME>:'"${HICLAW_MATRIX_DOMAIN}"'": 0 } } }' ``` Response: `{"room_id": "!<id>:<DOMAIN>"}` **Power levels:** `trusted_private_chat` auto-joins all invited members (no invite acceptance needed). `power_level_content_override` ensures Admin (100) and Manager (100) have admin rights while Workers are explicitly set to 0 (regular user). ### Send a Message in a Room **Simple message (no mention):** ```bash curl -X PUT "http://127.0.0.1:6167/_matrix/client/v3/rooms/<ROOM_ID>/send/m.room.message/$(date +%s)" \ -H "Authorization: Bearer ${MANAGER_TOKEN}" \ -H 'Content-Type: application/json' \ -d '{ "msgtype": "m.text", "body": "Hello, this is a general announcement..." }' ``` ### Send a Message with @Mention (Critical for Workers) **IMPORTANT**: When sending messages to Workers in group rooms, you MUST include the `m.mentions` field for them to receive the message. Workers have `requireMention: true` enabled, meaning they only process messages that properly @mention them. ```bash # Mention a single user curl -X PUT "http://127.0.0.1:6167/_matrix/client/v3/rooms/<ROOM_ID>/send/m.room.message/$(date +%s)" \ -H "Authorization: Bearer ${MANAGER_TOKEN}" \ -H 'Content-Type: application/json' \ -d '{ "msgtype": "m.text", "body": "@<WORKER_NAME>:'"${HICLAW_MATRIX_DOMAIN}"' Your task assignment: ...", "m.mentions": { "user_ids": ["@<WORKER_NAME>:'"${HICLAW_MATRIX_DOMAIN}"'"] } }' ``` ```bash # Mention multiple users curl -X PUT "http://127.0.0.1:6167/_matrix/client/v3/rooms/<ROOM_ID>/send/m.room.message/$(date +%s)" \ -H "Authorization: Bearer ${MANAGER_TOKEN}" \ -H 'Content-Type: application/json' \ -d '{ "msgtype": "m.text", "body": "@alice:'"${HICLAW_MATRIX_DOMAIN}"' and @bob:'"${HICLAW_MATRIX_DOMAIN}"' please coordinate on this task...", "m.mentions": { "user_ids": [ "@alice:'"${HICLAW_MATRIX_DOMAIN}"'", "@bob:'"${HICLAW_MATRIX_DOMAIN}"'" ] } }' ``` **Rules for @mentions:** - The `user_ids` array in `m.mentions` MUST contain the full Matrix user ID (e.g., `@alice:matrix-local.hiclaw.io:8080`) - The user ID in the body text and in `m.mentions.user_ids` must match exactly - Without `m.mentions`, Workers will receive the message but will NOT process it (it will be ignored) - This follows Matrix MSC3952 (Intentional Mentions) specification ### Upload a File (Media Upload) Use this to send files to the admin — task output artifacts, generated reports, config exports, log files, etc. ```bash curl -X POST "http://127.0.0.1:6167/_matrix/media/v3/upload?filename=<FILENAME>" \ -H "Authorization: Bearer ${MANAGER_TOKEN}" \ -H "Content-Type: application/octet-stream" \ --data-binary @/path/to/file ``` Response: `{"content_uri": "mxc://<SERVER>/<MEDIA_ID>"}` After uploading, send the `mxc://` URI to the admin as a Matrix message using the `m.file` (or `m.image` / `m.text`) msgtype: ```bash curl -X PUT "http://127.0.0.1:6167/_matrix/client/v3/rooms/<ROOM_ID>/send/m.room.message/$(date +%s)" \ -H "Authorization: Bearer ${MANAGER_TOKEN}" \ -H 'Content-Type: application/json' \ -d '{ "msgtype": "m.file", "body": "<FILENAME>", "url": "mxc://<SERVER>/<MEDIA_ID>" }' ``` Then reply in the conversation with: ``` MEDIA: mxc://<SERVER>/<MEDIA_ID> ``` **Notes:** - Use `Content-Type: text/plain` for plain text files, `application/octet-stream` as a safe fallback for any binary - The `mxc://` URI is permanent and accessible to all room members via the Matrix client (Element Web) ### List Joined Rooms ```bash curl -s http://127.0.0.1:6167/_matrix/client/v3/joined_rooms \ -H "Authorization: Bearer ${MANAGER_TOKEN}" | jq ``` ### Get Room Messages ```bash curl -s "http://127.0.0.1:6167/_matrix/client/v3/rooms/<ROOM_ID>/messages?dir=b&limit=20" \ -H "Authorization: Bearer ${MANAGER_TOKEN}" | jq ``` ## Important Notes - **Environment prefix**: Tuwunel uses `CONDUWUIT_` environment variable prefix (NOT `TUWUNEL_`) - **Server name**: Set in `CONDUWUIT_SERVER_NAME`, usually `${HICLAW_MATRIX_DOMAIN}` - **User ID format**: `@<username>:${HICLAW_MATRIX_DOMAIN}` - **Registration token**: Stored in `HICLAW_REGISTRATION_TOKEN` env var - **Direct access**: Use `http://127.0.0.1:6167` for server management (not through Higress Gateway port 8080) <!-- hiclaw-builtin-end -->

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 matrix-server-management-1776123910 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 matrix-server-management-1776123910 技能

通过命令行安装

skillhub install matrix-server-management-1776123910

下载 Zip 包

⬇ 下载 matrix-server-management v1.0.0

文件大小: 3.24 KB | 发布时间: 2026-4-14 13:12

v1.0.0 最新 2026-4-14 13:12
Initial release of matrix-server-management skill.

- Provides admin tools for managing the Tuwunel Matrix homeserver: register users, create rooms, manage room membership, upload files via media API.
- Clearly documents required environment variables (pre-set in Manager container).
- Explains worker, admin, and room permissions, including power level overrides for each role.
- Documents how to send messages, including support for Matrix MSC3952 @mentions (critical for Worker functionality).
- Details media upload process and how to share files with the admin using Matrix file messages.
- Includes examples for key actions such as user registration, room creation, sending messages (with and without mentions), file upload, listing rooms, and fetching room messages.
- Emphasizes operational constraints: use only for explicit admin requests, as workers/projects trigger their own Matrix operations internally.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部