@openscout/scout 0.2.70 → 0.2.72

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.
@@ -7,11 +7,11 @@ import { createRequire as createRequire2 } from "node:module";
7
7
 
8
8
  // packages/web/server/terminal-relay-session.ts
9
9
  import { createRequire } from "module";
10
- import { execSync } from "child_process";
10
+ import { execFileSync, execSync } from "child_process";
11
11
  import { existsSync, mkdirSync, writeFileSync } from "fs";
12
12
  import { join, dirname as pathDirname } from "path";
13
13
  var require2 = createRequire(import.meta.url);
14
- var pty = require2("node-pty");
14
+ var pty = require2("@lydell/node-pty");
15
15
  var DEFAULT_ORPHAN_TTL_MS = 30 * 60 * 1000;
16
16
  var MAX_BUFFER_SIZE = 512 * 1024;
17
17
  var sessions = new Map;
@@ -56,6 +56,9 @@ function resizeSession(session, cols, rows) {
56
56
  return false;
57
57
  try {
58
58
  session.pty.resize(cols, rows);
59
+ if (session.backend === "tmux" && session.tmuxSession) {
60
+ resizeTmuxWindow(session.tmuxSession, cols, rows);
61
+ }
59
62
  session.cols = cols;
60
63
  session.rows = rows;
61
64
  return true;
@@ -117,6 +120,22 @@ function tmuxSessionExists(name) {
117
120
  return false;
118
121
  }
119
122
  }
123
+ function resizeTmuxWindow(name, cols, rows) {
124
+ try {
125
+ execFileSync("tmux", [
126
+ "resize-window",
127
+ "-t",
128
+ name,
129
+ "-x",
130
+ String(cols),
131
+ "-y",
132
+ String(rows)
133
+ ], { stdio: "ignore" });
134
+ return true;
135
+ } catch {
136
+ return false;
137
+ }
138
+ }
120
139
  function bootstrapFiles(cwd, files, sessionId) {
121
140
  for (const [relPath, content] of Object.entries(files)) {
122
141
  const absPath = join(cwd, relPath);
@@ -140,9 +159,7 @@ function spawnTmuxSession(tmuxName, cols, rows, cwd, commandBin, commandArgs, en
140
159
  execSync(`tmux new-session -d -s ${tmuxName} -x ${cols} -y ${rows} -c '${cwd}' '${shellCmd}'`, { env });
141
160
  console.log(`[relay] Created tmux session: ${tmuxName}`);
142
161
  } else {
143
- try {
144
- execSync(`tmux resize-window -t ${tmuxName} -x ${cols} -y ${rows} 2>/dev/null`);
145
- } catch {}
162
+ resizeTmuxWindow(tmuxName, cols, rows);
146
163
  console.log(`[relay] Attaching to existing tmux session: ${tmuxName}`);
147
164
  }
148
165
  return pty.spawn("tmux", ["attach", "-t", tmuxName], {