pairshell-cli 0.0.1 → 0.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pairshell-cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Desktop agent CLI for PairShell — pair an Android device over an encrypted tunnel and drive a real terminal session.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -44,5 +44,8 @@
44
44
  "qrcode-terminal": "^0.12.0",
45
45
  "tweetnacl": "^1.0.3",
46
46
  "ws": "^8.18.0"
47
+ },
48
+ "allowScripts": {
49
+ "node-pty@1.1.0": true
47
50
  }
48
51
  }
package/src/pty-bridge.js CHANGED
@@ -14,12 +14,21 @@ export function bridgeSession(ws, opts = {}) {
14
14
  const rows = opts.rows && opts.rows > 0 ? opts.rows : 24;
15
15
  const sharedKey = opts.sharedKey || null;
16
16
 
17
- const term = pty.spawn(shell, [], {
18
- name: "xterm-256color",
19
- cols,
20
- rows,
21
- cwd: process.cwd(),
22
- });
17
+ let term;
18
+ try {
19
+ term = pty.spawn(shell, [], {
20
+ name: "xterm-256color",
21
+ cols,
22
+ rows,
23
+ cwd: process.cwd(),
24
+ });
25
+ } catch (err) {
26
+ try {
27
+ ws.send(JSON.stringify({ type: "error", message: `PTY spawn failed: ${err.message}` }));
28
+ } catch {}
29
+ try { ws.close(); } catch {}
30
+ return null;
31
+ }
23
32
 
24
33
  let closed = false;
25
34
  const cleanup = () => {
package/src/start.js CHANGED
@@ -279,6 +279,14 @@ export async function startCommand(opts) {
279
279
  process.exit(0);
280
280
  };
281
281
 
282
+ process.on("uncaughtException", (err) => {
283
+ warn(`Uncaught exception: ${err.message}`);
284
+ // don't exit — let the server keep running for reconnections
285
+ });
286
+ process.on("unhandledRejection", (err) => {
287
+ warn(`Unhandled rejection: ${err?.message || err}`);
288
+ });
289
+
282
290
  process.on("SIGINT", shutdown);
283
291
  process.on("SIGTERM", shutdown);
284
292