@turquoisebay/mqtt 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.16] - 2026-02-03
9
+
10
+ ### Docs
11
+ - Remove real IPs from documentation
12
+ - Add security note for trusted MQTT clients
13
+ - Add pairing/handshake TODO
14
+
15
+ ## [0.1.15] - 2026-02-03
16
+
17
+ ### Added
18
+ - Echo `correlationId` from inbound JSON in outbound replies
19
+
20
+ ### Docs
21
+ - Clarify how `senderId` maps to sessions vs `correlationId`
22
+
8
23
  ## [0.1.14] - 2026-02-03
9
24
 
10
25
  ### Fixed
@@ -89,6 +104,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
89
104
  - [ ] GitHub Actions CI
90
105
  - [ ] Last Will and Testament support
91
106
  - [ ] Multiple topic subscriptions
107
+ - [ ] Pairing/handshake for trusted clients
92
108
 
93
109
  ## [0.1.0] - Unreleased
94
110
 
package/README.md CHANGED
@@ -60,6 +60,13 @@ openclaw gateway restart
60
60
 
61
61
  ## Usage
62
62
 
63
+ ### Sessions & correlation IDs (important)
64
+
65
+ - **Sessions are keyed by `senderId`** → OpenClaw uses `mqtt:{senderId}` as the SessionKey, so memory and conversation history are grouped by sender.
66
+ - **`correlationId` is request‑level only** → if you include it in inbound JSON, it’s echoed back in the outbound reply for client-side matching. It does **not** create a new session or change memory.
67
+
68
+ If you want separate conversations, use distinct `senderId`s.
69
+
63
70
  ### Receiving messages (inbound)
64
71
 
65
72
  Messages published to your `inbound` topic will be processed by OpenClaw.
@@ -70,7 +77,7 @@ You can send either plain text or JSON (recommended):
70
77
  mosquitto_pub -t "openclaw/inbound" -m "Alert: Service down on playground"
71
78
 
72
79
  # JSON (recommended)
73
- mosquitto_pub -t "openclaw/inbound" -m '{"senderId":"pg-cli","text":"hello"}'
80
+ mosquitto_pub -t "openclaw/inbound" -m '{"senderId":"pg-cli","text":"hello","correlationId":"abc-123"}'
74
81
  ```
75
82
 
76
83
  ### Sending messages (outbound)
@@ -117,11 +124,15 @@ automation:
117
124
  payload: "{{ trigger.payload }}"
118
125
  ```
119
126
 
127
+ ## Security
128
+
129
+ **Important:** Any client that can publish to the inbound topic has full access to your OpenClaw agent. Treat MQTT as a **trusted channel only** (restricted broker, auth, private network). If you need untrusted access, add a validation layer before publishing to `openclaw/inbound`.
130
+
120
131
  ## Development
121
132
 
122
133
  ```bash
123
- # Clone
124
- git clone turq@10.0.20.9:/opt/git/openclaw-mqtt.git
134
+ # Clone (replace with your host)
135
+ git clone ssh://<host>/opt/git/openclaw-mqtt.git
125
136
  cd openclaw-mqtt
126
137
 
127
138
  # Install deps
@@ -144,6 +144,7 @@ async function handleInboundMessage(opts) {
144
144
  // Extract message body and sender from payload
145
145
  let messageBody;
146
146
  let senderId;
147
+ let correlationId;
147
148
  if (parsedPayload && typeof parsedPayload === "object") {
148
149
  messageBody =
149
150
  parsedPayload.message ??
@@ -159,6 +160,10 @@ async function handleInboundMessage(opts) {
159
160
  parsedPayload.from ??
160
161
  parsedPayload.service ??
161
162
  topic.replace(/\//g, "-");
163
+ correlationId =
164
+ parsedPayload.correlationId ??
165
+ parsedPayload.requestId ??
166
+ undefined;
162
167
  }
163
168
  else {
164
169
  messageBody = text;
@@ -202,6 +207,7 @@ async function handleInboundMessage(opts) {
202
207
  text: payload.text,
203
208
  kind: info.kind,
204
209
  ts: Date.now(),
210
+ ...(correlationId ? { correlationId } : {}),
205
211
  });
206
212
  await mqttClient.publish(outboundTopic, outboundPayload, qos);
207
213
  log?.info?.(`MQTT: sent reply to ${outboundTopic}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turquoisebay/mqtt",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "MQTT channel plugin for OpenClaw - bidirectional messaging via MQTT brokers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",