@peopl-health/nexus 5.72.7 → 5.72.8

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.
@@ -186,9 +186,11 @@ async function generateEscalationDraft({
186
186
  logger.warn('[escalationDraft] generation returned no usable text', { reviewId });
187
187
  return { completed: false, attempted: true, rejected: true, reason: 'the model returned no usable text' };
188
188
  }
189
- if (TECHNICAL_TOKEN.test(`${composeDoctorBody({ ...draft, alarm: null })}\n${patientMessage}`)) {
190
- logger.warn('[escalationDraft] generation leaked a technical token into the text', { reviewId });
191
- return { completed: false, attempted: true, rejected: true, reason: 'the model wrote a field name or technical token into the doctor or patient text' };
189
+ // The token goes into the reason because the audit log keeps the reason: it says which prompt rule leaked.
190
+ const leaked = TECHNICAL_TOKEN.exec(`${composeDoctorBody({ ...draft, alarm: null })}\n${patientMessage}`)?.[0].slice(0, 40);
191
+ if (leaked) {
192
+ logger.warn('[escalationDraft] generation leaked a technical token into the text', { reviewId, token: leaked });
193
+ return { completed: false, attempted: true, rejected: true, reason: `the model wrote a field name or technical token into the doctor or patient text: "${leaked}"` };
192
194
  }
193
195
 
194
196
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.72.7",
3
+ "version": "5.72.8",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",