nexus-agents 2.63.5 → 2.63.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.
@@ -69,7 +69,7 @@ import {
69
69
  clampTaskTtl,
70
70
  getAvailabilityCache,
71
71
  resolveFallback
72
- } from "./chunk-3K6O2OL5.js";
72
+ } from "./chunk-HRTGSG4L.js";
73
73
  import {
74
74
  DEFAULTS
75
75
  } from "./chunk-6MRF2PE2.js";
@@ -4561,7 +4561,7 @@ var ConsensusProtocol = class {
4561
4561
  requireUnanimous: config.requireUnanimous
4562
4562
  });
4563
4563
  const votingTask = createVotingTask(config.task);
4564
- const promises = config.experts.map(async (expertId) => {
4564
+ const promises2 = config.experts.map(async (expertId) => {
4565
4565
  const agent = agents.get(expertId);
4566
4566
  if (agent === void 0) {
4567
4567
  return { expertId, result: err(new AgentError(`Agent not found: ${expertId}`)) };
@@ -4569,7 +4569,7 @@ var ConsensusProtocol = class {
4569
4569
  const result = await this.executeAgentTask(agent, votingTask);
4570
4570
  return { expertId, result };
4571
4571
  });
4572
- const results = await Promise.all(promises);
4572
+ const results = await Promise.all(promises2);
4573
4573
  for (const { expertId, result } of results) {
4574
4574
  if (result.ok) {
4575
4575
  this.session.submitResult(expertId, result.value);
@@ -6137,7 +6137,7 @@ var ParallelProtocol = class extends BaseProtocol {
6137
6137
  sessionId: config.sessionId,
6138
6138
  expertCount: config.experts.length
6139
6139
  });
6140
- const promises = config.experts.map(async (expertId) => {
6140
+ const promises2 = config.experts.map(async (expertId) => {
6141
6141
  const agent = agents.get(expertId);
6142
6142
  if (agent === void 0) {
6143
6143
  return { expertId, result: err(new AgentError(`Agent not found: ${expertId}`)) };
@@ -6145,7 +6145,7 @@ var ParallelProtocol = class extends BaseProtocol {
6145
6145
  const result = await this.executeAgentTask(agent, config.task);
6146
6146
  return { expertId, result };
6147
6147
  });
6148
- const results = await Promise.all(promises);
6148
+ const results = await Promise.all(promises2);
6149
6149
  for (const { expertId, result } of results) {
6150
6150
  if (result.ok) {
6151
6151
  session.submitResult(expertId, result.value);
@@ -19169,10 +19169,10 @@ async function executeParallel(steps, context, stepExecutor, options) {
19169
19169
  }
19170
19170
  }
19171
19171
  async function runAllSteps(steps, context, stepExecutor, opts, state) {
19172
- const promises = steps.map(
19172
+ const promises2 = steps.map(
19173
19173
  (step) => executeStepInQueue(step, context, stepExecutor, opts, state)
19174
19174
  );
19175
- await Promise.allSettled(promises);
19175
+ await Promise.allSettled(promises2);
19176
19176
  }
19177
19177
  async function executeStepInQueue(step, context, stepExecutor, opts, state) {
19178
19178
  try {
@@ -26804,8 +26804,8 @@ function applyStateUpdates(graph, state, updates) {
26804
26804
  return newState;
26805
26805
  }
26806
26806
  async function executeNodes(graph, nodeIds, state, options) {
26807
- const promises = nodeIds.map((id) => executeSingleNode(graph, id, state, options));
26808
- return Promise.all(promises);
26807
+ const promises2 = nodeIds.map((id) => executeSingleNode(graph, id, state, options));
26808
+ return Promise.all(promises2);
26809
26809
  }
26810
26810
  function preconditionFailedResult(nodeId, results, startTime) {
26811
26811
  const failed = results.find((r) => !r.passed);
@@ -37009,7 +37009,7 @@ function createResearchQueryHandler(deps) {
37009
37009
  const logger56 = deps.logger ?? createLogger({ tool: "research_query" });
37010
37010
  return withToolError("Research query failed", logger56, async () => {
37011
37011
  const result = await executeQuery(validationResult.data);
37012
- return toolSuccess(JSON.stringify(result, null, 2));
37012
+ return toolSuccessStructured(result);
37013
37013
  });
37014
37014
  };
37015
37015
  }
@@ -37033,9 +37033,14 @@ function registerResearchQueryTool(server, deps) {
37033
37033
  timeoutMs,
37034
37034
  logger: logger56
37035
37035
  });
37036
+ const outputSchema = {
37037
+ action: z62.string(),
37038
+ success: z62.boolean(),
37039
+ data: z62.unknown()
37040
+ };
37036
37041
  server.registerTool(
37037
37042
  "research_query",
37038
- { description, inputSchema: toolSchema },
37043
+ { description, inputSchema: toolSchema, outputSchema },
37039
37044
  toSdkCallback(wrappedHandler)
37040
37045
  );
37041
37046
  logger56.info("Registered research_query tool with secure handler and timeout protection");
@@ -37101,7 +37106,7 @@ function createResearchAddHandler(deps) {
37101
37106
  if (!result.success) {
37102
37107
  return toolError(result.message);
37103
37108
  }
37104
- return toolSuccess(JSON.stringify(result, null, 2));
37109
+ return toolSuccessStructured(result);
37105
37110
  });
37106
37111
  };
37107
37112
  }
@@ -37124,9 +37129,16 @@ function registerResearchAddTool(server, deps) {
37124
37129
  timeoutMs,
37125
37130
  logger: logger56
37126
37131
  });
37132
+ const outputSchema = {
37133
+ success: z63.boolean(),
37134
+ paperId: z63.string().optional(),
37135
+ title: z63.string().optional(),
37136
+ message: z63.string(),
37137
+ dryRun: z63.boolean().optional()
37138
+ };
37127
37139
  server.registerTool(
37128
37140
  "research_add",
37129
- { description, inputSchema: toolSchema },
37141
+ { description, inputSchema: toolSchema, outputSchema },
37130
37142
  toSdkCallback(wrappedHandler)
37131
37143
  );
37132
37144
  logger56.info("Registered research_add tool with secure handler and timeout protection");
@@ -37283,7 +37295,7 @@ function createResearchAddSourceHandler(deps) {
37283
37295
  if (!result.success) {
37284
37296
  return toolError(result.message);
37285
37297
  }
37286
- return toolSuccess(JSON.stringify(result, null, 2));
37298
+ return toolSuccessStructured(result);
37287
37299
  });
37288
37300
  };
37289
37301
  }
@@ -37322,10 +37334,19 @@ function registerResearchAddSourceTool(server, deps) {
37322
37334
  });
37323
37335
  server.registerTool(
37324
37336
  "research_add_source",
37325
- { description, inputSchema: toolSchema },
37337
+ { description, inputSchema: toolSchema, outputSchema: RESEARCH_ADD_SOURCE_OUTPUT_SCHEMA },
37326
37338
  toSdkCallback(wrappedHandler)
37327
37339
  );
37328
37340
  }
37341
+ var RESEARCH_ADD_SOURCE_OUTPUT_SCHEMA = {
37342
+ success: z64.boolean(),
37343
+ sourceId: z64.string().optional(),
37344
+ name: z64.string().optional(),
37345
+ quality_score: z64.number().optional(),
37346
+ evidence_tier: z64.string().optional(),
37347
+ message: z64.string().optional(),
37348
+ dryRun: z64.boolean().optional()
37349
+ };
37329
37350
 
37330
37351
  // src/mcp/tools/research-discover.ts
37331
37352
  import { z as z65 } from "zod";
@@ -37593,7 +37614,7 @@ function createResearchDiscoverHandler(deps) {
37593
37614
  const response = await withToolError("Discovery failed", logger56, async () => {
37594
37615
  const result = await executeDiscovery(validationResult.data, logger56);
37595
37616
  recordDiscoverySuccess(result.topic, result.newItems, result.sourcesQueried);
37596
- return toolSuccess(JSON.stringify(result, null, 2));
37617
+ return toolSuccessStructured(result);
37597
37618
  });
37598
37619
  const durationMs = Date.now() - startMs;
37599
37620
  if (response.isError === true) {
@@ -37638,11 +37659,21 @@ function registerResearchDiscoverTool(server, deps) {
37638
37659
  });
37639
37660
  server.registerTool(
37640
37661
  "research_discover",
37641
- { description, inputSchema: toolSchema },
37662
+ { description, inputSchema: toolSchema, outputSchema: RESEARCH_DISCOVER_OUTPUT_SCHEMA },
37642
37663
  toSdkCallback(wrappedHandler)
37643
37664
  );
37644
37665
  logger56.info("Registered research_discover tool with secure handler and timeout protection");
37645
37666
  }
37667
+ var RESEARCH_DISCOVER_OUTPUT_SCHEMA = {
37668
+ topic: z65.string().optional(),
37669
+ sourcesQueried: z65.array(z65.string()).optional(),
37670
+ failedSources: z65.array(z65.string()).optional(),
37671
+ items: z65.array(z65.unknown()).optional(),
37672
+ totalFound: z65.number().optional(),
37673
+ alreadyInRegistry: z65.number().optional(),
37674
+ newItems: z65.number().optional(),
37675
+ filteredByRelevance: z65.number().optional()
37676
+ };
37646
37677
 
37647
37678
  // src/mcp/tools/research-analyze.ts
37648
37679
  import { z as z66 } from "zod";
@@ -37885,7 +37916,7 @@ function createResearchAnalyzeHandler(deps) {
37885
37916
  const logger56 = deps.logger ?? createLogger({ tool: "research_analyze" });
37886
37917
  return withToolError("Analysis failed", logger56, async () => {
37887
37918
  const result = await executeAnalysis(validationResult.data);
37888
- return toolSuccess(JSON.stringify(result, null, 2));
37919
+ return toolSuccessStructured(result);
37889
37920
  });
37890
37921
  };
37891
37922
  }
@@ -37906,9 +37937,15 @@ function registerResearchAnalyzeTool(server, deps) {
37906
37937
  timeoutMs,
37907
37938
  logger: logger56
37908
37939
  });
37940
+ const outputSchema = {
37941
+ focus: z66.string().optional(),
37942
+ success: z66.boolean().optional(),
37943
+ analysis: z66.unknown().optional(),
37944
+ recommendations: z66.array(z66.string()).optional()
37945
+ };
37909
37946
  server.registerTool(
37910
37947
  "research_analyze",
37911
- { description, inputSchema: toolSchema },
37948
+ { description, inputSchema: toolSchema, outputSchema },
37912
37949
  toSdkCallback(wrappedHandler)
37913
37950
  );
37914
37951
  logger56.info("Registered research_analyze tool with secure handler and timeout protection");
@@ -38044,7 +38081,7 @@ function createCatalogReviewHandler(deps) {
38044
38081
  if (!result.success) {
38045
38082
  return toolError(result.message);
38046
38083
  }
38047
- return toolSuccess(JSON.stringify(result, null, 2));
38084
+ return toolSuccessStructured(result);
38048
38085
  });
