@nexus-cortex/core 4.124.42 → 4.124.44
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.defaults +110 -0
- package/dist/adapters/GatewayTranslationLayer.d.ts.map +1 -1
- package/dist/adapters/GatewayTranslationLayer.js +10 -0
- package/dist/adapters/GatewayTranslationLayer.js.map +1 -1
- package/dist/config/SettingsLoader.d.ts +3 -1
- package/dist/config/SettingsLoader.d.ts.map +1 -1
- package/dist/config/SettingsLoader.js +18 -4
- package/dist/config/SettingsLoader.js.map +1 -1
- package/dist/config/SettingsSchema.d.ts +1 -0
- package/dist/config/SettingsSchema.d.ts.map +1 -1
- package/dist/config/SettingsSchema.js +9 -0
- package/dist/config/SettingsSchema.js.map +1 -1
- package/dist/config/effectiveConfig.d.ts +1 -1
- package/dist/config/effectiveConfig.d.ts.map +1 -1
- package/dist/config/effectiveConfig.js +14 -2
- package/dist/config/effectiveConfig.js.map +1 -1
- package/dist/config/interactiveProfile.d.ts +86 -0
- package/dist/config/interactiveProfile.d.ts.map +1 -0
- package/dist/config/interactiveProfile.js +114 -0
- package/dist/config/interactiveProfile.js.map +1 -0
- package/dist/middleware/HelperModelMiddleware.d.ts +10 -0
- package/dist/middleware/HelperModelMiddleware.d.ts.map +1 -1
- package/dist/middleware/HelperModelMiddleware.js +49 -6
- package/dist/middleware/HelperModelMiddleware.js.map +1 -1
- package/dist/middleware/SystemMessageMiddleware.d.ts.map +1 -1
- package/dist/middleware/SystemMessageMiddleware.js +4 -2
- package/dist/middleware/SystemMessageMiddleware.js.map +1 -1
- package/dist/middleware/helpers/helperProviderMatch.d.ts +40 -0
- package/dist/middleware/helpers/helperProviderMatch.d.ts.map +1 -0
- package/dist/middleware/helpers/helperProviderMatch.js +50 -0
- package/dist/middleware/helpers/helperProviderMatch.js.map +1 -0
- package/dist/orchestrator/APIClient.d.ts.map +1 -1
- package/dist/orchestrator/APIClient.js +26 -3
- package/dist/orchestrator/APIClient.js.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.d.ts +2 -1
- package/dist/orchestrator/CortexOrchestrator.d.ts.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.js +23 -3
- package/dist/orchestrator/CortexOrchestrator.js.map +1 -1
- package/dist/orchestrator/OrchestratorFactory.d.ts.map +1 -1
- package/dist/orchestrator/OrchestratorFactory.js +10 -0
- package/dist/orchestrator/OrchestratorFactory.js.map +1 -1
- package/dist/orchestrator/plateauStop.d.ts +12 -3
- package/dist/orchestrator/plateauStop.d.ts.map +1 -1
- package/dist/orchestrator/plateauStop.js +18 -6
- package/dist/orchestrator/plateauStop.js.map +1 -1
- package/dist/orchestrator/transportFixes.d.ts +55 -0
- package/dist/orchestrator/transportFixes.d.ts.map +1 -0
- package/dist/orchestrator/transportFixes.js +182 -0
- package/dist/orchestrator/transportFixes.js.map +1 -0
- package/dist/system-messages/promptPresets.d.ts +29 -1
- package/dist/system-messages/promptPresets.d.ts.map +1 -1
- package/dist/system-messages/promptPresets.js +44 -2
- package/dist/system-messages/promptPresets.js.map +1 -1
- package/dist/training/DecisionStore.d.ts +1 -1
- package/dist/training/DecisionStore.d.ts.map +1 -1
- package/dist/training/DecisionStore.js.map +1 -1
- package/dist/training/endTurnResolver.d.ts +7 -2
- package/dist/training/endTurnResolver.d.ts.map +1 -1
- package/dist/training/endTurnResolver.js +7 -4
- package/dist/training/endTurnResolver.js.map +1 -1
- package/dist/training/liftPlanner.d.ts +2 -1
- package/dist/training/liftPlanner.d.ts.map +1 -1
- package/dist/training/liftPlanner.js +5 -2
- package/dist/training/liftPlanner.js.map +1 -1
- package/dist/training/taskRules.d.ts +33 -0
- package/dist/training/taskRules.d.ts.map +1 -0
- package/dist/training/taskRules.js +68 -0
- package/dist/training/taskRules.js.map +1 -0
- package/package.json +3 -3
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Based on: docs/v4-core_library/Orchestrator_ARCHITECTURE.md
|
|
9
9
|
*/
|
|
10
|
+
import { liftPlanAllowedInSession } from '../config/interactiveProfile.js';
|
|
10
11
|
import { v4 as uuidv4 } from 'uuid';
|
|
11
12
|
import { ToolNamingHandler } from '../adapters/ToolNamingHandler.js';
|
|
12
13
|
// Phase 2.4: Server-Side Tools Support
|
|
@@ -93,6 +94,7 @@ import { resolveEffortRamp, rampEffortFor } from './effortRamp.js';
|
|
|
93
94
|
import { resolveWallDrop, resolveOutputCap, dropWalledTurn, resolveWallSummary, extractWalledReasoning, clipReasoning, formatWallSummary } from './wallGuard.js';
|
|
94
95
|
import { resolvePid1Guard, detectPid1Note } from './pid1Guard.js'; // R209
|
|
95
96
|
import { PlateauStopTracker, plateauBootInstruction, plateauStatusSegment } from './plateauStop.js'; // R210
|
|
97
|
+
import { resolveTaskRules, taskRulesPlanBlock, taskRulesJudgeClause } from '../training/taskRules.js'; // R211–R214
|
|
96
98
|
import { resolveComputeNudge, computeNudgeDecision, buildComputeNudgeLine, lastAssistantReasoningTokens } from './computeNudge.js';
|
|
97
99
|
import { classifyEmptyResponse, emptyResponseNudge, nudgeForbidsTools, emptyResponseNudgeFor, isReasoningExhaustion, stepDownEffort, effortLadderFor, resolveExhaustLadderMode, resolveReasoningExhaustBackoff } from './emptyResponseClassifier.js';
|
|
98
100
|
import { isImageRejectionError, stripRejectedImages } from './imageRejectionHeal.js'; // R154
|
|
@@ -277,6 +279,7 @@ export class CortexOrchestrator {
|
|
|
277
279
|
specFailHistory = new Map(); // R174b: consecutive identical spec failures
|
|
278
280
|
lastHoldMs = 0; // R173c: wall clock of the last hold/veto this turn
|
|
279
281
|
derivationHolds = 0; // R176: independent-derivation holds this turn (max 1)
|
|
282
|
+
taskRulePlanRecorded = false; // R211–R214: task_rule_plan is banked once per session
|
|
280
283
|
liftPlanText = ''; // 4.107.0: the PLAN OF ATTACK delivered at lift — handed to the resolver / deadline-exit / loop-exit judges as an advisory anchor
|
|
281
284
|
effectiveDeferredLoading = true; // per-turn resolved deferred-loading (card > env > settings); set at assembly
|
|
282
285
|
/**
|
|
@@ -451,11 +454,11 @@ export class CortexOrchestrator {
|
|
|
451
454
|
}
|
|
452
455
|
/** R210 HB-PLATEAU-STOP: scan this round's tool results for PLATEAU_METRIC reports and return the plateau reminder (or null) for
|
|
453
456
|
* the budget-steering signals line. Off → null without scanning. Events: plateau_metric_seen (first report of a metric name),
|
|
454
|
-
* plateau_stop (each firing, max 2 per session). Never throws. */
|
|
457
|
+
* plateau_stop (each firing, max 2 per session); in `status` mode plateau_detected replaces plateau_stop and no reminder is returned. Never throws. */
|
|
455
458
|
observePlateau(toolResults, iteration, streaming) {
|
|
456
459
|
try {
|
|
457
460
|
const r = this.plateauTracker.step(toolResults); // off → returns before touching the results
|
|
458
|
-
if (!r.newMetrics.length && !r.fire)
|
|
461
|
+
if (!r.newMetrics.length && !r.fire && !r.detected)
|
|
459
462
|
return null;
|
|
460
463
|
const store = this.getDecisionStore();
|
|
461
464
|
const sessionId = this.currentSessionId ?? 'unknown';
|
|
@@ -469,6 +472,10 @@ export class CortexOrchestrator {
|
|
|
469
472
|
if (this.config.debug)
|
|
470
473
|
console.log(`[PlateauStop] ${r.fire.name} plateau (${r.fire.improvementPct}% over the window, ${r.fire.points} points) — firing ${r.fire.firing}`);
|
|
471
474
|
}
|
|
475
|
+
if (r.detected) { // CORTEX_PLATEAU_STOP=status: would-have-fired point, nothing steered
|
|
476
|
+
if (store)
|
|
477
|
+
void store.recordEvent({ sessionId, kind: 'plateau_detected', detail: { ...r.detected, iteration, streaming } }).catch(() => { });
|
|
478
|
+
}
|
|
472
479
|
return r.signal;
|
|
473
480
|
}
|
|
474
481
|
catch {
|
|
@@ -544,7 +551,9 @@ export class CortexOrchestrator {
|
|
|
544
551
|
// there is no human watching — fine. In an interactive TUI a silent pause reads as a frozen UI,
|
|
545
552
|
// so the planner is SUPPRESSED there UNLESS a thinking-indicator is wired and opted in via
|
|
546
553
|
// CORTEX_LIFT_PLAN_INTERACTIVE=true. (autoApproveActions = !(stdin.isTTY && stdout.isTTY).)
|
|
547
|
-
|
|
554
|
+
// R219: the gate lives in config/interactiveProfile.ts (same env the CORTEX_INTERACTIVE_PROFILE resolver fills;
|
|
555
|
+
// bench-lite leaves it closed — NEEDS-ADAPTATION: silent pause, first-request-only, grader persona).
|
|
556
|
+
if (!liftPlanAllowedInSession(this.approvalMode.autoApproveActions)) {
|
|
548
557
|
return; // interactive session, no thinking-indicator opt-in → do not fire (do not consume one-shot)
|
|
549
558
|
}
|
|
550
559
|
this.liftPlanDelivered = true; // one-shot even if the call fails (never re-fire mid-task)
|
|
@@ -656,6 +665,13 @@ export class CortexOrchestrator {
|
|
|
656
665
|
// so a k=5 run can score plan QUALITY (and read the reasoning behind a RETIRE).
|
|
657
666
|
detail: { fired: true, planChars: plan.length, retire, criteriaStated, latencyMs, ...r171, mentor: this.mentorWire('lift-plan', resolveLiftPlanConfig().effort, resolveLiftPlanConfig().outputBudgetTokens), ...bankPlanText(plan) },
|
|
658
667
|
}).catch(() => { });
|
|
668
|
+
// R211–R214 HB-TASK-RULES (CORTEX_RULE_*, dark): the planner persona carried the active rule bullets — once per session.
|
|
669
|
+
const planRules = resolveTaskRules();
|
|
670
|
+
if (planRules.length && !this.taskRulePlanRecorded) {
|
|
671
|
+
this.taskRulePlanRecorded = true;
|
|
672
|
+
if (store)
|
|
673
|
+
void store.recordEvent({ sessionId, kind: 'task_rule_plan', detail: { rules: planRules, blockChars: taskRulesPlanBlock(planRules).length, planChars: plan.length, retire } }).catch(() => { });
|
|
674
|
+
}
|
|
659
675
|
if (this.config.debug) {
|
|
660
676
|
console.log(`[LiftPlan] plan delivered at lift (${plan.length} chars, retire=${retire}, criteria=${criteriaStated})`);
|
|
661
677
|
}
|
|
@@ -1367,6 +1383,9 @@ export class CortexOrchestrator {
|
|
|
1367
1383
|
// R208 HB-VERIFY-AT-SCALE (CORTEX_VERIFY_SCALE=on, dark): the judge persona carried the scale rubric item on this adjudication.
|
|
1368
1384
|
if (store && cfg.verifyScale)
|
|
1369
1385
|
void store.recordEvent({ sessionId, kind: 'verify_scale_item', toolName: 'EndTurn', detail: { surface: 'endturn-resolver', clauseChars: RESOLVER_SCALE_CLAUSE.length, roundsUsed, meets: verdict.meets, parsed: verdict.parsed, confidence: verdict.confidence } }).catch(() => { });
|
|
1386
|
+
// R211–R214 HB-TASK-RULES (CORTEX_RULE_*, dark): the judge persona carried the active rule clauses on this adjudication.
|
|
1387
|
+
if (store && cfg.taskRules.length)
|
|
1388
|
+
void store.recordEvent({ sessionId, kind: 'task_rule_judge', toolName: 'EndTurn', detail: { surface: 'endturn-resolver', rules: cfg.taskRules, clauseChars: taskRulesJudgeClause(cfg.taskRules).length, roundsUsed, meets: verdict.meets, parsed: verdict.parsed, confidence: verdict.confidence } }).catch(() => { });
|
|
1370
1389
|
if (store)
|
|
1371
1390
|
void store.recordEvent({
|
|
1372
1391
|
sessionId,
|
|
@@ -1387,6 +1406,7 @@ export class CortexOrchestrator {
|
|
|
1387
1406
|
reqLedger: cfg.reqLedger, reqLines: reqCounts.lines, reqOpen: reqCounts.open, reqExercised: reqCounts.exercised, reqFailed: reqCounts.failed, reqUnverifiable: reqCounts.unverifiable, reqHeld: !!reqHold, reqHolds: this.reqLedgerHolds, reqGenLatencyMs: this.reqLedgerMeta.genLatencyMs, reqJev: cfg.reqLedgerJev, reqJevAsked: reqJev?.asked ?? 0, reqJevClosed: reqJev?.closed ?? [], reqJevLatencyMs: reqJev?.latencyMs ?? 0, // R187/R187b
|
|
1388
1407
|
reqFailVeto: !!reqFailVeto, reqFailVetoes: this.reqLedgerFailVetoes, reqFailedNow, reqFailJev, // R192
|
|
1389
1408
|
verifyScale: cfg.verifyScale, // R208
|
|
1409
|
+
taskRules: cfg.taskRules, // R211–R214
|
|
1390
1410
|
reqBroken: [...this.reqLedgerBroken], reqLinesDetail: (this.reqLedger ?? []).map((e) => ({ id: e.id, kind: e.kind, status: e.status, check: !!e.check, runs: e.runs, last: (e.lastResult ?? '').split('\n').slice(0, 2).join(' / ').slice(0, 200) })), // R191: per-line outcomes so a false-failure read is possible from the decisions file
|
|
1391
1411
|
latencyMs, rawLen: (text ?? '').length,
|
|
1392
1412
|
deltaChars: workspaceDelta.length, checkRan: !!checkResult, checkPassed: checkResult ? /→ PASSED/.test(checkResult) : null,
|