nexus-agents 2.111.1 → 2.113.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 (26) hide show
  1. package/dist/{chunk-GJ47JWNS.js → chunk-5KBR7SYI.js} +181 -335
  2. package/dist/chunk-5KBR7SYI.js.map +1 -0
  3. package/dist/{chunk-354QTTF2.js → chunk-5NE37CDW.js} +64 -10
  4. package/dist/{chunk-354QTTF2.js.map → chunk-5NE37CDW.js.map} +1 -1
  5. package/dist/{chunk-XOKGSQIB.js → chunk-5VGGVVPG.js} +48 -2
  6. package/dist/chunk-5VGGVVPG.js.map +1 -0
  7. package/dist/{chunk-5P5KCVTX.js → chunk-7E2ZCYKA.js} +162 -2
  8. package/dist/chunk-7E2ZCYKA.js.map +1 -0
  9. package/dist/{chunk-RA25HAZE.js → chunk-JPCEQZPE.js} +3 -3
  10. package/dist/{chunk-SQSBG6CW.js → chunk-OMZD4OZP.js} +2 -2
  11. package/dist/cli.js +7 -7
  12. package/dist/{consensus-vote-SB2G2W6G.js → consensus-vote-EW5HWO6Z.js} +3 -3
  13. package/dist/{improvement-review-GFCDFNYV.js → improvement-review-7R5Q4OD3.js} +5 -3
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +18 -18
  16. package/dist/index.js.map +1 -1
  17. package/dist/{setup-command-QVVFQ2RD.js → setup-command-UZTCNASI.js} +3 -3
  18. package/package.json +1 -1
  19. package/dist/chunk-5P5KCVTX.js.map +0 -1
  20. package/dist/chunk-GJ47JWNS.js.map +0 -1
  21. package/dist/chunk-XOKGSQIB.js.map +0 -1
  22. /package/dist/{chunk-RA25HAZE.js.map → chunk-JPCEQZPE.js.map} +0 -0
  23. /package/dist/{chunk-SQSBG6CW.js.map → chunk-OMZD4OZP.js.map} +0 -0
  24. /package/dist/{consensus-vote-SB2G2W6G.js.map → consensus-vote-EW5HWO6Z.js.map} +0 -0
  25. /package/dist/{improvement-review-GFCDFNYV.js.map → improvement-review-7R5Q4OD3.js.map} +0 -0
  26. /package/dist/{setup-command-QVVFQ2RD.js.map → setup-command-UZTCNASI.js.map} +0 -0
@@ -1,5 +1,10 @@
1
1
  import {
2
+ DEFAULT_CONSENSUS_CONFIG,
3
+ DEFAULT_INCREMENTAL_QUORUM_CONFIG,
2
4
  NOOP_NOTIFIER,
5
+ ProposalSchema,
6
+ VOTING_THRESHOLDS,
7
+ VoteSchema,
3
8
  createMcpNotifier,
4
9
  createSecureHandler,
5
10
  getToolAnnotations,
@@ -9,7 +14,7 @@ import {
9
14
  toolSuccess,
10
15
  withProgressHeartbeat,
11
16
  wrapToolWithTimeout
12
- } from "./chunk-5P5KCVTX.js";
17
+ } from "./chunk-7E2ZCYKA.js";
13
18
  import {
14
19
  getToolMemory
15
20
  } from "./chunk-P2K5GCLL.js";
@@ -66,7 +71,7 @@ import {
66
71
  } from "./chunk-CH7QIDHQ.js";
67
72
 
68
73
  // src/mcp/tools/consensus-vote.ts
69
- import { z as z10 } from "zod";
74
+ import { z as z9 } from "zod";
70
75
 
71
76
  // src/cli/vote-types.ts
72
77
  var VOTER_ROLES = {
@@ -1997,187 +2002,40 @@ async function collectRealVotes(options) {
1997
2002
  });
1998
2003
  }
1999
2004
 
