@lansenger-pm/openclaw-lansenger-channel 3.16.1 → 3.16.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,32 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [3.16.3] - 2026-06-22
8
+
9
+ ### Fixed
10
+
11
+ - **`queryGroups` returns empty `groupIds`**: Default `pageOffset` was `1` but the API `page_offset` starts from `0`. With few groups, the first page was skipped entirely, returning `totalGroupIds > 0` but `groupIds: []`.
12
+
13
+ ## [3.16.2] - 2026-06-22
14
+
15
+ ### Added
16
+
17
+ - **`autoQuoteReply`**: Auto-quote the inbound message when replying. Supports four-level config (account-per-group > section-group > account > section), applies to both groups and DMs. Default `false`.
18
+ - **`botIds` in `ReminderParams` + `senderFromType` in `InboundEvent`**: `autoMentionReply` now correctly routes bot senders to `botIds` and human senders to `userIds` based on `fromType` (0=staff, 1=app/bot).
19
+ - **`groups` at account level**: Per-group config (`enabled`, `requireMention`, `autoMentionReply`, `autoQuoteReply`, `allowFrom`) now supported under `accounts.<appId>.groups.<chatId>`, in addition to section-level `groups.<chatId>`.
20
+ - **`msgType: "format"` inbound parsing**: Handles Lansenger markdown messages, stripping HTML tags (`<br>`) and leading `@name` prefixes.
21
+
22
+ ### Changed
23
+
24
+ - **`groupAllowFrom` removed in favor of framework-native `groups.<chatId>.enabled`**: Group allowlisting now uses the OpenClaw framework's per-group config (`groups.<chatId>.enabled` + `groupPolicy`). The flat `groupAllowFrom` array has been removed from schema and config. **Migration**: use `openclaw config set channels.lansenger.groups.<chatId>.enabled true` instead.
25
+
26
+ ### Fixed
27
+
28
+ - **DM auto-quote reply not working**: DM `messageId` was a random UUID instead of the platform's real `msgId`, so `refMsgId` was unrecognized by the Lansenger API.
29
+ - **`requireMention` per-group config not working**: Switched to framework-native `resolveRequireMention` which respects the full config hierarchy (account-per-group > section-group > account > section).
30
+ - **`resolveAutoMentionReply` missing account-per-group priority**: Added the missing top-level priority tier.
31
+ - **Gateway stability**: `gatewayStartAccount` no longer creates duplicate WS connections when the connection is already alive; `gatewayStopAccount` skips disconnecting live connections to prevent premature shutdown loops.
32
+
7
33
  ## [3.16.1] - 2026-06-22
8
34
 
9
35
  ### Fixed
@@ -302,7 +328,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
302
328
  ### Bug Fixes
303
329
 
304
330
  - Exclude test files from npm package (fix OpenClaw security scan blocking install).
305
- - Add OpenClaw device pairing troubleshooting section (all 5 locales).
306
331
 
307
332
  ## [3.4.5] - 2026-05-12
308
333
 
package/README.fr.md CHANGED
@@ -175,9 +175,10 @@ Les identifiants peuvent aussi être fournis via la configuration `openclaw.json
175
175
  | `configWrites` | Autoriser Lansenger à écrire la config en réponse aux événements du canal | `true` |
176
176
  | `name` | Nom d'affichage pour ce compte | — |
177
177
  | `accounts` | Configuration multi-robot | — |
178
- | `groupPolicy` | Politique de groupe : `open` (tous les groupes), `allowlist` (groupes autorisés uniquement), `disabled` (messages de groupe désactivés) | `allowlist` |
179
- | `groupAllowFrom` | IDs de groupes autorisés à déclencher le robot | `[]` |
180
- | `groups` | Configuration par groupe (requireMention, enabled, allowFrom) | |
178
+ | `groupPolicy` | Politique de groupe : `open` (tous les groupes), `allowlist` (groupes autorisés), `disabled` (désactivé) | `open` |
179
+ | `groups` | Configuration par groupe : `enabled`, `requireMention`, `autoMentionReply`, `autoQuoteReply`, `allowFrom`. Clé = `chatId` du groupe. Utiliser `groups.<chatId>.enabled: true` pour le mode allowlist. | — |
180
+ | `autoMentionReply` | @mention automatique de l'expéditeur dans les réponses de groupe | `false` |
181
+ | `autoQuoteReply` | Citation automatique du message entrant dans les réponses (groupes et DM) | `false` |
181
182
  | `ackMessage` | Envoyer un message de confirmation avant le traitement de l'agent | `true` |
182
183
  | `revokeAckMessage` | Révoquer automatiquement le message ack après la réponse de l'agent. Mettre `false` pour garder le message visible (certains utilisateurs préfèrent voir le message plutôt qu'une notification « message révoqué ») | `false` |
183
184
  | `mediaLocalRoots` | Répertoires racine autorisés pour l'envoi de fichiers locaux via média ; tableau vide par défaut = workspace + `/tmp` | `[cwd, /tmp]` |
@@ -358,6 +359,7 @@ Le plugin supporte les cartes d'approbation :
358
359
  - **reminder** — champ optionnel dans formatText ; recommandé dans les chats de groupe. Inclure « @姓名 » dans le texte pour les mentions.
359
360
  - **Média** — les balises `<media>` fonctionnent pour les fichiers du workspace ; pour les chemins externes, utilisez `lansenger_send_file`.
360
361
  - **openclaw skill/message lansenger** — ces commandes CLI n'existent PAS ; utilisez les outils de l'agent.
362
+ - **Copie automatique de la compétence lansenger-setup** — le plugin copie la compétence `lansenger-setup` dans `~/.openclaw/skills/` au démarrage pour que l'agent puisse aider à configurer Lansenger avant l'activation complète du canal. Ce comportement est intentionnel — ne le supprimez pas manuellement.
361
363
  - **Outils agent** — les outils agent (`lansenger_send_*`) nécessitent le plugin outils ET une injection réussie de la passerelle — si les outils ne sont pas disponibles, utilisez la CLI comme repli. Les commandes CLI (`lansenger message send-*`) nécessitent `pipx install lansenger-cli`.
362
364
  - **alsoAllow** — les outils agent sont enregistrés par ce plugin de canal mais peuvent être **invisibles** sous un profil d'outils restrictif. Ajoutez `"tools": { "alsoAllow": ["group:plugins"] }` dans `openclaw.json` pour que l'agent puisse voir et utiliser les outils `lansenger_send_*`. Sans cela, les outils peuvent ne pas apparaître silencieusement dans la liste d'outils de l'agent.
363
365
 
@@ -387,49 +389,32 @@ npx tsc --noEmit
387
389
  ```
