openclaw-droid 2.0.1 → 2.0.4

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.

Potentially problematic release.


This version of openclaw-droid might be problematic. Click here for more details.

@@ -1,64 +1,64 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
-
4
- const BYPASS_SCRIPT = `
5
- const os = require('os');
6
- const originalNetworkInterfaces = os.networkInterfaces;
7
-
8
- os.networkInterfaces = function() {
9
- try {
10
- const interfaces = originalNetworkInterfaces.call(os);
11
- if (interfaces && Object.keys(interfaces).length > 0) {
12
- return interfaces;
13
- }
14
- } catch (e) {}
15
-
16
- return {
17
- lo: [
18
- {
19
- address: '127.0.0.1',
20
- netmask: '255.0.0.0',
21
- family: 'IPv4',
22
- mac: '00:00:00:00:00:00',
23
- internal: true,
24
- cidr: '127.0.0.1/8'
25
- }
26
- ]
27
- };
28
- };
29
- `;
30
-
31
- export function getBypassScriptPath() {
32
- const homeDir = process.env.HOME || '/data/data/com.termux/files/home';
33
- return path.join(homeDir, '.openclaw', 'bionic-bypass.js');
34
- }
35
-
36
- export function installBypass() {
37
- const scriptPath = getBypassScriptPath();
38
- const scriptDir = path.dirname(scriptPath);
39
-
40
- if (!fs.existsSync(scriptDir)) {
41
- fs.mkdirSync(scriptDir, { recursive: true });
42
- }
43
-
44
- fs.writeFileSync(scriptPath, BYPASS_SCRIPT, 'utf8');
45
- fs.chmodSync(scriptPath, '644');
46
-
47
- return scriptPath;
48
- }
49
-
50
- export function getNodeOptions() {
51
- const scriptPath = getBypassScriptPath();
52
- return `--require "${scriptPath}"`;
53
- }
54
-
55
- export function isAndroid() {
56
- return process.platform === 'android' ||
57
- fs.existsSync('/data/data/com.termux') ||
58
- process.env.TERMUX_VERSION !== undefined;
59
- }
60
-
61
- export function checkBypassInstalled() {
62
- const scriptPath = getBypassScriptPath();
63
- return fs.existsSync(scriptPath);
64
- }
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ const BYPASS_SCRIPT = `
5
+ const os = require('os');
6
+ const originalNetworkInterfaces = os.networkInterfaces;
7
+
8
+ os.networkInterfaces = function() {
9
+ try {
10
+ const interfaces = originalNetworkInterfaces.call(os);
11
+ if (interfaces && Object.keys(interfaces).length > 0) {
12
+ return interfaces;
13
+ }
14
+ } catch (e) {}
15
+
16
+ return {
17
+ lo: [
18
+ {
19
+ address: '127.0.0.1',
20
+ netmask: '255.0.0.0',
21
+ family: 'IPv4',
22
+ mac: '00:00:00:00:00:00',
23
+ internal: true,
24
+ cidr: '127.0.0.1/8'
25
+ }
26
+ ]
27
+ };
28
+ };
29
+ `;
30
+
31
+ export function getBypassScriptPath() {
32
+ const homeDir = process.env.HOME || '/data/data/com.termux/files/home';
33
+ return path.join(homeDir, '.openclaw', 'bionic-bypass.js');
34
+ }
35
+
36
+ export function installBypass() {
37
+ const scriptPath = getBypassScriptPath();
38
+ const scriptDir = path.dirname(scriptPath);
39
+
40
+ if (!fs.existsSync(scriptDir)) {
41
+ fs.mkdirSync(scriptDir, { recursive: true });
42
+ }
43
+
44
+ fs.writeFileSync(scriptPath, BYPASS_SCRIPT, 'utf8');
45
+ fs.chmodSync(scriptPath, '644');
46
+
47
+ return scriptPath;
48
+ }
49
+
50
+ export function getNodeOptions() {
51
+ const scriptPath = getBypassScriptPath();
52
+ return `--require "${scriptPath}"`;
53
+ }
54
+
55
+ export function isAndroid() {
56
+ return process.platform === 'android' ||
57
+ fs.existsSync('/data/data/com.termux') ||
58
+ process.env.TERMUX_VERSION !== undefined;
59
+ }
60
+
61
+ export function checkBypassInstalled() {
62
+ const scriptPath = getBypassScriptPath();
63
+ return fs.existsSync(scriptPath);
64
+ }
package/lib/env.js CHANGED
@@ -1,49 +1,49 @@
1
- import { logger } from './utils.js';
2
-
3
- function createSafeEnv(baseEnv = {}) {
4
- const safeEnv = {
5
- ...baseEnv,
6
- ...process.env
7
- };
8
-
9
- if (process.env.NODE_OPTIONS) {
10
- safeEnv.NODE_OPTIONS = process.env.NODE_OPTIONS;
11
- }
12
-
13
- if (process.env.TMPDIR) {
14
- safeEnv.TMPDIR = process.env.TMPDIR;
15
- safeEnv.TMP = process.env.TMPDIR;
16
- safeEnv.TEMP = process.env.TMPDIR;
17
- }
18
-
19
- return safeEnv;
20
- }
21
-
22
- function setTempEnvironment(prefix) {
23
- const tmpDir = `${prefix}/tmp`;
24
-
25
- process.env.TMPDIR = tmpDir;
26
- process.env.TMP = tmpDir;
27
- process.env.TEMP = tmpDir;
28
-
29
- logger.debug(`Set TMPDIR to: ${tmpDir}`);
30
-
31
- return tmpDir;
32
- }
33
-
34
- function setNodeOptions(options) {
35
- const currentOptions = process.env.NODE_OPTIONS || '';
36
- const newOptions = `${currentOptions} ${options}`.trim();
37
-
38
- process.env.NODE_OPTIONS = newOptions;
39
-
40
- logger.debug(`Set NODE_OPTIONS to: ${newOptions}`);
41
-
42
- return newOptions;
43
- }
44
-
45
- export {
46
- createSafeEnv,
47
- setTempEnvironment,
48
- setNodeOptions
49
- };
1
+ import { logger } from './utils.js';
2
+
3
+ function createSafeEnv(baseEnv = {}) {
4
+ const safeEnv = {
5
+ ...baseEnv,
6
+ ...process.env
7
+ };
8
+
9
+ if (process.env.NODE_OPTIONS) {
10
+ safeEnv.NODE_OPTIONS = process.env.NODE_OPTIONS;
11
+ }
12
+
13
+ if (process.env.TMPDIR) {
14
+ safeEnv.TMPDIR = process.env.TMPDIR;
15
+ safeEnv.TMP = process.env.TMPDIR;
16
+ safeEnv.TEMP = process.env.TMPDIR;
17
+ }
18
+
19
+ return safeEnv;
20
+ }
21
+
22
+ function setTempEnvironment(prefix) {
23
+ const tmpDir = `${prefix}/tmp`;
24
+
25
+ process.env.TMPDIR = tmpDir;
26
+ process.env.TMP = tmpDir;
27
+ process.env.TEMP = tmpDir;
28
+
29
+ logger.debug(`Set TMPDIR to: ${tmpDir}`);
30
+
31
+ return tmpDir;
32
+ }
33
+
34
+ function setNodeOptions(options) {
35
+ const currentOptions = process.env.NODE_OPTIONS || '';
36
+ const newOptions = `${currentOptions} ${options}`.trim();
37
+
38
+ process.env.NODE_OPTIONS = newOptions;
39
+
40
+ logger.debug(`Set NODE_OPTIONS to: ${newOptions}`);
41
+
42
+ return newOptions;
43
+ }
44
+
45
+ export {
46
+ createSafeEnv,
47
+ setTempEnvironment,
48
+ setNodeOptions
49
+ };
package/lib/index.js CHANGED
@@ -124,22 +124,22 @@ async function runSetup() {
124
124
  console.log('Some features may not work on other platforms.\n');
125
125
  }
