nexus-agents 8.28.9 → 8.29.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-OQCVMQVW.js";
26
+ } from "./chunk-MEN32VJC.js";
27
27
  import {
28
28
  VERSION
29
- } from "./chunk-QIWQU3CB.js";
29
+ } from "./chunk-JW5IATB3.js";
30
30
  import {
31
31
  assessPanelIndependence,
32
32
  countDistinctModels,
@@ -5079,6 +5079,16 @@ var VoteRecordOptionCoverageSchema = z7.object({
5079
5079
  /** Approvers with no usable selection; their choice is unmeasured. */
5080
5080
  unattributedApprovals: z7.number().int().nonnegative()
5081
5081
  }).strict();
5082
+ var VoteRecordPanelCoverageSchema = z7.object({
5083
+ /** Voters the panel asked for. */
5084
+ requested: z7.number().int().nonnegative(),
5085
+ /** Voters that returned a usable vote — the denominator of `voteCounts`. */
5086
+ responded: z7.number().int().nonnegative(),
5087
+ /** Voters that errored or timed out. */
5088
+ errored: z7.number().int().nonnegative(),
5089
+ /** The roles behind `errored`, in panel order. */
5090
+ erroredRoles: z7.array(z7.string().min(1).max(100))
5091
+ }).strict();
5082
5092
  var VoterSummarySchema = z7.object({
5083
5093
  role: z7.string().min(1).max(100),
5084
5094
  decision: z7.enum(["approve", "reject", "abstain"]),
@@ -5104,7 +5114,7 @@ var VoteRecordSchema = z7.object({
5104
5114
  * `ratifies` is folded into the self-hash ONLY when present (see
5105
5115
  * {@link computeVoteRecordHash}).
5106
5116
  */
5107
- version: z7.enum(["1.1", "1.2", "1.3", "1.4"]),
5117
+ version: z7.enum(["1.1", "1.2", "1.3", "1.4", "1.5"]),
5108
5118
  /** Unique record id (also usable as a `ratificationVoteRef`). */
5109
5119
  id: z7.string().min(1),
5110
5120
  /**
@@ -5168,6 +5178,12 @@ var VoteRecordSchema = z7.object({
5168
5178
  * voter attached to adopting the "credit no option" rule.
5169
5179
  */
5170
5180
  optionCoverage: VoteRecordOptionCoverageSchema.optional(),
5181
+ /**
5182
+ * Panel coverage (#5738, schema 1.5). Present only when at least one
5183
+ * requested voter failed to return a vote; absent keeps a clean panel on
5184
+ * the pre-1.5 projection, so every historical record still verifies.
5185
+ */
5186
+ panelCoverage: VoteRecordPanelCoverageSchema.optional(),
5171
5187
  /**
5172
5188
  * The loop/strategy subject this vote RATIFIES (#3927 item 1). Present only on
5173
5189
  * a ratification vote; set at vote time and bound into the self-hash (so it is
@@ -5187,6 +5203,30 @@ var VoteRecordSchema = z7.object({
5187
5203
  /** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
5188
5204
  hash: z7.string().length(64)
5189
5205
  }).strict();
5206
+ function foldOptionalFields(base, payload) {
5207
+ const withTally = payload.optionTally !== void 0 ? {
5208
+ ...base,
5209
+ optionTally: payload.optionTally.map((o) => ({ option: o.option, count: o.count }))
5210
+ } : base;
5211
+ const withCoverage = payload.optionCoverage !== void 0 ? {
5212
+ ...withTally,
5213
+ optionCoverage: {
5214
+ approverCount: payload.optionCoverage.approverCount,
5215
+ selectedCount: payload.optionCoverage.selectedCount,
5216
+ unattributedApprovals: payload.optionCoverage.unattributedApprovals
5217
+ }
5218
+ } : withTally;
5219
+ const withPanel = payload.panelCoverage !== void 0 ? {
5220
+ ...withCoverage,
5221
+ panelCoverage: {
5222
+ requested: payload.panelCoverage.requested,
5223
+ responded: payload.panelCoverage.responded,
5224
+ errored: payload.panelCoverage.errored,
5225
+ erroredRoles: [...payload.panelCoverage.erroredRoles]
5226
+ }
5227
+ } : withCoverage;
5228
+ return payload.ratifies !== void 0 ? { ...withPanel, ratifies: payload.ratifies } : withPanel;
5229
+ }
5190
5230
  function computeVoteRecordHash(payload) {
5191
5231
  const base = {
5192
5232
  version: payload.version,
@@ -5213,21 +5253,7 @@ function computeVoteRecordHash(payload) {
5213
5253
  })),
5214
5254
  correlationId: payload.correlationId ?? null
5215
5255
  };
5216
- const withTally = payload.optionTally !== void 0 ? {
5217
- ...base,
5218
- optionTally: payload.optionTally.map((o) => ({ option: o.option, count: o.count }))
5219
- } : base;
5220
- const withCoverage = payload.optionCoverage !== void 0 ? {
5221
- ...withTally,
5222
- optionCoverage: {
5223
- approverCount: payload.optionCoverage.approverCount,
5224
- selectedCount: payload.optionCoverage.selectedCount,
5225
- unattributedApprovals: payload.optionCoverage.unattributedApprovals
5226
- }
5227
- } : withTally;
5228
- const canonical = JSON.stringify(
5229
- payload.ratifies !== void 0 ? { ...withCoverage, ratifies: payload.ratifies } : withCoverage
5230
- );
5256
+ const canonical = JSON.stringify(foldOptionalFields(base, payload));
5231
5257
  return crypto.createHash("sha256").update(canonical).digest("hex");
5232
5258
  }
5233
5259
  function hashProposal(proposal) {
@@ -5269,10 +5295,21 @@ function deriveOptionFields(votes) {
5269
5295
  optionCoverage: optionTally === void 0 ? void 0 : coverageOf(votes)
5270
5296
  };
5271
5297
  }
5272
- function recordVersion(optionTally, optionCoverage) {
5298
+ function recordVersion(optionTally, optionCoverage, panelCoverage) {
5299
+ if (panelCoverage !== void 0) return "1.5";
5273
5300
  if (optionCoverage !== void 0) return "1.4";
5274
5301
  return optionTally !== void 0 ? "1.3" : "1.2";
5275
5302
  }
5303
+ function panelCoverageOf(votes) {
5304
+ const erroredRoles = votes.filter((v) => v.source === "error").map((v) => v.role);
5305
+ if (erroredRoles.length === 0) return void 0;
5306
+ return {
5307
+ requested: votes.length,
5308
+ responded: votes.length - erroredRoles.length,
5309
+ errored: erroredRoles.length,
5310
+ erroredRoles
5311
+ };
5312
+ }
5276
5313
  function coverageOf(votes) {
5277
5314
  const approvers = votes.filter((v) => v.vote.decision === "approve");
5278
5315
  const selectedCount = approvers.filter((v) => v.selectedOption !== void 0).length;
@@ -5295,8 +5332,9 @@ function tallySelectedOptions(votes) {
5295
5332
  function buildVoteRecord(input) {
5296
5333
  const proposalTruncated = input.proposal.length > MAX_PROPOSAL_RECORD_CHARS ? input.proposal.slice(0, MAX_PROPOSAL_RECORD_CHARS) + "..." : input.proposal;
5297
5334
  const { optionTally, optionCoverage } = deriveOptionFields(input.votes);
5335
+ const panelCoverage = panelCoverageOf(input.votes);
5298
5336
  const payload = {
5299
- version: recordVersion(optionTally, optionCoverage),
5337
+ version: recordVersion(optionTally, optionCoverage, panelCoverage),
5300
5338
  id: input.id,
5301
5339
  sequence: input.sequence ?? 0,
5302
5340
  recordedAt: input.recordedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -5316,6 +5354,7 @@ function buildVoteRecord(input) {
5316
5354
  ...input.ratifies !== void 0 ? { ratifies: input.ratifies } : {},
5317
5355
  ...optionTally !== void 0 ? { optionTally } : {},
5318
5356
  ...optionCoverage !== void 0 ? { optionCoverage } : {},
5357
+ ...panelCoverage !== void 0 ? { panelCoverage } : {},
5319
5358
  ...input.previousHash !== void 0 ? { previousHash: input.previousHash } : {}
5320
5359
  };
5321
5360
  return { ...payload, hash: computeVoteRecordHash(payload) };
@@ -7683,4 +7722,4 @@ export {
7683
7722
  CONSENSUS_VOTE_TOOL_SCHEMA,
7684
7723
  registerConsensusVoteTool
7685
7724
  };
7686
- //# sourceMappingURL=chunk-MU374IAT.js.map
7725
+ //# sourceMappingURL=chunk-6RNUX5RK.js.map