@nexus-cortex/core 4.88.0 → 4.88.2
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.
- package/.env.example +13 -0
- package/dist/adapters/ChatCompletionsAPIAdapter.d.ts.map +1 -1
- package/dist/adapters/ChatCompletionsAPIAdapter.js +10 -7
- package/dist/adapters/ChatCompletionsAPIAdapter.js.map +1 -1
- package/dist/models/cards/deepseek/deepseek-v4-flash-vision-exp.d.ts.map +1 -1
- package/dist/models/cards/deepseek/deepseek-v4-flash-vision-exp.js +4 -0
- package/dist/models/cards/deepseek/deepseek-v4-flash-vision-exp.js.map +1 -1
- package/dist/models/cards/deepseek/deepseek-v4-flash.d.ts.map +1 -1
- package/dist/models/cards/deepseek/deepseek-v4-flash.js +4 -0
- package/dist/models/cards/deepseek/deepseek-v4-flash.js.map +1 -1
- package/dist/models/cards/deepseek/deepseek-v4-pro.d.ts.map +1 -1
- package/dist/models/cards/deepseek/deepseek-v4-pro.js +4 -0
- package/dist/models/cards/deepseek/deepseek-v4-pro.js.map +1 -1
- package/dist/models/configurators/DeepSeekConfigurator.d.ts +2 -0
- package/dist/models/configurators/DeepSeekConfigurator.d.ts.map +1 -1
- package/dist/models/configurators/DeepSeekConfigurator.js.map +1 -1
- package/dist/orchestrator/APIClient.d.ts.map +1 -1
- package/dist/orchestrator/APIClient.js +3 -0
- package/dist/orchestrator/APIClient.js.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.d.ts +6 -0
- package/dist/orchestrator/CortexOrchestrator.d.ts.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.js +62 -17
- package/dist/orchestrator/CortexOrchestrator.js.map +1 -1
- package/dist/training/mentorConsult.d.ts +8 -0
- package/dist/training/mentorConsult.d.ts.map +1 -1
- package/dist/training/mentorConsult.js +18 -0
- package/dist/training/mentorConsult.js.map +1 -1
- package/package.json +4 -4
|
@@ -37,7 +37,7 @@ import { slashCommandRegistry } from '../commands/SlashCommandRegistry.js';
|
|
|
37
37
|
import { prefixMcpToolName, parseMcpToolName } from '../mcp/mcpToolNamespacing.js';
|
|
38
38
|
import { DecisionStore } from '../training/DecisionStore.js';
|
|
39
39
|
import { formatPriorReminder, formatFamilyReminder, formatApproachReminder } from '../training/DecisionPriorInjector.js';
|
|
40
|
-
import { resolveConsultRung, resolveMentorConfig, bounceMessage, rateLimitedMessage, } from '../training/mentorConsult.js';
|
|
40
|
+
import { resolveConsultRung, resolveMentorConfig, bounceMessage, TEMPLATE_REFRAME, TEMPLATE_INTERVIEW, rateLimitedMessage, } from '../training/mentorConsult.js';
|
|
41
41
|
import { resolveThrashState, resolveThrashConfig } from '../training/thrashDetector.js';
|
|
42
42
|
import { classifyErrorFamily } from '../training/errorFamily.js';
|
|
43
43
|
import { classifyToolOutcome } from '../training/toolOutcome.js';
|
|
@@ -2385,7 +2385,7 @@ export class CortexOrchestrator {
|
|
|
2385
2385
|
temperature: options.parameters?.temperature,
|
|
2386
2386
|
maxTokens: options.parameters?.maxTokens,
|
|
2387
2387
|
topP: options.parameters?.topP,
|
|
2388
|
-
reasoningEffort: options.parameters?.reasoningEffort, //
|
|
2388
|
+
reasoningEffort: this.consumeEffortPulse() ?? options.parameters?.reasoningEffort, // effort pulse > request param > card
|
|
2389
2389
|
stream: options.streaming,
|
|
2390
2390
|
staticSystemPrompt: this.currentStaticSystemPrompt, // R28
|
|
2391
2391
|
conversationId: this.currentConversationId, // R28b
|
|
@@ -4009,7 +4009,7 @@ export class CortexOrchestrator {
|
|
|
4009
4009
|
temperature: options.parameters?.temperature,
|
|
4010
4010
|
maxTokens: options.parameters?.maxTokens,
|
|
4011
4011
|
topP: options.parameters?.topP,
|
|
4012
|
-
reasoningEffort: options.parameters?.reasoningEffort, //
|
|
4012
|
+
reasoningEffort: this.consumeEffortPulse() ?? options.parameters?.reasoningEffort, // effort pulse > request param > card
|
|
4013
4013
|
stream: true, // STREAMING continuation
|
|
4014
4014
|
staticSystemPrompt: this.currentStaticSystemPrompt, // R28
|
|
4015
4015
|
conversationId: this.currentConversationId, // R28b
|
|
@@ -6887,6 +6887,17 @@ export class CortexOrchestrator {
|
|
|
6887
6887
|
return undefined; // fail-open: never let the thrash read break a turn
|
|
6888
6888
|
}
|
|
6889
6889
|
}
|
|
6890
|
+
/** EFFORT PULSE (ablation 'think harder' arm, def-efdbb67fd8): continuations
|
|
6891
|
+
* remaining at elevated reasoning effort after a cumulative-thrash trigger. */
|
|
6892
|
+
effortPulseRemaining = 0;
|
|
6893
|
+
/** While the pulse is armed, continuation requests run at the elevated level
|
|
6894
|
+
* (CORTEX_EFFORT_PULSE_LEVEL, default 'high'); decrements per consumed request. */
|
|
6895
|
+
consumeEffortPulse() {
|
|
6896
|
+
if (this.effortPulseRemaining <= 0)
|
|
6897
|
+
return undefined;
|
|
6898
|
+
this.effortPulseRemaining -= 1;
|
|
6899
|
+
return (process.env.CORTEX_EFFORT_PULSE_LEVEL || 'high');
|
|
6900
|
+
}
|
|
6890
6901
|
/** Honored AskForAdvice consults per session (rate-limit + rung state; persists across turns). */
|
|
6891
6902
|
mentorConsultCounts = new Map();
|
|
6892
6903
|
/**
|
|
@@ -6919,21 +6930,30 @@ export class CortexOrchestrator {
|
|
|
6919
6930
|
return { success: true, llmContent: rateLimitedMessage(resolveMentorConfig().maxConsults), metadata: { source: 'mentor-consult', rung } };
|
|
6920
6931
|
}
|
|
6921
6932
|
let hint;
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
helperModelId: this.config.reactiveMentorship?.helperModelId,
|
|
6929
|
-
});
|
|
6933
|
+
if (process.env.CORTEX_MENTOR_TEMPLATE === 'true') {
|
|
6934
|
+
// Ablation-ladder rung 1 (no-LLM mentor): the FIXED self-interrogation
|
|
6935
|
+
// replaces the helper call at the SAME rung — identical trigger, bounce
|
|
6936
|
+
// ladder, rate limit and timing as the LLM mentor; only the hint CONTENT
|
|
6937
|
+
// differs (the isolation the ladder needs). Zero cost, zero latency.
|
|
6938
|
+
hint = rung === 'interview' ? TEMPLATE_INTERVIEW : TEMPLATE_REFRAME;
|
|
6930
6939
|
}
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6940
|
+
else {
|
|
6941
|
+
try {
|
|
6942
|
+
hint = await this.helperMiddleware.generateMentorHint({
|
|
6943
|
+
rung,
|
|
6944
|
+
task: this.lastRealUserText(),
|
|
6945
|
+
failed,
|
|
6946
|
+
question: input?.question,
|
|
6947
|
+
helperModelId: this.config.reactiveMentorship?.helperModelId,
|
|
6948
|
+
});
|
|
6949
|
+
}
|
|
6950
|
+
catch (err) {
|
|
6951
|
+
return {
|
|
6952
|
+
success: true,
|
|
6953
|
+
llmContent: 'Advice is unavailable right now — keep working the problem: re-read the task and try a distinct approach.',
|
|
6954
|
+
metadata: { source: 'mentor-consult', rung, error: String(err).slice(0, 120) },
|
|
6955
|
+
};
|
|
6956
|
+
}
|
|
6937
6957
|
}
|
|
6938
6958
|
this.mentorConsultCounts.set(sessionId, honored + 1);
|
|
6939
6959
|
if (store) {
|
|
@@ -6949,6 +6969,7 @@ export class CortexOrchestrator {
|
|
|
6949
6969
|
detail: {
|
|
6950
6970
|
tag: 'mentor_episode',
|
|
6951
6971
|
rung,
|
|
6972
|
+
...(process.env.CORTEX_MENTOR_TEMPLATE === 'true' ? { template: true } : {}),
|
|
6952
6973
|
turn: this.turnNumber,
|
|
6953
6974
|
helperModel: this.config.reactiveMentorship?.helperModelId ?? 'default',
|
|
6954
6975
|
question: input?.question ?? null,
|
|
@@ -7060,6 +7081,30 @@ export class CortexOrchestrator {
|
|
|
7060
7081
|
}
|
|
7061
7082
|
}
|
|
7062
7083
|
}
|
|
7084
|
+
// EFFORT PULSE trigger (def-efdbb67fd8, 'think harder' ablation arm): on
|
|
7085
|
+
// cumulative thrash, escalate reasoning effort for the next N continuation
|
|
7086
|
+
// requests — deep deliberation bought exactly at the stuck point. The
|
|
7087
|
+
// introspective CONTRAST to the mentor's decorrelative consult: same
|
|
7088
|
+
// trigger, same rstan gate (cumulative threshold), INDEPENDENT of
|
|
7089
|
+
// CORTEX_MENTOR_AUTO so each ablation arm isolates cleanly. Ship dark.
|
|
7090
|
+
if (process.env.CORTEX_EFFORT_PULSE === 'true' && outcome.status !== 'ok') {
|
|
7091
|
+
const cfgP = resolveThrashConfig();
|
|
7092
|
+
const [pOutcomes, pPrior] = await Promise.all([
|
|
7093
|
+
store.recentOutcomes(cfgP.window),
|
|
7094
|
+
store.failureCount(this.currentSessionId ?? 'unknown'),
|
|
7095
|
+
]);
|
|
7096
|
+
pOutcomes.push(false);
|
|
7097
|
+
const pCum = pPrior + 1;
|
|
7098
|
+
const pState = resolveThrashState(pOutcomes, pCum, cfgP, pCum);
|
|
7099
|
+
if (pState.thrashing) {
|
|
7100
|
+
const turns = Math.max(1, parseInt(process.env.CORTEX_EFFORT_PULSE_TURNS || '2', 10) || 2);
|
|
7101
|
+
if (this.effortPulseRemaining < turns)
|
|
7102
|
+
this.effortPulseRemaining = turns;
|
|
7103
|
+
if (this.config.debug) {
|
|
7104
|
+
console.log(`[EffortPulse] armed (trigger: ${pState.trigger}, cumFails: ${pCum}) — next ${this.effortPulseRemaining} continuation(s) at elevated effort`);
|
|
7105
|
+
}
|
|
7106
|
+
}
|
|
7107
|
+
}
|
|
7063
7108
|
}
|
|
7064
7109
|
catch (err) {
|
|
7065
7110
|
if (this.config.debug) {
|