fix(skills): finalize reconstructions for diagnostics and llm-gateway

This commit is contained in:
2026-04-28 19:18:11 -04:00
parent ad891a86e6
commit 8ad7443d3f
2 changed files with 42 additions and 42 deletions

View File

@@ -17,9 +17,9 @@ The *Diagnostics Skill* (Doctor) provides system-wide health checks and dependen
#+begin_src lisp #+begin_src lisp
(defun doctor-check-dependencies () (defun doctor-check-dependencies ()
"Verifies that all required external binaries are available." "Verifies that all required external binaries are available."
(let ((deps '("sbcl" "emacs" "git" "curl" "nc) (let ((deps '("sbcl" "emacs" "git" "curl" "nc"))
(all-ok t)) (all-ok t))
(format t "DOCTOR: Checking System Dependencies...~% (format t "DOCTOR: Checking System Dependencies...~%")
(dolist (dep deps) (dolist (dep deps)
(if (uiop:run-program (list "which" dep) :ignore-error-status t) (if (uiop:run-program (list "which" dep) :ignore-error-status t)
(format t " [OK] Found ~a~%" dep) (format t " [OK] Found ~a~%" dep)
@@ -33,8 +33,8 @@ The *Diagnostics Skill* (Doctor) provides system-wide health checks and dependen
#+begin_src lisp #+begin_src lisp
(defun doctor-check-xdg () (defun doctor-check-xdg ()
"Verifies XDG environment variables and directory structure." "Verifies XDG environment variables and directory structure."
(format t "DOCTOR: Checking XDG environment...~% (format t "DOCTOR: Checking XDG environment...~%")
(let ((vars '("OC_CONFIG_DIR" "OC_DATA_DIR" "OC_STATE_DIR" "MEMEX_DIR)) (let ((vars '("OC_CONFIG_DIR" "OC_DATA_DIR" "OC_STATE_DIR" "MEMEX_DIR")))
(dolist (var vars) (dolist (var vars)
(let ((val (uiop:getenv var))) (let ((val (uiop:getenv var)))
(if val (if val
@@ -47,15 +47,15 @@ The *Diagnostics Skill* (Doctor) provides system-wide health checks and dependen
#+begin_src lisp #+begin_src lisp
(defun doctor-main () (defun doctor-main ()
"Runs all diagnostic checks." "Runs all diagnostic checks."
(format t "==================================================~% (format t "==================================================~%")
(format t " OpenCortex System Diagnostic~% (format t " OpenCortex System Diagnostic~%")
(format t "==================================================~% (format t "==================================================~%")
(let ((d-ok (doctor-check-dependencies)) (let ((d-ok (doctor-check-dependencies))
(x-ok (doctor-check-xdg))) (x-ok (doctor-check-xdg)))
(format t "==================================================~% (format t "==================================================~%")
(if (and d-ok x-ok) (if (and d-ok x-ok)
(format t " ✓ SYSTEM HEALTHY: Ready for ignition.~% (format t " ✓ SYSTEM HEALTHY: Ready for ignition.~%")
(format t " SYSTEM UNHEALTHY: Issues detected.~%))) (format t " ✗ SYSTEM UNHEALTHY: Issues detected.~%"))))
#+end_src #+end_src
** Skill Registration ** Skill Registration

View File

@@ -6,38 +6,6 @@
* Overview * Overview
The *LLM Gateway* skill provides a unified interface for interacting with multiple Large Language Model providers. The *LLM Gateway* skill provides a unified interface for interacting with multiple Large Language Model providers.
* Test Suite
#+begin_src lisp :tangle org-skill-llm-gateway.lisp
(defpackage :opencortex-llm-gateway-tests
(:use :cl :opencortex)
(:export #:llm-gateway-suite))
(in-package :opencortex-llm-gateway-tests)
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam))
(fiveam:def-suite llm-gateway-suite :description "Tests for the LLM Gateway skill
(fiveam:in-suite llm-gateway-suite)
(fiveam:test test-llm-gateway-timeout
"Tier 2 Chaos: Verify that LLM Gateway handles connection failures gracefully."
(let ((old-host (uiop:getenv "OLLAMA_HOST))
(unwind-protect
(progn
(setf (uiop:getenv "OLLAMA_HOST "localhost:1
(let ((fn (or (find-symbol "EXECUTE-LLM-REQUEST" :opencortex.skills.org-skill-llm-gateway)
(find-symbol "EXECUTE-LLM-REQUEST" :opencortex))))
(if fn
(let ((result (funcall fn :prompt "hello" :provider :ollama)))
(fiveam:is (eq (getf result :status) :error))
(fiveam:is (uiop:string-prefix-p "Ollama Failure" (getf result :message))))
(fiveam:fail "Could not find EXECUTE-LLM-REQUEST symbol)))
(if old-host
(setf (uiop:getenv "OLLAMA_HOST old-host)
(sb-posix:unsetenv "OLLAMA_HOST))))
#+end_src
* Implementation * Implementation
** Package Context ** Package Context
@@ -65,3 +33,35 @@ The *LLM Gateway* skill provides a unified interface for interacting with multip
:trigger (lambda (ctx) (getf ctx :user-input)) :trigger (lambda (ctx) (getf ctx :user-input))
:deterministic (lambda (action ctx) (declare (ignore ctx)) action)) :deterministic (lambda (action ctx) (declare (ignore ctx)) action))
#+end_src #+end_src
* Test Suite
#+begin_src lisp :tangle tests/llm-gateway-tests.lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam :silent t))
(defpackage :opencortex-llm-gateway-tests
(:use :cl :opencortex)
(:export #:llm-gateway-suite))
(in-package :opencortex-llm-gateway-tests)
(fiveam:def-suite llm-gateway-suite :description "Tests for the LLM Gateway skill")
(fiveam:in-suite llm-gateway-suite)
(fiveam:test test-llm-gateway-timeout
"Tier 2 Chaos: Verify that LLM Gateway handles connection failures gracefully."
(let ((old-host (uiop:getenv "OLLAMA_HOST")))
(unwind-protect
(progn
(setf (uiop:getenv "OLLAMA_HOST") "localhost:1")
(let ((fn (or (find-symbol "EXECUTE-LLM-REQUEST" :opencortex.skills.org-skill-llm-gateway)
(find-symbol "EXECUTE-LLM-REQUEST" :opencortex))))
(if fn
(let ((result (funcall fn :prompt "hello" :provider :ollama)))
(fiveam:is (eq (getf result :status) :error))
(fiveam:is (uiop:string-prefix-p "Ollama Failure" (getf result :message))))
(fiveam:fail "Could not find EXECUTE-LLM-REQUEST symbol"))))
(if old-host
(setf (uiop:getenv "OLLAMA_HOST") old-host)
(uiop:run-program (list "unset" "OLLAMA_HOST") :ignore-error-status t)))))
#+end_src