nexus-agents 2.75.1 → 2.77.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.
Files changed (100) hide show
  1. package/dist/{adaptive-memory-OJY3IVNM.js → adaptive-memory-EI564K4C.js} +3 -3
  2. package/dist/{child-mcp-config-KMCKKPNY.js → child-mcp-config-MJMUF7TL.js} +2 -2
  3. package/dist/{chunk-Q3RFPJYK.js → chunk-3MRM53T4.js} +8 -2
  4. package/dist/{chunk-Q3RFPJYK.js.map → chunk-3MRM53T4.js.map} +1 -1
  5. package/dist/{chunk-EQHYXT56.js → chunk-3VWMM6UF.js} +2 -2
  6. package/dist/{chunk-QON7LR7J.js → chunk-5WHWKY32.js} +2 -2
  7. package/dist/{chunk-3SZBDLFX.js → chunk-6AY5DK4E.js} +3 -3
  8. package/dist/{chunk-PAFH336F.js → chunk-7NK7BTWP.js} +2 -2
  9. package/dist/{chunk-3ESCBV47.js → chunk-BJ2OMC7P.js} +2 -2
  10. package/dist/{chunk-Q6JDV36D.js → chunk-C2LLQ6TW.js} +3 -3
  11. package/dist/{chunk-DGELGUZF.js → chunk-CM3TORGV.js} +2 -2
  12. package/dist/{chunk-T5VPZZYX.js → chunk-CPPZCNAS.js} +135 -30
  13. package/dist/chunk-CPPZCNAS.js.map +1 -0
  14. package/dist/{chunk-4K6L7RKC.js → chunk-DIB6V67T.js} +3 -3
  15. package/dist/{chunk-44MVIL3F.js → chunk-DSQ5XM4O.js} +4 -4
  16. package/dist/{chunk-VJD5LANR.js → chunk-ERWXGXV2.js} +3 -3
  17. package/dist/{chunk-BK54O5J5.js → chunk-G6ZPVADX.js} +2 -2
  18. package/dist/{chunk-NQR7QAZX.js → chunk-IPWCD22D.js} +2 -2
  19. package/dist/{chunk-Q7FTNKPO.js → chunk-JN6UWGHH.js} +62 -28
  20. package/dist/chunk-JN6UWGHH.js.map +1 -0
  21. package/dist/{chunk-5LHKTF5L.js → chunk-KYCZCROX.js} +4 -4
  22. package/dist/{chunk-2SVS5WRV.js → chunk-MGLWPN2I.js} +2 -2
  23. package/dist/{chunk-S6LQJZY4.js → chunk-N2QNLBS5.js} +7 -7
  24. package/dist/{chunk-TBRNRW2Q.js → chunk-PWTJGGKB.js} +2 -2
  25. package/dist/{chunk-MKIYBAGV.js → chunk-T3LEOO3A.js} +25 -25
  26. package/dist/{chunk-NC2LECY6.js → chunk-VEF6DCQU.js} +3 -3
  27. package/dist/{chunk-UWJKMBPL.js → chunk-X3BU5MIG.js} +6 -6
  28. package/dist/{chunk-G5VE2DZS.js → chunk-YJ2IGAD2.js} +2 -2
  29. package/dist/{chunk-GS3GW7C7.js → chunk-YQMQSJQK.js} +2 -2
  30. package/dist/{chunk-CCODJRS6.js → chunk-ZKOBXAPK.js} +2 -2
  31. package/dist/{cli-circuit-breaker-STXIH563.js → cli-circuit-breaker-YX4BWZD5.js} +4 -4
  32. package/dist/cli.js +33 -31
  33. package/dist/cli.js.map +1 -1
  34. package/dist/{composite-router-7AHZN3VI.js → composite-router-S6E26BCI.js} +2 -2
  35. package/dist/{consensus-vote-XY55C7WQ.js → consensus-vote-UR3JU7RI.js} +11 -11
  36. package/dist/{doctor-deep-ONHJTGR4.js → doctor-deep-BRU5ZUJI.js} +3 -3
  37. package/dist/{expert-bridge-3AWQHR65.js → expert-bridge-DWBO2HXZ.js} +3 -3
  38. package/dist/{factory-E5NMAMZC.js → factory-A7DTCCUY.js} +5 -5
  39. package/dist/{factory-HWHQ44BB.js → factory-LXOVC44K.js} +4 -4
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.js +22 -22
  42. package/dist/{init-opencode-Z7OQ5RCB.js → init-opencode-CFE7M6XA.js} +25 -5
  43. package/dist/init-opencode-CFE7M6XA.js.map +1 -0
  44. package/dist/{issue-triage-UWBHMQHC.js → issue-triage-6XD6CVPB.js} +4 -4
  45. package/dist/{mobimem-G4UXJTCV.js → mobimem-CG2MNS7V.js} +2 -2
  46. package/dist/{registry-command-HYWVRAHE.js → registry-command-RPPC7N2K.js} +2 -2
  47. package/dist/{repo-security-plan-W35CXK3T.js → repo-security-plan-EIL2BV3S.js} +3 -3
  48. package/dist/{research-helpers-synthesize-GUQORWL4.js → research-helpers-synthesize-36TUTUUA.js} +5 -3
  49. package/dist/{routing-memory-VOJBOX3X.js → routing-memory-5VTX7LQX.js} +2 -2
  50. package/dist/{session-memory-B6LQMF4N.js → session-memory-7XBV6BMY.js} +3 -3
  51. package/dist/{setup-command-KP3QVBEW.js → setup-command-JE5VMKGI.js} +9 -9
  52. package/dist/{setup-config-53MHJA7S.js → setup-config-EI5KROA3.js} +3 -3
  53. package/dist/{setup-custom-api-VD5W754A.js → setup-custom-api-WM5W5AY5.js} +4 -4
  54. package/dist/{weather-report-APASTJDQ.js → weather-report-YJMVKJGA.js} +2 -2
  55. package/package.json +1 -1
  56. package/dist/chunk-Q7FTNKPO.js.map +0 -1
  57. package/dist/chunk-T5VPZZYX.js.map +0 -1
  58. package/dist/init-opencode-Z7OQ5RCB.js.map +0 -1
  59. /package/dist/{adaptive-memory-OJY3IVNM.js.map → adaptive-memory-EI564K4C.js.map} +0 -0
  60. /package/dist/{child-mcp-config-KMCKKPNY.js.map → child-mcp-config-MJMUF7TL.js.map} +0 -0
  61. /package/dist/{chunk-EQHYXT56.js.map → chunk-3VWMM6UF.js.map} +0 -0
  62. /package/dist/{chunk-QON7LR7J.js.map → chunk-5WHWKY32.js.map} +0 -0
  63. /package/dist/{chunk-3SZBDLFX.js.map → chunk-6AY5DK4E.js.map} +0 -0
  64. /package/dist/{chunk-PAFH336F.js.map → chunk-7NK7BTWP.js.map} +0 -0
  65. /package/dist/{chunk-3ESCBV47.js.map → chunk-BJ2OMC7P.js.map} +0 -0
  66. /package/dist/{chunk-Q6JDV36D.js.map → chunk-C2LLQ6TW.js.map} +0 -0
  67. /package/dist/{chunk-DGELGUZF.js.map → chunk-CM3TORGV.js.map} +0 -0
  68. /package/dist/{chunk-4K6L7RKC.js.map → chunk-DIB6V67T.js.map} +0 -0
  69. /package/dist/{chunk-44MVIL3F.js.map → chunk-DSQ5XM4O.js.map} +0 -0
  70. /package/dist/{chunk-VJD5LANR.js.map → chunk-ERWXGXV2.js.map} +0 -0
  71. /package/dist/{chunk-BK54O5J5.js.map → chunk-G6ZPVADX.js.map} +0 -0
  72. /package/dist/{chunk-NQR7QAZX.js.map → chunk-IPWCD22D.js.map} +0 -0
  73. /package/dist/{chunk-5LHKTF5L.js.map → chunk-KYCZCROX.js.map} +0 -0
  74. /package/dist/{chunk-2SVS5WRV.js.map → chunk-MGLWPN2I.js.map} +0 -0
  75. /package/dist/{chunk-S6LQJZY4.js.map → chunk-N2QNLBS5.js.map} +0 -0
  76. /package/dist/{chunk-TBRNRW2Q.js.map → chunk-PWTJGGKB.js.map} +0 -0
  77. /package/dist/{chunk-MKIYBAGV.js.map → chunk-T3LEOO3A.js.map} +0 -0
  78. /package/dist/{chunk-NC2LECY6.js.map → chunk-VEF6DCQU.js.map} +0 -0
  79. /package/dist/{chunk-UWJKMBPL.js.map → chunk-X3BU5MIG.js.map} +0 -0
  80. /package/dist/{chunk-G5VE2DZS.js.map → chunk-YJ2IGAD2.js.map} +0 -0
  81. /package/dist/{chunk-GS3GW7C7.js.map → chunk-YQMQSJQK.js.map} +0 -0
  82. /package/dist/{chunk-CCODJRS6.js.map → chunk-ZKOBXAPK.js.map} +0 -0
  83. /package/dist/{cli-circuit-breaker-STXIH563.js.map → cli-circuit-breaker-YX4BWZD5.js.map} +0 -0
  84. /package/dist/{composite-router-7AHZN3VI.js.map → composite-router-S6E26BCI.js.map} +0 -0
  85. /package/dist/{consensus-vote-XY55C7WQ.js.map → consensus-vote-UR3JU7RI.js.map} +0 -0
  86. /package/dist/{doctor-deep-ONHJTGR4.js.map → doctor-deep-BRU5ZUJI.js.map} +0 -0
  87. /package/dist/{expert-bridge-3AWQHR65.js.map → expert-bridge-DWBO2HXZ.js.map} +0 -0
  88. /package/dist/{factory-E5NMAMZC.js.map → factory-A7DTCCUY.js.map} +0 -0
  89. /package/dist/{factory-HWHQ44BB.js.map → factory-LXOVC44K.js.map} +0 -0
  90. /package/dist/{issue-triage-UWBHMQHC.js.map → issue-triage-6XD6CVPB.js.map} +0 -0
  91. /package/dist/{mobimem-G4UXJTCV.js.map → mobimem-CG2MNS7V.js.map} +0 -0
  92. /package/dist/{registry-command-HYWVRAHE.js.map → registry-command-RPPC7N2K.js.map} +0 -0
  93. /package/dist/{repo-security-plan-W35CXK3T.js.map → repo-security-plan-EIL2BV3S.js.map} +0 -0
  94. /package/dist/{research-helpers-synthesize-GUQORWL4.js.map → research-helpers-synthesize-36TUTUUA.js.map} +0 -0
  95. /package/dist/{routing-memory-VOJBOX3X.js.map → routing-memory-5VTX7LQX.js.map} +0 -0
  96. /package/dist/{session-memory-B6LQMF4N.js.map → session-memory-7XBV6BMY.js.map} +0 -0
  97. /package/dist/{setup-command-KP3QVBEW.js.map → setup-command-JE5VMKGI.js.map} +0 -0
  98. /package/dist/{setup-config-53MHJA7S.js.map → setup-config-EI5KROA3.js.map} +0 -0
  99. /package/dist/{setup-custom-api-VD5W754A.js.map → setup-custom-api-WM5W5AY5.js.map} +0 -0
  100. /package/dist/{weather-report-APASTJDQ.js.map → weather-report-YJMVKJGA.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  getErrorMessage,
5
5
  getTimeProvider,
6
6
  ok
7
- } from "./chunk-Q3RFPJYK.js";
7
+ } from "./chunk-3MRM53T4.js";
8
8
 
