refactor: moved org-agent to its own repository as a submodule
This commit is contained in:
60
notes/skill-web-interface.org
Normal file
60
notes/skill-web-interface.org
Normal file
@@ -0,0 +1,60 @@
|
||||
#+TITLE - Web Dashboard Skill
|
||||
#+AUTHOR - org-agent
|
||||
#+SKILL_NAME - skill-web-interface
|
||||
|
||||
This skill provides a lightweight web interface for the Neurosymbolic Kernel using the Hunchentoot server.
|
||||
|
||||
* Web Server Implementation
|
||||
#+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)))
|
||||
|
||||
(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))))
|
||||
|
||||
;; 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))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
#+begin_src lisp
|
||||
(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