openclaw-bridge 0.4.8 → 0.4.9
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 +18 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
2
4
|
import { Type } from "@sinclair/typebox";
|
|
3
5
|
import { parseConfig, getMachineId } from "./config.js";
|
|
4
6
|
import { BridgeRegistry } from "./registry.js";
|
|
@@ -254,14 +256,23 @@ ${nameMapping}
|
|
|
254
256
|
}
|
|
255
257
|
// Helper: call local gateway chat completions API
|
|
256
258
|
async function callGatewayAPI(payload) {
|
|
257
|
-
const configPath = process.env.OPENCLAW_CONFIG_PATH
|
|
258
|
-
|| `${process.env.OPENCLAW_HOME || ''}/openclaw.json`;
|
|
259
259
|
let gatewayToken = '';
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
const configCandidates = [
|
|
261
|
+
process.env.OPENCLAW_CONFIG_PATH,
|
|
262
|
+
process.env.OPENCLAW_HOME ? `${process.env.OPENCLAW_HOME}/openclaw.json` : '',
|
|
263
|
+
join(homedir(), '.openclaw', 'openclaw.json'),
|
|
264
|
+
].filter(Boolean);
|
|
265
|
+
for (const cp of configCandidates) {
|
|
266
|
+
try {
|
|
267
|
+
if (!existsSync(cp))
|
|
268
|
+
continue;
|
|
269
|
+
const raw = JSON.parse(readFileSync(cp, 'utf-8'));
|
|
270
|
+
gatewayToken = raw.gateway?.auth?.token || '';
|
|
271
|
+
if (gatewayToken)
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
catch { /* try next */ }
|
|
263
275
|
}
|
|
264
|
-
catch { /* no token */ }
|
|
265
276
|
// Check if payload is multimodal JSON (from Hub chat with image)
|
|
266
277
|
let messages;
|
|
267
278
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-bridge",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
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",
|