@peopl-health/nexus 5.11.0-dev.1117 → 5.11.0-dev.1120

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.
@@ -62,8 +62,7 @@ class BaseLLMProvider {
62
62
 
63
63
  const resolvedSchemas = this._resolveToolSchemas({ assistant, toolIds, filtered, toolDescriptions });
64
64
  const { toolChoice: flooredToolChoice, toolSchemas, narrowed } = this._applyDeliveryFloor(
65
- toolChoice, resolvedSchemas, prePromptResult?.toolChoice,
66
- Boolean(additionalInstructions && assistant?.toolRuntimeContext));
65
+ toolChoice, resolvedSchemas, Boolean(assistant?.toolRuntimeContext));
67
66
  const effectiveToolIds = narrowed ? toolSchemas.map(s => s.function?.name).filter(Boolean) : toolIds;
68
67
  const devContent = this._buildInstructions({ resolvedPrompt, toolSchemas, prePromptResult });
69
68
  const auditedPrompt = additionalInstructions
@@ -94,7 +93,7 @@ class BaseLLMProvider {
94
93
  instructions: instructions || devContent || '',
95
94
  input,
96
95
  toolSchemas,
97
- toolChoice: prePromptResult?.toolChoice || flooredToolChoice,
96
+ toolChoice: narrowed ? flooredToolChoice : prePromptResult?.toolChoice || flooredToolChoice,
98
97
  followUpToolChoice: flooredToolChoice,
99
98
  modelConfig,
100
99
  metadata,
@@ -372,11 +371,9 @@ class BaseLLMProvider {
372
371
  return toolNames.length > 0 && toolNames.every(name => TERMINAL_DELIVERY_TOOLS.has(name));
373
372
  }
374
373
 
375
- _applyDeliveryFloor(toolChoice, toolSchemas, prePromptToolChoice = null, isClinicalDirective = false) {
376
- if (prePromptToolChoice) return { toolChoice, toolSchemas, narrowed: false };
374
+ _applyDeliveryFloor(toolChoice, toolSchemas, hasToolRuntimeContext = false) {
377
375
  if (toolChoice !== 'none') return { toolChoice, toolSchemas, narrowed: false };
378
- // A directive dictates the message, not the turn's capabilities, so a clinical turn keeps its toolset.
379
- if (isClinicalDirective) return { toolChoice: 'auto', toolSchemas, narrowed: false };
376
+ if (!hasToolRuntimeContext) return { toolChoice, toolSchemas, narrowed: false };
380
377
  const deliveryOnly = toolSchemas.filter(s => TERMINAL_DELIVERY_TOOLS.has(s.function?.name));
381
378
  if (!deliveryOnly.length) return { toolChoice, toolSchemas, narrowed: false };
382
379
  return { toolChoice: 'auto', toolSchemas: deliveryOnly, narrowed: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.11.0-dev.1117",
3
+ "version": "5.11.0-dev.1120",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",