38049
38086
  };
38050
38087
  }
@@ -38067,9 +38104,15 @@ function registerResearchCatalogReviewTool(server, deps) {
38067
38104
  timeoutMs,
38068
38105
  logger: logger56
38069
38106
  });
38107
+ const outputSchema = {
38108
+ action: z67.string().optional(),
38109
+ success: z67.boolean().optional(),
38110
+ message: z67.string().optional(),
38111
+ data: z67.unknown().optional()
38112
+ };
38070
38113
  server.registerTool(
38071
38114
  "research_catalog_review",
38072
- { description, inputSchema: toolSchema },
38115
+ { description, inputSchema: toolSchema, outputSchema },
38073
38116
  toSdkCallback(wrappedHandler)
38074
38117
  );
38075
38118
  logger56.info("Registered research_catalog_review tool");
@@ -38092,7 +38135,7 @@ function createResearchSynthesizeHandler(deps) {
38092
38135
  if (!result.ok) {
38093
38136
  return toolError(`Synthesis failed: ${result.error.message}`);
38094
38137
  }
38095
- return toolSuccess(JSON.stringify(result.value, null, 2));
38138
+ return toolSuccessStructured(result.value);
38096
38139
  });
38097
38140
  };
38098
38141
  }
@@ -38112,9 +38155,15 @@ function registerResearchSynthesizeTool(server, deps) {
38112
38155
  timeoutMs,
38113
38156
  logger: logger56
38114
38157
  });