388
390
  openclaw-lansenger-channel/
389
391
  ├── src/
390
- │ ├── client.ts # Client API Lansenger (WS, HTTP, médias)
391
- │ ├── channel.ts # Plugin de canal OpenClaw
392
- │ ├── runtime.ts # Runtime passerelle (méthodes, handler entrant)
393
- │ ├── tools.ts # Définitions des outils agent (10 outils intégrés)
394
- │ ├── setup-wizard.ts # Assistant de configuration (migration config multi-compte)
395
- │ ├── channel.test.ts # Tests du plugin de canal
396
- │ ├── client.test.ts # Tests du client API
397
- │ ├── runtime.test.ts # Tests du runtime
398
- │ ├── tools.test.ts # Tests des outils
399
- │ └── setup-wizard.test.ts # Tests de l'assistant de configuration
392
+ │ ├── client.ts # Client API Lansenger (WS, HTTP, médias)
393
+ │ ├── channel.ts # Plugin de canal OpenClaw
394
+ │ ├── runtime.ts # Runtime passerelle (handler entrant, livraison)
395
+ │ ├── tools.ts # Définitions des outils agent (lansenger_send_*)
396
+ │ ├── persistent-store.ts # Persistance d'état sur disque
397
+ │ ├── setup-wizard.ts # Assistant de configuration (migration config multi-compte)
398
+ │ ├── setup-i18n.ts # i18n de l'assistant de configuration
399
+ │ ├── *.test.ts # Tests unitaires
400
400
  ├── skills/
401
- └── lansenger-messaging/
402
- └── SKILL.md # Stratégie de messagerie (outils + CLI)
403
- ├── dist/ # JavaScript compilé
404
- ├── index.ts # Point d'entrée du plugin
405
- ├── setup-entry.ts # Point d'entrée de l'assistant de configuration
406
- ├── openclaw.plugin.json # Métadonnées du plugin & configuration GUI
401
+ ├── lansenger-messaging/
402
+ └── SKILL.md # Stratégie de messagerie (outils + CLI)
403
+ │ └── lansenger-setup/
404
+ │ └── SKILL.md # Assistant d'installation (copié auto vers ~/.openclaw/skills)
405
+ ├── dist/ # JavaScript compilé
406
+ ├── index.ts # Point d'entrée du plugin (registerFull, ensureSetupSkill)
407
+ ├── setup-entry.ts # Point d'entrée de l'assistant de configuration
408
+ ├── openclaw.plugin.json # Métadonnées du plugin & configuration GUI
409
+ ├── CHANGELOG.md
410
+ ├── VERSION
411
+ ├── vitest.config.ts
407
412
  ├── package.json
408
413
  └── tsconfig.json
