openclaw-remote 0.4.4 → 0.4.5
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 +12 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2822,18 +2822,21 @@ async function resolveAgentIdentity(account, log) {
|
|
|
2822
2822
|
break;
|
|
2823
2823
|
}
|
|
2824
2824
|
}
|
|
2825
|
-
|
|
2825
|
+
let agentId = "";
|
|
2826
|
+
try {
|
|
2826
2827
|
const hbRes = await fetch(`${account.baseUrl}/api/v1/heartbeat`, {
|
|
2827
2828
|
headers: { Authorization: `Bearer ${account.apiKey}`, Accept: "application/json" },
|
|
2828
2829
|
signal: AbortSignal.timeout(1e4)
|
|
2829
2830
|
});
|
|
2830
2831
|
if (hbRes.ok) {
|
|
2831
2832
|
const hb = await hbRes.json();
|
|
2832
|
-
|
|
2833
|
+
agentId = hb.agent_id || "";
|
|
2834
|
+
if (!agentName) agentName = hb.agent_name || "";
|
|
2833
2835
|
}
|
|
2836
|
+
} catch {
|
|
2834
2837
|
}
|
|
2835
|
-
log?.info?.(`Agent identity resolved: "${agentName}", roles: [${myRoleIds.join(", ")}], leader: ${isLeader}`);
|
|
2836
|
-
return { agentName, myRoleIds, isLeader };
|
|
2838
|
+
log?.info?.(`Agent identity resolved: "${agentName}" (${agentId}), roles: [${myRoleIds.join(", ")}], leader: ${isLeader}`);
|
|
2839
|
+
return { agentId, agentName, myRoleIds, isLeader };
|
|
2837
2840
|
} catch (err) {
|
|
2838
2841
|
log?.warn?.(`Failed to resolve agent identity: ${err}`);
|
|
2839
2842
|
return null;
|
|
@@ -2886,9 +2889,12 @@ function connectRealtime(account, identity, onEvent, onError, log) {
|
|
|
2886
2889
|
try {
|
|
2887
2890
|
const row = payload.new;
|
|
2888
2891
|
if (row.agent_author_id && !row.author_id) {
|
|
2889
|
-
log?.info?.(`Skipping agent-authored comment on task ${row.task_id} (echo suppression)`);
|
|
2890
2892
|
scheduleLeaderNotification(row.task_id, row.agent_author_id, supabase, log);
|
|
2891
|
-
|
|
2893
|
+
if (identity && row.agent_author_id === identity.agentId) {
|
|
2894
|
+
log?.info?.(`Skipping own comment on task ${row.task_id} (echo suppression)`);
|
|
2895
|
+
return;
|
|
2896
|
+
}
|
|
2897
|
+
log?.info?.(`Delivering agent comment from ${row.agent_author_id} on task ${row.task_id}`);
|
|
2892
2898
|
}
|
|
2893
2899
|
const body = row.body || row.content || "";
|
|
2894
2900
|
if (!row.author_id && !row.agent_author_id && identity) {
|