38158
+ const outputSchema = {
38159
+ clusters: z68.array(z68.unknown()).optional(),
38160
+ alignmentSummary: z68.unknown().optional(),
38161
+ crossCuttingThemes: z68.array(z68.unknown()).optional(),
38162
+ generatedAt: z68.string().optional()
38163
+ };
38115
38164
  server.registerTool(
38116
38165
  "research_synthesize",
38117
- { description, inputSchema: toolSchema },
38166
+ { description, inputSchema: toolSchema, outputSchema },
38118
38167
  toSdkCallback(wrappedHandler)
38119
38168
  );
38120
38169
  logger56.info("Registered research_synthesize tool");
@@ -39272,7 +39321,7 @@ async function memoryQueryHandler(args, ctx) {
39272
39321
  }
39273
39322
  return withToolError("Memory query failed", ctx.logger, async () => {
39274
39323
  const result = await executeMemoryQuery(validationResult.data, ctx.logger);
39275
- return toolSuccess(JSON.stringify(result, null, 2));
39324
+ return toolSuccessStructured(result);
39276
39325
  });
39277
39326
  }
39278
39327
  function registerMemoryQueryTool(server, deps) {
@@ -39290,9 +39339,16 @@ function registerMemoryQueryTool(server, deps) {
39290
39339
  });