409
414
  ```
410
415
 
411
416
  ## Dépannage
412
417
 
413
- ### OpenClaw v2026.5.18+ : Appairage des appareils requis
414
-
415
- Après la mise à jour d'OpenClaw vers v2026.5.18 ou version ultérieure, **l'appairage des appareils** est requis avant que tout client (Dashboard navigateur, Control UI) puisse se connecter. Cela affecte également le canal Lansenger — si l'appareil de la machine hébergeant la passerelle n'est pas approuvé, les connexions WebSocket peuvent être bloquées et les messages de pairage ne peuvent pas être envoyés aux utilisateurs Lansenger.
416
-
417
- **Correction — exécuter ces commandes sur la machine hébergeant la passerelle OpenClaw :**
418
-
419
- ```bash
420
- # 1. Liste des demandes d'appairage en attente
421
- openclaw devices list
422
-
423
- # 2. Approuver la dernière demande (prévisualiser d'abord, puis approuver avec l'ID exact)
424
- openclaw devices approve --latest # prévisualisation
425
- openclaw devices approve <requestId> # approuver avec l'ID exact affiché
426
-
427
- # 3. Redémarrer la passerelle
428
- openclaw gateway restart
429
- ```
430
-
431
- Voir [Documentation des appareils OpenClaw](https://docs.openclaw.ai/cli/devices) pour plus de détails.
432
-
433
418
  ### "Le client mobile ne permet pas de voir les identifiants"
434
419
 
435
420
  Utilisez uniquement le **client Lansenger (desktop)**. L'application mobile n'affiche pas les identifiants du robot.
package/README.md CHANGED
@@ -167,9 +167,10 @@ Credentials can also be provided via `openclaw.json` config (see Optional Config
167
167
  | `configWrites` | Allow Lansenger to write config in response to channel events | `true` |
168
168
  | `name` | Display name for this account | — |
169
169
  | `accounts` | Multi-bot configuration | — |
170
- | `groupPolicy` | Group policy: `open`, `allowlist`, `disabled` | `allowlist` |
171
- | `groupAllowFrom` | Group IDs allowed to trigger the bot | `[]` |
172
- | `groups` | Per-group configuration (requireMention, enabled, allowFrom) | |
170
+ | `groupPolicy` | Group policy: `open`, `allowlist`, `disabled` | `open` |
171
+ | `groups` | Per-group configuration: `enabled`, `requireMention`, `autoMentionReply`, `autoQuoteReply`, `allowFrom`. Key is group `chatId`. Use `groups.<chatId>.enabled: true` for allowlist mode. | — |
172
+ | `autoMentionReply` | Auto @mention the sender when replying in groups | `false` |
173
+ | `autoQuoteReply` | Auto quote the inbound message when replying (groups and DMs) | `false` |
173
174
  | `ackMessage` | Send a brief acknowledgment message before agent processing | `true` |
174
175
  | `revokeAckMessage` | Auto-revoke ack message after agent reply is delivered. Set `false` to keep ack visible (some users prefer it over a "message revoked" system notice) | `false` |
175
176
  | `mediaLocalRoots` | Allowed root directories for sending local files via media; empty array defaults to workspace + `/tmp` | `[cwd, /tmp]` |
@@ -350,6 +351,7 @@ The plugin supports approval workflow cards:
350
351
  - **reminder** — optional in formatText; recommended in group chat. Include "@姓名" in text when mentioning.
351
352
  - **Media** — `<media>` tags work for workspace files; for external paths use `lansenger_send_file`.
352
353
  - **openclaw skill/message lansenger** — these CLI commands do NOT exist; use agent tools instead.
354
+ - **lansenger-setup skill auto-copy** — the plugin copies `lansenger-setup` skill to `~/.openclaw/skills/` on startup so the agent can help configure Lansenger even before the channel is fully activated. This is intentional — do not remove it manually.
353
355
  - **Agent tools** — agent tools (`lansenger_send_*`) are built into the channel plugin — always available when the channel is configured and running. CLI commands (`lansenger message send-*`) require `pipx install lansenger-cli` and are an optional alternative.
354
356
  - **alsoAllow** — agent tools are registered by this channel plugin but may be **invisible** under restrictive tool profiles. Add `"tools": { "alsoAllow": ["group:plugins"] }` to `openclaw.json` to ensure the agent can see and use `lansenger_send_*` tools. Without this, tools may silently not appear in the agent's tool list.
355
357
 
@@ -379,49 +381,32 @@ npx tsc --noEmit
379
381
  ```
380
382
  openclaw-lansenger-channel/
381
383
  ├── src/
382
- │ ├── client.ts # Lansenger API client (WS, HTTP, media)
383
- │ ├── channel.ts # OpenClaw channel plugin
384
- │ ├── runtime.ts # Gateway runtime (methods, inbound handler)
385
- │ ├── tools.ts # Agent tool definitions (10 built-in tools)
386
- │ ├── setup-wizard.ts # Setup wizard (multi-account config migration)
387
- │ ├── channel.test.ts # Channel plugin tests
388
- │ ├── client.test.ts # API client tests
389
- │ ├── runtime.test.ts # Runtime tests
390
- │ ├── tools.test.ts # Tool tests
391
- │ └── setup-wizard.test.ts # Setup wizard tests
384
+ │ ├── client.ts # Lansenger API client (WS, HTTP, media)
385
+ │ ├── channel.ts # OpenClaw channel plugin
386
+ │ ├── runtime.ts # Gateway runtime (inbound handler, delivery)
387
+ │ ├── tools.ts # Agent tool definitions (lansenger_send_*)
388
+ │ ├── persistent-store.ts # Disk-backed state persistence
389
+ │ ├── setup-wizard.ts # Setup wizard (multi-account config migration)
390
+ │ ├── setup-i18n.ts # Setup wizard i18n strings
391
+ │ ├── *.test.ts # Unit tests
392
392
  ├── skills/
393
- └── lansenger-messaging/
394
- └── SKILL.md # Agent messaging strategy (tools + CLI)
395
- ├── dist/ # Compiled JavaScript
396
- ├── index.ts # Plugin entry point
397
- ├── setup-entry.ts # Setup wizard entry
398
- ├── openclaw.plugin.json # Plugin metadata & GUI config
393
+ ├── lansenger-messaging/
394
+ └── SKILL.md # Agent messaging strategy (tools + CLI)
395
+ │ └── lansenger-setup/
396
+ │ └── SKILL.md # Setup assistant (auto-copied to ~/.openclaw/skills)
397
+ ├── dist/ # Compiled JavaScript
398
+ ├── index.ts # Plugin entry point (registerFull, ensureSetupSkill)
399
+ ├── setup-entry.ts # Setup wizard entry
400
+ ├── openclaw.plugin.json # Plugin metadata & GUI config
401
+ ├── CHANGELOG.md
402
+ ├── VERSION
403
+ ├── vitest.config.ts
399
404
  ├── package.json
400
405
  └── tsconfig.json
