openclaw-remote 0.4.1 → 0.4.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 +15 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2815,14 +2815,22 @@ async function resolveAgentIdentity(account, log) {
|
|
|
2815
2815
|
const myRoles = roles.filter((r) => r.is_mine);
|
|
2816
2816
|
const myRoleIds = myRoles.map((r) => r.id);
|
|
2817
2817
|
const isLeader = myRoles.some((r) => r.is_leader);
|
|
2818
|
-
const hbRes = await fetch(`${account.baseUrl}/api/v1/heartbeat`, {
|
|
2819
|
-
headers: { Authorization: `Bearer ${account.apiKey}`, Accept: "application/json" },
|
|
2820
|
-
signal: AbortSignal.timeout(1e4)
|
|
2821
|
-
});
|
|
2822
2818
|
let agentName = "";
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2819
|
+
for (const r of myRoles) {
|
|
2820
|
+
if (r.assigned_to?.type === "agent" && r.assigned_to?.name) {
|
|
2821
|
+
agentName = r.assigned_to.name;
|
|
2822
|
+
break;
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
if (!agentName) {
|
|
2826
|
+
const hbRes = await fetch(`${account.baseUrl}/api/v1/heartbeat`, {
|
|
2827
|
+
headers: { Authorization: `Bearer ${account.apiKey}`, Accept: "application/json" },
|
|
2828
|
+
signal: AbortSignal.timeout(1e4)
|
|
2829
|
+
});
|
|
2830
|
+
if (hbRes.ok) {
|
|
2831
|
+
const hb = await hbRes.json();
|
|
2832
|
+
agentName = hb.agent_name || "";
|
|
2833
|
+
}
|
|
2826
2834
|
}
|
|
2827
2835
|
log?.info?.(`Agent identity resolved: "${agentName}", roles: [${myRoleIds.join(", ")}], leader: ${isLeader}`);
|
|
2828
2836
|
return { agentName, myRoleIds, isLeader };
|