ellie: fix tree data lookup and stream callback warning

This commit is contained in:
Ollie Agent 2026-08-04 20:37:56 +02:00
parent 54bc11ae6d
commit 7888627e90
1 changed files with 8 additions and 6 deletions

View File

@ -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))