airloom 0.1.30 → 0.1.32
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/index.js +39 -24
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -921,7 +921,12 @@ var CLIAdapter = class {
|
|
|
921
921
|
// --- repl -------------------------------------------------------------------
|
|
922
922
|
async ensurePty() {
|
|
923
923
|
if (this.pty) return this.pty;
|
|
924
|
-
|
|
924
|
+
let nodePty;
|
|
925
|
+
try {
|
|
926
|
+
nodePty = await import("@lydell/node-pty");
|
|
927
|
+
} catch (err) {
|
|
928
|
+
throw new Error(`Failed to load @lydell/node-pty: ${err.message}`);
|
|
929
|
+
}
|
|
925
930
|
const executable = resolveExecutable(this.command) ?? this.command;
|
|
926
931
|
log(`[cli-repl] Spawning PTY: ${executable} ${this.args.join(" ")}`);
|
|
927
932
|
const pty = nodePty.spawn(executable, this.args, {
|
|
@@ -1064,25 +1069,23 @@ function getConfigPath() {
|
|
|
1064
1069
|
}
|
|
1065
1070
|
|
|
1066
1071
|
// src/terminal.ts
|
|
1067
|
-
import { basename, delimiter as delimiter2,
|
|
1068
|
-
import {
|
|
1072
|
+
import { basename, delimiter as delimiter2, isAbsolute as isAbsolute2, join as join3, resolve as resolve2 } from "node:path";
|
|
1073
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
1069
1074
|
import { createRequire } from "node:module";
|
|
1070
|
-
|
|
1071
|
-
|
|
1075
|
+
var _nodePty = null;
|
|
1076
|
+
var _nodePtyError = null;
|
|
1077
|
+
function requireNodePty() {
|
|
1078
|
+
if (_nodePty) return _nodePty;
|
|
1079
|
+
if (_nodePtyError) throw new Error(_nodePtyError);
|
|
1072
1080
|
try {
|
|
1073
1081
|
const require_ = createRequire(import.meta.url);
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
chmodSync(helperPath, mode | 493);
|
|
1080
|
-
log(`[host] Fixed spawn-helper permissions: ${helperPath}`);
|
|
1081
|
-
}
|
|
1082
|
-
} catch {
|
|
1082
|
+
_nodePty = require_("@lydell/node-pty");
|
|
1083
|
+
return _nodePty;
|
|
1084
|
+
} catch (err) {
|
|
1085
|
+
_nodePtyError = `Failed to load @lydell/node-pty: ${err.message}`;
|
|
1086
|
+
throw new Error(_nodePtyError);
|
|
1083
1087
|
}
|
|
1084
1088
|
}
|
|
1085
|
-
fixSpawnHelperPermissions();
|
|
1086
1089
|
var QUERY_RESPONSE_RE = new RegExp(
|
|
1087
1090
|
[
|
|
1088
1091
|
// OSC color (full form): ESC] <id>[;<id>] ; rgb:RR/GG/BB [ST]
|
|
@@ -1219,15 +1222,22 @@ var TerminalSession = class {
|
|
|
1219
1222
|
log(`[host] PTY spawn: ${file} ${command.args.join(" ")} (${this.cols}x${this.rows}) node=${process.version}`);
|
|
1220
1223
|
const env2 = { ...process.env, TERM: "xterm-256color" };
|
|
1221
1224
|
const spawnOpts = { name: "xterm-256color", cols: this.cols, rows: this.rows, cwd, env: env2 };
|
|
1225
|
+
let nodePty;
|
|
1226
|
+
try {
|
|
1227
|
+
nodePty = requireNodePty();
|
|
1228
|
+
} catch (err) {
|
|
1229
|
+
logError(`[host] ${err.message}`);
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1222
1232
|
try {
|
|
1223
|
-
this.pty =
|
|
1233
|
+
this.pty = nodePty.spawn(file, command.args, spawnOpts);
|
|
1224
1234
|
} catch (err) {
|
|
1225
1235
|
const e = err;
|
|
1226
1236
|
logError(`[host] PTY spawn failed: ${e.message} (code=${e.code ?? "none"}) file=${file} cwd=${cwd}`);
|
|
1227
1237
|
if (file !== "/bin/sh") {
|
|
1228
1238
|
logError("[host] Retrying with /bin/sh...");
|
|
1229
1239
|
try {
|
|
1230
|
-
this.pty =
|
|
1240
|
+
this.pty = nodePty.spawn("/bin/sh", [], spawnOpts);
|
|
1231
1241
|
log("[host] PTY fallback to /bin/sh succeeded");
|
|
1232
1242
|
} catch (err2) {
|
|
1233
1243
|
logError("[host] PTY fallback also failed:", err2.message);
|
|
@@ -2509,13 +2519,18 @@ async function main() {
|
|
|
2509
2519
|
if (!useAbly) console.log(`Relay: ${RELAY_URL}`);
|
|
2510
2520
|
const localUrl = `http://localhost:${port}`;
|
|
2511
2521
|
const controlUrl = encodeControlUrl(localUrl, controlToken);
|
|
2512
|
-
log(`
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2522
|
+
console.log(`Host UI: ${controlUrl}`);
|
|
2523
|
+
const isSSH = !!(process.env.SSH_CONNECTION || process.env.SSH_TTY || process.env.SSH_CLIENT);
|
|
2524
|
+
if (isSSH) {
|
|
2525
|
+
console.log("\n (SSH session detected \u2014 open the Host UI URL above in a local browser)");
|
|
2526
|
+
} else {
|
|
2527
|
+
import("node:child_process").then(({ exec }) => {
|
|
2528
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
2529
|
+
exec(`${cmd} ${controlUrl}`);
|
|
2530
|
+
}).catch(() => {
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
console.log();
|
|
2519
2534
|
const terminal = new TerminalSession(channel, () => state.terminalLaunchCommand, broadcast);
|
|
2520
2535
|
state.terminal = terminal;
|
|
2521
2536
|
const pushViewerSession = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "airloom",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"description": "Run AI on your computer, control it from your phone. E2E encrypted.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@lydell/node-pty": "^1.2.0-beta.3",
|
|
14
15
|
"@noble/hashes": "^1.7.0",
|
|
15
16
|
"@xterm/addon-fit": "^0.11.0",
|
|
16
17
|
"@xterm/xterm": "^6.0.0",
|
|
17
18
|
"ably": "^2.20.0",
|
|
18
19
|
"events": "^3.3.0",
|
|
19
20
|
"express": "5.2.1",
|
|
20
|
-
"node-pty": "^1.1.0",
|
|
21
21
|
"qrcode": "^1.5.3",
|
|
22
22
|
"tweetnacl": "^1.0.3",
|
|
23
23
|
"ws": "^8.18.0"
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"esbuild": "^0.27.4"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"postinstall": "node -e \"process.env.CI||require('child_process').execSync('pnpm rebuild node-pty',{stdio:'inherit'})\"",
|
|
36
35
|
"dev": "pnpm build:host-only && pnpm copy-viewer && node dist/index.js",
|
|
37
36
|
"start": "node dist/index.js",
|
|
38
37
|
"build": "pnpm --dir ../viewer build && node build.mjs && pnpm copy-viewer",
|