@meet-ai/cli 0.0.30 → 0.0.31
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 +36 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15519,10 +15519,11 @@ class TmuxClient {
|
|
|
15519
15519
|
"-t",
|
|
15520
15520
|
target,
|
|
15521
15521
|
"-p",
|
|
15522
|
-
"-e"
|
|
15523
|
-
"-S",
|
|
15524
|
-
`-${lines}`
|
|
15522
|
+
"-e"
|
|
15525
15523
|
];
|
|
15524
|
+
if (lines > 0) {
|
|
15525
|
+
args.push("-S", `-${lines}`);
|
|
15526
|
+
}
|
|
15526
15527
|
return new Promise((resolve2) => {
|
|
15527
15528
|
execFileCb("tmux", args, { encoding: "utf8", timeout: 5000 }, (error48, stdout) => {
|
|
15528
15529
|
if (error48) {
|
|
@@ -15538,6 +15539,15 @@ class TmuxClient {
|
|
|
15538
15539
|
});
|
|
15539
15540
|
});
|
|
15540
15541
|
}
|
|
15542
|
+
resizePane(paneId, cols, rows) {
|
|
15543
|
+
const result = this.exec(["-L", this.server, "resize-pane", "-t", paneId, "-x", String(cols)]);
|
|
15544
|
+
if (!result.ok)
|
|
15545
|
+
return result;
|
|
15546
|
+
if (rows) {
|
|
15547
|
+
return this.exec(["-L", this.server, "resize-pane", "-t", paneId, "-y", String(rows)]);
|
|
15548
|
+
}
|
|
15549
|
+
return result;
|
|
15550
|
+
}
|
|
15541
15551
|
attachSession(name) {
|
|
15542
15552
|
validateSessionName(name);
|
|
15543
15553
|
try {
|
|
@@ -15599,6 +15609,19 @@ function listen(client, input) {
|
|
|
15599
15609
|
const tmuxClient = new TmuxClient({ server: "meet-ai", scrollback: 50000 });
|
|
15600
15610
|
let terminalInterval = null;
|
|
15601
15611
|
const onMessage = (msg) => {
|
|
15612
|
+
if (msg.type === "terminal_resize") {
|
|
15613
|
+
const cols = msg.cols;
|
|
15614
|
+
if (typeof cols === "number" && cols > 0) {
|
|
15615
|
+
tmuxClient.listAllPanes().then((allPanes) => {
|
|
15616
|
+
const roomPrefix = roomId.slice(0, 8);
|
|
15617
|
+
const roomPanes = allPanes.filter((p) => p.sessionName.includes(roomPrefix));
|
|
15618
|
+
for (const p of roomPanes) {
|
|
15619
|
+
tmuxClient.resizePane(p.paneId, cols);
|
|
15620
|
+
}
|
|
15621
|
+
});
|
|
15622
|
+
}
|
|
15623
|
+
return;
|
|
15624
|
+
}
|
|
15602
15625
|
if (msg.type === "terminal_subscribe") {
|
|
15603
15626
|
const roomPrefix = roomId.slice(0, 8);
|
|
15604
15627
|
let membersByPaneId = {};
|
|
@@ -15619,6 +15642,7 @@ function listen(client, input) {
|
|
|
15619
15642
|
clearInterval(terminalInterval);
|
|
15620
15643
|
terminalInterval = null;
|
|
15621
15644
|
}
|
|
15645
|
+
let lastSentPayload = "";
|
|
15622
15646
|
const TERMINAL_POLL_MS = 500;
|
|
15623
15647
|
terminalInterval = setInterval(async () => {
|
|
15624
15648
|
try {
|
|
@@ -15638,11 +15662,15 @@ function listen(client, input) {
|
|
|
15638
15662
|
return a.name.localeCompare(b.name);
|
|
15639
15663
|
});
|
|
15640
15664
|
const results = await Promise.all(panes.map(async (p) => {
|
|
15641
|
-
const lines = await tmuxClient.capturePane(p.paneId,
|
|
15665
|
+
const lines = await tmuxClient.capturePane(p.paneId, 0);
|
|
15642
15666
|
return { name: p.name, paneId: p.paneId, data: lines.join(`\r
|
|
15643
15667
|
`) };
|
|
15644
15668
|
}));
|
|
15645
|
-
|
|
15669
|
+
const payload = JSON.stringify({ panes: results });
|
|
15670
|
+
if (payload === lastSentPayload)
|
|
15671
|
+
return;
|
|
15672
|
+
lastSentPayload = payload;
|
|
15673
|
+
await client.sendTerminalData(roomId, payload);
|
|
15646
15674
|
} catch {}
|
|
15647
15675
|
}, TERMINAL_POLL_MS);
|
|
15648
15676
|
return;
|
|
@@ -15654,6 +15682,9 @@ function listen(client, input) {
|
|
|
15654
15682
|
}
|
|
15655
15683
|
return;
|
|
15656
15684
|
}
|
|
15685
|
+
if (msg.type === "terminal_data") {
|
|
15686
|
+
return;
|
|
15687
|
+
}
|
|
15657
15688
|
if (msg.id && msg.room_id && msg.attachment_count > 0) {
|
|
15658
15689
|
downloadMessageAttachments(client, msg.room_id, msg.id).then((paths) => {
|
|
15659
15690
|
const output = paths.length ? { ...msg, attachments: paths } : msg;
|