Architectural Upgrade 2026-03-30: Modular Emacs, org-gtd v4.0, and PSF Phase 1
This commit is contained in:
80
system/skills/org-skill-web-interface.org
Normal file
80
system/skills/org-skill-web-interface.org
Normal file
@@ -0,0 +1,80 @@
|
||||
#+TITLE: SKILL: Web Dashboard Agent (Telemetry Interface)
|
||||
#+ID: skill-web-interface-agent
|
||||
#+STARTUP: content
|
||||
|
||||
* Overview
|
||||
The **Web Dashboard Agent** provides a lightweight, browser-based window into the Neurosymbolic Kernel's internal state. It exposes the active skill graph, execution telemetry, and recent system logs, enabling real-time monitoring and transparency of the agent's cognitive processes.
|
||||
|
||||
* The Interface Mandate
|
||||
1. **Transparency:** Provide a human-readable overview of skill performance (executions, time, failures).
|
||||
2. **Accessibility:** Serve a minimalist HTML dashboard over a configurable local port.
|
||||
3. **Observability:** Expose the tail of the system logs for rapid debugging and "pain" analysis.
|
||||
4. **Low Overhead:** Operate as a background service with minimal impact on the kernel's primary cognitive loop.
|
||||
|
||||
* Symbolic Implementation (The Logic)
|
||||
The implementation leverages the Hunchentoot web server to provide a simple, deterministic telemetry endpoint.
|
||||
|
||||
** Architectural Intent: Server Initialization
|
||||
Bootstraps the web server on a specified port, ensuring the dashboard is live from the moment the skill is loaded.
|
||||
|
||||
#+begin_src lisp
|
||||
(defvar *web-server* nil)
|
||||
|
||||
(defun start-dashboard (&optional (port 8080))
|
||||
"Starts the Hunchentoot dashboard server."
|
||||
(unless *web-server*
|
||||
(setf *web-server* (make-instance 'hunchentoot:easy-acceptor :port port))
|
||||
(hunchentoot:start *web-server*)
|
||||
(kernel-log "WEB - Dashboard live on port ~a" port)))
|
||||
#+end_src
|
||||
|
||||
** Architectural Intent: Telemetry Rendering
|
||||
This handler constructs the dashboard UI. It introspects the skill registry and gathers telemetry for each skill, formatting the results into a clean HTML table alongside the system's recent log history.
|
||||
|
||||
#+begin_src lisp
|
||||
(hunchentoot:define-easy-handler (dashboard-home :uri "/") ()
|
||||
(setf (hunchentoot:content-type*) "text/html")
|
||||
(let* ((skills (org-agent:context-list-all-skills))
|
||||
(telemetry (mapcar (lambda (s)
|
||||
(let ((stats (org-agent:context-get-skill-telemetry (getf s :name))))
|
||||
(format nil "<li><b>~a</b> (P:~a) [Execs: ~a, Time: ~ams, Fails: ~a]</li>"
|
||||
(getf s :name)
|
||||
(getf s :priority)
|
||||
(or (getf stats :executions) 0)
|
||||
(or (getf stats :total-time) 0)
|
||||
(or (getf stats :failures) 0))))
|
||||
skills)))
|
||||
(format nil "
|
||||
<html>
|
||||
<head><title>org-agent Dashboard</title></head>
|
||||
<body style='font-family: monospace; background: #111; color: #eee; padding: 20px;'>
|
||||
<h1>org-agent Neurosymbolic Kernel</h1>
|
||||
<hr>
|
||||
<h2>Active Skill Graph & Telemetry</h2>
|
||||
<ul>
|
||||
~{~a~%~}
|
||||
</ul>
|
||||
<hr>
|
||||
<h2>Recent Logs</h2>
|
||||
<pre>~{~a~%~}</pre>
|
||||
</body>
|
||||
</html>
|
||||
" telemetry (org-agent:context-get-system-logs 20))))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
** Architectural Intent: Background Bootstrap
|
||||
Ensures the server starts automatically using environment-defined ports or sane defaults.
|
||||
|
||||
#+begin_src lisp
|
||||
;; Start the dashboard upon skill load
|
||||
(let* ((env-port (uiop:getenv "ORG_AGENT_WEB_PORT"))
|
||||
(port (if env-port (parse-integer env-port :junk-allowed t) 8080)))
|
||||
(start-dashboard port))
|
||||
|
||||
(defskill :skill-web-interface
|
||||
:priority 10 ; Low priority, background service
|
||||
:trigger (lambda (context) nil)
|
||||
:neuro (lambda (context) nil)
|
||||
:symbolic (lambda (action context) action))
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user