airloom 0.1.30 → 0.1.31

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/dist/index.js +27 -17
  2. 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
- const nodePty = await import("node-pty");
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, dirname, isAbsolute as isAbsolute2, join as join3, resolve as resolve2 } from "node:path";
1068
- import { chmodSync, existsSync as existsSync2, statSync } from "node:fs";
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
- import { spawn as spawn2 } from "node-pty";
1071
- function fixSpawnHelperPermissions() {
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
- const ptyDir = dirname(require_.resolve("node-pty/package.json"));
1075
- const helperPath = join3(ptyDir, "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
1076
- if (!existsSync2(helperPath)) return;
1077
- const mode = statSync(helperPath).mode;
1078
- if (!(mode & 73)) {
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 = spawn2(file, command.args, spawnOpts);
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 = spawn2("/bin/sh", [], spawnOpts);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airloom",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",