nexus-agents 11.0.2 → 11.1.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.
@@ -5,7 +5,7 @@ import {
5
5
  getCurrentRequestContext,
6
6
  runWithRequestContext,
7
7
  serverCallerInfo
8
- } from "./chunk-Y34BCT36.js";
8
+ } from "./chunk-I7S3R5SQ.js";
9
9
  import {
10
10
  DEFAULT_EXECUTION_MODE
11
11
  } from "./chunk-TYLE7Z2S.js";
@@ -2343,4 +2343,4 @@ export {
2343
2343
  DEFAULT_CONSENSUS_CONFIG,
2344
2344
  ConsensusMetricsSchema
2345
2345
  };
2346
- //# sourceMappingURL=chunk-G667EEZ7.js.map
2346
+ //# sourceMappingURL=chunk-GAMT4NFP.js.map
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // src/version.ts
6
6
  import semver from "semver";
7
- var VERSION = true ? "11.0.2" : "dev";
7
+ var VERSION = true ? "11.1.0" : "dev";
8
8
  var NODE_ENGINE_RANGE = ">=24";
9
9
  function isNodeVersionSupported(version) {
10
10
  return semver.satisfies(version, NODE_ENGINE_RANGE);
@@ -106,4 +106,4 @@ export {
106
106
  contextForLogging,
107
107
  measuredTrustTier
108
108
  };
109
- //# sourceMappingURL=chunk-Y34BCT36.js.map
109
+ //# sourceMappingURL=chunk-I7S3R5SQ.js.map
@@ -21,7 +21,7 @@ import {
21
21
  toolSuccess,
22
22
  withProgressHeartbeat,
23
23
  wrapToolWithTimeout
24
- } from "./chunk-G667EEZ7.js";
24
+ } from "./chunk-GAMT4NFP.js";
25
25
  import {
26
26
  getToolMemory
27
27
  } from "./chunk-RR2Y2HVZ.js";
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-EZNIYU5T.js";
31
31
  import {
32
32
  VERSION
33
- } from "./chunk-Y34BCT36.js";
33
+ } from "./chunk-I7S3R5SQ.js";
34
34
  import {
35
35
  ModelBoundAdapter,
36
36
  UNVERIFIABLE_STDERR_RE,
@@ -9905,4 +9905,4 @@ export {
9905
9905
  CONSENSUS_VOTE_TOOL_SCHEMA,
9906
9906
  registerConsensusVoteTool
9907
9907
  };
9908
- //# sourceMappingURL=chunk-LSQ2IFMP.js.map
9908
+ //# sourceMappingURL=chunk-PNYCRRT6.js.map
package/dist/cli.js CHANGED
@@ -173,7 +173,7 @@ import {
173
173
  validateWorkflow,
174
174
  withPanelWorkspace,
175
175
  wrapInMarkdownFence
176
- } from "./chunk-TGUUUWJO.js";
176
+ } from "./chunk-7HPCEKK7.js";
177
177
  import "./chunk-QKWZZM2D.js";
178
178
  import "./chunk-WDAND5YU.js";
179
179
  import {
@@ -198,7 +198,7 @@ import {
198
198
  seatFallbacks,
199
199
  servedSubstitutions,
200
200
  toRecordDecision
201
- } from "./chunk-LSQ2IFMP.js";
201
+ } from "./chunk-PNYCRRT6.js";
202
202
  import {
203
203
  synthesizeResearch
204
204
  } from "./chunk-63YC42C2.js";
@@ -236,14 +236,14 @@ import {
236
236
  renderPlanAsResearch,
237
237
  runImprovementReview,
238
238
  scanForSecrets
239
- } from "./chunk-YUA3UBXT.js";
239
+ } from "./chunk-2JBWGPU6.js";
240
240
  import {
241
241
  getGlobalExecutionMode,
242
242
  setGlobalExecutionMode,
243
243
  setGlobalPolicyFirewall,
244
244
  setSecureHandlerAuditLogger,
245
245
  stagePolicyFirewallForRollout
246
- } from "./chunk-G667EEZ7.js";
246
+ } from "./chunk-GAMT4NFP.js";
247
247
  import "./chunk-AX5DBV3M.js";
248
248
  import "./chunk-4GDMHCKX.js";
249
249
  import "./chunk-I2THTVA4.js";
