@nexus-cortex/core 4.81.0 → 4.82.0
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/dist/adapters/GatewayTranslationLayer.d.ts +11 -0
- package/dist/adapters/GatewayTranslationLayer.d.ts.map +1 -1
- package/dist/adapters/GatewayTranslationLayer.js.map +1 -1
- package/dist/interfaces/APITransport.d.ts +6 -0
- package/dist/interfaces/APITransport.d.ts.map +1 -1
- package/dist/middleware/HelperModelMiddleware.d.ts +17 -0
- package/dist/middleware/HelperModelMiddleware.d.ts.map +1 -1
- package/dist/middleware/HelperModelMiddleware.js +24 -0
- package/dist/middleware/HelperModelMiddleware.js.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.d.ts +16 -0
- package/dist/orchestrator/CortexOrchestrator.d.ts.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.js +95 -2
- package/dist/orchestrator/CortexOrchestrator.js.map +1 -1
- package/dist/orchestrator/toolChoiceTranslation.d.ts +29 -0
- package/dist/orchestrator/toolChoiceTranslation.d.ts.map +1 -0
- package/dist/orchestrator/toolChoiceTranslation.js +63 -0
- package/dist/orchestrator/toolChoiceTranslation.js.map +1 -0
- package/dist/tools/registries/BaseToolRegistry.d.ts.map +1 -1
- package/dist/tools/registries/BaseToolRegistry.js +24 -0
- package/dist/tools/registries/BaseToolRegistry.js.map +1 -1
- package/dist/training/DecisionStore.d.ts +7 -1
- package/dist/training/DecisionStore.d.ts.map +1 -1
- package/dist/training/DecisionStore.js +33 -0
- package/dist/training/DecisionStore.js.map +1 -1
- package/dist/training/mentorConsult.d.ts +51 -0
- package/dist/training/mentorConsult.d.ts.map +1 -0
- package/dist/training/mentorConsult.js +73 -0
- package/dist/training/mentorConsult.js.map +1 -0
- package/dist/training/thrashDetector.d.ts +42 -0
- package/dist/training/thrashDetector.d.ts.map +1 -0
- package/dist/training/thrashDetector.js +45 -0
- package/dist/training/thrashDetector.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrashDetector.d.ts","sourceRoot":"","sources":["../../src/training/thrashDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,SAAS,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,EAAE,YAA2D,CAAC;AAO1F,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,YAAY,CAMtF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,OAAO,EAAE,EACnB,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,YAAoC,GACxC,WAAW,CAUb"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* thrashDetector — shape-agnostic STRUGGLE signal (MENTORSHIP_ASK_FOR_ADVICE_SPEC §2).
|
|
3
|
+
*
|
|
4
|
+
* The dominant bench failure mode is DIVERSE-exploration thrash: the model makes many
|
|
5
|
+
* DIFFERENT failing attempts (44–105 calls on hard tasks) that the loop/approach
|
|
6
|
+
* detectors miss because it is not a clean repeated loop. This fires on failure
|
|
7
|
+
* DENSITY over a recent window — regardless of shape — once past a turn floor (a few
|
|
8
|
+
* failing probes early are normal debugging; cf. MAX_CONSECUTIVE_ERRORS=6). Pure +
|
|
9
|
+
* env-configurable; the orchestrator feeds it the recent tool outcomes it already
|
|
10
|
+
* tracks (the decision-store success/fail signal). Sterile-bench-safe (hot tier, no key).
|
|
11
|
+
*/
|
|
12
|
+
export const THRASH_DEFAULTS = { failThreshold: 4, window: 6, minTurns: 5 };
|
|
13
|
+
function posInt(v, d) {
|
|
14
|
+
const n = parseInt((v ?? '').trim(), 10);
|
|
15
|
+
return Number.isInteger(n) && n > 0 ? n : d;
|
|
16
|
+
}
|
|
17
|
+
export function resolveThrashConfig(env = process.env) {
|
|
18
|
+
return {
|
|
19
|
+
failThreshold: posInt(env.CORTEX_THRASH_FAILS, THRASH_DEFAULTS.failThreshold),
|
|
20
|
+
window: posInt(env.CORTEX_THRASH_WINDOW, THRASH_DEFAULTS.window),
|
|
21
|
+
minTurns: posInt(env.CORTEX_THRASH_MIN_TURNS, THRASH_DEFAULTS.minTurns),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Decide whether the agent is thrashing.
|
|
26
|
+
*
|
|
27
|
+
* @param outcomes success booleans of tool calls, chronological (oldest→newest).
|
|
28
|
+
* @param turnCount total tool calls so far (>= outcomes.length).
|
|
29
|
+
* @param cfg thresholds (defaults from env).
|
|
30
|
+
*
|
|
31
|
+
* Fires only when: past the turn floor, a FULL window is available, the failure
|
|
32
|
+
* count meets the threshold, AND the most-recent outcome is a failure (so it never
|
|
33
|
+
* fires right after the model just made progress).
|
|
34
|
+
*/
|
|
35
|
+
export function resolveThrashState(outcomes, turnCount, cfg = resolveThrashConfig()) {
|
|
36
|
+
const win = outcomes.slice(-cfg.window);
|
|
37
|
+
const failures = win.reduce((n, ok) => n + (ok ? 0 : 1), 0);
|
|
38
|
+
const currentlyFailing = win.length > 0 && win[win.length - 1] === false;
|
|
39
|
+
const thrashing = turnCount >= cfg.minTurns &&
|
|
40
|
+
win.length >= cfg.window &&
|
|
41
|
+
failures >= cfg.failThreshold &&
|
|
42
|
+
currentlyFailing;
|
|
43
|
+
return { thrashing, failures, examined: win.length };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=thrashDetector.js.map
|
|
@@ -0,0 +1 @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AAC,CAAC,CAAC;IAC5D,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC;IACzE,MAAM,SAAS,GACb,SAAS,IAAI,GAAG,CAAC,QAAQ;QACzB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,MAAM;QACxB,QAAQ,IAAI,GAAG,CAAC,aAAa;QAC7B,gBAAgB,CAAC;IACnB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;AACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexus-cortex/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.82.0",
|
|
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.
|
|
51
|
-
"@nexus-cortex/types": "4.
|
|
50
|
+
"@nexus-cortex/executors": "4.82.0",
|
|
51
|
+
"@nexus-cortex/types": "4.82.0",
|
|
52
52
|
"@types/uuid": "^10.0.0",
|
|
53
53
|
"ajv": "^8.12.0",
|
|
54
54
|
"chokidar": "^3.6.0",
|