openclaw-rocketchat 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.en.md +113 -38
  2. package/README.md +113 -38
  3. package/package.json +1 -1
package/README.en.md CHANGED
@@ -641,70 +641,109 @@ All config is written automatically by CLI commands into `~/.openclaw/openclaw.j
641
641
 
642
642
  ### channels.rocketchat — Channel Config
643
643
 
644
- | Parameter | Type | Description |
645
- |-----------|------|-------------|
646
- | `enabled` | `boolean` | Enable/disable the Rocket.Chat channel |
647
- | `serverUrl` | `string` | Rocket.Chat server URL, e.g. `"https://123-45-67-89.sslip.io"` |
648
- | `accounts` | `object` | Bot accounts. Key is the account ID |
649
- | `accounts.<id>.botUsername` | `string` | Bot's username in RC |
650
- | `accounts.<id>.botDisplayName` | `string` | Bot's display name |
651
- | `groups` | `object` | Group config (optional). Key is group name |
652
- | `groups.<name>.bots` | `string[]` | Bots in this group |
653
- | `groups.<name>.requireMention` | `boolean` | Whether bot requires @mention to respond in groups |
644
+ | Parameter | Type | Default | Description |
645
+ |-----------|------|---------|-------------|
646
+ | `enabled` | `boolean` | `false` | Enable/disable the Rocket.Chat channel |
647
+ | `serverUrl` | `string` | — | Rocket.Chat server URL, e.g. `"https://123-45-67-89.sslip.io"` or `"https://127.0.0.1"` (co-located) |
648
+ | `port` | `number` | `443` | Rocket.Chat HTTPS port (the port specified during `install-rc.sh` installation) |
649
+ | `dmPolicy` | `string` | `"pairing"` | DM policy. `"pairing"` means setup auto-creates DM channels between users and bots |
650
+ | `accounts` | `object` | `{}` | Bot accounts. Key is the bot ID (written by `add-bot` command) |
651
+ | `accounts.<id>.botUsername` | `string` | | Bot's username in Rocket.Chat |
652
+ | `accounts.<id>.botDisplayName` | `string` | | Bot's display name (supports Unicode) |
653
+ | `groups` | `object` | `{}` | Group config (written by `add-group` command). Key is the group name |
654
+ | `groups.<name>.bots` | `string[]` | — | Bots in this group (matching keys in `accounts`) |
655
+ | `groups.<name>.requireMention` | `boolean` | `false` | Whether bot requires `@mention` to respond. `false`: responds to all messages; `true`: only responds when directly `@mentioned` (recommended for multi-bot groups to avoid all bots replying at once) |
656
+
657
+ > **Broadcast mentions**: `@here`, `@all`, `@everyone` never trigger bot responses, even when `requireMention` is `false`. Only direct `@botname` mentions trigger a response.
654
658
 
655
659
  ### bindings — Agent Bindings
656
660
 
657
- The `bindings` array maps bot accounts to Agents:
661
+ The `bindings` array maps bot accounts to Agents (written by `add-bot` command):
658
662
 
659
663
  | Parameter | Type | Description |
660
664
  |-----------|------|-------------|
661
- | `agentId` | `string` | The Agent ID to bind to (e.g. `"main"`) |
665
+ | `agentId` | `string` | The Agent ID to bind to (e.g. `"main"`). Created via `openclaw agents add` |
662
666
  | `match.channel` | `string` | Always `"rocketchat"` |
663
- | `match.accountId` | `string` | Matches a key in `accounts` |
667
+ | `match.accountId` | `string` | Matches a key in `channels.rocketchat.accounts` |
664
668
 
665
- ### plugins.entries — Plugin State
669
+ ### plugins — Plugin Config
666
670
 
667
671
  | Parameter | Type | Description |
668
672
  |-----------|------|-------------|
669
- | `openclaw-rocketchat.enabled` | `boolean` | Whether the plugin is enabled |
673
+ | `entries.openclaw-rocketchat.enabled` | `boolean` | Whether the plugin is enabled. Gateway auto-detects and sets to `true` on start |
674
+ | `installs.openclaw-rocketchat.source` | `string` | Installation source, typically `"npm"` |
675
+ | `installs.openclaw-rocketchat.spec` | `string` | Installed package spec, e.g. `"openclaw-rocketchat@0.4.2"` |
676
+ | `installs.openclaw-rocketchat.installPath` | `string` | Plugin installation path, e.g. `"~/.openclaw/extensions/openclaw-rocketchat"` |
677
+ | `installs.openclaw-rocketchat.version` | `string` | Currently installed version |
678
+ | `installs.openclaw-rocketchat.installedAt` | `string` | Installation timestamp (ISO format) |
670
679
 
671
680
  ### Full Config Example
672
681
 
682
+ Below shows the Rocket.Chat plugin-related sections of `~/.openclaw/openclaw.json` (omitting `meta`, `auth`, `models`, `agents`, `gateway`, and other unrelated sections):
683
+
673
684
  ```json5
