Per-command dispatch table, hierarchical config menu, fix dialog navigation
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 35s

- Replace 15-clause command-dispatch cond with per-command functions
  + dispatch table; fixes 19 SBCL compiler errors (loop/dotimes
  inside cond)
- Add hierarchical config menu: Config → Providers/Cascade/Network/
  Folders/Identity with breadcrumb dialog titles
- Add /config command for .env file management (provider keys,
  cascade, proxy, timeout, folders)
- Add /identity and /help <topic> commands
- Fix process-key-event dialog Enter handler double-pop that
  made submenus invisible
- Fix command-dispatch-prefix catch-all clause that shadowed
  subsequent prefix handlers
This commit is contained in:
2026-05-20 16:27:59 -04:00
parent a64532bc96
commit 084abc0644
2 changed files with 286 additions and 102 deletions

View File

@@ -264,7 +264,11 @@ Semantic keys (all presets define these):
(setf *state*
(list :running t :mode :chat :connected nil :stream nil
:input-history nil :input-hpos 0
:text-input (cl-tty.input:make-text-input)
:text-input (cl-tty.input:make-text-input
:on-submit #'handle-submit
:on-cancel #'handle-cancel
:on-tab #'handle-tab
:on-history #'handle-history)
:messages (make-array 16 :adjustable t :fill-pointer 0)
:scroll-offset 0 :busy nil
:pending-ctrl-x nil
@@ -305,51 +309,48 @@ Semantic keys (all presets define these):
** Slash Commands
#+BEGIN_SRC lisp :tangle /home/user/.local/share/passepartout/lisp/channel-tui-state.lisp
(defvar *slash-commands*
'((:title "/eval <expr> — Evaluate Lisp" :value "/eval" :category :session)
(:title "/undo — Undo last operation" :value "/undo" :category :session)
(:title "/redo — Redo last operation" :value "/redo" :category :session)
(:title "/reconnect — Re-establish daemon" :value "/reconnect" :category :session)
(:title "/quit — Save history and exit" :value "/quit" :category :session)
(:title "/q — Quick quit" :value "/q" :category :session)
(:title "/why — Show last gate trace" :value "/why" :category :memory)
(:title "/identity — Edit IDENTITY.org" :value "/identity" :category :memory)
(:title "/tags — List tag severities" :value "/tags" :category :memory)
(:title "/audit <id> — Inspect memory" :value "/audit" :category :memory)
(:title "/audit verify — Memory integrity" :value "/audit verify" :category :memory)
(:title "/rewind <n> — Rewind to snapshot" :value "/rewind" :category :memory)
(:title "/sessions — Show memory snapshots" :value "/sessions" :category :memory)
(:title "/resume <n> — Resume from snapshot" :value "/resume" :category :memory)
(:title "/focus <project> — Set context" :value "/focus" :category :system)
(:title "/scope <scope> — Change scope" :value "/scope" :category :system)
(:title "/unfocus — Pop context" :value "/unfocus" :category :system)
(:title "/theme [name] — Show/switch theme" :value "/theme" :category :system)
(:title "/context — Show context summary" :value "/context" :category :system)
(:title "/context why <id> — Debug memory" :value "/context why" :category :system)
(:title "/context dropped — Estimate pruned" :value "/context dropped" :category :system)
(:title "/search <query> — Search messages" :value "/search" :category :navigation)
(:title "/help — Show commands" :value "/help" :category :help)
(:title "/help <topic> — Search manual" :value "/help <topic>" :category :help))
'((:title "/eval <expr> — Evaluate Lisp" :value "/eval")
(:title "/undo — Undo last operation" :value "/undo")
(:title "/redo — Redo last operation" :value "/redo")
(:title "/reconnect — Re-establish daemon" :value "/reconnect")
(:title "/quit — Save history and exit" :value "/quit")
(:title "/q — Quick quit" :value "/q")
(:title "/why — Show last gate trace" :value "/why")
(:title "/tags — List tag severities" :value "/tags")
(:title "/audit <id> — Inspect memory" :value "/audit")
(:title "/audit verify — Memory integrity" :value "/audit verify")
(:title "/rewind <n> — Rewind to snapshot" :value "/rewind")
(:title "/sessions — Show memory snapshots" :value "/sessions")
(:title "/resume <n> — Resume from snapshot" :value "/resume")
(:title "/theme [name] — Show/switch theme" :value "/theme")
(:title "/context — Show context summary" :value "/context")
(:title "/search <query> — Search messages" :value "/search")
(:title "/help — Show commands" :value "/help")
(:title "/help <topic> — Search manual" :value "/help "))
"Slash commands for minibuffer select-dialog.")
#+END_SRC
** Daemon Commands
#+BEGIN_SRC lisp :tangle /home/user/.local/share/passepartout/lisp/channel-tui-state.lisp
(defvar *daemon-commands*
'((:title "Status — Daemon health info" :value (:action :status) :category :session)
(:title "Stats — Daemon statistics" :value (:action :stats) :category :session)
(:title "Ping — Daemon reachability" :value (:action :ping) :category :session)
(:title "Memory Snapshot — Capture state" :value (:action :memory-snapshot) :category :memory)
(:title "Memory Rebuild — Rebuild indices" :value (:action :memory-rebuild) :category :memory)
(:title "Memory Compact — Optimize storage" :value (:action :memory-compact) :category :memory)
(:title "Reload Config — Reload configuration" :value (:action :reload-config) :category :system)
(:title "Reload Identity — Reload identity file" :value (:action :reload-identity) :category :system)
(:title "List Skills — Available skills" :value (:action :list-skills) :category :system)
(:title "Help — Show daemon help" :value (:action :help) :category :help))
'((:title "Status — Daemon health info" :value (:action :status))
(:title "Stats — Daemon statistics" :value (:action :stats))
(:title "Ping — Daemon reachability" :value (:action :ping))
(:title "Memory Snapshot — Capture state" :value (:action :memory-snapshot))
(:title "Memory Rebuild — Rebuild indices" :value (:action :memory-rebuild))
(:title "Memory Compact — Optimize storage" :value (:action :memory-compact))
(:title "Reload Config — Reload configuration" :value (:action :reload-config))
(:title "Reload Identity — Reload identity file" :value (:action :reload-identity))
(:title "List Skills — Available skills" :value (:action :list-skills))
(:title "Help — Show daemon help" :value (:action :help)))
"Daemon commands for the command palette (Ctrl+P).")
(defun all-commands ()
"Merge slash commands and daemon commands into one unified list."
(append *slash-commands* *daemon-commands*))
"Merge slash commands, daemon commands, and menu entries into one unified list."
(append *menu-entries* *slash-commands* *daemon-commands*))
(defvar *menu-entries*
'((:title "/config — LLM providers, cascade, network, folders, identity"
:value :config-menu
:action passepartout.channel-tui::show-config-main-menu))
"Special menu entries with actions (open submenus).")
#+END_SRC
** Event Queue