@nexus-cortex/core 4.124.59 → 4.124.61

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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cortex/core",
3
- "version": "4.124.59",
3
+ "version": "4.124.61",
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.59",
51
- "@nexus-cortex/types": "4.124.59",
50
+ "@nexus-cortex/executors": "4.124.61",
51
+ "@nexus-cortex/types": "4.124.61",
52
52
  "@types/uuid": "^10.0.0",
53
53
  "ajv": "^8.12.0",
54
54
  "chokidar": "^3.6.0",