@productbrain/mcp 0.0.1-beta.13220 → 0.0.1-beta.13225

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.
@@ -1475,22 +1475,6 @@ Use \`context action=get\` to inspect the existing entry, or \`entries action=up
1475
1475
  return toolResult;
1476
1476
  }
1477
1477
 
1478
- // src/tools/conflict-preflight.ts
1479
- async function runConflictPreflight(name, description, collectionHint, subjectId) {
1480
- try {
1481
- const conflicts = await kernelQuery("chain.detectSemanticConflicts", {
1482
- name,
1483
- description,
1484
- ...collectionHint ? { collectionHint } : {},
1485
- ...subjectId ? { subjectId } : {}
1486
- });
1487
- return { conflicts: conflicts ?? [] };
1488
- } catch (err) {
1489
- console.error("[conflict-preflight] Semantic conflict detection unavailable:", err instanceof Error ? err.message : String(err));
1490
- return { conflicts: [] };
1491
- }
1492
- }
1493
-
1494
1478
  // src/lib/judgeWait.ts
1495
1479
  var JUDGE_TIMEOUT_MS = 3e4;
1496
1480
  var JUDGE_CALLS_PER_RUN = 1;
@@ -1521,10 +1505,6 @@ async function settleVerdictBeforeAccept(evaluate, readLatest, opts = {}) {
1521
1505
  await sleep(POLL_MS);
1522
1506
  }
1523
1507
  }
1524
- function judgedAcceptedLine(wait) {
1525
- if (!wait?.judged) return null;
1526
- return `Judged in ${Math.max(1, Math.round(wait.waitedMs / 1e3))} s, accepted.`;
1527
- }
1528
1508
 
1529
1509
  // src/tools/knowledge/updateEntryAppliedFields.ts
1530
1510
  function computeUpdateEntryAppliedFields(args, normalization, provenanceApplied = {}, revertedFields = []) {
@@ -1823,36 +1803,10 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1823
1803
  if (!entry) {
1824
1804
  return notFoundResult(entryId, `Entry '${entryId}' not found. Try search to find the right ID.`);
1825
1805
  }
1826
- const descField = readEntryBody(entry.data, "description") ?? readEntryBody(entry.data, "why") ?? readEntryBody(entry.data, "rationale") ?? readEntryBody(entry.data, "canonical") ?? "";
1827
- const preflight = await runConflictPreflight(
1828
- entry.name,
1829
- descField,
1830
- entry.collectionSlug ?? entry.collection?.slug ?? entry.collection?.name,
1831
- entry.entryId
1832
- // TASK-938: the reason names this entry
1833
- );
1834
- const advisoryWarnings = preflight.conflicts.map((conflict) => ({
1835
- entryId: conflict.chainEntryId,
1836
- name: conflict.chainEntryName,
1837
- explanation: conflict.explanation
1838
- }));
1839
- if (advisoryWarnings.length > 0) {
1840
- await recordSessionActivity({ contradictionWarning: true });
1841
- }
1842
- const conflictEvidence = preflight.conflicts.map((c) => ({
1843
- chainEntryId: c.chainEntryId,
1844
- chainEntryName: c.chainEntryName,
1845
- ...c.chainEntryDescription ? { chainEntryDescription: c.chainEntryDescription } : {},
1846
- type: c.type,
1847
- confidence: c.confidence,
1848
- explanation: c.explanation
1849
- }));
1850
- const judgeWait = preview ? null : await settleVerdictBeforeAccept(
1851
- () => kernelMutation("quality.evaluateHeuristicAndSchedule", { entryId, context: "commit" }),
1852
- () => kernelQuery("quality.getLatestVerdictForEntry", { entryId })
1853
- );
1854
- const stored = judgeWait?.latest?.verdict;
1855
- const coachingResult = stored ? { verdict: stored, source: stored.source } : judgeWait?.evaluation ?? null;
1806
+ const coachingResult = preview ? null : await kernelMutation(
1807
+ "quality.evaluateHeuristicAndSchedule",
1808
+ { entryId, context: "commit" }
1809
+ ).catch(() => null);
1856
1810
  const result2 = await kernelMutation("chain.commitEntry", {
1857
1811
  entryId,
1858
1812
  author: getAgentSessionId() ? `agent:${getAgentSessionId()}` : void 0,
@@ -1862,7 +1816,6 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1862
1816
  ...qualityOverrideReason ? { qualityOverrideReason } : {},
1863
1817
  // TASK-954
1864
1818
  ...coherencyAcknowledgement ? { coherencyAcknowledgement } : {},
1865
- ...conflictEvidence.length > 0 ? { conflicts: conflictEvidence } : {},
1866
1819
  ...replaces ? { replaces, ...reason !== void 0 ? { replacesReason: reason } : {} } : {}
1867
1820
  // TASK-1030; DEC-2006: the reason rides with it
1868
1821
  }).catch((err) => {
@@ -1890,7 +1843,9 @@ async function handleCommitEntry({ entryId, preview, steeringOverrideReason, qua
1890
1843
  wouldSetStatus: result2.wouldSetStatus,
1891
1844
  wouldBlock,
1892
1845
  ...wouldBlock && result2.blockingReason ? { blockingReason: result2.blockingReason } : {},
1893
- ...previewContradictionAdvisory ? { contradictionAdvisory: previewContradictionAdvisory } : {}
1846
+ ...previewContradictionAdvisory ? { contradictionAdvisory: previewContradictionAdvisory } : {},
1847
+ ...typeof result2.conflictCheck === "string" ? { conflictCheck: result2.conflictCheck } : {}
1848
+ // TASK-1040: as a real accept says it
1894
1849
  },
1895
1850
  [{ tool: toolName, description: "Accept for real", parameters: { action: "accept", entryId, ...replaces ? { replaces, ...reason !== void 0 ? { reason } : {} } : {} } }]
1896
1851
  // TASK-1030
@@ -1910,7 +1865,9 @@ ${previewContradictionAdvisory.conflictDetails.map((c) => `- \`${c.chainEntryId}
1910
1865
  return {
1911
1866
  content: [{ type: "text", text: `# Preview: ${entryId} ${previewVerdict}