9
9
  // src/context/session-memory.ts
10
10
  import * as fs from "fs";
@@ -351,4 +351,4 @@ export {
351
351
  SessionMemory,
352
352
  createSessionMemory
353
353
  };
354
- //# sourceMappingURL=chunk-EQHYXT56.js.map
354
+ //# sourceMappingURL=chunk-3VWMM6UF.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createLogger
3
- } from "./chunk-Q3RFPJYK.js";
3
+ } from "./chunk-3MRM53T4.js";
4
4
 
5
5
  // src/config/available-models-cache.ts
6
6
  var logger = createLogger({ component: "available-models-cache" });
@@ -150,4 +150,4 @@ export {
150
150
  getDefaultAvailableModelsCache,
151
151
  setDefaultAvailableModelsCache
152
152
  };
153
- //# sourceMappingURL=chunk-QON7LR7J.js.map
153
+ //# sourceMappingURL=chunk-5WHWKY32.js.map
@@ -2,14 +2,14 @@ import {
2
2
  CircuitBreakerRegistry,
3
3
  CircuitError,
4
4
  mapCliErrorToCategory
5
- } from "./chunk-TBRNRW2Q.js";
5
+ } from "./chunk-PWTJGGKB.js";
6
6
  import {
7
7
  createLogger,
8
8
  err,
9
9
  getFallbackChainForCategory,
10
10
  getTimeProvider,
11
11
  ok
12
- } from "./chunk-Q3RFPJYK.js";
12
+ } from "./chunk-3MRM53T4.js";
13
13
 
