@dhfpub/clawpool-openclaw 0.4.1
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/LICENSE +21 -0
- package/README.md +305 -0
- package/dist/index.js +4667 -0
- package/openclaw.plugin.json +12 -0
- package/package.json +82 -0
- package/skills/clawpool-auth-access/SKILL.md +233 -0
- package/skills/clawpool-auth-access/agents/openai.yaml +4 -0
- package/skills/clawpool-auth-access/references/api-contract.md +135 -0
- package/skills/clawpool-auth-access/references/clawpool-concepts.md +29 -0
- package/skills/clawpool-auth-access/references/openclaw-setup.md +154 -0
- package/skills/clawpool-auth-access/references/user-replies.md +29 -0
- package/skills/clawpool-auth-access/scripts/clawpool_auth.py +1550 -0
- package/skills/message-send/SKILL.md +225 -0
- package/skills/message-unsend/SKILL.md +242 -0
- package/skills/message-unsend/flowchart.mermaid +27 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: message-send
|
|
3
|
+
description: 发送私信消息。支持当前会话回复和跨会话私信。使用场景:(1) 需要给 owner/特定用户发送私信通知 (2) 跨会话发送消息 (3) 主动推送消息给指定目标。触发词:发私信、私信、发送消息、send message、notify。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 消息发送技能
|
|
7
|
+
|
|
8
|
+
这个技能用于通过 OpenClaw 的 `message` 工具发送消息。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 两种发送模式
|
|
13
|
+
|
|
14
|
+
### 1. 当前会话回复
|
|
15
|
+
|
|
16
|
+
在当前聊天上下文中回复消息,不需要额外参数。
|
|
17
|
+
|
|
18
|
+
**参数**:
|
|
19
|
+
- `action`: "send"
|
|
20
|
+
- `channel`: 当前渠道(如 "clawpool")
|
|
21
|
+
- `accountId`: 当前账号 ID
|
|
22
|
+
- `message`: 消息内容
|
|
23
|
+
|
|
24
|
+
**使用场景**:
|
|
25
|
+
- 在当前对话中回复用户
|
|
26
|
+
- 当前会话内的正常消息发送
|
|
27
|
+
|
|
28
|
+
### 2. 跨会话私信
|
|
29
|
+
|
|
30
|
+
脱离当前聊天上下文,给其他会话发送私信。
|
|
31
|
+
|
|
32
|
+
**参数**:
|
|
33
|
+
- `action`: "send"
|
|
34
|
+
- `channel`: "clawpool"
|
|
35
|
+
- `accountId`: 发送账号 ID(如 "{accountId}")
|
|
36
|
+
- `target`: 目标会话标识(格式见下文)
|
|
37
|
+
- `message`: 消息内容
|
|
38
|
+
|
|
39
|
+
**使用场景**:
|
|
40
|
+
- 给 owner 发送通知/审批请求
|
|
41
|
+
- 跨会话发送消息
|
|
42
|
+
- 主动推送消息给指定目标
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Target 格式说明
|
|
47
|
+
|
|
48
|
+
### Clawpool 私信格式
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
target=agent:{agentId}:clawpool:direct:{sessionId}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**参数说明**:
|
|
55
|
+
- `{agentId}`: 当前 agent 的 ID(如 "clawpool-developer")
|
|
56
|
+
- `{sessionId}`: 目标私聊会话的 session ID(UUID 格式)
|
|
57
|
+
|
|
58
|
+
**示例**:
|
|
59
|
+
```
|
|
60
|
+
target=agent:clawpool-developer:clawpool:direct:e72ce987-2d2e-40ed-bcc9-b336b4974512
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 如何获取 sessionId
|
|
64
|
+
|
|
65
|
+
1. **从 inbound context 获取**:当 owner 给你发私信时,inbound meta 中的 `chat_id` 包含 session ID
|
|
66
|
+
2. **从 MEMORY.md 获取**:如果 workspace 的 MEMORY.md 记录了 owner 的会话 ID,直接使用
|
|
67
|
+
3. **从会话列表获取**:通过 `sessions_list` 工具查找目标会话
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 实际调用示例
|
|
72
|
+
|
|
73
|
+
### 示例 1:当前会话回复
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"action": "send",
|
|
78
|
+
"channel": "clawpool",
|
|
79
|
+
"accountId": "{accountId}",
|
|
80
|
+
"message": "收到,正在处理中..."
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 示例 2:给 owner 发私信
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"action": "send",
|
|
89
|
+
"channel": "clawpool",
|
|
90
|
+
"accountId": "{accountId}",
|
|
91
|
+
"target": "agent:{agentId}:clawpool:direct:{ownerSessionId}",
|
|
92
|
+
"message": "需要您确认一个开发决策:..."
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 示例 3:发送到群组
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"action": "send",
|
|
101
|
+
"channel": "clawpool",
|
|
102
|
+
"accountId": "{accountId}",
|
|
103
|
+
"target": "{groupId}",
|
|
104
|
+
"message": "任务已完成,请查看结果"
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 关键参数说明
|
|
111
|
+
|
|
112
|
+
| 参数 | 必填 | 说明 |
|
|
113
|
+
|------|------|------|
|
|
114
|
+
| `action` | ✅ | 固定值 "send" |
|
|
115
|
+
| `channel` | ✅ | 渠道类型,如 "clawpool" |
|
|
116
|
+
| `accountId` | ✅ | 发送账号 ID |
|
|
117
|
+
| `message` | ✅ | 消息内容 |
|
|
118
|
+
| `target` | 私信必填 | 目标会话标识(私信/群组) |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## 注意事项
|
|
123
|
+
|
|
124
|
+
1. **区分 `target` 和 `to`**:Clawpool 使用 `target` 参数,不是 `to`
|
|
125
|
+
2. **sessionId 是 UUID**:不要混淆用户 ID 和会话 ID
|
|
126
|
+
3. **权限检查**:确保有目标会话的发送权限
|
|
127
|
+
4. **消息格式**:支持纯文本和 markdown
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 会话卡片消息协议
|
|
132
|
+
|
|
133
|
+
当消息内容是在**提醒用户打开某个群聊**、**打开某个私聊对话**、**引用某个具体对话记录入口**时,如果已经拿到了准确的 `session_id`,不要发送自然语言链接,也不要发送前端内部 JSON;必须发送显式的 `conversation-card` 指令文本,由前端统一解析并渲染为可点击的会话卡片。
|
|
134
|
+
|
|
135
|
+
### 标准格式
|
|
136
|
+
|
|
137
|
+
群聊:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
[[conversation-card|session_id=<SESSION_ID>|session_type=group|title=<GROUP_TITLE>]]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
私聊:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
[[conversation-card|session_id=<SESSION_ID>|session_type=private|title=<CHAT_TITLE>|peer_id=<PEER_ID>]]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 字段规则
|
|
150
|
+
|
|
151
|
+
- `session_id`:必填。必须是准确的目标会话 ID。
|
|
152
|
+
- `session_type`:必填。只能是 `group` 或 `private`。
|
|
153
|
+
- `title`:必填。展示给用户看的群标题或私聊标题。
|
|
154
|
+
- `peer_id`:仅私聊可选。用于补充私聊对象信息,但前端打开行为仍以 `session_id` 为准。
|
|
155
|
+
|
|
156
|
+
### 编码规则
|
|
157
|
+
|
|
158
|
+
为了避免标题里出现 `|`、`=`、`]`、空格、换行或其他保留字符导致前端解析失败,`conversation-card` 的字段值应按 URI component 规则编码后再写入指令。
|
|
159
|
+
|
|
160
|
+
- 推荐:对 `title`、`peer_id`、以及未来可能扩展的文本字段统一做 URI component 编码
|
|
161
|
+
- `session_id` 和 `session_type` 如果本身只包含安全字符,可以直接原样输出
|
|
162
|
+
- 前端会按 URI component 解码后再渲染
|
|
163
|
+
|
|
164
|
+
示例:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
[[conversation-card|session_id=session-9|session_type=group|title=%E4%BA%A7%E5%93%81%E8%AE%A8%E8%AE%BA%E7%BE%A4%20A]]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 使用要求
|
|
171
|
+
|
|
172
|
+
1. 只有在**已知准确 `session_id`** 时,才允许输出 `conversation-card`。
|
|
173
|
+
2. 如果没有 `session_id`,只能发送普通文本说明,不能伪造会话卡片。
|
|
174
|
+
3. 不要输出 `chat://...`、网页链接、或“点这里打开会话”之类的自然语言链接替代方案。
|
|
175
|
+
4. 不要构造前端内部 `biz_card` JSON,也不要尝试发送 Flutter/前端私有协议结构。
|
|
176
|
+
5. `conversation-card` 必须单行发送,不要换行,不要在同一条指令里混入多余说明文字。
|
|
177
|
+
6. 如果字段值包含特殊字符,先做 URI component 编码,再拼进指令文本。
|
|
178
|
+
|
|
179
|
+
### 示例
|
|
180
|
+
|
|
181
|
+
示例 1:提醒用户进入群聊
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
[[conversation-card|session_id=9d6a4b1d-5d37-4e38-ae6a-0c12a2c4c901|session_type=group|title=产品群]]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
示例 2:提醒用户进入某个私聊
|
|
188
|
+
|
|
189
|
+
```text
|
|
190
|
+
[[conversation-card|session_id=e72ce987-2d2e-40ed-bcc9-b336b4974512|session_type=private|title=Alice|peer_id=1001]]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 适用场景
|
|
194
|
+
|
|
195
|
+
- 给 owner 或其他用户发送“请进入这个对话继续处理”的提醒
|
|
196
|
+
- 发送“这是你要查看的群聊/私聊入口”的通知
|
|
197
|
+
- 发送引用型对话入口,而不是发送完整对话记录内容
|
|
198
|
+
|
|
199
|
+
### 不适用场景
|
|
200
|
+
|
|
201
|
+
- 普通文本通知
|
|
202
|
+
- 没有准确 `session_id` 的模糊提醒
|
|
203
|
+
- 需要直接发送完整对话记录内容的场景
|
|
204
|
+
- 仅仅告诉对方“我已经处理完了”,但并不需要跳转到某个具体会话的场景
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 错误处理
|
|
209
|
+
|
|
210
|
+
常见错误及处理方式:
|
|
211
|
+
|
|
212
|
+
- **target 不存在**:确认 session ID 是否正确
|
|
213
|
+
- **权限不足**:检查 accountId 是否有目标会话的发送权限
|
|
214
|
+
- **参数缺失**:确保必填参数都已提供
|
|
215
|
+
- **格式错误**:检查 target 格式是否符合要求
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 最佳实践
|
|
220
|
+
|
|
221
|
+
1. **记录 owner sessionId**:在 workspace 的 MEMORY.md 中记录 owner 的会话 ID,方便后续调用
|
|
222
|
+
2. **使用变量**:在代码中使用 `{agentId}`、`{accountId}` 等变量,而不是硬编码
|
|
223
|
+
3. **简洁明了**:私信消息应简洁,突出重点
|
|
224
|
+
4. **适当使用**:不要滥用私信功能,避免打扰 owner
|
|
225
|
+
5. **需要跳转时优先用会话卡片**:如果消息的核心目标是让对方打开某个已知会话,优先发送 `conversation-card` 指令,而不是发普通说明文字
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: message-unsend
|
|
3
|
+
description: 静默回撤/撤回已发送的消息。支持当前会话回撤和跨会话回撤。执行完成后必须直接结束,不得回复任何确认文本。触发词:撤回、回撤、删除消息、unsend、recall。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 消息回撤技能
|
|
7
|
+
|
|
8
|
+
这个技能用于通过 OpenClaw 的 `message` 工具回撤已发送的消息。
|
|
9
|
+
|
|
10
|
+
## 完成契约(最高优先级)
|
|
11
|
+
|
|
12
|
+
只要进入这个技能,最终输出必须满足下面 4 条:
|
|
13
|
+
|
|
14
|
+
1. **优先执行回撤动作**:能定位目标消息时,先撤回目标消息
|
|
15
|
+
2. **撤回指令消息**:当前这条“撤回/回撤”指令本身也要一起撤回
|
|
16
|
+
3. **绝不发送确认文本**:不要发送“已撤回”“撤回成功”“处理完成”等任何消息
|
|
17
|
+
4. **最终只允许 `NO_REPLY`**:技能结束时直接返回 `NO_REPLY`
|
|
18
|
+
|
|
19
|
+
这条完成契约高于其他示例、话术和分支说明。只要有冲突,一律以“静默执行并 `NO_REPLY` 结束”为准。
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## ⚠️ 权限控制(严格)
|
|
24
|
+
|
|
25
|
+
**只有郭同学(sender_id: 2030840865701756928)要求撤回消息时,才能执行此技能。**
|
|
26
|
+
|
|
27
|
+
### ✅ 允许执行的情况
|
|
28
|
+
- 郭同学在**私聊**中说"撤回/回撤/删除消息"
|
|
29
|
+
- 郭同学在**群聊**中说"撤回/回撤/删除消息"
|
|
30
|
+
- 郭同学引用消息要求撤回
|
|
31
|
+
|
|
32
|
+
### ❌ 禁止执行的情况
|
|
33
|
+
- 其他用户要求撤回(无论私聊还是群聊)
|
|
34
|
+
- 郭同学之外任何人发出撤回指令
|
|
35
|
+
|
|
36
|
+
### 🔇 对其他人撤回请求的处理
|
|
37
|
+
**完全忽略,不回复,不执行**
|
|
38
|
+
- ❌ 不要说"需要郭同学确认"
|
|
39
|
+
- ❌ 不要解释为什么不能撤回
|
|
40
|
+
- ❌ 不要回复任何内容
|
|
41
|
+
- ✅ 直接返回 `NO_REPLY` 或完全忽略
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🎯 核心行为:完全静默 + 双重撤回(最高优先级)
|
|
46
|
+
|
|
47
|
+
**撤回操作的黄金法则**:让一切就像从未发生过一样。
|
|
48
|
+
|
|
49
|
+
### 执行流程(必须严格遵守)
|
|
50
|
+
|
|
51
|
+
当郭同学发送撤回指令时,**必须按顺序执行三步**:
|
|
52
|
+
|
|
53
|
+
1. **撤回目标消息**(郭同学指定的消息)
|
|
54
|
+
2. **撤回指令消息**(郭同学发出的"撤回"指令本身)
|
|
55
|
+
3. **立即返回 NO_REPLY**(不发出任何回复)
|
|
56
|
+
|
|
57
|
+
### ⚠️ 绝对禁止
|
|
58
|
+
|
|
59
|
+
- ❌ 不要发送"已撤回"确认消息
|
|
60
|
+
- ❌ 不要发送"撤回成功"
|
|
61
|
+
- ❌ 不要发送"处理完成"
|
|
62
|
+
- ❌ 不要发送错误解释或补充说明
|
|
63
|
+
- ❌ 不要发送任何内容
|
|
64
|
+
- ❌ 不要留下任何"尾巴"
|
|
65
|
+
|
|
66
|
+
### 📋 实际示例
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
场景:郭同学引用消息 A,发送"撤回"(消息 B)
|
|
70
|
+
|
|
71
|
+
正确执行:
|
|
72
|
+
Step 1: unsend(messageId=A) // 撤回目标消息
|
|
73
|
+
Step 2: unsend(messageId=B) // 撤回指令消息
|
|
74
|
+
Step 3: 返回 NO_REPLY // 完全静默
|
|
75
|
+
|
|
76
|
+
最终效果:
|
|
77
|
+
- 消息 A 被删除 ✓
|
|
78
|
+
- 消息 B 被删除 ✓
|
|
79
|
+
- 没有任何新消息产生 ✓
|
|
80
|
+
- 就像什么都没发生过 ✓
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 🔑 关键要点
|
|
84
|
+
|
|
85
|
+
**双重撤回的目的**:避免留下"撤回"指令这条消息,让整个操作完全隐形。
|
|
86
|
+
|
|
87
|
+
**静默模式的目的**:不产生任何新消息,保持对话历史的干净。无论成功、失败、忽略还是权限拒绝,最终都不要向对话再写入任何文本。
|
|
88
|
+
|
|
89
|
+
**最终效果**:目标消息没了,指令消息也没了,就像它们从未存在过。
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 两种回撤模式
|
|
94
|
+
|
|
95
|
+
### 1. 当前会话回撤
|
|
96
|
+
|
|
97
|
+
在当前聊天上下文中回撤消息,只需要 `messageId`。
|
|
98
|
+
|
|
99
|
+
**参数**:
|
|
100
|
+
- `action`: "unsend"
|
|
101
|
+
- `messageId`: 要回撤的消息 ID(字符串)
|
|
102
|
+
|
|
103
|
+
**示例**:
|
|
104
|
+
```
|
|
105
|
+
action=unsend
|
|
106
|
+
params={ "messageId": "18889990099" }
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**使用场景**:
|
|
110
|
+
- 用户在当前对话中说"把刚才那条撤回"
|
|
111
|
+
- 你发送了错误内容需要立即回撤
|
|
112
|
+
- 当前会话内的消息管理
|
|
113
|
+
|
|
114
|
+
### 2. 跨会话回撤
|
|
115
|
+
|
|
116
|
+
脱离当前聊天上下文,回撤其他会话中的消息,需要 `messageId` + `sessionId`。
|
|
117
|
+
|
|
118
|
+
**参数**:
|
|
119
|
+
- `action`: "unsend"
|
|
120
|
+
- `messageId`: 要回撤的消息 ID(字符串)
|
|
121
|
+
- `sessionId`: 目标会话 ID(字符串)
|
|
122
|
+
|
|
123
|
+
**示例**:
|
|
124
|
+
```
|
|
125
|
+
action=unsend
|
|
126
|
+
params={
|
|
127
|
+
"messageId": "18889990099",
|
|
128
|
+
"sessionId": "u_1001_u_2001"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**使用场景**:
|
|
133
|
+
- 回撤在其他渠道(Discord、Telegram、Signal 等)发送的消息
|
|
134
|
+
- 回撤在其他私聊或群组中的消息
|
|
135
|
+
- 跨会话管理消息
|
|
136
|
+
|
|
137
|
+
## 实际调用示例
|
|
138
|
+
|
|
139
|
+
### 示例 1:当前会话回撤
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"action": "unsend",
|
|
144
|
+
"messageId": "2033329436849868800"
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 示例 2:跨会话回撤
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"action": "unsend",
|
|
153
|
+
"messageId": "18889990099",
|
|
154
|
+
"sessionId": "telegram:session:123456789"
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 重要说明
|
|
159
|
+
|
|
160
|
+
1. **Clawpool 实际能力**:经实测,可以回撤 agent 和用户发送的消息
|
|
161
|
+
2. **时间限制**:某些渠道(如 Telegram)有回撤时间窗口限制
|
|
162
|
+
3. **权限要求**:需要确保有目标会话的操作权限
|
|
163
|
+
4. **messageId 获取**:
|
|
164
|
+
- 从 inbound context 中的 `message_id` 字段获取
|
|
165
|
+
- 从之前发送消息的返回结果中获取
|
|
166
|
+
- 从会话历史记录中查找
|
|
167
|
+
|
|
168
|
+
## 错误处理
|
|
169
|
+
|
|
170
|
+
常见错误只做内部判断,**不要转成对用户的回复**:
|
|
171
|
+
|
|
172
|
+
- **messageId 不存在**:停止后续动作,直接 `NO_REPLY`
|
|
173
|
+
- **权限不足**:停止后续动作,直接 `NO_REPLY`
|
|
174
|
+
- **超时限制**:停止后续动作,直接 `NO_REPLY`
|
|
175
|
+
- **消息已删除**:视为无需补充说明,直接 `NO_REPLY`
|
|
176
|
+
|
|
177
|
+
### 错误处理禁令
|
|
178
|
+
|
|
179
|
+
- ❌ 不要回复“消息不存在”
|
|
180
|
+
- ❌ 不要回复“权限不足”
|
|
181
|
+
- ❌ 不要回复“撤回失败”
|
|
182
|
+
- ❌ 不要追问用户要不要重试
|
|
183
|
+
- ✅ 保持静默结束
|
|
184
|
+
|
|
185
|
+
## Clawpool 实测结果(2026-03-16 更新)
|
|
186
|
+
|
|
187
|
+
**状态**:✅ 可用
|
|
188
|
+
|
|
189
|
+
在 Clawpool 渠道测试成功,可以撤回 agent 和用户发送的消息。
|
|
190
|
+
|
|
191
|
+
**必填参数**(完整参数):
|
|
192
|
+
```
|
|
193
|
+
action=unsend
|
|
194
|
+
channel=clawpool
|
|
195
|
+
accountId=default
|
|
196
|
+
topic=<session-id> // 不要加 clawpool: 前缀
|
|
197
|
+
messageId=<message-id>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**测试记录**:
|
|
201
|
+
```json
|
|
202
|
+
// 撤回 agent 发送的消息
|
|
203
|
+
{
|
|
204
|
+
"action": "unsend",
|
|
205
|
+
"channel": "clawpool",
|
|
206
|
+
"accountId": "default",
|
|
207
|
+
"topic": "5c495569-ba1b-46ac-8070-5a1193a3f950",
|
|
208
|
+
"messageId": "2033371385615093760"
|
|
209
|
+
}
|
|
210
|
+
// 返回:
|
|
211
|
+
{
|
|
212
|
+
"ok": true,
|
|
213
|
+
"deleted": true,
|
|
214
|
+
"unsent": true,
|
|
215
|
+
"messageId": "2033371385615093760",
|
|
216
|
+
"sessionId": "5c495569-ba1b-46ac-8070-5a1193a3f950"
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 撤回用户发送的消息(sender_id: 2030840865701756928)
|
|
220
|
+
{
|
|
221
|
+
"action": "unsend",
|
|
222
|
+
"channel": "clawpool",
|
|
223
|
+
"accountId": "default",
|
|
224
|
+
"topic": "5c495569-ba1b-46ac-8070-5a1193a3f950",
|
|
225
|
+
"messageId": "2033474284277993472"
|
|
226
|
+
}
|
|
227
|
+
// 返回:
|
|
228
|
+
{
|
|
229
|
+
"ok": true,
|
|
230
|
+
"deleted": true,
|
|
231
|
+
"unsent": true,
|
|
232
|
+
"messageId": "2033474284277993472",
|
|
233
|
+
"sessionId": "5c495569-ba1b-46ac-8070-5a1193a3f950"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**重要说明**:
|
|
238
|
+
- ⚠️ 必须使用完整参数(channel, accountId, topic, messageId),只传 messageId 会失败
|
|
239
|
+
- topic 参数不要加 `clawpool:` 前缀,直接使用 session ID
|
|
240
|
+
- 返回结果包含 `deleted` 和 `unsent` 状态确认
|
|
241
|
+
- ✅ **可以撤回 agent 和用户发送的消息**(Clawpool 特殊能力)
|
|
242
|
+
- ⚠️ 但权限控制仍然有效:只允许郭同学(sender_id: 2030840865701756928)要求撤回
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
```mermaid
|
|
2
|
+
flowchart TD
|
|
3
|
+
Start([收到撤回请求]) --> CheckSender{sender_id = 2030840865701756928?}
|
|
4
|
+
CheckSender -->|否| End1[直接 NO_REPLY]
|
|
5
|
+
CheckSender -->|是| ResolveTarget{能定位目标消息?}
|
|
6
|
+
|
|
7
|
+
ResolveTarget -->|否| End2[直接 NO_REPLY]
|
|
8
|
+
ResolveTarget -->|是| PrepareTarget[准备目标消息参数<br/>action=unsend<br/>channel=clawpool<br/>accountId=default<br/>topic=sessionId<br/>messageId=目标消息]
|
|
9
|
+
|
|
10
|
+
PrepareTarget --> UnsendTarget[执行目标消息撤回]
|
|
11
|
+
UnsendTarget --> TargetResult{成功或已删除?}
|
|
12
|
+
TargetResult -->|否| End3[直接 NO_REPLY]
|
|
13
|
+
TargetResult -->|是| PrepareCommand[准备指令消息参数<br/>action=unsend<br/>channel=clawpool<br/>accountId=default<br/>topic=sessionId<br/>messageId=当前指令消息]
|
|
14
|
+
|
|
15
|
+
PrepareCommand --> UnsendCommand[执行指令消息撤回]
|
|
16
|
+
UnsendCommand --> End4[返回 NO_REPLY]
|
|
17
|
+
|
|
18
|
+
style Start fill:#e1f5e1
|
|
19
|
+
style End1 fill:#ffe1e1
|
|
20
|
+
style End2 fill:#ffe1e1
|
|
21
|
+
style End3 fill:#ffe1e1
|
|
22
|
+
style End4 fill:#e1f5e1
|
|
23
|
+
style CheckSender fill:#fff4e1
|
|
24
|
+
style ResolveTarget fill:#fff4e1
|
|
25
|
+
style UnsendTarget fill:#e1f0ff
|
|
26
|
+
style UnsendCommand fill:#e1f0ff
|
|
27
|
+
```
|