2000
- // src/consensus/types-core.ts
2001
- import { z as z2 } from "zod";
2002
- var ConsensusAlgorithmSchema = z2.enum([
2003
- "simple_majority",
2004
- "supermajority",
2005
- "unanimous",
2006
- "proof_of_learning",
2007
- "opinion_wise",
2008
- "higher_order"
2009
- ]);
2010
- var VoteDecisionSchema = z2.enum(["approve", "reject", "abstain"]);
2011
- var ProposalStatusSchema = z2.enum([
2012
- "pending",
2013
- "voting",
2014
- "approved",
2015
- "rejected",
2016
- "timeout",
2017
- "closed"
2018
- ]);
2019
- var RejectionCategorySchema = z2.enum([
2020
- "YAGNI",
2021
- "DRY_VIOLATION",
2022
- "OVER_ENGINEERING",
2023
- "SCOPE_CREEP",
2024
- "SECURITY_RISK",
2025
- "MISALIGNED",
2026
- "INSUFFICIENT_EVIDENCE"
2027
- ]);
2028
- var REJECTION_CATEGORIES = RejectionCategorySchema.options;
2029
- var FindingShapeSchema = z2.object({
2030
- summary: z2.string().min(1).max(500),
2031
- location: z2.string().min(1).max(200),
2032
- severity: z2.enum(["critical", "high", "medium", "low"]).default("medium"),
2033
- gate: z2.object({
2034
- reread_cited_line: z2.enum(["passed", "failed", "skipped"]).default("skipped"),
2035
- traced_call_path: z2.enum(["passed", "failed", "skipped"]).default("skipped"),
2036
- named_assertion: z2.string().default(""),
2037
- ruled_out_language_non_issue: z2.enum(["passed", "failed", "skipped"]).default("skipped")
2038
- }),
2039
- claim: z2.string().min(1).max(2e3)
2040
- });
2041
- var VoteSchema = z2.object({
2042
- decision: VoteDecisionSchema,
2043
- reasoning: z2.string().min(1).describe("Explanation for the vote"),
2044
- confidence: z2.number().min(0).max(1).describe("Confidence level 0-1"),
2045
- conditions: z2.array(z2.string()).optional().describe("Conditions for approval"),
2046
- /** Structured rejection categories for reject→refine→re-vote loops (Issue #1213). */
2047
- rejectionCategories: z2.array(RejectionCategorySchema).optional().describe("Rejection reason categories when decision is reject"),
2048
- /** Pre-verified PR-review findings (#2245 v4 follow-up). Optional;
2049
- * populated only when the voter emits the structured top-level array. */
2050
- findings: z2.array(FindingShapeSchema).optional().describe("PR-review findings (pre-verified)"),
2051
- timestamp: z2.iso.datetime().optional()
2052
- });
2053
- var ProposalSchema = z2.object({
2054
- id: z2.string().optional().describe("Auto-generated if not provided"),
2055
- title: z2.string().min(1).max(200).describe("Short proposal title"),
2056
- description: z2.string().min(1).describe("Detailed proposal description"),
2057
- algorithm: ConsensusAlgorithmSchema,
2058
- timeout: z2.number().int().positive().optional().describe("Timeout in milliseconds"),
2059
- requiredVoters: z2.array(z2.string()).optional().describe("Agent IDs that must vote"),
2060
- metadata: z2.record(z2.string(), z2.unknown()).optional().describe("Additional context"),
2061
- createdAt: z2.iso.datetime().optional()
2062
- });
2063
- var ConsensusResultSchema = z2.object({
2064
- proposalId: z2.string(),
2065
- proposal: ProposalSchema,
2066
- outcome: ProposalStatusSchema,
2067
- votes: z2.map(z2.string(), VoteSchema),
2068
- voteCounts: z2.object({
2069
- approve: z2.number().int().nonnegative(),
2070
- reject: z2.number().int().nonnegative(),
2071
- abstain: z2.number().int().nonnegative(),
2072
- total: z2.number().int().nonnegative()
2073
- }),
2074
- weightedCounts: z2.object({
2075
- approve: z2.number().nonnegative(),
2076
- reject: z2.number().nonnegative(),
2077
- abstain: z2.number().nonnegative(),
2078
- totalWeight: z2.number().nonnegative()
2079
- }).optional(),
2080
- approvalPercentage: z2.number().min(0).max(100),
2081
- quorumReached: z2.boolean(),
2082
- startedAt: z2.iso.datetime(),
2083
- closedAt: z2.iso.datetime(),
2084
- durationMs: z2.number().int().nonnegative()
2085
- });
2086
- var AgentPerformanceSchema = z2.object({
2087
- agentId: z2.string(),
2088
- totalVotes: z2.number().int().nonnegative(),
2089
- correctVotes: z2.number().int().nonnegative(),
2090
- successRate: z2.number().min(0).max(1),
2091
- lastUpdated: z2.iso.datetime()
2092
- });
2093
- var DEFAULT_INCREMENTAL_QUORUM_CONFIG = {
2094
- enabled: false,
2095
- maxExpansionRounds: 2,
2096
- votersPerExpansion: 2,
2097
- confidenceThreshold: 0.6,
2098
- ambiguityBand: 0.15
2099
- };
2100
- var ProposalCacheConfigSchema = z2.object({
2101
- enabled: z2.boolean().default(false),
2102
- ttlMs: z2.number().int().positive().default(36e5),
2103
- // 1 hour
2104
- maxEntries: z2.number().int().positive().default(500)
2105
- });
2106
- var ConsensusEngineConfigSchema = z2.object({
2107
- defaultTimeout: z2.number().int().positive().default(3e5),
2108
- // 5 minutes
2109
- minVotersForQuorum: z2.number().int().positive().default(2),
2110
- maxActiveProposals: z2.number().int().positive().default(100),
2111
- enablePerformanceTracking: z2.boolean().default(true),
2112
- maxClosedProposals: z2.number().int().positive().default(1e3),
2113
- // Issue #549
2114
- proposalCache: ProposalCacheConfigSchema.optional()
2115
- // Issue #589
2116
- });
2117
- var DEFAULT_CONSENSUS_CONFIG = {
2118
- defaultTimeout: 3e5,
2119
- // 5 minutes
2120
- minVotersForQuorum: 2,
2121
- maxActiveProposals: 100,
2122
- enablePerformanceTracking: true,
2123
- maxClosedProposals: 1e3
2124
- // Issue #549: Prevent unbounded memory growth
2125
- };
2126
- var VOTING_THRESHOLDS = {
2127
- simple_majority: 0.5,
2128
- supermajority: 0.67,
2129
- unanimous: 1,
2130
- proof_of_learning: 0.5,
2131
- // Uses weighted voting
2132
- opinion_wise: 0.5,
2133
- // Uses correlation-aware Bayesian aggregation (Issue #333)
2134
- higher_order: 0.5
2135
- // Alias for opinion_wise (Issue #514)
2136
- };
2137
- var ConsensusMetricsSchema = z2.object({
2138
- totalProposals: z2.number().int().nonnegative(),
2139
- approvedProposals: z2.number().int().nonnegative(),
2140
- rejectedProposals: z2.number().int().nonnegative(),
2141
- timedOutProposals: z2.number().int().nonnegative(),
2142
- averageDurationMs: z2.number().nonnegative(),
2143
- averageVotesPerProposal: z2.number().nonnegative(),
2144
- algorithmUsage: z2.record(ConsensusAlgorithmSchema, z2.number().int().nonnegative())
2145
- });
2146
-
2147
2005
  // src/consensus/types-voting-protocol.ts