14
14
  // src/cli-adapters/cli-circuit-breaker.ts
15
15
  var CATEGORY_TO_FALLBACK = {
@@ -152,4 +152,4 @@ export {
152
152
  CliCircuitBreakerIntegration,
153
153
  createCliCircuitBreakerIntegration
154
154
  };
155
- //# sourceMappingURL=chunk-3SZBDLFX.js.map
155
+ //# sourceMappingURL=chunk-6AY5DK4E.js.map
@@ -2,7 +2,7 @@ import {
2
2
  ConfigError,
3
3
  err,
4
4
  ok
5
- } from "./chunk-Q3RFPJYK.js";
5
+ } from "./chunk-3MRM53T4.js";
6
6
 
7
7
  // src/adapters/sdk/types.ts
8
8
  var PROVIDER_ENV_KEYS = {
@@ -117,4 +117,4 @@ export {
117
117
  CUSTOM_API_ALLOW_PRIVATE_ENV,
118
118
  validateCustomApiBaseUrl
119
119
  };
120
- //# sourceMappingURL=chunk-PAFH336F.js.map
120
+ //# sourceMappingURL=chunk-7NK7BTWP.js.map
@@ -11,7 +11,7 @@ import {
11
11
  formatZodError,
12
12
  getTimeProvider,
13
13
  ok
14
- } from "./chunk-Q3RFPJYK.js";
14
+ } from "./chunk-3MRM53T4.js";
15
15
 
