@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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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 {
|