fix: listSessions filters to @pi-remote-managed sessions only — excludes pi-sidecar and other unrelated tmux sessions
This commit is contained in:
parent
4b428df0a4
commit
2e44a7f286
|
|
@ -82,6 +82,17 @@ export async function spawnSession(opts: {
|
|||
if (command) args.push(command);
|
||||
|
||||
await execFileAsync("tmux", args);
|
||||
|
||||
// Mark as sidecar-managed so listSessions() can filter out unrelated
|
||||
// tmux sessions (e.g. the pi-sidecar launcher session itself).
|
||||
await execFileAsync("tmux", [
|
||||
"set-option",
|
||||
"-t",
|
||||
name,
|
||||
"@pi-remote-managed",
|
||||
"1",
|
||||
]).catch(() => {});
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
@ -144,6 +155,20 @@ export async function listSessions(): Promise<TmuxSession[]> {
|
|||
if (!line) continue;
|
||||
const [id, createdAt, lastActivityAt, w, h] = line.split(SEP);
|
||||
|
||||
// Only include sessions created by the sidecar.
|
||||
try {
|
||||
const r = await execFileAsync("tmux", [
|
||||
"show-options",
|
||||
"-t",
|
||||
id,
|
||||
"-qv",
|
||||
"@pi-remote-managed",
|
||||
]);
|
||||
if (!r.stdout.trim()) continue; // unmanaged session — skip
|
||||
} catch {
|
||||
continue; // can't read options → skip
|
||||
}
|
||||
|
||||
// Fetch @description option separately (may not be set)
|
||||
let description: string | undefined;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue