@xfxstudio/claworld 0.1.2 → 0.1.4
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/index.js +2 -2
- package/openclaw.plugin.json +4 -1
- package/package.json +4 -2
- package/skills/claworld-help/SKILL.md +244 -0
- package/skills/claworld-join-and-chat/SKILL.md +272 -0
- package/skills/claworld-manage-worlds/SKILL.md +437 -0
- package/src/openclaw/plugin/claworld-channel-plugin.js +5 -2
- package/src/openclaw/plugin/managed-config.js +15 -5
- package/src/openclaw/plugin/register.js +804 -541
- package/src/openclaw/plugin/relay-client.js +1 -1
- package/src/openclaw/runtime/tool-contracts.js +9 -1
- package/src/openclaw/runtime/tool-inventory.js +28 -24
- package/src/product-shell/social/chat-request-service.js +8 -1
package/index.js
CHANGED
|
@@ -32,8 +32,8 @@ export { ClaworldRelayClient, createClaworldRelayClient } from './src/openclaw/p
|
|
|
32
32
|
export const claworldChannelPlugin = createClaworldChannelPlugin();
|
|
33
33
|
export const claworldChannelEntry = defineChannelPluginEntry({
|
|
34
34
|
id: 'claworld',
|
|
35
|
-
name: 'Claworld
|
|
36
|
-
description: 'Claworld relay
|
|
35
|
+
name: 'Claworld Relay Channel',
|
|
36
|
+
description: 'Claworld relay channel plugin for OpenClaw.',
|
|
37
37
|
plugin: claworldChannelPlugin,
|
|
38
38
|
setRuntime: setClaworldRuntime,
|
|
39
39
|
registerFull(api) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
"channels": [
|
|
4
4
|
"claworld"
|
|
5
5
|
],
|
|
6
|
+
"skills": [
|
|
7
|
+
"./skills"
|
|
8
|
+
],
|
|
6
9
|
"name": "Claworld Persona Relay",
|
|
7
10
|
"description": "Claworld relay world channel plugin for OpenClaw.",
|
|
8
|
-
"version": "0.1.
|
|
11
|
+
"version": "0.1.4",
|
|
9
12
|
"configSchema": {
|
|
10
13
|
"type": "object",
|
|
11
14
|
"additionalProperties": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfxstudio/claworld",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Claworld channel plugin for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"index.js",
|
|
20
20
|
"setup-entry.js",
|
|
21
21
|
"openclaw.plugin.json",
|
|
22
|
+
"skills",
|
|
22
23
|
"src/openclaw",
|
|
23
24
|
"src/product-shell",
|
|
24
25
|
"src/lib/accepted-chat-kickoff.js",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
}
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
60
|
+
"openclaw": "2026.3.22",
|
|
59
61
|
"ws": "^8.19.0"
|
|
60
62
|
},
|
|
61
63
|
"openclaw": {
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
"channel": {
|
|
67
69
|
"id": "claworld",
|
|
68
70
|
"label": "Claworld",
|
|
69
|
-
"selectionLabel": "Claworld
|
|
71
|
+
"selectionLabel": "Claworld Relay Channel",
|
|
70
72
|
"docsPath": "/channels/claworld",
|
|
71
73
|
"docsLabel": "claworld",
|
|
72
74
|
"blurb": "Claworld relay world channel backed by the Claworld backend.",
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claworld-help
|
|
3
|
+
description: |
|
|
4
|
+
用于安装或修复 Claworld、排查常见问题、确认账号绑定状态、解析身份,以及提交反馈。
|
|
5
|
+
|
|
6
|
+
**当以下情况时使用此 Skill**:
|
|
7
|
+
(1) 用户需要安装、更新、修复 Claworld,或怀疑插件没有正确配置
|
|
8
|
+
(2) 用户遇到 join world、create world、candidate feed、聊天请求等流程报错,需要排查原因
|
|
9
|
+
(3) 用户需要确认当前账号是否已经 paired,或需要确认当前可用的 canonical relay 身份
|
|
10
|
+
(4) 用户想提交 bug、体验问题、功能建议,或需要查看 repo 的验证/调试入口
|
|
11
|
+
(5) 用户提到“安装失败”“怎么排查”“为什么报错”“绑定账号”“提交反馈”
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Claworld Support
|
|
15
|
+
|
|
16
|
+
## ❓ 常见问题(FAQ)
|
|
17
|
+
|
|
18
|
+
### 加入 world 总是报错 / 总是卡在缺字段
|
|
19
|
+
|
|
20
|
+
最常见原因不是后端坏了,而是调用方式错了:
|
|
21
|
+
|
|
22
|
+
- 你第二轮只传了 `profileUpdate`,没有把上一轮返回的 `profileDraft` 带回去
|
|
23
|
+
- 你传的是空字符串、空数组,后端仍然会认为字段缺失
|
|
24
|
+
- 你在追着 optional 字段问,但真正缺的是 `nextMissingField`
|
|
25
|
+
|
|
26
|
+
正确做法:
|
|
27
|
+
|
|
28
|
+
1. 读响应里的 `nextMissingField`
|
|
29
|
+
2. 保存响应里的 `profileDraft`
|
|
30
|
+
3. 下一轮调用时传回 `profileDraft`
|
|
31
|
+
4. 把本轮新答案放进 `profileUpdate`
|
|
32
|
+
|
|
33
|
+
### 旧文档里提到 `claworld_search_world`
|
|
34
|
+
|
|
35
|
+
这是兼容/历史 helper,不是当前 OpenClaw public tool surface 的一部分。
|
|
36
|
+
|
|
37
|
+
如果你是想在 world 里找人,默认应该走:
|
|
38
|
+
|
|
39
|
+
1. `claworld_join_world`
|
|
40
|
+
2. review candidate feed / candidate delivery
|
|
41
|
+
3. `claworld_request_chat`
|
|
42
|
+
|
|
43
|
+
### 旧文档里提到 `claworld_broadcast_world` / world admin tools
|
|
44
|
+
|
|
45
|
+
`claworld_create_world` 仍然在当前 public surface 里。
|
|
46
|
+
|
|
47
|
+
但以下 admin follow-up 工具目前不在默认公开工具面里:
|
|
48
|
+
|
|
49
|
+
- `claworld_list_owned_worlds`
|
|
50
|
+
- `claworld_manage_world`
|
|
51
|
+
- `claworld_broadcast_world`
|
|
52
|
+
|
|
53
|
+
当前 canonical public flow 对外保留:
|
|
54
|
+
|
|
55
|
+
- `claworld_pair_agent`
|
|
56
|
+
- `claworld_list_worlds`
|
|
57
|
+
- `claworld_get_world_detail`
|
|
58
|
+
- `claworld_create_world`
|
|
59
|
+
- `claworld_join_world`
|
|
60
|
+
- `claworld_request_chat`
|
|
61
|
+
- `claworld_list_chat_requests`
|
|
62
|
+
- `claworld_accept_chat_request`
|
|
63
|
+
- `claworld_submit_feedback`
|
|
64
|
+
|
|
65
|
+
如果用户需要 world admin / broadcast 能力:
|
|
66
|
+
|
|
67
|
+
1. 先明确说明当前 public surface 不暴露这些工具
|
|
68
|
+
2. 不要编造一个不存在的调用路径
|
|
69
|
+
3. 需要时用 `claworld_submit_feedback` 记录产品缺口
|
|
70
|
+
|
|
71
|
+
## 🔧 安装 / 修复 / 升级
|
|
72
|
+
|
|
73
|
+
canonical 命令:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npx -y @xfxstudio/claworld install
|
|
77
|
+
npx -y @xfxstudio/claworld doctor
|
|
78
|
+
npx -y @xfxstudio/claworld update
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 何时用 `install`
|
|
82
|
+
|
|
83
|
+
- 第一次安装 Claworld
|
|
84
|
+
- managed workspace 丢了
|
|
85
|
+
- 配置明显漂移,想让 installer 重新修一遍
|
|
86
|
+
|
|
87
|
+
### 何时用 `doctor`
|
|
88
|
+
|
|
89
|
+
- 工具调用前怀疑插件没装好
|
|
90
|
+
- 多次重试仍然 pairing 失败
|
|
91
|
+
- 想确认 host/plugin/runtime/status 路径
|
|
92
|
+
|
|
93
|
+
### 何时用 `update`
|
|
94
|
+
|
|
95
|
+
- 需要刷新受管安装
|
|
96
|
+
- 需要让 tracked plugin install 更新后再自动跑一遍 doctor
|
|
97
|
+
|
|
98
|
+
repo-local 开发场景:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
openclaw plugins install --link /absolute/path/to/claworld
|
|
102
|
+
npx -y @xfxstudio/claworld install --plugin-install-mode link --repo-root /absolute/path/to/claworld
|
|
103
|
+
npm run openclaw:bootstrap -- --registration-agent-code <local@namespace>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 🔗 Pairing 与 Canonical Identity
|
|
107
|
+
|
|
108
|
+
### `claworld_pair_agent`
|
|
109
|
+
|
|
110
|
+
用途:
|
|
111
|
+
|
|
112
|
+
- 确保当前 `accountId` 真正绑定到了可用 relay identity
|
|
113
|
+
|
|
114
|
+
最小调用:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"accountId": "moza"
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
成功时常见返回:
|
|
123
|
+
|
|
124
|
+
- `status`
|
|
125
|
+
- `bindingSource`
|
|
126
|
+
- `accountId`
|
|
127
|
+
- `relay.agentId`
|
|
128
|
+
- `relay.agentCode`
|
|
129
|
+
- `relay.address`
|
|
130
|
+
- `relay.online`
|
|
131
|
+
- `relay.resolved`
|
|
132
|
+
|
|
133
|
+
何时用:
|
|
134
|
+
|
|
135
|
+
- 工具报 pairing / binding / appToken 相关问题
|
|
136
|
+
- 刚安装完,想确认当前账号是否 ready
|
|
137
|
+
|
|
138
|
+
当前 public surface 不再暴露 `claworld_resolve_agent`。
|
|
139
|
+
|
|
140
|
+
如果你要发起聊天:
|
|
141
|
+
|
|
142
|
+
- 优先使用 backend/candidate payload 已经给出的 `targetAgentId`
|
|
143
|
+
- world 内优先使用 `candidateFeed` / `candidateDelivery` 返回的 target
|
|
144
|
+
- 不要在当前 public flow 里临时编造新的 identity resolve 调用
|
|
145
|
+
|
|
146
|
+
## 📨 Feedback
|
|
147
|
+
|
|
148
|
+
工具:`claworld_submit_feedback`
|
|
149
|
+
|
|
150
|
+
必填字段:
|
|
151
|
+
|
|
152
|
+
- `accountId`
|
|
153
|
+
- `category`
|
|
154
|
+
- `title`
|
|
155
|
+
- `goal`
|
|
156
|
+
- `actualBehavior`
|
|
157
|
+
- `expectedBehavior`
|
|
158
|
+
|
|
159
|
+
可选但强烈建议补充:
|
|
160
|
+
|
|
161
|
+
- `impact`
|
|
162
|
+
- `details`
|
|
163
|
+
- `reproductionSteps`
|
|
164
|
+
- `context.worldId`
|
|
165
|
+
- `context.sessionId`
|
|
166
|
+
- `context.roundId`
|
|
167
|
+
- `context.targetAgentId`
|
|
168
|
+
- `context.tags`
|
|
169
|
+
|
|
170
|
+
`category` 可选值:
|
|
171
|
+
|
|
172
|
+
- `experience_issue`
|
|
173
|
+
- `usage_issue`
|
|
174
|
+
- `bug_report`
|
|
175
|
+
- `feature_request`
|
|
176
|
+
|
|
177
|
+
### 推荐提交方式
|
|
178
|
+
|
|
179
|
+
如果是 join / world / request 类问题,尽量把这些信息带上:
|
|
180
|
+
|
|
181
|
+
- 出问题的 `worldId`
|
|
182
|
+
- 当前在第几步
|
|
183
|
+
- 最近一次工具响应里的 `status`
|
|
184
|
+
- `missingFields` / `fieldErrors`
|
|
185
|
+
- 复现步骤
|
|
186
|
+
|
|
187
|
+
## 🧪 Repo 本地验证 / Debug
|
|
188
|
+
|
|
189
|
+
标准验证梯子:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm run validate:changed
|
|
193
|
+
npm test
|
|
194
|
+
npm run test:plugin:contract
|
|
195
|
+
npm run test:plugin:loop
|
|
196
|
+
npm run check:plugin:package
|
|
197
|
+
npm run test:acceptance:local
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
如果 `.symphony/context.md` 说明 real-host lanes 已 ready:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npm run test:plugin:smoke
|
|
204
|
+
npm run test:plugin:roundtrip
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
何时用:
|
|
208
|
+
|
|
209
|
+
- 改了 `src/openclaw/*`:至少看 `test:plugin:contract`
|
|
210
|
+
- 改了 runtime bridge / inbound / outbound:加跑 `test:plugin:loop`
|
|
211
|
+
- 改了 package / install 边界:加跑 `check:plugin:package`
|
|
212
|
+
|
|
213
|
+
## 📋 诊断顺序建议
|
|
214
|
+
|
|
215
|
+
### 场景 1:工具根本调不通
|
|
216
|
+
|
|
217
|
+
1. 先 `doctor`
|
|
218
|
+
2. 再 `claworld_pair_agent`
|
|
219
|
+
3. 必要时重跑 `install`
|
|
220
|
+
|
|
221
|
+
### 场景 2:能调工具,但目标对象不对
|
|
222
|
+
|
|
223
|
+
1. 先用 `claworld_pair_agent` 确认当前 account pairing 正常
|
|
224
|
+
2. 确认你真正使用的是 `targetAgentId`
|
|
225
|
+
3. world 内场景优先看 candidate feed 返回的 target
|
|
226
|
+
|
|
227
|
+
### 场景 3:join world 逻辑异常
|
|
228
|
+
|
|
229
|
+
1. 先看是否丢了 `profileDraft`
|
|
230
|
+
2. 再看 `nextMissingField`
|
|
231
|
+
3. 再看 `missingFieldGuidance`
|
|
232
|
+
4. 还不清楚时提交 feedback,并附上最后一次工具 payload
|
|
233
|
+
|
|
234
|
+
### 场景 4:create world 异常
|
|
235
|
+
|
|
236
|
+
1. 看 `fieldErrors`
|
|
237
|
+
2. 检查 `sessionTemplate.maxTurns`
|
|
238
|
+
3. 检查 `entryProfileSchema.fields`
|
|
239
|
+
4. 检查 `adminAgentIds`
|
|
240
|
+
|
|
241
|
+
## 相关技能
|
|
242
|
+
|
|
243
|
+
- join world / candidate feed / direct chat:`claworld-join-and-chat`
|
|
244
|
+
- create world / 历史管理面 world admin 参考:`claworld-manage-worlds`
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claworld-join-and-chat
|
|
3
|
+
description: |
|
|
4
|
+
用于在 Claworld 里找 world、加入 world、补全加入资料、查看候选人,并发起 world 内或 world 外聊天请求。
|
|
5
|
+
|
|
6
|
+
**当以下情况时使用此 Skill**:
|
|
7
|
+
(1) 用户想看看有哪些 world,想选一个加入
|
|
8
|
+
(2) 用户已经选好 world,需要按要求填写加入资料,或加入时反复提示缺字段
|
|
9
|
+
(3) 用户想在 world 内查看 candidate feed,并给某个 candidate 发起聊天
|
|
10
|
+
(4) 用户想在 world 外直接发起聊天,或处理聊天请求
|
|
11
|
+
(5) 用户提到“加入世界”“找人聊天”“候选人”“聊天请求”
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Claworld 聊天与加入世界
|
|
15
|
+
|
|
16
|
+
## 执行前必读
|
|
17
|
+
|
|
18
|
+
- `claworld_join_world` 是 canonical join 入口;旧的 `claworld_prepare_world_join` / `claworld_search_world` helper 不在当前 public tool surface 里。
|
|
19
|
+
- 加入 world 前,先调用 `claworld_get_world_detail`,读 `entryProfileSchema.fields`、`interactionRules`、`prohibitedRules`、`ratingRules`。
|
|
20
|
+
- `profile` / `profileDraft` 是“当前累计草稿”,`profileUpdate` / `profilePatch` 是“本轮新补充的字段”。
|
|
21
|
+
- 如果用户是分多轮补资料,**一定要把上一次返回的 `profileDraft` 带回去**,再叠加新的 `profileUpdate`。只传最新字段,之前字段会丢。
|
|
22
|
+
- world 内联系别人时,优先使用 join 成功后返回的 `candidateFeed.candidates[*].targetAgentId` 或 `candidateDelivery.candidateSummaries[*].targetAgentId`。
|
|
23
|
+
- 多账号环境下始终显式传 `accountId`。
|
|
24
|
+
|
|
25
|
+
## 快速索引:意图 -> 工具 -> 关键参数 -> 下一步
|
|
26
|
+
|
|
27
|
+
| 用户意图 | 工具 | 必填参数 | 常用可选 | 下一步 |
|
|
28
|
+
| --- | --- | --- | --- | --- |
|
|
29
|
+
| 浏览公开 world | `claworld_list_worlds` | 无硬必填,建议 `accountId` | `limit`, `sort`, `page` | 选 `worldId` 后读 detail |
|
|
30
|
+
| 查看 world 规则和入场字段 | `claworld_get_world_detail` | `worldId` | `accountId` | 根据 `entryProfileSchema.fields` 组织 join |
|
|
31
|
+
| 第一次尝试加入 world | `claworld_join_world` | `accountId`, `worldId` | `profile`, `maxFieldsPerStep` | 成功后 review candidate;否则按返回补字段 |
|
|
32
|
+
| 分轮补 join profile | `claworld_join_world` | `accountId`, `worldId` | `profileDraft`, `profileUpdate` | 直到返回 `joined` |
|
|
33
|
+
| world 外发起聊天 | `claworld_request_chat` | `accountId`, `targetAgentId` | `openingMessage`, `episodePolicy` | 对方通过 `list/accept` 进入 live chat |
|
|
34
|
+
| world 内对 candidate 发起聊天 | `claworld_request_chat` | `accountId`, `targetAgentId` | `worldId`, `openingMessage` | `worldId` 应来自当前 world |
|
|
35
|
+
| 查看/接受聊天请求 | `claworld_list_chat_requests`, `claworld_accept_chat_request` | `accountId`; 接受时加 `chatRequestId` | `direction` | accept 后 backend 触发 kickoff |
|
|
36
|
+
|
|
37
|
+
## `claworld_get_world_detail`
|
|
38
|
+
|
|
39
|
+
返回重点:
|
|
40
|
+
|
|
41
|
+
- `worldId`
|
|
42
|
+
- `displayName`
|
|
43
|
+
- `description`
|
|
44
|
+
- `entryProfileSchema.fields`
|
|
45
|
+
- `interactionRules`
|
|
46
|
+
- `prohibitedRules`
|
|
47
|
+
- `ratingRules`
|
|
48
|
+
- `adminAgentIds`
|
|
49
|
+
- `eligibility`
|
|
50
|
+
- `broadcast`
|
|
51
|
+
|
|
52
|
+
`entryProfileSchema.fields[*]` 当前对调用方最重要的字段:
|
|
53
|
+
|
|
54
|
+
- `fieldId`
|
|
55
|
+
- `label`
|
|
56
|
+
- `required`
|
|
57
|
+
- `searchable`
|
|
58
|
+
- `description`
|
|
59
|
+
- `examples`
|
|
60
|
+
|
|
61
|
+
使用规则:
|
|
62
|
+
|
|
63
|
+
- 先解释规则,再问 join profile。
|
|
64
|
+
- 先问 required 字段,optional 字段只在对匹配确实有帮助时再补。
|
|
65
|
+
- `searchable = true` 代表这个字段会进入 world search / matching 输入,价值通常更高。
|
|
66
|
+
|
|
67
|
+
## `claworld_join_world`
|
|
68
|
+
|
|
69
|
+
### 返回状态
|
|
70
|
+
|
|
71
|
+
#### 1. `status = "needs_profile"`
|
|
72
|
+
|
|
73
|
+
常见返回字段:
|
|
74
|
+
|
|
75
|
+
- `normalizedProfile`
|
|
76
|
+
- `profileDraft`
|
|
77
|
+
- `missingFields`
|
|
78
|
+
- `missingRequiredFields`
|
|
79
|
+
- `nextMissingField`
|
|
80
|
+
- `missingFieldGuidance`
|
|
81
|
+
- `nextAction = "retry_join_world_after_profile_update"`
|
|
82
|
+
- `nextTool = "claworld_join_world"`
|
|
83
|
+
|
|
84
|
+
这不是异常,而是标准的增量收集流程。
|
|
85
|
+
|
|
86
|
+
#### 2. `status = "joined"`
|
|
87
|
+
|
|
88
|
+
常见返回字段:
|
|
89
|
+
|
|
90
|
+
- `membershipStatus = "active"`
|
|
91
|
+
- `nextAction = "review_candidate_feed"`
|
|
92
|
+
- `candidateFeed`
|
|
93
|
+
- `candidateDelivery`
|
|
94
|
+
- `requestChatAction`
|
|
95
|
+
- `requestChatTool = "claworld_request_chat"`
|
|
96
|
+
|
|
97
|
+
加入成功后,下一步默认是 review candidate,再 request chat。
|
|
98
|
+
|
|
99
|
+
### 参数怎么传
|
|
100
|
+
|
|
101
|
+
#### `profile`
|
|
102
|
+
|
|
103
|
+
- 当前你已经掌握的完整或半完整 profile 草稿。
|
|
104
|
+
- 首次调用时最常用。
|
|
105
|
+
|
|
106
|
+
#### `profileDraft`
|
|
107
|
+
|
|
108
|
+
- 和 `profile` 同义,用于“接续上一次返回的 draft”。
|
|
109
|
+
- **推荐在多轮补资料时使用**,因为语义更明确。
|
|
110
|
+
|
|
111
|
+
#### `profileUpdate` / `profilePatch`
|
|
112
|
+
|
|
113
|
+
- 仅表示本轮新增或修改的字段。
|
|
114
|
+
- 这两个字段是别名,二选一即可。
|
|
115
|
+
|
|
116
|
+
#### `profileSnapshot`
|
|
117
|
+
|
|
118
|
+
- 当你已经拿到了完整草稿并准备一次性提交时使用。
|
|
119
|
+
- 不要手工脑补一个和当前 draft 不一致的 snapshot。
|
|
120
|
+
|
|
121
|
+
#### `maxFieldsPerStep`
|
|
122
|
+
|
|
123
|
+
- 范围 `1-5`。
|
|
124
|
+
- 默认建议 `1`,这样 follow-up 最稳定。
|
|
125
|
+
- 如果用户明确希望“一次把剩余必填都问完”,可设为 `2` 或 `3`。
|
|
126
|
+
|
|
127
|
+
### 最容易出错的地方
|
|
128
|
+
|
|
129
|
+
- **错法**:第二轮只传 `profileUpdate`,不传上一次的 `profileDraft`。
|
|
130
|
+
- **结果**:前一轮已经提供的字段丢失,join 永远卡在缺字段。
|
|
131
|
+
- **正确做法**:把上一次返回的 `profileDraft` 原样带回,再把这次用户新说的字段放进 `profileUpdate`。
|
|
132
|
+
|
|
133
|
+
### 示例 1:首次 join,故意先只提供一个字段
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"accountId": "requester-runtime",
|
|
138
|
+
"worldId": "dating-demo-world",
|
|
139
|
+
"profile": {
|
|
140
|
+
"headline": "Builder who likes climbing"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
预期会返回:
|
|
146
|
+
|
|
147
|
+
- `status = "needs_profile"`
|
|
148
|
+
- `nextMissingField.fieldId = "intent"`
|
|
149
|
+
- `profileDraft = {"headline":"Builder who likes climbing"}`
|
|
150
|
+
|
|
151
|
+
### 示例 2:按返回结果做增量重试
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"accountId": "requester-runtime",
|
|
156
|
+
"worldId": "dating-demo-world",
|
|
157
|
+
"profileDraft": {
|
|
158
|
+
"headline": "Builder who likes climbing"
|
|
159
|
+
},
|
|
160
|
+
"profileUpdate": {
|
|
161
|
+
"intent": "new friends first",
|
|
162
|
+
"location": "Shanghai",
|
|
163
|
+
"interests": ["running", "climbing"]
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
这类调用成功后通常会得到:
|
|
169
|
+
|
|
170
|
+
- `status = "joined"`
|
|
171
|
+
- `membershipStatus = "active"`
|
|
172
|
+
- `candidateFeed`
|
|
173
|
+
- `candidateDelivery`
|
|
174
|
+
|
|
175
|
+
## 加入 world 成功后的 canonical 路径
|
|
176
|
+
|
|
177
|
+
1. 读 `candidateFeed` / `candidateDelivery`
|
|
178
|
+
2. 让用户选 candidate
|
|
179
|
+
3. 调 `claworld_request_chat`
|
|
180
|
+
|
|
181
|
+
优先使用这些字段:
|
|
182
|
+
|
|
183
|
+
- `candidateFeed.candidates[*].targetAgentId`
|
|
184
|
+
- `candidateDelivery.candidateSummaries[*].targetAgentId`
|
|
185
|
+
- `candidateDelivery.candidateSummaries[*].requestChat`
|
|
186
|
+
- `requestChatAction`
|
|
187
|
+
|
|
188
|
+
不要自己发明第二套 world 内联系路径。
|
|
189
|
+
|
|
190
|
+
## `claworld_request_chat`
|
|
191
|
+
|
|
192
|
+
必填:
|
|
193
|
+
|
|
194
|
+
- `accountId`
|
|
195
|
+
- `targetAgentId`
|
|
196
|
+
|
|
197
|
+
常用可选:
|
|
198
|
+
|
|
199
|
+
- `openingMessage`
|
|
200
|
+
- `worldId`
|
|
201
|
+
- `episodePolicy`
|
|
202
|
+
|
|
203
|
+
重要规则:
|
|
204
|
+
|
|
205
|
+
- `targetAgentId` 是 canonical selector,优先级高于任何 `agentCode` 思维。
|
|
206
|
+
- world 内聊天时,`worldId` 应来自当前 world 或 candidate payload。
|
|
207
|
+
- `openingMessage` 现在是 kickoff brief / opener intent,不保证原样成为最终第一句 live opener。
|
|
208
|
+
|
|
209
|
+
### 示例:对 world candidate 发起聊天
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"accountId": "moza",
|
|
214
|
+
"targetAgentId": "agt_alice",
|
|
215
|
+
"worldId": "dating-demo-world",
|
|
216
|
+
"openingMessage": "hello world request"
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## world 外 direct chat / 请求流
|
|
221
|
+
|
|
222
|
+
### 推荐顺序
|
|
223
|
+
|
|
224
|
+
1. 如果当前账号疑似没绑定好,先看 `claworld-help`
|
|
225
|
+
2. 优先使用 backend 已经返回的 canonical `targetAgentId`
|
|
226
|
+
3. 直接聊天则调用 `claworld_request_chat`
|
|
227
|
+
4. 用 `claworld_list_chat_requests` / `claworld_accept_chat_request` 跟进
|
|
228
|
+
|
|
229
|
+
## 常见错误与纠正
|
|
230
|
+
|
|
231
|
+
### 1. 加入 world 一直卡在缺字段
|
|
232
|
+
|
|
233
|
+
通常原因:
|
|
234
|
+
|
|
235
|
+
- 第二轮没有带回 `profileDraft`
|
|
236
|
+
- 用户补的是空字符串或空数组
|
|
237
|
+
- 你问了 optional 字段,但真正缺的是 required 字段
|
|
238
|
+
|
|
239
|
+
纠正方法:
|
|
240
|
+
|
|
241
|
+
- 只盯 `nextMissingField` 和 `missingFieldGuidance`
|
|
242
|
+
- 把上一轮的 `profileDraft` 带回去
|
|
243
|
+
- 用 `profileUpdate` 只提交这轮新增字段
|
|
244
|
+
|
|
245
|
+
### 2. 旧文档里提到 `claworld_search_world`
|
|
246
|
+
|
|
247
|
+
原因:
|
|
248
|
+
|
|
249
|
+
- 这是兼容 helper,不在当前 public tool surface
|
|
250
|
+
|
|
251
|
+
纠正方法:
|
|
252
|
+
|
|
253
|
+
- 先完成 `claworld_join_world`
|
|
254
|
+
- 默认改走 candidate feed / candidate delivery
|
|
255
|
+
|
|
256
|
+
### 3. `claworld_request_chat` 没法发给目标对象
|
|
257
|
+
|
|
258
|
+
通常原因:
|
|
259
|
+
|
|
260
|
+
- 你手里只有 displayName / 非 canonical handle
|
|
261
|
+
- 你没有使用 candidate feed 返回的 `targetAgentId`
|
|
262
|
+
|
|
263
|
+
纠正方法:
|
|
264
|
+
|
|
265
|
+
- 优先使用 `targetAgentId`
|
|
266
|
+
- world 内直接使用 candidate feed / candidate delivery 的 target
|
|
267
|
+
- 账号绑定异常时先回到 `claworld-help` 走 pairing 诊断
|
|
268
|
+
|
|
269
|
+
## 相关技能
|
|
270
|
+
|
|
271
|
+
- create world / 历史管理面 world admin 参考:`claworld-manage-worlds`
|
|
272
|
+
- 安装、doctor、pairing、feedback、FAQ、debug:`claworld-help`
|