16
16
  // src/context/memory-backend-types.ts
17
17
  import { z } from "zod";
@@ -941,4 +941,4 @@ export {
941
941
  AdaptiveMemoryBackend,
942
942
  createAdaptiveMemory
943
943
  };
944
- //# sourceMappingURL=chunk-3ESCBV47.js.map
944
+ //# sourceMappingURL=chunk-BJ2OMC7P.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  OpenAIAdapter
3
- } from "./chunk-4K6L7RKC.js";
3
+ } from "./chunk-DIB6V67T.js";
4
4
  import {
5
5
  ConfigError,
6
6
  createLogger,
@@ -9,7 +9,7 @@ import {
9
9
  getTimeProvider,
10
10
  lookupInTreeCapability,
11
11
  ok
12
- } from "./chunk-Q3RFPJYK.js";
12
+ } from "./chunk-3MRM53T4.js";
13
13
  import {
14
14
  getNexusDataDir
15
15
  } from "./chunk-GOT7OAL5.js";
@@ -307,4 +307,4 @@ export {
307
307
  discoverModels,
308
308
  buildOpenAICompatAdapters
309
309
  };
310
- //# sourceMappingURL=chunk-Q6JDV36D.js.map
310
+ //# sourceMappingURL=chunk-C2LLQ6TW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getErrorMessage
3
- } from "./chunk-Q3RFPJYK.js";
3
+ } from "./chunk-3MRM53T4.js";
4
4
 
5
5
  // src/cli/setup-config.ts
6
6
  import { copyFileSync, existsSync, writeFileSync } from "fs";