126
126
 
127
- if (isAndroid()) {
128
- console.log('[1/7] Installing Termux dependencies...');
129
- const termuxOk = installTermuxDeps();
130
- if (!termuxOk) {
131
- gracefulExit(1);
132
- }
133
- console.log('');
134
-
135
- console.log('[2/7] Setting up Termux Bionic Bypass...');
136
- try {
137
- setupBionicBypass();
138
- } catch (err) {
139
- console.error('Failed to setup Termux Bionic Bypass:', err.message);
140
- gracefulExit(1);
141
- }
142
- console.log('');
127
+ if (isAndroid()) {
128
+ console.log('[1/7] Installing Termux dependencies...');
129
+ const termuxOk = installTermuxDeps();
130
+ if (!termuxOk) {
131
+ gracefulExit(1);
132
+ }
133
+ console.log('');
134
+
135
+ console.log('[2/7] Setting up Termux Bionic Bypass...');
136
+ try {
137
+ setupBionicBypass();
138
+ } catch (err) {
139
+ console.error('Failed to setup Termux Bionic Bypass:', err.message);
140
+ gracefulExit(1);
141
+ }
142
+ console.log('');
143
143
  }
144
144
 
145
145
  let status = getInstallStatus();
@@ -297,15 +297,15 @@ function runSelfCheck(args = []) {
297
297
  console.log(` NODE_OPTIONS: ${status.nodeOptions ? '✓ set' : '✗ missing'}`);
298
298
  console.log('');
299
299
 
300
- console.log('Permissions:');
301
- let apiPermission = false;
302
- let storagePermission = false;
303
-
304
- try {
305
- safeExecSync('termux-battery-status', { stdio: 'pipe' });
306
- apiPermission = true;
307
- } catch (e) {
308
- logger.debug('API permission check failed:', e.message);
300
+ console.log('Permissions:');
301
+ let apiPermission = false;
302
+ let storagePermission = false;
303
+
304
+ try {
305
+ safeExecSync('termux-battery-status', { stdio: 'pipe' });
306
+ apiPermission = true;
307
+ } catch (e) {
308
+ logger.debug('API permission check failed:', e.message);
309
309
  }
310
310
 
311
311
  // Check storage (approximate check)