tamga-vdesktop 1.1.7 → 1.1.8

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 (3) hide show
  1. package/dist/cli.js +43 -12
  2. package/dist/server.js +43 -12
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2200,13 +2200,18 @@ var TerminalManager = class {
2200
2200
  const txt = chunk.toString("utf-8");
2201
2201
  for (const fn of listeners) fn({ type: "output", data: txt });
2202
2202
  });
2203
+ proc.stdin.on("error", () => {
2204
+ });
2203
2205
  proc.on("exit", (code) => {
2204
2206
  for (const fn of listeners) fn({ type: "exit", code: code ?? 0 });
2205
2207
  this.sessions.delete(sessionId);
2206
2208
  });
2207
2209
  const sendCmd = (payload) => {
2208
- if (proc.stdin.writable) {
2209
- proc.stdin.write(JSON.stringify(payload) + "\n");
2210
+ if (!proc.killed && proc.stdin.writable) {
2211
+ try {
2212
+ proc.stdin.write(JSON.stringify(payload) + "\n");
2213
+ } catch {
2214
+ }
2210
2215
  }
2211
2216
  };
2212
2217
  const session = {
@@ -2528,6 +2533,8 @@ var LinuxAppSession = class {
2528
2533
  }
2529
2534
  );
2530
2535
  this.x11BridgeProc = proc;
2536
+ proc.stdin?.on("error", () => {
2537
+ });
2531
2538
  proc.stderr?.on("data", (err) => {
2532
2539
  const msg = err.toString("utf-8").trim();
2533
2540
  if (msg) console.error(`[x11_bridge ${this.displayStr}]`, msg);
@@ -2876,6 +2883,8 @@ var LinuxAppSession = class {
2876
2883
  }
2877
2884
  );
2878
2885
  view.streamerProc = proc;
2886
+ proc.stdin?.on("error", () => {
2887
+ });
2879
2888
  proc.stderr?.on("data", (err) => {
2880
2889
  const msg = err.toString("utf-8").trim();
2881
2890
  if (msg) console.error(`[x11_streamer ${this.displayStr}/${view.viewId}]`, msg);
@@ -2896,12 +2905,22 @@ var LinuxAppSession = class {
2896
2905
  const frame = Buffer.from(acc.subarray(4, 4 + frameLen));
2897
2906
  acc = acc.subarray(4 + frameLen);
2898
2907
  if (!view.hasGeometry) {
2899
- if (proc.stdin?.writable) proc.stdin.write("a\n");
2908
+ if (proc.stdin?.writable) {
2909
+ try {
2910
+ proc.stdin.write("a\n");
2911
+ } catch {
2912
+ }
2913
+ }
2900
2914
  continue;
2901
2915
  }
2902
2916
  view.lastFrame = frame;
2903
2917
  if (view.subscribers.size === 0) {
2904
- if (proc.stdin?.writable) proc.stdin.write("a\n");
2918
+ if (proc.stdin?.writable) {
2919
+ try {
2920
+ proc.stdin.write("a\n");
2921
+ } catch {
2922
+ }
2923
+ }
2905
2924
  continue;
2906
2925
  }
2907
2926
  let ackSent = false;
@@ -2909,7 +2928,10 @@ var LinuxAppSession = class {
2909
2928
  if (!ackSent) {
2910
2929
  ackSent = true;
2911
2930
  if (!this.closed && proc.stdin?.writable) {
2912
- proc.stdin.write("a\n");
2931
+ try {
2932
+ proc.stdin.write("a\n");
2933
+ } catch {
2934
+ }
2913
2935
  }
2914
2936
  }
2915
2937
  };
@@ -2999,9 +3021,12 @@ var LinuxAppSession = class {
2999
3021
  }
3000
3022
  resizeViewCapture(view, evenW, evenH) {
3001
3023
  if (view.streamerMode === "xdamage" && view.streamerProc?.stdin?.writable) {
3002
- view.streamerProc.stdin.write(
3003
- JSON.stringify({ type: "resize", width: evenW, height: evenH }) + "\n"
3004
- );
3024
+ try {
3025
+ view.streamerProc.stdin.write(
3026
+ JSON.stringify({ type: "resize", width: evenW, height: evenH }) + "\n"
3027
+ );
3028
+ } catch {
3029
+ }
3005
3030
  return;
3006
3031
  }
3007
3032
  if (view.resizeTimer) clearTimeout(view.resizeTimer);
@@ -3039,13 +3064,16 @@ var LinuxAppSession = class {
3039
3064
  type: "view_geometry",
3040
3065
  width: view.width,
3041
3066
  height: view.height,
3042
- initial: true
3067
+ initial: view.viewId === "main"
3043
3068
  });
3044
3069
  }
3045
3070
  if (view.lastFrame && view.hasGeometry) {
3046
3071
  sub.onVideoFrame(view.lastFrame);
3047
3072
  } else if (view.streamerMode === "xdamage" && view.streamerProc?.stdin?.writable) {
3048
- view.streamerProc.stdin.write(JSON.stringify({ type: "refresh" }) + "\n");
3073
+ try {
3074
+ view.streamerProc.stdin.write(JSON.stringify({ type: "refresh" }) + "\n");
3075
+ } catch {
3076
+ }
3049
3077
  }
3050
3078
  return () => {
3051
3079
  view.subscribers.delete(sub);
@@ -3053,7 +3081,10 @@ var LinuxAppSession = class {
3053
3081
  }
3054
3082
  sendInput(msg, viewId = "main") {
3055
3083
  if (this.closed || !this.x11BridgeProc?.stdin?.writable) return;
3056
- this.x11BridgeProc.stdin.write(JSON.stringify({ ...msg, view: msg.view || viewId }) + "\n");
3084
+ try {
3085
+ this.x11BridgeProc.stdin.write(JSON.stringify({ ...msg, view: msg.view || viewId }) + "\n");
3086
+ } catch {
3087
+ }
3057
3088
  }
3058
3089
  resizeView(viewId, width, height) {
3059
3090
  if (this.closed) return;
@@ -3489,7 +3520,7 @@ var VSCodeServerManager = class {
3489
3520
  };
3490
3521
 
3491
3522
  // server/index.ts
3492
- var TAMGA_VERSION = "1.1.7";
3523
+ var TAMGA_VERSION = "1.1.8";
3493
3524
  var MIME_MAP = {
3494
3525
  html: "text/html; charset=utf-8",
3495
3526
  htm: "text/html; charset=utf-8",
package/dist/server.js CHANGED
@@ -1882,13 +1882,18 @@ var TerminalManager = class {
1882
1882
  const txt = chunk.toString("utf-8");
1883
1883
  for (const fn of listeners) fn({ type: "output", data: txt });
1884
1884
  });
1885
+ proc.stdin.on("error", () => {
1886
+ });
1885
1887
  proc.on("exit", (code) => {
1886
1888
  for (const fn of listeners) fn({ type: "exit", code: code ?? 0 });
1887
1889
  this.sessions.delete(sessionId);
1888
1890
  });
1889
1891
  const sendCmd = (payload) => {
1890
- if (proc.stdin.writable) {
1891
- proc.stdin.write(JSON.stringify(payload) + "\n");
1892
+ if (!proc.killed && proc.stdin.writable) {
1893
+ try {
1894
+ proc.stdin.write(JSON.stringify(payload) + "\n");
1895
+ } catch {
1896
+ }
1892
1897
  }
1893
1898
  };
1894
1899
  const session = {
@@ -2519,6 +2524,8 @@ var LinuxAppSession = class {
2519
2524
  }
2520
2525
  );
2521
2526
  this.x11BridgeProc = proc;
2527
+ proc.stdin?.on("error", () => {
2528
+ });
2522
2529
  proc.stderr?.on("data", (err) => {
2523
2530
  const msg = err.toString("utf-8").trim();
2524
2531
  if (msg) console.error(`[x11_bridge ${this.displayStr}]`, msg);
@@ -2867,6 +2874,8 @@ var LinuxAppSession = class {
2867
2874
  }
2868
2875
  );
2869
2876
  view.streamerProc = proc;
2877
+ proc.stdin?.on("error", () => {
2878
+ });
2870
2879
  proc.stderr?.on("data", (err) => {
2871
2880
  const msg = err.toString("utf-8").trim();
2872
2881
  if (msg) console.error(`[x11_streamer ${this.displayStr}/${view.viewId}]`, msg);
@@ -2887,12 +2896,22 @@ var LinuxAppSession = class {
2887
2896
  const frame = Buffer.from(acc.subarray(4, 4 + frameLen));
2888
2897
  acc = acc.subarray(4 + frameLen);
2889
2898
  if (!view.hasGeometry) {
2890
- if (proc.stdin?.writable) proc.stdin.write("a\n");
2899
+ if (proc.stdin?.writable) {
2900
+ try {
2901
+ proc.stdin.write("a\n");
2902
+ } catch {
2903
+ }
2904
+ }
2891
2905
  continue;
2892
2906
  }
2893
2907
  view.lastFrame = frame;
2894
2908
  if (view.subscribers.size === 0) {
2895
- if (proc.stdin?.writable) proc.stdin.write("a\n");
2909
+ if (proc.stdin?.writable) {
2910
+ try {
2911
+ proc.stdin.write("a\n");
2912
+ } catch {
2913
+ }
2914
+ }
2896
2915
  continue;
2897
2916
  }
2898
2917
  let ackSent = false;
@@ -2900,7 +2919,10 @@ var LinuxAppSession = class {
2900
2919
  if (!ackSent) {
2901
2920
  ackSent = true;
2902
2921
  if (!this.closed && proc.stdin?.writable) {
2903
- proc.stdin.write("a\n");
2922
+ try {
2923
+ proc.stdin.write("a\n");
2924
+ } catch {
2925
+ }
2904
2926
  }
2905
2927
  }
2906
2928
  };
@@ -2990,9 +3012,12 @@ var LinuxAppSession = class {
2990
3012
  }
2991
3013
  resizeViewCapture(view, evenW, evenH) {
2992
3014
  if (view.streamerMode === "xdamage" && view.streamerProc?.stdin?.writable) {
2993
- view.streamerProc.stdin.write(
2994
- JSON.stringify({ type: "resize", width: evenW, height: evenH }) + "\n"
2995
- );
3015
+ try {
3016
+ view.streamerProc.stdin.write(
3017
+ JSON.stringify({ type: "resize", width: evenW, height: evenH }) + "\n"
3018
+ );
3019
+ } catch {
3020
+ }
2996
3021
  return;
2997
3022
  }
2998
3023
  if (view.resizeTimer) clearTimeout(view.resizeTimer);
@@ -3030,13 +3055,16 @@ var LinuxAppSession = class {
3030
3055
  type: "view_geometry",
3031
3056
  width: view.width,
3032
3057
  height: view.height,
3033
- initial: true
3058
+ initial: view.viewId === "main"
3034
3059
  });
3035
3060
  }
3036
3061
  if (view.lastFrame && view.hasGeometry) {
3037
3062
  sub.onVideoFrame(view.lastFrame);
3038
3063
  } else if (view.streamerMode === "xdamage" && view.streamerProc?.stdin?.writable) {
3039
- view.streamerProc.stdin.write(JSON.stringify({ type: "refresh" }) + "\n");
3064
+ try {
3065
+ view.streamerProc.stdin.write(JSON.stringify({ type: "refresh" }) + "\n");
3066
+ } catch {
3067
+ }
3040
3068
  }
3041
3069
  return () => {
3042
3070
  view.subscribers.delete(sub);
@@ -3044,7 +3072,10 @@ var LinuxAppSession = class {
3044
3072
  }
3045
3073
  sendInput(msg, viewId = "main") {
3046
3074
  if (this.closed || !this.x11BridgeProc?.stdin?.writable) return;
3047
- this.x11BridgeProc.stdin.write(JSON.stringify({ ...msg, view: msg.view || viewId }) + "\n");
3075
+ try {
3076
+ this.x11BridgeProc.stdin.write(JSON.stringify({ ...msg, view: msg.view || viewId }) + "\n");
3077
+ } catch {
3078
+ }
3048
3079
  }
3049
3080
  resizeView(viewId, width, height) {
3050
3081
  if (this.closed) return;
@@ -3480,7 +3511,7 @@ var VSCodeServerManager = class {
3480
3511
  };
3481
3512
 
3482
3513
  // server/index.ts
3483
- var TAMGA_VERSION = "1.1.7";
3514
+ var TAMGA_VERSION = "1.1.8";
3484
3515
  var MIME_MAP = {
3485
3516
  html: "text/html; charset=utf-8",
3486
3517
  htm: "text/html; charset=utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamga-vdesktop",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "TamgaVDesktop — Self-hostable Linux Virtual Desktop OS platform with native web shell, real Linux terminal, and seamless native Linux GUI apps (Firefox, VS Code, Antigravity).",