update paths for new agent tree architecture

- sessions-dir: s/ → session/
- Add ellie--agent-dir to discover active agent ID
- ellie--session-file routes agent files (chat, prompt, cfg, ctl, etc.)
  through session/{sid}/agent/{aid}/, session-level files (plan, env)
  stay at session/{sid}/.
This commit is contained in:
Levi Neely 2026-07-30 00:33:18 +02:00
parent 4f7a22c29a
commit 519aca5a2c
1 changed files with 25 additions and 4 deletions

View File

@ -90,18 +90,39 @@ An alist of (KEY . VALUE) string pairs; valid keys are
;;;; ──────────────── Paths ──────────────── ;;;; ──────────────── Paths ────────────────
(defun ellie--sessions-dir () (defun ellie--sessions-dir ()
(expand-file-name "s" ellie-mount-directory)) (expand-file-name "session" ellie-mount-directory))
(defun ellie--sessions-new-path () (defun ellie--sessions-new-path ()
(expand-file-name "new" (ellie--sessions-dir))) (expand-file-name "new" (ellie--sessions-dir)))
(defun ellie--agent-dir ()
"Return the path to the active agent directory for the current session.
Discovers the agent ID by reading the agent/ subdirectory."
(unless ellie--session-id
(user-error "No active ollie session"))
(let* ((agent-parent (expand-file-name
"agent"
(expand-file-name ellie--session-id (ellie--sessions-dir))))
(entries (and (file-directory-p agent-parent)
(directory-files agent-parent nil "\\`[^.]"))))
(expand-file-name
(or (seq-find (lambda (e)
(file-directory-p (expand-file-name e agent-parent)))
entries)
"0")
agent-parent)))
(defun ellie--session-file (name) (defun ellie--session-file (name)
"Return the full path to file NAME inside the current session directory. "Return the full path to file NAME for the current session.
Agent files (chat, prompt, cfg, ctl, etc.) resolve under the agent directory.
Session-level files (plan, env) resolve under the session directory.
Signals `user-error' if no session is active." Signals `user-error' if no session is active."
(unless ellie--session-id (unless ellie--session-id
(user-error "No active ollie session")) (user-error "No active ollie session"))
(expand-file-name name (if (member name '("plan" "env"))
(expand-file-name ellie--session-id (ellie--sessions-dir)))) (expand-file-name name
(expand-file-name ellie--session-id (ellie--sessions-dir)))
(expand-file-name name (ellie--agent-dir))))
(defun ellie--last-session-path () (defun ellie--last-session-path ()
(expand-file-name "~/.config/ollie/last-session")) (expand-file-name "~/.config/ollie/last-session"))