@nexus-cortex/core 4.123.1 → 4.123.3

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.
@@ -21,7 +21,7 @@ import { execSync } from 'node:child_process';
21
21
  import { ENV_RECON_COMMAND, resolveLiftPlanConfig, parsePlannerResponse } from '../training/liftPlanner.js';
22
22
  import { resolveEndTurnResolverConfig, parseResolverVerdict, effectiveMaxRejects, budgetedVetoEscalation, decideVetoAction, shouldFinishConfirm, buildFinishConfirmMessage, buildMeetsConfirmMessage, gapHoldable, parseSpecChecks, applyVetoFloor, holdProgressed, planSimilarity, specCheckEvidence } from '../training/endTurnResolver.js';
23
23
  import { jevAvailable, jevNoul, buildGapHoldState, GAP_HOLD_QUESTIONS } from '../training/jevGate.js'; // R173b
24
- import { isValueShapedTask, parseDerivationReply, methodsDiffer, parseValueLines, extractNumbers, reconcile, buildDerivationHoldMessage, isDerivationCommandAllowed } from '../training/independentDerivation.js'; // R176
24
+ import { isValueShapedTask, parseDerivationReply, methodsDiffer, parseValueLines, extractNumbers, reconcile, buildDerivationHoldMessage, isDerivationCommandAllowed, checkRunPassed, checkRunBody } from '../training/independentDerivation.js'; // R176
25
25
  import { resolveDeadlineExitConfig, deadlineExitCallBudget, parseDeadlineExitVerdict } from '../training/deadlineExitMentor.js';
26
26
  import { isTaskShaped } from './requirementsVerification.js';
27
27
  import { extractServerSideMetadata, XAIServerSideTools, OpenAIServerSideTools, toCanonicalTool } from '../tools/ServerSideTools.js';
@@ -1044,13 +1044,15 @@ export class CortexOrchestrator {
1044
1044
  for (const c of allowed) {
1045
1045
  const r = runCheck(judgeCwd, c, jcfg);
1046
1046
  outputs.push(r);
1047
- Object.assign(derived, parseValueLines(r));
1048
- }
1047
+ if (checkRunPassed(r))
1048
+ Object.assign(derived, parseValueLines(checkRunBody(r)));
1049
+ } // R176b: a FAILED check derives nothing
1049
1050
  // Fallback when the author printed values without the `VALUE name=` contract: take the LAST few numbers each check printed
1050
1051
  // and require that at least one matches the deliverable — conservative (a disagreement needs every printed number to miss).
1051
1052
  let fallback = false;
1052
- if (!Object.keys(derived).length && outputs.length) {
1053
- const tail = outputs.flatMap((o) => extractNumbers(o.split('\n').slice(1).join('\n')).slice(-3));
1053
+ const passedOutputs = outputs.filter(checkRunPassed);
1054
+ if (!Object.keys(derived).length && passedOutputs.length) { // R176b: never read numbers out of a failed check's diagnostics
1055
+ const tail = passedOutputs.flatMap((o) => extractNumbers(checkRunBody(o)).slice(-3));
1054
1056
  tail.slice(-6).forEach((v, i) => { derived[`printed${i + 1}`] = String(v); });
1055
1057
  fallback = tail.length > 0;
1056
1058
  }
@@ -1058,7 +1060,7 @@ export class CortexOrchestrator {
1058
1060
  if (fallback && rec.compared.some((c) => c.matched !== null))
1059
1061
  rec = { ...rec, agreement: 'agree' };
1060
1062
  const differ = methodsDiffer(plan.methodAgent, plan.methodIndependent);
1061
- derivationInfo = { ...derivationInfo, methodAgent: plan.methodAgent, methodIndependent: plan.methodIndependent, methodsDiffer: differ, checks: allowed.length, refused: refusedCmds.length, refusedCmds, fallback, checkOutputs: outputs.map((o) => o.slice(0, 600)), derived, agreement: rec.agreement, compared: rec.compared, latencyMs: Date.now() - d0 };
1063
+ derivationInfo = { ...derivationInfo, methodAgent: plan.methodAgent, methodIndependent: plan.methodIndependent, methodsDiffer: differ, checks: allowed.length, checksPassed: passedOutputs.length, checkCmds: allowed.map((c) => c.slice(0, 300)), refused: refusedCmds.length, refusedCmds, fallback, checkOutputs: outputs.map((o) => o.slice(0, 600)), derived, agreement: rec.agreement, compared: rec.compared, latencyMs: Date.now() - d0 };
1062
1064
  if (rec.agreement === 'disagree' && differ)
1063
1065
  derivationHold = { message: buildDerivationHoldMessage({ methodIndependent: plan.methodIndependent, compared: rec.compared, remainingFrac: resolverRemainingFrac }) };
1064
1066
  console.warn(`[EndTurnResolver] R176 DERIVATION — ${rec.agreement} (${allowed.length} check(s), methodsDiffer=${differ}) in ${Date.now() - d0} ms`);