@productbrain/mcp 0.0.1-beta.14012 → 0.0.1-beta.14018

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.
@@ -1133,8 +1133,8 @@ var captureSuccessOutputSchema = z5.object({
1133
1133
  nextTo: z5.string().optional()
1134
1134
  }).optional(),
1135
1135
  // TASK-1164: the kernel's line about the rung above, and the Next's target
1136
- // WP-751 M3a-1b (TASK-189, DEC-1700): `coherencyRefusal` and `contradictionAdvisory` are deleted with the
1137
- // client-side auto-commit attempt that alone populated them (its gate refusal, the commit's advisory).
1136
+ possibleClashes: z5.array(z5.string()).optional(),
1137
+ // TASK-1553: the draft's open possible clashes, as the kernel worded them
1138
1138
  replayed: z5.literal(true).optional(),
1139
1139
  // TASK-898: a re-sent capture answered with the first capture's entry
1140
1140
  // TASK-897: the kernel's outcome per link, on a create and on a replay.
@@ -1248,6 +1248,7 @@ ${context.trim()}` : description;
1248
1248
  let coachingFromCreate;
1249
1249
  let wasAutoCommittedServerSide = false;
1250
1250
  let missingFieldLines = [];
1251
+ let possibleClashes = [];
1251
1252
  let spineFloor;
1252
1253
  let linkOutcomes = [];
1253
1254
  try {
@@ -1348,6 +1349,7 @@ No DB writes \u2014 call without \`preview:true\` to capture for real.${result2.
1348
1349
  coachingFromCreate = created.coaching;
1349
1350
  linkOutcomes = created.links ?? [];
1350
1351
  missingFieldLines = created.missingFieldLines ?? [];
1352
+ possibleClashes = created.possibleClashes ?? [];
1351
1353
  const createdStatus = created.status;
1352
1354
  if (createdStatus !== void 0 && isTrustAccepted(createdStatus)) wasAutoCommittedServerSide = true;
1353
1355
  spineFloor = created.spineFloor;
@@ -1411,7 +1413,7 @@ Use \`context action=get\` to inspect the existing entry, or \`entries action=up
1411
1413
  lines.push("");
1412
1414
  lines.push(`## Accepted: ${finalEntryId}`);
1413
1415
  lines.push(`**${name}** added to your knowledge base.`);
1414
- } else lines.push(...draftReplyLines(name, finalEntryId, spineFloor, missingFieldLines));
1416
+ } else lines.push(...draftReplyLines(name, finalEntryId, spineFloor, missingFieldLines), ...possibleClashes.length ? ["", ...possibleClashes] : []);
1415
1417
  if (groundingCaveat) lines.push("", groundingCaveat);
1416
1418
  const named = groundingReport.duplicates.slice(0, 3).map((d) => `${d.entryId} "${d.name}"`).join(", ");
1417
1419
  if (named) lines.push("", `**Possible match:** ${named}. Nothing was written to it; to change it, use \`entries action=update\`.`);
@@ -1500,7 +1502,8 @@ Use \`context action=get\` to inspect the existing entry, or \`entries action=up
1500
1502
  // WP-745 TASK-160 (PR #901 review): the machine-readable projection — was reaching the human text only.
1501
1503
  ...spineFloor && { spineFloor },
1502
1504
  ...linkOutcomes.length > 0 && { links: linkOutcomes },
1503
- // TASK-897
1505
+ ...possibleClashes.length > 0 && { possibleClashes },
1506
+ // TASK-897; TASK-1553
1504
1507
  // WP-318 S2: the possible-duplicate report — always included (empty when no ask match)
1505
1508
  groundingReport
1506
1509
  },
@@ -1836,6 +1839,7 @@ ${mcp}`, "QUALITY_HELD", mcp.split("\n")[0] ?? mcp, mcp.split("\n")[1] ?? mcp, v
1836
1839
  }, next)
1837
1840
  };
1838
1841
  }
1842
+ var possibleClashesOf = (result2) => Array.isArray(result2?.possibleClashes) ? result2.possibleClashes.filter((line) => typeof line === "string") : [];
1839
1843
  async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qualityOverrideReason, coherencyAcknowledgement, replaces, reason: reason2 }, toolName = "entries") {
1840
1844
  requireWriteAccess();
1841
1845
  const entry = await kernelQuery("chain.getEntry", { entryId });
@@ -1870,7 +1874,7 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1870
1874
  }
