@peopl-health/nexus 5.56.38 → 5.57.0-dev.10052

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.
@@ -4,6 +4,7 @@ const { OPERATOR_TURN_PREFIX } = require('../memory/DefaultMemoryManager');
4
4
  const { ROUTING_SKILL } = require('../helpers/clinicalWorkflowGuard');
5
5
  const { appendCall } = require('../services/llmAuditService');
6
6
  const { composePrompt } = require('../services/promptComposerService');
7
+ const { RISK_HEADLINE_MARKER, RISK_HEADLINE_DISCLAIMER } = require('../services/riskHeadlineService');
7
8
  const { isConversationalDraftReuseLive } = require('../flags/turnEfficiencyFlags');
8
9
  const { retryWithBackoff } = require('../../utils/retryUtils');
9
10
  const { withTiming } = require('../../utils/tracingDecorator');
@@ -475,9 +476,8 @@ class AnthropicProvider extends BaseLLMProvider {
475
476
  // turn persists once tool results are appended after it on multi-round turns.
476
477
  _buildInput({ additionalInstructions, ...rest }) {
477
478
  const input = super._buildInput({ additionalInstructions, ...rest });
478
- // Tail items move behind the history so they stop rewriting the cached prefix, but ahead of the
479
- // operator copy below, which is placed last precisely to hold recency.
480
- const ordered = [...input.filter(i => !i[TAIL_PLACEMENT]), ...input.filter(i => i[TAIL_PLACEMENT])];
479
+ const pinned = { role: 'developer', content: `${RISK_HEADLINE_MARKER}\n${RISK_HEADLINE_DISCLAIMER}` };
480
+ const ordered = [...input.filter(i => !i[TAIL_PLACEMENT]), pinned, ...input.filter(i => i[TAIL_PLACEMENT])];
481
481
  if (!additionalInstructions) return ordered;
482
482
  const { content } = this._operatorInstructionTurn(additionalInstructions);
483
483
  return [...ordered, { role: 'user', content: `${OPERATOR_TURN_PREFIX} ${content}`, type: 'message' }];
@@ -429,7 +429,9 @@ class BaseLLMProvider {
429
429
  parts.push(`## Síntomas recientes\n${symptoms}`);
430
430
  }
431
431
  if (parts.length === 0) return [];
432
- return [{ role: 'developer', content: parts.join('\n\n') }];
432
+ // Refreshed most turns (symptoms, risks); ahead of the history it rewrote the whole cached
433
+ // conversation. Informational only, so it rides behind it like the clock. Directives stay in system.
434
+ return [{ role: 'developer', content: parts.join('\n\n'), [TAIL_PLACEMENT]: true }];
433
435
  }
434
436
 
435
437
  _clinicalText(value, field) {
@@ -52,4 +52,5 @@ async function assembleRiskHeadline(patientId) {
52
52
  module.exports = {
53
53
  assembleRiskHeadline,
54
54
  RISK_HEADLINE_MARKER,
55
+ RISK_HEADLINE_DISCLAIMER,
55
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.56.38",
3
+ "version": "5.57.0-dev.10052",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",