Fix gateway skills: minor cleanup in matrix/signal/telegram org blocks

This commit is contained in:
2026-04-25 18:44:41 -04:00
parent 2db53fae17
commit 5f2b7e8d16
3 changed files with 18 additions and 19 deletions

View File

@@ -32,8 +32,8 @@ Integrate the OpenCortex into the Matrix federation for secure, distributed chat
Autonomous background polling of the Matrix homeserver. Uses `dexador` for HTTP and `cl-json` for parsing. Autonomous background polling of the Matrix homeserver. Uses `dexador` for HTTP and `cl-json` for parsing.
** 2. Semantic Interfaces ** 2. Semantic Interfaces
- `(:sensor :chat-message :channel :matrix ...)` - `(:type :EVENT :meta (:source :matrix :room-id "...") :payload (:sensor :user-input :text "..."))`
- `(:type :REQUEST :target :matrix :room-id "..." :text "...")` - `(:type :REQUEST :target :matrix :payload (:action :message :text "..."))`
* Phase D: Build (Implementation) * Phase D: Build (Implementation)
@@ -73,7 +73,8 @@ Sends an `m.room.message` to a Matrix room.
"Sends a message via Matrix Client API." "Sends a message via Matrix Client API."
(declare (ignore context)) (declare (ignore context))
(let* ((payload (getf action :payload)) (let* ((payload (getf action :payload))
(room-id (or (getf payload :room-id) (getf action :room-id))) (meta (getf action :meta))
(room-id (or (getf meta :room-id) (getf payload :room-id) (getf action :room-id)))
(text (or (getf payload :text) (getf action :text))) (text (or (getf payload :text) (getf action :text)))
(hs (get-matrix-homeserver)) (hs (get-matrix-homeserver))
(token (get-matrix-token)) (token (get-matrix-token))
@@ -126,10 +127,8 @@ Polls the `/sync` endpoint and processes timeline events.
(harness-log "MATRIX: Received message from ~a in ~a" sender room-id) (harness-log "MATRIX: Received message from ~a in ~a" sender room-id)
(inject-stimulus (inject-stimulus
(list :type :EVENT (list :type :EVENT
:payload (list :sensor :chat-message :meta (list :source :matrix :room-id room-id :sender sender)
:channel :matrix :payload (list :sensor :user-input
:room-id room-id
:sender sender
:text body))))))))) :text body)))))))))
(error (c) (harness-log "MATRIX SYNC ERROR: ~a" c)))))) (error (c) (harness-log "MATRIX SYNC ERROR: ~a" c))))))
#+end_src #+end_src

View File

@@ -32,8 +32,8 @@ Enable secure Signal communication for the OpenCortex.
Wraps the `signal-cli` binary. Polling is done in a background thread to prevent blocking the harness. Wraps the `signal-cli` binary. Polling is done in a background thread to prevent blocking the harness.
** 2. Semantic Interfaces ** 2. Semantic Interfaces
- `(:sensor :chat-message :channel :signal ...)` - `(:type :EVENT :meta (:source :signal :chat-id "+1...") :payload (:sensor :user-input :text "..."))`
- `(:type :REQUEST :target :signal :chat-id "+1..." :text "...")` - `(:type :REQUEST :target :signal :payload (:action :message :text "..."))`
* Phase D: Build (Implementation) * Phase D: Build (Implementation)
@@ -63,7 +63,8 @@ Executes the `signal-cli send` command.
"Sends a message via signal-cli." "Sends a message via signal-cli."
(declare (ignore context)) (declare (ignore context))
(let* ((payload (getf action :payload)) (let* ((payload (getf action :payload))
(chat-id (or (getf payload :chat-id) (getf action :chat-id))) (meta (getf action :meta))
(chat-id (or (getf meta :chat-id) (getf payload :chat-id) (getf action :chat-id)))
(text (or (getf payload :text) (getf action :text))) (text (or (getf payload :text) (getf action :text)))
(account (get-signal-account))) (account (get-signal-account)))
(when (and account chat-id text) (when (and account chat-id text)
@@ -97,9 +98,8 @@ Polls for new messages and injects them into the harness.
(harness-log "SIGNAL: Received message from ~a" source) (harness-log "SIGNAL: Received message from ~a" source)
(inject-stimulus (inject-stimulus
(list :type :EVENT (list :type :EVENT
:payload (list :sensor :chat-message :meta (list :source :signal :chat-id source)
:channel :signal :payload (list :sensor :user-input
:chat-id source
:text text)))))))) :text text))))))))
(error (c) (harness-log "SIGNAL POLL ERROR: ~a" c)))))) (error (c) (harness-log "SIGNAL POLL ERROR: ~a" c))))))
#+end_src #+end_src

View File

@@ -32,8 +32,8 @@ Enable mobile/remote access to the OpenCortex via a secure Telegram bot.
The gateway operates as an autonomous background service. It uses `dexador` for HTTP polling and `cl-json` for payload processing. Authentication is enforced via a whitelist of authorized `chat_id`s. The gateway operates as an autonomous background service. It uses `dexador` for HTTP polling and `cl-json` for payload processing. Authentication is enforced via a whitelist of authorized `chat_id`s.
** 2. Semantic Interfaces ** 2. Semantic Interfaces
- `(:sensor :chat-message :channel :telegram ...)` - `(:type :EVENT :meta (:source :telegram :chat-id "...") :payload (:sensor :user-input :text "..."))`
- `(:type :REQUEST :target :telegram :chat-id "..." :text "...")` - `(:type :REQUEST :target :telegram :payload (:action :message :text "..."))`
* Phase D: Build (Implementation) * Phase D: Build (Implementation)
@@ -76,7 +76,8 @@ Fetches the Bot API token from the secure vault.
"Sends a message back to Telegram." "Sends a message back to Telegram."
(declare (ignore context)) (declare (ignore context))
(let* ((payload (getf action :payload)) (let* ((payload (getf action :payload))
(chat-id (or (getf payload :chat-id) (getf action :chat-id))) (meta (getf action :meta))
(chat-id (or (getf meta :chat-id) (getf payload :chat-id) (getf action :chat-id)))
(text (or (getf payload :text) (getf action :text))) (text (or (getf payload :text) (getf action :text)))
(token (get-telegram-token)) (token (get-telegram-token))
(url (format nil "https://api.telegram.org/bot~a/sendMessage" token))) (url (format nil "https://api.telegram.org/bot~a/sendMessage" token)))
@@ -113,9 +114,8 @@ Fetches the Bot API token from the secure vault.
(harness-log "TELEGRAM: Received message from ~a" chat-id) (harness-log "TELEGRAM: Received message from ~a" chat-id)
(inject-stimulus (inject-stimulus
(list :type :EVENT (list :type :EVENT
:payload (list :sensor :chat-message :meta (list :source :telegram :chat-id (format nil "~a" chat-id))
:channel :telegram :payload (list :sensor :user-input
:chat-id (format nil "~a" chat-id)
:text text))))))) :text text)))))))
(error (c) (harness-log "TELEGRAM POLL ERROR: ~a" c)))))) (error (c) (harness-log "TELEGRAM POLL ERROR: ~a" c))))))
#+end_src #+end_src