1871
1875
  if (result2?.preview) {
1872
1876
  const wouldBlock = result2.wouldBlock === true;
1873
- const previewContradictionAdvisory = result2?.contradictionAdvisory;
1877
+ const previewClashes = possibleClashesOf(result2);
1874
1878
  const previewVerdict = wouldBlock ? LINK_REFUSAL_WORDS.wouldBeRefused.toLowerCase() : LINK_REFUSAL_WORDS.wouldBeAccepted.toLowerCase();
1875
1879
  const previewEnvelope = success(
1876
1880
  `Preview: ${entryId} ${previewVerdict} \u2014 no DB writes`,
@@ -1882,7 +1886,7 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1882
1886
  wouldSetStatus: result2.wouldSetStatus,
1883
1887
  wouldBlock,
1884
1888
  ...wouldBlock && result2.blockingReason ? { blockingReason: result2.blockingReason } : {},
1885
- ...previewContradictionAdvisory ? { contradictionAdvisory: previewContradictionAdvisory } : {},
1889
+ ...previewClashes.length ? { possibleClashes: previewClashes } : {},
1886
1890
  ...typeof result2.conflictCheck === "string" ? { conflictCheck: result2.conflictCheck } : {}
1887
1891
  // TASK-1040: as a real accept says it
1888
1892
  },
@@ -1897,10 +1901,9 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1897
1901
  **${LINK_REFUSAL_WORDS.wouldBeRefused}:** ${result2.blockingReason}` : wouldBlock ? `
1898
1902
 
1899
1903
  **${LINK_REFUSAL_WORDS.wouldBeRefused}** on a real accept.` : "";
1900
- const advisoryNote = previewContradictionAdvisory ? `
1904
+ const advisoryNote = previewClashes.length ? `
1901
1905
 
1902
- \u26A0 Contradiction advisory (would be attached on a real accept): ${previewContradictionAdvisory.reason}
1903
- ${previewContradictionAdvisory.conflictDetails.map((c) => `- \`${c.chainEntryId}\` ${c.chainEntryName}: ${c.explanation}`).join("\n")}` : "";
1906
+ ${previewClashes.join("\n")}` : "";
1904
1907
  return {
1905
1908
  content: [{ type: "text", text: `# Preview: ${entryId} ${previewVerdict}
1906
1909
 
@@ -1926,22 +1929,8 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1926
1929
  lines.push("");
1927
1930
  lines.push(`_Auto-verified as part of this accept \u2014 ${autoVerified.strength}${who}._`);
1928
1931
  }
1929
- const advisoryWarnings = (Array.isArray(result2?.conflicts) ? result2.conflicts : []).map((conflict) => ({
1930
- entryId: conflict.chainEntryId,
1931
- name: conflict.chainEntryName,
1932
- explanation: conflict.explanation
1933
- }));
1934
- if (advisoryWarnings.length > 0) {
1935
- await recordSessionActivity({ contradictionWarning: true });
1936
- lines.push("");
1937
- lines.push("\u26A0 Stored conflict check: advisory conflict(s) found.");
1938
- for (const w of advisoryWarnings) {
1939
- lines.push(`- ${w.name} (${w.entryId}) \u2014 ${w.explanation}`);
1940
- }
1941
- lines.push(
1942
- "Run context action=gather on the conflicting entries to review; use entries action=update to reconcile the two, or to mark this entry status='archived' if it's actually superseded."
1943
- );
1944
- }
1932
+ const conflictCount = Array.isArray(result2?.conflicts) ? result2.conflicts.length : 0;
1933
+ if (conflictCount > 0) await recordSessionActivity({ contradictionWarning: true });
1945
1934
  if (coachingResult?.verdict && coachingResult.verdict.tier !== "passive" && coachingResult.verdict.criteria.length > 0) {
1946
1935
  const coaching = formatRubricCoaching(coachingResult);
1947
1936
  if (coaching) {
@@ -1963,14 +1952,8 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1963
1952
  lines.push("");
1964
1953
  lines.push(`\u26A0 ${steeringAdvisory}`);
1965
1954
  }
1966
- const contradictionAdvisory = result2?.contradictionAdvisory;
1967
- if (contradictionAdvisory) {
1968
- lines.push("");
1969
- lines.push(`\u26A0 Contradiction advisory (entry accepted): ${contradictionAdvisory.reason}`);
1970
- for (const c of contradictionAdvisory.conflictDetails) {
1971
- lines.push(`- \`${c.chainEntryId}\` ${c.chainEntryName}: ${c.explanation}`);
1972
- }
1973
- }
1955
+ const possibleClashes = possibleClashesOf(result2);
1956
+ if (possibleClashes.length) lines.push("", ...possibleClashes);
1974
1957
  const conflictCheck = typeof result2?.conflictCheck === "string" && result2.conflictCheck ? result2.conflictCheck : void 0;
1975
1958
  if (conflictCheck) lines.push("", conflictCheck);
1976
1959
  const publishAdvisories = Array.isArray(result2?.publishAdvisories) ? result2.publishAdvisories.filter((a) => typeof a === "string") : void 0;
@@ -2015,7 +1998,7 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
2015
1998
  outcome: "committed",
2016
1999
  qualityVerdict: coachingResult?.verdict ?? void 0,
2017
2000
  source: coachingResult?.source ?? void 0,
2018
- contradictions: advisoryWarnings.length,
2001
+ contradictions: conflictCount,
2019
2002
  ...conflictCheck ? { conflictCheck } : {},
2020
2003
  // TASK-1040
2021
2004
  ...epistemic ? { epistemicStatus: epistemic } : {},
@@ -2023,9 +2006,8 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
2023
2006
  ...heldFlag ? { heldFlag, ...heldReason ? { heldReason } : {} } : {},
2024
2007
  ...overlap ? { overlap } : {},
2025
2008
  // TASK-1159; TASK-1325
2026
- // WP-485 Slice 2b round 2 (Codex P1, FEAT-1370): mirror the server's contradiction
2027
- // advisory into the structured payload so --json/agent consumers see it too.
2028
- ...contradictionAdvisory ? { contradictionAdvisory } : {},
2009
+ ...possibleClashes.length ? { possibleClashes } : {},
2010
+ // TASK-1553: for agents that read the data, not the text
2029
2011
  // WP-582 B1 (FEAT-1403): mirror the direction-trace advisory into the structured payload.
2030
2012
  ...publishAdvisories && publishAdvisories.length > 0 ? { publishAdvisories } : {},
2031
2013
  // WP-B (attestation spec §4.3): mirror the auto-verify receipt into the
@@ -12140,4 +12122,4 @@ export {
12140
12122
  SERVER_VERSION,
12141
12123
  createProductBrainServer
12142
12124
  };
12143
- //# sourceMappingURL=chunk-OA64RKYJ.js.map
12125
+ //# sourceMappingURL=chunk-E4I3ZNSP.js.map