openclaw-elys 1.7.2 → 1.7.4
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/dist/src/monitor.js +2 -4
- package/dist/src/mqtt-client.d.ts +1 -1
- package/dist/src/mqtt-client.js +6 -10
- package/dist/src/types.d.ts +0 -2
- package/package.json +1 -1
package/dist/src/monitor.js
CHANGED
|
@@ -57,13 +57,11 @@ export async function monitorElysProvider(opts) {
|
|
|
57
57
|
});
|
|
58
58
|
// Deliver callback: stream chunks back via MQTT
|
|
59
59
|
const deliver = async (payload, info) => {
|
|
60
|
-
if (signal.aborted)
|
|
61
|
-
return;
|
|
62
60
|
if (payload.text) {
|
|
63
61
|
fullText += payload.text;
|
|
64
62
|
seq++;
|
|
65
63
|
const done = info.kind === "final";
|
|
66
|
-
mqttClient.publishStreamChunk(cmd.id, payload.text, seq, done
|
|
64
|
+
mqttClient.publishStreamChunk(cmd.id, payload.text, seq, done);
|
|
67
65
|
if (info.kind === "block") {
|
|
68
66
|
log(`[elys] stream chunk #${seq}: ${payload.text.slice(0, 80)}...`);
|
|
69
67
|
}
|
|
@@ -73,7 +71,7 @@ export async function monitorElysProvider(opts) {
|
|
|
73
71
|
}
|
|
74
72
|
else if (info.kind === "final") {
|
|
75
73
|
seq++;
|
|
76
|
-
mqttClient.publishStreamChunk(cmd.id, "", seq, true
|
|
74
|
+
mqttClient.publishStreamChunk(cmd.id, "", seq, true);
|
|
77
75
|
log(`[elys] final reply delivered (empty)`);
|
|
78
76
|
}
|
|
79
77
|
};
|
|
@@ -35,7 +35,7 @@ export declare class ElysDeviceMQTTClient {
|
|
|
35
35
|
connect(abortSignal?: AbortSignal): Promise<void>;
|
|
36
36
|
disconnect(): void;
|
|
37
37
|
/** Send a stream chunk (for streaming AI responses) */
|
|
38
|
-
publishStreamChunk(commandId: string, chunk: string, seq: number, done: boolean
|
|
38
|
+
publishStreamChunk(commandId: string, chunk: string, seq: number, done: boolean): void;
|
|
39
39
|
private onMessage;
|
|
40
40
|
private flushDebounce;
|
|
41
41
|
/** Merge multiple buffered commands into one. Joins text args with newline. */
|
package/dist/src/mqtt-client.js
CHANGED
|
@@ -120,7 +120,7 @@ export class ElysDeviceMQTTClient {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
/** Send a stream chunk (for streaming AI responses) */
|
|
123
|
-
publishStreamChunk(commandId, chunk, seq, done
|
|
123
|
+
publishStreamChunk(commandId, chunk, seq, done) {
|
|
124
124
|
const msg = {
|
|
125
125
|
id: commandId,
|
|
126
126
|
type: "stream",
|
|
@@ -129,7 +129,7 @@ export class ElysDeviceMQTTClient {
|
|
|
129
129
|
seq,
|
|
130
130
|
done,
|
|
131
131
|
};
|
|
132
|
-
this.publish(msg
|
|
132
|
+
this.publish(msg);
|
|
133
133
|
}
|
|
134
134
|
// ─── Inbound message pipeline: dedup → ack → debounce → abort → execute ───
|
|
135
135
|
onMessage(payload) {
|
|
@@ -201,7 +201,6 @@ export class ElysDeviceMQTTClient {
|
|
|
201
201
|
async executeCommand(cmd, signal) {
|
|
202
202
|
if (!this.commandHandler)
|
|
203
203
|
return;
|
|
204
|
-
const replyTo = cmd.reply_to;
|
|
205
204
|
try {
|
|
206
205
|
const result = await Promise.race([
|
|
207
206
|
this.commandHandler(cmd, signal),
|
|
@@ -209,13 +208,10 @@ export class ElysDeviceMQTTClient {
|
|
|
209
208
|
const timer = setTimeout(() => {
|
|
210
209
|
reject(new Error(`command timed out after ${this.commandTimeoutMs / 1000}s`));
|
|
211
210
|
}, this.commandTimeoutMs);
|
|
212
|
-
// Clean up timer if command completes or is aborted
|
|
213
211
|
signal.addEventListener("abort", () => clearTimeout(timer), { once: true });
|
|
214
212
|
}),
|
|
215
213
|
]);
|
|
216
|
-
|
|
217
|
-
this.publish(result, replyTo);
|
|
218
|
-
}
|
|
214
|
+
this.publish(result);
|
|
219
215
|
}
|
|
220
216
|
catch (err) {
|
|
221
217
|
if (signal.aborted) {
|
|
@@ -229,7 +225,7 @@ export class ElysDeviceMQTTClient {
|
|
|
229
225
|
timestamp: Math.floor(Date.now() / 1000),
|
|
230
226
|
status: "error",
|
|
231
227
|
error: errMsg,
|
|
232
|
-
}
|
|
228
|
+
});
|
|
233
229
|
}
|
|
234
230
|
}
|
|
235
231
|
cleanupDedup() {
|
|
@@ -249,10 +245,10 @@ export class ElysDeviceMQTTClient {
|
|
|
249
245
|
};
|
|
250
246
|
this.publish(msg);
|
|
251
247
|
}
|
|
252
|
-
publish(msg
|
|
248
|
+
publish(msg) {
|
|
253
249
|
if (!this.client)
|
|
254
250
|
return;
|
|
255
|
-
const topic =
|
|
251
|
+
const topic = `elys/up/${this.credentials.deviceId}`;
|
|
256
252
|
this.client.publish(topic, JSON.stringify(msg), { qos: 1 }, (err) => {
|
|
257
253
|
if (err) {
|
|
258
254
|
this.log(`[elys] failed to publish to ${topic}:`, err);
|
package/dist/src/types.d.ts
CHANGED
|
@@ -24,8 +24,6 @@ export interface CommandMessage extends MQTTBaseMessage {
|
|
|
24
24
|
type: "command";
|
|
25
25
|
command: string;
|
|
26
26
|
args?: Record<string, unknown>;
|
|
27
|
-
/** If set, device should publish result/stream to this topic instead of elys/up/{device_id} */
|
|
28
|
-
reply_to?: string;
|
|
29
27
|
}
|
|
30
28
|
export interface AckMessage extends MQTTBaseMessage {
|
|
31
29
|
type: "ack";
|