@peopl-health/nexus 5.66.5 → 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.
|
@@ -3,7 +3,7 @@ const runtimeConfig = require('../../config/runtimeConfig');
|
|
|
3
3
|
const flagOn = (key) => String(runtimeConfig.get(key, 'false')).trim().toLowerCase() === 'true';
|
|
4
4
|
|
|
5
5
|
function escalationUpdateModeLive() {
|
|
6
|
-
return
|
|
6
|
+
return String(runtimeConfig.get('ESCALATION_UPDATE_MODE_LIVE', 'true')).trim().toLowerCase() !== 'false';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function escalationAssessmentLive() {
|
|
@@ -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();
|