ARCH: Finalize Microkernel Decoupling - Move behavioral skills to dynamic user-space

This commit is contained in:
2026-04-13 16:11:09 -04:00
parent 34f59a6e43
commit 19fb888434
74 changed files with 129 additions and 2744 deletions

View File

@@ -38,38 +38,37 @@ Autonomous background polling of the Matrix homeserver. Uses `dexador` for HTTP
* Phase D: Build (Implementation)
** Package Context
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
(in-package :org-agent)
#+begin_src lisp
#+end_src
** State: Sync Token
Tracks the last processed event to ensure we only receive new messages.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defvar *matrix-since-token* nil)
#+end_src
** State: Polling Thread
Reference to the background thread responsible for sync requests.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defvar *matrix-polling-thread* nil)
#+end_src
** Credential Retrieval: Homeserver
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defun get-matrix-homeserver () (vault-get-secret :matrix-homeserver))
#+end_src
** Credential Retrieval: Token
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defun get-matrix-token () (vault-get-secret :matrix-token))
#+end_src
** Actuator: sendMessage
Sends an `m.room.message` to a Matrix room.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defun execute-matrix-action (action context)
"Sends a message via Matrix Client API."
(declare (ignore context))
@@ -94,7 +93,7 @@ Sends an `m.room.message` to a Matrix room.
** Sensor: Sync loop & Injection
Polls the `/sync` endpoint and processes timeline events.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defun matrix-process-sync ()
"Calls Matrix sync and injects new messages."
(let* ((hs (get-matrix-homeserver))
@@ -138,7 +137,7 @@ Polls the `/sync` endpoint and processes timeline events.
** Start Polling
Initializes the Matrix background thread.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defun start-matrix-gateway ()
"Initializes the Matrix background thread."
(unless (and *matrix-polling-thread* (bt:thread-alive-p *matrix-polling-thread*))
@@ -155,7 +154,7 @@ Initializes the Matrix background thread.
** Stop Polling
Gracefully terminates the background thread.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defun stop-matrix-gateway ()
(when (and *matrix-polling-thread* (bt:thread-alive-p *matrix-polling-thread*))
(bt:destroy-thread *matrix-polling-thread*)
@@ -165,14 +164,14 @@ Gracefully terminates the background thread.
** Registration: Actuator
Register the Matrix channel as a physical actuator.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(register-actuator :matrix #'execute-matrix-action)
#+end_src
** Registration: Skill
Define the passive skill entry for the gateway.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(defskill :skill-gateway-matrix
:priority 150
:trigger (lambda (ctx) (declare (ignore ctx)) nil)
@@ -183,6 +182,6 @@ Define the passive skill entry for the gateway.
** Initialization
Trigger the sync loop upon loading.
#+begin_src lisp :tangle ../src/gateway-matrix.lisp
#+begin_src lisp
(start-matrix-gateway)
#+end_src