nexus-agents 8.30.0 → 8.31.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.
@@ -23,10 +23,10 @@ import {
23
23
  toolSuccessStructured,
24
24
  withProgressHeartbeat,
25
25
  wrapToolWithTimeout
26
- } from "./chunk-GG6OKZY4.js";
26
+ } from "./chunk-42LDWYPF.js";
27
27
  import {
28
28
  VERSION
29
- } from "./chunk-ZON73IQM.js";
29
+ } from "./chunk-PF452UB3.js";
30
30
  import {
31
31
  assessPanelIndependence,
32
32
  countDistinctModels,
@@ -5129,10 +5129,33 @@ var VoteRecordPanelCoverageSchema = z7.object({
5129
5129
  /** The roles behind `errored`, in panel order. */
5130
5130
  erroredRoles: z7.array(z7.string().min(1).max(100))
5131
5131
  }).strict();
5132
+ var MAX_VOTER_REASONING_CHARS = 2e4;
5132
5133
  var VoterSummarySchema = z7.object({
5133
5134
  role: z7.string().min(1).max(100),
5134
5135
  decision: z7.enum(["approve", "reject", "abstain"]),
5135
- confidence: z7.number().min(0).max(1)
5136
+ confidence: z7.number().min(0).max(1),
5137
+ /**
5138
+ * The voter's stated grounds (#5373, schema 1.6).
5139
+ *
5140
+ * `generateVoteHash` already hashed `{role, decision, reasoning}` and then
5141
+ * discarded the text, so the chain attested to a value it did not store and
5142
+ * nobody could re-verify the hash without re-obtaining the reasoning. On
5143
+ * #5228 a contrarian rejection was clipped mid-sentence in the terminal, the
5144
+ * grounds were unrecoverable, and the same defect resurfaced a round later —
5145
+ * one round of a 7-voter panel is 7-13 minutes of model time, and the
5146
+ * objection was right both times.
5147
+ *
5148
+ * Stored whole rather than sampled. Warn-mode near-misses are emitted per
5149
+ * TOOL CALL, thousands a day; votes are emitted per PANEL, dozens a day at
5150
+ * most, so ~17 KB per vote is not the same growth problem.
5151
+ *
5152
+ * Absence is not an empty argument: an errored voter has no entry in
5153
+ * `voters` at all (see `panelCoverage`), so `reasoning: ''` means a live
5154
+ * voter returned nothing, which is itself a signal.
5155
+ */
5156
+ reasoning: z7.string().max(MAX_VOTER_REASONING_CHARS).optional(),
5157
+ /** True when `reasoning` was clipped to {@link MAX_VOTER_REASONING_CHARS}. */
5158
+ reasoningTruncated: z7.literal(true).optional()
5136
5159
  }).strict();
5137
5160
  var VoteRecordCountsSchema = z7.object({
5138
5161
  approve: z7.number().int().nonnegative(),
@@ -5154,7 +5177,7 @@ var VoteRecordSchema = z7.object({
5154
5177
  * `ratifies` is folded into the self-hash ONLY when present (see
5155
5178
  * {@link computeVoteRecordHash}).
5156
5179
  */
5157
- version: z7.enum(["1.1", "1.2", "1.3", "1.4", "1.5"]),
5180
+ version: z7.enum(["1.1", "1.2", "1.3", "1.4", "1.5", "1.6"]),
5158
5181
  /** Unique record id (also usable as a `ratificationVoteRef`). */
5159
5182
  id: z7.string().min(1),
5160
5183
  /**
@@ -5286,10 +5309,17 @@ function computeVoteRecordHash(payload) {
5286
5309
  abstain: payload.voteCounts.abstain,
5287
5310
  total: payload.voteCounts.total
5288
5311
  },
5312
+ // `reasoning` / `reasoningTruncated` (#5373, schema 1.6) are appended per
5313
+ // entry ONLY when present, on the same rule as the record-level optional
5314
+ // fields: a pre-1.6 voter entry re-hashes byte-identical, so every
5315
+ // historical record still verifies, while editing or removing a stored
5316
+ // reasoning flips the hash.
5289
5317
  voters: payload.voters.map((v) => ({
5290
5318
  role: v.role,
5291
5319
  decision: v.decision,
5292
- confidence: v.confidence
5320
+ confidence: v.confidence,
5321
+ ...v.reasoning !== void 0 ? { reasoning: v.reasoning } : {},
5322
+ ...v.reasoningTruncated === true ? { reasoningTruncated: true } : {}
5293
5323
  })),
5294
5324
  correlationId: payload.correlationId ?? null
5295
5325
  };
@@ -5321,10 +5351,22 @@ function toVoterSummaries(votes) {
5321
5351
  for (const v of votes) {
5322
5352
  if (v.source === "error") continue;
5323
5353
  const vote = v.vote;
5324
- summaries.push({ role: v.role, decision: vote.decision, confidence: vote.confidence });
5354
+ summaries.push({
5355
+ role: v.role,
5356
+ decision: vote.decision,
5357
+ confidence: vote.confidence,
5358
+ ...reasoningFields(vote.reasoning)
5359
+ });
5325
5360
  }
5326
5361
  return summaries;
5327
5362
  }
5363
+ function reasoningFields(reasoning) {
5364
+ if (reasoning.length <= MAX_VOTER_REASONING_CHARS) return { reasoning };
5365
+ return {
5366
+ reasoning: reasoning.slice(0, MAX_VOTER_REASONING_CHARS),
5367
+ reasoningTruncated: true
5368
+ };
5369
+ }
5328
5370
  function recordDecisionFor(input) {
5329
5371
  return input.resolvedDecision ?? outcomeToDecision(input.result, input.votes, input.errorVoided ?? false);
5330
5372
  }
@@ -5335,7 +5377,8 @@ function deriveOptionFields(votes) {
5335
5377
  optionCoverage: optionTally === void 0 ? void 0 : coverageOf(votes)
5336
5378
  };
5337
5379
  }
5338
- function recordVersion(optionTally, optionCoverage, panelCoverage) {
5380
+ function recordVersion(optionTally, optionCoverage, panelCoverage, voters) {
5381
+ if (voters.some((v) => v.reasoning !== void 0)) return "1.6";
5339
5382
  if (panelCoverage !== void 0) return "1.5";
5340
5383
  if (optionCoverage !== void 0) return "1.4";
5341
5384
  return optionTally !== void 0 ? "1.3" : "1.2";
@@ -5373,8 +5416,9 @@ function buildVoteRecord(input) {
5373
5416
  const proposalTruncated = input.proposal.length > MAX_PROPOSAL_RECORD_CHARS ? input.proposal.slice(0, MAX_PROPOSAL_RECORD_CHARS) + "..." : input.proposal;
5374
5417
  const { optionTally, optionCoverage } = deriveOptionFields(input.votes);
5375
5418
  const panelCoverage = panelCoverageOf(input.votes);
5419
+ const voters = toVoterSummaries(input.votes);
5376
5420
  const payload = {
5377
- version: recordVersion(optionTally, optionCoverage, panelCoverage),
5421
+ version: recordVersion(optionTally, optionCoverage, panelCoverage, voters),
5378
5422
  id: input.id,
5379
5423
  sequence: input.sequence ?? 0,
5380
5424
  recordedAt: input.recordedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -5389,7 +5433,7 @@ function buildVoteRecord(input) {
5389
5433
  abstain: input.result.voteCounts.abstain,
5390
5434
  total: input.result.voteCounts.total
5391
5435
  },
5392
- voters: toVoterSummaries(input.votes),
5436
+ voters,
5393
5437
  ...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {},
5394
5438
  ...input.ratifies !== void 0 ? { ratifies: input.ratifies } : {},
5395
5439
  ...optionTally !== void 0 ? { optionTally } : {},
@@ -7762,4 +7806,4 @@ export {
7762
7806
  CONSENSUS_VOTE_TOOL_SCHEMA,
7763
7807
  registerConsensusVoteTool
7764
7808
  };
7765
- //# sourceMappingURL=chunk-ILBCNOV6.js.map
7809
+ //# sourceMappingURL=chunk-3ZVZXXRY.js.map