@@ -74,4 +74,4 @@ function ensureBackup(outputPath) {
74
74
  export {
75
75
  runConfigInitSync
76
76
  };
77
- //# sourceMappingURL=chunk-DGELGUZF.js.map
77
+ //# sourceMappingURL=chunk-CM3TORGV.js.map
@@ -4,18 +4,18 @@ import {
4
4
  createStream,
5
5
  requireApiKey,
6
6
  validateApiKeyPresence
7
- } from "./chunk-NQR7QAZX.js";
7
+ } from "./chunk-IPWCD22D.js";
8
8
  import {
9
9
  CUSTOM_API_BASE_URL_ENV,
10
10
  PROVIDER_ENV_KEYS,
11
11
  validateCustomApiBaseUrl
12
- } from "./chunk-PAFH336F.js";
12
+ } from "./chunk-7NK7BTWP.js";
13
13
  import {
14
14
  getDefaultAvailableModelsCache
15
- } from "./chunk-QON7LR7J.js";
15
+ } from "./chunk-5WHWKY32.js";
16
16
  import {
17
17
  CUSTOM_API_DEFAULT_MODEL
18
- } from "./chunk-GS3GW7C7.js";
18
+ } from "./chunk-YQMQSJQK.js";
19
19
  import {
20
20
  createCliAdapter,
21
21
  createCliDetectionCache,
@@ -23,10 +23,10 @@ import {
23
23
  getAvailableClis,
24
24
  isCliAvailable,
25
25
  withTimeout
26
- } from "./chunk-NC2LECY6.js";
26
+ } from "./chunk-VEF6DCQU.js";
27
27
  import {
28
28
  SessionMemory
29
- } from "./chunk-EQHYXT56.js";
29
+ } from "./chunk-3VWMM6UF.js";
30
30
  import {
31
31
  AdaptiveMemoryBackend,
32
32
  HybridMemoryBackend,
@@ -35,7 +35,7 @@ import {
35
35
  getMemoryEntry,
36
36
  memoryExists,
37
37
  memoryRowToEntry
38
- } from "./chunk-3ESCBV47.js";
38
+ } from "./chunk-BJ2OMC7P.js";
39
39
  import {
40
40
  stringifyValue,
41
41
  tokenizeFiltered
@@ -83,12 +83,13 @@ import {
83
83
  resolveCliAlias,
84
84
  resolveVoteTimeout,
85
85
  toRateLimitError
86
- } from "./chunk-Q3RFPJYK.js";
86
+ } from "./chunk-3MRM53T4.js";
87
87
  import {
88
88
  ensureLearningDir,
89
89
  getOutcomesFile
90
90
  } from "./chunk-I7ORMAO7.js";
91
91
  import {
92
+ getNexusDataDir,
92
93
  nexusDataPath
93
94
  } from "./chunk-GOT7OAL5.js";
94
95
 
@@ -159,6 +160,11 @@ async function withProgressHeartbeat(toolName, notifier, operation, intervalMs =
159
160
  }
160
161
  }
161
162
 
163
+ // src/mcp/middleware/tool-wrapper.ts
164
+ import { randomUUID } from "crypto";
165
+ import { appendFileSync, existsSync, mkdirSync } from "fs";
166
+ import { dirname, join } from "path";
167
+
162
168
  // src/mcp/middleware/rate-limiter.ts
163
169
  var DEFAULT_REFILL_INTERVAL_MS = CACHE_TIMEOUTS.rateLimitRefillMs;
164
170
  var RateLimiter = class {
@@ -1353,23 +1359,102 @@ function toSdkCallback(handler) {
1353
1359
  };
1354
1360
  }
1355
1361
  var MCP_SDK_DEFAULT_REQUEST_TIMEOUT_MS = 6e4;