401
406
  ```
402
407
 
403
408
  ## Troubleshooting
404
409
 
405
- ### OpenClaw v2026.5.18+: Device pairing required
406
-
407
- After upgrading OpenClaw to v2026.5.18 or later, **device pairing** is required before any client (browser Dashboard, Control UI) can connect. This also affects the Lansenger channel — if the gateway host's device is not approved, WebSocket connections may be blocked and pairing messages cannot be sent to Lansenger users.
408
-
409
- **Fix — run these commands on the OpenClaw gateway host:**
410
-
411
- ```bash
412
- # 1. List pending device pairing requests
413
- openclaw devices list
414
-
415
- # 2. Approve the latest request (preview first, then approve with exact ID)
416
- openclaw devices approve --latest # preview
417
- openclaw devices approve <requestId> # approve with the exact ID shown
418
-
419
- # 3. Restart the gateway
420
- openclaw gateway restart
421
- ```
422
-
423
- See [OpenClaw devices documentation](https://docs.openclaw.ai/cli/devices) for full details.
424
-
425
410
  ### "Mobile client does NOT support viewing credentials"
426
411
 
427
412
  Use the **Lansenger Desktop** client only. The mobile app does not display bot credentials.
package/README.zhHans.md CHANGED
@@ -175,9 +175,10 @@ openclaw pairing approve lansenger <配对码>
175
175
  | `configWrites` | 允许蓝信响应频道事件写入配置 | `true` |
176
176
  | `name` | 此账户的显示名称 | — |
177
177
  | `accounts` | 多机器人配置 | — |
178
- | `groupPolicy` | 群聊策略:`open`(所有群)、`allowlist`(仅允许列表群)、`disabled`(禁止群消息) | `allowlist` |
179
- | `groupAllowFrom` | 允许触发机器人的群 ID | `[]` |
180
- | `groups` | 群级配置(requireMention、enabled、allowFrom) | |
178
+ | `groupPolicy` | 群聊策略:`open`(所有群)、`allowlist`(仅允许列表群)、`disabled`(禁止群消息) | `open` |
179
+ | `groups` | 群级配置:`enabled`、`requireMention`、`autoMentionReply`、`autoQuoteReply`、`allowFrom`。key 为群 `chatId`。allowlist 模式设 `groups.<chatId>.enabled: true`。 | — |
180
+ | `autoMentionReply` | 群聊回复时自动 @发送者 | `false` |
181
+ | `autoQuoteReply` | 回复时自动引用入站消息(群聊和私聊) | `false` |
181
182
  | `ackMessage` | 在代理处理前发送确认消息 | `true` |
182
183
  | `revokeAckMessage` | 代理回复送达后自动撤回确认消息。设为 `false` 则保留确认消息可见(有些用户宁愿看到确认消息也不愿看到撤回的系统通知) | `false` |
183
184
  | `mediaLocalRoots` | 通过媒体发送本地文件时允许的根目录列表;空数组默认为工作区 + `/tmp` | `[cwd, /tmp]` |
@@ -358,6 +359,7 @@ openclaw channels status --probe
358
359
  - **reminder** — formatText 中可选字段;群聊中建议使用。提及用户时在文本中包含"@姓名"。
359
360
  - **媒体标签** — `<media>` 标签适用于工作区文件;外部路径请使用 `lansenger_send_file`。
360
361
  - **openclaw skill/message lansenger** — 这些 CLI 命令不存在;请使用代理工具。
362
+ - **lansenger-setup 技能自动复制** — 插件在启动时将 `lansenger-setup` 技能复制到 `~/.openclaw/skills/`,以便在频道完全激活之前就能帮助配置蓝信。这是有意设计,请勿手动删除。
361
363
  - **代理工具** — 代理工具(`lansenger_send_*`)需要工具插件且网关注入成功 — 若工具不可用,请使用 CLI 作为备选。CLI 命令(`lansenger message send-*`)需要 `pipx install lansenger-cli`。
362
364
  - **alsoAllow** — 本插件注册了 agent 工具(`lansenger_send_*`),但在严格工具策略下可能**不可见**。需在 `openclaw.json` 中添加 `"tools": { "alsoAllow": ["group:plugins"] }` 以确保 agent 能看到并使用这些工具。否则工具可能静默不出现在 agent 工具列表中。
363
365
 
@@ -387,49 +389,32 @@ npx tsc --noEmit
387
389
  ```
388
390
  openclaw-lansenger-channel/
389
391
  ├── src/
390
- │ ├── client.ts # 蓝信 API 客户端(WS、HTTP、媒体)
391
- │ ├── channel.ts # OpenClaw 频道插件
392
- │ ├── runtime.ts # 网关运行时(方法、入站处理器)
393
- │ ├── tools.ts # 代理工具定义(10 个内置工具)
394
- │ ├── setup-wizard.ts # 设置向导(多账号配置迁移)
395
- │ ├── channel.test.ts # 频道插件测试
396
- │ ├── client.test.ts # API 客户端测试
397
- │ ├── runtime.test.ts # 运行时测试
398
- │ ├── tools.test.ts # 工具测试
399
- │ └── setup-wizard.test.ts # 设置向导测试
392
+ │ ├── client.ts # 蓝信 API 客户端(WS、HTTP、媒体)
393
+ │ ├── channel.ts # OpenClaw 频道插件
394
+ │ ├── runtime.ts # 网关运行时(入站处理、投递)
395
+ │ ├── tools.ts # 代理工具定义(lansenger_send_*)
396
+ │ ├── persistent-store.ts # 磁盘状态持久化
397
+ │ ├── setup-wizard.ts # 设置向导(多账号配置迁移)
398
+ │ ├── setup-i18n.ts # 设置向导多语言
399
+ │ ├── *.test.ts # 单元测试
400
400
  ├── skills/
