ALIGN: Rename Protocol to Communication and unify terminology
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
:ID: org-skill-harness-protocol-validator
|
||||
:CREATED: [2026-04-12 Sun 14:35]
|
||||
:END:
|
||||
#+TITLE: SKILL: Harness Protocol Schema Validator (Universal Literate Note)
|
||||
#+TITLE: SKILL: Harness Communication Schema Validator (Universal Literate Note)
|
||||
#+STARTUP: content
|
||||
#+FILETAGS: :protocol:harness-protocol:security:validation:psf:
|
||||
|
||||
* Overview
|
||||
The *Harness Protocol Schema Validator* skill provides deep structural validation for all messages entering the org-agent kernel. It ensures that every property list adheres to a strict schema, preventing malformed data from causing harness-level errors.
|
||||
The *Harness Communication Schema Validator* skill provides deep structural validation for all messages entering the org-agent kernel. It ensures that every property list adheres to a strict schema, preventing malformed data from causing harness-level errors.
|
||||
|
||||
* Phase A: Demand (PRD)
|
||||
:PROPERTIES:
|
||||
@@ -15,7 +15,7 @@ The *Harness Protocol Schema Validator* skill provides deep structural validatio
|
||||
:END:
|
||||
|
||||
** 1. Purpose
|
||||
Enforce a formal grammar for the Org-Agent Control Protocol (Harness Protocol).
|
||||
Enforce a formal grammar for the Org-Agent Control Protocol (Harness Communication).
|
||||
|
||||
** 2. User Needs
|
||||
- *Type Safety:* Ensure mandatory keys (e.g., `:type`, `:payload`) are present.
|
||||
@@ -45,46 +45,46 @@ Decouple protocol parsing (framing/unframing) from semantic validation.
|
||||
* Phase D: Build (Implementation)
|
||||
|
||||
** Schema Enforcement
|
||||
#+begin_src lisp :tangle ../src/protocol-validator.lisp
|
||||
#+begin_src lisp :tangle ../src/communication-validator.lisp
|
||||
(in-package :org-agent)
|
||||
|
||||
(defun validate-harness-protocol-schema (msg)
|
||||
"Strict structural validation for incoming Harness Protocol messages."
|
||||
"Strict structural validation for incoming Harness Communication messages."
|
||||
(unless (listp msg)
|
||||
(error "Harness Protocol Schema Error: Message must be a property list (got ~s)" (type-of msg)))
|
||||
(error "Harness Communication Schema Error: Message must be a property list (got ~s)" (type-of msg)))
|
||||
|
||||
(let ((type (getf msg :type)))
|
||||
(unless (member type '(:REQUEST :EVENT :RESPONSE :LOG))
|
||||
(error "Harness Protocol Schema Error: Invalid message type '~a'" type))
|
||||
(error "Harness Communication Schema Error: Invalid message type '~a'" type))
|
||||
|
||||
(case type
|
||||
(:REQUEST
|
||||
(unless (getf msg :target)
|
||||
(error "Harness Protocol Schema Error: REQUEST missing mandatory :target"))
|
||||
(error "Harness Communication Schema Error: REQUEST missing mandatory :target"))
|
||||
(unless (getf msg :payload)
|
||||
(error "Harness Protocol Schema Error: REQUEST missing mandatory :payload")))
|
||||
(error "Harness Communication Schema Error: REQUEST missing mandatory :payload")))
|
||||
|
||||
(:EVENT
|
||||
(let ((payload (getf msg :payload)))
|
||||
(unless (and payload (listp payload))
|
||||
(error "Harness Protocol Schema Error: EVENT missing or invalid :payload"))
|
||||
(error "Harness Communication Schema Error: EVENT missing or invalid :payload"))
|
||||
(unless (or (getf payload :action) (getf payload :sensor))
|
||||
(error "Harness Protocol Schema Error: EVENT payload must contain :action or :sensor"))))
|
||||
(error "Harness Communication Schema Error: EVENT payload must contain :action or :sensor"))))
|
||||
|
||||
(:RESPONSE
|
||||
(unless (getf msg :payload)
|
||||
(error "Harness Protocol Schema Error: RESPONSE missing mandatory :payload"))))
|
||||
(error "Harness Communication Schema Error: RESPONSE missing mandatory :payload"))))
|
||||
|
||||
t))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
#+begin_src lisp :tangle ../src/protocol-validator.lisp
|
||||
#+begin_src lisp :tangle ../src/communication-validator.lisp
|
||||
(defskill :skill-harness-protocol-validator
|
||||
:priority 95
|
||||
:trigger (lambda (ctx) (member (getf (getf ctx :payload) :sensor) '(:protocol-received)))
|
||||
:neuro nil
|
||||
:symbolic (lambda (action ctx)
|
||||
:probabilistic nil
|
||||
:deterministic (lambda (action ctx)
|
||||
(declare (ignore ctx))
|
||||
(validate-harness-protocol-schema action)
|
||||
action))
|
||||
|
||||
Reference in New Issue
Block a user