metheus-governance-mcp-cli 0.2.54 → 0.2.55
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/cli.mjs +24 -3
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -1858,14 +1858,34 @@ async function deliverLocalProviderMessage({
|
|
|
1858
1858
|
if (replyToMessageID > 0) {
|
|
1859
1859
|
payload.reply_to_message_id = replyToMessageID;
|
|
1860
1860
|
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1861
|
+
let response = await postJSONWithoutAuth(requestURL, timeoutSeconds, payload);
|
|
1862
|
+
let responseJSON = parseJSONText(response.bodyText);
|
|
1863
|
+
let effectiveReplyToMessageID = replyToMessageID > 0 ? replyToMessageID : 0;
|
|
1864
|
+
let replyFallbackUsed = false;
|
|
1865
|
+
const responseDescription = String(safeObject(responseJSON).description || "").trim().toLowerCase();
|
|
1866
|
+
if (
|
|
1867
|
+
replyToMessageID > 0
|
|
1868
|
+
&& !(response.statusCode >= 200 && response.statusCode < 300 && Boolean(responseJSON?.ok ?? true))
|
|
1869
|
+
&& responseDescription.includes("message to be replied not found")
|
|
1870
|
+
) {
|
|
1871
|
+
const fallbackPayload = {
|
|
1872
|
+
chat_id: destination.chatID,
|
|
1873
|
+
text,
|
|
1874
|
+
disable_web_page_preview: disableWebPagePreview,
|
|
1875
|
+
};
|
|
1876
|
+
response = await postJSONWithoutAuth(requestURL, timeoutSeconds, fallbackPayload);
|
|
1877
|
+
responseJSON = parseJSONText(response.bodyText);
|
|
1878
|
+
effectiveReplyToMessageID = 0;
|
|
1879
|
+
replyFallbackUsed = true;
|
|
1880
|
+
}
|
|
1863
1881
|
return {
|
|
1864
1882
|
statusCode: response.statusCode,
|
|
1865
1883
|
body: responseJSON || response.bodyText,
|
|
1866
1884
|
ok: response.statusCode >= 200 && response.statusCode < 300 && Boolean(responseJSON?.ok ?? true),
|
|
1867
1885
|
url: sanitizeTelegramAPIURL(requestURL),
|
|
1868
1886
|
replySupported: true,
|
|
1887
|
+
effectiveReplyToMessageID,
|
|
1888
|
+
replyFallbackUsed,
|
|
1869
1889
|
};
|
|
1870
1890
|
}
|
|
1871
1891
|
if (normalizedProvider === "slack") {
|
|
@@ -5576,13 +5596,14 @@ async function performLocalBotDelivery({
|
|
|
5576
5596
|
deliveredResult.message_id ?? deliveredBody.message_id ?? deliveredBody.ts,
|
|
5577
5597
|
0,
|
|
5578
5598
|
);
|
|
5599
|
+
const archiveReplyToMessageID = intFromRawAllowZero(delivery.effectiveReplyToMessageID, replyToMessageID);
|
|
5579
5600
|
const archiveBody = formatBotReplyArchiveComment({
|
|
5580
5601
|
provider: normalizedProvider,
|
|
5581
5602
|
bot,
|
|
5582
5603
|
destination,
|
|
5583
5604
|
replyText: text,
|
|
5584
5605
|
messageID: deliveredMessageID,
|
|
5585
|
-
replyToMessageID,
|
|
5606
|
+
replyToMessageID: archiveReplyToMessageID,
|
|
5586
5607
|
});
|
|
5587
5608
|
const createdComment = await createThreadComment({
|
|
5588
5609
|
siteBaseURL,
|