@@ -315,7 +315,7 @@ import {
315
315
  loadConfig,
316
316
  printDoctorSummary,
317
317
  runDoctor
318
- } from "./chunk-ZBWKLJNT.js";
318
+ } from "./chunk-3RUQILL4.js";
319
319
  import {
320
320
  allOf,
321
321
  anyOf
@@ -324,7 +324,7 @@ import {
324
324
  NODE_ENGINE_RANGE,
325
325
  VERSION,
326
326
  isNodeVersionSupported
327
- } from "./chunk-Y34BCT36.js";
327
+ } from "./chunk-I7S3R5SQ.js";
328
328
  import "./chunk-WAPGSEIM.js";
329
329
  import {
330
330
  claimGlobalRegistry,
@@ -12172,16 +12172,32 @@ function gatherLearningMetrics(bandit, metricsCollector, feedbackIntegration, op
12172
12172
  summary
12173
12173
  };
12174
12174
  }
12175
+ function routingFields(routingModel) {
12176
+ if (routingModel === void 0) {
12177
+ return {
12178
+ successRate: 0,
12179
+ avgLatencyMs: 0,
12180
+ avgQuality: 0,
12181
+ selectionPercent: 0,
12182
+ routingSelectionCount: 0
12183
+ };
12184
+ }
12185
+ return {
12186
+ successRate: routingModel.successRate,
12187
+ avgLatencyMs: routingModel.avgLatencyMs,
12188
+ avgQuality: routingModel.avgQuality,
12189
+ selectionPercent: routingModel.selectionPercent,
12190
+ routingSelectionCount: routingModel.selectionCount
12191
+ };
12192
+ }
12175
12193
  function banditToModelStats(stat2, routingModel) {
12176
12194
  return {
12177
12195
  name: stat2.name,
12178
12196
  pullCount: stat2.pullCount,
12179
12197
  avgReward: stat2.avgReward,
12180
12198
  cumulativeReward: stat2.cumulativeReward,
12181
- successRate: routingModel?.successRate ?? 0,
12182
- avgLatencyMs: routingModel?.avgLatencyMs ?? 0,
12183
- avgQuality: routingModel?.avgQuality ?? 0,
12184
- selectionPercent: routingModel?.selectionPercent ?? 0
12199
+ rewardSource: "bandit",
12200
+ ...routingFields(routingModel)
12185
12201
  };
12186
12202
  }
12187
12203
  function routingToModelStats(metric) {
@@ -12193,7 +12209,9 @@ function routingToModelStats(metric) {
12193
12209
  successRate: metric.successRate,
12194
12210
  avgLatencyMs: metric.avgLatencyMs,
12195
12211
  avgQuality: metric.avgQuality,
12196
- selectionPercent: metric.selectionPercent
12212
+ selectionPercent: metric.selectionPercent,
12213
+ rewardSource: "routing",
12214
+ routingSelectionCount: metric.selectionCount
12197
12215
  };
12198
12216
  }
