openclaw-bridge 0.4.0 → 0.4.1
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/cli.js +44 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -673,23 +673,57 @@ async function cmdUpgrade() {
|
|
|
673
673
|
console.log("==========================\n");
|
|
674
674
|
let updatedPlugin = false;
|
|
675
675
|
let updatedCli = false;
|
|
676
|
-
// 1.
|
|
676
|
+
// 1. Try installing/upgrading as OpenClaw plugin
|
|
677
677
|
console.log("Checking OpenClaw plugin installation...");
|
|
678
678
|
try {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
runInherit("openclaw plugins install openclaw-bridge");
|
|
679
|
+
// First attempt: just try to install
|
|
680
|
+
const installResult = run("openclaw plugins install openclaw-bridge 2>&1", { silent: true });
|
|
681
|
+
if (installResult.includes("openclaw-bridge")) {
|
|
683
682
|
updatedPlugin = true;
|
|
684
|
-
console.log(" Plugin updated.");
|
|
683
|
+
console.log(" Plugin installed/updated.");
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
catch (installErr) {
|
|
687
|
+
const errMsg = String(installErr?.stdout || installErr?.message || installErr || "");
|
|
688
|
+
if (errMsg.includes("plugin already exists") || errMsg.includes("already exists")) {
|
|
689
|
+
// Parse the existing path from error: "plugin already exists: /path/to/openclaw-bridge (delete it first)"
|
|
690
|
+
const pathMatch = errMsg.match(/already exists:\s*(.+?)\s*\(/);
|
|
691
|
+
const existingPath = pathMatch?.[1]?.trim();
|
|
692
|
+
if (existingPath && existsSync(existingPath)) {
|
|
693
|
+
console.log(` Old plugin found at ${existingPath}. Removing...`);
|
|
694
|
+
run(IS_WINDOWS ? `rmdir /s /q "${existingPath}"` : `rm -rf "${existingPath}"`, { silent: true });
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
// Fallback: search common plugin directories
|
|
698
|
+
const candidates = [
|
|
699
|
+
join(homedir(), ".openclaw", "extensions", "openclaw-bridge"),
|
|
700
|
+
join(homedir(), "openclaw-extensions", "openclaw-bridge"),
|
|
701
|
+
IS_WINDOWS ? "C:\\openclaw-extensions\\openclaw-bridge" : "",
|
|
702
|
+
].filter(Boolean);
|
|
703
|
+
for (const dir of candidates) {
|
|
704
|
+
if (existsSync(dir)) {
|
|
705
|
+
console.log(` Old plugin found at ${dir}. Removing...`);
|
|
706
|
+
run(IS_WINDOWS ? `rmdir /s /q "${dir}"` : `rm -rf "${dir}"`, { silent: true });
|
|
707
|
+
break;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
// Retry install after removing old version
|
|
712
|
+
console.log(" Installing new version...");
|
|
713
|
+
try {
|
|
714
|
+
runInherit("openclaw plugins install openclaw-bridge");
|
|
715
|
+
updatedPlugin = true;
|
|
716
|
+
console.log(" Plugin updated.");
|
|
717
|
+
}
|
|
718
|
+
catch {
|
|
719
|
+
console.log(" Plugin install failed after removing old version. Try manually:");
|
|
720
|
+
console.log(" openclaw plugins install openclaw-bridge");
|
|
721
|
+
}
|
|
685
722
|
}
|
|
686
723
|
else {
|
|
687
|
-
console.log("
|
|
724
|
+
console.log(" openclaw CLI not found or plugins command failed. Skipping plugin check.");
|
|
688
725
|
}
|
|
689
726
|
}
|
|
690
|
-
catch {
|
|
691
|
-
console.log(" openclaw CLI not found or plugins command failed. Skipping plugin check.");
|
|
692
|
-
}
|
|
693
727
|
// 2. Check if installed as global npm package
|
|
694
728
|
console.log("\nChecking global npm installation...");
|
|
695
729
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-bridge",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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",
|