fix(skills): finalize reconstructions for diagnostics and llm-gateway
This commit is contained in:
@@ -17,9 +17,9 @@ The *Diagnostics Skill* (Doctor) provides system-wide health checks and dependen
|
||||
#+begin_src lisp
|
||||
(defun doctor-check-dependencies ()
|
||||
"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))
|
||||
(format t "DOCTOR: Checking System Dependencies...~%
|
||||
(format t "DOCTOR: Checking System Dependencies...~%")
|
||||
(dolist (dep deps)
|
||||
(if (uiop:run-program (list "which" dep) :ignore-error-status t)
|
||||
(format t " [OK] Found ~a~%" dep)
|
||||
@@ -33,8 +33,8 @@ The *Diagnostics Skill* (Doctor) provides system-wide health checks and dependen
|
||||
#+begin_src lisp
|
||||
(defun doctor-check-xdg ()
|
||||
"Verifies XDG environment variables and directory structure."
|
||||
(format t "DOCTOR: Checking XDG environment...~%
|
||||
(let ((vars '("OC_CONFIG_DIR" "OC_DATA_DIR" "OC_STATE_DIR" "MEMEX_DIR))
|
||||
(format t "DOCTOR: Checking XDG environment...~%")
|
||||
(let ((vars '("OC_CONFIG_DIR" "OC_DATA_DIR" "OC_STATE_DIR" "MEMEX_DIR")))
|
||||
(dolist (var vars)
|
||||
(let ((val (uiop:getenv var)))
|
||||
(if val
|
||||
@@ -47,15 +47,15 @@ The *Diagnostics Skill* (Doctor) provides system-wide health checks and dependen
|
||||
#+begin_src lisp
|
||||
(defun doctor-main ()
|
||||
"Runs all diagnostic checks."
|
||||
(format t "==================================================~%
|
||||
(format t " OpenCortex System Diagnostic~%
|
||||
(format t "==================================================~%
|
||||
(format t "==================================================~%")
|
||||
(format t " OpenCortex System Diagnostic~%")
|
||||
(format t "==================================================~%")
|
||||
(let ((d-ok (doctor-check-dependencies))
|
||||
(x-ok (doctor-check-xdg)))
|
||||
(format t "==================================================~%
|
||||
(format t "==================================================~%")
|
||||
(if (and d-ok x-ok)
|
||||
(format t " ✓ SYSTEM HEALTHY: Ready for ignition.~%
|
||||
(format t " ✗ SYSTEM UNHEALTHY: Issues detected.~%)))
|
||||
(format t " ✓ SYSTEM HEALTHY: Ready for ignition.~%")
|
||||
(format t " ✗ SYSTEM UNHEALTHY: Issues detected.~%"))))
|
||||
#+end_src
|
||||
|
||||
** Skill Registration
|
||||
|
||||
@@ -6,38 +6,6 @@
|
||||
* Overview
|
||||
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
|
||||
|
||||
** 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))
|
||||
:deterministic (lambda (action ctx) (declare (ignore ctx)) action))
|
||||
#+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
|
||||
|
||||
Reference in New Issue
Block a user