1362
+ var TIMEOUT_MISMATCH_TELEMETRY_REL_PATH = "mcp-telemetry/timeout-mismatch-events.jsonl";
1363
+ function appendTimeoutMismatchEvent(event) {
1364
+ try {
1365
+ const path3 = join(getNexusDataDir(), TIMEOUT_MISMATCH_TELEMETRY_REL_PATH);
1366
+ const dir = dirname(path3);
1367
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
1368
+ appendFileSync(path3, JSON.stringify(event) + "\n", "utf-8");
1369
+ } catch (err2) {
1370
+ wrapperLogger.debug("Best-effort timeout-mismatch event recording failed", {
1371
+ error: getErrorMessage(err2)
1372
+ });
1373
+ }
1374
+ }
1375
+ function extractErrorCategoryFromResult(result) {
1376
+ const envelope = result._meta?.["nexus-agents/error"];
1377
+ if (envelope !== null && typeof envelope === "object" && "errorCategory" in envelope) {
1378
+ const cat = envelope.errorCategory;
1379
+ if (typeof cat === "string") return cat;
1380
+ }
1381
+ return void 0;
1382
+ }
1383
+ function extractErrorMessageFromResult(result) {
1384
+ const first = result.content[0];
1385
+ if (first?.type === "text" && typeof first.text === "string") {
1386
+ return first.text.slice(0, 500);
1387
+ }
1388
+ return void 0;
1389
+ }
1390
+ function buildMismatchEvent(ctx, eventId, t0, outcome) {
1391
+ const t1 = Date.now();
1392
+ return {
1393
+ eventId,
1394
+ toolName: ctx.toolName,
1395
+ configuredTimeoutMs: ctx.configuredTimeoutMs,
1396
+ mcpSdkDefaultMs: MCP_SDK_DEFAULT_REQUEST_TIMEOUT_MS,
1397
+ startedAt: new Date(t0).toISOString(),
1398
+ endedAt: new Date(t1).toISOString(),
1399
+ durationMs: t1 - t0,
1400
+ outcome: outcome.outcome,
1401
+ ...outcome.errorCategory !== void 0 ? { errorCategory: outcome.errorCategory } : {},
1402
+ ...outcome.errorMessage !== void 0 ? { errorMessage: outcome.errorMessage } : {}
1403
+ };
1404
+ }
1405
+ function classifyResult(result) {
1406
+ if (result.isError !== true) return { outcome: "success" };
1407
+ const errorCategory = extractErrorCategoryFromResult(result);
1408
+ const errorMessage = extractErrorMessageFromResult(result);
1409
+ return {
1410
+ outcome: "error",
1411
+ ...errorCategory !== void 0 ? { errorCategory } : {},
1412
+ ...errorMessage !== void 0 ? { errorMessage } : {}
1413
+ };
1414
+ }
1415
+ async function runMismatchedCall(ctx) {
1416
+ const eventId = randomUUID();
1417
+ const t0 = Date.now();
1418
+ ctx.log.warn(
1419
+ "MCP tool budget exceeds client default and no progressToken received \u2014 request likely to be killed by client before server-side deadline",
1420
+ {
1421
+ tool: ctx.toolName,
1422
+ eventId,
1423
+ configuredTimeoutMs: ctx.configuredTimeoutMs,
1424
+ mcpSdkDefaultMs: MCP_SDK_DEFAULT_REQUEST_TIMEOUT_MS,
1425
+ remediation: "Client should pass `onprogress` and `resetTimeoutOnProgress: true` when calling, or extend `options.timeout`. See docs/architecture/MCP_PROTOCOL.md."
1426
+ }
1427
+ );
1428
+ try {
1429
+ const result = await runWithContexts(ctx.handler, ctx.args, ctx.progressCtx, ctx.signal);
1430
+ appendTimeoutMismatchEvent(buildMismatchEvent(ctx, eventId, t0, classifyResult(result)));
1431
+ return result;
1432
+ } catch (err2) {
1433
+ appendTimeoutMismatchEvent(
1434
+ buildMismatchEvent(ctx, eventId, t0, {
1435
+ outcome: "error",
1436
+ errorMessage: getErrorMessage(err2).slice(0, 500)
1437
+ })
1438
+ );
1439
+ throw err2;
1440
+ }
1441
+ }
1356
1442
  function toSdkCallbackWithBudgetCheck(handler, toolName, configuredTimeoutMs, logger12) {
1357
1443
  const log = logger12 ?? wrapperLogger;
1358
1444
  return (args, extra) => {
1359
1445
  const progressCtx = extractProgressContext(extra);
1360
1446
  const signal = extra?.signal;
1361
- if (configuredTimeoutMs > MCP_SDK_DEFAULT_REQUEST_TIMEOUT_MS && progressCtx === void 0) {
1362
- log.warn(
1363
- "MCP tool budget exceeds client default and no progressToken received \u2014 request likely to be killed by client before server-side deadline",
1364
- {
1365
- tool: toolName,
1366
- configuredTimeoutMs,
1367
- mcpSdkDefaultMs: MCP_SDK_DEFAULT_REQUEST_TIMEOUT_MS,
1368
- remediation: "Client should pass `onprogress` and `resetTimeoutOnProgress: true` when calling, or extend `options.timeout`. See docs/architecture/MCP_PROTOCOL.md."
1369
- }
1370
- );
1371
- }
1372
- return runWithContexts(handler, args, progressCtx, signal);
1447
+ const isMismatch = configuredTimeoutMs > MCP_SDK_DEFAULT_REQUEST_TIMEOUT_MS && progressCtx === void 0;
1448
+ if (!isMismatch) return runWithContexts(handler, args, progressCtx, signal);
1449
+ return runMismatchedCall({
1450
+ log,
1451
+ handler,
1452
+ args,
1453
+ progressCtx,
1454
+ signal,
1455
+ toolName,
1456
+ configuredTimeoutMs
1457
+ });
1373
1458
  };
1374
1459
  }
