@meet-ai/cli 0.0.28 → 0.0.30
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 +76 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14634,6 +14634,12 @@ function createClient(baseUrl, apiKey) {
|
|
|
14634
14634
|
const data = JSON.parse(text);
|
|
14635
14635
|
if (data.type === "pong")
|
|
14636
14636
|
return;
|
|
14637
|
+
if (data.type === "terminal_subscribe" || data.type === "terminal_unsubscribe") {
|
|
14638
|
+
options?.onMessage?.(data);
|
|
14639
|
+
return;
|
|
14640
|
+
}
|
|
14641
|
+
if (data.type === "terminal_data")
|
|
14642
|
+
return;
|
|
14637
14643
|
deliver(data);
|
|
14638
14644
|
};
|
|
14639
14645
|
ws.onclose = (event) => {
|
|
@@ -15450,6 +15456,29 @@ class TmuxClient {
|
|
|
15450
15456
|
};
|
|
15451
15457
|
});
|
|
15452
15458
|
}
|
|
15459
|
+
listAllPanes() {
|
|
15460
|
+
const args = [
|
|
15461
|
+
"-L",
|
|
15462
|
+
this.server,
|
|
15463
|
+
"list-panes",
|
|
15464
|
+
"-a",
|
|
15465
|
+
"-F",
|
|
15466
|
+
"#{pane_id}\t#{session_name}\t#{pane_title}\t#{pane_current_command}"
|
|
15467
|
+
];
|
|
15468
|
+
return new Promise((resolve2) => {
|
|
15469
|
+
execFileCb("tmux", args, { encoding: "utf8", timeout: 5000 }, (error48, stdout) => {
|
|
15470
|
+
if (error48) {
|
|
15471
|
+
resolve2([]);
|
|
15472
|
+
return;
|
|
15473
|
+
}
|
|
15474
|
+
resolve2(stdout.trim().split(`
|
|
15475
|
+
`).filter((line) => line.trim()).map((line) => {
|
|
15476
|
+
const [paneId, sessionName, title, command] = line.split("\t");
|
|
15477
|
+
return { paneId: paneId ?? "", sessionName: sessionName ?? "", title: title ?? "", command: command ?? "" };
|
|
15478
|
+
}));
|
|
15479
|
+
});
|
|
15480
|
+
});
|
|
15481
|
+
}
|
|
15453
15482
|
listPanes(sessionName) {
|
|
15454
15483
|
validateSessionName(sessionName);
|
|
15455
15484
|
const result = this.exec([
|
|
@@ -15474,12 +15503,14 @@ class TmuxClient {
|
|
|
15474
15503
|
});
|
|
15475
15504
|
}
|
|
15476
15505
|
capturePane(target, lines) {
|
|
15477
|
-
|
|
15478
|
-
|
|
15479
|
-
|
|
15480
|
-
|
|
15481
|
-
|
|
15482
|
-
|
|
15506
|
+
if (/^%\d+$/.test(target)) {} else {
|
|
15507
|
+
const dotIdx = target.indexOf(".");
|
|
15508
|
+
const sessionPart = dotIdx === -1 ? target : target.slice(0, dotIdx);
|
|
15509
|
+
const panePart = dotIdx === -1 ? null : target.slice(dotIdx + 1);
|
|
15510
|
+
validateSessionName(sessionPart);
|
|
15511
|
+
if (panePart !== null && !/^\d+$/.test(panePart)) {
|
|
15512
|
+
throw new Error(`Invalid pane index: ${panePart}`);
|
|
15513
|
+
}
|
|
15483
15514
|
}
|
|
15484
15515
|
const args = [
|
|
15485
15516
|
"-L",
|
|
@@ -15569,20 +15600,51 @@ function listen(client, input) {
|
|
|
15569
15600
|
let terminalInterval = null;
|
|
15570
15601
|
const onMessage = (msg) => {
|
|
15571
15602
|
if (msg.type === "terminal_subscribe") {
|
|
15572
|
-
const
|
|
15573
|
-
|
|
15574
|
-
|
|
15603
|
+
const roomPrefix = roomId.slice(0, 8);
|
|
15604
|
+
let membersByPaneId = {};
|
|
15605
|
+
if (teamDir) {
|
|
15606
|
+
try {
|
|
15607
|
+
const configPath = `${teamDir}/config.json`;
|
|
15608
|
+
const fs = __require("node:fs");
|
|
15609
|
+
const config2 = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
15610
|
+
const members = config2.members || [];
|
|
15611
|
+
for (const m of members) {
|
|
15612
|
+
if (m.tmuxPaneId) {
|
|
15613
|
+
membersByPaneId[m.tmuxPaneId] = m.name;
|
|
15614
|
+
}
|
|
15615
|
+
}
|
|
15616
|
+
} catch {}
|
|
15617
|
+
}
|
|
15575
15618
|
if (terminalInterval) {
|
|
15576
15619
|
clearInterval(terminalInterval);
|
|
15577
15620
|
terminalInterval = null;
|
|
15578
15621
|
}
|
|
15622
|
+
const TERMINAL_POLL_MS = 500;
|
|
15579
15623
|
terminalInterval = setInterval(async () => {
|
|
15580
15624
|
try {
|
|
15581
|
-
const
|
|
15582
|
-
|
|
15583
|
-
|
|
15625
|
+
const allTmuxPanes = await tmuxClient.listAllPanes();
|
|
15626
|
+
const roomPanes = allTmuxPanes.filter((p) => p.sessionName.includes(roomPrefix));
|
|
15627
|
+
if (roomPanes.length === 0)
|
|
15628
|
+
return;
|
|
15629
|
+
const panes = roomPanes.map((tp) => ({
|
|
15630
|
+
name: membersByPaneId[tp.paneId] || tp.title || tp.paneId,
|
|
15631
|
+
paneId: tp.paneId
|
|
15632
|
+
}));
|
|
15633
|
+
panes.sort((a, b) => {
|
|
15634
|
+
if (a.name === "team-lead")
|
|
15635
|
+
return -1;
|
|
15636
|
+
if (b.name === "team-lead")
|
|
15637
|
+
return 1;
|
|
15638
|
+
return a.name.localeCompare(b.name);
|
|
15639
|
+
});
|
|
15640
|
+
const results = await Promise.all(panes.map(async (p) => {
|
|
15641
|
+
const lines = await tmuxClient.capturePane(p.paneId, 500);
|
|
15642
|
+
return { name: p.name, paneId: p.paneId, data: lines.join(`\r
|
|
15643
|
+
`) };
|
|
15644
|
+
}));
|
|
15645
|
+
await client.sendTerminalData(roomId, JSON.stringify({ panes: results }));
|
|
15584
15646
|
} catch {}
|
|
15585
|
-
},
|
|
15647
|
+
}, TERMINAL_POLL_MS);
|
|
15586
15648
|
return;
|
|
15587
15649
|
}
|
|
15588
15650
|
if (msg.type === "terminal_unsubscribe") {
|
|
@@ -56355,7 +56417,7 @@ init_output();
|
|
|
56355
56417
|
var main = defineCommand({
|
|
56356
56418
|
meta: {
|
|
56357
56419
|
name: "meet-ai",
|
|
56358
|
-
version: "0.0.
|
|
56420
|
+
version: "0.0.30",
|
|
56359
56421
|
description: "CLI for meet-ai chat rooms — create rooms, send messages, and stream via WebSocket"
|
|
56360
56422
|
},
|
|
56361
56423
|
args: {
|