nexus-agents 4.3.4 → 4.3.6

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.
@@ -52,7 +52,7 @@ import {
52
52
  } from "./chunk-OQLFRJCW.js";
53
53
 
54
54
  // src/version.ts
55
- var VERSION = true ? "4.3.4" : "dev";
55
+ var VERSION = true ? "4.3.6" : "dev";
56
56
 
57
57
  // src/config/schemas-core.ts
58
58
  import { z } from "zod";
@@ -2339,7 +2339,7 @@ async function runDoctorFix(result) {
2339
2339
  writeLine2("\u2500".repeat(40));
2340
2340
  let fixCount = 0;
2341
2341
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2342
- const { runSetup } = await import("./setup-command-H7FJXFMF.js");
2342
+ const { runSetup } = await import("./setup-command-TLIVUIVE.js");
2343
2343
  const setupResult = runSetup({
2344
2344
  skipMcp: true,
2345
2345
  skipRules: true,
@@ -2452,4 +2452,4 @@ export {
2452
2452
  startStdioServer,
2453
2453
  closeServer
2454
2454
  };
2455
- //# sourceMappingURL=chunk-C3VVVABX.js.map
2455
+ //# sourceMappingURL=chunk-CDLXONR6.js.map
@@ -22,7 +22,7 @@ import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  DEFAULT_TOOL_RATE_LIMITS,
24
24
  clampTaskTtl
25
- } from "./chunk-C3VVVABX.js";
25
+ } from "./chunk-CDLXONR6.js";
26
26
  import {
27
27
  executeExpert
28
28
  } from "./chunk-QTP4AIVR.js";
@@ -54497,4 +54497,4 @@ export {
54497
54497
  shutdownFeedbackSubscriber,
54498
54498
  createEventBusBridge
54499
54499
  };
54500
- //# sourceMappingURL=chunk-I27YOL3U.js.map
54500
+ //# sourceMappingURL=chunk-K6VI5GUF.js.map
@@ -8,7 +8,7 @@ import {
8
8
  checkSqlite,
9
9
  defaultConfig,
10
10
  initDataDirectories
11
- } from "./chunk-C3VVVABX.js";
11
+ } from "./chunk-CDLXONR6.js";
12
12
  import {
13
13
  BUILT_IN_EXPERTS
14
14
  } from "./chunk-YPNQPT2F.js";
@@ -2001,4 +2001,4 @@ export {
2001
2001
  setupCommand,
2002
2002
  setupCommandAsync
2003
2003
  };
2004
- //# sourceMappingURL=chunk-YV7MHKY7.js.map
2004
+ //# sourceMappingURL=chunk-NXGHNZJV.js.map
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ import "./chunk-TKFWYFBD.js";
18
18
  import {
19
19
  setupCommandAsync,
20
20
  verifyCommand
21
- } from "./chunk-YV7MHKY7.js";
21
+ } from "./chunk-NXGHNZJV.js";
22
22
  import "./chunk-YIV4GQHK.js";
23
23
  import {
24
24
  AuthHandler,
@@ -139,7 +139,7 @@ import {
139
139
  validateCommand,
140
140
  validateWorkflow,
141
141
  wrapInMarkdownFence
142
- } from "./chunk-I27YOL3U.js";
142
+ } from "./chunk-K6VI5GUF.js";
143
143
  import "./chunk-SHG3MYMD.js";
144
144
  import "./chunk-HFOQKCD2.js";
145
145
  import "./chunk-RSMG2DPB.js";
@@ -166,7 +166,7 @@ import {
166
166
  loadConfig,
167
167
  runDoctor,
168
168
  validateNexusEnv
169
- } from "./chunk-C3VVVABX.js";
169
+ } from "./chunk-CDLXONR6.js";
170
170
  import {
171
171
  buildOpenAICompatAdapters,
172
172
  readOpenAICompatEnv
@@ -4279,6 +4279,14 @@ function validateCommandWithPolicy(commandString, options = {}) {
4279
4279
  }
4280
4280
  return null;
4281
4281
  }
