@geravant/sinain 1.0.3 → 1.0.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/install.js +15 -11
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -5,7 +5,7 @@ import os from "os";
|
|
|
5
5
|
import { execSync } from "child_process";
|
|
6
6
|
|
|
7
7
|
const HOME = os.homedir();
|
|
8
|
-
const PLUGIN_DIR = path.join(HOME, ".openclaw/extensions/sinain");
|
|
8
|
+
const PLUGIN_DIR = path.join(HOME, ".openclaw/extensions/sinain-hud");
|
|
9
9
|
const SOURCES_DIR = path.join(HOME, ".openclaw/sinain-sources");
|
|
10
10
|
const OC_JSON = path.join(HOME, ".openclaw/openclaw.json");
|
|
11
11
|
const WORKSPACE = path.join(HOME, ".openclaw/workspace");
|
|
@@ -17,7 +17,9 @@ const HEARTBEAT = path.join(PKG_DIR, "HEARTBEAT.md");
|
|
|
17
17
|
|
|
18
18
|
console.log("\nInstalling sinain plugin...");
|
|
19
19
|
|
|
20
|
-
// 1. Copy plugin files
|
|
20
|
+
// 1. Copy plugin files (remove stale extensions/sinain dir if present from old installs)
|
|
21
|
+
const stalePluginDir = path.join(HOME, ".openclaw/extensions/sinain");
|
|
22
|
+
if (fs.existsSync(stalePluginDir)) fs.rmSync(stalePluginDir, { recursive: true, force: true });
|
|
21
23
|
fs.mkdirSync(PLUGIN_DIR, { recursive: true });
|
|
22
24
|
fs.copyFileSync(path.join(PKG_DIR, "index.ts"), path.join(PLUGIN_DIR, "index.ts"));
|
|
23
25
|
fs.copyFileSync(path.join(PKG_DIR, "openclaw.plugin.json"), path.join(PLUGIN_DIR, "openclaw.plugin.json"));
|
|
@@ -52,7 +54,7 @@ if (fs.existsSync(OC_JSON)) {
|
|
|
52
54
|
}
|
|
53
55
|
cfg.plugins ??= {};
|
|
54
56
|
cfg.plugins.entries ??= {};
|
|
55
|
-
cfg.plugins.entries["sinain"] = {
|
|
57
|
+
cfg.plugins.entries["sinain-hud"] = {
|
|
56
58
|
enabled: true,
|
|
57
59
|
config: {
|
|
58
60
|
heartbeatPath: path.join(SOURCES_DIR, "HEARTBEAT.md"),
|
|
@@ -60,13 +62,15 @@ cfg.plugins.entries["sinain"] = {
|
|
|
60
62
|
sessionKey: "agent:main:sinain"
|
|
61
63
|
}
|
|
62
64
|
};
|
|
65
|
+
// Remove stale "sinain" entry if present from a previous install
|
|
66
|
+
delete cfg.plugins.entries["sinain"];
|
|
63
67
|
cfg.agents ??= {};
|
|
64
68
|
cfg.agents.defaults ??= {};
|
|
65
69
|
cfg.agents.defaults.sandbox ??= {};
|
|
66
70
|
cfg.agents.defaults.sandbox.sessionToolsVisibility = "all";
|
|
67
|
-
cfg.compaction = { mode: "safeguard", maxHistoryShare: 0.2, reserveTokensFloor: 40000 };
|
|
68
71
|
cfg.gateway ??= {};
|
|
69
|
-
cfg.gateway.
|
|
72
|
+
cfg.gateway.mode = "local"; // required for gateway to start
|
|
73
|
+
cfg.gateway.bind = "lan"; // allow remote Mac to connect
|
|
70
74
|
|
|
71
75
|
fs.mkdirSync(path.dirname(OC_JSON), { recursive: true });
|
|
72
76
|
fs.writeFileSync(OC_JSON, JSON.stringify(cfg, null, 2));
|
|
@@ -91,16 +95,16 @@ if (backupUrl) {
|
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
|
|
94
|
-
// 7.
|
|
98
|
+
// 7. Start / restart gateway
|
|
95
99
|
try {
|
|
96
|
-
execSync("openclaw
|
|
97
|
-
console.log(" ✓ Gateway
|
|
100
|
+
execSync("openclaw gateway restart --background", { stdio: "pipe" });
|
|
101
|
+
console.log(" ✓ Gateway restarted");
|
|
98
102
|
} catch {
|
|
99
103
|
try {
|
|
100
|
-
execSync("openclaw
|
|
101
|
-
console.log(" ✓ Gateway
|
|
104
|
+
execSync("openclaw gateway start --background", { stdio: "pipe" });
|
|
105
|
+
console.log(" ✓ Gateway started");
|
|
102
106
|
} catch {
|
|
103
|
-
console.warn(" ⚠ Could not
|
|
107
|
+
console.warn(" ⚠ Could not start gateway — run: openclaw gateway start");
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
|