moltedopus 2.2.0 → 2.3.1
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/lib/heartbeat.js +9 -3
- package/package.json +1 -1
package/lib/heartbeat.js
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* Restart hint → stdout as: RESTART:moltedopus [flags]
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
const VERSION = '2.
|
|
58
|
+
const VERSION = '2.3.1';
|
|
59
59
|
|
|
60
60
|
// ============================================================
|
|
61
61
|
// IMPORTS (zero dependencies — Node.js built-ins only)
|
|
@@ -924,12 +924,14 @@ async function cmdSay(argv) {
|
|
|
924
924
|
|
|
925
925
|
if (!roomId || !message) {
|
|
926
926
|
console.error('Usage: moltedopus say ROOM_ID "message"');
|
|
927
|
+
console.error(' moltedopus say ROOM_ID "message" --reply-to=MSG_ID');
|
|
927
928
|
console.error(' moltedopus say ROOM_ID --file=message.txt');
|
|
928
929
|
console.error(' echo "message" | moltedopus say ROOM_ID');
|
|
929
930
|
console.error(' Tip: Use \\n for newlines, single quotes to preserve $');
|
|
930
931
|
process.exit(1);
|
|
931
932
|
}
|
|
932
|
-
const
|
|
933
|
+
const replyTo = sayArgs['reply-to'] || null;
|
|
934
|
+
const result = await roomSay(roomId, message, replyTo);
|
|
933
935
|
if (result) {
|
|
934
936
|
console.log(JSON.stringify(result, null, 2));
|
|
935
937
|
} else {
|
|
@@ -2735,7 +2737,11 @@ async function heartbeatLoop(args, savedConfig) {
|
|
|
2735
2737
|
let brokeOnAction = false;
|
|
2736
2738
|
|
|
2737
2739
|
for (let cycle = 1; cycle <= maxCycles; cycle++) {
|
|
2738
|
-
|
|
2740
|
+
// First cycle: request full brief. Subsequent quiet polls: server skips brief to save bandwidth.
|
|
2741
|
+
// Brief is always included when actions exist (server-side logic).
|
|
2742
|
+
let endpoint = '/heartbeat';
|
|
2743
|
+
if (cycle === 1) endpoint += '?brief=1';
|
|
2744
|
+
if (cursor) endpoint += (endpoint.includes('?') ? '&' : '?') + `since=${encodeURIComponent(cursor)}`;
|
|
2739
2745
|
const data = await api('GET', endpoint);
|
|
2740
2746
|
|
|
2741
2747
|
if (!data) {
|