fix: name hermes vterm buffers by session id; drop autoload cookies

This commit is contained in:
2026-08-11 11:03:59 -04:00
parent baa7441f3b
commit 655e9d929f
2 changed files with 20 additions and 24 deletions

View File

@@ -2000,12 +2000,13 @@ already saved to ~.hermes-sessions~ at the project root.
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Org link type: [[hermes:20260718_162500_a1b2c3][Resume — Title]] ;; Org link type: [[hermes:20260718_162500_a1b2c3][Resume — Title]]
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
(org-link-set-parameters "hermes" (after! org
:follow (lambda (id) (org-link-set-parameters "hermes"
(gortium/hermes--open-vterm :follow (lambda (id)
(format "hermes chat --resume %s" id) (gortium/hermes--open-vterm
"*hermes*")) (format "hermes chat --resume %s" id)
:help-echo "Resume this Hermes chat session in vterm") (format "*hermes-%s*" id)))
:help-echo "Resume this Hermes chat session in vterm"))
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Helpers — build commands, detect project ;; Helpers — build commands, detect project
@@ -2105,7 +2106,6 @@ Remote needs ssh -t + docker exec -it (PTY required)."
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Start a new Hermes session (with title prompt) ;; Start a new Hermes session (with title prompt)
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-start (title &optional remote-host) (defun gortium/hermes-start (title &optional remote-host)
"Start a new Hermes session for the current project. "Start a new Hermes session for the current project.
With prefix arg, prompt for remote SSH host (default: lazyworkhorse)." With prefix arg, prompt for remote SSH host (default: lazyworkhorse)."
@@ -2122,12 +2122,11 @@ With prefix arg, prompt for remote SSH host (default: lazyworkhorse)."
(gortium/hermes-append-session sfile id title) (gortium/hermes-append-session sfile id title)
(gortium/hermes--open-vterm (gortium/hermes--open-vterm
(gortium/hermes--launch-cmd id remote-host) (gortium/hermes--launch-cmd id remote-host)
(format "*hermes-%s*" name))))) (format "*hermes-%s*" id)))))
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Browse / resume past sessions (completing-read menu) ;; Browse / resume past sessions (completing-read menu)
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-resume () (defun gortium/hermes-resume ()
"Browse and resume a past Hermes session from the current project." "Browse and resume a past Hermes session from the current project."
(interactive) (interactive)
@@ -2161,12 +2160,12 @@ With prefix arg, prompt for remote SSH host (default: lazyworkhorse)."
(session (nth idx sessions)) (session (nth idx sessions))
(id (plist-get session :id))) (id (plist-get session :id)))
(gortium/hermes--open-vterm (gortium/hermes--open-vterm
(format "hermes chat --resume %s" id)))))))) (format "hermes chat --resume %s" id)
(format "*hermes-%s*" id))))))))
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Link external session to current project ;; Link external session to current project
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-link-session (session-id title) (defun gortium/hermes-link-session (session-id title)
"Link an existing Hermes session to the current project. "Link an existing Hermes session to the current project.
If SESSION-ID is empty, show a menu of recent sessions to browse." If SESSION-ID is empty, show a menu of recent sessions to browse."
@@ -2213,7 +2212,6 @@ If SESSION-ID is empty, show a menu of recent sessions to browse."
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Remove a linked session from project ;; Remove a linked session from project
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-remove-session () (defun gortium/hermes-remove-session ()
"Remove a Hermes session from the current project's .hermes-sessions." "Remove a Hermes session from the current project's .hermes-sessions."
(interactive) (interactive)

View File

@@ -1196,12 +1196,13 @@ DIFF:
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Org link type: [[hermes:20260718_162500_a1b2c3][Resume — Title]] ;; Org link type: [[hermes:20260718_162500_a1b2c3][Resume — Title]]
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
(org-link-set-parameters "hermes" (after! org
:follow (lambda (id) (org-link-set-parameters "hermes"
(gortium/hermes--open-vterm :follow (lambda (id)
(format "hermes chat --resume %s" id) (gortium/hermes--open-vterm
"*hermes*")) (format "hermes chat --resume %s" id)
:help-echo "Resume this Hermes chat session in vterm") (format "*hermes-%s*" id)))
:help-echo "Resume this Hermes chat session in vterm"))
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Helpers — build commands, detect project ;; Helpers — build commands, detect project
@@ -1301,7 +1302,6 @@ Remote needs ssh -t + docker exec -it (PTY required)."
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Start a new Hermes session (with title prompt) ;; Start a new Hermes session (with title prompt)
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-start (title &optional remote-host) (defun gortium/hermes-start (title &optional remote-host)
"Start a new Hermes session for the current project. "Start a new Hermes session for the current project.
With prefix arg, prompt for remote SSH host (default: lazyworkhorse)." With prefix arg, prompt for remote SSH host (default: lazyworkhorse)."
@@ -1318,12 +1318,11 @@ With prefix arg, prompt for remote SSH host (default: lazyworkhorse)."
(gortium/hermes-append-session sfile id title) (gortium/hermes-append-session sfile id title)
(gortium/hermes--open-vterm (gortium/hermes--open-vterm
(gortium/hermes--launch-cmd id remote-host) (gortium/hermes--launch-cmd id remote-host)
(format "*hermes-%s*" name))))) (format "*hermes-%s*" id)))))
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Browse / resume past sessions (completing-read menu) ;; Browse / resume past sessions (completing-read menu)
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-resume () (defun gortium/hermes-resume ()
"Browse and resume a past Hermes session from the current project." "Browse and resume a past Hermes session from the current project."
(interactive) (interactive)
@@ -1357,12 +1356,12 @@ With prefix arg, prompt for remote SSH host (default: lazyworkhorse)."
(session (nth idx sessions)) (session (nth idx sessions))
(id (plist-get session :id))) (id (plist-get session :id)))
(gortium/hermes--open-vterm (gortium/hermes--open-vterm
(format "hermes chat --resume %s" id)))))))) (format "hermes chat --resume %s" id)
(format "*hermes-%s*" id))))))))
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Link external session to current project ;; Link external session to current project
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-link-session (session-id title) (defun gortium/hermes-link-session (session-id title)
"Link an existing Hermes session to the current project. "Link an existing Hermes session to the current project.
If SESSION-ID is empty, show a menu of recent sessions to browse." If SESSION-ID is empty, show a menu of recent sessions to browse."
@@ -1409,7 +1408,6 @@ If SESSION-ID is empty, show a menu of recent sessions to browse."
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;; Remove a linked session from project ;; Remove a linked session from project
;; ------------------------------------------------------------------- ;; -------------------------------------------------------------------
;;;###autoload
(defun gortium/hermes-remove-session () (defun gortium/hermes-remove-session ()
"Remove a Hermes session from the current project's .hermes-sessions." "Remove a Hermes session from the current project's .hermes-sessions."
(interactive) (interactive)