674
685
  {
675
- // Agents managed by openclaw agents add
676
- "agents": {
677
- "list": [
678
- { "id": "main", "default": true },
679
- { "id": "work", "name": "Work Helper" }
680
- ]
681
- },
682
-
683
- // Bot → Agent bindings (written by add-bot)
684
- "bindings": [
685
- { "agentId": "main", "match": { "channel": "rocketchat", "accountId": "molty" } },
686
- { "agentId": "work", "match": { "channel": "rocketchat", "accountId": "work-claw" } }
687
- ],
688
-
689
- // Rocket.Chat channel config (written by setup / add-bot)
686
+ // Rocket.Chat channel config (written by setup / add-bot / add-group)
690
687
  "channels": {
691
688
  "rocketchat": {
692
689
  "enabled": true,
693
- "serverUrl": "https://123-45-67-89.sslip.io",
690
+ "serverUrl": "https://127.0.0.1", // Use 127.0.0.1 for co-located; use sslip.io domain for remote
691
+ "port": 443, // Rocket.Chat HTTPS port
692
+ "dmPolicy": "pairing", // DM policy
694
693
  "accounts": {
695
- "molty": { "botUsername": "molty", "botDisplayName": "Lobster" },
696
- "work-claw": { "botUsername": "work-claw", "botDisplayName": "Work Helper" }
694
+ "molty": { // Bot 1
695
+ "botUsername": "molty",
696
+ "botDisplayName": "Lobster"
697
+ },
698
+ "work-bot": { // Bot 2 (optional, multiple bots)
699
+ "botUsername": "work-bot",
700
+ "botDisplayName": "Work Helper"
701
+ }
697
702
  },
698
- "groups": {
699
- "AI Squad": { "requireMention": false, "bots": ["molty", "work-claw"] }
703
+ "groups": { // Groups (optional)
704
+ "AI Squad": {
705
+ "requireMention": false, // Responds to all messages
706
+ "bots": ["molty", "work-bot"] // Bots in this group
707
+ },
708
+ "Tech Talk": {
709
+ "requireMention": true, // Only responds when @mentioned
710
+ "bots": ["molty"]
711
+ }
700
712
  }
701
713
  }
702
714
  },
703
715
 
716
+ // Bot → Agent bindings (written by add-bot)
717
+ "bindings": [
718
+ {
719
+ "agentId": "main", // Bound to main Agent
720
+ "match": {
721
+ "channel": "rocketchat",
722
+ "accountId": "molty" // Matches key in accounts
723
+ }
724
+ },
725
+ {
726
+ "agentId": "work", // Different bots can bind to different Agents
727
+ "match": {
728
+ "channel": "rocketchat",
729
+ "accountId": "work-bot"
730
+ }
731
+ }
732
+ ],
733
+
704
734
  // Plugin state
705
735
  "plugins": {
706
736
  "entries": {
707
737
  "openclaw-rocketchat": { "enabled": true }
738
+ },
739
+ "installs": {
740
+ "openclaw-rocketchat": {
741
+ "source": "npm",
742
+ "spec": "openclaw-rocketchat@0.4.2",
743
+ "installPath": "/root/.openclaw/extensions/openclaw-rocketchat",
744
+ "version": "0.4.2",
745
+ "installedAt": "2026-02-15T07:37:17.498Z"
746
+ }
708
747
  }
709
748
  }
710
749
  }
@@ -718,20 +757,56 @@ If auto-configuration has issues, edit `~/.openclaw/openclaw.json` directly:
718
757
  # Edit config
719
758
  vi ~/.openclaw/openclaw.json
720
759
 
721
- # Restart gateway to apply changes
760
+ # Restart Gateway to apply changes
722
761
  openclaw gateway restart
723
762
  ```
724
763
 
725
764
  **Common manual edits:**
726
765
 
727
- - **Change server URL**: Edit `channels.rocketchat.serverUrl`
728
- - **Disable/enable channel**: Edit `channels.rocketchat.enabled`
766
+ - **Change server URL**: Edit `channels.rocketchat.serverUrl` (`https://127.0.0.1` for co-located, `https://IP.sslip.io` for remote)
767
+ - **Change port**: Edit `channels.rocketchat.port`
768
+ - **Disable/enable channel**: Set `channels.rocketchat.enabled` to `false` / `true`
729
769
  - **Rebind bot to different Agent**: Edit `bindings` array, change `agentId`
730
770
  - **Remove a bot**: Delete entries from both `accounts` and `bindings`
731
771
  - **Toggle @mention requirement**: Edit `groups.<name>.requireMention`
772
+ - **Upgrade plugin version**: Update `plugins.installs.openclaw-rocketchat.version` and `spec`
732
773
 
733
774
  > **Note**: Bot credentials (passwords, tokens) are stored in `~/.openclaw/credentials/`, separate from `openclaw.json`. If you reinstall a bot, clean up the credentials directory as well.
734
775
 
776
+ ### Full Reset
777
+
778
+ To completely remove Rocket.Chat config and start over:
779
+
780
+ ```bash
781
+ # Stop Gateway
782
+ openclaw gateway stop
783
+
784
+ # Remove plugin and credentials
785
+ rm -rf ~/.openclaw/extensions/openclaw-rocketchat
786
+ rm -rf ~/.openclaw/credentials/rocketchat*
787
+
788
+ # Remove RC-related config entries
789
+ python3 -c "
790
+ import json
791
+ p = '$HOME/.openclaw/openclaw.json'
792
+ with open(p) as f:
793
+ c = json.load(f)
794
+ c.get('channels', {}).pop('rocketchat', None)
795
+ c['bindings'] = [b for b in c.get('bindings', []) if b.get('match', {}).get('channel') != 'rocketchat']
796
+ c.get('plugins', {}).get('entries', {}).pop('openclaw-rocketchat', None)
797
+ c.get('plugins', {}).get('entries', {}).pop('rocketchat', None)
798
+ c.get('plugins', {}).get('installs', {}).pop('openclaw-rocketchat', None)
799
+ with open(p, 'w') as f:
800
+ json.dump(c, f, indent=2, ensure_ascii=False)
801
+ print('Done')
802
+ "
803
+
804
+ # Reinstall and reconfigure
805
+ openclaw plugins install openclaw-rocketchat
806
+ openclaw rocketchat setup
807
+ openclaw rocketchat add-bot
808
+ ```
809
+
735
810
  ## Architecture
736
811
 
737
812
  ### Mode A: Co-located
package/README.md CHANGED
@@ -641,70 +641,109 @@ openclaw rocketchat uninstall
641
641
 
642
642
  ### channels.rocketchat — 频道配置
643
643
 
644
- | 参数 | 类型 | 说明 |
645
- |------|------|------|
646
- | `enabled` | `boolean` | 是否启用 Rocket.Chat 频道。`true` 启用,`false` 禁用 |
647
- | `serverUrl` | `string` | Rocket.Chat 服务器地址,如 `"https://123-45-67-89.sslip.io"`。Gateway 通过此地址连接 RC |
648
- | `accounts` | `object` | 机器人账号列表,key 为账号 ID |
649
- | `accounts.<id>.botUsername` | `string` | 机器人在 RC 中的用户名 |
650
- | `accounts.<id>.botDisplayName` | `string` | 机器人显示昵称 |
651
- | `groups` | `object` | 群组配置(可选),key 为群组名 |
652
- | `groups.<name>.bots` | `string[]` | 群组中的机器人列表 |
653
- | `groups.<name>.requireMention` | `boolean` | 群组中是否需要 @提及 机器人才回复 |
644
+ | 参数 | 类型 | 默认值 | 说明 |
645
+ |------|------|--------|------|
646
+ | `enabled` | `boolean` | `false` | 是否启用 Rocket.Chat 频道 |
647
+ | `serverUrl` | `string` | — | Rocket.Chat 服务器地址,如 `"https://123-45-67-89.sslip.io"` `"https://127.0.0.1"`(同机部署) |
648
+ | `port` | `number` | `443` | Rocket.Chat 对外 HTTPS 端口(`install-rc.sh` 安装时指定的端口) |
649
+ | `dmPolicy` | `string` | `"pairing"` | 私聊策略。`"pairing"` 表示 setup 时自动为用户和机器人创建 DM 通道 |
650
+ | `accounts` | `object` | `{}` | 机器人账号列表,key 为机器人 ID(由 `add-bot` 命令自动写入) |
651
+ | `accounts.<id>.botUsername` | `string` | | 机器人在 Rocket.Chat 中的用户名 |
652
+ | `accounts.<id>.botDisplayName` | `string` | | 机器人显示昵称(可中文) |
653
+ | `groups` | `object` | `{}` | 群组配置(由 `add-group` 命令自动写入),key 为群组名 |
654
+ | `groups.<name>.bots` | `string[]` | — | 群组中的机器人列表(对应 `accounts` 的 key) |
655
+ | `groups.<name>.requireMention` | `boolean` | `false` | 群内是否需要 `@机器人名` 才回复。`false`:所有消息都回复;`true`:只有 `@机器人` 才回复(多机器人群推荐开启,避免抢答) |
656
+
657
+ > **关于群内广播提及**:`@here`、`@all`、`@everyone` 这类广播提及不会触发机器人回复,即使 `requireMention` 为 `false`。只有直接 `@机器人名` 才会触发。
654
658
 
655
659
  ### bindings — Agent 绑定
656
660
 
657
- `bindings` 数组将机器人账号绑定到 Agent
661
+ `bindings` 数组将机器人账号绑定到 Agent(由 `add-bot` 命令自动写入):
658
662
 
659
663
  | 参数 | 类型 | 说明 |
660
664
  |------|------|------|
661
- | `agentId` | `string` | 绑定的 Agent ID(如 `"main"`) |
665
+ | `agentId` | `string` | 绑定的 Agent ID(如 `"main"`)。通过 `openclaw agents add` 创建 |
662
666
  | `match.channel` | `string` | 固定为 `"rocketchat"` |
663
- | `match.accountId` | `string` | 对应 `accounts` 中的 key |
667
+ | `match.accountId` | `string` | 对应 `channels.rocketchat.accounts` 中的 key |
664
668
 
665
- ### plugins.entries插件状态
669
+ ### plugins — 插件配置
666
670
 
667
671
  | 参数 | 类型 | 说明 |
668
672
  |------|------|------|
669
- | `openclaw-rocketchat.enabled` | `boolean` | 插件是否启用 |
673
+ | `entries.openclaw-rocketchat.enabled` | `boolean` | 插件是否启用。Gateway 启动时自动检测并设为 `true` |
674
+ | `installs.openclaw-rocketchat.source` | `string` | 安装来源,通常为 `"npm"` |
675
+ | `installs.openclaw-rocketchat.spec` | `string` | 安装的包版本,如 `"openclaw-rocketchat@0.4.2"` |
676
+ | `installs.openclaw-rocketchat.installPath` | `string` | 插件安装路径,如 `"~/.openclaw/extensions/openclaw-rocketchat"` |
677
+ | `installs.openclaw-rocketchat.version` | `string` | 当前安装版本号 |
678
+ | `installs.openclaw-rocketchat.installedAt` | `string` | 安装时间(ISO 格式) |
670
679
 
671
680
  ### 完整配置示例
672
681
 
682
+ 以下展示 `~/.openclaw/openclaw.json` 中与 Rocket.Chat 插件相关的配置(省略了 `meta`、`auth`、`models`、`agents`、`gateway` 等与插件无关的部分):
683
+
673
684
  ```json5
674
685
  {
675
- // Agent openclaw agents add 管理
676
- "agents": {
677
- "list": [
678
- { "id": "main", "default": true },
679
- { "id": "work", "name": "工作助手" }
680
- ]
681
- },
682
-
683
- // 机器人 → Agent 绑定(由 add-bot 自动写入)
684
- "bindings": [
685
- { "agentId": "main", "match": { "channel": "rocketchat", "accountId": "molty" } },
686
- { "agentId": "work", "match": { "channel": "rocketchat", "accountId": "work-claw" } }
687
- ],
688
-
689
- // Rocket.Chat 频道配置(由 setup / add-bot 自动写入)
686
+ // Rocket.Chat 频道配置(由 setup / add-bot / add-group 自动写入)
690
687
  "channels": {
691
688
  "rocketchat": {
692
689
  "enabled": true,
693
- "serverUrl": "https://123-45-67-89.sslip.io",
690
+ "serverUrl": "https://127.0.0.1", // 同机部署用 127.0.0.1;远程部署填 sslip.io 域名
691
+ "port": 443, // Rocket.Chat HTTPS 端口
692
+ "dmPolicy": "pairing", // 私聊策略
694
693
  "accounts": {
695
- "molty": { "botUsername": "molty", "botDisplayName": "小龙虾" },
696
- "work-claw": { "botUsername": "work-claw", "botDisplayName": "工作助手" }
694
+ "molty": { // 机器人 1
695
+ "botUsername": "molty",
696
+ "botDisplayName": "小龙虾"
697
+ },
698
+ "work-bot": { // 机器人 2(可选,多个机器人)
699
+ "botUsername": "work-bot",
700
+ "botDisplayName": "工作助手"
701
+ }
697
702
  },
698
- "groups": {
699
- "AI全能群": { "requireMention": false, "bots": ["molty", "work-claw"] }
703
+ "groups": { // 群组(可选)
704
+ "AI全能群": {
705
+ "requireMention": false, // 所有消息都回复
706
+ "bots": ["molty", "work-bot"] // 群内的机器人
707
+ },
708
+ "技术讨论": {
709
+ "requireMention": true, // 只有 @机器人 才回复
710
+ "bots": ["molty"]
711
+ }
700
712
  }
701
713
  }
702
714
  },
703
715
 
716
+ // 机器人 → Agent 绑定(由 add-bot 自动写入)
717
+ "bindings": [
718
+ {
719
+ "agentId": "main", // 绑定到 main Agent
720
+ "match": {
721
+ "channel": "rocketchat",
722
+ "accountId": "molty" // 对应 accounts 中的 key
723
+ }
724
+ },
725
+ {
726
+ "agentId": "work", // 不同机器人可绑定不同 Agent
727
+ "match": {
728
+ "channel": "rocketchat",
729
+ "accountId": "work-bot"
730
+ }
731
+ }
732
+ ],
733
+
704
734
  // 插件状态
705
735
  "plugins": {
706
736
  "entries": {
707
737
  "openclaw-rocketchat": { "enabled": true }
738
+ },
739
+ "installs": {
740
+ "openclaw-rocketchat": {
741
+ "source": "npm",
742
+ "spec": "openclaw-rocketchat@0.4.2",
743
+ "installPath": "/root/.openclaw/extensions/openclaw-rocketchat",
744
+ "version": "0.4.2",
745
+ "installedAt": "2026-02-15T07:37:17.498Z"
746
+ }
708
747
  }
709
748
  }
710
749
  }
@@ -718,20 +757,56 @@ openclaw rocketchat uninstall
718
757
  # 编辑配置
719
758
  vi ~/.openclaw/openclaw.json
720
759
 
721
- # 修改后重启 gateway 生效
760
+ # 修改后重启 Gateway 生效
722
761
  openclaw gateway restart
723
762
  ```
724
763
 
725
764
  **常见手动修改场景:**
726
765
 
727
- - **更换服务器地址**:修改 `channels.rocketchat.serverUrl`
728
- - **禁用/启用频道**:修改 `channels.rocketchat.enabled`
766
+ - **更换服务器地址**:修改 `channels.rocketchat.serverUrl`(同机部署填 `https://127.0.0.1`,远程部署填 `https://IP.sslip.io`)
767
+ - **更换端口**:修改 `channels.rocketchat.port`
768
+ - **禁用/启用频道**:修改 `channels.rocketchat.enabled` 为 `false` / `true`
729
769
  - **修改机器人绑定的 Agent**:修改 `bindings` 数组中对应条目的 `agentId`
730
770
  - **删除机器人**:从 `accounts` 和 `bindings` 中删除对应条目
731
771
  - **修改群组的 @提及 规则**:修改 `groups.<name>.requireMention`
772
+ - **升级插件版本**:修改 `plugins.installs.openclaw-rocketchat.version` 和 `spec`
732
773
 
733
774
  > **注意**: 机器人的凭据(密码、token)存储在 `~/.openclaw/credentials/` 目录下,与 `openclaw.json` 分离。如果重装机器人,需要同时清理凭据文件。
734
775
 
776
+ ### 完全重置 Rocket.Chat 配置
777
+
778
+ 如果需要从头开始,运行以下命令清除所有 Rocket.Chat 相关配置:
779
+
780
+ ```bash
781
+ # 停止 Gateway
782
+ openclaw gateway stop
783
+
784
+ # 清除插件和凭据
785
+ rm -rf ~/.openclaw/extensions/openclaw-rocketchat
786
+ rm -rf ~/.openclaw/credentials/rocketchat*
787
+
788
+ # 清除配置中的 Rocket.Chat 相关项
789
+ python3 -c "
790
+ import json
791
+ p = '$HOME/.openclaw/openclaw.json'
792
+ with open(p) as f:
793
+ c = json.load(f)
794
+ c.get('channels', {}).pop('rocketchat', None)
795
+ c['bindings'] = [b for b in c.get('bindings', []) if b.get('match', {}).get('channel') != 'rocketchat']
796
+ c.get('plugins', {}).get('entries', {}).pop('openclaw-rocketchat', None)
797
+ c.get('plugins', {}).get('entries', {}).pop('rocketchat', None)
798
+ c.get('plugins', {}).get('installs', {}).pop('openclaw-rocketchat', None)
799
+ with open(p, 'w') as f:
800
+ json.dump(c, f, indent=2, ensure_ascii=False)
801
+ print('Done')
802
+ "
803
+
804
+ # 重新安装和配置
805
+ openclaw plugins install openclaw-rocketchat
806
+ openclaw rocketchat setup
807
+ openclaw rocketchat add-bot
808
+ ```
809
+
735
810
  ## 架构
736
811
 
737
812
  ### 方式 A:同机部署
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-rocketchat",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Rocket.Chat channel plugin for OpenClaw — connect via mobile app, ideal for China mainland users",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",