@paradow/ledge 0.34.0 → 0.36.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.
- package/dist/cli/index.js +40782 -39
- package/dist/cli/reduceWorker.js +2216 -0
- package/package.json +4 -1
- package/dist/cli/action-K42H5BDA.js +0 -27
- package/dist/cli/attach-KEE4A5YP.js +0 -87
- package/dist/cli/bridge-X327AZY4.js +0 -70
- package/dist/cli/chunk-25RVT5MR.js +0 -623
- package/dist/cli/chunk-3OJCWJAA.js +0 -144
- package/dist/cli/chunk-4OYVM4MT.js +0 -49
- package/dist/cli/chunk-4TCSADFR.js +0 -252
- package/dist/cli/chunk-53ISXX2R.js +0 -39
- package/dist/cli/chunk-54KF5RBY.js +0 -17
- package/dist/cli/chunk-7NHQGP6J.js +0 -95
- package/dist/cli/chunk-G7XPEVCG.js +0 -118
- package/dist/cli/chunk-IWY7DSSO.js +0 -2476
- package/dist/cli/chunk-KPDTYX7F.js +0 -60
- package/dist/cli/chunk-OLLQBK6N.js +0 -41
- package/dist/cli/chunk-RPH773TY.js +0 -6
- package/dist/cli/chunk-RX5CJ7YH.js +0 -43
- package/dist/cli/chunk-T547FLQN.js +0 -128
- package/dist/cli/chunk-U67V476Y.js +0 -35
- package/dist/cli/chunk-UJ2WBGLW.js +0 -305
- package/dist/cli/chunk-ULOMKEB6.js +0 -85
- package/dist/cli/chunk-V4XKKL6K.js +0 -205
- package/dist/cli/daemon-RO43S3S5.js +0 -11449
- package/dist/cli/decide-KZFYL3HY.js +0 -59
- package/dist/cli/handover-BWNMI2RA.js +0 -17
- package/dist/cli/hook-ZLWXI5EQ.js +0 -473
- package/dist/cli/launch-GCX7TXOH.js +0 -28
- package/dist/cli/send-SXZAPVRH.js +0 -19
- package/dist/cli/setup-TJ32FMVJ.js +0 -38
- package/dist/cli/status-YDVRES4E.js +0 -28
- package/dist/cli/task-TUSOVJK7.js +0 -19
- package/dist/cli/tui-TCVIRZCQ.js +0 -19348
- package/dist/cli/uninstall-QO7YMSLA.js +0 -162
- package/dist/cli/version-BAYSYWFP.js +0 -7
- package/dist/cli/who-6AZYSP7T.js +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paradow/ledge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Follow and answer your WSL agent sessions (Claude Code, Codex, Cursor Agent) from the Ledge island on Windows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": { "ledge": "dist/cli/index.js" },
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"ink": "7.1.1",
|
|
22
|
+
"jpeg-js": "^0.4.4",
|
|
23
|
+
"pngjs": "^7.0.0",
|
|
22
24
|
"react": "^19.3.0",
|
|
23
25
|
"string-width": "^8.3.0",
|
|
24
26
|
"ws": "^8.18.0",
|
|
@@ -31,6 +33,7 @@
|
|
|
31
33
|
"@ledge/seal": "workspace:*",
|
|
32
34
|
"@ledge/ui": "workspace:*",
|
|
33
35
|
"@types/node": "^22.7.0",
|
|
36
|
+
"@types/pngjs": "^6.0.5",
|
|
34
37
|
"@types/react": "^19.3.0",
|
|
35
38
|
"@types/ws": "^8.5.12",
|
|
36
39
|
"ink-testing-library": "4.0.0",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CLOSE_USAGE,
|
|
3
|
-
DAEMON_DOWN,
|
|
4
|
-
RUN_MS,
|
|
5
|
-
actionArgs,
|
|
6
|
-
callerOf,
|
|
7
|
-
closeArgs,
|
|
8
|
-
resultLine,
|
|
9
|
-
runClose,
|
|
10
|
-
runOnClient
|
|
11
|
-
} from "./chunk-ULOMKEB6.js";
|
|
12
|
-
import "./chunk-4TCSADFR.js";
|
|
13
|
-
import "./chunk-7NHQGP6J.js";
|
|
14
|
-
import "./chunk-IWY7DSSO.js";
|
|
15
|
-
import "./chunk-53ISXX2R.js";
|
|
16
|
-
import "./chunk-U67V476Y.js";
|
|
17
|
-
export {
|
|
18
|
-
CLOSE_USAGE,
|
|
19
|
-
DAEMON_DOWN,
|
|
20
|
-
RUN_MS,
|
|
21
|
-
actionArgs,
|
|
22
|
-
callerOf,
|
|
23
|
-
closeArgs,
|
|
24
|
-
resultLine,
|
|
25
|
-
runClose,
|
|
26
|
-
runOnClient
|
|
27
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
attachEnv
|
|
3
|
-
} from "./chunk-V4XKKL6K.js";
|
|
4
|
-
import "./chunk-4TCSADFR.js";
|
|
5
|
-
import {
|
|
6
|
-
connect
|
|
7
|
-
} from "./chunk-7NHQGP6J.js";
|
|
8
|
-
import {
|
|
9
|
-
PROTOCOL_PORT,
|
|
10
|
-
backendOf
|
|
11
|
-
} from "./chunk-IWY7DSSO.js";
|
|
12
|
-
import {
|
|
13
|
-
isSeatSession,
|
|
14
|
-
realTmux
|
|
15
|
-
} from "./chunk-T547FLQN.js";
|
|
16
|
-
import "./chunk-54KF5RBY.js";
|
|
17
|
-
import "./chunk-53ISXX2R.js";
|
|
18
|
-
import "./chunk-U67V476Y.js";
|
|
19
|
-
|
|
20
|
-
// src/cli/attach.ts
|
|
21
|
-
import { spawn } from "child_process";
|
|
22
|
-
var TMUX_SOCKET = "ledge";
|
|
23
|
-
function attachInherit(args, env) {
|
|
24
|
-
return new Promise((resolve) => {
|
|
25
|
-
const child = spawn("tmux", args, { stdio: "inherit", env });
|
|
26
|
-
child.on("error", () => resolve(1));
|
|
27
|
-
child.on("exit", (c) => resolve(c ?? 1));
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
async function seatSession(id, port) {
|
|
31
|
-
try {
|
|
32
|
-
const c = await connect({ port, timeoutMs: 800 });
|
|
33
|
-
const snap = await c.next("snapshot");
|
|
34
|
-
await Promise.race([c.close(), new Promise((r) => setTimeout(r, 500))]);
|
|
35
|
-
const s = snap.sessions.find((x) => x.id === id);
|
|
36
|
-
return s?.source === "rig" && s.tmuxSession && isSeatSession(s.tmuxSession) ? s.tmuxSession : null;
|
|
37
|
-
} catch {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async function nativeSession(id, port) {
|
|
42
|
-
try {
|
|
43
|
-
const c = await connect({ port, timeoutMs: 800 });
|
|
44
|
-
const snap = await c.next("snapshot");
|
|
45
|
-
await Promise.race([c.close(), new Promise((r) => setTimeout(r, 500))]);
|
|
46
|
-
const s = snap.sessions.find((x) => x.id === id);
|
|
47
|
-
return s && backendOf(s) === "omp-rpc" ? s.name : null;
|
|
48
|
-
} catch {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function attach(id, opts = {}) {
|
|
53
|
-
if (!id) {
|
|
54
|
-
console.error("ledge attach: missing session id");
|
|
55
|
-
return 2;
|
|
56
|
-
}
|
|
57
|
-
let tmux = realTmux(opts.tmuxSocket ?? TMUX_SOCKET);
|
|
58
|
-
let tmuxName = `ledge-${id}`;
|
|
59
|
-
if (!await tmux.hasSession(tmuxName)) {
|
|
60
|
-
const seat = await seatSession(id, opts.port ?? PROTOCOL_PORT);
|
|
61
|
-
if (seat) {
|
|
62
|
-
tmux = realTmux(opts.seatSocket === void 0 ? null : opts.seatSocket);
|
|
63
|
-
tmuxName = seat;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (!await tmux.hasSession(tmuxName)) {
|
|
67
|
-
const native = await nativeSession(id, opts.port ?? PROTOCOL_PORT);
|
|
68
|
-
console.error(native ? `ledge attach: ${native} is driven by Ledge over OMP's own protocol: there is no terminal to attach to (open a shell from the app)` : `ledge attach: no session ${id}`);
|
|
69
|
-
return 1;
|
|
70
|
-
}
|
|
71
|
-
let title = tmuxName;
|
|
72
|
-
try {
|
|
73
|
-
const c = await connect({ port: opts.port ?? PROTOCOL_PORT, timeoutMs: 800 });
|
|
74
|
-
const snap = await c.next("snapshot");
|
|
75
|
-
title = snap.sessions.find((s) => s.id === id)?.title ?? title;
|
|
76
|
-
await Promise.race([c.close(), new Promise((r) => setTimeout(r, 500))]);
|
|
77
|
-
} catch {
|
|
78
|
-
}
|
|
79
|
-
const write = opts.write ?? ((s) => {
|
|
80
|
-
if (process.stdout.isTTY) process.stdout.write(s);
|
|
81
|
-
});
|
|
82
|
-
write(`\x1B]0;${title}\x07`);
|
|
83
|
-
return (opts.attach ?? attachInherit)(tmux.attachArgs(tmuxName, { readOnly: opts.readOnly }), attachEnv(process.env));
|
|
84
|
-
}
|
|
85
|
-
export {
|
|
86
|
-
attach
|
|
87
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MAX_FRAME,
|
|
3
|
-
readFrames
|
|
4
|
-
} from "./chunk-OLLQBK6N.js";
|
|
5
|
-
import {
|
|
6
|
-
PROTOCOL_PORT,
|
|
7
|
-
parseClientMessage,
|
|
8
|
-
parseServerMessage,
|
|
9
|
-
readDaemonToken
|
|
10
|
-
} from "./chunk-IWY7DSSO.js";
|
|
11
|
-
import "./chunk-53ISXX2R.js";
|
|
12
|
-
import "./chunk-U67V476Y.js";
|
|
13
|
-
|
|
14
|
-
// src/cli/bridge.ts
|
|
15
|
-
import WebSocket from "ws";
|
|
16
|
-
function bearerHeaders() {
|
|
17
|
-
const token = readDaemonToken();
|
|
18
|
-
return token ? { authorization: `Bearer ${token}` } : {};
|
|
19
|
-
}
|
|
20
|
-
function bridge(opts = {}) {
|
|
21
|
-
const input = opts.input ?? process.stdin, output = opts.output ?? process.stdout;
|
|
22
|
-
const ws = new WebSocket(`ws://127.0.0.1:${opts.port ?? PROTOCOL_PORT}`, { maxPayload: MAX_FRAME, handshakeTimeout: 1e4, headers: bearerHeaders() });
|
|
23
|
-
return new Promise((resolve, reject) => {
|
|
24
|
-
let settled = false, off = () => {
|
|
25
|
-
};
|
|
26
|
-
const finish = (error) => {
|
|
27
|
-
if (settled) return;
|
|
28
|
-
settled = true;
|
|
29
|
-
off();
|
|
30
|
-
input.pause();
|
|
31
|
-
input.off("end", end);
|
|
32
|
-
input.off("error", fail);
|
|
33
|
-
output.off("error", fail);
|
|
34
|
-
output.off("drain", drain);
|
|
35
|
-
ws.terminate();
|
|
36
|
-
error ? reject(error) : resolve();
|
|
37
|
-
};
|
|
38
|
-
const fail = (e) => finish(e);
|
|
39
|
-
const end = () => ws.close();
|
|
40
|
-
const drain = () => ws.resume();
|
|
41
|
-
input.on("error", fail);
|
|
42
|
-
output.on("error", fail);
|
|
43
|
-
output.on("drain", drain);
|
|
44
|
-
ws.on("open", () => {
|
|
45
|
-
off = readFrames(input, (raw) => {
|
|
46
|
-
const msg = parseClientMessage(raw);
|
|
47
|
-
if (msg.type === "machines.set" || msg.type === "projects.set" || msg.type === "island.set") return;
|
|
48
|
-
if (ws.bufferedAmount > MAX_FRAME) throw new Error("Ledge bridge is overloaded");
|
|
49
|
-
ws.send(JSON.stringify(msg));
|
|
50
|
-
}, fail);
|
|
51
|
-
input.on("end", end);
|
|
52
|
-
if (input.readableEnded) end();
|
|
53
|
-
});
|
|
54
|
-
ws.on("message", (data) => {
|
|
55
|
-
try {
|
|
56
|
-
const msg = parseServerMessage(JSON.parse(String(data)));
|
|
57
|
-
if (msg.type === "machines" || msg.type === "projects" || msg.type === "island") return;
|
|
58
|
-
if (!output.write(`${JSON.stringify(msg)}
|
|
59
|
-
`)) ws.pause();
|
|
60
|
-
} catch (e) {
|
|
61
|
-
fail(e);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
ws.on("error", fail);
|
|
65
|
-
ws.on("close", (code) => finish(code === 1e3 || code === 1005 ? void 0 : new Error(`Ledge daemon disconnected (${code})`)));
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
export {
|
|
69
|
-
bridge
|
|
70
|
-
};
|