ALIGN: Rename Protocol to Communication and unify terminology
This commit is contained in:
@@ -25,8 +25,8 @@
|
||||
(org-agent::defskill :infinite-skill
|
||||
:priority 100
|
||||
:trigger (lambda (ctx) t)
|
||||
:neuro (lambda (ctx) nil)
|
||||
:symbolic (lambda (action ctx)
|
||||
:probabilistic (lambda (ctx) nil)
|
||||
:deterministic (lambda (action ctx)
|
||||
`(:type :EVENT :payload (:sensor :infinite-trigger))))
|
||||
|
||||
;; The pipeline has (when (> depth 10) ...) check.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
(in-package :org-agent-tests)
|
||||
|
||||
(def-suite harness-protocol-suite
|
||||
:description "Test suite for org-agent Communication Protocol (Harness Protocol)")
|
||||
:description "Test suite for org-agent Communication Protocol (Harness Communication)")
|
||||
(in-suite harness-protocol-suite)
|
||||
|
||||
(test test-framing
|
||||
@@ -35,12 +35,12 @@
|
||||
))
|
||||
|
||||
(test test-formal-gate-middleware
|
||||
"Verify that the skill correctly filters actions via its symbolic function."
|
||||
"Verify that the skill correctly filters actions via its deterministic function."
|
||||
(let ((action '(:type :REQUEST :target :shell :payload (:cmd "nc -l 1234")))
|
||||
(context '(:payload (:sensor :test))))
|
||||
;; The skill should return a :log error action instead of the original request
|
||||
(let* ((skill (gethash "skill-formal-verification" org-agent::*skills-registry*))
|
||||
(result (funcall (org-agent::skill-symbolic-fn skill) action context)))
|
||||
(result (funcall (org-agent::skill-deterministic-fn skill) action context)))
|
||||
(is (not (eq result action)))
|
||||
(is (eq :log (getf result :type)))
|
||||
(is (search "Formal verification failed" (getf (getf result :payload) :text))))))
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
(skill (org-agent::make-skill
|
||||
:name "crasher" :priority 100
|
||||
:trigger-fn (lambda (ctx) t)
|
||||
:neuro-prompt (lambda (ctx) nil)
|
||||
:symbolic-fn (lambda (action ctx)
|
||||
:probabilistic-prompt (lambda (ctx) nil)
|
||||
:deterministic-fn (lambda (action ctx)
|
||||
'(:type :REQUEST :target :tool :payload (:action :call :tool "crashing-tool"))))))
|
||||
|
||||
(clrhash org-agent::*skills-registry*)
|
||||
@@ -43,8 +43,8 @@
|
||||
(org-agent::defskill :evil-skill
|
||||
:priority 100
|
||||
:trigger (lambda (ctx) (eq (getf (getf ctx :payload) :sensor) :test))
|
||||
:neuro (lambda (ctx) (error "CRITICAL BRAIN FAILURE"))
|
||||
:symbolic nil)
|
||||
:probabilistic (lambda (ctx) (error "CRITICAL BRAIN FAILURE"))
|
||||
:deterministic nil)
|
||||
|
||||
(harness-log "CLEAN LOG")
|
||||
(org-agent:process-signal '(:type :EVENT :payload (:sensor :test)))
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
(defpackage :org-agent (:use :cl))
|
||||
(in-package :org-agent)
|
||||
|
||||
;; We need to load the core and neuro files to test them.
|
||||
;; We need to load the core and probabilistic files to test them.
|
||||
(load "projects/org-agent/src/core.lisp")
|
||||
(load "projects/org-agent/src/neuro.lisp")
|
||||
(load "projects/org-agent/src/probabilistic.lisp")
|
||||
|
||||
;; Simple testing framework
|
||||
(defvar *tests-run* 0)
|
||||
@@ -33,15 +33,15 @@
|
||||
(format t "PASS: ~a~%" (or ,message "Assertion passed")))
|
||||
(format t "FAIL: ~a~% Condition evaluated to NIL~%" (or ,message "Assertion failed"))))))
|
||||
|
||||
(format t "--- Running Neuro Microkernel Tests ---~%")
|
||||
(format t "--- Running Probabilistic Microkernel Tests ---~%")
|
||||
|
||||
;; Test 1: Graceful failure on empty registry
|
||||
(clrhash org-agent::*neuro-backends*)
|
||||
(clrhash org-agent::*probabilistic-backends*)
|
||||
(setf org-agent::*provider-cascade* '(:nonexistent))
|
||||
|
||||
(let ((result (org-agent:ask-neuro "Test prompt")))
|
||||
(let ((result (org-agent:ask-probabilistic "Test prompt")))
|
||||
(assert-true (and (stringp result) (search ":LOG" result) (search "Neural Cascade Failure" result))
|
||||
"ask-neuro should return a Neural Cascade Failure log when no backends are available."))
|
||||
"ask-probabilistic should return a Neural Cascade Failure log when no backends are available."))
|
||||
|
||||
;; Test 2: Successful delegation to a mock provider
|
||||
(defvar *mock-called* nil)
|
||||
@@ -50,7 +50,7 @@
|
||||
(setf *mock-called* t)
|
||||
(format nil "MOCK-RESPONSE: ~a" prompt))
|
||||
|
||||
(org-agent:register-neuro-backend :mock #'mock-provider-fn)
|
||||
(org-agent:register-probabilistic-backend :mock #'mock-provider-fn)
|
||||
|
||||
;; Temporarily mock the token accountant's model selector so it doesn't fail
|
||||
(defun mock-model-selector (provider context)
|
||||
@@ -60,18 +60,18 @@
|
||||
|
||||
;; Test with our mock provider
|
||||
(setf org-agent::*provider-cascade* '(:mock))
|
||||
(let ((result (org-agent:ask-neuro "Hello Mock")))
|
||||
(assert-equal "MOCK-RESPONSE: Hello Mock" result "ask-neuro should return the exact string from the registered provider")
|
||||
(assert-true *mock-called* "The mock provider function must be called by ask-neuro"))
|
||||
(let ((result (org-agent:ask-probabilistic "Hello Mock")))
|
||||
(assert-equal "MOCK-RESPONSE: Hello Mock" result "ask-probabilistic should return the exact string from the registered provider")
|
||||
(assert-true *mock-called* "The mock provider function must be called by ask-probabilistic"))
|
||||
|
||||
;; Test 3: The core should NOT contain execute-openrouter-request, execute-groq-request, or execute-gemini-request
|
||||
;; This is the architectural test. These functions should be UNBOUND or not exist in the org-agent package.
|
||||
(assert-true (not (fboundp 'org-agent::execute-openrouter-request))
|
||||
"execute-openrouter-request should be removed from the core neuro.lisp")
|
||||
"execute-openrouter-request should be removed from the core probabilistic.lisp")
|
||||
(assert-true (not (fboundp 'org-agent::execute-groq-request))
|
||||
"execute-groq-request should be removed from the core neuro.lisp")
|
||||
"execute-groq-request should be removed from the core probabilistic.lisp")
|
||||
(assert-true (not (fboundp 'org-agent::execute-gemini-request))
|
||||
"execute-gemini-request should be removed from the core neuro.lisp")
|
||||
"execute-gemini-request should be removed from the core probabilistic.lisp")
|
||||
|
||||
(format t "--- Test Summary ---~%")
|
||||
(format t "Tests Run: ~a~%" *tests-run*)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
(should (string= "000014(:type :EVENT :id 1)" captured-framed)))))
|
||||
|
||||
(ert-deftest test-org-agent-parsing ()
|
||||
"Verify that the filter correctly parses Harness Protocol framed messages."
|
||||
"Verify that the filter correctly parses Harness Communication framed messages."
|
||||
(let ((mock-buffer (generate-new-buffer " *org-agent-test*"))
|
||||
(received-plist nil))
|
||||
(cl-letf (((symbol-function 'org-agent--handle-message)
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
(org-agent::defskill :mock-refactor
|
||||
:priority 100
|
||||
:trigger (lambda (ctx) (eq (getf (getf ctx :payload) :command) :organize-subtree))
|
||||
:neuro (lambda (ctx) "Mock neuro prompt")
|
||||
:symbolic (lambda (action ctx)
|
||||
:probabilistic (lambda (ctx) "Mock probabilistic prompt")
|
||||
:deterministic (lambda (action ctx)
|
||||
`(:type :REQUEST :id 123
|
||||
:payload (:action :refactor-subtree
|
||||
:target-id nil
|
||||
@@ -21,8 +21,8 @@
|
||||
(org-agent::defskill :mock-safety
|
||||
:priority 50
|
||||
:trigger (lambda (ctx) t) ; always triggers
|
||||
:neuro (lambda (ctx) "Mock neuro")
|
||||
:symbolic (lambda (action ctx) nil))) ; rejects everything
|
||||
:probabilistic (lambda (ctx) "Mock probabilistic")
|
||||
:deterministic (lambda (action ctx) nil))) ; rejects everything
|
||||
|
||||
(test test-perceive-gate
|
||||
"Perceive gate should update the object store and normalize signal."
|
||||
@@ -76,8 +76,8 @@
|
||||
:priority 10
|
||||
:dependencies (list "mock-safety")
|
||||
:trigger (lambda (ctx) nil)
|
||||
:neuro nil
|
||||
:symbolic nil)
|
||||
:probabilistic nil
|
||||
:deterministic nil)
|
||||
(let ((deps (org-agent::resolve-skill-dependencies "mock-dependent")))
|
||||
(is (member "mock-safety" deps :test #'string-equal))
|
||||
(is (member "mock-dependent" deps :test #'string-equal))))
|
||||
@@ -107,8 +107,8 @@
|
||||
(org-agent::defskill :crashing-skill
|
||||
:priority 200
|
||||
:trigger (lambda (ctx) t)
|
||||
:neuro (lambda (ctx) (list :type :REQUEST :payload (list :action :eval :code "(error \"BOOM\")")))
|
||||
:symbolic (lambda (action ctx) (error "CRASH IN DETERMINISTIC ENGINE")))
|
||||
:probabilistic (lambda (ctx) (list :type :REQUEST :payload (list :action :eval :code "(error \"BOOM\")")))
|
||||
:deterministic (lambda (action ctx) (error "CRASH IN DETERMINISTIC ENGINE")))
|
||||
(process-signal (list :type :EVENT :payload (list :sensor :test)))
|
||||
;; Verify that we are still in State A
|
||||
(let ((obj (lookup-object "node-1")))
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
(org-agent:defskill :skill-broken-math
|
||||
:priority 50
|
||||
:trigger (lambda (ctx) (eq (getf (getf ctx :payload) :sensor) :broken-trigger))
|
||||
:neuro nil
|
||||
:symbolic (lambda (action context)
|
||||
:probabilistic nil
|
||||
:deterministic (lambda (action context)
|
||||
(declare (ignore action context))
|
||||
(+ 1 \"two\"))) ; DETERMINISTIC BUG
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user