multiclaws 0.4.32 → 0.4.33
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
CHANGED
|
@@ -234,6 +234,35 @@ function createTools(getService, logger) {
|
|
|
234
234
|
}
|
|
235
235
|
},
|
|
236
236
|
};
|
|
237
|
+
const multiclawsNotify = {
|
|
238
|
+
name: "multiclaws_notify",
|
|
239
|
+
description: "Send a notification message to the local user's WebUI. " +
|
|
240
|
+
"Used by sub-agents to deliver delegation results back to the user. " +
|
|
241
|
+
"Broadcasts to all known channels so the user sees the message regardless of which channel they are on.",
|
|
242
|
+
parameters: {
|
|
243
|
+
type: "object",
|
|
244
|
+
additionalProperties: false,
|
|
245
|
+
properties: {
|
|
246
|
+
message: { type: "string", description: "The message to send to the user." },
|
|
247
|
+
},
|
|
248
|
+
required: ["message"],
|
|
249
|
+
},
|
|
250
|
+
execute: async (_toolCallId, args) => {
|
|
251
|
+
const msg = typeof args.message === "string" ? args.message.trim() : "";
|
|
252
|
+
log("info", `tool:multiclaws_notify(len=${msg.length})`);
|
|
253
|
+
try {
|
|
254
|
+
const service = requireService(getService());
|
|
255
|
+
if (!msg)
|
|
256
|
+
throw new Error("message is required");
|
|
257
|
+
await service.notifyUser(msg);
|
|
258
|
+
return textResult("Notification sent.");
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
log("error", `tool:multiclaws_notify failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
262
|
+
throw err;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
};
|
|
237
266
|
const multiclawsTaskStatus = {
|
|
238
267
|
name: "multiclaws_task_status",
|
|
239
268
|
description: "Check the status of a delegated task.",
|
|
@@ -471,6 +500,7 @@ function createTools(getService, logger) {
|
|
|
471
500
|
multiclawsDelegate,
|
|
472
501
|
multiclawsDelegateSend,
|
|
473
502
|
multiclawsA2ACallback,
|
|
503
|
+
multiclawsNotify,
|
|
474
504
|
multiclawsTaskStatus,
|
|
475
505
|
multiclawsTeamCreate,
|
|
476
506
|
multiclawsTeamJoin,
|
|
@@ -137,6 +137,6 @@ export declare class MulticlawsService extends EventEmitter {
|
|
|
137
137
|
resolveA2ACallback(taskId: string, result: string): boolean;
|
|
138
138
|
addNotificationTarget(key: string, target: NotificationTarget): void;
|
|
139
139
|
/** Send a notification to all known targets. Individual failures are silently ignored. */
|
|
140
|
-
|
|
140
|
+
notifyUser(message: string): Promise<void>;
|
|
141
141
|
private log;
|
|
142
142
|
}
|
|
@@ -38,14 +38,15 @@ function buildDelegationPrompt(agent, task) {
|
|
|
38
38
|
|
|
39
39
|
## 执行步骤
|
|
40
40
|
1. 调用 multiclaws_delegate_send(agentUrl="${agent.url}", task="${task.replace(/"/g, '\\"')}") 发送任务
|
|
41
|
-
2.
|
|
41
|
+
2. 收到回复后,调用 multiclaws_notify(message="结果内容") 将结果推送给用户
|
|
42
42
|
3. 如果需要进一步沟通,可再次调用 multiclaws_delegate_send(最多 5 轮)
|
|
43
|
-
4.
|
|
43
|
+
4. 每次收到回复后立即调用 multiclaws_notify 推送进展
|
|
44
44
|
|
|
45
45
|
## 规则
|
|
46
46
|
- 使用 multiclaws_delegate_send(不是 multiclaws_delegate)发送任务
|
|
47
|
+
- 使用 multiclaws_notify(不是 message)将结果推送给用户
|
|
47
48
|
- 最多 5 轮沟通
|
|
48
|
-
-
|
|
49
|
+
- 遇到错误时在 multiclaws_notify 中说明失败原因`;
|
|
49
50
|
}
|
|
50
51
|
/* ------------------------------------------------------------------ */
|
|
51
52
|
/* Service */
|