@geravant/sinain 1.0.10 → 1.0.12

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.
Files changed (2) hide show
  1. package/install.js +26 -24
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -33,29 +33,28 @@ console.log(" ✓ sinain-memory copied");
33
33
  fs.copyFileSync(HEARTBEAT, path.join(SOURCES_DIR, "HEARTBEAT.md"));
34
34
  console.log(" ✓ HEARTBEAT.md copied");
35
35
 
36
- // 4. Install Python deps (for local bare-metal path; harmless to run here)
37
- const reqFile = path.join(memoryDst, "requirements.txt");
38
- if (fs.existsSync(reqFile)) {
39
- console.log(" Installing Python dependencies...");
40
- try {
41
- execSync(`pip3 install -r "${reqFile}" --quiet --break-system-packages`, { stdio: "inherit" });
42
- console.log(" ✓ Python dependencies installed");
43
- } catch {
44
- try {
45
- execSync(`pip3 install -r "${reqFile}" --quiet`, { stdio: "inherit" });
46
- console.log(" ✓ Python dependencies installed");
47
- } catch {
48
- console.warn(" ⚠ pip3 unavailable — Python eval features disabled");
49
- }
50
- }
51
- }
52
-
53
36
  // ── Detect environment and branch ───────────────────────────────────────────
54
37
 
55
38
  const nemoClaw = detectNemoClaw();
56
39
  if (nemoClaw) {
57
40
  await installNemoClaw(nemoClaw);
58
41
  } else {
42
+ // 4. Install Python deps (local/bare-metal only — sandbox manages its own)
43
+ const reqFile = path.join(memoryDst, "requirements.txt");
44
+ if (fs.existsSync(reqFile)) {
45
+ console.log(" Installing Python dependencies...");
46
+ try {
47
+ execSync(`pip3 install -r "${reqFile}" --quiet --break-system-packages`, { stdio: "inherit" });
48
+ console.log(" ✓ Python dependencies installed");
49
+ } catch {
50
+ try {
51
+ execSync(`pip3 install -r "${reqFile}" --quiet`, { stdio: "inherit" });
52
+ console.log(" ✓ Python dependencies installed");
53
+ } catch {
54
+ console.warn(" ⚠ pip3 unavailable — Python eval features disabled");
55
+ }
56
+ }
57
+ }
59
58
  await installLocal();
60
59
  }
61
60
 
@@ -94,8 +93,9 @@ async function installNemoClaw({ sandboxName }) {
94
93
  console.log(" ✓ sinain-sources uploaded to sandbox");
95
94
 
96
95
  // Download sandbox openclaw.json, patch, re-upload
97
- const tmpJson = path.join(os.tmpdir(), `sinain-openclaw-${Date.now()}.json`);
98
- run(`openshell sandbox download ${sandboxName} /sandbox/.openclaw/openclaw.json "${tmpJson}"`);
96
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "sinain-oc-"));
97
+ run(`openshell sandbox download ${sandboxName} /sandbox/.openclaw/openclaw.json "${tmpDir}"`);
98
+ const tmpJson = path.join(tmpDir, "openclaw.json");
99
99
 
100
100
  let cfg = {};
101
101
  try { cfg = JSON.parse(fs.readFileSync(tmpJson, "utf8")); } catch {}
@@ -121,9 +121,11 @@ async function installNemoClaw({ sandboxName }) {
121
121
 
122
122
  const token = cfg.gateway?.auth?.token ?? "(see sandbox openclaw.json)";
123
123
 
124
- fs.writeFileSync(tmpJson, JSON.stringify(cfg, null, 2));
125
- run(`openshell sandbox upload ${sandboxName} "${tmpJson}" /sandbox/.openclaw/openclaw.json`);
126
- fs.rmSync(tmpJson, { force: true });
124
+ const jsonContent = JSON.stringify(cfg, null, 2);
125
+ // openshell upload always treats destination as a directory, so use SSH to write the file directly
126
+ const encoded = Buffer.from(jsonContent).toString("base64");
127
+ run(`ssh -T openshell-${sandboxName} "printf '%s' '${encoded}' | base64 --decode > /sandbox/.openclaw/openclaw.json"`);
128
+ fs.rmSync(tmpDir, { recursive: true, force: true });
127
129
  console.log(" ✓ openclaw.json patched in sandbox");
128
130
 
129
131
  // Memory restore from backup repo (workspace lives inside sandbox)
@@ -251,11 +253,11 @@ function detectNemoClaw() {
251
253
  // ── Helpers ──────────────────────────────────────────────────────────────────
252
254
 
253
255
  function run(cmd) {
254
- execSync(cmd, { stdio: "inherit" });
256
+ execSync(cmd, { stdio: "inherit", cwd: HOME });
255
257
  }
256
258
 
257
259
  function run_capture(cmd) {
258
- return execSync(cmd, { encoding: "utf-8", stdio: ["pipe","pipe","pipe"] }).trim();
260
+ return execSync(cmd, { encoding: "utf-8", stdio: ["pipe","pipe","pipe"], cwd: HOME }).trim();
259
261
  }
260
262
 
261
263
  function copyDir(src, dst) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geravant/sinain",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "sinain OpenClaw plugin — AI overlay for macOS",
5
5
  "type": "module",
6
6
  "bin": {