401
- └── lansenger-messaging/
402
- └── SKILL.md # 代理消息策略(工具 + CLI)
403
- ├── dist/ # 编译后的 JavaScript
404
- ├── index.ts # 插件入口
405
- ├── setup-entry.ts # 设置向导入口
406
- ├── openclaw.plugin.json # 插件元数据与 GUI 配置
401
+ ├── lansenger-messaging/
402
+ └── SKILL.md # 代理消息策略(工具 + CLI)
403
+ │ └── lansenger-setup/
404
+ │ └── SKILL.md # 安装助手(自动复制至 ~/.openclaw/skills)
405
+ ├── dist/ # 编译后的 JavaScript
406
+ ├── index.ts # 插件入口(registerFull、ensureSetupSkill)
407
+ ├── setup-entry.ts # 设置向导入口
408
+ ├── openclaw.plugin.json # 插件元数据与 GUI 配置
409
+ ├── CHANGELOG.md
410
+ ├── VERSION
411
+ ├── vitest.config.ts
407
412
  ├── package.json
408
413
  └── tsconfig.json
409
414
  ```
410
415
 
411
416
  ## 故障排除
412
417
 
413
- ### OpenClaw v2026.5.18+:需要设备配对
414
-
415
- 升级 OpenClaw 至 v2026.5.18 或更高版本后,**任何客户端(浏览器 Dashboard、Control UI)连接前都必须完成设备配对**。这也影响蓝信频道——如果网关主机的设备未被审批,WebSocket 连接可能被阻止,配对消息无法发送给蓝信用户。
416
-
417
- **修复——在 OpenClaw 网关主机上执行以下命令:**
418
-
419
- ```bash
420
- # 1. 查看待审批的设备配对请求
421
- openclaw devices list
422
-
423
- # 2. 审批最近的请求(先预览,再使用确切 ID 审批)
424
- openclaw devices approve --latest # 预览
425
- openclaw devices approve <requestId> # 使用显示的确切 ID 审批
426
-
427
- # 3. 重启网关
428
- openclaw gateway restart
429
- ```
430
-
431
- 详见 [OpenClaw 设备文档](https://docs.openclaw.ai/cli/devices)。
432
-
433
418
  ### "移动端不支持查看凭证"
434
419
 
435
420
  请仅使用**蓝信桌面端**。移动端应用不显示机器人凭证。
package/README.zhHant.md CHANGED
@@ -175,9 +175,10 @@ openclaw pairing approve lansenger <配對碼>
175
175
  | `configWrites` | 允許藍信回應頻道事件寫入配置 | `true` |
176
176
  | `name` | 此帳戶的顯示名稱 | — |
177
177
  | `accounts` | 多機器人設定 | — |
178
- | `groupPolicy` | 群聊策略:`open`(所有群)、`allowlist`(僅允許列表群)、`disabled`(禁止群訊息) | `allowlist` |
179
- | `groupAllowFrom` | 允許觸發機器人的群 ID | `[]` |
180
- | `groups` | 群級設定(requireMention、enabled、allowFrom) | |
178
+ | `groupPolicy` | 群聊策略:`open`(所有群)、`allowlist`(僅允許列表群)、`disabled`(禁止群訊息) | `open` |
179
+ | `groups` | 群級設定:`enabled`、`requireMention`、`autoMentionReply`、`autoQuoteReply`、`allowFrom`。key 為群 `chatId`。allowlist 模式設 `groups.<chatId>.enabled: true`。 | — |
180
+ | `autoMentionReply` | 群聊回覆時自動 @傳送者 | `false` |
181
+ | `autoQuoteReply` | 回覆時自動引用入站訊息(群聊和私聊) | `false` |
181
182
  | `ackMessage` | 在代理處理前傳送確認訊息 | `true` |
182
183
  | `revokeAckMessage` | 代理回覆遞送後自動撤回確認訊息。設為 `false` 則保留確認訊息可見(有些使用者偏好看到確認訊息而非撤回的系統通知) | `false` |
183
184
  | `mediaLocalRoots` | 透過媒體傳送本地檔案時允許的根目錄列表;空陣列預設為工作區 + `/tmp` | `[cwd, /tmp]` |
@@ -358,6 +359,7 @@ openclaw channels status --probe
358
359
  - **reminder**——formatText 中可選欄位;群組聊天中建議使用。提及使用者時在文字中包含「@姓名」。
359
360
  - **媒體標籤**——`<media>` 標籤適用於工作區檔案;外部路徑請使用 `lansenger_send_file`。
360
361
  - **openclaw skill/message lansenger**——這些 CLI 命令不存在;請使用代理工具。
362
+ - **lansenger-setup 技能自動複製**——插件在啟動時將 `lansenger-setup` 技能複製到 `~/.openclaw/skills/`,以便在頻道完全啟用前就能幫助設定藍信。此為設計行為,請勿手動刪除。
361
363
  - **代理工具**——代理工具(`lansenger_send_*`)需要工具插件且閘道注入成功——若工具不可用,請使用 CLI 作為備選。CLI 命令(`lansenger message send-*`)需要 `pipx install lansenger-cli`。
362
364
  - **alsoAllow**——本插件註冊了 agent 工具(`lansenger_send_*`),但在嚴格工具策略下可能**不可見**。需在 `openclaw.json` 中新增 `"tools": { "alsoAllow": ["group:plugins"] }` 以確保 agent 能看到並使用這些工具。否則工具可能靜默不出現在 agent 工具列表中。
363
365
 
@@ -387,49 +389,32 @@ npx tsc --noEmit
387
389
  ```
