nexrall-code 0.5.57 → 0.5.58

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.
Files changed (2) hide show
  1. package/dist/index.js +28 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9982,7 +9982,7 @@ var require_client = __commonJS({
9982
9982
  }
9983
9983
  var MAX_TOTAL_ATTEMPTS = (MAX_RETRIES + 1) * (MAX_RETRIES + 1);
9984
9984
  async function streamChat(messages, options, onEvent) {
9985
- const { model, env: env3, editorContext, nexrallMd, mode, effort, clientType, abortSignal, extraTools, agents, skills, allowRestartAfterRender, canWriteSharedMemory, hasOwnAgentStore } = options;
9985
+ const { model, env: env3, editorContext, nexrallMd, mode, effort, clientType, abortSignal, extraTools, agents, skills, allowRestartAfterRender, canWriteSharedMemory, hasOwnAgentStore, canSpawnSubAgents } = options;
9986
9986
  let turnId = (0, crypto_1.randomUUID)();
9987
9987
  const controller = new AbortController();
9988
9988
  if (abortSignal?.aborted)
@@ -10023,7 +10023,7 @@ var require_client = __commonJS({
10023
10023
  {
10024
10024
  method: "POST",
10025
10025
  headers: authHeaders(),
10026
- body: JSON.stringify({ messages, model, env: env3, editorContext, nexrallMd, mode, effort, clientType, extraTools, agents, skills, turnId, canWriteSharedMemory, hasOwnAgentStore }),
10026
+ body: JSON.stringify({ messages, model, env: env3, editorContext, nexrallMd, mode, effort, clientType, extraTools, agents, skills, turnId, canWriteSharedMemory, hasOwnAgentStore, canSpawnSubAgents }),
10027
10027
  signal: controller.signal
10028
10028
  }
10029
10029
  ];
@@ -15061,6 +15061,13 @@ var require_agentTypes = __commonJS({
15061
15061
  message: `lists unknown tool name(s): ${unknown.join(", ")}. An allowlist only grants, so these silently do nothing and the agent cannot use them. Tool names are lower_snake_case (read_file, search_files, glob, bash).`
15062
15062
  });
15063
15063
  }
15064
+ if ((tools ?? []).includes("task")) {
15065
+ warnings.push({
15066
+ file: full,
15067
+ agent: name,
15068
+ message: "lists `task`, which cannot be granted: sub-agents are never sent that tool because they cannot spawn further sub-agents. Remove it \u2014 delegation stays with the main agent."
15069
+ });
15070
+ }
15064
15071
  const strayKeys = Object.keys(meta).filter((k) => !KNOWN_META_KEYS.has(k));
15065
15072
  if (strayKeys.length) {
15066
15073
  warnings.push({
@@ -15954,7 +15961,7 @@ var require_loop = __commonJS({
15954
15961
  };
15955
15962
  }();
15956
15963
  Object.defineProperty(exports, "__esModule", { value: true });
15957
- exports.VERIFY_CMD_RE = exports.WRITE_TOOL_NAMES = exports.ToolNotAllowedError = exports.AGENT_MEMORY_TOOL_SCHEMA = exports.AGENT_MEMORY_TOOL = exports._stallLimits = exports.bashNeedsRepoLock = void 0;
15964
+ exports.VERIFY_CMD_RE = exports.WRITE_TOOL_NAMES = exports.ToolNotAllowedError = exports.NO_NESTED_SUBAGENTS_MSG = exports.AGENT_MEMORY_TOOL_SCHEMA = exports.AGENT_MEMORY_TOOL = exports._stallLimits = exports.bashNeedsRepoLock = void 0;
15958
15965
  exports.errorRoundSignature = errorRoundSignature;
15959
15966
  exports.executeAgentMemoryWrite = executeAgentMemoryWrite;
15960
15967
  exports.stopReasonNotice = stopReasonNotice;
@@ -15963,6 +15970,7 @@ var require_loop = __commonJS({
15963
15970
  exports.resolveMaxConcurrentSubtasks = resolveMaxConcurrentSubtasks;
15964
15971
  exports.createLimiter = createLimiter;
15965
15972
  exports._resetSubTaskLimiter = _resetSubTaskLimiter;
15973
+ exports.canSpawnSubAgents = canSpawnSubAgents;
15966
15974
  exports.resolveSubtaskTimeoutMs = resolveSubtaskTimeoutMs;
15967
15975
  exports.extractSubTaskText = extractSubTaskText;
15968
15976
  exports.capSubTaskText = capSubTaskText;
@@ -16357,6 +16365,12 @@ ${ctx.repeatError}
16357
16365
  }
16358
16366
  }
16359
16367
  var MAX_TASK_DEPTH = 1;
16368
+ exports.NO_NESTED_SUBAGENTS_MSG = "Sub-agents cannot spawn further sub-agents \u2014 this is a structural limit, not a permission, so no other agent type and no approval can lift it. Do this work directly with the tools you have, or report back so the main agent can delegate it.";
16369
+ function canSpawnSubAgents(depth, allowedTools) {
16370
+ if (depth >= MAX_TASK_DEPTH)
16371
+ return false;
16372
+ return allowedTools ? allowedTools.has("task") : true;
16373
+ }
16360
16374
  var _subTaskCounter = 0;
16361
16375
  var DEFAULT_SUBTASK_TIMEOUT_MS = 10 * 60 * 1e3;
16362
16376
  function resolveSubtaskTimeoutMs(settingsRaw) {
@@ -16485,7 +16499,7 @@ ${body}`);
16485
16499
  return { error: "task tool requires a non-empty prompt" };
16486
16500
  const depth = options._depth ?? 0;
16487
16501
  if (depth >= MAX_TASK_DEPTH) {
16488
- return { error: "Sub-agents cannot spawn further sub-agents. Do this work directly, or report back so the main agent can delegate it." };
16502
+ return { error: exports.NO_NESTED_SUBAGENTS_MSG };
16489
16503
  }
16490
16504
  const resumeId = typeof input.resume_agent_id === "string" ? input.resume_agent_id.trim() : "";
16491
16505
  const resumed = resumeId ? (0, agentRegistry_1.getAgent)(resumeId) : void 0;
@@ -16536,6 +16550,9 @@ ${inheritedMd}` : "") : options.nexrallMd;
16536
16550
  if (req.tool === exports.AGENT_MEMORY_TOOL && !(agent && memoryScope)) {
16537
16551
  throw new ToolNotAllowedError(`\`${exports.AGENT_MEMORY_TOOL}\` is only available to a sub-agent whose definition declares a \`memory:\` scope (project, user or local). Report anything worth remembering in your final message instead \u2014 the main agent decides what to persist.`);
16538
16552
  }
16553
+ if (req.tool === "task") {
16554
+ throw new ToolNotAllowedError(exports.NO_NESTED_SUBAGENTS_MSG);
16555
+ }
16539
16556
  if (allowed && !allowed.has(req.tool)) {
16540
16557
  throw new ToolNotAllowedError(`The "${agent.name}" sub-agent is not allowed to use \`${req.tool}\` \u2014 it is not in that agent's tool allowlist. This is a restriction of the agent definition, NOT a user decision: do not ask for approval, use one of the tools you do have, or report back that the task needs a different agent.`);
16541
16558
  }
@@ -17070,7 +17087,8 @@ Continue the work from here.` }] });
17070
17087
  const agentScope = options._agentScope ?? "root";
17071
17088
  const settings = (0, rules_1.loadSettings)(options.workDir);
17072
17089
  const agentTypes = (0, agentTypes_1.loadAgentTypes)(options.workDir).filter((t2) => (0, rules_1.evaluatePermission)(settings.permissions, "task", { subagent_type: t2.name }, options.workDir) !== "deny");
17073
- const agentsCatalogue = depth === 0 ? (0, agentTypes_1.summariseAgents)(agentTypes) : "";
17090
+ const maySpawn = canSpawnSubAgents(depth, options._allowedTools);
17091
+ const agentsCatalogue = maySpawn ? (0, agentTypes_1.summariseAgents)(agentTypes) : "";
17074
17092
  const skillsCatalogue = (0, skills_1.summariseSkills)((0, skills_1.loadSkills)(options.workDir));
17075
17093
  const planAwareNexrallMd = options.planMode ? planMode_1.PLAN_MODE_INSTRUCTIONS + (options.nexrallMd ? `
17076
17094
 
@@ -17220,6 +17238,9 @@ ${options.nexrallMd}` : "") : options.nexrallMd;
17220
17238
  canWriteSharedMemory: options._allowedTools ? options._allowedTools.has("memory_write") : true,
17221
17239
  // no allowlist = main agent = may write
17222
17240
  hasOwnAgentStore: !!options._agentMemory,
17241
+ // Withholds the `task` schema and its instructions when this run cannot
17242
+ // delegate — see canSpawnSubAgents.
17243
+ canSpawnSubAgents: maySpawn,
17223
17244
  agents: agentsCatalogue || void 0,
17224
17245
  skills: skillsCatalogue || void 0,
17225
17246
  // Only allow a post-render restart when the caller actually implements the
@@ -64554,7 +64575,7 @@ var InkReadlineAdapter = class extends EventEmitter3 {
64554
64575
  };
64555
64576
 
64556
64577
  // src/commands/chat.ts
64557
- var CLI_VERSION = "0.5.57";
64578
+ var CLI_VERSION = "0.5.58";
64558
64579
  var MODEL_LABELS = {
64559
64580
  turbo: "Nexrall Turbo",
64560
64581
  pro: "Nexrall Pro",
@@ -66225,7 +66246,7 @@ function pluginSourceRemoveCommand(name, opts) {
66225
66246
 
66226
66247
  // src/index.ts
66227
66248
  var program2 = new Command();
66228
- program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.57").enablePositionalOptions();
66249
+ program2.name("nex").description("Nexrall Code \u2014 AI coding assistant (powered by Nexrall)").version("0.5.58").enablePositionalOptions();
66229
66250
  program2.command("auth").description("Login to your Nexrall account").action(authCommand);
66230
66251
  program2.command("logout").description("Log out of your Nexrall account").action(logoutCommand);
66231
66252
  program2.command("update").description("Update nex to the latest version").option("-c, --check", "Check for updates without installing").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexrall-code",
3
- "version": "0.5.57",
3
+ "version": "0.5.58",
4
4
  "description": "Nexrall Code — AI coding assistant for your terminal (headless agent for scripts, CI and automation)",
5
5
  "keywords": [
6
6
  "ai",
@@ -41,7 +41,7 @@
41
41
  "react": "^19.2.8",
42
42
  "readline": "^1.3.0",
43
43
  "string-width": "^7.2.0",
44
- "@nexrall/code-core": "1.4.32"
44
+ "@nexrall/code-core": "1.4.33"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@aws-sdk/client-s3": "^3.600.0",