@nexus-cortex/core 4.108.8 → 4.108.10
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 +11 -0
- package/dist/config/RuntimeConfigRegistry.d.ts.map +1 -1
- package/dist/config/RuntimeConfigRegistry.js +1 -0
- package/dist/config/RuntimeConfigRegistry.js.map +1 -1
- package/dist/config/SettingsLoader.d.ts.map +1 -1
- package/dist/config/SettingsLoader.js +1 -0
- 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.map +1 -1
- package/dist/config/effectiveConfig.js +1 -0
- package/dist/config/effectiveConfig.js.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.d.ts +4 -0
- package/dist/orchestrator/CortexOrchestrator.d.ts.map +1 -1
- package/dist/orchestrator/CortexOrchestrator.js +25 -7
- package/dist/orchestrator/CortexOrchestrator.js.map +1 -1
- package/dist/orchestrator/outerToolTimeout.d.ts +11 -1
- package/dist/orchestrator/outerToolTimeout.d.ts.map +1 -1
- package/dist/orchestrator/outerToolTimeout.js +16 -2
- package/dist/orchestrator/outerToolTimeout.js.map +1 -1
- package/dist/orchestrator/sliceBlock.d.ts +14 -0
- package/dist/orchestrator/sliceBlock.d.ts.map +1 -1
- package/dist/orchestrator/sliceBlock.js +14 -0
- package/dist/orchestrator/sliceBlock.js.map +1 -1
- package/dist/training/chunkReadProgression.d.ts +30 -0
- package/dist/training/chunkReadProgression.d.ts.map +1 -0
- package/dist/training/chunkReadProgression.js +80 -0
- package/dist/training/chunkReadProgression.js.map +1 -0
- package/dist/training/loopLadder.d.ts +2 -1
- package/dist/training/loopLadder.d.ts.map +1 -1
- package/dist/training/loopLadder.js +15 -2
- package/dist/training/loopLadder.js.map +1 -1
- package/dist/training/toolOutcome.d.ts +5 -0
- package/dist/training/toolOutcome.d.ts.map +1 -1
- package/dist/training/toolOutcome.js +3 -0
- package/dist/training/toolOutcome.js.map +1 -1
- package/package.json +3 -3
|
@@ -36,14 +36,14 @@ import { SubAgentProcessManager, createSubAgentProcessManager } from './SubAgent
|
|
|
36
36
|
// Phase 1: Tool Architecture Refactor - Unified Tool Registry
|
|
37
37
|
import { toolFactory } from '../tools/ToolFactory.js';
|
|
38
38
|
import { resolveToolProfile, resolveToolAnchor, resolveFrameProfile, resolveLiftNudge, resolveLiftPlan, resolveEndTurnResolver, resolveHeadlessDropAskUser, resolveDeferredLoading, isNarrowProfile, isToolAllowedByProfile, applyToolProfile, webToolBlocked, resolveVisionHelperModel, resolveVisionHandoffMax, resolveSliceNudge, resolveSliceBlock, resolveSliceBlockAt, resolveSliceBlockMax } from '../tools/ToolProfile.js';
|
|
39
|
-
import { sliceReadFile, decideSliceBlock } from './sliceBlock.js';
|
|
39
|
+
import { sliceReadFile, decideSliceBlock, sliceReadStep } from './sliceBlock.js';
|
|
40
40
|
import { TurnEvidence, evaluateEndTurnGates, buildMissingEndTurnReminder } from './endTurnGates.js';
|
|
41
41
|
import { resolveCompactionResume, pickDropped, buildCompactionResumeReminder, isCompactionResumeMessage, resolveTaskText, resumeMemoryTargetTokens, coversAll, buildRollingSeedMessage, memoryIndexLine, upsertMemoryIndex, scaleEstimateToRequestView, approxCharsOf, anchoredRequestEstimate } from './compactionResume.js';
|
|
42
42
|
import { renderResumeMemoryPrompt, buildRebuildInstructions, resolveCheckpointBand, resolveRearmBand } from './compactionResumeTemplate.js';
|
|
43
43
|
import { resolveCortexStateDir, cortexStatePath } from '../utils/stateDir.js';
|
|
44
44
|
import { collectWorkspaceDelta, detectCheckCommand, runCheck, resolveJudgeGroundingConfig } from '../training/judgeEvidence.js';
|
|
45
45
|
import { resolveMentorRoleConfig, describeMentorWire, describeMentorDelivery, mentorSurfaceTimeoutMs } from '../training/mentorRole.js';
|
|
46
|
-
import { resolveOuterToolDeadlineMs } from './outerToolTimeout.js';
|
|
46
|
+
import { resolveOuterToolDeadlineMs, resolveOuterToolTimeoutFloorMs } from './outerToolTimeout.js';
|
|
47
47
|
import { resolveSubAgentTimeoutMs } from './subAgentTimeout.js';
|
|
48
48
|
import { resolveTurnDeadlineMs, timeBudgetState, timeBudgetWarnNudge } from './timeBudget.js';
|
|
49
49
|
import { readStagedDoctrine, applyCuratedDoctrine, runOrientForStaging, withTimeout } from './doctrineCuration.js';
|
|
@@ -1596,6 +1596,7 @@ export class CortexOrchestrator {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
const MAX_TOOL_ITERATIONS = loopDefaults.maxToolIterations;
|
|
1598
1598
|
const TOOL_TIMEOUT_MS = loopDefaults.toolTimeoutMs;
|
|
1599
|
+
const OUTER_TOOL_TIMEOUT_FLOOR_MS = loopDefaults.outerToolTimeoutFloorMs;
|
|
1599
1600
|
const MAX_CONSECUTIVE_ERRORS = loopDefaults.maxConsecutiveErrors;
|
|
1600
1601
|
const MAX_LOOP_REPETITIONS = loopDefaults.maxLoopRepetitions;
|
|
1601
1602
|
const TOOL_BUDGET_SOFT = loopDefaults.toolBudgetSoft; // R29b brake
|
|
@@ -2333,7 +2334,7 @@ export class CortexOrchestrator {
|
|
|
2333
2334
|
const abortController = new AbortController();
|
|
2334
2335
|
// D-A (2026-09-04): outer cap must sit ABOVE the model's REQUESTED Bash timeout, not a static
|
|
2335
2336
|
// ~150s, or a legit `Bash({ timeout: 250000 })` is killed before ShellTool's own promote-at-deadline.
|
|
2336
|
-
const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs);
|
|
2337
|
+
const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs, OUTER_TOOL_TIMEOUT_FLOOR_MS);
|
|
2337
2338
|
const timeoutId = setTimeout(() => {
|
|
2338
2339
|
console.warn(`[Orchestrator Phase 2.5] Tool execution timeout after ${outerDeadlineMs}ms`);
|
|
2339
2340
|
abortController.abort();
|
|
@@ -3792,6 +3793,7 @@ export class CortexOrchestrator {
|
|
|
3792
3793
|
const MAX_CONSECUTIVE_ERRORS = loopDefaults.maxConsecutiveErrors;
|
|
3793
3794
|
const MAX_LOOP_REPETITIONS = loopDefaults.maxLoopRepetitions;
|
|
3794
3795
|
const TOOL_TIMEOUT_MS = loopDefaults.toolTimeoutMs;
|
|
3796
|
+
const OUTER_TOOL_TIMEOUT_FLOOR_MS = loopDefaults.outerToolTimeoutFloorMs;
|
|
3795
3797
|
const TOOL_BUDGET_SOFT = loopDefaults.toolBudgetSoft; // R29b brake
|
|
3796
3798
|
// R64: TOOL_BUDGET_SOFT <= 0 disables the budget-pressure system entirely
|
|
3797
3799
|
// (no reminders, no force-synthesis cap). Runaway protection then rests on
|
|
@@ -4140,7 +4142,7 @@ export class CortexOrchestrator {
|
|
|
4140
4142
|
// see the non-stream site: ShellTool's promote-at-deadline must win the race; 4.90.1)
|
|
4141
4143
|
const abortController = new AbortController();
|
|
4142
4144
|
// D-A (2026-09-04): outer cap sits above the requested Bash timeout (see the non-stream site).
|
|
4143
|
-
const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs);
|
|
4145
|
+
const outerDeadlineMs = resolveOuterToolDeadlineMs(toolUseBlocks, TOOL_TIMEOUT_MS, OUTER_TIMEOUT_GRACE_MS, this.subAgentBlockTimeoutMs, OUTER_TOOL_TIMEOUT_FLOOR_MS);
|
|
4144
4146
|
const timeoutId = setTimeout(() => {
|
|
4145
4147
|
if (this.config.debug) {
|
|
4146
4148
|
console.warn(`[Orchestrator Streaming] Tool execution timeout after ${outerDeadlineMs}ms`);
|
|
@@ -5138,6 +5140,8 @@ export class CortexOrchestrator {
|
|
|
5138
5140
|
// coercion silently replaced an explicit 0 with 15.
|
|
5139
5141
|
toolBudgetSoft: Number.isFinite(softRaw) && softRaw >= 0 ? softRaw : 400,
|
|
5140
5142
|
toolTimeoutMs: this.config.loopControl?.toolTimeoutMs ?? 120000,
|
|
5143
|
+
// CORTEX_OUTER_TOOL_TIMEOUT_MS: floor for the outer per-batch abort (0 = no floor, byte-identical).
|
|
5144
|
+
outerToolTimeoutFloorMs: resolveOuterToolTimeoutFloorMs(),
|
|
5141
5145
|
maxLoopRepetitions: this.config.loopControl?.maxLoopRepetitions ?? 5,
|
|
5142
5146
|
// #2 wall-clock deadline: opt-in (0 = disabled), env CORTEX_TURN_DEADLINE_MS is the fallback.
|
|
5143
5147
|
turnDeadlineMs: resolveTurnDeadlineMs(this.config.loopControl?.turnDeadlineMs),
|
|
@@ -7593,6 +7597,9 @@ export class CortexOrchestrator {
|
|
|
7593
7597
|
visionHandoffsThisTurn = 0;
|
|
7594
7598
|
/** Per-session bash slice-read counts per file (CORTEX_SLICE_NUDGE). */
|
|
7595
7599
|
sliceReads = new Map();
|
|
7600
|
+
/** HB-CHUNKED-READS (R128): last parsed chunk (line range) per file — a disjoint increasing
|
|
7601
|
+
* progression over one file is NOT a re-read for the slice nudge/block (sliceReadStep). */
|
|
7602
|
+
lastSliceChunk = new Map();
|
|
7596
7603
|
/** Per-session coercive-block counts per file (CORTEX_SLICE_BLOCK — HB-SLICE-BLOCK). */
|
|
7597
7604
|
sliceBlockCounts = new Map();
|
|
7598
7605
|
/** Dependencies the shared EndTurn gates need from the orchestrator (endTurnGates.ts). */
|
|
@@ -7622,10 +7629,16 @@ export class CortexOrchestrator {
|
|
|
7622
7629
|
applySliceNudge(toolUse, result) {
|
|
7623
7630
|
if (toolUse.name !== 'Bash' || result.is_error || !resolveSliceNudge(process.env))
|
|
7624
7631
|
return;
|
|
7625
|
-
const
|
|
7632
|
+
const cmd = String(toolUse.input?.command ?? '');
|
|
7633
|
+
const file = sliceReadFile(cmd);
|
|
7626
7634
|
if (!file)
|
|
7627
7635
|
return;
|
|
7628
|
-
const
|
|
7636
|
+
const step = sliceReadStep(this.sliceReads.get(file) ?? 0, this.lastSliceChunk.get(file), cmd);
|
|
7637
|
+
if (step.chunk)
|
|
7638
|
+
this.lastSliceChunk.set(file, step.chunk);
|
|
7639
|
+
if (step.progression)
|
|
7640
|
+
return; // next chunk of the same file (HB-CHUNKED-READS): not a re-read
|
|
7641
|
+
const n = step.count;
|
|
7629
7642
|
this.sliceReads.set(file, n);
|
|
7630
7643
|
if (n !== 3)
|
|
7631
7644
|
return;
|
|
@@ -7645,9 +7658,14 @@ export class CortexOrchestrator {
|
|
|
7645
7658
|
maybeBlockSliceRead(toolUse) {
|
|
7646
7659
|
if (toolUse.name !== 'Bash' || !resolveSliceBlock(process.env))
|
|
7647
7660
|
return null;
|
|
7648
|
-
const
|
|
7661
|
+
const cmd = String(toolUse.input?.command ?? '');
|
|
7662
|
+
const file = sliceReadFile(cmd);
|
|
7649
7663
|
if (!file)
|
|
7650
7664
|
return null;
|
|
7665
|
+
// HB-CHUNKED-READS (R128): the next disjoint chunk of a file the model is reading sequentially is
|
|
7666
|
+
// never blocked (peek only — applySliceNudge records the chunk after execution).
|
|
7667
|
+
if (sliceReadStep(0, this.lastSliceChunk.get(file), cmd).progression)
|
|
7668
|
+
return null;
|
|
7651
7669
|
const priorSlices = this.sliceReads.get(file) ?? 0;
|
|
7652
7670
|
const priorBlocks = this.sliceBlockCounts.get(file) ?? 0;
|
|
7653
7671
|
const decision = decideSliceBlock(file, priorSlices, priorBlocks, resolveSliceBlockAt(process.env), resolveSliceBlockMax(process.env));
|