12199
12217
  function aggregateModelStats(banditStats, routingMetrics) {
@@ -12296,6 +12314,7 @@ function computeSummary(models, banditProgress, feedbackLoop) {
12296
12314
 
12297
12315
  // src/cli/learning-metrics-format.ts
12298
12316
  var ANSI3 = colors;
12317
+ var UNMEASURED_NO_ROUTINGS = "unmeasured (0 routings)";
12299
12318
  function formatHeader3(result) {
12300
12319
  const lines = [];
12301
12320
  lines.push(color("\u256D" + horizontalLine() + "\u256E", ANSI3.cyan));
@@ -12304,21 +12323,45 @@ function formatHeader3(result) {
12304
12323
  lines.push(color("\u251C" + horizontalLine() + "\u2524", ANSI3.cyan));
12305
12324
  return lines;
12306
12325
  }
12326
+ function formatLearningStatus(result) {
12327
+ const statusEmoji = result.summary.learningStatus === "unmeasured" ? color("?", ANSI3.dim) : result.summary.learningStatus === "exploring" ? color("\u26A1", ANSI3.yellow) : result.summary.learningStatus === "exploiting" ? color("\u2713", ANSI3.green) : color("\u25CE", ANSI3.blue);
12328
+ const statusText = result.summary.learningStatus === "reconstructed" && result.banditReconstruction !== void 0 ? `reconstructed (${String(result.banditReconstruction.empiricalOutcomesReplayed)} empirical outcomes)` : result.summary.learningStatus === "unmeasured" ? result.banditReconstruction === void 0 ? "unmeasured (no routing decisions recorded)" : result.banditReconstruction.status === "failed" ? "unmeasured (reconstruction failed)" : "unmeasured (no empirical replay)" : result.summary.learningStatus;
12329
+ return { statusEmoji, statusText };
12330
+ }
12307
12331
  function formatSummary2(result) {
12308
12332
  const lines = [];
12309
12333
  lines.push(boxLine(color(" Summary:", ANSI3.bold)));
12310
- const statusEmoji = result.summary.learningStatus === "unmeasured" ? color("?", ANSI3.dim) : result.summary.learningStatus === "exploring" ? color("\u26A1", ANSI3.yellow) : result.summary.learningStatus === "exploiting" ? color("\u2713", ANSI3.green) : color("\u25CE", ANSI3.blue);
12311
- const statusText = result.summary.learningStatus === "reconstructed" && result.banditReconstruction !== void 0 ? `reconstructed (${String(result.banditReconstruction.empiricalOutcomesReplayed)} empirical outcomes)` : result.summary.learningStatus === "unmeasured" ? result.banditReconstruction === void 0 ? "unmeasured (no routing decisions recorded)" : result.banditReconstruction.status === "failed" ? "unmeasured (reconstruction failed)" : "unmeasured (no empirical replay)" : result.summary.learningStatus;
12334
+ const { statusEmoji, statusText } = formatLearningStatus(result);
12312
12335
  lines.push(boxLine(` ${statusEmoji} Learning Status: ${statusText}`));
12313
12336
  const routings = result.summary.totalRoutings.toLocaleString();
12314
12337
  lines.push(boxLine(` Total Routings: ${routings}`));
12315
- const successRate = formatPercentage(result.summary.overallSuccessRate, 1);
12338
+ const noRoutings = result.summary.totalRoutings === 0;
12339
+ const successRate = noRoutings ? UNMEASURED_NO_ROUTINGS : formatPercentage(result.summary.overallSuccessRate, 1);
12316
12340
  lines.push(boxLine(` Success Rate: ${successRate}`));
12317
- const avgReward = result.summary.avgReward.toFixed(3);
12341
+ const avgReward = noRoutings ? UNMEASURED_NO_ROUTINGS : result.summary.avgReward.toFixed(3);
12318
12342
  lines.push(boxLine(` Avg Reward: ${avgReward}`));
12319
12343
  lines.push(color("\u251C" + horizontalLine() + "\u2524", ANSI3.cyan));
12320
12344
  return lines;
12321
12345
  }
12346
+ function sampleLabel(source, count) {
12347
+ return `${count.toLocaleString()} ${source === "bandit" ? "pulls" : "routings"}`;
12348
+ }
12349
+ function formatSelectionShare(model) {
12350
+ if (model.routingSelectionCount === 0) return UNMEASURED_NO_ROUTINGS;
12351
+ const barLength = Math.min(20, Math.max(0, Math.round(model.selectionPercent * 0.2)));
12352
+ const bar = "\u2588".repeat(barLength) + "\u2591".repeat(20 - barLength);
12353
+ return `${bar} ${model.selectionPercent.toFixed(1).padStart(5)}%`;
12354
+ }
12355
+ function formatModelReward(model) {
12356
+ if (model.pullCount === 0) {
12357
+ return model.rewardSource === "bandit" ? "unmeasured (0 bandit pulls)" : UNMEASURED_NO_ROUTINGS;
12358
+ }
12359
+ return `${model.avgReward.toFixed(2)} (${model.rewardSource}, ${sampleLabel(model.rewardSource, model.pullCount)})`;
12360
+ }
12361
+ function formatModelSuccess(model) {
12362
+ if (model.routingSelectionCount === 0) return UNMEASURED_NO_ROUTINGS;
12363
+ return `${formatPercentage(model.successRate)} (routing, ${sampleLabel("routing", model.routingSelectionCount)})`;
12364
+ }
12322
12365
  function formatModelStats(models) {
12323
12366
  const lines = [];
12324
12367
  lines.push(boxLine(color(" Model Performance:", ANSI3.bold)));
@@ -12328,13 +12371,10 @@ function formatModelStats(models) {
12328
12371
  return lines;
12329
12372
  }
12330
12373
  for (const model of models) {
12331
- const pct2 = model.selectionPercent.toFixed(1);
12332
- const barLength = Math.min(20, Math.max(0, Math.round(model.selectionPercent * 0.2)));
12333
- const bar = "\u2588".repeat(barLength) + "\u2591".repeat(20 - barLength);
12334
- lines.push(boxLine(` ${model.name.padEnd(10)} ${bar} ${pct2.padStart(5)}%`));
12335
- const reward = model.avgReward.toFixed(2);
12336
- const success = formatPercentage(model.successRate);
12337
- lines.push(boxLine(` reward: ${reward.padStart(5)} | success: ${success.padStart(4)}`));
12374
+ lines.push(boxLine(` ${model.name.padEnd(10)} ${formatSelectionShare(model)}`));
12375
+ lines.push(
12376
+ boxLine(` reward: ${formatModelReward(model)} | success: ${formatModelSuccess(model)}`)
12377
+ );
12338
12378
  }
12339
12379
  lines.push(color("\u251C" + horizontalLine() + "\u2524", ANSI3.cyan));
12340
12380
  return lines;
@@ -12397,7 +12437,7 @@ function formatFeedbackLoop(feedback) {
12397
12437
  const decisions = feedback.totalDecisions.toLocaleString();
12398
12438
  const outcomes = feedback.totalOutcomes.toLocaleString();
12399
12439
  lines.push(boxLine(` Decisions: ${decisions} | Outcomes: ${outcomes}`));
12400
- const correlation = formatPercentage(feedback.correlationRate, 1);
12440
+ const correlation = feedback.totalDecisions === 0 ? "unmeasured (0 decisions)" : formatPercentage(feedback.correlationRate, 1);
12401
12441
  lines.push(boxLine(` Correlation Rate: ${correlation}`));
12402
12442
  const dist = feedback.outcomeDistribution;
12403
12443
  const total = dist.success + dist.partial + dist.failure;
@@ -19287,7 +19327,7 @@ function startImprovementReviewScheduler(options) {
19287
19327
  let running = false;
19288
19328
  const runOnce = async () => {
19289
19329
  try {
19290
- const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-UQUJ4ZR5.js");
19330
+ const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-VYT24FPH.js");
19291
19331
  const input = ImprovementReviewInputSchema2.parse({ fileIssues });
19292
19332
  const result = await runImprovementReview2(input, { logger: logger23 });
19293
19333
  logger23.info("Scheduled improvement_review complete", {
@@ -21970,6 +22010,22 @@ var REVIEW_HELP = {
21970
22010
  { flag: "--skip-checks", description: "Skip pre-flight validation" }
21971
22011
  ]
21972
22012
  };
22013
+ var LEARNING_METRICS_HELP = {
22014
+ command: "learning-metrics",
22015
+ examples: [
22016
+ "nexus-agents learning-metrics",
22017
+ "nexus-agents learning-metrics --period=48 --bandit-stats",
22018
+ "nexus-agents learning-metrics --json",
22019
+ "nexus-agents learning-metrics --export=metrics.json"
22020
+ ],
22021
+ flags: [
22022
+ { flag: "--period=<hours>", description: "Time period for metrics", defaultValue: "24" },
22023
+ { flag: "--json", description: "Output the same data as JSON (same as --format=json)" },
22024
+ { flag: "--bandit-stats", description: "Include LinUCB bandit progress and features" },
22025
+ { flag: "--no-trends", description: "Hide the reward trend section" },
22026
+ { flag: "--export=<path>", description: "Write the JSON output to a file" }
22027
+ ]
22028
+ };
21973
22029
  var COMMAND_HELP = [
21974
22030
  ORCHESTRATE_HELP,
21975
22031
  VOTE_HELP,
@@ -21981,7 +22037,8 @@ var COMMAND_HELP = [
21981
22037
  CONFIG_HELP,
21982
22038
  RESEARCH_HELP,
21983
22039
  FITNESS_AUDIT_HELP,
21984
- REVIEW_HELP
22040
+ REVIEW_HELP,
22041
+ LEARNING_METRICS_HELP
21985
22042
  ];
21986
22043
  function formatFlag(entry) {
21987
22044
  const defaultSuffix = entry.defaultValue !== void 0 ? ` (default: ${entry.defaultValue})` : "";
@@ -22487,7 +22544,7 @@ function handleValidationCommand(args) {
22487
22544
  return cliExitFromStatus(exitCode);
22488
22545
  }
22489
22546
  function handleLearningMetricsCommand(args) {
22490
- const format = args.options.format === "json" ? "json" : "ascii";
22547
+ const format = args.options.json === true || args.options.format === "json" || args.options.export !== void 0 ? "json" : "ascii";
22491
22548
  const periodNum = args.options.period !== void 0 ? Number(args.options.period) : void 0;
22492
22549
  const period = periodNum !== void 0 && Number.isFinite(periodNum) && periodNum > 0 ? periodNum : 24;
22493
22550
  const exitCode = learningMetricsCommand({