388
390
  openclaw-lansenger-channel/
389
391
  ├── src/
390
- │ ├── client.ts # 藍信 API 客戶端(WS、HTTP、媒體)
391
- │ ├── channel.ts # OpenClaw 频道插件
392
- │ ├── runtime.ts # 閘道運行時(方法、入站處理器)
393
- │ ├── tools.ts # 代理工具定義(10 個內建工具)
394
- │ ├── setup-wizard.ts # 設定精靈(多帳號配置遷移)
395
- │ ├── channel.test.ts # 频道插件測試
396
- │ ├── client.test.ts # API 客戶端測試
397
- │ ├── runtime.test.ts # 運行時測試
398
- │ ├── tools.test.ts # 工具測試
399
- │ └── setup-wizard.test.ts # 設定精靈測試
392
+ │ ├── client.ts # 藍信 API 客戶端(WS、HTTP、媒體)
393
+ │ ├── channel.ts # OpenClaw 頻道插件
394
+ │ ├── runtime.ts # 閘道運行時(入站處理、投遞)
395
+ │ ├── tools.ts # 代理工具定義(lansenger_send_*)
396
+ │ ├── persistent-store.ts # 磁碟狀態持久化
397
+ │ ├── setup-wizard.ts # 設定精靈(多帳號配置遷移)
398
+ │ ├── setup-i18n.ts # 設定精靈多語言
399
+ │ ├── *.test.ts # 單元測試
400
400
  ├── skills/
401
- └── lansenger-messaging/
402
- └── SKILL.md # 代理訊息策略(工具 + CLI)
403
- ├── dist/ # 編譯後的 JavaScript
404
- ├── index.ts # 插件入口
405
- ├── setup-entry.ts # 設定精靈入口
406
- ├── openclaw.plugin.json # 插件元資料與 GUI 設定
401
+ ├── lansenger-messaging/
402
+ └── SKILL.md # 代理訊息策略(工具 + CLI)
403
+ │ └── lansenger-setup/
404
+ │ └── SKILL.md # 安裝助手(自動複製至 ~/.openclaw/skills)
405
+ ├── dist/ # 編譯後的 JavaScript
406
+ ├── index.ts # 插件入口(registerFull、ensureSetupSkill)
407
+ ├── setup-entry.ts # 設定精靈入口
408
+ ├── openclaw.plugin.json # 插件元資料與 GUI 設定
409
+ ├── CHANGELOG.md
410
+ ├── VERSION
411
+ ├── vitest.config.ts
407
412
  ├── package.json
408
413
  └── tsconfig.json
409
414
  ```
410
415
 
411
416
  ## 故障排除
412
417
 
413
- ### OpenClaw v2026.5.18+:需要設備配對
414
-
415
- 升級 OpenClaw 至 v2026.5.18 或更高版本後,**任何客戶端(瀏覽器 Dashboard、Control UI)連線前必須完成設備配對**。這也影響藍信頻道——如果閘道主機的設備未經審批,WebSocket 連線可能被阻止,配對訊息無法傳送給藍信使用者。
416
-
417
- **修復——在 OpenClaw 閘道主機上執行以下命令:**
418
-
419
- ```bash
420
- # 1. 查看待審批的設備配對請求
421
- openclaw devices list
422
-
423
- # 2. 審批最近的請求(先預覽,再使用確切 ID 審批)
424
- openclaw devices approve --latest # 預覽
425
- openclaw devices approve <requestId> # 使用顯示的確切 ID 審批
426
-
427
- # 3. 重啟閘道
428
- openclaw gateway restart
429
- ```
430
-
431
- 詳見 [OpenClaw 設備文件](https://docs.openclaw.ai/cli/devices)。
432
-
433
418
  ### "行動端不支援查看憑證"
434
419
 
435
420
  請僅使用**藍信桌面端**。行動端應用不顯示機器人憑證。
@@ -175,9 +175,10 @@ openclaw pairing approve lansenger <配對碼>
175
175
  | `configWrites` | 允許藍信回應頻道事件寫入配置 | `true` |
176
176
  | `name` | 此帳戶的顯示名稱 | — |
177
177
  | `accounts` | 多機械人設定 | — |
178
- | `groupPolicy` | 羣聊策略:`open`(所有羣)、`allowlist`(僅允許列表羣)、`disabled`(禁止羣訊息) | `allowlist` |
179
- | `groupAllowFrom` | 允許觸發機械人的羣 ID | `[]` |
180
- | `groups` | 羣級設定(requireMention、enabled、allowFrom) | |
178
+ | `groupPolicy` | 羣聊策略:`open`(所有羣)、`allowlist`(僅允許列表羣)、`disabled`(禁止羣訊息) | `open` |
179
+ | `groups` | 羣級設定:`enabled`、`requireMention`、`autoMentionReply`、`autoQuoteReply`、`allowFrom`。key 為羣 `chatId`。allowlist 模式設 `groups.<chatId>.enabled: true`。 | — |
180
+ | `autoMentionReply` | 羣聊回覆時自動 @發送者 | `false` |
181
+ | `autoQuoteReply` | 回覆時自動引用入站訊息(羣聊和私聊) | `false` |
181
182
  | `ackMessage` | 在代理處理前發送確認訊息 | `true` |
182
183
  | `revokeAckMessage` | 代理回覆遞送後自動撤回確認訊息。設為 `false` 則保留確認訊息可見(有些使用者偏好看到確認訊息而非撤回的系統通知) | `false` |
183
184
  | `mediaLocalRoots` | 透過媒體發送本地檔案時允許的根目錄列表;空陣列預設為工作區 + `/tmp` | `[cwd, /tmp]` |
@@ -360,6 +361,7 @@ openclaw channels status --probe
360
361
  - **reminder** — formatText 中可選欄位;群組聊天中建議使用。提及使用者時在文字中包含「@姓名」。
361
362
  - **媒體標籤** — `<media>` 標籤適用於工作區檔案;外部路徑請使用 `lansenger_send_file`。
362
363
  - **openclaw skill/message lansenger** — 這些 CLI 命令不存在;請使用代理工具。
364
+ - **lansenger-setup 技能自動複製** — 插件在啟動時將 `lansenger-setup` 技能複製到 `~/.openclaw/skills/`,以便在頻道完全啟用前就能幫助設定藍信。此為設計行為,請勿手動刪除。
363
365
  - **代理工具** — 代理工具(`lansenger_send_*`)需要工具插件且網關注入成功 — 若工具不可用,請使用 CLI 作為備選。CLI 命令(`lansenger message send-*`)需要 `pipx install lansenger-cli`。
364
366
  - **alsoAllow** — 本插件註冊了 agent 工具(`lansenger_send_*`),但在嚴格工具策略下可能**不可見**。需在 `openclaw.json` 中新增 `"tools": { "alsoAllow": ["group:plugins"] }` 以確保 agent 能看到並使用這些工具。否則工具可能靜默不出現在 agent 工具列表中。
365
367
 
@@ -389,49 +391,32 @@ npx tsc --noEmit
389
391
  ```