39291
39340
  const timeoutMs = getToolTimeout("memory_query", deps.security);
39292
39341
  const wrappedHandler = wrapToolWithTimeout("memory_query", secureHandler, { timeoutMs, logger: logger56 });
39342
+ const outputSchema = {
39343
+ query: z72.string(),
39344
+ expandedQuery: z72.string().optional(),
39345
+ results: z72.array(z72.unknown()),
39346
+ count: z72.number(),
39347
+ source: z72.string()
39348
+ };
39293
39349
  server.registerTool(
39294
39350
  "memory_query",
39295
- { description, inputSchema: toolSchema },
39351
+ { description, inputSchema: toolSchema, outputSchema },
39296
39352
  toSdkCallback(wrappedHandler)
39297
39353
  );
39298
39354
  logger56.info("Registered memory_query tool");
@@ -39358,7 +39414,7 @@ async function memoryStatsHandler(args, ctx) {
39358
39414
  }
39359
39415
  return withToolError("Memory stats failed", ctx.logger, async () => {
39360
39416
  const result = await collectMemoryStats(validationResult.data, ctx.logger);
39361
- return toolSuccess(JSON.stringify(result, null, 2));
39417
+ return toolSuccessStructured(result);
39362
39418
  });
39363
39419
  }
39364
39420
  function registerMemoryStatsTool(server, deps) {
@@ -39374,9 +39430,18 @@ function registerMemoryStatsTool(server, deps) {
39374
39430
  });
39375
39431
  const timeoutMs = getToolTimeout("memory_stats", deps.security);
39376
39432
  const wrappedHandler = wrapToolWithTimeout("memory_stats", secureHandler, { timeoutMs, logger: logger56 });
39433
+ const outputSchema = {
39434
+ backends: z73.unknown(),
39435
+ session: z73.unknown().optional(),
39436
+ belief: z73.unknown().optional(),
39437
+ typed: z73.unknown().optional(),
39438
+ mobimem: z73.unknown().optional(),
39439
+ decay: z73.unknown().optional(),
39440
+ collectedAt: z73.string().optional()
39441
+ };
39377
39442
  server.registerTool(
39378
39443
  "memory_stats",
39379
- { description, inputSchema: toolSchema },
39444
+ { description, inputSchema: toolSchema, outputSchema },
39380
39445
  toSdkCallback(wrappedHandler)
39381
39446
  );
