From 79cbccb59da539d6cce0f7f67b8efe1844ae4cbd Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 25 Jun 2026 08:51:56 -0400 Subject: feat(ai-term): step into detached sessions too, attaching them The next-agent step (C-; a n / M-SPC) cycled only live agent buffers, so a detached session (alive in tmux, no Emacs buffer) was reachable only through the picker. Now the queue is every active agent, live buffer or live session, keyed on the project dir and ordered by buffer name. Stepping onto a detached one attaches it: show-or-create recreates the terminal, which reattaches the tmux session. The live-buffer swap path is unchanged. I replaced the buffer-rotation helper with a dir-based one and added an active-agent enumerator, with 10 tests. --- tests/test-ai-term--next-no-agents.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/test-ai-term--next-no-agents.el') diff --git a/tests/test-ai-term--next-no-agents.el b/tests/test-ai-term--next-no-agents.el index ef87d71ee..59132df8e 100644 --- a/tests/test-ai-term--next-no-agents.el +++ b/tests/test-ai-term--next-no-agents.el @@ -17,7 +17,7 @@ (ert-deftest test-ai-term-next-no-agents-launches-picker () "Error: no agents open -> launches the picker instead of erroring." (let ((picked 0)) - (cl-letf (((symbol-function 'cj/--ai-term-agent-buffers) (lambda (&rest _) nil)) + (cl-letf (((symbol-function 'cj/--ai-term-active-agent-dirs) (lambda (&rest _) nil)) ((symbol-function 'cj/--ai-term-displayed-agent-window) (lambda (&rest _) nil)) ((symbol-function 'cj/ai-term-pick-project) (lambda (&rest _) (setq picked (1+ picked))))) (cj/ai-term-next) @@ -25,7 +25,7 @@ (ert-deftest test-ai-term-next-no-agents-does-not-signal () "Error: no agents open -> returns normally, no user-error raised." - (cl-letf (((symbol-function 'cj/--ai-term-agent-buffers) (lambda (&rest _) nil)) + (cl-letf (((symbol-function 'cj/--ai-term-active-agent-dirs) (lambda (&rest _) nil)) ((symbol-function 'cj/--ai-term-displayed-agent-window) (lambda (&rest _) nil)) ((symbol-function 'cj/ai-term-pick-project) (lambda (&rest _) nil))) (should (progn (cj/ai-term-next) t)))) -- cgit v1.2.3