@nexus-cortex/cli 4.133.1 → 4.134.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/.env.defaults CHANGED
@@ -1657,6 +1657,16 @@ CORTEX_ENDTURN_GATE=true
1657
1657
  # [LEDGER 2026-11-12 in tree, UNMEASURED] motivation: holdout-8 web runs, judge reviews were most of the 5-9x harness time (11-04: 116 of
1658
1658
  # 296 task-minutes).
1659
1659
  #CORTEX_ENDTURN_RESOLVER_WEB=
1660
+ # [LEDGER 2026-11-13 @4.134.0 SHIPPED ON] widened (operator 11-13: "desktop tasks should perhaps be like web tasks, the model isnt going
1661
+ # to use the desktop for coding"): a finish counts as web/observation-evidenced when it read WEB tool results, nexus-browser MCP results
1662
+ # (direct browser driving — FIX: before this a direct-browser finish was never a web turn, so this lever rarely fired under user-hybrid)
1663
+ # or nexus-desktop results, and wrote no files. Integrity's sources check still keys on web-tool content only (browser MCP kept out).
1664
+ # CORTEX_ENDTURN_USER_HALT — default ON: when the desktop tool returns its latched STOP refusal ('desktop control is STOPPED by the user')
1665
+ # the turn is user-halted: the EndTurn gate accepts the finish without its stages and the judge skips it (decisions event
1666
+ # endturn_user_halt / endturn_resolver skipped:user-halt). Keyed on the desktop TOOL result, never on model text. off = old behaviour.
1667
+ # [LEDGER 2026-11-13 @4.134.0 SHIPPED ON] operator 11-13 "yes build the desktop stop short-circuit". Evidence: macbook D7 T5 retest on
1668
+ # 4.133.1/0.10.1 — after the stop the agent spent 3.5 min and 5 EndTurn calls (1 rejected) before reporting. Unit: endTurnUserHalt.test.ts.
1669
+ #CORTEX_ENDTURN_USER_HALT=
1660
1670
  # CORTEX_RESOLVER_WEB_RULE — EndTurn judge web-answer rubric, appended to the judge persona on WEB turns only (web results read, no files
1661
1671
  # changed). A GAP must name a stated constraint the page evidence shows unmet (price, rating, size, location, date, count, a required filter),
1662
1672
  # an answer the evidence contradicts, or a required fact with no evidence; NO wording vetoes (a site's own synonym/abbreviation satisfies a
@@ -2221,6 +2231,17 @@ PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=
2221
2231
  # 6c460bfc3 with default 2 — corrected to 1 the same day after finding the 10-19 design.) Unit tests
2222
2232
  # browseAgentPolicy.test.ts; live check: the Browse delegate runs with CORTEX_BROWSE_AGENT=true.
2223
2233
  #CORTEX_MAX_AGENT_DEPTH=
2234
+ # CORTEX_TOOL_PARENT_DEPTH — INTERNAL marker (do not set by hand): every process an agent's tool starts (Bash, …; core toolChildEnv) carries
2235
+ # the depth of the agent that started it. bin/cortex.js refuses to start ANOTHER agent from such a process (prompt / agent / run / TUI,
2236
+ # and the agent-launching subcommands autoresearch, message, tmux; exit 3, "use the Task tool"); info commands still work. Closes the
2237
+ # gap where a sub-agent ran `cortex …` through Bash and got an unbounded fresh agent (often on the parent's shared :4000 server at
2238
+ # depth 0). Empty = unmarked (the vitest configs blank it so suites run from an agent's Bash behave).
2239
+ # [LEDGER 2026-11-12 @4.133.3 SHIPPED ON] (4.133.2 CI-failed, never on npm) operator 11-12 "fix the sub-agent nesting gap". Evidence: bin refusal + toolChildEnv marker tests.
2240
+ #CORTEX_TOOL_PARENT_DEPTH=
2241
+ # CORTEX_ALLOW_NESTED_AGENT — operator override for the guard above: true (REAL env only) lets a tool-started process launch cortex
2242
+ # agents again. Default unset = refused.
2243
+ # [LEDGER 2026-11-12 @4.133.3 SHIPPED ON] default unset (guard on).
2244
+ #CORTEX_ALLOW_NESTED_AGENT=
2224
2245
  TMUX_BIN=
2225
2246
  # Google Vertex AI project (only when using Vertex instead of the Gemini API)
2226
2247
  GOOGLE_CLOUD_PROJECT=
package/bin/cortex.js CHANGED
@@ -124,6 +124,21 @@ const COMMANDER_SUBCOMMANDS = new Set([
124
124
  'secrets', 'canon', 'features', 'sessions', 'server', 'browser', 'desktop',
125
125
  ]);
126
126
  const __firstPositional = args.find((a) => !a.startsWith('-'));
127
+ // 2026-11-12 sub-agent NESTING GUARD: an agent's tool (Bash …) marks its children with CORTEX_TOOL_PARENT_DEPTH (core toolChildEnv). From
128
+ // there, anything that would start ANOTHER agent conversation is refused: a prompt / `agent` / `run` / the TUI, and the agent-launching
129
+ // subcommands (autoresearch, message, tmux). Info commands (--version, --help, --sessions, --stats, config, secrets, canon, update …) still
130
+ // work. Sub-agents go through the bounded Task tool. CORTEX_ALLOW_NESTED_AGENT=true (real env) is the operator override.
131
+ {
132
+ const __parent = process.env.CORTEX_TOOL_PARENT_DEPTH;
133
+ const __infoOnly = args.some((a) => ['--help', '-h', '--sessions', '--stats', '--list-models', '--models'].includes(a));
134
+ const __launches = !__infoOnly && (!__firstPositional || !COMMANDER_SUBCOMMANDS.has(__firstPositional) || ['autoresearch', 'message', 'tmux'].includes(__firstPositional));
135
+ if (__parent && __launches && process.env.CORTEX_ALLOW_NESTED_AGENT !== 'true') {
136
+ process.stderr.write(`cortex: refused — this command was started by an agent's tool (agent depth ${__parent}), and it would start another agent. `
137
+ + 'Use the Task tool to delegate to a sub-agent (it is depth-bounded); do not launch cortex from a shell inside an agent. '
138
+ + '(Operator override: CORTEX_ALLOW_NESTED_AGENT=true.)\n');
139
+ process.exit(3);
140
+ }
141
+ }
127
142
  if (__firstPositional && COMMANDER_SUBCOMMANDS.has(__firstPositional)) {
128
143
  // A few delegated subcommands talk to the cortex server over HTTP (they connect via
129
144
  // CortexClient to localhost:PORT). Auto-start the server first so e.g.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cortex/cli",
3
- "version": "4.133.1",
3
+ "version": "4.134.0",
4
4
  "description": "Nexus Cortex CLI - Terminal interface for multi-provider LLM orchestration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "prepack": "node ../../scripts/copy-pkg-cortex-scaffold.mjs"
20
20
  },
21
21
  "dependencies": {
22
- "@nexus-cortex/core": "4.133.1",
22
+ "@nexus-cortex/core": "4.134.0",
23
23
  "chalk": "^4.1.2",
24
24
  "cli-spinners": "^2.9.0",
25
25
  "commander": "^11.0.0",