@paradow/ledge 0.5.4 → 0.7.0

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.
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  attachEnv
3
- } from "./chunk-ISPFJBJM.js";
4
- import "./chunk-U4RU6V35.js";
3
+ } from "./chunk-HR6VWBLT.js";
4
+ import "./chunk-3TXM4DM7.js";
5
5
  import {
6
6
  realTmux
7
- } from "./chunk-XZMLFV6H.js";
8
- import "./chunk-P2SHPHAN.js";
7
+ } from "./chunk-3TNPEAMR.js";
8
+ import "./chunk-L6IGH4LF.js";
9
9
  import {
10
10
  connect
11
- } from "./chunk-IDGN7JGC.js";
11
+ } from "./chunk-MK7NEXY7.js";
12
12
  import {
13
13
  PROTOCOL_PORT
14
- } from "./chunk-E6ZQOGY4.js";
14
+ } from "./chunk-4BBKLTDB.js";
15
15
 
16
16
  // src/cli/attach.ts
17
17
  import { spawn } from "child_process";
@@ -6,7 +6,7 @@ import {
6
6
  PROTOCOL_PORT,
7
7
  parseClientMessage,
8
8
  parseServerMessage
9
- } from "./chunk-E6ZQOGY4.js";
9
+ } from "./chunk-4BBKLTDB.js";
10
10
 
11
11
  // src/cli/bridge.ts
12
12
  import WebSocket from "ws";
@@ -37,6 +37,7 @@ function bridge(opts = {}) {
37
37
  ws.on("open", () => {
38
38
  off = readFrames(input, (raw) => {
39
39
  const msg = parseClientMessage(raw);
40
+ if (msg.type === "machines.set" || msg.type === "projects.set" || msg.type === "island.set") return;
40
41
  if (ws.bufferedAmount > MAX_FRAME) throw new Error("Ledge bridge is overloaded");
41
42
  ws.send(JSON.stringify(msg));
42
43
  }, fail);
@@ -45,7 +46,9 @@ function bridge(opts = {}) {
45
46
  });
46
47
  ws.on("message", (data) => {
47
48
  try {
48
- if (!output.write(`${JSON.stringify(parseServerMessage(JSON.parse(String(data))))}
49
+ const msg = parseServerMessage(JSON.parse(String(data)));
50
+ if (msg.type === "machines" || msg.type === "projects" || msg.type === "island") return;
51
+ if (!output.write(`${JSON.stringify(msg)}
49
52
  `)) ws.pause();
50
53
  } catch (e) {
51
54
  fail(e);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  log,
3
3
  paths
4
- } from "./chunk-P2SHPHAN.js";
4
+ } from "./chunk-L6IGH4LF.js";
5
5
 
6
6
  // src/tmux.ts
7
7
  import { execFile } from "child_process";
@@ -57,6 +57,11 @@ function realTmux(socket = "ledge", opts = {}) {
57
57
  if (r.code !== 0) return null;
58
58
  return r.stdout.replace(/\s+$/g, "").split("\n").slice(-lines).join("\n");
59
59
  },
60
+ async width(name) {
61
+ const r = await t(["display-message", "-p", "-t", `=${name}:`, "#{pane_width}"]);
62
+ const n = Number(r.stdout.trim());
63
+ return r.code === 0 && Number.isInteger(n) && n > 0 ? n : null;
64
+ },
60
65
  async hasSession(name) {
61
66
  return (await t(["has-session", "-t", `=${name}`])).code === 0;
62
67
  },
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  paths
3
- } from "./chunk-P2SHPHAN.js";
3
+ } from "./chunk-L6IGH4LF.js";
4
4
  import {
5
5
  pickName
6
- } from "./chunk-E6ZQOGY4.js";
6
+ } from "./chunk-4BBKLTDB.js";
7
7
 
8
8
  // src/daemon/transcript.ts
9
9
  import { closeSync, fstatSync, openSync, readSync } from "fs";
@@ -120,8 +120,8 @@ function agentEnv(base, extra) {
120
120
  async function spawnSession(opts) {
121
121
  const now = opts.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
122
122
  const takenIds = new Set(opts.taken.ids);
123
- let id;
124
- do
123
+ let id = opts.id;
124
+ if (id === void 0) do
125
125
  id = randomBytes(2).toString("hex");
126
126
  while (takenIds.has(id));
127
127
  const name = pickName(opts.taken.names, opts.name);