nexus-agents 2.156.0 → 2.157.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.
@@ -18,13 +18,14 @@ import {
18
18
  DEFAULT_TASK_TTL_MS,
19
19
  DEFAULT_TOOL_RATE_LIMITS,
20
20
  clampTaskTtl
21
- } from "./chunk-IDOAR55M.js";
21
+ } from "./chunk-OXYGRB4C.js";
22
22
  import {
23
23
  executeExpert
24
24
  } from "./chunk-BGAK4N74.js";
25
25
  import {
26
26
  JobStatusSchema,
27
27
  abortJob,
28
+ checkSimulationAllowed,
28
29
  collectRealVotes,
29
30
  defaultBusyEnvelope,
30
31
  defaultCollisionEnvelope,
@@ -38,10 +39,10 @@ import {
38
39
  resolveIdempotency,
39
40
  runAsJob,
40
41
  runConsensusForGoal,
42
+ simulationDeniedResult,
41
43
  toJobSummary,
42
- warnIfSimulatedOutsideTests,
43
44
  writeJobCancelled
44
- } from "./chunk-BEJWHTRX.js";
45
+ } from "./chunk-TT4ZITRU.js";
45
46
  import {
46
47
  normalizeTopicToCanonical,
47
48
  synthesizeResearch
@@ -43466,7 +43467,7 @@ ${contextBlock}`;
43466
43467
  const strategy = config.votingStrategy ?? "higher_order";
43467
43468
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
43468
43469
  try {
43469
- const { executeVoting } = await import("./consensus-vote-6REGRDS6.js");
43470
+ const { executeVoting } = await import("./consensus-vote-7EBYYBCQ.js");
43470
43471
  const votingResult = await executeVoting(
43471
43472
  {
43472
43473
  proposal: buildVoteProposal(plan, research),
@@ -44804,6 +44805,10 @@ function makePrReviewHandler(gatewayAdapters) {
44804
44805
  });
44805
44806
  }
44806
44807
  const input = parsed.data;
44808
+ if (input.simulate) {
44809
+ const simCheck = checkSimulationAllowed("pr_review", ctx.logger);
44810
+ if (!simCheck.allowed) return simulationDeniedResult(simCheck.reason);
44811
+ }
44807
44812
  try {
44808
44813
  if (input.dispatch === "async") {
44809
44814
  return runAsJob({
@@ -47164,8 +47169,11 @@ async function runDevPipelineForGoal(goal, trustTier) {
47164
47169
  const stages = await createStages(input);
47165
47170
  return runDevPipeline(goal, stages, trustTier !== void 0 ? { trustTier } : void 0);
47166
47171
  }
47167
- function buildStructuredOutput(result) {
47172
+ function buildStructuredOutput(result, simulated) {
47168
47173
  return {
47174
+ // #4170: stamped only on an explicit NEXUS_ALLOW_SIMULATE=1 opt-in run so
47175
+ // a random demo panel can never pass as a real decision.
47176
+ ...simulated ? { simulated: true } : {},
47169
47177
  completed: result.completed,
47170
47178
  securityPassed: result.securityPassed,
47171
47179
  voteIterations: result.voteIterations,
@@ -47193,10 +47201,10 @@ function buildPipelineOptions(input, trustTier, auditLogger) {
47193
47201
  ...auditLogger !== void 0 ? { auditLogger } : {}
47194
47202
  };
47195
47203
  }
47196
- async function executeDevPipelineBody(taskText, stages, pipelineOptions) {
47204
+ async function executeDevPipelineBody(taskText, stages, pipelineOptions, simulated) {
47197
47205
  const result = await runDevPipeline(taskText, stages, pipelineOptions);
47198
47206
  flushPipelineMemory();
47199
- return toolSuccessStructured(buildStructuredOutput(result));
47207
+ return toolSuccessStructured(buildStructuredOutput(result, simulated));
47200
47208
  }
47201
47209
  async function runDevPipelineHandler(args, logger58, trustTier, auditLogger) {
47202
47210
  const parsed = DevPipelineInputSchema.safeParse(args);
@@ -47207,8 +47215,11 @@ async function runDevPipelineHandler(args, logger58, trustTier, auditLogger) {
47207
47215
  });
47208
47216
  }
47209
47217
  const input = parsed.data;
47218
+ let simulated = false;
47210
47219
  if (input.simulateVotes) {
47211
- warnIfSimulatedOutsideTests("run_dev_pipeline", logger58);
47220
+ const simCheck = checkSimulationAllowed("run_dev_pipeline", logger58);
47221
+ if (!simCheck.allowed) return simulationDeniedResult(simCheck.reason);
47222
+ simulated = simCheck.optedIn;
47212
47223
  }
47213
47224
  try {
47214
47225
  const taskText = await resolveTaskInput(input);
@@ -47216,10 +47227,11 @@ async function runDevPipelineHandler(args, logger58, trustTier, auditLogger) {
47216
47227
  const pipelineOptions = buildPipelineOptions(input, trustTier, auditLogger);
47217
47228
  const hasOptions = Object.keys(pipelineOptions).length > 0;
47218
47229
  const resolvedOptions = hasOptions ? pipelineOptions : void 0;
47230
+ const run = () => executeDevPipelineBody(taskText, stages, resolvedOptions, simulated);
47219
47231
  if (input.dispatch === "async" && !input.dryRun) {
47220
- return dispatchAsyncDevPipeline(input, taskText, stages, resolvedOptions, logger58);
47232
+ return dispatchAsyncDevPipeline(input, run, logger58);
47221
47233
  }
47222
- return await executeDevPipelineBody(taskText, stages, resolvedOptions);
47234
+ return await run();
47223
47235
  } catch (error) {
47224
47236
  return toolStructuredError({
47225
47237
  errorCategory: "internal",
@@ -47227,8 +47239,7 @@ async function runDevPipelineHandler(args, logger58, trustTier, auditLogger) {
47227
47239
  });
47228
47240
  }
47229
47241
  }
47230
- function dispatchAsyncDevPipeline(input, taskText, stages, pipelineOptions, logger58) {
47231
- const run = () => executeDevPipelineBody(taskText, stages, pipelineOptions);
47242
+ function dispatchAsyncDevPipeline(input, run, logger58) {
47232
47243
  if (input.sessionId === void 0) {
47233
47244
  return runAsJob({
47234
47245
  toolName: "run_dev_pipeline",
@@ -47324,7 +47335,7 @@ var PipelineInputSchema = z104.object({
47324
47335
  /** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
47325
47336
  simulateVotes: z104.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
47326
47337
  });
47327
- function buildOutput2(result) {
47338
+ function buildOutput2(result, simulated) {
47328
47339
  return {
47329
47340
  success: result.success,
47330
47341
  templateId: result.templateId,
@@ -47333,6 +47344,9 @@ function buildOutput2(result) {
47333
47344
  stepsExecuted: result.stepsExecuted,
47334
47345
  durationMs: result.durationMs,
47335
47346
  error: result.error ?? null,
47347
+ // #4170: stamped only on an explicit NEXUS_ALLOW_SIMULATE=1 opt-in run so
47348
+ // a random demo panel can never pass as a real decision.
47349
+ ...simulated ? { simulated: true } : {},
47336
47350
  // Rate limit awareness (#1802)
47337
47351
  rateLimitHint: result.error?.toLowerCase().includes("rate limit") === true ? "Consider using quickMode or increasing delay between pipeline runs" : void 0
47338
47352
  };
@@ -47400,13 +47414,13 @@ async function runPipelineForGoal(goal, logger58 = createLogger({ tool: "run_pip
47400
47414
  const stages = selectStageRegistry(void 0, goal, agentStages);
47401
47415
  return runAdaptiveOrchestrator(goal, { stages });
47402
47416
  }
47403
- async function executePipelineBody(task, stages, templateId, dryRun) {
47417
+ async function executePipelineBody(task, stages, templateId, dryRun, simulated) {
47404
47418
  const result = await runAdaptiveOrchestrator(task, {
47405
47419
  stages,
47406
47420
  templateId,
47407
47421
  dryRun
47408
47422
  });
47409
- return toolSuccessStructured(buildOutput2(result));
47423
+ return toolSuccessStructured(buildOutput2(result, simulated));
47410
47424
  }
47411
47425
  async function runPipelineHandler(args, logger58) {
47412
47426
  const parsed = PipelineInputSchema.safeParse(args);
@@ -47417,8 +47431,11 @@ async function runPipelineHandler(args, logger58) {
47417
47431
  });
47418
47432
  }
47419
47433
  const input = parsed.data;
47434
+ let simulated = false;
47420
47435
  if (input.simulateVotes) {
47421
- warnIfSimulatedOutsideTests("run_pipeline", logger58);
47436
+ const simCheck = checkSimulationAllowed("run_pipeline", logger58);
47437
+ if (!simCheck.allowed) return simulationDeniedResult(simCheck.reason);
47438
+ simulated = simCheck.optedIn;
47422
47439
  }
47423
47440
  try {
47424
47441
  const task = await resolveTask(input.task, input.specFile);
@@ -47434,11 +47451,11 @@ async function runPipelineHandler(args, logger58) {
47434
47451
  toolName: "run_pipeline",
47435
47452
  input,
47436
47453
  freshJobId: () => `rp-${randomUUID16()}`,
47437
- run: () => executePipelineBody(task, stages, input.template, input.dryRun),
47454
+ run: () => executePipelineBody(task, stages, input.template, input.dryRun, simulated),
47438
47455
  logger: logger58
47439
47456
  });
47440
47457
  }
47441
- return await executePipelineBody(task, stages, input.template, input.dryRun);
47458
+ return await executePipelineBody(task, stages, input.template, input.dryRun, simulated);
47442
47459
  } catch (error) {
47443
47460
  return toolStructuredError({
47444
47461
  errorCategory: "internal",
@@ -48082,6 +48099,10 @@ async function tradeoffPanelHandler(args, ctx) {
48082
48099
  });
48083
48100
  }
48084
48101
  const input = parsed.data;
48102
+ if (input.simulate) {
48103
+ const simCheck = checkSimulationAllowed("supply_chain_tradeoff_panel", ctx.logger);
48104
+ if (!simCheck.allowed) return simulationDeniedResult(simCheck.reason);
48105
+ }
48085
48106
  try {
48086
48107
  if (input.dispatch === "async") {
48087
48108
  return runAsJob({
@@ -51788,4 +51809,4 @@ export {
51788
51809
  shutdownFeedbackSubscriber,
51789
51810
  createEventBusBridge
51790
51811
  };
51791
- //# sourceMappingURL=chunk-GAZMJBCK.js.map
51812
+ //# sourceMappingURL=chunk-3SE57WOV.js.map