nexus-agents 2.118.0 → 2.119.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.
@@ -8,7 +8,7 @@ import {
8
8
  checkSqlite,
9
9
  defaultConfig,
10
10
  initDataDirectories
11
- } from "./chunk-VPWMPJYW.js";
11
+ } from "./chunk-WGVRUD3L.js";
12
12
  import {
13
13
  probeAllClis
14
14
  } from "./chunk-ONSYPTQV.js";
@@ -1987,4 +1987,4 @@ export {
1987
1987
  setupCommand,
1988
1988
  setupCommandAsync
1989
1989
  };
1990
- //# sourceMappingURL=chunk-SQOLRU4Q.js.map
1990
+ //# sourceMappingURL=chunk-6M4BCY2N.js.map
@@ -115,7 +115,7 @@ import {
115
115
  DEFAULT_TASK_TTL_MS,
116
116
  DEFAULT_TOOL_RATE_LIMITS,
117
117
  clampTaskTtl
118
- } from "./chunk-VPWMPJYW.js";
118
+ } from "./chunk-WGVRUD3L.js";
119
119
  import {
120
120
  resolveInsideRoot
121
121
  } from "./chunk-NUBSJGQZ.js";
@@ -34224,6 +34224,64 @@ function registerDelegateToModelTool(server, deps) {
34224
34224
  logger56.info("Registered delegate_to_model tool with secure handler and timeout protection");
34225
34225
  }
34226
34226
 
34227
+ // src/orchestration/graph/consensus-node.ts
34228
+ async function runConsensusGate(voter, input) {
34229
+ try {
34230
+ return await voter(input);
34231
+ } catch (error) {
34232
+ const message = error instanceof Error ? error.message : String(error);
34233
+ return {
34234
+ outcome: "rejected",
34235
+ feedback: `Consensus gate failed closed (voter error): ${message}`,
34236
+ detail: { error: message }
34237
+ };
34238
+ }
34239
+ }
34240
+ function createConsensusGateNode(options) {
34241
+ return async (state) => {
34242
+ let input;
34243
+ try {
34244
+ input = options.proposalFrom(state);
34245
+ } catch (error) {
34246
+ const message = error instanceof Error ? error.message : String(error);
34247
+ return {
34248
+ [options.verdictKey]: {
34249
+ outcome: "rejected",
34250
+ feedback: `Consensus gate failed closed (proposal extraction error): ${message}`,
34251
+ detail: { error: message }
34252
+ }
34253
+ };
34254
+ }
34255
+ const verdict = await runConsensusGate(options.voter, input);
34256
+ return { [options.verdictKey]: verdict };
34257
+ };
34258
+ }
34259
+ async function runGraphWithConsensus(options) {
34260
+ const proposalKey = options.proposalKey ?? "proposal";
34261
+ const verdictKey = options.verdictKey ?? "consensusVerdict";
34262
+ const gate = createConsensusGateNode({
34263
+ voter: options.voter,
34264
+ verdictKey,
34265
+ proposalFrom: (state) => {
34266
+ const raw2 = state[proposalKey];
34267
+ return { proposal: typeof raw2 === "string" ? raw2 : "" };
34268
+ }
34269
+ });
34270
+ const compiled = new GraphBuilder().addState(proposalKey, overwrite("")).addState(verdictKey, overwrite(null)).addNode("produce", options.produce).addNode("consensus", gate).addEdge(START, "produce").addEdge("produce", "consensus").addEdge("consensus", END).compile();
34271
+ if (!compiled.ok) {
34272
+ return err(
34273
+ new Error(
34274
+ `runGraphWithConsensus: graph compile failed: ${formatCompileError(compiled.error)}`
34275
+ )
34276
+ );
34277
+ }
34278
+ const execResult = await executeGraph(compiled.value, options.initialState ?? {});
34279
+ if (!execResult.ok) return err(execResult.error);
34280
+ const raw = execResult.value.finalState[verdictKey];
34281
+ const verdict = raw ?? void 0;
34282
+ return ok({ execution: execResult.value, verdict });
34283
+ }
34284
+
34227
34285
  // src/mcp/tools/run-graph-workflow-multicli-templates.ts
34228
34286
  var SECURITY_AUDIT_ASSIGNMENTS = [
34229
34287
  { node: "threat_model", preferredCli: "claude" },
@@ -42959,6 +43017,14 @@ ${priorArt}` : research;
42959
43017
  };
42960
43018
  }
42961
43019
  function createVoteStageWrapper(stages) {
43020
+ const voter = async (input) => {
43021
+ const vote = await stages.vote(input.proposal, input.context ?? "");
43022
+ return {
43023
+ outcome: isApproved(vote) ? "approved" : "rejected",
43024
+ feedback: isApproved(vote) ? "" : getVoteFeedback(vote),
43025
+ detail: { vote }
43026
+ };
43027
+ };
42962
43028
  return {
42963
43029
  id: "vote",
42964
43030
  name: "Vote",
@@ -42966,19 +43032,14 @@ function createVoteStageWrapper(stages) {
42966
43032
  const start = getTimeProvider().now();
42967
43033
  const plan = typeof ctx.state[PIPELINE_STATE_KEYS.PLAN] === "string" ? ctx.state[PIPELINE_STATE_KEYS.PLAN] : "";
42968
43034
  const research = typeof ctx.state[PIPELINE_STATE_KEYS.RESEARCH] === "string" ? ctx.state[PIPELINE_STATE_KEYS.RESEARCH] : "";
42969
- try {
42970
- const vote = await stages.vote(plan, research);
42971
- const ms = getTimeProvider().now() - start;
42972
- const feedback = isApproved(vote) ? "" : getVoteFeedback(vote);
42973
- return {
42974
- stateKey: PIPELINE_STATE_KEYS.VOTE_RESULT,
42975
- value: { vote, feedback },
42976
- durationMs: ms,
42977
- success: isApproved(vote)
42978
- };
42979
- } catch (e) {
42980
- return failOutput(PIPELINE_STATE_KEYS.VOTE_RESULT, getErrorMessage(e), getTimeProvider().now() - start);
42981
- }
43035
+ const verdict = await runConsensusGate(voter, { proposal: plan, context: research });
43036
+ const vote = verdict.detail?.["vote"];
43037
+ return {
43038
+ stateKey: PIPELINE_STATE_KEYS.VOTE_RESULT,
43039
+ value: { vote, feedback: verdict.feedback },
43040
+ durationMs: getTimeProvider().now() - start,
43041
+ success: verdict.outcome === "approved"
43042
+ };
42982
43043
  }
42983
43044
  };
42984
43045
  }
@@ -48857,6 +48918,9 @@ export {
48857
48918
  analyzeTask,
48858
48919
  selectModel,
48859
48920
  registerDelegateToModelTool,
48921
+ runConsensusGate,
48922
+ createConsensusGateNode,
48923
+ runGraphWithConsensus,
48860
48924
  getGraphWorkflowList,
48861
48925
  getGraphRegistry,
48862
48926
  ListExpertsInputSchema,
@@ -49010,4 +49074,4 @@ export {
49010
49074
  detectBackend,
49011
49075
  createTaskTracker
49012
49076
  };
49013
- //# sourceMappingURL=chunk-N53G2GXS.js.map
49077
+ //# sourceMappingURL=chunk-I4BPTXSC.js.map