nexus-agents 2.128.6 → 2.129.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.
@@ -40,7 +40,7 @@ import {
40
40
  } from "./chunk-ZGLIHPGJ.js";
41
41
 
42
42
  // src/version.ts
43
- var VERSION = true ? "2.128.6" : "dev";
43
+ var VERSION = true ? "2.129.0" : "dev";
44
44
 
45
45
  // src/config/schemas-core.ts
46
46
  import { z } from "zod";
@@ -2126,7 +2126,7 @@ async function runDoctorFix(result) {
2126
2126
  writeLine2("\u2500".repeat(40));
2127
2127
  let fixCount = 0;
2128
2128
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2129
- const { runSetup } = await import("./setup-command-EUV4BVXV.js");
2129
+ const { runSetup } = await import("./setup-command-55WGRQR7.js");
2130
2130
  const setupResult = runSetup({
2131
2131
  skipMcp: true,
2132
2132
  skipRules: true,
@@ -2238,4 +2238,4 @@ export {
2238
2238
  startStdioServer,
2239
2239
  closeServer
2240
2240
  };
2241
- //# sourceMappingURL=chunk-RQLFGWST.js.map
2241
+ //# sourceMappingURL=chunk-ECGYBJQ3.js.map
@@ -123,7 +123,7 @@ import {
123
123
  DEFAULT_TASK_TTL_MS,
124
124
  DEFAULT_TOOL_RATE_LIMITS,
125
125
  clampTaskTtl
126
- } from "./chunk-RQLFGWST.js";
126
+ } from "./chunk-ECGYBJQ3.js";
127
127
  import {
128
128
  resolveInsideRoot
129
129
  } from "./chunk-NUBSJGQZ.js";
@@ -42838,6 +42838,57 @@ async function runQualityGate(stage, checks, iteration = 1) {
42838
42838
  };
42839
42839
  }
42840
42840
 
42841
+ // src/pipeline/research-context.ts
42842
+ var MAX_RENDERED_ITEMS = 8;
42843
+ function sanitizeExternal(value, maxLen = 160) {
42844
+ const collapsed = value.replace(/`/g, "").replace(/[-]/g, " ").replace(/\s+/g, " ").trim();
42845
+ return collapsed.length > maxLen ? `${collapsed.slice(0, maxLen - 1)}\u2026` : collapsed;
42846
+ }
42847
+ function buildResearchContextMetadata(discover, analyze) {
42848
+ const discoveredItems = discover.items.map((item) => ({
42849
+ title: item.title,
42850
+ url: item.url,
42851
+ ...item.relevanceScore !== void 0 ? { relevanceScore: item.relevanceScore } : {},
42852
+ alreadyInRegistry: item.alreadyInRegistry
42853
+ })).sort((a, b) => (b.relevanceScore ?? 0) - (a.relevanceScore ?? 0));
42854
+ return {
42855
+ discoveredItems,
42856
+ recommendations: analyze?.recommendations ?? [],
42857
+ qualitySignals: {
42858
+ totalFound: discover.totalFound,
42859
+ newItems: discover.newItems,
42860
+ alreadyInRegistry: discover.alreadyInRegistry
42861
+ }
42862
+ };
42863
+ }
42864
+ function renderResearchText(metadata, topic) {
42865
+ const { discoveredItems, recommendations, qualitySignals } = metadata;
42866
+ const lines = [];
42867
+ lines.push(`[Research] ${sanitizeExternal(topic, 120)}`);
42868
+ lines.push(
42869
+ `Maturity: ${String(qualitySignals.totalFound)} found, ${String(qualitySignals.newItems)} new, ${String(qualitySignals.alreadyInRegistry)} already in registry.`
42870
+ );
42871
+ if (discoveredItems.length > 0) {
42872
+ lines.push("Top discoveries (by relevance):");
42873
+ for (const item of discoveredItems.slice(0, MAX_RENDERED_ITEMS)) {
42874
+ const score = item.relevanceScore !== void 0 ? item.relevanceScore.toFixed(2) : "n/a";
42875
+ const known = item.alreadyInRegistry ? " [in registry]" : "";
42876
+ lines.push(`- ${sanitizeExternal(item.title)} (relevance ${score})${known}`);
42877
+ }
42878
+ } else {
42879
+ lines.push("Top discoveries (by relevance): none.");
42880
+ }
42881
+ if (recommendations.length > 0) {
42882
+ lines.push("Gap recommendations:");
42883
+ for (const rec of recommendations) lines.push(`- ${sanitizeExternal(rec)}`);
42884
+ }
42885
+ return lines.join("\n");
42886
+ }
42887
+ function buildResearchContext(discover, analyze, topic = discover.topic) {
42888
+ const metadata = buildResearchContextMetadata(discover, analyze);
42889
+ return { text: renderResearchText(metadata, topic), metadata };
42890
+ }
42891
+
42841
42892
  // src/pipeline/budget-guard.ts
42842
42893
  var BudgetGuard = class {
42843
42894
  breaker;
@@ -43111,45 +43162,45 @@ function createAgentStages(config = {}) {
43111
43162
  return {
43112
43163
  research: async (task) => {
43113
43164
  emitStageEvent2("research", "started");
43114
- await postProgress(config, "Research", "Querying memory + research tools...");
43115
- const memoryCtx = await getMemoryContext(task);
43116
- const discover = await runExpert(
43117
- guard,
43118
- "research",
43119
- `Use research_discover to find papers and repos related to:
43120
-
43121
- ${task}${memoryCtx}`,
43122
- "research"
43123
- );
43124
- const analyze = await runExpert(
43125
- guard,
43126
- "research",
43127
- `Use research_analyze focus=gaps to identify what is missing for:
43128
-
43129
- ${task}`,
43130
- "research"
43131
- );
43132
- const combined = [discover.text, analyze.text].filter(Boolean).join("\n\n");
43133
- const totalMs = discover.durationMs + analyze.durationMs;
43134
- const success = discover.success || analyze.success;
43135
- const researchCli = discover.cli ?? analyze.cli;
43136
- emitStageEvent2("research", success ? "completed" : "failed", { durationMs: totalMs });
43137
- recordOutcome({
43138
- taskId: "research",
43139
- category: "research",
43140
- cli: researchCli,
43141
- success,
43142
- durationMs: totalMs
43143
- });
43144
- if (success && combined.length > 50) {
43145
- recordLearning(
43146
- `Research for "${task.slice(0, 80)}": ${combined.slice(0, 200)}`,
43147
- 0.7,
43148
- "pipeline-research"
43165
+ await postProgress(config, "Research", "Querying research tools (structured)...");
43166
+ const start = getTimeProvider().now();
43167
+ const topic = task.slice(0, 200);
43168
+ try {
43169
+ const memoryCtx = await getMemoryContext(task);
43170
+ const discoverInput = ResearchDiscoverInputSchema.parse({ topic });
43171
+ const discover = await executeDiscovery(discoverInput, logger44);
43172
+ const analyze = await analyzeGaps(topic);
43173
+ const ctx = buildResearchContext(discover, analyze, topic);
43174
+ const durationMs = getTimeProvider().now() - start;
43175
+ emitStageEvent2("research", "completed", { durationMs });
43176
+ recordOutcome({
43177
+ taskId: "research",
43178
+ category: "research",
43179
+ cli: void 0,
43180
+ success: true,
43181
+ durationMs
43182
+ });
43183
+ if (ctx.text.length > 50) {
43184
+ recordLearning(
43185
+ `Research for "${task.slice(0, 80)}": ${ctx.text.slice(0, 200)}`,
43186
+ 0.7,
43187
+ "pipeline-research"
43188
+ );
43189
+ }
43190
+ await postProgress(
43191
+ config,
43192
+ "Research",
43193
+ `Done (${String(ctx.metadata.discoveredItems.length)} items, ${String(durationMs)}ms)`
43149
43194
  );
43195
+ return memoryCtx ? `${ctx.text}${memoryCtx}` : ctx.text;
43196
+ } catch (error) {
43197
+ const durationMs = getTimeProvider().now() - start;
43198
+ emitStageEvent2("research", "failed", { durationMs });
43199
+ logger44.debug("Research stage failed; continuing with minimal context", {
43200
+ error: error instanceof Error ? error.message : String(error)
43201
+ });
43202
+ return `[Research failed] ${task.slice(0, 500)}`;
43150
43203
  }
43151
- await postProgress(config, "Research", `Done (${combined.length} chars, ${totalMs}ms)`);
43152
- return combined || `[Research failed] ${task.slice(0, 500)}`;
43153
43204
  },
43154
43205
  plan: async (task, research, feedback) => {
43155
43206
  emitStageEvent2("plan", "started");
@@ -50526,4 +50577,4 @@ export {
50526
50577
  shutdownFeedbackSubscriber,
50527
50578
  createEventBusBridge
50528
50579
  };
50529
- //# sourceMappingURL=chunk-CZ6BQVFR.js.map
50580
+ //# sourceMappingURL=chunk-O3COR3G2.js.map