1375
1460
 
@@ -2739,7 +2824,7 @@ async function createAutoAdapter(config = {}) {
2739
2824
  }
2740
2825
 
2741
2826
  // src/agents/collaboration/event-bus-helpers.ts
2742
- import { randomUUID } from "crypto";
2827
+ import { randomUUID as randomUUID2 } from "crypto";
2743
2828
  var DEFAULT_MAX_HISTORY_SIZE = 1e3;
2744
2829
  var MAX_SUBSCRIPTIONS = 500;
2745
2830
  var MAX_TOPIC_PATTERN_LENGTH = 200;
@@ -2760,10 +2845,10 @@ function topicMatchesPattern(topic, regex) {
2760
2845
  return regex.test(topic);
2761
2846
  }
2762
2847
  function generateEventId() {
2763
- return `evt-${String(getTimeProvider().now())}-${randomUUID().slice(0, 8)}`;
2848
+ return `evt-${String(getTimeProvider().now())}-${randomUUID2().slice(0, 8)}`;
2764
2849
  }
2765
2850
  function generateSubscriptionId() {
2766
- return `sub-${String(getTimeProvider().now())}-${randomUUID().slice(0, 8)}`;
2851
+ return `sub-${String(getTimeProvider().now())}-${randomUUID2().slice(0, 8)}`;
2767
2852
  }
