multiclaws 0.3.1 → 0.3.2
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/dist/index.js +35 -0
- package/dist/types/openclaw.d.ts +24 -1
- package/package.json +1 -1
- package/skills/multiclaws/SKILL.md +23 -20
package/dist/index.js
CHANGED
|
@@ -370,6 +370,41 @@ const plugin = {
|
|
|
370
370
|
api.on("gateway_stop", () => {
|
|
371
371
|
structured.logger.info("[multiclaws] gateway_stop observed");
|
|
372
372
|
});
|
|
373
|
+
// Inject onboarding prompt when profile is pending first-run setup
|
|
374
|
+
api.on("before_prompt_build", async (_event, _ctx) => {
|
|
375
|
+
if (!service)
|
|
376
|
+
return;
|
|
377
|
+
try {
|
|
378
|
+
const review = await service.getPendingProfileReview();
|
|
379
|
+
if (!review.pending)
|
|
380
|
+
return;
|
|
381
|
+
return {
|
|
382
|
+
appendSystemContext: `## MultiClaws 首次安装 — 需要完成档案设置
|
|
383
|
+
|
|
384
|
+
multiclaws 插件刚安装,需要在本次对话中完成以下初始化流程(优先处理,不管用户说了什么):
|
|
385
|
+
|
|
386
|
+
1. **扫描当前环境**,自动生成 bio(markdown 格式),内容包括:
|
|
387
|
+
- 用户角色和职责
|
|
388
|
+
- 可处理的任务类型(基于已安装 skills、工具、连接的渠道)
|
|
389
|
+
- 可访问的数据/系统(git 仓库、邮件、日历、Notion 等)
|
|
390
|
+
- 时区和语言
|
|
391
|
+
|
|
392
|
+
2. 向用户展示生成的档案,并逐一确认以下三项(名字和 bio 需要用户明确回答):
|
|
393
|
+
- **名字**:展示推断出的名字,询问是否需要修改
|
|
394
|
+
- **Bio**:展示生成的 bio,询问是否需要修改
|
|
395
|
+
- **网络情况**:告知用户「同局域网开箱即用;跨网络需安装 Tailscale(https://tailscale.com/download)并重启 OpenClaw」,无需用户回答
|
|
396
|
+
|
|
397
|
+
3. 根据用户对名字和 bio 的回答更新档案内容(如需修改),然后调用 \`multiclaws_profile_set(ownerName="...", bio="...")\` 保存。
|
|
398
|
+
|
|
399
|
+
4. 调用 \`multiclaws_profile_clear_pending_review()\` 完成初始化。
|
|
400
|
+
|
|
401
|
+
**注意**:名字和 bio 需要用户明确确认;网络情况仅告知无需回答。`,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
catch (err) {
|
|
405
|
+
structured.logger.warn("[multiclaws] before_prompt_build: failed to check pending review: " + String(err));
|
|
406
|
+
}
|
|
407
|
+
});
|
|
373
408
|
},
|
|
374
409
|
};
|
|
375
410
|
exports.default = plugin;
|
package/dist/types/openclaw.d.ts
CHANGED
|
@@ -38,6 +38,24 @@ export type PluginHookGatewayStartEvent = {
|
|
|
38
38
|
export type PluginHookGatewayStopEvent = {
|
|
39
39
|
reason?: string;
|
|
40
40
|
};
|
|
41
|
+
export type PluginHookAgentContext = {
|
|
42
|
+
agentId?: string;
|
|
43
|
+
sessionKey?: string;
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
workspaceDir?: string;
|
|
46
|
+
channelId?: string;
|
|
47
|
+
trigger?: string;
|
|
48
|
+
};
|
|
49
|
+
export type PluginHookBeforePromptBuildEvent = {
|
|
50
|
+
prompt: string;
|
|
51
|
+
messages: unknown[];
|
|
52
|
+
};
|
|
53
|
+
export type PluginHookBeforePromptBuildResult = {
|
|
54
|
+
systemPrompt?: string;
|
|
55
|
+
prependContext?: string;
|
|
56
|
+
prependSystemContext?: string;
|
|
57
|
+
appendSystemContext?: string;
|
|
58
|
+
};
|
|
41
59
|
export type PluginTool = {
|
|
42
60
|
name: string;
|
|
43
61
|
description: string;
|
|
@@ -82,5 +100,10 @@ export type OpenClawPluginApi = {
|
|
|
82
100
|
end: (body?: string) => void;
|
|
83
101
|
}) => void;
|
|
84
102
|
}) => void;
|
|
85
|
-
on:
|
|
103
|
+
on: {
|
|
104
|
+
(name: "message_received", handler: (event: PluginHookMessageEvent, ctx: PluginHookMessageContext) => void | Promise<void>): void;
|
|
105
|
+
(name: "gateway_start", handler: (event: PluginHookGatewayStartEvent) => void | Promise<void>): void;
|
|
106
|
+
(name: "gateway_stop", handler: (event: PluginHookGatewayStopEvent) => void | Promise<void>): void;
|
|
107
|
+
(name: "before_prompt_build", handler: (event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext) => PluginHookBeforePromptBuildResult | void | Promise<PluginHookBeforePromptBuildResult | void>): void;
|
|
108
|
+
};
|
|
86
109
|
};
|
package/package.json
CHANGED
|
@@ -6,29 +6,28 @@ MultiClaws 让多个 OpenClaw 实例通过 [A2A(Agent-to-Agent)](https://goo
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
## 1.
|
|
9
|
+
## 1. 首次安装:档案初始化(由插件 hook 触发)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
首次安装后,插件会通过 `before_prompt_build` hook 自动在系统提示中注入初始化任务。
|
|
12
|
+
**无需每次对话手动检查 `multiclaws_profile_pending_review()`**,hook 已处理触发时机。
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
multiclaws_profile_pending_review()
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
如果 `pending: true`:
|
|
14
|
+
当 hook 注入了初始化任务时,按以下步骤执行:
|
|
18
15
|
|
|
19
|
-
1.
|
|
16
|
+
1. **扫描当前环境**,自动生成 bio(markdown 格式),包含:
|
|
20
17
|
- 可用的工具和 skills(推断能力)
|
|
21
18
|
- 已连接的渠道(Telegram、Discord、Gmail 等)
|
|
22
19
|
- 工作区内容(git 仓库、关键文件、项目目录)
|
|
23
20
|
- 已安装的插件
|
|
24
|
-
2. 写成 **markdown** 格式的 bio——把它当作「技能卡」,其他 AI 读它来决定是否把任务委派过来。包含:
|
|
25
|
-
- 所有者名字和角色
|
|
26
|
-
- 这个智能体能处理什么
|
|
27
|
-
- 能访问什么数据/系统
|
|
28
21
|
- 时区、语言等上下文
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
|
|
23
|
+
2. 向用户展示生成的档案,并逐一确认以下三项:
|
|
24
|
+
- **名字**:展示推断出的名字,询问是否需要修改(需用户明确回答)
|
|
25
|
+
- **Bio**:展示生成的 bio,询问是否需要修改(需用户明确回答)
|
|
26
|
+
- **网络情况**:告知用户「同局域网开箱即用;跨网络需安装 Tailscale(https://tailscale.com/download)并重启 OpenClaw」,无需用户回答
|
|
27
|
+
|
|
28
|
+
3. 根据用户对名字和 bio 的回答更新内容后,调用 `multiclaws_profile_set(ownerName="...", bio="...")` 保存档案。
|
|
29
|
+
|
|
30
|
+
4. 调用 `multiclaws_profile_clear_pending_review()` 完成初始化。
|
|
32
31
|
|
|
33
32
|
**示例 bio:**
|
|
34
33
|
```markdown
|
|
@@ -47,7 +46,7 @@ multiclaws_profile_pending_review()
|
|
|
47
46
|
**时区:** GMT+8
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
---
|
|
51
50
|
|
|
52
51
|
## 2. 团队操作前检查档案
|
|
53
52
|
|
|
@@ -59,8 +58,11 @@ multiclaws_profile_show()
|
|
|
59
58
|
|
|
60
59
|
如果 `bio` 为空或 `ownerName` 为空:
|
|
61
60
|
1. 自动生成 bio(同上)
|
|
62
|
-
2.
|
|
63
|
-
3.
|
|
61
|
+
2. 询问用户确认名字和 bio
|
|
62
|
+
3. 调用 `multiclaws_profile_set(...)` 设置
|
|
63
|
+
4. 然后继续团队操作
|
|
64
|
+
|
|
65
|
+
---
|
|
64
66
|
|
|
65
67
|
## 3. 保持档案更新
|
|
66
68
|
|
|
@@ -111,6 +113,7 @@ multiclaws_profile_show()
|
|
|
111
113
|
- **只使用上面列出的工具。** 没有 `multiclaws_status` 工具。
|
|
112
114
|
- **Bio 是自由格式的 markdown。** 写得让另一个 AI 能读懂这个智能体能做什么。
|
|
113
115
|
- **每个智能体就像一个 skill。** 委派时读每个智能体的 bio,选最匹配的。
|
|
116
|
+
- **名字和 bio 必须用户明确确认**;网络情况仅告知,无需用户回答。
|
|
114
117
|
|
|
115
118
|
---
|
|
116
119
|
|
|
@@ -120,7 +123,7 @@ multiclaws_profile_show()
|
|
|
120
123
|
|
|
121
124
|
```
|
|
122
125
|
1. multiclaws_profile_show() — 检查档案
|
|
123
|
-
2.(如果为空)自动生成并设置 bio
|
|
126
|
+
2.(如果为空)自动生成并设置 bio,确认名字和 bio
|
|
124
127
|
3. multiclaws_team_create(name="...") — 返回 inviteCode (mc:xxxx)
|
|
125
128
|
4. 告诉用户把邀请码分享给队友
|
|
126
129
|
```
|
|
@@ -129,7 +132,7 @@ multiclaws_profile_show()
|
|
|
129
132
|
|
|
130
133
|
```
|
|
131
134
|
1. multiclaws_profile_show() — 检查档案
|
|
132
|
-
2.(如果为空)自动生成并设置 bio
|
|
135
|
+
2.(如果为空)自动生成并设置 bio,确认名字和 bio
|
|
133
136
|
3. multiclaws_team_join(inviteCode="mc:xxxx")
|
|
134
137
|
→ 自动同步所有团队成员
|
|
135
138
|
```
|