fix(chaos): hard-inserted clean relative tangle headers in all core files
This commit is contained in:
@@ -16,8 +16,8 @@ The *Bouncer Skill* is the physical security layer of OpenCortex. It enforces op
|
||||
** Security Configuration
|
||||
#+begin_src lisp
|
||||
(defvar *bouncer-network-whitelist*
|
||||
'("api.telegram.org" "matrix.org" "googleapis.com" "openai.com" "anthropic.com")
|
||||
"Domains that the Bouncer considers safe for outbound connections.")
|
||||
'("api.telegram.org" "matrix.org" "googleapis.com" "openai.com" "anthropic.com
|
||||
"Domains that the Bouncer considers safe for outbound connections.
|
||||
#+end_src
|
||||
|
||||
** Secret Scanning (bouncer-scan-secrets)
|
||||
@@ -57,7 +57,7 @@ The *Bouncer Skill* is the physical security layer of OpenCortex. It enforces op
|
||||
(payload (proto-get action :payload))
|
||||
(text (or (proto-get payload :text) (proto-get action :text)))
|
||||
(cmd (or (proto-get payload :cmd)
|
||||
(when (and (eq target :tool) (equal (proto-get payload :tool) "shell"))
|
||||
(when (and (eq target :tool) (equal (proto-get payload :tool) "shell)
|
||||
(proto-get (proto-get payload :args) :cmd))))
|
||||
(approved (proto-get action :approved)))
|
||||
|
||||
@@ -72,13 +72,13 @@ The *Bouncer Skill* is the physical security layer of OpenCortex. It enforces op
|
||||
:text (format nil "Action blocked: Potential exposure of '~a'" secret-name)))))
|
||||
|
||||
((and (or (eq target :shell)
|
||||
(and (eq target :tool) (equal (proto-get payload :tool) "shell")))
|
||||
(and (eq target :tool) (equal (proto-get payload :tool) "shell))
|
||||
(bouncer-check-network-exfil cmd))
|
||||
(harness-log "SECURITY WARNING: External network call detected. Queuing for approval.")
|
||||
(harness-log "SECURITY WARNING: External network call detected. Queuing for approval.
|
||||
(list :type :EVENT :payload (list :sensor :approval-required :action action)))
|
||||
|
||||
((or (member target '(:shell))
|
||||
(and (eq target :tool) (member (proto-get payload :tool) '("shell" "repair-file") :test #'string=))
|
||||
(and (eq target :tool) (member (proto-get payload :tool) '("shell" "repair-file :test #'string=))
|
||||
(and (eq target :emacs) (eq (proto-get payload :action) :eval)))
|
||||
(harness-log "SECURITY: High-impact action requires approval: ~a" (or (proto-get payload :tool) target))
|
||||
(list :type :EVENT :payload (list :sensor :approval-required :action action)))
|
||||
@@ -90,7 +90,7 @@ The *Bouncer Skill* is the physical security layer of OpenCortex. It enforces op
|
||||
#+begin_src lisp
|
||||
(defun bouncer-process-approvals ()
|
||||
"Scans for APPROVED flight plans and re-injects them."
|
||||
(let ((approved-nodes (list-objects-with-attribute :TODO "APPROVED"))
|
||||
(let ((approved-nodes (list-objects-with-attribute :TODO "APPROVED)
|
||||
(found-any nil))
|
||||
(dolist (node approved-nodes)
|
||||
(let* ((attrs (org-object-attributes node))
|
||||
@@ -102,7 +102,7 @@ The *Bouncer Skill* is the physical security layer of OpenCortex. It enforces op
|
||||
(when action
|
||||
(setf (getf action :approved) t)
|
||||
(inject-stimulus action)
|
||||
(setf (getf (org-object-attributes node) :TODO) "DONE")
|
||||
(setf (getf (org-object-attributes node) :TODO) "DONE
|
||||
(setq found-any t))))))
|
||||
found-any))
|
||||
#+end_src
|
||||
@@ -116,7 +116,7 @@ The *Bouncer Skill* is the physical security layer of OpenCortex. It enforces op
|
||||
(list :type :REQUEST :target :emacs
|
||||
:payload (list :action :insert-node :id id
|
||||
:attributes (list :TITLE "Flight Plan: High-Risk Action"
|
||||
:TODO "PLAN" :TAGS '("FLIGHT_PLAN")
|
||||
:TODO "PLAN" :TAGS '("FLIGHT_PLAN
|
||||
:ACTION (format nil "~s" blocked-action))))))
|
||||
#+end_src
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ The *Config Manager* skill provides the OpenCortex Agent with the capability to
|
||||
#+begin_src lisp
|
||||
(defun get-oc-config-dir ()
|
||||
"Returns the absolute path to the opencortex config directory."
|
||||
(let ((xdg (uiop:getenv "OC_CONFIG_DIR")))
|
||||
(if (and xdg (string/= xdg ""))
|
||||
(let ((xdg (uiop:getenv "OC_CONFIG_DIR))
|
||||
(if (and xdg (string/= xdg
|
||||
(uiop:ensure-directory-pathname xdg)
|
||||
(uiop:ensure-directory-pathname (merge-pathnames ".config/opencortex/" (user-homedir-pathname))))))
|
||||
|
||||
(defun save-providers ()
|
||||
"Stubs for saving provider configuration."
|
||||
(harness-log "CONFIG: Providers saved."))
|
||||
(harness-log "CONFIG: Providers saved.)
|
||||
|
||||
(defun configure-provider (id)
|
||||
"Stubs for configuring a provider."
|
||||
@@ -32,7 +32,7 @@ The *Config Manager* skill provides the OpenCortex Agent with the capability to
|
||||
|
||||
(defun run-setup-wizard ()
|
||||
"Interactive setup wizard for OpenCortex."
|
||||
(format t "--- OpenCortex Setup Wizard ---~%")
|
||||
(format t "--- OpenCortex Setup Wizard ---~%
|
||||
(save-providers)
|
||||
(doctor-main))
|
||||
#+end_src
|
||||
|
||||
@@ -16,7 +16,7 @@ The *Credentials Vault* provides secure in-memory storage for sensitive API keys
|
||||
** Vault Storage
|
||||
#+begin_src lisp
|
||||
(defvar *vault-memory* (make-hash-table :test 'equal)
|
||||
"In-memory cache of sensitive credentials.")
|
||||
"In-memory cache of sensitive credentials.
|
||||
#+end_src
|
||||
|
||||
** Secret Management
|
||||
@@ -28,10 +28,10 @@ The *Credentials Vault* provides secure in-memory storage for sensitive API keys
|
||||
(if val
|
||||
val
|
||||
(let ((env-var (case provider
|
||||
(:gemini "GEMINI_API_KEY")
|
||||
(:openai "OPENAI_API_KEY")
|
||||
(:anthropic "ANTHROPIC_API_KEY")
|
||||
(:openrouter "OPENROUTER_API_KEY")
|
||||
(:gemini "GEMINI_API_KEY
|
||||
(:openai "OPENAI_API_KEY
|
||||
(:anthropic "ANTHROPIC_API_KEY
|
||||
(:openrouter "OPENROUTER_API_KEY
|
||||
(otherwise nil))))
|
||||
(when env-var (uiop:getenv env-var))))))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,7 +17,7 @@ The *Engineering Standards Skill* enforces technical invariants, including the *
|
||||
#+begin_src lisp
|
||||
(defun verify-git-clean-p (dir)
|
||||
"Checks if a directory has uncommitted changes."
|
||||
(let ((status (uiop:run-program (list "git" "-C" (namestring dir) "status" "--porcelain")
|
||||
(let ((status (uiop:run-program (list "git" "-C" (namestring dir) "status" "--porcelain
|
||||
:output :string
|
||||
:ignore-error-status t)))
|
||||
(string= "" (string-trim '(#\Space #\Newline #\Tab) status))))
|
||||
|
||||
@@ -17,11 +17,11 @@ The *Gardener Skill* performs periodic maintenance on the Memex knowledge graph.
|
||||
#+begin_src lisp
|
||||
(defun gardener-prune-orphans ()
|
||||
"Identifies and handles orphaned objects in memory."
|
||||
(harness-log "GARDENER: Pruning orphans..."))
|
||||
(harness-log "GARDENER: Pruning orphans...)
|
||||
|
||||
(defun gardener-verify-merkle-integrity ()
|
||||
"Validates the hashes of all objects in memory."
|
||||
(harness-log "GARDENER: Verifying Merkle integrity..."))
|
||||
(harness-log "GARDENER: Verifying Merkle integrity...)
|
||||
#+end_src
|
||||
|
||||
** Skill Registration
|
||||
|
||||
@@ -17,7 +17,7 @@ The *Homoiconic Memory* skill provides the capability to treat system memory as
|
||||
#+begin_src lisp
|
||||
(defun memory-self-inspect ()
|
||||
"Allows the system to inspect its own memory state."
|
||||
(harness-log "MEMORY: Self-inspection triggered."))
|
||||
(harness-log "MEMORY: Self-inspection triggered.)
|
||||
#+end_src
|
||||
|
||||
** Skill Registration
|
||||
|
||||
@@ -15,9 +15,9 @@ The *Llama Backend* skill provides the actual implementation for calling local m
|
||||
|
||||
** Ollama API Call (ollama-call)
|
||||
#+begin_src lisp
|
||||
(defun ollama-call (prompt system-prompt &key (model "llama3"))
|
||||
(defun ollama-call (prompt system-prompt &key (model "llama3)
|
||||
"Sends a request to the local Ollama API."
|
||||
(let* ((host (or (uiop:getenv "OLLAMA_HOST") "localhost:11434"))
|
||||
(let* ((host (or (uiop:getenv "OLLAMA_HOST "localhost:11434)
|
||||
(url (format nil "http://~a/api/generate" host))
|
||||
(payload (cl-json:encode-json-to-string
|
||||
`((model . ,model)
|
||||
@@ -25,7 +25,7 @@ The *Llama Backend* skill provides the actual implementation for calling local m
|
||||
(system . ,system-prompt)
|
||||
(stream . nil)))))
|
||||
(handler-case
|
||||
(let ((response (dex:post url :content payload :headers '(("Content-Type" . "application/json")))))
|
||||
(let ((response (dex:post url :content payload :headers '(("Content-Type" . "application/json))))
|
||||
(let ((data (cl-json:decode-json-from-string response)))
|
||||
(list :status :success :content (getf data :response))))
|
||||
(error (c)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
The *LLM Gateway* skill provides a unified interface for interacting with multiple Large Language Model providers.
|
||||
|
||||
* Test Suite
|
||||
#+begin_src lisp :tangle tests/llm-gateway-tests.lisp
|
||||
#+begin_src lisp :tangle org-skill-llm-gateway.lisp
|
||||
(defpackage :opencortex-llm-gateway-tests
|
||||
(:use :cl :opencortex)
|
||||
(:export #:llm-gateway-suite))
|
||||
@@ -17,25 +17,25 @@ The *LLM Gateway* skill provides a unified interface for interacting with multip
|
||||
(eval-when (:compile-toplevel :load-toplevel :execute)
|
||||
(ql:quickload :fiveam))
|
||||
|
||||
(fiveam:def-suite llm-gateway-suite :description "Tests for the LLM Gateway skill")
|
||||
(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")))
|
||||
(let ((old-host (uiop:getenv "OLLAMA_HOST))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(setf (uiop:getenv "OLLAMA_HOST") "localhost:1")
|
||||
(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"))))
|
||||
(fiveam:fail "Could not find EXECUTE-LLM-REQUEST symbol)))
|
||||
(if old-host
|
||||
(setf (uiop:getenv "OLLAMA_HOST") old-host)
|
||||
(sb-posix:unsetenv "OLLAMA_HOST")))))
|
||||
(setf (uiop:getenv "OLLAMA_HOST old-host)
|
||||
(sb-posix:unsetenv "OLLAMA_HOST))))
|
||||
#+end_src
|
||||
|
||||
* Implementation
|
||||
|
||||
@@ -20,7 +20,7 @@ The *Peripheral Vision* skill enhances the context engine with high-level summar
|
||||
(let ((obj (lookup-object obj-id)))
|
||||
(if obj
|
||||
(format nil "Node: ~a (~a)" (getf (org-object-attributes obj) :TITLE) obj-id)
|
||||
"[Unknown Node]")))
|
||||
"[Unknown Node]))
|
||||
#+end_src
|
||||
|
||||
** Skill Registration
|
||||
|
||||
@@ -23,10 +23,10 @@ The *Policy Skill* is the constitutional layer of OpenCortex. It enforces founda
|
||||
(if (and explanation (stringp explanation) (> (length explanation) 10))
|
||||
action
|
||||
(progn
|
||||
(harness-log "POLICY VIOLATION: Action lacks sufficient explanation.")
|
||||
(harness-log "POLICY VIOLATION: Action lacks sufficient explanation.
|
||||
(list :type :LOG
|
||||
:payload (list :level :warn
|
||||
:text "Action blocked: Missing or insufficient :explanation. Please justify your reasoning."))))))
|
||||
:text "Action blocked: Missing or insufficient :explanation. Please justify your reasoning.)))))
|
||||
#+end_src
|
||||
|
||||
** Skill Registration
|
||||
|
||||
Reference in New Issue
Block a user