sisyphi 1.0.10 → 1.0.11
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/daemon.js +27 -0
- package/dist/daemon.js.map +1 -1
- package/dist/tui.js +333 -359
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
|
@@ -524,6 +524,25 @@ function killSession(sessionName) {
|
|
|
524
524
|
function setSessionOption(sessionName, option, value) {
|
|
525
525
|
execSafe(`tmux set-option -t "${sessionName}" ${option} ${shellQuote(value)}`);
|
|
526
526
|
}
|
|
527
|
+
function findHomeSession(cwd) {
|
|
528
|
+
const output = execSafe('tmux list-sessions -F "#{session_name}"');
|
|
529
|
+
if (!output) return null;
|
|
530
|
+
const normalizedCwd = cwd.replace(/\/+$/, "");
|
|
531
|
+
for (const name of output.split("\n").filter(Boolean)) {
|
|
532
|
+
if (name.startsWith("sisyphus-")) continue;
|
|
533
|
+
const val = execSafe(`tmux show-options -t "${name}" -v @sisyphus_cwd`);
|
|
534
|
+
if (val?.trim() === normalizedCwd) return name;
|
|
535
|
+
}
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
function switchAttachedClients(sessionName, targetSession) {
|
|
539
|
+
if (!sessionExists(targetSession)) return;
|
|
540
|
+
const output = execSafe(`tmux list-clients -t "${sessionName}" -F "#{client_tty}"`);
|
|
541
|
+
if (!output) return;
|
|
542
|
+
for (const tty of output.split("\n").filter(Boolean)) {
|
|
543
|
+
execSafe(`tmux switch-client -c "${tty}" -t "${targetSession}"`);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
527
546
|
function listPanes(windowTarget) {
|
|
528
547
|
const output = execSafe(`tmux list-panes -t "${windowTarget}" -F "#{pane_id} #{pane_pid}"`);
|
|
529
548
|
if (!output) return [];
|
|
@@ -1470,6 +1489,11 @@ function sendTerminalNotification(title, message) {
|
|
|
1470
1489
|
|
|
1471
1490
|
// src/daemon/session-manager.ts
|
|
1472
1491
|
var NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
1492
|
+
function switchToHomeSession(session) {
|
|
1493
|
+
if (!session.tmuxSessionName) return;
|
|
1494
|
+
const home = findHomeSession(session.cwd);
|
|
1495
|
+
if (home) switchAttachedClients(session.tmuxSessionName, home);
|
|
1496
|
+
}
|
|
1473
1497
|
async function startSession(task, cwd, context, name) {
|
|
1474
1498
|
const sessionId = uuidv4();
|
|
1475
1499
|
if (name && !NAME_PATTERN.test(name)) {
|
|
@@ -1724,7 +1748,9 @@ async function handleYield(sessionId, cwd, nextPrompt, mode) {
|
|
|
1724
1748
|
}
|
|
1725
1749
|
}
|
|
1726
1750
|
async function handleComplete(sessionId, cwd, report) {
|
|
1751
|
+
const session = getSession(cwd, sessionId);
|
|
1727
1752
|
await handleOrchestratorComplete(sessionId, cwd, report);
|
|
1753
|
+
switchToHomeSession(session);
|
|
1728
1754
|
}
|
|
1729
1755
|
async function handleContinue(sessionId, cwd) {
|
|
1730
1756
|
await continueSession(cwd, sessionId);
|
|
@@ -1758,6 +1784,7 @@ async function handleKill(sessionId, cwd) {
|
|
|
1758
1784
|
await updateSessionStatus(cwd, sessionId, "completed");
|
|
1759
1785
|
untrackSession(sessionId);
|
|
1760
1786
|
unregisterSessionPanes(sessionId);
|
|
1787
|
+
switchToHomeSession(session);
|
|
1761
1788
|
if (session.tmuxSessionName) {
|
|
1762
1789
|
killSession(session.tmuxSessionName);
|
|
1763
1790
|
} else if (windowId) {
|