1912
1867
 
1913
- Current status: \`${result2.currentStatus}\`${wouldBlock ? "" : ` \u2192 would become \`${result2.wouldSetStatus}\``}.${blockingNote}${advisoryNote}
1868
+ Current status: \`${result2.currentStatus}\`${wouldBlock ? "" : ` \u2192 would become \`${result2.wouldSetStatus}\``}.${blockingNote}${advisoryNote}${typeof result2.conflictCheck === "string" ? `
1869
+
1870
+ ${result2.conflictCheck}` : ""}
1914
1871
 
1915
1872
  No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1916
1873
  structuredContent: previewEnvelope
@@ -1919,10 +1876,8 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1919
1876
  const docId = result2?._id ?? entry._id;
1920
1877
  const wsCtx = await getWorkspaceContext();
1921
1878
  await recordSessionActivity({ entryModified: docId });
1922
- const judged = judgedAcceptedLine(judgeWait);
1923
1879
  const lines = [
1924
1880
  `# Accepted: ${entryId}`,
1925
- ...judged ? [judged] : [],
1926
1881
  `**${entry.name}** accepted onto the Chain.`,
1927
1882
  `**Workspace:** ${wsCtx.workspaceSlug} (${wsCtx.workspaceId})`
1928
1883
  ];
@@ -1932,9 +1887,15 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1932
1887
  lines.push("");
1933
1888
  lines.push(`_Auto-verified as part of this accept \u2014 ${autoVerified.strength}${who}._`);
1934
1889
  }
1890
+ const advisoryWarnings = (Array.isArray(result2?.conflicts) ? result2.conflicts : []).map((conflict) => ({
1891
+ entryId: conflict.chainEntryId,
1892
+ name: conflict.chainEntryName,
1893
+ explanation: conflict.explanation
1894
+ }));
1935
1895
  if (advisoryWarnings.length > 0) {
1896
+ await recordSessionActivity({ contradictionWarning: true });
1936
1897
  lines.push("");
1937
- lines.push("\u26A0 Semantic conflict preflight: advisory conflict(s) found.");
1898
+ lines.push("\u26A0 Stored conflict check: advisory conflict(s) found.");
1938
1899
  for (const w of advisoryWarnings) {
1939
1900
  lines.push(`- ${w.name} (${w.entryId}) \u2014 ${w.explanation}`);
1940
1901
  }
@@ -1971,6 +1932,8 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
1971
1932
  lines.push(`- \`${c.chainEntryId}\` ${c.chainEntryName}: ${c.explanation}`);
1972
1933
  }
1973
1934
  }
1935
+ const conflictCheck = typeof result2?.conflictCheck === "string" && result2.conflictCheck ? result2.conflictCheck : void 0;
1936
+ if (conflictCheck) lines.push("", conflictCheck);
1974
1937
  const publishAdvisories = Array.isArray(result2?.publishAdvisories) ? result2.publishAdvisories.filter((a) => typeof a === "string") : void 0;
1975
1938
  if (publishAdvisories && publishAdvisories.length > 0) {
1976
1939
  lines.push("");
@@ -2013,9 +1976,9 @@ No DB writes \u2014 call without \`preview:true\` to accept for real.` }],
2013
1976
  outcome: "committed",
2014
1977
  qualityVerdict: coachingResult?.verdict ?? void 0,
2015
1978
  source: coachingResult?.source ?? void 0,
2016
- ...judgeWait?.judged ? { judgedInMs: judgeWait.waitedMs } : {},
2017
- // TASK-612
2018
1979
  contradictions: advisoryWarnings.length,
1980
+ ...conflictCheck ? { conflictCheck } : {},
1981
+ // TASK-1040
2019
1982
  ...epistemic ? { epistemicStatus: epistemic } : {},
2020
1983
  ...steeringAdvisory ? { steeringAdvisory } : {},
2021
1984
  ...heldFlag ? { heldFlag, ...heldReason ? { heldReason } : {} } : {},
@@ -12039,4 +12002,4 @@ export {
12039
12002
  SERVER_VERSION,
12040
12003
  createProductBrainServer
12041
12004
  };
12042
- //# sourceMappingURL=chunk-NSKSK6LK.js.map
12005
+ //# sourceMappingURL=chunk-I2JXAGTV.js.map