openclaw-bridge 0.4.3 → 0.4.7
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 +8 -1
- package/dist/message-relay.js +11 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -216,9 +216,16 @@ ${nameMapping}
|
|
|
216
216
|
relayClient = new MessageRelayClient(config.agentId, config.messageRelay, api.logger, machineId);
|
|
217
217
|
relayClient.setAgentName(config.agentName);
|
|
218
218
|
relayClient.setOnConflictRename((newAgentId, newAgentName) => {
|
|
219
|
-
|
|
219
|
+
const oldAgentId = entry.agentId;
|
|
220
|
+
api.logger.info(`[bridge] Conflict rename: ${oldAgentId} → ${newAgentId}, ${entry.agentName} → ${newAgentName}`);
|
|
221
|
+
// Deregister old agentId from Hub registry before switching
|
|
222
|
+
registry.deregister(oldAgentId).catch((err) => {
|
|
223
|
+
api.logger.warn(`[bridge] Failed to deregister old agentId "${oldAgentId}": ${err.message}`);
|
|
224
|
+
});
|
|
220
225
|
entry.agentId = newAgentId;
|
|
221
226
|
entry.agentName = newAgentName;
|
|
227
|
+
config.agentId = newAgentId;
|
|
228
|
+
config.agentName = newAgentName;
|
|
222
229
|
// Persist the renamed agentId to openclaw.json so it survives restarts
|
|
223
230
|
const configPath = process.env.OPENCLAW_CONFIG_PATH;
|
|
224
231
|
if (configPath) {
|
package/dist/message-relay.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import WebSocket from 'ws';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { join, dirname } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
// Read version from package.json at module load time
|
|
6
|
+
let BRIDGE_VERSION = 'unknown';
|
|
7
|
+
try {
|
|
8
|
+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
|
9
|
+
BRIDGE_VERSION = JSON.parse(readFileSync(pkgPath, 'utf-8')).version;
|
|
10
|
+
}
|
|
11
|
+
catch { }
|
|
2
12
|
export class MessageRelayClient {
|
|
3
13
|
ws = null;
|
|
4
14
|
agentId;
|
|
@@ -69,6 +79,7 @@ export class MessageRelayClient {
|
|
|
69
79
|
agentId: this.agentId,
|
|
70
80
|
apiKey: this.config.apiKey,
|
|
71
81
|
machineId: this.machineId,
|
|
82
|
+
bridgeVersion: BRIDGE_VERSION,
|
|
72
83
|
}));
|
|
73
84
|
});
|
|
74
85
|
this.ws.on('message', (data) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-bridge",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"author": "Bill Zhao (https://www.linkedin.com/in/billzhaodi/)",
|
|
5
5
|
"description": "OpenClaw plugin for cross-gateway communication — agent discovery, file transfer, real-time messaging, session handoff, and local process management. Install as plugin: openclaw plugins install openclaw-bridge",
|
|
6
6
|
"type": "module",
|