4282
+ function readErrorStdout(error) {
4283
+ if (typeof error !== "object" || error === null || !("stdout" in error)) return null;
4284
+ const { stdout } = error;
4285
+ const text = typeof stdout === "string" ? stdout : Buffer.isBuffer(stdout) ? stdout.toString("utf-8") : null;
4286
+ if (text === null) return null;
4287
+ const trimmed = text.trim();
4288
+ return trimmed === "" ? null : trimmed;
4289
+ }
4282
4290
  function safeExecSandboxed(commandString, options = {}) {
4283
4291
  const violation = validateCommandWithPolicy(commandString, options);
4284
4292
  if (violation !== null) {
@@ -4302,6 +4310,13 @@ function safeExecSandboxed(commandString, options = {}) {
4302
4310
  const result = execSync(commandString, execOptions);
4303
4311
  return typeof result === "string" ? result.trim() : result.toString("utf-8").trim();
4304
4312
  } catch (error) {
4313
+ if (options.allowNonZeroExit === true) {
4314
+ const stdout = readErrorStdout(error);
4315
+ if (stdout !== null) {
4316
+ logger4.debug("Command exited non-zero but produced output", { command: commandString });
4317
+ return stdout;
4318
+ }
4319
+ }
4305
4320
  logger4.debug("Command execution failed", {
4306
4321
  command: commandString,
4307
4322
  error: getErrorMessage(error)
@@ -6329,6 +6344,12 @@ var SYSTEM_REVIEW_CONSTANTS = {
6329
6344
  /** Security severity penalties */
6330
6345
  SECURITY_HIGH_PENALTY: 20,
6331
6346
  SECURITY_MODERATE_PENALTY: 5,
6347
+ /**
6348
+ * Applied when the audit could not run (#4838). An unmeasured audit is not
6349
+ * evidence of health, so it must not score the same as a clean one; it is
6350
+ * set below SECURITY_HIGH_PENALTY because "unknown" is not "known bad".
6351
+ */
6352
+ SECURITY_UNMEASURED_PENALTY: 10,
6332
6353
  /** Code quality penalties */
6333
6354
  TYPECHECK_FAIL_PENALTY: 15,
6334
6355
  LINT_FAIL_PENALTY: 15,
@@ -6347,6 +6368,7 @@ var {
6347
6368
  DOC_REVIEW_PENALTY,
6348
6369
  SECURITY_HIGH_PENALTY,
6349
6370
  SECURITY_MODERATE_PENALTY,
6371
+ SECURITY_UNMEASURED_PENALTY,
6350
6372
  TYPECHECK_FAIL_PENALTY,
6351
6373
  LINT_FAIL_PENALTY,
6352
6374
  LOW_COVERAGE_PENALTY,
@@ -6357,7 +6379,7 @@ function calculateHealthScore(r) {
6357
6379
  for (const d of r.docs) {
6358
6380
  score -= d.status === "stale" ? DOC_STALE_PENALTY : d.status === "review" ? DOC_REVIEW_PENALTY : 0;
6359
6381
  }
6360
- score -= r.security.high * SECURITY_HIGH_PENALTY + r.security.moderate * SECURITY_MODERATE_PENALTY;
6382
+ score -= r.security.parseError === true ? SECURITY_UNMEASURED_PENALTY : r.security.high * SECURITY_HIGH_PENALTY + r.security.moderate * SECURITY_MODERATE_PENALTY;
6361
6383
  if (!r.quality.typecheckPass) score -= TYPECHECK_FAIL_PENALTY;
6362
6384
  if (!r.quality.lintPass) score -= LINT_FAIL_PENALTY;
6363
6385
  if (r.quality.coveragePercent !== null && r.quality.coveragePercent < COVERAGE_TARGET_PERCENT) {
@@ -6402,6 +6424,11 @@ function printPhase3(i) {
6402
6424
  function printPhase4(s) {
6403
6425
  writeLine(`${colors.cyan}Phase 4: Security Audit${colors.reset}
6404
6426
  `);
6427
+ if (s.parseError === true) {
6428
+ writeLine(` ${formatStatus("warn")} Unmeasured \u2014 the audit did not run`);
6429
+ writeLine("");
6430
+ return;
6431
+ }
6405
6432
  if (s.totalVulns === 0) {
6406
6433
  writeLine(` ${formatStatus("pass")} No vulnerabilities found`);
6407
6434
  } else {
@@ -6428,6 +6455,9 @@ function formatDocRow(d) {
6428
6455
  const newerInfo = newerCount > 0 ? ` (${String(newerCount)} newer deps)` : "";
6429
6456
  return `| ${d.file} | ${String(d.daysSinceUpdate)} | ${statusIcon}${newerInfo} |`;
6430
6457
  }
6458
+ function formatSecurityCaveat(s) {
6459
+ return s.parseError === true ? "> **Unmeasured:** the audit did not run \u2014 the counts below are defaults, not findings.\n\n" : "";
6460
+ }
6431
6461
  function createIssueBody(r) {
6432
6462
  const now = new Date(getTimeProvider().now());
6433
6463
  const date = now.toISOString().split("T")[0] ?? "unknown";
@@ -6462,7 +6492,7 @@ ${r.docs.map(formatDocRow).join("\n")}
6462
6492
 
6463
6493
  ### Phase 4: Security
6464
6494
 
6465
- - High: ${String(r.security.high)}
6495
+ ${formatSecurityCaveat(r.security)}- High: ${String(r.security.high)}
6466
6496
  - Moderate: ${String(r.security.moderate)}
6467
6497
  - Low: ${String(r.security.low)}
6468
6498
 
@@ -6750,9 +6780,9 @@ var {
6750
6780
  NOT_STARTED_TECHNIQUE_THRESHOLD,
6751
6781
  HEALTH_SCORE_WARN_THRESHOLD: HEALTH_SCORE_WARN_THRESHOLD2
6752
6782
  } = SYSTEM_REVIEW_CONSTANTS;
6753
- function safeExec(command, cwd) {
6783
+ function safeExec(command, cwd, allowNonZeroExit = false) {
6754
6784
  const context = command.startsWith("gh ") ? "gh" : command.startsWith("git ") ? "git" : command.startsWith("pnpm ") ? "write" : "read";
6755
- return cwd !== void 0 ? safeExecSandboxed(command, { context, cwd }) : safeExecSandboxed(command, { context });
6785
+ return cwd !== void 0 ? safeExecSandboxed(command, { context, cwd, allowNonZeroExit }) : safeExecSandboxed(command, { context, allowNonZeroExit });
6756
6786
  }
6757
6787
  function parseGhIssueList(json, context) {
6758
6788
  try {
@@ -6828,7 +6858,7 @@ function runPhase3() {
6828
6858
  }
6829
6859
  function runPhase4(projectRoot) {
6830
6860
  const def = { totalVulns: 0, high: 0, moderate: 0, low: 0, parseError: false };
6831
- const out = safeExec("pnpm audit --json", projectRoot);
6861
+ const out = safeExec("pnpm audit --json", projectRoot, true);
6832
6862
  if (out === null) {
6833
6863
  logger7.warn("pnpm audit command failed or returned null", { projectRoot });
6834
6864
  return { ...def, parseError: true };
@@ -13204,9 +13234,10 @@ async function recordToolTask(storage, input) {
13204
13234
  const taskDescription = `${input.tool_name}: ${summarizeToolInput(input.tool_input)}`;
13205
13235
  const taskResult = await storage.addTask(activeSession.id, taskDescription);
13206
13236
  if (!taskResult.ok) return;
13237
+ const outcome = classifyToolResponse(input.tool_response);
13207
13238
  await storage.updateTask(taskResult.value.id, {
13208
- result: summarizeToolResponse(input.tool_response),
13209
- status: TaskStatus.COMPLETED,
13239
+ result: outcome.summary,
13240
+ status: outcome.status,
13210
13241
  durationMs: metrics.durationMs,
13211
13242
  tokensUsed: metrics.tokensUsed
13212
13243
  });
@@ -13236,17 +13267,23 @@ function summarizeToolInput(toolInput) {
13236
13267
  const keys = Object.keys(toolInput);
13237
13268
  return keys.length > 0 ? keys.join(", ") : "(no input)";
13238
13269
  }
13239
- function summarizeToolResponse(toolResponse) {
13270
+ function classifyToolResponse(toolResponse) {
13240
13271
  const error = toolResponse.error ?? toolResponse.stderr;
13241
13272
  if (error !== void 0 && error !== "") {
13242
- return `Error: ${safeString(error).substring(0, 100)}`;
13273
+ return {
13274
+ status: TaskStatus.FAILED,
13275
+ summary: `Error: ${safeString(error).substring(0, 100)}`
13276
+ };
13243
13277
  }
13244
13278
  const stdout = toolResponse.stdout ?? toolResponse.output ?? toolResponse.content;
13245
13279
  if (stdout !== void 0) {
13246
13280
  const out = safeString(stdout);
13247
- return out.length > 100 ? `${out.substring(0, 100)}...` : out;
13281
+ return {
13282
+ status: TaskStatus.COMPLETED,
13283
+ summary: out.length > 100 ? `${out.substring(0, 100)}...` : out
13284
+ };
13248
13285
  }
13249
- return "completed";
13286
+ return { status: TaskStatus.COMPLETED, summary: "completed" };
13250
13287
  }
13251
13288
  function extractFilePath(toolInput) {
13252
13289
  const filePath = toolInput.file_path ?? toolInput.path ?? toolInput.notebook_path;