39382
39447
  logger56.info("Registered memory_stats tool");
@@ -39501,7 +39566,7 @@ async function memoryWriteHandler(args, ctx) {
39501
39566
  if (!result.success) {
39502
39567
  return toolError(JSON.stringify(result, null, 2));
39503
39568
  }
39504
- return toolSuccess(JSON.stringify(result, null, 2));
39569
+ return toolSuccessStructured(result);
39505
39570
  });
39506
39571
  }
39507
39572
  function registerMemoryWriteTool(server, deps) {
@@ -39523,9 +39588,16 @@ function registerMemoryWriteTool(server, deps) {
39523
39588
  });
39524
39589
  const timeoutMs = getToolTimeout("memory_write", deps.security);
39525
39590
  const wrappedHandler = wrapToolWithTimeout("memory_write", secureHandler, { timeoutMs, logger: logger56 });
39591
+ const outputSchema = {
39592
+ success: z74.boolean(),
39593
+ backend: z74.string(),
39594
+ key: z74.string(),
39595
+ deduplicated: z74.boolean().optional(),
39596
+ error: z74.string().optional()
39597
+ };
39526
39598
  server.registerTool(
39527
39599
  "memory_write",
39528
- { description, inputSchema: toolSchema },
39600
+ { description, inputSchema: toolSchema, outputSchema },
39529
39601
  toSdkCallback(wrappedHandler)
39530
39602
  );
39531
39603
  logger56.info("Registered memory_write tool");
@@ -43747,22 +43819,26 @@ function buildOutput2(result) {
43747
43819
  rateLimitHint: result.error?.toLowerCase().includes("rate limit") === true ? "Consider using quickMode or increasing delay between pipeline runs" : void 0
43748
43820
  };
43749
43821
  }
43750
- function resolveTask(task, specFile) {
43822
+ async function resolveTask(task, specFile) {
43751
43823
  if (specFile === void 0) return task;
43752
43824
  const resolved = path11.resolve(specFile);
43753
43825
  const cwdRoot = path11.resolve(".");
43754
43826
  if (!resolved.startsWith(cwdRoot)) {
43755
43827
  throw new Error(`Path traversal denied: specFile must be within ${cwdRoot}`);
43756
43828
  }
43757
- if (!fs12.existsSync(resolved)) {
43758
- throw new Error(`Spec file not found: ${resolved}`);
43759
- }
43760
- const specContent = fs12.readFileSync(resolved, "utf-8");
43761
- return `${specContent}
43829
+ try {
43830
+ const specContent = await fs12.promises.readFile(resolved, "utf-8");
43831
+ return `${specContent}
43762
43832
 
43763
43833
  ---
43764
43834
 
43765
43835
  ${task}`;
43836
+ } catch (err2) {
43837
+ if (err2.code === "ENOENT") {
43838
+ throw new Error(`Spec file not found: ${resolved}`);
43839
+ }
43840
+ throw err2;
43841
+ }
43766
43842
  }
43767
43843
  function selectStageRegistry(template, task, agentStages) {
43768
43844
  const effectiveTemplate = template ?? classifyTask(task).pipelineType;
@@ -43785,7 +43861,7 @@ function registerPipelineTool(server, _deps) {
43785
43861
  warnIfSimulatedOutsideTests("run_pipeline", createLogger({ tool: "run_pipeline" }));
43786
43862
  }
43787
43863
  try {
43788
- const task = resolveTask(input.task, input.specFile);
43864
+ const task = await resolveTask(input.task, input.specFile);
43789
43865
  const agentStages = createAgentStages({
43790
43866
  simulateVotes: input.simulateVotes,
43791
43867
  votingStrategy: input.votingStrategy,
@@ -53703,4 +53779,4 @@ export {
53703
53779
  detectBackend,
53704
53780
  createTaskTracker
53705
53781
  };
53706
- //# sourceMappingURL=chunk-LQPW7LIC.js.map
53782
+ //# sourceMappingURL=chunk-CUGQAPGY.js.map