390
392
  openclaw-lansenger-channel/
391
393
  ├── src/
392
- │ ├── client.ts # 藍信 API 客戶端(WS、HTTP、媒體)
393
- │ ├── channel.ts # OpenClaw 频道插件
394
- │ ├── runtime.ts # 網關運行時(方法、入站處理器)
395
- │ ├── tools.ts # 代理工具定義(10 個內建工具)
396
- │ ├── setup-wizard.ts # 設定精靈(多帳號配置遷移)
397
- │ ├── channel.test.ts # 频道插件測試
398
- │ ├── client.test.ts # API 客戶端測試
399
- │ ├── runtime.test.ts # 運行時測試
400
- │ ├── tools.test.ts # 工具測試
401
- │ └── setup-wizard.test.ts # 設定精靈測試
394
+ │ ├── client.ts # 藍信 API 客戶端(WS、HTTP、媒體)
395
+ │ ├── channel.ts # OpenClaw 頻道插件
396
+ │ ├── runtime.ts # 網關運行時(入站處理、投遞)
397
+ │ ├── tools.ts # 代理工具定義(lansenger_send_*)
398
+ │ ├── persistent-store.ts # 磁碟狀態持久化
399
+ │ ├── setup-wizard.ts # 設定精靈(多帳號配置遷移)
400
+ │ ├── setup-i18n.ts # 設定精靈多語言
401
+ │ ├── *.test.ts # 單元測試
402
402
  ├── skills/
403
- └── lansenger-messaging/
404
- └── SKILL.md # 代理訊息策略(工具 + CLI)
405
- ├── dist/ # 編譯後的 JavaScript
406
- ├── index.ts # 插件入口
407
- ├── setup-entry.ts # 設定精靈入口
408
- ├── openclaw.plugin.json # 插件元資料與 GUI 設定
403
+ ├── lansenger-messaging/
404
+ └── SKILL.md # 代理訊息策略(工具 + CLI)
405
+ │ └── lansenger-setup/
406
+ │ └── SKILL.md # 安裝助手(自動複製至 ~/.openclaw/skills)
407
+ ├── dist/ # 編譯後的 JavaScript
408
+ ├── index.ts # 插件入口(registerFull、ensureSetupSkill)
409
+ ├── setup-entry.ts # 設定精靈入口
410
+ ├── openclaw.plugin.json # 插件元資料與 GUI 設定
411
+ ├── CHANGELOG.md
412
+ ├── VERSION
413
+ ├── vitest.config.ts
409
414
  ├── package.json
410
415
  └── tsconfig.json