2148
- import { z as z3 } from "zod";
2149
- var VotingRoundPhaseSchema = z3.enum(["analysis", "deliberation", "consensus"]);
2150
- var VotingRoundStatusSchema = z3.enum([
2006
+ import { z as z2 } from "zod";
2007
+ var VotingRoundPhaseSchema = z2.enum(["analysis", "deliberation", "consensus"]);
2008
+ var VotingRoundStatusSchema = z2.enum([
2151
2009
  "pending",
2152
2010
  "in_progress",
2153
2011
  "awaiting_votes",
2154
2012
  "completed",
2155
2013
  "aborted"
2156
2014
  ]);
2157
- var AgentFindingSchema = z3.object({
2158
- agentId: z3.string(),
2159
- category: z3.enum(["bug", "security", "performance", "style", "design", "documentation", "other"]),
2160
- severity: z3.enum(["critical", "major", "minor", "suggestion"]),
2161
- description: z3.string().min(1),
2162
- location: z3.string().optional().describe("File path and line range if applicable"),
2163
- suggestion: z3.string().optional().describe("Recommended fix"),
2164
- confidence: z3.number().min(0).max(1),
2165
- timestamp: z3.iso.datetime().optional()
2015
+ var AgentFindingSchema = z2.object({
2016
+ agentId: z2.string(),
2017
+ category: z2.enum(["bug", "security", "performance", "style", "design", "documentation", "other"]),
2018
+ severity: z2.enum(["critical", "major", "minor", "suggestion"]),
2019
+ description: z2.string().min(1),
2020
+ location: z2.string().optional().describe("File path and line range if applicable"),
2021
+ suggestion: z2.string().optional().describe("Recommended fix"),
2022
+ confidence: z2.number().min(0).max(1),
2023
+ timestamp: z2.iso.datetime().optional()
2166
2024
  });
2167
- var FindingVoteSchema = z3.object({
2168
- agentId: z3.string(),
2169
- findingId: z3.string(),
2170
- agree: z3.boolean(),
2171
- reasoning: z3.string().optional(),
2172
- amendedSeverity: z3.enum(["critical", "major", "minor", "suggestion"]).optional()
2025
+ var FindingVoteSchema = z2.object({
2026
+ agentId: z2.string(),
2027
+ findingId: z2.string(),
2028
+ agree: z2.boolean(),
2029
+ reasoning: z2.string().optional(),
2030
+ amendedSeverity: z2.enum(["critical", "major", "minor", "suggestion"]).optional()
2173
2031
  });
2174
- var VotingProtocolConfigSchema = z3.object({
2175
- committeeSize: z3.number().int().min(2).max(7).default(3),
2176
- maxRounds: z3.number().int().min(1).max(5).default(3),
2177
- roundTimeoutMs: z3.number().int().positive().default(6e4),
2178
- agreementThreshold: z3.number().min(0.5).max(1).default(0.67),
2179
- enableAntiSycophancy: z3.boolean().default(true),
2180
- sycophancyThreshold: z3.number().min(0).max(1).default(0.8)
2032
+ var VotingProtocolConfigSchema = z2.object({
2033
+ committeeSize: z2.number().int().min(2).max(7).default(3),
2034
+ maxRounds: z2.number().int().min(1).max(5).default(3),
2035
+ roundTimeoutMs: z2.number().int().positive().default(6e4),
2036
+ agreementThreshold: z2.number().min(0.5).max(1).default(0.67),
2037
+ enableAntiSycophancy: z2.boolean().default(true),
2038
+ sycophancyThreshold: z2.number().min(0).max(1).default(0.8)
2181
2039
  });
2182
2040
  var DEFAULT_VOTING_PROTOCOL_CONFIG = {
2183
2041
  committeeSize: 3,
@@ -2189,30 +2047,30 @@ var DEFAULT_VOTING_PROTOCOL_CONFIG = {
2189
2047
  };
2190
2048
 
2191
2049
  // src/consensus/types-weighted-voting.ts
2192
- import { z as z4 } from "zod";
2193
- var TaskOutcomeStatusSchema = z4.enum(["success", "failure", "partial", "unknown"]);
2194
- var WeightedAgentRecordSchema = z4.object({
2195
- agentId: z4.string().min(1),
2196
- totalTasks: z4.number().int().nonnegative(),
2197
- successfulTasks: z4.number().int().nonnegative(),
2198
- failedTasks: z4.number().int().nonnegative(),
2199
- partialTasks: z4.number().int().nonnegative(),
2200
- successRate: z4.number().min(0).max(1),
2201
- weight: z4.number().min(0).max(1),
2202
- trustScore: z4.number().min(0).max(1),
2203
- byzantineFlags: z4.number().int().nonnegative(),
2204
- lastActive: z4.date(),
2205
- createdAt: z4.date()
2050
+ import { z as z3 } from "zod";
2051
+ var TaskOutcomeStatusSchema = z3.enum(["success", "failure", "partial", "unknown"]);
2052
+ var WeightedAgentRecordSchema = z3.object({
2053
+ agentId: z3.string().min(1),
2054
+ totalTasks: z3.number().int().nonnegative(),
2055
+ successfulTasks: z3.number().int().nonnegative(),
2056
+ failedTasks: z3.number().int().nonnegative(),
2057
+ partialTasks: z3.number().int().nonnegative(),
2058
+ successRate: z3.number().min(0).max(1),
2059
+ weight: z3.number().min(0).max(1),
2060
+ trustScore: z3.number().min(0).max(1),
2061
+ byzantineFlags: z3.number().int().nonnegative(),
2062
+ lastActive: z3.date(),
2063
+ createdAt: z3.date()
2206
2064
  });
2207
- var WeightedVotingConfigSchema = z4.object({
2208
- minWeight: z4.number().min(0).max(1).default(0.1),
2209
- maxByzantineFraction: z4.number().min(0).max(0.5).default(0.33),
2210
- weightDecayFactor: z4.number().min(0.5).max(1).default(0.9),
2211
- weightRecoveryFactor: z4.number().min(1).max(2).default(1.05),
2212
- minTrustScore: z4.number().min(0).max(1).default(0.3),
2213
- byzantineFlagThreshold: z4.number().int().positive().default(3),
2214
- initialWeight: z4.number().min(0).max(1).default(0.5),
2215
- quorumThreshold: z4.number().min(0.5).max(1).default(0.67)
2065
+ var WeightedVotingConfigSchema = z3.object({
2066
+ minWeight: z3.number().min(0).max(1).default(0.1),
2067
+ maxByzantineFraction: z3.number().min(0).max(0.5).default(0.33),
2068
+ weightDecayFactor: z3.number().min(0.5).max(1).default(0.9),
2069
+ weightRecoveryFactor: z3.number().min(1).max(2).default(1.05),
2070
+ minTrustScore: z3.number().min(0).max(1).default(0.3),
2071
+ byzantineFlagThreshold: z3.number().int().positive().default(3),
2072
+ initialWeight: z3.number().min(0).max(1).default(0.5),
2073
+ quorumThreshold: z3.number().min(0.5).max(1).default(0.67)
2216
2074
  });
2217
2075
  var DEFAULT_WEIGHTED_VOTING_CONFIG = {
2218
2076
  minWeight: 0.1,
@@ -2226,7 +2084,7 @@ var DEFAULT_WEIGHTED_VOTING_CONFIG = {
2226
2084
  };
2227
2085
 
2228
2086
  // src/consensus/higher-order-types.ts
2229
- import { z as z5 } from "zod";
2087
+ import { z as z4 } from "zod";
2230
2088
  function createAgentPairKey(agentA, agentB) {
2231
2089
  return agentA < agentB ? `${agentA}:${agentB}` : `${agentB}:${agentA}`;
2232
2090
  }
@@ -2237,40 +2095,40 @@ function parseAgentPairKey(key) {
2237
2095
  }
2238
2096
  return [parts[0], parts[1]];
2239
2097
  }
2240
- var CorrelationCoefficientSchema = z5.number().min(-1).max(1);
2241
- var IndependentSubsetSchema = z5.object({
2242
- id: z5.string(),
2243
- agentIds: z5.array(z5.string()),
2244
- independenceScore: z5.number().min(0).max(1),
2245
- observationCount: z5.number().int().nonnegative()
2098
+ var CorrelationCoefficientSchema = z4.number().min(-1).max(1);
2099
+ var IndependentSubsetSchema = z4.object({
2100
+ id: z4.string(),
2101
+ agentIds: z4.array(z4.string()),
2102
+ independenceScore: z4.number().min(0).max(1),
2103
+ observationCount: z4.number().int().nonnegative()
2246
2104
  });
2247
- var VotingObservationSchema = z5.object({
2248
- proposalId: z5.string(),
2249
- agentId: z5.string(),
2250
- decision: z5.enum(["approve", "reject", "abstain"]),
2251
- confidence: z5.number().min(0).max(1),
2252
- alignedWithOutcome: z5.boolean(),
2253
- timestamp: z5.date()
2105
+ var VotingObservationSchema = z4.object({
2106
+ proposalId: z4.string(),
2107
+ agentId: z4.string(),
2108
+ decision: z4.enum(["approve", "reject", "abstain"]),
2109
+ confidence: z4.number().min(0).max(1),
2110
+ alignedWithOutcome: z4.boolean(),
2111
+ timestamp: z4.date()
2254
2112
  });
2255
- var PairwiseVotingHistorySchema = z5.object({
2256
- pairKey: z5.string(),
2257
- jointObservations: z5.number().int().nonnegative(),
2258
- agreements: z5.number().int().nonnegative(),
2259
- disagreements: z5.number().int().nonnegative(),
2113
+ var PairwiseVotingHistorySchema = z4.object({
2114
+ pairKey: z4.string(),
2115
+ jointObservations: z4.number().int().nonnegative(),
2116
+ agreements: z4.number().int().nonnegative(),
2117
+ disagreements: z4.number().int().nonnegative(),
2260
2118
  correlation: CorrelationCoefficientSchema,
2261
- lastUpdated: z5.date()
2119
+ lastUpdated: z4.date()
2262
2120
  });
2263
- var HigherOrderVotingConfigSchema = z5.object({
2264
- minObservationsForCorrelation: z5.number().int().positive().default(10),
2265
- correlationThreshold: z5.number().min(0).max(1).default(0.3),
2266
- correlationMaxAgeMs: z5.number().int().positive().default(864e5),
2121
+ var HigherOrderVotingConfigSchema = z4.object({
2122
+ minObservationsForCorrelation: z4.number().int().positive().default(10),
2123
+ correlationThreshold: z4.number().min(0).max(1).default(0.3),
2124
+ correlationMaxAgeMs: z4.number().int().positive().default(864e5),
2267
2125
  // 24 hours
2268
- independenceThreshold: z5.number().min(0).max(1).default(0.2),
2269
- fallbackToSimpleVoting: z5.boolean().default(true),
2270
- observationDecayFactor: z5.number().min(0).max(1).default(0.95),
2271
- maxObservationsPerAgent: z5.number().int().positive().default(1e3),
2272
- maxProposals: z5.number().int().positive().default(5e3),
2273
- maxTrackedPairs: z5.number().int().positive().default(100)
2126
+ independenceThreshold: z4.number().min(0).max(1).default(0.2),
2127
+ fallbackToSimpleVoting: z4.boolean().default(true),
2128
+ observationDecayFactor: z4.number().min(0).max(1).default(0.95),
2129
+ maxObservationsPerAgent: z4.number().int().positive().default(1e3),
2130
+ maxProposals: z4.number().int().positive().default(5e3),
2131
+ maxTrackedPairs: z4.number().int().positive().default(100)
2274
2132
  });
2275
2133
  var DEFAULT_HIGHER_ORDER_CONFIG = {
2276
2134
  minObservationsForCorrelation: 10,
@@ -2284,25 +2142,25 @@ var DEFAULT_HIGHER_ORDER_CONFIG = {
2284
2142
  maxProposals: 5e3,
2285
2143
  maxTrackedPairs: 100
2286
2144
  };
2287
- var HigherOrderVotingResultSchema = z5.object({
2288
- decision: z5.enum(["approve", "reject", "no_consensus"]),
2289
- posteriorApproval: z5.number().min(0).max(1),
2290
- posteriorRejection: z5.number().min(0).max(1),
2291
- effectiveVoteCount: z5.number().nonnegative(),
2292
- usedCorrelationData: z5.boolean(),
2293
- method: z5.enum(["ow", "isp", "simple"]),
2294
- improvementOverBaseline: z5.number(),
2295
- independentSubsets: z5.array(IndependentSubsetSchema).optional(),
2296
- downweightedAgents: z5.array(z5.string()),
2297
- reasoning: z5.string()
2145
+ var HigherOrderVotingResultSchema = z4.object({
2146
+ decision: z4.enum(["approve", "reject", "no_consensus"]),
2147
+ posteriorApproval: z4.number().min(0).max(1),
2148
+ posteriorRejection: z4.number().min(0).max(1),
2149
+ effectiveVoteCount: z4.number().nonnegative(),
2150
+ usedCorrelationData: z4.boolean(),
2151
+ method: z4.enum(["ow", "isp", "simple"]),
2152
+ improvementOverBaseline: z4.number(),
2153
+ independentSubsets: z4.array(IndependentSubsetSchema).optional(),
2154
+ downweightedAgents: z4.array(z4.string()),
2155
+ reasoning: z4.string()
2298
2156
  });
2299
- var CorrelationTrackerStatsSchema = z5.object({
2300
- totalAgents: z5.number().int().nonnegative(),
2301
- trackedPairs: z5.number().int().nonnegative(),
2302
- totalObservations: z5.number().int().nonnegative(),
2303
- averageCorrelation: z5.number(),
2304
- independentSubsetCount: z5.number().int().nonnegative(),
2305
- pairsWithSufficientData: z5.number().int().nonnegative()
2157
+ var CorrelationTrackerStatsSchema = z4.object({
2158
+ totalAgents: z4.number().int().nonnegative(),
2159
+ trackedPairs: z4.number().int().nonnegative(),
2160
+ totalObservations: z4.number().int().nonnegative(),
2161
+ averageCorrelation: z4.number(),
2162
+ independentSubsetCount: z4.number().int().nonnegative(),
2163
+ pairsWithSufficientData: z4.number().int().nonnegative()
2306
2164
  });
2307
2165
 
2308
2166
  // src/consensus/higher-order-helpers.ts
@@ -4990,7 +4848,7 @@ function createCorrelationTracker(config) {
4990
4848
 
4991
4849
  // src/consensus/correlation-persistence.ts
4992
4850
  import * as fs from "fs";
4993
- import { z as z6 } from "zod";
4851
+ import { z as z5 } from "zod";
4994
4852
  var logger6 = createLogger({ component: "correlation-persistence" });
4995
4853
  var VOTING_SUBDIR = "voting";
4996
4854
  var CORRELATIONS_FILE = "correlations.json";
@@ -4998,21 +4856,21 @@ var CORRELATIONS_JSONL_FILE = "correlations.jsonl";
4998
4856
  var FILE_MODE = 384;
4999
4857
  var DIR_MODE = 448;
5000
4858
  var SCHEMA_VERSION = 2;
5001
- var PersistedVoteSchema = z6.object({
5002
- agentId: z6.string(),
5003
- decision: z6.enum(["approve", "reject", "abstain"]),
5004
- confidence: z6.number().min(0).max(1)
4859
+ var PersistedVoteSchema = z5.object({
4860
+ agentId: z5.string(),
4861
+ decision: z5.enum(["approve", "reject", "abstain"]),
4862
+ confidence: z5.number().min(0).max(1)
5005
4863
  });
5006
- var PersistedProposalSchema = z6.object({
5007
- proposalId: z6.string(),
5008
- votes: z6.array(PersistedVoteSchema),
5009
- outcome: z6.enum(["approved", "rejected"]),
5010
- timestamp: z6.iso.datetime()
4864
+ var PersistedProposalSchema = z5.object({
4865
+ proposalId: z5.string(),
4866
+ votes: z5.array(PersistedVoteSchema),
4867
+ outcome: z5.enum(["approved", "rejected"]),
4868
+ timestamp: z5.iso.datetime()
5011
4869
  });
5012
- var PersistedCorrelationDataSchema = z6.object({
5013
- version: z6.number().int().positive(),
5014
- proposals: z6.array(PersistedProposalSchema),
5015
- savedAt: z6.iso.datetime()
4870
+ var PersistedCorrelationDataSchema = z5.object({
4871
+ version: z5.number().int().positive(),
4872
+ proposals: z5.array(PersistedProposalSchema),
4873
+ savedAt: z5.iso.datetime()
5016
4874
  });
5017
4875
  function getCorrelationDataPath() {
5018
4876
  return nexusDataPath(VOTING_SUBDIR, CORRELATIONS_FILE);
@@ -5213,9 +5071,9 @@ function createPersistedProposal(proposalId, votes, outcome) {
5213
5071
  }
5214
5072
 
5215
5073
  // src/mcp/tools/consensus-vote-types.ts
5216
- import { z as z7 } from "zod";
5074
+ import { z as z6 } from "zod";
5217
5075
  var MAX_PROPOSAL_LENGTH = 4e3;
5218
- var VotingStrategySchema = z7.enum([
5076
+ var VotingStrategySchema = z6.enum([
5219
5077
  "simple_majority",
5220
5078
  "supermajority",
5221
5079
  "unanimous",
@@ -5226,8 +5084,8 @@ var VotingStrategySchema = z7.enum([
5226
5084
  function isHigherOrderStrategy(strategy) {
5227
5085
  return strategy === "higher_order" || strategy === "opinion_wise";
5228
5086
  }
5229
- var ErrorPolicySchema = z7.enum(["reduce_denominator", "count_as_abstain", "fail_closed"]);
5230
- var VoteThresholdSchema = z7.enum(["majority", "supermajority", "unanimous"]);
5087
+ var ErrorPolicySchema = z6.enum(["reduce_denominator", "count_as_abstain", "fail_closed"]);
5088
+ var VoteThresholdSchema = z6.enum(["majority", "supermajority", "unanimous"]);
5231
5089
  var ERROR_FLOOR_FRACTION = 0.5;
5232
5090
  function getDefaultErrorPolicy(strategy) {
5233
5091
  if (strategy === "unanimous") {
@@ -5235,8 +5093,8 @@ function getDefaultErrorPolicy(strategy) {
5235
5093
  }
5236
5094
  return "reduce_denominator";
5237
5095
  }
5238
- var ConsensusVoteInputSchema = z7.object({
5239
- proposal: z7.string().min(1).max(MAX_PROPOSAL_LENGTH).describe("Proposal text to vote on"),
5096
+ var ConsensusVoteInputSchema = z6.object({
5097
+ proposal: z6.string().min(1).max(MAX_PROPOSAL_LENGTH).describe("Proposal text to vote on"),
5240
5098
  threshold: VoteThresholdSchema.optional().describe(
5241
5099
  "Voting threshold (legacy): majority, supermajority, unanimous. Use strategy instead."
5242
5100
  ),
@@ -5246,8 +5104,8 @@ var ConsensusVoteInputSchema = z7.object({
5246
5104
  errorPolicy: ErrorPolicySchema.optional().describe(
5247
5105
  "How to treat voters that errored or timed out (#2630). Default: fail_closed for unanimous only; reduce_denominator for all other strategies incl. higher_order/opinion_wise (#3138 \u2014 a single infra timeout should not void an otherwise-unanimous vote). Regardless of policy, errors > 50% always fails."
5248
5106
  ),
5249
- quickMode: z7.boolean().optional().default(false).describe("Use 3 agents instead of the full 7-role panel for faster execution"),
5250
- simulateVotes: z7.boolean().optional().default(false).describe(
5107
+ quickMode: z6.boolean().optional().default(false).describe("Use 3 agents instead of the full 7-role panel for faster execution"),
5108
+ simulateVotes: z6.boolean().optional().default(false).describe(
5251
5109
  "TESTS ONLY \u2014 when true, voters return random decisions. Output must not be used for real decisions. (#2319)"
5252
5110
  ),
5253
5111
  /**
@@ -5267,7 +5125,7 @@ var ConsensusVoteInputSchema = z7.object({
5267
5125
  * Kept optional (no `.default()`) so the inferred type doesn't force
5268
5126
  * `mode: 'sync'` on every existing call site / test fixture.
5269
5127
  */
5270
- mode: z7.enum(["sync", "async"]).optional().describe(
5128
+ mode: z6.enum(["sync", "async"]).optional().describe(
5271
5129
  'Dispatch mode (default: sync). Use "async" for higher-order strategies with 7 voters.'
5272
5130
  ),
5273
5131
  /**
@@ -5276,7 +5134,7 @@ var ConsensusVoteInputSchema = z7.object({
5276
5134
  * same key with different inputs fails closed with
5277
5135
  * `idempotency_key_collision`. Sync mode ignores this.
5278
5136
  */
5279
- idempotencyKey: z7.string().min(1).max(256).optional().describe(
5137
+ idempotencyKey: z6.string().min(1).max(256).optional().describe(
5280
5138
  "Replay-safe key for async-mode dispatch (#3042 Stage 1c). Same (key, inputs) returns existing jobId."
5281
5139
  )
5282
5140
  });
@@ -5621,30 +5479,30 @@ function warnIfSimulatedOutsideTests(toolName, logger11) {
5621
5479
 
5622
5480
  // src/mcp/jobs/job-result-store.ts
5623
5481
  import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync, writeFileSync as writeFileSync3 } from "fs";
5624
- import { z as z8 } from "zod";
5482
+ import { z as z7 } from "zod";
5625
5483
  var logger8 = createLogger({ component: "job-result-store" });
5626
- var JobStatusSchema = z8.enum(["pending", "complete", "failed", "cancelled"]);
5627
- var JobResultSchema = z8.object({
5484
+ var JobStatusSchema = z7.enum(["pending", "complete", "failed", "cancelled"]);
5485
+ var JobResultSchema = z7.object({
5628
5486
  /** Format version. Currently `1` — bump if the shape changes. */
5629
- v: z8.literal(1),
5630
- jobId: z8.string().min(1),
5487
+ v: z7.literal(1),
5488
+ jobId: z7.string().min(1),
5631
5489
  /** Tool that was invoked (e.g. `orchestrate`). */
5632
- toolName: z8.string().min(1),
5490
+ toolName: z7.string().min(1),
5633
5491
  status: JobStatusSchema,
5634
- createdAt: z8.iso.datetime(),
5492
+ createdAt: z7.iso.datetime(),
5635
5493
  /** Set when the job leaves `pending` — either via `complete` or `failed` or `cancelled`. */
5636
- completedAt: z8.iso.datetime().optional(),
5494
+ completedAt: z7.iso.datetime().optional(),
5637
5495
  /**
5638
5496
  * Structured payload the synchronous mode would have returned. Present
5639
5497
  * only when `status === 'complete'`. Shape is tool-specific — readers
5640
5498
  * cast to the tool's known output type after status check.
5641
5499
  */
5642
- result: z8.unknown().optional(),
5500
+ result: z7.unknown().optional(),
5643
5501
  /**
5644
5502
  * Failure message when `status === 'failed'`. Cannot be paired with
5645
5503
  * `result` — the discriminator is `status`.
5646
5504
  */
5647
- error: z8.string().optional()
5505
+ error: z7.string().optional()
5648
5506
  });
5649
5507
  function jobResultPath(jobId) {
5650
5508
  return nexusDataPathEnsure("jobs", `result-${jobId}.json`);
@@ -5761,20 +5619,20 @@ function listJobs() {
5761
5619
  // src/mcp/jobs/job-idempotency.ts
5762
5620
  import { createHash, randomUUID as randomUUID2 } from "crypto";
5763
5621
  import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
5764
- import { z as z9 } from "zod";
5622
+ import { z as z8 } from "zod";
5765
5623
  var logger9 = createLogger({ component: "job-idempotency" });
5766
- var IdempotencyIndexEntrySchema = z9.object({
5767
- v: z9.literal(1),
5624
+ var IdempotencyIndexEntrySchema = z8.object({
5625
+ v: z8.literal(1),
5768
5626
  /** MCP tool name (e.g. `orchestrate`, `run_workflow`, `consensus_vote`). */
5769
- tool: z9.string().min(1),
5627
+ tool: z8.string().min(1),
5770
5628
  /** Caller-supplied idempotency key. */
5771
- key: z9.string().min(1),
5629
+ key: z8.string().min(1),
5772
5630
  /** sha256 of the canonical input JSON. */
5773
- inputsHash: z9.string().length(64),
5631
+ inputsHash: z8.string().length(64),
5774
5632
  /** Existing jobId for this (tool, key, inputs) tuple. */
5775
- jobId: z9.string().min(1),
5633
+ jobId: z8.string().min(1),
5776
5634
  /** ISO timestamp of first dispatch. */
5777
- createdAt: z9.iso.datetime()
5635
+ createdAt: z8.iso.datetime()
5778
5636
  });
5779
5637
  function sha256Hex(input) {
5780
5638
  return createHash("sha256").update(input).digest("hex");
@@ -6432,27 +6290,27 @@ function createConsensusVoteHandler(deps) {
6432
6290
  };
6433
6291
  }
6434
6292
  var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
6435
- proposal: z10.string(),
6293
+ proposal: z9.string(),
6436
6294
  strategy: VotingStrategySchema,
6437
- decision: z10.enum(["approved", "rejected", "no_quorum"]),
6438
- approvalPercentage: z10.number(),
6439
- voteCounts: z10.object({
6440
- approve: z10.number(),
6441
- reject: z10.number(),
6442
- abstain: z10.number(),
6443
- error: z10.number()
6295
+ decision: z9.enum(["approved", "rejected", "no_quorum"]),
6296
+ approvalPercentage: z9.number(),
6297
+ voteCounts: z9.object({
6298
+ approve: z9.number(),
6299
+ reject: z9.number(),
6300
+ abstain: z9.number(),
6301
+ error: z9.number()
6444
6302
  }),
6445
- votes: z10.array(
6446
- z10.object({
6447
- role: z10.string().max(100),
6448
- decision: z10.enum(["approve", "reject", "abstain"]),
6449
- confidence: z10.number(),
6450
- reasoning: z10.string().max(4e3),
6451
- simulated: z10.boolean(),
6452
- error: z10.boolean(),
6453
- modelUsed: z10.string().max(100).optional(),
6454
- rejectionCategories: z10.array(
6455
- z10.enum([
6303
+ votes: z9.array(
6304
+ z9.object({
6305
+ role: z9.string().max(100),
6306
+ decision: z9.enum(["approve", "reject", "abstain"]),
6307
+ confidence: z9.number(),
6308
+ reasoning: z9.string().max(4e3),
6309
+ simulated: z9.boolean(),
6310
+ error: z9.boolean(),
6311
+ modelUsed: z9.string().max(100).optional(),
6312
+ rejectionCategories: z9.array(
6313
+ z9.enum([
6456
6314
  "YAGNI",
6457
6315
  "DRY_VIOLATION",
6458
6316
  "OVER_ENGINEERING",
@@ -6465,34 +6323,34 @@ var CONSENSUS_VOTE_OUTPUT_SCHEMA = {
6465
6323
  })
6466
6324
  ),
6467
6325
  threshold: VoteThresholdSchema.optional(),
6468
- durationMs: z10.number(),
6469
- simulateVotes: z10.boolean(),
6470
- higherOrderMetadata: z10.object({
6471
- posteriorApproval: z10.number(),
6472
- posteriorRejection: z10.number(),
6473
- effectiveVoteCount: z10.number(),
6474
- method: z10.enum(["ow", "isp", "simple"]),
6475
- usedCorrelationData: z10.boolean(),
6476
- improvementOverBaseline: z10.number(),
6477
- downweightedAgents: z10.array(z10.string().max(100)).max(10),
6478
- reasoning: z10.string().max(2e3)
6326
+ durationMs: z9.number(),
6327
+ simulateVotes: z9.boolean(),
6328
+ higherOrderMetadata: z9.object({
6329
+ posteriorApproval: z9.number(),
6330
+ posteriorRejection: z9.number(),
6331
+ effectiveVoteCount: z9.number(),
6332
+ method: z9.enum(["ow", "isp", "simple"]),
6333
+ usedCorrelationData: z9.boolean(),
6334
+ improvementOverBaseline: z9.number(),
6335
+ downweightedAgents: z9.array(z9.string().max(100)).max(10),
6336
+ reasoning: z9.string().max(2e3)
6479
6337
  }).optional(),
6480
6338
  // #3124: explains a `rejected` decision that coexists with a high
6481
6339
  // approvalPercentage (an error-policy short-circuit, e.g. fail_closed).
6482
- policyReason: z10.string().max(200).optional()
6340
+ policyReason: z9.string().max(200).optional()
6483
6341
  };
6484
6342
  function registerConsensusVoteTool(server, deps) {
6485
6343
  const logger11 = deps.logger ?? createLogger({ tool: "consensus_vote" });
6486
6344
  const notifier = deps.notifier ?? createMcpNotifier(server);
6487
6345
  const depsWithNotifier = { ...deps, notifier };
6488
6346
  const toolSchema = {
6489
- proposal: z10.string().min(1).max(MAX_PROPOSAL_LENGTH).describe("Proposal text to vote on"),
6490
- threshold: z10.enum(["majority", "supermajority", "unanimous"]).optional().describe("Voting threshold (legacy). Use strategy instead."),
6347
+ proposal: z9.string().min(1).max(MAX_PROPOSAL_LENGTH).describe("Proposal text to vote on"),
6348
+ threshold: z9.enum(["majority", "supermajority", "unanimous"]).optional().describe("Voting threshold (legacy). Use strategy instead."),
6491
6349
  strategy: VotingStrategySchema.optional().describe(
6492
6350
  "Voting strategy: simple_majority (default), supermajority, unanimous, proof_of_learning, or higher_order"
6493
6351
  ),
6494
- quickMode: z10.boolean().optional().default(false).describe("Use 3 agents instead of 7"),
6495
- simulateVotes: z10.boolean().optional().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
6352
+ quickMode: z9.boolean().optional().default(false).describe("Use 3 agents instead of 7"),
6353
+ simulateVotes: z9.boolean().optional().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
6496
6354
  };
6497
6355
  const description = "Execute multi-model consensus voting on a proposal. Uses 7 specialized agent roles (architect, security, devex, ai_ml, pm, catfish, scope_steward) to vote on proposals with configurable strategies. Supports higher_order strategy for Bayesian-optimal aggregation with correlation awareness (Issue #514).";
6498
6356
  const secureHandler = createSecureHandler(createConsensusVoteHandler(depsWithNotifier), {
@@ -6546,18 +6404,6 @@ export {
6546
6404
  VOTER_ROLES,
6547
6405
  NoAdapterError,
6548
6406
  collectRealVotes,
6549
- ConsensusAlgorithmSchema,
6550
- ProposalStatusSchema,
6551
- RejectionCategorySchema,
6552
- REJECTION_CATEGORIES,
6553
- VoteSchema,
6554
- ProposalSchema,
6555
- ConsensusResultSchema,
6556
- AgentPerformanceSchema,
6557
- ConsensusEngineConfigSchema,
6558
- DEFAULT_CONSENSUS_CONFIG,
6559
- VOTING_THRESHOLDS,
6560
- ConsensusMetricsSchema,
6561
6407
  VotingRoundPhaseSchema,
6562
6408
  VotingRoundStatusSchema,
6563
6409
  AgentFindingSchema,
@@ -6611,4 +6457,4 @@ export {
6611
6457
  CONSENSUS_VOTE_OUTPUT_SCHEMA,
6612
6458
  registerConsensusVoteTool
6613
6459
  };
6614
- //# sourceMappingURL=chunk-GJ47JWNS.js.map
6460
+ //# sourceMappingURL=chunk-5KBR7SYI.js.map