@unlikeotherai/unloved 0.3.0 → 0.3.1

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 CHANGED
@@ -332,15 +332,15 @@ var GRACE_MS = 6e4;
332
332
  function sendJson(ws, msg) {
333
333
  ws.send(JSON.stringify(msg));
334
334
  }
335
- function attach(sessionName, ws) {
335
+ function attach(sessionName, ws, initialCols = 120, initialRows = 30) {
336
336
  let entry = entries.get(sessionName);
337
337
  if (!entry) {
338
338
  let pty;
339
339
  try {
340
340
  pty = spawn(tmuxBin, ["attach-session", "-t", sessionName], {
341
341
  name: "xterm-256color",
342
- cols: 120,
343
- rows: 30,
342
+ cols: initialCols,
343
+ rows: initialRows,
344
344
  cwd: process.env.HOME ?? "/",
345
345
  env: { ...process.env }
346
346
  });
@@ -373,6 +373,7 @@ function attach(sessionName, ws) {
373
373
  clearTimeout(entry.graceTimer);
374
374
  entry.graceTimer = null;
375
375
  }
376
+ entry.pty.resize(initialCols, initialRows);
376
377
  const replay = entry.buffer.getAll();
377
378
  if (replay.length > 0) {
378
379
  sendJson(ws, { type: "replay", data: replay.toString("utf-8") });
@@ -408,8 +409,11 @@ function createWsHandler(server) {
408
409
  wss.emit("connection", ws, req, match[1]);
409
410
  });
410
411
  });
411
- wss.on("connection", (ws, _req, sessionName) => {
412
- attach(sessionName, ws);
412
+ wss.on("connection", (ws, req, sessionName) => {
413
+ const url = new URL(req.url ?? "", "http://localhost");
414
+ const cols = Math.max(1, Number(url.searchParams.get("cols")) || 120);
415
+ const rows = Math.max(1, Number(url.searchParams.get("rows")) || 30);
416
+ attach(sessionName, ws, cols, rows);
413
417
  ws.on("message", (raw, isBinary) => {
414
418
  if (isBinary) {
415
419
  write(sessionName, raw.toString());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unlikeotherai/unloved",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Local multi-device AI coding cockpit",
5
5
  "type": "module",
6
6
  "bin": {