@nexus-cortex/core 4.124.58 → 4.124.60

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.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * HB-WALL-RETRY-LADDER (R241 / R240, 2026-10-06, DARK).
3
+ *
4
+ * Why: under the 393,216-token cap every reasoning wall in the 10-05 TB4 cell was a DEGENERATE REPETITION LOOP (40/40), and the retry
5
+ * after a wall re-entered the same loop from its first tokens at full cap price (~$0.47 + ~20 min each). DeepSeek offers no server-side
6
+ * cycle breaker in thinking mode (penalties deprecated, temperature inert, stop sequences do not reach reasoning_content — probed 10-06),
7
+ * and the bench's action call is non-streaming, so the only bound is the retry's own max_tokens and its mode.
8
+ *
9
+ * What: after the n-th reasoning-exhaustion wall in a turn, the empty-response RETRY is sent with (a) max_tokens from a ladder
10
+ * (CORTEX_WALL_RETRY_LADDER="65536,16384": wall 1 → 65,536, wall 2+ → 16,384; shorter ladders repeat the last rung) and, from wall
11
+ * CORTEX_WALL_FORCE_ACTION_AT (default 2) on, (b) `tool_choice: required` — which on DeepSeek the gateway already turns into thinking OFF
12
+ * (AC ~1011-1016 / 1056-1062): the model must emit a tool call and act. Probed 10-06: the forced thinking-off tool call works
13
+ * mid-conversation and thinking resumes on the next call; the switch costs ONE uncached prefix read (thinking mode is in the cache key).
14
+ * Only exhaustion kinds qualify — never a "do not call tools" nudge kind (nudgeForbidsTools). Off = byte-identical.
15
+ */
16
+ import type { EmptyResponseClassification } from './emptyResponseClassifier.js';
17
+ export interface WallRetryLadderConfig {
18
+ enabled: boolean;
19
+ /** max_tokens per wall index (1-based); the last rung repeats. */
20
+ rungs: number[];
21
+ /** wall index (1-based) from which the retry forces an action (tool_choice required → thinking off on DeepSeek); 0 = never. */
22
+ forceActionAt: number;
23
+ }
24
+ export declare function resolveWallRetryLadder(env?: NodeJS.ProcessEnv): WallRetryLadderConfig;
25
+ /** max_tokens for the retry after wall number `wallIndex` (1-based); `baseCap` bounds it (never raise above the request's own cap). */
26
+ export declare function ladderCapFor(cfg: WallRetryLadderConfig, wallIndex: number, baseCap: number | undefined): number | undefined;
27
+ /** Force an action on this retry? Only for reasoning-exhaustion walls, never for nudge kinds that forbid tools. */
28
+ export declare function shouldForceAction(cfg: WallRetryLadderConfig, wallIndex: number, cls: EmptyResponseClassification | null | undefined): boolean;
29
+ //# sourceMappingURL=wallRetryLadder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallRetryLadder.d.ts","sourceRoot":"","sources":["../../src/orchestrator/wallRetryLadder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAGhF,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,kEAAkE;IAClE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,+HAA+H;IAC/H,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,qBAAqB,CASlG;AAED,uIAAuI;AACvI,wBAAgB,YAAY,CAAC,GAAG,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAI3H;AAED,mHAAmH;AACnH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAK7I"}
@@ -0,0 +1,29 @@
1
+ import { isReasoningExhaustion, nudgeForbidsTools } from './emptyResponseClassifier.js';
2
+ export function resolveWallRetryLadder(env = process.env) {
3
+ const raw = String(env.CORTEX_WALL_RETRY_LADDER ?? '').trim();
4
+ const rungs = raw.split(',').map((s) => parseInt(s.trim(), 10)).filter((n) => Number.isInteger(n) && n >= 1024);
5
+ const fa = parseInt(String(env.CORTEX_WALL_FORCE_ACTION_AT ?? '').trim(), 10);
6
+ return {
7
+ enabled: rungs.length > 0,
8
+ rungs,
9
+ forceActionAt: Number.isInteger(fa) && fa >= 0 ? fa : 2,
10
+ };
11
+ }
12
+ /** max_tokens for the retry after wall number `wallIndex` (1-based); `baseCap` bounds it (never raise above the request's own cap). */
13
+ export function ladderCapFor(cfg, wallIndex, baseCap) {
14
+ if (!cfg.enabled || cfg.rungs.length === 0 || wallIndex < 1)
15
+ return baseCap;
16
+ const rung = cfg.rungs[Math.min(wallIndex, cfg.rungs.length) - 1];
17
+ return baseCap && baseCap > 0 ? Math.min(baseCap, rung) : rung;
18
+ }
19
+ /** Force an action on this retry? Only for reasoning-exhaustion walls, never for nudge kinds that forbid tools. */
20
+ export function shouldForceAction(cfg, wallIndex, cls) {
21
+ if (!cfg.enabled || cfg.forceActionAt <= 0 || wallIndex < cfg.forceActionAt)
22
+ return false;
23
+ if (!isReasoningExhaustion(cls))
24
+ return false;
25
+ if (cls && nudgeForbidsTools(cls.kind))
26
+ return false;
27
+ return true;
28
+ }
29
+ //# sourceMappingURL=wallRetryLadder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallRetryLadder.js","sourceRoot":"","sources":["../../src/orchestrator/wallRetryLadder.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAUxF,MAAM,UAAU,sBAAsB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACzE,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9D,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC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AE,OAAO,KAAK,CAAC;IAC9C,IAAI,GAAG,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"taskRules.d.ts","sourceRoot":"","sources":["../../src/training/taskRules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAA6C,CAAC;AAExF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAKlD,CAAC;AAEF,8GAA8G;AAC9G,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,QAAQ,EAAE,CAEjF;AAED,gHAAgH;AAChH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAczD,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAErE;AAED;iCACiC;AACjC,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAmB5D,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAEvE"}
1
+ {"version":3,"file":"taskRules.d.ts","sourceRoot":"","sources":["../../src/training/taskRules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAA6C,CAAC;AAExF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAKlD,CAAC;AAEF,8GAA8G;AAC9G,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,QAAQ,EAAE,CAEjF;AAED,gHAAgH;AAChH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAezD,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAErE;AAED;iCACiC;AACjC,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAoB5D,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAEvE"}
@@ -30,8 +30,9 @@ export function resolveTaskRules(env = process.env) {
30
30
  /** Carrier A: one planner doctrine bullet per rule (same `- NAME: …\n` shape as the other doctrine bullets). */
31
31
  export const TASK_RULE_PLAN_LINES = {
32
32
  inputs: '- INPUT COVERAGE: include a step that lists every field, column and parameter of the provided inputs and where the solution uses ' +
33
- 'each one. Never change a given constant or input to make the problem feasible; if it looks infeasible with the given data, ' +
34
- 're-read the task and the inputs — something was misread.\n',
33
+ 'each one. Never alter a given value to make the problem feasible. If two provided sources disagree, or a given value is internally ' +
34
+ 'inconsistent, re-read once; if the conflict is real, use the source the task names as authoritative (else the task text itself), ' +
35
+ 'record the discrepancy in the deliverable\'s notes, and proceed — do not keep re-reading.\n',
35
36
  interp: '- INTERPRETATIONS: when the task or the work names alternative readings, conventions or candidates, include a step that computes ' +
36
37
  'each one and keeps the one consistent with every explicit hint and all of the data, stating why.\n',
37
38
  holdout: '- HELD-OUT VALIDATION: when the task implies hidden inputs, other variants or generalisation, include a step that validates on a ' +
@@ -48,7 +49,8 @@ export function taskRulesPlanBlock(rules) {
48
49
  export const TASK_RULE_JUDGE_CLAUSES = {
49
50
  inputs: '\n\nINPUTS RULE (HB-RULE-INPUTS): when the task provides input data, parameters or constants, does the work use them and leave the ' +
50
51
  'given values unchanged? If a provided field is ignored or a given value was altered to make the problem feasible, treat that as a GAP ' +
51
- 'and name a CHECK that shows where that input is used. Tasks with no provided inputs are not affected by this rule.',
52
+ 'and name a CHECK that shows where that input is used. Tasks with no provided inputs are not affected by this rule. A recorded, ' +
53
+ 'justified discrepancy between provided sources, resolved in favour of the task\'s authoritative source, is not a gap.',
52
54
  interp: '\n\nINTERPRETATION RULE (HB-RULE-INTERP): where the task or the work names alternative readings, conventions or candidates, does ' +
53
55
  'the evidence show each one was computed and the chosen one is consistent with every explicit hint and all the data? If an ' +
54
56
  'alternative was set aside without that comparison, treat that as a GAP and name a CHECK that scores the alternatives against the ' +
@@ -1 +1 @@
1
- {"version":3,"file":"taskRules.js","sourceRoot":"","sources":["../../src/training/taskRules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,oFAAoF;AACpF,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD,MAAM,EAAE,oBAAoB;IAC5B,MAAM,EAAE,oBAAoB;IAC5B,OAAO,EAAE,qBAAqB;IAC9B,KAAK,EAAE,mBAAmB;CAC3B,CAAC;AAEF,8GAA8G;AAC9G,MAAM,UAAU,gBAAgB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACnE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED,gHAAgH;AAChH,MAAM,CAAC,MAAM,oBAAoB,GAA6B;IAC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HAA4H;QAC5H,mIAAmI;QACnI,qBAAqB;IACvB,OAAO,EACL,kIAAkI;QAClI,iIAAiI;QACjI,2EAA2E;IAC7E,KAAK,EACH,gIAAgI;QAChI,mIAAmI;QACnI,uIAAuI;QACvI,oEAAoE;CACvE,CAAC;AAEF,sEAAsE;AACtE,MAAM,UAAU,oBAAoB,CAAC,KAA0B;IAC7D,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cortex/core",
3
- "version": "4.124.58",
3
+ "version": "4.124.60",
4
4
  "description": "Core orchestration library implementing Claude CLI architecture patterns",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -47,8 +47,8 @@
47
47
  "@google/generative-ai": "^0.2.1",
48
48
  "@gradio/client": "^2.3.1",
49
49
  "@modelcontextprotocol/sdk": "^1.20.2",
50
- "@nexus-cortex/executors": "4.124.58",
51
- "@nexus-cortex/types": "4.124.58",
50
+ "@nexus-cortex/executors": "4.124.60",
51
+ "@nexus-cortex/types": "4.124.60",
52
52
  "@types/uuid": "^10.0.0",
53
53
  "ajv": "^8.12.0",
54
54
  "chokidar": "^3.6.0",