@whanext/core 0.19.13 → 0.19.14
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 +5 -0
- package/dist/index.js +9 -114
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.19.14
|
|
4
|
+
|
|
5
|
+
- Removed the temporary end-to-end AntiEdit diagnostic instrumentation after confirming the group-author identity fix in production.
|
|
6
|
+
- Normal edit handling remains quiet apart from the existing standard error and recovery logs.
|
|
7
|
+
|
|
3
8
|
## 0.19.13
|
|
4
9
|
|
|
5
10
|
- Group edits now preserve the original message author's participant identities instead of replacing them with identities carried by the edit-addon envelope.
|
package/dist/index.js
CHANGED
|
@@ -3112,13 +3112,6 @@ var ZapoProvider = class {
|
|
|
3112
3112
|
client.on("message", (event) => {
|
|
3113
3113
|
const protocol = this.#protocolMessage(event);
|
|
3114
3114
|
if (protocol && this.#isMessageMutationProtocol(protocol.type)) {
|
|
3115
|
-
if (protocol.type === proto.Message.ProtocolMessage.Type.MESSAGE_EDIT) {
|
|
3116
|
-
this.#logEditDiagnostic("received_message_protocol_payload", {
|
|
3117
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3118
|
-
targetMessageId: protocol.key?.id ?? void 0,
|
|
3119
|
-
offline: event.offline === true
|
|
3120
|
-
});
|
|
3121
|
-
}
|
|
3122
3115
|
this.#enqueueProtocolEvent({
|
|
3123
3116
|
...event,
|
|
3124
3117
|
protocolMessage: protocol
|
|
@@ -3127,11 +3120,6 @@ var ZapoProvider = class {
|
|
|
3127
3120
|
}
|
|
3128
3121
|
const directEdit = this.#directEditedMessage(event.message);
|
|
3129
3122
|
if (directEdit && event.key.id) {
|
|
3130
|
-
this.#logEditDiagnostic("received_direct_edited_message", {
|
|
3131
|
-
eventMessageId: event.key.id,
|
|
3132
|
-
targetMessageId: event.key.id,
|
|
3133
|
-
offline: event.offline === true
|
|
3134
|
-
});
|
|
3135
3123
|
this.#enqueueProtocolEvent({
|
|
3136
3124
|
...event,
|
|
3137
3125
|
protocolMessage: {
|
|
@@ -3142,14 +3130,6 @@ var ZapoProvider = class {
|
|
|
3142
3130
|
});
|
|
3143
3131
|
return;
|
|
3144
3132
|
}
|
|
3145
|
-
const encryptedEdit = this.#encryptedEditInfo(event.message);
|
|
3146
|
-
if (encryptedEdit) {
|
|
3147
|
-
this.#logEditDiagnostic("received_encrypted_addon", {
|
|
3148
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3149
|
-
targetMessageId: encryptedEdit.targetMessageId,
|
|
3150
|
-
offline: event.offline === true
|
|
3151
|
-
});
|
|
3152
|
-
}
|
|
3153
3133
|
this.#handleMessage(event);
|
|
3154
3134
|
});
|
|
3155
3135
|
client.on("message_send", (event) => {
|
|
@@ -3165,13 +3145,6 @@ var ZapoProvider = class {
|
|
|
3165
3145
|
});
|
|
3166
3146
|
});
|
|
3167
3147
|
client.on("message_protocol", (event) => {
|
|
3168
|
-
if (event.protocolMessage.type === proto.Message.ProtocolMessage.Type.MESSAGE_EDIT) {
|
|
3169
|
-
this.#logEditDiagnostic("received_message_protocol_event", {
|
|
3170
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3171
|
-
targetMessageId: event.protocolMessage.key?.id ?? void 0,
|
|
3172
|
-
offline: event.offline === true
|
|
3173
|
-
});
|
|
3174
|
-
}
|
|
3175
3148
|
this.#enqueueProtocolEvent(event);
|
|
3176
3149
|
});
|
|
3177
3150
|
client.on("message_addon", (event) => {
|
|
@@ -3229,29 +3202,10 @@ var ZapoProvider = class {
|
|
|
3229
3202
|
const kind = event.kind ?? this.#stringField(decrypted, "kind") ?? this.#stringField(decrypted, "type");
|
|
3230
3203
|
const isEdit = kind === "message_edit" || protocol?.type === proto.Message.ProtocolMessage.Type.MESSAGE_EDIT;
|
|
3231
3204
|
if (!isEdit) return;
|
|
3232
|
-
this.#logEditDiagnostic("received_decrypted_addon", {
|
|
3233
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3234
|
-
targetMessageId: event.targetMessageId ?? this.#stringField(decrypted, "targetMessageId") ?? this.#stringField(decrypted, "targetMessageID") ?? protocol?.key?.id ?? void 0,
|
|
3235
|
-
addonKind: kind ?? void 0,
|
|
3236
|
-
offline: event.offline === true
|
|
3237
|
-
});
|
|
3238
3205
|
const targetMessageId = event.targetMessageId ?? this.#stringField(decrypted, "targetMessageId") ?? this.#stringField(decrypted, "targetMessageID") ?? protocol?.key?.id ?? void 0;
|
|
3239
|
-
if (!targetMessageId)
|
|
3240
|
-
this.#logEditDiagnostic("dropped_addon_without_target", {
|
|
3241
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3242
|
-
addonKind: kind ?? void 0
|
|
3243
|
-
}, "warn");
|
|
3244
|
-
return;
|
|
3245
|
-
}
|
|
3206
|
+
if (!targetMessageId) return;
|
|
3246
3207
|
const editedMessage = protocol?.editedMessage ?? this.#addonEditedMessage(event.decrypted);
|
|
3247
|
-
if (!editedMessage)
|
|
3248
|
-
this.#logEditDiagnostic("dropped_addon_without_edited_content", {
|
|
3249
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3250
|
-
targetMessageId,
|
|
3251
|
-
addonKind: kind ?? void 0
|
|
3252
|
-
}, "warn");
|
|
3253
|
-
return;
|
|
3254
|
-
}
|
|
3208
|
+
if (!editedMessage) return;
|
|
3255
3209
|
const protocolKey = protocol?.key;
|
|
3256
3210
|
const target = {
|
|
3257
3211
|
...protocolKey ?? {},
|
|
@@ -3334,24 +3288,6 @@ var ZapoProvider = class {
|
|
|
3334
3288
|
const nested = message.ephemeralMessage?.message ?? message.deviceSentMessage?.message;
|
|
3335
3289
|
return nested ? this.#directEditedMessage(nested) : void 0;
|
|
3336
3290
|
}
|
|
3337
|
-
#encryptedEditInfo(message) {
|
|
3338
|
-
const content = unwrapZapoMessageContent(message);
|
|
3339
|
-
const encrypted = content?.secretEncryptedMessage;
|
|
3340
|
-
if (!encrypted) return void 0;
|
|
3341
|
-
if (encrypted.secretEncType !== proto.Message.SecretEncryptedMessage.SecretEncType.MESSAGE_EDIT) {
|
|
3342
|
-
return void 0;
|
|
3343
|
-
}
|
|
3344
|
-
return {
|
|
3345
|
-
...encrypted.targetMessageKey?.id ? { targetMessageId: encrypted.targetMessageKey.id } : {}
|
|
3346
|
-
};
|
|
3347
|
-
}
|
|
3348
|
-
#logEditDiagnostic(stage, context, level = "info") {
|
|
3349
|
-
this.#logger[level]("AntiEdit diagnostic", {
|
|
3350
|
-
diagnostic: "antiedit",
|
|
3351
|
-
stage,
|
|
3352
|
-
...context
|
|
3353
|
-
});
|
|
3354
|
-
}
|
|
3355
3291
|
#protocolMessage(event) {
|
|
3356
3292
|
if (event.protocolMessage) return event.protocolMessage;
|
|
3357
3293
|
const content = unwrapZapoMessageContent(event.message);
|
|
@@ -3389,15 +3325,10 @@ var ZapoProvider = class {
|
|
|
3389
3325
|
if (!protocol || !this.#isMessageMutationProtocol(protocol.type)) return;
|
|
3390
3326
|
const protocolKey = protocol.key;
|
|
3391
3327
|
if (!protocolKey?.id) {
|
|
3392
|
-
|
|
3328
|
+
this.#logger.debug("Ignored Zapo protocol mutation without a target message id.", {
|
|
3393
3329
|
messageId: event.key.id ?? void 0,
|
|
3394
3330
|
protocolType: protocol.type ?? void 0
|
|
3395
|
-
};
|
|
3396
|
-
if (protocol.type === proto.Message.ProtocolMessage.Type.MESSAGE_EDIT) {
|
|
3397
|
-
this.#logEditDiagnostic("dropped_protocol_without_target", context, "warn");
|
|
3398
|
-
} else {
|
|
3399
|
-
this.#logger.debug("Ignored Zapo protocol mutation without a target message id.", context);
|
|
3400
|
-
}
|
|
3331
|
+
});
|
|
3401
3332
|
return;
|
|
3402
3333
|
}
|
|
3403
3334
|
const remoteJid = protocolKey.remoteJid ?? event.key.remoteJid;
|
|
@@ -3412,16 +3343,7 @@ var ZapoProvider = class {
|
|
|
3412
3343
|
const stored = await this.#findStoredMessage(target);
|
|
3413
3344
|
if (stored) target = this.#targetKeyFromStoredMessage(target, stored.key);
|
|
3414
3345
|
if (!target.remoteJid && stored?.key.remoteJid) target.remoteJid = stored.key.remoteJid;
|
|
3415
|
-
if (!target.remoteJid)
|
|
3416
|
-
if (protocol.type === proto.Message.ProtocolMessage.Type.MESSAGE_EDIT) {
|
|
3417
|
-
this.#logEditDiagnostic("dropped_edit_without_chat", {
|
|
3418
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3419
|
-
targetMessageId: target.id ?? void 0,
|
|
3420
|
-
previousRecovered: stored !== void 0
|
|
3421
|
-
}, "warn");
|
|
3422
|
-
}
|
|
3423
|
-
return;
|
|
3424
|
-
}
|
|
3346
|
+
if (!target.remoteJid) return;
|
|
3425
3347
|
const type = protocol.type;
|
|
3426
3348
|
const mutationKey = this.#protocolDeliveryKey(event, target, type);
|
|
3427
3349
|
if (mutationKey && this.#handledProtocolStore.has(mutationKey)) {
|
|
@@ -3452,13 +3374,7 @@ var ZapoProvider = class {
|
|
|
3452
3374
|
return;
|
|
3453
3375
|
}
|
|
3454
3376
|
const editedContent = protocol.editedMessage ? this.#unwrapEditedContent(protocol.editedMessage) : void 0;
|
|
3455
|
-
if (!editedContent)
|
|
3456
|
-
this.#logEditDiagnostic("dropped_edit_without_content", {
|
|
3457
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3458
|
-
targetMessageId: target.id ?? void 0
|
|
3459
|
-
}, "warn");
|
|
3460
|
-
return;
|
|
3461
|
-
}
|
|
3377
|
+
if (!editedContent) return;
|
|
3462
3378
|
const pushName = event.pushName ?? stored?.pushName;
|
|
3463
3379
|
const edited = {
|
|
3464
3380
|
...stored ?? {},
|
|
@@ -3471,31 +3387,18 @@ var ZapoProvider = class {
|
|
|
3471
3387
|
...pushName !== void 0 ? { pushName } : {}
|
|
3472
3388
|
};
|
|
3473
3389
|
const message = normalizeZapoMessage(edited);
|
|
3474
|
-
if (!message)
|
|
3475
|
-
this.#logEditDiagnostic("dropped_edit_normalization_failed", {
|
|
3476
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3477
|
-
targetMessageId: target.id ?? void 0,
|
|
3478
|
-
previousRecovered: stored !== void 0
|
|
3479
|
-
}, "warn");
|
|
3480
|
-
return;
|
|
3481
|
-
}
|
|
3390
|
+
if (!message) return;
|
|
3482
3391
|
const previous = stored ? normalizeZapoMessage(stored) : void 0;
|
|
3483
3392
|
if (mutationKey) this.#rememberHandledProtocol(mutationKey);
|
|
3484
3393
|
this.#remember(edited);
|
|
3485
3394
|
const editedByMe = event.key.fromMe === true;
|
|
3486
3395
|
const editedById = event.key.participant ?? event.key.participantAlt ?? (editedByMe ? this.getCurrentUserIds()[0] : event.key.remoteJid ?? void 0);
|
|
3487
3396
|
if (!previous) {
|
|
3488
|
-
this.#
|
|
3397
|
+
this.#logger.debug("Zapo edit target was not present in the recent message cache.", {
|
|
3489
3398
|
targetMessageId: target.id ?? void 0,
|
|
3490
3399
|
chatId: target.remoteJid ?? void 0
|
|
3491
|
-
}
|
|
3400
|
+
});
|
|
3492
3401
|
}
|
|
3493
|
-
this.#logEditDiagnostic("emitting_message_edited", {
|
|
3494
|
-
eventMessageId: event.key.id ?? void 0,
|
|
3495
|
-
targetMessageId: target.id ?? void 0,
|
|
3496
|
-
previousRecovered: previous !== void 0,
|
|
3497
|
-
editedByMe
|
|
3498
|
-
});
|
|
3499
3402
|
void this.#events.emit("messageEdited", {
|
|
3500
3403
|
key: message.keys,
|
|
3501
3404
|
...previous ? { previous } : {},
|
|
@@ -4591,14 +4494,6 @@ var WhaNextZapoLogger = class _WhaNextZapoLogger {
|
|
|
4591
4494
|
this.#logger.info(message, this.#merge(context));
|
|
4592
4495
|
}
|
|
4593
4496
|
warn(message, context) {
|
|
4594
|
-
if (message.startsWith("addon parent message secret not found") && context?.kind === "message_edit") {
|
|
4595
|
-
this.#logger.warn("AntiEdit diagnostic", {
|
|
4596
|
-
diagnostic: "antiedit",
|
|
4597
|
-
stage: "decrypt_failed_missing_parent_secret",
|
|
4598
|
-
...this.#merge(context)
|
|
4599
|
-
});
|
|
4600
|
-
return;
|
|
4601
|
-
}
|
|
4602
4497
|
this.#logger.warn(message, this.#merge(context));
|
|
4603
4498
|
}
|
|
4604
4499
|
error(message, context) {
|