johns-harness 2026.10.14 → 2026.10.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 +7 -0
- package/dist/compact-B247y5Qt.js +20 -16
- package/dist/pi-embedded-C6ITuRXf.js +20 -16
- package/dist/pi-embedded-DoQsYfIY.js +20 -16
- package/dist/pi-embedded-helpers-B7bn2aDM.js +4 -1
- package/dist/pi-embedded-helpers-CGK9ncQY.js +4 -1
- package/dist/pi-embedded-helpers-CkWXaNFn.js +4 -1
- package/dist/pi-embedded-helpers-DLLQ3MsR.js +4 -1
- package/dist/plugin-sdk/dispatch-BP0viZiL.js +20 -16
- package/dist/plugin-sdk/dispatch-CQsjmw7g.js +20 -16
- package/dist/plugin-sdk/dispatch-Cerq29sy.js +20 -16
- package/dist/plugin-sdk/dispatch-Cndjtt0g.js +20 -16
- package/dist/plugin-sdk/dispatch-UogiJYul.js +20 -16
- package/dist/plugin-sdk/pi-embedded-helpers-B89Z8pGU.js +4 -1
- package/dist/plugin-sdk/pi-embedded-helpers-BDFUaaiY.js +4 -1
- package/dist/plugin-sdk/pi-embedded-helpers-BnFhV3or.js +4 -1
- package/dist/plugin-sdk/pi-embedded-helpers-CRUVFL1T.js +4 -1
- package/dist/plugin-sdk/pi-embedded-helpers-CY7PsNpl.js +4 -1
- package/dist/plugin-sdk/pi-embedded-helpers-Dira0ZRW.js +4 -1
- package/dist/plugin-sdk/reply-DbZnH8-h.js +20 -16
- package/dist/reply-C5LKjXcC.js +20 -16
- package/docs/PATCHES.md +34 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026.10.16
|
|
4
|
+
|
|
5
|
+
- **Fixed Telegram replies disappearing after sending a file.** A successful message-tool send used to discard every final reply to that chat, even unrelated text. Telegram briefly showed the reply as a preview and then removed it because it never received a final payload. Direct and queued replies now deduplicate actual content instead of suppressing the entire destination; distinct follow-up text is finalized and stays visible.
|
|
6
|
+
- **Preserved deliberate silence and duplicate protection:** `NO_REPLY` still sends nothing; repeated text/media and already-block-streamed replies are still suppressed. Exact short and emoji-only repeats are deduplicated too. Cleanup only removes unused previews, never messages already delivered by the tool. Queued content dedupe respects the originating chat, topic, channel and account.
|
|
7
|
+
- **Regression coverage:** all ten reply bundles plus a fake-transport execution of the real Telegram dispatcher/finalizer that reproduces the old disappearance and proves the new reply remains. No model, authentication, gateway configuration or deployment changes.
|
|
8
|
+
- **Rollback:** `npm i -g johns-harness@2026.10.14` (previous confirmed registry release).
|
|
9
|
+
|
|
3
10
|
## 2026.10.14
|
|
4
11
|
|
|
5
12
|
- **New stable chat model:** `google/gemini-4-argon` (GA October 13, cutoff March 2026). Text/image input in the harness and text output; the native API also accepts audio/video/PDF. A unified **1,048,576-token** window includes input, thinking and output; output uses only the remaining space. Function calling is verified through the real adapter.
|
package/dist/compact-B247y5Qt.js
CHANGED
|
@@ -58537,7 +58537,8 @@ async function buildReplyPayloads(params) {
|
|
|
58537
58537
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
58538
58538
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
58539
58539
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
58540
|
-
|
|
58540
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
58541
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
58541
58542
|
messageProvider: resolveOriginMessageProvider({
|
|
58542
58543
|
originatingChannel: params.originatingChannel,
|
|
58543
58544
|
provider: params.messageProvider
|
|
@@ -58546,7 +58547,7 @@ async function buildReplyPayloads(params) {
|
|
|
58546
58547
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
58547
58548
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
58548
58549
|
});
|
|
58549
|
-
const dedupeMessagingToolPayloads =
|
|
58550
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
58550
58551
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
58551
58552
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
58552
58553
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -58561,7 +58562,7 @@ async function buildReplyPayloads(params) {
|
|
|
58561
58562
|
}) : dedupedPayloads;
|
|
58562
58563
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
58563
58564
|
return {
|
|
58564
|
-
replyPayloads:
|
|
58565
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
58565
58566
|
didLogHeartbeatStrip
|
|
58566
58567
|
};
|
|
58567
58568
|
}
|
|
@@ -58944,18 +58945,8 @@ function createFollowupRunner(params) {
|
|
|
58944
58945
|
originatingChannel: queued.originatingChannel,
|
|
58945
58946
|
provider: queued.run.messageProvider
|
|
58946
58947
|
});
|
|
58947
|
-
|
|
58948
|
-
|
|
58949
|
-
payloads: applyReplyThreading({
|
|
58950
|
-
payloads: sanitizedPayloads,
|
|
58951
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
58952
|
-
replyToChannel
|
|
58953
|
-
}),
|
|
58954
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
58955
|
-
}),
|
|
58956
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
58957
|
-
});
|
|
58958
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
58948
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
58949
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
58959
58950
|
messageProvider: resolveOriginMessageProvider({
|
|
58960
58951
|
originatingChannel: queued.originatingChannel,
|
|
58961
58952
|
provider: queued.run.messageProvider
|
|
@@ -58966,7 +58957,20 @@ function createFollowupRunner(params) {
|
|
|
58966
58957
|
originatingAccountId: queued.originatingAccountId,
|
|
58967
58958
|
accountId: queued.run.agentAccountId
|
|
58968
58959
|
})
|
|
58969
|
-
})
|
|
58960
|
+
});
|
|
58961
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
58962
|
+
payloads: sanitizedPayloads,
|
|
58963
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
58964
|
+
replyToChannel
|
|
58965
|
+
});
|
|
58966
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
58967
|
+
payloads: filterMessagingToolDuplicates({
|
|
58968
|
+
payloads: replyTaggedPayloads,
|
|
58969
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
58970
|
+
}),
|
|
58971
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
58972
|
+
}) : replyTaggedPayloads;
|
|
58973
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
58970
58974
|
if (finalPayloads.length === 0) return;
|
|
58971
58975
|
if (autoCompactionCompleted) {
|
|
58972
58976
|
const count = await incrementRunCompactionCount({
|
|
@@ -52811,7 +52811,8 @@ async function buildReplyPayloads(params) {
|
|
|
52811
52811
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
52812
52812
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
52813
52813
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
52814
|
-
|
|
52814
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
52815
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
52815
52816
|
messageProvider: resolveOriginMessageProvider({
|
|
52816
52817
|
originatingChannel: params.originatingChannel,
|
|
52817
52818
|
provider: params.messageProvider
|
|
@@ -52820,7 +52821,7 @@ async function buildReplyPayloads(params) {
|
|
|
52820
52821
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
52821
52822
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
52822
52823
|
});
|
|
52823
|
-
const dedupeMessagingToolPayloads =
|
|
52824
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
52824
52825
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
52825
52826
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
52826
52827
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -52835,7 +52836,7 @@ async function buildReplyPayloads(params) {
|
|
|
52835
52836
|
}) : dedupedPayloads;
|
|
52836
52837
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
52837
52838
|
return {
|
|
52838
|
-
replyPayloads:
|
|
52839
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
52839
52840
|
didLogHeartbeatStrip
|
|
52840
52841
|
};
|
|
52841
52842
|
}
|
|
@@ -53218,18 +53219,8 @@ function createFollowupRunner(params) {
|
|
|
53218
53219
|
originatingChannel: queued.originatingChannel,
|
|
53219
53220
|
provider: queued.run.messageProvider
|
|
53220
53221
|
});
|
|
53221
|
-
|
|
53222
|
-
|
|
53223
|
-
payloads: applyReplyThreading({
|
|
53224
|
-
payloads: sanitizedPayloads,
|
|
53225
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
53226
|
-
replyToChannel
|
|
53227
|
-
}),
|
|
53228
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
53229
|
-
}),
|
|
53230
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
53231
|
-
});
|
|
53232
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
53222
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
53223
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
53233
53224
|
messageProvider: resolveOriginMessageProvider({
|
|
53234
53225
|
originatingChannel: queued.originatingChannel,
|
|
53235
53226
|
provider: queued.run.messageProvider
|
|
@@ -53240,7 +53231,20 @@ function createFollowupRunner(params) {
|
|
|
53240
53231
|
originatingAccountId: queued.originatingAccountId,
|
|
53241
53232
|
accountId: queued.run.agentAccountId
|
|
53242
53233
|
})
|
|
53243
|
-
})
|
|
53234
|
+
});
|
|
53235
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
53236
|
+
payloads: sanitizedPayloads,
|
|
53237
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
53238
|
+
replyToChannel
|
|
53239
|
+
});
|
|
53240
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
53241
|
+
payloads: filterMessagingToolDuplicates({
|
|
53242
|
+
payloads: replyTaggedPayloads,
|
|
53243
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
53244
|
+
}),
|
|
53245
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
53246
|
+
}) : replyTaggedPayloads;
|
|
53247
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
53244
53248
|
if (finalPayloads.length === 0) return;
|
|
53245
53249
|
if (autoCompactionCompleted) {
|
|
53246
53250
|
const count = await incrementRunCompactionCount({
|
|
@@ -52807,7 +52807,8 @@ async function buildReplyPayloads(params) {
|
|
|
52807
52807
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
52808
52808
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
52809
52809
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
52810
|
-
|
|
52810
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
52811
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
52811
52812
|
messageProvider: resolveOriginMessageProvider({
|
|
52812
52813
|
originatingChannel: params.originatingChannel,
|
|
52813
52814
|
provider: params.messageProvider
|
|
@@ -52816,7 +52817,7 @@ async function buildReplyPayloads(params) {
|
|
|
52816
52817
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
52817
52818
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
52818
52819
|
});
|
|
52819
|
-
const dedupeMessagingToolPayloads =
|
|
52820
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
52820
52821
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
52821
52822
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
52822
52823
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -52831,7 +52832,7 @@ async function buildReplyPayloads(params) {
|
|
|
52831
52832
|
}) : dedupedPayloads;
|
|
52832
52833
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
52833
52834
|
return {
|
|
52834
|
-
replyPayloads:
|
|
52835
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
52835
52836
|
didLogHeartbeatStrip
|
|
52836
52837
|
};
|
|
52837
52838
|
}
|
|
@@ -53214,18 +53215,8 @@ function createFollowupRunner(params) {
|
|
|
53214
53215
|
originatingChannel: queued.originatingChannel,
|
|
53215
53216
|
provider: queued.run.messageProvider
|
|
53216
53217
|
});
|
|
53217
|
-
|
|
53218
|
-
|
|
53219
|
-
payloads: applyReplyThreading({
|
|
53220
|
-
payloads: sanitizedPayloads,
|
|
53221
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
53222
|
-
replyToChannel
|
|
53223
|
-
}),
|
|
53224
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
53225
|
-
}),
|
|
53226
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
53227
|
-
});
|
|
53228
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
53218
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
53219
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
53229
53220
|
messageProvider: resolveOriginMessageProvider({
|
|
53230
53221
|
originatingChannel: queued.originatingChannel,
|
|
53231
53222
|
provider: queued.run.messageProvider
|
|
@@ -53236,7 +53227,20 @@ function createFollowupRunner(params) {
|
|
|
53236
53227
|
originatingAccountId: queued.originatingAccountId,
|
|
53237
53228
|
accountId: queued.run.agentAccountId
|
|
53238
53229
|
})
|
|
53239
|
-
})
|
|
53230
|
+
});
|
|
53231
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
53232
|
+
payloads: sanitizedPayloads,
|
|
53233
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
53234
|
+
replyToChannel
|
|
53235
|
+
});
|
|
53236
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
53237
|
+
payloads: filterMessagingToolDuplicates({
|
|
53238
|
+
payloads: replyTaggedPayloads,
|
|
53239
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
53240
|
+
}),
|
|
53241
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
53242
|
+
}) : replyTaggedPayloads;
|
|
53243
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
53240
53244
|
if (finalPayloads.length === 0) return;
|
|
53241
53245
|
if (autoCompactionCompleted) {
|
|
53242
53246
|
const count = await incrementRunCompactionCount({
|
|
@@ -1174,6 +1174,8 @@ function normalizeTextForComparison(text) {
|
|
|
1174
1174
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
1175
1175
|
}
|
|
1176
1176
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
1177
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
1178
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
1177
1179
|
if (normalizedSentTexts.length === 0) return false;
|
|
1178
1180
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
1179
1181
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -1182,9 +1184,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
1182
1184
|
});
|
|
1183
1185
|
}
|
|
1184
1186
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
1187
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
1188
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
1185
1189
|
if (sentTexts.length === 0) return false;
|
|
1186
1190
|
const normalized = normalizeTextForComparison(text);
|
|
1187
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
1188
1191
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
1189
1192
|
}
|
|
1190
1193
|
//#endregion
|
|
@@ -1174,6 +1174,8 @@ function normalizeTextForComparison(text) {
|
|
|
1174
1174
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
1175
1175
|
}
|
|
1176
1176
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
1177
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
1178
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
1177
1179
|
if (normalizedSentTexts.length === 0) return false;
|
|
1178
1180
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
1179
1181
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -1182,9 +1184,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
1182
1184
|
});
|
|
1183
1185
|
}
|
|
1184
1186
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
1187
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
1188
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
1185
1189
|
if (sentTexts.length === 0) return false;
|
|
1186
1190
|
const normalized = normalizeTextForComparison(text);
|
|
1187
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
1188
1191
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
1189
1192
|
}
|
|
1190
1193
|
//#endregion
|
|
@@ -9733,6 +9733,8 @@ function normalizeTextForComparison(text) {
|
|
|
9733
9733
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9734
9734
|
}
|
|
9735
9735
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9736
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9737
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9736
9738
|
if (normalizedSentTexts.length === 0) return false;
|
|
9737
9739
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9738
9740
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9741,9 +9743,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9741
9743
|
});
|
|
9742
9744
|
}
|
|
9743
9745
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9746
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9747
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9744
9748
|
if (sentTexts.length === 0) return false;
|
|
9745
9749
|
const normalized = normalizeTextForComparison(text);
|
|
9746
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9747
9750
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9748
9751
|
}
|
|
9749
9752
|
//#endregion
|
|
@@ -9736,6 +9736,8 @@ function normalizeTextForComparison(text) {
|
|
|
9736
9736
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9737
9737
|
}
|
|
9738
9738
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9739
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9740
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9739
9741
|
if (normalizedSentTexts.length === 0) return false;
|
|
9740
9742
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9741
9743
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9744,9 +9746,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9744
9746
|
});
|
|
9745
9747
|
}
|
|
9746
9748
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9749
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9750
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9747
9751
|
if (sentTexts.length === 0) return false;
|
|
9748
9752
|
const normalized = normalizeTextForComparison(text);
|
|
9749
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9750
9753
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9751
9754
|
}
|
|
9752
9755
|
//#endregion
|
|
@@ -100247,7 +100247,8 @@ async function buildReplyPayloads(params) {
|
|
|
100247
100247
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
100248
100248
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
100249
100249
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
100250
|
-
|
|
100250
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
100251
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
100251
100252
|
messageProvider: resolveOriginMessageProvider({
|
|
100252
100253
|
originatingChannel: params.originatingChannel,
|
|
100253
100254
|
provider: params.messageProvider
|
|
@@ -100256,7 +100257,7 @@ async function buildReplyPayloads(params) {
|
|
|
100256
100257
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
100257
100258
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
100258
100259
|
});
|
|
100259
|
-
const dedupeMessagingToolPayloads =
|
|
100260
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
100260
100261
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
100261
100262
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
100262
100263
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -100271,7 +100272,7 @@ async function buildReplyPayloads(params) {
|
|
|
100271
100272
|
}) : dedupedPayloads;
|
|
100272
100273
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
100273
100274
|
return {
|
|
100274
|
-
replyPayloads:
|
|
100275
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
100275
100276
|
didLogHeartbeatStrip
|
|
100276
100277
|
};
|
|
100277
100278
|
}
|
|
@@ -100654,18 +100655,8 @@ function createFollowupRunner(params) {
|
|
|
100654
100655
|
originatingChannel: queued.originatingChannel,
|
|
100655
100656
|
provider: queued.run.messageProvider
|
|
100656
100657
|
});
|
|
100657
|
-
|
|
100658
|
-
|
|
100659
|
-
payloads: applyReplyThreading({
|
|
100660
|
-
payloads: sanitizedPayloads,
|
|
100661
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100662
|
-
replyToChannel
|
|
100663
|
-
}),
|
|
100664
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100665
|
-
}),
|
|
100666
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100667
|
-
});
|
|
100668
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
100658
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
100659
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
100669
100660
|
messageProvider: resolveOriginMessageProvider({
|
|
100670
100661
|
originatingChannel: queued.originatingChannel,
|
|
100671
100662
|
provider: queued.run.messageProvider
|
|
@@ -100676,7 +100667,20 @@ function createFollowupRunner(params) {
|
|
|
100676
100667
|
originatingAccountId: queued.originatingAccountId,
|
|
100677
100668
|
accountId: queued.run.agentAccountId
|
|
100678
100669
|
})
|
|
100679
|
-
})
|
|
100670
|
+
});
|
|
100671
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
100672
|
+
payloads: sanitizedPayloads,
|
|
100673
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100674
|
+
replyToChannel
|
|
100675
|
+
});
|
|
100676
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
100677
|
+
payloads: filterMessagingToolDuplicates({
|
|
100678
|
+
payloads: replyTaggedPayloads,
|
|
100679
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100680
|
+
}),
|
|
100681
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100682
|
+
}) : replyTaggedPayloads;
|
|
100683
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
100680
100684
|
if (finalPayloads.length === 0) return;
|
|
100681
100685
|
if (autoCompactionCompleted) {
|
|
100682
100686
|
const count = await incrementRunCompactionCount({
|
|
@@ -100247,7 +100247,8 @@ async function buildReplyPayloads(params) {
|
|
|
100247
100247
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
100248
100248
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
100249
100249
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
100250
|
-
|
|
100250
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
100251
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
100251
100252
|
messageProvider: resolveOriginMessageProvider({
|
|
100252
100253
|
originatingChannel: params.originatingChannel,
|
|
100253
100254
|
provider: params.messageProvider
|
|
@@ -100256,7 +100257,7 @@ async function buildReplyPayloads(params) {
|
|
|
100256
100257
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
100257
100258
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
100258
100259
|
});
|
|
100259
|
-
const dedupeMessagingToolPayloads =
|
|
100260
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
100260
100261
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
100261
100262
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
100262
100263
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -100271,7 +100272,7 @@ async function buildReplyPayloads(params) {
|
|
|
100271
100272
|
}) : dedupedPayloads;
|
|
100272
100273
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
100273
100274
|
return {
|
|
100274
|
-
replyPayloads:
|
|
100275
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
100275
100276
|
didLogHeartbeatStrip
|
|
100276
100277
|
};
|
|
100277
100278
|
}
|
|
@@ -100654,18 +100655,8 @@ function createFollowupRunner(params) {
|
|
|
100654
100655
|
originatingChannel: queued.originatingChannel,
|
|
100655
100656
|
provider: queued.run.messageProvider
|
|
100656
100657
|
});
|
|
100657
|
-
|
|
100658
|
-
|
|
100659
|
-
payloads: applyReplyThreading({
|
|
100660
|
-
payloads: sanitizedPayloads,
|
|
100661
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100662
|
-
replyToChannel
|
|
100663
|
-
}),
|
|
100664
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100665
|
-
}),
|
|
100666
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100667
|
-
});
|
|
100668
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
100658
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
100659
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
100669
100660
|
messageProvider: resolveOriginMessageProvider({
|
|
100670
100661
|
originatingChannel: queued.originatingChannel,
|
|
100671
100662
|
provider: queued.run.messageProvider
|
|
@@ -100676,7 +100667,20 @@ function createFollowupRunner(params) {
|
|
|
100676
100667
|
originatingAccountId: queued.originatingAccountId,
|
|
100677
100668
|
accountId: queued.run.agentAccountId
|
|
100678
100669
|
})
|
|
100679
|
-
})
|
|
100670
|
+
});
|
|
100671
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
100672
|
+
payloads: sanitizedPayloads,
|
|
100673
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100674
|
+
replyToChannel
|
|
100675
|
+
});
|
|
100676
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
100677
|
+
payloads: filterMessagingToolDuplicates({
|
|
100678
|
+
payloads: replyTaggedPayloads,
|
|
100679
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100680
|
+
}),
|
|
100681
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100682
|
+
}) : replyTaggedPayloads;
|
|
100683
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
100680
100684
|
if (finalPayloads.length === 0) return;
|
|
100681
100685
|
if (autoCompactionCompleted) {
|
|
100682
100686
|
const count = await incrementRunCompactionCount({
|
|
@@ -100561,7 +100561,8 @@ async function buildReplyPayloads(params) {
|
|
|
100561
100561
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
100562
100562
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
100563
100563
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
100564
|
-
|
|
100564
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
100565
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
100565
100566
|
messageProvider: resolveOriginMessageProvider({
|
|
100566
100567
|
originatingChannel: params.originatingChannel,
|
|
100567
100568
|
provider: params.messageProvider
|
|
@@ -100570,7 +100571,7 @@ async function buildReplyPayloads(params) {
|
|
|
100570
100571
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
100571
100572
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
100572
100573
|
});
|
|
100573
|
-
const dedupeMessagingToolPayloads =
|
|
100574
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
100574
100575
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
100575
100576
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
100576
100577
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -100585,7 +100586,7 @@ async function buildReplyPayloads(params) {
|
|
|
100585
100586
|
}) : dedupedPayloads;
|
|
100586
100587
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
100587
100588
|
return {
|
|
100588
|
-
replyPayloads:
|
|
100589
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
100589
100590
|
didLogHeartbeatStrip
|
|
100590
100591
|
};
|
|
100591
100592
|
}
|
|
@@ -100968,18 +100969,8 @@ function createFollowupRunner(params) {
|
|
|
100968
100969
|
originatingChannel: queued.originatingChannel,
|
|
100969
100970
|
provider: queued.run.messageProvider
|
|
100970
100971
|
});
|
|
100971
|
-
|
|
100972
|
-
|
|
100973
|
-
payloads: applyReplyThreading({
|
|
100974
|
-
payloads: sanitizedPayloads,
|
|
100975
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100976
|
-
replyToChannel
|
|
100977
|
-
}),
|
|
100978
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100979
|
-
}),
|
|
100980
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100981
|
-
});
|
|
100982
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
100972
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
100973
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
100983
100974
|
messageProvider: resolveOriginMessageProvider({
|
|
100984
100975
|
originatingChannel: queued.originatingChannel,
|
|
100985
100976
|
provider: queued.run.messageProvider
|
|
@@ -100990,7 +100981,20 @@ function createFollowupRunner(params) {
|
|
|
100990
100981
|
originatingAccountId: queued.originatingAccountId,
|
|
100991
100982
|
accountId: queued.run.agentAccountId
|
|
100992
100983
|
})
|
|
100993
|
-
})
|
|
100984
|
+
});
|
|
100985
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
100986
|
+
payloads: sanitizedPayloads,
|
|
100987
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100988
|
+
replyToChannel
|
|
100989
|
+
});
|
|
100990
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
100991
|
+
payloads: filterMessagingToolDuplicates({
|
|
100992
|
+
payloads: replyTaggedPayloads,
|
|
100993
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100994
|
+
}),
|
|
100995
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100996
|
+
}) : replyTaggedPayloads;
|
|
100997
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
100994
100998
|
if (finalPayloads.length === 0) return;
|
|
100995
100999
|
if (autoCompactionCompleted) {
|
|
100996
101000
|
const count = await incrementRunCompactionCount({
|
|
@@ -100288,7 +100288,8 @@ async function buildReplyPayloads(params) {
|
|
|
100288
100288
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
100289
100289
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
100290
100290
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
100291
|
-
|
|
100291
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
100292
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
100292
100293
|
messageProvider: resolveOriginMessageProvider({
|
|
100293
100294
|
originatingChannel: params.originatingChannel,
|
|
100294
100295
|
provider: params.messageProvider
|
|
@@ -100297,7 +100298,7 @@ async function buildReplyPayloads(params) {
|
|
|
100297
100298
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
100298
100299
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
100299
100300
|
});
|
|
100300
|
-
const dedupeMessagingToolPayloads =
|
|
100301
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
100301
100302
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
100302
100303
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
100303
100304
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -100312,7 +100313,7 @@ async function buildReplyPayloads(params) {
|
|
|
100312
100313
|
}) : dedupedPayloads;
|
|
100313
100314
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
100314
100315
|
return {
|
|
100315
|
-
replyPayloads:
|
|
100316
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
100316
100317
|
didLogHeartbeatStrip
|
|
100317
100318
|
};
|
|
100318
100319
|
}
|
|
@@ -100695,18 +100696,8 @@ function createFollowupRunner(params) {
|
|
|
100695
100696
|
originatingChannel: queued.originatingChannel,
|
|
100696
100697
|
provider: queued.run.messageProvider
|
|
100697
100698
|
});
|
|
100698
|
-
|
|
100699
|
-
|
|
100700
|
-
payloads: applyReplyThreading({
|
|
100701
|
-
payloads: sanitizedPayloads,
|
|
100702
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100703
|
-
replyToChannel
|
|
100704
|
-
}),
|
|
100705
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100706
|
-
}),
|
|
100707
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100708
|
-
});
|
|
100709
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
100699
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
100700
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
100710
100701
|
messageProvider: resolveOriginMessageProvider({
|
|
100711
100702
|
originatingChannel: queued.originatingChannel,
|
|
100712
100703
|
provider: queued.run.messageProvider
|
|
@@ -100717,7 +100708,20 @@ function createFollowupRunner(params) {
|
|
|
100717
100708
|
originatingAccountId: queued.originatingAccountId,
|
|
100718
100709
|
accountId: queued.run.agentAccountId
|
|
100719
100710
|
})
|
|
100720
|
-
})
|
|
100711
|
+
});
|
|
100712
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
100713
|
+
payloads: sanitizedPayloads,
|
|
100714
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100715
|
+
replyToChannel
|
|
100716
|
+
});
|
|
100717
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
100718
|
+
payloads: filterMessagingToolDuplicates({
|
|
100719
|
+
payloads: replyTaggedPayloads,
|
|
100720
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100721
|
+
}),
|
|
100722
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100723
|
+
}) : replyTaggedPayloads;
|
|
100724
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
100721
100725
|
if (finalPayloads.length === 0) return;
|
|
100722
100726
|
if (autoCompactionCompleted) {
|
|
100723
100727
|
const count = await incrementRunCompactionCount({
|
|
@@ -100247,7 +100247,8 @@ async function buildReplyPayloads(params) {
|
|
|
100247
100247
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
100248
100248
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
100249
100249
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
100250
|
-
|
|
100250
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
100251
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
100251
100252
|
messageProvider: resolveOriginMessageProvider({
|
|
100252
100253
|
originatingChannel: params.originatingChannel,
|
|
100253
100254
|
provider: params.messageProvider
|
|
@@ -100256,7 +100257,7 @@ async function buildReplyPayloads(params) {
|
|
|
100256
100257
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
100257
100258
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
100258
100259
|
});
|
|
100259
|
-
const dedupeMessagingToolPayloads =
|
|
100260
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
100260
100261
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
100261
100262
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
100262
100263
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -100271,7 +100272,7 @@ async function buildReplyPayloads(params) {
|
|
|
100271
100272
|
}) : dedupedPayloads;
|
|
100272
100273
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
100273
100274
|
return {
|
|
100274
|
-
replyPayloads:
|
|
100275
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
100275
100276
|
didLogHeartbeatStrip
|
|
100276
100277
|
};
|
|
100277
100278
|
}
|
|
@@ -100654,18 +100655,8 @@ function createFollowupRunner(params) {
|
|
|
100654
100655
|
originatingChannel: queued.originatingChannel,
|
|
100655
100656
|
provider: queued.run.messageProvider
|
|
100656
100657
|
});
|
|
100657
|
-
|
|
100658
|
-
|
|
100659
|
-
payloads: applyReplyThreading({
|
|
100660
|
-
payloads: sanitizedPayloads,
|
|
100661
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100662
|
-
replyToChannel
|
|
100663
|
-
}),
|
|
100664
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100665
|
-
}),
|
|
100666
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100667
|
-
});
|
|
100668
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
100658
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
100659
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
100669
100660
|
messageProvider: resolveOriginMessageProvider({
|
|
100670
100661
|
originatingChannel: queued.originatingChannel,
|
|
100671
100662
|
provider: queued.run.messageProvider
|
|
@@ -100676,7 +100667,20 @@ function createFollowupRunner(params) {
|
|
|
100676
100667
|
originatingAccountId: queued.originatingAccountId,
|
|
100677
100668
|
accountId: queued.run.agentAccountId
|
|
100678
100669
|
})
|
|
100679
|
-
})
|
|
100670
|
+
});
|
|
100671
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
100672
|
+
payloads: sanitizedPayloads,
|
|
100673
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
100674
|
+
replyToChannel
|
|
100675
|
+
});
|
|
100676
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
100677
|
+
payloads: filterMessagingToolDuplicates({
|
|
100678
|
+
payloads: replyTaggedPayloads,
|
|
100679
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
100680
|
+
}),
|
|
100681
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
100682
|
+
}) : replyTaggedPayloads;
|
|
100683
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
100680
100684
|
if (finalPayloads.length === 0) return;
|
|
100681
100685
|
if (autoCompactionCompleted) {
|
|
100682
100686
|
const count = await incrementRunCompactionCount({
|
|
@@ -9730,6 +9730,8 @@ function normalizeTextForComparison(text) {
|
|
|
9730
9730
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9731
9731
|
}
|
|
9732
9732
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9733
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9734
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9733
9735
|
if (normalizedSentTexts.length === 0) return false;
|
|
9734
9736
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9735
9737
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9738,9 +9740,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9738
9740
|
});
|
|
9739
9741
|
}
|
|
9740
9742
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9743
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9744
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9741
9745
|
if (sentTexts.length === 0) return false;
|
|
9742
9746
|
const normalized = normalizeTextForComparison(text);
|
|
9743
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9744
9747
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9745
9748
|
}
|
|
9746
9749
|
//#endregion
|
|
@@ -9730,6 +9730,8 @@ function normalizeTextForComparison(text) {
|
|
|
9730
9730
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9731
9731
|
}
|
|
9732
9732
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9733
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9734
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9733
9735
|
if (normalizedSentTexts.length === 0) return false;
|
|
9734
9736
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9735
9737
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9738,9 +9740,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9738
9740
|
});
|
|
9739
9741
|
}
|
|
9740
9742
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9743
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9744
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9741
9745
|
if (sentTexts.length === 0) return false;
|
|
9742
9746
|
const normalized = normalizeTextForComparison(text);
|
|
9743
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9744
9747
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9745
9748
|
}
|
|
9746
9749
|
//#endregion
|
|
@@ -9730,6 +9730,8 @@ function normalizeTextForComparison(text) {
|
|
|
9730
9730
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9731
9731
|
}
|
|
9732
9732
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9733
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9734
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9733
9735
|
if (normalizedSentTexts.length === 0) return false;
|
|
9734
9736
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9735
9737
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9738,9 +9740,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9738
9740
|
});
|
|
9739
9741
|
}
|
|
9740
9742
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9743
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9744
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9741
9745
|
if (sentTexts.length === 0) return false;
|
|
9742
9746
|
const normalized = normalizeTextForComparison(text);
|
|
9743
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9744
9747
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9745
9748
|
}
|
|
9746
9749
|
//#endregion
|
|
@@ -9730,6 +9730,8 @@ function normalizeTextForComparison(text) {
|
|
|
9730
9730
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9731
9731
|
}
|
|
9732
9732
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9733
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9734
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9733
9735
|
if (normalizedSentTexts.length === 0) return false;
|
|
9734
9736
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9735
9737
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9738,9 +9740,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9738
9740
|
});
|
|
9739
9741
|
}
|
|
9740
9742
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9743
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9744
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9741
9745
|
if (sentTexts.length === 0) return false;
|
|
9742
9746
|
const normalized = normalizeTextForComparison(text);
|
|
9743
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9744
9747
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9745
9748
|
}
|
|
9746
9749
|
//#endregion
|
|
@@ -9730,6 +9730,8 @@ function normalizeTextForComparison(text) {
|
|
|
9730
9730
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9731
9731
|
}
|
|
9732
9732
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9733
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9734
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9733
9735
|
if (normalizedSentTexts.length === 0) return false;
|
|
9734
9736
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9735
9737
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9738,9 +9740,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9738
9740
|
});
|
|
9739
9741
|
}
|
|
9740
9742
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9743
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9744
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9741
9745
|
if (sentTexts.length === 0) return false;
|
|
9742
9746
|
const normalized = normalizeTextForComparison(text);
|
|
9743
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9744
9747
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9745
9748
|
}
|
|
9746
9749
|
//#endregion
|
|
@@ -9723,6 +9723,8 @@ function normalizeTextForComparison(text) {
|
|
|
9723
9723
|
return text.trim().toLowerCase().replace(/\p{Emoji_Presentation}|\p{Extended_Pictographic}/gu, "").replace(/\s+/g, " ").trim();
|
|
9724
9724
|
}
|
|
9725
9725
|
function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
9726
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: exact repeats (including short replies) are duplicates; short substrings are not.
|
|
9727
|
+
if (normalized && normalizedSentTexts.includes(normalized)) return true;
|
|
9726
9728
|
if (normalizedSentTexts.length === 0) return false;
|
|
9727
9729
|
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9728
9730
|
return normalizedSentTexts.some((normalizedSent) => {
|
|
@@ -9731,9 +9733,10 @@ function isMessagingToolDuplicateNormalized(normalized, normalizedSentTexts) {
|
|
|
9731
9733
|
});
|
|
9732
9734
|
}
|
|
9733
9735
|
function isMessagingToolDuplicate(text, sentTexts) {
|
|
9736
|
+
// Preserve exact emoji-only repeats too: comparison normalization removes emoji.
|
|
9737
|
+
if (text.trim() && sentTexts.some((sent) => sent.trim() === text.trim())) return true;
|
|
9734
9738
|
if (sentTexts.length === 0) return false;
|
|
9735
9739
|
const normalized = normalizeTextForComparison(text);
|
|
9736
|
-
if (!normalized || normalized.length < MIN_DUPLICATE_TEXT_LENGTH) return false;
|
|
9737
9740
|
return isMessagingToolDuplicateNormalized(normalized, sentTexts.map(normalizeTextForComparison));
|
|
9738
9741
|
}
|
|
9739
9742
|
//#endregion
|
|
@@ -101381,7 +101381,8 @@ async function buildReplyPayloads(params) {
|
|
|
101381
101381
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
101382
101382
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
101383
101383
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
101384
|
-
|
|
101384
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
101385
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
101385
101386
|
messageProvider: resolveOriginMessageProvider({
|
|
101386
101387
|
originatingChannel: params.originatingChannel,
|
|
101387
101388
|
provider: params.messageProvider
|
|
@@ -101390,7 +101391,7 @@ async function buildReplyPayloads(params) {
|
|
|
101390
101391
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
101391
101392
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
101392
101393
|
});
|
|
101393
|
-
const dedupeMessagingToolPayloads =
|
|
101394
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
101394
101395
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
101395
101396
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
101396
101397
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -101405,7 +101406,7 @@ async function buildReplyPayloads(params) {
|
|
|
101405
101406
|
}) : dedupedPayloads;
|
|
101406
101407
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
101407
101408
|
return {
|
|
101408
|
-
replyPayloads:
|
|
101409
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
101409
101410
|
didLogHeartbeatStrip
|
|
101410
101411
|
};
|
|
101411
101412
|
}
|
|
@@ -101788,18 +101789,8 @@ function createFollowupRunner(params) {
|
|
|
101788
101789
|
originatingChannel: queued.originatingChannel,
|
|
101789
101790
|
provider: queued.run.messageProvider
|
|
101790
101791
|
});
|
|
101791
|
-
|
|
101792
|
-
|
|
101793
|
-
payloads: applyReplyThreading({
|
|
101794
|
-
payloads: sanitizedPayloads,
|
|
101795
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
101796
|
-
replyToChannel
|
|
101797
|
-
}),
|
|
101798
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
101799
|
-
}),
|
|
101800
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
101801
|
-
});
|
|
101802
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
101792
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
101793
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
101803
101794
|
messageProvider: resolveOriginMessageProvider({
|
|
101804
101795
|
originatingChannel: queued.originatingChannel,
|
|
101805
101796
|
provider: queued.run.messageProvider
|
|
@@ -101810,7 +101801,20 @@ function createFollowupRunner(params) {
|
|
|
101810
101801
|
originatingAccountId: queued.originatingAccountId,
|
|
101811
101802
|
accountId: queued.run.agentAccountId
|
|
101812
101803
|
})
|
|
101813
|
-
})
|
|
101804
|
+
});
|
|
101805
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
101806
|
+
payloads: sanitizedPayloads,
|
|
101807
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
101808
|
+
replyToChannel
|
|
101809
|
+
});
|
|
101810
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
101811
|
+
payloads: filterMessagingToolDuplicates({
|
|
101812
|
+
payloads: replyTaggedPayloads,
|
|
101813
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
101814
|
+
}),
|
|
101815
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
101816
|
+
}) : replyTaggedPayloads;
|
|
101817
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
101814
101818
|
if (finalPayloads.length === 0) return;
|
|
101815
101819
|
if (autoCompactionCompleted) {
|
|
101816
101820
|
const count = await incrementRunCompactionCount({
|
package/dist/reply-C5LKjXcC.js
CHANGED
|
@@ -93266,7 +93266,8 @@ async function buildReplyPayloads(params) {
|
|
|
93266
93266
|
const shouldDropFinalPayloads = params.blockStreamingEnabled && Boolean(params.blockReplyPipeline?.didStream()) && !params.blockReplyPipeline?.isAborted();
|
|
93267
93267
|
const messagingToolSentTexts = params.messagingToolSentTexts ?? [];
|
|
93268
93268
|
const messagingToolSentTargets = params.messagingToolSentTargets ?? [];
|
|
93269
|
-
|
|
93269
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: matching a destination scopes dedupe; it is not a reason to discard a new answer.
|
|
93270
|
+
const hasMessagingToolSendToOrigin = shouldSuppressMessagingToolReplies({
|
|
93270
93271
|
messageProvider: resolveOriginMessageProvider({
|
|
93271
93272
|
originatingChannel: params.originatingChannel,
|
|
93272
93273
|
provider: params.messageProvider
|
|
@@ -93275,7 +93276,7 @@ async function buildReplyPayloads(params) {
|
|
|
93275
93276
|
originatingTo: resolveOriginMessageTo({ originatingTo: params.originatingTo }),
|
|
93276
93277
|
accountId: resolveOriginAccountId({ originatingAccountId: params.accountId })
|
|
93277
93278
|
});
|
|
93278
|
-
const dedupeMessagingToolPayloads =
|
|
93279
|
+
const dedupeMessagingToolPayloads = hasMessagingToolSendToOrigin || messagingToolSentTargets.length === 0;
|
|
93279
93280
|
const messagingToolSentMediaUrls = dedupeMessagingToolPayloads ? await normalizeSentMediaUrlsForDedupe({
|
|
93280
93281
|
sentMediaUrls: params.messagingToolSentMediaUrls ?? [],
|
|
93281
93282
|
normalizeMediaPaths: params.normalizeMediaPaths
|
|
@@ -93290,7 +93291,7 @@ async function buildReplyPayloads(params) {
|
|
|
93290
93291
|
}) : dedupedPayloads;
|
|
93291
93292
|
const filteredPayloads = shouldDropFinalPayloads ? [] : params.blockStreamingEnabled ? mediaFilteredPayloads.filter((payload) => !params.blockReplyPipeline?.hasSentPayload(payload)) : params.directlySentBlockKeys?.size ? mediaFilteredPayloads.filter((payload) => !params.directlySentBlockKeys.has(createBlockReplyPayloadKey(payload))) : mediaFilteredPayloads;
|
|
93292
93293
|
return {
|
|
93293
|
-
replyPayloads:
|
|
93294
|
+
replyPayloads: filteredPayloads.filter(isRenderablePayload),
|
|
93294
93295
|
didLogHeartbeatStrip
|
|
93295
93296
|
};
|
|
93296
93297
|
}
|
|
@@ -93673,18 +93674,8 @@ function createFollowupRunner(params) {
|
|
|
93673
93674
|
originatingChannel: queued.originatingChannel,
|
|
93674
93675
|
provider: queued.run.messageProvider
|
|
93675
93676
|
});
|
|
93676
|
-
|
|
93677
|
-
|
|
93678
|
-
payloads: applyReplyThreading({
|
|
93679
|
-
payloads: sanitizedPayloads,
|
|
93680
|
-
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
93681
|
-
replyToChannel
|
|
93682
|
-
}),
|
|
93683
|
-
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
93684
|
-
}),
|
|
93685
|
-
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
93686
|
-
});
|
|
93687
|
-
const finalPayloads = shouldSuppressMessagingToolReplies({
|
|
93677
|
+
// JOHNNESS_PATCH_TOOL_FOLLOWUP_85: queued runs use content dedupe, never destination-wide suppression.
|
|
93678
|
+
const dedupeMessagingToolPayloads = (runResult.messagingToolSentTargets?.length ?? 0) === 0 || shouldSuppressMessagingToolReplies({
|
|
93688
93679
|
messageProvider: resolveOriginMessageProvider({
|
|
93689
93680
|
originatingChannel: queued.originatingChannel,
|
|
93690
93681
|
provider: queued.run.messageProvider
|
|
@@ -93695,7 +93686,20 @@ function createFollowupRunner(params) {
|
|
|
93695
93686
|
originatingAccountId: queued.originatingAccountId,
|
|
93696
93687
|
accountId: queued.run.agentAccountId
|
|
93697
93688
|
})
|
|
93698
|
-
})
|
|
93689
|
+
});
|
|
93690
|
+
const replyTaggedPayloads = applyReplyThreading({
|
|
93691
|
+
payloads: sanitizedPayloads,
|
|
93692
|
+
replyToMode: resolveReplyToMode(queued.run.config, replyToChannel, queued.originatingAccountId, queued.originatingChatType),
|
|
93693
|
+
replyToChannel
|
|
93694
|
+
});
|
|
93695
|
+
const mediaFilteredPayloads = dedupeMessagingToolPayloads ? filterMessagingToolMediaDuplicates({
|
|
93696
|
+
payloads: filterMessagingToolDuplicates({
|
|
93697
|
+
payloads: replyTaggedPayloads,
|
|
93698
|
+
sentTexts: runResult.messagingToolSentTexts ?? []
|
|
93699
|
+
}),
|
|
93700
|
+
sentMediaUrls: runResult.messagingToolSentMediaUrls ?? []
|
|
93701
|
+
}) : replyTaggedPayloads;
|
|
93702
|
+
const finalPayloads = mediaFilteredPayloads.filter(isRenderablePayload);
|
|
93699
93703
|
if (finalPayloads.length === 0) return;
|
|
93700
93704
|
if (autoCompactionCompleted) {
|
|
93701
93705
|
const count = await incrementRunCompactionCount({
|
package/docs/PATCHES.md
CHANGED
|
@@ -17,6 +17,8 @@ they predate ~2026-06-06).
|
|
|
17
17
|
|
|
18
18
|
## Index
|
|
19
19
|
|
|
20
|
+
Current addition: [85 - Distinct final replies after messaging-tool sends](#85--distinct-final-replies-after-messaging-tool-sends-2026-10-16).
|
|
21
|
+
|
|
20
22
|
Family 01 is retired. Families 02 through 41, 43 through 81, including the 65.1 amendment, are live on `main`; the `latest` and `extended` release lines converged at 2026.9.24. Family 42 is omitted; native Codex OAuth ownership is Family 58.
|
|
21
23
|
|
|
22
24
|
1. **01, announce queue TTL, retired:** Removed the five-minute age filter that could discard delayed sub-agent completion announcements. [Details](#01--announce-ttl-retired-2026-07-30)
|
|
@@ -2912,3 +2914,35 @@ The 2026-10-12 detection (`/tmp/detect-20261012/REPORT.md`) found five callable
|
|
|
2912
2914
|
- **Tool**: per-model quality/size/ratio/mask/input/prompt validation (the default primary's rules when no model is given); each fallback candidate re-validated and skipped with `params:` if it cannot honour the request; unknown providers fail closed instead of going to api.openai.com; response MIME from magic bytes.
|
|
2913
2915
|
- **Checks**: verifier 62.19/63.10/83.8 now assert the master-driven chain, 84.1-84.4 new; `tests/image-models-84.test.mjs` (21 tests).
|
|
2914
2916
|
- Roll back with `npm i -g johns-harness@2026.9.41`.
|
|
2917
|
+
|
|
2918
|
+
## 85 - Distinct final replies after messaging-tool sends (2026-10-16)
|
|
2919
|
+
|
|
2920
|
+
A successful `message.send` to the inbound route used to suppress **all** final
|
|
2921
|
+
payloads, independent of their content. This included captionless file sends.
|
|
2922
|
+
Telegram showed the new final text as a streaming preview, but no final payload
|
|
2923
|
+
reached the lane finalizer. Its normal cleanup deleted that unfinalized preview.
|
|
2924
|
+
This was a payload-selection bug, not a reason to disable preview cleanup.
|
|
2925
|
+
|
|
2926
|
+
All ten reply/dispatch bundles now use the existing destination matcher only to
|
|
2927
|
+
scope content deduplication. A distinct final answer is delivered normally, in
|
|
2928
|
+
both direct and queued follow-up runs. Actual repeated text and media are still
|
|
2929
|
+
filtered; empty media-only remnants are dropped. Queued dedupe also respects a
|
|
2930
|
+
different chat, Telegram topic, channel or account, as the direct path does.
|
|
2931
|
+
All ten comparison-helper copies recognize exact short repeats (and the final
|
|
2932
|
+
filter recognizes exact emoji-only repeats) without treating short substrings
|
|
2933
|
+
as duplicates. Existing long-text normalization/substring matching is preserved.
|
|
2934
|
+
`NO_REPLY` and block-streamed output still use their existing suppression paths.
|
|
2935
|
+
No Telegram deletion/lifecycle code was changed: delivered tool messages are
|
|
2936
|
+
never cleanup targets, and new final answers now finalize their own preview.
|
|
2937
|
+
|
|
2938
|
+
**Replay:** `python3 scripts/patch-tool-followup-85.py [root] [--check]` validates
|
|
2939
|
+
all exact hunks before writing; `--present-only` supports historical fixtures.
|
|
2940
|
+
Family 67's historical checks reverse only these reviewed edits, and fixture
|
|
2941
|
+
replay applies them last. The verifier checks all 20 runtime copies.
|
|
2942
|
+
|
|
2943
|
+
**Regression:** `tests/messaging-tool-followup.test.mjs` executes payload
|
|
2944
|
+
selection from every reply bundle, both queue/direct paths, and the real Telegram
|
|
2945
|
+
dispatcher/finalizer with a fake transport. It reproduces legacy disappearance
|
|
2946
|
+
and proves the fixed preview survives, checks streaming off, two document sends,
|
|
2947
|
+
captioned media, duplicate text/media, short/emoji repeats, destination isolation,
|
|
2948
|
+
NO_REPLY, failed sends, block streaming, exact replay, idempotence and drift refusal.
|