411
416
  ```
412
417
 
413
418
  ## 故障排除
414
419
 
415
- ### OpenClaw v2026.5.18+:需要設備配對
416
-
417
- 升級 OpenClaw 至 v2026.5.18 或更高版本後,**任何客戶端(瀏覽器 Dashboard、Control UI)連線前必須完成設備配對**。這也影響藍信頻道——如果網關主機的設備未經審批,WebSocket 連線可能被阻止,配對訊息無法發送給藍信使用者。
418
-
419
- **修復——在 OpenClaw 網關主機上執行以下命令:**
420
-
421
- ```bash
422
- # 1. 查看待審批的設備配對請求
423
- openclaw devices list
424
-
425
- # 2. 審批最近的請求(先預覽,再使用確切 ID 審批)
426
- openclaw devices approve --latest # 預覽
427
- openclaw devices approve <requestId> # 使用顯示的確切 ID 審批
428
-
429
- # 3. 重啟網關
430
- openclaw gateway restart
431
- ```
432
-
433
- 詳見 [OpenClaw 設備文件](https://docs.openclaw.ai/cli/devices)。
434
-
435
420
  ### "行動端不支援查看憑證"
436
421
 
437
422
  請僅使用**藍信桌面端**。行動端應用不顯示機械人憑證。
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ import { cpSync, existsSync, mkdirSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
1
5
  import { defineChannelPluginEntry } from "openclaw/plugin-sdk/channel-core";
2
6
  import { lansengerPlugin } from "./src/channel.js";
3
7
  import { startLansengerGateway } from "./src/runtime.js";
@@ -5,6 +9,24 @@ import { registerLansengerTools } from "./src/tools.js";
5
9
  export { resolveAccount, makeClient } from "./src/channel.js";
6
10
  export { getRunningClient, getRunningAccount, getLastInboundChatId } from "./src/runtime.js";
7
11
  export { LansengerClient } from "./src/client.js";
12
+ /**
13
+ * Ensure lansenger-setup skill is available in the global skills directory.
14
+ * This is needed because the plugin may not activate until channels.lansenger
15
+ * config exists, but the setup skill is meant to help create that config.
16
+ * Skills in ~/.openclaw/skills/ are always loaded regardless of plugin activation.
17
+ */
18
+ function ensureSetupSkill() {
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = dirname(__filename);
21
+ const srcPath = join(__dirname, "..", "skills", "lansenger-setup", "SKILL.md");
22
+ if (!existsSync(srcPath))
23
+ return;
24
+ const destDir = join(homedir(), ".openclaw", "skills", "lansenger-setup");
25
+ const destPath = join(destDir, "SKILL.md");
26
+ // Always overwrite so plugin upgrades propagate skill changes
27
+ mkdirSync(destDir, { recursive: true });
28
+ cpSync(srcPath, destPath);
29
+ }
8
30
  export default defineChannelPluginEntry({
9
31
  id: "lansenger",
10
32
  name: "Lansenger (蓝信)",
@@ -14,6 +36,7 @@ export default defineChannelPluginEntry({
14
36
  registerLansengerTools(api);
15
37
  },
16
38
  registerFull(api) {
39
+ ensureSetupSkill();
17
40
  startLansengerGateway(api);
18
41
  registerLansengerTools(api);
19
42
  },
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,eAAe,wBAAwB,CAAC;IACtC,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,4DAA4D;IACzE,MAAM,EAAE,eAAe;IACvB,mBAAmB,CAAC,GAAG;QACrB,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IACD,YAAY,CAAC,GAAG;QACd,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAC3B,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD;;;;;GAKG;AACH,SAAS,gBAAgB;IACvB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAE/E,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO;IAEjC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAE3C,8DAA8D;IAC9D,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC5B,CAAC;AAED,eAAe,wBAAwB,CAAC;IACtC,EAAE,EAAE,WAAW;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,4DAA4D;IACzE,MAAM,EAAE,eAAe;IACvB,mBAAmB,CAAC,GAAG;QACrB,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IACD,YAAY,CAAC,GAAG;QACd,gBAAgB,EAAE,CAAC;QACnB,qBAAqB,CAAC,GAAG,CAAC,CAAC;QAC3B,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC,CAAC"}
@@ -97,7 +97,6 @@ function resolveAccount(cfg, accountId) {
97
97
  const allowFrom = account?.allowFrom ?? [];
98
98
  const dmPolicy = account?.dmPolicy ?? account?.dmSecurity;
99
99
  const groupPolicy = account?.groupPolicy ?? section?.groupPolicy ?? "open";
100
- const groupAllowFrom = (account?.groupAllowFrom ?? section?.groupAllowFrom ?? []).map(String);
101
100
  const requireMention = account?.requireMention ?? section?.requireMention ?? true;
102
101
  const homeChannel = account?.homeChannel;
103
102
  const enabled = Boolean(appId && appSecret);
@@ -115,7 +114,6 @@ function resolveAccount(cfg, accountId) {
115
114
  allowFrom,
116
115
  dmPolicy,
117
116
  groupPolicy,
118
- groupAllowFrom,
119
117
  requireMention,
120
118
  homeChannel,
121
119
  enabled,
@@ -389,8 +387,8 @@ const chatPlugin = createChatChannelPlugin({
389
387
  }
390
388
  }
391
389
  }
392
- if (section.groupPolicy || section.groupAllowFrom) {
393
- findings.push({ checkId: "lansenger/group-config", severity: "info", title: "Group config is active / 群聊配置已生效", detail: "Lansenger supports group chat. groupPolicy and groupAllowFrom settings control group behavior. / 蓝信支持群聊功能。", remediation: "Group settings are active. / 群聊设置已启用。" });
390
+ if (section.groupPolicy) {
391
+ findings.push({ checkId: "lansenger/group-config", severity: "info", title: "Group config is active / 群聊配置已生效", detail: "Lansenger supports group chat. groupPolicy setting controls group behavior. Per-group settings can be configured via groups.<chatId>.enabled / 蓝信支持群聊功能。", remediation: "Group settings are active. / 群聊设置已启用。" });
394
392
  }
395
393
  const topLevelGatewayUrl = section.apiGatewayUrl;
396
394
  const envHasGatewayUrl = Boolean(process.env.LANSENGER_API_GATEWAY_URL);