openclaw-remote 0.4.1 → 0.4.3
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 +17 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
setAccountEnabledInConfigSection,
|
|
11
11
|
waitUntilAbort,
|
|
12
12
|
optionalStringEnum
|
|
13
|
-
} from "openclaw/plugin-sdk/compat";
|
|
13
|
+
} from "openclaw/dist/plugin-sdk/compat.js";
|
|
14
14
|
|
|
15
15
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
16
16
|
var value_exports = {};
|
|
@@ -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 };
|
|
@@ -3119,7 +3127,7 @@ function formatGenericEvent(event) {
|
|
|
3119
3127
|
}
|
|
3120
3128
|
|
|
3121
3129
|
// src/runtime.ts
|
|
3122
|
-
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/compat";
|
|
3130
|
+
import { createPluginRuntimeStore } from "openclaw/dist/plugin-sdk/compat.js";
|
|
3123
3131
|
var { setRuntime: setRemoteRuntime, getRuntime: getRemoteRuntime } = createPluginRuntimeStore(
|
|
3124
3132
|
"Remote runtime not initialized - plugin not registered"
|
|
3125
3133
|
);
|