@peopl-health/nexus 5.76.5 → 5.76.6
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.
|
@@ -322,7 +322,7 @@ class BaseLLMProvider {
|
|
|
322
322
|
...this._buildFollowUpPolicyMessage(toolIds),
|
|
323
323
|
...this._buildFollowUpMessage(promptVariables),
|
|
324
324
|
...this._buildFollowUpCheckMessage(toolIds),
|
|
325
|
-
...this._buildContingencyCheckMessage(promptVariables, toolIds),
|
|
325
|
+
...this._buildContingencyCheckMessage(promptVariables, toolIds, outreachBrief),
|
|
326
326
|
...this._buildClockMessage(promptVariables, interpolatedVariables),
|
|
327
327
|
...messages,
|
|
328
328
|
...this._buildOutreachBriefMessage({ outreachBrief, toolIds }),
|
|
@@ -495,12 +495,16 @@ class BaseLLMProvider {
|
|
|
495
495
|
// Rides behind the history like the follow-up check: the nets block above lists the nets, the decision lives here,
|
|
496
496
|
// because an unresolved net later asks the patient a question they had already answered.
|
|
497
497
|
// Only answers given after the net was armed count: an escalation net waits for how the reported symptom evolved.
|
|
498
|
-
|
|
498
|
+
// A net is marked fired before its own check-in turn runs, so during that turn its check-in has not reached the patient yet.
|
|
499
|
+
_buildContingencyCheckMessage(promptVariables, toolIds = [], outreachBrief = null) {
|
|
499
500
|
if (!(toolIds || []).includes('setContingencyPlan')) return [];
|
|
500
501
|
const active = Array.isArray(promptVariables?.active_contingencies) ? promptVariables.active_contingencies : [];
|
|
501
502
|
if (!active.length) return [];
|
|
503
|
+
const dueNet = outreachBrief?.checkIn?.planId || null;
|
|
502
504
|
const waiting = active.map(({ carePlan: plan = {} } = {}) => {
|
|
503
|
-
|
|
505
|
+
let fired = '';
|
|
506
|
+
if (dueNet && plan.planId === dueNet) fired = ' Su check-in es el de este turno: todavía no le ha llegado.';
|
|
507
|
+
else if (plan.status === 'fired_reminder') fired = ' Su check-in ya se envió.';
|
|
504
508
|
return `- ${plan.planId} (armada ${localFireTime(plan.createdAt)}) espera: ${sanitizeInlineText(plan.awaitingCharacterization)}.${fired}`;
|
|
505
509
|
});
|
|
506
510
|
return [{
|
|
@@ -101,6 +101,7 @@ async function planCheckInDue({ code, reminderId, type, question = '', firstName
|
|
|
101
101
|
checkIn = {
|
|
102
102
|
type,
|
|
103
103
|
reminderId,
|
|
104
|
+
planId,
|
|
104
105
|
dueAt: null,
|
|
105
106
|
question: netQuestion,
|
|
106
107
|
concern: net.carePlan.concern,
|
|
@@ -118,6 +119,7 @@ async function planCheckInDue({ code, reminderId, type, question = '', firstName
|
|
|
118
119
|
checkIn = {
|
|
119
120
|
type,
|
|
120
121
|
reminderId,
|
|
122
|
+
planId: null,
|
|
121
123
|
dueAt: plan.fireAt || null,
|
|
122
124
|
question: plan.message || question,
|
|
123
125
|
concern: plan.windowReasoning,
|
package/lib/index.d.ts
CHANGED
|
@@ -468,7 +468,7 @@ declare module '@peopl-health/nexus' {
|
|
|
468
468
|
lastInboundAt?: string | null;
|
|
469
469
|
lastOutboundAt?: string | null;
|
|
470
470
|
lastOutreach?: string | null;
|
|
471
|
-
checkIn?: { type: string; reminderId?: string | null; dueAt?: string | null; question: string; concern?: string | null; awaiting?: string | null; armedAt?: string | null; urgency?: string | null; otherPlans?: number | null } | null;
|
|
471
|
+
checkIn?: { type: string; reminderId?: string | null; planId?: string | null; dueAt?: string | null; question: string; concern?: string | null; awaiting?: string | null; armedAt?: string | null; urgency?: string | null; otherPlans?: number | null } | null;
|
|
472
472
|
recentCheckIns?: string[];
|
|
473
473
|
exchange?: { patient: { at: string; text: string } | null; own: { at: string; text: string } | null; ownMessagesToday: number; sessionOpen?: boolean } | null;
|
|
474
474
|
asOf?: string | null;
|