2768
2853
  function applyHistoryFilters(history, filter) {
2769
2854
  let result = history;
@@ -3791,6 +3876,13 @@ function getGlobalRegistry(config) {
3791
3876
  return globalRegistry;
3792
3877
  }
3793
3878
 
3879
+ // src/cli-adapters/codex-limits.ts
3880
+ var CODEX_DEFAULT_MAX_THREADS = 6;
3881
+ function checkCodexConcurrency(codexBoundConcurrency) {
3882
+ if (codexBoundConcurrency <= CODEX_DEFAULT_MAX_THREADS) return null;
3883
+ return `${String(codexBoundConcurrency)} parallel calls are bound for Codex, exceeding its default max_threads=${String(CODEX_DEFAULT_MAX_THREADS)}. Codex may queue or drop the excess. Raise [agents] max_threads in ~/.codex/config.toml, or spread the panel across more CLIs (claude/gemini) so fewer roles land on Codex.`;
3884
+ }
3885
+
3794
3886
  // src/cli/voter-prompts.ts
3795
3887
  var DEFAULT_PROJECT = "nexus-agents";
3796
3888
  function prReviewModeAddendum() {
@@ -4447,6 +4539,15 @@ function resolveAdapter(options, logger12) {
4447
4539
  return { error: getErrorMessage(error) };
4448
4540
  }
4449
4541
  }
4542
+ function warnIfCodexConcurrencyExceeded(roleAdapters, logger12) {
4543
+ const codexBound = [...roleAdapters.values()].filter(
4544
+ (a) => a.name === "codex"
4545
+ ).length;
4546
+ const warning = checkCodexConcurrency(codexBound);
4547
+ if (warning !== null) {
4548
+ logger12.warn("Codex concurrency limit may be exceeded", { detail: warning });
4549
+ }
4550
+ }
4450
4551
  function assignUniformAdapter(roles, adapter) {
4451
4552
  const adapters = /* @__PURE__ */ new Map();
4452
4553
  for (const role of roles) adapters.set(role, adapter);
@@ -4541,6 +4642,7 @@ async function collectRealVotes(options) {
4541
4642
  );
4542
4643
  }
4543
4644
  const roleAdapters = options.adapter !== void 0 ? assignUniformAdapter(roles, adapterResult.adapter) : await resolveDiverseAdapters(roles, logger12, adapterResult.adapter);
4645
+ warnIfCodexConcurrencyExceeded(roleAdapters, logger12);
4544
4646
  const voteOptions = { timeoutMs, maxRetries, allowSimulation: allowSimulation ?? false };
4545
4647
  const interDelay = options.interAgentDelayMs ?? DEFAULT_INTER_AGENT_DELAY_MS;
4546
4648
  return launchStaggeredVotes({
@@ -8000,7 +8102,7 @@ var DEFAULT_BELIEF_CONFIG = {
8000
8102
  };
8001
8103
 
8002
8104
  // src/utils/id-utils.ts
8003
- import { randomUUID as randomUUID2 } from "crypto";
8105
+ import { randomUUID as randomUUID3 } from "crypto";
8004
8106
  function generateId(prefix, randomLength = 8) {
8005
8107
  const timestamp = getTimeProvider().now().toString(36);
8006
8108
  const random = getRandomProvider().random().toString(36).substring(2, 2 + randomLength);
@@ -8012,7 +8114,7 @@ function generateHyphenId(prefix, randomLength = 6) {
8012
8114
  return `${prefix}-${timestamp}-${random}`;
8013
8115
  }
8014
8116
  function generateUUID() {
8015
- return randomUUID2();
8117
+ return randomUUID3();
8016
8118
  }
8017
8119
 
8018
8120
  // src/context/belief-memory-helpers.ts
@@ -12178,7 +12280,7 @@ var ToolMemoryManager = class {
12178
12280
  };
12179
12281
 
12180
12282
  // src/orchestration/outcomes/outcome-store-persistence.ts
12181
- import { appendFileSync, readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync3 } from "fs";
12283
+ import { appendFileSync as appendFileSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync4 } from "fs";
12182
12284
  var PersistentOutcomeStore = class extends OutcomeStore {
12183
12285
  filePath;
12184
12286
  logger;
@@ -12229,7 +12331,7 @@ var PersistentOutcomeStore = class extends OutcomeStore {
12229
12331
  }
12230
12332
  }
12231
12333
  hydrate() {
12232
- if (!existsSync3(this.filePath)) {
12334
+ if (!existsSync4(this.filePath)) {
12233
12335
  this.logger.debug("No outcomes file found, starting fresh", {
12234
12336
  path: this.filePath
12235
12337
  });
@@ -12288,7 +12390,7 @@ var PersistentOutcomeStore = class extends OutcomeStore {
12288
12390
  }
12289
12391
  persistLine(outcome) {
12290
12392
  try {
12291
- appendFileSync(this.filePath, JSON.stringify(outcome) + "\n", "utf-8");
12393
+ appendFileSync2(this.filePath, JSON.stringify(outcome) + "\n", "utf-8");
12292
12394
  } catch (error) {
12293
12395
  const msg = getErrorMessage(error);
12294
12396
  this.logger.warn("Failed to persist outcome to disk", {
@@ -12385,6 +12487,9 @@ function recordVoteOutcomes(votes) {
12385
12487
  durationMs: vote.processingTimeMs,
12386
12488
  timestamp: now,
12387
12489
  source: "consensus",
12490
+ // #2662 — carry the voter role so the stratified outcome report
12491
+ // can break consensus results down by role.
12492
+ voterRole: vote.role,
12388
12493
  ...!voteSuccess && vote.error !== void 0 ? {
12389
12494
  failureCategory: categorizeOutcomeErrorMessage(vote.error),
12390
12495
  errorMessage: vote.error.slice(0, 500)
@@ -12888,7 +12993,7 @@ async function processVotesWithCascade(engineVotes, opts) {
12888
12993
  var CONTRARIAN_ESCALATION_THRESHOLD = 0.8;
12889
12994
  async function runContrarianCheck(proposal, log) {
12890
12995
  try {
12891
- const { executeExpert } = await import("./expert-bridge-3AWQHR65.js");
12996
+ const { executeExpert } = await import("./expert-bridge-DWBO2HXZ.js");
12892
12997
  const prompt = [
12893
12998
  "You are a contrarian analyst. Your job is to find reasons this proposal should be REJECTED.",
12894
12999
  "Look for: YAGNI (not needed), MISALIGNED (wrong tech/architecture), SECURITY_RISK, SCOPE_CREEP.",
@@ -13310,4 +13415,4 @@ export {
13310
13415
  CONSENSUS_VOTE_OUTPUT_SCHEMA,
13311
13416
  registerConsensusVoteTool
13312
13417
  };
13313
- //# sourceMappingURL=chunk-T5VPZZYX.js.map
13418
+ //# sourceMappingURL=chunk-CPPZCNAS.js.map