diff --git a/contrib/elisp/ellie.el b/contrib/elisp/ellie.el index c30607e..421cbbf 100644 --- a/contrib/elisp/ellie.el +++ b/contrib/elisp/ellie.el @@ -122,7 +122,7 @@ the first agent in the session." ;; Auto-discover first agent (let ((agents (ellie--agents-for s))) (if agents - (let ((aid2 (car (last (car agents))))) ; agent ID is last field + (let ((aid2 (nth 1 (car agents)))) ; agent ID is the second field (when (and (not ellie--agent-id) (string= s ellie--session-id)) (setq ellie--agent-id aid2)) (format "session/%s/agent/%s" s aid2)) @@ -167,13 +167,15 @@ where agents is (name id state ...)." (defun ellie--agents-for (sid) "Return agent list (name id state) for session SID from cache." - (let ((entry (assoc sid ellie--tree-cache - (lambda (a b) (string= (nth 2 a) (or b "")))))) + (let ((entry (seq-find (lambda (entry) + (string= (nth 2 entry) sid)) + ellie--tree-cache))) (if entry (nth 3 entry) ;; Fallback: refresh and try again (ellie--parse-session-idx) - (let ((entry2 (assoc sid ellie--tree-cache - (lambda (a b) (string= (nth 2 a) (or b "")))))) + (let ((entry2 (seq-find (lambda (entry) + (string= (nth 2 entry) sid)) + ellie--tree-cache))) (if entry2 (nth 3 entry2) nil))))) ;;;; ──────────────── Last-session persistence ──────────────── @@ -553,7 +555,7 @@ Prompts for agent profile and other options." (defvar ellie--chat-stream nil "Process object for the chat stream, or nil.") -(defun ellie--chat-filter (proc output) +(defun ellie--chat-filter (_proc output) "Filter function for the chat stream process. Inserts OUTPUT into the chat buffer as it arrives." (when (buffer-live-p (get-buffer ellie--buf))