@rubytech/create-maxy-lite 0.1.9 → 0.1.11
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/index.mjs +17 -18
- package/lib/paths.mjs +15 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -136,27 +136,26 @@ const installDeps = async () => {
|
|
|
136
136
|
// built artifact directly to recover the actual dlopen error, and carry THAT into
|
|
137
137
|
// err= — the true reason (ABI/NODE_MODULE_VERSION/symbol/ELF), not the swallowed miss.
|
|
138
138
|
if (runIn(ptyLoadCommand()).code !== 0) {
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
|
|
139
|
+
// Build err= from the THREE facts that pin a native-load failure, each plainly
|
|
140
|
+
// labelled — not the raw multi-line Node stack (which buries the real line and
|
|
141
|
+
// truncates). `lines()` drops proot's per-login `can't sanitize binding` noise.
|
|
142
|
+
const lines = (s) =>
|
|
142
143
|
String(s || '')
|
|
143
144
|
.split('\n')
|
|
144
|
-
.
|
|
145
|
-
.
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
.map((l) => l.trim())
|
|
146
|
+
.filter((l) => l && !/proot warning: can't sanitize binding/.test(l))
|
|
147
|
+
const join = (s) => lines(s).join(' ').replace(/\s+/g, ' ').trim()
|
|
148
|
+
|
|
149
|
+
// 1. The real error line only (e.g. `Error: libc.so: cannot open shared object
|
|
150
|
+
// file`), not the dlopen stack frames.
|
|
148
151
|
const direct = runIn(ptyDirectLoadCommand())
|
|
149
|
-
const
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
// Termux linker env
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
)
|
|
157
|
-
throw new Error(
|
|
158
|
-
`node-pty native module did not load after build: ${cause} || ldd+env: ${clean(diag.stdout + ' ' + diag.stderr)}`,
|
|
159
|
-
)
|
|
152
|
+
const errLine = lines(direct.stderr).find((l) => /Error:/.test(l)) || join(direct.stderr) || `no stderr; ${PTY_NODE}`
|
|
153
|
+
// 2. ldd: which shared objects pty.node needs and which resolve to "not found".
|
|
154
|
+
const ldd = join(runIn(`ldd ${PTY_NODE} 2>&1`).stdout)
|
|
155
|
+
// 3. Any leaked Termux linker env that could have steered the build's libc.
|
|
156
|
+
const env = join(runIn(`env | grep -iE 'LD_PRELOAD|LD_LIBRARY_PATH|LIBRARY_PATH' || echo '(no LD_* env)'`).stdout)
|
|
157
|
+
|
|
158
|
+
throw new Error(`node-pty did not load | error: ${errLine} | ldd: ${ldd} | env: ${env}`)
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
161
|
|
package/lib/paths.mjs
CHANGED
|
@@ -26,6 +26,17 @@ export const VALIDATOR_CLI = `${PATHS.appDir}/validator/cli.mjs`
|
|
|
26
26
|
// exactly one place.
|
|
27
27
|
export const PTY_NODE = `${WEBCHAT_DIR}/node_modules/node-pty/build/Release/pty.node`
|
|
28
28
|
|
|
29
|
+
// Clean guest environment for the native build / load / relay. The installer spawns
|
|
30
|
+
// proot FROM bare Termux, so the guest inherits Termux's PATH (its clang) and
|
|
31
|
+
// linker env (LD_LIBRARY_PATH/LD_PRELOAD → Termux's bionic libc + libc++_shared.so).
|
|
32
|
+
// Building node-pty under that linked it against Termux's libraries, so pty.node
|
|
33
|
+
// needed bionic `libc.so` (not found under glibc) — proven by `ldd` showing
|
|
34
|
+
// `libc++_shared.so => /data/data/com.termux/.../lib`. Forcing a clean Ubuntu PATH
|
|
35
|
+
// and dropping the leaked linker vars makes the build use Ubuntu's glibc toolchain,
|
|
36
|
+
// exactly as the spike's clean interactive login did.
|
|
37
|
+
export const GUEST_BUILD_ENV =
|
|
38
|
+
'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; unset LD_LIBRARY_PATH LD_PRELOAD LIBRARY_PATH'
|
|
39
|
+
|
|
29
40
|
/**
|
|
30
41
|
* The guest-side command that proves node-pty's native module actually loads
|
|
31
42
|
* under the guest's Node — `require("node-pty")` exits 0 only when `pty.node` is
|
|
@@ -36,7 +47,7 @@ export const PTY_NODE = `${WEBCHAT_DIR}/node_modules/node-pty/build/Release/pty.
|
|
|
36
47
|
* binary (stale/wrong-ABI from a prior build) and wrongly skip the rebuild.
|
|
37
48
|
*/
|
|
38
49
|
export function ptyLoadCommand({ webchatDir = WEBCHAT_DIR } = {}) {
|
|
39
|
-
return
|
|
50
|
+
return `${GUEST_BUILD_ENV}; cd ${webchatDir} && node -e 'require("node-pty")'`
|
|
40
51
|
}
|
|
41
52
|
|
|
42
53
|
/**
|
|
@@ -51,7 +62,7 @@ export function ptyLoadCommand({ webchatDir = WEBCHAT_DIR } = {}) {
|
|
|
51
62
|
* and the pass/fail gate) fails, to put the true reason into the step's `err=`.
|
|
52
63
|
*/
|
|
53
64
|
export function ptyDirectLoadCommand({ ptyNode = PTY_NODE } = {}) {
|
|
54
|
-
return
|
|
65
|
+
return `${GUEST_BUILD_ENV}; node -e 'require("${ptyNode}")'`
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
/**
|
|
@@ -74,7 +85,7 @@ export function webchatInstallCommand({ webchatDir = WEBCHAT_DIR } = {}) {
|
|
|
74
85
|
// node_modules first, then install: that recreates the spike's empty-dir build.
|
|
75
86
|
// `npm install node-pty` also resolves package.json (ws). The env prefix forces
|
|
76
87
|
// scripts on to match the spike's environment regardless of ambient ignore-scripts.
|
|
77
|
-
return
|
|
88
|
+
return `${GUEST_BUILD_ENV}; cd ${webchatDir} && rm -rf node_modules package-lock.json && npm_config_ignore_scripts=false npm install node-pty`
|
|
78
89
|
}
|
|
79
90
|
|
|
80
91
|
// The shipped skills, as bundled into the app dir, and the path the on-device
|
|
@@ -148,7 +159,7 @@ export function vaultBindLogin(
|
|
|
148
159
|
inner,
|
|
149
160
|
{ distro = PATHS.distro, vaultHost = PATHS.vaultHost, vaultGuest = PATHS.vaultGuest } = {},
|
|
150
161
|
) {
|
|
151
|
-
return `proot-distro login ${distro} --bind ${vaultHost}:${vaultGuest} -- bash -lc '${inner}'`
|
|
162
|
+
return `proot-distro login ${distro} --bind ${vaultHost}:${vaultGuest} -- bash -lc '${GUEST_BUILD_ENV}; ${inner}'`
|
|
152
163
|
}
|
|
153
164
|
|
|
154
165
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubytech/create-maxy-lite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Install maxy-lite on an Android phone: orchestrates proot-distro Ubuntu, glibc Node, claude, the web-chat relay, the vault and its bind-mount — run via npx in bare Termux.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|