@peopl-health/nexus 5.66.6 → 5.66.7

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.
@@ -125,13 +125,13 @@ class BaseLLMProvider {
125
125
  assistant.toolRuntimeContext.enabledSkills = enabledSkills;
126
126
  }
127
127
 
128
- const resolvedSchemas = this._resolveToolSchemas({
128
+ const resolvedSchemas = this._scopeOutreachDecisionTool(this._resolveToolSchemas({
129
129
  assistant, toolIds: resolvedToolIds, filtered, toolDescriptions,
130
- });
130
+ }), isOutreach);
131
131
  const { toolChoice: flooredToolChoice, toolSchemas, narrowed } = this._applyDeliveryFloor(
132
132
  toolChoice, resolvedSchemas, Boolean(assistant?.toolRuntimeContext), turnKind);
133
133
  const effectiveToolIds = toolSchemas.map(s => s.function?.name).filter(Boolean);
134
- const instructionToolIds = narrowed ? effectiveToolIds : resolvedToolIds;
134
+ const instructionToolIds = narrowed || isOutreach ? effectiveToolIds : resolvedToolIds;
135
135
  const requestedToolChoice = prePromptResult?.toolChoice;
136
136
  const requestedToolName = requestedToolChoice?.name || requestedToolChoice?.function?.name || null;
137
137
  const supportedGenericChoices = new Set(['auto', 'none', 'required', 'any']);
@@ -234,6 +234,17 @@ class BaseLLMProvider {
234
234
  };
235
235
  }
236
236
 
237
+ // The decision tool belongs to the turn kind, not to a preset: without it an outreach turn cannot
238
+ // close and the brief is dropped, and on any other turn it would invite a decision nobody asked for.
239
+ _scopeOutreachDecisionTool(schemas, isOutreach) {
240
+ const others = schemas.filter(s => s.function?.name !== OUTREACH_DECISION_TOOL);
241
+ if (!isOutreach) return others;
242
+ const decision = schemas.find(s => s.function?.name === OUTREACH_DECISION_TOOL)
243
+ || getRegistrySchemas([OUTREACH_DECISION_TOOL])[0];
244
+ if (!decision) throw new Error('OUTREACH_DECISION_TOOL_UNAVAILABLE');
245
+ return [...others, decision];
246
+ }
247
+
237
248
  _resolveToolSchemas({ assistant, toolIds, filtered, toolDescriptions }) {
238
249
  const assistantSchemas = assistant?.getToolSchemas?.() || [];
239
250
  const registrySchemas = getRegistrySchemas();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.66.6",
3
+ "version": "5.66.7",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",