multiclaws 0.4.21 → 0.4.23
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.
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.OpenClawAgentExecutor = void 0;
|
|
7
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
4
8
|
const gateway_client_1 = require("../infra/gateway-client");
|
|
5
9
|
function extractTextFromMessage(message) {
|
|
6
10
|
if (!message.parts)
|
|
@@ -80,6 +84,7 @@ class OpenClawAgentExecutor {
|
|
|
80
84
|
args: {
|
|
81
85
|
task: taskText,
|
|
82
86
|
mode: "run",
|
|
87
|
+
cwd: node_os_1.default.homedir(),
|
|
83
88
|
},
|
|
84
89
|
sessionKey: `a2a-${taskId}`,
|
|
85
90
|
timeoutMs: 15_000,
|
|
@@ -123,5 +123,7 @@ export declare class MulticlawsService extends EventEmitter {
|
|
|
123
123
|
private extractArtifactText;
|
|
124
124
|
/** Fetch with up to 2 retries and exponential backoff. */
|
|
125
125
|
private fetchWithRetry;
|
|
126
|
+
/** Send a notification message to the local user via the gateway message tool. */
|
|
127
|
+
private notifyUser;
|
|
126
128
|
private log;
|
|
127
129
|
}
|
|
@@ -357,7 +357,7 @@ class MulticlawsService extends node_events_1.EventEmitter {
|
|
|
357
357
|
await (0, gateway_client_1.invokeGatewayTool)({
|
|
358
358
|
gateway: this.gatewayConfig,
|
|
359
359
|
tool: "sessions_spawn",
|
|
360
|
-
args: { task: prompt, mode: "run" },
|
|
360
|
+
args: { task: prompt, mode: "run", cwd: node_os_1.default.homedir() },
|
|
361
361
|
sessionKey: `delegate-${Date.now()}`,
|
|
362
362
|
timeoutMs: 15_000,
|
|
363
363
|
});
|
|
@@ -679,6 +679,8 @@ class MulticlawsService extends node_events_1.EventEmitter {
|
|
|
679
679
|
this.log("warn", `broadcast to ${other.url} failed`);
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
|
+
// Notify local user that a new member joined
|
|
683
|
+
void this.notifyUser(`📢 **${member.name}** 已加入团队「${team.teamName}」`);
|
|
682
684
|
}
|
|
683
685
|
res.json({ ok: true });
|
|
684
686
|
}
|
|
@@ -903,6 +905,22 @@ class MulticlawsService extends node_events_1.EventEmitter {
|
|
|
903
905
|
}
|
|
904
906
|
throw lastError;
|
|
905
907
|
}
|
|
908
|
+
/** Send a notification message to the local user via the gateway message tool. */
|
|
909
|
+
async notifyUser(message) {
|
|
910
|
+
if (!this.gatewayConfig)
|
|
911
|
+
return;
|
|
912
|
+
try {
|
|
913
|
+
await (0, gateway_client_1.invokeGatewayTool)({
|
|
914
|
+
gateway: this.gatewayConfig,
|
|
915
|
+
tool: "message",
|
|
916
|
+
args: { action: "send", message },
|
|
917
|
+
timeoutMs: 5_000,
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
catch {
|
|
921
|
+
this.log("warn", `notifyUser failed: ${message.slice(0, 80)}`);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
906
924
|
log(level, message) {
|
|
907
925
|
this.options.logger?.[level]?.(`[multiclaws] ${message}`);
|
|
908
926
|
}
|