@peopl-health/nexus 5.56.33 → 5.56.35
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.
|
@@ -49,7 +49,8 @@ function resolveMaxFunctionRounds(explicit) {
|
|
|
49
49
|
const LOOP_ITERATION_HEADROOM = 3;
|
|
50
50
|
const CACHE_TTLS = ['5m', '1h'];
|
|
51
51
|
const DEFAULT_CACHE_TTL = '1h';
|
|
52
|
-
|
|
52
|
+
// Toggling thinking mid-turn invalidates the message cache, so the next call rewrites the whole history.
|
|
53
|
+
const DEFAULT_THINKING_MODE = 'always';
|
|
53
54
|
// Turns that end the model's clinical reasoning for the turn; after one, until_commit stops thinking.
|
|
54
55
|
const TERMINAL_COMMIT_TOOLS = new Set(['submitRoutingDecision', 'reportMedicalEscalation', 'reportCrisis', 'reportUnresolvedRequestv2']);
|
|
55
56
|
const ROUTING_TOOL = 'submitRoutingDecision';
|
package/lib/index.js
CHANGED
|
@@ -34,7 +34,6 @@ const { startRecommendationRecoverySweep } = require('./clinical/services/recomm
|
|
|
34
34
|
const { startInboundRecoverySweep } = require('./services/inboundRecoveryService');
|
|
35
35
|
const { requestIdMiddleware, getRequestId } = require('./middleware/requestId');
|
|
36
36
|
const { QueueAdapter, LocalQueueAdapter, RedisQueueAdapter, createQueueAdapter, registerQueueAdapter } = require('./queue');
|
|
37
|
-
const { createWorkflowRunner } = require('./core/workflowRunner');
|
|
38
37
|
const { DrainingError } = require('./core/BatchingManager');
|
|
39
38
|
const routes = require('./routes');
|
|
40
39
|
const { resetAll, stopAllSweeps } = require('./config/lifecycle');
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
function createWorkflowRunner({ queueAdapter } = {}) {
|
|
2
|
-
if (!queueAdapter) throw new Error('createWorkflowRunner requires a queueAdapter');
|
|
3
|
-
const workflows = new Map();
|
|
4
|
-
|
|
5
|
-
async function register(workflow = {}) {
|
|
6
|
-
if (!workflow.kind || typeof workflow.kind !== 'string') throw new Error('workflow requires a kind');
|
|
7
|
-
if (workflow.kind.includes('__')) throw new Error(`workflow '${workflow.kind}' must not contain '__' (reserved as the jobId delimiter)`);
|
|
8
|
-
if (typeof workflow.dedupeKey !== 'function') throw new Error(`workflow '${workflow.kind}' requires a dedupeKey function`);
|
|
9
|
-
if (typeof workflow.prepare !== 'function') throw new Error(`workflow '${workflow.kind}' requires a prepare function`);
|
|
10
|
-
if (workflows.has(workflow.kind)) throw new Error(`workflow '${workflow.kind}' is already registered`);
|
|
11
|
-
workflows.set(workflow.kind, workflow);
|
|
12
|
-
try {
|
|
13
|
-
await queueAdapter.process(workflow.kind, (trigger) => workflow.prepare(trigger));
|
|
14
|
-
} catch (error) {
|
|
15
|
-
workflows.delete(workflow.kind);
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
return workflow;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function enqueue(kind, trigger, options = {}) {
|
|
22
|
-
const workflow = workflows.get(kind);
|
|
23
|
-
if (!workflow) throw new Error(`no workflow registered for '${kind}'`);
|
|
24
|
-
const dedupeKey = workflow.dedupeKey(trigger);
|
|
25
|
-
if (dedupeKey == null || (typeof dedupeKey === 'string' && !dedupeKey.trim())) {
|
|
26
|
-
throw new Error(`workflow '${kind}' produced an empty dedupe key`);
|
|
27
|
-
}
|
|
28
|
-
if (typeof dedupeKey !== 'string') throw new Error(`workflow '${kind}' produced a non-string dedupe key`);
|
|
29
|
-
return queueAdapter.enqueue(kind, trigger, { ...options, jobId: `${kind}__${dedupeKey}` });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return { register, enqueue };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
module.exports = { createWorkflowRunner };
|