@peopl-health/nexus 5.71.7 → 5.71.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.
|
@@ -377,6 +377,7 @@ class BaseLLMProvider {
|
|
|
377
377
|
'Si una contingencia activa ya cubre la preocupación, no la cruces con otro seguimiento. Si programas, primero usa schedulePatientReminder con reminder_type seguimiento y la misma utility_basis concreta; luego registra hold con el mismo next_check_at.',
|
|
378
378
|
'',
|
|
379
379
|
'Si escribes, que sea para ELLA: lo que te contó, lo que quedó abierto, lo que quieres saber ahora.',
|
|
380
|
+
'Tu texto llega dentro de una plantilla que ya empieza con «Hola {su nombre},»: no saludes ni escribas su nombre, entra directo a lo que quieres decirle, breve (menos de 500 caracteres) y con un emoji como máximo. Es un contacto sobre su cuidado: no le sumes invitaciones a charlas, sesiones ni actividades.',
|
|
380
381
|
'LÍMITE UTILITY: escribe sólo cuando puedas anclar el contacto en algo concreto que la paciente contó, preguntó o acordó, o en una interacción de cuidado todavía vigente. La inactividad por sí sola no basta. Si escribes, registra esa ancla en utility_basis; si sólo queda un saludo general para generar engagement, registra hold con hold_reason no_utility_anchor y utility_basis null.',
|
|
381
382
|
'No repitas un mensaje que ya le enviaste, y no menciones automatizaciones, listas ni seguimientos programados.',
|
|
382
383
|
);
|
|
@@ -38,7 +38,7 @@ const { ProcessingPipeline } = require('../core/ProcessingPipeline');
|
|
|
38
38
|
const { preProcessMessages, configureOpenAIProvider, AssistantProcessor, TURN_KIND } = require('../clinical');
|
|
39
39
|
const { deliveryOutcome } = require('../clinical/AssistantProcessor');
|
|
40
40
|
const { UNASSIGNED, alertOpsForClaimedMessage, coverIfUnassigned, coverUnansweredPatient } = require('../clinical/services/pausedSafetyNetService');
|
|
41
|
-
const { buildOutreachCarrier } = require('../clinical/services/outreachCarrierService');
|
|
41
|
+
const { buildOutreachCarrier, validateAgentText } = require('../clinical/services/outreachCarrierService');
|
|
42
42
|
const { routineOutreachCollisionReason, isWithinTriageProtectionWindow } = require('../clinical/services/outreachSweepService');
|
|
43
43
|
const {
|
|
44
44
|
readPendingReminderForPatient,
|
|
@@ -1037,6 +1037,14 @@ class NexusMessaging {
|
|
|
1037
1037
|
}
|
|
1038
1038
|
const accepted = Boolean(runResult.output) && delivery?.success === true && delivery?.deferred !== true;
|
|
1039
1039
|
const delivered = ['delivered', 'read'].includes(String(delivery?.status || '').toLowerCase());
|
|
1040
|
+
let carrierRejection = null;
|
|
1041
|
+
if (dryRun && decision.decision === 'write') {
|
|
1042
|
+
try {
|
|
1043
|
+
validateAgentText(runResult.output, firstName);
|
|
1044
|
+
} catch (error) {
|
|
1045
|
+
carrierRejection = error.message;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1040
1048
|
if (!dryRun && (decision.decision === 'write') !== accepted) {
|
|
1041
1049
|
logger.warn('[processOutreach] decision and delivery disagree', {
|
|
1042
1050
|
code, decision: decision.decision, accepted, status: delivery?.status || null,
|
|
@@ -1049,6 +1057,7 @@ class NexusMessaging {
|
|
|
1049
1057
|
holdReason: decision.holdReason || null,
|
|
1050
1058
|
nextCheckAt: decision.nextCheckAt || null,
|
|
1051
1059
|
draft: dryRun ? (runResult.output || '') : null,
|
|
1060
|
+
carrierRejection,
|
|
1052
1061
|
accepted,
|
|
1053
1062
|
delivered,
|
|
1054
1063
|
deferred: Boolean(delivery?.deferred),
|
package/lib/index.d.ts
CHANGED
|
@@ -475,6 +475,8 @@ declare module '@peopl-health/nexus' {
|
|
|
475
475
|
nextCheckAt: string | null;
|
|
476
476
|
/** Drafted patient-facing text. Present only on a dry run. */
|
|
477
477
|
draft?: string | null;
|
|
478
|
+
/** Why the out-of-window template would refuse the draft. Present only on a dry run. */
|
|
479
|
+
carrierRejection?: string | null;
|
|
478
480
|
/** Whether the provider accepted the fixed-template send. This is not proof of delivery. */
|
|
479
481
|
accepted?: boolean;
|
|
480
482
|
/** Whether the provider status is already terminal delivered/read. */
|